Fix in material cards creation for duplicated names. (A. Gheata)
[u/mrichter/AliRoot.git] / TFluka / macro / FlukaConfig.C
CommitLineData
b9d0a01d 1static Int_t eventsPerRun = 100;
2void Config()
3{
4 cout << "==> Config.C..." << endl;
5
6 // Set Random Number seed
7 // gRandom->SetSeed(12345);
8
9
10 // libraries required by fluka21
241a2f65 11
a3fd5381 12 if (!gSystem->Getenv("WITH_ROOT")) {
13 cout << "=== RUNNING TFluka with FLUGG ===\n";
14 char * gvmc = gSystem->ExpandPathName("$(G4VMC)/examples/macro/g4libs.C");
15 gROOT->LoadMacro(gvmc);
16 g4libs();
241a2f65 17
a3fd5381 18 cout << "\t* Loading Flugg..." << endl;
19 gSystem->Load("libFlugg");
20 } else {
21 cout << "=== RUNNING TFluka with TGeo ===\n";
22 gSystem->Load("libGeom");
23 }
241a2f65 24 cout << "\t* Loading TFluka..." << endl;
25 gSystem->Load("libTFluka");
26
b9d0a01d 27 cout << "\t* Instantiating TFluka..." << endl;
28 new TFluka("C++ Interface to Fluka", 3/*verbositylevel*/);
29
30 cout << "\t* Recreating galice.root if needed..." << endl;
241a2f65 31
32 if (!gSystem->Getenv("CONFIG_FILE"))
33 {
34 cout<<"Config.C: Creating Run Loader ..."<<endl;
35 AliRunLoader* rl = AliRunLoader::Open("galice.root",AliConfig::fgkDefaultEventFolderName,
36 "recreate");
37 if (rl == 0x0)
38 {
39 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
40 return;
41 }
42 rl->SetCompressionLevel(2);
43 rl->SetNumberOfEventsPerFile(3);
44 gAlice->SetRunLoader(rl);
b9d0a01d 45 }
241a2f65 46
b9d0a01d 47
48 TFluka *fluka = (TFluka *) gMC;
241a2f65 49 fluka->SetCoreInputFileName("corealice.inp");
dc3912b3 50 fluka->SetInputFileName("alice.inp");
b9d0a01d 51 //
52 // Set External decayer
53 TVirtualMCDecayer *decayer = new AliDecayerPythia();
b9d0a01d 54 decayer->SetForceDecay(kAll);
55 decayer->Init();
56 gMC->SetExternalDecayer(decayer);
57 //
58 //
59 // Physics process control
60 gMC ->SetProcess("DCAY",1);
241a2f65 61 gMC ->SetProcess("PAIR",0);
62 gMC ->SetProcess("COMP",0);
63 gMC ->SetProcess("PHOT",0);
b9d0a01d 64 gMC ->SetProcess("PFIS",0);
65 gMC ->SetProcess("DRAY",0);
241a2f65 66 gMC ->SetProcess("ANNI",0);
67 gMC ->SetProcess("BREM",0);
b9d0a01d 68 gMC ->SetProcess("MUNU",1);
b9d0a01d 69 gMC ->SetProcess("HADR",1); //Select pure GEANH (HADR 1) or GEANH/NUCRIN (HADR 3)
70 gMC ->SetProcess("LOSS",2);
71 gMC ->SetProcess("MULS",1);
72 //xx gMC ->SetProcess("RAYL",1);
73
74 // Energy cuts
75 // (in development)
241a2f65 76 Float_t cut = 1.e-1; // 100 MeV cut by default
b9d0a01d 77 Float_t tofmax = 1.e10;
78
79 gMC ->SetCut("CUTGAM",cut);
80 gMC ->SetCut("CUTELE",cut);
81 gMC ->SetCut("CUTNEU",cut);
82 gMC ->SetCut("CUTHAD",cut);
83 gMC ->SetCut("CUTMUO",cut);
84 gMC ->SetCut("BCUTE",cut);
85 gMC ->SetCut("BCUTM",cut);
86 gMC ->SetCut("DCUTE",cut);
87 gMC ->SetCut("DCUTM",cut);
88 gMC ->SetCut("PPCUTM",cut);
89 gMC ->SetCut("TOFMAX",tofmax);
90
e98b7803 91 //
92 //=======================================================================
93 // ************* STEERING parameters FOR ALICE SIMULATION **************
94 // --- Specify event type to be tracked through the ALICE setup
95 // --- All positions are in cm, angles in degrees, and P and E in GeV
96 if (gSystem->Getenv("CONFIG_NPARTICLES"))
241a2f65 97 int nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
e98b7803 98 else
241a2f65 99 int nParticles = 10;
100
e98b7803 101 cout << "\t* Creating and configuring generator for " << nParticles
102 << " particles..." << endl;
103
104 AliGenHIJINGpara *gener = new AliGenHIJINGpara(nParticles);
105
106 gener->SetMomentumRange(0, 999);
107 gener->SetPhiRange(0, 360);
108 // Set pseudorapidity range from -8 to 8.
241a2f65 109 Float_t thmin = EtaToTheta( 0.1); // theta min. <---> eta max
110 Float_t thmax = EtaToTheta(-0.1); // theta max. <---> eta min
e98b7803 111 gener->SetThetaRange(thmin,thmax);
112 gener->SetOrigin(0, 0, 0); //vertex position
113 gener->SetSigma(0, 0, 0); //Sigma in (X,Y,Z) (cm) on IP position
114 gener->Init();
115 //
116 // Activate this line if you want the vertex smearing to happen
117 // track by track
118 //
b9d0a01d 119
e98b7803 120 gAlice->SetField(-999, 2); //Specify maximum magnetic field in Tesla (neg. ==> default field)
241a2f65 121 gAlice->SetDebug(10);
e98b7803 122
2c053554 123 Int_t iABSO = 0; //1
cdb67f97 124 Int_t iCRT = 0; //Not good ?
2c053554 125 Int_t iDIPO = 0; //1
126 Int_t iFMD = 0; //1
127 Int_t iFRAME = 0; //1
128 Int_t iHALL = 0; //1
129 Int_t iITS = 0; //1
130 Int_t iMAG = 0; //1
131 Int_t iMUON = 0; //1. Not good (newFlagLttc=10000 is outside array bounds)
132 Int_t iPHOS = 0; //1
133 Int_t iPIPE = 0; //1
cdb67f97 134 Int_t iPMD = 0; //Not good (too many regions)
241a2f65 135 Int_t iRICH = 1; //1. Not good (no tracking with FRAME)
2c053554 136 Int_t iSHIL = 0; //1. Not good (no tracking) (it works alone)
137 Int_t iSTART = 0; //1. Not good (no tracking) (it works alone)
138 Int_t iTOF = 0; //1. Not good (no tracking) (newFlagLttc=10000 is outside array bounds if alone)
cdb67f97 139 Int_t iTPC = 1;
2c053554 140 Int_t iTRD = 0; //1. Not good (no tracking) (Crash alone with FRAME)
141 Int_t iZDC = 0; //1. Needs SHIL and others
247ce658 142 Int_t iEMCAL = 0; //Not good (Crash)
2c053554 143 Int_t iVZERO = 0;
cdb67f97 144
e98b7803 145 cout << "\t* Creating the detectors ..." << endl;
146 //=================== Alice BODY parameters =============================
147 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
148 cout << "\t\t+ BODY..." << endl;
149
150
151 if (iMAG)
b9d0a01d 152 {
e98b7803 153 //=================== MAG parameters ============================
154 // --- Start with Magnet since detector layouts may be depending ---
155 // --- on the selected Magnet dimensions ---
156 cout << "\t\t+ Magnet..." << endl;
157 AliMAG *MAG = new AliMAG("MAG", "Magnet");
b9d0a01d 158 }
e98b7803 159
160
161 if (iABSO)
b9d0a01d 162 {
e98b7803 163 //=================== ABSO parameters ============================
164 cout << "\t\t+ ABSO..." << endl;
165 AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
b9d0a01d 166 }
e98b7803 167
168 if (iDIPO)
b9d0a01d 169 {
e98b7803 170 //=================== DIPO parameters ============================
171 cout << "\t\t+ DIPO..." << endl;
172 AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
b9d0a01d 173 }
e98b7803 174
175 if (iHALL)
b9d0a01d 176 {
e98b7803 177 //=================== HALL parameters ============================
178 cout << "\t\t+ HALL..." << endl;
179 AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
b9d0a01d 180 }
e98b7803 181
182
183 if (iFRAME)
b9d0a01d 184 {
e98b7803 185 //=================== FRAME parameters ============================
186
187 cout << "\t\t+ FRAME..." << endl;
188 AliFRAME *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
189
b9d0a01d 190 }
e98b7803 191
192 if (iSHIL)
b9d0a01d 193 {
e98b7803 194 //=================== SHIL parameters ============================
195
196 cout << "\t\t+ SHIL..." << endl;
197 AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding");
b9d0a01d 198 }
e98b7803 199
200
201 if (iPIPE)
b9d0a01d 202 {
e98b7803 203 //=================== PIPE parameters ============================
204
205 cout << "\t\t+ PIPE..." << endl;
206 AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
b9d0a01d 207 }
e98b7803 208
b9d0a01d 209 if(iITS) {
e98b7803 210 cout << "\t\t+ ITS..." << endl;
211
212 //=================== ITS parameters ============================
b9d0a01d 213 //
214 // As the innermost detector in ALICE, the Inner Tracking System "impacts" on
215 // almost all other detectors. This involves the fact that the ITS geometry
216 // still has several options to be followed in parallel in order to determine
217 // the best set-up which minimizes the induced background. All the geometries
218 // available to date are described in the following. Read carefully the comments
219 // and use the default version (the only one uncommented) unless you are making
220 // comparisons and you know what you are doing. In this case just uncomment the
221 // ITS geometry you want to use and run Aliroot.
222 //
223 // Detailed geometries:
224 //
225 //
226 //AliITS *ITS = new AliITSv5symm("ITS","Updated ITS TDR detailed version with symmetric services");
227 //
228 //AliITS *ITS = new AliITSv5asymm("ITS","Updates ITS TDR detailed version with asymmetric services");
229 //
230 AliITSvPPRasymm *ITS = new AliITSvPPRasymm("ITS","New ITS PPR detailed version with asymmetric services");
231 ITS->SetMinorVersion(2); // don't touch this parameter if you're not an ITS developer
232 ITS->SetReadDet(kFALSE); // don't touch this parameter if you're not an ITS developer
233 // ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det"); // don't touch this parameter if you're not an ITS developer
234 ITS->SetThicknessDet1(200.); // detector thickness on layer 1 must be in the range [100,300]
235 ITS->SetThicknessDet2(200.); // detector thickness on layer 2 must be in the range [100,300]
236 ITS->SetThicknessChip1(200.); // chip thickness on layer 1 must be in the range [150,300]
237 ITS->SetThicknessChip2(200.); // chip thickness on layer 2 must be in the range [150,300]
238 ITS->SetRails(1); // 1 --> rails in ; 0 --> rails out
239 ITS->SetCoolingFluid(1); // 1 --> water ; 0 --> freon
240 //
241 //AliITSvPPRsymm *ITS = new AliITSvPPRsymm("ITS","New ITS PPR detailed version with symmetric services");
242 //ITS->SetMinorVersion(2); // don't touch this parameter if you're not an ITS developer
243 //ITS->SetReadDet(kFALSE); // don't touch this parameter if you're not an ITS developer
244 //ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRsymm2.det"); // don't touch this parameter if you're not an ITS developer
245 //ITS->SetThicknessDet1(200.); // detector thickness on layer 1 must be in the range [100,300]
246 //ITS->SetThicknessDet2(200.); // detector thickness on layer 2 must be in the range [100,300]
247 //ITS->SetThicknessChip1(200.); // chip thickness on layer 1 must be in the range [150,300]
248 //ITS->SetThicknessChip2(200.); // chip thickness on layer 2 must be in the range [150,300]
249 //ITS->SetRails(1); // 1 --> rails in ; 0 --> rails out
250 //ITS->SetCoolingFluid(1); // 1 --> water ; 0 --> freon
251 //
252 //
253 // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful
254 // for reconstruction !):
255 //
256 //
257 //AliITSvPPRcoarseasymm *ITS = new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version with asymmetric services");
258 //ITS->SetRails(1); // 1 --> rails in ; 0 --> rails out
259 //ITS->SetSupportMaterial(0); // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
260 //
261 //AliITS *ITS = new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version with symmetric services");
262 //ITS->SetRails(1); // 1 --> rails in ; 0 --> rails out
263 //ITS->SetSupportMaterial(0); // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
264 //
265 //
266 //
267 // Geant3 <-> EUCLID conversion
268 // ============================
269 //
270 // SetEUCLID is a flag to output (=1) or not to output (=0) both geometry and
271 // media to two ASCII files (called by default ITSgeometry.euc and
272 // ITSgeometry.tme) in a format understandable to the CAD system EUCLID.
273 // The default (=0) means that you dont want to use this facility.
274 //
275 ITS->SetEUCLID(0);
276 }
277
e98b7803 278
279 if (iTPC)
b9d0a01d 280 {
e98b7803 281 cout << "\t\t+ TPC..." << endl;
282 //============================ TPC parameters ================================
283 // --- This allows the user to specify sectors for the SLOW (TPC geometry 2)
284 // --- Simulator. SecAL (SecAU) <0 means that ALL lower (upper)
285 // --- sectors are specified, any value other than that requires at least one
286 // --- sector (lower or upper)to be specified!
287 // --- Reminder: sectors 1-24 are lower sectors (1-12 -> z>0, 13-24 -> z<0)
288 // --- sectors 25-72 are the upper ones (25-48 -> z>0, 49-72 -> z<0)
289 // --- SecLows - number of lower sectors specified (up to 6)
290 // --- SecUps - number of upper sectors specified (up to 12)
291 // --- Sens - sensitive strips for the Slow Simulator !!!
292 // --- This does NOT work if all S or L-sectors are specified, i.e.
293 // --- if SecAL or SecAU < 0
294 //
295 //
296 //-----------------------------------------------------------------------------
241a2f65 297 //
e98b7803 298 // gROOT->LoadMacro("SetTPCParam.C");
299 // AliTPCParam *param = SetTPCParam();
241a2f65 300 AliTPC *TPC = new AliTPCv1("TPC", "Default");
e98b7803 301 // All sectors included
302 TPC->SetSecAL(-1);
303 TPC->SetSecAU(-1);
b9d0a01d 304 }
e98b7803 305
306 if (iTOF)
b9d0a01d 307 {
e98b7803 308 cout << "\t\t+ TOF..." << endl;
309 //=================== TOF parameters ============================
310 AliTOF *TOF = new AliTOFv2("TOF", "normal TOF");
b9d0a01d 311 }
e98b7803 312
313 if (iRICH)
b9d0a01d 314 {
e98b7803 315 cout << "\t\t+ RICH..." << endl;
316 //=================== RICH parameters ===========================
b9d0a01d 317 AliRICH *RICH = new AliRICHv1("RICH", "normal RICH");
e98b7803 318
b9d0a01d 319 }
e98b7803 320
321
322 if (iZDC)
b9d0a01d 323 {
e98b7803 324 cout << "\t\t+ ZDC..." << endl;
325 //=================== ZDC parameters ============================
326
327 AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
b9d0a01d 328 }
e98b7803 329
330 if (iCRT)
b9d0a01d 331 {
e98b7803 332 cout << "\t\t+ CRT..." << endl;
333 //=================== CRT parameters ============================
334
335 AliCRT *CRT = new AliCRTv0("CRT", "normal CRT");
b9d0a01d 336 }
e98b7803 337
338 if (iTRD)
b9d0a01d 339 {
e98b7803 340 cout << "\t\t+ TRD..." << endl;
341 //=================== TRD parameters ============================
342
343 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
344
345 // Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 90% Xe + 10% CO2)
346 TRD->SetGasMix(1);
347
348 // With hole in front of PHOS
349 TRD->SetPHOShole();
350 // With hole in front of RICH
351 TRD->SetRICHhole();
352 // Switch on TR
353 AliTRDsim *TRDsim = TRD->CreateTR();
b9d0a01d 354 }
e98b7803 355
356 if (iFMD)
b9d0a01d 357 {
e98b7803 358 cout << "\t\t+ FMD..." << endl;
359 //=================== FMD parameters ============================
360
361 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
362 FMD->SetRingsSi1(256);
363 FMD->SetRingsSi2(64);
364 FMD->SetSectorsSi1(20);
365 FMD->SetSectorsSi2(24);
366 }
367
368 if (iMUON)
b9d0a01d 369 {
e98b7803 370 cout << "\t\t+ MUON..." << endl;
371 //=================== MUON parameters ===========================
372
373 AliMUON *MUON = new AliMUONv1("MUON", "default");
b9d0a01d 374 }
e98b7803 375 //=================== PHOS parameters ===========================
376
377 if (iPHOS)
b9d0a01d 378 {
e98b7803 379 cout << "\t\t+ PHOS..." << endl;
380 AliPHOS *PHOS = new AliPHOSv1("PHOS", "GPS2");
b9d0a01d 381 }
e98b7803 382
383
384 if (iPMD)
b9d0a01d 385 {
e98b7803 386 cout << "\t\t+ PMD..." << endl;
387 //=================== PMD parameters ============================
388
389 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
390
391 PMD->SetPAR(1., 1., 0.8, 0.02);
392 PMD->SetIN(6., 18., -580., 27., 27.);
393 PMD->SetGEO(0.0, 0.2, 4.);
394 PMD->SetPadSize(0.8, 1.0, 1.0, 1.5);
395
b9d0a01d 396 }
e98b7803 397
398 if (iEMCAL && !iRICH)
b9d0a01d 399 {
e98b7803 400 cout << "\t\t+ EMCAL (no RICH)..." << endl;
401 //=================== EMCAL parameters ============================
402 AliEMCAL *EMCAL = new AliEMCALv1("EMCAL", "EMCALArch1a");
b9d0a01d 403 }
e98b7803 404
405 if (iSTART)
b9d0a01d 406 {
e98b7803 407 cout << "\t\t+ START..." << endl;
408 //=================== START parameters ============================
409 AliSTART *START = new AliSTARTv1("START", "START Detector");
b9d0a01d 410 }
cdb67f97 411 if (iVZERO)
412 {
413 cout << "\t\t+ VZERO..." << endl;
414 //=================== CRT parameters ============================
415 AliVZERO *VZERO = new AliVZEROv2("VZERO", "normal VZERO");
416 }
b9d0a01d 417}
418
419Float_t EtaToTheta(Float_t arg){
420 return (180./TMath::Pi())*2.*atan(exp(-arg));
421}