]>
Commit | Line | Data |
---|---|---|
68861244 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, 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 | ||
88cb7938 | 16 | /* $Id$ */ |
17 | ||
0e46b9ae | 18 | //_________________________________________________________________________// |
19 | // // | |
20 | // TOF digit: member variables // | |
21 | // fSector : TOF sector // | |
22 | // fPlate : TOF plate // | |
23 | // fStrip : strips number // | |
24 | // fPadx : pad number along x // | |
25 | // fPadz : pad number along z // | |
26 | // fTdc : TDC // | |
27 | // fAdc : ADC // | |
28 | // // | |
29 | // Getters, setters and member functions defined here // | |
30 | // // | |
31 | // -- Authors: F. Pierella, A. Seganti, D. Vicinanza // | |
32 | //_________________________________________________________________________// | |
88cb7938 | 33 | |
34 | ||
0e46b9ae | 35 | #include "Riostream.h" |
d3c7bfac | 36 | |
68861244 | 37 | #include "AliTOFdigit.h" |
0e46b9ae | 38 | #include "AliTOFGeometry.h" |
68861244 | 39 | |
fe7d86eb | 40 | using std::endl; |
41 | using std::cout; | |
68861244 | 42 | ClassImp(AliTOFdigit) |
43 | ||
655e379f | 44 | //______________________________________________________________________________ |
45 | AliTOFdigit::AliTOFdigit() | |
46 | :AliDigit(), | |
47 | fSector(-1), | |
48 | fPlate(-1), | |
49 | fStrip(-1), | |
50 | fPadx(-1), | |
51 | fPadz(-1), | |
52 | fTdc(0), | |
53 | fTdcND(0), | |
54 | fAdc(0), | |
55 | fToT(0) | |
56 | { | |
57 | } | |
68861244 | 58 | //______________________________________________________________________________ |
3e2f0097 | 59 | AliTOFdigit::AliTOFdigit(Int_t *tracks, Int_t *vol, Int_t *digit) |
655e379f | 60 | :AliDigit(tracks), |
8a190ba2 | 61 | fSector(vol[0]), |
62 | fPlate(vol[1]), | |
63 | fStrip(vol[2]), | |
64 | fPadx(vol[3]), | |
65 | fPadz(vol[4]), | |
66 | fTdc(digit[0]), | |
67 | fTdcND(digit[3]), | |
68 | fAdc(digit[1]), | |
69 | fToT(digit[2]) | |
68861244 | 70 | { |
71 | // | |
72 | // Constructor of digit object | |
73 | // | |
68861244 | 74 | } |
75 | ||
76 | //____________________________________________________________________________ | |
77 | AliTOFdigit::AliTOFdigit(const AliTOFdigit & digit) | |
655e379f | 78 | :AliDigit(digit), |
8a190ba2 | 79 | fSector(digit.fSector), |
80 | fPlate(digit.fPlate), | |
81 | fStrip(digit.fStrip), | |
82 | fPadx(digit.fPadx), | |
83 | fPadz(digit.fPadz), | |
84 | fTdc(digit.fTdc), | |
85 | fTdcND(digit.fTdcND), | |
86 | fAdc(digit.fAdc), | |
87 | fToT(digit.fToT) | |
68861244 | 88 | { |
89 | // | |
90 | // copy ctor for AliTOFdigit object | |
91 | // | |
92 | ||
93 | Int_t i ; | |
94 | for ( i = 0; i < 3 ; i++) | |
95 | fTracks[i] = digit.fTracks[i] ; | |
68861244 | 96 | |
97 | } | |
98 | ||
99 | //______________________________________________________________________________ | |
100 | AliTOFdigit::AliTOFdigit(Int_t sector, Int_t plate, Int_t strip, Int_t padx, | |
bf33f8f0 | 101 | Int_t padz, Int_t tdc, Int_t adc): |
8a190ba2 | 102 | fSector(sector), |
103 | fPlate(plate), | |
104 | fStrip(strip), | |
105 | fPadx(padx), | |
106 | fPadz(padz), | |
107 | fTdc(tdc), | |
655e379f | 108 | fTdcND(0), |
8a190ba2 | 109 | fAdc(adc), |
655e379f | 110 | fToT(0) |
68861244 | 111 | { |
112 | // | |
113 | // Constructor for sdigit | |
114 | // | |
68861244 | 115 | } |
116 | ||
117 | //______________________________________________________________________________ | |
3e2f0097 | 118 | void AliTOFdigit::GetLocation(Int_t *loc) const |
68861244 | 119 | { |
120 | // | |
121 | // Get the cohordinates of the digit | |
122 | // in terms of Sector - Plate - Strip - Pad | |
123 | // | |
124 | ||
3e2f0097 | 125 | loc[0] = fSector; |
126 | loc[1] = fPlate; | |
127 | loc[2] = fStrip; | |
128 | loc[3] = fPadx; | |
129 | loc[4] = fPadz; | |
68861244 | 130 | } |
131 | ||
132 | //______________________________________________________________________________ | |
96f01799 | 133 | Int_t AliTOFdigit::GetTotPad() const |
68861244 | 134 | { |
135 | // | |
136 | // Get the "total" index of the pad inside a Sector | |
137 | // starting from the digits data. | |
138 | // | |
139 | ||
68861244 | 140 | Int_t before=0; |
141 | ||
142 | switch(fPlate){ | |
7e6dce66 | 143 | case 0: |
144 | //before = 0; | |
145 | break; | |
146 | case 1: | |
96f01799 | 147 | before = AliTOFGeometry::NStripC(); |
7e6dce66 | 148 | break; |
149 | case 2: | |
96f01799 | 150 | before = AliTOFGeometry::NStripC() + AliTOFGeometry::NStripB(); |
7e6dce66 | 151 | break; |
152 | case 3: | |
96f01799 | 153 | before = AliTOFGeometry::NStripC() + AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA(); |
7e6dce66 | 154 | break; |
155 | case 4: | |
96f01799 | 156 | before = AliTOFGeometry::NStripC() + 2*AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA(); |
7e6dce66 | 157 | break; |
68861244 | 158 | } |
159 | ||
c630773f | 160 | Int_t pad = AliTOFGeometry::NpadZ()*fPadx + fPadz; |
7e6dce66 | 161 | Int_t strip = fStrip + before; |
162 | Int_t padTot = AliTOFGeometry::NpadXStrip()*strip + pad; | |
163 | ||
68861244 | 164 | return padTot; |
165 | } | |
166 | ||
167 | //______________________________________________________________________________ | |
168 | void AliTOFdigit::AddTrack(Int_t track) | |
169 | { | |
170 | // | |
517b7f8f | 171 | // Add a new and different track to the digit |
68861244 | 172 | // |
517b7f8f | 173 | if (track==fTracks[0] || track==fTracks[1] || track==fTracks[2]) return; |
c630773f | 174 | if (fTracks[1]==-1) |
517b7f8f | 175 | fTracks[1] = track; |
c630773f | 176 | else if (fTracks[2]==-1) |
517b7f8f | 177 | fTracks[2] = track; |
c630773f | 178 | else |
179 | printf("W-AliTOFdigit::AddTrack: Too many tracks (>3) that contribute to the same TOF digit\n"); | |
180 | ||
68861244 | 181 | } |
182 | ||
183 | // Overloading of Streaming, Sum and Comparison operators | |
184 | ||
185 | //______________________________________________________________________________ | |
186 | Bool_t AliTOFdigit::operator==(AliTOFdigit const &digit) const | |
187 | { | |
188 | // | |
189 | // Overloading of Comparison operator | |
190 | // | |
191 | if (fSector==digit.fSector && | |
192 | fPlate==digit.fPlate && | |
193 | fStrip==digit.fStrip && | |
194 | fPadx==digit.fPadx && | |
195 | fPadz==digit.fPadz && | |
196 | fTdc==digit.fTdc && | |
6dc9348d | 197 | fTdcND==digit.fTdcND && |
198 | fAdc==digit.fAdc && | |
199 | fToT==digit.fToT ) return kTRUE; | |
68861244 | 200 | else return kFALSE; |
201 | } | |
202 | ||
203 | //______________________________________________________________________________ | |
655e379f | 204 | AliTOFdigit AliTOFdigit::operator+(const AliTOFdigit &digit) |
68861244 | 205 | { |
206 | // | |
207 | // Overloading of Sum operator | |
208 | // Note: Some convolution | |
209 | // between the two digit variables has to be inserted | |
210 | // | |
211 | if (fSector==digit.fSector && | |
212 | fPlate==digit.fPlate && | |
213 | fStrip==digit.fStrip && | |
214 | fPadx==digit.fPadx && | |
215 | fPadz==digit.fPadz) { | |
216 | // convolution to be inserted here | |
217 | fTdc+=digit.fTdc; | |
218 | fAdc+=digit.fAdc; | |
219 | } else | |
220 | AliTOFdigit(fSector,fPlate,fStrip,fPadx,fPadz,fTdc,fAdc); | |
221 | return *this; | |
222 | } | |
223 | ||
224 | //______________________________________________________________________________ | |
0e74c396 | 225 | ostream& operator << (ostream & out, const AliTOFdigit &digit) |
68861244 | 226 | { |
d0eb8f39 | 227 | // |
228 | // Output streamer: output of the digit data | |
229 | // | |
230 | ||
231 | out << "Sector " << digit.fSector << ", Plate " << digit.fPlate << ", Strip " << digit.fStrip << endl; | |
232 | out << "Padx" << digit.fPadx << ", Padz " << digit.fPadz << endl; | |
233 | out << "TDC " << digit.fTdc << ", ADC "<< digit.fAdc << endl; | |
234 | ||
235 | return out; | |
68861244 | 236 | } |