source: trunk/MagicSoft/Mars/mjobs/MJCalibration.h@ 7600

Last change on this file since 7600 was 7013, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 10.2 KB
Line 
1#ifndef MARS_MJCalibration
2#define MARS_MJCalibration
3
4#ifndef MARS_MJCalib
5#include "MJCalib.h"
6#endif
7#ifndef MARS_MCalibrationIntensityChargeCam
8#include "MCalibrationIntensityChargeCam.h"
9#endif
10#ifndef MARS_MCalibrationChargeCam
11#include "MCalibrationChargeCam.h"
12#endif
13#ifndef MARS_MCalibrationIntensityBlindCam
14#include "MCalibrationIntensityBlindCam.h"
15#endif
16#ifndef MARS_MCalibrationBlindCam
17#include "MCalibrationBlindCam.h"
18#endif
19#ifndef MARS_MCalibrationChargePINDiode
20#include "MCalibrationChargePINDiode.h"
21#endif
22#ifndef MARS_MCalibrationIntensityRelTimeCam
23#include "MCalibrationIntensityRelTimeCam.h"
24#endif
25#ifndef MARS_MCalibrationRelTimeCam
26#include "MCalibrationRelTimeCam.h"
27#endif
28#ifndef MARS_MCalibrationIntensityQECam
29#include "MCalibrationIntensityQECam.h"
30#endif
31#ifndef MARS_MCalibrationQECam
32#include "MCalibrationQECam.h"
33#endif
34#ifndef MARS_MBadPixelsIntensityCam
35#include "MBadPixelsIntensityCam.h"
36#endif
37#ifndef MARS_MBadPixelsCam
38#include "MBadPixelsCam.h"
39#endif
40#ifndef MARS_MPedestalCam
41#include "MPedestalCam.h"
42#endif
43
44class TH1D;
45
46class MTask;
47class MParList;
48class MPedestalCam;
49class MExtractor;
50class MExtractTime;
51class MEvtLoop;
52class MExtractBlindPixel;
53class MHCalibrationChargeBlindCam;
54class MHCamera;
55
56class MJCalibration : public MJCalib
57{
58private:
59
60 static const Int_t gkIFAEBoxInaugurationRun; //! Run number of first IFAE box calibration
61 static const Int_t gkSecondBlindPixelInstallation; //! Run number upon which second blind pixel was installed
62 static const Int_t gkSpecialPixelsContInstallation; //! Run number upon which third blind pixel was installed
63 static const Int_t gkThirdBlindPixelInstallation; //! Run number upon which third blind pixel was installed
64
65 static const TString fgReferenceFile; //! default for fReferenceFile ("mjobs/calibrationref.rc")
66 static const TString fgHiLoCalibFile; //! default for fHiLoCalibFile ("mjobs/hilocalib.root")
67
68 Double_t fConvFADC2PheMin; //! Histogram minimum for conversion factor to phes
69 Double_t fConvFADC2PheMax; //! Histogram maximum for conversion factor to phes
70 Double_t fConvFADC2PhotMin; //! Histogram minimum for conversion factor to phs
71 Double_t fConvFADC2PhotMax; //! Histogram maixmum for conversion factor to phs
72 Double_t fQEMin; //! Histogram minimum for quantum efficiency
73 Double_t fQEMax; //! Histogram maximum for quantum efficiency
74 Double_t fArrivalTimeMin; //! Histogram minimum for arrival times
75 Double_t fArrivalTimeMax; //! Histogram maximum for arrival times
76 Double_t fTimeOffsetMin; //! Histogram minimum for time offsets
77 Double_t fTimeOffsetMax; //! Histogram maximum for time offsets
78 Double_t fTimeResolutionMin; //! Histogram minimum for time resolutions
79 Double_t fTimeResolutionMax; //! Histogram maximum for time resolutions
80
81 Float_t fRefFADC2PheInner; //! Reference value for the ratio phes/charge - inner
82 Float_t fRefFADC2PheOuter; //! Reference value for the ratio phes/charge - outer
83 Float_t fRefConvFADC2PhotInner; //! Reference value for the conversion factor to phs - inner
84 Float_t fRefConvFADC2PhotOuter; //! Reference value for the conversion factor to phs - outer
85 Float_t fRefConvFADC2PheInner; //! Reference value for the conversion factor to phs - inner
86 Float_t fRefConvFADC2PheOuter; //! Reference value for the conversion factor to phs - outer
87 Float_t fRefQEInner; //! Reference value for the quantum eff. cascades - inner
88 Float_t fRefQEOuter; //! Reference value for the quantum eff. cascades - outer
89 Float_t fRefArrivalTimeInner; //! Reference value for the arrival time - inner
90 Float_t fRefArrivalTimeOuter; //! Reference value for the arrival time - outer
91 Float_t fRefArrivalTimeRmsInner; //! Reference value for the arrival time - inner
92 Float_t fRefArrivalTimeRmsOuter; //! Reference value for the arrival time - outer
93 Float_t fRefTimeOffsetInner; //! Reference value for the time offset - inner
94 Float_t fRefTimeOffsetOuter; //! Reference value for the time offset - outer
95 Float_t fRefTimeResolutionInner; //! Reference value for the time resolution - inner
96 Float_t fRefTimeResolutionOuter; //! Reference value for the time resolution - outer
97
98 TString fReferenceFile; // File name containing the reference values
99 TString fHiLoCalibFile; // File name containing the hi-lo calib. constants
100
101 MExtractor *fExtractor; // Signal extractor
102 MExtractTime *fTimeExtractor; // Arrival Time extractor
103
104 MBadPixelsIntensityCam fIntensBadCam; // Bad Pixels cam, can be set from previous runs
105 MBadPixelsCam fBadPixels; // Bad Pixels cam, can be set from previous runs
106 MCalibrationIntensityChargeCam fIntensCalibCam; // Calibration conversion factors FADC2Phe for diff. intens.
107 MCalibrationChargeCam fCalibrationCam; // Calibration conversion factors FADC2Phe
108 MCalibrationIntensityBlindCam fIntensBlindCam; // Calibration from Blind Pixel(s)
109 MCalibrationBlindCam fCalibrationBlindCam; // Calibration from Blind Pixel(s)
110 MCalibrationChargePINDiode fCalibrationPINDiode; // Calibration from PIN Diode
111 MCalibrationIntensityQECam fIntensQECam; // Quantum efficiency for diff. intensities,
112 MCalibrationQECam fQECam; // Quantum efficiency, can be set from previous runs
113 MCalibrationIntensityRelTimeCam fIntensRelTimeCam; // Calibration constants rel. times for diff. intensities
114 MCalibrationRelTimeCam fRelTimeCam; // Calibration constants rel. times
115
116 MPedestalCam fExtractorCam; // Pedestal Cam with extractor resolution
117
118 MCalibrationCam::PulserColor_t fColor; // Colour of the pulsed LEDs
119
120 enum Display_t // Possible Display types
121 {
122 kFullDisplay,
123 kDataCheckDisplay,
124 kNormalDisplay
125 };
126
127 Display_t fDisplayType; // Chosen Display type
128
129 enum { kRelTimes, kDebug, kIntensity }; // Possible flags
130
131 Byte_t fFlags; // Bit-field for the flags
132
133 TString fGeometry; // Class name geometry
134
135 Bool_t IsRelTimes () const { return TESTBIT(fFlags,kRelTimes); }
136 Bool_t IsDebug () const { return TESTBIT(fFlags,kDebug); }
137 Bool_t IsIntensity () const { return TESTBIT(fFlags,kIntensity); }
138
139 void DrawTab(MParList &plist, const char *cont, const char *name, Option_t *opt);
140
141 void DisplayResult ( MParList &plist );
142 void DisplayReferenceLines( MHCamera *cam , const Int_t what ) const;
143 void DisplayOutliers ( TH1D *hist, const char* whatsmall, const char* whatbig ) const;
144 void DisplayDoubleProject ( MHCamera *cam , const char* whatsmall, const char* whatbig ) const;
145 const Int_t CountBadPixels ( MHCamera *cam , const Int_t what ) const;
146 void FixDataCheckHist ( TH1D *hist ) const;
147
148 Bool_t WriteResult (MParList &plist);
149 //Bool_t WriteEventloop( MEvtLoop &evtloop ) const;
150 Bool_t WriteTasks ( MTask *t1, MTask *t2) const;
151 Bool_t CheckEnvLocal ();
152
153 // WORKAROUNDS!!!
154 void InitBlindPixel(MExtractBlindPixel &blindext,
155 MHCalibrationChargeBlindCam &blindcam);
156
157 const char* GetOutputFileName() const;
158
159 void ReadReferenceFile();
160 Bool_t ReadHiLoCalibFile();
161
162public:
163 MJCalibration(const char *name=NULL, const char *title=NULL);
164
165 MCalibrationIntensityChargeCam &GetIntensCalibrationCam() { return fIntensCalibCam; }
166 MCalibrationIntensityRelTimeCam &GetIntensRelTimeCam() { return fIntensRelTimeCam; }
167 MCalibrationIntensityQECam &GetIntensQECam() { return fIntensQECam; }
168 MBadPixelsIntensityCam &GetIntensBadCam() { return fIntensBadCam; }
169
170 MCalibrationChargeCam &GetCalibrationCam() { return fCalibrationCam; }
171 MCalibrationRelTimeCam &GetRelTimeCam() { return fRelTimeCam; }
172 MCalibrationQECam &GetQECam() { return fQECam; }
173 MBadPixelsCam &GetBadPixels() { return fBadPixels; }
174
175 // Containers and pointers
176 void SetBadPixels ( const MBadPixelsCam &bad) { bad.Copy(fBadPixels); }
177 void SetColor ( const MCalibrationCam::PulserColor_t color) { fColor = color; }
178 void SetExtractor ( MExtractor* ext) { fExtractor = ext; }
179 void SetExtractorCam ( const MPedestalCam &ped) { ped.Copy(fExtractorCam); fExtractorCam.SetName(ped.GetName()); }
180 void SetQECam ( const MCalibrationQECam &qe) { qe.Copy(fQECam); }
181 void SetTimeExtractor( MExtractTime* ext) { fTimeExtractor = ext; }
182
183 // Displays
184 void SetFullDisplay() { fDisplayType = kFullDisplay; }
185 void SetDataCheckDisplay() { fDisplayType = kDataCheckDisplay; }
186 void SetNormalDisplay() { fDisplayType = kNormalDisplay; }
187
188 // Camera Geomtry
189 void SetGeometry(const char *geom) { fGeometry = geom; }
190
191 // Flags
192 void SetRelTimeCalibration( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags,kRelTimes) : CLRBIT(fFlags,kRelTimes); }
193 void SetDebug ( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags,kDebug) : CLRBIT(fFlags,kDebug); }
194 void SetIntensity ( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags,kIntensity) : CLRBIT(fFlags,kIntensity); }
195
196 // Files
197 void SetReferenceFile( const TString ref=fgReferenceFile ) { fReferenceFile = ref; }
198 void SetHiLoCalibFile( const TString ref=fgHiLoCalibFile ) { fHiLoCalibFile = ref; }
199
200 // Precessing
201 Bool_t Process(MPedestalCam &pedcam);
202
203 ClassDef(MJCalibration, 0) // Tool to run a calibration per pulser colour and intensity
204};
205
206#endif
Note: See TracBrowser for help on using the repository browser.