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