]>
Commit | Line | Data |
---|---|---|
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$ */ | |
17 | ||
18 | /////////////////////////////////////////////////// | |
19 | // | |
20 | // Track parameters | |
21 | // in | |
22 | // ALICE | |
23 | // dimuon | |
24 | // spectrometer | |
25 | // | |
26 | /////////////////////////////////////////////////// | |
27 | ||
28 | #include <Riostream.h> | |
29 | ||
30 | #include "AliMUONTrackParam.h" | |
31 | #include "AliESDMuonTrack.h" | |
32 | #include "AliLog.h" | |
33 | #include "AliMUONHitForRec.h" | |
34 | ||
35 | /// \cond CLASSIMP | |
36 | ClassImp(AliMUONTrackParam) // Class implementation in ROOT context | |
37 | /// \endcond | |
38 | ||
39 | //_________________________________________________________________________ | |
40 | AliMUONTrackParam::AliMUONTrackParam() | |
41 | : TObject(), | |
42 | fInverseBendingMomentum(0.), | |
43 | fBendingSlope(0.), | |
44 | fNonBendingSlope(0.), | |
45 | fZ(0.), | |
46 | fBendingCoor(0.), | |
47 | fNonBendingCoor(0.), | |
48 | fHitForRecPtr(0x0) | |
49 | { | |
50 | /// Constructor | |
51 | } | |
52 | ||
53 | //_________________________________________________________________________ | |
54 | AliMUONTrackParam::AliMUONTrackParam(const AliMUONTrackParam& theMUONTrackParam) | |
55 | : TObject(theMUONTrackParam), | |
56 | fInverseBendingMomentum(theMUONTrackParam.fInverseBendingMomentum), | |
57 | fBendingSlope(theMUONTrackParam.fBendingSlope), | |
58 | fNonBendingSlope(theMUONTrackParam.fNonBendingSlope), | |
59 | fZ(theMUONTrackParam.fZ), | |
60 | fBendingCoor(theMUONTrackParam.fBendingCoor), | |
61 | fNonBendingCoor(theMUONTrackParam.fNonBendingCoor), | |
62 | fHitForRecPtr(theMUONTrackParam.fHitForRecPtr) | |
63 | { | |
64 | /// Copy constructor | |
65 | } | |
66 | ||
67 | //_________________________________________________________________________ | |
68 | AliMUONTrackParam& AliMUONTrackParam::operator=(const AliMUONTrackParam& theMUONTrackParam) | |
69 | { | |
70 | /// Asignment operator | |
71 | if (this == &theMUONTrackParam) | |
72 | return *this; | |
73 | ||
74 | // base class assignement | |
75 | TObject::operator=(theMUONTrackParam); | |
76 | ||
77 | fInverseBendingMomentum = theMUONTrackParam.fInverseBendingMomentum; | |
78 | fBendingSlope = theMUONTrackParam.fBendingSlope; | |
79 | fNonBendingSlope = theMUONTrackParam.fNonBendingSlope; | |
80 | fZ = theMUONTrackParam.fZ; | |
81 | fBendingCoor = theMUONTrackParam.fBendingCoor; | |
82 | fNonBendingCoor = theMUONTrackParam.fNonBendingCoor; | |
83 | fHitForRecPtr = theMUONTrackParam.fHitForRecPtr; | |
84 | ||
85 | return *this; | |
86 | } | |
87 | ||
88 | //__________________________________________________________________________ | |
89 | AliMUONTrackParam::~AliMUONTrackParam() | |
90 | { | |
91 | /// Destructor | |
92 | /// Update the number of TrackHit's connected to the attached HitForRec if any | |
93 | if (fHitForRecPtr) fHitForRecPtr->SetNTrackHits(fHitForRecPtr->GetNTrackHits() - 1); // decrement NTrackHits of hit | |
94 | } | |
95 | ||
96 | //__________________________________________________________________________ | |
97 | void AliMUONTrackParam::SetTrackParam(AliMUONTrackParam& theMUONTrackParam) | |
98 | { | |
99 | /// Set track parameters from "TrackParam" leaving pointer to fHitForRecPtr unchanged | |
100 | fInverseBendingMomentum = theMUONTrackParam.fInverseBendingMomentum; | |
101 | fBendingSlope = theMUONTrackParam.fBendingSlope; | |
102 | fNonBendingSlope = theMUONTrackParam.fNonBendingSlope; | |
103 | fZ = theMUONTrackParam.fZ; | |
104 | fBendingCoor = theMUONTrackParam.fBendingCoor; | |
105 | fNonBendingCoor = theMUONTrackParam.fNonBendingCoor; | |
106 | ||
107 | } | |
108 | ||
109 | //__________________________________________________________________________ | |
110 | AliMUONHitForRec* AliMUONTrackParam::GetHitForRecPtr(void) const | |
111 | { | |
112 | /// return pointer to HitForRec attached to the current TrackParam | |
113 | /// this method should not be called when fHitForRecPtr == NULL | |
114 | if (!fHitForRecPtr) AliWarning("AliMUONTrackParam::GetHitForRecPtr: fHitForRecPtr == NULL"); | |
115 | return fHitForRecPtr; | |
116 | } | |
117 | ||
118 | //__________________________________________________________________________ | |
119 | Int_t AliMUONTrackParam::Compare(const TObject* TrackParam) const | |
120 | { | |
121 | /// "Compare" function to sort with decreasing Z (spectro. muon Z <0). | |
122 | /// Returns 1 (0, -1) if Z of current TrackHit | |
123 | /// is smaller than (equal to, larger than) Z of TrackHit | |
124 | if (fHitForRecPtr->GetZ() < ((AliMUONTrackParam*)TrackParam)->fHitForRecPtr->GetZ()) return(1); | |
125 | else if (fHitForRecPtr->GetZ() == ((AliMUONTrackParam*)TrackParam)->fHitForRecPtr->GetZ()) return(0); | |
126 | else return(-1); | |
127 | } | |
128 | ||
129 | //_________________________________________________________________________ | |
130 | void AliMUONTrackParam::GetParamFrom(const AliESDMuonTrack& esdMuonTrack) | |
131 | { | |
132 | /// assigned value form ESD track. | |
133 | fInverseBendingMomentum = esdMuonTrack.GetInverseBendingMomentum(); | |
134 | fBendingSlope = TMath::Tan(esdMuonTrack.GetThetaY()); | |
135 | fNonBendingSlope = TMath::Tan(esdMuonTrack.GetThetaX()); | |
136 | fZ = esdMuonTrack.GetZ(); | |
137 | fBendingCoor = esdMuonTrack.GetBendingCoor(); | |
138 | fNonBendingCoor = esdMuonTrack.GetNonBendingCoor(); | |
139 | } | |
140 | ||
141 | //_________________________________________________________________________ | |
142 | void AliMUONTrackParam::SetParamFor(AliESDMuonTrack& esdMuonTrack) | |
143 | { | |
144 | /// assigned value form ESD track. | |
145 | esdMuonTrack.SetInverseBendingMomentum(fInverseBendingMomentum); | |
146 | esdMuonTrack.SetThetaX(TMath::ATan(fNonBendingSlope)); | |
147 | esdMuonTrack.SetThetaY(TMath::ATan(fBendingSlope)); | |
148 | esdMuonTrack.SetZ(fZ); | |
149 | esdMuonTrack.SetBendingCoor(fBendingCoor); | |
150 | esdMuonTrack.SetNonBendingCoor(fNonBendingCoor); | |
151 | } | |
152 | ||
153 | //__________________________________________________________________________ | |
154 | Double_t AliMUONTrackParam::Px() const | |
155 | { | |
156 | /// return px from track paramaters | |
157 | Double_t pYZ, pZ, pX; | |
158 | pYZ = 0; | |
159 | if ( TMath::Abs(fInverseBendingMomentum) > 0 ) | |
160 | pYZ = TMath::Abs(1.0 / fInverseBendingMomentum); | |
161 | pZ = -pYZ / (TMath::Sqrt(1.0 + fBendingSlope * fBendingSlope)); // spectro. (z<0) | |
162 | pX = pZ * fNonBendingSlope; | |
163 | return pX; | |
164 | } | |
165 | ||
166 | //__________________________________________________________________________ | |
167 | Double_t AliMUONTrackParam::Py() const | |
168 | { | |
169 | /// return px from track paramaters | |
170 | Double_t pYZ, pZ, pY; | |
171 | pYZ = 0; | |
172 | if ( TMath::Abs(fInverseBendingMomentum) > 0 ) | |
173 | pYZ = TMath::Abs(1.0 / fInverseBendingMomentum); | |
174 | pZ = -pYZ / (TMath::Sqrt(1.0 + fBendingSlope * fBendingSlope)); // spectro. (z<0) | |
175 | pY = pZ * fBendingSlope; | |
176 | return pY; | |
177 | } | |
178 | ||
179 | //__________________________________________________________________________ | |
180 | Double_t AliMUONTrackParam::Pz() const | |
181 | { | |
182 | /// return px from track paramaters | |
183 | Double_t pYZ, pZ; | |
184 | pYZ = 0; | |
185 | if ( TMath::Abs(fInverseBendingMomentum) > 0 ) | |
186 | pYZ = TMath::Abs(1.0 / fInverseBendingMomentum); | |
187 | pZ = -pYZ / (TMath::Sqrt(1.0 + fBendingSlope * fBendingSlope)); // spectro. (z<0) | |
188 | return pZ; | |
189 | } | |
190 | ||
191 | //__________________________________________________________________________ | |
192 | Double_t AliMUONTrackParam::P() const | |
193 | { | |
194 | /// return p from track paramaters | |
195 | Double_t pYZ, pZ, p; | |
196 | pYZ = 0; | |
197 | if ( TMath::Abs(fInverseBendingMomentum) > 0 ) | |
198 | pYZ = TMath::Abs(1.0 / fInverseBendingMomentum); | |
199 | pZ = -pYZ / (TMath::Sqrt(1.0 + fBendingSlope * fBendingSlope)); // spectro. (z<0) | |
200 | p = TMath::Abs(pZ) * | |
201 | TMath::Sqrt(1.0 + fBendingSlope * fBendingSlope + fNonBendingSlope * fNonBendingSlope); | |
202 | return p; | |
203 | ||
204 | } | |
205 | ||
206 | //_____________________________________________- | |
207 | void AliMUONTrackParam::Print(Option_t* opt) const | |
208 | { | |
209 | /// Printing TrackParam information | |
210 | /// "full" option for printing all the information about the TrackParam | |
211 | TString sopt(opt); | |
212 | sopt.ToUpper(); | |
213 | ||
214 | if ( sopt.Contains("FULL") ) { | |
215 | cout << "<AliMUONTrackParam> Bending P=" << setw(5) << setprecision(3) << 1./GetInverseBendingMomentum() << | |
216 | ", NonBendSlope=" << setw(5) << setprecision(3) << GetNonBendingSlope()*180./TMath::Pi() << | |
217 | ", BendSlope=" << setw(5) << setprecision(3) << GetBendingSlope()*180./TMath::Pi() << | |
218 | ", (x,y,z)_IP=(" << setw(5) << setprecision(3) << GetNonBendingCoor() << | |
219 | "," << setw(5) << setprecision(3) << GetBendingCoor() << | |
220 | "," << setw(5) << setprecision(3) << GetZ() << | |
221 | ") cm, (px,py,pz)=(" << setw(5) << setprecision(3) << Px() << | |
222 | "," << setw(5) << setprecision(3) << Py() << | |
223 | "," << setw(5) << setprecision(3) << Pz() << ") GeV/c" << endl; | |
224 | } | |
225 | else { | |
226 | cout << "<AliMUONTrackParam>" << endl; | |
227 | } | |
228 | ||
229 | } |