]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSPulseGenerator.h
Extract ALTRO sample generation to a separate class AliPHOSPulseGenerator
[u/mrichter/AliRoot.git] / PHOS / AliPHOSPulseGenerator.h
1 #ifndef ALIPHOSPULSEGENERATOR_H
2 #define ALIPHOSPULSEGENERATOR_H
3 /* Copyright(c) 2007, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                          */
5
6 /* $Id$ */
7
8 // The class which simulates the pulse shape from the PHOS FEE shaper,
9 // make sampled amplitudes, digitize them.
10 // The shape is described by the function RawResponseFunction
11 // The input parameters for the shape function (time and aplitude) are passed
12 // to the class via constructor.
13 // Other parameters related to the shaper are hard-coded in this class
14
15 #include <Rtypes.h>
16
17 class AliPHOSPulseGenerator : public TObject
18 {
19 public:
20   AliPHOSPulseGenerator(Double_t a=0, Double_t t0=0);
21   AliPHOSPulseGenerator(const AliPHOSPulseGenerator & pulse);
22   virtual  ~AliPHOSPulseGenerator();
23
24   void      AddBaseline(Double_t baselineLevel);
25   void      AddNoise   (Double_t *sigma);
26   void      AddNoise   (Double_t *sigma, Double_t cutoff);
27   void      AddPretriggerSamples(Int_t nPresamples);
28   void      GetSamples(Int_t *adcHG, Int_t *adcLG) const;
29   Bool_t    MakeSamples();
30   void      Digitize();
31   Bool_t    GetDigitize() {return fDigitize;}
32   void      SetDigitise (Bool_t flag) {fDigitize  = flag;}
33   void      SetAmplitude(Double_t  a) {fAmplitude = a   ;}
34   void      SetTZero    (Double_t t0) {fTZero     = t0  ;}
35
36   // Raw Read Out
37   Double_t        GetRawFormatCapa()        const { return fgCapa ; }
38   static Double_t GetRawFormatHighCharge()        { return fgHighCharge ; }
39   static Double_t GetRawFormatHighGain()          { return fgHighGain ; }
40   static Double_t GetRawFormatHighLowGainFactor() { return fgHighLowGainFactor ; }
41   static Double_t GetRawFormatLowCharge()         { return ( fgHighCharge *  fgHighLowGainFactor ) ; }
42   static Double_t GetRawFormatLowGain()           { return ( fgHighGain / fgHighLowGainFactor ) ; }
43   Int_t           GetRawFormatOrder()       const { return fgOrder ; }
44   static Int_t    GetRawFormatTimeBins()          { return fkTimeBins ; }
45   Double_t        GetRawFormatTimeMax()     const { return fgTimeMax ; }
46   Double_t        GetRawFormatTimePeak()    const { return fgTimePeak ; }
47   Double_t        GetRawFormatTimeTrigger() const { return fgTimeTrigger ; }
48   static Double_t RawResponseFunctionMax(Double_t charge, Double_t gain) ;
49   static Double_t RawResponseFunction   (Double_t *x, Double_t *par) ;
50
51   virtual void Print(Option_t*) const;
52   virtual void Draw (Option_t*);
53
54   AliPHOSPulseGenerator& operator = (const AliPHOSPulseGenerator &) {
55     Fatal("operator =", "not implemented") ;
56     return *this;
57   }
58
59 private:
60   static Double_t fgCapa ;              // capacitor of the preamplifier
61   static Double_t fgHighCharge ;        // high charge (to convert energy to charge)
62   static Double_t fgHighGain ;          // high gain
63   static Double_t fgHighLowGainFactor ; // high to low gain factor
64   static Int_t    fgOrder ;             // order of the gamma function
65   static const Int_t fkTimeBins = 64 ;  // number of sampling bins
66   static Double_t fgTimeMax ;           // maximum sampled time
67   static Double_t fgTimePeak ;          // peaking time
68   static Double_t fgTimeTrigger ;       // time of the trigger for the RO signal 
69   
70 private:
71   Double_t  fAmplitude;    // signal amplitude in GeV
72   Double_t  fTZero;        // signal start time in ns
73   Double_t *fDataHG;       // samples array for high gain
74   Double_t *fDataLG;       // samples array for low  gain
75   Bool_t    fDigitize;     // true is samples should be rounded to integers
76   
77   ClassDef(AliPHOSPulseGenerator,1)
78
79 };
80
81 #endif
82