Replace the PHOS version from IHEP to Run1 and fix the compilation, when possibletest...
[u/mrichter/AliRoot.git] / test / generators / epos / Config.C
CommitLineData
97bd8e56 1// One can use the configuration macro in compiled mode by
2// root [0] gSystem->Load("libgeant321");
5889a25e 3// root [1] gSystem->Load("libpythia6.4.25.so");
4// root [2] gSystem->Load("libqpythia.so");
5// root [3] gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include\
6// -I$ALICE/geant3/TGeant3");
7// root [4] AliSimulation sim
8// root [5] sim.SetConfigFile("Config.C++")
9// root [6] sim.Run()
97bd8e56 10
11#if !defined(__CINT__) || defined(__MAKECINT__)
12#include <Riostream.h>
13#include <TRandom.h>
14#include <TSystem.h>
15#include <TVirtualMC.h>
16#include <TGeant3TGeo.h>
17#include <TPDGCode.h>
18#include <TF1.h>
5889a25e 19#include <TGeoGlobalMagField.h>
20#include "AliRunLoader.h"
21#include "AliRun.h"
22#include "AliConfig.h"
23#include "AliGenerator.h"
24#include "AliLog.h"
25#include "AliDecayerPythia.h"
26#include "AliGenHIJINGpara.h"
27#include "AliGenHijing.h"
28#include "AliGenCocktail.h"
29#include "AliGenSlowNucleons.h"
30#include "AliSlowNucleonModelExp.h"
31#include "AliGenParam.h"
32#include "AliGenMUONlib.h"
33#include "AliGenSTRANGElib.h"
34#include "AliGenMUONCocktail.h"
35#include "AliGenCocktail.h"
36#include "AliGenGeVSim.h"
37#include "AliGeVSimParticle.h"
38#include "AliGenPythia.h"
39#include "AliMagF.h"
40#include "AliBODY.h"
41#include "AliMAG.h"
42#include "AliABSOv3.h"
43#include "AliDIPOv3.h"
44#include "AliHALLv3.h"
45#include "AliFRAMEv2.h"
46#include "AliSHILv3.h"
47#include "AliPIPEv3.h"
48#include "AliITSv11.h"
49#include "AliTPCv2.h"
50#include "AliTOFv6T0.h"
51#include "AliHMPIDv3.h"
52#include "AliZDCv4.h"
53#include "AliTRDv1.h"
54#include "AliFMDv1.h"
55#include "AliMUONv1.h"
56#include "AliPHOSv1.h"
57#include "AliPMDv1.h"
58#include "AliT0v1.h"
59#include "AliEMCALv2.h"
60#include "AliACORDEv1.h"
61#include "AliVZEROv7.h"
62#include "AliGenEpos.h"
63#include "AliTRDgeometry.h"
64#include "AliSimulation.h"
97bd8e56 65#endif
66
67enum PprTrigConf_t
68{
69 kDefaultPPTrig, kDefaultPbPbTrig
70};
71
72const char * pprTrigConfName[] = {
73 "p-p","Pb-Pb"
74};
75
76// This part for configuration
77
78static AliMagF::BMap_t smag = AliMagF::k5kG;
79static Int_t sseed = 0; //Set 0 to use the current time
80static PprTrigConf_t strig = kDefaultPPTrig; // default pp trigger configuration
81static Float_t energy = 900;
82
83// Comment line
84static TString comment;
85
86// Functions
87Float_t EtaToTheta(Float_t arg);
88void ProcessEnvironmentVars();
89
90void Config()
91{
92 // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
93 // Theta range given through pseudorapidity limits 22/6/2001
94
95 // Get settings from environment variables
96 ProcessEnvironmentVars();
97
98 // Set Random Number seed
99 gRandom->SetSeed(sseed);
100 cout<<"Seed for random number generation= "<<gRandom->GetSeed()<<endl;
101
102
103 // libraries required by geant321
104#if defined(__CINT__)
105 gSystem->Load("liblhapdf");
106 gSystem->Load("libEGPythia6");
107 gSystem->Load("libpythia6");
108 gSystem->Load("libAliPythia6");
109 gSystem->Load("libgeant321");
4070f709 110 gSystem->Load("libEPOS");
97bd8e56 111#endif
112
113 new TGeant3TGeo("C++ Interface to Geant3");
114
115 // Output every 100 tracks
116 ((TGeant3*)gMC)->SetSWIT(4,100);
117
118 AliRunLoader* rl=0x0;
119
120 AliLog::Message(AliLog::kInfo, "Creating Run Loader", "", "", "Config()","ConfigPPR.C", __LINE__);
121
122 rl = AliRunLoader::Open("galice.root",
123 AliConfig::GetDefaultEventFolderName(),
124 "recreate");
125 if (rl == 0x0)
126 {
127 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
128 return;
129 }
130 rl->SetCompressionLevel(2);
131 rl->SetNumberOfEventsPerFile(100);
132 gAlice->SetRunLoader(rl);
133
134 // Set the trigger configuration
93133609 135 AliSimulation::Instance()->SetTriggerConfig(pprTrigConfName[strig]);
97bd8e56 136 cout<<"Trigger configuration is set to "<<pprTrigConfName[strig]<<endl;
137
138 //
139 // Set External decayer
140 AliDecayer *decayer = new AliDecayerPythia();
141 decayer->Init();
142 gMC->SetExternalDecayer(decayer);
143 //
144 //
145 //=======================================================================
146 //
147 //=======================================================================
148 // ************* STEERING parameters FOR ALICE SIMULATION **************
149 // --- Specify event type to be tracked through the ALICE setup
150 // --- All positions are in cm, angles in degrees, and P and E in GeV
151
152 gMC->SetProcess("DCAY",1);
153 gMC->SetProcess("PAIR",1);
154 gMC->SetProcess("COMP",1);
155 gMC->SetProcess("PHOT",1);
156 gMC->SetProcess("PFIS",0);
157 gMC->SetProcess("DRAY",0);
158 gMC->SetProcess("ANNI",1);
159 gMC->SetProcess("BREM",1);
160 gMC->SetProcess("MUNU",1);
161 gMC->SetProcess("CKOV",1);
162 gMC->SetProcess("HADR",1);
163 gMC->SetProcess("LOSS",2);
164 gMC->SetProcess("MULS",1);
165 gMC->SetProcess("RAYL",1);
166
167 Float_t cut = 1.e-3; // 1MeV cut by default
168 Float_t tofmax = 1.e10;
169
170 gMC->SetCut("CUTGAM", cut);
171 gMC->SetCut("CUTELE", cut);
172 gMC->SetCut("CUTNEU", cut);
173 gMC->SetCut("CUTHAD", cut);
174 gMC->SetCut("CUTMUO", cut);
175 gMC->SetCut("BCUTE", cut);
176 gMC->SetCut("BCUTM", cut);
177 gMC->SetCut("DCUTE", cut);
178 gMC->SetCut("DCUTM", cut);
179 gMC->SetCut("PPCUTM", cut);
180 gMC->SetCut("TOFMAX", tofmax);
181
182 // Generator Configuration
183
184 AliGenerator* gener = 0x0;
185
186 AliGenEpos *epos = new AliGenEpos();
187 epos->SetProjectile("p", 1, 1);
188 epos->SetTarget("p", 1, 1);
189 epos->SetEnergyCMS(energy);
190 gener = epos;
191
192 gener->SetOrigin(0, 0, 0); // vertex position
193 gener->SetSigma(0, 0, 5.3); // Sigma in (X,Y,Z) (cm) on IP position
194 gener->SetCutVertexZ(1.); // Truncate at 1 sigma
195 gener->SetVertexSmear(kPerEvent);
196 gener->SetTrackingFlag(1);
197 gener->Init();
198
199 AliMagF* field = 0x0;
200 if (smag == AliMagF::k2kG) {
201 comment = comment.Append(" | L3 field 0.2 T");
202 field = new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG,AliMagF::kBeamTypepp, energy/2.0);
203 } else if (smag == AliMagF::k5kG) {
204 comment = comment.Append(" | L3 field 0.5 T");
205 field = new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG,AliMagF::kBeamTypepp, energy/2.0);
206 }
207
208 printf("\n \n Comment: %s \n \n", comment.Data());
209
210
211// Field
212 TGeoGlobalMagField::Instance()->SetField(field);
213
214 rl->CdGAFile();
215//
216 Int_t iABSO = 1;
217 Int_t iDIPO = 1;
218 Int_t iFMD = 1;
219 Int_t iFRAME = 1;
220 Int_t iHALL = 1;
221 Int_t iITS = 1;
222 Int_t iMAG = 1;
223 Int_t iMUON = 1;
224 Int_t iPHOS = 1;
225 Int_t iPIPE = 1;
226 Int_t iPMD = 1;
227 Int_t iHMPID = 1;
228 Int_t iSHIL = 1;
229 Int_t iT0 = 1;
230 Int_t iTOF = 1;
231 Int_t iTPC = 1;
232 Int_t iTRD = 1;
233 Int_t iZDC = 1;
234 Int_t iEMCAL = 1;
235 Int_t iVZERO = 1;
236 Int_t iACORDE = 1;
237
238 //=================== Alice BODY parameters =============================
239 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
240
97bd8e56 241 if (iMAG)
242 {
243 //=================== MAG parameters ============================
244 // --- Start with Magnet since detector layouts may be depending ---
245 // --- on the selected Magnet dimensions ---
246 AliMAG *MAG = new AliMAG("MAG", "Magnet");
247 }
248
249
250 if (iABSO)
251 {
252 //=================== ABSO parameters ============================
253 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
254 }
255
256 if (iDIPO)
257 {
258 //=================== DIPO parameters ============================
259
260 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
261 }
262
263 if (iHALL)
264 {
265 //=================== HALL parameters ============================
266
267 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
268 }
269
270
271 if (iFRAME)
272 {
273 //=================== FRAME parameters ============================
274
275 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
276 FRAME->SetHoles(1);
277 }
278
279 if (iSHIL)
280 {
281 //=================== SHIL parameters ============================
282
283 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
284 }
285
286
287 if (iPIPE)
288 {
289 //=================== PIPE parameters ============================
290
291 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
292 }
293
294 if (iITS)
295 {
296 //=================== ITS parameters ============================
297
07787d1d 298 AliITS *ITS = new AliITSv11("ITS","ITS v11");
97bd8e56 299 }
300
301 if (iTPC)
302 {
93133609 303 //============================ TPC parameters ===================
97bd8e56 304 AliTPC *TPC = new AliTPCv2("TPC", "Default");
305 }
306
307
308 if (iTOF) {
309 //=================== TOF parameters ============================
310 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
93133609 311 }
97bd8e56 312
313
314 if (iHMPID)
315 {
316 //=================== HMPID parameters ===========================
317 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
318
319 }
320
321
322 if (iZDC)
323 {
324 //=================== ZDC parameters ============================
325
047922b1 326 AliZDC *ZDC = new AliZDCv4("ZDC", "normal ZDC");
97bd8e56 327 }
328
329 if (iTRD)
330 {
331 //=================== TRD parameters ============================
332
333 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
93133609 334 AliTRDgeometry *geoTRD = TRD->GetGeometry();
335 // Partial geometry: modules at 0,1,7,8,9,10,17
336 // starting at 3h in positive direction
337 geoTRD->SetSMstatus(2,0);
338 geoTRD->SetSMstatus(3,0);
339 geoTRD->SetSMstatus(4,0);
340 geoTRD->SetSMstatus(5,0);
341 geoTRD->SetSMstatus(6,0);
342 geoTRD->SetSMstatus(11,0);
343 geoTRD->SetSMstatus(12,0);
344 geoTRD->SetSMstatus(13,0);
345 geoTRD->SetSMstatus(14,0);
346 geoTRD->SetSMstatus(15,0);
347 geoTRD->SetSMstatus(16,0);
97bd8e56 348 }
349
350 if (iFMD)
351 {
352 //=================== FMD parameters ============================
353 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
354 }
355
356 if (iMUON)
357 {
358 //=================== MUON parameters ===========================
359 // New MUONv1 version (geometry defined via builders)
93133609 360 AliMUON *MUON = new AliMUONv1("MUON","default");
97bd8e56 361 }
362 //=================== PHOS parameters ===========================
363
364 if (iPHOS)
365 {
5889a25e 366 AliPHOS *PHOS = new AliPHOSv1("PHOS", "Run1");
97bd8e56 367 }
368
369
370 if (iPMD)
371 {
372 //=================== PMD parameters ============================
373 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
374 }
375
376 if (iT0)
377 {
378 //=================== T0 parameters ============================
379 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
380 }
381
382 if (iEMCAL)
383 {
384 //=================== EMCAL parameters ============================
c76b9217 385 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETEV1");
97bd8e56 386 }
387
388 if (iACORDE)
389 {
390 //=================== ACORDE parameters ============================
391 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
392 }
393
394 if (iVZERO)
395 {
396 //=================== VZERO parameters ============================
397 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
398 }
399
400
401}
402
403Float_t EtaToTheta(Float_t arg){
404 return (180./TMath::Pi())*2.*atan(exp(-arg));
405}
406
407
408
409
410void ProcessEnvironmentVars()
411{
97bd8e56 412 // Random Number seed
413 if (gSystem->Getenv("CONFIG_SEED")) {
414 sseed = atoi(gSystem->Getenv("CONFIG_SEED"));
415 }
416}