Removing deprecated linearization and MC rescaling (now part of the centrality framework)
[u/mrichter/AliRoot.git] / PWG2 / SPECTRA / LambdaK0PbPb / AliAnalysisCentralitySelector.cxx
CommitLineData
e886738f 1// AliAnalysisMultPbCentralitySelector
2// Interface class to centrality estimators for the PbPb
3// track-multiplicity analysis
4// Michele Floris, CERN
5
6#include "AliAnalysisCentralitySelector.h"
7#include "AliESDtrackCuts.h"
8#include "AliCentrality.h"
9#include "AliESDEvent.h"
10#include "AliLog.h"
11#include "AliESDVZERO.h"
12#include <iostream>
13#include "AliMultiplicity.h"
14
15using namespace std;
16
17
18
19ClassImp(AliAnalysisCentralitySelector)
20
21Bool_t AliAnalysisCentralitySelector::IsCentralityBinSelected(AliESDEvent* aEsd, AliESDtrackCuts * trackCuts) {
22
23 // Centrality selection
24 // On MC cuts on the number of good tracks,
25 // On data cuts using AliESDCentrality and the cut requested in ntracks
26
27 // cout << "Tracks " << trackCuts->CountAcceptedTracks(aEsd) << endl;
28 /// cout << "CENTRALITY " << fUseV0CutRange << " " << fUseMultRange << " " << fMultMin << " " << fMultMax << endl;
29
30 if (fUseMultRange && fUseV0CutRange && fUseSPDOuterRange) {
31 AliFatal(Form("Cannot use multiple estimators at once: fUseMultRange [%d], fUseV0CutRange[%d], fUseSPDOuterRange[%d]!!",
32 fUseMultRange , fUseV0CutRange , fUseSPDOuterRange));
33 }
34
35 if (fUseV0CutRange) {
36
37 Float_t multV0=0;
38 AliESDVZERO* esdV0 = aEsd->GetVZEROData();
39 Float_t multV0A=esdV0->GetMTotV0A();
40 Float_t multV0C=esdV0->GetMTotV0C();
41 multV0 = multV0A+multV0C;
42
e886738f 43 if (multV0 < fMultMin) return kFALSE;
44 if (multV0 > fMultMax) return kFALSE;
45 // cout << "ok" << endl;
46
47 }
48 else if (fUseSPDOuterRange) {
49
50 const AliMultiplicity * mult = aEsd->GetMultiplicity();
51 Float_t outerLayerSPD = mult->GetNumberOfITSClusters(1);
52
53 if (outerLayerSPD < fMultMin) return kFALSE;
54 if (outerLayerSPD > fMultMax) return kFALSE;
55 // cout << "ok" << endl;
56
57 }
5b98504b 58 else if(fUseMultRange) {
e886738f 59 if(!trackCuts){
60 AliFatal("Track cuts object is invalid");
61 }
62 Float_t ntracks = trackCuts->CountAcceptedTracks(aEsd);
63 // cout << "Hey! " << fCentrBin << " " << ntracks << " " << fMultMin <<" - " << fMultMax << endl;
64
65 if (fCentrBin == -1 && !fUseMultRange) return kTRUE;
66 if (ntracks < fMultMin) return kFALSE;
67 if (ntracks > fMultMax) return kFALSE;
68 } else {
69
70 AliCentrality *centrality = (AliCentrality*) aEsd->GetCentrality(); // FIXME: change to alicentrality?
71 if(!centrality && !fUseMultRange) {
72 AliFatal("Centrality object not available");
73 }
74 else {
75 Int_t centrBin = centrality->GetCentralityClass5(fCentrEstimator.Data()) ;
76 if (centrBin != fCentrBin && fCentrBin != -1 && !fUseMultRange) return kFALSE;
77 }
78 }
79
80 // cout << "Selected" << endl;
81
82
83 return kTRUE;
84
85}
86
87void AliAnalysisCentralitySelector::Print(Option_t* option ) const {
88 // Print some information
89
90 Printf("AliAnalysisCentralitySelector [%s]", option);
91 Printf(" - Centrality estimator [%s]",fCentrEstimator.Data());
92 Printf(" - Centrality bin [%d]",fCentrBin);
93 if ( fUseMultRange ) {
94 Printf ("Using multiplicity range [%1.1f - %1.1f]",fMultMin,fMultMax);
95 }
96 if ( fUseV0CutRange ) {
97 Printf ("Using V0 range [%1.1f - %1.1f]",fMultMin,fMultMax);
98 }
99 if ( fIsMC ) {
100 Printf("Running on Monte Carlo, actual cut was on tracks multiplicity [%1.1f - %1.1f]",fMultMin,fMultMax);
101 }
102
103}