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

Last change on this file since 8898 was 8788, checked in by tbretz, 17 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 void DrawBadPixel(TPaveText &pave, const MHCamera &h, Int_t n, Float_t f, const char *str) const;
121 void DrawTab(MParList &plist, const char *cont, const char *name, Option_t *opt);
122
123 void DisplayResult ( MParList &plist );
124 void DisplayReferenceLines( MHCamera *cam , const Int_t what ) const;
125 void DisplayOutliers ( TH1D *hist, const char* whatsmall, const char* whatbig ) const;
126 void DisplayDoubleProject ( MHCamera *cam , const char* whatsmall, const char* whatbig ) const;
127 void FixDataCheckHist ( TH1D *hist ) const;
128
129 Bool_t WriteResult (MParList &plist);
130 //Bool_t WriteEventloop( MEvtLoop &evtloop ) const;
131 Bool_t WriteTasks ( MTask *t1, MTask *t2) const;
132 Bool_t CheckEnvLocal ();
133
134 // WORKAROUNDS!!!
135 void InitBlindPixel(MExtractBlindPixel &blindext,
136 MHCalibrationChargeBlindCam &blindcam);
137
138 const char* GetOutputFileName() const;
139
140 void ReadReferenceFile();
141 Bool_t ReadHiLoCalibFile();
142
143public:
144 MJCalibration(const char *name=NULL, const char *title=NULL);
145
146 const MCalibrationChargeCam &GetCalibrationCam() const { return fCalibrationCam; }
147 const MCalibrationRelTimeCam &GetRelTimeCam() const { return fRelTimeCam; }
148 const MCalibrationQECam &GetQECam() const { return fQECam; }
149 const MBadPixelsCam &GetBadPixels() const { return fBadPixels; }
150
151 // Containers and pointers
152 void SetBadPixels ( const MBadPixelsCam &bad) { bad.Copy(fBadPixels); }
153 void SetColor ( const MCalibrationCam::PulserColor_t color) { fColor = color; }
154 void SetExtractor ( MExtractor* ext) { fExtractor = ext; }
155 void SetExtractorCam ( const MPedestalCam &ped) { ped.Copy(fExtractorCam); fExtractorCam.SetName(ped.GetName()); }
156 void SetQECam ( const MCalibrationQECam &qe) { qe.Copy(fQECam); }
157 void SetTimeExtractor( MExtractTime* ext) { fTimeExtractor = ext; }
158
159 // Displays
160 void SetFullDisplay() { fDisplayType = kFullDisplay; }
161 void SetDataCheckDisplay() { fDisplayType = kDataCheckDisplay; }
162 void SetNormalDisplay() { fDisplayType = kNormalDisplay; }
163
164 // Camera Geomtry
165 void SetGeometry(const char *geom) { fGeometry = geom; }
166
167 // Flags
168 void SetRelTimeCalibration( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags,kRelTimes) : CLRBIT(fFlags,kRelTimes); }
169 void SetDebug ( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags,kDebug) : CLRBIT(fFlags,kDebug); }
170 //void SetIntensity ( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags,kIntensity) : CLRBIT(fFlags,kIntensity); }
171
172 // Files
173 void SetReferenceFile( const TString ref=fgReferenceFile ) { fReferenceFile = ref; }
174 void SetHiLoCalibFile( const TString ref=fgHiLoCalibFile ) { fHiLoCalibFile = ref; }
175
176 // Precessing
177 Bool_t Process(MPedestalCam &pedcam);
178
179 ClassDef(MJCalibration, 0) // Tool to run a calibration per pulser colour and intensity
180};
181
182#endif
Note: See TracBrowser for help on using the repository browser.