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