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 eec6ed0d3a221f76bf3a341e72fd1ceb31398180..d28fd049e98b7c9524d21707d34384dd887f37b2 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 ad4b10dc5bee7d5711ef630ca915a8905dcf6d40..873ade34af2962c7fdda6ed08cabcb724b92bab5 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 f0ad603c2b4fac19eed86652477137b2dec040ff..2661f2d783c3746e751f5b56b245f7c0f9947082 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 f07a7e24501b0c0847b6b159d59e42dbfb93e2fc..090f17891dc36db830289b220726c635aa5e8dde 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 7ef11015ffc8b44b2307b87838e685a9dd7828c4..bf9127e309908b62d396948b5e24bd748ae8edee 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 4462c58931e6e6e74d8a46bfdfa5aeab46be3649..0df437540c140d89dc45de0b045883562877e964 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 f537eba9d36ddb23d9d17874bafed12538c27d77..73d450a46fb827a15f83064fa0e349731bef5dde 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 62ebbdedaf2e39a66f98e1fe998495fa30507635..77c6d3d3003714579d3de96480813d23d3fb9ea2 100644 (file)
@@ -104,6 +104,40 @@ AliExternalTrackParam::AliExternalTrackParam(Double_t x, Double_t alpha,
   CheckCovariance();
 }
 
+//_____________________________________________________________________________
+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(),
index e0f4b1669ddcfa47c930a05d535376bc24cb07a6..d6a7f193a1d081108a6c184753aa7ef39f06dbc2 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];}