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

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