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

Last change on this file since 6078 was 6078, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 10.8 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#ifndef MARS_MPedestalCam
41#include "MPedestalCam.h"
42#endif
43
44class TH1D;
45
46class MTask;
47class MRunIter;
48class MParList;
49class MPedestalCam;
50class MExtractor;
51class MExtractTime;
52class MEvtLoop;
53class MExtractBlindPixel;
54class MHCalibrationChargeBlindCam;
55class MHCamera;
56
57class MJCalibration : public MJob
58{
59private:
60
61 static const Int_t gkIFAEBoxInaugurationRun; //! Run number of first IFAE box calibration
62 static const Int_t gkSecondBlindPixelInstallation; //! Run number upon which second blind pixel was installed
63 static const Int_t gkSpecialPixelsContInstallation; //! Run number upon which third blind pixel was installed
64 static const Int_t gkThirdBlindPixelInstallation; //! Run number upon which third blind pixel was installed
65
66 static const TString fgReferenceFile; //! default for fReferenceFile ("mjobs/calibrationref.rc")
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
77 Float_t fRefConvFADC2PheInner; //! Reference value for the conversion factor to phes - inner
78 Float_t fRefConvFADC2PheOuter; //! Reference value for the conversion factor to phes - outer
79 Float_t fRefConvFADC2PhotInner; //! Reference value for the conversion factor to phs - inner
80 Float_t fRefConvFADC2PhotOuter; //! Reference value for the conversion factor to phs - outer
81 Float_t fRefQEInner; //! Reference value for the quantum eff. cascades - inner
82 Float_t fRefQEOuter; //! Reference value for the quantum eff. cascades - outer
83 Float_t fRefArrivalTimeInner; //! Reference value for the arrival time - inner
84 Float_t fRefArrivalTimeOuter; //! Reference value for the arrival time - outer
85 Float_t fRefArrivalTimeRmsInner; //! Reference value for the arrival time - inner
86 Float_t fRefArrivalTimeRmsOuter; //! Reference value for the arrival time - outer
87
88 TString fReferenceFile; // File name containing the reference values
89
90 MRunIter *fRuns; // Calibration files
91
92 MExtractor *fExtractor; // Signal extractor
93 MExtractTime *fTimeExtractor; // Arrival Time extractor
94
95 MBadPixelsIntensityCam fIntensBadCam; // Bad Pixels cam, can be set from previous runs
96 MBadPixelsCam fBadPixels; // Bad Pixels cam, can be set from previous runs
97 MCalibrationIntensityChargeCam fIntensCalibCam; // Calibration conversion factors FADC2Phe for diff. intens.
98 MCalibrationChargeCam fCalibrationCam; // Calibration conversion factors FADC2Phe
99 MCalibrationIntensityBlindCam fIntensBlindCam; // Calibration from Blind Pixel(s)
100 MCalibrationBlindCam fCalibrationBlindCam; // Calibration from Blind Pixel(s)
101 MCalibrationChargePINDiode fCalibrationPINDiode; // Calibration from PIN Diode
102 MCalibrationIntensityQECam fIntensQECam; // Quantum efficiency for diff. intensities,
103 MCalibrationQECam fQECam; // Quantum efficiency, can be set from previous runs
104 MCalibrationIntensityRelTimeCam fIntensRelTimeCam; // Calibration constants rel. times for diff. intensities
105 MCalibrationRelTimeCam fRelTimeCam; // Calibration constants rel. times
106
107 MPedestalCam fExtractorCam; // Pedestal Cam with extractor resolution
108
109 MCalibrationCam::PulserColor_t fColor; // Colour of the pulsed LEDs
110
111 enum Display_t // Possible Display types
112 {
113 kFullDisplay,
114 kDataCheckDisplay,
115 kNormalDisplay
116 };
117
118 Display_t fDisplayType; // Chosen Display type
119
120 enum Device_t // Possible devices for calibration
121 {
122 kUseBlindPixel,
123 kUsePINDiode
124 };
125
126 Byte_t fDevices; // Bit-field for used devices for calibration
127
128 enum Storage_t // Possible devices for calibration
129 {
130 kNoStorage,
131 kHistsStorage
132 }; // Possible flags for the storage of results
133
134 Byte_t fStorage; // Bit-field for chosen storage type
135
136 enum { kRelTimes, kDataCheck, kDebug, kIntensity }; // Possible flags
137
138 Byte_t fFlags; // Bit-field for the flags
139
140 TString fGeometry; // Class name geometry
141
142 Bool_t IsUseBlindPixel() const { return TESTBIT(fDevices,kUseBlindPixel); }
143 Bool_t IsUsePINDiode () const { return TESTBIT(fDevices,kUsePINDiode); }
144
145 Bool_t IsRelTimes () const { return TESTBIT(fFlags,kRelTimes); }
146 Bool_t IsDataCheck () const { return TESTBIT(fFlags,kDataCheck); }
147 Bool_t IsDebug () const { return TESTBIT(fFlags,kDebug); }
148 Bool_t IsIntensity () const { return TESTBIT(fFlags,kIntensity); }
149
150 Bool_t IsNoStorage () const { return TESTBIT(fStorage,kNoStorage); }
151 Bool_t IsHistsStorage () const { return TESTBIT(fStorage,kHistsStorage); }
152
153 void DrawTab(MParList &plist, const char *cont, const char *name, Option_t *opt);
154
155 void DisplayResult ( MParList &plist );
156 void DisplayReferenceLines( MHCamera *cam , const Int_t what ) const;
157 void DisplayOutliers ( TH1D *hist, const char* whatsmall, const char* whatbig ) const;
158 void DisplayDoubleProject ( MHCamera *cam , const char* whatsmall, const char* whatbig ) const;
159 const Int_t CountBadPixels ( MHCamera *cam , const Int_t what ) const;
160 void FixDataCheckHist ( TH1D *hist ) const;
161
162 Bool_t WriteResult (MParList &plist);
163 //Bool_t WriteEventloop( MEvtLoop &evtloop ) const;
164 Bool_t WriteTasks ( MTask *t1, MTask *t2) const;
165 Bool_t CheckEnvLocal ();
166
167 // WORKAROUNDS!!!
168 void InitBlindPixel(MExtractBlindPixel &blindext,
169 MHCalibrationChargeBlindCam &blindcam);
170
171 const char* GetOutputFileName() const;
172
173public:
174 MJCalibration(const char *name=NULL, const char *title=NULL);
175
176 const char* GetOutputFile() const;
177
178 MCalibrationIntensityChargeCam &GetIntensCalibrationCam() { return fIntensCalibCam; }
179 MCalibrationIntensityRelTimeCam &GetIntensRelTimeCam() { return fIntensRelTimeCam; }
180 MCalibrationIntensityQECam &GetIntensQECam() { return fIntensQECam; }
181 MBadPixelsIntensityCam &GetIntensBadCam() { return fIntensBadCam; }
182
183 MCalibrationChargeCam &GetCalibrationCam() { return fCalibrationCam; }
184 MCalibrationRelTimeCam &GetRelTimeCam() { return fRelTimeCam; }
185 MCalibrationQECam &GetQECam() { return fQECam; }
186 MBadPixelsCam &GetBadPixels() { return fBadPixels; }
187
188 // Containers and pointers
189 void SetBadPixels ( const MBadPixelsCam &bad) { bad.Copy(fBadPixels); }
190 void SetColor ( const MCalibrationCam::PulserColor_t color) { fColor = color; }
191 void SetExtractor ( MExtractor* ext) { fExtractor = ext; }
192 void SetExtractorCam ( const MPedestalCam &ped) { ped.Copy(fExtractorCam); fExtractorCam.SetName(ped.GetName()); }
193 void SetInput ( MRunIter *iter) { fRuns = iter; }
194 void SetQECam ( const MCalibrationQECam &qe) { qe.Copy(fQECam); }
195 void SetTimeExtractor( MExtractTime* ext) { fTimeExtractor = ext; }
196
197 // Displays
198 void SetFullDisplay() { fDisplayType = kFullDisplay; }
199 void SetDataCheckDisplay() { fDisplayType = kDataCheckDisplay; }
200 void SetNormalDisplay() { fDisplayType = kNormalDisplay; }
201
202 // Camera Geomtry
203 void SetGeometry(const char *geom) { fGeometry = geom; }
204
205 // Flags
206 void SetRelTimeCalibration( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags,kRelTimes) : CLRBIT(fFlags,kRelTimes); }
207 void SetDataCheck ( const Bool_t b=kTRUE ) { b ? SetDataCheckDisplay(), SETBIT(fFlags,kDataCheck)
208 : CLRBIT(fFlags,kDataCheck); }
209 void SetDebug ( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags,kDebug) : CLRBIT(fFlags,kDebug); }
210 void SetIntensity ( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags,kIntensity) : CLRBIT(fFlags,kIntensity); }
211
212 // Devices
213 void SetUseBlindPixel(const Bool_t b=kTRUE);
214 void SetUsePINDiode(const Bool_t b=kTRUE);
215
216 // Storage
217 void SetNoStorage ( const Bool_t b=kTRUE ) { b ? SETBIT(fStorage,kNoStorage) : CLRBIT(fStorage,kNoStorage); }
218 void SetHistsStorage ( const Bool_t b=kTRUE ) { b ? SETBIT(fStorage,kHistsStorage) : CLRBIT(fStorage,kHistsStorage); }
219
220 void SetReferenceFile( const TString ref=fgReferenceFile ) { fReferenceFile = ref; }
221
222 // Precessing
223 Bool_t ReadCalibrationCam();
224 Bool_t ProcessFile(MPedestalCam &pedcam);
225 Bool_t Process(MPedestalCam &pedcam);
226
227 ClassDef(MJCalibration, 0) // Tool to run a calibration per pulser colour and intensity
228};
229
230#endif
Note: See TracBrowser for help on using the repository browser.