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