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