Replace the PHOS version from IHEP to Run1 and fix the compilation, when possibletest...
[u/mrichter/AliRoot.git] / test / generators / therminator / 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 <TDatime.h>
15#include <TSystem.h>
16#include <TVirtualMC.h>
17#include <TGeant3TGeo.h>
5889a25e 18#include <TGeoGlobalMagField.h>
19#include "AliRunLoader.h"
20#include "AliRun.h"
21#include "AliConfig.h"
22#include "AliDecayerPythia.h"
23#include "AliGenPythia.h"
24#include "AliGenDPMjet.h"
25#include "AliMagF.h"
26#include "AliBODY.h"
27#include "AliMAG.h"
28#include "AliABSOv3.h"
29#include "AliDIPOv3.h"
30#include "AliHALLv3.h"
31#include "AliFRAMEv2.h"
32#include "AliSHILv3.h"
33#include "AliPIPEv3.h"
34#include "AliITSv11.h"
35#include "AliTPCv2.h"
36#include "AliTOFv6T0.h"
37#include "AliHMPIDv3.h"
38#include "AliZDCv4.h"
39#include "AliTRDv1.h"
40#include "AliTRDgeometry.h"
41#include "AliFMDv1.h"
42#include "AliMUONv1.h"
43#include "AliPHOSv1.h"
44#include "AliPHOSSimParam.h"
45#include "AliPMDv1.h"
46#include "AliT0v1.h"
47#include "AliEMCALv2.h"
48#include "AliACORDEv1.h"
49#include "AliVZEROv7.h"
50#include "AliGenTherminator.h"
51#include "AliSimulation.h"
97bd8e56 52#endif
53
54enum PDC06Proc_t
55{
56 kPythia6, kPhojet, kTherminator, kRunMax
57};
58
59const char * pprRunName[] =
60{
61 "kPythia6", "kPhojet", "kTherminator"
62};
63
64enum Mag_t
65{
66 kNoField, k5kG, kFieldMax
67};
68
69const char * pprField[] =
70{
71"kNoField", "k5kG"
72};
73
74enum PprTrigConf_t
75{
76kDefaultPPTrig, kDefaultPbPbTrig
77};
78
79const char * pprTrigConfName[] =
80{
81"p-p","Pb-Pb"
82};
83
84static PprTrigConf_t strig = kDefaultPbPbTrig;// default PP trigger configuration
85
86//--- Functions ---
87class AliGenPythia;
88AliGenerator *MbPythia();
89AliGenerator *MbPhojet();
90AliGenerator *Therminator();
91void ProcessEnvironmentVars();
92
93// Geterator, field, beam energy
94static PDC06Proc_t proc = kTherminator;
95static Mag_t mag = k5kG;
96static Float_t energy = 10000; // energy in CMS
97//======================= =//
98// Set Random Number seed //
99//========================//
100TDatime dt;
101static UInt_t seed = dt.Get();
102
103// Comment line
104static TString comment;
105
106void Config()
107{
108
109 // Get settings from environment variables
110 ProcessEnvironmentVars();
111
112 gRandom->SetSeed(seed);
113 cerr<<"Seed for random number generation= "<<seed<<endl;
114
115 // Libraries required by geant321
116#if defined(__CINT__)
117 gSystem->Load("liblhapdf"); // Parton density functions
118 gSystem->Load("libEGPythia6"); // TGenerator interface
119 gSystem->Load("libpythia6"); // Pythia
120 gSystem->Load("libAliPythia6"); // ALICE specific implementations
121 gSystem->Load("libgeant321");
122#endif
123
124 new TGeant3TGeo("C++ Interface to Geant3");
125
126 //=======================================================================
127 // Create the output file
128
129
130 AliRunLoader* rl=0x0;
131
132 cout<<"Config.C: Creating Run Loader ..."<<endl;
133 rl = AliRunLoader::Open("galice.root",
134 AliConfig::GetDefaultEventFolderName(),
135 "recreate");
136 if (rl == 0x0)
137 {
138 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
139 return;
140 }
141 rl->SetCompressionLevel(2);
142 rl->SetNumberOfEventsPerFile(1000);
143 gAlice->SetRunLoader(rl);
144
145 // Set the trigger configuration: proton-proton
93133609 146 AliSimulation::Instance()->SetTriggerConfig(pprTrigConfName[strig]);
97bd8e56 147 cout<<"Trigger configuration is set to "<<pprTrigConfName[strig]<<endl;
148
149 //
150 //=======================================================================
151 // ************* STEERING parameters FOR ALICE SIMULATION **************
152 // --- Specify event type to be tracked through the ALICE setup
153 // --- All positions are in cm, angles in degrees, and P and E in GeV
154
155
156 gMC->SetProcess("DCAY",1);
157 gMC->SetProcess("PAIR",1);
158 gMC->SetProcess("COMP",1);
159 gMC->SetProcess("PHOT",1);
160 gMC->SetProcess("PFIS",0);
161 gMC->SetProcess("DRAY",0);
162 gMC->SetProcess("ANNI",1);
163 gMC->SetProcess("BREM",1);
164 gMC->SetProcess("MUNU",1);
165 gMC->SetProcess("CKOV",1);
166 gMC->SetProcess("HADR",1);
167 gMC->SetProcess("LOSS",2);
168 gMC->SetProcess("MULS",1);
169 gMC->SetProcess("RAYL",1);
170
171 Float_t cut = 1.e-3; // 1MeV cut by default
172 Float_t tofmax = 1.e10;
173
174 gMC->SetCut("CUTGAM", cut);
175 gMC->SetCut("CUTELE", cut);
176 gMC->SetCut("CUTNEU", cut);
177 gMC->SetCut("CUTHAD", cut);
178 gMC->SetCut("CUTMUO", cut);
179 gMC->SetCut("BCUTE", cut);
180 gMC->SetCut("BCUTM", cut);
181 gMC->SetCut("DCUTE", cut);
182 gMC->SetCut("DCUTM", cut);
183 gMC->SetCut("PPCUTM", cut);
184 gMC->SetCut("TOFMAX", tofmax);
185
186 //======================//
187 // Set External decayer //
188 //======================//
189 TVirtualMCDecayer* decayer = new AliDecayerPythia();
190 decayer->SetForceDecay(kAll);
191 decayer->Init();
192 gMC->SetExternalDecayer(decayer);
193
194 //=========================//
195 // Generator Configuration //
196 //=========================//
197 AliGenerator* gener = 0x0;
198
199 switch (proc)
200 {
201 case kPythia6:
202 gener = MbPythia();
203 break;
204 case kPhojet:
205 gener = MbPhojet();
206 break;
207 case kTherminator:
5889a25e 208 default:
97bd8e56 209 gener = Therminator();
210 break;
211 }
212
213 // PRIMARY VERTEX
214 //
215 gener->SetOrigin(0., 0., 0.); // vertex position
216 //
217 // Size of the interaction diamond
218 // Longitudinal
219 Float_t sigmaz = 5.4 / TMath::Sqrt(2.); // [cm]
220 if (energy == 900)
221 sigmaz = 10.5 / TMath::Sqrt(2.); // [cm]
222 //
223 // Transverse
224 Float_t betast = 10; // beta* [m]
225 Float_t eps = 3.75e-6; // emittance [m]
226 Float_t gamma = energy / 2.0 / 0.938272; // relativistic gamma [1]
227 Float_t sigmaxy = TMath::Sqrt(eps * betast / gamma) / TMath::Sqrt(2.) * 100.; // [cm]
228 printf("\n \n Diamond size x-y: %10.3e z: %10.3e\n \n", sigmaxy, sigmaz);
229
230 gener->SetSigma(sigmaxy, sigmaxy, sigmaz); // Sigma in (X,Y,Z) (cm) on IP position
231 gener->SetCutVertexZ(3.); // Truncate at 3 sigma
232 gener->SetVertexSmear(kPerEvent);
233
234 gener->Init();
235
236 // FIELD
237 AliMagF* field = 0x0;
238
239 if (mag == kNoField)
240 {
241 comment = comment.Append(" | L3 field 0.0 T");
242 field = new AliMagF("Maps","Maps", -1., -1., AliMagF::k2kG);
243 }
244 else if (mag == k5kG)
245 {
246 comment = comment.Append(" | L3 field 0.5 T");
247 field = new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG);
248 }
249 printf("\n \n Comment: %s \n \n", comment.Data());
250
251 TGeoGlobalMagField::Instance()->SetField(field);
252
253 rl->CdGAFile();
254
255 Int_t iABSO = 1;
256 Int_t iACORDE= 0;
257 Int_t iDIPO = 1;
258 Int_t iEMCAL = 0;
259 Int_t iFMD = 1;
260 Int_t iFRAME = 1;
261 Int_t iHALL = 1;
262 Int_t iITS = 1;
263 Int_t iMAG = 1;
264 Int_t iMUON = 1;
265 Int_t iPHOS = 1;
266 Int_t iPIPE = 1;
267 Int_t iPMD = 0;
268 Int_t iHMPID = 1;
269 Int_t iSHIL = 1;
270 Int_t iT0 = 1;
271 Int_t iTOF = 1;
272 Int_t iTPC = 1;
273 Int_t iTRD = 1;
274 Int_t iVZERO = 1;
275 Int_t iZDC = 1;
276
277 //=================== Alice BODY parameters =============================
278 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
279
280 if (iMAG)
281 {
282 //=================== MAG parameters ============================
283 // --- Start with Magnet since detector layouts may be depending ---
284 // --- on the selected Magnet dimensions ---
285 AliMAG *MAG = new AliMAG("MAG", "Magnet");
286 }
287
288 if (iABSO)
289 {
290 //=================== ABSO parameters ============================
291 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
292 }
293
294 if (iDIPO)
295 {
296 //=================== DIPO parameters ============================
297
298 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
299 }
300
301 if (iHALL)
302 {
303 //=================== HALL parameters ============================
304
305 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
306 }
307
308 if (iFRAME)
309 {
310 //=================== FRAME parameters ============================
311
312 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
313 FRAME->SetHoles(1);
314 }
315
316 if (iSHIL)
317 {
318 //=================== SHIL parameters ============================
319
320 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
321 }
322
323 if (iPIPE)
324 {
325 //=================== PIPE parameters ============================
326
327 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
328 }
329
330 if (iITS)
331 {
332 //=================== ITS parameters ============================
333
07787d1d 334 AliITS *ITS = new AliITSv11("ITS","ITS v11");
97bd8e56 335 }
336
337 if (iTPC)
338 {
339 //============================ TPC parameters =====================
340
341 AliTPC *TPC = new AliTPCv2("TPC", "Default");
342 }
343
344 if (iTOF)
345 {
346 //=================== TOF parameters ============================
347
348 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
349 }
350
351 if (iHMPID)
352 {
353 //=================== HMPID parameters ===========================
354
355 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
356
357 }
358
359 if (iZDC)
360 {
361 //=================== ZDC parameters ============================
362
047922b1 363 AliZDC *ZDC = new AliZDCv4("ZDC", "normal ZDC");
97bd8e56 364 }
365
366 if (iTRD)
367 {
368 //=================== TRD parameters ============================
369
370 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
371 AliTRDgeometry *geoTRD = TRD->GetGeometry();
372 // Partial geometry: modules at 0,1,7,8,9,10,17
373 // starting at 3h in positive direction
374 geoTRD->SetSMstatus(2,0);
375 geoTRD->SetSMstatus(3,0);
376 geoTRD->SetSMstatus(4,0);
377 geoTRD->SetSMstatus(5,0);
378 geoTRD->SetSMstatus(6,0);
379 geoTRD->SetSMstatus(11,0);
380 geoTRD->SetSMstatus(12,0);
381 geoTRD->SetSMstatus(13,0);
382 geoTRD->SetSMstatus(14,0);
383 geoTRD->SetSMstatus(15,0);
384 geoTRD->SetSMstatus(16,0);
385 }
386
387 if (iFMD)
388 {
389 //=================== FMD parameters ============================
390
391 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
392 }
393
394 if (iMUON)
395 {
396 //=================== MUON parameters ===========================
397 // New MUONv1 version (geometry defined via builders)
398
399 AliMUON *MUON = new AliMUONv1("MUON", "default");
400 }
401
402 if (iPHOS)
403 {
404 //=================== PHOS parameters ===========================
405
5889a25e 406 AliPHOS *PHOS = new AliPHOSv1("PHOS", "Run1");
97bd8e56 407 }
408
409 if (iPMD)
410 {
411 //=================== PMD parameters ============================
412
413 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
414 }
415
416 if (iT0)
417{
418 //=================== T0 parameters ============================
419AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
420}
421
422if (iEMCAL)
423{
424 //=================== EMCAL parameters ============================
425
c76b9217 426 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETEV1");
97bd8e56 427}
428
429if (iACORDE)
430{
431 // =================== ACORDE parameters ============================
432
433AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
434}
435
436if (iVZERO)
437{
438//=================== ACORDE parameters ============================
439
440AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
441}
442}
443//
444// PYTHIA
445//
446
447AliGenerator* MbPythia()
448{
449comment = comment.Append(" pp at 14 TeV: Pythia low-pt");
450//
451// Pythia
452AliGenPythia* pythia = new AliGenPythia(-1);
453pythia->SetMomentumRange(0, 999999.);
454pythia->SetThetaRange(0., 180.);
455pythia->SetYRange(-12.,12.);
456pythia->SetPtRange(0,1000.);
457pythia->SetProcess(kPyMb);
458pythia->SetEnergyCMS(energy);
459
460return pythia;
461}
462
463AliGenerator* MbPhojet()
464{
465comment = comment.Append(" pp at 14 TeV: Phojet low-pt");
466//
467// DPMJET
468#if defined(__CINT__)
257e1b2b 469gSystem->Load("libDPMJET"); // Parton density functions
97bd8e56 470gSystem->Load("libTDPMjet"); // Parton density functions
471#endif
472AliGenDPMjet* dpmjet = new AliGenDPMjet(-1);
473dpmjet->SetMomentumRange(0, 999999.);
474dpmjet->SetThetaRange(0., 180.);
475dpmjet->SetYRange(-12.,12.);
476dpmjet->SetPtRange(0,1000.);
477dpmjet->SetProcess(kDpmMb);
478dpmjet->SetEnergyCMS(energy);
479
480return dpmjet;
481}
482
483AliGenerator* Therminator()
484{
485comment = comment.Append(" pp at 14 TeV: Therminator");
486
487#if defined(__CINT__)
488gSystem->Load("libTTherminator"); // Therminator library
489#endif
490AliGenTherminator *genther = new AliGenTherminator();
491genther->SetFileName("event.out");
492genther->SetEventNumberInFile(1);
493genther->SetTemperature(0.145);
494genther->SetMiuI(-0.0009);
495genther->SetMiuS(0.000);
496genther->SetMiuB(0.0008);
497genther->SetAlfaRange(8.0);
498genther->SetRapRange(4.0);
499genther->SetRhoMax(7.74);
500genther->SetTau(9.74);
501genther->SetModel("Lhyquid3D");
502genther->SetLhyquidSet("LHC500C2030");
503
504return genther;
505}
506
507void ProcessEnvironmentVars()
508{
509// Run type
510if (gSystem->Getenv("CONFIG_RUN_TYPE"))
511{
512 for (Int_t iRun = 0; iRun < kRunMax; iRun++)
513 {
514 if (strcmp(gSystem->Getenv("CONFIG_RUN_TYPE"), pprRunName[iRun])==0)
515 {
516 proc = (PDC06Proc_t)iRun;
517 cout<<"Run type set to "<<pprRunName[iRun]<<endl;
518 }
519 }
520}
521
522// Field
523if (gSystem->Getenv("CONFIG_FIELD"))
524{
525 for (Int_t iField = 0; iField < kFieldMax; iField++)
526 {
527 if (strcmp(gSystem->Getenv("CONFIG_FIELD"), pprField[iField])==0)
528 {
529 mag = (Mag_t)iField;
530 cout<<"Field set to "<<pprField[iField]<<endl;
531 }
532 }
533}
534
535// Energy
536if (gSystem->Getenv("CONFIG_ENERGY"))
537{
538 energy = atoi(gSystem->Getenv("CONFIG_ENERGY"));
539 cout<<"Energy set to "<<energy<<" GeV"<<endl;
540}
541
542// Random Number seed
543if (gSystem->Getenv("CONFIG_SEED"))
544{
545 seed = atoi(gSystem->Getenv("CONFIG_SEED"));
546}
547}