]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG0/AliPWG0depHelper.cxx
compatibility with release and HEAD
[u/mrichter/AliRoot.git] / PWG0 / AliPWG0depHelper.cxx
1 /* $Id$ */
2
3 #include <AliPWG0depHelper.h>
4
5 #include <AliHeader.h>
6
7 #include <AliGenEventHeader.h>
8 #include <AliGenPythiaEventHeader.h>
9 #include <AliGenCocktailEventHeader.h>
10
11 //____________________________________________________________________
12 ClassImp(AliPWG0depHelper)
13
14 //____________________________________________________________________
15 const Int_t AliPWG0depHelper::GetPythiaEventProcessType(AliHeader* aHeader, Bool_t adebug) {
16   //
17   // get the process type of the event.
18   //
19
20   // can only read pythia headers, either directly or from cocktalil header
21   AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(aHeader->GenEventHeader());
22
23   if (!pythiaGenHeader) {
24
25     AliGenCocktailEventHeader* genCocktailHeader = dynamic_cast<AliGenCocktailEventHeader*>(aHeader->GenEventHeader());
26     if (!genCocktailHeader) {
27       printf("AliPWG0depHelper::GetProcessType : Unknown header type (not Pythia or Cocktail). \n");
28       return -1;
29     }
30
31     TList* headerList = genCocktailHeader->GetHeaders();
32     if (!headerList) {
33       return -1;
34     }
35
36     for (Int_t i=0; i<headerList->GetEntries(); i++) {
37       pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(headerList->At(i));
38       if (pythiaGenHeader)
39         break;
40     }
41
42     if (!pythiaGenHeader) {
43       printf("AliPWG0depHelper::GetProcessType : Could not find Pythia header. \n");
44       return -1;
45     }
46   }
47
48   if (adebug) {
49     printf("AliPWG0depHelper::GetProcessType : Pythia process type found: %d \n",pythiaGenHeader->ProcessType());
50   }
51
52   return pythiaGenHeader->ProcessType();
53 }