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

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