]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/totEt/AliAnalysisEtSelector.cxx
Changing cluster E cut to cluster ET cut and changing name of function for correcting...
[u/mrichter/AliRoot.git] / PWGLF / totEt / AliAnalysisEtSelector.cxx
CommitLineData
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 18ClassImp(AliAnalysisEtSelector);
ef647350 19
f61cec2f 20AliAnalysisEtSelector::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 28AliAnalysisEtSelector::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
38AliAnalysisEtSelector::~AliAnalysisEtSelector()
4d376d01 39{ // dtor
f61cec2f 40 if(fClusterArray)
41 {
42 delete fClusterArray;
43 }
44}
86e7d5db 45void AliAnalysisEtSelector::SetEvent(const AliESDEvent* event)
46{
47 fEvent = event;
48 if(!fInitialized) Init(event);
49}
f61cec2f 50
86e7d5db 51Bool_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
f61cec2f 56Bool_t AliAnalysisEtSelector::IsEmEtParticle(const Int_t pdgCode) const
57{
58 return pdgCode == fgGammaCode || pdgCode == fgPi0Code || pdgCode == fgEtaCode || pdgCode == fgEPlusCode || pdgCode == fgEMinusCode;
ef647350 59}
60
f61cec2f 61
62Bool_t AliAnalysisEtSelector::PrimaryIsEmEtParticle(const Int_t pIdx, AliStack& stack) const
63{
64 return IsEmEtParticle(stack.Particle(GetPrimary(pIdx, stack))->GetPdgCode());
65}
66Int_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}
b2c10007 86Bool_t AliAnalysisEtSelector::FromSecondaryInteraction(const TParticle& part, AliStack &stack) const
87{
f6b36c54 88// Bool_t partVtxSecondary = (
89// TMath::Sqrt(part.Vx()*part.Vx() + part.Vy()*part.Vy()) > fCuts->GetPrimaryVertexCutXY()
90// || TMath::Abs(part.Vz()) > fCuts->GetPrimaryVertexCutZ()
91// )
92// && TMath::Sqrt(part.Vx()*part.Vx()+part.Vy()*part.Vy() + part.Vz()*part.Vz())<(fCuts->GetGeometryPhosDetectorRadius()-10);
b2c10007 93
94 //Let's find suspect decay (typical for secondary interaction)...
95
96 return SuspeciousDecayInChain(211, 111, part, stack);
97
98
99
100
101}
102
f6b36c54 103Bool_t AliAnalysisEtSelector::SuspeciousDecayInChain(const UInt_t suspectMotherPdg, const UInt_t suspectDaughterPdg, const TParticle &part, AliStack& stack) const
b2c10007 104{
105 UInt_t partPdg = TMath::Abs(part.GetPdgCode());
106 if(part.GetFirstMother() == -1)
107 {
108 return kFALSE;
109 }
110 TParticle *mother = stack.Particle(part.GetFirstMother());
111 UInt_t motherPdg = TMath::Abs(mother->GetPdgCode());
112 if((suspectDaughterPdg==partPdg || 2112 == partPdg )&& suspectMotherPdg == motherPdg)
113 {
114 return kTRUE;
115 }
116 return SuspeciousDecayInChain(suspectMotherPdg, suspectDaughterPdg, *mother, stack);
117}