]>
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 | ||
18 | //_________________________________________________________________________ | |
19 | // TOF digit: member variables | |
20 | // fSector : TOF sector | |
21 | // fPlate : TOF plate | |
22 | // fStrip : strips number | |
23 | // fPadx : pad number along x | |
24 | // fPadz : pad number along z | |
25 | // fTdc : TDC | |
26 | // fAdc : ADC | |
27 | // | |
28 | // Getters, setters and member functions defined here | |
29 | // | |
30 | //*-- Authors: F. Pierella, A. Seganti, D. Vicinanza | |
31 | ||
32 | ||
f8014e68 | 33 | #include <Riostream.h> |
68861244 | 34 | |
88cb7938 | 35 | #include "AliRun.h" |
d3c7bfac | 36 | |
7e6dce66 | 37 | #include "AliTOFGeometry.h" |
d3c7bfac | 38 | #include "AliTOFGeometryV4.h" |
39 | #include "AliTOFGeometryV5.h" | |
68861244 | 40 | #include "AliTOFdigit.h" |
68861244 | 41 | |
42 | ClassImp(AliTOFdigit) | |
43 | ||
44 | //______________________________________________________________________________ | |
45 | AliTOFdigit::AliTOFdigit(Int_t *tracks, Int_t *vol,Float_t *digit) | |
46 | :AliDigit(tracks) | |
47 | { | |
48 | // | |
49 | // Constructor of digit object | |
50 | // | |
51 | fSector = vol[0]; | |
52 | fPlate = vol[1]; | |
53 | fStrip = vol[2]; | |
7e6dce66 | 54 | fPadx = vol[3]; |
55 | fPadz = vol[4]; | |
68861244 | 56 | fTdc = digit[0]; |
57 | fAdc = digit[1]; | |
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; | |
77 | fAdc = digit.fAdc; | |
78 | ||
79 | } | |
80 | ||
81 | //______________________________________________________________________________ | |
82 | AliTOFdigit::AliTOFdigit(Int_t sector, Int_t plate, Int_t strip, Int_t padx, | |
83 | Int_t padz, Float_t tdc, Float_t adc) | |
84 | { | |
85 | // | |
86 | // Constructor for sdigit | |
87 | // | |
88 | fSector = sector; | |
89 | fPlate = plate; | |
90 | fStrip = strip; | |
91 | fPadx = padx; | |
92 | fPadz = padz; | |
93 | fTdc = tdc; | |
94 | fAdc = adc; | |
95 | } | |
96 | ||
97 | //______________________________________________________________________________ | |
98 | void AliTOFdigit::GetLocation(Int_t *Loc) const | |
99 | { | |
100 | // | |
101 | // Get the cohordinates of the digit | |
102 | // in terms of Sector - Plate - Strip - Pad | |
103 | // | |
104 | ||
105 | Loc[0]=fSector; | |
106 | Loc[1]=fPlate; | |
107 | Loc[2]=fStrip; | |
108 | Loc[3]=fPadx; | |
109 | Loc[4]=fPadz; | |
110 | } | |
111 | ||
112 | //______________________________________________________________________________ | |
d3c7bfac | 113 | Int_t AliTOFdigit::GetTotPad(AliTOFGeometry *tofGeom) const |
68861244 | 114 | { |
115 | // | |
116 | // Get the "total" index of the pad inside a Sector | |
117 | // starting from the digits data. | |
118 | // | |
119 | ||
68861244 | 120 | Int_t before=0; |
121 | ||
122 | switch(fPlate){ | |
7e6dce66 | 123 | case 0: |
124 | //before = 0; | |
125 | break; | |
126 | case 1: | |
d3c7bfac | 127 | before = tofGeom->NStripC(); |
7e6dce66 | 128 | break; |
129 | case 2: | |
d3c7bfac | 130 | before = tofGeom->NStripC() + AliTOFGeometry::NStripB(); |
7e6dce66 | 131 | break; |
132 | case 3: | |
d3c7bfac | 133 | before = tofGeom->NStripC() + AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA(); |
7e6dce66 | 134 | break; |
135 | case 4: | |
d3c7bfac | 136 | before = tofGeom->NStripC() + 2*AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA(); |
7e6dce66 | 137 | break; |
68861244 | 138 | } |
139 | ||
7e6dce66 | 140 | Int_t pad = 2*fPadx + fPadz; |
141 | //Int_t pad = fPadx+AliTOFGeometry::NpadX()*fPadz; | |
142 | Int_t strip = fStrip + before; | |
143 | Int_t padTot = AliTOFGeometry::NpadXStrip()*strip + pad; | |
144 | ||
68861244 | 145 | return padTot; |
146 | } | |
147 | ||
148 | //______________________________________________________________________________ | |
149 | void AliTOFdigit::AddTrack(Int_t track) | |
150 | { | |
151 | // | |
517b7f8f | 152 | // Add a new and different track to the digit |
68861244 | 153 | // |
517b7f8f | 154 | if (track==fTracks[0] || track==fTracks[1] || track==fTracks[2]) return; |
155 | if (fTracks[1]==0){ | |
156 | fTracks[1] = track; | |
157 | }else if (fTracks[2]==0){ | |
158 | fTracks[2] = track; | |
159 | }else{ | |
160 | // printf("AliTOFdigit::AddTrack ERROR: Too many Tracks (>3) \n"); | |
161 | } | |
68861244 | 162 | } |
163 | ||
164 | // Overloading of Streaming, Sum and Comparison operators | |
165 | ||
166 | //______________________________________________________________________________ | |
167 | Bool_t AliTOFdigit::operator==(AliTOFdigit const &digit) const | |
168 | { | |
169 | // | |
170 | // Overloading of Comparison operator | |
171 | // | |
172 | if (fSector==digit.fSector && | |
173 | fPlate==digit.fPlate && | |
174 | fStrip==digit.fStrip && | |
175 | fPadx==digit.fPadx && | |
176 | fPadz==digit.fPadz && | |
177 | fTdc==digit.fTdc && | |
178 | fAdc==digit.fAdc) return kTRUE; | |
179 | else return kFALSE; | |
180 | } | |
181 | ||
182 | //______________________________________________________________________________ | |
183 | AliTOFdigit& AliTOFdigit::operator+(AliTOFdigit const &digit) | |
184 | { | |
185 | // | |
186 | // Overloading of Sum operator | |
187 | // Note: Some convolution | |
188 | // between the two digit variables has to be inserted | |
189 | // | |
190 | if (fSector==digit.fSector && | |
191 | fPlate==digit.fPlate && | |
192 | fStrip==digit.fStrip && | |
193 | fPadx==digit.fPadx && | |
194 | fPadz==digit.fPadz) { | |
195 | // convolution to be inserted here | |
196 | fTdc+=digit.fTdc; | |
197 | fAdc+=digit.fAdc; | |
198 | } else | |
199 | AliTOFdigit(fSector,fPlate,fStrip,fPadx,fPadz,fTdc,fAdc); | |
200 | return *this; | |
201 | } | |
202 | ||
203 | //______________________________________________________________________________ | |
204 | ostream& operator << (ostream& out, const AliTOFdigit &digit) | |
205 | { | |
206 | // | |
207 | // Output streamer: output of the digit data | |
208 | // | |
209 | out << "Sector " << digit.fSector << ", Plate " << digit.fPlate << ", Strip " << digit.fStrip << endl; | |
210 | out << "Padx" << digit.fPadx << ", Padz " << digit.fPadz << endl; | |
211 | out << "TDC " << digit.fTdc << ", ADC "<< digit.fAdc << endl; | |
212 | return out; | |
213 | } |