]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDDigit.h
Correct raw data reconstruction in case of trigger
[u/mrichter/AliRoot.git] / FMD / AliFMDDigit.h
1 #ifndef ALIFMDDIGIT_H
2 #define ALIFMDDIGIT_H
3 /** @file    AliFMDDigit.h
4     @author  Christian Holm Christensen <cholm@nbi.dk>
5     @date    Mon Mar 27 12:37:41 2006
6     @brief   Digits for the FMD 
7 */
8 //___________________________________________________________________
9 //
10 //  Digits classes for the FMD
11 //  AliFMDBaseDigit - base class 
12 //  AliFMDDigit     - Normal (smeared) digit             
13 //  AliFMDSDigit    - Summable (non-smeared) digit             
14 //
15 #ifndef ROOT_TObject
16 # include <TObject.h>
17 #endif
18
19 //____________________________________________________________________
20 /** @class AliFMDBaseDigit AliFMDDigit.h <FMD/AliFMDDigit.h>
21     @brief base class for digits 
22     @ingroup FMD_base
23  */
24 class AliFMDBaseDigit : public TObject 
25 {
26 public: 
27   /** CTOR */
28   AliFMDBaseDigit();
29   /** Constrctor 
30       @param detector Detector 
31       @param ring     Ring
32       @param sector   Sector
33       @param strip    Strip */
34   AliFMDBaseDigit(UShort_t detector, 
35                   Char_t   ring='\0', 
36                   UShort_t sector=0, 
37                   UShort_t strip=0);
38   /** DTOR */
39   virtual ~AliFMDBaseDigit() {}
40   /** @return Detector # */
41   UShort_t     Detector()          const { return fDetector; }
42   /** @return Ring ID */
43   Char_t       Ring()              const { return fRing;     }
44   /** @return sector # */
45   UShort_t     Sector()            const { return fSector;   }
46   /** @return strip # */
47   UShort_t     Strip()             const { return fStrip;    }
48   /** Print information 
49       @param opt Not used */
50   virtual void Print(Option_t* opt="") const;
51   /** @return Name */
52   const char*  GetName() const;
53 protected:
54   UShort_t fDetector;  // (Sub) Detector # (1,2, or 3)
55   Char_t   fRing;      // Ring ID ('I' or 'O')
56   UShort_t fSector;    // Sector # (phi division)
57   UShort_t fStrip;     // Strip # (radial division)
58   ClassDef(AliFMDBaseDigit, 1) // Base class for FMD digits 
59 };
60
61 //____________________________________________________________________
62 /** @class AliFMDDigit AliFMDDigit.h <FMD/AliFMDDigit.h>
63     @brief class for digits 
64     @ingroup FMD_base
65  */
66 class AliFMDDigit : public AliFMDBaseDigit
67 {
68 public:
69   /** CTOR */
70   AliFMDDigit();
71   /** Constrctor 
72       @param detector Detector 
73       @param ring     Ring
74       @param sector   Sector
75       @param strip    Strip 
76       @param count    ADC (first sample)
77       @param count2   ADC (second sample, or -1 if not used)
78       @param count3   ADC (third sample, or -1 if not used) */
79   AliFMDDigit(UShort_t detector, 
80               Char_t   ring='\0', 
81               UShort_t sector=0, 
82               UShort_t strip=0, 
83               UShort_t count=0, 
84               Short_t  count2=-1, 
85               Short_t  count3=-1);
86   /** DTOR */
87   virtual ~AliFMDDigit() {}
88   /** @param i # of sample to get 
89       @return sample # @a i */
90   Int_t Count(size_t i=0) const;
91   /** @return ADC count (first sample) */
92   UShort_t Count1()                const { return fCount1;   }
93   /** @return ADC count (second sample, or -1 if not used) */
94   Short_t  Count2()                const { return fCount2;   }
95   /** @return ADC count (third sample, or -1 if not used) */
96   Short_t  Count3()                const { return fCount3;   }
97   /** @return Canonical ADC counts */
98   UShort_t Counts()                const;
99   /** Print info 
100       @param opt Not used */
101   void     Print(Option_t* opt="") const;
102   /** @return Title */
103   const char* GetTitle() const;
104 protected:
105   UShort_t fCount1;     // Digital signal 
106   Short_t  fCount2;     // Digital signal (-1 if not used)
107   Short_t  fCount3;     // Digital signal (-1 if not used)
108   ClassDef(AliFMDDigit,1)     // Normal FMD digit
109 };
110
111 inline UShort_t 
112 AliFMDDigit::Counts() const 
113 {
114   return fCount1 
115     + (fCount2 >= 0 ? fCount2 : 0)
116     + (fCount3 >= 0 ? fCount3 : 0);
117 }
118
119 inline Int_t
120 AliFMDDigit::Count(size_t i) const 
121 {
122   switch (i) {
123   case 0: return fCount1;
124   case 1: return fCount2;
125   case 2: return fCount3;
126   }
127   return -1;
128 }
129
130 //____________________________________________________________________
131 /** @class AliFMDSDigit AliFMDDigit.h <FMD/AliFMDDigit.h>
132     @brief class for summable digits 
133     @ingroup FMD_base
134  */
135 class AliFMDSDigit : public AliFMDBaseDigit
136 {
137 public:
138   /** CTOR */
139   AliFMDSDigit();
140   /** Constrctor 
141       @param detector Detector 
142       @param ring     Ring
143       @param sector   Sector
144       @param strip    Strip 
145       @param edep     Energy deposited 
146       @param count    ADC (first sample)
147       @param count2   ADC (second sample, or -1 if not used)
148       @param count3   ADC (third sample, or -1 if not used) */
149   AliFMDSDigit(UShort_t detector, 
150                Char_t   ring='\0', 
151                UShort_t sector=0, 
152                UShort_t strip=0, 
153                Float_t  edep=0,
154                UShort_t count=0, 
155                Short_t  count2=-1, 
156                Short_t  count3=-1);
157   /** DTOR */
158   virtual ~AliFMDSDigit() {}
159   /** @return ADC count (first sample) */
160   UShort_t Count1()                const { return fCount1;   }
161   /** @return ADC count (second sample, or -1 if not used) */
162   Short_t  Count2()                const { return fCount2;   }
163   /** @return ADC count (third sample, or -1 if not used) */
164   Short_t  Count3()                const { return fCount3;   }
165   /** @return Canonical ADC counts */
166   UShort_t Counts()                const;
167   /** @return Energy deposited */
168   Float_t  Edep()                  const { return fEdep;     }
169   /** Print info 
170       @param opt Not used */
171   void     Print(Option_t* opt="") const;
172 protected:
173   Float_t  fEdep;       // Energy deposited 
174   UShort_t fCount1;     // Digital signal 
175   Short_t  fCount2;     // Digital signal (-1 if not used)
176   Short_t  fCount3;     // Digital signal (-1 if not used)
177   ClassDef(AliFMDSDigit,1)     // Summable FMD digit
178 };
179   
180 inline UShort_t 
181 AliFMDSDigit::Counts() const 
182 {
183   return fCount1 
184     + (fCount2 >= 0 ? fCount2 : 0)
185     + (fCount3 >= 0 ? fCount3 : 0);
186 }
187
188
189 #endif
190 //____________________________________________________________________
191 //
192 // Local Variables:
193 //   mode: C++
194 // End:
195 //
196 //
197 // EOF
198 //