]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG0/dNdEta/AlidNdEtaAnalysisMCSelector.cxx
o) new way of calculating the final dndeta
[u/mrichter/AliRoot.git] / PWG0 / dNdEta / AlidNdEtaAnalysisMCSelector.cxx
index b486000878b749ec03cd9aaff26f6439856b2176..5b511787501ac68939270564584378e140d8345a 100644 (file)
@@ -8,6 +8,7 @@
 #include <TParticle.h>
 #include <TParticlePDG.h>
 #include <TVector3.h>
+#include <TH1F.h>
 #include <TH3F.h>
 #include <TTree.h>
 
@@ -22,7 +23,9 @@ ClassImp(AlidNdEtaAnalysisMCSelector)
 
 AlidNdEtaAnalysisMCSelector::AlidNdEtaAnalysisMCSelector() :
   AlidNdEtaAnalysisSelector(),
-  fVertex(0)
+  fVertex(0),
+  fPartEta(0),
+  fEvents(0)
 {
   //
   // Constructor. Initialization of pointers
@@ -42,7 +45,9 @@ void AlidNdEtaAnalysisMCSelector::Init(TTree *tree)
 
   tree->SetBranchStatus("ESD", 0);
 
-  fVertex = new TH3F("vertex", "vertex", 50, -50, 50, 50, -50, 50, 50, -50, 50);
+  fVertex = new TH3F("vertex_check", "vertex_check", 50, -50, 50, 50, -50, 50, 50, -50, 50);
+  fPartEta = new TH1F("dndeta_check", "dndeta_check", 120, -6, 6);
+  fPartEta->Sumw2();
 }
 
 Bool_t AlidNdEtaAnalysisMCSelector::Process(Long64_t entry)
@@ -102,9 +107,13 @@ Bool_t AlidNdEtaAnalysisMCSelector::Process(Long64_t entry)
 
     fdNdEtaAnalysis->FillTrack(vtxMC[2], particle->Eta(), 1);
     fVertex->Fill(particle->Vx(), particle->Vy(), particle->Vz());
+
+    fPartEta->Fill(particle->Eta());
   }
   fdNdEtaAnalysis->FillEvent(vtxMC[2]);
 
+  ++fEvents;
+
   return kTRUE;
 }
 
@@ -112,6 +121,15 @@ void AlidNdEtaAnalysisMCSelector::Terminate()
 {
   AlidNdEtaAnalysisSelector::Terminate();
 
-  new TCanvas;
+  fPartEta->Scale(1.0/fEvents);
+  fPartEta->Scale(1.0/fPartEta->GetBinWidth(1));
+
+  TCanvas* canvas = new TCanvas("control", "control", 900, 450);
+  canvas->Divide(2, 1);
+
+  canvas->cd(1);
   fVertex->Draw();
+
+  canvas->cd(2);
+  fPartEta->Draw();
 }