]>
Commit | Line | Data |
---|---|---|
ee299369 | 1 | #ifndef ALIEMCALRAWUTILS_H |
2 | #define ALIEMCALRAWUTILS_H | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | /* $Id$ */ | |
e5bbbc4e | 7 | |
ee299369 | 8 | //_________________________________________________________________________ |
9 | // Utility Class for handling Raw data | |
10 | // Does all transitions from Digits to Raw and vice versa, | |
11 | // for simu and reconstruction | |
12 | // | |
13 | // Note: the current version is still simplified. Only | |
14 | // one raw signal per digit is generated; either high-gain or low-gain | |
15 | // Need to add concurrent high and low-gain info in the future | |
16 | // No pedestal is added to the raw signal. | |
17 | // | |
18 | //*-- Author: Marco van Leeuwen (LBL) | |
19 | // | |
20 | #include "TObject.h" // for ROOT types | |
feedcab9 | 21 | #include <TString.h> |
32cd4c24 | 22 | //#include "AliCaloRawStreamV3.h" |
23 | class AliCaloRawStreamV3; | |
e5bbbc4e | 24 | class AliAltroMapping; |
ee299369 | 25 | class TGraph; |
ee299369 | 26 | class AliRawReader; |
65bdc82f | 27 | class AliEMCALGeometry; |
5e3106bc | 28 | class AliCaloCalibPedestal; |
16605c06 | 29 | class AliCaloRawAnalyzer; |
ee299369 | 30 | |
31 | class AliEMCALRawUtils : public TObject { | |
32 | public: | |
16605c06 | 33 | enum fitAlgorithm {kStandard = 0, kFastFit= 1, kNeuralNet = 2, kLogFit = 3, kLMS = 4, kPeakFinder = 5, kCrude = 6}; |
9f467289 | 34 | |
16605c06 | 35 | AliEMCALRawUtils(fitAlgorithm fitAlgo = kStandard); |
36 | AliEMCALRawUtils(AliEMCALGeometry *pGeometry, fitAlgorithm fitAlgo = kStandard); | |
37 | virtual ~AliEMCALRawUtils(); | |
9f467289 | 38 | |
65bdc82f | 39 | AliEMCALRawUtils(const AliEMCALRawUtils& rawUtils); //copy ctor |
40 | AliEMCALRawUtils& operator =(const AliEMCALRawUtils& rawUtils); | |
41 | ||
42 | void Digits2Raw(); | |
916f1e76 | 43 | void Raw2Digits(AliRawReader *reader, TClonesArray *digitsArr, const AliCaloCalibPedestal* pedbadmap, |
44 | TClonesArray *digitsTRG=0x0); | |
65bdc82f | 45 | |
829ba234 | 46 | void AddDigit(TClonesArray *digitsArr, Int_t id, Int_t lowGain, Float_t amp, Float_t time); |
916f1e76 | 47 | void AddDigit(TClonesArray *digitsArr, Int_t id, Int_t timeSamples[], Int_t nSamples); |
f4a4dc82 | 48 | void TrimDigits(TClonesArray *digitsArr); |
ee299369 | 49 | |
50 | // Signal shape parameters | |
b4133f05 | 51 | Double_t GetRawFormatHighLowGainFactor() const { return fHighLowGainFactor ;} |
829ba234 | 52 | Int_t GetRawFormatOrder() const { return fOrder ; } |
b4133f05 | 53 | Double_t GetRawFormatTau() const { return fTau ; } |
829ba234 | 54 | Int_t GetNoiseThreshold() const { return fNoiseThreshold; } |
55 | Int_t GetNPedSamples() const { return fNPedSamples; } | |
f4a4dc82 | 56 | |
e2c2134b | 57 | // get methods for fast fit simulation |
829ba234 | 58 | Int_t GetPedestalValue() const {return fgPedestalValue;} |
59 | Double_t GetFEENoise() const {return fgFEENoise;} | |
b4133f05 | 60 | |
829ba234 | 61 | Bool_t GetRemoveBadChannels() const {return fRemoveBadChannels;} |
62 | Int_t GetFittingAlgorithm() const {return fFittingAlgorithm; } | |
f4a4dc82 | 63 | Float_t GetTimeMax() const {return fTimeMax ;} |
64 | Float_t GetTimeMin() const {return fTimeMin ;} | |
829ba234 | 65 | Bool_t UseFALTRO() const {return fUseFALTRO; } |
f4a4dc82 | 66 | |
b4133f05 | 67 | void SetRawFormatHighLowGainFactor(Double_t val) {fHighLowGainFactor=val;} |
68 | void SetRawFormatOrder(Int_t val) {fOrder=val; } | |
69 | void SetRawFormatTau(Double_t val) {fTau=val; } | |
70 | void SetNoiseThreshold(Int_t val) {fNoiseThreshold=val; } | |
71 | void SetNPedSamples(Int_t val) {fNPedSamples=val; } | |
9f467289 | 72 | void SetRemoveBadChannels(Bool_t val) {fRemoveBadChannels=val; } |
4fe71e02 | 73 | void SetFittingAlgorithm(Int_t val) ; |
f4a4dc82 | 74 | void SetTimeMin(Float_t t) {fTimeMin = t ;} |
75 | void SetTimeMax(Float_t t) {fTimeMax = t ;} | |
46f1d25f | 76 | void SetFALTROUsage(Bool_t val) {fUseFALTRO=val; } |
77 | ||
e2c2134b | 78 | // set methods for fast fit simulation |
79 | void SetFEENoise(Double_t val) {fgFEENoise = val;} | |
80 | void SetRawFormatTimeBins(Int_t val) {fgTimeBins = val;} | |
829ba234 | 81 | void SetPedestalValue(Int_t val) {fgPedestalValue = val;} |
7643e728 | 82 | |
829ba234 | 83 | static Int_t GetRawFormatTimeBins() { return fgTimeBins ; } |
84 | static Double_t GetRawFormatTimeMax() { return fgTimeBins*fgTimeBinWidth; } | |
82cbdfca | 85 | static Double_t GetRawFormatTimeBinWidth() { return fgTimeBinWidth; } |
85c25c2e | 86 | static Double_t GetRawFormatTimeBin() |
87 | { return GetRawFormatTimeMax() / GetRawFormatTimeBins(); } | |
829ba234 | 88 | Double_t GetRawFormatTimeTrigger() const { return fgTimeTrigger ; } |
89 | Int_t GetRawFormatThreshold() const { return fgThreshold ; } | |
ee299369 | 90 | Int_t GetRawFormatDDLPerSuperModule() const { return fgDDLPerSuperModule ; } |
829ba234 | 91 | AliCaloRawAnalyzer *GetRawAnalyzer() const { return fRawAnalyzer;} |
16605c06 | 92 | |
feedcab9 | 93 | virtual Option_t* GetOption() const { return fOption.Data(); } |
16605c06 | 94 | void SetOption(const Option_t* opt) { fOption = opt; } |
feedcab9 | 95 | |
ee299369 | 96 | // Signal shape functions |
9f467289 | 97 | |
507751ce | 98 | void FitRaw(const Int_t firstTimeBin, const Int_t lastTimeBin, Float_t & amp, Float_t & time, Bool_t & fitDone) const ; |
16605c06 | 99 | void FitParabola(const TGraph *gSig, Float_t & amp) const ; |
ee299369 | 100 | static Double_t RawResponseFunction(Double_t *x, Double_t *par); |
7683df1d | 101 | static Double_t RawResponseFunctionLog(Double_t *x, Double_t *par); |
6751f762 | 102 | Bool_t RawSampledResponse(Double_t dtime, Double_t damp, Int_t * adcH, Int_t * adcL, const Int_t keyErr=0) const; |
ee299369 | 103 | |
3a187ba0 | 104 | static void CalculateChi2(const Double_t* t,const Double_t* y,const Int_t nPoints, |
105 | const Double_t sig, const Double_t tau, const Double_t amp, const Double_t t0, Double_t &chi2); | |
ee299369 | 106 | |
107 | private: | |
108 | Double_t fHighLowGainFactor ; // high to low gain factor for the raw RO signal | |
b4133f05 | 109 | Int_t fOrder ; // order of the gamma function for the RO signal |
110 | Double_t fTau ; // tau parameter of gamma function for the RO signal | |
111 | Int_t fNoiseThreshold; // threshold to consider signal or noise | |
112 | Int_t fNPedSamples; // number of samples to use in pedestal calculation | |
f4a4dc82 | 113 | |
b4133f05 | 114 | static const Int_t fgkOverflowCut = 950; // cut to discriminate overflowed channels |
b4133f05 | 115 | static const Int_t fgkRawSignalOverflow = 0x3FF; // maximum signal (10 bits) |
7643e728 | 116 | static Int_t fgTimeBins; // number of sampling bins of the raw RO signal |
b4133f05 | 117 | |
118 | static Double_t fgTimeTrigger ; // time of the trigger for the RO signal | |
82cbdfca | 119 | static Double_t fgTimeBinWidth; // maximum sampled time of the raw RO signal |
ee299369 | 120 | static Int_t fgThreshold; // threshold |
121 | static Int_t fgDDLPerSuperModule; // number of DDL per SuperModule | |
fe93d365 | 122 | static Int_t fgPedestalValue; // pedestal value for Digits2Raw |
123 | static Double_t fgFEENoise; // electronics noise in ADC units | |
feedcab9 | 124 | |
f4a4dc82 | 125 | AliEMCALGeometry* fGeom; // geometry |
126 | AliAltroMapping* fMapping[4]; // only two for now | |
65bdc82f | 127 | |
feedcab9 | 128 | TString fOption; //! option passed from Reconstructor |
b4133f05 | 129 | |
f4a4dc82 | 130 | Bool_t fRemoveBadChannels; // select if bad channels are removed before fitting |
131 | Int_t fFittingAlgorithm; // select the fitting algorithm | |
132 | Float_t fTimeMin; // minimum threshold for the time of the signal | |
133 | Float_t fTimeMax; // maximum threshold for the time of the signal | |
134 | Bool_t fUseFALTRO; // use FALTRO and pass it to the digits | |
46f1d25f | 135 | |
16605c06 | 136 | AliCaloRawAnalyzer *fRawAnalyzer; // e.g. for sample selection for fits |
9f467289 | 137 | |
f4a4dc82 | 138 | ClassDef(AliEMCALRawUtils,7) // utilities for raw signal fitting |
ee299369 | 139 | }; |
140 | ||
141 | #endif |