]>
Commit | Line | Data |
---|---|---|
52c19022 | 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 | ||
16 | /* $Id: AliTRDtrackletGTU.cxx 28397 2008-09-02 09:33:00Z cblume $ */ | |
17 | ||
18 | //////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // GTU tracklet // | |
21 | // // | |
22 | // Author: J. Klein (Jochen.Klein@cern.ch) // | |
23 | // // | |
24 | //////////////////////////////////////////////////////////////////////////// | |
25 | ||
26 | #include "TMath.h" | |
4cc89512 | 27 | #include "TClass.h" |
52c19022 | 28 | |
29 | #include "AliTRDtrackletGTU.h" | |
30 | #include "AliTRDtrackletWord.h" | |
4cc89512 | 31 | #include "AliTRDtrackletMCM.h" |
52c19022 | 32 | #include "AliLog.h" |
33 | #include "AliTRDgtuParam.h" | |
34 | #include "AliTRDgeometry.h" | |
35 | #include "AliTRDpadPlane.h" | |
36 | ||
37 | ClassImp(AliTRDtrackletGTU) | |
38 | ||
39 | AliTRDtrackletBase* AliTRDtrackletGTU::fgkDummyTracklet = new AliTRDtrackletWord(0); | |
40 | ||
41 | AliTRDtrackletGTU::AliTRDtrackletGTU() : | |
42 | AliTRDtrackletBase(), | |
43 | fGtuParam(AliTRDgtuParam::Instance()), | |
80f93426 | 44 | fTracklet(0x0), //fgkDummyTracklet), |
52c19022 | 45 | fSubChannel(0x0), |
46 | fAssignedZ(kFALSE), | |
47 | fAlpha(0), | |
48 | fYProj(0), | |
49 | fYPrime(0), | |
50 | fIndex(0) | |
51 | { | |
52 | // ctor for any tracklet deriving from AliTRDtrackletBase | |
53 | ||
54 | fSubChannel = new Int_t[fGtuParam->GetNZChannels()]; | |
55 | for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++) | |
56 | fSubChannel[zch] = 0; | |
57 | } | |
58 | ||
59 | AliTRDtrackletGTU::AliTRDtrackletGTU(AliTRDtrackletBase *tracklet) : | |
60 | AliTRDtrackletBase(*tracklet), | |
61 | fGtuParam(AliTRDgtuParam::Instance()), | |
62 | fTracklet(0x0), | |
63 | fSubChannel(0x0), | |
64 | fAssignedZ(kFALSE), | |
65 | fAlpha(0), | |
66 | fYProj(0), | |
67 | fYPrime(0), | |
68 | fIndex(0) | |
69 | { | |
70 | // ctor for any tracklet deriving from AliTRDtrackletBase | |
71 | ||
72 | fSubChannel = new Int_t[fGtuParam->GetNZChannels()]; | |
73 | for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++) | |
74 | fSubChannel[zch] = 0; | |
75 | fTracklet = tracklet; | |
4cc89512 | 76 | if ( fTracklet->IsA() == TClass::GetClass("AliTRDtrackletMCM")) { |
c8b1590d | 77 | AliDebug(5,Form("label from mcm tracklet: %i", ((AliTRDtrackletMCM*) fTracklet)->GetLabel())); |
4cc89512 | 78 | } |
52c19022 | 79 | } |
80 | ||
81 | AliTRDtrackletGTU::AliTRDtrackletGTU(const AliTRDtrackletGTU& tracklet) : | |
82 | AliTRDtrackletBase(tracklet), | |
83 | fGtuParam(AliTRDgtuParam::Instance()), | |
84 | fTracklet(tracklet.fTracklet), | |
85 | fSubChannel(0x0), | |
86 | fAssignedZ(tracklet.fAssignedZ), | |
87 | fAlpha(tracklet.fAlpha), | |
88 | fYProj(tracklet.fYProj), | |
89 | fYPrime(tracklet.fYPrime), | |
90 | fIndex(tracklet.fIndex) | |
91 | { | |
92 | // copy ctor | |
93 | ||
94 | fSubChannel = new Int_t[fGtuParam->GetNZChannels()]; | |
95 | for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++) | |
96 | fSubChannel[zch] = tracklet.fSubChannel[zch]; | |
97 | } | |
98 | ||
99 | AliTRDtrackletGTU& AliTRDtrackletGTU::operator=(const AliTRDtrackletGTU &rhs) | |
100 | { | |
36dc3337 | 101 | // assignment operator |
102 | ||
52c19022 | 103 | if (&rhs != this) { |
104 | fTracklet = rhs.fTracklet; | |
105 | for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++) | |
106 | fSubChannel[zch] = rhs.fSubChannel[zch]; | |
107 | fIndex = rhs.fIndex; | |
108 | fYPrime = rhs.fYPrime; | |
109 | fYProj = rhs.fYProj; | |
110 | fAlpha = rhs.fAlpha; | |
111 | fAssignedZ = rhs.fAssignedZ; | |
112 | } | |
113 | ||
114 | return *this; | |
115 | } | |
116 | ||
117 | AliTRDtrackletGTU::~AliTRDtrackletGTU() | |
118 | { | |
119 | // dtor | |
120 | if (fSubChannel) | |
121 | delete [] fSubChannel; | |
80f93426 | 122 | fTracklet = 0x0; |
52c19022 | 123 | } |
124 | ||
125 | Int_t AliTRDtrackletGTU::Compare(const TObject *o) const { | |
126 | // sorting w. r. t. Z, Y if no z-channel assigned (as needed in input unit) | |
127 | // otherwise w. r. t. Z, Y_proj | |
128 | // must be changed to Z-channel, Y_proj | |
129 | // will be changed | |
130 | ||
131 | if (!o) | |
132 | return 0; | |
133 | ||
134 | if (!o->InheritsFrom("AliTRDtrackletGTU")) { | |
135 | AliError("Cannot compare to object not deriving from AliTRDtrackletGTU"); | |
136 | return 0; | |
137 | } | |
138 | ||
139 | if (!fAssignedZ) { | |
140 | if ( GetZbin() < ((AliTRDtrackletGTU*) o)->GetZbin()) | |
141 | return -1; | |
142 | else if (GetZbin() > ((AliTRDtrackletGTU*) o)->GetZbin()) | |
143 | return 1; | |
144 | else | |
145 | if (GetYbin() < ((AliTRDtrackletGTU*) o)->GetYbin()) | |
146 | return -1; | |
147 | else if (GetYbin() > ((AliTRDtrackletGTU*) o)->GetYbin()) | |
148 | return 1; | |
149 | else | |
150 | return 0; | |
151 | } | |
152 | else { | |
153 | // sorting should be according to zsubindex, not to Z !!! | |
154 | // therefore this depends on the zch | |
155 | if (GetZbin() < ((AliTRDtrackletGTU*) o)->GetZbin()) | |
156 | return -1; | |
157 | else if (GetZbin() > ((AliTRDtrackletGTU*) o)->GetZbin()) | |
158 | return 1; | |
159 | else | |
160 | if (GetYProj() < ((AliTRDtrackletGTU*) o)->GetYProj()) | |
161 | return -1; | |
162 | else if (GetYProj() > ((AliTRDtrackletGTU*) o)->GetYProj()) | |
163 | return 1; | |
164 | else | |
165 | return 0; | |
166 | } | |
167 | } | |
168 | ||
169 | void AliTRDtrackletGTU::SetSubChannel(Int_t zch, Int_t subch) | |
170 | { | |
171 | // set the subchannel in the given z-channel | |
172 | fAssignedZ = kTRUE; | |
173 | fSubChannel[zch] = subch; | |
174 | } | |
175 | ||
36dc3337 | 176 | Int_t AliTRDtrackletGTU::GetSubChannel(Int_t zch) const |
52c19022 | 177 | { |
178 | // get the subchannel in the given z-channel | |
179 | return fSubChannel[zch]; | |
180 | } | |
181 | ||
4cc89512 | 182 | Int_t AliTRDtrackletGTU::GetLabel() const |
183 | { | |
36dc3337 | 184 | // get the MC label for the tracklet, -1 if none |
185 | ||
4cc89512 | 186 | if ( fTracklet->IsA() == TClass::GetClass("AliTRDtrackletMCM")) |
187 | return ((AliTRDtrackletMCM*) fTracklet)->GetLabel(); | |
188 | else | |
189 | return -1; | |
190 | } | |
191 | ||
52c19022 | 192 | /* |
193 | Float_t AliTRDtrackletGTU::GetPhysX(Int_t layer) | |
194 | { | |
195 | // get the x-position (in the local system) assuming the tracklet is in the given layer | |
196 | return fGtuParam->GetGeo()->GetTime0(layer); | |
197 | } | |
198 | ||
199 | Float_t AliTRDtrackletGTU::GetPhysY() | |
200 | { | |
201 | // | |
202 | return GetYbin() * 0.0160; | |
203 | } | |
204 | ||
205 | Float_t AliTRDtrackletGTU::GetPhysAlpha() | |
206 | { | |
207 | return GetAlpha() * 0.01; // wrong factor! | |
208 | } | |
209 | ||
210 | Float_t AliTRDtrackletGTU::GetPhysZ(Int_t stack, Int_t layer) | |
211 | { | |
212 | return fGtuParam->GetGeo()->GetPadPlane(layer, stack)->GetRowPos(GetZbin()); // not the middle of a pad! | |
213 | } | |
214 | */ |