#include <TClonesArray.h>
#include <TParticle.h>
+#include <TMCProcess.h>
#include "AliDielectronSignalMC.h"
#include "AliDielectronMC.h"
return kFALSE;
}
+//________________________________________________________________________________
+Bool_t AliDielectronMC::IsSecondaryFromWeakDecay(Int_t label) const {
+ //
+ // Check if the particle with label "label" is a physical secondary from weak decay according to the
+ // definition in AliStack::IsSecondaryFromWeakDecay(Int_t label)
+ //
+ if(label<0) return kFALSE;
+ if(fAnaType==kAOD) {
+ if(!fMcArray) return kFALSE;
+ return (static_cast<AliAODMCParticle*>(GetMCTrackFromMCEvent(label)))->IsSecondaryFromWeakDecay();
+ } else if(fAnaType==kESD) {
+ if (!fMCEvent) return kFALSE;
+ return fStack->IsSecondaryFromWeakDecay(label);
+ }
+ return kFALSE;
+}
+
+//________________________________________________________________________________
+Bool_t AliDielectronMC::IsSecondaryFromMaterial(Int_t label) const {
+ //
+ // Check if the particle with label "label" is a physical secondary from weak decay according to the
+ // definition in AliStack::IsSecondaryFromMaterial(Int_t label)
+ //
+ if(label<0) return kFALSE;
+ if(fAnaType==kAOD) {
+ if(!fMcArray) return kFALSE;
+ return (static_cast<AliAODMCParticle*>(GetMCTrackFromMCEvent(label)))->IsSecondaryFromMaterial();
+ } else if(fAnaType==kESD) {
+ if (!fMCEvent) return kFALSE;
+ return fStack->IsSecondaryFromMaterial(label);
+ }
+ return kFALSE;
+}
+
+
+//________________________________________________________________________________
+Bool_t AliDielectronMC::CheckGEANTProcess(Int_t label, TMCProcess process) const {
+ //
+ // Check the GEANT process for the particle
+ // NOTE: for tracks the absolute label should be passed
+ //
+ if(label<0) return kFALSE;
+ if(fAnaType==kAOD) {
+ if(!fMcArray) return kFALSE;
+ UInt_t processID = static_cast<AliAODMCParticle*>(GetMCTrackFromMCEvent(label))->GetMCProcessCode();
+ // printf("process: id %d --> %s \n",processID,TMCProcessName[processID]);
+ return (process==processID);
+ } else if(fAnaType==kESD) {
+ if (!fMCEvent) return kFALSE;
+ AliError(Form("return of GEANT process not implemented for ESD "));
+ return kFALSE;
+ }
+ return kFALSE;
+
+}
//________________________________________________________________________________
Bool_t AliDielectronMC::CheckParticleSource(Int_t label, AliDielectronSignalMC::ESource source) const {
// or particles from strange weakly decaying particles (e.g. lambda, kaons, etc.)
return (label>=GetNPrimary() && !IsPhysicalPrimary(label));
break;
+ case AliDielectronSignalMC::kSecondaryFromWeakDecay :
+ // secondary particle from weak decay
+ // or particles from strange weakly decaying particles (e.g. lambda, kaons, etc.)
+ return (IsSecondaryFromWeakDecay(label));
+ break;
+ case AliDielectronSignalMC::kSecondaryFromMaterial :
+ // secondary particle from material
+ return (IsSecondaryFromMaterial(label));
+ break;
default :
return kFALSE;
}
AliError(Form("Could not find MC particle with label %d",label));
return kFALSE;
}
-
+
+ // check geant process if set
+ if(signalMC->GetCheckGEANTProcess() && !CheckGEANTProcess(label,signalMC->GetGEANTProcess())) return kFALSE;
+
// check the leg
if(!ComparePDG(part->PdgCode(),signalMC->GetLegPDG(branch),signalMC->GetLegPDGexclude(branch),signalMC->GetCheckBothChargesLegs(branch))) return kFALSE;
if(!CheckParticleSource(label, signalMC->GetLegSource(branch))) return kFALSE;
//
// legs (daughters)
- const AliVParticle * mcD1 = pair->GetFirstDaughter();
- const AliVParticle * mcD2 = pair->GetSecondDaughter();
+ const AliVParticle * mcD1 = pair->GetFirstDaughterP();
+ const AliVParticle * mcD2 = pair->GetSecondDaughterP();
Int_t labelD1 = (mcD1 ? TMath::Abs(mcD1->GetLabel()) : -1);
Int_t labelD2 = (mcD2 ? TMath::Abs(mcD2->GetLabel()) : -1);
Int_t d1Pdg = GetPdgFromLabel(labelD1);
if(signalMC->GetGrandMotherPDG(2)!=0 || signalMC->GetGrandMotherSource(2)!=AliDielectronSignalMC::kDontCare) {
if(!mcG1 && mcM1) {
labelG1 = GetMothersLabel(labelM1);
- if(labelG2>-1) mcG1 = GetMCTrackFromMCEvent(labelG1);
+ if(labelG1>-1) mcG1 = GetMCTrackFromMCEvent(labelG1);
}
crossTerm = crossTerm && (mcG1 || signalMC->GetGrandMotherPDGexclude(2))
&& ComparePDG((mcG1 ? mcG1->PdgCode() : 0),signalMC->GetGrandMotherPDG(2),signalMC->GetGrandMotherPDGexclude(2),signalMC->GetCheckBothChargesGrandMothers(2))
if(signalMC->GetMothersRelation()==AliDielectronSignalMC::kDifferent) {
motherRelation = motherRelation && !HaveSameMother(pair);
}
-
- return ((directTerm || crossTerm) && motherRelation);
+
+ // check geant process if set
+ Bool_t processGEANT = kTRUE;
+ if(signalMC->GetCheckGEANTProcess()) {
+ if(!CheckGEANTProcess(labelD1,signalMC->GetGEANTProcess()) &&
+ !CheckGEANTProcess(labelD2,signalMC->GetGEANTProcess()) ) processGEANT= kFALSE;
+ }
+
+ return ((directTerm || crossTerm) && motherRelation && processGEANT);
}
// Check whether two particles have the same mother
//
- const AliVParticle * daughter1 = pair->GetFirstDaughter();
- const AliVParticle * daughter2 = pair->GetSecondDaughter();
+ const AliVParticle * daughter1 = pair->GetFirstDaughterP();
+ const AliVParticle * daughter2 = pair->GetSecondDaughterP();
if (!daughter1 || !daughter2) return 0;
AliVParticle *mcDaughter1=GetMCTrackFromMCEvent(daughter1->GetLabel());
// "1" for secondary jpsi (from beauty)
// "2" for background
if(!HaveSameMother(pair)) return 2;
- AliVParticle *mcDaughter1=GetMCTrackFromMCEvent((pair->GetFirstDaughter())->GetLabel());
+ AliVParticle *mcDaughter1=GetMCTrackFromMCEvent((pair->GetFirstDaughterP())->GetLabel());
Int_t labelMother=-1;
if (mcDaughter1->IsA()==AliMCParticle::Class()){