Improvement of muon reconstruction by extrapolating trackParam to real z of clusters
authorcussonno <cussonno@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 7 Oct 2004 08:38:03 +0000 (08:38 +0000)
committercussonno <cussonno@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 7 Oct 2004 08:38:03 +0000 (08:38 +0000)
MUON/AliMUONEventReconstructor.cxx
MUON/AliMUONSegment.cxx
MUON/AliMUONSegment.h
MUON/AliMUONTrack.cxx
MUON/AliMUONTrack.h
MUON/AliMUONTrackHit.cxx
MUON/AliMUONTrackHit.h

index 6a76ad0..11b7613 100644 (file)
@@ -228,13 +228,13 @@ void AliMUONEventReconstructor::SetReconstructionParametersToDefaults(void)
   // scaled to the real distance between chambers in a station
   fSegmentMaxDistBending[0] = TMath::Abs( 1.5 *
     ((&(pMUON->Chamber(1)))->Z() - (&(pMUON->Chamber(0)))->Z()) / 20.0);
-  fSegmentMaxDistBending[1] =  TMath::Abs( 1.5 *
+  fSegmentMaxDistBending[1] = TMath::Abs( 1.5 *
     ((&(pMUON->Chamber(3)))->Z() - (&(pMUON->Chamber(2)))->Z()) / 20.0);
-  fSegmentMaxDistBending[2] =  TMath::Abs( 3.0 *
+  fSegmentMaxDistBending[2] = TMath::Abs( 3.0 *
     ((&(pMUON->Chamber(5)))->Z() - (&(pMUON->Chamber(4)))->Z()) / 20.0);
-  fSegmentMaxDistBending[3] =  TMath::Abs( 6.0 *
+  fSegmentMaxDistBending[3] = TMath::Abs( 6.0 *
     ((&(pMUON->Chamber(7)))->Z() - (&(pMUON->Chamber(6)))->Z()) / 20.0);
-  fSegmentMaxDistBending[4] =  TMath::Abs( 6.0 *
+  fSegmentMaxDistBending[4] = TMath::Abs( 6.0 *
     ((&(pMUON->Chamber(9)))->Z() - (&(pMUON->Chamber(8)))->Z()) / 20.0);
   
   fBendingResolution = fgkDefaultBendingResolution;
@@ -869,7 +869,6 @@ void AliMUONEventReconstructor::MakeSegmentsPerStation(Int_t Station)
   Bool_t last2st;
   Double_t bendingSlope, distBend, distNonBend, extBendCoor, extNonBendCoor,
       impactParam = 0., maxImpactParam = 0., minImpactParam = 0.; // =0 to avoid compilation warnings.
-  AliMUON *pMUON  = (AliMUON*) gAlice->GetModule("MUON"); // necessary ????
   if (fPrintLevel >= 1)
     cout << "enter MakeSegmentsPerStation (0...) " << Station << endl;
   // first and second chambers (0...) in the station
@@ -889,8 +888,7 @@ void AliMUONEventReconstructor::MakeSegmentsPerStation(Int_t Station)
   else last2st = kFALSE;
   // extrapolation factor from Z of first chamber to Z of second chamber
   // dZ to be changed to take into account fine structure of chambers ????
-  Double_t extrapFact =
-    (&(pMUON->Chamber(ch2)))->Z() / (&(pMUON->Chamber(ch1)))->Z();
+  Double_t extrapFact;
   // index for current segment
   Int_t segmentIndex = 0;
   // Loop over HitsForRec in the first chamber of the station
@@ -902,8 +900,6 @@ void AliMUONEventReconstructor::MakeSegmentsPerStation(Int_t Station)
     // extrapolation,
     // on the straight line joining the HitForRec to the vertex (0,0,0),
     // to the Z of the second chamber of the station
-    extBendCoor = extrapFact * hit1Ptr->GetBendingCoor();
-    extNonBendCoor = extrapFact * hit1Ptr->GetNonBendingCoor();
     // Loop over HitsForRec in the second chamber of the station
     for (Int_t hit2 = fIndexOfFirstHitForRecPerChamber[ch2];
         hit2 < fIndexOfFirstHitForRecPerChamber[ch2] + fNHitsForRecPerChamber[ch2];
@@ -913,6 +909,9 @@ void AliMUONEventReconstructor::MakeSegmentsPerStation(Int_t Station)
       // absolute values of distances, in bending and non bending planes,
       // between the HitForRec in the second chamber
       // and the previous extrapolation
+      extrapFact = hit2Ptr->GetZ()/ hit1Ptr->GetZ();
+      extBendCoor = extrapFact * hit1Ptr->GetBendingCoor();
+      extNonBendCoor = extrapFact * hit1Ptr->GetNonBendingCoor();
       distBend = TMath::Abs(hit2Ptr->GetBendingCoor() - extBendCoor);
       distNonBend = TMath::Abs(hit2Ptr->GetNonBendingCoor() - extNonBendCoor);
       if (last2st) {
@@ -1110,7 +1109,8 @@ Int_t AliMUONEventReconstructor::MakeTrackCandidatesWithTwoSegments(AliMUONSegme
   // the first segment being pointed to by "BegSegment".
   // Returns the number of such track candidates.
   Int_t endStation, iEndSegment, nbCan2Seg;
-  AliMUONSegment *endSegment, *extrapSegment;
+  AliMUONSegment *endSegment;
+  AliMUONSegment *extrapSegment = NULL;
   AliMUONTrack *recTrack;
   Double_t mcsFactor;
   if (fPrintLevel >= 1) cout << "enter MakeTrackCandidatesWithTwoSegments" << endl;
@@ -1121,8 +1121,6 @@ Int_t AliMUONEventReconstructor::MakeTrackCandidatesWithTwoSegments(AliMUONSegme
     GetBendingMomentumFromImpactParam(BegSegment->GetBendingImpact());
   mcsFactor    = fChamberThicknessInX0 * mcsFactor * mcsFactor;
   // linear extrapolation to end station
-  extrapSegment =
-    BegSegment->CreateSegmentFromLinearExtrapToStation(endStation, mcsFactor);
   // number of candidates with 2 segments to 0
   nbCan2Seg = 0;
   // Loop over segments in the end station
@@ -1131,6 +1129,8 @@ Int_t AliMUONEventReconstructor::MakeTrackCandidatesWithTwoSegments(AliMUONSegme
     endSegment = (AliMUONSegment*) ((*fSegmentsPtr[endStation])[iEndSegment]);
     // test compatibility between current segment and "extrapSegment"
     // 4 because 4 quantities in chi2
+    extrapSegment =
+      BegSegment->CreateSegmentFromLinearExtrapToStation(endSegment->GetZ(), mcsFactor);
     if ((endSegment->
         NormalizedChi2WithSegment(extrapSegment,
                                   fMaxSigma2Distance)) <= 4.0) {
@@ -1162,7 +1162,8 @@ Int_t AliMUONEventReconstructor::MakeTrackCandidatesWithOneSegmentAndOnePoint(Al
   // in stations(1..) 4 and 5,
   // the segment being pointed to by "BegSegment".
   Int_t ch, ch1, ch2, endStation, iHit, iHitMax, iHitMin, nbCan1Seg1Hit;
-  AliMUONHitForRec *extrapHitForRec, *hit;
+  AliMUONHitForRec *extrapHitForRec= NULL;
+  AliMUONHitForRec *hit;
   AliMUONTrack *recTrack;
   Double_t mcsFactor;
   if (fPrintLevel >= 1)
@@ -1180,9 +1181,6 @@ Int_t AliMUONEventReconstructor::MakeTrackCandidatesWithOneSegmentAndOnePoint(Al
   nbCan1Seg1Hit = 0;
   // Loop over chambers of the end station
   for (ch = ch2; ch >= ch1; ch--) {
-    // linear extrapolation to chamber
-    extrapHitForRec =
-      BegSegment->CreateHitForRecFromLinearExtrapToChamber(ch, mcsFactor);
     // limits for the hit index in the loop
     iHitMin = fIndexOfFirstHitForRecPerChamber[ch];
     iHitMax = iHitMin + fNHitsForRecPerChamber[ch];
@@ -1192,6 +1190,9 @@ Int_t AliMUONEventReconstructor::MakeTrackCandidatesWithOneSegmentAndOnePoint(Al
       hit = (AliMUONHitForRec*) ((*fHitsForRecPtr)[iHit]);
       // test compatibility between current HitForRec and "extrapHitForRec"
       // 2 because 2 quantities in chi2
+      // linear extrapolation to chamber
+      extrapHitForRec =
+       BegSegment->CreateHitForRecFromLinearExtrapToChamber( hit->GetZ(), mcsFactor);
       if ((hit->
           NormalizedChi2WithHitForRec(extrapHitForRec,
                                       fMaxSigma2Distance)) <= 2.0) {
@@ -1257,8 +1258,8 @@ void AliMUONEventReconstructor::FollowTracks(void)
 {
   // Follow tracks in stations(1..) 3, 2 and 1
   // too long: should be made more modular !!!!
-  AliMUONHitForRec *bestHit, *extrapHit, *extrapCorrHit, *hit;
-  AliMUONSegment *bestSegment, *extrapSegment, *extrapCorrSegment, *segment;
+  AliMUONHitForRec *bestHit, *extrapHit, *hit;
+  AliMUONSegment *bestSegment, *extrapSegment, *segment;
   AliMUONTrack *track, *nextTrack;
   AliMUONTrackParam *trackParam1, trackParam[2], trackParamVertex;
   // -1 to avoid compilation warnings
@@ -1299,7 +1300,6 @@ void AliMUONEventReconstructor::FollowTracks(void)
       // extrapolation to station
       trackParam1->ExtrapToStation(station, trackParam);
       extrapSegment = new AliMUONSegment(); //  empty segment
-      extrapCorrSegment = new AliMUONSegment(); //  empty corrected segment
       // multiple scattering factor corresponding to one chamber
       // and momentum in bending plane (not total)
       mcsFactor = 0.0136 * trackParam1->GetInverseBendingMomentum();
@@ -1319,14 +1319,6 @@ void AliMUONEventReconstructor::FollowTracks(void)
       extrapSegment->UpdateFromStationTrackParam
        (trackParam, mcsFactor, dZ1, dZ2, dZ3, station,
         trackParam1->GetInverseBendingMomentum());
-      // same thing for corrected segment
-      // better to use copy constructor, after checking that it works properly !!!!
-      extrapCorrSegment->SetBendingCoorReso2(fBendingResolution * fBendingResolution);
-      extrapCorrSegment->
-       SetNonBendingCoorReso2(fNonBendingResolution * fNonBendingResolution);
-      extrapCorrSegment->UpdateFromStationTrackParam
-       (trackParam, mcsFactor, dZ1, dZ2, dZ3, station,
-        trackParam1->GetInverseBendingMomentum());
       bestChi2 = 5.0;
       bestSegment = NULL;
       if (fPrintLevel >= 10) {
@@ -1342,18 +1334,14 @@ void AliMUONEventReconstructor::FollowTracks(void)
        segment = (AliMUONSegment*) ((*fSegmentsPtr[station])[iSegment]);
        // correction of corrected segment (fBendingCoor and fNonBendingCoor)
        // according to real Z value of "segment" and slopes of "extrapSegment"
-       extrapCorrSegment->
-         SetBendingCoor(extrapSegment->GetBendingCoor() +
-                        extrapSegment->GetBendingSlope() *
-                        (segment->GetHitForRec1()->GetZ() -
-                         (&(pMUON->Chamber(2 * station)))->Z()));
-       extrapCorrSegment->
-         SetNonBendingCoor(extrapSegment->GetNonBendingCoor() +
-                           extrapSegment->GetNonBendingSlope() *
-                           (segment->GetHitForRec1()->GetZ() -
-                            (&(pMUON->Chamber(2 * station)))->Z()));
+       (&(trackParam[0]))->ExtrapToZ(segment->GetZ());
+       (&(trackParam[1]))->ExtrapToZ(segment->GetZ());
+       extrapSegment->SetBendingCoor((&(trackParam[0]))->GetBendingCoor());
+       extrapSegment->SetNonBendingCoor((&(trackParam[0]))->GetNonBendingCoor());
+       extrapSegment->SetBendingSlope((&(trackParam[0]))->GetBendingSlope());
+       extrapSegment->SetNonBendingSlope((&(trackParam[0]))->GetNonBendingSlope());
        chi2 = segment->
-         NormalizedChi2WithSegment(extrapCorrSegment, maxSigma2Distance);
+         NormalizedChi2WithSegment(extrapSegment, maxSigma2Distance);
        if (chi2 < bestChi2) {
          // update best Chi2 and Segment if better found
          bestSegment = segment;
@@ -1362,6 +1350,8 @@ void AliMUONEventReconstructor::FollowTracks(void)
       }
       if (bestSegment) {
        // best segment found: add it to track candidate
+       (&(trackParam[0]))->ExtrapToZ(bestSegment->GetZ());
+       (&(trackParam[1]))->ExtrapToZ(bestSegment->GetZ());
        track->AddSegment(bestSegment);
        // set track parameters at these two TrakHit's
        track->SetTrackParamAtHit(track->GetNTrackHits() - 2, &(trackParam[0]));
@@ -1378,7 +1368,6 @@ void AliMUONEventReconstructor::FollowTracks(void)
        // should consider all possibilities ????
        // multiple scattering ???? do about like for extrapSegment !!!!
        extrapHit = new AliMUONHitForRec(); //  empty hit
-       extrapCorrHit = new AliMUONHitForRec(); //  empty corrected hit
        bestChi2 = 3.0;
        bestHit = NULL;
        if (fPrintLevel >= 10) {
@@ -1388,41 +1377,22 @@ void AliMUONEventReconstructor::FollowTracks(void)
        }
        // Loop over chambers of the station
        for (chInStation = 0; chInStation < 2; chInStation++) {
-         // coordinates of extrapolated hit
-         extrapHit->
-           SetBendingCoor((&(trackParam[chInStation]))->GetBendingCoor());
-         extrapHit->
-           SetNonBendingCoor((&(trackParam[chInStation]))->GetNonBendingCoor());
-         // resolutions from "extrapSegment"
-         extrapHit->SetBendingReso2(extrapSegment->GetBendingCoorReso2());
-         extrapHit->SetNonBendingReso2(extrapSegment->GetNonBendingCoorReso2());
-         // same things for corrected hit
-         // better to use copy constructor, after checking that it works properly !!!!
-         extrapCorrHit->
-           SetBendingCoor((&(trackParam[chInStation]))->GetBendingCoor());
-         extrapCorrHit->
-           SetNonBendingCoor((&(trackParam[chInStation]))->GetNonBendingCoor());
-         extrapHit->SetBendingReso2(extrapSegment->GetBendingCoorReso2());
-         extrapHit->SetNonBendingReso2(extrapSegment->GetNonBendingCoorReso2());
-         // Loop over hits in the chamber
          ch = 2 * station + chInStation;
          for (iHit = fIndexOfFirstHitForRecPerChamber[ch];
               iHit < fIndexOfFirstHitForRecPerChamber[ch] +
                 fNHitsForRecPerChamber[ch];
               iHit++) {
            hit = (AliMUONHitForRec*) ((*fHitsForRecPtr)[iHit]);
-           // correction of corrected hit (fBendingCoor and fNonBendingCoor)
-           // according to real Z value of "hit" and slopes of right "trackParam"
-           extrapCorrHit->
-             SetBendingCoor((&(trackParam[chInStation]))->GetBendingCoor() +
-                            (&(trackParam[chInStation]))->GetBendingSlope() *
-                            (hit->GetZ() -
-                             (&(trackParam[chInStation]))->GetZ()));
-           extrapCorrHit->
-             SetNonBendingCoor((&(trackParam[chInStation]))->GetNonBendingCoor() +
-                               (&(trackParam[chInStation]))->GetNonBendingSlope() *
-                               (hit->GetZ() -
-                                (&(trackParam[chInStation]))->GetZ()));
+           // coordinates of extrapolated hit
+           (&(trackParam[chInStation]))->ExtrapToZ(hit->GetZ());
+           extrapHit->
+             SetBendingCoor((&(trackParam[chInStation]))->GetBendingCoor());
+           extrapHit->
+             SetNonBendingCoor((&(trackParam[chInStation]))->GetNonBendingCoor());
+           // resolutions from "extrapSegment"
+           extrapHit->SetBendingReso2(extrapSegment->GetBendingCoorReso2());
+           extrapHit->SetNonBendingReso2(extrapSegment->GetNonBendingCoorReso2());
+           // Loop over hits in the chamber
            // condition for hit not already in segment ????
            chi2 = hit->NormalizedChi2WithHitForRec(extrapHit, maxSigma2Distance);
            if (chi2 < bestChi2) {
@@ -1435,6 +1405,7 @@ void AliMUONEventReconstructor::FollowTracks(void)
        }
        if (bestHit) {
          // best hit found: add it to track candidate
+         (&(trackParam[chBestHit]))->ExtrapToZ(bestHit->GetZ());
          track->AddHitForRec(bestHit);
          // set track parameters at this TrackHit
          track->SetTrackParamAtHit(track->GetNTrackHits() - 1,
@@ -1450,17 +1421,13 @@ void AliMUONEventReconstructor::FollowTracks(void)
          // and corresponding TrackHit's, ...
          track->Remove();
          delete extrapSegment;
-         delete extrapCorrSegment;
          delete extrapHit;
-         delete extrapCorrHit;
          break; // stop the search for this candidate:
          // exit from the loop over station
        }
        delete extrapHit;
-       delete extrapCorrHit;
       }
       delete extrapSegment;
-      delete extrapCorrSegment;
       // Sort track hits according to increasing Z
       track->GetTrackHitsPtr()->Sort();
       // Update track parameters at first track hit (smallest Z)
index a4f1a89..134d5cf 100644 (file)
@@ -57,6 +57,7 @@ AliMUONSegment::AliMUONSegment()
   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
 }
@@ -78,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;
@@ -175,7 +177,7 @@ Double_t AliMUONSegment::NormalizedChi2WithSegment(AliMUONSegment* Segment, Doub
 }
 
   //__________________________________________________________________________
-AliMUONSegment* AliMUONSegment::CreateSegmentFromLinearExtrapToStation (Int_t Station, Double_t MCSfactor) const
+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"
@@ -188,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
@@ -219,7 +220,7 @@ AliMUONSegment* AliMUONSegment::CreateSegmentFromLinearExtrapToStation (Int_t St
 }
 
   //__________________________________________________________________________
-AliMUONHitForRec* AliMUONSegment::CreateHitForRecFromLinearExtrapToChamber (Int_t Chamber, Double_t MCSfactor) const
+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"
@@ -230,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
@@ -319,6 +319,8 @@ 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"
index e912024..f91c386 100644 (file)
@@ -37,13 +37,15 @@ class AliMUONSegment : public TObject
   void SetBendingCoorReso2(Double_t BendingCoorReso2) {fBendingCoorReso2 = BendingCoorReso2;}
   Double_t GetNonBendingCoorReso2(void) const {return fNonBendingCoorReso2;}
   void SetNonBendingCoorReso2(Double_t NonBendingCoorReso2) {fNonBendingCoorReso2 = NonBendingCoorReso2;}
+  Double_t GetZ(void) const {return fZ;}
+  
   Double_t GetBendingImpact(void) const {return fBendingImpact;}
   Bool_t GetInTrack(void) const {return fInTrack;}
   void SetInTrack(Bool_t InTrack) {fInTrack = InTrack;}
 
-  AliMUONSegment* CreateSegmentFromLinearExtrapToStation (Int_t Station, Double_t MCSfactor) const;
+  AliMUONSegment* CreateSegmentFromLinearExtrapToStation (Double_t z, Double_t MCSfactor) const;
   Double_t NormalizedChi2WithSegment(AliMUONSegment* Segment, Double_t Sigma2Cut) const;
-  AliMUONHitForRec* CreateHitForRecFromLinearExtrapToChamber (Int_t Chamber, Double_t MCSfactor) const;
+  AliMUONHitForRec* CreateHitForRecFromLinearExtrapToChamber (Double_t z, Double_t MCSfactor) const;
   void UpdateFromStationTrackParam(AliMUONTrackParam *TrackParam, Double_t MCSfactor, Double_t Dz1, Double_t Dz2, Double_t Dz3, Int_t Station, Double_t InverseMomentum);
 
   // What is necessary for sorting TClonesArray's; sufficient too ????
@@ -73,6 +75,7 @@ class AliMUONSegment : public TObject
   Double_t fNonBendingSlopeReso2; // Covariance(slope)
   Double_t fNonBendingCoorSlopeReso2; // Covariance(C1,slope)
   Double_t fNonBendingImpact; // Impact parameter in non bending plane
+  Double_t fZ;                // Z of the segment
   Bool_t fInTrack; // TRUE if segment belongs to one track
   
   ClassDef(AliMUONSegment, 1) // Segment for reconstruction in ALICE dimuon spectrometer
index 998e651..0337518 100644 (file)
@@ -60,7 +60,7 @@ AliMUONTrack::AliMUONTrack()
   // Default constructor
   fgFitter = 0;
   fEventReconstructor = 0;
-  fTrackHitsPtr = 0;
+  fTrackHitsPtr = new TObjArray(10);
   fTrackParamAtHit = new TClonesArray("AliMUONTrackParam",10);  
 }
 
@@ -138,8 +138,21 @@ AliMUONTrack::AliMUONTrack (const AliMUONTrack& theMUONTrack)
                               // and AliMUONTrack is not the owner of its EventReconstructor 
   fEventReconstructor = theMUONTrack.fEventReconstructor;
   fTrackParamAtVertex = theMUONTrack.fTrackParamAtVertex;
-  fTrackHitsPtr     =  new TObjArray(*theMUONTrack.fTrackHitsPtr);  // is it right ?
-  fTrackParamAtHit  =  new TClonesArray(*theMUONTrack.fTrackParamAtHit);
+
+ // necessary to make a copy of the objects and not only the pointers in TObjArray.
+  fTrackHitsPtr  =  new TObjArray(10);
+  for (Int_t index = 0; index < (theMUONTrack.fTrackHitsPtr)->GetEntriesFast(); index++) {
+    AliMUONTrackHit *trackHit = new AliMUONTrackHit(*(AliMUONTrackHit*)(theMUONTrack.fTrackHitsPtr)->At(index));
+    fTrackHitsPtr->Add(trackHit);
+  }
+
+  // necessary to make a copy of the objects and not only the pointers in TClonesArray.
+  fTrackParamAtHit  =  new TClonesArray("AliMUONTrackParam",10);
+  for (Int_t index = 0; index < (theMUONTrack.fTrackParamAtHit)->GetEntriesFast(); index++) {
+    {new ((*fTrackParamAtHit)[fTrackParamAtHit->GetEntriesFast()]) 
+       AliMUONTrackParam(*(AliMUONTrackParam*)(theMUONTrack.fTrackParamAtHit)->At(index));}
+  }
+
   fNTrackHits       =  theMUONTrack.fNTrackHits;
   fFitMCS           =  theMUONTrack.fFitMCS;
   fFitNParam        =  theMUONTrack.fFitNParam;
@@ -164,8 +177,21 @@ AliMUONTrack & AliMUONTrack::operator=(const AliMUONTrack& theMUONTrack)
                                // is it right ? NO because it would use dummy copy constructor
   fEventReconstructor =  theMUONTrack.fEventReconstructor;
   fTrackParamAtVertex =  theMUONTrack.fTrackParamAtVertex;
-  fTrackHitsPtr       =  new TObjArray(*theMUONTrack.fTrackHitsPtr); // is it right ?
-  fTrackParamAtHit    =  new TClonesArray(*theMUONTrack.fTrackParamAtHit);
+
+ // necessary to make a copy of the objects and not only the pointers in TObjArray.
+  fTrackHitsPtr  =  new TObjArray(10);
+  for (Int_t index = 0; index < (theMUONTrack.fTrackHitsPtr)->GetEntriesFast(); index++) {
+    AliMUONTrackHit *trackHit = new AliMUONTrackHit(*(AliMUONTrackHit*)(theMUONTrack.fTrackHitsPtr)->At(index));
+    fTrackHitsPtr->Add(trackHit);
+  }
+
+  // necessary to make a copy of the objects and not only the pointers in TClonesArray.
+  fTrackParamAtHit  =  new TClonesArray("AliMUONTrackParam",10);
+  for (Int_t index = 0; index < (theMUONTrack.fTrackParamAtHit)->GetEntriesFast(); index++) {
+    {new ((*fTrackParamAtHit)[fTrackParamAtHit->GetEntriesFast()]) 
+       AliMUONTrackParam(*(AliMUONTrackParam*)(theMUONTrack.fTrackParamAtHit)->At(index));}
+  }
+
   fNTrackHits         =  theMUONTrack.fNTrackHits;
   fFitMCS             =  theMUONTrack.fFitMCS;
   fFitNParam          =  theMUONTrack.fFitNParam;
index 593f984..57a89e9 100644 (file)
@@ -41,6 +41,7 @@ class AliMUONTrack : public TObject
   void SetTrackParamAtVertex(void); // Set track parameters at vertex from last stations 4 & 5
   void SetTrackParamAtVertex(AliMUONTrackParam* TrackParam) {fTrackParamAtVertex = *TrackParam;}
   TClonesArray *GetTrackParamAtHit(void) const {return fTrackParamAtHit;}
+  void ResetTrackParamAtHit(void) { fTrackParamAtHit->Delete(); }
   void AddTrackParamAtHit(const AliMUONTrackParam *trackParam) 
     {new ((*fTrackParamAtHit)[fTrackParamAtHit->GetEntriesFast()]) AliMUONTrackParam(*trackParam);}
 
index e8ae95b..e94748d 100644 (file)
@@ -39,7 +39,33 @@ AliMUONTrackHit::AliMUONTrackHit()
   fNextTrackHitWithSameHitForRec = 0;
   fPrevTrackHitWithSameHitForRec = 0;
 }
+  //__________________________________________________________________________
+AliMUONTrackHit::AliMUONTrackHit (const AliMUONTrackHit& theMUONTrackHit)
+  :  TObject(theMUONTrackHit)
+{
+  fTrackParam                    =  theMUONTrackHit.fTrackParam;
+  fHitForRecPtr                  =  theMUONTrackHit.fHitForRecPtr;
+  fNextTrackHitWithSameHitForRec =  theMUONTrackHit.fNextTrackHitWithSameHitForRec;
+  fPrevTrackHitWithSameHitForRec =  theMUONTrackHit.fPrevTrackHitWithSameHitForRec;
+}
+  //__________________________________________________________________________
+AliMUONTrackHit & AliMUONTrackHit::operator=(const AliMUONTrackHit& theMUONTrackHit)
+{
+  // check assignement to self
+  if (this == &theMUONTrackHit)
+    return *this;
 
+  // base class assignement
+  TObject::operator=(theMUONTrackHit);
+
+  fTrackParam                    =  theMUONTrackHit.fTrackParam;
+  fHitForRecPtr                  =  theMUONTrackHit.fHitForRecPtr;
+  fNextTrackHitWithSameHitForRec = theMUONTrackHit.fNextTrackHitWithSameHitForRec;
+  fPrevTrackHitWithSameHitForRec = theMUONTrackHit.fPrevTrackHitWithSameHitForRec;
+
+  return *this;
+
+}
   //__________________________________________________________________________
 AliMUONTrackHit::AliMUONTrackHit(AliMUONHitForRec* Hit)
 {
@@ -60,28 +86,6 @@ AliMUONTrackHit::AliMUONTrackHit(AliMUONHitForRec* Hit)
 }
 
   //__________________________________________________________________________
-AliMUONTrackHit::AliMUONTrackHit (const AliMUONTrackHit& theMUONTrackHit)
-  : TObject(theMUONTrackHit)
-{
-// Protected copy constructor
-
-  Fatal("AliMUONTrackHit", "Not implemented.");
-}
-
-  //__________________________________________________________________________
-AliMUONTrackHit & AliMUONTrackHit::operator=(const AliMUONTrackHit& rhs)
-{
-// Protected assignement operator
-
-  if (this == &rhs) return *this;
-
-  Fatal("operator=", "Not implemented.");
-    
-  return *this;  
-}
-
-
-  //__________________________________________________________________________
 AliMUONTrackHit::~AliMUONTrackHit()
 {
   // Destructor
index e9669cb..c83c541 100644 (file)
@@ -20,6 +20,8 @@ class AliMUONTrackHit : public TObject
  public:
   AliMUONTrackHit(); // Constructor
   virtual ~AliMUONTrackHit(); // Destructor
+  AliMUONTrackHit (const AliMUONTrackHit& AliMUONTrackHit); // copy constructor
+  AliMUONTrackHit& operator=(const AliMUONTrackHit& AliMUONTrackHit); // assignment operator
   AliMUONTrackHit(AliMUONHitForRec* Hit); // Constructor from one HitForRec
 
   // Inline functions for Get and Set
@@ -33,9 +35,6 @@ class AliMUONTrackHit : public TObject
     return kTRUE; }
   Int_t Compare(const TObject* TrackHit) const; // "Compare" function for sorting
 
- protected:
-  AliMUONTrackHit (const AliMUONTrackHit& AliMUONTrackHit); // copy constructor
-  AliMUONTrackHit& operator=(const AliMUONTrackHit& AliMUONTrackHit); // assignment operator
 
  private:
   void SetNextTrackHitWithSameHitForRec(AliMUONTrackHit *Next) {fNextTrackHitWithSameHitForRec = Next;}