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