]> git.uio.no Git - u/mrichter/AliRoot.git/blame - CORRFW/AliCFManager.cxx
Remove a run from LHC10e wo AODs; added run list for the new PbPb MC LHC11a10b_bis
[u/mrichter/AliRoot.git] / CORRFW / AliCFManager.cxx
CommitLineData
563113d0 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15///////////////////////////////////////////////////////////////////////////
16// The class AliCFManager is designed to handle inside the
17// task the basic components for a particle-level correction of single
18// particle analysis
19// The class provides methods to set lists of cuts and to loop over them
20// for several different selection steps to be then used for
21// efficiency calculation.
22// prototype version by S.Arcelli silvia.arcelli@cern.ch
23///////////////////////////////////////////////////////////////////////////
563113d0 24#include "AliCFCutBase.h"
25#include "AliCFManager.h"
26
27ClassImp(AliCFManager)
28
29//_____________________________________________________________________________
30AliCFManager::AliCFManager() :
31 TNamed(),
00148604 32 fNStepEvt(0),
33 fNStepPart(0),
563113d0 34 fEvtContainer(0x0),
84df86a7 35 fPartContainer(0x0),
36 fEvtCutList(0x0),
37 fPartCutList(0x0)
563113d0 38{
39 //
40 // ctor
41 //
563113d0 42}
43//_____________________________________________________________________________
44AliCFManager::AliCFManager(Char_t* name, Char_t* title) :
45 TNamed(name,title),
00148604 46 fNStepEvt(0),
47 fNStepPart(0),
563113d0 48 fEvtContainer(0x0),
84df86a7 49 fPartContainer(0x0),
50 fEvtCutList(0x0),
51 fPartCutList(0x0)
52{
563113d0 53 //
54 // ctor
55 //
563113d0 56}
57//_____________________________________________________________________________
58AliCFManager::AliCFManager(const AliCFManager& c) :
59 TNamed(c),
00148604 60 fNStepEvt(c.fNStepEvt),
61 fNStepPart(c.fNStepPart),
563113d0 62 fEvtContainer(c.fEvtContainer),
84df86a7 63 fPartContainer(c.fPartContainer),
64 fEvtCutList(c.fEvtCutList),
65 fPartCutList(c.fPartCutList)
66{
563113d0 67 //
68 //copy ctor
69 //
84df86a7 70}
563113d0 71//_____________________________________________________________________________
72AliCFManager& AliCFManager::operator=(const AliCFManager& c)
73{
74 //
75 // Assignment operator
76 //
77 if (this != &c) {
78 TNamed::operator=(c) ;
79 }
84df86a7 80
00148604 81 this->fNStepEvt=c.fNStepEvt;
82 this->fNStepPart=c.fNStepPart;
563113d0 83 this->fEvtContainer=c.fEvtContainer;
84 this->fPartContainer=c.fPartContainer;
84df86a7 85 this->fEvtCutList=c.fEvtCutList;
86 this->fPartCutList=c.fPartCutList;
563113d0 87 return *this ;
88}
89
90//_____________________________________________________________________________
91AliCFManager::~AliCFManager() {
92 //
93 //dtor
94 //
563113d0 95}
96
97//_____________________________________________________________________________
98Bool_t AliCFManager::CheckParticleCuts(Int_t isel, TObject *obj, const TString &selcuts) const {
99 //
100 // check whether object obj passes particle-level selection isel
101 //
102
4b49fad2 103 if(isel>=fNStepPart){
104 AliWarning(Form("Selection index out of Range! isel=%i, max. number of selections= %i", isel,fNStepPart));
84df86a7 105 return kTRUE;
563113d0 106 }
107 if(!fPartCutList[isel])return kTRUE;
108 TObjArrayIter iter(fPartCutList[isel]);
109 AliCFCutBase *cut = 0;
110 while ( (cut = (AliCFCutBase*)iter.Next()) ) {
111 TString cutName=cut->GetName();
112 Bool_t checkCut=CompareStrings(cutName,selcuts);
113 if(checkCut && !cut->IsSelected(obj)) return kFALSE;
114 }
115 return kTRUE;
116}
117
118//_____________________________________________________________________________
119Bool_t AliCFManager::CheckEventCuts(Int_t isel, TObject *obj, const TString &selcuts) const{
120 //
121 // check whether object obj passes event-level selection isel
122 //
123
4b49fad2 124 if(isel>=fNStepEvt){
125 AliWarning(Form("Selection index out of Range! isel=%i, max. number of selections= %i", isel,fNStepEvt));
563113d0 126 return kTRUE;
127 }
128 if(!fEvtCutList[isel])return kTRUE;
129 TObjArrayIter iter(fEvtCutList[isel]);
130 AliCFCutBase *cut = 0;
131 while ( (cut = (AliCFCutBase*)iter.Next()) ) {
132 TString cutName=cut->GetName();
133 Bool_t checkCut=CompareStrings(cutName,selcuts);
134 if(checkCut && !cut->IsSelected(obj)) return kFALSE;
135 }
136 return kTRUE;
137}
138
563113d0 139//_____________________________________________________________________________
0c01ae65 140void AliCFManager::SetMCEventInfo(const TObject *obj) const {
563113d0 141
142 //Particle level cuts
143
4b49fad2 144 if (!fPartCutList) {
145 AliWarning("No particle cut list found");
84df86a7 146 }
147 else {
4b49fad2 148 for(Int_t isel=0;isel<fNStepPart; isel++){
84df86a7 149 if(!fPartCutList[isel])continue;
150 TObjArrayIter iter(fPartCutList[isel]);
151 AliCFCutBase *cut = 0;
152 while ( (cut = (AliCFCutBase*)iter.Next()) ) {
0c01ae65 153 cut->SetMCEventInfo(obj);
84df86a7 154 }
155 }
563113d0 156 }
157
158 //Event level cuts
84df86a7 159
4b49fad2 160 if (!fEvtCutList) {
161 AliWarning("No event cut list found");
84df86a7 162 }
163 else {
4b49fad2 164 for(Int_t isel=0;isel<fNStepEvt; isel++){
84df86a7 165 if(!fEvtCutList[isel])continue;
166 TObjArrayIter iter(fEvtCutList[isel]);
167 AliCFCutBase *cut = 0;
168 while ( (cut = (AliCFCutBase*)iter.Next()) ) {
0c01ae65 169 cut->SetMCEventInfo(obj);
170 }
171 }
172 }
173}
174//_____________________________________________________________________________
175void AliCFManager::SetRecEventInfo(const TObject *obj) const {
176
177 //Particle level cuts
178
179 if (!fPartCutList) {
180 AliWarning("No particle cut list found");
181 }
182 else {
183 for(Int_t isel=0;isel<fNStepPart; isel++){
184 if(!fPartCutList[isel])continue;
185 TObjArrayIter iter(fPartCutList[isel]);
186 AliCFCutBase *cut = 0;
187 while ( (cut = (AliCFCutBase*)iter.Next()) ) {
188 cut->SetRecEventInfo(obj);
189 }
190 }
191 }
192
193 //Event level cuts
194
195 if (!fEvtCutList) {
196 AliWarning("No event cut list found");
197 }
198 else {
199 for(Int_t isel=0;isel<fNStepEvt; isel++){
200 if(!fEvtCutList[isel])continue;
201 TObjArrayIter iter(fEvtCutList[isel]);
202 AliCFCutBase *cut = 0;
203 while ( (cut = (AliCFCutBase*)iter.Next()) ) {
204 cut->SetRecEventInfo(obj);
84df86a7 205 }
206 }
563113d0 207 }
208}
563113d0 209
210//_____________________________________________________________________________
211Bool_t AliCFManager::CompareStrings(const TString &cutname,const TString &selcuts) const{
212 //
213 // compare two strings
214 //
215
216 if(selcuts.Contains("all"))return kTRUE;
217 if ( selcuts.CompareTo(cutname) == 0 ||
218 selcuts.BeginsWith(cutname+" ") ||
219 selcuts.EndsWith(" "+cutname) ||
220 selcuts.Contains(" "+cutname+" ")) return kTRUE;
221 return kFALSE;
222}
223
224
84df86a7 225//_____________________________________________________________________________
226void AliCFManager::SetEventCutsList(Int_t isel, TObjArray* array) {
227 //
228 //Setter for event-level selection cut list at selection step isel
229 //
230
231 if (!fEvtContainer) {
4b49fad2 232 AliWarning("No event container defined, you may need to set it first!");
84df86a7 233 }
234
00148604 235 Int_t nstep = fNStepEvt;
84df86a7 236
60935290 237 if (!fEvtCutList) {
238 fEvtCutList = new TObjArray*[nstep] ;
239 for (Int_t i=0; i<nstep; ++i) fEvtCutList[i] = 0;
240 }
84df86a7 241 if (isel >= nstep) {
242 AliWarning(Form("Selection index out of Range! isel=%i, max. number of selections= %i", isel,nstep));
243 return;
244 }
245 fEvtCutList[isel] = array;
246}
247
248//_____________________________________________________________________________
249void AliCFManager::SetParticleCutsList(Int_t isel, TObjArray* array) {
250 //
251 //Setter for particle-level selection cut list at selection step isel
252 //
253
254 if (!fPartContainer) {
4b49fad2 255 AliWarning("No particle container defined, you may need to set it first!");
84df86a7 256 }
257
00148604 258 Int_t nstep = fNStepPart ;
84df86a7 259
afbebc59 260 if (!fPartCutList) {
261 fPartCutList = new TObjArray*[nstep] ;
262 for (Int_t istep = 0; istep < nstep; istep++) fPartCutList[istep] = 0;
263 }
264
84df86a7 265 if (isel >= nstep) {
266 AliWarning(Form("Selection index out of Range! isel=%i, max. number of selections= %i", isel,nstep));
267 return;
268 }
269 fPartCutList[isel] = array;
270}