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