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