Possibility to not write syswatch info to file (default)
[u/mrichter/AliRoot.git] / STEER / ESD / AliESDMuonGlobalTrack.cxx
CommitLineData
d3eabe96 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//====================================================================================================================================================
17//
18// ESD description of an ALICE muon forward track, combining the information of the Muon Spectrometer and the Muon Forward Tracker
19//
20// Contact author: antonio.uras@cern.ch
21//
22//====================================================================================================================================================
23
24#include "AliESDMuonGlobalTrack.h"
25#include "AliESDEvent.h"
26
27#include "TClonesArray.h"
28#include "TLorentzVector.h"
29#include "TMath.h"
30#include "TDatabasePDG.h"
31
32ClassImp(AliESDMuonGlobalTrack)
33
34//====================================================================================================================================================
35
36AliESDMuonGlobalTrack::AliESDMuonGlobalTrack():
37 AliVParticle(),
38 fCharge(0),
39 fMatchTrigger(0),
f7cc8591 40 fNMFTClusters(0),
41 fNWrongMFTClustersMC(-1),
42 fMFTClusterPattern(0),
d3eabe96 43 fPx(0),
44 fPy(0),
45 fPz(0),
46 fPt(0),
47 fP(0),
48 fEta(0),
49 fRapidity(0),
f7cc8591 50 fFirstTrackingPointX(0),
51 fFirstTrackingPointY(0),
52 fFirstTrackingPointZ(0),
53 fXAtVertex(0),
54 fYAtVertex(0),
55 fRAtAbsorberEnd(0),
9562d53c 56 fCovariances(0),
f7cc8591 57 fChi2OverNdf(0),
d3eabe96 58 fChi2MatchTrigger(0),
59 fLabel(-1),
f7cc8591 60 fMuonClusterMap(0),
61 fHitsPatternInTrigCh(0),
62 fHitsPatternInTrigChTrk(0),
63 fLoCircuit(0),
64 fIsConnected(kFALSE),
d3eabe96 65 fESDEvent(0)
66{
67
68 // Default constructor
69
393f6a0d 70 fProdVertexXYZ[0]=0;
71 fProdVertexXYZ[1]=0;
72 fProdVertexXYZ[2]=0;
73
d3eabe96 74}
75
76//====================================================================================================================================================
77
78AliESDMuonGlobalTrack::AliESDMuonGlobalTrack(Double_t px, Double_t py, Double_t pz):
79 AliVParticle(),
80 fCharge(0),
81 fMatchTrigger(0),
f7cc8591 82 fNMFTClusters(0),
83 fNWrongMFTClustersMC(-1),
84 fMFTClusterPattern(0),
d3eabe96 85 fPx(0),
86 fPy(0),
87 fPz(0),
88 fPt(0),
89 fP(0),
90 fEta(0),
91 fRapidity(0),
f7cc8591 92 fFirstTrackingPointX(0),
93 fFirstTrackingPointY(0),
94 fFirstTrackingPointZ(0),
95 fXAtVertex(0),
96 fYAtVertex(0),
97 fRAtAbsorberEnd(0),
9562d53c 98 fCovariances(0),
f7cc8591 99 fChi2OverNdf(0),
d3eabe96 100 fChi2MatchTrigger(0),
101 fLabel(-1),
f7cc8591 102 fMuonClusterMap(0),
103 fHitsPatternInTrigCh(0),
104 fHitsPatternInTrigChTrk(0),
105 fLoCircuit(0),
106 fIsConnected(kFALSE),
d3eabe96 107 fESDEvent(0)
108{
109
110 // Constructor with kinematics
111
112 SetPxPyPz(px, py, pz);
113
393f6a0d 114 fProdVertexXYZ[0]=0;
115 fProdVertexXYZ[1]=0;
116 fProdVertexXYZ[2]=0;
117
d3eabe96 118}
119
120//====================================================================================================================================================
121
122AliESDMuonGlobalTrack::AliESDMuonGlobalTrack(const AliESDMuonGlobalTrack& muonTrack):
123 AliVParticle(muonTrack),
124 fCharge(muonTrack.fCharge),
125 fMatchTrigger(muonTrack.fMatchTrigger),
f7cc8591 126 fNMFTClusters(muonTrack.fNMFTClusters),
127 fNWrongMFTClustersMC(muonTrack.fNWrongMFTClustersMC),
128 fMFTClusterPattern(muonTrack.fMFTClusterPattern),
d3eabe96 129 fPx(muonTrack.fPx),
130 fPy(muonTrack.fPy),
131 fPz(muonTrack.fPz),
132 fPt(muonTrack.fPt),
133 fP(muonTrack.fP),
134 fEta(muonTrack.fEta),
135 fRapidity(muonTrack.fRapidity),
f7cc8591 136 fFirstTrackingPointX(muonTrack.fFirstTrackingPointX),
137 fFirstTrackingPointY(muonTrack.fFirstTrackingPointY),
138 fFirstTrackingPointZ(muonTrack.fFirstTrackingPointZ),
139 fXAtVertex(muonTrack.fXAtVertex),
140 fYAtVertex(muonTrack.fYAtVertex),
141 fRAtAbsorberEnd(muonTrack.fRAtAbsorberEnd),
9562d53c 142 fCovariances(0),
f7cc8591 143 fChi2OverNdf(muonTrack.fChi2OverNdf),
d3eabe96 144 fChi2MatchTrigger(muonTrack.fChi2MatchTrigger),
145 fLabel(muonTrack.fLabel),
f7cc8591 146 fMuonClusterMap(muonTrack.fMuonClusterMap),
147 fHitsPatternInTrigCh(muonTrack.fHitsPatternInTrigCh),
148 fHitsPatternInTrigChTrk(muonTrack.fHitsPatternInTrigChTrk),
149 fLoCircuit(muonTrack.fLoCircuit),
150 fIsConnected(muonTrack.fIsConnected),
d3eabe96 151 fESDEvent(muonTrack.fESDEvent)
152{
153
154 // Copy constructor
155
393f6a0d 156 fProdVertexXYZ[0]=muonTrack.fProdVertexXYZ[0];
157 fProdVertexXYZ[1]=muonTrack.fProdVertexXYZ[1];
158 fProdVertexXYZ[2]=muonTrack.fProdVertexXYZ[2];
159
9562d53c 160 if (muonTrack.fCovariances) fCovariances = new TMatrixD(*(muonTrack.fCovariances));
161
d3eabe96 162}
163
164//====================================================================================================================================================
165
166AliESDMuonGlobalTrack& AliESDMuonGlobalTrack::operator=(const AliESDMuonGlobalTrack& muonTrack) {
167
168 // Assignment operator
169
170 if (this == &muonTrack) return *this;
171
172 // Base class assignement
173 AliVParticle::operator=(muonTrack);
174
f7cc8591 175 fCharge = muonTrack.fCharge;
176 fMatchTrigger = muonTrack.fMatchTrigger;
177 fNMFTClusters = muonTrack.fNMFTClusters;
178 fNWrongMFTClustersMC = muonTrack.fNWrongMFTClustersMC;
179 fMFTClusterPattern = muonTrack.fMFTClusterPattern;
180 fPx = muonTrack.fPx;
181 fPy = muonTrack.fPy;
182 fPz = muonTrack.fPz;
183 fPt = muonTrack.fPt;
184 fP = muonTrack.fP;
185 fEta = muonTrack.fEta;
186 fRapidity = muonTrack.fRapidity;
187 fFirstTrackingPointX = muonTrack.fFirstTrackingPointX;
188 fFirstTrackingPointY = muonTrack.fFirstTrackingPointY;
189 fFirstTrackingPointZ = muonTrack.fFirstTrackingPointZ;
190 fXAtVertex = muonTrack.fXAtVertex;
191 fYAtVertex = muonTrack.fYAtVertex;
192 fRAtAbsorberEnd = muonTrack.fRAtAbsorberEnd;
193 fChi2OverNdf = muonTrack.fChi2OverNdf;
194 fChi2MatchTrigger = muonTrack.fChi2MatchTrigger;
195 fLabel = muonTrack.fLabel;
196 fMuonClusterMap = muonTrack.fMuonClusterMap;
197 fHitsPatternInTrigCh = muonTrack.fHitsPatternInTrigCh;
198 fHitsPatternInTrigChTrk = muonTrack.fHitsPatternInTrigChTrk;
199 fLoCircuit = muonTrack.fLoCircuit;
200 fIsConnected = muonTrack.fIsConnected;
201 fESDEvent = muonTrack.fESDEvent;
d3eabe96 202
393f6a0d 203 fProdVertexXYZ[0]=muonTrack.fProdVertexXYZ[0];
204 fProdVertexXYZ[1]=muonTrack.fProdVertexXYZ[1];
205 fProdVertexXYZ[2]=muonTrack.fProdVertexXYZ[2];
206
9562d53c 207 if (muonTrack.fCovariances) {
208 if (fCovariances) *fCovariances = *(muonTrack.fCovariances);
209 else fCovariances = new TMatrixD(*(muonTrack.fCovariances));
210 }
211 else {
212 delete fCovariances;
213 fCovariances = 0x0;
214 }
215
d3eabe96 216 return *this;
217
218}
219
220//====================================================================================================================================================
221
222void AliESDMuonGlobalTrack::Copy(TObject &obj) const {
223
224 // This overwrites the virtual TObject::Copy()
225 // to allow run time copying without casting
226 // in AliESDEvent
227
228 if (this==&obj) return;
229 AliESDMuonGlobalTrack *robj = dynamic_cast<AliESDMuonGlobalTrack*>(&obj);
230 if (!robj) return; // not an AliESDMuonGlobalTrack
231 *robj = *this;
232
233}
234
235//====================================================================================================================================================
236
237void AliESDMuonGlobalTrack::SetPxPyPz(Double_t px, Double_t py, Double_t pz) {
238
239 Double_t mMu = TDatabasePDG::Instance()->GetParticle("mu-")->Mass();
240 Double_t eMu = TMath::Sqrt(mMu*mMu + px*px + py*py + pz*pz);
241
242 TLorentzVector kinem(px, py, pz, eMu);
243
244 fPx = kinem.Px();
245 fPy = kinem.Py();
246 fPz = kinem.Pz();
247 fP = kinem.P();
248 fPt = kinem.Pt();
249 fEta = kinem.Eta();
250 fRapidity = kinem.Rapidity();
251
252}
253
254//====================================================================================================================================================
9562d53c 255
256const TMatrixD& AliESDMuonGlobalTrack::GetCovariances() const {
257
258 // Return the covariance matrix (create it before if needed)
259
260 if (!fCovariances) {
261 fCovariances = new TMatrixD(5,5);
262 fCovariances->Zero();
263 }
264 return *fCovariances;
265
266}
267
268//====================================================================================================================================================
269
270void AliESDMuonGlobalTrack::SetCovariances(const TMatrixD& covariances) {
271
272 // Set the covariance matrix
273
274 if (fCovariances) *fCovariances = covariances;
275 else fCovariances = new TMatrixD(covariances);
276
277}
278
279//====================================================================================================================================================