Fixes for #87003: Drift velocity calibration + Bug in the AliExternalTrackParam ...
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 27 Sep 2011 12:45:08 +0000 (12:45 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 27 Sep 2011 12:45:08 +0000 (12:45 +0000)
PWG1/TRD/info/AliTRDtrackInfo.cxx
PWG3/vertexingHF/AliAODRecoDecayHF.cxx
PWG3/vertexingHF/AliAnalysisTaskSEImproveITS.cxx
PWG4/UserTasks/EmcalTasks/AliAnalysisTaskEMCALPi0PbPb.cxx
STEER/AOD/AliAODRecoDecay.cxx
STEER/AOD/AliAODTrack.cxx
STEER/ESD/AliVertexerTracks.cxx
STEER/STEERBase/AliExternalTrackParam.cxx
STEER/STEERBase/AliExternalTrackParam.h

index eec6ed0..d28fd04 100644 (file)
@@ -306,8 +306,9 @@ AliTRDtrackInfo::AliESDinfo& AliTRDtrackInfo::AliESDinfo::operator=(const AliESD
   if(esd.fOP){
     if(fOP){
       fOP->~AliExternalTrackParam();
-      new(fOP) AliExternalTrackParam(esd.fOP);
-    } else fOP = new AliExternalTrackParam(esd.fOP);
+      // RS: Constructor from VTrack was used instead of Constructor from AliExternalTrackParam
+      new(fOP) AliExternalTrackParam(*esd.fOP);
+    } else fOP = new AliExternalTrackParam(*esd.fOP);
   } else fOP = NULL;
 
   return *this;
index ad4b10d..873ade3 100644 (file)
@@ -314,16 +314,14 @@ void AliAODRecoDecayHF::RecalculateImpPars(AliAODVertex *vtxAODNew,AliAODEvent*
   //
   // now recalculate the daughters impact parameters
   //
-  AliExternalTrackParam *etp = 0;
   Double_t dz[2],covdz[3];
   for(Int_t i=0; i<GetNDaughters(); i++) {
     AliAODTrack *t = (AliAODTrack*)GetDaughter(i);
-    etp = new AliExternalTrackParam(t);
-    if(etp->PropagateToDCA(vtxAODNew,aod->GetMagneticField(),3.,dz,covdz)) {
+    AliExternalTrackParam etp; etp.CopyFromVTrack(t);
+    if(etp.PropagateToDCA(vtxAODNew,aod->GetMagneticField(),3.,dz,covdz)) {
       fd0[i]    = dz[0];
       fd0err[i] = TMath::Sqrt(covdz[0]);
     }
-    delete etp; etp=NULL;
   }
 
   return;
index f0ad603..2661f2d 100644 (file)
@@ -216,9 +216,9 @@ void AliAnalysisTaskSEImproveITS::UserExec(Option_t*) {
 
       // recalculate vertices
       AliVVertex *oldSecondaryVertex=decay->GetSecondaryVtx();
-      AliExternalTrackParam et1(static_cast<AliAODTrack*>(decay->GetDaughter(0)));
-      AliExternalTrackParam et2(static_cast<AliAODTrack*>(decay->GetDaughter(1)));
-      AliExternalTrackParam et3(static_cast<AliAODTrack*>(decay->GetDaughter(2)));
+      AliExternalTrackParam et1; et1.CopyFromVTrack(static_cast<AliAODTrack*>(decay->GetDaughter(0)));
+      AliExternalTrackParam et2; et2.CopyFromVTrack(static_cast<AliAODTrack*>(decay->GetDaughter(1)));
+      AliExternalTrackParam et3; et3.CopyFromVTrack(static_cast<AliAODTrack*>(decay->GetDaughter(2)));
       TObjArray ta123,ta12,ta23;
       ta123.Add(&et1);ta123.Add(&et2);ta123.Add(&et3);
       ta12. Add(&et1);ta12 .Add(&et2);
@@ -287,7 +287,7 @@ void AliAnalysisTaskSEImproveITS::SmearTrack(AliAODTrack *track,const TClonesArr
     return;
 
   // Get reconstructed track parameters
-  AliExternalTrackParam et(track);
+  AliExternalTrackParam et; et.CopyFromVTrack(track);
   Double_t *param=const_cast<Double_t*>(et.GetParameter());
 //TODO:  Double_t *covar=const_cast<Double_t*>(et.GetCovariance());
 
index f07a7e2..090f178 100644 (file)
@@ -1059,8 +1059,11 @@ void AliAnalysisTaskEMCALPi0PbPb::CalcClusterProps()
           AliESDtrack *esdTrack = static_cast<AliESDtrack*>(track);
           tParam = new AliExternalTrackParam(*esdTrack->GetTPCInnerParam());
          dedx = esdTrack->GetTPCsignal();
-        } else 
-          tParam = new AliExternalTrackParam(track);
+        } 
+       else {  
+          tParam = new AliExternalTrackParam();
+         tParam->CopyFromVTrack(track);
+       }
 
         Double_t bfield[3] = {0};
         track->GetBxByBz(bfield);
@@ -1083,7 +1086,7 @@ void AliAnalysisTaskEMCALPi0PbPb::CalcClusterProps()
       } else {
         if (TMath::Abs(clsEta-track->Eta())>fIsoDist)
           continue;
-        AliExternalTrackParam tParam(track);
+        AliExternalTrackParam tParam; tParam.CopyFromVTrack(track);
         if (!fReco->ExtrapolateTrackToCluster(&tParam, clus, tmpR, tmpZ))
           continue;
       }
@@ -1308,7 +1311,7 @@ void AliAnalysisTaskEMCALPi0PbPb::CalcTracks()
         continue;
 
       if (0 && (track->Pt()>=0.6) && (track->PxAtDCA()==-999)) { // compute position on EMCAL 
-        AliExternalTrackParam tParam(track);
+        AliExternalTrackParam tParam; tParam.CopyFromVTrack(track);
         if (AliTrackerBase::PropagateTrackToBxByBz(&tParam, 438, 0.139, 1, kTRUE)) {
           Double_t trkPos[3];
           tParam.GetXYZ(trkPos);
index 7ef1101..bf9127e 100644 (file)
@@ -451,7 +451,7 @@ Bool_t AliAODRecoDecay::PropagateToDCA(const AliVVertex* vtx,Double_t b,Double_t
     retval = ntp.PropagateToDCA(vtx,b,maxd,dz,covar);
   } else {
     // convert to AliExternalTrackParam
-    AliExternalTrackParam etp(this);  
+    AliExternalTrackParam etp; etp.CopyFromVTrack(this);  
     retval = etp.PropagateToDCA(vtx,b,maxd,dz,covar);
   }
   return retval;
index 4462c58..0df4375 100644 (file)
@@ -541,7 +541,7 @@ Bool_t AliAODTrack::PropagateToDCA(const AliVVertex *vtx,
   // return kFALSE is something went wrong
 
   // convert to AliExternalTrackParam
-  AliExternalTrackParam etp(this);  
+  AliExternalTrackParam etp; etp.CopyFromVTrack(this);  
 
   Float_t xstart = etp.GetX();
   if(xstart>3.) {
index f537eba..73d450a 100644 (file)
@@ -234,7 +234,7 @@ AliESDVertex* AliVertexerTracks::FindPrimaryVertex(const AliVEvent *vEvent)
       Int_t ncls0=0;
       for(Int_t l=0;l<6;l++) if(TESTBIT(track->GetITSClusterMap(),l)) ncls0++;
       if(ncls0 < fMinClusters) continue;
-      t = new AliExternalTrackParam(track);
+      t = new AliExternalTrackParam(); t->CopyFromVTrack(track);
     }
 
     // use TOF info about bunch crossing
index 62ebbde..77c6d3d 100644 (file)
@@ -105,6 +105,40 @@ AliExternalTrackParam::AliExternalTrackParam(Double_t x, Double_t alpha,
 }
 
 //_____________________________________________________________________________
+void AliExternalTrackParam::CopyFromVTrack(const AliVTrack *vTrack)
+{
+  //
+  // Recreate TrackParams from VTrack
+  // This is not a copy contructor !
+  //
+  if (!vTrack) {
+    AliError("Source VTrack is NULL");
+    return;
+  }
+  if (this==vTrack) {
+    AliError("Copy of itself is requested");
+    return;
+  }
+  //
+  if (vTrack->InheritsFrom(AliExternalTrackParam::Class())) {
+    AliDebug(1,"Source itself is AliExternalTrackParam, using assignment operator");
+    *this = *(AliExternalTrackParam*)vTrack;
+    return;
+  }
+  //
+  AliVTrack::operator=( *vTrack );
+  //
+  Double_t xyz[3],pxpypz[3],cv[21];
+  vTrack->GetXYZ(xyz);
+  pxpypz[0]=vTrack->Px();
+  pxpypz[1]=vTrack->Py();
+  pxpypz[2]=vTrack->Pz();
+  vTrack->GetCovarianceXYZPxPyPz(cv);
+  Short_t sign = (Short_t)vTrack->Charge();
+  Set(xyz,pxpypz,cv,sign);
+}
+
+//_____________________________________________________________________________
 AliExternalTrackParam::AliExternalTrackParam(const AliVTrack *vTrack) :
   AliVTrack(),
   fX(0.),
index e0f4b16..d6a7f19 100644 (file)
@@ -41,10 +41,10 @@ class AliExternalTrackParam: public AliVTrack {
   AliExternalTrackParam& operator=(const AliExternalTrackParam & trkPar);
   AliExternalTrackParam(Double_t x, Double_t alpha, 
                        const Double_t param[5], const Double_t covar[15]);
-  AliExternalTrackParam(const AliVTrack *vTrack);
   AliExternalTrackParam(Double_t xyz[3],Double_t pxpypz[3],
                        Double_t cv[21],Short_t sign);
   virtual ~AliExternalTrackParam(){}
+  void CopyFromVTrack(const AliVTrack *vTrack);
 
   template <typename T>
   void Set(T x, T alpha, const T param[5], const T covar[15]) {
@@ -234,6 +234,9 @@ class AliExternalTrackParam: public AliVTrack {
   static Bool_t  GetUseLogTermMS()                {return fgUseLogTermMS;} 
   static void    SetUseLogTermMS(Bool_t v=kTRUE)  {fgUseLogTermMS = v;} 
 
+ protected:
+  AliExternalTrackParam(const AliVTrack *vTrack);
+
 /*  protected: */
  private:
   Double_t &Par(Int_t i) {return fP[i];}