Updates for the pPb Ntrk ZVtx corrrections (J.Wilkinson)
authorzconesa <zaida.conesa.del.valle@cern.ch>
Thu, 20 Feb 2014 10:17:37 +0000 (11:17 +0100)
committerzconesa <zaida.conesa.del.valle@cern.ch>
Thu, 20 Feb 2014 10:18:29 +0000 (11:18 +0100)
PWGHF/vertexingHF/AliAnalysisTaskSEDvsMultiplicity.cxx
PWGHF/vertexingHF/AliAnalysisTaskSEDvsMultiplicity.h
PWGHF/vertexingHF/macros/AddTaskDvsMultiplicity.C

index e74177f..f0448fc 100644 (file)
@@ -101,6 +101,7 @@ AliAnalysisTaskSE(),
   fUseNchWeight(kFALSE),
   fHistoMCNch(0),
   fHistoMeasNch(0),
+  fNMultEstimatorProfiles(4),
   fRefMult(9.26),
   fPdgMeson(411),
   fMultiplicityEstimator(kNtrk10),
@@ -112,7 +113,7 @@ AliAnalysisTaskSE(),
 }
 
 //________________________________________________________________________
-AliAnalysisTaskSEDvsMultiplicity::AliAnalysisTaskSEDvsMultiplicity(const char *name, Int_t pdgMeson,AliRDHFCuts *cuts):
+AliAnalysisTaskSEDvsMultiplicity::AliAnalysisTaskSEDvsMultiplicity(const char *name, Int_t pdgMeson,AliRDHFCuts *cuts, Bool_t switchPPb):
   AliAnalysisTaskSE(name),
   fOutput(0),
   fListCuts(0),
@@ -155,12 +156,13 @@ AliAnalysisTaskSEDvsMultiplicity::AliAnalysisTaskSEDvsMultiplicity(const char *n
   fHigherImpPar(2000.),
   fReadMC(kFALSE),
   fMCOption(0),
-  fisPPbData(kFALSE),
+  fisPPbData(switchPPb),
   fUseBit(kTRUE),
   fSubtractTrackletsFromDau(kFALSE),
   fUseNchWeight(kFALSE),
   fHistoMCNch(0),
   fHistoMeasNch(0),
+  fNMultEstimatorProfiles((switchPPb) ? 2 : 4),
   fRefMult(9.26),
   fPdgMeson(pdgMeson),
   fMultiplicityEstimator(kNtrk10),
@@ -169,6 +171,7 @@ AliAnalysisTaskSEDvsMultiplicity::AliAnalysisTaskSEDvsMultiplicity(const char *n
   // 
   // Standard constructor
   //
   for(Int_t i=0; i<5; i++) fHistMassPtImpPar[i]=0;
   for(Int_t i=0; i<4; i++) fMultEstimatorAvg[i]=0;
   if(fPdgMeson==413){
@@ -201,7 +204,10 @@ AliAnalysisTaskSEDvsMultiplicity::~AliAnalysisTaskSEDvsMultiplicity()
   delete fRDCutsAnalysis;
   delete fCounter;
   delete fCounterU;
-  for(Int_t i=0; i<4; i++) delete fMultEstimatorAvg[i];
+  for(Int_t i=0; i<4; i++) {
+      if (fMultEstimatorAvg[i]) delete fMultEstimatorAvg[i];
+  }
+  
   for(Int_t i=0; i<5; i++){
     delete fHistMassPtImpPar[i];
   }
@@ -257,8 +263,12 @@ void AliAnalysisTaskSEDvsMultiplicity::Init(){
   
   fListProfiles = new TList();
   fListProfiles->SetOwner();
-  TString period[4]={"LHC10b","LHC10c","LHC10d","LHC10e"};
-  for(Int_t i=0; i<4; i++){
+  TString period[4];
+  
+  if (fNMultEstimatorProfiles == 2) {period[0]="LHC13b"; period[1]="LHC13c";}
+  else {period[0]="LHC10b"; period[1]="LHC10c"; period[2]="LHC10d"; period[3]="LHC10e";}
+  for(Int_t i=0; i<fNMultEstimatorProfiles; i++){
     if(fMultEstimatorAvg[i]){
       TProfile* hprof=new TProfile(*fMultEstimatorAvg[i]);
       hprof->SetName(Form("ProfileTrkVsZvtx%s\n",period[i].Data()));
@@ -895,12 +905,21 @@ TProfile* AliAnalysisTaskSEDvsMultiplicity::GetEstimatorHistogram(const AliVEven
   //
 
   Int_t runNo  = event->GetRunNumber();
-  Int_t period = -1;   // 0-LHC10b, 1-LHC10c, 2-LHC10d, 3-LHC10e
-  if(runNo>114930 && runNo<117223) period = 0;
-  if(runNo>119158 && runNo<120830) period = 1;
-  if(runNo>122373 && runNo<126438) period = 2;
-  if(runNo>127711 && runNo<130841) period = 3;
-  if(period<0 || period>3) return 0;
+  Int_t period = -1;   // pp: 0-LHC10b, 1-LHC10c, 2-LHC10d, 3-LHC10e
+                       // pPb: 0-LHC13b, 1-LHC13c
+  if (fisPPbData) {
+      if (runNo>195343 && runNo<195484) period = 0;
+      if (runNo>195528 && runNo<195678) period = 1;
+      if (period < 0 || period > 1) return 0;
+  } 
+   else {
+      if(runNo>114930 && runNo<117223) period = 0;
+      if(runNo>119158 && runNo<120830) period = 1;
+      if(runNo>122373 && runNo<126438) period = 2;
+      if(runNo>127711 && runNo<130841) period = 3;
+      if(period<0 || period>3) return 0;
+     
+} 
 
   return fMultEstimatorAvg[period];
 }
index 5c62ceb..64ea6f1 100644 (file)
@@ -36,7 +36,7 @@ class AliAnalysisTaskSEDvsMultiplicity : public AliAnalysisTaskSE
  public:
 
   AliAnalysisTaskSEDvsMultiplicity();
-  AliAnalysisTaskSEDvsMultiplicity(const char *name, Int_t pdgMeson, AliRDHFCuts* cuts);
+  AliAnalysisTaskSEDvsMultiplicity(const char *name, Int_t pdgMeson, AliRDHFCuts* cuts, Bool_t switchPPb);
   virtual ~AliAnalysisTaskSEDvsMultiplicity();
 
 
@@ -56,10 +56,14 @@ class AliAnalysisTaskSEDvsMultiplicity : public AliAnalysisTaskSE
 
   void SetReadMC(Bool_t readMC=kTRUE){fReadMC=readMC;}
   void SetMCOption(Int_t option=0){ fMCOption = option; }
-  void SetIsPPbData(Bool_t flag=kTRUE){ fisPPbData=flag; }
+  void SetIsPPbData(Bool_t flag=kTRUE){ 
+    fisPPbData=flag;
+    if(flag) fNMultEstimatorProfiles = 2;
+  }
   void SetUseBit(Bool_t use=kTRUE){fUseBit=use;}
   void SetDoImpactParameterHistos(Bool_t doImp=kTRUE){fDoImpPar=doImp;}
 
+  void SetNMultEstimatorProfiles(Int_t n = 4) {fNMultEstimatorProfiles = n;}
 
   void SetMultiplVsZProfileLHC10b(TProfile* hprof){
     if(fMultEstimatorAvg[0]) delete fMultEstimatorAvg[0];
@@ -77,6 +81,16 @@ class AliAnalysisTaskSEDvsMultiplicity : public AliAnalysisTaskSE
     if(fMultEstimatorAvg[3]) delete fMultEstimatorAvg[3];
     fMultEstimatorAvg[3]=new TProfile(*hprof);
   }
+  
+  void SetMultiplVsZProfileLHC13b(TProfile* hprof){
+    if(fMultEstimatorAvg[0]) delete fMultEstimatorAvg[0];
+    fMultEstimatorAvg[0]=new TProfile(*hprof);
+  }
+  void SetMultiplVsZProfileLHC13c(TProfile* hprof){
+    if(fMultEstimatorAvg[1]) delete fMultEstimatorAvg[1];
+    fMultEstimatorAvg[1]=new TProfile(*hprof);
+  }
+    
   void SetReferenceMultiplcity(Double_t rmu){fRefMult=rmu;}
 
   // Nch weights on MC
@@ -174,14 +188,15 @@ class AliAnalysisTaskSEDvsMultiplicity : public AliAnalysisTaskSE
   TH1F* fHistoMCNch;    // weight histogram for the MC on the generated multiplicity
   TH1F* fHistoMeasNch;  //! weight histogram on the true measured multiplicity
   
-  TProfile* fMultEstimatorAvg[4]; // TProfile with mult vs. Z per period
+  Int_t fNMultEstimatorProfiles;  //Number of multiplicity estimators (= number of periods: 4 for pp, 2 for pPb)
+  TProfile* fMultEstimatorAvg[4]; //TProfile with mult vs. Z per period
   Double_t fRefMult;   // refrence multiplcity (period b)
   Int_t fPdgMeson;   // pdg code of analyzed meson
 
   Int_t fMultiplicityEstimator; // Definition of the multiplicity estimator: kNtrk10=0, kNtrk10to16=1, kVZERO=2
   Int_t fMCPrimariesEstimator;  // Definition of the primaries estimator eta range: |eta|<1.0=0, -1.6<|eta|<1.0=1, VZEROrange=2 
   
-  ClassDef(AliAnalysisTaskSEDvsMultiplicity,8); // D vs. mult task
+  ClassDef(AliAnalysisTaskSEDvsMultiplicity,9); // D vs. mult task
 };
 
 #endif
index 2a477e2..4ee4e81 100644 (file)
@@ -68,8 +68,7 @@ AliAnalysisTaskSEDvsMultiplicity *AddTaskDvsMultiplicity(Int_t system=0,
     Name="DStar";
   }
 
-
-  AliAnalysisTaskSEDvsMultiplicity *dMultTask = new AliAnalysisTaskSEDvsMultiplicity("dMultAnalysis",pdgMeson,analysiscuts);
+  AliAnalysisTaskSEDvsMultiplicity *dMultTask = new AliAnalysisTaskSEDvsMultiplicity("dMultAnalysis",pdgMeson,analysiscuts,isPPbData);
   dMultTask->SetReadMC(readMC);  
   dMultTask->SetDebugLevel(0);
   dMultTask->SetUseBit(kTRUE);
@@ -99,21 +98,41 @@ AliAnalysisTaskSEDvsMultiplicity *AddTaskDvsMultiplicity(Int_t system=0,
   if(estimatorFilename.EqualTo("") ) {
     printf("Estimator file not provided, multiplcity corrected histograms will not be filled\n");
   } else{
-    const Char_t* periodNames[4] = {"LHC10b", "LHC10c", "LHC10d", "LHC10e"};
-    TProfile* multEstimatorAvg[4];                       
-    TFile* fileEstimator=TFile::Open(estimatorFilename.Data());
-    if(!fileEstimator)  {
-      AliFatal("File with multiplicity estimator not found\n"); 
-      return;
-    }
-    for(Int_t ip=0; ip<4; ip++) {
-      multEstimatorAvg[ip] = (TProfile*)(fileEstimator->Get(Form("SPDmult10_%s",periodNames[ip]))->Clone(Form("SPDmult10_%s_clone",periodNames[ip])));  
-    }
-    dMultTask->SetMultiplVsZProfileLHC10b(multEstimatorAvg[0]);
-    dMultTask->SetMultiplVsZProfileLHC10c(multEstimatorAvg[1]);
-    dMultTask->SetMultiplVsZProfileLHC10d(multEstimatorAvg[2]);
-    dMultTask->SetMultiplVsZProfileLHC10e(multEstimatorAvg[3]);
-    dMultTask->SetReferenceMultiplcity(refMult);
+         if ( isPPbData) {    //Only use two profiles if pPb
+            const Char_t* periodNames[2] = {"LHC13b", "LHC13c"};
+            TProfile* multEstimatorAvg[2];                       
+            TFile* fileEstimator=TFile::Open(estimatorFilename.Data());
+            if(!fileEstimator)  {
+               AliFatal("File with multiplicity estimator not found\n"); 
+               return;
+            }
+            
+            for(Int_t ip=0; ip<2; ip++) {
+               multEstimatorAvg[ip] = (TProfile*)(fileEstimator->Get(Form("SPDmult10_%s",periodNames[ip]))->Clone(Form("SPDmult10_%s_clone",periodNames[ip])));  
+            }
+            dMultTask->SetMultiplVsZProfileLHC13b(multEstimatorAvg[0]);
+            dMultTask->SetMultiplVsZProfileLHC13c(multEstimatorAvg[1]);
+            dMultTask->SetReferenceMultiplcity(refMult);
+            
+         }
+         else {
+            const Char_t* periodNames[4] = {"LHC10b", "LHC10c", "LHC10d", "LHC10e"};
+            TProfile* multEstimatorAvg[4];                       
+            TFile* fileEstimator=TFile::Open(estimatorFilename.Data());
+            if(!fileEstimator)  {
+               AliFatal("File with multiplicity estimator not found\n"); 
+               return;
+            }
+            
+            for(Int_t ip=0; ip<4; ip++) {
+               multEstimatorAvg[ip] = (TProfile*)(fileEstimator->Get(Form("SPDmult10_%s",periodNames[ip]))->Clone(Form("SPDmult10_%s_clone",periodNames[ip])));  
+            }
+            dMultTask->SetMultiplVsZProfileLHC10b(multEstimatorAvg[0]);
+            dMultTask->SetMultiplVsZProfileLHC10c(multEstimatorAvg[1]);
+            dMultTask->SetMultiplVsZProfileLHC10d(multEstimatorAvg[2]);
+            dMultTask->SetMultiplVsZProfileLHC10e(multEstimatorAvg[3]);
+            dMultTask->SetReferenceMultiplcity(refMult);
+   }
   }
   mgr->AddTask(dMultTask);