source: trunk/Mars/mtemp/mifae/macros/psffit.C@ 19824

Last change on this file since 19824 was 4073, checked in by jlopez, 21 years ago
*** empty log message ***
File size: 3.8 KB
Line 
1/* ======================================================================== *\
2!
3! *
4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
5! * Software. It is distributed to you in the hope that it can be a useful
6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
7! * It is distributed WITHOUT ANY WARRANTY.
8! *
9! * Permission to use, copy, modify and distribute this software and its
10! * documentation for any purpose is hereby granted without fee,
11! * provided that the above copyright notice appear in all copies and
12! * that both that copyright notice and this permission notice appear
13! * in supporting documentation. It is provided "as is" without express
14! * or implied warranty.
15! *
16!
17!
18! Author(s): Javier López, 04/2004 <mailto:jlopez@ifae.es>
19!
20! Copyright: MAGIC Software Development, 2000-2004
21!
22!
23\* ======================================================================== */
24
25
26Bool_t HandleInput()
27{
28 TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
29 while (1)
30 {
31 //
32 // While reading the input process gui events asynchronously
33 //
34 timer.TurnOn();
35 TString input = Getline("Type 'q' to exit, <return> to go on: ");
36 timer.TurnOff();
37
38 if (input=="q\n")
39 return kFALSE;
40
41 if (input=="\n")
42 return kTRUE;
43 };
44
45 return kFALSE;
46}
47
48
49void psffit(const TString filename="dc_2004_03_19_00_36_50_20781_Mrk421.root", const TString directory="/nfs/magic/CaCodata/rootdata/Mrk421/Period015/2004_03_19/", const UInt_t numEvents = 0)
50{
51
52 //
53 // Create a empty Parameter List and an empty Task List
54 // The tasklist is identified in the eventloop by its name
55 //
56 MParList plist;
57
58 MTaskList tlist;
59 plist.AddToList(&tlist);
60
61
62 MGeomCamMagic geomcam;
63 MCameraDC dccam;
64 MPSFFit psffit;
65
66 plist.AddToList(&geomcam);
67 plist.AddToList(&dccam);
68 plist.AddToList(&psffit);
69
70 //
71 // Now setup the tasks and tasklist:
72 // ---------------------------------
73 //
74
75 // Reads the trees of the root file and the analysed branches
76 MReadReports read;
77 read.AddTree("Currents");
78 read.AddFile(directory+filename); // after the reading of the trees!!!
79 read.AddToBranchList("MReportCurrents.*");
80
81 MGeomApply geomapl;
82
83 const Int_t numrings = 3;
84 const Int_t numblind = 23;
85 const Short_t x[numblind] = { 8, 27, 224, 279, 339,
86 507, 508, 509, 510, 511, 512, 513, 514,
87 543,
88 559, 560, 561, 562, 563, 564, 565, 566, 567};
89 const TArrayS blindpixels(numblind,(Short_t*)x);
90 MPSFFitCalc psfcalc;
91 //psfcalc.SetImgCleanMode(MPSFFitCalc::kRing);
92 psfcalc.SetImgCleanMode(MPSFFitCalc::kCombined);
93 psfcalc.SetNumRings(numrings);
94 psfcalc.SetBlindPixels(blindpixels);
95
96
97 tlist.AddToList(&geomapl);
98 tlist.AddToList(&read);
99 tlist.AddToList(&psfcalc, "Currents");
100
101 //
102 // Create and setup the eventloop
103 //
104 MEvtLoop evtloop;
105 evtloop.SetParList(&plist);
106
107 //
108 // Execute your analysis
109 //
110
111 if (numEvents > 0)
112 {
113 if (!evtloop.Eventloop(numEvents))
114 return;
115 }
116 else
117 {
118 if (!evtloop.PreProcess())
119 return;
120
121 MHCamera display(geomcam);
122 display.SetPrettyPalette();
123 display.Draw();
124 gPad->cd(1);
125 psffit.Draw();
126
127 while (tlist.Process())
128 {
129 display.SetCamContent(dccam);
130 gPad->Modified();
131 gPad->Update();
132 psffit.Print();
133 // Remove the comments if you want to go through the file
134 // event-by-event:
135 if (!HandleInput())
136 break;
137 }
138
139 evtloop.PostProcess();
140 }
141
142 tlist.PrintStatistics();
143
144 psffit.Print();
145 cout << "RUN " << psffit.GetMeanMinorAxis() << ' ' << psffit.GetSigmaMinorAxis() << ' ' << psffit.GetMeanMajorAxis() << ' ' << psffit.GetSigmaMajorAxis() << ' ' << psffit.GetChisquare() << endl;
146
147}
148
149
Note: See TracBrowser for help on using the repository browser.