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

Last change on this file since 4903 was 4870, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 7.4 KB
Line 
1#ifndef MARS_MJCalibration
2#define MARS_MJCalibration
3
4#ifndef MARS_MJob
5#include "MJob.h"
6#endif
7#ifndef MARS_MCalibrationChargeCam
8#include "MCalibrationChargeCam.h"
9#endif
10#ifndef MARS_MCalibrationChargeBlindCam
11#include "MCalibrationChargeBlindCam.h"
12#endif
13#ifndef MARS_MCalibrationChargePINDiode
14#include "MCalibrationChargePINDiode.h"
15#endif
16#ifndef MARS_MCalibrationRelTimeCam
17#include "MCalibrationRelTimeCam.h"
18#endif
19#ifndef MARS_MCalibrationQECam
20#include "MCalibrationQECam.h"
21#endif
22#ifndef MARS_MBadPixelsCam
23#include "MBadPixelsCam.h"
24#endif
25
26class TH1D;
27
28class MTask;
29class MRunIter;
30class MParList;
31class MPedestalCam;
32class MExtractor;
33class MExtractTime;
34class MEvtLoop;
35class MExtractBlindPixel;
36class MHCalibrationChargeBlindCam;
37class MHCamera;
38
39class MJCalibration : public MJob
40{
41private:
42
43 static const Int_t gkIFAEBoxInaugurationRun; //! Run number of first IFAE box calibration
44 static const Int_t gkSecondBlindPixelInstallation; //! Run number upon which second blind pixel was installed
45 static const Int_t gkThirdBlindPixelInstallation; //! Run number upon which third blind pixel was installed
46
47 static const Double_t fgConvFADC2PheMin; //! Histogram minimum for conversion factor to phes
48 static const Double_t fgConvFADC2PheMax; //! Histogram maximum for conversion factor to phes
49 static const Double_t fgConvFADC2PhotMin; //! Histogram minimum for conversion factor to phs
50 static const Double_t fgConvFADC2PhotMax; //! Histogram maixmum for conversion factor to phs
51 static const Double_t fgQEMin; //! Histogram minimum for quantum efficiency
52 static const Double_t fgQEMax; //! Histogram maximum for quantum efficiency
53 static const Double_t fgArrivalTimeMin; //! Histogram minimum for arrival times
54 static const Double_t fgArrivalTimeMax; //! Histogram maximum for arrival times
55
56 static const Float_t fgRefConvFADC2PheInner; //! Reference value for the conversion factor to phes - inner
57 static const Float_t fgRefConvFADC2PheOuter; //! Reference value for the conversion factor to phes - outer
58 static const Float_t fgRefConvFADC2PhotInner; //! Reference value for the conversion factor to phs - inner
59 static const Float_t fgRefConvFADC2PhotOuter; //! Reference value for the conversion factor to phs - outer
60 static const Float_t fgRefQEInner; //! Reference value for the quantum eff. cascades - inner
61 static const Float_t fgRefQEOuter; //! Reference value for the quantum eff. cascades - outer
62 static const Float_t fgRefArrivalTimeInner; //! Reference value for the arrival time - inner
63 static const Float_t fgRefArrivalTimeOuter; //! Reference value for the arrival time - outer
64 static const Float_t fgRefArrivalTimeRmsInner; //! Reference value for the arrival time - inner
65 static const Float_t fgRefArrivalTimeRmsOuter; //! Reference value for the arrival time - outer
66
67 MRunIter *fRuns; // Calibration files
68
69 MExtractor *fExtractor; // Signal extractor
70 MExtractTime *fTimeExtractor; // Arrival Time extractor
71
72 MBadPixelsCam fBadPixels; // Bad Pixels cam, can be set from previous runs
73 MCalibrationChargeCam fCalibrationCam; // Calibration conversion factors FADC2Phe
74 MCalibrationChargeBlindCam fCalibrationBlindCam; // Calibration from Blind Pixel(s)
75 MCalibrationChargePINDiode fCalibrationPINDiode; // Calibration from PIN Diode
76 MCalibrationQECam fQECam; // Quantum efficiency, can be set from previous runs
77 MCalibrationRelTimeCam fRelTimeCam; // Calibration constants rel. times
78
79 MCalibrationCam::PulserColor_t fColor; // Colour of the pulsed LEDs
80
81 enum Display_t // Possible Display types
82 {
83 kFullDisplay,
84 kDataCheckDisplay,
85 kNormalDisplay
86 };
87
88 Display_t fDisplayType; // Chosen Display type
89
90 enum Device_t // Possible devices for calibration
91 {
92 kUseBlindPixel,
93 kUsePINDiode
94 };
95
96 Byte_t fDevices; // Bit-field for used devices for calibration
97
98 // Combine these options into a single bit-files (TestBit/SetBit, etc)
99 Bool_t fRelTimes; // Flag if relative times have to be calibrated
100 Bool_t fDataCheck; // Flag if the data check is run on raw data
101 Bool_t fDebug; // Flag if debug option is passed onto cal. classes
102
103 TString fGeometry;
104
105 void DisplayResult ( MParList &plist );
106 void DisplayReferenceLines( MHCamera *cam , const Int_t what ) const;
107 void DisplayOutliers ( TH1D *hist, const char* whatsmall, const char* whatbig ) const;
108 void DisplayDoubleProject ( MHCamera *cam , const char* whatsmall, const char* whatbig ) const;
109 const Int_t CountBadPixels ( MHCamera *cam , const Int_t what ) const;
110 void FixDataCheckHist ( TH1D *hist ) const;
111
112 Bool_t WriteResult(TObject *geom);
113 Bool_t WriteEventloop(MEvtLoop &evtloop) const;
114 Bool_t WriteTasks(MTask *t1, MTask *t2) const;
115 Bool_t CheckEnvLocal();
116
117 // WORKAROUNDS!!!
118 Bool_t FindColor();
119 void InitBlindPixel(MExtractBlindPixel &blindext,
120 MHCalibrationChargeBlindCam &blindcam);
121
122public:
123 MJCalibration(const char *name=NULL, const char *title=NULL);
124
125 const char* GetOutputFile() const;
126
127 MCalibrationChargeCam &GetCalibrationCam() { return fCalibrationCam; }
128 MCalibrationRelTimeCam &GetRelTimeCam() { return fRelTimeCam; }
129 MCalibrationQECam &GetQECam() { return fQECam; }
130 MBadPixelsCam &GetBadPixels() { return fBadPixels; }
131
132 Bool_t IsUseBlindPixel() const;
133 Bool_t IsUsePINDiode() const;
134
135 void SetBadPixels(const MBadPixelsCam &bad) { bad.Copy(fBadPixels); }
136 void SetExtractor(MExtractor* ext) { fExtractor = ext; }
137 void SetTimeExtractor(MExtractTime* ext) { fTimeExtractor = ext; }
138 void SetQECam(const MCalibrationQECam &qe) { qe.Copy(fQECam); }
139 void SetColor(const MCalibrationCam::PulserColor_t color) { fColor = color; }
140 void SetInput(MRunIter *iter) { fRuns = iter; }
141
142 // Displays
143 void SetFullDisplay() { fDisplayType = kFullDisplay; }
144 void SetDataCheckDisplay() { fDisplayType = kDataCheckDisplay; }
145 void SetNormalDisplay() { fDisplayType = kNormalDisplay; }
146
147 // Camera Geomtry
148 void SetGeometry(const char *geom) { fGeometry = geom; }
149
150 // Rel. Time
151 void SetRelTimeCalibration(const Bool_t b=kTRUE) { fRelTimes = b; }
152
153 // Data Check
154 void SetDataCheck(const Bool_t b=kTRUE) { fDataCheck = b; SetDataCheckDisplay(); }
155
156 // Debug
157 void SetDebug(const Bool_t b=kTRUE) { fDebug = b; }
158
159 // Devices
160 void SetUseBlindPixel(const Bool_t b=kTRUE);
161 void SetUsePINDiode(const Bool_t b=kTRUE);
162
163 // Precessing
164 Bool_t ReadCalibrationCam();
165 Bool_t ProcessFile(MPedestalCam &pedcam);
166 Bool_t Process(MPedestalCam &pedcam);
167
168 ClassDef(MJCalibration, 0) // Tool to run a calibration per pulser colour and intensity
169};
170
171#endif
Note: See TracBrowser for help on using the repository browser.