Small correction in constructor
[u/mrichter/AliRoot.git] / FASTSIM / fastGen.C
CommitLineData
8bb5c9a6 1AliGenerator* CreateGenerator();
2
3void fastGen(Int_t nev = 1, char* filename = "galice.root")
4{
9c653bef 5// Runloader
6
7 AliRunLoader* rl = AliRunLoader::Open("galice.root","FASTRUN","recreate");
8
9 rl->SetCompressionLevel(2);
10 rl->SetNumberOfEventsPerFile(nev);
11 rl->LoadKinematics("RECREATE");
12 rl->MakeTree("E");
13 gAlice->SetRunLoader(rl);
14
8bb5c9a6 15// Create stack
9c653bef 16 rl->MakeStack();
17 AliStack* stack = rl->Stack();
18
19// Header
20 AliHeader* header = rl->GetHeader();
8bb5c9a6 21//
22// Create and Initialize Generator
23 AliGenerator *gener = CreateGenerator();
24 gener->Init();
25 gener->SetStack(stack);
26
27//
28// Event Loop
29//
30 Int_t iev;
31
32 for (iev = 0; iev < nev; iev++) {
33
34 printf("\n \n Event number %d \n \n", iev);
35
36// Initialize event
37 header->Reset(0,iev);
9c653bef 38 rl->SetEventNumber(iev);
db11648d 39 stack->Reset();
9c653bef 40 rl->MakeTree("K");
41// stack->ConnectTree();
42
8bb5c9a6 43// Generate event
44 gener->Generate();
45// Analysis
46 Int_t npart = stack->GetNprimary();
47 printf("Analyse %d Particles\n", npart);
48 for (Int_t part=0; part<npart; part++) {
49 TParticle *MPart = stack->Particle(part);
50 Int_t mpart = MPart->GetPdgCode();
51 printf("Particle %d\n", mpart);
52 }
53
54// Finish event
55 header->SetNprimary(stack->GetNprimary());
56 header->SetNtrack(stack->GetNtrack());
57// I/O
58//
db11648d 59 stack->FinishEvent();
60 header->SetStack(stack);
9c653bef 61 rl->WriteKinematics("OVERWRITE");
8bb5c9a6 62 } // event loop
63//
64// Termination
65// Generator
66 gener->FinishRun();
8bb5c9a6 67// Stack
68 stack->FinishRun();
69// Write file
70 gener->Write();
9c653bef 71 rl->WriteHeader("OVERWRITE");
8bb5c9a6 72}
73
74
75AliGenerator* CreateGenerator()
76{
77 gener = new AliGenPythia(1);
78//
79//
80// vertex position and smearing
81 gener->SetVertexSmear(kPerEvent);
82// structure function
83 gener->SetStrucFunc(kGRVHO);
84// charm, beauty, charm_unforced, beauty_unforced, jpsi, jpsi_chi, mb
85 gener->SetProcess(kPyJets);
86// Centre of mass energy
db11648d 87 gener->SetEnergyCMS(5500.);
8bb5c9a6 88// Pt transfer of the hard scattering
db11648d 89 gener->SetPtHard(50.,50.2);
8bb5c9a6 90// Initialize generator
91 return gener;
92}
93
94
95
96
97
98
99
100
101
102
103
104