CMake: Retrieve Git information
[u/mrichter/AliRoot.git] / TDPMjet / fastGenDPMjet.C
1 AliGenerator*  CreateGenerator();
2
3 void fastGenDPMjet(Int_t nev = 1, char* filename = "dpmjet.root")
4 {
5 //  Runloader
6 #if defined(__CINT__)
7     gSystem->Load("liblhapdf"); 
8     gSystem->Load("libpythia6");     
9     gSystem->Load("libdpmjet");
10     gSystem->Load("libTDPMjet");
11 #endif
12
13     AliPDG::AddParticlesToPdgDataBase();
14     
15     AliRunLoader* rl = AliRunLoader::Open(filename,"FASTRUN","recreate");
16     AliPythiaRndm::SetPythiaRandom(new TRandom());
17
18     rl->SetCompressionLevel(2);
19     rl->SetNumberOfEventsPerFile(nev);
20     rl->LoadKinematics("RECREATE");
21     rl->MakeTree("E");
22     gAlice->SetRunLoader(rl);
23
24     //  Create stack
25     rl->MakeStack();
26     AliStack* stack   = rl->Stack();
27  
28     //  Header
29     AliHeader* header = rl->GetHeader();
30     //AliGenDPMjetEventHEader* dpmHeader;
31
32     //  Create and Initialize Generator
33     AliGenDPMjet *gener = CreateGenerator();
34     //AliCollisionGeometry *coll = gener->CollisionGeometry();
35     gener->Init();
36     gener->SetStack(stack);
37     
38     // Event Loop
39     Int_t iev;
40      
41     for (iev = 0; iev < nev; iev++) {
42
43         if(iev%500==0) printf("\n  Event number %d  \n", iev);
44         
45         //  Initialize event
46         header->Reset(0,iev);
47         rl->SetEventNumber(iev);
48         stack->Reset();
49         rl->MakeTree("K");
50     
51         //  Generate event
52         gener->Generate();
53         
54         Int_t npart = stack->GetNprimary();
55         
56         //  Finish event
57         header->SetNprimary(stack->GetNprimary());
58         header->SetNtrack(stack->GetNtrack());  
59
60 //      I/O
61 //      
62         stack->FinishEvent();
63         header->SetStack(stack);
64         rl->TreeE()->Fill();
65         rl->WriteKinematics("OVERWRITE");
66
67     } // event loop
68
69     gener->FinishRun();
70
71     rl->WriteHeader("OVERWRITE");
72     gener->Write();
73     rl->Write();
74     
75 }
76
77
78 AliGenerator*  CreateGenerator()
79
80   AliGenDPMjet *gener = new AliGenDPMjet(-1);
81   
82   //  p-A
83   /*Float_t pEnergy = 4000.;
84   gener->SetProjectile("P", 1, 1);
85   gener->SetTarget("A", 208, 82);
86   //
87   gener->SetEnergyCMS(TMath::Sqrt(82./208.) * 2* pEnergy);
88   gener->SetProjectileBeamEnergy(pEnergy); */ 
89   
90   //  A-p
91   Float_t pEnergy = 1577.;
92   gener->SetProjectile("A", 208, 82);
93   gener->SetTarget("P", 1, 1);
94   //
95   gener->SetEnergyCMS(TMath::Sqrt(208./82.) * 2* pEnergy);
96   gener->SetProjectileBeamEnergy(pEnergy);
97
98   // Pb-Pb
99   /*  gener->SetProjectile("A", 208, 82);
100   gener->SetTarget("A", 208, 82);
101   gener->SetEnergyCMS(2760.);
102   //
103   gener->SetProcess(kDpmMb);
104   gener->SetImpactParameterRange(0., 100.);
105   //gener->SetFragmentProd(kTRUE);*/
106
107   gener->SetTrackingFlag(0);
108   
109   return gener;
110 }
111
112
113
114
115
116
117
118
119
120
121
122