effc++ warnings
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysis.cxx
CommitLineData
b26900d0 1#include "AliAnalysis.h"
2//________________________________
3///////////////////////////////////////////////////////////
4//
5// class AliAnalysis
6//
a5556ea5 7// Base class for analysis.
8// Each inheriting calss must define 3 methods:
9// - Init() : that is called before event processing
10// - ProcessEvent(AliESD*,AliStack*)
11// -
b26900d0 12// Piotr.Skowronski@cern.ch
13//
14///////////////////////////////////////////////////////////
15
8e119ee7 16#include "AliEventCut.h"
7b6503d6 17#include "AliAODPairCut.h"
b26900d0 18
19ClassImp(AliAnalysis)
20
78daa440 21AliAnalysis::AliAnalysis():
22 fEventCut(0x0),
23 fCutOnSim(kTRUE),
7b6503d6 24 fCutOnRec(kTRUE),
b4fb427e 25 fPairCut(new AliAODPairEmptyCut()),//empty cut - accepts all particles
7b6503d6 26 fkPass(&AliAnalysis::PassPartAndTrack), //by default perform cut on both track and particle pair
27 fkPass1(&AliAnalysis::PassPartAndTrack1), //used onluy by ProcessTracksAndParticles
28 fkPass2(&AliAnalysis::PassPartAndTrack2),
29 fkPassPairProp(&AliAnalysis::PassPairPropPartAndTrack)
b26900d0 30{
54a28fdd 31 //ctor
b26900d0 32}
33/*********************************************************/
34
54a28fdd 35AliAnalysis::AliAnalysis(const char* name,const char* title):
8e119ee7 36 TTask(name,title),
37 fEventCut(0x0),
38 fCutOnSim(kTRUE),
7b6503d6 39 fCutOnRec(kTRUE),
b4fb427e 40 fPairCut(new AliAODPairEmptyCut()),//empty cut - accepts all particles
7b6503d6 41 fkPass(&AliAnalysis::PassPartAndTrack), //by default perform cut on both track and particle pair
42 fkPass1(&AliAnalysis::PassPartAndTrack1), //used onluy by ProcessTracksAndParticles
43 fkPass2(&AliAnalysis::PassPartAndTrack2),
44 fkPassPairProp(&AliAnalysis::PassPairPropPartAndTrack)
b26900d0 45{
54a28fdd 46 //ctor
b26900d0 47}
48/*********************************************************/
5eac1680 49AliAnalysis::AliAnalysis(const AliAnalysis& ana):
50 TTask(ana),
51 fEventCut(ana.fEventCut),
52 fCutOnSim(ana.fCutOnSim),
53 fCutOnRec(ana.fCutOnRec),
54 fPairCut(ana.fPairCut),
55 fkPass(ana.fkPass),
56 fkPass1(ana.fkPass1),
57 fkPass2(ana.fkPass2),
58 fkPassPairProp(ana.fkPassPairProp)
59{
60 //ctor
61}
62/*********************************************************/
b26900d0 63
64AliAnalysis::~AliAnalysis()
65{
54a28fdd 66 //dtor
8e119ee7 67 delete fEventCut;
b26900d0 68}
69/*********************************************************/
70
8e119ee7 71void AliAnalysis::SetEventCut(AliEventCut* evcut)
72{
73//Sets event - makes a private copy
74 delete fEventCut;
75 if (evcut) fEventCut = (AliEventCut*)evcut->Clone();
76 else fEventCut = 0x0;
77}
78/*********************************************************/
79
cea0a066 80Bool_t AliAnalysis::Rejected(AliAOD* recevent, AliAOD* simevent)
8e119ee7 81{
82 //checks the event cut
83 if (fEventCut == 0x0) return kFALSE;
84
85 if (fCutOnRec)
cea0a066 86 if (fEventCut->Rejected(recevent)) return kTRUE;
8e119ee7 87
88 if (fCutOnSim)
cea0a066 89 if (fEventCut->Rejected(simevent)) return kTRUE;
8e119ee7 90
91 return kFALSE;
92}
7b6503d6 93/*************************************************************************************/
94
95void AliAnalysis::SetPairCut(AliAODPairCut* cut)
96{
97//Sets new Pair Cut. Old one is deleted
98//Note that it is created new object instead of simple pointer set
99//I do not want to have pointer
100//to object created somewhere else
101//because in that case I could not believe that
102//it would always exist (sb could delete it)
103//so we have always own copy
104
105 if(!cut)
106 {
107 Error("AliHBTFunction::SetPairCut","argument is NULL");
108 return;
109 }
110 delete fPairCut;
111 fPairCut = (AliAODPairCut*)cut->Clone();
112
113}
114/******************************************************************/
115
116void AliAnalysis::SetCutsOnSim()
117{
118 // -- aplies only to Process("TracksAndParticles")
119 // (ProcessTracksAndParticles and ProcessTracksAndParticlesNonIdentAnal)
120 // Only particles properties are checkes against cuts
121
122 fCutOnRec = kFALSE;
123 fCutOnSim = kTRUE;
124
125 fkPass = &AliAnalysis::PassPart;
126 fkPass1 = &AliAnalysis::PassPart1;
127 fkPass2 = &AliAnalysis::PassPart2;
128 fkPassPairProp = &AliAnalysis::PassPairPropPart;
129
130}
131/*************************************************************************************/
132
133void AliAnalysis::SetCutsOnRec()
134{
135 // -- aplies only to Process("TracksAndParticles")
136 // (ProcessTracksAndParticles and ProcessTracksAndParticlesNonIdentAnal)
137 // Only tracks properties are checkes against cuts
138
139 fCutOnRec = kTRUE;
140 fCutOnSim = kFALSE;
141
142 fkPass = &AliAnalysis::PassTrack;
143 fkPass1 = &AliAnalysis::PassTrack1;
144 fkPass2 = &AliAnalysis::PassTrack2;
145 fkPassPairProp = &AliAnalysis::PassPairPropTrack;
146
147}
148/*************************************************************************************/
149
150void AliAnalysis::SetCutsOnRecAndSim()
151{
152 // -- aplies only to Process("TracksAndParticles")
153 // (ProcessTracksAndParticles and ProcessTracksAndParticlesNonIdentAnal)
154 // Both, tracks and particles, properties are checked against cuts
155
156 fCutOnRec = kTRUE;
157 fCutOnSim = kTRUE;
158
159 fkPass = &AliAnalysis::PassPartAndTrack;
160 fkPass1 = &AliAnalysis::PassPartAndTrack1;
161 fkPass2 = &AliAnalysis::PassPartAndTrack2;
162 fkPassPairProp = &AliAnalysis::PassPairPropPartAndTrack;
163}