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

Last change on this file since 9484 was 9317, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 8.7 KB
Line 
1#ifndef MARS_MJCalibration
2#define MARS_MJCalibration
3
4#ifndef MARS_MJCalib
5#include "MJCalib.h"
6#endif
7#ifndef MARS_MCalibrationChargeCam
8#include "MCalibrationChargeCam.h"
9#endif
10#ifndef MARS_MCalibrationBlindCam
11#include "MCalibrationBlindCam.h"
12#endif
13#ifndef MARS_MCalibrationRelTimeCam
14#include "MCalibrationRelTimeCam.h"
15#endif
16#ifndef MARS_MCalibrationChargePINDiode
17#include "MCalibrationChargePINDiode.h"
18#endif
19#ifndef MARS_MCalibrationQECam
20#include "MCalibrationQECam.h"
21#endif
22#ifndef MARS_MBadPixelsCam
23#include "MBadPixelsCam.h"
24#endif
25#ifndef MARS_MPedestalCam
26#include "MPedestalCam.h"
27#endif
28
29class TH1D;
30class TPaveText;
31
32class MTask;
33class MParList;
34class MPedestalCam;
35class MExtractor;
36class MExtractTime;
37class MEvtLoop;
38class MExtractBlindPixel;
39class MHCalibrationChargeBlindCam;
40class MHCamera;
41
42class MJCalibration : public MJCalib
43{
44private:
45
46 static const Int_t gkIFAEBoxInaugurationRun; //! Run number of first IFAE box calibration
47 static const Int_t gkSecondBlindPixelInstallation; //! Run number upon which second blind pixel was installed
48 static const Int_t gkSpecialPixelsContInstallation; //! Run number upon which third blind pixel was installed
49 static const Int_t gkThirdBlindPixelInstallation; //! Run number upon which third blind pixel was installed
50
51 static const TString fgReferenceFile; //! default for fReferenceFile ("mjobs/calibrationref.rc")
52 static const TString fgHiLoCalibFile; //! default for fHiLoCalibFile ("mjobs/hilocalib.root")
53
54 Double_t fConvFADC2PheMin; //! Histogram minimum for conversion factor to phes
55 Double_t fConvFADC2PheMax; //! Histogram maximum for conversion factor to phes
56 Double_t fConvFADC2PhotMin; //! Histogram minimum for conversion factor to phs
57 Double_t fConvFADC2PhotMax; //! Histogram maixmum for conversion factor to phs
58 Double_t fQEMin; //! Histogram minimum for quantum efficiency
59 Double_t fQEMax; //! Histogram maximum for quantum efficiency
60 Double_t fArrivalTimeMin; //! Histogram minimum for arrival times
61 Double_t fArrivalTimeMax; //! Histogram maximum for arrival times
62 Double_t fTimeOffsetMin; //! Histogram minimum for time offsets
63 Double_t fTimeOffsetMax; //! Histogram maximum for time offsets
64 Double_t fTimeResolutionMin; //! Histogram minimum for time resolutions
65 Double_t fTimeResolutionMax; //! Histogram maximum for time resolutions
66
67 Float_t fRefFADC2PheInner; //! Reference value for the ratio phes/charge - inner
68 Float_t fRefFADC2PheOuter; //! Reference value for the ratio phes/charge - outer
69 Float_t fRefConvFADC2PhotInner; //! Reference value for the conversion factor to phs - inner
70 Float_t fRefConvFADC2PhotOuter; //! Reference value for the conversion factor to phs - outer
71 Float_t fRefConvFADC2PheInner; //! Reference value for the conversion factor to phs - inner
72 Float_t fRefConvFADC2PheOuter; //! Reference value for the conversion factor to phs - outer
73 Float_t fRefQEInner; //! Reference value for the quantum eff. cascades - inner
74 Float_t fRefQEOuter; //! Reference value for the quantum eff. cascades - outer
75 Float_t fRefArrivalTimeInner; //! Reference value for the arrival time - inner
76 Float_t fRefArrivalTimeOuter; //! Reference value for the arrival time - outer
77 Float_t fRefArrivalTimeRmsInner; //! Reference value for the arrival time - inner
78 Float_t fRefArrivalTimeRmsOuter; //! Reference value for the arrival time - outer
79 Float_t fRefTimeOffsetOuter; //! Reference value for the time offset - outer
80 Float_t fRefTimeResolutionInner; //! Reference value for the time resolution - inner
81 Float_t fRefTimeResolutionOuter; //! Reference value for the time resolution - outer
82
83 TString fReferenceFile; // File name containing the reference values
84 TString fHiLoCalibFile; // File name containing the hi-lo calib. constants
85
86 MExtractor *fExtractor; // Signal extractor
87 MExtractTime *fTimeExtractor; // Arrival Time extractor
88
89 MBadPixelsCam fBadPixels; // Bad Pixels cam, can be set from previous runs
90 MCalibrationChargeCam fCalibrationCam; // Calibration conversion factors FADC2Phe
91 MCalibrationBlindCam fCalibrationBlindCam; // Calibration from Blind Pixel(s)
92 MCalibrationChargePINDiode fCalibrationPINDiode; // Calibration from PIN Diode
93 MCalibrationQECam fQECam; // Quantum efficiency, can be set from previous runs
94 MCalibrationRelTimeCam fRelTimeCam; // Calibration constants rel. times
95
96 MPedestalCam fExtractorCam; // Pedestal Cam with extractor resolution
97
98 MCalibrationCam::PulserColor_t fColor; // Colour of the pulsed LEDs
99
100 enum Display_t // Possible Display types
101 {
102 kFullDisplay,
103 kDataCheckDisplay,
104 kNormalDisplay
105 };
106
107 Display_t fDisplayType; // Chosen Display type
108
109 enum { kRelTimes, kDebug }; // Possible flags
110
111 Byte_t fFlags; // Bit-field for the flags
112
113 UInt_t fMinEvents; // Minimum number of events
114
115 TString fGeometry; // Class name geometry
116
117 Bool_t IsRelTimes () const { return TESTBIT(fFlags,kRelTimes); }
118 Bool_t IsDebug () const { return TESTBIT(fFlags,kDebug); }
119
120 MHCamera *DrawBadPixelPad(const MHCamera &h, Bool_t unsuit) const;
121 void DrawTab(MParList &plist, const char *cont, const char *name, Option_t *opt);
122
123 void DisplayResult(MParList &plist);
124 void DisplayReferenceLines(const MHCamera &hist, const Int_t what) const;
125 //void DisplayOutliers ( TH1D *hist, const char* whatsmall, const char* whatbig ) const;
126
127 Bool_t WriteResult (MParList &plist);
128 //Bool_t WriteEventloop( MEvtLoop &evtloop ) const;
129 Bool_t WriteTasks ( MTask *t1, MTask *t2) const;
130 Bool_t CheckEnvLocal ();
131
132 // WORKAROUNDS!!!
133 void InitBlindPixel(MExtractBlindPixel &blindext,
134 MHCalibrationChargeBlindCam &blindcam);
135
136 const char* GetOutputFileName() const;
137
138 void ReadReferenceFile();
139 Bool_t ReadHiLoCalibFile();
140
141public:
142 MJCalibration(const char *name=NULL, const char *title=NULL);
143
144 const MCalibrationChargeCam &GetCalibrationCam() const { return fCalibrationCam; }
145 const MCalibrationRelTimeCam &GetRelTimeCam() const { return fRelTimeCam; }
146 const MCalibrationQECam &GetQECam() const { return fQECam; }
147 const MBadPixelsCam &GetBadPixels() const { return fBadPixels; }
148
149 // Containers and pointers
150 void SetBadPixels ( const MBadPixelsCam &bad) { bad.Copy(fBadPixels); }
151 void SetColor ( const MCalibrationCam::PulserColor_t color) { fColor = color; }
152 void SetExtractor ( MExtractor* ext) { fExtractor = ext; }
153 void SetExtractorCam ( const MPedestalCam &ped) { ped.Copy(fExtractorCam); fExtractorCam.SetName(ped.GetName()); }
154 void SetQECam ( const MCalibrationQECam &qe) { qe.Copy(fQECam); }
155 void SetTimeExtractor( MExtractTime* ext) { fTimeExtractor = ext; }
156
157 // Displays
158 void SetFullDisplay() { fDisplayType = kFullDisplay; }
159 void SetDataCheckDisplay() { fDisplayType = kDataCheckDisplay; }
160 void SetNormalDisplay() { fDisplayType = kNormalDisplay; }
161
162 // Camera Geomtry
163 void SetGeometry(const char *geom) { fGeometry = geom; }
164
165 // Flags
166 void SetRelTimeCalibration( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags,kRelTimes) : CLRBIT(fFlags,kRelTimes); }
167 void SetDebug ( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags,kDebug) : CLRBIT(fFlags,kDebug); }
168 //void SetIntensity ( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags,kIntensity) : CLRBIT(fFlags,kIntensity); }
169
170 // Files
171 void SetReferenceFile( const TString ref=fgReferenceFile ) { fReferenceFile = ref; }
172 void SetHiLoCalibFile( const TString ref=fgHiLoCalibFile ) { fHiLoCalibFile = ref; }
173
174 // Precessing
175 Bool_t Process(MPedestalCam &pedcam);
176
177 // Public helper functions
178 static void DisplayDoubleProject(const MHCamera &cam);
179 static void FixDataCheckHist(TH1D &hist, Double_t min=-1111, Double_t max=-1111);
180
181 ClassDef(MJCalibration, 0) // Tool to run a calibration per pulser colour and intensity
182};
183
184#endif
Note: See TracBrowser for help on using the repository browser.