//#include <Riostream.h>
#include "AliMUON.h"
#include "AliMUONTrackParam.h"
-//#include "AliMUONChamber.h"
-#include "AliRun.h"
+#include "AliMUONConstants.h"
+#include "AliESDMuonTrack.h"
#include "AliMagF.h"
#include "AliLog.h"
+#include "AliTracker.h"
+#include "AliMUONHitForRec.h"
ClassImp(AliMUONTrackParam) // Class implementation in ROOT context
//_________________________________________________________________________
AliMUONTrackParam::AliMUONTrackParam()
- : TObject()
+ : TObject(),
+ fInverseBendingMomentum(0.),
+ fBendingSlope(0.),
+ fNonBendingSlope(0.),
+ fZ(0.),
+ fBendingCoor(0.),
+ fNonBendingCoor(0.),
+ fkField(0x0),
+ fHitForRecPtr(0x0)
{
-// Constructor
-
- fInverseBendingMomentum = 0;
- fBendingSlope = 0;
- fNonBendingSlope = 0;
- fZ = 0;
- fBendingCoor = 0;
- fNonBendingCoor = 0;
+/// Constructor
+ // get field from outside
+ fkField = AliTracker::GetFieldMap();
+ if (!fkField) AliFatal("No field available");
}
//_________________________________________________________________________
-AliMUONTrackParam&
-AliMUONTrackParam::operator=(const AliMUONTrackParam& theMUONTrackParam)
+AliMUONTrackParam::AliMUONTrackParam(const AliMUONTrackParam& theMUONTrackParam)
+ : TObject(theMUONTrackParam),
+ fInverseBendingMomentum(theMUONTrackParam.fInverseBendingMomentum),
+ fBendingSlope(theMUONTrackParam.fBendingSlope),
+ fNonBendingSlope(theMUONTrackParam.fNonBendingSlope),
+ fZ(theMUONTrackParam.fZ),
+ fBendingCoor(theMUONTrackParam.fBendingCoor),
+ fNonBendingCoor(theMUONTrackParam.fNonBendingCoor),
+ fkField(theMUONTrackParam.fkField),
+ fHitForRecPtr(theMUONTrackParam.fHitForRecPtr)
+{
+ /// Copy constructor
+}
+
+ //_________________________________________________________________________
+AliMUONTrackParam& AliMUONTrackParam::operator=(const AliMUONTrackParam& theMUONTrackParam)
{
- // Asignment operator
+ /// Asignment operator
if (this == &theMUONTrackParam)
return *this;
fZ = theMUONTrackParam.fZ;
fBendingCoor = theMUONTrackParam.fBendingCoor;
fNonBendingCoor = theMUONTrackParam.fNonBendingCoor;
+ fkField = theMUONTrackParam.fkField;
+ fHitForRecPtr = theMUONTrackParam.fHitForRecPtr;
return *this;
}
- //_________________________________________________________________________
-AliMUONTrackParam::AliMUONTrackParam(const AliMUONTrackParam& theMUONTrackParam)
- : TObject(theMUONTrackParam)
+
+ //__________________________________________________________________________
+AliMUONTrackParam::~AliMUONTrackParam()
+{
+/// Destructor
+/// Update the number of TrackHit's connected to the attached HitForRec if any
+ if (fHitForRecPtr) fHitForRecPtr->SetNTrackHits(fHitForRecPtr->GetNTrackHits() - 1); // decrement NTrackHits of hit
+}
+
+ //__________________________________________________________________________
+void AliMUONTrackParam::SetTrackParam(AliMUONTrackParam& theMUONTrackParam)
{
- // Copy constructor
+ /// Set track parameters from "TrackParam" leaving pointer to fHitForRecPtr unchanged
fInverseBendingMomentum = theMUONTrackParam.fInverseBendingMomentum;
fBendingSlope = theMUONTrackParam.fBendingSlope;
fNonBendingSlope = theMUONTrackParam.fNonBendingSlope;
fZ = theMUONTrackParam.fZ;
fBendingCoor = theMUONTrackParam.fBendingCoor;
fNonBendingCoor = theMUONTrackParam.fNonBendingCoor;
+
+}
+
+ //__________________________________________________________________________
+AliMUONHitForRec* AliMUONTrackParam::GetHitForRecPtr(void) const
+{
+/// return pointer to HitForRec attached to the current TrackParam
+/// this method should not be called when fHitForRecPtr == NULL
+ if (!fHitForRecPtr) AliWarning("AliMUONTrackParam::GetHitForRecPtr: fHitForRecPtr == NULL");
+ return fHitForRecPtr;
+}
+
+ //__________________________________________________________________________
+Int_t AliMUONTrackParam::Compare(const TObject* TrackParam) const
+{
+/// "Compare" function to sort with decreasing Z (spectro. muon Z <0).
+/// Returns 1 (0, -1) if Z of current TrackHit
+/// is smaller than (equal to, larger than) Z of TrackHit
+ if (fHitForRecPtr->GetZ() < ((AliMUONTrackParam*)TrackParam)->fHitForRecPtr->GetZ()) return(1);
+ else if (fHitForRecPtr->GetZ() == ((AliMUONTrackParam*)TrackParam)->fHitForRecPtr->GetZ()) return(0);
+ else return(-1);
+}
+
+ //_________________________________________________________________________
+void AliMUONTrackParam::GetParamFrom(const AliESDMuonTrack& esdMuonTrack)
+{
+ /// assigned value form ESD track.
+ fInverseBendingMomentum = esdMuonTrack.GetInverseBendingMomentum();
+ fBendingSlope = TMath::Tan(esdMuonTrack.GetThetaY());
+ fNonBendingSlope = TMath::Tan(esdMuonTrack.GetThetaX());
+ fZ = esdMuonTrack.GetZ();
+ fBendingCoor = esdMuonTrack.GetBendingCoor();
+ fNonBendingCoor = esdMuonTrack.GetNonBendingCoor();
+}
+
+ //_________________________________________________________________________
+void AliMUONTrackParam::SetParamFor(AliESDMuonTrack& esdMuonTrack)
+{
+ /// assigned value form ESD track.
+ esdMuonTrack.SetInverseBendingMomentum(fInverseBendingMomentum);
+ esdMuonTrack.SetThetaX(TMath::ATan(fNonBendingSlope));
+ esdMuonTrack.SetThetaY(TMath::ATan(fBendingSlope));
+ esdMuonTrack.SetZ(fZ);
+ esdMuonTrack.SetBendingCoor(fBendingCoor);
+ esdMuonTrack.SetNonBendingCoor(fNonBendingCoor);
}
//__________________________________________________________________________
void AliMUONTrackParam::ExtrapToZ(Double_t Z)
{
- // Track parameter extrapolation to the plane at "Z".
- // On return, the track parameters resulting from the extrapolation
- // replace the current track parameters.
+ /// Track parameter extrapolation to the plane at "Z".
+ /// On return, the track parameters resulting from the extrapolation
+ /// replace the current track parameters.
if (this->fZ == Z) return; // nothing to be done if same Z
Double_t forwardBackward; // +1 if forward, -1 if backward
if (Z < this->fZ) forwardBackward = 1.0; // spectro. z<0
//__________________________________________________________________________
void AliMUONTrackParam::SetGeant3Parameters(Double_t *VGeant3, Double_t ForwardBackward)
{
- // Set vector of Geant3 parameters pointed to by "VGeant3"
- // from track parameters in current AliMUONTrackParam.
- // Since AliMUONTrackParam is only geometry, one uses "ForwardBackward"
- // to know whether the particle is going forward (+1) or backward (-1).
+ /// Set vector of Geant3 parameters pointed to by "VGeant3"
+ /// from track parameters in current AliMUONTrackParam.
+ /// Since AliMUONTrackParam is only geometry, one uses "ForwardBackward"
+ /// to know whether the particle is going forward (+1) or backward (-1).
VGeant3[0] = this->fNonBendingCoor; // X
VGeant3[1] = this->fBendingCoor; // Y
VGeant3[2] = this->fZ; // Z
//__________________________________________________________________________
void AliMUONTrackParam::GetFromGeant3Parameters(Double_t *VGeant3, Double_t Charge)
{
- // Get track parameters in current AliMUONTrackParam
- // from Geant3 parameters pointed to by "VGeant3",
- // assumed to be calculated for forward motion in Z.
- // "InverseBendingMomentum" is signed with "Charge".
+ /// Get track parameters in current AliMUONTrackParam
+ /// from Geant3 parameters pointed to by "VGeant3",
+ /// assumed to be calculated for forward motion in Z.
+ /// "InverseBendingMomentum" is signed with "Charge".
this->fNonBendingCoor = VGeant3[0]; // X
this->fBendingCoor = VGeant3[1]; // Y
this->fZ = VGeant3[2]; // Z
//__________________________________________________________________________
void AliMUONTrackParam::ExtrapToStation(Int_t Station, AliMUONTrackParam *TrackParam)
{
- // Track parameters extrapolated from current track parameters ("this")
- // to both chambers of the station(0..) "Station"
- // are returned in the array (dimension 2) of track parameters
- // pointed to by "TrackParam" (index 0 and 1 for first and second chambers).
+ /// Track parameters extrapolated from current track parameters ("this")
+ /// to both chambers of the station(0..) "Station"
+ /// are returned in the array (dimension 2) of track parameters
+ /// pointed to by "TrackParam" (index 0 and 1 for first and second chambers).
Double_t extZ[2], z1, z2;
Int_t i1 = -1, i2 = -1; // = -1 to avoid compilation warnings
- AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ????
// range of Station to be checked ????
- z1 = (&(pMUON->Chamber(2 * Station)))->Z(); // Z of first chamber
- z2 = (&(pMUON->Chamber(2 * Station + 1)))->Z(); // Z of second chamber
+ z1 = AliMUONConstants::DefaultChamberZ(2 * Station);
+ z2 = AliMUONConstants::DefaultChamberZ(2 * Station + 1);
// First and second Z to extrapolate at
if ((z1 > this->fZ) && (z2 > this->fZ)) {i1 = 0; i2 = 1;}
else if ((z1 < this->fZ) && (z2 < this->fZ)) {i1 = 1; i2 = 0;}
//__________________________________________________________________________
void AliMUONTrackParam::ExtrapToVertex(Double_t xVtx, Double_t yVtx, Double_t zVtx)
{
- // Extrapolation to the vertex.
- // Returns the track parameters resulting from the extrapolation,
- // in the current TrackParam.
- // Changes parameters according to Branson correction through the absorber
+ /// Extrapolation to the vertex.
+ /// Returns the track parameters resulting from the extrapolation in the current TrackParam.
+ /// Changes parameters according to Branson correction through the absorber
Double_t zAbsorber = -503.0; // to be coherent with the Geant absorber geometry !!!!
// spectro. (z<0)
void AliMUONTrackParam::BransonCorrection(Double_t xVtx,Double_t yVtx,Double_t zVtx)
{
- // Branson correction of track parameters
+ /// Branson correction of track parameters
// the entry parameters have to be calculated at the end of the absorber
// simplified version: the z positions of Branson's planes are no longer calculated
// but are given as inputs. One can use the macros MUONTestAbso.C and DrawTestAbso.C
// Would it be possible to calculate all that from Geant configuration ????
// and to get the Branson parameters from a function in ABSO module ????
// with an eventual contribution from other detectors like START ????
- //change to take into account the vertex postition (real, reconstruct,....)
+ // change to take into account the vertex postition (real, reconstruct,....)
Double_t zBP, xBP, yBP;
Double_t pYZ, pX, pY, pZ, pTotal, xEndAbsorber, yEndAbsorber, radiusEndAbsorber2, pT, theta;
//__________________________________________________________________________
Double_t AliMUONTrackParam::TotalMomentumEnergyLoss(Double_t thetaLimit, Double_t pTotal, Double_t theta)
{
- // Returns the total momentum corrected from energy loss in the front absorber
+ /// Returns the total momentum corrected from energy loss in the front absorber
// One can use the macros MUONTestAbso.C and DrawTestAbso.C
// to test this correction.
// Momentum energy loss behaviour evaluated with the simulation of single muons (april 2002)
} else {
deltaP = 3.0714 + 0.011767 *pTotal;
}
+ deltaP *= 0.75; // AZ
} else {
if (pTotal < 20) {
deltaP = 2.1207 + 0.05478 * pTotal - 0.00145079 * pTotal * pTotal;
} else {
deltaP = 2.6069 + 0.0051705 * pTotal;
}
+ deltaP *= 0.9; // AZ
}
pTotalCorrected = pTotal + deltaP / TMath::Cos(theta);
return pTotalCorrected;
//__________________________________________________________________________
void AliMUONTrackParam::FieldCorrection(Double_t Z)
{
- //
- // Correction of the effect of the magnetic field in the absorber
+ /// Correction of the effect of the magnetic field in the absorber
// Assume a constant field along Z axis.
-
Float_t b[3],x[3];
Double_t bZ;
Double_t pYZ,pX,pY,pZ,pT;
x[1] = x[2]*fBendingSlope;
// Take magn. field value at position x.
- gAlice->Field()->Field(x, b);
+ fkField->Field(x, b);
bZ = b[2];
// Transverse momentum rotation
}
//__________________________________________________________________________
-Double_t AliMUONTrackParam::Px()
+Double_t AliMUONTrackParam::Px() const
{
- // return px from track paramaters
+ /// return px from track paramaters
Double_t pYZ, pZ, pX;
pYZ = 0;
if ( TMath::Abs(fInverseBendingMomentum) > 0 )
return pX;
}
//__________________________________________________________________________
-Double_t AliMUONTrackParam::Py()
+Double_t AliMUONTrackParam::Py() const
{
- // return px from track paramaters
+ /// return px from track paramaters
Double_t pYZ, pZ, pY;
pYZ = 0;
if ( TMath::Abs(fInverseBendingMomentum) > 0 )
return pY;
}
//__________________________________________________________________________
-Double_t AliMUONTrackParam::Pz()
+Double_t AliMUONTrackParam::Pz() const
{
- // return px from track paramaters
+ /// return px from track paramaters
Double_t pYZ, pZ;
pYZ = 0;
if ( TMath::Abs(fInverseBendingMomentum) > 0 )
return pZ;
}
//__________________________________________________________________________
-Double_t AliMUONTrackParam::P()
+Double_t AliMUONTrackParam::P() const
{
- // return p from track paramaters
+ /// return p from track paramaters
Double_t pYZ, pZ, p;
pYZ = 0;
if ( TMath::Abs(fInverseBendingMomentum) > 0 )
void AliMUONTrackParam::ExtrapOneStepHelix(Double_t charge, Double_t step,
Double_t *vect, Double_t *vout) const
{
-// ******************************************************************
-// * *
-// * Performs the tracking of one step in a magnetic field *
-// * The trajectory is assumed to be a helix in a constant field *
-// * taken at the mid point of the step. *
-// * Parameters: *
-// * input *
-// * STEP =arc length of the step asked *
-// * VECT =input vector (position,direction cos and momentum) *
-// * CHARGE= electric charge of the particle *
-// * output *
-// * VOUT = same as VECT after completion of the step *
-// * *
-// * ==>Called by : <USER>, GUSWIM *
-// * Author m.hansroul ********* *
-// * modified s.egli, s.v.levonian *
-// * modified v.perevoztchikov
-// * *
-// ******************************************************************
-//
+/// ******************************************************************
+/// * *
+/// * Performs the tracking of one step in a magnetic field *
+/// * The trajectory is assumed to be a helix in a constant field *
+/// * taken at the mid point of the step. *
+/// * Parameters: *
+/// * input *
+/// * STEP =arc length of the step asked *
+/// * VECT =input vector (position,direction cos and momentum) *
+/// * CHARGE= electric charge of the particle *
+/// * output *
+/// * VOUT = same as VECT after completion of the step *
+/// * *
+/// * ==>Called by : <USER>, GUSWIM *
+/// * Author m.hansroul ********* *
+/// * modified s.egli, s.v.levonian *
+/// * modified v.perevoztchikov
+/// * *
+/// ******************************************************************
// modif: everything in double precision
void AliMUONTrackParam::ExtrapOneStepHelix3(Double_t field, Double_t step,
Double_t *vect, Double_t *vout) const
{
-//
-// ******************************************************************
-// * *
-// * Tracking routine in a constant field oriented *
-// * along axis 3 *
-// * Tracking is performed with a conventional *
-// * helix step method *
-// * *
-// * ==>Called by : <USER>, GUSWIM *
-// * Authors R.Brun, M.Hansroul ********* *
-// * Rewritten V.Perevoztchikov
-// * *
-// ******************************************************************
-//
+/// ******************************************************************
+/// * *
+/// * Tracking routine in a constant field oriented *
+/// * along axis 3 *
+/// * Tracking is performed with a conventional *
+/// * helix step method *
+/// * *
+/// * ==>Called by : <USER>, GUSWIM *
+/// * Authors R.Brun, M.Hansroul ********* *
+/// * Rewritten V.Perevoztchikov
+/// * *
+/// ******************************************************************
Double_t hxp[3];
Double_t h4, hp, rho, tet;
void AliMUONTrackParam::ExtrapOneStepRungekutta(Double_t charge, Double_t step,
Double_t* vect, Double_t* vout) const
{
-//
-// ******************************************************************
-// * *
-// * Runge-Kutta method for tracking a particle through a magnetic *
-// * field. Uses Nystroem algorithm (See Handbook Nat. Bur. of *
-// * Standards, procedure 25.5.20) *
-// * *
-// * Input parameters *
-// * CHARGE Particle charge *
-// * STEP Step size *
-// * VECT Initial co-ords,direction cosines,momentum *
-// * Output parameters *
-// * VOUT Output co-ords,direction cosines,momentum *
-// * User routine called *
-// * CALL GUFLD(X,F) *
-// * *
-// * ==>Called by : <USER>, GUSWIM *
-// * Authors R.Brun, M.Hansroul ********* *
-// * V.Perevoztchikov (CUT STEP implementation) *
-// * *
-// * *
-// ******************************************************************
-//
+/// ******************************************************************
+/// * *
+/// * Runge-Kutta method for tracking a particle through a magnetic *
+/// * field. Uses Nystroem algorithm (See Handbook Nat. Bur. of *
+/// * Standards, procedure 25.5.20) *
+/// * *
+/// * Input parameters *
+/// * CHARGE Particle charge *
+/// * STEP Step size *
+/// * VECT Initial co-ords,direction cosines,momentum *
+/// * Output parameters *
+/// * VOUT Output co-ords,direction cosines,momentum *
+/// * User routine called *
+/// * CALL GUFLD(X,F) *
+/// * *
+/// * ==>Called by : <USER>, GUSWIM *
+/// * Authors R.Brun, M.Hansroul ********* *
+/// * V.Perevoztchikov (CUT STEP implementation) *
+/// * *
+/// * *
+/// ******************************************************************
Double_t h2, h4, f[4];
Double_t xyzt[3], a, b, c, ph,ph2;
//___________________________________________________________
void AliMUONTrackParam::GetField(Double_t *Position, Double_t *Field) const
{
- // interface to "gAlice->Field()->Field" for arguments in double precision
-
+ /// interface for arguments in double precision (Why ? ChF)
Float_t x[3], b[3];
x[0] = Position[0]; x[1] = Position[1]; x[2] = Position[2];
- gAlice->Field()->Field(x, b);
+ fkField->Field(x, b);
Field[0] = b[0]; Field[1] = b[1]; Field[2] = b[2];
return;
}
+//_____________________________________________-
+void AliMUONTrackParam::Print(Option_t* opt) const
+{
+ /// Printing TrackParam information
+ /// "full" option for printing all the information about the TrackParam
+ TString sopt(opt);
+ sopt.ToUpper();
+
+ if ( sopt.Contains("FULL") ) {
+ cout << "<AliMUONTrackParam> Bending P=" << setw(5) << setprecision(3) << 1./GetInverseBendingMomentum() <<
+ ", NonBendSlope=" << setw(5) << setprecision(3) << GetNonBendingSlope()*180./TMath::Pi() <<
+ ", BendSlope=" << setw(5) << setprecision(3) << GetBendingSlope()*180./TMath::Pi() <<
+ ", (x,y,z)_IP=(" << setw(5) << setprecision(3) << GetNonBendingCoor() <<
+ "," << setw(5) << setprecision(3) << GetBendingCoor() <<
+ "," << setw(5) << setprecision(3) << GetZ() <<
+ ") cm, (px,py,pz)=(" << setw(5) << setprecision(3) << Px() <<
+ "," << setw(5) << setprecision(3) << Py() <<
+ "," << setw(5) << setprecision(3) << Pz() << ") GeV/c" << endl;
+ }
+ else {
+ cout << "<AliMUONTrackParam>" << endl;
+ }
+
+}