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

Last change on this file since 4753 was 4753, checked in by gaug, 20 years ago
*** empty log message ***
File size: 6.6 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
54 static const Float_t fgRefConvFADC2PheInner; //! Reference value for the conversion factor to phes - inner
55 static const Float_t fgRefConvFADC2PheOuter; //! Reference value for the conversion factor to phes - outer
56 static const Float_t fgRefConvFADC2PhotInner; //! Reference value for the conversion factor to phs - inner
57 static const Float_t fgRefConvFADC2PhotOuter; //! Reference value for the conversion factor to phs - outer
58 static const Float_t fgRefQEInner; //! Reference value for the quantum eff. cascades - inner
59 static const Float_t fgRefQEOuter; //! Reference value for the quantum eff. cascades - outer
60
61 MRunIter *fRuns; // Calibration files
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 // Combine these options into a single bit-files (TestBit/SetBit, etc)
93 Bool_t fRelTimes; // Flag if relative times have to be calibrated
94 Bool_t fDataCheck; // Flag if the data check is run on raw data
95 Bool_t fDebug; // Flag if debug option is passed onto cal. classes
96
97 void DisplayResult ( MParList &plist );
98 void DisplayReferenceLines( MHCamera *cam , const Int_t what ) const;
99 void DisplayOutliers ( TH1D *hist, const char* whatsmall, const char* whatbig ) const;
100 void DisplayDoubleProject ( MHCamera *cam , const char* whatsmall, const char* whatbig ) const;
101 const Int_t CountBadPixels ( MHCamera *cam , const Int_t what ) const;
102 void FixDataCheckHist ( TH1D *hist ) const;
103
104 Bool_t WriteResult();
105 Bool_t WriteEventloop(MEvtLoop &evtloop) const;
106 Bool_t WriteTasks(MTask *t1, MTask *t2) const;
107 Bool_t CheckEnv();
108
109 // WORKAROUNDS!!!
110 Bool_t FindColor();
111 void InitBlindPixel(MExtractBlindPixel &blindext,
112 MHCalibrationChargeBlindCam &blindcam);
113
114public:
115 MJCalibration(const char *name=NULL, const char *title=NULL);
116
117 const char* GetOutputFile() const;
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 void SetInput(MRunIter *iter) { fRuns = iter; }
133
134 // Displays
135 void SetFullDisplay() { fDisplayType = kFullDisplay; }
136 void SetDataCheckDisplay() { fDisplayType = kDataCheckDisplay; }
137 void SetNormalDisplay() { fDisplayType = kNormalDisplay; }
138
139 // Rel. Time
140 void SetRelTimeCalibration(const Bool_t b=kTRUE) { fRelTimes = b; }
141
142 // Data Check
143 void SetDataCheck(const Bool_t b=kTRUE) { fDataCheck = b; SetDataCheckDisplay(); }
144
145 // Debug
146 void SetDebug(const Bool_t b=kTRUE) { fDebug = b; }
147
148 // Devices
149 void SetUseBlindPixel(const Bool_t b=kTRUE);
150 void SetUsePINDiode(const Bool_t b=kTRUE);
151
152 // Precessing
153 Bool_t ReadCalibrationCam();
154 Bool_t ProcessFile(MPedestalCam &pedcam);
155 Bool_t Process(MPedestalCam &pedcam);
156
157 ClassDef(MJCalibration, 0) // Tool to run a calibration per pulser colour and intensity
158};
159
160#endif
Note: See TracBrowser for help on using the repository browser.