source: tags/Mars-V0.8.5/macros/readCalibration.C

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