]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
New methods to identify particles from the injected signal events (Johannes, Rossella)
authorfprino <fprino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 2 Sep 2013 12:14:40 +0000 (12:14 +0000)
committerfprino <fprino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 2 Sep 2013 12:14:40 +0000 (12:14 +0000)
PWGHF/vertexingHF/AliVertexingHFUtils.cxx
PWGHF/vertexingHF/AliVertexingHFUtils.h

index 1e6e695e5e63271b812c3d24a68cc575d77861b7..0162d04171595569eb1265151370e3082e58ec4d 100644 (file)
@@ -470,16 +470,62 @@ Double_t AliVertexingHFUtils::GetCorrectedNtracklets(TProfile* estimatorAvg, Dou
 }
 //______________________________________________________________________
 TString AliVertexingHFUtils::GetGenerator(Int_t label, AliAODMCHeader* header){
-   Int_t nsumpart=0;
-   TList *lh=header->GetCocktailHeaders();
-   Int_t nh=lh->GetEntries();
-   for(Int_t i=0;i<nh;i++){
-     AliGenEventHeader* gh=(AliGenEventHeader*)lh->At(i);
-     TString genname=gh->GetName();
-     Int_t npart=gh->NProduced();
-     if(label>=nsumpart && label<(nsumpart+npart)) return genname;
-     nsumpart+=npart;
-   }
-   TString empty="";
-   return empty;
- }
+  // get the name of the generator that produced a given particle
+
+  Int_t nsumpart=0;
+  TList *lh=header->GetCocktailHeaders();
+  Int_t nh=lh->GetEntries();
+  for(Int_t i=0;i<nh;i++){
+    AliGenEventHeader* gh=(AliGenEventHeader*)lh->At(i);
+    TString genname=gh->GetName();
+    Int_t npart=gh->NProduced();
+    if(label>=nsumpart && label<(nsumpart+npart)) return genname;
+    nsumpart+=npart;
+  }
+  TString empty="";
+  return empty;
+}
+//----------------------------------------------------------------------
+Bool_t AliVertexingHFUtils::IsTrackInjected(AliAODTrack *track,AliAODMCHeader *header,TClonesArray *arrayMC){
+  // method to check if a track comes from the signal event or from the underlying Hijing event
+
+  Int_t lab=TMath::Abs(track->GetLabel());
+  TString nameGen=GetGenerator(lab,header);
+  
+  //  Int_t countControl=0;
+  
+  while(nameGen.IsWhitespace()){
+    AliAODMCParticle *mcpart= (AliAODMCParticle*)arrayMC->At(lab);
+    if(!mcpart){
+      printf("AliVertexingHFUtils::IsTrackInjected - BREAK: No valid AliAODMCParticle at label %i\n",lab);
+      break;
+    }
+    Int_t mother = mcpart->GetMother();
+    if(mother<0){
+      printf("AliVertexingHFUtils::IsTrackInjected - BREAK: Reached primary particle without valid mother\n");
+      break;
+    }
+    lab=mother;
+    nameGen=GetGenerator(mother,header);
+    // countControl++;
+    // if(countControl>=10){ // 10 = arbitrary number; protection from infinite loops
+    //   printf("AliVertexingHFUtils::IsTrackInjected - BREAK: Protection from infinite loop active\n");
+    //   break;
+    // }
+  }
+  
+  if(nameGen.IsWhitespace() || nameGen.Contains("ijing")) return kFALSE;
+  
+  return kTRUE;
+}
+//____________________________________________________________________________
+Bool_t AliVertexingHFUtils::IsCandidateInjected(AliAODRecoDecayHF *cand, AliAODMCHeader *header,TClonesArray *arrayMC){
+  // method to check if a D meson candidate comes from the signal event or from the underlying Hijing event
+
+  Int_t nprongs=cand->GetNProngs();
+  for(Int_t i=0;i<nprongs;i++){
+    AliAODTrack *daugh=(AliAODTrack*)cand->GetDaughter(i);
+    if(IsTrackInjected(daugh,header,arrayMC)) return kTRUE;
+  }
+  return kFALSE;
+}
index 80d0549606c4bdf223c3298cacae4db0a00deddb..12a9a70ff12a6ad5e39fd47c745cb144a4bfdf4b 100644 (file)
@@ -15,6 +15,9 @@
 ///////////////////////////////////////////////////////////////////
 
 #include "TObject.h"
+#include "AliAODTrack.h"
+#include "AliAODRecoDecay.h"
+#include "AliAODRecoDecayHF.h"
 
 class AliAODMCParticle;
 class AliAODMCHeader;
@@ -66,6 +69,8 @@ class AliVertexingHFUtils : public TObject{
   static Double_t GetFullEvResolLowLim(const TH1F* hSubEvCorr, Int_t k=1);
   static Double_t GetFullEvResolHighLim(const TH1F* hSubEvCorr, Int_t k=1);
   static TString  GetGenerator(Int_t label, AliAODMCHeader* header); 
+  Bool_t IsTrackInjected(AliAODTrack *track,AliAODMCHeader *header,TClonesArray *arrayMC);
+  Bool_t IsCandidateInjected(AliAODRecoDecayHF *cand, AliAODMCHeader *header,TClonesArray *arrayMC);
   // Functions for tracklet multiplcity calculation
   void SetEtaRangeForTracklets(Double_t mineta, Double_t maxeta){
     fMinEtaForTracklets=mineta;