1 //_________________________________________________________________________
2 // Utility Class for transverse energy studies
7 //*-- Authors: Oystein Djuvsland (Bergen)
8 //_________________________________________________________________________
9 #include "AliAnalysisEtSelector.h"
10 #include "AliAnalysisEtCuts.h"
11 #include "AliESDCaloCluster.h"
13 #include "TParticle.h"
14 #include "TParticlePDG.h"
15 #include "AliAnalysisEtCommon.h"
18 ClassImp(AliAnalysisEtSelector);
20 AliAnalysisEtSelector::AliAnalysisEtSelector(AliAnalysisEtCuts *cuts) : AliAnalysisEtCommon()
29 AliAnalysisEtSelector::~AliAnalysisEtSelector()
36 void AliAnalysisEtSelector::SetEvent(const AliESDEvent* event)
39 if(!fInitialized) Init(event);
42 Bool_t AliAnalysisEtSelector::IsNeutralMcParticle(Int_t pIdx, AliStack& s, const TParticlePDG& pdg) const
44 return s.IsPhysicalPrimary(pIdx) &&(TMath::Abs(TMath::Abs(pdg.Charge()) - fCuts->GetMonteCarloNeutralParticle())<1e-3);
47 Bool_t AliAnalysisEtSelector::IsEmEtParticle(const Int_t pdgCode) const
49 return pdgCode == fgGammaCode || pdgCode == fgPi0Code || pdgCode == fgEtaCode || pdgCode == fgEPlusCode || pdgCode == fgEMinusCode;
53 Bool_t AliAnalysisEtSelector::PrimaryIsEmEtParticle(const Int_t pIdx, AliStack& stack) const
55 return IsEmEtParticle(stack.Particle(GetPrimary(pIdx, stack))->GetPdgCode());
57 Int_t AliAnalysisEtSelector::GetPrimary(const Int_t partIdx, AliStack& stack) const
61 Int_t mothIdx = stack.Particle(partIdx)->GetMother(0);
62 if(mothIdx < 0) return -1;
63 TParticle *mother = stack.Particle(mothIdx);
66 if(stack.IsPhysicalPrimary(mothIdx)) return mothIdx;
67 else return GetPrimary(mothIdx, stack);
71 std::cout << "WAT!" << std::endl;
77 Bool_t AliAnalysisEtSelector::FromSecondaryInteraction(const TParticle& part, AliStack &stack) const
79 // Bool_t partVtxSecondary = (
80 // TMath::Sqrt(part.Vx()*part.Vx() + part.Vy()*part.Vy()) > fCuts->GetPrimaryVertexCutXY()
81 // || TMath::Abs(part.Vz()) > fCuts->GetPrimaryVertexCutZ()
83 // && TMath::Sqrt(part.Vx()*part.Vx()+part.Vy()*part.Vy() + part.Vz()*part.Vz())<(fCuts->GetGeometryPhosDetectorRadius()-10);
85 //Let's find suspect decay (typical for secondary interaction)...
87 return SuspeciousDecayInChain(211, 111, part, stack);
94 Bool_t AliAnalysisEtSelector::SuspeciousDecayInChain(const UInt_t suspectMotherPdg, const UInt_t suspectDaughterPdg, const TParticle &part, AliStack& stack) const
96 UInt_t partPdg = TMath::Abs(part.GetPdgCode());
97 if(part.GetFirstMother() == -1)
101 TParticle *mother = stack.Particle(part.GetFirstMother());
102 UInt_t motherPdg = TMath::Abs(mother->GetPdgCode());
103 if((suspectDaughterPdg==partPdg || 2112 == partPdg )&& suspectMotherPdg == motherPdg)
107 return SuspeciousDecayInChain(suspectMotherPdg, suspectDaughterPdg, *mother, stack);