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