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