new way of creating the corrections: 3d as function of eta, vtx_z and pt
authorjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 13 Jun 2006 10:24:45 +0000 (10:24 +0000)
committerjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 13 Jun 2006 10:24:45 +0000 (10:24 +0000)
renamed dNdEtaCorrection class
updated selectors

15 files changed:
PWG0/PWG0baseLinkDef.h
PWG0/dNdEta/AlidNdEtaAnalysisESDSelector.cxx
PWG0/dNdEta/AlidNdEtaAnalysisESDSelector.h
PWG0/dNdEta/AlidNdEtaAnalysisMCSelector.cxx
PWG0/dNdEta/AlidNdEtaCorrection.cxx
PWG0/dNdEta/AlidNdEtaCorrection.h
PWG0/dNdEta/AlidNdEtaCorrectionSelector.cxx
PWG0/dNdEta/AlidNdEtaCorrectionSelector.h
PWG0/dNdEta/AlidNdEtaVertexRecEffSelector.cxx
PWG0/dNdEta/dNdEtaAnalysis.cxx
PWG0/dNdEta/dNdEtaAnalysis.h
PWG0/dNdEta/dNdEtaCorrection.cxx [deleted file]
PWG0/dNdEta/dNdEtaCorrection.h [deleted file]
PWG0/dNdEta/makeCorrection2.C
PWG0/libPWG0base.pkg

index cf2094713e9487c41fdb19566959e4bbf6a5eecd..c082f9b8e929b2fae780980218bd0d9bf55508f6 100644 (file)
 #pragma link C++ class AliSelector+;
 
 #pragma link C++ class dNdEtaAnalysis+;
-#pragma link C++ class dNdEtaCorrection+;
+#pragma link C++ class AlidNdEtaCorrection+;
 
 #pragma link C++ class AliESDtrackCuts+;
 
-#pragma link C++ class CorrectionMatrix2D+;
+#pragma link C++ class AliCorrectionMatrix+;
+#pragma link C++ class AliCorrectionMatrix2D+;
+#pragma link C++ class AliCorrectionMatrix3D+;
 
+#pragma link C++ class AliPWG0Helper+;
 
 #endif
index d6ab08a7d5114d24de6a7f02b6156188ba481df1..bca1f7fb2cda219746efb9e7b36c2fa8c1fad798 100644 (file)
 
 #include "esdTrackCuts/AliESDtrackCuts.h"
 #include "dNdEta/dNdEtaAnalysis.h"
+#include "dNdEta/AlidNdEtaCorrection.h"
+#include "AliPWG0Helper.h"
 
 ClassImp(AlidNdEtaAnalysisESDSelector)
 
 AlidNdEtaAnalysisESDSelector::AlidNdEtaAnalysisESDSelector() :
   AliSelector(),
-  fEsdTrackCuts(0)
+  fEsdTrackCuts(0),
+  fdNdEtaCorrection(0)
 {
   //
   // Constructor. Initialization of pointers
@@ -73,6 +76,9 @@ void AlidNdEtaAnalysisESDSelector::Init(TTree* tree)
 
   if (!fEsdTrackCuts)
      AliDebug(AliLog::kError, "ERROR: Could not read EsdTrackCuts from user info.");
+
+  if (!fdNdEtaCorrection && fTree)
+    fdNdEtaCorrection = dynamic_cast<AlidNdEtaCorrection*> (fTree->GetUserInfo()->FindObject("dndeta_correction"));
 }
 
 Bool_t AlidNdEtaAnalysisESDSelector::Process(Long64_t entry)
@@ -111,55 +117,58 @@ Bool_t AlidNdEtaAnalysisESDSelector::Process(Long64_t entry)
     return kFALSE;
   }
 
-  // ########################################################
-  // get the EDS vertex
-  const AliESDVertex* vtxESD = fESD->GetVertex();
-
-  // the vertex should be reconstructed
-  if (strcmp(vtxESD->GetName(),"default")==0)
-    return kTRUE;
-
-  Double_t vtx_res[3];
-  vtx_res[0] = vtxESD->GetXRes();
-  vtx_res[1] = vtxESD->GetYRes();
-  vtx_res[2] = vtxESD->GetZRes();
+  if (!fdNdEtaCorrection)
+  {
+    AliDebug(AliLog::kError, "fdNdEtaCorrection not available");
+    return kFALSE;
+  }
 
-  // the resolution should be reasonable???
-  if (vtx_res[2]==0 || vtx_res[2]>0.1)
+  if (AliPWG0Helper::IsVertexReconstructed(fESD) == kFALSE)
     return kTRUE;
 
+  // ########################################################
+  // get the EDS vertex
+  const AliESDVertex* vtxESD = fESD->GetVertex();
   Double_t vtx[3];
   vtxESD->GetXYZ(vtx);
 
-  // ########################################################
+  // get number of "good" tracks
+  TObjArray* list = fEsdTrackCuts->GetAcceptedTracks(fESD);
+  Int_t nGoodTracks = list->GetEntries();
+
+  Float_t vertexRecoCorr = fdNdEtaCorrection->GetVertexRecoCorrection(vtx[2], nGoodTracks);
+
   // loop over esd tracks
-  Int_t nTracks = fESD->GetNumberOfTracks();
-  for (Int_t t=0; t<nTracks; t++)
+  for (Int_t t=0; t<nGoodTracks; t++)
   {
-    AliESDtrack* esdTrack = fESD->GetTrack(t);
+    AliESDtrack* esdTrack = dynamic_cast<AliESDtrack*> (list->At(t));
     if (!esdTrack)
     {
       AliDebug(AliLog::kError, Form("ERROR: Could not retrieve track %d.", t));
       continue;
     }
 
-    // cut the esd track?
-    if (!fEsdTrackCuts->AcceptTrack(esdTrack))
-      continue;
-
     Double_t p[3];
     esdTrack->GetConstrainedPxPyPz(p); // ### TODO or GetInnerPxPyPy / GetOuterPxPyPy
     TVector3 vector(p);
 
     Float_t theta = vector.Theta();
     Float_t eta   = -TMath::Log(TMath::Tan(theta/2.));
+    Float_t pt = vector.Pt();
+
+    // TODO pt cut
 
-    fdNdEtaAnalysis->FillTrack(vtx[2], eta);
+    Float_t track2particleCorr = fdNdEtaCorrection->GetTrack2ParticleCorrection(vtx[2], eta, pt);
+
+    fdNdEtaAnalysis->FillTrack(vtx[2], eta, pt, vertexRecoCorr * track2particleCorr);
 
   } // end of track loop
 
+  delete list;
+  list = 0;
+
   // for event count per vertex
-  fdNdEtaAnalysis->FillEvent(vtx[2]);
+  fdNdEtaAnalysis->FillEvent(vtx[2], vertexRecoCorr);
 
   return kTRUE;
 }
index 176b90be5b3649a4bf13f0b8a9e0036a1f479932..f894c6615440708b9237c978fadfb8432e275668 100644 (file)
@@ -7,6 +7,7 @@
 
 class AliESDtrackCuts;
 class dNdEtaAnalysis;
+class AlidNdEtaCorrection;
 
 class AlidNdEtaAnalysisESDSelector : public AliSelector {
   public:
@@ -23,6 +24,8 @@ class AlidNdEtaAnalysisESDSelector : public AliSelector {
     dNdEtaAnalysis* fdNdEtaAnalysis;      // contains the target histograms
     AliESDtrackCuts*  fEsdTrackCuts;     // Object containing the parameters of the esd track cuts
 
+    AlidNdEtaCorrection* fdNdEtaCorrection; // correction maps
+
  private:
 
   ClassDef(AlidNdEtaAnalysisESDSelector, 0);
index 05ba91adcf967ecb6274eea542c0cb6414b157ed..7165dceec3c8ae8db3759a26d939b6077cef1195 100644 (file)
@@ -18,6 +18,7 @@
 #include <AliHeader.h>
 
 #include "dNdEta/dNdEtaAnalysis.h"
+#include "AliPWG0Helper.h"
 
 
 ClassImp(AlidNdEtaAnalysisMCSelector)
@@ -113,17 +114,17 @@ Bool_t AlidNdEtaAnalysisMCSelector::Process(Long64_t entry)
     if (!particle)
       continue;
 
-    if (IsPrimaryCharged(particle, nPrim) == kFALSE)
+    if (AliPWG0Helper::IsPrimaryCharged(particle, nPrim) == kFALSE)
       continue;
 
     AliDebug(AliLog::kDebug+1, Form("Accepted primary %d, unique ID: %d", i_mc, particle->GetUniqueID()));
 
-    fdNdEtaAnalysis->FillTrack(vtxMC[2], particle->Eta());
+    fdNdEtaAnalysis->FillTrack(vtxMC[2], particle->Eta(), particle->Pt(), 1);
     fVertex->Fill(particle->Vx(), particle->Vy(), particle->Vz());
 
     fPartEta->Fill(particle->Eta());
   }
-  fdNdEtaAnalysis->FillEvent(vtxMC[2]);
+  fdNdEtaAnalysis->FillEvent(vtxMC[2], 1);
 
   ++fEvents;
 
index 6ee954af73b6beac66362789ef1be7d82b4a5cad..a69b24467e88be2ce5666bdc292f43157a6ddef5 100644 (file)
@@ -3,47 +3,50 @@
 #include "AlidNdEtaCorrection.h"
 
 #include <TCanvas.h>
+#include <TH2F.h>
 
 //____________________________________________________________________
 ClassImp(AlidNdEtaCorrection)
 
 //____________________________________________________________________
 AlidNdEtaCorrection::AlidNdEtaCorrection(Char_t* name) 
-  : TNamed(name, name)
+  : TNamed(name, name),
+  fNEvents(0),
+  fNTriggeredEvents(0)
 {  
   // constructor
   //
 
-  fNtrackToNparticleCorrection = new CorrectionMatrix2D("nTrackToNPart", "nTrackToNPart",80,-20,20,120,-6,6);
+  fTrack2ParticleCorrection = new AliCorrectionMatrix3D("nTrackToNPart", "nTrackToNPart",80,-20,20,120,-6,6, 100, 0, 10);
 
   Float_t binLimitsN[]   = {-0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 
                            10.5, 12.5, 14.5, 16.5, 18.5, 20.5, 25.5, 30.5, 40.5, 50.5, 100.5, 300.5};
   Float_t binLimitsVtx[] = {-20,-15,-10,-6,-3,0,3,6,10,15,20};
   
-  fVertexRecoCorrection        = new CorrectionMatrix2D("vtxReco",       "vtxReco",10,binLimitsVtx ,22,binLimitsN);
+  fVertexRecoCorrection        = new AliCorrectionMatrix2D("vtxReco",       "vtxReco",10,binLimitsVtx ,22,binLimitsN);
 
-  fTriggerBiasCorrection       = new CorrectionMatrix2D("triggerBias",   "triggerBias",120,-6,6,100, 0, 10);
+  fTriggerBiasCorrection       = new AliCorrectionMatrix2D("triggerBias",   "triggerBias",120,-6,6,100, 0, 10);
 
-  fNtrackToNparticleCorrection ->SetAxisTitles("vtx z [cm]", "#eta");
+  fTrack2ParticleCorrection ->SetAxisTitles("vtx z [cm]", "#eta", "p_{T}");
   fVertexRecoCorrection        ->SetAxisTitles("vtx z [cm]", "n particles/tracks/tracklets?");
-  
+
   fTriggerBiasCorrection       ->SetAxisTitles("#eta", "p_{T} [GeV/c]");
 }
 
 //____________________________________________________________________
 void
-AlidNdEtaCorrection::Finish(Int_t nEventsAll, Int_t nEventsTriggered) {  
+AlidNdEtaCorrection::Finish() {
   //
   // finish method
   //
-  // divide the histograms in the CorrectionMatrix2D objects to get the corrections
+  // divide the histograms in the AliCorrectionMatrix2D objects to get the corrections
 
-  
-  fNtrackToNparticleCorrection->Divide();
+
+  fTrack2ParticleCorrection->Divide();
 
   fVertexRecoCorrection->Divide();
 
-  fTriggerBiasCorrection->GetMeasuredHistogram()->Scale(Double_t(nEventsTriggered)/Double_t(nEventsAll));
+  fTriggerBiasCorrection->GetMeasuredHistogram()->Scale(Double_t(fNTriggeredEvents)/Double_t(fNEvents));
   fTriggerBiasCorrection->Divide();
 
 }
@@ -76,13 +79,13 @@ AlidNdEtaCorrection::Merge(TCollection* list) {
     if (entry == 0) 
       continue;
 
-    collectionNtrackToNparticle ->Add(entry->GetNtrackToNpraticleCorrection());
+    collectionNtrackToNparticle ->Add(entry->GetTrack2ParticleCorrection());
     collectionVertexReco        ->Add(entry->GetVertexRecoCorrection());
     collectionTriggerBias        ->Add(entry->GetTriggerBiasCorrection());
 
     count++;
   }
-  fNtrackToNparticleCorrection ->Merge(collectionNtrackToNparticle);
+  fTrack2ParticleCorrection ->Merge(collectionNtrackToNparticle);
   fVertexRecoCorrection        ->Merge(collectionVertexReco);
   fTriggerBiasCorrection        ->Merge(collectionTriggerBias);
   
@@ -101,7 +104,7 @@ AlidNdEtaCorrection::LoadHistograms(Char_t* fileName, Char_t* dir) {
   // loads the histograms
   //
 
-  fNtrackToNparticleCorrection ->LoadHistograms(fileName, dir);
+  fTrack2ParticleCorrection ->LoadHistograms(fileName, dir);
   fVertexRecoCorrection        ->LoadHistograms(fileName, dir);
   fTriggerBiasCorrection       ->LoadHistograms(fileName, dir);
   
@@ -119,7 +122,7 @@ AlidNdEtaCorrection::SaveHistograms() {
   gDirectory->mkdir(fName.Data());
   gDirectory->cd(fName.Data());
 
-  fNtrackToNparticleCorrection ->SaveHistograms();
+  fTrack2ParticleCorrection ->SaveHistograms();
   fVertexRecoCorrection        ->SaveHistograms();
   fTriggerBiasCorrection       ->SaveHistograms();
 
@@ -130,11 +133,10 @@ AlidNdEtaCorrection::SaveHistograms() {
 void AlidNdEtaCorrection::DrawHistograms()
 {
   //
-  // call the draw histogram method of the two CorrectionMatrix2D objects
+  // call the draw histogram method of the two AliCorrectionMatrix2D objects
 
-  fNtrackToNparticleCorrection ->DrawHistograms();
+  fTrack2ParticleCorrection ->DrawHistograms();
   fVertexRecoCorrection        ->DrawHistograms();
   fTriggerBiasCorrection       ->DrawHistograms();
 
-  
 }
index 9958d473832632bdae9fd7f8eb6321a984677e9f..a581e80be215bbef7bf9b7be6764e60228de4d6a 100644 (file)
 // - add documentation
 // - add status: generate or use maps
 // - add functionality to set the bin sizes
-// 
+//
 
 #include <TNamed.h>
-#include <TFile.h>
-
-#include <CorrectionMatrix2D.h>
 
+#include <AliCorrectionMatrix2D.h>
+#include <AliCorrectionMatrix3D.h>
 
 class AlidNdEtaCorrection : public TNamed
 {
-protected:  
-  
-  CorrectionMatrix2D* fNtrackToNparticleCorrection; // handles the track-to-vertex correction
-  CorrectionMatrix2D* fVertexRecoCorrection;        // handles the vertex reco (n tracks vs vtx)
-
-  CorrectionMatrix2D* fTriggerBiasCorrection;          // MB to desired sample
-
 public:
   AlidNdEtaCorrection(Char_t* name="dndeta_correction");
 
+  // fVertexRecoCorrection
   void FillEvent(Float_t vtx, Float_t n)                        {fVertexRecoCorrection->FillGene(vtx, n);}
   void FillEventWithReconstructedVertex(Float_t vtx, Float_t n) {fVertexRecoCorrection->FillMeas(vtx, n);}
-  
-  void FillParticle(Float_t vtx, Float_t eta, Float_t pt=0)                  {fNtrackToNparticleCorrection->FillGene(vtx, eta);}
-  void FillParticleWhenMeasuredTrack(Float_t vtx, Float_t eta, Float_t pt=0) {fNtrackToNparticleCorrection->FillMeas(vtx, eta);}
-  
-  void FillParticleAllEvents(Float_t eta, Float_t pt=0)          {fTriggerBiasCorrection->FillGene(eta, pt);}
-  void FillParticleWhenEventTriggered(Float_t eta, Float_t pt=0) {fTriggerBiasCorrection->FillMeas(eta, pt);}
 
-  void Finish(Int_t nEventsAll = 1, Int_t nEventsTriggered = 1);
+  // 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);}
 
-  CorrectionMatrix2D* GetNtrackToNpraticleCorrection() {return fNtrackToNparticleCorrection;}
-  CorrectionMatrix2D* GetVertexRecoCorrection()        {return fVertexRecoCorrection;}
-  CorrectionMatrix2D* GetTriggerBiasCorrection()       {return fTriggerBiasCorrection;}
+  // 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++; }
+
+  void Finish();
+
+  AliCorrectionMatrix3D* GetTrack2ParticleCorrection()    {return fTrack2ParticleCorrection;}
+  AliCorrectionMatrix2D* GetVertexRecoCorrection()        {return fVertexRecoCorrection;}
+  AliCorrectionMatrix2D* GetTriggerBiasCorrection()       {return fTriggerBiasCorrection;}
 
   virtual Long64_t Merge(TCollection* list);
 
@@ -61,13 +59,21 @@ public:
   
   //  void RemoveEdges(Float_t cut=2, Int_t nBinsVtx=0, Int_t nBinsEta=0);
   
-  Float_t GetNtracksToNpartCorrection(Float_t vtx, Float_t eta, Float_t pt) 
-    {return fNtrackToNparticleCorrection->GetCorrection(vtx, eta);}  
+  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 GetTriggerBiasCorrection(Float_t eta, Float_t pt=0) {return fTriggerBiasCorrection->GetCorrection(eta, pt);}
-  
+
+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* fTriggerBiasCorrection;          // MB to desired sample
+
+  Long64_t fNEvents;
+  Long64_t fNTriggeredEvents;
 
   ClassDef(AlidNdEtaCorrection,0)
 };
index 6aa6f30d895913924ee8d559928a75aa81893e74..8abc3c69f9d3eb24f91eec8e9d3b75506ebb61de 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <TChain.h>
 #include <TSelector.h>
+#include <TFile.h>
 
 #include <AliLog.h>
 #include <AliGenEventHeader.h>
 #include <AliESDVertex.h>
 #include <AliESD.h>
 #include <AliESDtrack.h>
+#include <AliRunLoader.h>
+#include <AliStack.h>
 
 #include "esdTrackCuts/AliESDtrackCuts.h"
-#include "dNdEtaCorrection.h"
+#include "dNdEta/AlidNdEtaCorrection.h"
+#include "AliPWG0Helper.h"
 
 ClassImp(AlidNdEtaCorrectionSelector)
 
 AlidNdEtaCorrectionSelector::AlidNdEtaCorrectionSelector() :
   AliSelectorRL(),
   fEsdTrackCuts(0),
-  fdNdEtaCorrection(0),
-  fdNdEtaCorrectionFinal(0)
+  fdNdEtaCorrection(0)
 {
   //
   // Constructor. Initialization of pointers
@@ -62,7 +65,7 @@ void AlidNdEtaCorrectionSelector::SlaveBegin(TTree * tree)
 
   AliSelectorRL::SlaveBegin(tree);
 
-  fdNdEtaCorrection = new dNdEtaCorrection();
+  fdNdEtaCorrection = new AlidNdEtaCorrection();
 
   if (fTree)
     fEsdTrackCuts = dynamic_cast<AliESDtrackCuts*> (fTree->GetUserInfo()->FindObject("AliESDtrackCuts"));
@@ -108,101 +111,113 @@ Bool_t AlidNdEtaCorrectionSelector::Process(Long64_t entry)
     return kFALSE;
   }
 
+  AliRunLoader* runLoader = GetRunLoader();
+  if (!runLoader)
+  {
+    AliDebug(AliLog::kError, "RunLoader not available");
+    return kFALSE;
+  }
+
+  runLoader->LoadKinematics();
+  AliStack* stack = runLoader->Stack();
+  if (!stack)
+  {
+    AliDebug(AliLog::kError, "Stack not available");
+    return kFALSE;
+  }
+
   if (!fEsdTrackCuts)
   {
     AliDebug(AliLog::kError, "fESDTrackCuts not available");
     return kFALSE;
   }
 
-  // ########################################################
-  // get the EDS vertex
-  const AliESDVertex* vtxESD = fESD->GetVertex();
-
-  Bool_t goodEvent = kTRUE;
+  Bool_t vertexReconstructed = AliPWG0Helper::IsVertexReconstructed(fESD);
 
-  // the vertex should be reconstructed
-  if (strcmp(vtxESD->GetName(),"default")==0) 
-    goodEvent = kFALSE;
+  // check if the event was triggered
+  Bool_t eventTriggered = AliPWG0Helper::IsEventTriggered(fESD);
 
-  Double_t vtx_res[3];
-  vtx_res[0] = vtxESD->GetXRes();
-  vtx_res[1] = vtxESD->GetYRes();
-  vtx_res[2] = vtxESD->GetZRes();
-  
-  // the resolution should be reasonable???
-  if (vtx_res[2]==0 || vtx_res[2]>0.1)
-    goodEvent = kFALSE;
-    
+  fdNdEtaCorrection->IncreaseEventCount();
+  if (eventTriggered)
+    fdNdEtaCorrection->IncreaseTriggeredEventCount();
 
-  // ########################################################
   // get the MC vertex
   AliGenEventHeader* genHeader = header->GenEventHeader();
 
   TArrayF vtxMC(3);
   genHeader->PrimaryVertex(vtxMC);
 
-  fdNdEtaCorrection->FillEvent(vtxMC[2]);
-
-  if (goodEvent)
-    fdNdEtaCorrection->FillUsedEvent(vtxMC[2]);
-    
-
-
-  // ########################################################
   // loop over mc particles
-  TTree* particleTree = GetKinematics();
-  TParticle* particle = 0;
-  particleTree->SetBranchAddress("Particles", &particle);
+  Int_t nPrim  = stack->GetNprimary();
 
-  Int_t nPrim  = header->GetNprimary();
-  Int_t nTotal = header->GetNtrack();
-
-  for (Int_t i_mc = nTotal - nPrim; i_mc < nTotal; ++i_mc)
+  for (Int_t iMc = 0; iMc < nPrim; ++iMc)
   {
-    particleTree->GetEntry(i_mc);
+    AliDebug(AliLog::kDebug+1, Form("MC Loop: Processing particle %d.", iMc));
+
+    TParticle* particle = stack->Particle(iMc);
 
     if (!particle)
+    {
+      AliDebug(AliLog::kError, Form("UNEXPECTED: particle with label %d not found in stack (mc loop).", iMc));
       continue;
+    }
 
-    if (IsPrimaryCharged(particle, nPrim) == kFALSE)
+    if (AliPWG0Helper::IsPrimaryCharged(particle, nPrim) == kFALSE)
       continue;
 
     Float_t eta = particle->Eta();
-    
-    fdNdEtaCorrection->FillParticleAllEvents(vtxMC[2], eta);   
-    
-    if (goodEvent)
-      fdNdEtaCorrection->FillParticleWhenUsedEvent(vtxMC[2], eta);     
-    
-  }// end of mc particle
+    Float_t pt = particle->Pt();
+
+    if (vertexReconstructed)
+      fdNdEtaCorrection->FillParticle(vtxMC[2], eta, pt);
 
-  if (!goodEvent)
-    return kTRUE;  
+    fdNdEtaCorrection->FillParticleAllEvents(eta, pt);
+    if (eventTriggered)
+      fdNdEtaCorrection->FillParticleWhenEventTriggered(eta, pt);
+  }// end of mc particle
 
   // ########################################################
   // loop over esd tracks
   Int_t nTracks = fESD->GetNumberOfTracks();
+
+  // count the number of "good" tracks for vertex reconstruction efficiency
+  // TODO change to number of ITS clusters or similar
+  Int_t nGoodTracks = 0;
   for (Int_t t=0; t<nTracks; t++)
   {
+    AliDebug(AliLog::kDebug+1, Form("ESD Loop: Processing track %d.", t));
+
     AliESDtrack* esdTrack = fESD->GetTrack(t);
 
     // cut the esd track?
     if (!fEsdTrackCuts->AcceptTrack(esdTrack))
       continue;
 
-    // using the eta of the mc particle
+    nGoodTracks++;
+
+    // using the properties of the mc particle
     Int_t label = TMath::Abs(esdTrack->GetLabel());
     if (label == 0)
     {
       AliDebug(AliLog::kWarning, Form("WARNING: cannot find corresponding mc part for track %d.", t));
       continue;
     }
-    particleTree->GetEntry(nTotal - nPrim + label);
 
-    fdNdEtaCorrection->FillParticleWhenMeasuredTrack(vtxMC[2], particle->Eta());
+    TParticle* particle = stack->Particle(label);
+    if (!particle)
+    {
+      AliDebug(AliLog::kError, Form("UNEXPECTED: particle with label %d not found in stack (track loop).", label));
+      continue;
+    }
 
+    if (vertexReconstructed)
+      fdNdEtaCorrection->FillParticleWhenMeasuredTrack(vtxMC[2], particle->Eta(), particle->Pt());
   } // end of track loop
 
+  fdNdEtaCorrection->FillEvent(vtxMC[2], nGoodTracks);
+  if (vertexReconstructed)
+    fdNdEtaCorrection->FillEventWithReconstructedVertex(vtxMC[2], nGoodTracks);
+
   return kTRUE;
 }
 
@@ -232,17 +247,17 @@ void AlidNdEtaCorrectionSelector::Terminate()
 
   AliSelectorRL::Terminate();
 
-  fdNdEtaCorrectionFinal = dynamic_cast<dNdEtaCorrection*> (fOutput->FindObject("dndeta_correction"));
+  fdNdEtaCorrection = dynamic_cast<AlidNdEtaCorrection*> (fOutput->FindObject("dndeta_correction"));
 
-  fdNdEtaCorrectionFinal->Finish();
+  fdNdEtaCorrection->Finish();
 
   TFile* fout = new TFile("correction_map.root","RECREATE");
 
   fEsdTrackCuts->SaveHistograms("esd_track_cuts");
-  fdNdEtaCorrectionFinal->SaveHistograms();
+  fdNdEtaCorrection->SaveHistograms();
 
   fout->Write();
   fout->Close();
 
-  fdNdEtaCorrectionFinal->DrawHistograms();
+  fdNdEtaCorrection->DrawHistograms();
 }
index cff24d3426d663ca0e242c487e04ae3da4c1eff2..496ad01cf8bde77e46222c583fb3714aeef27eb8 100644 (file)
@@ -6,7 +6,7 @@
 #include "AliSelectorRL.h"
 
 class AliESDtrackCuts;
-class dNdEtaCorrection;
+class AlidNdEtaCorrection;
 
 class AlidNdEtaCorrectionSelector : public AliSelectorRL {
   public:
@@ -24,8 +24,7 @@ class AlidNdEtaCorrectionSelector : public AliSelectorRL {
   
     AliESDtrackCuts*  fEsdTrackCuts;          // Object containing the parameters of the esd track cuts
 
-    dNdEtaCorrection* fdNdEtaCorrection;      // contains the intermediate histograms (on each slave)
-    dNdEtaCorrection* fdNdEtaCorrectionFinal; // contains the final histograms
+    AlidNdEtaCorrection* fdNdEtaCorrection;      // contains the intermediate histograms (on each slave)
 
  private:
 
index 2bf0fff8b3bdb62a9c139bffc0aad643d77bbfef..4a4cb2e3873a004b9961a3598291d304651e0a34 100644 (file)
@@ -14,6 +14,8 @@
 #include <AliESD.h>
 #include <AliESDVertex.h>
 
+#include "AliPWG0Helper.h"
+
 //
 // This class plots the vertex reconstruction efficiency
 // If a vertex was reconstructed is decided by the function CheckVertex()
@@ -129,7 +131,7 @@ Bool_t AlidNdEtaVertexRecEffSelector::Process(Long64_t entry)
     if (!particle)
       continue;
 
-    if (IsPrimaryCharged(particle, nPrim) == kFALSE)
+    if (AliPWG0Helper::IsPrimaryCharged(particle, nPrim) == kFALSE)
       continue;
 
     if (TMath::Abs(particle->Eta()) < fkEtaRange)
index 4e21461b867b53204f493f368d660c79ab4af755..3c8685007321b8808545c0cd9d4f8814cd7f6ddd 100644 (file)
@@ -3,7 +3,7 @@
 #include "dNdEtaAnalysis.h"
 
 #include <TFile.h>
-#include <TH2F.h>
+#include <TH3F.h>
 #include <TH1D.h>
 #include <TMath.h>
 #include <TCanvas.h>
@@ -12,7 +12,7 @@
 #include <TList.h>
 #include <TLegend.h>
 
-#include "dNdEtaCorrection.h"
+#include "AlidNdEtaCorrection.h"
 
 //____________________________________________________________________
 ClassImp(dNdEtaAnalysis)
@@ -20,25 +20,29 @@ ClassImp(dNdEtaAnalysis)
 //____________________________________________________________________
 dNdEtaAnalysis::dNdEtaAnalysis(Char_t* name, Char_t* title) :
   TNamed(name, title),
-  fEtaVsVtx(0),
-  fEtaVsVtxUncorrected(0),
+  fData(0),
+  fDataUncorrected(0),
+  fNEvents(0),
   fVtx(0)
 {
   // constructor
 
-  fEtaVsVtx  = new TH2F(Form("%s_eta_vs_vtx", name),"",80,-20,20,120,-6,6);
-  fEtaVsVtx->SetXTitle("vtx z [cm]");
-  fEtaVsVtx->SetYTitle("#eta");
+  fData  = new TH3F(Form("%s_analysis", name),"",80,-20,20,120,-6,6,100, 0, 10);
+  fData->SetXTitle("vtx z [cm]");
+  fData->SetYTitle("#eta");
+  fData->SetZTitle("p_{T}");
 
-  fEtaVsVtxUncorrected = dynamic_cast<TH2F*> (fEtaVsVtx->Clone(Form("%s_eta_vs_vtx_uncorrected", name)));
-  fVtx       = fEtaVsVtx->ProjectionX(Form("%s_vtx", name));
-  for (Int_t i=0; i<kVertexBinning; ++i)
+  fDataUncorrected = dynamic_cast<TH3F*> (fData->Clone(Form("%s_analysis_uncorrected", name)));
+  fVtx       = dynamic_cast<TH1D*> (fData->Project3D("x"));
+
+  fdNdEta[0] = dynamic_cast<TH1D*> (fData->Project3D("y"));
+  for (Int_t i=1; i<kVertexBinning; ++i)
   {
-    fdNdEta[i]    = fEtaVsVtx->ProjectionY(Form("%s_dNdEta_%d", name, i));
+    fdNdEta[i]    = dynamic_cast<TH1D*> (fdNdEta[0]->Clone(Form("%s_%d", fdNdEta[0]->GetName(), i)));
     fdNdEta[i]->SetYTitle("dN/d#eta");
   }
 
-  fEtaVsVtx->Sumw2();
+  fData->Sumw2();
   fVtx->Sumw2();
 }
 
@@ -47,11 +51,11 @@ dNdEtaAnalysis::~dNdEtaAnalysis()
 {
   // destructor
 
-  delete fEtaVsVtx;
-  fEtaVsVtx = 0;
+  delete fData;
+  fData = 0;
 
-  delete fEtaVsVtxUncorrected;
-  fEtaVsVtxUncorrected = 0;
+  delete fDataUncorrected;
+  fDataUncorrected = 0;
 
   delete fVtx;
   fVtx = 0;
@@ -66,8 +70,9 @@ dNdEtaAnalysis::~dNdEtaAnalysis()
 //_____________________________________________________________________________
 dNdEtaAnalysis::dNdEtaAnalysis(const dNdEtaAnalysis &c) :
   TNamed(c),
-  fEtaVsVtx(0),
-  fEtaVsVtxUncorrected(0),
+  fData(0),
+  fDataUncorrected(0),
+  fNEvents(0),
   fVtx(0)
 {
   //
@@ -97,34 +102,39 @@ void dNdEtaAnalysis::Copy(TObject &c) const
 
   dNdEtaAnalysis& target = (dNdEtaAnalysis &) c;
 
-  target.fEtaVsVtx = dynamic_cast<TH2F*> (fEtaVsVtx->Clone());
-  target.fEtaVsVtxUncorrected = dynamic_cast<TH2F*> (fEtaVsVtxUncorrected->Clone());
+  target.fData = dynamic_cast<TH3F*> (fData->Clone());
+  target.fDataUncorrected = dynamic_cast<TH3F*> (fDataUncorrected->Clone());
   target.fVtx = dynamic_cast<TH1D*> (fVtx->Clone());
 
   for (Int_t i=0; i<kVertexBinning; ++i)
     target.fdNdEta[i] = dynamic_cast<TH1D*> (fdNdEta[i]->Clone());
 
+  target.fNEvents = fNEvents;
+
   TNamed::Copy((TNamed &) c);
 }
 
 //____________________________________________________________________
-void dNdEtaAnalysis::FillTrack(Float_t vtx, Float_t eta)
+void dNdEtaAnalysis::FillTrack(Float_t vtx, Float_t eta, Float_t pt, Float_t weight)
 {
   // fills a track into the histograms
 
-  fEtaVsVtxUncorrected->Fill(vtx,eta);
+  fDataUncorrected->Fill(vtx, eta, pt);
+  fData->Fill(vtx, eta, pt, weight);
 }
 
 //____________________________________________________________________
-void dNdEtaAnalysis::FillEvent(Float_t vtx)
+void dNdEtaAnalysis::FillEvent(Float_t vtx, Float_t weight)
 {
   // fills an event into the histograms
 
-  fVtx->Fill(vtx);
+  fVtx->Fill(vtx, weight); // TODO vtx distribution with or without weight?
+
+  fNEvents += weight;
 }
 
 //____________________________________________________________________
-void dNdEtaAnalysis::Finish(dNdEtaCorrection* correction)
+void dNdEtaAnalysis::Finish(AlidNdEtaCorrection* correction)
 {
   // correct with correction values if available
 
@@ -133,29 +143,29 @@ void dNdEtaAnalysis::Finish(dNdEtaCorrection* correction)
     printf("INFO: No correction applied\n");
 
   // this can be replaced by TH2F::Divide if we agree that the binning will be always the same
 for (Int_t iVtx=0; iVtx<=fEtaVsVtxUncorrected->GetNbinsX(); iVtx++)
/* for (Int_t iVtx=0; iVtx<=fDataUncorrected->GetNbinsX(); iVtx++)
   {
-    for (Int_t iEta=0; iEta<=fEtaVsVtxUncorrected->GetNbinsY(); iEta++)
+    for (Int_t iEta=0; iEta<=fDataUncorrected->GetNbinsY(); iEta++)
     {
       Float_t correctionValue = 1;
       if (correction)
-        correctionValue = correction->GetCorrection(fEtaVsVtxUncorrected->GetXaxis()->GetBinCenter(iVtx), fEtaVsVtxUncorrected->GetYaxis()->GetBinCenter(iEta));
+        correctionValue = correction->GetTrack2ParticleCorrection(fDataUncorrected->GetXaxis()->GetBinCenter(iVtx), fDataUncorrected->GetYaxis()->GetBinCenter(iEta), 1.0);
 
-      Float_t value = fEtaVsVtxUncorrected->GetBinContent(iVtx, iEta);
-      Float_t error = fEtaVsVtxUncorrected->GetBinError(iVtx, iEta);
+      Float_t value = fDataUncorrected->GetBinContent(iVtx, iEta);
+      Float_t error = fDataUncorrected->GetBinError(iVtx, iEta);
 
       Float_t correctedValue = value * correctionValue;
       Float_t correctedError = error * correctionValue;
 
       if (correctedValue != 0)
       {
-        fEtaVsVtx->SetBinContent(iVtx, iEta, correctedValue);
-        fEtaVsVtx->SetBinError(iVtx, iEta, correctedError);
+        fData->SetBinContent(iVtx, iEta, correctedValue);
+        fData->SetBinError(iVtx, iEta, correctedError);
       }
     }
   }
 
-  for (Int_t iEta=0; iEta<=fEtaVsVtx->GetNbinsY(); iEta++)
+  for (Int_t iEta=0; iEta<=fData->GetNbinsY(); iEta++)
   {
     // do we have several histograms for different vertex positions?
     Int_t vertexBinWidth = fVtx->GetNbinsX() / (kVertexBinning-1);
@@ -182,10 +192,10 @@ void dNdEtaAnalysis::Finish(dNdEtaCorrection* correction)
       Float_t sumError2 = 0;
       for (Int_t iVtx = vertexBinBegin; iVtx < vertexBinEnd; iVtx++)
       {
-        if (fEtaVsVtx->GetBinContent(iVtx, iEta) != 0)
+        if (fData->GetBinContent(iVtx, iEta) != 0)
         {
-          sum = sum + fEtaVsVtx->GetBinContent(iVtx, iEta);
-          sumError2 = sumError2 + TMath::Power(fEtaVsVtx->GetBinError(iVtx, iEta),2);
+          sum = sum + fData->GetBinContent(iVtx, iEta);
+          sumError2 = sumError2 + TMath::Power(fData->GetBinError(iVtx, iEta),2);
         }
       }
 
@@ -198,7 +208,7 @@ void dNdEtaAnalysis::Finish(dNdEtaCorrection* correction)
       fdNdEta[vertexPos]->SetBinContent(iEta, dndeta);
       fdNdEta[vertexPos]->SetBinError(iEta, error);
     }
-  }
+  }*/
 }
 
 //____________________________________________________________________
@@ -209,8 +219,8 @@ void dNdEtaAnalysis::SaveHistograms()
   gDirectory->mkdir(GetName());
   gDirectory->cd(GetName());
 
-  fEtaVsVtx  ->Write();
-  fEtaVsVtxUncorrected->Write();
+  fData  ->Write();
+  fDataUncorrected->Write();
   fVtx       ->Write();
   for (Int_t i=0; i<kVertexBinning; ++i)
     fdNdEta[i]    ->Write();
@@ -224,8 +234,8 @@ void dNdEtaAnalysis::LoadHistograms()
 
   gDirectory->cd(GetName());
 
-  fEtaVsVtx = dynamic_cast<TH2F*> (gDirectory->Get(fEtaVsVtx->GetName()));
-  fEtaVsVtxUncorrected = dynamic_cast<TH2F*> (gDirectory->Get(fEtaVsVtxUncorrected->GetName()));
+  fData = dynamic_cast<TH3F*> (gDirectory->Get(fData->GetName()));
+  fDataUncorrected = dynamic_cast<TH3F*> (gDirectory->Get(fDataUncorrected->GetName()));
 
   fVtx = dynamic_cast<TH1D*> (gDirectory->Get(fVtx->GetName()));
 
@@ -244,12 +254,12 @@ void dNdEtaAnalysis::DrawHistograms()
   canvas->Divide(2, 2);
 
   canvas->cd(1);
-  if (fEtaVsVtx)
-    fEtaVsVtx->Draw("COLZ");
+  if (fData)
+    fData->Draw("COLZ");
 
   canvas->cd(2);
-  if (fEtaVsVtxUncorrected)
-    fEtaVsVtxUncorrected->Draw("COLZ");
+  if (fDataUncorrected)
+    fDataUncorrected->Draw("COLZ");
 
   canvas->cd(3);
   if (fVtx)
@@ -314,8 +324,8 @@ Long64_t dNdEtaAnalysis::Merge(TCollection* list)
     if (entry == 0)
       continue;
 
-    collections[0]->Add(entry->fEtaVsVtx);
-    collections[1]->Add(entry->fEtaVsVtxUncorrected);
+    collections[0]->Add(entry->fData);
+    collections[1]->Add(entry->fDataUncorrected);
     collections[2]->Add(entry->fVtx);
 
     for (Int_t i=0; i<kVertexBinning; ++i)
@@ -324,8 +334,8 @@ Long64_t dNdEtaAnalysis::Merge(TCollection* list)
     ++count;
   }
 
-  fEtaVsVtx->Merge(collections[0]);
-  fEtaVsVtxUncorrected->Merge(collections[1]);
+  fData->Merge(collections[0]);
+  fDataUncorrected->Merge(collections[1]);
   fVtx->Merge(collections[2]);
   for (Int_t i=0; i<kVertexBinning; ++i)
     fdNdEta[i]->Merge(collections[3+i]);
index 3ac557357fd3808f3220e6f862962a9299e6cd6e..9db2a9138024e585b503e985f11471e2ba7abddb 100644 (file)
 
 #include <TNamed.h>
 
-class TH2F;
+class TH3F;
 class TH1D;
 class TCollection;
-class dNdEtaCorrection;
+class AlidNdEtaCorrection;
 
 class dNdEtaAnalysis : public TNamed
 {
@@ -37,10 +37,10 @@ public:
   dNdEtaAnalysis &operator=(const dNdEtaAnalysis &c);
   virtual void Copy(TObject &c) const;
 
-  void FillTrack(Float_t vtx, Float_t eta);
-  void FillEvent(Float_t vtx);
+  void FillTrack(Float_t vtx, Float_t eta, Float_t pt, Float_t weight);
+  void FillEvent(Float_t vtx, Float_t weight);
 
-  void Finish(dNdEtaCorrection* correction);
+  void Finish(AlidNdEtaCorrection* correction);
 
   void DrawHistograms();
   void LoadHistograms();
@@ -48,14 +48,17 @@ public:
 
   virtual Long64_t Merge(TCollection* list);
 
-  TH2F* GetEtaVsVtxHistogram() { return fEtaVsVtx; }
-  TH2F* GetEtaVsVtxUncorrectedHistogram() { return fEtaVsVtxUncorrected; }
+  TH3F* GetHistogram() { return fData; }
+  TH3F* GetUncorrectedHistogram() { return fDataUncorrected; }
   TH1D* GetVtxHistogram() { return fVtx; }
   TH1D* GetdNdEtaHistogram(Int_t i = 0) { return fdNdEta[i]; }
 
 protected:
-  TH2F* fEtaVsVtx;              // histogram Eta vs vtx (track count)
-  TH2F* fEtaVsVtxUncorrected;   // uncorrected histograms Eta vs vtx (track count)
+  TH3F* fData;              // histogram Eta vs vtx (track count)
+  TH3F* fDataUncorrected;   // uncorrected histograms Eta vs vtx (track count)
+
+  Float_t fNEvents;             // number of events (float because corrected by weight)
+
   TH1D* fVtx;                   // vtx histogram (event count)
   TH1D* fdNdEta[kVertexBinning];// dndeta results for different vertex bins (0 = full range)
 
diff --git a/PWG0/dNdEta/dNdEtaCorrection.cxx b/PWG0/dNdEta/dNdEtaCorrection.cxx
deleted file mode 100644 (file)
index e7cce26..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-/* $Id$ */
-
-#include "dNdEtaCorrection.h"
-
-#include <TCanvas.h>
-
-//____________________________________________________________________
-ClassImp(dNdEtaCorrection)
-
-//____________________________________________________________________
-dNdEtaCorrection::dNdEtaCorrection(Char_t* name) 
-  : TNamed(name, name)
-{  
-  // constructor
-  //
-
-  fNtrackToNparticleCorrection = new CorrectionMatrix2D("nTrackToNPart", "nTrackToNPart",80,-20,20,120,-6,6);
-  fEventBiasCorrection         = new CorrectionMatrix2D("EventBias",    "EventBias ",80,-20,20,120,-6,6);
-
-  fNtrackToNparticleCorrection ->SetAxisTitles("vtx z [cm]", "#eta");
-  fEventBiasCorrection         ->SetAxisTitles("vtx z [cm]", "#eta");
-
-  fhVtxZAllEvents  = new TH1F("vtx_z_all_events", "vtx_z_all_events",80,-20,20);
-  fhVtxZUsedEvents = new TH1F("vtx_z_used_events","vtx_z_used_events",80,-20,20);
-
-  fhVtxZAllEvents ->Sumw2();
-  fhVtxZUsedEvents->Sumw2();
-}
-
-//____________________________________________________________________
-void
-dNdEtaCorrection::Finish() {  
-  //
-  // finish method
-  //
-  // divide the histograms in the CorrectionMatrix2D objects to get the corrections
-
-
-  fNtrackToNparticleCorrection->Divide();
-
-  // normalize event bias histograms to the number of events
-
-  TH2F* meas = fEventBiasCorrection->GetMeasuredHistogram();
-  TH2F* gene = fEventBiasCorrection->GetGeneratedHistogram();
-  for (Int_t i_vtx=0; i_vtx<=meas->GetNbinsX(); i_vtx++) {
-    Int_t nEventsAll  = (Int_t)fhVtxZAllEvents->GetBinContent(i_vtx);
-    Int_t nEventsUsed = (Int_t)fhVtxZUsedEvents->GetBinContent(i_vtx);
-
-    if (nEventsAll<10)  nEventsAll=0;
-    if (nEventsUsed<10) nEventsUsed=0;
-
-    for (Int_t i_eta=0; i_eta<=meas->GetNbinsY(); i_eta++) {
-      Float_t valueMeas=0;
-      Float_t errorMeas=0;
-
-      Float_t valueGene=0;
-      Float_t errorGene=0;
-      
-      if (nEventsUsed!=0) {
-       valueMeas = meas->GetBinContent(i_vtx, i_eta)/Float_t(nEventsUsed);
-       errorMeas = meas->GetBinError(i_vtx, i_eta)/Float_t(nEventsUsed);
-      }
-      meas->SetBinContent(i_vtx, i_eta, valueMeas);
-      meas->SetBinError(i_vtx, i_eta, errorMeas);
-
-      if (nEventsAll!=0) {
-       valueGene = gene->GetBinContent(i_vtx, i_eta)/Float_t(nEventsAll);
-       errorGene = gene->GetBinError(i_vtx, i_eta)/Float_t(nEventsAll);
-      }
-      gene->SetBinContent(i_vtx, i_eta, valueGene);
-      gene->SetBinError(i_vtx, i_eta, errorGene);
-
-    }
-  }
-  fEventBiasCorrection->SetMeasuredHistogram(meas);
-  fEventBiasCorrection->SetGeneratedHistogram(gene);
-  
-  fEventBiasCorrection->Divide();
-}
-
-//____________________________________________________________________
-Long64_t 
-dNdEtaCorrection::Merge(TCollection* list) {
-  // Merge a list of dNdEtaCorrection objects with this (needed for
-  // PROOF). 
-  // Returns the number of merged objects (including this).
-
-  if (!list)
-    return 0;
-  
-  if (list->IsEmpty())
-    return 1;
-
-  TIterator* iter = list->MakeIterator();
-  TObject* obj;
-
-  // collections of measured and generated histograms
-  TList* collectionNtrackToNparticle = new TList;
-  TList* collectionEventBias         = new TList;
-  TList* collectionVtxHistAllEvents  = new TList;
-  TList* collectionVtxHistUsedEvents = new TList;
-
-  Int_t count = 0;
-  while ((obj = iter->Next())) {
-    
-    dNdEtaCorrection* entry = dynamic_cast<dNdEtaCorrection*> (obj);
-    if (entry == 0) 
-      continue;
-
-    collectionNtrackToNparticle ->Add(entry->GetNtrackToNpraticleCorrection());
-    collectionEventBias         ->Add(entry->GetEventBiasCorrection());
-    collectionVtxHistAllEvents  ->Add(entry->GetVertexZHistogramAllEvents());
-    collectionVtxHistUsedEvents ->Add(entry->GetVertexZHistogramUsedEvents());
-
-    count++;
-  }
-  fNtrackToNparticleCorrection ->Merge(collectionNtrackToNparticle);
-  fEventBiasCorrection         ->Merge(collectionEventBias);
-
-  fhVtxZAllEvents ->Merge(collectionVtxHistAllEvents );
-  fhVtxZUsedEvents->Merge(collectionVtxHistUsedEvents);
-
-  
-  delete collectionNtrackToNparticle;
-  delete collectionEventBias;
-  delete collectionVtxHistAllEvents;
-  delete collectionVtxHistUsedEvents;
-
-  return count+1;
-}
-
-
-
-
-//____________________________________________________________________
-void
-dNdEtaCorrection::RemoveEdges(Float_t cut, Int_t nBinsVtx, Int_t nBinsEta) {
-  //
-  // removes the edges of the correction maps
-  //
-
-  fNtrackToNparticleCorrection ->RemoveEdges(cut, nBinsVtx, nBinsEta);
-  fEventBiasCorrection         ->RemoveEdges(cut, nBinsVtx, nBinsEta);
-}
-
-//____________________________________________________________________
-Bool_t
-dNdEtaCorrection::LoadHistograms(Char_t* fileName, Char_t* dir) {
-  //
-  // loads the histograms
-  //
-
-  fNtrackToNparticleCorrection ->LoadHistograms(fileName, dir);
-  fEventBiasCorrection         ->LoadHistograms(fileName, dir);
-  
-  return kTRUE;
-}
-
-
-//____________________________________________________________________
-void
-dNdEtaCorrection::SaveHistograms() {
-  //
-  // save the histograms
-  //
-
-  gDirectory->mkdir(fName.Data());
-  gDirectory->cd(fName.Data());
-
-  fNtrackToNparticleCorrection ->SaveHistograms();
-  fEventBiasCorrection         ->SaveHistograms();
-
-  fhVtxZAllEvents ->Write();
-  fhVtxZUsedEvents->Write();
-
-  gDirectory->cd("../");
-}
-
-//____________________________________________________________________
-void dNdEtaCorrection::DrawHistograms()
-{
-  //
-  // call the draw histogram method of the two CorrectionMatrix2D objects
-
-  fNtrackToNparticleCorrection ->DrawHistograms();
-  fEventBiasCorrection         ->DrawHistograms();
-
-  fEventBiasCorrection->Get1DCorrection("x")->Draw();
-  
-}
diff --git a/PWG0/dNdEta/dNdEtaCorrection.h b/PWG0/dNdEta/dNdEtaCorrection.h
deleted file mode 100644 (file)
index 3dc4c96..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/* $Id$ */
-
-#ifndef DNDETACORRECTION_H
-#define DNDETACORRECTION_H
-
-
-// ------------------------------------------------------
-//
-// Class to handle corrections for dN/dEta measurements
-//
-// ------------------------------------------------------
-//
-// TODO:
-// - add documentation
-// - add status: generate or use maps
-// - add functionality to set the bin sizes
-// 
-
-#include <TNamed.h>
-#include <TFile.h>
-
-#include <CorrectionMatrix2D.h>
-
-
-class dNdEtaCorrection : public TNamed
-{
-protected:  
-  
-  CorrectionMatrix2D* fNtrackToNparticleCorrection; // handles the track-to-vertex correction
-  CorrectionMatrix2D* fEventBiasCorrection;         // handles the event bias correction
-
-  TH1F* fhVtxZAllEvents;
-  TH1F* fhVtxZUsedEvents;
-
-public:
-  dNdEtaCorrection(Char_t* name="dndeta_correction");
-
-  void FillEvent(Float_t vtx)     {fhVtxZAllEvents->Fill(vtx);}
-  void FillUsedEvent(Float_t vtx) {fhVtxZUsedEvents->Fill(vtx);}
-  void FillParticleAllEvents(Float_t vtx, Float_t eta)         {fEventBiasCorrection->FillGene(vtx, eta);}
-  void FillParticleWhenUsedEvent(Float_t vtx, Float_t eta)     {fEventBiasCorrection->FillMeas(vtx, eta);
-                                                                fNtrackToNparticleCorrection->FillGene(vtx, eta);}
-  void FillParticleWhenMeasuredTrack(Float_t vtx, Float_t eta) {fNtrackToNparticleCorrection->FillMeas(vtx, eta);}
-
-  void Finish();
-
-  CorrectionMatrix2D* GetNtrackToNpraticleCorrection() {return fNtrackToNparticleCorrection;}
-  CorrectionMatrix2D* GetEventBiasCorrection()         {return fEventBiasCorrection;}
-
-  TH1F* GetVertexZHistogramAllEvents()  {return fhVtxZAllEvents;}
-  TH1F* GetVertexZHistogramUsedEvents() {return fhVtxZUsedEvents;}
-
-  virtual Long64_t Merge(TCollection* list);
-
-  void    SaveHistograms();
-  Bool_t  LoadHistograms(Char_t* fileName, Char_t* dir = "dndeta_correction");
-  Bool_t  LoadCorrection(Char_t* fileName, Char_t* dir = "dndeta_correction") 
-    {return LoadHistograms(fileName, dir);}
-  
-  void DrawHistograms();
-  
-  void RemoveEdges(Float_t cut=2, Int_t nBinsVtx=0, Int_t nBinsEta=0);
-  
-  Float_t GetCorrection(Float_t vtx, Float_t eta) 
-    {return fNtrackToNparticleCorrection->GetCorrection(vtx, eta) * fEventBiasCorrection->GetCorrection(vtx, eta);}
-  
-
-  ClassDef(dNdEtaCorrection,0)
-};
-
-#endif
index 6e1ab4bb45d75098344b97b7c45a4ebad56fd860..cfee4db254de270d54ead48cb2e724fe78058b17 100644 (file)
@@ -9,9 +9,10 @@
 
 #include "../CreateESDChain.C"
 
-void makeCorrection2(Char_t* dataDir, Int_t nRuns=20, Int_t offset = 0)
+void makeCorrection2(Char_t* dataDir, Int_t nRuns=20, Int_t offset = 0, Bool_t debug = kFALSE)
 {
   gSystem->Load("libPWG0base");
+  gSystem->Load("libPWG0dep");
 
   TChain* chain = CreateESDChainFromDir(dataDir, nRuns, offset);
 
@@ -29,5 +30,10 @@ void makeCorrection2(Char_t* dataDir, Int_t nRuns=20, Int_t offset = 0)
   chain->GetUserInfo()->Add(fEsdTrackCuts);
 
   AliLog::SetClassDebugLevel("AlidNdEtaCorrectionSelector", AliLog::kInfo);
-  chain->Process("AlidNdEtaCorrectionSelector.cxx+");
+
+  TString selector("AlidNdEtaCorrectionSelector.cxx+");
+  if (debug != kFALSE)
+    selector += "g";
+
+  chain->Process(selector);
 }
index 040862210ba8aa13ba5c91d3b146d7c8d41e42c0..0b7d5644ff90a59c677a83b106edbbbcc136d3a6 100644 (file)
@@ -2,9 +2,12 @@
 
 HDRS = AliSelector.h \
       dNdEta/dNdEtaAnalysis.h \
-      dNdEta/dNdEtaCorrection.h \
+      dNdEta/AlidNdEtaCorrection.h \
       esdTrackCuts/AliESDtrackCuts.h \
-      CorrectionMatrix2D.h
+      AliCorrectionMatrix.h \
+      AliCorrectionMatrix2D.h \
+      AliCorrectionMatrix3D.h \
+      AliPWG0Helper.h
 
 SRCS = $(HDRS:.h=.cxx)