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 MPedestalCam;
|
---|
18 | class MRawEvtData;
|
---|
19 | class MRawRunHeader;
|
---|
20 | class MRawEvtHeader;
|
---|
21 | class MExtractTimeAndCharge;
|
---|
22 |
|
---|
23 | class MExtractPedestal : public MTask
|
---|
24 | {
|
---|
25 | private:
|
---|
26 | static const TString fgNamePedestalCam; //! "MPedestalCam"
|
---|
27 | static const TString fgNameRawEvtData; //! "MRawEvtData"
|
---|
28 | static const UInt_t fgNumDump; //!
|
---|
29 |
|
---|
30 | TString fNamePedestalCamIn; // Name of the incoming 'MPedestalCam' container
|
---|
31 | TString fNamePedestalCamOut; // Name of the outgoing 'MPedestalCam' container
|
---|
32 | TString fNamePedestalCamInter; // Name of the intermediate 'MPedestalCam' container
|
---|
33 | TString fNameRawEvtData; // Name of MRawEvtData
|
---|
34 |
|
---|
35 | Bool_t fRandomCalculation; // Is pedestalextraction by extractor random?
|
---|
36 |
|
---|
37 | protected:
|
---|
38 |
|
---|
39 | Bool_t fIntermediateStorage; // Is pedestal stored every event?
|
---|
40 |
|
---|
41 | MGeomCam *fGeom; //! Camera geometry
|
---|
42 | MPedestalCam *fPedestalsIn; //! Pedestals of all pixels in the camera (incoming)
|
---|
43 | MPedestalCam *fPedestalsInter; //! Pedestals of all pixels in the camera (intermediate)
|
---|
44 | MPedestalCam *fPedestalsOut; //! Pedestals of all pixels in the camera (outgoing)
|
---|
45 | MRawEvtData *fRawEvt; //! Raw event data (time slices)
|
---|
46 | MRawRunHeader *fRunHeader; //! RunHeader information
|
---|
47 | MRawEvtHeader *fEvtHeader; //! EvtHeader information
|
---|
48 | MExtractTimeAndCharge *fExtractor; // Possible Extractor
|
---|
49 |
|
---|
50 | UShort_t fExtractWinFirst; // First FADC slice to extract pedestal from
|
---|
51 | UShort_t fExtractWinSize; // Number of slices to calculate the pedestal from
|
---|
52 | UShort_t fExtractWinLast; // Last FADC slice to extract pedestal from
|
---|
53 |
|
---|
54 | UInt_t fNumEventsDump; // Number of event after which MPedestalCam gets updated
|
---|
55 | UInt_t fNumAreasDump; // Number of events after which averaged areas gets updated
|
---|
56 | UInt_t fNumSectorsDump; // Number of events after which averaged sectors gets updated
|
---|
57 |
|
---|
58 | Bool_t fPedestalUpdate; // Flag if the pedestal shall be updated after every fNumEventsDump
|
---|
59 | Bool_t fUseSpecialPixels; // Flag if the special pixels shall be treated
|
---|
60 |
|
---|
61 | MArrayD fSumx; // sum of values
|
---|
62 | MArrayD fSumx2; // sum of squared values
|
---|
63 | MArrayD fSumAB0; // sum of ABFlag=0 slices
|
---|
64 | MArrayD fSumAB1; // sum of ABFlag=1 slices
|
---|
65 | MArrayD fAreaSumx; // averaged sum of values per area idx
|
---|
66 | MArrayD fAreaSumx2; // averaged sum of squared values per area idx
|
---|
67 | MArrayD fAreaSumAB0; // averaged sum of ABFlag=0 slices per area idx
|
---|
68 | MArrayD fAreaSumAB1; // averaged sum of ABFlag=1 slices per area idx
|
---|
69 | MArrayI fAreaFilled; // number of valid entries with area idx
|
---|
70 | MArrayI fAreaValid; // number of valid pixels within area idx
|
---|
71 | MArrayD fSectorSumx; // averaged sum of values per sector
|
---|
72 | MArrayD fSectorSumx2; // averaged sum of squared values per sector
|
---|
73 | MArrayD fSectorSumAB0; // averaged sum of ABFlag=0 slices per sector
|
---|
74 | MArrayD fSectorSumAB1; // averaged sum of ABFlag=1 slices per sector
|
---|
75 | MArrayI fSectorFilled; // number of valid entries with sector idx
|
---|
76 | MArrayI fSectorValid; // number of valid pixels within sector idx
|
---|
77 |
|
---|
78 | // MTask virtual functions
|
---|
79 | Int_t PreProcess(MParList *pList);
|
---|
80 | Int_t Process();
|
---|
81 | Int_t PostProcess();
|
---|
82 | Bool_t ReInit(MParList *pList);
|
---|
83 | Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
|
---|
84 |
|
---|
85 | // Interface to be overwritten by a new class
|
---|
86 | virtual void ResetArrays();
|
---|
87 | virtual Int_t Calc() = 0;
|
---|
88 |
|
---|
89 | // Helper functions
|
---|
90 | void CalcPixResults (const UInt_t nevts, const UInt_t pixid);
|
---|
91 | void CalcAreaResults (const UInt_t nevts, const UInt_t napix, const UInt_t aidx);
|
---|
92 | void CalcSectorResults(const UInt_t nevts, const UInt_t nspix, const UInt_t sector);
|
---|
93 |
|
---|
94 | public:
|
---|
95 | MExtractPedestal(const char *name=NULL, const char *title=NULL);
|
---|
96 |
|
---|
97 | void Clear(const Option_t *o="");
|
---|
98 | void Print(const Option_t *o="") const;
|
---|
99 |
|
---|
100 | Bool_t SetExtractWindow(UShort_t first, UShort_t size);
|
---|
101 |
|
---|
102 | void SetNumEventsDump (UInt_t dumpevents=fgNumDump) { fNumEventsDump = dumpevents; }
|
---|
103 | void SetNumAreasDump (UInt_t dumpevents=fgNumDump) { fNumAreasDump = dumpevents; }
|
---|
104 | void SetNumSectorsDump(UInt_t dumpevents=fgNumDump) { fNumSectorsDump = dumpevents; }
|
---|
105 | void SetNumDump (UInt_t n=fgNumDump) { fNumEventsDump=n; fNumAreasDump=n; fNumSectorsDump=n; }
|
---|
106 |
|
---|
107 | // names
|
---|
108 | void SetNamePedestalCamIn (const char *name=fgNamePedestalCam) { fNamePedestalCamIn = name; }
|
---|
109 | void SetNamePedestalCamInter(const char *name=fgNamePedestalCam) { fNamePedestalCamInter = name; }
|
---|
110 | void SetNamePedestalCamOut (const char *name=fgNamePedestalCam) { fNamePedestalCamOut = name; }
|
---|
111 | void SetNameRawEvtData (const char *name=fgNameRawEvtData) { fNameRawEvtData = name; }
|
---|
112 |
|
---|
113 | // pointers
|
---|
114 | void SetExtractor ( MExtractTimeAndCharge *e) { fExtractor = e; }
|
---|
115 | void SetPedestalsIn ( MPedestalCam *pedcam ) { fPedestalsIn = pedcam; }
|
---|
116 | void SetPedestalsInter( MPedestalCam *pedcam ) { fPedestalsInter = pedcam; }
|
---|
117 | void SetPedestalsOut ( MPedestalCam *pedcam ) { fPedestalsOut = pedcam; }
|
---|
118 |
|
---|
119 | // flags
|
---|
120 | void SetIntermediateStorage (Bool_t b=kTRUE) { fIntermediateStorage = b; }
|
---|
121 | void SetUseSpecialPixels (Bool_t b=kTRUE) { fUseSpecialPixels = b; }
|
---|
122 | void SetPedestalUpdate (Bool_t b=kTRUE) { fPedestalUpdate = b; }
|
---|
123 | void SetRandomCalculation (Bool_t b=kTRUE) { fRandomCalculation = b; }
|
---|
124 |
|
---|
125 | ClassDef(MExtractPedestal, 0) // Base class for pedestal extractors
|
---|
126 | };
|
---|
127 |
|
---|
128 | #endif
|
---|