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): Markus Gaug, 11/2003 <mailto:markus@ifae.es>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2004
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 | /////////////////////////////////////////////////////////////////////////////
|
---|
25 | //
|
---|
26 | // calibration.C
|
---|
27 | //
|
---|
28 | // Needs as arguments the run number of a calibration file ("*_C_*.root") and
|
---|
29 | // the run number of the corresponding pedestal file ("*_P_*.root").
|
---|
30 | //
|
---|
31 | // The TString inpath has to be set correctly.
|
---|
32 | //
|
---|
33 | // The macro searches for the pulser colour which corresponds to the calibration
|
---|
34 | // run number. If the run number is smaller than 20000, pulser colour "CT1"
|
---|
35 | // is assumed, otherwise, it searches for the strings "green", "blue", "uv" or
|
---|
36 | // "ct1" in the filenames. If no colour or multiple colours are found, the
|
---|
37 | // execution is aborted.
|
---|
38 | //
|
---|
39 | // The container MBadPixelsCam is created and followed during the execution of the
|
---|
40 | // rest of the macro.
|
---|
41 | //
|
---|
42 | // A first loop over the pedestal file is performed using the class MJPedestal
|
---|
43 | //
|
---|
44 | // The container MCalibrationQECam is created and followed during the execution of the
|
---|
45 | // rest of the macro.
|
---|
46 | //
|
---|
47 | // A loop over the calibration files is performed using the class MJCalibration.
|
---|
48 | // The results are displayed using the MJCalibration::SetNormalDisplay() facility,
|
---|
49 | // but other displays can easily be uncommented.
|
---|
50 | // The call to MJCalibration skips the relative time calibration, which can be
|
---|
51 | // uncommented as well.
|
---|
52 | //
|
---|
53 | // Last, a third loop is performed over the calibration file again in order to
|
---|
54 | // "calibrate" it and test the resulting outcome.
|
---|
55 | //
|
---|
56 | //////////////////////////////////////////////////////////////////////////////////////////
|
---|
57 | #include <TStyle.h>
|
---|
58 | #include <TObject.h>
|
---|
59 | #include <TObjectTable.h>
|
---|
60 | #include <TCanvas.h>
|
---|
61 | #include <TPad.h>
|
---|
62 | #include <TH1.h>
|
---|
63 | #include <TPaveStats.h>
|
---|
64 | #include <TApplication.h>
|
---|
65 | #include <TClass.h>
|
---|
66 |
|
---|
67 | #include "getExtractor.C"
|
---|
68 |
|
---|
69 | #include "MJPedestal.h"
|
---|
70 | #include "MJCalibration.h"
|
---|
71 | #include "MJExtractCalibTest.h"
|
---|
72 | #include "MJCalibrateSignalFromOutside.h"
|
---|
73 | #include "MRunIter.h"
|
---|
74 | #include "MStatusDisplay.h"
|
---|
75 | #include "MCalibrationQECamMagic.h"
|
---|
76 | #include "MCalibrationQECam.h"
|
---|
77 | #include "MBadPixelsCam.h"
|
---|
78 | #include "MArgs.h"
|
---|
79 | #include "MArray.h"
|
---|
80 | #include "MParContainer.h"
|
---|
81 | #include "MGeomCamMagic.h"
|
---|
82 |
|
---|
83 | using namespace std;
|
---|
84 |
|
---|
85 | static TString outpath = "./";
|
---|
86 | static TString inpath = "/home/rootdata/Calib/2004_09_22";
|
---|
87 | static TString badfile;
|
---|
88 | //static TString badfile = "badpixels_only0_388_559.dat";
|
---|
89 | //
|
---|
90 | // the default pedestal run for the calibration
|
---|
91 | //
|
---|
92 | static const Int_t pedrun = 38995;
|
---|
93 | //
|
---|
94 | // the default start calibration run
|
---|
95 | //
|
---|
96 | static const Int_t calrun1 = 38997;
|
---|
97 | //
|
---|
98 | // the default last calibration run (if 0, only one run is taken, otherwise consecutive runs
|
---|
99 | // between calrun1 and calrun2)
|
---|
100 | //
|
---|
101 | static const Int_t calrun2 = 0;
|
---|
102 | //
|
---|
103 | // the default start data run
|
---|
104 | //
|
---|
105 | static const Int_t datrun1 = 39000;
|
---|
106 | //
|
---|
107 | // the default last calibration run (if 0, only one run is taken, otherwise consecutive runs
|
---|
108 | // between calrun1 and calrun2)
|
---|
109 | //
|
---|
110 | static const Int_t datrun2 = 0;
|
---|
111 | //
|
---|
112 | // A switch to output debugging information about Objects use
|
---|
113 | //
|
---|
114 | static Bool_t debug = kFALSE;
|
---|
115 | //
|
---|
116 | // A switch to use the Blind Pixel
|
---|
117 | //
|
---|
118 | static Bool_t blindpix = kTRUE;
|
---|
119 | //
|
---|
120 | // A switch to use the PIN Diode
|
---|
121 | //
|
---|
122 | static Bool_t pindiode = kTRUE;
|
---|
123 | //
|
---|
124 | // Tell if you want to use the display:
|
---|
125 | //
|
---|
126 | static Bool_t useDisplay = kTRUE;
|
---|
127 | //
|
---|
128 | // Tell if you want to test the result afterwards
|
---|
129 | //
|
---|
130 | static Bool_t useTest = kFALSE;
|
---|
131 | //
|
---|
132 | // Tell if you want to test the intensity calibration
|
---|
133 | //
|
---|
134 | static Bool_t useIntensity = kFALSE;
|
---|
135 | //
|
---|
136 | // Tell if you want to store and read the F0 and F1- files
|
---|
137 | //
|
---|
138 | static Bool_t useStorage = kTRUE;
|
---|
139 | //
|
---|
140 | // Tell which extractor you want to use. The flags are counted according
|
---|
141 | // to the extractor-TDAS
|
---|
142 | //
|
---|
143 | static Int_t extractorflag = 33;
|
---|
144 | //
|
---|
145 | Int_t calibration(const UInt_t extflag=extractorflag, const Int_t prun=pedrun,
|
---|
146 | const Int_t crun1=calrun1, const Int_t crun2=calrun2,
|
---|
147 | const Int_t drun1=datrun1, const Int_t drun2=datrun2)
|
---|
148 | {
|
---|
149 |
|
---|
150 | MExtractor *extractor = getExtractor(extflag==33 ? 32 : extflag);
|
---|
151 |
|
---|
152 | if (!extractor)
|
---|
153 | return 99;
|
---|
154 |
|
---|
155 | extractor->SetName(Form("%s_Run_%05d",extractor->GetName(),prun));
|
---|
156 | const Bool_t timeandcharge = extractor->InheritsFrom("MExtractTimeAndCharge");
|
---|
157 |
|
---|
158 | gStyle->SetOptStat(1111);
|
---|
159 | gStyle->SetOptFit();
|
---|
160 | gStyle->SetTitleSize(0.35,"u");
|
---|
161 | gStyle->SetTitleFontSize(0.9);
|
---|
162 | gStyle->SetTitleH(0.12);
|
---|
163 | gStyle->SetTitleW(0.95);
|
---|
164 | gStyle->SetLineWidth(1);
|
---|
165 |
|
---|
166 | if (debug)
|
---|
167 | TObject::SetObjectStat(kTRUE);
|
---|
168 |
|
---|
169 | MRunIter pruns;
|
---|
170 | MRunIter cruns;
|
---|
171 |
|
---|
172 | pruns.AddRun(prun,inpath);
|
---|
173 |
|
---|
174 | if (crun1!=0)
|
---|
175 | if (crun2==0)
|
---|
176 | cruns.AddRun(crun1,inpath);
|
---|
177 | else
|
---|
178 | cruns.AddRuns(crun1,crun2,inpath);
|
---|
179 |
|
---|
180 | MStatusDisplay *display = NULL;
|
---|
181 |
|
---|
182 | if (useDisplay)
|
---|
183 | {
|
---|
184 | display = new MStatusDisplay;
|
---|
185 | display->SetUpdateTime(3000);
|
---|
186 | display->Resize(850,700);
|
---|
187 | }
|
---|
188 |
|
---|
189 | /*****************************************/
|
---|
190 | /* FIRST LOOP: PURE PEDESTAL COMPUTATION */
|
---|
191 | /*****************************************/
|
---|
192 | //
|
---|
193 | // Hand over to the jobs a QE Cam with Cornings initialized
|
---|
194 | //
|
---|
195 | MGeomCamMagic geomcam;
|
---|
196 | MCalibrationQECamMagic qecam;
|
---|
197 | MBadPixelsCam badcam;
|
---|
198 | badcam.InitSize(geomcam.GetNumPixels());
|
---|
199 | //
|
---|
200 | // If you want to exclude pixels from the beginning, read
|
---|
201 | // an ascii-file with the corr. pixel numbers (see MBadPixelsCam)
|
---|
202 | //
|
---|
203 | if (!badfile.IsNull())
|
---|
204 | {
|
---|
205 | ifstream f(badfile.Data());
|
---|
206 | badcam.AsciiRead((istream&)f);
|
---|
207 | f.close();
|
---|
208 | }
|
---|
209 |
|
---|
210 | MJPedestal pedloop1;
|
---|
211 | pedloop1.SetNoStorage(!useStorage);
|
---|
212 | pedloop1.SetEnvDebug(debug);
|
---|
213 | pedloop1.SetExtractor(extractor);
|
---|
214 | pedloop1.SetInput(&pruns);
|
---|
215 | pedloop1.SetPathOut(outpath.Data());
|
---|
216 | if (useDisplay)
|
---|
217 | {
|
---|
218 | pedloop1.SetDisplay(display);
|
---|
219 | pedloop1.SetDataCheckDisplay();
|
---|
220 | }
|
---|
221 | pedloop1.SetBadPixels(badcam);
|
---|
222 |
|
---|
223 | if (!pedloop1.Process())
|
---|
224 | return 1;
|
---|
225 |
|
---|
226 | /****************************************/
|
---|
227 | /* SECOND LOOP: CALIBRATION COMPUTATION */
|
---|
228 | /****************************************/
|
---|
229 |
|
---|
230 | MJPedestal pedloop2;
|
---|
231 | MJCalibration calloop;
|
---|
232 |
|
---|
233 | if (timeandcharge)
|
---|
234 | {
|
---|
235 | /***********************************************************/
|
---|
236 | /* NEEDED FOR SECOND LOOP: EXTRACTOR RESOLUTION COMPUTATION */
|
---|
237 | /***********************************************************/
|
---|
238 |
|
---|
239 | pedloop2.SetUseData();
|
---|
240 | pedloop2.SetNoStorage(!useStorage);
|
---|
241 | pedloop2.SetEnvDebug(debug);
|
---|
242 | pedloop2.SetExtractor(extractor);
|
---|
243 | pedloop2.SetExtractorResolution();
|
---|
244 | pedloop2.SetPedestals(pedloop1.GetPedestalCam());
|
---|
245 | pedloop2.SetInput(&pruns);
|
---|
246 | pedloop2.SetPathOut(outpath.Data());
|
---|
247 | if (useDisplay)
|
---|
248 | {
|
---|
249 | pedloop2.SetDisplay(display);
|
---|
250 | pedloop2.SetDataCheckDisplay();
|
---|
251 | }
|
---|
252 | pedloop2.SetBadPixels(badcam);
|
---|
253 |
|
---|
254 | if (!pedloop2.Process())
|
---|
255 | return 1;
|
---|
256 |
|
---|
257 | calloop.SetExtractorCam(pedloop2.GetPedestalCam());
|
---|
258 | }
|
---|
259 |
|
---|
260 | if (crun1 == 0)
|
---|
261 | return 0;
|
---|
262 |
|
---|
263 | MPedestalCam &pedcam = pedloop1.GetPedestalCam();
|
---|
264 |
|
---|
265 | if (debug)
|
---|
266 | calloop.SetDebug();
|
---|
267 | calloop.SetEnvDebug(debug);
|
---|
268 | if (useIntensity)
|
---|
269 | calloop.SetIntensity();
|
---|
270 | // calloop.SetHistsStorage();
|
---|
271 | calloop.SetNoStorage(!useStorage);
|
---|
272 | calloop.SetRelTimeCalibration(kTRUE);
|
---|
273 | //
|
---|
274 | // If you want to set a colour explicitely from outside (not recommanded!)
|
---|
275 | // calloop.SetColor(MCalibrationCam::kUV);
|
---|
276 | //
|
---|
277 | // If you want to run the data-check on RAW DATA!!!, choose:
|
---|
278 | // calloop.SetDataCheck();
|
---|
279 | //
|
---|
280 | // If you want to see the data-check plots only, choose:
|
---|
281 | calloop.SetDataCheckDisplay();
|
---|
282 | //calloop.SetNormalDisplay();
|
---|
283 | //
|
---|
284 | // For everything, you have ever dreamed of, choose:
|
---|
285 | // calloop.SetFullDisplay();
|
---|
286 |
|
---|
287 | //
|
---|
288 | // If you want to calibrate the times as well, choose:
|
---|
289 | //
|
---|
290 | calloop.SetExtractor(extractor);
|
---|
291 | calloop.SetInput(&cruns);
|
---|
292 | calloop.SetPathOut(outpath.Data());
|
---|
293 | if (useDisplay)
|
---|
294 | calloop.SetDisplay(display);
|
---|
295 | calloop.SetUseBlindPixel(blindpix);
|
---|
296 | calloop.SetUsePINDiode(pindiode);
|
---|
297 | calloop.SetQECam(qecam);
|
---|
298 | calloop.SetBadPixels(badcam);
|
---|
299 |
|
---|
300 | if (!calloop.Process(pedcam))
|
---|
301 | return 2;
|
---|
302 |
|
---|
303 | //
|
---|
304 | // The next lines are the use the Print() function and have
|
---|
305 | // all the results as ascii-tables:
|
---|
306 | //
|
---|
307 | if (debug)
|
---|
308 | {
|
---|
309 | MCalibrationQECam &nqecam = calloop.GetQECam();
|
---|
310 | MBadPixelsCam &badbad = calloop.GetBadPixels();
|
---|
311 | MCalibrationChargeCam &chargecam = calloop.GetCalibrationCam();
|
---|
312 | chargecam.Print();
|
---|
313 | nqecam.Print();
|
---|
314 | badbad.Print();
|
---|
315 | }
|
---|
316 |
|
---|
317 | /********************************************************************/
|
---|
318 | /* THIRD LOOP: APPLY CALIBRATION TO THE CALIBRATION FILES FOR TESTS */
|
---|
319 | /********************************************************************/
|
---|
320 |
|
---|
321 | if (useTest)
|
---|
322 | {
|
---|
323 |
|
---|
324 | MJExtractCalibTest testloop;
|
---|
325 |
|
---|
326 | // If you want to see the data-check plots only, choose:
|
---|
327 | testloop.SetDataCheckDisplay();
|
---|
328 |
|
---|
329 | testloop.SetExtractor(extractor);
|
---|
330 | testloop.SetInput(&cruns);
|
---|
331 | testloop.SetPathOut(outpath);
|
---|
332 | if (useDisplay)
|
---|
333 | testloop.SetDisplay(display);
|
---|
334 | testloop.SetBadPixels(calloop.GetBadPixels());
|
---|
335 |
|
---|
336 | if (!testloop.ProcessD(pedloop1.GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam()))
|
---|
337 | return 3;
|
---|
338 |
|
---|
339 | }
|
---|
340 |
|
---|
341 | if (drun1 == 0)
|
---|
342 | return 4;
|
---|
343 |
|
---|
344 | MRunIter druns;
|
---|
345 |
|
---|
346 | if (drun2==0)
|
---|
347 | druns.AddRun(drun1,inpath);
|
---|
348 | else
|
---|
349 | druns.AddRuns(drun1,drun2,inpath);
|
---|
350 |
|
---|
351 |
|
---|
352 | /********************************************************************/
|
---|
353 | /* FOURTH LOOP: APPLY CALIBRATION TO THE PEDESTAL FILES */
|
---|
354 | /********************************************************************/
|
---|
355 |
|
---|
356 | if (extflag == 33)
|
---|
357 | {
|
---|
358 | delete extractor;
|
---|
359 | extractor = getExtractor(28);
|
---|
360 | }
|
---|
361 |
|
---|
362 | MJCalibrateSignalFromOutside calibloop;
|
---|
363 |
|
---|
364 | calibloop.SetExtractor(extractor);
|
---|
365 | calibloop.SetInput(&druns);
|
---|
366 | // calibloop.SetOutputPath(outpath);
|
---|
367 | if (useDisplay)
|
---|
368 | calibloop.SetDisplay(display);
|
---|
369 | calibloop.SetBadPixels(calloop.GetBadPixels());
|
---|
370 | calibloop.SetNoStorage(!useStorage);
|
---|
371 |
|
---|
372 | if (!calibloop.ProcessFile(pedloop1.GetPedestalCam(),timeandcharge ? pedloop2.GetPedestalCam() : pedloop1.GetPedestalCam(), calloop.GetCalibrationCam(),calloop.GetQECam(), calloop.GetRelTimeCam()))
|
---|
373 | return 5;
|
---|
374 |
|
---|
375 | if (debug)
|
---|
376 | TObject::SetObjectStat(kFALSE);
|
---|
377 |
|
---|
378 | //
|
---|
379 | // Debugging at the end:
|
---|
380 | //
|
---|
381 | if (debug)
|
---|
382 | gObjectTable->Print();
|
---|
383 |
|
---|
384 |
|
---|
385 | return 0;
|
---|
386 | }
|
---|
387 |
|
---|
388 | static void Usage()
|
---|
389 | {
|
---|
390 | gLog << endl;
|
---|
391 | gLog << "Usage:" << endl;
|
---|
392 | gLog << endl;
|
---|
393 | gLog << " calibration [ped.run nr.] [first cal.run nr.] [last cal.run nr.] [first dat.run nr.] [last dat.run nr.]" << endl ;
|
---|
394 | gLog << endl;
|
---|
395 | gLog << " ped.run.nr: Run number of the pedestal file." << endl;
|
---|
396 | gLog << " first cal.run nr.: Run number of the first calibration file." << endl;
|
---|
397 | gLog << " last cal.run nr.: Run number of the last calibration file." << endl;
|
---|
398 | gLog << " first dat.run nr.: Run number of the first data file to be calibrated." << endl;
|
---|
399 | gLog << " last dat.run nr.: Run number of the last data file to be calibrated." << endl;
|
---|
400 | gLog << endl;
|
---|
401 | gLog << "All calibration runs between (first cal.run nr.) and (last cal.run nr.) will be used" << endl;
|
---|
402 | gLog << "If last.cal.run.nr is 0 (default), only one calibration run is taken" << endl;
|
---|
403 | gLog << endl;
|
---|
404 | gLog << "All data runs between (first dat.run nr.) and (last dat.run nr.) will be used" << endl;
|
---|
405 | gLog << "If last.dat.run.nr is 0 (default), only one data run is taken" << endl;
|
---|
406 | gLog << endl;
|
---|
407 | gLog << "Additional Options: " << endl;
|
---|
408 | gLog << " --extractor=# Choose one of the following possible extractors (integer)" << endl;
|
---|
409 | gLog << " (default: Nr. 33) " << endl;
|
---|
410 | gLog << endl;
|
---|
411 | gLog << " Nr. Extractor Parameters " << endl;
|
---|
412 | gLog << endl;
|
---|
413 | gLog << " MExtractFixedWindow: " << endl;
|
---|
414 | gLog << " with the following parameters: " << endl;
|
---|
415 | gLog << " 1: SetRange(4,7,6,9) " << endl;
|
---|
416 | gLog << " 2: SetRange(4,7,5,10)" << endl;
|
---|
417 | gLog << " 3: SetRange(3,8,5,10)" << endl;
|
---|
418 | gLog << " 4: SetRange(2,9,4,11)" << endl;
|
---|
419 | gLog << " 5: SetRange(0,13,4,13)" << endl;
|
---|
420 | gLog << " MExtractFixedWindowSpline: " << endl;
|
---|
421 | gLog << " 6: SetRange(3,7,5,9)" << endl;
|
---|
422 | gLog << " 7: SetRange(3,7,5,11)" << endl;
|
---|
423 | gLog << " 8: SetRange(3,9,5,11)" << endl;
|
---|
424 | gLog << " 9: SetRange(2,10,4,12)" << endl;
|
---|
425 | gLog << " 10: SetRange(0,14,4,14)" << endl;
|
---|
426 | gLog << " MExtractFixedWindowPeakSearch: " << endl;
|
---|
427 | gLog << " SetRange(0,18,2,14) and the following parameters:" << endl;
|
---|
428 | gLog << " 11: SetWindows(2,2,2)" << endl;
|
---|
429 | gLog << " SetOffsetFromWindow(0)" << endl;
|
---|
430 | gLog << " 12: SetWindows(4,4,2)" << endl;
|
---|
431 | gLog << " SetOffsetFromWindow(1)" << endl;
|
---|
432 | gLog << " 13: SetWindows(4,6,4)" << endl;
|
---|
433 | gLog << " SetOffsetFromWindow(0)" << endl;
|
---|
434 | gLog << " 14: SetWindows(6,6,4)" << endl;
|
---|
435 | gLog << " SetOffsetFromWindow(1)" << endl;
|
---|
436 | gLog << " 15: SetWindows(8,8,4)" << endl;
|
---|
437 | gLog << " SetOffsetFromWindow(1)" << endl;
|
---|
438 | gLog << " 16: SetWindows(14,10,4)" << endl;
|
---|
439 | gLog << " SetOffsetFromWindow(2)" << endl;
|
---|
440 | gLog << " MExtractTimeAndChargeSlidingWindow:" << endl;
|
---|
441 | gLog << " SetRange(0,18,2,14) and the following parameters:" << endl;
|
---|
442 | gLog << " 17: SetWindowSize(2,2)" << endl;
|
---|
443 | gLog << " 18: SetWindowSize(4,4)" << endl;
|
---|
444 | gLog << " 19: SetWindowSize(4,6)" << endl;
|
---|
445 | gLog << " 20: SetWindowSize(6,6)" << endl;
|
---|
446 | gLog << " 21: SetWindowSize(8,8)" << endl;
|
---|
447 | gLog << " 22: SetWindowSize(14,10)" << endl;
|
---|
448 | gLog << " MExtractTimeAndChargeSpline: " << endl;
|
---|
449 | gLog << " 23: SetChargeType(MExtractTimeAndChargeSpline::kAmplitude) and:" << endl;
|
---|
450 | gLog << " SetRange(0,13,2,13) " << endl;
|
---|
451 | gLog << " 24: SetChargeType(MExtractTimeAndChargeSpline::kIntegral) and:" << endl;
|
---|
452 | gLog << " SetRiseTime(0.5); SetFallTime(0.5)" << endl;
|
---|
453 | gLog << " 25: SetRiseTime(0.5); SetFallTime(1.5)" << endl;
|
---|
454 | gLog << " 26: SetRiseTime(1.0); SetFallTime(3.0)" << endl;
|
---|
455 | gLog << " 27 SetRiseTime(1.5); SetFallTime(4.5)" << endl;
|
---|
456 | gLog << " MExtractTimeAndChargeDigitalFilter" << endl;
|
---|
457 | gLog << " SetRange(0,18,2,14) and the following parameters:" << endl;
|
---|
458 | gLog << " 28: SetNameWeightsFile('msignal/cosmics_weights.dat')" << endl;
|
---|
459 | gLog << " 29: SetNameWeightsFile('msignal/cosmics_weights4.dat')" << endl;
|
---|
460 | gLog << " 30: SetNameWeightsFile('msignal/cosmics_weights_logain6.dat')" << endl;
|
---|
461 | gLog << " 31: SetNameWeightsFile('msignal/cosmics_weights_logain4.dat')" << endl;
|
---|
462 | gLog << " 32: SetNameWeightsFile('msignal/calibration_weights_UV.dat')" << endl;
|
---|
463 | gLog << " 33: Use calibration weights for calibration events and cosmics weights for data events" << endl;
|
---|
464 | gLog << endl;
|
---|
465 | gLog << " --inpath=# Find the data in inpath" << endl;
|
---|
466 | gLog << " --outpath=# Write the output containers to outpath" << endl;
|
---|
467 | gLog << " --badfile=# Use the file # to exclude pixels from the beginning" << endl;
|
---|
468 | gLog << " --debug Use the TObjectTable for debugging " << endl;
|
---|
469 | gLog << " and write out the pixels as ascii tables" << endl;
|
---|
470 | gLog << " --useTest Use the class MJExtractCalibTest to test the calibration on itself" << endl;
|
---|
471 | gLog << " --skipBlindPix Skip the blind pixel calibration" << endl;
|
---|
472 | gLog << " --skipPINDiode Skip the PIN Diode calibration" << endl;
|
---|
473 | }
|
---|
474 |
|
---|
475 |
|
---|
476 | int main(int argc, char **argv)
|
---|
477 | {
|
---|
478 |
|
---|
479 |
|
---|
480 | MArray::Class()->IgnoreTObjectStreamer();
|
---|
481 | MParContainer::Class()->IgnoreTObjectStreamer();
|
---|
482 | //
|
---|
483 | // Evaluate arguments
|
---|
484 | //
|
---|
485 | MArgs arg(argc, argv);
|
---|
486 |
|
---|
487 | if (arg.HasOnly("-?") || arg.HasOnly("-h") || arg.HasOnly("--help"))
|
---|
488 | {
|
---|
489 | Usage();
|
---|
490 | return -1;
|
---|
491 | }
|
---|
492 |
|
---|
493 | debug = arg.HasOnlyAndRemove("--debug") || arg.HasOnlyAndRemove("-d");
|
---|
494 | useTest = arg.HasOnlyAndRemove("--useTest") || arg.HasOnlyAndRemove("-e");
|
---|
495 | blindpix = !(arg.HasOnlyAndRemove("--skipBlindPix"));
|
---|
496 | pindiode = !(arg.HasOnlyAndRemove("--skipPINDiode"));
|
---|
497 |
|
---|
498 | if (arg.HasOption("--extractor="))
|
---|
499 | extractorflag = arg.GetIntAndRemove("--extractor=");
|
---|
500 |
|
---|
501 | if (arg.HasOption("--inpath="))
|
---|
502 | inpath = arg.GetStringAndRemove("--inpath=");
|
---|
503 |
|
---|
504 | if (arg.HasOption("--outpath="))
|
---|
505 | outpath = arg.GetStringAndRemove("--outpath=");
|
---|
506 |
|
---|
507 | if (arg.HasOption("--badfile="))
|
---|
508 | badfile = arg.GetStringAndRemove("--badfile=");
|
---|
509 |
|
---|
510 | if (gSystem->AccessPathName(badfile,kFileExists))
|
---|
511 | {
|
---|
512 | gLog << "WARNING: the bad pixels file '" << badfile.Data() << "' doesn't exist." << endl;
|
---|
513 | badfile = "";
|
---|
514 | }
|
---|
515 |
|
---|
516 | // check for the right usage of the program
|
---|
517 | //
|
---|
518 | if (arg.GetNumArguments()>6)
|
---|
519 | {
|
---|
520 | Usage();
|
---|
521 | return -1;
|
---|
522 | }
|
---|
523 |
|
---|
524 | //
|
---|
525 | // Initialize Non-GUI (batch) mode
|
---|
526 | //
|
---|
527 | gROOT->SetBatch();
|
---|
528 |
|
---|
529 | //
|
---|
530 | // Switch off the display
|
---|
531 | //
|
---|
532 | useDisplay = kTRUE;
|
---|
533 | //
|
---|
534 | // check for the arguments
|
---|
535 | //
|
---|
536 | Int_t pedr = 0;
|
---|
537 | Int_t calr1 = 0;
|
---|
538 | Int_t calr2 = 0;
|
---|
539 | Int_t datr1 = 0;
|
---|
540 | Int_t datr2 = 0;
|
---|
541 |
|
---|
542 | const Int_t nargs = arg.GetNumArguments();
|
---|
543 |
|
---|
544 | if (nargs>=5)
|
---|
545 | {
|
---|
546 | pedr = arg.GetArgumentInt(0);
|
---|
547 | calr1 = arg.GetArgumentInt(1);
|
---|
548 | calr2 = arg.GetArgumentInt(2);
|
---|
549 | datr1 = arg.GetArgumentInt(3);
|
---|
550 | datr2 = arg.GetArgumentInt(4);
|
---|
551 | return calibration(extractorflag,pedr,calr1,calr2,datr1,datr2);
|
---|
552 | }
|
---|
553 |
|
---|
554 | if (nargs>=4)
|
---|
555 | {
|
---|
556 | pedr = arg.GetArgumentInt(0);
|
---|
557 | calr1 = arg.GetArgumentInt(1);
|
---|
558 | calr2 = arg.GetArgumentInt(2);
|
---|
559 | datr1 = arg.GetArgumentInt(3);
|
---|
560 | datr2 = arg.GetArgumentInt(4);
|
---|
561 | return calibration(extractorflag,pedr,calr1,calr2,datr1,0);
|
---|
562 | }
|
---|
563 |
|
---|
564 | if (nargs>=3)
|
---|
565 | {
|
---|
566 | pedr = arg.GetArgumentInt(0);
|
---|
567 | calr1 = arg.GetArgumentInt(1);
|
---|
568 | calr2 = arg.GetArgumentInt(2);
|
---|
569 | return calibration(extractorflag,pedr,calr1,calr2,0);
|
---|
570 | }
|
---|
571 |
|
---|
572 | if (nargs>=2)
|
---|
573 | {
|
---|
574 | pedr = arg.GetArgumentInt(0);
|
---|
575 | calr1 = arg.GetArgumentInt(1);
|
---|
576 | gLog << "PEDR: " << pedr << " CALR1: " << calr1 << " CALR2 " << calr2 << endl;
|
---|
577 | gLog << "inpath: " << inpath << endl;
|
---|
578 | gLog << "extractor: " << extractorflag << endl;
|
---|
579 | return calibration(extractorflag,pedr,calr1,0,0);
|
---|
580 | }
|
---|
581 |
|
---|
582 | if (nargs>=1)
|
---|
583 | {
|
---|
584 | pedr = arg.GetArgumentInt(0);
|
---|
585 | return calibration(extractorflag,pedr,0);
|
---|
586 | }
|
---|
587 |
|
---|
588 | return calibration(extractorflag,pedr,calr1,calr2);
|
---|
589 | }
|
---|
590 |
|
---|