source: trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.h@ 6593

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