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