]>
Commit | Line | Data |
---|---|---|
ef647350 | 1 | #include "AliAnalysisEtSelector.h" |
2 | #include "AliAnalysisEtCuts.h" | |
f61cec2f | 3 | #include "AliESDCaloCluster.h" |
4 | #include "AliStack.h" | |
5 | #include "TParticle.h" | |
6 | #include "TParticlePDG.h" | |
7 | #include "AliAnalysisEtCommon.h" | |
8 | #include <iostream> | |
ef647350 | 9 | |
f61cec2f | 10 | ClassImp(AliAnalysisEtSelector); |
ef647350 | 11 | |
f61cec2f | 12 | AliAnalysisEtSelector::AliAnalysisEtSelector(AliAnalysisEtCuts *cuts) : AliAnalysisEtCommon() |
13 | ,fEvent(0) | |
ef647350 | 14 | ,fCuts(cuts) |
f61cec2f | 15 | ,fClusterArray(0) |
ef647350 | 16 | ,fRunNumber(0) |
17 | { | |
ef647350 | 18 | } |
19 | ||
20 | AliAnalysisEtSelector::~AliAnalysisEtSelector() | |
21 | { | |
f61cec2f | 22 | if(fClusterArray) |
23 | { | |
24 | delete fClusterArray; | |
25 | } | |
26 | } | |
27 | ||
28 | Bool_t AliAnalysisEtSelector::CutNeutralMcParticle(Int_t pIdx, AliStack& s, const TParticlePDG& pdg) const | |
29 | { | |
30 | return s.IsPhysicalPrimary(pIdx) &&(TMath::Abs(TMath::Abs(pdg.Charge()) - fCuts->GetMonteCarloNeutralParticle())<1e-3); | |
31 | } | |
ef647350 | 32 | |
f61cec2f | 33 | Bool_t AliAnalysisEtSelector::IsEmEtParticle(const Int_t pdgCode) const |
34 | { | |
35 | return pdgCode == fgGammaCode || pdgCode == fgPi0Code || pdgCode == fgEtaCode || pdgCode == fgEPlusCode || pdgCode == fgEMinusCode; | |
ef647350 | 36 | } |
37 | ||
f61cec2f | 38 | |
39 | Bool_t AliAnalysisEtSelector::PrimaryIsEmEtParticle(const Int_t pIdx, AliStack& stack) const | |
40 | { | |
41 | return IsEmEtParticle(stack.Particle(GetPrimary(pIdx, stack))->GetPdgCode()); | |
42 | } | |
43 | Int_t AliAnalysisEtSelector::GetPrimary(const Int_t partIdx, AliStack& stack) const | |
44 | { | |
45 | if(partIdx >= 0) | |
46 | { | |
47 | Int_t mothIdx = stack.Particle(partIdx)->GetMother(0); | |
48 | if(mothIdx < 0) return -1; | |
49 | TParticle *mother = stack.Particle(mothIdx); | |
50 | if(mother) | |
51 | { | |
52 | if(stack.IsPhysicalPrimary(mothIdx)) return mothIdx; | |
53 | else return GetPrimary(mothIdx, stack); | |
54 | } | |
55 | else | |
56 | { | |
57 | std::cout << "WAT!" << std::endl; | |
58 | return -1; | |
59 | } | |
60 | } | |
61 | return -1; | |
62 | } |