Add possibility to read HIJING MC information, removed on FF configuration from the...
authorkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 21 Oct 2010 08:14:28 +0000 (08:14 +0000)
committerkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 21 Oct 2010 08:14:28 +0000 (08:14 +0000)
PWG4/JetTasks/AliAnalysisTaskFragmentationFunction.cxx
PWG4/macros/AnalysisTrainPWG4Jets.C

index b8778a8..46a7309 100644 (file)
@@ -37,6 +37,7 @@
 #include "AliAODMCParticle.h"
 #include "AliAODJet.h"
 #include "AliGenPythiaEventHeader.h"
+#include "AliGenHijingEventHeader.h"
 #include "AliInputEventHandler.h"
 
 #include "AliAnalysisHelperJetTasks.h"
@@ -2266,22 +2267,33 @@ void AliAnalysisTaskFragmentationFunction::UserExec(Option_t *)
   Double_t nTrials = 1; // trials for MC trigger weight for real data
   
   if(fMCEvent){
-     AliGenPythiaEventHeader*  pythiaGenHeader = AliAnalysisHelperJetTasks::GetPythiaEventHeader(fMCEvent);
-     if(!pythiaGenHeader){
-        if(fJetTypeGen != kJetsUndef && fTrackTypeGen != kTrackUndef){
-           Printf("%s:%d no pythiaGenHeader found", (char*)__FILE__,__LINE__);
-           return;
-        }
-     } else {
-        nTrials = pythiaGenHeader->Trials();
-        ptHard  = pythiaGenHeader->GetPtHard();
+     AliGenEventHeader* genHeader = fMCEvent->GenEventHeader();
+     AliGenPythiaEventHeader*  pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(genHeader);
+     AliGenHijingEventHeader*  hijingGenHeader = 0x0;
+
+     if(pythiaGenHeader){
+        if(fDebug>3) Printf("%s:%d pythiaGenHeader found", (char*)__FILE__,__LINE__);
+        nTrials = pythiaGenHeader->Trials();
+        ptHard  = pythiaGenHeader->GetPtHard();
+
+        fh1PtHard->Fill(ptHard);
+        fh1PtHardTrials->Fill(ptHard,nTrials);
+
 
-        fh1PtHard->Fill(ptHard);
-        fh1PtHardTrials->Fill(ptHard,nTrials);
+     } else { // no pythia, hijing?
 
-        fh1Trials->Fill("#sum{ntrials}",fAvgTrials);
+        if(fDebug>3) Printf("%s:%d no pythiaGenHeader found", (char*)__FILE__,__LINE__);
+
+         hijingGenHeader = dynamic_cast<AliGenHijingEventHeader*>(genHeader);
+         if(!hijingGenHeader){
+            Printf("%s:%d no pythiaGenHeader or hjingGenHeader found", (char*)__FILE__,__LINE__);
+         } else {
+           if(fDebug>3) Printf("%s:%d hijingGenHeader found", (char*)__FILE__,__LINE__);
+        }
      }
-   }
+
+     fh1Trials->Fill("#sum{ntrials}",fAvgTrials);
+  }
   
   
   //___ fetch jets __________________________________________________________________________
@@ -3042,11 +3054,38 @@ Int_t AliAnalysisTaskFragmentationFunction::GetListOfJets(TList *list, Int_t typ
       if(fDebug>1) Printf("%s:%d no mcEvent",(char*)__FILE__,__LINE__);
       return 0;
     }
-    
-    AliGenPythiaEventHeader*  pythiaGenHeader = AliAnalysisHelperJetTasks::GetPythiaEventHeader(fMCEvent);
+   
+    AliGenEventHeader* genHeader = fMCEvent->GenEventHeader();
+    AliGenPythiaEventHeader*  pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(genHeader);
+    AliGenHijingEventHeader*  hijingGenHeader = 0x0;
+
     if(!pythiaGenHeader){
-      Printf("%s:%d no pythiaGenHeader found", (char*)__FILE__,__LINE__);
-      return 0;
+      hijingGenHeader = dynamic_cast<AliGenHijingEventHeader*>(genHeader);
+      
+      if(!hijingGenHeader){
+         Printf("%s:%d no pythiaGenHeader or hijingGenHeader found", (char*)__FILE__,__LINE__);
+         return 0;
+      }else{
+         TLorentzVector mom[4];
+         AliAODJet* jet[4];
+         hijingGenHeader->GetJets(mom[0], mom[1], mom[2], mom[3]);
+
+         for(Int_t i=0; i<2; ++i){
+           if(!mom[i].Pt()) continue;
+            jet[i] = new AliAODJet(mom[i]);
+
+            if( type == kJetsKineAcceptance &&
+                (    jet[i]->Eta() < fJetEtaMin
+                  || jet[i]->Eta() > fJetEtaMax
+                  || jet[i]->Phi() < fJetPhiMin
+                  || jet[i]->Phi() > fJetPhiMax )) continue;
+
+           list->Add(jet[i]);
+           nGenJets++;
+        }
+        list->Sort();
+         return nGenJets;
+      }
     }
     
     // fetch the pythia generated jets
index 5e04009..a97e257 100644 (file)
@@ -484,7 +484,7 @@ void AnalysisTrainPWG4Jets(const char *analysis_mode="local",
      if(kUseAODMC){
        taskFrag = AddTaskFragmentationFunction(1<<1,kHighPtFilterMask);
        taskFrag = AddTaskFragmentationFunction(1<<2,kHighPtFilterMask);
-       taskFrag = AddTaskFragmentationFunction(1<<3,kHighPtFilterMask);
+       //       taskFrag = AddTaskFragmentationFunction(1<<3,kHighPtFilterMask);
        taskFrag = AddTaskFragmentationFunction(1<<5,kHighPtFilterMask);
        taskFrag = AddTaskFragmentationFunction(1<<11);  // w/o acceptance cuts       
        taskFrag =  AddTaskFragmentationFunction(1<<12);  // with acceptance cuts