]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALRawUtils.h
reorganization of TRD PID reference maker classes. Data management has
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALRawUtils.h
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$ */
7
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
21 #include <TString.h>
22 //#include "AliCaloRawStreamV3.h"
23 class AliCaloRawStreamV3;
24 class AliAltroMapping;
25 class TGraph;
26 class TF1;
27 class AliRawReader;
28 class AliEMCALGeometry;
29
30 class AliEMCALRawUtils : public TObject {
31  public:
32   AliEMCALRawUtils();
33   AliEMCALRawUtils(AliEMCALGeometry *pGeometry);
34   virtual ~AliEMCALRawUtils();
35
36   AliEMCALRawUtils(const AliEMCALRawUtils& rawUtils);  //copy ctor
37   AliEMCALRawUtils& operator =(const AliEMCALRawUtils& rawUtils);
38
39   void Digits2Raw();
40   void Raw2Digits(AliRawReader *reader,TClonesArray *digitsArr);
41
42   void AddDigit(TClonesArray *digitsArr, Int_t id, Int_t lowGain, Int_t amp, Float_t time);
43
44   // Signal shape parameters
45   Double_t GetRawFormatHighLowGainFactor() const { return fHighLowGainFactor ;}
46   Int_t GetRawFormatOrder()                const { return fOrder ; }   
47   Double_t GetRawFormatTau()               const { return fTau ; }    
48   Int_t GetNoiseThreshold()                const { return fNoiseThreshold; }
49   Int_t GetNPedSamples()                   const { return fNPedSamples; }
50
51   void SetRawFormatHighLowGainFactor(Double_t val) {fHighLowGainFactor=val;}
52   void SetRawFormatOrder(Int_t val)                {fOrder=val; }   
53   void SetRawFormatTau(Double_t val)               {fTau=val; }    
54   void SetNoiseThreshold(Int_t val)                {fNoiseThreshold=val; }
55   void SetNPedSamples(Int_t val)                   {fNPedSamples=val; }
56   
57   static Int_t GetRawFormatTimeBins() { return fgkTimeBins ; }    
58   static Double_t GetRawFormatTimeMax() { return fgkTimeBins*fgTimeBinWidth; }   
59   static Double_t GetRawFormatTimeBinWidth() { return fgTimeBinWidth; }   
60   static Double_t GetRawFormatTimeBin() 
61   { return GetRawFormatTimeMax() / GetRawFormatTimeBins(); }   
62   Double_t GetRawFormatTimeTrigger() const { return fgTimeTrigger ; }
63   Int_t GetRawFormatThreshold() const { return fgThreshold ; }       
64   Int_t GetRawFormatDDLPerSuperModule() const { return fgDDLPerSuperModule ; } 
65
66   virtual Option_t* GetOption() const { return fOption.Data(); }
67   void SetOption(Option_t* opt) { fOption = opt; }
68
69   // Signal shape functions
70   void FitRaw(TGraph * gSig, TF1* signalF, Float_t & amp, Float_t & time) const ;
71   static Double_t RawResponseFunction(Double_t *x, Double_t *par); 
72   Bool_t   RawSampledResponse(Double_t dtime, Double_t damp, Int_t * adcH, Int_t * adcL) const;  
73
74
75  private:
76   Double_t fHighLowGainFactor ;         // high to low gain factor for the raw RO signal
77   Int_t fOrder ;                        // order of the gamma function for the RO signal
78   Double_t fTau ;                       // tau parameter of gamma function for the RO signal
79   Int_t fNoiseThreshold;                // threshold to consider signal or noise
80   Int_t fNPedSamples;                   // number of samples to use in pedestal calculation
81
82   static const Int_t fgkOverflowCut = 950;  // cut to discriminate overflowed channels
83   static const Int_t fgkTimeBins = 256 ; // number of sampling bins of the raw RO signal  
84   static const Int_t fgkRawSignalOverflow = 0x3FF; // maximum signal (10 bits)
85
86   static Double_t fgTimeTrigger ;       // time of the trigger for the RO signal 
87   static Double_t fgTimeBinWidth;       // maximum sampled time of the raw RO signal                             
88   static Int_t fgThreshold;             // threshold
89   static Int_t fgDDLPerSuperModule;     // number of DDL per SuperModule
90   static Int_t fgPedestalValue;         // pedestal value for Digits2Raw
91   static Double_t fgFEENoise;           // electronics noise in ADC units
92
93   AliEMCALGeometry* fGeom;         //geometry
94   AliAltroMapping*  fMapping[4];   //only two for now
95
96   TString fOption;                      //! option passed from Reconstructor
97
98   ClassDef(AliEMCALRawUtils,3)          // utilities for raw signal fitting
99 };
100
101 #endif