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 | static const TString outpath = "./";
|
---|
58 | static const TString inpath = "./";
|
---|
59 | //static const TString inpath = "/home/rootdata/Calib/";
|
---|
60 | //
|
---|
61 | // Tell if you want to calibrate times:
|
---|
62 | //
|
---|
63 | static const Bool_t useTimes = kTRUE;
|
---|
64 | //
|
---|
65 | // the default pedestal run for the calibration
|
---|
66 | //
|
---|
67 | static const Int_t pedrun = 26210;
|
---|
68 | //
|
---|
69 | // the default start calibration run
|
---|
70 | //
|
---|
71 | static const Int_t calrun1 = 26209;
|
---|
72 | //
|
---|
73 | // the default last calibration run (if 0, only one run is taken, otherwise consecutive runs
|
---|
74 | // between calrun1 and calrun2)
|
---|
75 | //
|
---|
76 | static const Int_t calrun2 = 0;
|
---|
77 | //
|
---|
78 | // A switch to output debugging information about Objects use
|
---|
79 | //
|
---|
80 | static const Bool_t debug = kFALSE;
|
---|
81 | //
|
---|
82 | void calibration(const Int_t prun=pedrun, const Int_t crun1=calrun1, const Int_t crun2=calrun2)
|
---|
83 | {
|
---|
84 |
|
---|
85 |
|
---|
86 | TObject::SetObjectStat(kTRUE);
|
---|
87 |
|
---|
88 | //
|
---|
89 | // Choose the signal Extractor:
|
---|
90 | //
|
---|
91 | // MExtractFixedWindowPeakSearch extractor;
|
---|
92 | // MExtractSlidingWindow extractor;
|
---|
93 | MExtractFixedWindow extractor;
|
---|
94 |
|
---|
95 | //
|
---|
96 | // Set Ranges or Windows
|
---|
97 | //
|
---|
98 | extractor.SetRange(3,14,3,14);
|
---|
99 | // extractor.SetWindows(8,8);
|
---|
100 |
|
---|
101 | //
|
---|
102 | // Choose the arrival time Extractor:
|
---|
103 | //
|
---|
104 | // MExtractTimeHighestIntegral timeext;
|
---|
105 | MExtractTimeFastSpline timeext;
|
---|
106 | //
|
---|
107 | // Set Ranges or Windows
|
---|
108 | //
|
---|
109 | timeext.SetRange(2,12,4,14);
|
---|
110 |
|
---|
111 | MRunIter pruns;
|
---|
112 | MRunIter cruns;
|
---|
113 |
|
---|
114 | pruns.AddRun(prun,inpath);
|
---|
115 |
|
---|
116 | if (crun2==0)
|
---|
117 | cruns.AddRun(crun1,inpath);
|
---|
118 | else
|
---|
119 | cruns.AddRuns(crun1,crun2,inpath);
|
---|
120 |
|
---|
121 | gStyle->SetOptStat(1);
|
---|
122 | gStyle->SetOptFit();
|
---|
123 |
|
---|
124 | MStatusDisplay *display = new MStatusDisplay;
|
---|
125 | display->SetUpdateTime(3000);
|
---|
126 | display->Resize(850,700);
|
---|
127 |
|
---|
128 | /************************************/
|
---|
129 | /* FIRST LOOP: PEDESTAL COMPUTATION */
|
---|
130 | /************************************/
|
---|
131 |
|
---|
132 | MCalibrationQECam qecam;
|
---|
133 | MBadPixelsCam badcam;
|
---|
134 | MGeomCamMagic geomcam;
|
---|
135 | MGeomApply geomapl;
|
---|
136 | //
|
---|
137 | // If you want to exclude pixels from the beginning, read
|
---|
138 | // an ascii-file with the corr. pixel numbers (see MBadPixelsCam)
|
---|
139 | //
|
---|
140 | // badcam.AsciiRead("badpixels.dat");
|
---|
141 |
|
---|
142 | MJPedestal pedloop;
|
---|
143 | pedloop.SetExtractor(&extractor);
|
---|
144 | pedloop.SetInput(&pruns);
|
---|
145 | pedloop.SetOutputPath(outpath.Data());
|
---|
146 | pedloop.SetDisplay(display);
|
---|
147 | pedloop.SetBadPixels(badcam);
|
---|
148 |
|
---|
149 | if (!pedloop.Process())
|
---|
150 | return;
|
---|
151 |
|
---|
152 | /****************************************/
|
---|
153 | /* SECOND LOOP: CALIBRATION COMPUTATION */
|
---|
154 | /****************************************/
|
---|
155 |
|
---|
156 | MJCalibration calloop;
|
---|
157 |
|
---|
158 | //
|
---|
159 | // If you want to run the data-check on RAW DATA!!!, choose:
|
---|
160 | // calloop.SetDataCheck();
|
---|
161 | //
|
---|
162 | // If you want to see the data-check plots only, choose:
|
---|
163 | // calloop.SetDataCheckDisplay();
|
---|
164 | //
|
---|
165 | // For everything, you have ever dreamed of, choose:
|
---|
166 | // calloop.SetFullDisplay();
|
---|
167 |
|
---|
168 | //
|
---|
169 | // If you want to calibrate the times as well, choose:
|
---|
170 | //
|
---|
171 | calloop.SetRelTimeCalibration(useTimes);
|
---|
172 | calloop.SetExtractor(&extractor);
|
---|
173 | calloop.SetTimeExtractor(&timeext);
|
---|
174 | calloop.SetInput(&cruns);
|
---|
175 | calloop.SetOutputPath(outpath.Data());
|
---|
176 | calloop.SetDisplay(display);
|
---|
177 | calloop.SetQECam(qecam);
|
---|
178 | calloop.SetBadPixels(pedloop.GetBadPixels());
|
---|
179 |
|
---|
180 | calloop.Process(pedloop.GetPedestalCam());
|
---|
181 |
|
---|
182 | /********************************************************************/
|
---|
183 | /* THIRD LOOP: APPLY CALIBRATION TO THE CALIBRATION FILES FOR TESTS */
|
---|
184 | /********************************************************************/
|
---|
185 |
|
---|
186 | MJExtractCalibTest testloop;
|
---|
187 |
|
---|
188 | testloop.SetExtractor(&extractor);
|
---|
189 | testloop.SetTimeExtractor(&timeext);
|
---|
190 | testloop.SetInput(&cruns);
|
---|
191 | testloop.SetOutputPath(outpath);
|
---|
192 | testloop.SetDisplay(display);
|
---|
193 | testloop.SetBadPixels(calloop.GetBadPixels());
|
---|
194 | testloop.ProcessD(pedloop.GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam());
|
---|
195 | if (useTimes)
|
---|
196 | testloop.ProcessT(pedloop.GetPedestalCam(),calloop.GetRelTimeCam());
|
---|
197 |
|
---|
198 | TObject::SetObjectStat(kFALSE);
|
---|
199 | //
|
---|
200 | // List of useful containers:
|
---|
201 | //
|
---|
202 | if (debug)
|
---|
203 | gObjectTable->Print();
|
---|
204 |
|
---|
205 | //
|
---|
206 | // List of useful containers:
|
---|
207 | //
|
---|
208 | /*
|
---|
209 | MPedestalCam &pedcam = pedloop.GetPedestalCam();
|
---|
210 | MCalibrationChargeCam &chargecam = calloop.GetCalibrationCam();
|
---|
211 | MCalibrationQECam &qecam = calloop.GetCalibrationCam();
|
---|
212 | MBadPixelsCam &badcam = calloop.GetBadPixels();
|
---|
213 | MHCalibrationTestCam &testcam = testloop.GetTestCam();
|
---|
214 | MHCalibrationTestTimeCam &testtime = testloop.GetTestTimeCam();
|
---|
215 | */
|
---|
216 | }
|
---|
217 |
|
---|
218 |
|
---|