The description of changes:
[u/mrichter/AliRoot.git] / MUON / AliMUONTrack.cxx
index f1e32e0..3b98ce7 100644 (file)
@@ -61,7 +61,8 @@ AliMUONTrack::AliMUONTrack()
     fTrackID(-1),
     fTrackParamAtVertex(0x0),
     fHitsPatternInTrigCh(0),
-    fLocalTrigger(0)
+    fLocalTrigger(0),
+    fConnected(kFALSE)
 {
   /// Default constructor
   fVertexErrXY2[0] = 0.;
@@ -84,7 +85,8 @@ AliMUONTrack::AliMUONTrack(AliMUONObjectPair *segment, Double_t bendingVertexDis
     fTrackID(-1),
     fTrackParamAtVertex(0x0),
     fHitsPatternInTrigCh(0),
-    fLocalTrigger(0)
+    fLocalTrigger(0),
+    fConnected(kFALSE)
 {
   /// Constructor from two clusters
   
@@ -192,7 +194,8 @@ AliMUONTrack::AliMUONTrack(const AliMUONTrack& track)
     fTrackID(track.fTrackID),
     fTrackParamAtVertex(0x0),
     fHitsPatternInTrigCh(track.fHitsPatternInTrigCh),
-    fLocalTrigger(track.fLocalTrigger)
+    fLocalTrigger(track.fLocalTrigger),
+    fConnected(track.fConnected)
 {
   ///copy constructor
   
@@ -276,6 +279,7 @@ AliMUONTrack & AliMUONTrack::operator=(const AliMUONTrack& track)
   fTrackID            =  track.fTrackID; 
   fHitsPatternInTrigCh = track.fHitsPatternInTrigCh;
   fLocalTrigger        = track.fLocalTrigger;
+  fConnected          =  track.fConnected;
 
   return *this;
 }
@@ -320,6 +324,7 @@ void AliMUONTrack::Reset()
   fTrackID = -1;
   fHitsPatternInTrigCh = 0;
   fLocalTrigger = 0;
+  fConnected = kFALSE;
   delete fTrackParamAtCluster; fTrackParamAtCluster = 0x0;
   delete fClusterWeightsNonBending; fClusterWeightsNonBending = 0x0;
   delete fClusterWeightsBending; fClusterWeightsBending = 0x0;
@@ -1003,56 +1008,43 @@ void AliMUONTrack::ComputeMCSCovariances(TMatrixD& mcsCovariances) const
 }
 
   //__________________________________________________________________________
-Int_t AliMUONTrack::ClustersInCommon(AliMUONTrack* track) const
+Int_t AliMUONTrack::ClustersInCommon(AliMUONTrack* track, Int_t stMin, Int_t stMax) const
 {
-  /// Returns the number of clusters in common between the current track ("this")
-  /// and the track pointed to by "track".
-  if (!fTrackParamAtCluster || !this->fTrackParamAtCluster) return 0;
-  Int_t nCluster1 = this->GetNClusters();
-  Int_t nCluster2 = track->GetNClusters();
-  Int_t clustersInCommon = 0;
-  AliMUONTrackParam *trackParamAtCluster1, *trackParamAtCluster2;
-  // Loop over clusters of first track
-  for(Int_t iCluster1 = 0; iCluster1 < nCluster1; iCluster1++) {
-    trackParamAtCluster1 = (AliMUONTrackParam*) this->fTrackParamAtCluster->UncheckedAt(iCluster1);
-    // Loop over clusters of second track
-    for(Int_t iCluster2 = 0; iCluster2 < nCluster2; iCluster2++) {
-      trackParamAtCluster2 = (AliMUONTrackParam*) track->fTrackParamAtCluster->UncheckedAt(iCluster2);
-      // Increment "clustersInCommon" if both trackParamAtCluster1 & 2 point to the same cluster
-      if ((trackParamAtCluster1->GetClusterPtr()) == (trackParamAtCluster2->GetClusterPtr())) {
-       clustersInCommon++;
-       break;
-      }
-    }
-  }
-  return clustersInCommon;
-}
-
-  //__________________________________________________________________________
-Int_t AliMUONTrack::ClustersInCommonInSt345(AliMUONTrack* track) const
-{
-  /// Returns the number of clusters in common on stations 3, 4 and 5
+  /// Returns the number of clusters in common in stations [stMin, stMax]
   /// between the current track ("this") and the track pointed to by "track".
+  
   if (!fTrackParamAtCluster || !this->fTrackParamAtCluster) return 0;
-  Int_t nCluster1 = this->GetNClusters();
-  Int_t nCluster2 = track->GetNClusters();
+  
+  Int_t chMin = 2 * stMin;
+  Int_t chMax = 2 * stMax + 1;
   Int_t clustersInCommon = 0;
-  AliMUONTrackParam *trackParamAtCluster1, *trackParamAtCluster2;
+  
   // Loop over clusters of first track
-  for(Int_t iCluster1 = 0; iCluster1 < nCluster1; iCluster1++) {
-    trackParamAtCluster1 = (AliMUONTrackParam*) this->fTrackParamAtCluster->UncheckedAt(iCluster1);
-    if (trackParamAtCluster1->GetClusterPtr()->GetChamberId() < 4) continue;
+  Int_t nCl1 = this->GetNClusters();
+  for(Int_t iCl1 = 0; iCl1 < nCl1; iCl1++) {
+    AliMUONVCluster* cl1 = ((AliMUONTrackParam*) this->fTrackParamAtCluster->UncheckedAt(iCl1))->GetClusterPtr();
+    
+    Int_t chCl1 = cl1->GetChamberId();
+    if (chCl1 < chMin || chCl1 > chMax) continue;
+    
     // Loop over clusters of second track
-    for(Int_t iCluster2 = 0; iCluster2 < nCluster2; iCluster2++) {
-      trackParamAtCluster2 = (AliMUONTrackParam*) track->fTrackParamAtCluster->UncheckedAt(iCluster2);
-      if (trackParamAtCluster2->GetClusterPtr()->GetChamberId() < 4) continue;
-      // Increment "clustersInCommon" if both trackParamAtCluster1 & 2 point to the same cluster
-      if ((trackParamAtCluster1->GetClusterPtr()) == (trackParamAtCluster2->GetClusterPtr())) {
+    Int_t nCl2 = track->GetNClusters();
+    for(Int_t iCl2 = 0; iCl2 < nCl2; iCl2++) {
+      AliMUONVCluster* cl2 = ((AliMUONTrackParam*) track->fTrackParamAtCluster->UncheckedAt(iCl2))->GetClusterPtr();
+      
+      Int_t chCl2 = cl2->GetChamberId();
+      if (chCl2 < chMin || chCl2 > chMax) continue;
+      
+      // Increment "clustersInCommon" if both clusters have the same ID
+      if (cl1->GetUniqueID() == cl2->GetUniqueID()) {
        clustersInCommon++;
        break;
       }
+      
     }
+    
   }
+  
   return clustersInCommon;
 }