* Changed the trigger bias correction scheme (added MB->INEL, MB->NSD and MB->ND)
authorekman <ekman@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 18 Sep 2006 09:00:55 +0000 (09:00 +0000)
committerekman <ekman@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 18 Sep 2006 09:00:55 +0000 (09:00 +0000)
* Added method to get the pythia process type in AliPWG0Helper
* Updated macros etc...

PWG0/AliCorrectionMatrix.cxx
PWG0/AliCorrectionMatrix2D.cxx
PWG0/AliCorrectionMatrix2D.h
PWG0/AliPWG0Helper.cxx
PWG0/AliPWG0Helper.h
PWG0/dNdEta/AlidNdEtaCorrection.cxx
PWG0/dNdEta/AlidNdEtaCorrection.h
PWG0/dNdEta/AlidNdEtaCorrectionSelector.cxx
PWG0/dNdEta/CreateCuts.C

index ff24721..5137cbc 100644 (file)
@@ -195,15 +195,14 @@ Bool_t AliCorrectionMatrix::LoadHistograms(const Char_t* fileName, const Char_t*
   if(fhMeas)  {delete fhMeas;  fhMeas=0;}
   
   fhMeas  = dynamic_cast<TH1*> (fin->Get(Form("%s/meas_%s", dir,GetName())));
-  if(!fhMeas)  Info("LoadHistograms","No meas  hist available");
+  if(!fhMeas)  Info("LoadHistograms","No meas. (%s) hist available",Form("%s/meas_%s", dir,GetName()));
 
   fhGene  = dynamic_cast<TH1*> (fin->Get(Form("%s/gene_%s",dir, GetName())));
-  if(!fhGene)  Info("LoadHistograms","No gene  hist available");
+  if(!fhGene)  Info("LoadHistograms","No gene. (%s) hist available",Form("%s/gene_%s",dir, GetName()));
 
   fhCorr  = dynamic_cast<TH1*> (fin->Get(Form("%s/corr_%s",dir, GetName())));
-  if(!fhCorr) 
-  {
-    Info("LoadHistograms","No corr  hist available");
+  if(!fhCorr) {
+    Info("LoadHistograms","No corr.(%s) hist available",Form("%s/corr_%s",dir, GetName()));
     return kFALSE;
   }
       
index 6cfee18..30f3ec3 100644 (file)
@@ -102,7 +102,7 @@ TH2F* AliCorrectionMatrix2D::GetMeasuredHistogram() const
 }
 
 //____________________________________________________________________
-TH1F* AliCorrectionMatrix2D::Get1DCorrection(Char_t* opt)
+TH1F* AliCorrectionMatrix2D::Get1DCorrection(Char_t* opt, Float_t min, Float_t max)
 {
   //
   // integrate the correction over one variable 
@@ -112,12 +112,34 @@ TH1F* AliCorrectionMatrix2D::Get1DCorrection(Char_t* opt)
   TH1D* gene1D = 0; 
 
   if (strcmp(opt,"x")==0) {
-    meas1D = GetMeasuredHistogram()->ProjectionX();
-    gene1D = GetGeneratedHistogram()->ProjectionX();
+    Int_t binMin = GetMeasuredHistogram()->GetYaxis()->FindBin(min);
+    Int_t binMax = GetMeasuredHistogram()->GetYaxis()->FindBin(max);
+
+    if (min==0 && max==0) {
+      meas1D = GetMeasuredHistogram()->ProjectionX();
+      gene1D = GetGeneratedHistogram()->ProjectionX();
+    }
+    else {
+      AliDebug(AliLog::kDebug+1, Form("Getting 1D map. Including y-bins %d to %d \n", binMin, binMax));
+
+      meas1D = GetMeasuredHistogram()->ProjectionX("pm",binMin,binMax);
+      gene1D = GetGeneratedHistogram()->ProjectionX("pg",binMin,binMax);
+    }
   }
   if (strcmp(opt,"y")==0) {
-    meas1D = GetMeasuredHistogram()->ProjectionY();
-    gene1D = GetGeneratedHistogram()->ProjectionY();
+    Int_t binMin = GetMeasuredHistogram()->GetXaxis()->FindBin(min);
+    Int_t binMax = GetMeasuredHistogram()->GetXaxis()->FindBin(max);
+
+    if (min==0 && max==0) {
+      meas1D = GetMeasuredHistogram()->ProjectionY();
+      gene1D = GetGeneratedHistogram()->ProjectionY();
+    }
+    else {
+      AliDebug(AliLog::kDebug+1, Form("Getting 1D map. Including x-bins %d to %d \n", binMin, binMax));
+
+      meas1D = GetMeasuredHistogram()->ProjectionY("pm", binMin, binMax);
+      gene1D = GetGeneratedHistogram()->ProjectionY("pg", binMin, binMax);
+    }
   }
   gene1D->Sumw2();
 
index ba29869..05cdcd8 100644 (file)
@@ -33,7 +33,8 @@ public:
   TH2F* GetGeneratedHistogram() const;
   TH2F* GetMeasuredHistogram() const;
 
-  TH1F* Get1DCorrection(Char_t* opt="x");
+  TH2F* GetCorrectionHistrogram() {return (TH2F*)fhCorr;}
+  TH1F* Get1DCorrection(Char_t* opt="x", Float_t min=0, Float_t max=0);
 
   void FillMeas(Float_t ax, Float_t ay);
   void FillGene(Float_t ax, Float_t ay);
index a7eaad9..b25baaf 100644 (file)
 #include <AliESD.h>
 #include <AliESDVertex.h>
 
+#include <AliGenEventHeader.h>
+#include <AliGenPythiaEventHeader.h>
+#include <AliGenCocktailEventHeader.h>
+
+
 //____________________________________________________________________
 ClassImp(AliPWG0Helper)
 
@@ -60,7 +65,7 @@ Bool_t AliPWG0Helper::IsVertexReconstructed(AliESD* aEsd)
 }
 
 //____________________________________________________________________
-Bool_t AliPWG0Helper::IsPrimaryCharged(TParticle* aParticle, Int_t aTotalPrimaries, Bool_t debug)
+Bool_t AliPWG0Helper::IsPrimaryCharged(TParticle* aParticle, Int_t aTotalPrimaries, Bool_t adebug)
 {
   //
   // this function checks if a particle from the event generator (i.e. among the nPrim particles in the stack)
@@ -72,7 +77,7 @@ Bool_t AliPWG0Helper::IsPrimaryCharged(TParticle* aParticle, Int_t aTotalPrimari
   // if the particle has a daughter primary, we do not want to count it
   if (aParticle->GetFirstDaughter() != -1 && aParticle->GetFirstDaughter() < aTotalPrimaries)
   {
-    if (debug)
+    if (adebug)
       printf("Dropping particle because it has a daughter among the primaries.\n");
     return kFALSE;
   }
@@ -82,14 +87,14 @@ Bool_t AliPWG0Helper::IsPrimaryCharged(TParticle* aParticle, Int_t aTotalPrimari
   // skip quarks and gluon
   if (pdgCode <= 10 || pdgCode == 21)
   {
-    if (debug)
+    if (adebug)
       printf("Dropping particle because it is a quark or gluon.\n");
     return kFALSE;
   }
 
   if (strcmp(aParticle->GetName(),"XXX") == 0)
   {
-    if (debug)
+    if (adebug)
       printf("WARNING: There is a particle named XXX.\n");
     return kFALSE;
   }
@@ -98,14 +103,14 @@ Bool_t AliPWG0Helper::IsPrimaryCharged(TParticle* aParticle, Int_t aTotalPrimari
 
   if (strcmp(pdgPart->ParticleClass(),"Unknown") == 0)
   {
-    if (debug)
+    if (adebug)
       printf("WARNING: There is a particle with an unknown particle class (pdg code %d).\n", pdgCode);
     return kFALSE;
   }
 
   if (pdgPart->Charge() == 0)
   {
-    if (debug)
+    if (adebug)
       printf("Dropping particle because it is not charged.\n");
     return kFALSE;
   }
@@ -114,6 +119,47 @@ Bool_t AliPWG0Helper::IsPrimaryCharged(TParticle* aParticle, Int_t aTotalPrimari
 }
 
 //____________________________________________________________________
+const Int_t AliPWG0Helper::GetPythiaEventProcessType(AliHeader* aHeader, Bool_t adebug) {
+  //
+  // get the process type of the event.
+  // 
+
+  // can only read pythia headers, either directly or from cocktalil header
+  AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(aHeader->GenEventHeader());
+  
+  if (!pythiaGenHeader) {
+    
+    AliGenCocktailEventHeader* genCocktailHeader = dynamic_cast<AliGenCocktailEventHeader*>(aHeader->GenEventHeader());
+    if (!genCocktailHeader) {
+      printf("AliPWG0Helper::GetProcessType : Unknown header type (not Pythia or Cocktail). \n");
+      return -1;
+    }
+
+    TList* headerList = genCocktailHeader->GetHeaders();
+    if (!headerList) {     
+      return -1;
+    }
+    
+    for (Int_t i=0; i<headerList->GetEntries(); i++) {
+      pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(headerList->At(i));
+      if (pythiaGenHeader)
+       break;
+    }        
+    
+    if (!pythiaGenHeader) {
+      printf("AliPWG0Helper::GetProcessType : Could not find Pythia header. \n");
+      return -1;
+    }
+  }
+  
+  if (adebug) {
+    printf("AliPWG0Helper::GetProcessType : Pythia process type found: %d \n",pythiaGenHeader->ProcessType());
+  }
+
+  return pythiaGenHeader->ProcessType();        
+}
+
+//____________________________________________________________________
 void AliPWG0Helper::CreateProjections(TH3* hist)
 {
   // create projections of 3d hists to all 2d combinations
index b0f1a62..1ae6f62 100644 (file)
@@ -5,6 +5,8 @@
 
 #include <TObject.h>
 
+#include <AliHeader.h>
+
 // static helper functions
 
 class AliESD;
@@ -16,11 +18,13 @@ class AliPWG0Helper : public TObject
   public:
     static Bool_t IsEventTriggered(AliESD* aEsd);
     static Bool_t IsVertexReconstructed(AliESD* aEsd);
-    static Bool_t IsPrimaryCharged(TParticle* aParticle, Int_t aTotalPrimaries, Bool_t debug = kFALSE);
+    static Bool_t IsPrimaryCharged(TParticle* aParticle, Int_t aTotalPrimaries, Bool_t adebug = kFALSE);
+
+    static const Int_t GetPythiaEventProcessType(AliHeader* aHeader, Bool_t adebug = kFALSE);
 
     static void CreateProjections(TH3* hist);
     static void CreateDividedProjections(TH3* hist, TH3* hist2, const char* axis = 0, Bool_t putErrors = kFALSE);
-    static const char* GetAxisTitle(TH3* hist, const char axis);
+    static const char* GetAxisTitle(TH3* hist, const char axis);    
     
   protected:
     ClassDef(AliPWG0Helper, 0)
index 7b7f069..2b2ac24 100644 (file)
@@ -14,10 +14,9 @@ AlidNdEtaCorrection::AlidNdEtaCorrection()
   : TNamed(),
   fTrack2ParticleCorrection(0),
   fVertexRecoCorrection(0),
-  fTriggerCorrection(0),
-  fTriggerBiasCorrection(0)
-  //fNEvents(0),
-  //fNTriggeredEvents(0)
+  fTriggerBiasCorrectionMBToINEL(0),
+  fTriggerBiasCorrectionMBToNSD(0),
+  fTriggerBiasCorrectionMBToND(0)
 {
   // default constructor
 }
@@ -27,10 +26,9 @@ AlidNdEtaCorrection::AlidNdEtaCorrection(const Char_t* name, const Char_t* title
   : TNamed(name, title),
   fTrack2ParticleCorrection(0),
   fVertexRecoCorrection(0),
-  fTriggerCorrection(0),
-  fTriggerBiasCorrection(0)
-  //fNEvents(0),
-  //fNTriggeredEvents(0)
+  fTriggerBiasCorrectionMBToINEL(0),
+  fTriggerBiasCorrectionMBToNSD(0),
+  fTriggerBiasCorrectionMBToND(0)
 {
   // constructor
   //
@@ -49,17 +47,19 @@ AlidNdEtaCorrection::AlidNdEtaCorrection(const Char_t* name, const Char_t* title
   matrixName.Form("%s_vtxReco", name);
   fVertexRecoCorrection        = new AliCorrectionMatrix2D(matrixName, matrixName, 10,binLimitsVtx ,22,binLimitsN);
 
-  matrixName.Form("%s_trigger", name);
-  fTriggerCorrection           = new AliCorrectionMatrix2D(matrixName, matrixName, 10,binLimitsVtx ,22,binLimitsN);
+  matrixName.Form("%s_triggerBias_MBToINEL", name);
+  fTriggerBiasCorrectionMBToINEL       = new AliCorrectionMatrix2D(matrixName, matrixName, 10,binLimitsVtx ,22,binLimitsN);
+  matrixName.Form("%s_triggerBias_MBToNSD", name);
+  fTriggerBiasCorrectionMBToNSD        = new AliCorrectionMatrix2D(matrixName, matrixName, 10,binLimitsVtx ,22,binLimitsN);
+  matrixName.Form("%s_triggerBias_MBToND", name);
+  fTriggerBiasCorrectionMBToND         = new AliCorrectionMatrix2D(matrixName, matrixName, 10,binLimitsVtx ,22,binLimitsN);
+  
+  fTrack2ParticleCorrection      ->SetAxisTitles("vtx z [cm]", "#eta", "p_{T} [GeV/c]");
+  fVertexRecoCorrection          ->SetAxisTitles("vtx z [cm]", "Ntracks");
+  fTriggerBiasCorrectionMBToINEL ->SetAxisTitles("vtx z [cm]", "Ntracks");
+  fTriggerBiasCorrectionMBToNSD  ->SetAxisTitles("vtx z [cm]", "Ntracks");
+  fTriggerBiasCorrectionMBToND   ->SetAxisTitles("vtx z [cm]", "Ntracks");
 
-  matrixName.Form("%s_triggerBias", name);
-  fTriggerBiasCorrection       = new AliCorrectionMatrix2D(matrixName, matrixName, 120,-6,6,100, 0, 10);
-
-  fTrack2ParticleCorrection ->SetAxisTitles("vtx z [cm]", "#eta", "p_{T} [GeV/c]");
-  fVertexRecoCorrection        ->SetAxisTitles("vtx z [cm]", "Ntracks");
-  fTriggerCorrection        ->SetAxisTitles("vtx z [cm]", "Ntracks");
-
-  fTriggerBiasCorrection       ->SetAxisTitles("#eta", "p_{T} [GeV/c]");
 }
 
 //____________________________________________________________________
@@ -67,28 +67,29 @@ AlidNdEtaCorrection::~AlidNdEtaCorrection()
 {
   // destructor
 
-  if (fTrack2ParticleCorrection)
-  {
+  if (fTrack2ParticleCorrection) {
     delete fTrack2ParticleCorrection;
     fTrack2ParticleCorrection = 0;
   }
 
-  if (fVertexRecoCorrection)
-  {
+  if (fVertexRecoCorrection) {
     delete fVertexRecoCorrection;
     fVertexRecoCorrection = 0;
   }
 
-  if (fTriggerCorrection)
-  {
-    delete fTriggerCorrection;
-    fTriggerCorrection = 0;
+  if (fTriggerBiasCorrectionMBToINEL) {
+    delete fTriggerBiasCorrectionMBToINEL;
+    fTriggerBiasCorrectionMBToINEL = 0;
   }
 
-  if (fTriggerBiasCorrection)
-  {
-    delete fTriggerBiasCorrection;
-    fTriggerBiasCorrection = 0;
+  if (fTriggerBiasCorrectionMBToNSD) {
+    delete fTriggerBiasCorrectionMBToNSD;
+    fTriggerBiasCorrectionMBToNSD = 0;
+  }
+
+  if (fTriggerBiasCorrectionMBToND) {
+    delete fTriggerBiasCorrectionMBToND;
+    fTriggerBiasCorrectionMBToND = 0;
   }
 }
 
@@ -116,15 +117,9 @@ AlidNdEtaCorrection::Finish() {
   printf("INFO: In the central region fTrack2ParticleCorrection has %d empty bins\n", emptyBins);
 
   fVertexRecoCorrection->Divide();
-  fTriggerCorrection->Divide();
-
-  if (GetNevents() <= 0)
-  {
-    printf("ERROR: GetNevents() returns 0. Cannot scale histogram. Skipping processing of fTriggerBiasCorrection\n");
-    return;
-  }
-  fTriggerBiasCorrection->GetMeasuredHistogram()->Scale(Double_t(GetNtriggeredEvents())/Double_t(GetNevents()));
-  fTriggerBiasCorrection->Divide();
+  fTriggerBiasCorrectionMBToINEL->Divide();
+  fTriggerBiasCorrectionMBToNSD->Divide();
+  fTriggerBiasCorrectionMBToND->Divide();
 }
 
 //____________________________________________________________________
@@ -144,10 +139,11 @@ AlidNdEtaCorrection::Merge(TCollection* list) {
   TObject* obj;
 
   // collections of measured and generated histograms
-  TList* collectionNtrackToNparticle = new TList;
-  TList* collectionVertexReco        = new TList;
-  TList* collectionTriggerBias       = new TList;
-  TList* collectionTrigger           = new TList;
+  TList* collectionNtrackToNparticle    = new TList;
+  TList* collectionVertexReco           = new TList;
+  TList* collectionTriggerBiasMBToINEL  = new TList;
+  TList* collectionTriggerBiasMBToNSD   = new TList;
+  TList* collectionTriggerBiasMBToND    = new TList;
 
   Int_t count = 0;
   while ((obj = iter->Next())) {
@@ -156,29 +152,34 @@ AlidNdEtaCorrection::Merge(TCollection* list) {
     if (entry == 0)
       continue;
 
-    collectionNtrackToNparticle ->Add(entry->GetTrack2ParticleCorrection());
-    collectionVertexReco        ->Add(entry->GetVertexRecoCorrection());
-    collectionTriggerBias        ->Add(entry->GetTriggerBiasCorrection());
-    collectionTrigger        ->Add(entry->GetTriggerCorrection());
+    collectionNtrackToNparticle  ->Add(entry->GetTrack2ParticleCorrection());
+    collectionVertexReco         ->Add(entry->GetVertexRecoCorrection());
+    collectionTriggerBiasMBToINEL->Add(entry->GetTriggerBiasCorrection("INEL"));
+    collectionTriggerBiasMBToNSD ->Add(entry->GetTriggerBiasCorrection("NSD"));
+    collectionTriggerBiasMBToND  ->Add(entry->GetTriggerBiasCorrection("ND"));
 
     count++;
 
     //fNEvents += entry->fNEvents;
     //fNTriggeredEvents += entry->fNTriggeredEvents;
   }
-  fTrack2ParticleCorrection ->Merge(collectionNtrackToNparticle);
-  fVertexRecoCorrection        ->Merge(collectionVertexReco);
-  fTriggerBiasCorrection        ->Merge(collectionTriggerBias);
-  fTriggerCorrection        ->Merge(collectionTrigger);
+  fTrack2ParticleCorrection      ->Merge(collectionNtrackToNparticle);
+  fVertexRecoCorrection          ->Merge(collectionVertexReco);
+  fTriggerBiasCorrectionMBToINEL ->Merge(collectionTriggerBiasMBToINEL);
+  fTriggerBiasCorrectionMBToNSD  ->Merge(collectionTriggerBiasMBToNSD);
+  fTriggerBiasCorrectionMBToND   ->Merge(collectionTriggerBiasMBToND);
 
   delete collectionNtrackToNparticle;
   delete collectionVertexReco;
-  delete collectionTriggerBias;
-  delete collectionTrigger;
+  delete collectionTriggerBiasMBToINEL;
+  delete collectionTriggerBiasMBToNSD;
+  delete collectionTriggerBiasMBToND;
 
   return count+1;
 }
 
+
+
 //____________________________________________________________________
 Bool_t
 AlidNdEtaCorrection::LoadHistograms(const Char_t* fileName, const Char_t* dir) {
@@ -186,10 +187,13 @@ AlidNdEtaCorrection::LoadHistograms(const Char_t* fileName, const Char_t* dir) {
   // loads the histograms
   //
 
-  fTrack2ParticleCorrection ->LoadHistograms(fileName, dir);
-  fVertexRecoCorrection        ->LoadHistograms(fileName, dir);
-  fTriggerCorrection        ->LoadHistograms(fileName, dir);
-  fTriggerBiasCorrection       ->LoadHistograms(fileName, dir);
+  fTrack2ParticleCorrection      ->LoadHistograms(fileName, dir);
+  fVertexRecoCorrection          ->LoadHistograms(fileName, dir);
+  fTriggerBiasCorrectionMBToINEL ->LoadHistograms(fileName, dir);
+  fTriggerBiasCorrectionMBToNSD  ->LoadHistograms(fileName, dir);
+  fTriggerBiasCorrectionMBToND   ->LoadHistograms(fileName, dir);
+
+  
 
   return kTRUE;
 }
@@ -204,10 +208,11 @@ AlidNdEtaCorrection::SaveHistograms() {
   gDirectory->mkdir(fName.Data());
   gDirectory->cd(fName.Data());
 
-  fTrack2ParticleCorrection->SaveHistograms();
-  fVertexRecoCorrection->SaveHistograms();
-  fTriggerCorrection->SaveHistograms();
-  fTriggerBiasCorrection->SaveHistograms();
+  fTrack2ParticleCorrection     ->SaveHistograms();
+  fVertexRecoCorrection         ->SaveHistograms();
+  fTriggerBiasCorrectionMBToINEL->SaveHistograms();
+  fTriggerBiasCorrectionMBToNSD ->SaveHistograms();
+  fTriggerBiasCorrectionMBToND  ->SaveHistograms();
 
   gDirectory->cd("../");
 }
@@ -218,14 +223,80 @@ void AlidNdEtaCorrection::DrawHistograms()
   //
   // call the draw histogram method of the two AliCorrectionMatrix2D objects
 
-  fTrack2ParticleCorrection ->DrawHistograms();
-  fVertexRecoCorrection        ->DrawHistograms();
-  fTriggerCorrection        ->DrawHistograms();
-  fTriggerBiasCorrection       ->DrawHistograms();
+  fTrack2ParticleCorrection     ->DrawHistograms();
+  fVertexRecoCorrection         ->DrawHistograms();
+  fTriggerBiasCorrectionMBToINEL->DrawHistograms();
+  fTriggerBiasCorrectionMBToNSD ->DrawHistograms();
+  fTriggerBiasCorrectionMBToND  ->DrawHistograms();
+
+}
+
+//____________________________________________________________________
+void AlidNdEtaCorrection::FillEventWithTrigger(Float_t vtx, Float_t n) 
+{
+  // fill events with trigger.
+  // used to calculate vertex reco and trigger bias corrections
+
+  fVertexRecoCorrection->FillGene(vtx, n);
+  fTriggerBiasCorrectionMBToINEL ->FillMeas(vtx, n);
+  fTriggerBiasCorrectionMBToNSD  ->FillMeas(vtx, n);
+  fTriggerBiasCorrectionMBToND   ->FillMeas(vtx, n);  
+}
+
+//____________________________________________________________________
+void AlidNdEtaCorrection::FillEventAll(Float_t vtx, Float_t n, Char_t* opt)  
+{
+  // fill all events 
+  // used to calculate trigger bias corrections
+
+  if (strcmp(opt,"INEL")==0) 
+    fTriggerBiasCorrectionMBToINEL->FillGene(vtx, n);
+  else if (strcmp(opt,"NSD")==0)  
+    fTriggerBiasCorrectionMBToNSD->FillGene(vtx, n);
+  else if (strcmp(opt,"ND")==0)   
+    fTriggerBiasCorrectionMBToND->FillGene(vtx, n);
+  else 
+    AliDebug(AliLog::kWarning, Form(" event type %s unknown (use INEL, NSD or ND)",opt));
+}
 
+//____________________________________________________________________
+AliCorrectionMatrix2D* AlidNdEtaCorrection::GetTriggerBiasCorrection(Char_t* opt)  
+{
+  // returning the trigger bias correction matrix 
+  // option can be used to specify to which collision process (INEL, NSD or ND)  
+  if (strcmp(opt,"INEL")==0) 
+    return fTriggerBiasCorrectionMBToINEL;
+  else if (strcmp(opt,"NSD")==0)  
+    return fTriggerBiasCorrectionMBToNSD;
+  else if (strcmp(opt,"ND")==0)   
+    return fTriggerBiasCorrectionMBToND;
+  else 
+    {
+      AliDebug(AliLog::kWarning, Form(" %s is unknown (use INEL, NSD or ND). returning INEL ",opt)); 
+      return fTriggerBiasCorrectionMBToINEL;
+    }
 }
 
 //____________________________________________________________________
+Float_t AlidNdEtaCorrection::GetTriggerBiasCorrection(Float_t vtx, Float_t n, Char_t* opt) 
+{
+  // returning the trigger bias correction matrix 
+  // 3rd option can be used to specify to which collision process (INEL, NSD or ND)  
+
+  if (strcmp(opt,"INEL")==0) 
+    return fTriggerBiasCorrectionMBToINEL->GetCorrection(vtx, n);
+  else if (strcmp(opt,"NSD")==0)  
+    return fTriggerBiasCorrectionMBToNSD->GetCorrection(vtx, n);
+  else if (strcmp(opt,"ND")==0)   
+    return fTriggerBiasCorrectionMBToND->GetCorrection(vtx, n);
+  else {
+    AliDebug(AliLog::kWarning, Form(" %s unknown (use INEL, NSD or ND). returning corr for INEL",opt)); 
+    return fTriggerBiasCorrectionMBToINEL->GetCorrection(vtx, n);
+  }
+}
+
+
+//____________________________________________________________________
 Float_t AlidNdEtaCorrection::GetMeasuredFraction(Float_t ptCutOff, Float_t eta, Bool_t debug)
 {
   // calculates the fraction of particles measured (some are missed due to the pt cut off)
@@ -282,27 +353,9 @@ void AlidNdEtaCorrection::ReduceInformation()
   // in memory
 
   // these are needed for GetMeasuredFraction(): fTrack2ParticleCorrection->ReduceInformation();
-  fVertexRecoCorrection->ReduceInformation();
-  fTriggerCorrection->ReduceInformation();
-  fTriggerBiasCorrection->ReduceInformation();
+  fVertexRecoCorrection          ->ReduceInformation();
+  fTriggerBiasCorrectionMBToINEL ->ReduceInformation();
+  fTriggerBiasCorrectionMBToNSD  ->ReduceInformation();
+  fTriggerBiasCorrectionMBToND   ->ReduceInformation();
 }
 
-Int_t AlidNdEtaCorrection::GetNevents()
-{
-  // Return total number of events used for this correction map (taken from fTriggerCorrection)
-
-  if (!fTriggerCorrection)
-    return -1;
-
-  return (Int_t) fTriggerCorrection->GetGeneratedHistogram()->Integral(0, fTriggerCorrection->GetGeneratedHistogram()->GetNbinsX()+1);
-}
-
-Int_t AlidNdEtaCorrection::GetNtriggeredEvents()
-{
-  // Return total number of triggered events used for this correction map (taken from fTriggerCorrection)
-
-  if (!fTriggerCorrection)
-    return -1;
-
-  return (Int_t) fTriggerCorrection->GetMeasuredHistogram()->Integral(0, fTriggerCorrection->GetMeasuredHistogram()->GetNbinsX()+1);
-}
index fb527b8..1cba5b0 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <AliCorrectionMatrix2D.h>
 #include <AliCorrectionMatrix3D.h>
+#include <AliLog.h>
 
 class AlidNdEtaCorrection : public TNamed
 {
@@ -31,35 +32,29 @@ public:
 
   ~AlidNdEtaCorrection();
 
-  // fVertexRecoCorrection, fTriggerCorrection
-  void FillEvent(Float_t vtx, Float_t n)                        {fTriggerCorrection->FillGene(vtx, n);}
-  void FillEventWithTrigger(Float_t vtx, Float_t n)             {fVertexRecoCorrection->FillGene(vtx, n); fTriggerCorrection->FillMeas(vtx, n);}
-  void FillEventWithTriggerWithReconstructedVertex(Float_t vtx, Float_t n) {fVertexRecoCorrection->FillMeas(vtx, n);}
-
   // fTrack2ParticleCorrection
   void FillParticle(Float_t vtx, Float_t eta, Float_t pt)                  {fTrack2ParticleCorrection->FillGene(vtx, eta, pt);}
   void FillParticleWhenMeasuredTrack(Float_t vtx, Float_t eta, Float_t pt) {fTrack2ParticleCorrection->FillMeas(vtx, eta, pt);}
 
-  // fTriggerBiasCorrection
-  void FillParticleAllEvents(Float_t eta, Float_t pt)          {fTriggerBiasCorrection->FillGene(eta, pt);}
-  void FillParticleWhenEventTriggered(Float_t eta, Float_t pt) {fTriggerBiasCorrection->FillMeas(eta, pt);}
-
-  //void IncreaseEventCount() { fNEvents++; }
-  //void IncreaseTriggeredEventCount() { fNTriggeredEvents++; }
-
+  // fVertexRecoCorrection & fTriggerBiasCorrection
+  void FillEventWithTriggerWithReconstructedVertex(Float_t vtx, Float_t n) {fVertexRecoCorrection->FillMeas(vtx, n);}
+  void FillEventWithTrigger(Float_t vtx, Float_t n);                         
+  void FillEventAll(Float_t vtx, Float_t n, Char_t* opt="INEL"); 
+    
   void Finish();
 
-  AliCorrectionMatrix3D* GetTrack2ParticleCorrection()    {return fTrack2ParticleCorrection;}
-  AliCorrectionMatrix2D* GetVertexRecoCorrection()        {return fVertexRecoCorrection;}
-  AliCorrectionMatrix2D* GetTriggerBiasCorrection()       {return fTriggerBiasCorrection;}
-  AliCorrectionMatrix2D* GetTriggerCorrection()       {return fTriggerCorrection;}
+  AliCorrectionMatrix3D* GetTrack2ParticleCorrection()  {return fTrack2ParticleCorrection;}
+  AliCorrectionMatrix2D* GetVertexRecoCorrection()      {return fVertexRecoCorrection;}
+  AliCorrectionMatrix2D* GetTriggerBiasCorrectionINEL() {return fTriggerBiasCorrectionMBToINEL;}
+  AliCorrectionMatrix2D* GetTriggerBiasCorrectionNSD()  {return fTriggerBiasCorrectionMBToNSD;}
+  AliCorrectionMatrix2D* GetTriggerBiasCorrectionND()   {return fTriggerBiasCorrectionMBToND;}
+  AliCorrectionMatrix2D* GetTriggerBiasCorrection(Char_t* opt="INEL");
 
   virtual Long64_t Merge(TCollection* list);
 
   void    SaveHistograms();
   Bool_t  LoadHistograms(const Char_t* fileName, const Char_t* dir = "dndeta_correction");
-  Bool_t  LoadCorrection(const Char_t* fileName, const Char_t* dir = "dndeta_correction")
-    {return LoadHistograms(fileName, dir);}
+  Bool_t  LoadCorrection(const Char_t* fileName, const Char_t* dir = "dndeta_correction") {return LoadHistograms(fileName, dir);}
   
   void DrawHistograms();
   
@@ -67,28 +62,24 @@ public:
   
   Float_t GetTrack2ParticleCorrection(Float_t vtx, Float_t eta, Float_t pt)
     {return fTrack2ParticleCorrection->GetCorrection(vtx, eta, pt);}
-
-  Float_t GetVertexRecoCorrection(Float_t vtx, Float_t n) {return fVertexRecoCorrection->GetCorrection(vtx, n);}
-
-  Float_t GetTriggerCorrection(Float_t vtx, Float_t n) {return fTriggerCorrection->GetCorrection(vtx, n);}
-
-  Float_t GetTriggerBiasCorrection(Float_t eta, Float_t pt=0) {return fTriggerBiasCorrection->GetCorrection(eta, pt);}
+  
+  Float_t GetVertexRecoCorrection     (Float_t vtx, Float_t n) {return fVertexRecoCorrection->GetCorrection(vtx, n);}
+  Float_t GetTriggerBiasCorrectionINEL(Float_t vtx, Float_t n) {return fTriggerBiasCorrectionMBToINEL->GetCorrection(vtx, n);} 
+  Float_t GetTriggerBiasCorrectionNSD (Float_t vtx, Float_t n) {return fTriggerBiasCorrectionMBToNSD->GetCorrection(vtx, n);} 
+  Float_t GetTriggerBiasCorrectionND  (Float_t vtx, Float_t n) {return fTriggerBiasCorrectionMBToND->GetCorrection(vtx, n);} 
+  Float_t GetTriggerBiasCorrection    (Float_t vtx, Float_t n, Char_t* opt="INEL");
 
   Float_t GetMeasuredFraction(Float_t ptCutOff, Float_t eta = -100, Bool_t debug = kFALSE);
 
-  //void SetNEvents(Long64_t events) { fNEvents = events; }
-
-  Int_t GetNevents();
-  Int_t GetNtriggeredEvents();
 
   void ReduceInformation();
 
 protected:
-  AliCorrectionMatrix3D* fTrack2ParticleCorrection; //-> handles the track-to-particle correction, function of vtx_z, eta, pt
-  AliCorrectionMatrix2D* fVertexRecoCorrection;     //-> handles the vertex reconstruction efficiency, function of n_clustersITS and vtx_z
-  AliCorrectionMatrix2D* fTriggerCorrection;       //-> handles the trigger efficiency, function of n_clustersITS and vtx_z
-
-  AliCorrectionMatrix2D* fTriggerBiasCorrection;          //-> MB to desired sample, obsolete!!!
+  AliCorrectionMatrix3D* fTrack2ParticleCorrection;       //-> handles the track-to-particle correction, function of vtx_z, eta, pt
+  AliCorrectionMatrix2D* fVertexRecoCorrection;           //-> handles the vertex reconstruction efficiency, function of n_clustersITS and vtx_z
+  AliCorrectionMatrix2D* fTriggerBiasCorrectionMBToINEL;  //-> handles the trigger bias MB->INEL, function of n and vtx_z
+  AliCorrectionMatrix2D* fTriggerBiasCorrectionMBToNSD;   //-> handles the trigger bias MB->NSD,  function of n and vtx_z
+  AliCorrectionMatrix2D* fTriggerBiasCorrectionMBToND;    //-> handles the trigger bias MB->ND,   function of n and vtx_z
 
   //Long64_t fNEvents;
   //Long64_t fNTriggeredEvents;
index ca90821..d70a5e0 100644 (file)
 #include <TFile.h>
 
 #include <AliLog.h>
-#include <AliGenEventHeader.h>
 #include <AliTracker.h>
-#include <AliHeader.h>
 #include <AliESDVertex.h>
 #include <AliESD.h>
 #include <AliESDtrack.h>
 #include <AliRunLoader.h>
 #include <AliStack.h>
 
+#include <AliHeader.h>
+#include <AliGenEventHeader.h>
+#include <AliGenPythiaEventHeader.h>
+#include <AliGenCocktailEventHeader.h>
+
 #include "esdTrackCuts/AliESDtrackCuts.h"
 #include "dNdEta/AlidNdEtaCorrection.h"
 #include "AliPWG0Helper.h"
@@ -166,6 +169,9 @@ Bool_t AlidNdEtaCorrectionSelector::Process(Long64_t entry)
   //  Assuming that fTree is the pointer to the TChain being processed,
   //  use fTree->GetTree()->GetEntry(entry).
 
+  AliDebug(AliLog::kDebug+1,"Processing event ...\n");
+
+
   if (AliSelectorRL::Process(entry) == kFALSE)
     return kFALSE;
 
@@ -230,16 +236,12 @@ Bool_t AlidNdEtaCorrectionSelector::Process(Long64_t entry)
     Float_t eta = particle->Eta();
     Float_t pt = particle->Pt();
 
-    if (vertexReconstructed)
-    {
+    if (vertexReconstructed) {
       fdNdEtaCorrection->FillParticle(vtxMC[2], eta, pt);
+
       if (pt > 0.1 && pt < 0.2)
-        fPIDParticles->Fill(particle->GetPdgCode());
+       fPIDParticles->Fill(particle->GetPdgCode());
     }
-
-    fdNdEtaCorrection->FillParticleAllEvents(eta, pt);
-    if (eventTriggered)
-      fdNdEtaCorrection->FillParticleWhenEventTriggered(eta, pt);
   }// end of mc particle
 
   // ########################################################
@@ -282,8 +284,8 @@ Bool_t AlidNdEtaCorrectionSelector::Process(Long64_t entry)
     {
       fdNdEtaCorrection->FillParticleWhenMeasuredTrack(vtxMC[2], particle->Eta(), particle->Pt());
       if (particle->Pt() > 0.1 && particle->Pt() < 0.2)
-      {
-        fPIDTracks->Fill(particle->GetPdgCode());
+       {
+         fPIDTracks->Fill(particle->GetPdgCode());
         if (particle->GetPDG()->Charge() > 0)
         {
           fClustersITSPos->Fill(esdTrack->GetITSclusters(0));
@@ -298,14 +300,28 @@ Bool_t AlidNdEtaCorrectionSelector::Process(Long64_t entry)
     }
   } // end of track loop
 
-  fdNdEtaCorrection->FillEvent(vtxMC[2], nGoodTracks);
-  if (eventTriggered)
-  {
+  // stuff regarding the vertex reco correction and trigger bias correction
+  if (eventTriggered) {
     fdNdEtaCorrection->FillEventWithTrigger(vtxMC[2], nGoodTracks);
     if (vertexReconstructed)
       fdNdEtaCorrection->FillEventWithTriggerWithReconstructedVertex(vtxMC[2], nGoodTracks);
   }
 
+  // getting process information
+  Int_t processtype = AliPWG0Helper::GetPythiaEventProcessType(header);
+  AliDebug(AliLog::kDebug+1,Form(" Found pythia procces type %d", processtype));
+
+  if (processtype<0)
+    AliDebug(AliLog::kError, Form("Unkown Pythia process type %d.", processtype));
+  
+  fdNdEtaCorrection->FillEventAll(vtxMC[2], nGoodTracks, "INEL");
+  
+  if (processtype!=92 && processtype!=93)
+    fdNdEtaCorrection->FillEventAll(vtxMC[2], nGoodTracks, "NSD");
+  
+  if (processtype!=92 && processtype!=93 && processtype!=94)
+    fdNdEtaCorrection->FillEventAll(vtxMC[2], nGoodTracks, "ND");
+
   return kTRUE;
 }
 
index fb01ce4..e0e4435 100644 (file)
@@ -4,7 +4,7 @@
 
 AliESDtrackCuts* CreateTrackCuts(Bool_t hists = kTRUE)
 {
-  AliESDtrackCuts* esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","");
+  AliESDtrackCuts* esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
 
   if (hists)
     esdTrackCuts->DefineHistograms(1);