source: trunk/MagicSoft/Mars/macros/calibration.C@ 4054

Last change on this file since 4054 was 3925, checked in by gaug, 21 years ago
*** empty log message ***
File size: 5.7 KB
Line 
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/////////////////////////////////////////////////////////////////////////////
57static const TString inpath = "/mnt/Data/rootdata/Miscellaneous/2004_03_03/";
58static const Int_t pedrun = 20123;
59static const Int_t calrun1 = 20125;
60static const Int_t calrun2 = 0;
61
62void calibration(const Int_t prun=pedrun, const Int_t crun1=calrun1, const Int_t crun2=calrun2)
63{
64
65
66 //
67 // Choose the signal Extractor:
68 //
69 MExtractFixedWindowPeakSearch extractor;
70 // MExtractSlidingWindow extractor;
71 // MExtractFixedWindow extractor;
72
73 //
74 // Set Ranges or Windows
75 //
76 // extractor.SetRange(2,14,5,14);
77 // extractor.SetWindows(8,8);
78
79 //
80 // Choose the arrival time Extractor:
81 //
82 MExtractTimeHighestIntegral timeext;
83 // MExtractTimeSpline timeext;
84 //
85 // Set Ranges or Windows
86 //
87 // timeext.SetRange(0,14,6,14);
88
89 //
90 // Tell if you want to calibrate times:
91 //
92 Bool_t useTimes = kTRUE;
93 // Bool_t calibrateTimes = kFALSE;
94
95 MRunIter pruns;
96 MRunIter cruns;
97
98 pruns.AddRun(prun,inpath);
99
100 if (crun2==0)
101 cruns.AddRun(crun1,inpath);
102 else
103 cruns.AddRuns(crun1,crun2,inpath);
104
105 gStyle->SetOptStat(1);
106 gStyle->SetOptFit();
107
108 MStatusDisplay *display = new MStatusDisplay;
109 display->SetUpdateTime(3000);
110 display->Resize(850,700);
111
112 /************************************/
113 /* FIRST LOOP: PEDESTAL COMPUTATION */
114 /************************************/
115
116 MCalibrationQECam qecam;
117 MBadPixelsCam badcam;
118 MGeomCamMagic geomcam;
119 MGeomApply geomapl;
120 //
121 // If you want to exclude pixels from the beginning, read
122 // an ascii-file with the corr. pixel numbers (see MBadPixelsCam)
123 //
124 badcam.AsciiRead("badpixels.dat");
125
126 MJPedestal pedloop;
127 pedloop.SetExtractor(&extractor);
128 pedloop.SetInput(&pruns);
129 pedloop.SetDisplay(display);
130 pedloop.SetBadPixels(badcam);
131
132 if (!pedloop.Process())
133 return;
134
135 /****************************************/
136 /* SECOND LOOP: CALIBRATION COMPUTATION */
137 /****************************************/
138
139 MJCalibration calloop;
140
141 //
142 // If you want to run the data-check on RAW DATA!!!, choose:
143 // calloop.SetDataCheck();
144 //
145 // If you want to see the data-check plots only, choose:
146 // calloop.SetDataCheckDisplay();
147 //
148 // For everything, you have ever dreamed of, choose:
149 // calloop.SetFullDisplay();
150
151 //
152 // If you want to calibrate the times as well, choose:
153 //
154 calloop.SetRelTimeCalibration(useTimes);
155 calloop.SetExtractor(&extractor);
156 calloop.SetTimeExtractor(&timeext);
157 calloop.SetInput(&cruns);
158 calloop.SetDisplay(display);
159 calloop.SetQECam(qecam);
160 calloop.SetBadPixels(pedloop.GetBadPixels());
161 if (!calloop.Process(pedloop.GetPedestalCam()))
162 return;
163
164 /*
165 MCalibrationChargeCam &chargecam = calloop.GetCalibrationCam();
166 MLog juanlog;
167 juanlog.SetOutputFile("test.txt",1);
168 chargecam.SetLogStream(&juanlog);
169 chargecam.Print();
170 chargecam.SetLogStream(&gLog);
171 */
172
173 /********************************************************************/
174 /* THIRD LOOP: APPLY CALIBRATION TO THE CALIBRATION FILES FOR TESTS */
175 /********************************************************************/
176
177 MJExtractCalibTest testloop;
178
179 testloop.SetExtractor(&extractor);
180 testloop.SetInput(&cruns);
181 testloop.SetDisplay(display);
182 testloop.SetBadPixels(calloop.GetBadPixels());
183 testloop.ProcessD(pedloop.GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam());
184
185}
186
Note: See TracBrowser for help on using the repository browser.