Got rid of class template AliFMD<Type> on request of Federico, who
[u/mrichter/AliRoot.git] / FMD / AliFMDDigitizer.h
1 #ifndef ALIFMDDIGITIZER_H
2 #define ALIFMDDIGITIZER_H
3 /* Copyright(c) 1998-2000, ALICE Experiment at CERN, All rights
4  * reserved. 
5  *
6  * See cxx source for full Copyright notice                               
7  */
8 #ifndef ALIDIGITIZER_H
9 # include <AliDigitizer.h>
10 #endif
11 #ifndef ALIRUNDIGITIZER_H
12 # include <AliRunDigitizer.h>
13 #endif
14 #ifndef ALIFMDEdepMAP_H
15 # include <AliFMDEdepMap.h>
16 #endif
17 #ifndef __UTILITY__
18 # include <utility>
19 #endif
20 // #ifndef ROOT_TArrayF
21 // # include <TArrayF.h>
22 // #endif
23
24 //====================================================================
25 class TClonesArray;
26 class AliFMD;
27 class AliLoader;
28 class AliRunLoader;
29
30
31 //====================================================================
32 class AliFMDBaseDigitizer : public AliDigitizer 
33 {
34 public:
35   AliFMDBaseDigitizer();
36   AliFMDBaseDigitizer(AliRunDigitizer * manager);
37   AliFMDBaseDigitizer(const Char_t* name, const Char_t* title);
38   virtual ~AliFMDBaseDigitizer();
39    
40   // Do the main work
41   virtual Bool_t Init();
42
43   // Extra member functions 
44   void     SetVA1MipRange(UShort_t r=20) { fVA1MipRange = r; }
45   void     SetAltroChannelSize(UShort_t s=1024) { fAltroChannelSize = s;}
46   void     SetSampleRate(UShort_t r=1) { fSampleRate = (r>2 ? 2 : r); }
47   void     SetShapingTime(Float_t t=10) { fShapingTime = t;  }
48   
49   UShort_t GetVA1MipRange()      const { return fVA1MipRange; }
50   UShort_t GetAltroChannelSize() const { return fAltroChannelSize; }
51   UShort_t GetSampleRate()       const { return fSampleRate; }
52   Float_t  GetShapingTime()      const { return fShapingTime; }
53 protected:
54   virtual void     SumContributions(AliFMD* fmd);
55   virtual void     DigitizeHits(AliFMD* fmd) const;
56   virtual void     ConvertToCount(Float_t   edep, 
57                                   Float_t   last,
58                                   Float_t   siThickness, 
59                                   Float_t   siDensity, 
60                                   TArrayI&  counts) const;
61   virtual UShort_t MakePedestal() const { return 0; }
62   virtual void     AddNoise(TArrayI&) const {}
63   virtual void     AddDigit(AliFMD*  /* fmd      */,
64                             UShort_t /* detector */, 
65                             Char_t   /* ring     */,
66                             UShort_t /* sector   */, 
67                             UShort_t /* strip    */, 
68                             Float_t  /* edep     */, 
69                             UShort_t /* count1   */, 
70                             Short_t  /* count2   */, 
71                             Short_t  /* count3   */) const {}
72
73   AliRunLoader* fRunLoader;
74   AliFMDEdepMap fEdep;             // Cache of Energy from hits 
75   UShort_t      fVA1MipRange;      // How many MIPs the pre-amp can do    
76   UShort_t      fAltroChannelSize; // Largest # to store in 1 ADC chan.
77   UShort_t      fSampleRate;       // Times the ALTRO samples pre-amp.
78   Float_t       fShapingTime;      // Shaping profile parameter
79   
80   ClassDef(AliFMDBaseDigitizer,0) // Base class for FMD digitizers
81 };
82
83 //====================================================================
84 class AliFMDDigitizer : public AliFMDBaseDigitizer 
85 {
86 public:
87   AliFMDDigitizer();
88   AliFMDDigitizer(AliRunDigitizer * manager);
89   virtual ~AliFMDDigitizer() {}
90   virtual void  Exec(Option_t* option=0);
91   
92    
93   // Extra member functions 
94   void     SetPedestal(Float_t mean=10, Float_t width=.5);
95   void     GetPedestal(Float_t& mean,   Float_t& width) const;
96 protected:
97   virtual void     AddDigit(AliFMD*  fmd,
98                             UShort_t detector, 
99                             Char_t   ring,
100                             UShort_t sector, 
101                             UShort_t strip, 
102                             Float_t  edep, 
103                             UShort_t count1, 
104                             Short_t  count2, 
105                             Short_t  count3) const;
106   virtual UShort_t MakePedestal() const;
107   virtual void     CheckDigit(Float_t         edep, 
108                               UShort_t        nhits,
109                               const TArrayI&  counts);
110   Float_t       fPedestal;         // Mean of pedestal 
111   Float_t       fPedestalWidth;    // Width of pedestal 
112   ClassDef(AliFMDDigitizer,0) // Make Digits from Hits
113 };
114 //____________________________________________________________________
115 inline void 
116 AliFMDDigitizer::SetPedestal(Float_t mean, Float_t width) 
117 {
118   fPedestal      = mean;
119   fPedestalWidth = width;
120 }
121
122 //____________________________________________________________________
123 inline void 
124 AliFMDDigitizer::GetPedestal(Float_t& mean, Float_t& width)  const
125 {
126   mean  = fPedestal;
127   width = fPedestalWidth;
128 }
129
130
131 //====================================================================
132 class AliFMDSDigitizer : public AliFMDBaseDigitizer 
133 {
134 public:
135   AliFMDSDigitizer();
136   AliFMDSDigitizer(const Char_t* headerFile, const Char_t* sdigFile="");
137   virtual ~AliFMDSDigitizer();
138   virtual void  Exec(Option_t* option=0);
139 protected:
140   virtual void     AddDigit(AliFMD*  fmd,
141                             UShort_t detector, 
142                             Char_t   ring,
143                             UShort_t sector, 
144                             UShort_t strip, 
145                             Float_t  edep, 
146                             UShort_t count1, 
147                             Short_t  count2, 
148                             Short_t  count3) const;
149   ClassDef(AliFMDSDigitizer,0) // Make Summable Digits from Hits
150 };
151
152
153
154 #endif
155 //____________________________________________________________________
156 //
157 // Local Variables:
158 //   mode: C++
159 // End:
160 //
161 //
162 // EOF
163 //
164