Do not include from subdirectories
[u/mrichter/AliRoot.git] / FASTSIM / fastGen.C
CommitLineData
8bb5c9a6 1AliGenerator* CreateGenerator();
2
3void fastGen(Int_t nev = 1, char* filename = "galice.root")
4{
d2c2889f 5// Load libraries
4070f709 6 gSystem->Load("liblhapdf");
7 gSystem->Load("libpythia6");
8 gSystem->Load("libEGPythia6");
9 gSystem->Load("libAliPythia6");
d2c2889f 10
9c653bef 11// Runloader
12
13 AliRunLoader* rl = AliRunLoader::Open("galice.root","FASTRUN","recreate");
14
15 rl->SetCompressionLevel(2);
16 rl->SetNumberOfEventsPerFile(nev);
17 rl->LoadKinematics("RECREATE");
18 rl->MakeTree("E");
19 gAlice->SetRunLoader(rl);
20
8bb5c9a6 21// Create stack
9c653bef 22 rl->MakeStack();
23 AliStack* stack = rl->Stack();
24
25// Header
26 AliHeader* header = rl->GetHeader();
8bb5c9a6 27//
28// Create and Initialize Generator
29 AliGenerator *gener = CreateGenerator();
30 gener->Init();
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);
9c653bef 44 rl->SetEventNumber(iev);
db11648d 45 stack->Reset();
9c653bef 46 rl->MakeTree("K");
47// stack->ConnectTree();
48
8bb5c9a6 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//
db11648d 65 stack->FinishEvent();
66 header->SetStack(stack);
abf2927c 67 rl->TreeE()->Fill();
9c653bef 68 rl->WriteKinematics("OVERWRITE");
abf2927c 69
8bb5c9a6 70 } // event loop
71//
72// Termination
73// Generator
74 gener->FinishRun();
8bb5c9a6 75// Write file
9c653bef 76 rl->WriteHeader("OVERWRITE");
abf2927c 77 gener->Write();
78 rl->Write();
79
8bb5c9a6 80}
81
82
83AliGenerator* CreateGenerator()
84{
85 gener = new AliGenPythia(1);
86//
87//
88// vertex position and smearing
89 gener->SetVertexSmear(kPerEvent);
90// structure function
d2c2889f 91 gener->SetStrucFunc(kCTEQ6);
8bb5c9a6 92// charm, beauty, charm_unforced, beauty_unforced, jpsi, jpsi_chi, mb
93 gener->SetProcess(kPyJets);
94// Centre of mass energy
db11648d 95 gener->SetEnergyCMS(5500.);
8bb5c9a6 96// Pt transfer of the hard scattering
db11648d 97 gener->SetPtHard(50.,50.2);
8bb5c9a6 98// Initialize generator
99 return gener;
100}
101
102
103
104
105
106
107
108
109
110
111
112