]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONSegment.cxx
- Revised comments and adapted them for Doxygen
[u/mrichter/AliRoot.git] / MUON / AliMUONSegment.cxx
index 01671570e80cc2e02eb63c71086850806c7e275b..d7e52f36476428dbfe2ebac99e3e2031acb6589c 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.3  2000/06/25 13:06:39  hristov
-Inline functions moved from *.cxx to *.h files instead of forward declarations
+/* $Id$ */
 
-Revision 1.2  2000/06/15 07:58:48  morsch
-Code from MUON-dev joined
-
-Revision 1.1.2.4  2000/06/12 10:10:21  morsch
-Dummy copy constructor and assignment operator added
-
-Revision 1.1.2.3  2000/06/09 21:01:16  morsch
-Make includes consistent with new file structure.
-
-Revision 1.1.2.2  2000/06/09 12:58:05  gosset
-Removed comment beginnings in Log sections of .cxx files
-Suppressed most violations of coding rules
-
-Revision 1.1.2.1  2000/06/07 14:44:53  gosset
-Addition of files for track reconstruction in C++
-*/
-
-//__________________________________________________________________________
+///////////////////////////////////////////////////////////
 //
-// Segment for reconstruction in ALICE dimuon spectrometer:
+// Segment for reconstruction
+// in 
+// ALICE 
+// dimuon 
+// spectrometer:
 // two hits for reconstruction in the two chambers of one station
-//__________________________________________________________________________
+//
+///////////////////////////////////////////////////////////
 
 #include "AliMUONSegment.h" 
-
 #include "AliMUON.h"
 #include "AliMUONHitForRec.h" 
 #include "AliMUONTrackParam.h" 
-#include "AliMUONChamber.h" 
-#include "AliRun.h"
+#include "AliRun.h" // for gAlice
+#include "AliLog.h" 
 
 ClassImp(AliMUONSegment) // Class implementation in ROOT context
 
+  //__________________________________________________________________________
+AliMUONSegment::AliMUONSegment()
+  : TObject()
+{
+  // Default constructor
+  fHitForRecPtr1 = 0; // pointer to HitForRec in first chamber
+  fHitForRecPtr2 = 0; // pointer to HitForRec in second chamber
+  // Bending plane:
+  fBendingCoor = 0.0; // Coordinate in bending plane
+  fBendingSlope = 0.0; // Slope in bending plane
+  // Covariance in bending plane:
+  fBendingCoorReso2 = 0.0; // Covariance(coordinate C1 in first chamber)
+  fBendingSlopeReso2 = 0.0; // Covariance(slope)
+  fBendingCoorSlopeReso2 = 0.0; // Covariance(C1,slope)
+  fBendingImpact = 0.0; // Impact parameter in bending plane
+  // Non Bending plane:
+  fNonBendingCoor = 0.0; // Coordinate in non bending plane
+  fNonBendingSlope = 0.0; // Slope in non bending plane
+  // Covariance in non bending plane:
+  fNonBendingCoorReso2 = 0.0; // Covariance(coordinate C1 in first chamber)
+  fNonBendingSlopeReso2 = 0.0; // Covariance(slope)
+  fNonBendingCoorSlopeReso2 = 0.0; // Covariance(C1,slope)
+  fZ = 0.0; // z in first plane
+  fNonBendingImpact = 0.0; // Impact parameter in non bending plane
+  fInTrack = kFALSE; // TRUE if segment belongs to one track
+}
+
   //__________________________________________________________________________
 AliMUONSegment::AliMUONSegment(AliMUONHitForRec* Hit1, AliMUONHitForRec* Hit2)
+  : TObject()
 {
   // Constructor for AliMUONSegment from two HitForRec's,
   // one, in the first chamber of the station, pointed to by "Hit1",
@@ -67,6 +79,7 @@ AliMUONSegment::AliMUONSegment(AliMUONHitForRec* Hit1, AliMUONHitForRec* Hit2)
   fHitForRecPtr1 = Hit1;
   fHitForRecPtr2 = Hit2;
   dz = Hit1->GetZ() - Hit2->GetZ();
+  fZ = Hit1->GetZ();
   // bending plane
   fBendingCoor = Hit1->GetBendingCoor();
   fBendingSlope = (fBendingCoor - Hit2->GetBendingCoor()) / dz;
@@ -88,33 +101,41 @@ AliMUONSegment::AliMUONSegment(AliMUONHitForRec* Hit1, AliMUONHitForRec* Hit2)
   return;
 }
 
-AliMUONSegment::AliMUONSegment (const AliMUONSegment& MUONSegment)
+AliMUONSegment::AliMUONSegment (const AliMUONSegment& theMUONSegment)
+  : TObject(theMUONSegment)
 {
-// Dummy copy constructor
+// Protected copy constructor
+
+  AliFatal("Not implemented.");
 }
 
-AliMUONSegment & AliMUONSegment::operator=(const AliMUONSegment& MUONSegment)
+AliMUONSegment & AliMUONSegment::operator=(const AliMUONSegment& rhs)
 {
-// Dummy assignment operator
-    return *this;
+// Protected assignement operator
+
+  if (this == &rhs) return *this;
+
+  AliFatal("Not implemented.");
+    
+  return *this;  
 }
 
   //__________________________________________________________________________
-Int_t AliMUONSegment::Compare(TObject* Segment)
+Int_t AliMUONSegment::Compare(const TObject* Segment) const
 {
   // "Compare" function to sort with increasing absolute value
   // of the "impact parameter" in bending plane.
   // Returns -1 (0, +1) if |impact parameter| of current Segment
   // is smaller than (equal to, larger than) |impact parameter| of Segment
-  if (TMath::Abs(((AliMUONSegment*)this)->fBendingSlope)
-      < TMath::Abs(((AliMUONSegment*)Segment)->fBendingSlope))
+  if (TMath::Abs(((AliMUONSegment*)this)->fBendingImpact)
+      < TMath::Abs(((AliMUONSegment*)Segment)->fBendingImpact))
     return(-1);
   // continuous parameter, hence no need for testing equal case
   else return(+1);
 }
 
   //__________________________________________________________________________
-Double_t AliMUONSegment::NormalizedChi2WithSegment(AliMUONSegment* Segment, Double_t Sigma2Cut)
+Double_t AliMUONSegment::NormalizedChi2WithSegment(AliMUONSegment* Segment, Double_t Sigma2Cut) const
 {
   // Calculate the normalized Chi2 between the current Segment (this)
   // and the Segment pointed to by "Segment",
@@ -156,7 +177,7 @@ Double_t AliMUONSegment::NormalizedChi2WithSegment(AliMUONSegment* Segment, Doub
 }
 
   //__________________________________________________________________________
-AliMUONSegment* AliMUONSegment::CreateSegmentFromLinearExtrapToStation (Int_t Station, Double_t MCSfactor)
+AliMUONSegment* AliMUONSegment::CreateSegmentFromLinearExtrapToStation ( Double_t z, Double_t MCSfactor) const
 {
   // Extrapolates linearly the current Segment (this) to station (0..) "Station".
   // Multiple Coulomb scattering calculated from "MCSfactor"
@@ -169,10 +190,9 @@ AliMUONSegment* AliMUONSegment::CreateSegmentFromLinearExtrapToStation (Int_t St
   // The caller has the responsibility to delete this object.
   AliMUONSegment* extrapSegment = new AliMUONSegment(); // creates empty new segment
   // dZ from first hit of current Segment to first chamber of station "Station"
-  AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ????
-  Double_t dZ =
-    (&(pMUON->Chamber(2 * Station)))->Z() - (this->fHitForRecPtr1)->GetZ();
+  Double_t dZ =  z - this->GetZ();
   // Data in bending plane
+  extrapSegment->fZ = z;
   //  coordinate
   extrapSegment->fBendingCoor = this->fBendingCoor + this->fBendingSlope * dZ;
   //  slope
@@ -200,7 +220,7 @@ AliMUONSegment* AliMUONSegment::CreateSegmentFromLinearExtrapToStation (Int_t St
 }
 
   //__________________________________________________________________________
-AliMUONHitForRec* AliMUONSegment::CreateHitForRecFromLinearExtrapToChamber (Int_t Chamber, Double_t MCSfactor)
+AliMUONHitForRec* AliMUONSegment::CreateHitForRecFromLinearExtrapToChamber ( Double_t z, Double_t MCSfactor) const
 {
   // Extrapolates linearly the current Segment (this) to chamber(0..) "Chamber".
   // Multiple Coulomb scattering calculated from "MCSfactor"
@@ -211,10 +231,9 @@ AliMUONHitForRec* AliMUONSegment::CreateHitForRecFromLinearExtrapToChamber (Int_
   // The caller has the responsibility to delete this object.
   AliMUONHitForRec* extrapHitForRec = new AliMUONHitForRec(); // creates empty new HitForRec
   // dZ from first hit of current Segment to chamber
-  AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ????
-  Double_t dZ =
-    (&(pMUON->Chamber(Chamber)))->Z() - (this->fHitForRecPtr1)->GetZ();
+  Double_t dZ = z - this->GetZ();
   // Data in bending plane
+  extrapHitForRec->SetZ(z);
   //  coordinate
   extrapHitForRec->SetBendingCoor(this->fBendingCoor + this->fBendingSlope * dZ);
   //  covariance, including multiple Coulomb scattering over dZ due to one chamber
@@ -232,7 +251,7 @@ AliMUONHitForRec* AliMUONSegment::CreateHitForRecFromLinearExtrapToChamber (Int_
 }
 
   //__________________________________________________________________________
-void AliMUONSegment::UpdateFromStationTrackParam(AliMUONTrackParam *TrackParam, Double_t MCSfactor, Double_t Dz1, Double_t Dz2, Double_t Dz3, Int_t Station, Double_t InverseMomentum)
+void AliMUONSegment::UpdateFromStationTrackParam(AliMUONTrackParam *TrackParam, Double_t /*MCSfactor*/, Double_t /*Dz1*/, Double_t /*Dz2*/, Double_t /*Dz3*/, Int_t Station, Double_t InverseMomentum)
 {
   // Fill data members with values calculated from the array of track parameters
   // pointed to by "TrackParam" (index = 0 and 1 for first and second chambers
@@ -253,18 +272,27 @@ void AliMUONSegment::UpdateFromStationTrackParam(AliMUONTrackParam *TrackParam,
   // The "road" is parametrized from the old reco_muon.F
   // with 8 cm between stations.
   AliMUONTrackParam *param0;
-  Double_t cReso2, sReso2;
+//   Double_t cReso2, sReso2;
   // parameters to define the widths of the searching roads in station 0,1,2
   // width = p0 + p1/ (momentum)^2
   //                  station number:        0         1          2
-  static Double_t p0BendingCoor[3] =     { 6.43e-2, 1.64e-2,   0.034 };   
-  static Double_t p1BendingCoor[3] =     {    986.,    821.,    446. };  
-  static Double_t p0BendingSlope[3] =    { 3.54e-6, 3.63e-6,  3.6e-6 };  
-  static Double_t p1BendingSlope[3] =    { 4.49e-3,  4.8e-3,   0.011 };  
-  static Double_t p0NonBendingCoor[3] =  { 4.66e-2, 4.83e-2,   0.049 };   
-  static Double_t p1NonBendingCoor[3] =  {   1444.,    866.,    354. };  
-  static Double_t p0NonBendingSlope[3] = { 6.14e-4, 6.49e-4, 6.85e-4 };  
-  static Double_t p1NonBendingSlope[3] = {      0.,      0.,      0. };  
+//   static Double_t p0BendingCoor[3] =     { 6.43e-2, 1.64e-2,   0.034 };   
+//   static Double_t p1BendingCoor[3] =     {    986.,    821.,    446. };  
+//   static Double_t p0BendingSlope[3] =    { 3.54e-6, 3.63e-6,  3.6e-6 };  
+//   static Double_t p1BendingSlope[3] =    { 4.49e-3,  4.8e-3,   0.011 };  
+//   static Double_t p0NonBendingCoor[3] =  { 4.66e-2, 4.83e-2,   0.049 };   
+//   static Double_t p1NonBendingCoor[3] =  {   1444.,    866.,    354. };  
+//   static Double_t p0NonBendingSlope[3] = { 6.14e-4, 6.49e-4, 6.85e-4 };  
+//   static Double_t p1NonBendingSlope[3] = {      0.,      0.,      0. };
+  
+  static Double_t p0BendingCoor[3] =     { 6.43e-2, 6.43e-2,   6.43e-2  };   
+  static Double_t p1BendingCoor[3] =     {    986.,    986.,       986. };  
+  static Double_t p0BendingSlope[3] =    {   3.6e-6,   3.6e-6,     3.6e-6  };  
+  static Double_t p1BendingSlope[3] =    {  1.1e-2,  1.1e-2,    1.1e-2  };  
+  static Double_t p0NonBendingCoor[3] =  {   0.049,   0.049,     0.049  };   
+  static Double_t p1NonBendingCoor[3] =  {   1444.,   1444.,      1444. };  
+  static Double_t p0NonBendingSlope[3] = {   6.8e-4,   6.8e-4,     6.8e-4  };  
+  static Double_t p1NonBendingSlope[3] = {      0.,      0.,         0. };  
   param0 = &(TrackParam[0]);
 
 // OLD version
@@ -291,20 +319,22 @@ void AliMUONSegment::UpdateFromStationTrackParam(AliMUONTrackParam *TrackParam,
   fNonBendingCoor = param0->GetNonBendingCoor(); // coordinate
   fNonBendingSlope = param0->GetNonBendingSlope(); // slope
 
+  fZ = param0->GetZ(); // z
+
   // Resolutions
   // cReso2 and sReso2 have to be subtracted here from the parametrization
   // because they are added in the functions "NormalizedChi2WithSegment"
   // and "NormalizedChi2WithHitForRec"
   // Bending plane
-  cReso2 = fBendingCoorReso2;
-  sReso2 = (2. * cReso2 )/ (Dz3*Dz3) ;
-  fBendingCoorReso2 = p0BendingCoor[Station] + p1BendingCoor[Station]*InverseMomentum*InverseMomentum - cReso2;
-  fBendingSlopeReso2 = p0BendingSlope[Station] + p1BendingSlope[Station]*InverseMomentum*InverseMomentum - sReso2;
+//   cReso2 = fBendingCoorReso2;
+//   sReso2 = (2. * cReso2 )/ (Dz3*Dz3) ;
+  fBendingCoorReso2 = p0BendingCoor[Station] + p1BendingCoor[Station]*InverseMomentum*InverseMomentum ;  // - cReso2
+  fBendingSlopeReso2 = p0BendingSlope[Station] + p1BendingSlope[Station]*InverseMomentum*InverseMomentum; //  - sReso2;
   // Non bending plane
-  cReso2 = fNonBendingCoorReso2;
-  sReso2 =  (2. * cReso2 )/ (Dz3*Dz3) ;
-  fNonBendingCoorReso2 = p0NonBendingCoor[Station] + p1NonBendingCoor[Station]*InverseMomentum*InverseMomentum - cReso2;
-  fNonBendingSlopeReso2 = p0NonBendingSlope[Station] + p1NonBendingSlope[Station]*InverseMomentum*InverseMomentum - sReso2;
+//   cReso2 = fNonBendingCoorReso2;
+//   sReso2 =  (2. * cReso2 )/ (Dz3*Dz3) ;
+  fNonBendingCoorReso2 = p0NonBendingCoor[Station] + p1NonBendingCoor[Station]*InverseMomentum*InverseMomentum; // - cReso2;
+  fNonBendingSlopeReso2 = p0NonBendingSlope[Station] + p1NonBendingSlope[Station]*InverseMomentum*InverseMomentum; //  - sReso2;
   return;
 }