]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG4/JetTasks/AliAnalysisHelperJetTasks.cxx
New analysis devoted to shower shape studies
[u/mrichter/AliRoot.git] / PWG4 / JetTasks / AliAnalysisHelperJetTasks.cxx
index c0155e17da662af357136a0f247dfda003f015da..aaf3800799757f5f01b83a3e1ad1e9f5786639a1 100644 (file)
@@ -17,6 +17,7 @@
 #include "AliStack.h"
 #include "AliGenEventHeader.h"
 #include "AliGenCocktailEventHeader.h"
+#include <AliGenDPMjetEventHeader.h>
 #include "AliGenPythiaEventHeader.h"
 #include <fstream>
 #include <iostream>
 
 ClassImp(AliAnalysisHelperJetTasks)
 
-
+Int_t AliAnalysisHelperJetTasks::fgLastProcessType = -1;
 
  
 AliGenPythiaEventHeader*  AliAnalysisHelperJetTasks::GetPythiaEventHeader(AliMCEvent *mcEvent){
   
+  if(!mcEvent)return 0;
   AliGenEventHeader* genHeader = mcEvent->GenEventHeader();
   AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(genHeader);
   if(!pythiaGenHeader){
@@ -243,7 +245,12 @@ void  AliAnalysisHelperJetTasks::MergeOutput(char* cFiles, char* cDir, char *cLi
   Int_t ibTotal = 0;
   while(in1>>cFile){
     fIn[ibTotal] = TFile::Open(cFile);
-    dIn[ibTotal] = (TDirectory*)fIn[ibTotal]->Get(cDir);
+    if(strlen(cDir)==0){
+      dIn[ibTotal] = gDirectory;
+    }
+    else{
+      dIn[ibTotal] = (TDirectory*)fIn[ibTotal]->Get(cDir);
+    }
     if(!dIn[ibTotal]){
       Printf("%s:%d No directory %s found, exiting...",__FILE__,__LINE__,cDir);
       fIn[ibTotal]->ls();
@@ -443,6 +450,29 @@ Bool_t  AliAnalysisHelperJetTasks::Selected(Bool_t bSet,Bool_t bNew){
   return bSelected;
 }
 
+Bool_t  AliAnalysisHelperJetTasks::IsCosmic(){
+  return ((SelectInfo()&kIsCosmic)==kIsCosmic);
+}
+
+Bool_t  AliAnalysisHelperJetTasks::IsPileUp(){
+  return ((SelectInfo()&kIsPileUp)==kIsPileUp);
+}
+
+
+Bool_t  AliAnalysisHelperJetTasks::TestSelectInfo(UInt_t iMask){
+  return ((SelectInfo()&iMask)==iMask);
+}
+
+
+UInt_t  AliAnalysisHelperJetTasks::SelectInfo(Bool_t bSet,UInt_t iNew){
+  static UInt_t iSelectInfo = 0; //
+  if(bSet){
+    iSelectInfo = iNew;
+  }
+  return iSelectInfo;
+}
+
+
 //___________________________________________________________________________________________________________
 
 Bool_t AliAnalysisHelperJetTasks::GetEventShapes(TVector3 &n01, TVector3 * pTrack, Int_t nTracks, Double_t * eventShapes)
@@ -780,3 +810,74 @@ Bool_t AliAnalysisHelperJetTasks::IsTriggerFired(const AliVEvent* aEv, Trigger t
   }
     return kFALSE;
 }
+
+
+ AliAnalysisHelperJetTasks::MCProcessType  AliAnalysisHelperJetTasks::GetPythiaEventProcessType(AliGenEventHeader* aHeader, Bool_t adebug) {
+
+  AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(aHeader);
+
+  if (!pythiaGenHeader) {
+    //    printf(" AliAnalysisHelperJetTasks::GetProcessType : Unknown gen Header type). \n");
+    return kInvalidProcess;
+  }
+
+
+  Int_t pythiaType = pythiaGenHeader->ProcessType();
+  fgLastProcessType = pythiaType;
+  MCProcessType globalType = kInvalidProcess;  
+
+
+  if (adebug) {
+    printf(" AliAnalysisHelperJetTasks::GetProcessType : Pythia process type found: %d \n",pythiaType);
+  }
+
+
+  if(pythiaType==92||pythiaType==93){
+    globalType = kSD;
+  }
+  else if(pythiaType==94){
+    globalType = kDD;
+  }
+  //else if(pythiaType != 91){ // also exclude elastic to be sure... CKB??
+  else {
+    globalType = kND;
+  }
+  return globalType;
+}
+
+
+ AliAnalysisHelperJetTasks::MCProcessType  AliAnalysisHelperJetTasks::GetDPMjetEventProcessType(AliGenEventHeader* aHeader, Bool_t adebug) {
+  //
+  // get the process type of the event.
+  //
+
+  // can only read pythia headers, either directly or from cocktalil header
+  AliGenDPMjetEventHeader* dpmJetGenHeader = dynamic_cast<AliGenDPMjetEventHeader*>(aHeader);
+
+  if (!dpmJetGenHeader) {
+    printf(" AliAnalysisHelperJetTasks::GetDPMjetProcessType : Unknown header type (not DPMjet or). \n");
+    return kInvalidProcess;
+  }
+
+  Int_t dpmJetType = dpmJetGenHeader->ProcessType();
+  fgLastProcessType = dpmJetType;
+  MCProcessType globalType = kInvalidProcess;  
+
+
+  if (adebug) {
+    printf(" AliAnalysisHelperJetTasks::GetDPMJetProcessType : DPMJet process type found: %d \n",dpmJetType);
+  }
+
+
+  if (dpmJetType == 1 || dpmJetType == 4) { // explicitly inelastic plus central diffraction
+    globalType = kND;
+  }  
+  else if (dpmJetType==5 || dpmJetType==6) {
+    globalType = kSD;
+  }
+  else if (dpmJetType==7) {
+    globalType = kDD;
+  }
+  return globalType;
+}
+