]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDDigit.cxx
0. General code clean-up, including messages, and the like.
[u/mrichter/AliRoot.git] / FMD / AliFMDDigit.cxx
1 /**************************************************************************
2  * Copyright(c) 2004, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id$ */
17
18 //////////////////////////////////////////////////////////////////////
19 //
20 //  Digits classes for the FMD                
21 //
22 //  Digits consists of
23 //   - Detector #
24 //   - Ring ID                                             
25 //   - Sector #     
26 //   - Strip #
27 //   - ADC count in this channel                                  
28 //
29 //  Digits consists of
30 //   - Detector #
31 //   - Ring ID                                             
32 //   - Sector #     
33 //   - Strip #
34 //   - Total energy deposited in the strip
35 //   - ADC count in this channel                                  
36 //
37 // As the Digits and SDigits have so much in common, the classes
38 // AliFMDDigit and AliFMDSDigit are implemented via a base
39 // class AliFMDBaseDigit.
40 ///
41 //              +-----------------+
42 //              | AliFMDBaseDigit |
43 //              +-----------------+
44 //                      ^
45 //                      |
46 //                +------------+
47 //                |            |
48 //      +-------------+ +--------------+
49 //      | AliFMDDigit | | AliFMDSDigit |
50 //      +-------------+ +--------------+
51 //
52 // (Note, that I'd really would have liked to implement AliFMDHit as a
53 // derived class from some base class - say AliFMDStrip, and the Digit
54 // classes would (eventually) have derived from that as well.
55 // However, ROOT doesn't do well with multiple inheritance, so I chose
56 // not to anyway).
57 //
58 // Latest changes by Christian Holm Christensen
59 //
60 //////////////////////////////////////////////////////////////////////
61
62 #include "AliFMDDigit.h"        // ALIFMDDIGIT_H
63 #include "Riostream.h"          // ROOT_Riostream
64 #include <TString.h>
65
66 //====================================================================
67 ClassImp(AliFMDBaseDigit)
68 #if 0
69   ; // This is here to keep Emacs from indenting the next line
70 #endif
71
72 //____________________________________________________________________
73 AliFMDBaseDigit::AliFMDBaseDigit()
74   : fDetector(0), 
75     fRing('\0'), 
76     fSector(0), 
77     fStrip(0)
78 {}
79
80 //____________________________________________________________________
81 AliFMDBaseDigit::AliFMDBaseDigit(UShort_t detector, 
82                          Char_t   ring, 
83                          UShort_t sector, 
84                          UShort_t strip)
85   : fDetector(detector), 
86     fRing(ring), 
87     fSector(sector), 
88     fStrip(strip)
89 {
90   //
91   // Creates a base data digit object
92   //
93   // Parameters 
94   //
95   //    detector  Detector # (1, 2, or 3)                      
96   //    ring      Ring ID ('I' or 'O')
97   //    sector    Sector # (For inner/outer rings: 0-19/0-39)
98   //    strip     Strip # (For inner/outer rings: 0-511/0-255)
99 }
100
101 //____________________________________________________________________
102 void
103 AliFMDBaseDigit::Print(Option_t* /* option*/) const 
104 {
105   // Print digit to standard out 
106   cout << ClassName() << ": FMD" << fDetector << fRing << "[" 
107        << setw(3) << fSector << ","
108        << setw(3) << fStrip << "]" 
109        << flush;
110 }
111
112 //____________________________________________________________________
113 const char*
114 AliFMDBaseDigit::GetName() const 
115
116   static TString n;
117   n = Form("FMD%d%c[%2d,%3d]", fDetector, fRing, fSector, fStrip);
118   return n.Data();
119 }
120
121 //====================================================================
122 ClassImp(AliFMDDigit)
123
124 //____________________________________________________________________
125 AliFMDDigit::AliFMDDigit()
126   : fCount1(0),
127     fCount2(-1),
128     fCount3(-1)
129 {}
130
131 //____________________________________________________________________
132 AliFMDDigit::AliFMDDigit(UShort_t detector, 
133                          Char_t   ring, 
134                          UShort_t sector, 
135                          UShort_t strip, 
136                          UShort_t count1,
137                          Short_t  count2, 
138                          Short_t  count3)
139   : AliFMDBaseDigit(detector, ring, sector, strip), 
140     fCount1(count1),
141     fCount2(count2),
142     fCount3(count3)
143 {
144   //
145   // Creates a real data digit object
146   //
147   // Parameters 
148   //
149   //    detector  Detector # (1, 2, or 3)                      
150   //    ring      Ring ID ('I' or 'O')
151   //    sector    Sector # (For inner/outer rings: 0-19/0-39)
152   //    strip     Strip # (For inner/outer rings: 0-511/0-255)
153   //    count1    ADC count (a 10-bit word)
154   //    count2    ADC count (a 10-bit word) -1 if not used
155   //    count3    ADC count (a 10-bit word) -1 if not used
156 }
157
158 //____________________________________________________________________
159 const char*
160 AliFMDDigit::GetTitle() const 
161
162   static TString t;
163   t = Form("ADC: %d", Counts());
164   return t.Data();
165 }
166
167 //____________________________________________________________________
168 void
169 AliFMDDigit::Print(Option_t* /* option*/) const 
170 {
171   // Print digit to standard out 
172   AliFMDBaseDigit::Print();
173   cout << "\t" 
174        << fCount1 << " (+ " << fCount2 << " + " << fCount2 << ") = " 
175        << Counts() << endl;
176 }
177
178 //====================================================================
179 ClassImp(AliFMDSDigit)
180
181 //____________________________________________________________________
182 AliFMDSDigit::AliFMDSDigit()
183   : fEdep(0), 
184     fCount1(0),
185     fCount2(-1),
186     fCount3(-1)
187 {}
188
189 //____________________________________________________________________
190 AliFMDSDigit::AliFMDSDigit(UShort_t detector, 
191                            Char_t   ring, 
192                            UShort_t sector, 
193                            UShort_t strip, 
194                            Float_t  edep,
195                            UShort_t count1,
196                            Short_t  count2, 
197                            Short_t  count3)
198   : AliFMDBaseDigit(detector, ring, sector, strip), 
199     fEdep(edep),
200     fCount1(count1),
201     fCount2(count2),
202     fCount3(count3)
203 {
204   //
205   // Creates a real data digit object
206   //
207   // Parameters 
208   //
209   //    detector  Detector # (1, 2, or 3)                      
210   //    ring      Ring ID ('I' or 'O')
211   //    sector    Sector # (For inner/outer rings: 0-19/0-39)
212   //    strip     Strip # (For inner/outer rings: 0-511/0-255)
213   //    edep      Total energy deposited 
214   //    count1    ADC count (a 10-bit word)
215   //    count2    ADC count (a 10-bit word) -1 if not used
216   //    count3    ADC count (a 10-bit word) -1 if not used
217 }
218
219 //____________________________________________________________________
220 void
221 AliFMDSDigit::Print(Option_t* /* option*/) const 
222 {
223   // Print digit to standard out 
224   AliFMDBaseDigit::Print();
225   cout << "\t" << fEdep << " -> "
226        << fCount1 << " (+ " << fCount2 << " + " << fCount2 << ") = " 
227        << Counts() << endl;
228 }
229
230 //____________________________________________________________________
231 //
232 // EOF
233 //