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

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