changes to include AliPerformanceMach component (Michael Knichel)
[u/mrichter/AliRoot.git] / TDPMjet / fastGenDPMjet.C
CommitLineData
89083db0 1AliGenerator* CreateGenerator();
2
3void fastGenDPMjet(Int_t nev = 1, char* filename = "galice.root")
4{
5// Runloader
f4e87470 6 gSystem->Load("liblhapdf");
7 gSystem->Load("libpythia6");
89083db0 8 gSystem->Load("libdpmjet.so");
9 gSystem->Load("libTDPMjet.so");
10
11 AliRunLoader* rl = AliRunLoader::Open("galice.root","FASTRUN","recreate");
f4e87470 12 AliPythiaRndm::SetPythiaRandom(new TRandom());
13
89083db0 14 rl->SetCompressionLevel(2);
15 rl->SetNumberOfEventsPerFile(nev);
16 rl->LoadKinematics("RECREATE");
17 rl->MakeTree("E");
18 gAlice->SetRunLoader(rl);
19
20// Create stack
21 rl->MakeStack();
22 AliStack* stack = rl->Stack();
23
24// Header
25 AliHeader* header = rl->GetHeader();
26//
27// Create and Initialize Generator
28 AliGenerator *gener = CreateGenerator();
29 gener->Init();
30 gener->SetStack(stack);
31
32//
33// Event Loop
34//
35 Int_t iev;
36
37 for (iev = 0; iev < nev; iev++) {
38
39 printf("\n \n Event number %d \n \n", iev);
40
41// Initialize event
42 header->Reset(0,iev);
43 rl->SetEventNumber(iev);
44 stack->Reset();
45 rl->MakeTree("K");
46// stack->ConnectTree();
47
48// Generate event
49 gener->Generate();
50// Analysis
51 Int_t npart = stack->GetNprimary();
52 printf("Analyse %d Particles\n", npart);
53 for (Int_t part=0; part<npart; part++) {
54 TParticle *MPart = stack->Particle(part);
55 Int_t pdg = MPart->GetPdgCode();
56 Int_t pis = MPart->GetStatusCode();
57// printf("Particle %5d %5d\n", part, pdg, pis);
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 // kDpmMb
86 // kDpmMbNonDiffr
87 // kDpmDiffr
88 // kDpmSingleDiffr
89 // kDpmDoubleDiffr
90 gener = new AliGenDPMjet(1);
91 gener->SetProcess(kDpmMb);
f4e87470 92 gener->SetProjectile("P", 1, 1);
93 gener->SetTarget("P", 1, 1);
89083db0 94 gener->SetEnergyCMS(14000.);
95 return gener;
96}
97
98
99
100
101
102
103
104
105
106
107
108