]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONHitForRec.cxx
Put index into track's name instead of its label.
[u/mrichter/AliRoot.git] / MUON / AliMUONHitForRec.cxx
index 5f98fad7a4a6df4f658c2c551bb57f294c3d161d..16345388b7aa17993e09f5efa8f64ed6cb6f3c9d 100644 (file)
 
 /* $Id$ */
 
-//__________________________________________________________________________
-//
+//-----------------------------------------------------------------------------
+// Class AliMUONHitForRec
+// ------------------------
 // Hit for reconstruction in ALICE dimuon spectrometer
-//__________________________________________________________________________
+// Author: J. Gosset
+//-----------------------------------------------------------------------------
 
 #include "AliMUONHitForRec.h" 
-#include "AliMUONTrackParam.h" 
-#include "AliMUONRawCluster.h"
-#include "AliMUONHit.h"
+#include "AliMUONVCluster.h"
+#include "AliMUONConstants.h"
+#include "AliLog.h"
+#include "TMath.h"
+#include "Riostream.h"
 
+/// \cond CLASSIMP
 ClassImp(AliMUONHitForRec) // Class implementation in ROOT context
+/// \endcond
 
   //__________________________________________________________________________
-AliMUONHitForRec::AliMUONHitForRec(AliMUONHit* Ghit)
+AliMUONHitForRec::AliMUONHitForRec()
+  : TObject(),
+    fBendingCoor(0.),
+    fNonBendingCoor(0.),
+    fZ(0.),
+    fBendingReso2(0.),
+    fNonBendingReso2(0.),
+    fChamberNumber(0),
+    fDetElemId(0),
+    fHitNumber(0),
+    fTTRTrack(0),
+    fTrackRefSignal(0),
+    fNTrackHits(0)
 {
-  // Constructor for AliMUONHitForRec from a GEANT hit.
-  // Fills the bending, non bending, and Z coordinates,
-  // which are taken from the coordinates of the GEANT hit,
-  // the track number (GEANT and not TH),
-  // and the chamber number (0...).
-  fBendingCoor = Ghit->Y();
-  fNonBendingCoor = Ghit->X();
-  fZ = Ghit->Z();
-  // fTrack = Ghit->fTrack; ?????????
-  fChamberNumber = Ghit->Chamber() - 1;
-  // other fields will be updated in
-  // AliMUONEventReconstructor::NewHitForRecFromGEANT,
-  // except the following ones
-  fIndexOfFirstSegment = -1;
-  fNSegments = 0;
-  fFirstTrackHitPtr = fLastTrackHitPtr = NULL;
-  fNTrackHits = 0;
-  return;
+/// Default Constructor
 }
 
-//   //__________________________________________________________________________
-// AliMUONHitForRec::AliMUONHitForRec(AliMUONReconstHit* CathCorrel)
-// {
-//   // Constructor for AliMUONHitForRec from a (cathode correlated) raw cluster.
-//   // Fills the bending and non bending coordinates.
-//   // Only the first correlation is taken into account.
-//   // The bending coordinate is taken from the first cathode.
-//   // The non bending coordinate is taken 
-//   // from the second cathode if it exists,
-//   // from the first one otherwise.
-//   fBendingCoor = CathCorrel->fY[3];
-//   if (CathCorrel->fCorrelIndex[0] >= 0) fNonBendingCoor = CathCorrel->fX[0];
-//   else fNonBendingCoor = CathCorrel->fX[3];
-//   return;
-// }
-
   //__________________________________________________________________________
-AliMUONHitForRec::AliMUONHitForRec(AliMUONRawCluster* RawCluster)
+AliMUONHitForRec::AliMUONHitForRec(AliMUONVCluster* theRawCluster)
+  : TObject(),
+    fBendingCoor(theRawCluster->GetY()),
+    fNonBendingCoor(theRawCluster->GetX()),
+    fZ(0.),
+    fBendingReso2(0.),
+    fNonBendingReso2(0.),
+    fChamberNumber(0),
+    fDetElemId(theRawCluster->GetDetElemId()),
+    fHitNumber(0),
+    fTTRTrack(-1),
+    fTrackRefSignal(-1),
+    fNTrackHits(0)
 {
-  // Constructor for AliMUONHitForRec from a raw cluster.
-  // Fills the bending and non bending coordinates.
-  fNonBendingCoor = RawCluster->GetX(0);
-  fBendingCoor = RawCluster->GetY(0);
+/// Constructor for AliMUONHitForRec from a raw cluster.
+/// Fills the bending and non bending coordinates.
+
   // other fields will be updated in
   // AliMUONEventReconstructor::AddHitsForRecFromRawClusters,
-  // except the following ones
-  fTHTrack = -1;
-  fGeantSignal = -1;
-  fIndexOfFirstSegment = -1;
-  fNSegments = 0;
-  fFirstTrackHitPtr = fLastTrackHitPtr = NULL;
-  fNTrackHits = 0;
   return;
 }
 
-AliMUONHitForRec::AliMUONHitForRec (const AliMUONHitForRec& MUONHitForRec):TObject(MUONHitForRec)
+  //__________________________________________________________________________
+AliMUONHitForRec::AliMUONHitForRec (const AliMUONHitForRec& theMUONHitForRec)
+  : TObject(theMUONHitForRec),
+    fBendingCoor(theMUONHitForRec.fBendingCoor),
+    fNonBendingCoor(theMUONHitForRec.fNonBendingCoor),
+    fZ(theMUONHitForRec.fZ),
+    fBendingReso2(theMUONHitForRec.fBendingReso2),
+    fNonBendingReso2(theMUONHitForRec.fNonBendingReso2),
+    fChamberNumber(theMUONHitForRec.fChamberNumber),
+    fDetElemId(theMUONHitForRec.fDetElemId),
+    fHitNumber(theMUONHitForRec.fHitNumber),
+    fTTRTrack(theMUONHitForRec.fTTRTrack),
+    fTrackRefSignal(theMUONHitForRec.fTrackRefSignal),
+    fNTrackHits(theMUONHitForRec.fNTrackHits)
+{
+/// Copy constructor
+
+}
+
+  //__________________________________________________________________________
+AliMUONHitForRec::~AliMUONHitForRec()
 {
-// Dummy copy constructor
+/// Destructor
 }
 
-AliMUONHitForRec & AliMUONHitForRec::operator=(const AliMUONHitForRec& /*MUONHitForRec*/)
+  //__________________________________________________________________________
+AliMUONHitForRec & AliMUONHitForRec::operator=(const AliMUONHitForRec& theMUONHitForRec)
 {
-// Dummy assignment operator
-    return *this;
+/// Assignment operator
+
+  fBendingCoor = theMUONHitForRec.fBendingCoor;
+  fNonBendingCoor = theMUONHitForRec.fNonBendingCoor;
+  fZ = theMUONHitForRec.fZ;
+  fBendingReso2 = theMUONHitForRec.fBendingReso2;
+  fNonBendingReso2 = theMUONHitForRec.fNonBendingReso2;
+  fChamberNumber = theMUONHitForRec.fChamberNumber;
+  fDetElemId = theMUONHitForRec.fDetElemId;
+  fHitNumber = theMUONHitForRec.fHitNumber;
+  fTTRTrack = theMUONHitForRec.fTTRTrack;
+  fTrackRefSignal = theMUONHitForRec.fTrackRefSignal;
+  fNTrackHits = theMUONHitForRec.fNTrackHits;
+  return *this;
 }
   //__________________________________________________________________________
 /*AZ
@@ -110,40 +133,55 @@ Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
   //__________________________________________________________________________
 Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
 {
-  // "Compare" function to sort with decreasing Z-coordinate (spectro. MUON z<0).
-  // Returns 1 (0, -1) if Z-coordinate of current HitForRec
-  // is smaller than (equal to, larger than) Z-coordinate of Hit
+/// "Compare" function to sort with decreasing Z-coordinate (spectro. MUON z<0).
+/// Returns 1 (0, -1) if Z-coordinate of current HitForRec
+/// is smaller than (equal to, larger than) Z-coordinate of Hit
+
   if (fZ <  ((AliMUONHitForRec*)Hit)->fZ) return(1);
   else if (fZ == ((AliMUONHitForRec*)Hit)->fZ) return( 0);
   else return(-1);
 }
 
   //__________________________________________________________________________
-Double_t AliMUONHitForRec::NormalizedChi2WithHitForRec(AliMUONHitForRec* HitForRec, Double_t Sigma2Cut)
+Double_t AliMUONHitForRec::NormalizedChi2WithHitForRec(AliMUONHitForRec* hitForRec, Double_t Sigma2Cut) const
 {
-  // Calculate the normalized Chi2 between the current HitForRec (this)
-  // and the HitForRec pointed to by "HitForRec",
-  // i.e. the square deviations between the coordinates,
-  // in both the bending and the non bending plane,
-  // divided by the variance of the same quantities and by "Sigma2Cut".
-  // Returns 3 if none of the 2 quantities is OK,
-  // something smaller than or equal to 2 otherwise.
-  // Would it be more correct to use a real chi square
-  // including the non diagonal term ????
+/// Calculate the normalized Chi2 between the current hitForRec (this) and the hitForRec pointed to by "hitForRec",
+/// i.e. the square deviations between the coordinates, in both the bending and the non bending plane,
+/// divided by the variance of the same quantities and by "Sigma2Cut".
+/// Returns 3 if none of the 2 quantities is OK, something smaller than or equal to 2 otherwise.
+/// Would it be more correct to use a real chi square including the non diagonal term ????
+
   Double_t chi2, chi2Max, diff, normDiff;
   chi2 = 0.0;
   chi2Max = 3.0;
   // coordinate in bending plane
-  diff = this->fBendingCoor - HitForRec->fBendingCoor;
-  normDiff = diff * diff /
-    (this->fBendingReso2 + HitForRec->fBendingReso2) / Sigma2Cut;
+  diff = fBendingCoor - hitForRec->fBendingCoor;
+  normDiff = diff * diff / (fBendingReso2 + hitForRec->fBendingReso2) / Sigma2Cut;
   if (normDiff > 1.0) return chi2Max;
   chi2 = chi2 + normDiff;
   // coordinate in non bending plane
-  diff = this->fNonBendingCoor - HitForRec->fNonBendingCoor;
-  normDiff = diff * diff /
-    (this->fNonBendingReso2 + HitForRec->fNonBendingReso2) / Sigma2Cut;
+  diff = fNonBendingCoor - hitForRec->fNonBendingCoor;
+  normDiff = diff * diff / (fNonBendingReso2 + hitForRec->fNonBendingReso2) / Sigma2Cut;
   if (normDiff > 1.0) return chi2Max;
   chi2 = chi2 + normDiff;
   return chi2;
 }
+
+//______________________________________________________________________________
+void
+AliMUONHitForRec::Print(Option_t* /*opt*/) const
+{
+/// Printing
+
+  cout << "<AliMUONHitForRec> Coordinates (B,NB,Z) = (" 
+  << setw(8) << setprecision(5) << fBendingCoor
+  << "," << setw(8) << setprecision(5) << fNonBendingCoor << "," 
+  << setw(8) << setprecision(5) << fZ << ") "
+  << "Reso (B,NB)=(" << setw(8) << setprecision(5) << TMath::Sqrt(fBendingReso2) 
+  << "," << setw(8) << setprecision(5) << TMath::Sqrt(fNonBendingReso2)
+  << ") " 
+  << "Number " << setw(3) << fHitNumber 
+  << " within chamber " << setw(3) <<fChamberNumber 
+  << " DE " << setw(4) << fDetElemId
+  << endl;
+}