]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - TFluka/macro/FlukaConfig.C
Fix in material cards creation for duplicated names. (A. Gheata)
[u/mrichter/AliRoot.git] / TFluka / macro / FlukaConfig.C
... / ...
CommitLineData
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
11
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();
17
18 cout << "\t* Loading Flugg..." << endl;
19 gSystem->Load("libFlugg");
20 } else {
21 cout << "=== RUNNING TFluka with TGeo ===\n";
22 gSystem->Load("libGeom");
23 }
24 cout << "\t* Loading TFluka..." << endl;
25 gSystem->Load("libTFluka");
26
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;
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);
45 }
46
47
48 TFluka *fluka = (TFluka *) gMC;
49 fluka->SetCoreInputFileName("corealice.inp");
50 fluka->SetInputFileName("alice.inp");
51 //
52 // Set External decayer
53 TVirtualMCDecayer *decayer = new AliDecayerPythia();
54 decayer->SetForceDecay(kAll);
55 decayer->Init();
56 gMC->SetExternalDecayer(decayer);
57 //
58 //
59 // Physics process control
60 gMC ->SetProcess("DCAY",1);
61 gMC ->SetProcess("PAIR",0);
62 gMC ->SetProcess("COMP",0);
63 gMC ->SetProcess("PHOT",0);
64 gMC ->SetProcess("PFIS",0);
65 gMC ->SetProcess("DRAY",0);
66 gMC ->SetProcess("ANNI",0);
67 gMC ->SetProcess("BREM",0);
68 gMC ->SetProcess("MUNU",1);
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)
76 Float_t cut = 1.e-1; // 100 MeV cut by default
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
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"))
97 int nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
98 else
99 int nParticles = 10;
100
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.
109 Float_t thmin = EtaToTheta( 0.1); // theta min. <---> eta max
110 Float_t thmax = EtaToTheta(-0.1); // theta max. <---> eta min
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 //
119
120 gAlice->SetField(-999, 2); //Specify maximum magnetic field in Tesla (neg. ==> default field)
121 gAlice->SetDebug(10);
122
123 Int_t iABSO = 0; //1
124 Int_t iCRT = 0; //Not good ?
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
134 Int_t iPMD = 0; //Not good (too many regions)
135 Int_t iRICH = 1; //1. Not good (no tracking with FRAME)
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)
139 Int_t iTPC = 1;
140 Int_t iTRD = 0; //1. Not good (no tracking) (Crash alone with FRAME)
141 Int_t iZDC = 0; //1. Needs SHIL and others
142 Int_t iEMCAL = 0; //Not good (Crash)
143 Int_t iVZERO = 0;
144
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)
152 {
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");
158 }
159
160
161 if (iABSO)
162 {
163 //=================== ABSO parameters ============================
164 cout << "\t\t+ ABSO..." << endl;
165 AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
166 }
167
168 if (iDIPO)
169 {
170 //=================== DIPO parameters ============================
171 cout << "\t\t+ DIPO..." << endl;
172 AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
173 }
174
175 if (iHALL)
176 {
177 //=================== HALL parameters ============================
178 cout << "\t\t+ HALL..." << endl;
179 AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
180 }
181
182
183 if (iFRAME)
184 {
185 //=================== FRAME parameters ============================
186
187 cout << "\t\t+ FRAME..." << endl;
188 AliFRAME *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
189
190 }
191
192 if (iSHIL)
193 {
194 //=================== SHIL parameters ============================
195
196 cout << "\t\t+ SHIL..." << endl;
197 AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding");
198 }
199
200
201 if (iPIPE)
202 {
203 //=================== PIPE parameters ============================
204
205 cout << "\t\t+ PIPE..." << endl;
206 AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
207 }
208
209 if(iITS) {
210 cout << "\t\t+ ITS..." << endl;
211
212 //=================== ITS parameters ============================
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
278
279 if (iTPC)
280 {
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 //-----------------------------------------------------------------------------
297 //
298 // gROOT->LoadMacro("SetTPCParam.C");
299 // AliTPCParam *param = SetTPCParam();
300 AliTPC *TPC = new AliTPCv1("TPC", "Default");
301 // All sectors included
302 TPC->SetSecAL(-1);
303 TPC->SetSecAU(-1);
304 }
305
306 if (iTOF)
307 {
308 cout << "\t\t+ TOF..." << endl;
309 //=================== TOF parameters ============================
310 AliTOF *TOF = new AliTOFv2("TOF", "normal TOF");
311 }
312
313 if (iRICH)
314 {
315 cout << "\t\t+ RICH..." << endl;
316 //=================== RICH parameters ===========================
317 AliRICH *RICH = new AliRICHv1("RICH", "normal RICH");
318
319 }
320
321
322 if (iZDC)
323 {
324 cout << "\t\t+ ZDC..." << endl;
325 //=================== ZDC parameters ============================
326
327 AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
328 }
329
330 if (iCRT)
331 {
332 cout << "\t\t+ CRT..." << endl;
333 //=================== CRT parameters ============================
334
335 AliCRT *CRT = new AliCRTv0("CRT", "normal CRT");
336 }
337
338 if (iTRD)
339 {
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();
354 }
355
356 if (iFMD)
357 {
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)
369 {
370 cout << "\t\t+ MUON..." << endl;
371 //=================== MUON parameters ===========================
372
373 AliMUON *MUON = new AliMUONv1("MUON", "default");
374 }
375 //=================== PHOS parameters ===========================
376
377 if (iPHOS)
378 {
379 cout << "\t\t+ PHOS..." << endl;
380 AliPHOS *PHOS = new AliPHOSv1("PHOS", "GPS2");
381 }
382
383
384 if (iPMD)
385 {
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
396 }
397
398 if (iEMCAL && !iRICH)
399 {
400 cout << "\t\t+ EMCAL (no RICH)..." << endl;
401 //=================== EMCAL parameters ============================
402 AliEMCAL *EMCAL = new AliEMCALv1("EMCAL", "EMCALArch1a");
403 }
404
405 if (iSTART)
406 {
407 cout << "\t\t+ START..." << endl;
408 //=================== START parameters ============================
409 AliSTART *START = new AliSTARTv1("START", "START Detector");
410 }
411 if (iVZERO)
412 {
413 cout << "\t\t+ VZERO..." << endl;
414 //=================== CRT parameters ============================
415 AliVZERO *VZERO = new AliVZEROv2("VZERO", "normal VZERO");
416 }
417}
418
419Float_t EtaToTheta(Float_t arg){
420 return (180./TMath::Pi())*2.*atan(exp(-arg));
421}