]>
Commit | Line | Data |
---|---|---|
4d376d01 | 1 | //_________________________________________________________________________ |
2 | // Utility Class for transverse energy studies | |
3 | // Selector Base class | |
4 | // - | |
5 | // implementation file | |
6 | // | |
7 | //*-- Authors: Oystein Djuvsland (Bergen) | |
8 | //_________________________________________________________________________ | |
ef647350 | 9 | #include "AliAnalysisEtSelector.h" |
10 | #include "AliAnalysisEtCuts.h" | |
f61cec2f | 11 | #include "AliESDCaloCluster.h" |
12 | #include "AliStack.h" | |
13 | #include "TParticle.h" | |
14 | #include "TParticlePDG.h" | |
15 | #include "AliAnalysisEtCommon.h" | |
16 | #include <iostream> | |
ef647350 | 17 | |
f61cec2f | 18 | ClassImp(AliAnalysisEtSelector); |
ef647350 | 19 | |
f61cec2f | 20 | AliAnalysisEtSelector::AliAnalysisEtSelector(AliAnalysisEtCuts *cuts) : AliAnalysisEtCommon() |
21 | ,fEvent(0) | |
f61cec2f | 22 | ,fClusterArray(0) |
f6b36c54 | 23 | ,fCuts(cuts) |
ef647350 | 24 | ,fRunNumber(0) |
95a76eaf | 25 | ,fInitialized(kFALSE) |
ef647350 | 26 | { |
ef647350 | 27 | } |
c31562f7 | 28 | AliAnalysisEtSelector::AliAnalysisEtSelector() : AliAnalysisEtCommon() |
29 | ,fEvent(0) | |
30 | ,fClusterArray(0) | |
31 | ,fCuts(0) | |
32 | ,fRunNumber(0) | |
33 | ,fInitialized(kFALSE) | |
34 | { | |
35 | fCuts = new AliAnalysisEtCuts(); | |
36 | } | |
ef647350 | 37 | |
38 | AliAnalysisEtSelector::~AliAnalysisEtSelector() | |
4d376d01 | 39 | { // dtor |
f61cec2f | 40 | if(fClusterArray) |
41 | { | |
42 | delete fClusterArray; | |
43 | } | |
44 | } | |
86e7d5db | 45 | void AliAnalysisEtSelector::SetEvent(const AliESDEvent* event) |
46 | { | |
47 | fEvent = event; | |
48 | if(!fInitialized) Init(event); | |
49 | } | |
f61cec2f | 50 | |
86e7d5db | 51 | Bool_t AliAnalysisEtSelector::IsNeutralMcParticle(Int_t pIdx, AliStack& s, const TParticlePDG& pdg) const |
f61cec2f | 52 | { |
53 | return s.IsPhysicalPrimary(pIdx) &&(TMath::Abs(TMath::Abs(pdg.Charge()) - fCuts->GetMonteCarloNeutralParticle())<1e-3); | |
54 | } | |
ef647350 | 55 | |
02d47689 | 56 | Bool_t AliAnalysisEtSelector::IsEmEtParticle(const Int_t pdgCode) const |
f61cec2f | 57 | { |
58 | return pdgCode == fgGammaCode || pdgCode == fgPi0Code || pdgCode == fgEtaCode || pdgCode == fgEPlusCode || pdgCode == fgEMinusCode; | |
ef647350 | 59 | } |
60 | ||
f61cec2f | 61 | |
02d47689 | 62 | Bool_t AliAnalysisEtSelector::PrimaryIsEmEtParticle(const Int_t pIdx, AliStack& stack) const |
f61cec2f | 63 | { |
64 | return IsEmEtParticle(stack.Particle(GetPrimary(pIdx, stack))->GetPdgCode()); | |
65 | } | |
02d47689 | 66 | Int_t AliAnalysisEtSelector::GetPrimary(const Int_t partIdx, AliStack& stack) const |
4d376d01 | 67 | { // get primary |
f61cec2f | 68 | if(partIdx >= 0) |
69 | { | |
70 | Int_t mothIdx = stack.Particle(partIdx)->GetMother(0); | |
71 | if(mothIdx < 0) return -1; | |
72 | TParticle *mother = stack.Particle(mothIdx); | |
73 | if(mother) | |
74 | { | |
75 | if(stack.IsPhysicalPrimary(mothIdx)) return mothIdx; | |
76 | else return GetPrimary(mothIdx, stack); | |
77 | } | |
78 | else | |
79 | { | |
80 | std::cout << "WAT!" << std::endl; | |
81 | return -1; | |
82 | } | |
83 | } | |
84 | return -1; | |
85 | } | |
6844c491 | 86 | //Bool_t AliAnalysisEtSelector::FromSecondaryInteraction(const TParticle& part, AliStack &stack) const |
87 | Bool_t AliAnalysisEtSelector::FromSecondaryInteraction(Int_t partID, AliStack &stack) const | |
b2c10007 | 88 | { |
f6b36c54 | 89 | // Bool_t partVtxSecondary = ( |
90 | // TMath::Sqrt(part.Vx()*part.Vx() + part.Vy()*part.Vy()) > fCuts->GetPrimaryVertexCutXY() | |
91 | // || TMath::Abs(part.Vz()) > fCuts->GetPrimaryVertexCutZ() | |
92 | // ) | |
93 | // && TMath::Sqrt(part.Vx()*part.Vx()+part.Vy()*part.Vy() + part.Vz()*part.Vz())<(fCuts->GetGeometryPhosDetectorRadius()-10); | |
b2c10007 | 94 | |
32503dac | 95 | |
6844c491 | 96 | //Bool_t partVtxSecondary = (TMath::Sqrt(part.Vx()*part.Vx() + part.Vy()*part.Vy()) <420); |
97 | //if(partVtxSecondary) return kFalse; | |
32503dac | 98 | // //Let's find suspect decay (typical for secondary interaction)... |
99 | // if(partVtxSecondary){ | |
6844c491 | 100 | // return SuspiciousDecayInChain(211, 111, part, stack); |
101 | //return stack.IsSecondaryFromMaterial(part.GetUniqueID()); | |
102 | return stack.IsSecondaryFromMaterial(partID); | |
32503dac | 103 | // } |
104 | // else{ | |
105 | // return kFALSE; | |
106 | // } | |
b2c10007 | 107 | |
108 | ||
109 | ||
110 | ||
111 | } | |
112 | ||
6844c491 | 113 | Int_t AliAnalysisEtSelector::GetMother(Int_t partID, AliStack& stack) const { |
114 | if(partID>0){ | |
115 | TParticle *particle = stack.Particle(partID); | |
116 | if(particle){ | |
117 | ||
118 | return particle->GetMother(0); | |
119 | } | |
120 | } | |
121 | return -1; | |
122 | } | |
123 | Bool_t AliAnalysisEtSelector::IsFromDetectorCover(Int_t partID, AliStack& stack) const{ | |
124 | if(partID>0){ | |
125 | TParticle *particle = stack.Particle(partID); | |
126 | if(particle){//particle exists | |
127 | if(stack.IsSecondaryFromMaterial(partID)){//particle is from an interaction with the material | |
128 | //say that it's from the detector cover if its vertex is larger than 400 cm because this is where the cover is | |
129 | return (TMath::Sqrt(particle->Vx()*particle->Vx() + particle->Vy()*particle->Vy()) >400); | |
130 | ||
131 | } | |
132 | } | |
133 | } | |
134 | return kFALSE; | |
135 | } | |
136 | ||
137 | Int_t AliAnalysisEtSelector::GetFirstMotherNotFromDetectorCover(Int_t partID, AliStack& stack) const{ | |
138 | Int_t targetParticle = partID; | |
139 | Int_t testParticle = partID; | |
140 | Int_t iteration = 0; | |
141 | while(IsFromDetectorCover(targetParticle,stack) && testParticle>0){//if the particle is from the detector cover | |
142 | //cout<<"Particle "<<targetParticle<<" is from detector cover. Getting mother "; | |
143 | testParticle = GetMother(targetParticle,stack); | |
144 | if(testParticle>0) targetParticle = testParticle; | |
145 | //cout<<targetParticle<<" iteration "<<iteration<<endl; | |
146 | iteration++; | |
147 | } | |
148 | //if(iteration>0) cout<<"iterations "<<iteration<<endl; | |
149 | return targetParticle; | |
150 | } | |
15d985fd | 151 | Bool_t AliAnalysisEtSelector::SuspiciousDecayInChain(const UInt_t suspectMotherPdg, const UInt_t suspectDaughterPdg, const TParticle &part, AliStack& stack) const |
b2c10007 | 152 | { |
153 | UInt_t partPdg = TMath::Abs(part.GetPdgCode()); | |
154 | if(part.GetFirstMother() == -1) | |
155 | { | |
156 | return kFALSE; | |
157 | } | |
158 | TParticle *mother = stack.Particle(part.GetFirstMother()); | |
159 | UInt_t motherPdg = TMath::Abs(mother->GetPdgCode()); | |
160 | if((suspectDaughterPdg==partPdg || 2112 == partPdg )&& suspectMotherPdg == motherPdg) | |
161 | { | |
162 | return kTRUE; | |
163 | } | |
15d985fd | 164 | return SuspiciousDecayInChain(suspectMotherPdg, suspectDaughterPdg, *mother, stack); |
b2c10007 | 165 | } |
43dd5a38 | 166 | |
167 | Float_t AliAnalysisEtSelector::ShiftAngle(Float_t phi){//Always returns an angle in radians between -pi<phi<pi | |
168 | float myphi = phi; | |
169 | while(myphi>TMath::Pi()){//angle is too high, decrease the angle | |
170 | myphi = myphi - 2*TMath::Pi(); | |
171 | } | |
172 | while(myphi<-TMath::Pi()){//angle is too low, increase the angle | |
173 | myphi = myphi + 2*TMath::Pi(); | |
174 | } | |
175 | return myphi; | |
176 | } | |
02d47689 | 177 | Bool_t AliAnalysisEtSelector::PassMinEnergyCut(Double_t e) const |
178 | { | |
179 | return e > fCuts->GetReconstructedEmcalClusterEnergyCut(); | |
180 | } | |
181 |