]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FASTSIM/fastGenPA.C
commented logging message
[u/mrichter/AliRoot.git] / FASTSIM / fastGenPA.C
1 AliGenerator*  CreateGenerator();
2
3 void fastGenPA(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     AliPythia* pyth = AliPythia::Instance();
24     
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         header->Reset(0,iev);
39         stack->Reset();
40         stack->BeginEvent(iev);
41
42 //  Generate event
43         gener->Generate();
44                 
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 //      
59 //      stack->FinishEvent();
60 //      header->SetStack(stack);
61 //      treeE->Fill();
62 //      (stack->TreeK())->Write(0,TObject::kOverwrite);
63     } // event loop
64 //
65 //                         Termination
66 //  Generator
67     printf("Calling Finish Run \n");
68     
69     gener->FinishRun();
70 //  Header
71     treeE->Write(0,TObject::kOverwrite);
72     delete treeE;   treeE = 0;
73 //  Stack
74     stack->FinishRun();
75 //  Write file
76     gener->Write();
77     file->Write();
78 }
79
80
81 AliGenerator*  CreateGenerator()
82 {
83     AliGenCocktail *gener  = new AliGenCocktail();
84     gener->SetTrackingFlag(0);
85     AliGenHijing   *hijing = new AliGenHijing(-1);
86 // centre of mass energy 
87     hijing->SetEnergyCMS(TMath::Sqrt(82./208.) * 14000.);
88 // impact parameter range
89     hijing->SetImpactParameterRange(0., 6.);
90 // reference frame
91     hijing->SetReferenceFrame("CMS");
92     hijing->SetBoostLHC(1);
93 // projectile
94     hijing->SetProjectile("P", 1, 1);
95     hijing->SetTarget    ("A", 208, 82);
96 // tell hijing to keep the full parent child chain
97     hijing->KeepFullEvent();
98 // enable jet quenching
99     hijing->SetJetQuenching(4);
100 // enable shadowing
101     hijing->SetShadowing(1);
102 // Don't track spectators
103     hijing->SetSpectators(0);
104 // kinematic selection
105     hijing->SetSelectAll(0);
106 //
107     AliGenSlowNucleons*  gray    = new AliGenSlowNucleons(1);
108     AliSlowNucleonModel* model   = new AliSlowNucleonModelExp();
109     gray->SetSlowNucleonModel(model);
110     gray->SetDebug(1);
111     
112     
113     gener->AddGenerator(hijing,"Hijing pPb", 1);
114     gener->AddGenerator(gray,  "Gray Particles",1);
115     
116     return gener;
117 }
118
119
120
121
122
123
124
125
126
127
128
129