AliPhysics  50c46fc (50c46fc)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliFlowEventCuts.cxx
Go to the documentation of this file.
1  /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2  * *
3  * Author: The ALICE Off-line Project. *
4  * Contributors are mentioned in the code where appropriate. *
5  * *
6  * Permission to use, copy, modify and distribute this software and its *
7  * documentation strictly for non-commercial purposes is hereby granted *
8  * without fee, provided that the above copyright notice appears in all *
9  * copies and that both the copyright notice and this permission notice *
10  * appear in the supporting documentation. The authors make no claims *
11  * about the suitability of this software for any purpose. It is *
12  * provided "as is" without express or implied warranty. *
13  **************************************************************************/
14 
15 /* $Id$ */
16 
17 // AliFlowEventCuts:
18 // An event cut class for the flow framework
19 //
20 // origin: Mikolaj Krzewicki (mikolaj.krzewicki@cern.ch)
21 
22 #include <limits.h>
23 #include <float.h>
24 #include <TList.h>
25 #include <TH1F.h>
26 #include <TH2F.h>
27 #include <TBrowser.h>
28 #include "TMath.h"
29 #include "TNamed.h"
30 #include "AliVVertex.h"
31 #include "AliVEvent.h"
32 #include "AliESDEvent.h"
33 #include "AliAODEvent.h"
34 #include "AliAODHeader.h"
35 #include "AliCentrality.h"
36 #include "AliMultSelection.h" // available from November 2015
37 #include "AliESDVZERO.h"
38 #include "AliMultiplicity.h"
39 #include "AliMCEvent.h"
40 #include "AliFlowEventCuts.h"
41 #include "AliFlowTrackCuts.h"
42 #include "AliTriggerAnalysis.h"
43 #include "AliCollisionGeometry.h"
44 #include "AliGenEventHeader.h"
45 #include "AliAnalysisUtils.h"
46 #include "AliMultSelection.h"
47 #include "AliNanoAODTrack.h"
48 #include "AliNanoAODHeader.h"
49 #include <iostream>
50 using namespace std;
51 
52 ClassImp(AliFlowEventCuts)
53 
54 //-----------------------------------------------------------------------
57  fQA(NULL),
58  fCutNumberOfTracks(kFALSE),
59  fNumberOfTracksMax(INT_MAX),
60  fNumberOfTracksMin(INT_MIN),
61  fCutRefMult(kFALSE),
62  fRefMultMethod(kTPConly),
63  fUseAliESDtrackCutsRefMult(kFALSE),
64  fRefMultMethodAliESDtrackCuts(AliESDtrackCuts::kTrackletsITSTPC),
65  fRefMultMax(INT_MAX),
66  fRefMultMin(INT_MIN),
67  fRefMultCuts(NULL),
68  fMeanPtCuts(NULL),
69  fStandardTPCcuts(NULL),
70  fStandardGlobalCuts(NULL),
71  fUtils(NULL),
72  fMultSelection(NULL),
73  fCutPrimaryVertexX(kFALSE),
74  fPrimaryVertexXmax(INT_MAX),
75  fPrimaryVertexXmin(INT_MIN),
76  fCutPrimaryVertexY(kFALSE),
77  fPrimaryVertexYmax(INT_MAX),
78  fPrimaryVertexYmin(INT_MIN),
79  fCutPrimaryVertexZ(kFALSE),
80  fPrimaryVertexZmax(INT_MAX),
81  fPrimaryVertexZmin(INT_MIN),
82  fCutNContributors(kFALSE),
83  fNContributorsMax(INT_MAX),
84  fNContributorsMin(INT_MIN),
85  fCutMeanPt(kFALSE),
86  fMeanPtMax(-DBL_MAX),
87  fMeanPtMin(DBL_MAX),
88  fCutSPDvertexerAnomaly(kFALSE),
89  fCutSPDTRKVtxZ(kFALSE),
90  fCutTPCmultiplicityOutliers(kFALSE),
91  fCutTPCmultiplicityOutliersAOD(kFALSE),
92  fUseCentralityUnchecked(kFALSE),
93  fCentralityPercentileMethod(kTPConly),
94  fCutZDCtiming(kFALSE),
95  fTrigAna(),
96  fCutImpactParameter(kFALSE),
97  fImpactParameterMin(0.0),
98  fImpactParameterMax(100.0),
99  fhistTPCvsGlobalMult(0),
100  fData2011(kFALSE),
101  fCheckPileUp(kFALSE)
102 {
103  //constructor
104 }
105 
106 //-----------------------------------------------------------------------
107 AliFlowEventCuts::AliFlowEventCuts(const char* name, const char* title):
108  AliFlowEventSimpleCuts(name, title),
109  fQA(NULL),
110  fCutNumberOfTracks(kFALSE),
111  fNumberOfTracksMax(INT_MAX),
112  fNumberOfTracksMin(INT_MIN),
113  fCutRefMult(kFALSE),
114  fRefMultMethod(kTPConly),
115  fUseAliESDtrackCutsRefMult(kFALSE),
116  fRefMultMethodAliESDtrackCuts(AliESDtrackCuts::kTrackletsITSTPC),
117  fRefMultMax(INT_MAX),
118  fRefMultMin(INT_MIN),
119  fRefMultCuts(NULL),
120  fMeanPtCuts(NULL),
121  fStandardTPCcuts(AliFlowTrackCuts::GetStandardTPCStandaloneTrackCuts2010()),
122  fStandardGlobalCuts(AliFlowTrackCuts::GetStandardGlobalTrackCuts2010()),
123  fUtils(NULL),
124  fMultSelection(NULL),
125  fCutPrimaryVertexX(kFALSE),
126  fPrimaryVertexXmax(INT_MAX),
127  fPrimaryVertexXmin(INT_MIN),
128  fCutPrimaryVertexY(kFALSE),
129  fPrimaryVertexYmax(INT_MAX),
130  fPrimaryVertexYmin(INT_MIN),
131  fCutPrimaryVertexZ(kFALSE),
132  fPrimaryVertexZmax(INT_MAX),
133  fPrimaryVertexZmin(INT_MIN),
134  fCutNContributors(kFALSE),
135  fNContributorsMax(INT_MAX),
136  fNContributorsMin(INT_MIN),
137  fCutMeanPt(kFALSE),
138  fMeanPtMax(-DBL_MAX),
139  fMeanPtMin(DBL_MAX),
140  fCutSPDvertexerAnomaly(kFALSE),
141  fCutSPDTRKVtxZ(kFALSE),
142  fCutTPCmultiplicityOutliers(kFALSE),
143  fCutTPCmultiplicityOutliersAOD(kFALSE),
144  fUseCentralityUnchecked(kFALSE),
145  fCentralityPercentileMethod(kTPConly),
146  fCutZDCtiming(kFALSE),
147  fTrigAna(),
148  fCutImpactParameter(kFALSE),
149  fImpactParameterMin(0.0),
150  fImpactParameterMax(100.0),
151  fhistTPCvsGlobalMult(0),
152  fData2011(kFALSE),
153  fCheckPileUp(kFALSE)
154 {
155  //constructor
156 }
157 
161  fQA(NULL),
162  fCutNumberOfTracks(that.fCutNumberOfTracks),
163  fNumberOfTracksMax(that.fNumberOfTracksMax),
164  fNumberOfTracksMin(that.fNumberOfTracksMin),
165  fCutRefMult(that.fCutRefMult),
166  fRefMultMethod(that.fRefMultMethod),
167  fUseAliESDtrackCutsRefMult(that.fUseAliESDtrackCutsRefMult),
168  fRefMultMethodAliESDtrackCuts(that.fRefMultMethodAliESDtrackCuts),
169  fRefMultMax(that.fRefMultMax),
170  fRefMultMin(that.fRefMultMin),
171  fRefMultCuts(NULL),
172  fMeanPtCuts(NULL),
173  fStandardTPCcuts(NULL),
174  fStandardGlobalCuts(NULL),
175  fUtils(NULL),
176  fMultSelection(NULL),
177  fCutPrimaryVertexX(that.fCutPrimaryVertexX),
178  fPrimaryVertexXmax(that.fPrimaryVertexXmax),
179  fPrimaryVertexXmin(that.fPrimaryVertexXmin),
180  fCutPrimaryVertexY(that.fCutPrimaryVertexX),
181  fPrimaryVertexYmax(that.fPrimaryVertexYmax),
182  fPrimaryVertexYmin(that.fPrimaryVertexYmin),
183  fCutPrimaryVertexZ(that.fCutPrimaryVertexX),
184  fPrimaryVertexZmax(that.fPrimaryVertexZmax),
185  fPrimaryVertexZmin(that.fPrimaryVertexZmin),
186  fCutNContributors(that.fCutNContributors),
187  fNContributorsMax(that.fNContributorsMax),
188  fNContributorsMin(that.fNContributorsMin),
189  fCutMeanPt(that.fCutMeanPt),
190  fMeanPtMax(that.fMeanPtMax),
191  fMeanPtMin(that.fMeanPtMin),
192  fCutSPDvertexerAnomaly(that.fCutSPDvertexerAnomaly),
193  fCutSPDTRKVtxZ(that.fCutSPDTRKVtxZ),
194  fCutTPCmultiplicityOutliers(that.fCutTPCmultiplicityOutliers),
195  fCutTPCmultiplicityOutliersAOD(that.fCutTPCmultiplicityOutliersAOD),
196  fUseCentralityUnchecked(that.fUseCentralityUnchecked),
197  fCentralityPercentileMethod(that.fCentralityPercentileMethod),
198  fCutZDCtiming(that.fCutZDCtiming),
199  fTrigAna(),
200  fCutImpactParameter(that.fCutImpactParameter),
201  fImpactParameterMin(that.fImpactParameterMin),
202  fImpactParameterMax(that.fImpactParameterMax),
203  fhistTPCvsGlobalMult(that.fhistTPCvsGlobalMult),
204  fData2011(that.fData2011),
205  fCheckPileUp(that.fCheckPileUp)
206 {
207  if (that.fQA) DefineHistograms();
208  //copy constructor
209  if (that.fRefMultCuts)
211  if (that.fMeanPtCuts)
215 
216  if (that.fUtils) {
217  fUtils = new AliAnalysisUtils();
218  fUtils->SetUseMVPlpSelection(kTRUE);
219  fUtils->SetUseOutOfBunchPileUp(kTRUE);
220  }
221 }
222 
225 {
226  //dtor
227  delete fMeanPtCuts;
228  delete fRefMultCuts;
229  delete fStandardGlobalCuts;
230  delete fStandardTPCcuts;
231  if(fUtils) {
232  delete fUtils;
233  fUtils = NULL;
234  }
235  if (fQA) { fQA->SetOwner(); fQA->Delete(); delete fQA; }
236 }
237 
240 {
241  //assignment
242  if (this==&that) return *this;
243 
244  if (that.fQA)
245  {
246  if (fQA)
247  {
248  fQA->Delete();
249  delete fQA;
250  }
251  fQA = static_cast<TList*>(that.fQA->Clone());
252  }
253  else
254  {
255  fQA->Delete();
256  delete fQA;
257  fQA=NULL;
258  }
259 
269  if (that.fRefMultCuts) *fRefMultCuts=*(that.fRefMultCuts);
270  if (that.fMeanPtCuts) *fMeanPtCuts=*(that.fMeanPtCuts);
273  if (that.fUtils) {
274  fUtils = new AliAnalysisUtils();
275  fUtils->SetUseMVPlpSelection(kTRUE);
276  fUtils->SetUseOutOfBunchPileUp(kTRUE);
277  }
278 
291  fCutMeanPt=that.fCutMeanPt;
292  fMeanPtMax=that.fMeanPtMax;
293  fMeanPtMin=that.fMeanPtMin;
302  fData2011=that.fData2011;
304  return *this;
305 }
306 
307 //-----------------------------------------------------------------------
309 {
310  //check cuts
311  AliVEvent* vevent = dynamic_cast<AliVEvent*>(obj);
312  AliMCEvent* mcevent = dynamic_cast<AliMCEvent*>(objmc);
313  if (vevent) return PassesCuts(vevent,mcevent);;
314  return kFALSE; //when passed wrong type of object
315 }
316 //-----------------------------------------------------------------------
317 Bool_t AliFlowEventCuts::PassesCuts(AliVEvent *event, AliMCEvent *mcevent)
318 {
320  const AliVVertex* pvtx=event->GetPrimaryVertex();
321  Double_t pvtxx = 0.;
322  Double_t pvtxy = 0.;
323  Double_t pvtxz = 0.;
324  Int_t ncontrib = 0;
325 
326  if(pvtx){
327  pvtxx = pvtx->GetX();
328  pvtxy = pvtx->GetY();
329  pvtxz = pvtx->GetZ();
330  ncontrib = pvtx->GetNContributors();
331  }
332 
333  Bool_t pass=kTRUE;
334  AliESDEvent* esdevent = dynamic_cast<AliESDEvent*>(event);
335  AliAODEvent* aodevent = dynamic_cast<AliAODEvent*>(event);
336 
337  Int_t multTPC = 0;
338  Int_t multGlobal = 0;
339  TObject* header = aodevent->GetHeader();
340 
341  //NanoAOD cuts
342  if((header->InheritsFrom("AliNanoAODStorage"))&&(header->InheritsFrom("AliVAODHeader"))){
343  AliNanoAODHeader *nanoAodHeader = (AliNanoAODHeader*) header;
344 
345  if(fCheckPileUp){
346  Int_t pilepIndex = nanoAodHeader->GetVarIndex("cstPileUp");
347  if(nanoAodHeader->GetVar(pilepIndex)==0) pass = kTRUE;
348  if(nanoAodHeader->GetVar(pilepIndex)==1) pass = kFALSE;
349  }
350 
351  if (fCutPrimaryVertexZ)
352  {
353  if (pvtxz < fPrimaryVertexZmin || pvtxz >= fPrimaryVertexZmax)
354  pass=kFALSE;
355  }
356 
358 
359  Int_t nTracks(aodevent->GetNumberOfTracks());
360  for(Int_t iTracks = 0; iTracks < nTracks; iTracks++) {
361  AliNanoAODTrack* track = dynamic_cast<AliNanoAODTrack*>(aodevent->GetTrack(iTracks));
362 
363  if(!track) continue;
364  if (!track || track->Pt() < .2 || track->Pt() > 5.0 || TMath::Abs(track->Eta()) > .8 || track->GetTPCNcls() < 70 || track->GetTPCsignal() < 10.0) continue;
365  if (track->TestFilterBit(1) && track->Chi2perNDF() > 0.2) multTPC++;
366  if (!track->TestFilterBit(16) || track->Chi2perNDF() < 0.1) continue;
367 
368  Double_t b[2] = {-99., -99.};
369  Double_t bCov[3] = {-99., -99., -99.};
370 
371  AliNanoAODTrack copy(*track);
372  Double_t magField = nanoAodHeader->GetMagneticField();
373 
374  if (magField!=0){
375 
376  if (track->PropagateToDCA(aodevent->GetPrimaryVertex(), magField, 100., b, bCov) && TMath::Abs(b[0]) < 0.3 && TMath::Abs(b[1]) < 0.3) multGlobal++;
377 
378  }
379  }
380 
382  {
383  if(nanoAodHeader->GetRunNumber() < 209122) {
384  if(!fData2011 && (multTPC < (-40.3+1.22*multGlobal) || multTPC > (32.1+1.59*multGlobal))) {
385  pass = kFALSE;
386  }
387  else if(fData2011 && (multTPC < (-36.73 + 1.48*multGlobal) || multTPC > (62.87 + 1.78*multGlobal))) pass = kFALSE;
388  } else {
389  if(multTPC < (-18.5+1.15*multGlobal) || multTPC > (200.+1.45*multGlobal)) {
390  pass = kFALSE;
391  }
392  }
393  }
394 
395  if (fQA)
396  {
397  QAbefore(0)->Fill(pvtxz);
398  QAbefore(1)->Fill(multGlobal,multTPC);
399  }
400 
402  AliCentrality* centr = ((AliVAODHeader*)aodevent->GetHeader())->GetCentralityP();
404  Double_t v0Centr = nanoAodHeader->GetCentr("V0M");
405  Double_t trkCentr = nanoAodHeader->GetCentr("TRK");
406 
407  if(TMath::Abs(v0Centr-trkCentr) > 5) pass = kFALSE;
408  }
409 
412  if (!centr->IsEventInCentralityClassUnchecked( fCentralityPercentileMin,
415  pass = kFALSE;
416  }
417  } else {
418  if (!centr->IsEventInCentralityClass( fCentralityPercentileMin,
421  pass = kFALSE;
422  }
423  }
424  }
425  }else {
427  Float_t lPercentile = nanoAodHeader->GetCentr(CentrMethName(fCentralityPercentileMethod));
428 
429  if(!(fCentralityPercentileMin <= lPercentile && lPercentile < fCentralityPercentileMax))
430  {
431  pass=kFALSE;
432  }
433  }
434  }
435  }
436 
437  if (fQA&&pass)
438  {
439  QAafter(0)->Fill(pvtxz);
440  QAafter(1)->Fill(multGlobal,multTPC);
441  }
442 
443  }else{
444 
445 
446 
447  if(fCheckPileUp){
448  // pile-up rejection
449  if(!fUtils) {
450  fUtils = new AliAnalysisUtils();
451  fUtils->SetUseMVPlpSelection(kTRUE);
452  fUtils->SetUseOutOfBunchPileUp(kTRUE);
453  }
454  if(fUtils->IsPileUpEvent(aodevent)) pass = kFALSE;
455  }
456 
457 
458  // to remove multiplicity outliers, an explicit cut on the correlation
459  // between global and tpc only tracks can be made by counting the two
460  // sets. as counting is expensive, only count when qa is requested or cut is enabeled
461  // the cut criteria are different for different data takign periods
462  // and (of course) cut criteria, specific routines exist for 10h, 11h data
463  // and esds (by calling AliFlowTrackCuts) or aods (evaluated here explicitely)
464  if(esdevent && (fQA || fCutTPCmultiplicityOutliers))
465  {
466  //this is pretty slow as we check the event track by track twice
467  //this cut will work for 2010 PbPb data and is dependent on
468  //TPC and ITS reco efficiency (e.g. geometry, calibration etc)
469  multTPC = fStandardTPCcuts->Count(event);
470  multGlobal = fStandardGlobalCuts->Count(event);
472  if (multTPC > ( 23+1.216*multGlobal)) pass = kFALSE;
473  if (multTPC < (-20+1.087*multGlobal)) pass = kFALSE;
474  }
475  }
476  if(aodevent && (fQA || fCutTPCmultiplicityOutliersAOD))
477  {
478  //similar (slow) cut for aod's. will work for both 2010 and 2010 pbpb data
479  //but the user is responsible that this object is configured
480  //correctly to select the dataset
481  //FIXME data could dynamically be determined by this class via the
482  //runnumber
483  Int_t nTracks(aodevent->GetNumberOfTracks());
484  for(Int_t iTracks = 0; iTracks < nTracks; iTracks++) {
485  AliAODTrack* track = dynamic_cast<AliAODTrack*>(aodevent->GetTrack(iTracks));
486  if(!track) continue;
487  if (!track || track->Pt() < .2 || track->Pt() > 5.0 || TMath::Abs(track->Eta()) > .8 || track->GetTPCNcls() < 70 || !track->GetDetPid() || track->GetDetPid()->GetTPCsignal() < 10.0) continue; // general quality cut
488  if (track->TestFilterBit(1) && track->Chi2perNDF() > 0.2) multTPC++;
489  if (!track->TestFilterBit(16) || track->Chi2perNDF() < 0.1) continue;
490  Double_t b[2] = {-99., -99.};
491  Double_t bCov[3] = {-99., -99., -99.};
492  AliAODTrack copy(*track);
493  if (copy.PropagateToDCA(event->GetPrimaryVertex(), event->GetMagneticField(), 100., b, bCov) && TMath::Abs(b[0]) < 0.3 && TMath::Abs(b[1]) < 0.3) multGlobal++;
494  }
496  {
497  if(event->GetRunNumber() < 209122) {
498  if(!fData2011 && (multTPC < (-40.3+1.22*multGlobal) || multTPC > (32.1+1.59*multGlobal))) pass = kFALSE;
499  else if(fData2011 && (multTPC < (-36.73 + 1.48*multGlobal) || multTPC > (62.87 + 1.78*multGlobal))) pass = kFALSE;
500  } else {
501  if(multTPC < (-18.5+1.15*multGlobal) || multTPC > (200.+1.45*multGlobal)) pass = kFALSE;
502  }
503  }
504  }
505 
506  if (fQA)
507  {
508  QAbefore(0)->Fill(pvtxz);
509  QAbefore(1)->Fill(multGlobal,multTPC);
510  }
511 
512  if (fCutNContributors)
513  {
514  if (ncontrib < fNContributorsMin || ncontrib >= fNContributorsMax) pass=kFALSE;
515  }
516  if (fCutPrimaryVertexX)
517  {
518  if (pvtxx < fPrimaryVertexXmin || pvtxx >= fPrimaryVertexXmax) pass=kFALSE;
519  }
520  if (fCutPrimaryVertexY)
521  {
522  if (pvtxy < fPrimaryVertexYmin || pvtxy >= fPrimaryVertexYmax) pass=kFALSE;
523  }
524  if (fCutPrimaryVertexZ)
525  {
526  if (pvtxz < fPrimaryVertexZmin || pvtxz >= fPrimaryVertexZmax)
527  pass=kFALSE;
528  }
529 
530  // Handles ESD event
531  if (fCutCentralityPercentile&&esdevent)
532  {
534  {
535  AliCentrality* centr = esdevent->GetCentrality();
537  {
538  if (!centr->IsEventInCentralityClassUnchecked( fCentralityPercentileMin,
541  {
542  pass=kFALSE;
543  }
544  }
545  else
546  {
547  if (!centr->IsEventInCentralityClass( fCentralityPercentileMin,
550  {
551  pass=kFALSE;
552  }
553  }
554  } // if(!fUseNewCentralityFramework)
555  else
556  {
557  fMultSelection = (AliMultSelection *) esdevent->FindListObject("MultSelection");
558  Float_t lPercentile = fMultSelection->GetMultiplicityPercentile(CentrMethName(fCentralityPercentileMethod));
559  if(!(fCentralityPercentileMin <= lPercentile && lPercentile < fCentralityPercentileMax))
560  {
561  pass=kFALSE;
562  }
563  } // else
564  }
565  if (fCutSPDvertexerAnomaly&&esdevent)
566  {
567  const AliESDVertex* sdpvertex = esdevent->GetPrimaryVertexSPD();
568  if (sdpvertex->GetNContributors()<1) pass=kFALSE;
569  if (sdpvertex->GetDispersion()>0.04) pass=kFALSE;
570  if (sdpvertex->GetZRes()>0.25) pass=kFALSE;
571  const AliESDVertex* tpcvertex = esdevent->GetPrimaryVertexTPC();
572  if (tpcvertex->GetNContributors()<1) pass=kFALSE;
573  const AliMultiplicity* tracklets = esdevent->GetMultiplicity();
574  if (tpcvertex->GetNContributors()<(-10.0+0.25*tracklets->GetNumberOfITSClusters(0)))
575  {
576  pass=kFALSE;
577  }
578  }
579  if (fCutZDCtiming&&esdevent)
580  {
581  if (!fTrigAna.ZDCTimeTrigger(esdevent))
582  {
583  pass=kFALSE;
584  }
585  }
586  if(fCutNumberOfTracks) {if ( event->GetNumberOfTracks() < fNumberOfTracksMin ||
587  event->GetNumberOfTracks() >= fNumberOfTracksMax ) pass=kFALSE;}
588  if((fCutRefMult&&mcevent)||(fCutRefMult&&esdevent))
589  {
590  //reference multiplicity still to be defined
591  Double_t refMult = RefMult(event,mcevent);
592  if (refMult < fRefMultMin || refMult >= fRefMultMax )
593  {
594  pass=kFALSE;
595  }
596  }
597 
598  // Handles AOD event
599  if(aodevent) {
600  if(fCutSPDTRKVtxZ) {
601  Double_t tVtxZ = aodevent->GetPrimaryVertex()->GetZ();
602  Double_t tSPDVtxZ = aodevent->GetPrimaryVertexSPD()->GetZ();
603  if( TMath::Abs(tVtxZ-tSPDVtxZ) > 0.5 ) pass = kFALSE;
604  }
606  AliCentrality* centr = ((AliVAODHeader*)aodevent->GetHeader())->GetCentralityP();
608  Double_t v0Centr = centr->GetCentralityPercentile("V0M");
609  Double_t trkCentr = centr->GetCentralityPercentile("TRK");
610  if(TMath::Abs(v0Centr-trkCentr) > 5) pass = kFALSE;
611  }
614  if (!centr->IsEventInCentralityClassUnchecked( fCentralityPercentileMin,
617  pass = kFALSE;
618  }
619  } else {
620  if (!centr->IsEventInCentralityClass( fCentralityPercentileMin,
623  pass = kFALSE;
624  }
625  }
626  }
627  }
628  else {
630  fMultSelection = (AliMultSelection *) aodevent->FindListObject("MultSelection");
631  Float_t lPercentile = fMultSelection->GetMultiplicityPercentile(CentrMethName(fCentralityPercentileMethod));
632  if(!fMultSelection){
633  AliWarning("AliMultSelection not found, did you Run AliMultSelectionTask? \n");
634  }
635  if(!(fCentralityPercentileMin <= lPercentile && lPercentile < fCentralityPercentileMax))
636  {
637  pass=kFALSE;
638  }
639  }
640  }
641  }
642 
643  if (fCutMeanPt)
644  {
645  Float_t meanpt=0.0;
646  Int_t ntracks=event->GetNumberOfTracks();
647  Int_t nselected=0;
648  for (Int_t i=0; i<ntracks; i++)
649  {
650  AliVParticle* track = event->GetTrack(i);
651  if (!track) continue;
652  Bool_t localpass=kTRUE;
653  if (fMeanPtCuts) localpass=fMeanPtCuts->IsSelected(track);
654  if (localpass)
655  {
656  meanpt += track->Pt();
657  nselected++;
658  }
659  }
660  if (nselected) meanpt=meanpt/nselected;
661  if (meanpt<fMeanPtMin || meanpt >= fMeanPtMax) pass=kFALSE;
662  }
663 
664  //impact parameter cut
665  if(fCutImpactParameter) {
666  Double_t gImpactParameter = 0.;
667  if(mcevent) {
668  AliCollisionGeometry* headerH = dynamic_cast<AliCollisionGeometry*>(dynamic_cast<AliMCEvent*>(mcevent)->GenEventHeader());
669  if(headerH)
670  gImpactParameter = headerH->ImpactParameter();
671  }
672  if ((gImpactParameter < fImpactParameterMin) || (gImpactParameter >= fImpactParameterMax ))
673  pass=kFALSE;
674  }
675 
676  if (fQA&&pass)
677  {
678  QAafter(1)->Fill(multGlobal,multTPC);
679  QAafter(0)->Fill(pvtxz);
680  }
681  }
682  return pass;
683 }
684 
685 //-----------------------------------------------------------------------
686 Float_t AliFlowEventCuts::GetCentrality(AliVEvent* event, AliMCEvent* /*mcEvent*/)
687 {
688  //get the centrality percentile of the event
689  AliESDEvent* esdEvent = dynamic_cast<AliESDEvent*>(event);
690  AliAODEvent* aodEvent = dynamic_cast<AliAODEvent*>(event);
691 
692  Float_t centrality=-1.;
693 
695  {
696  AliCentrality* centr = NULL;
697  if (esdEvent)
698  centr = esdEvent->GetCentrality();
699  if (aodEvent)
700  centr = ((AliVAODHeader*)aodEvent->GetHeader())->GetCentralityP();
701 
702  if (!centr) return -1.;
703 
705  centrality=centr->GetCentralityPercentileUnchecked(CentrMethName(fCentralityPercentileMethod));
706  else
707  centrality=centr->GetCentralityPercentile(CentrMethName(fCentralityPercentileMethod));
708  }
709  else // if(!fUseNewCentralityFramework)
710  {
711  if (esdEvent)
712  {
713  fMultSelection = (AliMultSelection *) esdEvent->FindListObject("MultSelection");
714  Float_t lPercentile = fMultSelection->GetMultiplicityPercentile(CentrMethName(fCentralityPercentileMethod));
715  centrality = lPercentile;
716  }
717  else if (aodEvent)
718  {
719  fMultSelection = (AliMultSelection *) aodEvent->FindListObject("MultSelection");
720  Float_t lPercentile = fMultSelection->GetMultiplicityPercentile(CentrMethName(fCentralityPercentileMethod));
721  if(!fMultSelection){
722  AliWarning("AliMultSelection not found, did you Run AliMultSelectionTask? \n");
723  }
724  centrality = lPercentile;
725  } // else if (aodEvent)
726  } // else // if(!fUseNewCentralityFramework)
727 
728  return centrality;
729 }
730 
731 //-----------------------------------------------------------------------
733 {
734  //get the string for refmultmethod, for use with AliCentrality in
735  //the cut on centrality percentile
736  switch (method)
737  {
738  case kSPDtracklets:
739  return "TKL";
740  case kSPD1clusters:
741  return "CL1";
742  case kTPConly:
743  return "TRK";
744  case kVZERO:
745  return "V0M";
746  case kZDC:
747  return "ZDC";
748  default:
749  return "";
750  }
751 }
752 //-----------------------------------------------------------------------
754 {
755  //make a set of standard event cuts, caller becomes owner
756  AliFlowEventCuts* cuts = new AliFlowEventCuts();
757  return cuts;
758 }
759 
760 //-----------------------------------------------------------------------
761 Int_t AliFlowEventCuts::RefMult(AliVEvent* event, AliMCEvent *mcEvent)
762 {
763  //calculate the reference multiplicity, if all fails return 0
764  AliESDVZERO* vzero = NULL;
765  AliESDEvent* esdevent = dynamic_cast<AliESDEvent*>(event);
766 
767  if (fUseAliESDtrackCutsRefMult && esdevent)
768  {
769  //use the standard ALICE reference multiplicity with the default eta range
770  return AliESDtrackCuts::GetReferenceMultiplicity(esdevent, fRefMultMethodAliESDtrackCuts);
771  }
772 
774  {
776  fRefMultCuts->SetEtaRange(-0.8,0.8);
777  fRefMultCuts->SetPtMin(0.15);
778  }
780  {
781  fRefMultCuts = new AliFlowTrackCuts("tracklet refmult cuts");
783  fRefMultCuts->SetEtaRange(-0.8,0.8);
784  }
785  else if (fRefMultMethod==kVZERO)
786  {
787  if (!esdevent) return 0;
788  vzero=esdevent->GetVZEROData();
789  if (!vzero) return 0;
790  return TMath::Nint(vzero->GetMTotV0A()+vzero->GetMTotV0C());
791  }
792  else if (fRefMultMethod==kSPD1clusters)
793  {
794  if (!esdevent) return 0;
795  const AliMultiplicity* mult = esdevent->GetMultiplicity();
796  if (!mult) return 0;
797  return mult->GetNumberOfITSClusters(1);
798  }
799 
800  Int_t refmult=0;
801  fRefMultCuts->SetEvent(event,mcEvent);
802  Int_t numberOfInputObjects = fRefMultCuts->GetNumberOfInputObjects();
803  for (Int_t i=0; i<numberOfInputObjects; i++) {
805  refmult++;
806  }
807  return refmult;
808 }
809 //_____________________________________________________________________________
811 {
812  //define QA histos
813  if (fQA) return;
814 
815  Bool_t adddirstatus = TH1::AddDirectoryStatus();
816  TH1::AddDirectory(kFALSE);
817  fQA = new TList(); fQA->SetOwner();
818  fQA->SetName(Form("%s QA",GetName()));
819  TList* before = new TList(); before->SetOwner();
820  before->SetName("before");
821  TList* after = new TList(); after->SetOwner();
822  after->SetName("after");
823  fQA->Add(before);
824  fQA->Add(after);
825  before->Add(new TH1F("zvertex",";z;event cout",500,-15.,15.)); //0
826  after->Add(new TH1F("zvertex",";z;event cout",500,-15.,15.)); //0
827  before->Add(new TH2F("fTPCvsGlobalMult","TPC only vs Global track multiplicity;global;TPC only",600,0,3000,600,0,4000));//1
828  after->Add(new TH2F("fTPCvsGlobalMult","TPC only vs Global track multiplicity;global;TPC only",600,0,3000,600,0,4000));//1
829  TH1::AddDirectory(adddirstatus);
830 }
831 
832 //---------------------------------------------------------------//
833 void AliFlowEventCuts::Browse(TBrowser* b)
834 {
835  //some browsing capabilities
836  if (fQA) b->Add(fQA);
837 }
838 
839 //---------------------------------------------------------------//
841 {
842  //merge
843  Int_t number=0;
844  AliFlowEventCuts* obj;
845  if (!list) return 0;
846  if (list->GetEntries()<1) return 0;
847  TIter next(list);
848  while ( (obj = dynamic_cast<AliFlowEventCuts*>(next())) )
849  {
850  if (obj==this) continue;
851  TList listwrapper;
852  listwrapper.Add(obj->GetQA());
853  fQA->Merge(&listwrapper);
854  number++;
855  }
856  return number;
857 }
858 
859 
Double_t fPrimaryVertexZmax
AliESDtrackCuts::MultEstTrackType fRefMultMethodAliESDtrackCuts
Float_t GetCentrality(AliVEvent *event, AliMCEvent *mcEvent)
double Double_t
Definition: External.C:58
Double_t fPrimaryVertexXmax
Bool_t fData2011
correlation between TPCMult and GlobalMult
TObject * GetInputObject(Int_t i)
Definition: External.C:236
const char * title
Definition: MakeQAPdf.C:27
Long64_t Merge(TCollection *list)
TH1 * QAbefore(Int_t i)
long long Long64_t
Definition: External.C:43
Bool_t fCutTPCmultiplicityOutliersAOD
static AliFlowTrackCuts * GetStandardGlobalTrackCuts2010()
AliFlowTrackCuts * fStandardTPCcuts
AliFlowTrackCuts * fMeanPtCuts
centrality
Double_t fPrimaryVertexYmin
Double_t fPrimaryVertexYmax
TList * list
TDirectory file where lists per trigger are stored in train ouput.
TH1 * QAafter(Int_t i)
AliFlowEventCuts & operator=(const AliFlowEventCuts &someCuts)
Int_t Count(AliVEvent *event=NULL)
AliAnalysisUtils * fUtils
virtual Bool_t IsSelected(TObject *obj, Int_t id=-666)
void SetParamType(trackParameterType paramType)
const char * CentrMethName(refMultMethod method) const
refMultMethod fRefMultMethod
Bool_t PassesCuts(AliVEvent *event, AliMCEvent *mcevent)
Int_t GetNumberOfInputObjects() const
int Int_t
Definition: External.C:63
static AliFlowTrackCuts * GetStandardTPCStandaloneTrackCuts()
float Float_t
Definition: External.C:68
Int_t RefMult(AliVEvent *event, AliMCEvent *mcEvent=0x0)
static AliFlowTrackCuts * GetStandardTPCStandaloneTrackCuts2010()
Int_t method
refMultMethod fCentralityPercentileMethod
void Browse(TBrowser *b)
Bool_t fCutPrimaryVertexX
new centrality framework
AliTriggerAnalysis fTrigAna
Double_t fPrimaryVertexZmin
AliMultSelection * fMultSelection
analysis utils object
Bool_t fUseAliESDtrackCutsRefMult
Double_t fImpactParameterMax
void SetEvent(AliVEvent *event, AliMCEvent *mcEvent=NULL)
AliFlowTrackCuts * fStandardGlobalCuts
Bool_t fUseCentralityUnchecked
AliFlowTrackCuts * fRefMultCuts
TList * GetQA() const
static AliFlowEventCuts * StandardCuts()
Double_t fImpactParameterMin
Double_t fPrimaryVertexXmin
bool Bool_t
Definition: External.C:53
virtual Bool_t IsSelected(TObject *obj, TObject *objmc)
Bool_t fCutTPCmultiplicityOutliers
void SetEtaRange(Float_t r1, Float_t r2)