Method to recalc vertex
authordainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 9 Feb 2011 15:30:43 +0000 (15:30 +0000)
committerdainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 9 Feb 2011 15:30:43 +0000 (15:30 +0000)
PWG3/vertexingHF/AliRDHFCuts.cxx
PWG3/vertexingHF/AliRDHFCuts.h

index c2f5eec..6d4833b 100644 (file)
@@ -672,3 +672,52 @@ void AliRDHFCuts::MakeTable() const {
 
   return;
 }
+//--------------------------------------------------------------------------
+Bool_t AliRDHFCuts::RecalcOwnPrimaryVtx(AliAODRecoDecayHF *d,AliAODEvent *aod,
+                                     AliAODVertex *origownvtx,AliAODVertex *recvtx) const
+{
+  //
+  // Recalculate primary vertex without daughters
+  //
+
+  if(!aod) {
+    AliError("Can not remove daughters from vertex without AOD event");
+    return kFALSE;
+  }   
+  if(d->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*d->GetOwnPrimaryVtx());
+  recvtx=d->RemoveDaughtersFromPrimaryVtx(aod);
+  if(!recvtx){
+    AliDebug(2,"Removal of daughter tracks failed");
+    if(origownvtx){
+      delete origownvtx;
+      origownvtx=NULL;
+    }
+    return kFALSE;
+  }
+  //set recalculed primary vertex
+  d->SetOwnPrimaryVtx(recvtx);
+  delete recvtx; recvtx=NULL;
+
+  return kTRUE;
+}
+//--------------------------------------------------------------------------
+void AliRDHFCuts::CleanOwnPrimaryVtx(AliAODRecoDecayHF *d,AliAODVertex *origownvtx) const
+{
+  //
+  // Clean-up own primary vertex if needed
+  //
+
+  if(origownvtx) {
+    d->SetOwnPrimaryVtx(origownvtx);
+    delete origownvtx;
+    origownvtx=NULL;
+  } else if(fRemoveDaughtersFromPrimary) {
+    d->UnsetOwnPrimaryVtx();
+    AliDebug(3,"delete new vertex\n");
+  }
+
+  return;
+}
+
+
+
index 99ade1a..ac3181d 100644 (file)
@@ -123,6 +123,9 @@ class AliRDHFCuts : public AliAnalysisCuts
   void SetNPtBins(Int_t nptBins){fnPtBins=nptBins;}
   void SetNVars(Int_t nVars){fnVars=nVars;}
 
+  Bool_t RecalcOwnPrimaryVtx(AliAODRecoDecayHF *d,AliAODEvent *aod,AliAODVertex *origownvtx,AliAODVertex *recvtx) const;
+  void   CleanOwnPrimaryVtx(AliAODRecoDecayHF *d,AliAODVertex *origownvtx) const;
+
   // cuts on the event
   Int_t fMinVtxType; // 0: not cut; 1: SPDZ; 2: SPD3D; 3: Tracks
   Int_t fMinVtxContr;   // minimum vertex contributors