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