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