source: trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilter.h@ 9061

Last change on this file since 9061 was 8304, checked in by tbretz, 18 years ago
*** empty log message ***
File size: 4.1 KB
Line 
1#ifndef MARS_MExtractTimeAndChargeDigitalFilter
2#define MARS_MExtractTimeAndChargeDigitalFilter
3
4#ifndef MARS_MExtractTimeAndCharge
5#include "MExtractTimeAndCharge.h"
6#endif
7
8#ifndef MARS_MArrayF
9#include "MArrayF.h"
10#endif
11
12class MCalibrationPattern;
13
14class MExtractTimeAndChargeDigitalFilter : public MExtractTimeAndCharge
15{
16private:
17 static const Byte_t fgHiGainFirst; //! Default for fHiGainFirst (now set to: 0)
18 static const Byte_t fgHiGainLast; //! Default for fHiGainLast (now set to:14)
19 static const Int_t fgLoGainFirst; //! Default for fLoGainFirst (now set to: 3)
20 static const Byte_t fgLoGainLast; //! Default for fLoGainLast (now set to:14)
21 static const Int_t fgBinningResolutionHiGain; //! Default for fBinningResolutionHiGain (now set to: 10)
22 static const Int_t fgBinningResolutionLoGain; //! Default for fBinningResolutionLoGain (now set to: 10)
23 static const TString fgNameWeightsFile; //! "cosmics_weights.dat"
24 static const Float_t fgOffsetLoGain; //! Default for fOffsetLoGain (now set to 1.7)
25
26 MCalibrationPattern *fCalibPattern; //! Calibration DM pattern
27
28 Int_t fBinningResolutionHiGain; // Number of weights per bin High-Gain
29 Int_t fBinningResolutionLoGain; // Number of weights per bin Low-Gain
30
31 MArrayF fAmpWeightsHiGain; //! Amplitude weights High-Gain (from weights file)
32 MArrayF fTimeWeightsHiGain; //! Time weights High-Gain (from weights file)
33 MArrayF fAmpWeightsLoGain; //! Amplitude weights Low-Gain (from weights file)
34 MArrayF fTimeWeightsLoGain; //! Time weights Low-Gain (from weights file)
35
36 MArrayF fPulseHiGain; //! Pulse Shape Hi-Gain (for chisq)
37 MArrayF fPulseLoGain; //! Pulse Shape Lo-Gain (for chisq)
38
39 TString fNameWeightsFile; // Name of the weights file
40 Bool_t fAutomaticWeights; // Flag whether weight should be determined automatically
41 TString fNameWeightsFileSet; //! Flag if weights have alreayd been set
42
43 // MExtractTimeAndChargeDigitalFilter
44 void CalcBinningResArrays();
45 Int_t GetAutomaticWeights();
46 Bool_t GetWeights();
47 Int_t ReadWeightsFile(TString filename, TString path="");
48 TString CompileWeightFileName(TString path, const TString &name) const;
49
50
51 // MExtractTimeAndCharge
52 Bool_t InitArrays(Int_t n);
53
54 // MTask
55 Int_t PreProcess(MParList *pList);
56 Int_t Process();
57
58protected:
59 // MParContainer
60 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
61
62public:
63 MExtractTimeAndChargeDigitalFilter(const char *name=NULL, const char *title=NULL);
64 ~MExtractTimeAndChargeDigitalFilter() { }
65
66 void SetNameWeightsFile(TString s="")
67 {
68 s.ReplaceAll("\015", ""); // This is a fix for TEnv files edited with windows editors
69 fNameWeightsFile = s;
70 fNameWeightsFileSet="";
71 }
72
73 void EnableAutomaticWeights(Bool_t b=kTRUE) { fAutomaticWeights = b; }
74
75 void SetBinningResolution(const Int_t rh=fgBinningResolutionHiGain, const Int_t rl=fgBinningResolutionLoGain)
76 {
77 fBinningResolutionHiGain = rh;
78 fBinningResolutionLoGain = rl;
79 }
80
81 void SetWindowSize( Int_t windowh, Int_t windowl);
82 const char* GetNameWeightsFile() const { return fNameWeightsFile.Data(); }
83
84 void Print(Option_t *o="") const; //*MENU*
85
86 void FindTimeAndChargeHiGain2(const Float_t *firstused, Int_t num, Float_t &sum, Float_t &dsum,
87 Float_t &time, Float_t &dtime,
88 Byte_t sat, Int_t maxpos) const;
89
90 void FindTimeAndChargeLoGain2(const Float_t *firstused, Int_t num, Float_t &sum, Float_t &dsum,
91 Float_t &time, Float_t &dtime,
92 Byte_t sat, Int_t maxpos) const;
93
94 ClassDef(MExtractTimeAndChargeDigitalFilter, 3) // Hendrik's digital filter
95};
96
97#endif
Note: See TracBrowser for help on using the repository browser.