AliAnalysisMultPbCentralitySelector
authormfloris <mfloris@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 10 Nov 2010 21:20:04 +0000 (21:20 +0000)
committermfloris <mfloris@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 10 Nov 2010 21:20:04 +0000 (21:20 +0000)
- Implemented sharp cut on V0M
AliAnalysisMultPbTrackHistoManager
- Added histogram for particle species
run.C & run.sh
- More options for centrality selection, new physics selection

PWG0/multPbPb/AliAnalysisMultPbCentralitySelector.cxx
PWG0/multPbPb/AliAnalysisMultPbCentralitySelector.h
PWG0/multPbPb/AliAnalysisMultPbTrackHistoManager.cxx
PWG0/multPbPb/AliAnalysisMultPbTrackHistoManager.h
PWG0/multPbPb/AliAnalysisTaskMultPbTracks.cxx
PWG0/multPbPb/correct.C
PWG0/multPbPb/run.C
PWG0/multPbPb/run.sh

index 77d5cb8..3f871ad 100644 (file)
@@ -8,6 +8,7 @@
 #include "AliESDCentrality.h"
 #include "AliESDEvent.h"
 #include "AliLog.h"
+#include "AliESDVZERO.h"
 #include <iostream>
 
 using namespace std;
@@ -23,9 +24,23 @@ Bool_t AliAnalysisMultPbCentralitySelector::IsCentralityBinSelected(AliESDEvent*
   // On data cuts using AliESDCentrality and the cut requested in ntracks
 
   //  cout << "Tracks " << trackCuts->CountAcceptedTracks(aEsd) << endl;
+  ///  cout << "CENTRALITY " << fUseV0CutRange << " " << fUseMultRange << " " << fMultMin << " " << fMultMax << endl;
   
 
-  if(fIsMC || fUseMultRange) {
+  if (fUseV0CutRange) {
+
+    AliESDVZERO* esdV0 = aEsd->GetVZEROData();
+    Float_t multV0A=esdV0->GetMTotV0A();
+    Float_t multV0C=esdV0->GetMTotV0C();
+    Float_t multV0 = multV0A+multV0C;
+    //    cout << "V0 Mult: " << multV0 << " " << fMultMin << " " << fMultMax << endl;
+    
+    if (multV0 < fMultMin) return kFALSE;
+    if (multV0 > fMultMax) return kFALSE;
+    //    cout << "ok" << endl;
+
+  }
+  else if(fIsMC || fUseMultRange) {
     if(!trackCuts){
       AliFatal("Track cuts object is invalid");
     }
@@ -62,10 +77,13 @@ void AliAnalysisMultPbCentralitySelector::Print(Option_t* option ) const {
   Printf(" - File1 used for centrality estimate: [%s]", fFile1.Data());
   Printf(" - File2 used for centrality estimate: [%s]", fFile2.Data());
   if ( fUseMultRange ) {
-    Printf ("Using multiplicity range [%d - %d]",fMultMin,fMultMax);
+    Printf ("Using multiplicity range [%1.1f - %1.1f]",fMultMin,fMultMax);
+  }
+  if ( fUseV0CutRange ) {
+    Printf ("Using V0 range [%1.1f - %1.1f]",fMultMin,fMultMax);
   }
   if ( fIsMC ) {    
-    Printf("Running on Monte Carlo, actual cut was on tracks multiplicity [%d - %d]",fMultMin,fMultMax);    
+    Printf("Running on Monte Carlo, actual cut was on tracks multiplicity [%1.1f - %1.1f]",fMultMin,fMultMax);    
   } 
   
 }
index 1da9e39..76017a6 100644 (file)
@@ -30,7 +30,7 @@ class AliAnalysisMultPbCentralitySelector : public AliAnalysisCuts
 {
 public:
 
-  AliAnalysisMultPbCentralitySelector() : fIsMC (0), fCentrEstimator(""), fCentrBin(-1), fMultMin(0), fMultMax(1000000), fFile1(""), fFile2(""), fUseMultRange(kFALSE) {;}
+  AliAnalysisMultPbCentralitySelector() : fIsMC (0), fCentrEstimator(""), fCentrBin(-1), fMultMin(0), fMultMax(1000000), fFile1(""), fFile2(""), fUseMultRange(kFALSE), fUseV0CutRange(kFALSE) {;}
   virtual ~AliAnalysisMultPbCentralitySelector(){}
     
   // AliAnalysisCuts interface
@@ -43,6 +43,7 @@ public:
   void SetIsMC(Bool_t flag = kTRUE, Int_t multMin = 0, Int_t multMax=10000) { fIsMC = flag; fMultMin = multMin; fMultMax = multMax; }
   void SetMultRange(Int_t multMin = 0, Int_t multMax=10000) { fMultMin = multMin; fMultMax = multMax; }
   void SetUseMultRange(Bool_t flag = kTRUE) {fUseMultRange = flag;}
+  void SetUseV0Range(Bool_t flag = kTRUE) {fUseV0CutRange = flag;}
   void SetCentralityEstimator(const char * estimator) { fCentrEstimator = estimator; }
   void SetCentralityBin(Int_t bin) { fCentrBin = bin; }
   void SetCentrTaskFiles(const char * file1, const char * file2) { fFile1 = file1; fFile2 = file2; }
@@ -53,11 +54,12 @@ protected:
   Bool_t fIsMC;             // flag if MC is analyzed
   TString fCentrEstimator;  // Centrality estimator for AliESDCentrality
   Int_t   fCentrBin; // centrality bin to be selected
-  Int_t fMultMin ; // Minimum multiplicity, because on MC we cut on tracks rather than on the estimator  
-  Int_t fMultMax ; // Maximum multiplicity, because on MC we cut on tracks rather than on the estimator  
+  Float_t fMultMin ; // Minimum multiplicity, because on MC we cut on tracks rather than on the estimator . Also used for other estimators
+  Float_t fMultMax ; // Maximum multiplicity, because on MC we cut on tracks rather than on the estimator . Also used for other estimators
   TString fFile1; // file used by centrality task. Set here for bookkeeping
   TString fFile2; // file used by centrality task. Set here for bookkeeping
   Bool_t fUseMultRange; // if true, use track bins rather than multiplicity estimator
+  Bool_t fUseV0CutRange; // if true, use v0 range rather than multiplicity estimator
 
   ClassDef(AliAnalysisMultPbCentralitySelector, 2)
     
index 1f9471c..f03b851 100644 (file)
@@ -5,9 +5,12 @@
 #include "TH1I.h"
 #include "TROOT.h"
 #include "TMCProcess.h"
+#include "AliMCParticle.h"
 
 #include <iostream>
+
 using namespace std;
+
 ClassImp(AliAnalysisMultPbTrackHistoManager)
 
 const char * AliAnalysisMultPbTrackHistoManager::kStatStepNames[]     = { "All Events", "After physics Selection", "After centrality selection", "With Vertex" };
@@ -15,7 +18,7 @@ const char * AliAnalysisMultPbTrackHistoManager::kHistoPtEtaVzNames[] = { "hGenP
                                                                          "hRecPtEtaVzSecWeak", "hRecPtEtaVzSecMaterial", "hRecPtEtaVzFake"};
 const char * AliAnalysisMultPbTrackHistoManager::kHistoDCANames[]     = { "hGenDCA", "hRecDCA", "hRecDCAPrim", "hRecDCASecWeak","hRecDCASecMaterial", "hRecDCAFake"};
 const char * AliAnalysisMultPbTrackHistoManager::kHistoPrefix[]     = { "hGen", "hRec", "hRecPrim", "hRecSecWeak","hRecSecMaterial", "hRecFake"};
-
+const char * AliAnalysisMultPbTrackHistoManager::kSpeciesName[]     = { "#pi+", "K+", "p", "l+",  "#pi-", "K-", "#bar{p}", "l-", "Others"};
 
 
 AliAnalysisMultPbTrackHistoManager::AliAnalysisMultPbTrackHistoManager() : AliHistoListWrapper(), fHNameSuffix(""){ 
@@ -181,11 +184,11 @@ TH1D * AliAnalysisMultPbTrackHistoManager::GetHistoEta (Histo_t id,
   return h;
 }
 
-TH1D * AliAnalysisMultPbTrackHistoManager::GetHistoSpecies(Histo_t id) {
+TH1D * AliAnalysisMultPbTrackHistoManager::GetHistoProcess(Histo_t id) {
 
   // Returns histogram with particle specties
 
-  TString name = TString(kHistoPrefix[id])+"_Species";
+  TString name = TString(kHistoPrefix[id])+"_Process";
 
   TH1D * h =  (TH1D*) GetHisto(name);
   if (!h) {
@@ -195,7 +198,7 @@ TH1D * AliAnalysisMultPbTrackHistoManager::GetHistoSpecies(Histo_t id) {
 
     AliInfo(Form("Booking histo %s",name.Data()));
 
-    h = new TH1D (name.Data(), Form("Particle species (%s)",kHistoPrefix[id]), kPNoProcess+1, -0.5, kPNoProcess+1-0.5);                         
+    h = new TH1D (name.Data(), Form("Particle production process (%s)",kHistoPrefix[id]), kPNoProcess+1, -0.5, kPNoProcess+1-0.5);                      
     Int_t nbin = kPNoProcess+1;
     for(Int_t ibin = 0; ibin < nbin; ibin++){
       h->GetXaxis()->SetBinLabel(ibin+1,TMCProcessName[ibin]);      
@@ -211,6 +214,36 @@ TH1D * AliAnalysisMultPbTrackHistoManager::GetHistoSpecies(Histo_t id) {
 }
 
 
+TH1D * AliAnalysisMultPbTrackHistoManager::GetHistoSpecies(Histo_t id) {
+
+  // Returns histogram with particle specties
+
+  TString name = TString(kHistoPrefix[id])+"_Species";
+
+  TH1D * h =  (TH1D*) GetHisto(name);
+  if (!h) {
+    name+=fHNameSuffix;
+    Bool_t oldStatus = TH1::AddDirectoryStatus();
+    TH1::AddDirectory(kFALSE);
+
+    AliInfo(Form("Booking histo %s",name.Data()));
+
+    h = new TH1D (name.Data(), Form("Particle species (%s)",kHistoPrefix[id]), kNPart+1, -0.5, kNPart+1-0.5);                   
+    Int_t nbin = kNPart+1;
+    for(Int_t ibin = 0; ibin < nbin; ibin++){
+      h->GetXaxis()->SetBinLabel(ibin+1,kSpeciesName[ibin]);      
+    }
+    TH1::AddDirectory(oldStatus);
+    fList->Add(h);
+
+
+  }
+  return h;
+  
+
+}
+
+
 
 TH1I * AliAnalysisMultPbTrackHistoManager::GetHistoStats() {
   // Returns histogram with event statistiscs (processed events at each step)
@@ -364,7 +397,46 @@ TH1I * AliAnalysisMultPbTrackHistoManager::BookHistoStats() {
   return h;
 }
 
-
+Int_t AliAnalysisMultPbTrackHistoManager::GetLocalParticleID(AliMCParticle * part) {
+  // returns the local code (Part_t)
+  
+  Int_t pdgcode = part->PdgCode();
+  switch(pdgcode) {
+
+  case 211:
+    return kPartPiPlus;
+    break;
+  case -211:
+    return kPartPiMinus;
+    break;
+  case 2212:
+    return kPartP;
+    break;
+  case -2212:
+    return kPartPBar;
+    break;
+  case 321:
+    return kPartKPlus;
+    break;
+  case -321:
+    return kPartKMinus;
+    break;
+  case -11:
+    return kPartLMinus;
+    break;
+  case 11:
+    return kPartLPlus;
+    break;
+  case -13:
+    return kPartLMinus;
+    break;
+  case 13:
+    return kPartLPlus;
+    break;
+  default:
+    return kPartOther;
+  }
+}
 
 
  
index 37efdef..80a92a9 100644 (file)
@@ -7,6 +7,7 @@
 class TH3D;
 class TH1D;
 class TH1I;
+class AliMCParticle;
 
 //-------------------------------------------------------------------------
 //                      AliAnalysisMultPbTrackHistoManager
@@ -24,6 +25,8 @@ public:
 
   typedef enum {kHistoGen, kHistoRec, kHistoRecPrim, kHistoRecSecWeak, kHistoRecSecMat, kHistoRecFake, kNHistos} Histo_t;
   typedef enum {kStatAll, kStatPhysSel, kStatCentr, kStatVtx, kNStatBins} Stat_t;
+  typedef enum {kPartPiPlus, kPartKPlus, kPartP, kPartLPlus, kPartPiMinus, kPartKMinus, kPartPBar, kPartLMinus, kPartOther, kNPart} Part_t;
+
 
   AliAnalysisMultPbTrackHistoManager();
   AliAnalysisMultPbTrackHistoManager(const char * name,const char * title);
@@ -44,11 +47,12 @@ public:
   TH1D * GetHistoMult(Histo_t id);
 
   TH1D * GetHistoSpecies(Histo_t id);
+  TH1D * GetHistoProcess(Histo_t id);
 
   // Misch utils
   void ScaleHistos (Double_t nev, Option_t * option="");
-  
-
+  Int_t GetLocalParticleID(AliMCParticle * part);
+  void FillParticleID(Histo_t id, AliMCParticle * part) { GetHistoSpecies(id)->Fill(GetLocalParticleID(part));}
 
   // Histo bookers
   TH3D * BookHistoPtEtaVz(const char * name, const char * title);
@@ -65,11 +69,12 @@ private:
   static const char * kHistoPtEtaVzNames[];   // names of the 3D histograms pt/eta/vz
   static const char * kHistoDCANames[];   // names of the DCA histograms 
   static const char * kHistoPrefix[];   // prefix for histo names // FIXME: remove the others and keep only this 
+  static const char * kSpeciesName[];   // Particle species
   TString fHNameSuffix; // Suffix added to all histo names. Useful if you have in the same session e.g. MC and data.
 
   AliAnalysisMultPbTrackHistoManager& operator=(const AliAnalysisMultPbTrackHistoManager& task);
   
-  ClassDef(AliAnalysisMultPbTrackHistoManager, 2)
+  ClassDef(AliAnalysisMultPbTrackHistoManager, 3)
 
 
 };
index bbe5fc0..d4d8be7 100644 (file)
@@ -177,9 +177,9 @@ void AliAnalysisTaskMultPbTracks::UserExec(Option_t *)
        if(!IsPhysicalPrimaryAndTransportBit(ipart)) continue;
  
        nPhysicalPrimaries++;
-       // Fill species histo
-       fHistoManager->GetHistoSpecies(AliAnalysisMultPbTrackHistoManager::kHistoGen)->Fill(mcPart->Particle()->GetUniqueID());
-
+       // Fill species histo and particle species
+       fHistoManager->GetHistoProcess(AliAnalysisMultPbTrackHistoManager::kHistoGen)->Fill(mcPart->Particle()->GetUniqueID());
+       fHistoManager->FillParticleID(AliAnalysisMultPbTrackHistoManager::kHistoGen, mcPart);
        
        // Get MC vertex
        //FIXME: which vertex do I take for MC?
@@ -267,7 +267,7 @@ void AliAnalysisTaskMultPbTracks::UserExec(Option_t *)
       else {
        if(IsPhysicalPrimaryAndTransportBit(label)) {
          // Fill species histo
-         fHistoManager->GetHistoSpecies(AliAnalysisMultPbTrackHistoManager::kHistoRecPrim)->Fill(mcPart->Particle()->GetUniqueID());
+         fHistoManager->GetHistoProcess(AliAnalysisMultPbTrackHistoManager::kHistoRecPrim)->Fill(mcPart->Particle()->GetUniqueID());
          if(accepted)
            hTracks[AliAnalysisMultPbTrackHistoManager::kHistoRecPrim]->Fill(esdTrack->Pt(),esdTrack->Eta(),vtxESD->GetZ());
          if(acceptedNoDCA)
@@ -282,13 +282,13 @@ void AliAnalysisTaskMultPbTracks::UserExec(Option_t *)
            mfl = Int_t (codemoth/ TMath::Power(10, Int_t(TMath::Log10(codemoth))));
          }
          if(mfl==3){ // strangeness
-           fHistoManager->GetHistoSpecies(AliAnalysisMultPbTrackHistoManager::kHistoRecSecWeak)->Fill(mcPart->Particle()->GetUniqueID());
+           fHistoManager->GetHistoProcess(AliAnalysisMultPbTrackHistoManager::kHistoRecSecWeak)->Fill(mcPart->Particle()->GetUniqueID());
            if(accepted)
              hTracks[AliAnalysisMultPbTrackHistoManager::kHistoRecSecWeak]->Fill(esdTrack->Pt(),esdTrack->Eta(),vtxESD->GetZ());
            if(acceptedNoDCA)
              hDCA[AliAnalysisMultPbTrackHistoManager::kHistoRecSecWeak]->Fill(weightedDCA);      
          }else{ // material
-           fHistoManager->GetHistoSpecies(AliAnalysisMultPbTrackHistoManager::kHistoRecSecMat)->Fill(mcPart->Particle()->GetUniqueID());
+           fHistoManager->GetHistoProcess(AliAnalysisMultPbTrackHistoManager::kHistoRecSecMat)->Fill(mcPart->Particle()->GetUniqueID());
            if(accepted)
              hTracks[AliAnalysisMultPbTrackHistoManager::kHistoRecSecMat]->Fill(esdTrack->Pt(),esdTrack->Eta(),vtxESD->GetZ());
            if(acceptedNoDCA)
index d83c4ec..e7abe1d 100644 (file)
@@ -47,15 +47,15 @@ void correct(TString dataFolder = "./output/LHC10g2d_130844_V0M_bin_10/", TStrin
   LoadLibs();
   LoadData(dataFolder,correctionFolder);
   SetStyle();
-  ShowAcceptanceInVzSlices();
-  return;
+  // ShowAcceptanceInVzSlices();
+  // return;
 
   // TODO add some cool printout for cuts and centrality selection
   
   CheckVz();
 
   Double_t fractionWeak = 1, fractionMaterial=1; 
-  CheckSecondaries(fractionWeak, fractionMaterial);
+  //  CheckSecondaries(fractionWeak, fractionMaterial);
   cout << "Rescaling secondaries correction, weak: " << fractionWeak << ", material: " << fractionMaterial <<endl;
   
 
index 4706601..d96dacf 100644 (file)
@@ -10,7 +10,7 @@ TList * listToLoad = new TList();
 TChain * GetAnalysisChain(const char * incollection);
 
 void run(Char_t* data, Long64_t nev = -1, Long64_t offset = 0, Bool_t debug = kFALSE, Int_t runMode = 0, Bool_t isMC = 0, 
-        Int_t centrBin = 0, const char * centrEstimator = "VOM", Bool_t useTrackCentralityCut = kFALSE, Int_t trackMin=0, Int_t trackMax=10000, 
+        Int_t centrBin = 0, const char * centrEstimator = "VOM", Int_t useOtherCentralityCut = 0, Int_t trackMin=0, Int_t trackMax=10000, 
         const char* option = "",TString customSuffix = "", Int_t workers = -1)
 {
   // runMode:
@@ -57,34 +57,38 @@ void run(Char_t* data, Long64_t nev = -1, Long64_t offset = 0, Bool_t debug = kF
   gROOT->ProcessLine(".L $ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
   physicsSelectionTask = AddTaskPhysicsSelection(isMC,0);//FIXME
   // FIXME!!
-  if(!isMC) {
-    AliPhysicsSelection * physSel = physicsSelectionTask->GetPhysicsSelection();
-    //    physSel->AddCollisionTriggerClass("+CTRUE-B-NOPF-ALL");
-    physSel->AddCollisionTriggerClass("+CMBAC-B-NOPF-ALL");
-    physSel->AddCollisionTriggerClass("+CMBS1C-B-NOPF-ALL");
-    physSel->AddCollisionTriggerClass("+CMBS1A-B-NOPF-ALL");
-    physSel->AddBGTriggerClass("+CMBAC-C-NOPF-ALL");
-    physSel->AddBGTriggerClass("+CMBS1C-C-NOPF-ALL");
-    physSel->AddBGTriggerClass("+CMBS1A-C-NOPF-ALL");
-    physSel->AddBGTriggerClass("+CMBAC-A-NOPF-ALL");
-    physSel->AddBGTriggerClass("+CMBS1C-A-NOPF-ALL");
-    physSel->AddBGTriggerClass("+CMBS1A-A-NOPF-ALL");
-    physSel->AddBGTriggerClass("+CMBAC-E-NOPF-ALL");
-    physSel->AddBGTriggerClass("+CMBS1C-E-NOPF-ALL");
-    physSel->AddBGTriggerClass("+CMBS1A-E-NOPF-ALL");
-    //    physSel->AddBGTriggerClass       ("+C0SM1-E-NOPF-ALL");
-  }
+  // if(!isMC) {
+  //   AliPhysicsSelection * physSel = physicsSelectionTask->GetPhysicsSelection();
+  //   //    physSel->AddCollisionTriggerClass("+CTRUE-B-NOPF-ALL");
+  //   physSel->AddCollisionTriggerClass("+CMBAC-B-NOPF-ALL");
+  //   physSel->AddCollisionTriggerClass("+CMBS1C-B-NOPF-ALL");
+  //   physSel->AddCollisionTriggerClass("+CMBS1A-B-NOPF-ALL");
+  //   physSel->AddBGTriggerClass("+CMBAC-C-NOPF-ALL");
+  //   physSel->AddBGTriggerClass("+CMBS1C-C-NOPF-ALL");
+  //   physSel->AddBGTriggerClass("+CMBS1A-C-NOPF-ALL");
+  //   physSel->AddBGTriggerClass("+CMBAC-A-NOPF-ALL");
+  //   physSel->AddBGTriggerClass("+CMBS1C-A-NOPF-ALL");
+  //   physSel->AddBGTriggerClass("+CMBS1A-A-NOPF-ALL");
+  //   physSel->AddBGTriggerClass("+CMBAC-E-NOPF-ALL");
+  //   physSel->AddBGTriggerClass("+CMBS1C-E-NOPF-ALL");
+  //   physSel->AddBGTriggerClass("+CMBS1A-E-NOPF-ALL");
+  //   //    physSel->AddBGTriggerClass       ("+C0SM1-E-NOPF-ALL");
+  // }
 
   // Centrality
   AliCentralitySelectionTask *taskCentr = new AliCentralitySelectionTask("CentralitySelection");
-  // const char * file1 = "$ALICE_ROOT/ANALYSIS/macros/test_AliCentralityBy1D.root";
+  const char * file1 = "$ALICE_ROOT/ANALYSIS/macros/test_AliCentralityBy1D.root";
+  const char * file2 = "$ALICE_ROOT/ANALYSIS/macros/test_AliCentralityByFunction.root";
+  // const char * file1 = "$ALICE_ROOT/ANALYSIS/macros/AliCentralityBy1D_LHC10g2a_100.root";
+  // const char * file2 = "$ALICE_ROOT/ANALYSIS/macros/AliCentralityByFunction_LHC10g2a_100.root";
+  // const char * file1 = "$ALICE_ROOT/ANALYSIS/macros/AliCentralityBy1D_137161_GLAU.root";
   // const char * file2 = "$ALICE_ROOT/ANALYSIS/macros/test_AliCentralityByFunction.root";
-  const char * file1 = "$ALICE_ROOT/ANALYSIS/macros/AliCentralityBy1D_LHC10g2a_100.root";
-  const char * file2 = "$ALICE_ROOT/ANALYSIS/macros/AliCentralityByFunction_LHC10g2a_100.root";
+  
   taskCentr->SetPercentileFile (file1);
   taskCentr->SetPercentileFile2(file2);
-  mgr->AddTask(taskCentr);
-  mgr->ConnectInput (taskCentr,0, mgr->GetCommonInputContainer());
+  //FIXME
+  //  mgr->AddTask(taskCentr);
+  //  mgr->ConnectInput (taskCentr,0, mgr->GetCommonInputContainer());
 
   // Create my own centrality selector
   AliAnalysisMultPbCentralitySelector * centrSelector = new AliAnalysisMultPbCentralitySelector();
@@ -94,10 +98,19 @@ void run(Char_t* data, Long64_t nev = -1, Long64_t offset = 0, Bool_t debug = kF
   // FIXME!!!
 
   //centrSelector->SetIsMC(isMC,1500,2300);
-  if(useTrackCentralityCut){
+  cout << "SETTING" << endl;
+  
+  if(useOtherCentralityCut == 1){
+    cout << "SETTING MULT" << endl;
     centrSelector->SetUseMultRange();
     centrSelector->SetMultRange(trackMin,trackMax);
   }
+  if(useOtherCentralityCut == 2){
+    cout << "SETTING V0" << endl;
+    
+    centrSelector->SetUseV0Range();
+    centrSelector->SetMultRange(trackMin,trackMax);
+  }
 
   // Parse option strings
   TString optionStr(option);
@@ -142,11 +155,12 @@ void run(Char_t* data, Long64_t nev = -1, Long64_t offset = 0, Bool_t debug = kF
   gROOT->ProcessLine(".L $ALICE_ROOT/PWG0/multPbPb/AddTaskMultPbPbTracks.C");
   AliAnalysisTaskMultPbTracks * task = AddTaskMultPbPbTracks("multPbPbtracks.root", cuts, centrSelector); // kTRUE enables DCA cut
   task->SetIsMC(useMCKinematics);
-  if (isMC) {
-    task->SetOfflineTrigger(AliVEvent::kMB);
-  } else {
-    task->SetOfflineTrigger(AliVEvent::kUserDefined);
-  }
+  task->SetOfflineTrigger(AliVEvent::kMB);
+  // if (isMC) {
+  //   task->SetOfflineTrigger(AliVEvent::kMB);
+  // } else {
+  //   task->SetOfflineTrigger(AliVEvent::kUserDefined);
+  // }
   if(useMCKinematics) task->GetHistoManager()->SetSuffix("MC");
   if(customSuffix!=""){
     cout << "Setting custom suffix: " << customSuffix << endl;    
@@ -171,10 +185,12 @@ void run(Char_t* data, Long64_t nev = -1, Long64_t offset = 0, Bool_t debug = kF
     cout << "ERROR: unknown run mode" << endl;        
   }
 
-  if (!useTrackCentralityCut) {
+  if (!useOtherCentralityCut) {
     pathsuffix = pathsuffix + "_" + centrEstimator + "_bin_"+long(centrBin);
-  } else {
+  } else if(useOtherCentralityCut==1){
     pathsuffix = pathsuffix + "_TrackRange_" + long(trackMin) + "_" + long(trackMax);
+  } else if(useOtherCentralityCut==2){
+    pathsuffix = pathsuffix + "_V0Range_" + long(trackMin) + "_" + long(trackMax);
   }
   pathsuffix += customSuffix;
 
index e3f42d5..2e35780 100755 (executable)
@@ -19,7 +19,7 @@ runTriggerStudy=no
 customSuffix=""
 ntrackletsTrigger=50
 rejectBGV0Trigger=kFALSE
-useTrackCentralityCut=kFALSE
+useTrackCentralityCut=0
 trackMin=0
 trackMax=100
 
@@ -60,6 +60,8 @@ Available options:
                                 - ZEMvsZDC = correlation between ZEM and ZDC     
   -y <min,max>                 Select centrality based on "good tracks" rather than on centrality
                                estimator [off by default]
+  -0 <min,max>                 Select centrality based on v0 multiplicity range rather than on centrality
+                               estimator [off by default]
   -o <option>                  Misc option [default=$option]
                                Available options: 
                                 - SAVE:     Move results to a different output folder*
@@ -81,14 +83,19 @@ ENDOFGUIDE
 
 }
 
-while getopts "x:sr:cgmd:o:w:n:e:b:t:k:vy:" opt; do
+while getopts "x:sr:cgmd:o:w:n:e:b:t:k:vy:0:" opt; do
   case $opt in
     r)
       run=yes
       runmode=$OPTARG
       ;;      
     y)
-      useTrackCentralityCut=kTRUE
+      useTrackCentralityCut=1
+      trackMin=${OPTARG%%,*}
+      trackMax=${OPTARG##*,}
+      ;;      
+    0)
+      useTrackCentralityCut=2
       trackMin=${OPTARG%%,*}
       trackMax=${OPTARG##*,}
       ;;