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

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