source: trunk/MagicSoft/Mars/macros/bootcampstandardanalysis.C@ 3188

Last change on this file since 3188 was 3187, checked in by gaug, 21 years ago
*** empty log message ***
File size: 6.7 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, 12/2003 <mailto:jlopez@ifae.es>
19!
20! Copyright: MAGIC Software Development, 2000-2003
21!
22!
23\* ======================================================================== */
24
25Bool_t HandleInput()
26{
27 TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
28
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
48void bootcampstandardanalysis(
49TString pedname="/mnt/magic_data/Data/rootdata/2003_11_29/20031128_03127_P_Crab-Nebula_E.root",
50TString calname="/mnt/magic_data/Data/rootdata/2003_11_29/20031128_03128_C_Crab-Nebula_E.root",
51TString dataname="/mnt/magic_data/Data/rootdata/2003_11_29/20031128_03200_D_Crab-Nebula_E.root")
52{
53
54// Before starting be sure you have the pedestal, calibration and data runs names
55// if (pedname != NULL)
56// cout << endl << "usage: bootcampstandardanalysis.C()" << endl;
57
58 //
59 // Create a empty Parameter List and an empty Task List
60 // The tasklist is identified in the eventloop by its name
61 //
62 MParList plist;
63
64 MTaskList tlist;
65 plist.AddToList(&tlist);
66
67 //
68 // Now setup the tasks and tasklist for the pedestals:
69 // ---------------------------------------------------
70 //
71
72 MPedestalCam pedcam;
73 plist.AddToList(&pedcam);
74
75
76 //tasks
77 MReadMarsFile read("Events", pedname);
78 read.DisableAutoScheme();
79
80 MGeomApply geomapl;
81 MPedCalcPedRun pedcalc;
82 MGeomCamMagic geomcam;
83
84 tlist.AddToList(&read);
85 tlist.AddToList(&geomapl);
86 tlist.AddToList(&pedcalc);
87
88 //
89 // Create and setup the eventloop
90 //
91 MEvtLoop evtloop;
92 evtloop.SetParList(&plist);
93
94 //
95 // Execute first analysis
96 //
97 if (!evtloop.Eventloop())
98 return;
99
100 tlist.PrintStatistics();
101
102 //
103 // Create a empty Parameter List and an empty Task List
104 //
105 MParList plist2;
106
107 MTaskList tlist2;
108 plist2.AddToList(&tlist2);
109
110
111 //
112 // Now setup the new tasks and tasklist for the calibration
113 // ---------------------------------------------------
114 //
115
116 MCalibrationCam calcam;
117 MExtractedSignalCam sigcam;
118
119 plist2.AddToList(&geomcam);
120 plist2.AddToList(&pedcam);
121 plist2.AddToList(&calcam);
122 plist2.AddToList(&sigcam);
123
124
125 //tasks
126 MReadMarsFile read2("Events", calname);
127 read2.DisableAutoScheme();
128
129
130 MExtractSignal sigsig;
131 MCalibrationCalc calcalc;
132
133 //
134 // As long, as we don't have digital modules,
135 // we have to set the color of the pulser LED by hand
136 //
137 calcalc.SetPulserColor(MCalibrationCalc::kECT1);
138
139 //
140 // Apply a filter against cosmics
141 // (was directly in MCalibrationCalc in earlier versions)
142 //
143 MFCosmics cosmics;
144 MContinue cont(&cosmics);
145
146 tlist2.AddToList(&read2);
147 tlist2.AddToList(&geomapl);
148 tlist2.AddToList(&sigsig);
149 //
150 // In case, you want to skip the cosmics rejection,
151 // uncomment the next line
152 //
153 tlist2.AddToList(&cont);
154 //
155 tlist2.AddToList(&calcalc);
156
157 //
158 // Create and setup the eventloop
159 //
160 MEvtLoop evtloop2;
161 evtloop2.SetParList(&plist2);
162
163 //
164 // Execute second analysis
165 //
166 if (!evtloop2.Eventloop())
167 return;
168
169 tlist2.PrintStatistics();
170
171
172 //
173 // Create a empty Parameter List and an empty Task List
174 //
175 MParList plist3;
176
177 MTaskList tlist3;
178 plist3.AddToList(&tlist3);
179
180 //
181 // Now setup the tasks and tasklist to calculate the pedestal rms in number of photons
182 // -----------------------------------------------------------------------------------
183 //
184
185 MCerPhotEvt nphot;
186 MPedPhotCam nphotrms;
187
188 plist3.AddToList(&geomcam);
189 plist3.AddToList(&pedcam);
190 plist3.AddToList(&calcam);
191 plist3.AddToList(&nphot);
192 plist3.AddToList(&nphotrms);
193
194 //tasks
195 MReadMarsFile read3("Events", pedname);
196 read3.DisableAutoScheme();
197
198 MExtractSignal extsig;
199 MCalibrate photcalc;
200// MPedPhotCalc photrmscalc; //It doesn't exist yet
201
202 tlist3.AddToList(&read3);
203 tlist3.AddToList(&geomapl);
204 tlist3.AddToList(&extsig);
205 tlist3.AddToList(&photcalc);
206// tlist3.AddToList(&photrmscalc);
207
208 //
209 // Create and setup the eventloop
210 //
211 MEvtLoop evtloop3;
212 evtloop3.SetParList(&plist3);
213
214
215 //
216 // Execute first analysis
217 //
218 if (!evtloop3.Eventloop())
219 return;
220
221 tlist3.PrintStatistics();
222
223 //
224 // Create a empty Parameter List and an empty Task List
225 //
226 MParList plist4;
227
228 MTaskList tlist4;
229 plist4.AddToList(&tlist4);
230
231 //
232 // Now setup the tasks and tasklist to analize the data
233 // -----------------------------------------------------
234 //
235
236 plist4.AddToList(&geomcam);
237 plist4.AddToList(&pedcam);
238 plist4.AddToList(&calcam);
239 plist4.AddToList(&nphot);
240 plist4.AddToList(&nphotrms);
241
242 //tasks
243 MReadMarsFile read4("Events", dataname);
244 read4.DisableAutoScheme();
245
246
247 MExtractSignal extsig;
248 MCalibrate photcalc;
249
250 tlist4.AddToList(&read4);
251 tlist4.AddToList(&geomapl);
252 tlist4.AddToList(&extsig);
253 tlist4.AddToList(&photcalc);
254
255 //
256 // Create and setup the eventloop
257 //
258 MEvtLoop evtloop4;
259 evtloop4.SetParList(&plist4);
260
261 if (!evtloop4.PreProcess())
262 return;
263
264 TCanvas *c = new TCanvas;
265 MHCamera display(geomcam);
266 display.SetPrettyPalette();
267 //display.SetInvDeepBlueSeaPalette()
268 display.Draw();
269 gPad->SetLogy();
270 gPad->cd(1);
271
272 while (tlist4.Process())
273 {
274 display.SetCamContent(nphot);
275
276 gPad->Modified();
277 gPad->Update();
278
279 // Remove the comments if you want to go through the file
280 // event-by-event:
281 if (!HandleInput())
282 break;
283 }
284
285
286
287 evtloop4.PostProcess();
288
289}
Note: See TracBrowser for help on using the repository browser.