]>
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 | |
40 | ClassImp(AliTOFdigit) | |
41 | ||
42 | //______________________________________________________________________________ | |
43 | AliTOFdigit::AliTOFdigit(Int_t *tracks, Int_t *vol,Float_t *digit) | |
44 | :AliDigit(tracks) | |
45 | { | |
46 | // | |
47 | // Constructor of digit object | |
48 | // | |
d0eb8f39 | 49 | |
68861244 | 50 | fSector = vol[0]; |
51 | fPlate = vol[1]; | |
52 | fStrip = vol[2]; | |
7e6dce66 | 53 | fPadx = vol[3]; |
54 | fPadz = vol[4]; | |
68861244 | 55 | fTdc = digit[0]; |
d0eb8f39 | 56 | fTdcND = digit[3]; |
68861244 | 57 | fAdc = digit[1]; |
d0eb8f39 | 58 | fToT = digit[2]; |
59 | ||
68861244 | 60 | } |
61 | ||
62 | //____________________________________________________________________________ | |
63 | AliTOFdigit::AliTOFdigit(const AliTOFdigit & digit) | |
5c016a7b | 64 | :AliDigit(digit) |
68861244 | 65 | { |
66 | // | |
67 | // copy ctor for AliTOFdigit object | |
68 | // | |
69 | ||
70 | Int_t i ; | |
71 | for ( i = 0; i < 3 ; i++) | |
72 | fTracks[i] = digit.fTracks[i] ; | |
73 | fSector = digit.fSector; | |
74 | fPlate = digit.fPlate; | |
75 | fStrip = digit.fStrip; | |
76 | fPadx = digit.fPadx; | |
77 | fPadz = digit.fPadz; | |
78 | fTdc = digit.fTdc; | |
6dc9348d | 79 | fTdcND = digit.fTdcND; |
68861244 | 80 | fAdc = digit.fAdc; |
6dc9348d | 81 | fToT = digit.fToT; |
68861244 | 82 | |
83 | } | |
84 | ||
85 | //______________________________________________________________________________ | |
86 | AliTOFdigit::AliTOFdigit(Int_t sector, Int_t plate, Int_t strip, Int_t padx, | |
87 | Int_t padz, Float_t tdc, Float_t adc) | |
88 | { | |
89 | // | |
90 | // Constructor for sdigit | |
91 | // | |
92 | fSector = sector; | |
93 | fPlate = plate; | |
94 | fStrip = strip; | |
95 | fPadx = padx; | |
96 | fPadz = padz; | |
97 | fTdc = tdc; | |
6dc9348d | 98 | fTdcND = 0; |
68861244 | 99 | fAdc = adc; |
6dc9348d | 100 | fToT = 0; |
68861244 | 101 | } |
102 | ||
103 | //______________________________________________________________________________ | |
104 | void AliTOFdigit::GetLocation(Int_t *Loc) const | |
105 | { | |
106 | // | |
107 | // Get the cohordinates of the digit | |
108 | // in terms of Sector - Plate - Strip - Pad | |
109 | // | |
110 | ||
111 | Loc[0]=fSector; | |
112 | Loc[1]=fPlate; | |
113 | Loc[2]=fStrip; | |
114 | Loc[3]=fPadx; | |
115 | Loc[4]=fPadz; | |
116 | } | |
117 | ||
118 | //______________________________________________________________________________ | |
d3c7bfac | 119 | Int_t AliTOFdigit::GetTotPad(AliTOFGeometry *tofGeom) const |
68861244 | 120 | { |
121 | // | |
122 | // Get the "total" index of the pad inside a Sector | |
123 | // starting from the digits data. | |
124 | // | |
125 | ||
68861244 | 126 | Int_t before=0; |
127 | ||
128 | switch(fPlate){ | |
7e6dce66 | 129 | case 0: |
130 | //before = 0; | |
131 | break; | |
132 | case 1: | |
d3c7bfac | 133 | before = tofGeom->NStripC(); |
7e6dce66 | 134 | break; |
135 | case 2: | |
d3c7bfac | 136 | before = tofGeom->NStripC() + AliTOFGeometry::NStripB(); |
7e6dce66 | 137 | break; |
138 | case 3: | |
d3c7bfac | 139 | before = tofGeom->NStripC() + AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA(); |
7e6dce66 | 140 | break; |
141 | case 4: | |
d3c7bfac | 142 | before = tofGeom->NStripC() + 2*AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA(); |
7e6dce66 | 143 | break; |
68861244 | 144 | } |
145 | ||
7e6dce66 | 146 | Int_t pad = 2*fPadx + fPadz; |
147 | //Int_t pad = fPadx+AliTOFGeometry::NpadX()*fPadz; | |
148 | Int_t strip = fStrip + before; | |
149 | Int_t padTot = AliTOFGeometry::NpadXStrip()*strip + pad; | |
150 | ||
68861244 | 151 | return padTot; |
152 | } | |
153 | ||
154 | //______________________________________________________________________________ | |
155 | void AliTOFdigit::AddTrack(Int_t track) | |
156 | { | |
157 | // | |
517b7f8f | 158 | // Add a new and different track to the digit |
68861244 | 159 | // |
517b7f8f | 160 | if (track==fTracks[0] || track==fTracks[1] || track==fTracks[2]) return; |
161 | if (fTracks[1]==0){ | |
162 | fTracks[1] = track; | |
163 | }else if (fTracks[2]==0){ | |
164 | fTracks[2] = track; | |
165 | }else{ | |
166 | // printf("AliTOFdigit::AddTrack ERROR: Too many Tracks (>3) \n"); | |
167 | } | |
68861244 | 168 | } |
169 | ||
170 | // Overloading of Streaming, Sum and Comparison operators | |
171 | ||
172 | //______________________________________________________________________________ | |
173 | Bool_t AliTOFdigit::operator==(AliTOFdigit const &digit) const | |
174 | { | |
175 | // | |
176 | // Overloading of Comparison operator | |
177 | // | |
178 | if (fSector==digit.fSector && | |
179 | fPlate==digit.fPlate && | |
180 | fStrip==digit.fStrip && | |
181 | fPadx==digit.fPadx && | |
182 | fPadz==digit.fPadz && | |
183 | fTdc==digit.fTdc && | |
6dc9348d | 184 | fTdcND==digit.fTdcND && |
185 | fAdc==digit.fAdc && | |
186 | fToT==digit.fToT ) return kTRUE; | |
68861244 | 187 | else return kFALSE; |
188 | } | |
189 | ||
190 | //______________________________________________________________________________ | |
191 | AliTOFdigit& AliTOFdigit::operator+(AliTOFdigit const &digit) | |
192 | { | |
193 | // | |
194 | // Overloading of Sum operator | |
195 | // Note: Some convolution | |
196 | // between the two digit variables has to be inserted | |
197 | // | |
198 | if (fSector==digit.fSector && | |
199 | fPlate==digit.fPlate && | |
200 | fStrip==digit.fStrip && | |
201 | fPadx==digit.fPadx && | |
202 | fPadz==digit.fPadz) { | |
203 | // convolution to be inserted here | |
204 | fTdc+=digit.fTdc; | |
205 | fAdc+=digit.fAdc; | |
206 | } else | |
207 | AliTOFdigit(fSector,fPlate,fStrip,fPadx,fPadz,fTdc,fAdc); | |
208 | return *this; | |
209 | } | |
210 | ||
211 | //______________________________________________________________________________ | |
212 | ostream& operator << (ostream& out, const AliTOFdigit &digit) | |
213 | { | |
d0eb8f39 | 214 | // |
215 | // Output streamer: output of the digit data | |
216 | // | |
217 | ||
218 | out << "Sector " << digit.fSector << ", Plate " << digit.fPlate << ", Strip " << digit.fStrip << endl; | |
219 | out << "Padx" << digit.fPadx << ", Padz " << digit.fPadz << endl; | |
220 | out << "TDC " << digit.fTdc << ", ADC "<< digit.fAdc << endl; | |
221 | ||
222 | return out; | |
68861244 | 223 | } |