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

Last change on this file since 5832 was 5561, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 10.7 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 Double_t fgConvFADC2PheMin; //! Histogram minimum for conversion factor to phes
67 static const Double_t fgConvFADC2PheMax; //! Histogram maximum for conversion factor to phes
68 static const Double_t fgConvFADC2PhotMin; //! Histogram minimum for conversion factor to phs
69 static const Double_t fgConvFADC2PhotMax; //! Histogram maixmum for conversion factor to phs
70 static const Double_t fgQEMin; //! Histogram minimum for quantum efficiency
71 static const Double_t fgQEMax; //! Histogram maximum for quantum efficiency
72 static const Double_t fgArrivalTimeMin; //! Histogram minimum for arrival times
73 static const Double_t fgArrivalTimeMax; //! Histogram maximum for arrival times
74
75 static const Float_t fgRefConvFADC2PheInner; //! Reference value for the conversion factor to phes - inner
76 static const Float_t fgRefConvFADC2PheOuter; //! Reference value for the conversion factor to phes - outer
77 static const Float_t fgRefConvFADC2PhotInner; //! Reference value for the conversion factor to phs - inner
78 static const Float_t fgRefConvFADC2PhotOuter; //! Reference value for the conversion factor to phs - outer
79 static const Float_t fgRefQEInner; //! Reference value for the quantum eff. cascades - inner
80 static const Float_t fgRefQEOuter; //! Reference value for the quantum eff. cascades - outer
81 static const Float_t fgRefArrivalTimeInner; //! Reference value for the arrival time - inner
82 static const Float_t fgRefArrivalTimeOuter; //! Reference value for the arrival time - outer
83 static const Float_t fgRefArrivalTimeRmsInner; //! Reference value for the arrival time - inner
84 static const Float_t fgRefArrivalTimeRmsOuter; //! Reference value for the arrival time - outer
85
86 MRunIter *fRuns; // Calibration files
87
88 MExtractor *fExtractor; // Signal extractor
89 MExtractTime *fTimeExtractor; // Arrival Time extractor
90
91 MBadPixelsIntensityCam fIntensBadCam; // Bad Pixels cam, can be set from previous runs
92 MBadPixelsCam fBadPixels; // Bad Pixels cam, can be set from previous runs
93 MCalibrationIntensityChargeCam fIntensCalibCam; // Calibration conversion factors FADC2Phe for diff. intens.
94 MCalibrationChargeCam fCalibrationCam; // Calibration conversion factors FADC2Phe
95 MCalibrationIntensityBlindCam fIntensBlindCam; // Calibration from Blind Pixel(s)
96 MCalibrationBlindCam fCalibrationBlindCam; // Calibration from Blind Pixel(s)
97 MCalibrationChargePINDiode fCalibrationPINDiode; // Calibration from PIN Diode
98 MCalibrationIntensityQECam fIntensQECam; // Quantum efficiency for diff. intensities,
99 MCalibrationQECam fQECam; // Quantum efficiency, can be set from previous runs
100 MCalibrationIntensityRelTimeCam fIntensRelTimeCam; // Calibration constants rel. times for diff. intensities
101 MCalibrationRelTimeCam fRelTimeCam; // Calibration constants rel. times
102
103 MPedestalCam fExtractorCam; // Pedestal Cam with extractor resolution
104
105 MCalibrationCam::PulserColor_t fColor; // Colour of the pulsed LEDs
106
107 enum Display_t // Possible Display types
108 {
109 kFullDisplay,
110 kDataCheckDisplay,
111 kNormalDisplay
112 };
113
114 Display_t fDisplayType; // Chosen Display type
115
116 enum Device_t // Possible devices for calibration
117 {
118 kUseBlindPixel,
119 kUsePINDiode
120 };
121
122 Byte_t fDevices; // Bit-field for used devices for calibration
123
124 enum Storage_t // Possible devices for calibration
125 {
126 kNoStorage,
127 kHistsStorage
128 }; // Possible flags for the storage of results
129
130 Byte_t fStorage; // Bit-field for chosen storage type
131
132 enum { kRelTimes, kDataCheck, kDebug, kIntensity }; // Possible flags
133
134 Byte_t fFlags; // Bit-field for the flags
135
136 TString fGeometry; // Class name geometry
137
138 Bool_t IsUseBlindPixel() const { return TESTBIT(fDevices,kUseBlindPixel); }
139 Bool_t IsUsePINDiode () const { return TESTBIT(fDevices,kUsePINDiode); }
140
141 Bool_t IsRelTimes () const { return TESTBIT(fFlags,kRelTimes); }
142 Bool_t IsDataCheck () const { return TESTBIT(fFlags,kDataCheck); }
143 Bool_t IsDebug () const { return TESTBIT(fFlags,kDebug); }
144 Bool_t IsIntensity () const { return TESTBIT(fFlags,kIntensity); }
145
146 Bool_t IsNoStorage () const { return TESTBIT(fStorage,kNoStorage); }
147 Bool_t IsHistsStorage () const { return TESTBIT(fStorage,kHistsStorage); }
148
149 void DrawTab(MParList &plist, const char *cont, const char *name, Option_t *opt);
150
151 void DisplayResult ( MParList &plist );
152 void DisplayReferenceLines( MHCamera *cam , const Int_t what ) const;
153 void DisplayOutliers ( TH1D *hist, const char* whatsmall, const char* whatbig ) const;
154 void DisplayDoubleProject ( MHCamera *cam , const char* whatsmall, const char* whatbig ) const;
155 const Int_t CountBadPixels ( MHCamera *cam , const Int_t what ) const;
156 void FixDataCheckHist ( TH1D *hist ) const;
157
158 Bool_t WriteResult ( TObject *geom );
159 Bool_t WriteHists ( MParList &plist );
160 Bool_t WriteEventloop( MEvtLoop &evtloop ) const;
161 Bool_t WriteTasks ( MTask *t1, MTask *t2) const;
162 Bool_t CheckEnvLocal ();
163
164 // WORKAROUNDS!!!
165 void InitBlindPixel(MExtractBlindPixel &blindext,
166 MHCalibrationChargeBlindCam &blindcam);
167
168public:
169 MJCalibration(const char *name=NULL, const char *title=NULL);
170
171 const char* GetOutputFile() const;
172
173 MCalibrationIntensityChargeCam &GetIntensCalibrationCam() { return fIntensCalibCam; }
174 MCalibrationIntensityRelTimeCam &GetIntensRelTimeCam() { return fIntensRelTimeCam; }
175 MCalibrationIntensityQECam &GetIntensQECam() { return fIntensQECam; }
176 MBadPixelsIntensityCam &GetIntensBadCam() { return fIntensBadCam; }
177
178 MCalibrationChargeCam &GetCalibrationCam() { return fCalibrationCam; }
179 MCalibrationRelTimeCam &GetRelTimeCam() { return fRelTimeCam; }
180 MCalibrationQECam &GetQECam() { return fQECam; }
181 MBadPixelsCam &GetBadPixels() { return fBadPixels; }
182
183 // Containers and pointers
184 void SetBadPixels ( const MBadPixelsCam &bad) { bad.Copy(fBadPixels); }
185 void SetColor ( const MCalibrationCam::PulserColor_t color) { fColor = color; }
186 void SetExtractor ( MExtractor* ext) { fExtractor = ext; }
187 void SetExtractorCam ( const MPedestalCam &ped) { ped.Copy(fExtractorCam); }
188 void SetInput ( MRunIter *iter) { fRuns = iter; }
189 void SetQECam ( const MCalibrationQECam &qe) { qe.Copy(fQECam); }
190 void SetTimeExtractor( MExtractTime* ext) { fTimeExtractor = ext; }
191
192 // Displays
193 void SetFullDisplay() { fDisplayType = kFullDisplay; }
194 void SetDataCheckDisplay() { fDisplayType = kDataCheckDisplay; }
195 void SetNormalDisplay() { fDisplayType = kNormalDisplay; }
196
197 // Camera Geomtry
198 void SetGeometry(const char *geom) { fGeometry = geom; }
199
200 // Flags
201 void SetRelTimeCalibration( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags,kRelTimes) : CLRBIT(fFlags,kRelTimes); }
202 void SetDataCheck ( const Bool_t b=kTRUE ) { b ? SetDataCheckDisplay(), SETBIT(fFlags,kDataCheck)
203 : CLRBIT(fFlags,kDataCheck); }
204 void SetDebug ( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags,kDebug) : CLRBIT(fFlags,kDebug); }
205 void SetIntensity ( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags,kIntensity) : CLRBIT(fFlags,kIntensity); }
206
207 // Devices
208 void SetUseBlindPixel(const Bool_t b=kTRUE);
209 void SetUsePINDiode(const Bool_t b=kTRUE);
210
211 // Storage
212 void SetNoStorage ( const Bool_t b=kTRUE ) { b ? SETBIT(fStorage,kNoStorage) : CLRBIT(fStorage,kNoStorage); }
213 void SetHistsStorage ( const Bool_t b=kTRUE ) { b ? SETBIT(fStorage,kHistsStorage) : CLRBIT(fStorage,kHistsStorage); }
214
215 // Precessing
216 Bool_t ReadCalibrationCam();
217 Bool_t ProcessFile(MPedestalCam &pedcam);
218 Bool_t Process(MPedestalCam &pedcam);
219
220 ClassDef(MJCalibration, 0) // Tool to run a calibration per pulser colour and intensity
221};
222
223#endif
Note: See TracBrowser for help on using the repository browser.