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