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