1 //========================================================================
2 // Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved.
4 // Author: The ALICE Off-line Project.
5 // Contributors are mentioned in the code where appropriate.
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 //========================================================================
16 // Class AliEMCALTrack
17 // ---------------------
18 // A class implementing a track which is propagated to EMCAL and
19 // matches and EMCAL cluster.
20 // This track object will not update Kalman parameters, but it
21 // allows for track propagation and suitable energy loss correction,
22 // even in an environment with a variable magnetic field, which is not
23 // well managed in the AliExternalTrackParam class.
24 // ------------------------------------------------------------------------
25 // author: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
26 //=========================================================================
28 #include "Riostream.h"
31 #include "AliTracker.h"
32 #include "AliESDtrack.h"
34 #include "AliEMCALTrack.h"
36 Bool_t AliEMCALTrack::fgUseOuterParams = kTRUE;
38 ClassImp(AliEMCALTrack)
40 //------------------------------------------------------------------------------
42 AliEMCALTrack::AliEMCALTrack()
43 : AliExternalTrackParam(),
51 // Default constructor.
52 // Sets to meaningless values the indexes corresponding to
53 // ESD seed track and matched cluster.
57 //------------------------------------------------------------------------------
59 AliEMCALTrack::AliEMCALTrack(const AliEMCALTrack& t)
60 : AliExternalTrackParam(t),
61 fClusterIndex(t.fClusterIndex),
62 fClusterDist(t.fClusterDist),
64 fSeedIndex(t.fSeedIndex),
65 fSeedLabel(t.fSeedLabel)
72 //------------------------------------------------------------------------------
74 AliEMCALTrack::AliEMCALTrack(const AliESDtrack& t)
75 : AliExternalTrackParam(),
80 fSeedLabel(t.GetLabel())
83 // Constructor from AliESDtrack
86 // parameters are chosen according to static variable fUseOuterParams
87 Double_t alpha, x, params[5], cov[15];
88 if (fgUseOuterParams) {
89 t.GetOuterExternalParameters(alpha, x, params);
90 t.GetOuterExternalCovariance(cov);
94 t.GetExternalParameters(x, params);
95 t.GetExternalCovariance(cov);
98 if (alpha < -TMath::Pi()) alpha += TMath::TwoPi();
99 else if (alpha >= TMath::Pi()) alpha -= TMath::TwoPi();
101 // set this accordingly
102 Set(x, alpha, params, cov);
105 //------------------------------------------------------------------------------
107 AliEMCALTrack& AliEMCALTrack::operator=(const AliEMCALTrack &t)
110 // Assignment operator
111 // Works like copy constructor
114 fClusterIndex = t.fClusterIndex;
115 fClusterDist = t.fClusterDist;
119 fSeedIndex = t.fSeedIndex;
120 fSeedLabel = t.fSeedLabel;
125 //------------------------------------------------------------------------------
127 Int_t AliEMCALTrack::Compare(const TObject *obj) const
130 // Tracks compared wrt their distance from matched point
133 AliEMCALTrack *that = (AliEMCALTrack*)obj;
135 Double_t thisDist = GetClusterDist();
136 Double_t thatDist = that->GetClusterDist();
138 if (thisDist > thatDist) return 1;
139 else if (thisDist < thatDist) return -1;
143 //------------------------------------------------------------------------------
145 Double_t AliEMCALTrack::GetBz() const
148 // returns Bz component of the magnetic field in kG,
149 // at the point where track is actually propagated
154 if (AliTracker::UniformField()) {
155 return AliTracker::GetBz();
159 return AliTracker::GetBz(r);
163 //------------------------------------------------------------------------------
165 Bool_t AliEMCALTrack::PropagateTo(Double_t xk, Double_t eqWidth, Double_t x0)
168 // Propagates a track to the plane defined by x='xk'.
169 // Second parameter represents the percent width of radiation length
170 // crossed by the track.
171 // Third parameter is the reference radiation length used (default: Si).
172 // Track propagation includes computing energy loss (modifies curvature)
173 // and multiple scattering perturbation (alters covariance matrix).
174 // Method returns kFALSE when something goes wrong with computations.
177 Double_t field = GetBz();
179 if (!AliExternalTrackParam::PropagateTo(xk, field)) return kFALSE;
180 if (!AliExternalTrackParam::CorrectForMaterial(eqWidth, x0, GetMass())) return kFALSE;