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

Last change on this file since 8260 was 8151, checked in by tbretz, 18 years ago
*** empty log message ***
File size: 5.8 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;
22class MPedestalSubtractedEvt;
23class MRawEvtPixelIter;
24
25class MExtractPedestal : public MTask
26{
27private:
28 static const TString fgNamePedestalCam; //! "MPedestalCam"
29 static const TString fgNameRawEvtData; //! "MRawEvtData"
30
31 static const UShort_t fgCheckWinFirst; //! First FADC slice to check for signal (currently set to: 0)
32 static const UShort_t fgCheckWinLast; //! Last FADC slice to check for signal (currently set to: 29)
33 static const UShort_t fgMaxSignalVar; //! The maximum difference between the highest and lowest slice
34
35 TString fNamePedestalCamIn; // Name of the incoming 'MPedestalCam' container
36 TString fNamePedestalCamOut; // Name of the outgoing 'MPedestalCam' container
37 TString fNamePedestalCamInter; // Name of the intermediate 'MPedestalCam' container
38 TString fNameRawEvtData; // Name of MRawEvtData
39
40 Bool_t fRandomCalculation; // Is pedestalextraction by extractor random?
41
42protected:
43
44 Bool_t fIntermediateStorage; // Is pedestal stored every event?
45
46 MGeomCam *fGeom; //! Camera geometry
47 MPedestalCam *fPedestalsIn; //! Pedestals of all pixels in the camera (incoming)
48 MPedestalCam *fPedestalsInter; //! Pedestals of all pixels in the camera (intermediate)
49 MPedestalCam *fPedestalsOut; //! Pedestals of all pixels in the camera (outgoing)
50 MRawEvtData *fRawEvt; //! Raw event data (time slices)
51 MRawRunHeader *fRunHeader; //! RunHeader information
52 MExtractTimeAndCharge *fExtractor; // Possible Extractor
53 MPedestalSubtractedEvt *fSignal; //!
54
55 UShort_t fExtractWinFirst; // First FADC slice to extract pedestal from
56 UShort_t fExtractWinSize; // Number of slices to calculate the pedestal from
57 UShort_t fExtractWinLast; // Last FADC slice to extract pedestal from
58
59 UShort_t fCheckWinFirst;
60 UShort_t fCheckWinLast;
61
62 UShort_t fMaxSignalVar;
63
64 Bool_t fUseSpecialPixels; // Flag if the special pixels shall be treated
65
66 MArrayD fSumx; // sum of values
67 MArrayD fSumx2; // sum of squared values
68 MArrayD fSumAB0; // sum of ABFlag=0 slices
69 MArrayD fSumAB1; // sum of ABFlag=1 slices
70 MArrayD fAreaSumx; // averaged sum of values per area idx
71 MArrayD fAreaSumx2; // averaged sum of squared values per area idx
72 MArrayD fAreaSumAB0; // averaged sum of ABFlag=0 slices per area idx
73 MArrayD fAreaSumAB1; // averaged sum of ABFlag=1 slices per area idx
74 MArrayI fAreaFilled; // number of valid entries with area idx
75 MArrayI fAreaValid; // number of valid pixels within area idx
76 MArrayD fSectorSumx; // averaged sum of values per sector
77 MArrayD fSectorSumx2; // averaged sum of squared values per sector
78 MArrayD fSectorSumAB0; // averaged sum of ABFlag=0 slices per sector
79 MArrayD fSectorSumAB1; // averaged sum of ABFlag=1 slices per sector
80 MArrayI fSectorFilled; // number of valid entries with sector idx
81 MArrayI fSectorValid; // number of valid pixels within sector idx
82
83 // MTask virtual functions
84 Int_t PreProcess(MParList *pList);
85 Int_t Process();
86 Int_t PostProcess();
87 Bool_t ReInit(MParList *pList);
88 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
89
90 // Interface to be overwritten by a new class
91 virtual void ResetArrays();
92 virtual Int_t Calc() = 0;
93
94 // Helper functions
95 void CalcPixResults (const UInt_t nevts, const UInt_t pixid);
96 void CalcAreaResults (const UInt_t nevts, const UInt_t napix, const UInt_t aidx);
97 void CalcSectorResults(const UInt_t nevts, const UInt_t nspix, const UInt_t sector);
98
99 Float_t CalcExtractor(const MRawEvtPixelIter &pixel, Int_t offset) const;
100 UInt_t CalcSums(const MRawEvtPixelIter &pixel, Int_t offset, UInt_t &ab0, UInt_t &ab1) const;
101 Bool_t CheckVariation(UInt_t idx) const;
102
103 void CheckExtractionWindow();
104
105public:
106 MExtractPedestal(const char *name=NULL, const char *title=NULL);
107
108 void Clear(const Option_t *o="");
109 void Print(const Option_t *o="") const;
110
111 // Setters
112 Bool_t SetExtractWindow(UShort_t first, UShort_t size);
113 Bool_t SetCheckRange(UShort_t checkfirst=fgCheckWinFirst, UShort_t checklast=fgCheckWinLast);
114
115 void SetMaxSignalVar(UShort_t maxvar=40) { fMaxSignalVar = maxvar; }
116
117 // names
118 void SetNamePedestalCamIn (const char *name=fgNamePedestalCam) { fNamePedestalCamIn = name; }
119 void SetNamePedestalCamInter(const char *name=fgNamePedestalCam) { fNamePedestalCamInter = name; }
120 void SetNamePedestalCamOut (const char *name=fgNamePedestalCam) { fNamePedestalCamOut = name; }
121 void SetNameRawEvtData (const char *name=fgNameRawEvtData) { fNameRawEvtData = name; }
122
123 // pointers
124 void SetExtractor ( MExtractTimeAndCharge *e) { fExtractor = e; }
125 void SetPedestalsIn ( MPedestalCam *pedcam ) { fPedestalsIn = pedcam; }
126 void SetPedestalsInter( MPedestalCam *pedcam ) { fPedestalsInter = pedcam; }
127 void SetPedestalsOut ( MPedestalCam *pedcam ) { fPedestalsOut = pedcam; }
128
129 // flags
130 void SetIntermediateStorage (Bool_t b=kTRUE) { fIntermediateStorage = b; }
131 void SetUseSpecialPixels (Bool_t b=kTRUE) { fUseSpecialPixels = b; }
132 void SetRandomCalculation (Bool_t b=kTRUE) { fRandomCalculation = b; }
133
134 ClassDef(MExtractPedestal, 0) // Base class for pedestal extractors
135};
136
137#endif
Note: See TracBrowser for help on using the repository browser.