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