source: trunk/Mars/macros/readCalibration.C@ 13408

Last change on this file since 13408 was 6609, checked in by gaug, 20 years ago
*** empty log message ***
File size: 3.9 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// the default start calibration run
38//
39static const Int_t calrun = 26209;
40//
41// Tell if you want to use the display:
42//
43static Bool_t useDisplay = kFALSE;
44//
45void readCalibration(const Int_t crun=calrun)
46{
47
48 const TString calname = Form("%s/calib%08d.root", (const char*)inpath,crun);
49
50 if (gSystem->AccessPathName(calname, kFileExists))
51 {
52 cout << "Input file " << calname << " doesn't exist." << endl;
53 return;
54 }
55
56 MStatusDisplay = NULL;
57
58 if (useDisplay)
59 display = new MStatusDisplay;
60
61 MPedestalCam pedcam;
62 MCalibrationChargeCam chargecam;
63 MCalibrationQECam qecam;
64 MCalibrationRelTimeCam relcam;
65 MBadPixelsCam badcam;
66
67 cout << "Reading from file: " << calname << endl;
68
69 TFile calfile(calname, "READ");
70 if (chargecam.Read()<=0)
71 {
72 cout << "Unable to read MCalibrationChargeCam from " << calname << endl;
73 return;
74 }
75 if (qecam.Read()<=0)
76 {
77 cout << "Unable to read MCalibrationQECam from " << calname << endl;
78 return;
79 }
80
81 if (calfile.FindKey("MBadPixelsCam"))
82 {
83 MBadPixelsCam bad;
84 if (bad.Read()<=0)
85 {
86 cout << "Unable to read MBadPixelsCam from " << calname << endl;
87 return;
88 }
89 badcam.Merge(bad);
90 }
91 if (relcam.Read()<=0)
92 {
93 cout << "Unable to read MCalibrationRelTimeCam from " << calname << endl;
94 return;
95 }
96
97 cout << "Size of QECam: " << qecam.GetSize() << endl;
98 cout << "Size of Chargecam: " << chargecam.GetSize() << endl;
99 cout << "Size of RelTimeCam: " << relcam.GetSize() << endl;
100
101 MGeomCamMagic geom;
102
103 if (useDisplay)
104 display->Read();
105
106 for (Int_t i=0; i<relcam.GetSize(); i++)
107 {
108 MCalibrationRelTimePix &rpix = (MCalibrationRelTimePix&)relcam[i];
109 MBadPixelsPix &badpix = badcam[i];
110 if (!badpix.IsUnsuitable())
111 cout << "Number of outliers in time pixel: " << i << ": " << rpix.GetNumPickup()+rpix.GetNumBlackout() << endl;
112 }
113
114 for (Int_t i=0; i<2; i++)
115 {
116 TArrayF conv = chargecam.GetAveragedConvFADC2PhotPerArea(geom,qecam,i,&badcam);
117 cout << "Average Conv Factor Area idx: " << i << ": " << conv[0] << "+-" << conv[1] << endl;
118 }
119
120 for (Int_t i=0; i<qecam.GetSize(); i++)
121 {
122 MCalibrationChargePix &cpix = (MCalibrationChargePix&)chargecam[i];
123 MCalibrationQEPix &qpix = (MCalibrationQEPix&) qecam[i];
124 MBadPixelsPix &bpix = badcam[i];
125 if (!bpix.IsUnsuitable())
126 cout << "Conversion Factor: " << cpix.GetMeanConvFADC2Phe() / qpix.GetQECascadesFFactor() << endl;
127 }
128
129}
130
Note: See TracBrowser for help on using the repository browser.