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

Last change on this file since 3534 was 3436, checked in by gaug, 21 years ago
*** empty log message ***
File size: 7.4 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 MBadPixelsCam badcam;
117 MCalibrationChargeCam calcam;
118 MExtractedSignalCam sigcam;
119 MCalibrationChargePINDiode pindiode;
120 MCalibrationChargeBlindPix blindpix;
121
122 //
123 // As long, as we don't have digital modules,
124 // we have to set the color of the pulser LED by hand
125 //
126 // calcam.SetColor(MCalibrationChargeCam::kECT1);
127 blindpix.SetColor(MCalibrationChargeBlindpix:kECT1);
128
129 plist2.AddToList(&geomcam);
130 plist2.AddToList(&badcam);
131 plist2.AddToList(&pedcam);
132 plist2.AddToList(&calcam);
133 plist2.AddToList(&sigcam);
134 plist2.AddToList(&pindiode);
135 plist2.AddToList(&blindpix);
136
137 // hists
138 MFillH fillpin( "MHCalibrationChargePINDiode", "MExtractedSignalPINDiode");
139 MFillH fillblind("MHCalibrationChargeBlindPix", "MExtractedSignalBlindPix");
140 MFillH fillcam( "MHCalibrationChargeCam" , "MExtractedSignalCam");
141
142 //tasks
143 MReadMarsFile read2("Events", calname);
144 read2.DisableAutoScheme();
145
146 MExtractPINDiode pincalc;
147 MExtractBlindPixel blindcalc;
148 MExtractSignal sigsig;
149 MCalibrationChargeCalc calcalc;
150
151 //
152 // Apply a filter against cosmics
153 // (was directly in MCalibrationCalc in earlier versions)
154 //
155 MFCosmics cosmics;
156 MContinue cont(&cosmics);
157
158 tlist2.AddToList(&read2);
159 tlist2.AddToList(&geomapl);
160 tlist2.AddToList(&blindcalc);
161 tlist2.AddToList(&pincalc);
162 tlist2.AddToList(&sigsig);
163 //
164 // In case, you want to skip the cosmics rejection,
165 // uncomment the next line
166 //
167 tlist2.AddToList(&cont);
168 //
169 // tlist2.AddToList(&fillpin);
170 tlist2.AddToList(&fillblind);
171 tlist2.AddToList(&fillcam);
172 tlist2.AddToList(&calcalc);
173 //
174 // Create and setup the eventloop
175 //
176 MEvtLoop evtloop2;
177 evtloop2.SetParList(&plist2);
178
179 //
180 // Execute second analysis
181 //
182 if (!evtloop2.Eventloop())
183 return;
184
185 tlist2.PrintStatistics();
186
187
188 //
189 // Create a empty Parameter List and an empty Task List
190 //
191 MParList plist3;
192
193 MTaskList tlist3;
194 plist3.AddToList(&tlist3);
195
196 //
197 // Now setup the tasks and tasklist to calculate the pedestal rms in number of photons
198 // -----------------------------------------------------------------------------------
199 //
200
201 MCerPhotEvt nphot;
202 MPedPhotCam nphotrms;
203
204 plist3.AddToList(&geomcam);
205 plist3.AddToList(&pedcam);
206 plist3.AddToList(&calcam);
207 plist3.AddToList(&nphot);
208 plist3.AddToList(&nphotrms);
209
210 //tasks
211 MReadMarsFile read3("Events", pedname);
212 read3.DisableAutoScheme();
213
214 MExtractSignal extsig;
215 MCalibrate photcalc;
216// MPedPhotCalc photrmscalc; //It doesn't exist yet
217
218 tlist3.AddToList(&read3);
219 tlist3.AddToList(&geomapl);
220 tlist3.AddToList(&extsig);
221 tlist3.AddToList(&photcalc);
222// tlist3.AddToList(&photrmscalc);
223
224 //
225 // Create and setup the eventloop
226 //
227 MEvtLoop evtloop3;
228 evtloop3.SetParList(&plist3);
229
230
231 //
232 // Execute first analysis
233 //
234 if (!evtloop3.Eventloop())
235 return;
236
237 tlist3.PrintStatistics();
238
239 //
240 // Create a empty Parameter List and an empty Task List
241 //
242 MParList plist4;
243
244 MTaskList tlist4;
245 plist4.AddToList(&tlist4);
246
247 //
248 // Now setup the tasks and tasklist to analize the data
249 // -----------------------------------------------------
250 //
251
252 plist4.AddToList(&geomcam);
253 plist4.AddToList(&pedcam);
254 plist4.AddToList(&calcam);
255 plist4.AddToList(&nphot);
256 plist4.AddToList(&nphotrms);
257
258 //tasks
259 MReadMarsFile read4("Events", dataname);
260 read4.DisableAutoScheme();
261
262
263 MExtractSignal extsig;
264 MCalibrate photcalc;
265
266 tlist4.AddToList(&read4);
267 tlist4.AddToList(&geomapl);
268 tlist4.AddToList(&extsig);
269 tlist4.AddToList(&photcalc);
270
271 //
272 // Create and setup the eventloop
273 //
274 MEvtLoop evtloop4;
275 evtloop4.SetParList(&plist4);
276
277 if (!evtloop4.PreProcess())
278 return;
279
280 TCanvas *c = new TCanvas;
281 MHCamera display(geomcam);
282 display.SetPrettyPalette();
283 //display.SetInvDeepBlueSeaPalette()
284 display.Draw();
285 gPad->SetLogy();
286 gPad->cd(1);
287
288 while (tlist4.Process())
289 {
290 display.SetCamContent(nphot);
291
292 gPad->Modified();
293 gPad->Update();
294
295 // Remove the comments if you want to go through the file
296 // event-by-event:
297 if (!HandleInput())
298 break;
299 }
300
301
302
303 evtloop4.PostProcess();
304
305}
Note: See TracBrowser for help on using the repository browser.