]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG/FLOW/Tasks/AliFlowEventCuts.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWG / FLOW / Tasks / AliFlowEventCuts.cxx
index 11eefa588ff4c8424446886ec964d9cc471af3ea..5f2881feaf2142530ccc1362e05100b0fab07a09 100644 (file)
@@ -1,5 +1,4 @@
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  *                                                                        *
  * Author: The ALICE Off-line Project.                                    *
  * Contributors are mentioned in the code where appropriate.              *
 #include "AliTriggerAnalysis.h"
 #include "AliCollisionGeometry.h"
 #include "AliGenEventHeader.h"
+#include <iostream>
+using namespace std;
 
 ClassImp(AliFlowEventCuts)
 
 //-----------------------------------------------------------------------
 AliFlowEventCuts::AliFlowEventCuts():
-  TNamed(),
+  AliFlowEventSimpleCuts(),
   fQA(NULL),
   fCutNumberOfTracks(kFALSE),
   fNumberOfTracksMax(INT_MAX),
@@ -80,23 +81,23 @@ AliFlowEventCuts::AliFlowEventCuts():
   fCutSPDvertexerAnomaly(kFALSE),
   fCutSPDTRKVtxZ(kFALSE),
   fCutTPCmultiplicityOutliers(kFALSE),
-  fCutCentralityPercentile(kFALSE),
+  fCutTPCmultiplicityOutliersAOD(kFALSE),
   fUseCentralityUnchecked(kFALSE),
   fCentralityPercentileMethod(kTPConly),
-  fCentralityPercentileMax(100.),
-  fCentralityPercentileMin(0.),
   fCutZDCtiming(kFALSE),
   fTrigAna(),
   fCutImpactParameter(kFALSE),
   fImpactParameterMin(0.0),
-  fImpactParameterMax(100.0)
+  fImpactParameterMax(100.0),
+  fhistTPCvsGlobalMult(0),
+  fData2011(kFALSE)
 {
   //constructor 
 }
 
 //-----------------------------------------------------------------------
 AliFlowEventCuts::AliFlowEventCuts(const char* name, const char* title):
-  TNamed(name, title),
+  AliFlowEventSimpleCuts(name, title),
   fQA(NULL),
   fCutNumberOfTracks(kFALSE),
   fNumberOfTracksMax(INT_MAX),
@@ -129,23 +130,23 @@ AliFlowEventCuts::AliFlowEventCuts(const char* name, const char* title):
   fCutSPDvertexerAnomaly(kFALSE),
   fCutSPDTRKVtxZ(kFALSE),
   fCutTPCmultiplicityOutliers(kFALSE),
-  fCutCentralityPercentile(kFALSE),
+  fCutTPCmultiplicityOutliersAOD(kFALSE),
   fUseCentralityUnchecked(kFALSE),
   fCentralityPercentileMethod(kTPConly),
-  fCentralityPercentileMax(100.),
-  fCentralityPercentileMin(0.),
   fCutZDCtiming(kFALSE),
   fTrigAna(),
   fCutImpactParameter(kFALSE),
   fImpactParameterMin(0.0),
-  fImpactParameterMax(100.0)
+  fImpactParameterMax(100.0),
+  fhistTPCvsGlobalMult(0),
+  fData2011(kFALSE)
 {
   //constructor 
 }
 
 ////-----------------------------------------------------------------------
 AliFlowEventCuts::AliFlowEventCuts(const AliFlowEventCuts& that):
-  TNamed(that),
+  AliFlowEventSimpleCuts(that),
   fQA(NULL),
   fCutNumberOfTracks(that.fCutNumberOfTracks),
   fNumberOfTracksMax(that.fNumberOfTracksMax),
@@ -178,16 +179,16 @@ AliFlowEventCuts::AliFlowEventCuts(const AliFlowEventCuts& that):
   fCutSPDvertexerAnomaly(that.fCutSPDvertexerAnomaly),
   fCutSPDTRKVtxZ(that.fCutSPDTRKVtxZ),
   fCutTPCmultiplicityOutliers(that.fCutTPCmultiplicityOutliers),
-  fCutCentralityPercentile(that.fCutCentralityPercentile),
+  fCutTPCmultiplicityOutliersAOD(that.fCutTPCmultiplicityOutliersAOD),
   fUseCentralityUnchecked(that.fUseCentralityUnchecked),
   fCentralityPercentileMethod(that.fCentralityPercentileMethod),
-  fCentralityPercentileMax(that.fCentralityPercentileMax),
-  fCentralityPercentileMin(that.fCentralityPercentileMin),
   fCutZDCtiming(that.fCutZDCtiming),
   fTrigAna(),
   fCutImpactParameter(that.fCutImpactParameter),
   fImpactParameterMin(that.fImpactParameterMin),
-  fImpactParameterMax(that.fImpactParameterMax)
+  fImpactParameterMax(that.fImpactParameterMax),
+  fhistTPCvsGlobalMult(that.fhistTPCvsGlobalMult),
+  fData2011(that.fData2011)
 {
   if (that.fQA) DefineHistograms();
   //copy constructor 
@@ -263,12 +264,12 @@ AliFlowEventCuts& AliFlowEventCuts::operator=(const AliFlowEventCuts& that)
   fCutSPDvertexerAnomaly=that.fCutSPDvertexerAnomaly;
   fCutSPDTRKVtxZ=that.fCutSPDTRKVtxZ;
   fCutTPCmultiplicityOutliers=that.fCutTPCmultiplicityOutliers;
-  fCutCentralityPercentile=that.fCutCentralityPercentile;
+  fCutTPCmultiplicityOutliersAOD=that.fCutTPCmultiplicityOutliersAOD;
   fUseCentralityUnchecked=that.fUseCentralityUnchecked;
   fCentralityPercentileMethod=that.fCentralityPercentileMethod;
-  fCentralityPercentileMax=that.fCentralityPercentileMax;
-  fCentralityPercentileMin=that.fCentralityPercentileMin;
   fCutZDCtiming=that.fCutZDCtiming;
+  fhistTPCvsGlobalMult=that.fhistTPCvsGlobalMult;
+  fData2011=that.fData2011;
   return *this;
 }
 
@@ -295,26 +296,57 @@ Bool_t AliFlowEventCuts::PassesCuts(AliVEvent *event, AliMCEvent *mcevent)
   AliAODEvent* aodevent = dynamic_cast<AliAODEvent*>(event);
   Int_t multTPC = 0;
   Int_t multGlobal = 0; 
-  if (fQA)
+
+  // to remove multiplicity outliers, an explicit cut on the correlation 
+  // between global and tpc only tracks can be made by counting the two
+  // sets. as counting is expensive, only count when qa is requested or cut is enabeled
+  // the cut criteria are different for different data takign periods
+  // and (of course) cut criteria, specific routines exist for 10h, 11h data
+  // and esds (by calling AliFlowTrackCuts) or aods (evaluated here explicitely)
+  if(esdevent && (fQA || fCutTPCmultiplicityOutliers)) 
   {
+    //this is pretty slow as we check the event track by track twice
+    //this cut will work for 2010 PbPb data and is dependent on
+    //TPC and ITS reco efficiency (e.g. geometry, calibration etc)
     multTPC = fStandardTPCcuts->Count(event);
     multGlobal = fStandardGlobalCuts->Count(event);
-    QAbefore(0)->Fill(pvtxz);
-    QAbefore(1)->Fill(multGlobal,multTPC);
+    if(fCutTPCmultiplicityOutliers) {
+      if (multTPC > ( 23+1.216*multGlobal)) pass = kFALSE;
+      if (multTPC < (-20+1.087*multGlobal)) pass = kFALSE;
+    }
   }
-  if (fCutTPCmultiplicityOutliers && esdevent)
+  if(aodevent && (fQA || fCutTPCmultiplicityOutliersAOD)) 
   {
-    //this is pretty slow as we check the event track by track twice
-    //this cut will work for 2010 PbPb data and is dependent on
-    //TPC and ITS reco efficiency (e.g. geometry, calibration etc)
-    if (!fQA)
+    //similar (slow) cut for aod's. will work for both 2010 and 2010 pbpb data
+    //but the user is responsible that this object is configured
+    //correctly to select the dataset
+    //FIXME data could dynamically be determined by this class via the
+    //runnumber
+    Int_t nTracks(aodevent->GetNumberOfTracks());
+    for(Int_t iTracks = 0; iTracks < nTracks; iTracks++) { 
+      AliAODTrack* track = dynamic_cast<AliAODTrack*>(aodevent->GetTrack(iTracks));
+      if(!track) continue;
+      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
+      if (track->TestFilterBit(1) && track->Chi2perNDF() > 0.2) multTPC++;
+      if (!track->TestFilterBit(16) || track->Chi2perNDF() < 0.1) continue;
+      Double_t b[2] = {-99., -99.};
+      Double_t bCov[3] = {-99., -99., -99.};
+      AliAODTrack copy(*track);
+      if (copy.PropagateToDCA(event->GetPrimaryVertex(), event->GetMagneticField(), 100., b, bCov) && TMath::Abs(b[0]) < 0.3 && TMath::Abs(b[1]) < 0.3) multGlobal++;
+    }
+    if(fCutTPCmultiplicityOutliersAOD) 
     {
-      multTPC = fStandardTPCcuts->Count(event);
-      multGlobal = fStandardGlobalCuts->Count(event);
+      if(!fData2011 && (multTPC < (-40.3+1.22*multGlobal) || multTPC > (32.1+1.59*multGlobal))) pass = kFALSE;
+      else if(fData2011  && (multTPC < (-36.73 + 1.48*multGlobal) || multTPC > (62.87 + 1.78*multGlobal))) pass = kFALSE;
     }
-    if (multTPC > ( 23+1.216*multGlobal)) {pass=kFALSE;}
-    if (multTPC < (-20+1.087*multGlobal)) {pass=kFALSE;}
   }
+
+  if (fQA)
+  {
+    QAbefore(0)->Fill(pvtxz);
+    QAbefore(1)->Fill(multGlobal,multTPC);
+  }
   if (fCutNContributors)
   {
     if (ncontrib < fNContributorsMin || ncontrib >= fNContributorsMax) pass=kFALSE;
@@ -394,8 +426,8 @@ Bool_t AliFlowEventCuts::PassesCuts(AliVEvent *event, AliMCEvent *mcevent)
       Double_t tSPDVtxZ = aodevent->GetPrimaryVertexSPD()->GetZ();
       if( TMath::Abs(tVtxZ-tSPDVtxZ) > 0.5 ) pass = kFALSE;
     }
-    AliCentrality* centr = aodevent->GetHeader()->GetCentralityP();
-    if(fCutTPCmultiplicityOutliers){
+    AliCentrality* centr = ((AliVAODHeader*)aodevent->GetHeader())->GetCentralityP();
+    if(fCutTPCmultiplicityOutliers || fCutTPCmultiplicityOutliersAOD){
       Double_t v0Centr  = centr->GetCentralityPercentile("V0M");
       Double_t trkCentr = centr->GetCentralityPercentile("TRK"); 
       if(TMath::Abs(v0Centr-trkCentr) > 5) pass = kFALSE;
@@ -458,6 +490,31 @@ Bool_t AliFlowEventCuts::PassesCuts(AliVEvent *event, AliMCEvent *mcevent)
   return pass;
 }
 
+//----------------------------------------------------------------------- 
+Float_t AliFlowEventCuts::GetCentrality(AliVEvent* event, AliMCEvent* /*mcEvent*/)
+{
+  //get the centrality percentile of the event
+  AliESDEvent* esdEvent = dynamic_cast<AliESDEvent*>(event);
+  AliAODEvent* aodEvent = dynamic_cast<AliAODEvent*>(event);
+
+  Float_t centrality=-1.;
+
+  AliCentrality* centr = NULL;
+  if (esdEvent)
+    centr = esdEvent->GetCentrality();
+  if (aodEvent) 
+    centr = ((AliVAODHeader*)aodEvent->GetHeader())->GetCentralityP();
+  
+  if (!centr) return -1.;
+
+  if (fUseCentralityUnchecked) 
+    centrality=centr->GetCentralityPercentileUnchecked(CentrMethName(fCentralityPercentileMethod));
+  else 
+    centrality=centr->GetCentralityPercentile(CentrMethName(fCentralityPercentileMethod));
+
+  return centrality;
+}
+
 //----------------------------------------------------------------------- 
 const char* AliFlowEventCuts::CentrMethName(refMultMethod method) const
 {
@@ -471,7 +528,7 @@ const char* AliFlowEventCuts::CentrMethName(refMultMethod method) const
       return "CL1";
     case kTPConly:
       return "TRK";
-    case kV0:
+    case kVZERO:
       return "V0M";
     default:
       return "";
@@ -510,7 +567,7 @@ Int_t AliFlowEventCuts::RefMult(AliVEvent* event, AliMCEvent *mcEvent)
     fRefMultCuts->SetParamType(AliFlowTrackCuts::kSPDtracklet);
     fRefMultCuts->SetEtaRange(-0.8,0.8);
   }
-  else if (fRefMultMethod==kV0)
+  else if (fRefMultMethod==kVZERO)
   {
     if (!esdevent) return 0;
     vzero=esdevent->GetVZEROData();
@@ -584,3 +641,4 @@ Long64_t AliFlowEventCuts::Merge(TCollection* list)
   return number;
 }
 
+