nvartrk=7 in ESE task
[u/mrichter/AliRoot.git] / FASTSIM / fastGenPA.C
1 AliGenerator*  CreateGenerator();
2
3 void fastGenPA(Int_t nev = 1, char* filename = "galice.root")
4 {
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
15 //  Create stack
16     rl->MakeStack();
17     AliStack* stack      = rl->Stack();
18  
19 //  Header
20     AliHeader* header = rl->GetHeader();
21
22
23 //  Create and Initialize Generator
24     AliGenerator *gener = CreateGenerator();
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);
36
37         //  Initialize event
38
39         header->Reset(0,iev);
40         rl->SetEventNumber(iev);
41         stack->Reset();
42         rl->MakeTree("K");
43
44 //  Generate event
45
46         gener->Generate();
47
48 //  Analysis
49         Int_t npart = stack->GetNprimary();
50         printf("Analyse %d Particles\n", npart);
51         for (Int_t part=0; part<npart; part++) {
52             TParticle *MPart = stack->Particle(part);
53             Int_t mpart  = MPart->GetPdgCode();
54         }
55         
56 //  Finish event
57         header->SetNprimary(stack->GetNprimary());
58         header->SetNtrack(stack->GetNtrack());  
59 //      I/O
60 //      
61         stack->FinishEvent();
62         header->SetStack(stack);
63         rl->TreeE()->Fill();
64         rl->WriteKinematics("OVERWRITE");
65     } // event loop
66 //
67 //                         Termination
68 //  Generator
69     gener->FinishRun();
70
71     //  Write file
72     rl->WriteHeader("OVERWRITE");
73     gener->Write();
74     rl->Write();
75 }
76
77
78 AliGenerator*  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