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

Last change on this file since 5028 was 5017, checked in by gaug, 20 years ago
*** empty log message ***
File size: 9.3 KB
Line 
1#ifndef MARS_MJCalibration
2#define MARS_MJCalibration
3
4#ifndef MARS_MJob
5#include "MJob.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
41class TH1D;
42
43class MTask;
44class MRunIter;
45class MParList;
46class MPedestalCam;
47class MExtractor;
48class MExtractTime;
49class MEvtLoop;
50class MExtractBlindPixel;
51class MHCalibrationChargeBlindCam;
52class MHCamera;
53
54class MJCalibration : public MJob
55{
56private:
57
58 static const Int_t gkIFAEBoxInaugurationRun; //! Run number of first IFAE box calibration
59 static const Int_t gkSecondBlindPixelInstallation; //! Run number upon which second blind pixel was installed
60 static const Int_t gkThirdBlindPixelInstallation; //! Run number upon which third blind pixel was installed
61
62 static const Double_t fgConvFADC2PheMin; //! Histogram minimum for conversion factor to phes
63 static const Double_t fgConvFADC2PheMax; //! Histogram maximum for conversion factor to phes
64 static const Double_t fgConvFADC2PhotMin; //! Histogram minimum for conversion factor to phs
65 static const Double_t fgConvFADC2PhotMax; //! Histogram maixmum for conversion factor to phs
66 static const Double_t fgQEMin; //! Histogram minimum for quantum efficiency
67 static const Double_t fgQEMax; //! Histogram maximum for quantum efficiency
68 static const Double_t fgArrivalTimeMin; //! Histogram minimum for arrival times
69 static const Double_t fgArrivalTimeMax; //! Histogram maximum for arrival times
70
71 static const Float_t fgRefConvFADC2PheInner; //! Reference value for the conversion factor to phes - inner
72 static const Float_t fgRefConvFADC2PheOuter; //! Reference value for the conversion factor to phes - outer
73 static const Float_t fgRefConvFADC2PhotInner; //! Reference value for the conversion factor to phs - inner
74 static const Float_t fgRefConvFADC2PhotOuter; //! Reference value for the conversion factor to phs - outer
75 static const Float_t fgRefQEInner; //! Reference value for the quantum eff. cascades - inner
76 static const Float_t fgRefQEOuter; //! Reference value for the quantum eff. cascades - outer
77 static const Float_t fgRefArrivalTimeInner; //! Reference value for the arrival time - inner
78 static const Float_t fgRefArrivalTimeOuter; //! Reference value for the arrival time - outer
79 static const Float_t fgRefArrivalTimeRmsInner; //! Reference value for the arrival time - inner
80 static const Float_t fgRefArrivalTimeRmsOuter; //! Reference value for the arrival time - outer
81
82 MRunIter *fRuns; // Calibration files
83
84 MExtractor *fExtractor; // Signal extractor
85 MExtractTime *fTimeExtractor; // Arrival Time extractor
86
87 MBadPixelsIntensityCam fIntensBadCam; // Bad Pixels cam, can be set from previous runs
88 MBadPixelsCam fBadPixels; // Bad Pixels cam, can be set from previous runs
89 MCalibrationIntensityChargeCam fIntensCalibCam; // Calibration conversion factors FADC2Phe for diff. intens.
90 MCalibrationChargeCam fCalibrationCam; // Calibration conversion factors FADC2Phe
91 MCalibrationIntensityBlindCam fIntensBlindCam; // Calibration from Blind Pixel(s)
92 MCalibrationBlindCam fCalibrationBlindCam; // Calibration from Blind Pixel(s)
93 MCalibrationChargePINDiode fCalibrationPINDiode; // Calibration from PIN Diode
94 MCalibrationIntensityQECam fIntensQECam; // Quantum efficiency for diff. intensities,
95 MCalibrationQECam fQECam; // Quantum efficiency, can be set from previous runs
96 MCalibrationIntensityRelTimeCam fIntensRelTimeCam; // Calibration constants rel. times for diff. intensities
97 MCalibrationRelTimeCam fRelTimeCam; // Calibration constants rel. times
98
99 MCalibrationCam::PulserColor_t fColor; // Colour of the pulsed LEDs
100
101 enum Display_t // Possible Display types
102 {
103 kFullDisplay,
104 kDataCheckDisplay,
105 kNormalDisplay
106 };
107
108 Display_t fDisplayType; // Chosen Display type
109
110 enum Device_t // Possible devices for calibration
111 {
112 kUseBlindPixel,
113 kUsePINDiode
114 };
115
116 Byte_t fDevices; // Bit-field for used devices for calibration
117
118 enum { kRelTimes, kDataCheck, kDebug, kIntensity }; // Possible flags
119
120 Byte_t fFlags; // Bit-field for the flags
121
122 TString fGeometry; // Class name geometry
123
124 void DisplayResult ( MParList &plist );
125 void DisplayReferenceLines( MHCamera *cam , const Int_t what ) const;
126 void DisplayOutliers ( TH1D *hist, const char* whatsmall, const char* whatbig ) const;
127 void DisplayDoubleProject ( MHCamera *cam , const char* whatsmall, const char* whatbig ) const;
128 const Int_t CountBadPixels ( MHCamera *cam , const Int_t what ) const;
129 void FixDataCheckHist ( TH1D *hist ) const;
130
131 Bool_t WriteResult ( TObject *geom );
132 Bool_t WriteEventloop( MEvtLoop &evtloop ) const;
133 Bool_t WriteTasks ( MTask *t1, MTask *t2) const;
134 Bool_t CheckEnvLocal ();
135
136 // WORKAROUNDS!!!
137 Bool_t FindColor();
138 void InitBlindPixel(MExtractBlindPixel &blindext,
139 MHCalibrationChargeBlindCam &blindcam);
140
141public:
142 MJCalibration(const char *name=NULL, const char *title=NULL);
143
144 const char* GetOutputFile() const;
145
146 MCalibrationIntensityChargeCam &GetIntensCalibrationCam() { return fIntensCalibCam; }
147 MCalibrationIntensityRelTimeCam &GetIntensRelTimeCam() { return fIntensRelTimeCam; }
148 MCalibrationIntensityQECam &GetIntensQECam() { return fIntensQECam; }
149 MBadPixelsIntensityCam &GetIntensBadCam() { return fIntensBadCam; }
150
151 MCalibrationChargeCam &GetCalibrationCam() { return fCalibrationCam; }
152 MCalibrationRelTimeCam &GetRelTimeCam() { return fRelTimeCam; }
153 MCalibrationQECam &GetQECam() { return fQECam; }
154 MBadPixelsCam &GetBadPixels() { return fBadPixels; }
155
156 Bool_t IsUseBlindPixel() const;
157 Bool_t IsUsePINDiode () const;
158
159 Bool_t IsRelTimes () const { return TESTBIT(fFlags,kRelTimes); }
160 Bool_t IsDataCheck () const { return TESTBIT(fFlags,kDataCheck); }
161 Bool_t IsDebug () const { return TESTBIT(fFlags,kDebug); }
162 Bool_t IsIntensity () const { return TESTBIT(fFlags,kIntensity); }
163
164 void SetBadPixels(const MBadPixelsCam &bad) { bad.Copy(fBadPixels); }
165 void SetExtractor(MExtractor* ext) { fExtractor = ext; }
166 void SetTimeExtractor(MExtractTime* ext) { fTimeExtractor = ext; }
167 void SetQECam(const MCalibrationQECam &qe) { qe.Copy(fQECam); }
168 void SetColor(const MCalibrationCam::PulserColor_t color) { fColor = color; }
169 void SetInput(MRunIter *iter) { fRuns = iter; }
170
171 // Displays
172 void SetFullDisplay() { fDisplayType = kFullDisplay; }
173 void SetDataCheckDisplay() { fDisplayType = kDataCheckDisplay; }
174 void SetNormalDisplay() { fDisplayType = kNormalDisplay; }
175
176 // Camera Geomtry
177 void SetGeometry(const char *geom) { fGeometry = geom; }
178
179 // Flags
180 void SetRelTimeCalibration( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags,kRelTimes) : CLRBIT(fFlags,kRelTimes); }
181 void SetDataCheck ( const Bool_t b=kTRUE ) { b ? SetDataCheckDisplay(), SETBIT(fFlags,kDataCheck)
182 : CLRBIT(fFlags,kDataCheck); }
183 void SetDebug ( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags,kDebug) : CLRBIT(fFlags,kDebug); }
184 void SetIntensity ( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags,kIntensity) : CLRBIT(fFlags,kIntensity); }
185
186 // Devices
187 void SetUseBlindPixel(const Bool_t b=kTRUE);
188 void SetUsePINDiode(const Bool_t b=kTRUE);
189
190 // Precessing
191 Bool_t ReadCalibrationCam();
192 Bool_t ProcessFile(MPedestalCam &pedcam);
193 Bool_t Process(MPedestalCam &pedcam);
194
195 ClassDef(MJCalibration, 0) // Tool to run a calibration per pulser colour and intensity
196};
197
198#endif
Note: See TracBrowser for help on using the repository browser.