Ref to the 2Prong moved from AliAODRecoCascadeHF to AliAODVertex
authordainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 12 Jan 2009 13:11:54 +0000 (13:11 +0000)
committerdainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 12 Jan 2009 13:11:54 +0000 (13:11 +0000)
PWG3/vertexingHF/AliAODRecoCascadeHF.cxx
PWG3/vertexingHF/AliAODRecoCascadeHF.h
PWG3/vertexingHF/AliAnalysisVertexingHF.cxx
PWG3/vertexingHF/AliAnalysisVertexingHF.h

index be4926998c3b6c3f349f438fa4ec4adbf7a819d1..53de3598229b5cc80f2728e8ba9f06c38b71cbcc 100644 (file)
@@ -31,8 +31,7 @@ ClassImp(AliAODRecoCascadeHF)
 //-----------------------------------------------------------------------------
 
 AliAODRecoCascadeHF::AliAODRecoCascadeHF() :
-  AliAODRecoDecayHF2Prong(),
-  f2Prong()
+  AliAODRecoDecayHF2Prong()
 {
   //
   // Default Constructor
@@ -42,8 +41,7 @@ AliAODRecoCascadeHF::AliAODRecoCascadeHF() :
 AliAODRecoCascadeHF::AliAODRecoCascadeHF(AliAODVertex *vtx2, Short_t charge,
                                         Double_t *px, Double_t *py, Double_t *pz,
                                         Double_t *d0, Double_t *d0err, Double_t dca) :
-  AliAODRecoDecayHF2Prong(vtx2, px, py, pz, d0, d0err, dca),
-  f2Prong()
+  AliAODRecoDecayHF2Prong(vtx2, px, py, pz, d0, d0err, dca)
 {
   //
   //  Constructor with AliAODVertex for decay vertex
@@ -53,8 +51,7 @@ AliAODRecoCascadeHF::AliAODRecoCascadeHF(AliAODVertex *vtx2, Short_t charge,
 //-----------------------------------------------------------------------------
 AliAODRecoCascadeHF::AliAODRecoCascadeHF(AliAODVertex *vtx2, Short_t charge,
                                         Double_t *d0, Double_t *d0err, Double_t dca) :
-  AliAODRecoDecayHF2Prong(vtx2, d0, d0err, dca),
-  f2Prong()
+  AliAODRecoDecayHF2Prong(vtx2, d0, d0err, dca)
 {
   //
   //  Constructor with decay vertex and without prongs momenta
@@ -63,8 +60,7 @@ AliAODRecoCascadeHF::AliAODRecoCascadeHF(AliAODVertex *vtx2, Short_t charge,
 }
 //-----------------------------------------------------------------------------
 AliAODRecoCascadeHF::AliAODRecoCascadeHF(const AliAODRecoCascadeHF &source) :
-  AliAODRecoDecayHF2Prong(source),
-  f2Prong()
+  AliAODRecoDecayHF2Prong(source)
 {
   //
   // Copy constructor
@@ -80,8 +76,6 @@ AliAODRecoCascadeHF &AliAODRecoCascadeHF::operator=(const AliAODRecoCascadeHF &s
 
   AliAODRecoDecayHF2Prong::operator=(source);
 
-  f2Prong = source.f2Prong;
-
   return *this;
 }
 //-----------------------------------------------------------------------------
index 304b0e913b41a2ad78a8abd9c4b214de671450cc..be88536db4aeff0b6fff4a6062d03b5fc254cd5f 100644 (file)
@@ -33,12 +33,7 @@ class AliAODRecoCascadeHF : public AliAODRecoDecayHF2Prong {
   AliAODRecoCascadeHF& operator=(const AliAODRecoCascadeHF& source);
 
   // 2prong (D0 for Dstar)
-  void Set2Prong(TObject *the2Prong) { f2Prong = the2Prong; }
-  void Check2Prong() const { if(!f2Prong.GetObject()) printf("f2Prong not set\n"); return; }
-  // GetDaughter(1) doesn't work because the V0 and the bachelor have different 
-  // process id and they can't go to the same TRefArray
-  AliAODRecoDecayHF2Prong* Get2Prong() const { if(GetDaughter(1)) { return (AliAODRecoDecayHF2Prong*)GetDaughter(1); } else { return (AliAODRecoDecayHF2Prong*)f2Prong.GetObject(); } }
-  void Unset2Prong () { f2Prong=0; return; }
+  AliAODRecoDecayHF2Prong* Get2Prong() const {return (AliAODRecoDecayHF2Prong*)GetDaughter(1);}
 
   // Bachelor (soft pion for Dstar)
   AliAODTrack* GetBachelor() const {return (AliAODTrack*)GetDaughter(0);}
@@ -53,10 +48,7 @@ class AliAODRecoCascadeHF : public AliAODRecoDecayHF2Prong {
 
  protected:
 
-
-  TRef f2Prong; // the "V0" (e.g. D0->Kpi)
-
-  ClassDef(AliAODRecoCascadeHF, 1); // heavy-flavour cascade class
+  ClassDef(AliAODRecoCascadeHF, 2); // heavy-flavour cascade class
 };
 
 #endif
index 7040ccaa1eeaacaa676b46edc997cac3aae8d60e..a81cdd8b5a521ff4201d7b0bf7797167af5a4dac 100644 (file)
@@ -35,7 +35,7 @@
 #include "AliESDEvent.h"
 #include "AliESDVertex.h"
 #include "AliExternalTrackParam.h"
-//#include "AliNeutralTrackParam.h"
+#include "AliNeutralTrackParam.h"
 #include "AliESDtrack.h"
 #include "AliESDtrackCuts.h"
 #include "AliAODEvent.h"
@@ -330,9 +330,7 @@ void AliAnalysisVertexingHF::FindCandidates(AliVEvent *event,
            io2Prong->SetSecondaryVtx(vertexp1n1);
          }
          // create a track from the D0
-         //AliNeutralTrackParam *trackD0 = new AliNeutralTrackParam(io2Prong); // to be uncommented after commit of AliAODRecoDecay : public AliVTrack
-         AliESDtrack *trackD0 = new AliESDtrack(); // temporary, just to allow compilation
-
+         AliNeutralTrackParam *trackD0 = new AliNeutralTrackParam(io2Prong);
          // LOOP ON TRACKS THAT PASSED THE SOFT PION CUTS
          for(iTrkSoftPi=0; iTrkSoftPi<nSeleTrks; iTrkSoftPi++) {
            if(iTrkSoftPi==iTrkP1 || iTrkSoftPi==iTrkN1) continue;
@@ -348,7 +346,7 @@ void AliAnalysisVertexingHF::FindCandidates(AliVEvent *event,
            // Vertexing
            twoTrackArrayCasc->AddAt(trackPi,0);
            twoTrackArrayCasc->AddAt(trackD0,1);
-           AliAODVertex *vertexCasc = ReconstructSecondaryVertex(twoTrackArrayCasc,dispersion);
+           AliAODVertex *vertexCasc = ReconstructSecondaryVertex(twoTrackArrayCasc,dispersion,kFALSE);
            if(!vertexCasc) { 
              twoTrackArrayCasc->Clear();
              trackPi=0; 
@@ -367,10 +365,13 @@ void AliAnalysisVertexingHF::FindCandidates(AliVEvent *event,
              }
              // add the vertex and the cascade to the AOD
              AliAODVertex *vCasc = new(verticesHFRef[iVerticesHF++])AliAODVertex(*vertexCasc); 
-             if(fInputAOD) AddDaughterRefs(vCasc,event,twoTrackArrayCasc); // add the pion
-             //vCasc->AddDaughter(rd); // doesn't work, because the D0 and the bachelor have different ROOT process ID
+             if(fInputAOD) {
+               AddDaughterRefs(vCasc,event,twoTrackArrayCasc); // add the pion
+             } else {
+               vCasc->AddDaughter(rd); // just to fill ref #0 
+             }
+             vCasc->AddDaughter(rd); // add the D0 (in ref #1)
              rc = new(aodDstarRef[iDstar++])AliAODRecoCascadeHF(*ioCascade);
-             rc->Set2Prong(rd); // add the D0
              rc->SetSecondaryVtx(vCasc);
              vCasc->SetParent(rc);
            }
@@ -616,7 +617,8 @@ AliAODRecoCascadeHF* AliAnalysisVertexingHF::MakeCascade(
   //--- selection cuts
   //
   AliAODRecoCascadeHF *tmpCascade = new AliAODRecoCascadeHF(*theCascade);
-  tmpCascade->Set2Prong(rd2Prong); // this is needed for the selection
+  tmpCascade->GetSecondaryVtx()->AddDaughter(trackPi);
+  tmpCascade->GetSecondaryVtx()->AddDaughter(rd2Prong);
   AliAODVertex *primVertexAOD=0;
   if(!fRecoPrimVtxSkippingTrks && !fRmTrksFromPrimVtx) {
     // take event primary vertex
@@ -629,8 +631,8 @@ AliAODRecoCascadeHF* AliAnalysisVertexingHF::MakeCascade(
     Bool_t testD0=kTRUE;
     okDstar = tmpCascade->SelectDstar(fDstarCuts,fD0fromDstarCuts,testD0);
   }
+  tmpCascade->GetSecondaryVtx()->RemoveDaughters();
   tmpCascade->UnsetOwnPrimaryVtx(); 
-  tmpCascade->Unset2Prong(); 
   delete tmpCascade; tmpCascade=NULL;
   if(!fRecoPrimVtxSkippingTrks && !fRmTrksFromPrimVtx) {
     rd2Prong->UnsetOwnPrimaryVtx();
@@ -1126,7 +1128,7 @@ void AliAnalysisVertexingHF::PrintStatus() const {
 }
 //-----------------------------------------------------------------------------
 AliAODVertex* AliAnalysisVertexingHF::ReconstructSecondaryVertex(TObjArray *trkArray,
-                                                                Double_t &dispersion) const
+                                                                Double_t &dispersion,Bool_t useTRefArray) const
 {
   // Secondary vertex reconstruction with AliVertexerTracks or AliKFParticle
 
@@ -1175,8 +1177,8 @@ AliAODVertex* AliAnalysisVertexingHF::ReconstructSecondaryVertex(TObjArray *trkA
   dispersion = vertexESD->GetDispersion();
   delete vertexESD; vertexESD=NULL;
 
-  vertexAOD = new AliAODVertex(pos,cov,chi2perNDF);
-  vertexAOD->SetType(AliAODVertex::kUndef); // to be changed
+  Int_t nprongs= (useTRefArray ? 0 : trkArray->GetEntriesFast());
+  vertexAOD = new AliAODVertex(pos,cov,chi2perNDF,0x0,-1,AliAODVertex::kUndef,nprongs);
 
   return vertexAOD;
 }
index 8cbed5d3e17ddaaeca75bf4f53fa51dc1855b41f..bb37e27f9a00f43ab9c9526a2c012e539b8b95f4 100644 (file)
@@ -247,7 +247,7 @@ class AliAnalysisVertexingHF : public TNamed {
                                   Bool_t &okDstar) const;
 
   AliAODVertex* PrimaryVertex(TObjArray *trkArray=0x0,AliVEvent *event=0x0) const;
-  AliAODVertex* ReconstructSecondaryVertex(TObjArray *trkArray,Double_t &dispersion) const;
+  AliAODVertex* ReconstructSecondaryVertex(TObjArray *trkArray,Double_t &dispersion,Bool_t useTRefArray=kTRUE) const;
   Bool_t SelectInvMass(Int_t decay,Int_t nprongs,
                       Double_t *px,Double_t *py,Double_t *pz) const;
   void   SelectTracksAndCopyVertex(AliVEvent *event,