1 | #ifndef MARS_MExtractPedestal
|
---|
2 | #define MARS_MExtractPedestal
|
---|
3 |
|
---|
4 | #ifndef MARS_MTask
|
---|
5 | #include "MTask.h"
|
---|
6 | #endif
|
---|
7 |
|
---|
8 | #ifndef MARS_MArrayD
|
---|
9 | #include <MArrayD.h>
|
---|
10 | #endif
|
---|
11 |
|
---|
12 | #ifndef MARS_MArrayI
|
---|
13 | #include <MArrayI.h>
|
---|
14 | #endif
|
---|
15 |
|
---|
16 | class MGeomCam;
|
---|
17 | class MExtractor;
|
---|
18 | class MPedestalCam;
|
---|
19 | class MRawEvtData;
|
---|
20 | class MRawRunHeader;
|
---|
21 | class MRawEvtHeader;
|
---|
22 | class MExtractTimeAndCharge;
|
---|
23 | class MPedestalSubtractedEvt;
|
---|
24 | class MRawEvtPixelIter;
|
---|
25 |
|
---|
26 | class MExtractPedestal : public MTask
|
---|
27 | {
|
---|
28 | private:
|
---|
29 | static const TString fgNamePedestalCam; //! "MPedestalCam"
|
---|
30 | static const TString fgNameRawEvtData; //! "MRawEvtData"
|
---|
31 |
|
---|
32 | static const UShort_t fgCheckWinFirst; //! First FADC slice to check for signal (currently set to: 0)
|
---|
33 | static const UShort_t fgCheckWinLast; //! Last FADC slice to check for signal (currently set to: 29)
|
---|
34 | static const UShort_t fgMaxSignalVar; //! The maximum difference between the highest and lowest slice
|
---|
35 |
|
---|
36 | TString fNamePedestalCamIn; // Name of the incoming 'MPedestalCam' container
|
---|
37 | TString fNamePedestalCamOut; // Name of the outgoing 'MPedestalCam' container
|
---|
38 | TString fNamePedestalCamInter; // Name of the intermediate 'MPedestalCam' container
|
---|
39 | TString fNameRawEvtData; // Name of MRawEvtData
|
---|
40 |
|
---|
41 | Bool_t fRandomCalculation; // Is pedestalextraction by extractor random?
|
---|
42 |
|
---|
43 | protected:
|
---|
44 |
|
---|
45 | Bool_t fIntermediateStorage; // Is pedestal stored every event?
|
---|
46 |
|
---|
47 | MGeomCam *fGeom; //! Camera geometry
|
---|
48 | MPedestalCam *fPedestalsIn; //! Pedestals of all pixels in the camera (incoming)
|
---|
49 | MPedestalCam *fPedestalsInter; //! Pedestals of all pixels in the camera (intermediate)
|
---|
50 | MPedestalCam *fPedestalsOut; //! Pedestals of all pixels in the camera (outgoing)
|
---|
51 | MRawEvtData *fRawEvt; //! Raw event data (time slices)
|
---|
52 | MRawRunHeader *fRunHeader; //! RunHeader information
|
---|
53 | MExtractTimeAndCharge *fExtractor; // Possible Extractor
|
---|
54 | MPedestalSubtractedEvt *fSignal; //!
|
---|
55 |
|
---|
56 | UShort_t fExtractWinFirst; // First FADC slice to extract pedestal from
|
---|
57 | UShort_t fExtractWinSize; // Number of slices to calculate the pedestal from
|
---|
58 | UShort_t fExtractWinLast; // Last FADC slice to extract pedestal from
|
---|
59 |
|
---|
60 | UShort_t fCheckWinFirst;
|
---|
61 | UShort_t fCheckWinLast;
|
---|
62 |
|
---|
63 | UShort_t fMaxSignalVar;
|
---|
64 |
|
---|
65 | Bool_t fUseSpecialPixels; // Flag if the special pixels shall be treated
|
---|
66 |
|
---|
67 | MArrayD fSumx; // sum of values
|
---|
68 | MArrayD fSumx2; // sum of squared values
|
---|
69 | MArrayD fSumAB0; // sum of ABFlag=0 slices
|
---|
70 | MArrayD fSumAB1; // sum of ABFlag=1 slices
|
---|
71 | MArrayD fAreaSumx; // averaged sum of values per area idx
|
---|
72 | MArrayD fAreaSumx2; // averaged sum of squared values per area idx
|
---|
73 | MArrayD fAreaSumAB0; // averaged sum of ABFlag=0 slices per area idx
|
---|
74 | MArrayD fAreaSumAB1; // averaged sum of ABFlag=1 slices per area idx
|
---|
75 | MArrayI fAreaFilled; // number of valid entries with area idx
|
---|
76 | MArrayI fAreaValid; // number of valid pixels within area idx
|
---|
77 | MArrayD fSectorSumx; // averaged sum of values per sector
|
---|
78 | MArrayD fSectorSumx2; // averaged sum of squared values per sector
|
---|
79 | MArrayD fSectorSumAB0; // averaged sum of ABFlag=0 slices per sector
|
---|
80 | MArrayD fSectorSumAB1; // averaged sum of ABFlag=1 slices per sector
|
---|
81 | MArrayI fSectorFilled; // number of valid entries with sector idx
|
---|
82 | MArrayI fSectorValid; // number of valid pixels within sector idx
|
---|
83 |
|
---|
84 | // MTask virtual functions
|
---|
85 | Int_t PreProcess(MParList *pList);
|
---|
86 | Int_t Process();
|
---|
87 | Int_t PostProcess();
|
---|
88 | Bool_t ReInit(MParList *pList);
|
---|
89 | Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
|
---|
90 |
|
---|
91 | // Interface to be overwritten by a new class
|
---|
92 | virtual void ResetArrays();
|
---|
93 | virtual Int_t Calc() = 0;
|
---|
94 |
|
---|
95 | // Helper functions
|
---|
96 | void CalcPixResults (const UInt_t nevts, const UInt_t pixid);
|
---|
97 | void CalcAreaResults (const UInt_t nevts, const UInt_t napix, const UInt_t aidx);
|
---|
98 | void CalcSectorResults(const UInt_t nevts, const UInt_t nspix, const UInt_t sector);
|
---|
99 |
|
---|
100 | Float_t CalcExtractor(const MRawEvtPixelIter &pixel, Int_t offset) const;
|
---|
101 | UInt_t CalcSums(const MRawEvtPixelIter &pixel, Int_t offset, UInt_t &ab0, UInt_t &ab1) const;
|
---|
102 | Bool_t CheckVariation(UInt_t idx) const;
|
---|
103 |
|
---|
104 | void CheckExtractionWindow(UInt_t offset=0);
|
---|
105 |
|
---|
106 | Bool_t SetRangeFromExtractor(const MExtractor &ext, Bool_t logain);
|
---|
107 |
|
---|
108 | public:
|
---|
109 | MExtractPedestal(const char *name=NULL, const char *title=NULL);
|
---|
110 |
|
---|
111 | void Clear(const Option_t *o="");
|
---|
112 | void Print(const Option_t *o="") const;
|
---|
113 |
|
---|
114 | // Setters
|
---|
115 | Bool_t SetExtractWindow(UShort_t first, UShort_t size);
|
---|
116 | Bool_t SetCheckRange(UShort_t checkfirst=fgCheckWinFirst, UShort_t checklast=fgCheckWinLast);
|
---|
117 |
|
---|
118 | virtual Bool_t SetRangeFromExtractor(const MExtractor &ext) = 0;
|
---|
119 |
|
---|
120 | void SetMaxSignalVar(UShort_t maxvar=40) { fMaxSignalVar = maxvar; }
|
---|
121 |
|
---|
122 | // names
|
---|
123 | void SetNamePedestalCamIn (const char *name=fgNamePedestalCam) { fNamePedestalCamIn = name; }
|
---|
124 | void SetNamePedestalCamInter(const char *name=fgNamePedestalCam) { fNamePedestalCamInter = name; }
|
---|
125 | void SetNamePedestalCamOut (const char *name=fgNamePedestalCam) { fNamePedestalCamOut = name; }
|
---|
126 | void SetNameRawEvtData (const char *name=fgNameRawEvtData) { fNameRawEvtData = name; }
|
---|
127 |
|
---|
128 | // pointers
|
---|
129 | void SetExtractor ( MExtractTimeAndCharge *e) { fExtractor = e; }
|
---|
130 | void SetPedestalsIn ( MPedestalCam *pedcam ) { fPedestalsIn = pedcam; }
|
---|
131 | void SetPedestalsInter( MPedestalCam *pedcam ) { fPedestalsInter = pedcam; }
|
---|
132 | void SetPedestalsOut ( MPedestalCam *pedcam ) { fPedestalsOut = pedcam; }
|
---|
133 |
|
---|
134 | // flags
|
---|
135 | void SetIntermediateStorage (Bool_t b=kTRUE) { fIntermediateStorage = b; }
|
---|
136 | void SetUseSpecialPixels (Bool_t b=kTRUE) { fUseSpecialPixels = b; }
|
---|
137 | void SetRandomCalculation (Bool_t b=kTRUE) { fRandomCalculation = b; }
|
---|
138 |
|
---|
139 | ClassDef(MExtractPedestal, 0) // Base class for pedestal extractors
|
---|
140 | };
|
---|
141 |
|
---|
142 | #endif
|
---|