]>
Commit | Line | Data |
---|---|---|
daf66719 | 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 | /* $Id$ */ | |
17 | ||
18 | // AliFlowEventCuts: | |
19 | // An event cut class for the flow framework | |
20 | // | |
21 | // origin: Mikolaj Krzewicki (mikolaj.krzewicki@cern.ch) | |
22 | ||
23 | #include <limits.h> | |
24 | #include <float.h> | |
1c4a5bf7 | 25 | #include "TMath.h" |
daf66719 | 26 | #include "TNamed.h" |
ee242db3 | 27 | #include "AliVVertex.h" |
daf66719 | 28 | #include "AliVEvent.h" |
333ce021 | 29 | #include "AliESDEvent.h" |
7d9ab4fb | 30 | #include "AliESDCentrality.h" |
1c4a5bf7 | 31 | #include "AliESDVZERO.h" |
9a0783cc | 32 | #include "AliMultiplicity.h" |
333ce021 | 33 | #include "AliMCEvent.h" |
daf66719 | 34 | #include "AliFlowEventCuts.h" |
9a0783cc | 35 | #include "AliFlowTrackCuts.h" |
daf66719 | 36 | |
37 | ClassImp(AliFlowEventCuts) | |
38 | ||
39 | //----------------------------------------------------------------------- | |
40 | AliFlowEventCuts::AliFlowEventCuts(): | |
41 | TNamed(), | |
42 | fCutNumberOfTracks(kFALSE), | |
43 | fNumberOfTracksMax(INT_MAX), | |
5559ce24 | 44 | fNumberOfTracksMin(INT_MIN), |
45 | fCutRefMult(kFALSE), | |
9a0783cc | 46 | fRefMultMethod(kTPConly), |
5559ce24 | 47 | fRefMultMax(INT_MAX), |
333ce021 | 48 | fRefMultMin(INT_MIN), |
ee242db3 | 49 | fRefMultCuts(NULL), |
2279052e | 50 | fMeanPtCuts(NULL), |
ee242db3 | 51 | fCutPrimaryVertexX(kFALSE), |
52 | fPrimaryVertexXmax(INT_MAX), | |
53 | fPrimaryVertexXmin(INT_MIN), | |
54 | fCutPrimaryVertexY(kFALSE), | |
55 | fPrimaryVertexYmax(INT_MAX), | |
56 | fPrimaryVertexYmin(INT_MIN), | |
57 | fCutPrimaryVertexZ(kFALSE), | |
58 | fPrimaryVertexZmax(INT_MAX), | |
59 | fPrimaryVertexZmin(INT_MIN), | |
60 | fCutNContributors(kFALSE), | |
61 | fNContributorsMax(INT_MAX), | |
d32716f4 | 62 | fNContributorsMin(INT_MIN), |
63 | fCutMeanPt(kFALSE), | |
e90a4b03 | 64 | fMeanPtMax(-DBL_MAX), |
d7e66a39 | 65 | fMeanPtMin(DBL_MAX), |
7d9ab4fb | 66 | fCutSPDvertexerAnomaly(kTRUE), |
67 | fCutCentralityPercentile(kFALSE), | |
68 | fCentralityPercentileMethod(kTPConly), | |
69 | fCentralityPercentileMax(100.), | |
70 | fCentralityPercentileMin(0.) | |
daf66719 | 71 | { |
72 | //constructor | |
73 | } | |
74 | ||
957517fa | 75 | //----------------------------------------------------------------------- |
76 | AliFlowEventCuts::AliFlowEventCuts(const char* name, const char* title): | |
77 | TNamed(name, title), | |
78 | fCutNumberOfTracks(kFALSE), | |
79 | fNumberOfTracksMax(INT_MAX), | |
80 | fNumberOfTracksMin(INT_MIN), | |
81 | fCutRefMult(kFALSE), | |
9a0783cc | 82 | fRefMultMethod(kTPConly), |
957517fa | 83 | fRefMultMax(INT_MAX), |
333ce021 | 84 | fRefMultMin(INT_MIN), |
ee242db3 | 85 | fRefMultCuts(NULL), |
2279052e | 86 | fMeanPtCuts(NULL), |
ee242db3 | 87 | fCutPrimaryVertexX(kFALSE), |
88 | fPrimaryVertexXmax(INT_MAX), | |
89 | fPrimaryVertexXmin(INT_MIN), | |
90 | fCutPrimaryVertexY(kFALSE), | |
91 | fPrimaryVertexYmax(INT_MAX), | |
92 | fPrimaryVertexYmin(INT_MIN), | |
93 | fCutPrimaryVertexZ(kFALSE), | |
94 | fPrimaryVertexZmax(INT_MAX), | |
95 | fPrimaryVertexZmin(INT_MIN), | |
96 | fCutNContributors(kFALSE), | |
97 | fNContributorsMax(INT_MAX), | |
d32716f4 | 98 | fNContributorsMin(INT_MIN), |
99 | fCutMeanPt(kFALSE), | |
e90a4b03 | 100 | fMeanPtMax(-DBL_MAX), |
d7e66a39 | 101 | fMeanPtMin(DBL_MAX), |
7d9ab4fb | 102 | fCutSPDvertexerAnomaly(kTRUE), |
103 | fCutCentralityPercentile(kFALSE), | |
104 | fCentralityPercentileMethod(kTPConly), | |
105 | fCentralityPercentileMax(100.), | |
106 | fCentralityPercentileMin(0.) | |
957517fa | 107 | { |
108 | //constructor | |
109 | } | |
110 | ||
daf66719 | 111 | ////----------------------------------------------------------------------- |
03d364db | 112 | AliFlowEventCuts::AliFlowEventCuts(const AliFlowEventCuts& that): |
113 | TNamed(that), | |
114 | fCutNumberOfTracks(that.fCutNumberOfTracks), | |
115 | fNumberOfTracksMax(that.fNumberOfTracksMax), | |
116 | fNumberOfTracksMin(that.fNumberOfTracksMin), | |
117 | fCutRefMult(that.fCutRefMult), | |
118 | fRefMultMethod(that.fRefMultMethod), | |
119 | fRefMultMax(that.fRefMultMax), | |
120 | fRefMultMin(that.fRefMultMin), | |
ee242db3 | 121 | fRefMultCuts(NULL), |
2279052e | 122 | fMeanPtCuts(NULL), |
ee242db3 | 123 | fCutPrimaryVertexX(that.fCutPrimaryVertexX), |
124 | fPrimaryVertexXmax(that.fPrimaryVertexXmax), | |
125 | fPrimaryVertexXmin(that.fPrimaryVertexXmin), | |
126 | fCutPrimaryVertexY(that.fCutPrimaryVertexX), | |
127 | fPrimaryVertexYmax(that.fPrimaryVertexYmax), | |
128 | fPrimaryVertexYmin(that.fPrimaryVertexYmin), | |
129 | fCutPrimaryVertexZ(that.fCutPrimaryVertexX), | |
130 | fPrimaryVertexZmax(that.fPrimaryVertexZmax), | |
131 | fPrimaryVertexZmin(that.fPrimaryVertexZmin), | |
132 | fCutNContributors(that.fCutNContributors), | |
133 | fNContributorsMax(that.fNContributorsMax), | |
d32716f4 | 134 | fNContributorsMin(that.fNContributorsMin), |
135 | fCutMeanPt(that.fCutMeanPt), | |
136 | fMeanPtMax(that.fMeanPtMax), | |
d7e66a39 | 137 | fMeanPtMin(that.fMeanPtMin), |
7d9ab4fb | 138 | fCutSPDvertexerAnomaly(that.fCutSPDvertexerAnomaly), |
139 | fCutCentralityPercentile(that.fCutCentralityPercentile), | |
140 | fCentralityPercentileMethod(that.fCentralityPercentileMethod), | |
141 | fCentralityPercentileMax(that.fCentralityPercentileMax), | |
142 | fCentralityPercentileMin(that.fCentralityPercentileMin) | |
03d364db | 143 | { |
144 | //copy constructor | |
ee242db3 | 145 | if (that.fRefMultCuts) |
146 | fRefMultCuts = new AliFlowTrackCuts(*(that.fRefMultCuts)); | |
2279052e | 147 | if (that.fMeanPtCuts) |
148 | fMeanPtCuts = new AliFlowTrackCuts(*(that.fMeanPtCuts)); | |
149 | } | |
150 | ||
151 | ////----------------------------------------------------------------------- | |
152 | AliFlowEventCuts::~AliFlowEventCuts() | |
153 | { | |
154 | //dtor | |
155 | delete fMeanPtCuts; | |
156 | delete fRefMultCuts; | |
03d364db | 157 | } |
158 | ||
daf66719 | 159 | ////----------------------------------------------------------------------- |
03d364db | 160 | AliFlowEventCuts& AliFlowEventCuts::operator=(const AliFlowEventCuts& that) |
161 | { | |
162 | //assignment | |
163 | fCutNumberOfTracks=that.fCutNumberOfTracks; | |
164 | fNumberOfTracksMax=that.fNumberOfTracksMax; | |
165 | fNumberOfTracksMin=that.fNumberOfTracksMin; | |
166 | fCutRefMult=that.fCutRefMult; | |
167 | fRefMultMethod=that.fRefMultMethod; | |
168 | fRefMultMax=that.fRefMultMax; | |
169 | fRefMultMin=that.fRefMultMin; | |
ee242db3 | 170 | if (that.fRefMultCuts) *fRefMultCuts=*(that.fRefMultCuts); |
2279052e | 171 | if (that.fMeanPtCuts) *fMeanPtCuts=*(that.fMeanPtCuts); |
ee242db3 | 172 | fCutPrimaryVertexX=that.fCutPrimaryVertexX; |
173 | fPrimaryVertexXmin=that.fPrimaryVertexXmin; | |
174 | fPrimaryVertexXmax=that.fPrimaryVertexXmax; | |
175 | fPrimaryVertexYmin=that.fPrimaryVertexYmin; | |
176 | fPrimaryVertexYmax=that.fPrimaryVertexYmax; | |
177 | fPrimaryVertexZmin=that.fPrimaryVertexZmin; | |
178 | fPrimaryVertexZmax=that.fPrimaryVertexZmax; | |
179 | fCutNContributors=that.fCutNContributors; | |
180 | fNContributorsMax=that.fNContributorsMax; | |
181 | fNContributorsMin=that.fNContributorsMin; | |
d32716f4 | 182 | fCutMeanPt=that.fCutMeanPt; |
183 | fMeanPtMax=that.fMeanPtMax; | |
184 | fMeanPtMin=that.fMeanPtMin; | |
d7e66a39 | 185 | fCutSPDvertexerAnomaly=that.fCutSPDvertexerAnomaly; |
7d9ab4fb | 186 | fCutCentralityPercentile=that.fCutCentralityPercentile; |
187 | fCentralityPercentileMethod=that.fCentralityPercentileMethod; | |
188 | fCentralityPercentileMax=that.fCentralityPercentileMax; | |
189 | fCentralityPercentileMin=that.fCentralityPercentileMin; | |
03d364db | 190 | return *this; |
191 | } | |
daf66719 | 192 | |
193 | //----------------------------------------------------------------------- | |
7d9ab4fb | 194 | Bool_t AliFlowEventCuts::IsSelected(TObject* obj) |
daf66719 | 195 | { |
196 | //check cuts | |
7d9ab4fb | 197 | AliVEvent* vevent = dynamic_cast<AliVEvent*>(obj); |
daf66719 | 198 | if (vevent) return PassesCuts(vevent); |
199 | return kFALSE; //when passed wrong type of object | |
200 | } | |
201 | //----------------------------------------------------------------------- | |
7d9ab4fb | 202 | Bool_t AliFlowEventCuts::PassesCuts(AliVEvent *event) |
daf66719 | 203 | { |
204 | ///check if event passes cuts | |
7d9ab4fb | 205 | AliESDEvent* esdevent = dynamic_cast<AliESDEvent*>(event); |
206 | if (fCutCentralityPercentile) | |
207 | { | |
208 | AliESDCentrality* centr = esdevent->GetCentrality(); | |
209 | return centr->IsEventInCentralityClass( fCentralityPercentileMin, | |
210 | fCentralityPercentileMax, | |
211 | CentrMethName(fCentralityPercentileMethod) ); | |
212 | } | |
213 | if (fCutSPDvertexerAnomaly&&esdevent) | |
214 | { | |
215 | const AliESDVertex* sdpvertex = esdevent->GetPrimaryVertexSPD(); | |
216 | if (sdpvertex->GetNContributors()<1) return kFALSE; | |
217 | if (sdpvertex->GetDispersion()>0.04) return kFALSE; | |
218 | if (sdpvertex->GetZRes()>0.25) return kFALSE; | |
219 | const AliESDVertex* tpcvertex = esdevent->GetPrimaryVertexTPC(); | |
220 | if (tpcvertex->GetNContributors()<1) return kFALSE; | |
221 | const AliMultiplicity* tracklets = esdevent->GetMultiplicity(); | |
222 | if (tpcvertex->GetNContributors()<(-10.0+0.25*tracklets->GetNumberOfITSClusters(0))) | |
223 | return kFALSE; | |
224 | } | |
225 | if(fCutNumberOfTracks) {if ( event->GetNumberOfTracks() < fNumberOfTracksMin || | |
226 | event->GetNumberOfTracks() >= fNumberOfTracksMax ) return kFALSE;} | |
5559ce24 | 227 | if(fCutRefMult) |
228 | { | |
229 | //reference multiplicity still to be defined | |
03d364db | 230 | Double_t refMult = RefMult(event); |
231 | if (refMult < fRefMultMin || refMult >= fRefMultMax ) | |
5559ce24 | 232 | return kFALSE; |
233 | } | |
ee242db3 | 234 | const AliVVertex* pvtx=event->GetPrimaryVertex(); |
235 | Double_t pvtxx = pvtx->GetX(); | |
236 | Double_t pvtxy = pvtx->GetY(); | |
237 | Double_t pvtxz = pvtx->GetZ(); | |
238 | Int_t ncontrib = pvtx->GetNContributors(); | |
239 | if (fCutNContributors) | |
240 | { | |
241 | if (ncontrib < fNContributorsMin || ncontrib >= fNContributorsMax) | |
242 | return kFALSE; | |
243 | } | |
244 | if (fCutPrimaryVertexX) | |
245 | { | |
246 | if (pvtxx < fPrimaryVertexXmin || pvtxx >= fPrimaryVertexXmax) | |
247 | return kFALSE; | |
248 | } | |
249 | if (fCutPrimaryVertexY) | |
250 | { | |
251 | if (pvtxy < fPrimaryVertexYmin || pvtxy >= fPrimaryVertexYmax) | |
252 | return kFALSE; | |
253 | } | |
254 | if (fCutPrimaryVertexZ) | |
255 | { | |
256 | if (pvtxz < fPrimaryVertexZmin || pvtxz >= fPrimaryVertexZmax) | |
257 | return kFALSE; | |
258 | } | |
d32716f4 | 259 | if (fCutMeanPt) |
260 | { | |
261 | Float_t meanpt=0.0; | |
262 | Int_t ntracks=event->GetNumberOfTracks(); | |
f33c7420 | 263 | Int_t nselected=0; |
d32716f4 | 264 | for (Int_t i=0; i<ntracks; i++) |
265 | { | |
266 | AliVParticle* track = event->GetTrack(i); | |
267 | if (!track) continue; | |
2279052e | 268 | Bool_t pass=kTRUE; |
269 | if (fMeanPtCuts) pass=fMeanPtCuts->IsSelected(track); | |
f33c7420 | 270 | if (pass) |
271 | { | |
272 | meanpt += track->Pt(); | |
273 | nselected++; | |
274 | } | |
d32716f4 | 275 | } |
f33c7420 | 276 | meanpt=meanpt/nselected; |
d32716f4 | 277 | if (meanpt<fMeanPtMin || meanpt >= fMeanPtMax) return kFALSE; |
278 | } | |
daf66719 | 279 | return kTRUE; |
280 | } | |
281 | ||
7d9ab4fb | 282 | //----------------------------------------------------------------------- |
283 | const char* AliFlowEventCuts::CentrMethName(refMultMethod method) const | |
284 | { | |
285 | //get the string for refmultmethod, for use with AliESDCentrality in | |
286 | //the cut on centrality percentile | |
287 | switch (method) | |
288 | { | |
289 | case kSPDtracklets: | |
290 | return "TKL"; | |
291 | case kSPD1clusters: | |
292 | return "CL1"; | |
293 | case kTPConly: | |
294 | return "TRK"; | |
295 | case kV0: | |
296 | return "V0M"; | |
297 | default: | |
298 | return ""; | |
299 | } | |
300 | } | |
daf66719 | 301 | //----------------------------------------------------------------------- |
302 | AliFlowEventCuts* AliFlowEventCuts::StandardCuts() | |
303 | { | |
304 | //make a set of standard event cuts, caller becomes owner | |
305 | AliFlowEventCuts* cuts = new AliFlowEventCuts(); | |
306 | return cuts; | |
307 | } | |
333ce021 | 308 | |
309 | //----------------------------------------------------------------------- | |
7d9ab4fb | 310 | Int_t AliFlowEventCuts::RefMult(AliVEvent* event) |
333ce021 | 311 | { |
9a0783cc | 312 | //calculate the reference multiplicity, if all fails return 0 |
1c4a5bf7 | 313 | AliESDVZERO* vzero = NULL; |
7d9ab4fb | 314 | AliESDEvent* esdevent = dynamic_cast<AliESDEvent*>(event); |
2cdf5762 | 315 | const AliMultiplicity* mult = esdevent->GetMultiplicity(); |
1c4a5bf7 | 316 | Int_t refmult=0; |
32b846cd | 317 | |
318 | switch (fRefMultMethod) | |
9a0783cc | 319 | { |
32b846cd | 320 | case kTPConly: |
321 | if (fRefMultCuts) break; | |
322 | fRefMultCuts = AliFlowTrackCuts::GetStandardTPCOnlyTrackCuts(); | |
323 | fRefMultCuts->SetEtaRange(-0.8,0.8); | |
324 | fRefMultCuts->SetPtMin(0.15); | |
325 | break; | |
326 | case kSPDtracklets: | |
327 | if (fRefMultCuts) break; | |
328 | fRefMultCuts = new AliFlowTrackCuts(); | |
329 | fRefMultCuts->SetParamType(AliFlowTrackCuts::kESD_SPDtracklet); | |
330 | fRefMultCuts->SetEtaRange(-0.8,0.8); | |
331 | break; | |
332 | case kV0: | |
333 | if (!esdevent) return 0; | |
334 | vzero=esdevent->GetVZEROData(); | |
335 | if (!vzero) return 0; | |
336 | refmult = TMath::Nint(vzero->GetMTotV0A()+vzero->GetMTotV0C()); | |
337 | return refmult; | |
338 | case kSPD1clusters: | |
339 | if (!mult) return 0; | |
340 | refmult = mult->GetNumberOfITSClusters(1); | |
341 | return refmult; | |
342 | default: | |
343 | return 0; | |
9a0783cc | 344 | } |
345 | ||
7d9ab4fb | 346 | fRefMultCuts->SetEvent(event); |
2948ac5a | 347 | for (Int_t i=0; i<fRefMultCuts->GetNumberOfInputObjects(); i++) |
348 | { | |
349 | if (fRefMultCuts->IsSelected(fRefMultCuts->GetInputObject(i),i)) | |
350 | refmult++; | |
351 | } | |
352 | return refmult; | |
333ce021 | 353 | } |