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

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