]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALRawUtils.h
Refactoring: Functions related to the shaper response
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALRawUtils.h
1 // -*- mode: c++ -*-
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$ */
8
9
10 //_________________________________________________________________________
11 //  Utility Class for handling Raw data
12 //  Does all transitions from Digits to Raw and vice versa, 
13 //  for simu and reconstruction
14 //
15 //  Note: the current version is still simplified. Only 
16 //    one raw signal per digit is generated; either high-gain or low-gain
17 //    Need to add concurrent high and low-gain info in the future
18 //    No pedestal is added to the raw signal.
19 //
20 //*-- Author: Marco van Leeuwen (LBL)
21 //
22 #include "TObject.h" // for ROOT types
23 #include <TString.h>
24
25
26 class AliAnalysisManager;
27 class AliCaloRawStreamV3;
28 class AliAltroMapping;
29 class TGraph;
30 class AliRawReader;
31 class AliEMCALGeometry;
32 class AliCaloCalibPedestal;
33 class AliCaloRawAnalyzer;
34 class AliCaloRawAnalyzerLMSOffline;
35 class AliEMCALTriggerRawDigitMaker;
36 class AliEMCALTriggerData;
37
38 #include "AliCaloConstants.h"
39
40
41 class AliEMCALRawUtils : public TObject {
42  public:
43   AliEMCALRawUtils(Algo::fitAlgorithm fitAlgo = Algo::kStandard);
44   AliEMCALRawUtils(AliEMCALGeometry *pGeometry, Algo::fitAlgorithm fitAlgo = Algo::kStandard);
45   virtual ~AliEMCALRawUtils();
46   
47   // void FitRaw(const Int_t firstTimeBin, const Int_t lastTimeBin, Float_t & amp, Float_t & time, Float_t & chi2, Bool_t & fitDone) const ;
48   //  void FitParabola(const TGraph *gSig, Float_t & amp) const ; 
49   
50   void Digits2Raw();
51   void Raw2Digits(AliRawReader *reader, TClonesArray *digitsArr, const AliCaloCalibPedestal* pedbadmap,
52                                   TClonesArray *digitsTRG=0x0, AliEMCALTriggerData* trgData = 0x0);
53   //static Double_t RawResponseFunctionLog(Double_t *x, Double_t *par); 
54   void AddDigit(TClonesArray *digitsArr, Int_t id, Int_t lowGain, Float_t amp, Float_t time, Float_t chi2, Int_t ndf);
55   void TrimDigits(TClonesArray *digitsArr);
56   Int_t    GetNoiseThreshold()             const { return fNoiseThreshold; }
57   Int_t    GetNPedSamples()                const { return fNPedSamples; }
58   
59   // Int_t    GetPedestalValue()     const {return fgPedestalValue;}
60   // Double_t GetFEENoise()          const {return fgFEENoise;}
61  
62   Bool_t   GetRemoveBadChannels() const {return fRemoveBadChannels;}
63   Int_t    GetFittingAlgorithm()  const {return fFittingAlgorithm; }
64   Float_t  GetTimeMax()           const {return fTimeMax ;}
65   Float_t  GetTimeMin()           const {return fTimeMin ;}
66   Bool_t   UseFALTRO()            const {return fUseFALTRO; }
67   void SetNoiseThreshold(Int_t val)                {fNoiseThreshold=val; }
68   void SetNPedSamples(Int_t val)                   {fNPedSamples=val; }
69   void SetRemoveBadChannels(Bool_t val)            {fRemoveBadChannels=val; }
70   void SetFittingAlgorithm(Int_t val) ;             
71   void SetTimeMin(Float_t t)                       {fTimeMin   = t          ;}
72   void SetTimeMax(Float_t t)                       {fTimeMax   = t          ;}
73   void SetFALTROUsage(Bool_t val)                  {fUseFALTRO=val; }
74   // void SetFEENoise(Double_t val)                   {fgFEENoise = val;}
75   // void SetPedestalValue(Int_t val)                 {fgPedestalValue = val;}
76   //Double_t GetRawFormatTimeTrigger()    const { return fgTimeTrigger ; }
77   // Int_t GetRawFormatThreshold()         const { return fgThreshold ; }       
78   AliCaloRawAnalyzer *GetRawAnalyzer()  const { return fRawAnalyzer;}
79   virtual Option_t* GetOption() const { return fOption.Data(); }
80   void SetOption(const Option_t* opt) { fOption = opt; }
81
82   // static Double_t RawResponseFunction(Double_t *x, Double_t *par); 
83   // Bool_t   RawSampledResponse(Double_t dtime, Double_t damp, Int_t * adcH, Int_t * adcL, const Int_t keyErr=0) const;  
84   
85
86
87 private:
88   AliEMCALRawUtils(const AliEMCALRawUtils& rawUtils);  //copy ctor
89   AliEMCALRawUtils& operator =(const AliEMCALRawUtils& rawUtils);
90   Int_t fNoiseThreshold;                // threshold to consider signal or noise
91   Int_t fNPedSamples;                   // number of samples to use in pedestal calculation
92   
93   /*
94   static Double_t fgTimeTrigger ;       // time of the trigger for the RO signal 
95   static Int_t fgThreshold;             // threshold
96   static Int_t fgPedestalValue;         // pedestal value for Digits2Raw
97   static Double_t fgFEENoise;           // electronics noise in ADC units
98   */ 
99
100   AliEMCALGeometry* fGeom;              // geometry
101   AliAltroMapping*  fMapping[4];        // only two for now
102   TString fOption;                      // option passed from Reconstructor
103   Bool_t  fRemoveBadChannels;           // select if bad channels are removed before fitting
104   Int_t   fFittingAlgorithm;            // select the fitting algorithm
105   Float_t fTimeMin;                     // minimum threshold for the time of the signal
106   Float_t fTimeMax;                     // maximum threshold for the time of the signal
107   Bool_t  fUseFALTRO;                   // use FALTRO and pass it to the digits
108   AliCaloRawAnalyzer *fRawAnalyzer;     // e.g. for sample selection for fits
109   AliEMCALTriggerRawDigitMaker* fTriggerRawDigitMaker;  
110  
111   ClassDef(AliEMCALRawUtils,7)          // utilities for raw signal fitting
112
113 };
114
115 #endif