]>
Commit | Line | Data |
---|---|---|
a9e2aefa | 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$ */ |
a9e2aefa | 17 | |
3831f268 | 18 | /////////////////////////////////////////////////// |
19 | // | |
20 | // Track parameters | |
21 | // in | |
22 | // ALICE | |
23 | // dimuon | |
24 | // spectrometer | |
a9e2aefa | 25 | // |
3831f268 | 26 | /////////////////////////////////////////////////// |
a9e2aefa | 27 | |
37827b29 | 28 | #include <Riostream.h> |
29 | ||
30 | #include "AliMUONTrackParam.h" | |
211c52eb | 31 | #include "AliESDMuonTrack.h" |
37827b29 | 32 | #include "AliLog.h" |
de2cd600 | 33 | #include "AliMUONHitForRec.h" |
a9e2aefa | 34 | |
7945aae7 | 35 | /// \cond CLASSIMP |
a9e2aefa | 36 | ClassImp(AliMUONTrackParam) // Class implementation in ROOT context |
7945aae7 | 37 | /// \endcond |
a9e2aefa | 38 | |
61adb9bd | 39 | //_________________________________________________________________________ |
30178c30 | 40 | AliMUONTrackParam::AliMUONTrackParam() |
54d7ba50 | 41 | : TObject(), |
42 | fInverseBendingMomentum(0.), | |
43 | fBendingSlope(0.), | |
44 | fNonBendingSlope(0.), | |
45 | fZ(0.), | |
46 | fBendingCoor(0.), | |
de2cd600 | 47 | fNonBendingCoor(0.), |
de2cd600 | 48 | fHitForRecPtr(0x0) |
30178c30 | 49 | { |
37827b29 | 50 | /// Constructor |
30178c30 | 51 | } |
61adb9bd | 52 | |
30178c30 | 53 | //_________________________________________________________________________ |
de2cd600 | 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), | |
de2cd600 | 62 | fHitForRecPtr(theMUONTrackParam.fHitForRecPtr) |
63 | { | |
2457f726 | 64 | /// Copy constructor |
de2cd600 | 65 | } |
66 | ||
67 | //_________________________________________________________________________ | |
68 | AliMUONTrackParam& AliMUONTrackParam::operator=(const AliMUONTrackParam& theMUONTrackParam) | |
61adb9bd | 69 | { |
2457f726 | 70 | /// Asignment operator |
30178c30 | 71 | if (this == &theMUONTrackParam) |
61adb9bd | 72 | return *this; |
73 | ||
30178c30 | 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; | |
de2cd600 | 83 | fHitForRecPtr = theMUONTrackParam.fHitForRecPtr; |
61adb9bd | 84 | |
85 | return *this; | |
86 | } | |
de2cd600 | 87 | |
88 | //__________________________________________________________________________ | |
89 | AliMUONTrackParam::~AliMUONTrackParam() | |
61adb9bd | 90 | { |
de2cd600 | 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 | } | |
54d7ba50 | 108 | |
de2cd600 | 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); | |
61adb9bd | 127 | } |
a9e2aefa | 128 | |
211c52eb | 129 | //_________________________________________________________________________ |
130 | void AliMUONTrackParam::GetParamFrom(const AliESDMuonTrack& esdMuonTrack) | |
131 | { | |
2457f726 | 132 | /// assigned value form ESD track. |
211c52eb | 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 | { | |
2457f726 | 144 | /// assigned value form ESD track. |
211c52eb | 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 | ||
b8dc484b | 153 | //__________________________________________________________________________ |
6464217e | 154 | Double_t AliMUONTrackParam::Px() const |
b8dc484b | 155 | { |
2457f726 | 156 | /// return px from track paramaters |
b8dc484b | 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 | } | |
37827b29 | 165 | |
b8dc484b | 166 | //__________________________________________________________________________ |
6464217e | 167 | Double_t AliMUONTrackParam::Py() const |
b8dc484b | 168 | { |
2457f726 | 169 | /// return px from track paramaters |
b8dc484b | 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 | } | |
37827b29 | 178 | |
b8dc484b | 179 | //__________________________________________________________________________ |
6464217e | 180 | Double_t AliMUONTrackParam::Pz() const |
b8dc484b | 181 | { |
2457f726 | 182 | /// return px from track paramaters |
b8dc484b | 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 | } | |
37827b29 | 190 | |
b8dc484b | 191 | //__________________________________________________________________________ |
6464217e | 192 | Double_t AliMUONTrackParam::P() const |
b8dc484b | 193 | { |
2457f726 | 194 | /// return p from track paramaters |
b8dc484b | 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 | ||
b45fd22b | 204 | } |
4d03a78e | 205 | |
6464217e | 206 | //_____________________________________________- |
207 | void AliMUONTrackParam::Print(Option_t* opt) const | |
208 | { | |
2457f726 | 209 | /// Printing TrackParam information |
210 | /// "full" option for printing all the information about the TrackParam | |
6464217e | 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 | } |