]>
Commit | Line | Data |
---|---|---|
68861244 | 1 | //_________________________________________________________________________ |
2 | // TOF digit: member variables | |
3 | // fSector : TOF sector | |
4 | // fPlate : TOF plate | |
5 | // fStrip : strips number | |
6 | // fPadx : pad number along x | |
7 | // fPadz : pad number along z | |
8 | // fTdc : TDC | |
9 | // fAdc : ADC | |
10 | // | |
11 | // Getters, setters and member functions defined here | |
12 | // | |
13 | //*-- Authors: F. Pierella, A. Seganti, D. Vicinanza | |
14 | ||
15 | ||
16 | /************************************************************************** | |
17 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
18 | * * | |
19 | * Author: The ALICE Off-line Project. * | |
20 | * Contributors are mentioned in the code where appropriate. * | |
21 | * * | |
22 | * Permission to use, copy, modify and distribute this software and its * | |
23 | * documentation strictly for non-commercial purposes is hereby granted * | |
24 | * without fee, provided that the above copyright notice appears in all * | |
25 | * copies and that both the copyright notice and this permission notice * | |
26 | * appear in the supporting documentation. The authors make no claims * | |
27 | * about the suitability of this software for any purpose. It is * | |
28 | * provided "as is" without express or implied warranty. * | |
29 | **************************************************************************/ | |
30 | ||
f8014e68 | 31 | #include <Riostream.h> |
68861244 | 32 | |
33 | #include "AliTOF.h" | |
34 | #include "AliTOFdigit.h" | |
35 | #include "AliRun.h" | |
68861244 | 36 | |
37 | ClassImp(AliTOFdigit) | |
38 | ||
39 | //______________________________________________________________________________ | |
40 | AliTOFdigit::AliTOFdigit(Int_t *tracks, Int_t *vol,Float_t *digit) | |
41 | :AliDigit(tracks) | |
42 | { | |
43 | // | |
44 | // Constructor of digit object | |
45 | // | |
46 | fSector = vol[0]; | |
47 | fPlate = vol[1]; | |
48 | fStrip = vol[2]; | |
49 | fPadx = vol[3]; | |
50 | fPadz = vol[4]; | |
51 | fTdc = digit[0]; | |
52 | fAdc = digit[1]; | |
53 | } | |
54 | ||
55 | //____________________________________________________________________________ | |
56 | AliTOFdigit::AliTOFdigit(const AliTOFdigit & digit) | |
57 | { | |
58 | // | |
59 | // copy ctor for AliTOFdigit object | |
60 | // | |
61 | ||
62 | Int_t i ; | |
63 | for ( i = 0; i < 3 ; i++) | |
64 | fTracks[i] = digit.fTracks[i] ; | |
65 | fSector = digit.fSector; | |
66 | fPlate = digit.fPlate; | |
67 | fStrip = digit.fStrip; | |
68 | fPadx = digit.fPadx; | |
69 | fPadz = digit.fPadz; | |
70 | fTdc = digit.fTdc; | |
71 | fAdc = digit.fAdc; | |
72 | ||
73 | } | |
74 | ||
75 | //______________________________________________________________________________ | |
76 | AliTOFdigit::AliTOFdigit(Int_t sector, Int_t plate, Int_t strip, Int_t padx, | |
77 | Int_t padz, Float_t tdc, Float_t adc) | |
78 | { | |
79 | // | |
80 | // Constructor for sdigit | |
81 | // | |
82 | fSector = sector; | |
83 | fPlate = plate; | |
84 | fStrip = strip; | |
85 | fPadx = padx; | |
86 | fPadz = padz; | |
87 | fTdc = tdc; | |
88 | fAdc = adc; | |
89 | } | |
90 | ||
91 | //______________________________________________________________________________ | |
92 | void AliTOFdigit::GetLocation(Int_t *Loc) const | |
93 | { | |
94 | // | |
95 | // Get the cohordinates of the digit | |
96 | // in terms of Sector - Plate - Strip - Pad | |
97 | // | |
98 | ||
99 | Loc[0]=fSector; | |
100 | Loc[1]=fPlate; | |
101 | Loc[2]=fStrip; | |
102 | Loc[3]=fPadx; | |
103 | Loc[4]=fPadz; | |
104 | } | |
105 | ||
106 | //______________________________________________________________________________ | |
107 | Int_t AliTOFdigit::GetTotPad() const | |
108 | { | |
109 | // | |
110 | // Get the "total" index of the pad inside a Sector | |
111 | // starting from the digits data. | |
112 | // | |
113 | ||
114 | AliTOF* tof; | |
115 | ||
116 | if(gAlice){ | |
117 | tof =(AliTOF*) gAlice->GetDetector("TOF"); | |
118 | }else{ | |
119 | printf("AliTOFdigit::GetTotPad - No AliRun object present, exiting"); | |
120 | return 0; | |
121 | } | |
122 | ||
123 | Int_t pad = fPadx+tof->GetNpadX()*(fPadz-1); | |
124 | Int_t before=0; | |
125 | ||
126 | switch(fPlate){ | |
127 | case 1: before = 0; | |
128 | break; | |
129 | case 2: before = tof->GetNStripC(); | |
130 | break; | |
131 | case 3: before = tof->GetNStripB() + tof->GetNStripC(); | |
132 | break; | |
133 | case 4: before = tof->GetNStripA() + tof->GetNStripB() + tof->GetNStripC(); | |
134 | break; | |
135 | case 5: before = tof->GetNStripA() + 2*tof->GetNStripB() + tof->GetNStripC(); | |
136 | break; | |
137 | } | |
138 | ||
139 | Int_t strip = fStrip+before; | |
140 | Int_t padTot = tof->GetPadXStr()*(strip-1)+pad; | |
141 | return padTot; | |
142 | } | |
143 | ||
144 | //______________________________________________________________________________ | |
145 | void AliTOFdigit::AddTrack(Int_t track) | |
146 | { | |
147 | // | |
517b7f8f | 148 | // Add a new and different track to the digit |
68861244 | 149 | // |
517b7f8f | 150 | if (track==fTracks[0] || track==fTracks[1] || track==fTracks[2]) return; |
151 | if (fTracks[1]==0){ | |
152 | fTracks[1] = track; | |
153 | }else if (fTracks[2]==0){ | |
154 | fTracks[2] = track; | |
155 | }else{ | |
156 | // printf("AliTOFdigit::AddTrack ERROR: Too many Tracks (>3) \n"); | |
157 | } | |
68861244 | 158 | } |
159 | ||
160 | // Overloading of Streaming, Sum and Comparison operators | |
161 | ||
162 | //______________________________________________________________________________ | |
163 | Bool_t AliTOFdigit::operator==(AliTOFdigit const &digit) const | |
164 | { | |
165 | // | |
166 | // Overloading of Comparison operator | |
167 | // | |
168 | if (fSector==digit.fSector && | |
169 | fPlate==digit.fPlate && | |
170 | fStrip==digit.fStrip && | |
171 | fPadx==digit.fPadx && | |
172 | fPadz==digit.fPadz && | |
173 | fTdc==digit.fTdc && | |
174 | fAdc==digit.fAdc) return kTRUE; | |
175 | else return kFALSE; | |
176 | } | |
177 | ||
178 | //______________________________________________________________________________ | |
179 | AliTOFdigit& AliTOFdigit::operator+(AliTOFdigit const &digit) | |
180 | { | |
181 | // | |
182 | // Overloading of Sum operator | |
183 | // Note: Some convolution | |
184 | // between the two digit variables has to be inserted | |
185 | // | |
186 | if (fSector==digit.fSector && | |
187 | fPlate==digit.fPlate && | |
188 | fStrip==digit.fStrip && | |
189 | fPadx==digit.fPadx && | |
190 | fPadz==digit.fPadz) { | |
191 | // convolution to be inserted here | |
192 | fTdc+=digit.fTdc; | |
193 | fAdc+=digit.fAdc; | |
194 | } else | |
195 | AliTOFdigit(fSector,fPlate,fStrip,fPadx,fPadz,fTdc,fAdc); | |
196 | return *this; | |
197 | } | |
198 | ||
199 | //______________________________________________________________________________ | |
200 | ostream& operator << (ostream& out, const AliTOFdigit &digit) | |
201 | { | |
202 | // | |
203 | // Output streamer: output of the digit data | |
204 | // | |
205 | out << "Sector " << digit.fSector << ", Plate " << digit.fPlate << ", Strip " << digit.fStrip << endl; | |
206 | out << "Padx" << digit.fPadx << ", Padz " << digit.fPadz << endl; | |
207 | out << "TDC " << digit.fTdc << ", ADC "<< digit.fAdc << endl; | |
208 | return out; | |
209 | } | |
210 |