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