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

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