Do not include from subdirectories
[u/mrichter/AliRoot.git] / FASTSIM / fastGenPA.C
CommitLineData
33de81b8 1AliGenerator* CreateGenerator();
2
3void fastGenPA(Int_t nev = 1, char* filename = "galice.root")
4{
b1bcc356 5// Runloader
6 AliRunLoader* rl = AliRunLoader::Open("galice.root", "FASTRUN", "recreate");
7
8 rl->SetCompressionLevel(2);
9 rl->SetNumberOfEventsPerFile(10000);
10 rl->LoadKinematics("RECREATE");
11 rl->MakeTree("E");
12 gAlice->SetRunLoader(rl);
13
14
33de81b8 15// Create stack
b1bcc356 16 rl->MakeStack();
17 AliStack* stack = rl->Stack();
18
19// Header
20 AliHeader* header = rl->GetHeader();
21
33de81b8 22
33de81b8 23// Create and Initialize Generator
24 AliGenerator *gener = CreateGenerator();
33de81b8 25 gener->Init();
26 gener->SetStack(stack);
27
28//
29// Event Loop
30//
31 Int_t iev;
32
33 for (iev = 0; iev < nev; iev++) {
34
35 printf("\n \n Event number %d \n \n", iev);
b1bcc356 36
37 // Initialize event
38
33de81b8 39 header->Reset(0,iev);
b1bcc356 40 rl->SetEventNumber(iev);
33de81b8 41 stack->Reset();
b1bcc356 42 rl->MakeTree("K");
33de81b8 43
44// Generate event
b1bcc356 45
33de81b8 46 gener->Generate();
b1bcc356 47
33de81b8 48// Analysis
49 Int_t npart = stack->GetNprimary();
b1bcc356 50 printf("Analyse %d Particles\n", npart);
33de81b8 51 for (Int_t part=0; part<npart; part++) {
52 TParticle *MPart = stack->Particle(part);
53 Int_t mpart = MPart->GetPdgCode();
33de81b8 54 }
55
56// Finish event
57 header->SetNprimary(stack->GetNprimary());
58 header->SetNtrack(stack->GetNtrack());
59// I/O
60//
b1bcc356 61 stack->FinishEvent();
62 header->SetStack(stack);
63 rl->TreeE()->Fill();
64 rl->WriteKinematics("OVERWRITE");
33de81b8 65 } // event loop
66//
67// Termination
68// Generator
33de81b8 69 gener->FinishRun();
b1bcc356 70
71 // Write file
72 rl->WriteHeader("OVERWRITE");
33de81b8 73 gener->Write();
b1bcc356 74 rl->Write();
33de81b8 75}
76
77
78AliGenerator* CreateGenerator()
79{
80 AliGenCocktail *gener = new AliGenCocktail();
81 gener->SetTrackingFlag(0);
82 AliGenHijing *hijing = new AliGenHijing(-1);
83// centre of mass energy
84 hijing->SetEnergyCMS(TMath::Sqrt(82./208.) * 14000.);
85// impact parameter range
86 hijing->SetImpactParameterRange(0., 6.);
87// reference frame
88 hijing->SetReferenceFrame("CMS");
89 hijing->SetBoostLHC(1);
90// projectile
91 hijing->SetProjectile("P", 1, 1);
92 hijing->SetTarget ("A", 208, 82);
93// tell hijing to keep the full parent child chain
94 hijing->KeepFullEvent();
95// enable jet quenching
96 hijing->SetJetQuenching(4);
97// enable shadowing
98 hijing->SetShadowing(1);
99// Don't track spectators
100 hijing->SetSpectators(0);
101// kinematic selection
102 hijing->SetSelectAll(0);
103//
104 AliGenSlowNucleons* gray = new AliGenSlowNucleons(1);
105 AliSlowNucleonModel* model = new AliSlowNucleonModelExp();
106 gray->SetSlowNucleonModel(model);
107 gray->SetDebug(1);
108
109
110 gener->AddGenerator(hijing,"Hijing pPb", 1);
111 gener->AddGenerator(gray, "Gray Particles",1);
112
113 return gener;
114}
115
116
117
118
119
120
121
122
123
124
125
126