]>
Commit | Line | Data |
---|---|---|
f3050824 | 1 | |
2 | #include "TROOT.h" | |
3 | #include "TList.h" | |
4 | #include "AliMCEvent.h" | |
5 | #include "AliStack.h" | |
6 | #include "AliGenEventHeader.h" | |
7 | #include "AliGenCocktailEventHeader.h" | |
8 | #include "AliGenPythiaEventHeader.h" | |
9 | #include <fstream> | |
10 | #include <iostream> | |
11 | #include "AliAnalysisHelperJetTasks.h" | |
12 | ||
13 | ||
14 | ClassImp(AliAnalysisHelperJetTasks) | |
15 | ||
16 | ||
17 | ||
18 | ||
19 | AliGenPythiaEventHeader* AliAnalysisHelperJetTasks::GetPythiaEventHeader(AliMCEvent *mcEvent){ | |
20 | ||
21 | AliGenEventHeader* genHeader = mcEvent->GenEventHeader(); | |
22 | AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(genHeader); | |
23 | if(!pythiaGenHeader){ | |
24 | // cocktail ?? | |
25 | AliGenCocktailEventHeader* genCocktailHeader = dynamic_cast<AliGenCocktailEventHeader*>(genHeader); | |
26 | ||
27 | if (!genCocktailHeader) { | |
28 | Printf("%s %d: Unknown header type (not Pythia or Cocktail)",(char*)__FILE__,__LINE__); | |
29 | return 0; | |
30 | } | |
31 | TList* headerList = genCocktailHeader->GetHeaders(); | |
32 | for (Int_t i=0; i<headerList->GetEntries(); i++) { | |
33 | pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(headerList->At(i)); | |
34 | if (pythiaGenHeader) | |
35 | break; | |
36 | } | |
37 | if(!pythiaGenHeader){ | |
38 | Printf("%s %d: PythiaHeader not found!",(char*)__FILE__,__LINE__); | |
39 | return 0; | |
40 | } | |
41 | } | |
42 | return pythiaGenHeader; | |
43 | ||
44 | } | |
45 | ||
46 | ||
47 | void AliAnalysisHelperJetTasks::PrintStack(AliMCEvent *mcEvent,Int_t iFirst,Int_t iLast,Int_t iMaxPrint){ | |
48 | ||
49 | AliStack *stack = mcEvent->Stack(); | |
50 | if(!stack){ | |
51 | Printf("%s%d No Stack available",(char*)__FILE__,__LINE__); | |
52 | return; | |
53 | } | |
54 | ||
55 | static Int_t iCount = 0; | |
56 | if(iCount>iMaxPrint)return; | |
57 | Int_t nStack = stack->GetNtrack(); | |
58 | if(iLast == 0)iLast = nStack; | |
59 | else if(iLast > nStack)iLast = nStack; | |
60 | ||
61 | ||
62 | Printf("####################################################################"); | |
63 | for(Int_t np = iFirst;np<iLast;++np){ | |
64 | TParticle *p = stack->Particle(np); | |
65 | Printf("Nr.%d --- Status %d ---- Mother1 %d Mother2 %d Daughter1 %d Daughter2 %d ", | |
66 | np,p->GetStatusCode(),p->GetMother(0),p->GetMother(1),p->GetDaughter(0),p->GetDaughter(1)); | |
67 | Printf("Eta %3.3f Phi %3.3f ",p->Eta(),p->Phi()); | |
68 | p->Print(); | |
69 | Printf("---------------------------------------"); | |
70 | } | |
71 | iCount++; | |
72 | } | |
73 | ||
74 |