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 | // readCalibration.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 | //
|
---|
34 | /////////////////////////////////////////////////////////////////////////////
|
---|
35 | static const TString inpath = ".";
|
---|
36 | //
|
---|
37 | // Tell if you want to calibrate times:
|
---|
38 | //
|
---|
39 | static const Bool_t useTimes = kTRUE;
|
---|
40 | //
|
---|
41 | // the default pedestal run for the calibration
|
---|
42 | //
|
---|
43 | static const Int_t pedrun = 26210;
|
---|
44 | //
|
---|
45 | // the default start calibration run
|
---|
46 | //
|
---|
47 | static const Int_t calrun = 26209;
|
---|
48 | //
|
---|
49 | // A switch to output debugging information about Objects use
|
---|
50 | //
|
---|
51 | static const Bool_t debug = kFALSE;
|
---|
52 | //
|
---|
53 | void readCalibration(const Int_t prun=pedrun, const Int_t crun=calrun)
|
---|
54 | {
|
---|
55 |
|
---|
56 | const TString pedname = Form("%s/%i-F0.root", (const char*)inpath,prun);
|
---|
57 | const TString calname = Form("%s/%i-F1.root", (const char*)inpath,crun);
|
---|
58 | const TString testname = Form("%s/%i-Test.root", (const char*)inpath,crun);
|
---|
59 |
|
---|
60 | if (gSystem->AccessPathName(pedname, kFileExists))
|
---|
61 | {
|
---|
62 | cout << "Input file " << pedname << " doesn't exist." << endl;
|
---|
63 | return;
|
---|
64 | }
|
---|
65 |
|
---|
66 | if (gSystem->AccessPathName(calname, kFileExists))
|
---|
67 | {
|
---|
68 | cout << "Input file " << calname << " doesn't exist." << endl;
|
---|
69 | return;
|
---|
70 | }
|
---|
71 |
|
---|
72 | if (gSystem->AccessPathName(testname, kFileExists))
|
---|
73 | {
|
---|
74 | cout << "Input file " << testname << " doesn't exist." << endl;
|
---|
75 | return;
|
---|
76 | }
|
---|
77 |
|
---|
78 | MStatusDisplay *display = new MStatusDisplay;
|
---|
79 | MPedestalCam pedcam;
|
---|
80 | MCalibrationChargeCam chargecam;
|
---|
81 | MCalibrationQECam qecam;
|
---|
82 | MCalibrationRelTimeCam reltimecam;
|
---|
83 | MBadPixelsCam badcam;
|
---|
84 | MHCalibrationTestCam testcam;
|
---|
85 | MHCalibrationTestTimeCam testtime;
|
---|
86 |
|
---|
87 | cout << "Reading from file: " << pedname << endl;
|
---|
88 |
|
---|
89 | TFile pedfile(pedname, "READ");
|
---|
90 | if (pedcam.Read()<=0)
|
---|
91 | {
|
---|
92 | cout << "Unable to read MPedestalCam from " << pedname << endl;
|
---|
93 | return;
|
---|
94 | }
|
---|
95 |
|
---|
96 | if (display->GetCanvas("Pedestals"))
|
---|
97 | display->Read();
|
---|
98 |
|
---|
99 | cout << "Reading from file: " << calname << endl;
|
---|
100 |
|
---|
101 | TFile calfile(calname, "READ");
|
---|
102 | if (chargecam.Read()<=0)
|
---|
103 | {
|
---|
104 | cout << "Unable to read MCalibrationChargeCam from " << calname << endl;
|
---|
105 | return;
|
---|
106 | }
|
---|
107 |
|
---|
108 | if (qecam.Read()<=0)
|
---|
109 | {
|
---|
110 | cout << "Unable to read MCalibrationQECam from " << calname << endl;
|
---|
111 | return;
|
---|
112 | }
|
---|
113 |
|
---|
114 | if (reltimecam.Read()<=0)
|
---|
115 | {
|
---|
116 | cout << "Unable to read MCalibrationRelTimeCam from " << calname << endl;
|
---|
117 | return;
|
---|
118 | }
|
---|
119 |
|
---|
120 | if (calfile.FindKey("MBadPixelsCam"))
|
---|
121 | {
|
---|
122 | MBadPixelsCam bad;
|
---|
123 | if (bad.Read()<=0)
|
---|
124 | {
|
---|
125 | cout << "Unable to read MBadPixelsCam from " << calname << endl;
|
---|
126 | return;
|
---|
127 | }
|
---|
128 | badcam.Merge(bad);
|
---|
129 | }
|
---|
130 |
|
---|
131 | display->Read();
|
---|
132 |
|
---|
133 | cout << "Reading from file: " << testname << endl;
|
---|
134 |
|
---|
135 | TFile testfile(testname, "READ");
|
---|
136 | if (testcam.Read()<=0)
|
---|
137 | {
|
---|
138 | cout << "Unable to read MHCalibrationTestCam from " << testname << endl;
|
---|
139 | return;
|
---|
140 | }
|
---|
141 | if (testtime.Read()<=0)
|
---|
142 | {
|
---|
143 | cout << "Unable to read MHCalibrationTestTimeCam from " << testname << endl;
|
---|
144 | return;
|
---|
145 | }
|
---|
146 |
|
---|
147 | display->Read();
|
---|
148 |
|
---|
149 | MCalibrationChargePix &pix = chargecam[100];
|
---|
150 | cout << pix.GetPheFFactorMethod() << endl;
|
---|
151 |
|
---|
152 | MCalibrationChargePix &innpix = chargecam.GetAverageArea(0);
|
---|
153 | cout << innpix.GetPheFFactorMethod() << endl;
|
---|
154 |
|
---|
155 | //
|
---|
156 | // List of interesting plots:
|
---|
157 | //
|
---|
158 | /*
|
---|
159 | testcam.GetAverageHiGainArea(0).DrawClone();
|
---|
160 | testcam.GetAverageLoGainArea(0).DrawClone();
|
---|
161 | testcam.GetAverageHiGainArea(1).DrawClone();
|
---|
162 | testcam.GetAverageLoGainArea(1).DrawClone();
|
---|
163 |
|
---|
164 | testcam.GetAverageHiGainSector(1).DrawClone();
|
---|
165 | testcam.GetAverageLoGainSector(1).DrawClone();
|
---|
166 | testcam.GetAverageHiGainSector(2).DrawClone();
|
---|
167 | testcam.GetAverageLoGainSector(2).DrawClone();
|
---|
168 | testcam.GetAverageHiGainSector(3).DrawClone();
|
---|
169 | testcam.GetAverageLoGainSector(3).DrawClone();
|
---|
170 | testcam.GetAverageHiGainSector(4).DrawClone();
|
---|
171 | testcam.GetAverageLoGainSector(4).DrawClone();
|
---|
172 | testcam.GetAverageHiGainSector(5).DrawClone();
|
---|
173 | testcam.GetAverageLoGainSector(5).DrawClone();
|
---|
174 | testcam.GetAverageHiGainSector(6).DrawClone();
|
---|
175 | testcam.GetAverageLoGainSector(6).DrawClone();
|
---|
176 | */
|
---|
177 |
|
---|
178 |
|
---|
179 |
|
---|
180 |
|
---|
181 | }
|
---|
182 |
|
---|