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

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