Correction needed for decayer.
[u/mrichter/AliRoot.git] / PYTHIA8 / pythia8.C
CommitLineData
e0ef9f4b 1AliGenerator* CreateGenerator();
2
3void pythia8(Int_t nev = 1, char* filename = "galice.root")
4{
5// Runloader
6 gSystem->Load("liblhapdf.so");
7 gSystem->Load("libEGPythia6.so");
8 gSystem->Load("libpythia6.so");
9 gSystem->Load("libAliPythia6.so");
10 gSystem->Load("libpythia8.so");
e0ef9f4b 11 gSystem->Load("libAliPythia8.so");
12
13 AliRunLoader* rl = AliRunLoader::Open("galice.root","FASTRUN","recreate");
14
15 rl->SetCompressionLevel(2);
2dc65636 16 rl->SetNumberOfEventsPerFile(10000);
e0ef9f4b 17 rl->LoadKinematics("RECREATE");
18 rl->MakeTree("E");
19 gAlice->SetRunLoader(rl);
20
21// Create stack
22 rl->MakeStack();
23 AliStack* stack = rl->Stack();
24
25// Header
26 AliHeader* header = rl->GetHeader();
27//
28// Create and Initialize Generator
29 AliGenerator *gener = CreateGenerator();
30 gener->Init();
e0ef9f4b 31 gener->SetStack(stack);
32
33//
34// Event Loop
35//
36 Int_t iev;
37
38 for (iev = 0; iev < nev; iev++) {
39
40 printf("\n \n Event number %d \n \n", iev);
41
42// Initialize event
43 header->Reset(0,iev);
44 rl->SetEventNumber(iev);
45 stack->Reset();
46 rl->MakeTree("K");
47// stack->ConnectTree();
48
49// Generate event
50 gener->Generate();
51// Analysis
52 Int_t npart = stack->GetNprimary();
53 printf("Analyse %d Particles\n", npart);
54 for (Int_t part=0; part<npart; part++) {
55 TParticle *MPart = stack->Particle(part);
56 Int_t mpart = MPart->GetPdgCode();
57// printf("Particle %d\n", mpart);
58 }
59
60// Finish event
61 header->SetNprimary(stack->GetNprimary());
62 header->SetNtrack(stack->GetNtrack());
63// I/O
64//
65 stack->FinishEvent();
66 header->SetStack(stack);
67 rl->TreeE()->Fill();
68 rl->WriteKinematics("OVERWRITE");
69
70 } // event loop
71//
72// Termination
73// Generator
74 gener->FinishRun();
75// Write file
76 rl->WriteHeader("OVERWRITE");
77 gener->Write();
78 rl->Write();
79
80}
81
82
83AliGenerator* CreateGenerator()
84{
85 AliGenPythiaPlus* gener = new AliGenPythiaPlus(AliPythia8::Instance());
86//
87//
2dc65636 88 gener->SetProcess(kPyMbDefault);
e0ef9f4b 89// Centre of mass energy
2dc65636 90 gener->SetEnergyCMS(7000.);
e0ef9f4b 91// Initialize generator
a9e7a52d 92 gener->SetEventListRange(-1, 10);
e0ef9f4b 93 return gener;
94}
95
96
97
98
99
100
101
102