]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG0/dNdEta/AlidNdEtaSystematicsSelector.cxx
Modifed the AddGoodRuns
[u/mrichter/AliRoot.git] / PWG0 / dNdEta / AlidNdEtaSystematicsSelector.cxx
index e00075fb4a6bfba2857a3b28170903e72ad8609c..bed6bb52ffc9ed9e859ec6516ffbbba19b5afd45 100644 (file)
 #include <AliStack.h>
 #include <AliHeader.h>
 #include <AliGenEventHeader.h>
-#include <../PYTHIA6/AliGenPythiaEventHeader.h>
-#include <../EVGEN/AliGenCocktailEventHeader.h>
+#include <../STEER/AliGenPythiaEventHeader.h>
+#include <../STEER/AliGenCocktailEventHeader.h>
 
-#include "esdTrackCuts/AliESDtrackCuts.h"
+#include "AliESDtrackCuts.h"
 #include "AliPWG0Helper.h"
-#include "AliPWG0depHelper.h"
 #include "dNdEta/AlidNdEtaCorrection.h"
 
 ClassImp(AlidNdEtaSystematicsSelector)
@@ -95,6 +94,8 @@ void AlidNdEtaSystematicsSelector::SlaveBegin(TTree* tree)
 
   printf("Running AlidNdEtaSystematicsSelector with options %s\n", option.Data());
 
+  // Options: secondaries particle-composition sigma-vertex vertexreco triggerbias
+
   if (option.Contains("secondaries"))
   {
     fSecondaries = new TH2F("fSecondaries", "fSecondaries;Case;N", 8, 0.5, 8.5, 2001, -0.5, 2000.5);
@@ -220,9 +221,9 @@ Bool_t AlidNdEtaSystematicsSelector::Process(Long64_t entry)
     return kFALSE;
   }
   
-  // getting process information NB: this only works for Pythia !!!
-  Int_t processtype = AliPWG0depHelper::GetPythiaEventProcessType(header);
-    
+  // getting process information
+  Int_t processtype = AliPWG0Helper::GetEventProcessType(header);
+
   // can only read pythia headers, either directly or from cocktalil header
   AliGenEventHeader* genHeader = (AliGenEventHeader*)(header->GenEventHeader());
   
@@ -242,29 +243,27 @@ Bool_t AlidNdEtaSystematicsSelector::Process(Long64_t entry)
   Bool_t vertexReconstructed = AliPWG0Helper::IsVertexReconstructed(fESD);
   
   // non diffractive
-  if (processtype!=92 && processtype!=93 && processtype!=94) { 
-    // NB: passing the wrong process type here (1), since the process type is defined by the index in the array (here non-diffractive)
+  if (processtype == AliPWG0Helper::kND) {
+    // NB: passing the wrong process type here (1), since the process type is defined by the index in the array (here non-diffractive) // ???? CKB ???
     if (triggerBiasStudy) fdNdEtaCorrectionTriggerBias[0]->FillEvent(vtxMC[2], nGoodTracks, eventTriggered, vertexReconstructed, 1);      
     if (vertexRecoStudy)  fdNdEtaCorrectionVertexReco[0] ->FillEvent(vtxMC[2], nGoodTracks, eventTriggered, vertexReconstructed, 1);
   }
   
   // single diffractive
-  if (processtype==92 || processtype==93) { 
+  if (processtype == AliPWG0Helper::kSD) { 
     if (triggerBiasStudy) fdNdEtaCorrectionTriggerBias[1]->FillEvent(vtxMC[2], nGoodTracks, eventTriggered, vertexReconstructed, 1);     
     if (vertexRecoStudy)  fdNdEtaCorrectionVertexReco[1] ->FillEvent(vtxMC[2], nGoodTracks, eventTriggered, vertexReconstructed, 1);
   }
   
   // double diffractive
-  if (processtype==94) { 
+  if (processtype==AliPWG0Helper::kDD) { 
     if (triggerBiasStudy) fdNdEtaCorrectionTriggerBias[2]->FillEvent(vtxMC[2], nGoodTracks, eventTriggered, vertexReconstructed, 1);     
     if (vertexRecoStudy)  fdNdEtaCorrectionVertexReco[2] ->FillEvent(vtxMC[2], nGoodTracks, eventTriggered, vertexReconstructed, 1);
   }
 
-  if (eventTriggered & vertexReconstructed) {
-    for (Int_t i=0; i<4; ++i) {
-      if (fdNdEtaCorrectionSpecies[i])
-       fdNdEtaCorrectionSpecies[i]->FillEvent(vtxMC[2], nGoodTracks, eventTriggered, vertexReconstructed, 1);
-    }
+  for (Int_t i=0; i<4; ++i) {
+    if (fdNdEtaCorrectionSpecies[i])
+      fdNdEtaCorrectionSpecies[i]->FillEvent(vtxMC[2], nGoodTracks, eventTriggered, vertexReconstructed, 1);
   }
 
   // --------------------------------------------------------------
@@ -322,17 +321,17 @@ Bool_t AlidNdEtaSystematicsSelector::Process(Long64_t entry)
     }
     
     // non diffractive
-    if (processtype!=92 && processtype!=93 && processtype!=94) { 
+    if (processtype==AliPWG0Helper::kND) { 
       if (triggerBiasStudy) fdNdEtaCorrectionTriggerBias[0]->FillMCParticle(vtxMC[2], eta, pt, eventTriggered, vertexReconstructed, 1);
       if (vertexRecoStudy)  fdNdEtaCorrectionVertexReco[0] ->FillMCParticle(vtxMC[2], eta, pt, eventTriggered, vertexReconstructed, 1);
     }
     // single diffractive
-    if (processtype==92 || processtype==93) { 
+    if (processtype==AliPWG0Helper::kSD) { 
       if (triggerBiasStudy) fdNdEtaCorrectionTriggerBias[1]->FillMCParticle(vtxMC[2], eta, pt, eventTriggered, vertexReconstructed, 1);
       if (vertexRecoStudy)  fdNdEtaCorrectionVertexReco[1] ->FillMCParticle(vtxMC[2], eta, pt, eventTriggered, vertexReconstructed, 1);
     }
     // double diffractive
-    if (processtype==94) { 
+    if (processtype==AliPWG0Helper::kDD) { 
       if (triggerBiasStudy) fdNdEtaCorrectionTriggerBias[2]->FillMCParticle(vtxMC[2], eta, pt, eventTriggered, vertexReconstructed, 1);
       if (vertexRecoStudy)  fdNdEtaCorrectionVertexReco[2] ->FillMCParticle(vtxMC[2], eta, pt, eventTriggered, vertexReconstructed, 1);
     }
@@ -359,62 +358,40 @@ Bool_t AlidNdEtaSystematicsSelector::Process(Long64_t entry)
   {
     AliESDtrack* esdTrack = dynamic_cast<AliESDtrack*> (obj);
     if (!esdTrack)
+      continue;    
+
+    // using the properties of the mc particle
+    Int_t label = TMath::Abs(esdTrack->GetLabel());
+    TParticle* particle = stack->Particle(label);
+    if (!particle)
+    {
+      AliDebug(AliLog::kError, Form("UNEXPECTED: particle with label %d not found in stack (track loop).", label));
       continue;
+    }
 
     Float_t eta = particle->Eta();
     Float_t pt  = particle->Pt();
     
     // non diffractive
-    if (processtype!=92 && processtype!=93 && processtype!=94) { 
+    if (processtype==AliPWG0Helper::kND) { 
       if (triggerBiasStudy) fdNdEtaCorrectionTriggerBias[0]->FillTrackedParticle(vtxMC[2], eta, pt);
       if (vertexRecoStudy)  fdNdEtaCorrectionVertexReco[0] ->FillTrackedParticle(vtxMC[2], eta, pt);
     }
     
     // single diffractive
-    if (processtype==92 || processtype==93) { 
+    if (processtype==AliPWG0Helper::kSD) { 
       if (triggerBiasStudy) fdNdEtaCorrectionTriggerBias[1]->FillTrackedParticle(vtxMC[2], eta, pt);
       if (vertexRecoStudy)  fdNdEtaCorrectionVertexReco[1] ->FillTrackedParticle(vtxMC[2], eta, pt);
     }
 
     // double diffractive
-    if (processtype==94) { 
+    if (processtype==AliPWG0Helper::kDD) { 
       if (triggerBiasStudy) fdNdEtaCorrectionTriggerBias[2]->FillTrackedParticle(vtxMC[2], eta, pt);
       if (vertexRecoStudy)  fdNdEtaCorrectionVertexReco[2] ->FillTrackedParticle(vtxMC[2], eta, pt);
     }
-    
 
-    // using the properties of the mc particle
-    Int_t label = TMath::Abs(esdTrack->GetLabel());
-    TParticle* particle = stack->Particle(label);
-    if (!particle)
-    {
-      AliDebug(AliLog::kError, Form("UNEXPECTED: particle with label %d not found in stack (track loop).", label));
-      continue;
-    }
-
-    TParticle* mother = particle;
     // find primary particle that created this particle
-    while (label >= nPrim)
-    {
-      //printf("Particle %d (pdg %d) is not a primary. Let's check its mother %d\n", label, mother->GetPdgCode(), mother->GetMother(0));
-
-      if (mother->GetMother(0) == -1)
-      {
-        AliDebug(AliLog::kError, Form("UNEXPECTED: Could not find mother of secondary particle %d.", label));
-        mother = 0;
-        break;
-      }
-
-      label = mother->GetMother(0);
-
-      mother = stack->Particle(label);
-      if (!mother)
-      {
-        AliDebug(AliLog::kError, Form("UNEXPECTED: particle with label %d not found in stack (find mother loop).", label));
-        break;
-      }
-    }
-
+    TParticle* mother = AliPWG0Helper::FindPrimaryMother(stack, label);
     if (!mother)
       continue;