Merging the VirtualMC branch to the main development branch (HEAD)
[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;
25 fluka->SetInputFileName("mu.inp");
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
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 {
78 int nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
79 } else
80 {
81 int nParticles = 50;
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);
99
100 gAlice->SetField(-999, 2); //Specify maximum magnetic field in Tesla (neg. ==> default field)
101
102 Int_t iABSO = 1;
103 Int_t iCRT = 1;
104 Int_t iDIPO = 1;
105 Int_t iFMD = 1;
106 Int_t iFRAME = 1;
107 Int_t iHALL = 1;
108 Int_t iITS = 1;
109 Int_t iMAG = 1;
110 Int_t iMUON = 1;
111 Int_t iPHOS = 1;
112 Int_t iPIPE = 1;
113 Int_t iPMD = 1;
114 Int_t iRICH = 1;
115 Int_t iSHIL = 1;
116 Int_t iSTART = 1;
117 Int_t iTOF = 1;
118 Int_t iTPC = 1;
119 Int_t iTRD = 1;
120 Int_t iZDC = 1;
121 Int_t iEMCAL = 0;
122
123 //=================== Alice BODY parameters =============================
124 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
125
126
127 if (iMAG)
128 {
129 //=================== MAG parameters ============================
130 // --- Start with Magnet since detector layouts may be depending ---
131 // --- on the selected Magnet dimensions ---
132 AliMAG *MAG = new AliMAG("MAG", "Magnet");
133 }
134
135
136 if (iABSO)
137 {
138 //=================== ABSO parameters ============================
139 AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
140 }
141
142 if (iDIPO)
143 {
144 //=================== DIPO parameters ============================
145
146 AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
147 }
148
149 if (iHALL)
150 {
151 //=================== HALL parameters ============================
152
153 AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
154 }
155
156
157 if (iFRAME)
158 {
159 //=================== FRAME parameters ============================
160
161 AliFRAME *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
162
163 }
164
165 if (iSHIL)
166 {
167 //=================== SHIL parameters ============================
168
169 AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding");
170 }
171
172
173 if (iPIPE)
174 {
175 //=================== PIPE parameters ============================
176
177 AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
178 }
179
180 if(iITS) {
181
182//=================== ITS parameters ============================
183 //
184 // As the innermost detector in ALICE, the Inner Tracking System "impacts" on
185 // almost all other detectors. This involves the fact that the ITS geometry
186 // still has several options to be followed in parallel in order to determine
187 // the best set-up which minimizes the induced background. All the geometries
188 // available to date are described in the following. Read carefully the comments
189 // and use the default version (the only one uncommented) unless you are making
190 // comparisons and you know what you are doing. In this case just uncomment the
191 // ITS geometry you want to use and run Aliroot.
192 //
193 // Detailed geometries:
194 //
195 //
196 //AliITS *ITS = new AliITSv5symm("ITS","Updated ITS TDR detailed version with symmetric services");
197 //
198 //AliITS *ITS = new AliITSv5asymm("ITS","Updates ITS TDR detailed version with asymmetric services");
199 //
200 AliITSvPPRasymm *ITS = new AliITSvPPRasymm("ITS","New ITS PPR detailed version with asymmetric services");
201 ITS->SetMinorVersion(2); // don't touch this parameter if you're not an ITS developer
202 ITS->SetReadDet(kFALSE); // don't touch this parameter if you're not an ITS developer
203 // ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det"); // don't touch this parameter if you're not an ITS developer
204 ITS->SetThicknessDet1(200.); // detector thickness on layer 1 must be in the range [100,300]
205 ITS->SetThicknessDet2(200.); // detector thickness on layer 2 must be in the range [100,300]
206 ITS->SetThicknessChip1(200.); // chip thickness on layer 1 must be in the range [150,300]
207 ITS->SetThicknessChip2(200.); // chip thickness on layer 2 must be in the range [150,300]
208 ITS->SetRails(1); // 1 --> rails in ; 0 --> rails out
209 ITS->SetCoolingFluid(1); // 1 --> water ; 0 --> freon
210 //
211 //AliITSvPPRsymm *ITS = new AliITSvPPRsymm("ITS","New ITS PPR detailed version with symmetric 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_vPPRsymm2.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 //
223 // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful
224 // for reconstruction !):
225 //
226 //
227 //AliITSvPPRcoarseasymm *ITS = new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version with asymmetric services");
228 //ITS->SetRails(1); // 1 --> rails in ; 0 --> rails out
229 //ITS->SetSupportMaterial(0); // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
230 //
231 //AliITS *ITS = new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version with symmetric services");
232 //ITS->SetRails(1); // 1 --> rails in ; 0 --> rails out
233 //ITS->SetSupportMaterial(0); // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
234 //
235 //
236 //
237 // Geant3 <-> EUCLID conversion
238 // ============================
239 //
240 // SetEUCLID is a flag to output (=1) or not to output (=0) both geometry and
241 // media to two ASCII files (called by default ITSgeometry.euc and
242 // ITSgeometry.tme) in a format understandable to the CAD system EUCLID.
243 // The default (=0) means that you dont want to use this facility.
244 //
245 ITS->SetEUCLID(0);
246 }
247
248
249 if (iTPC)
250 {
251 //============================ TPC parameters ================================
252 // --- This allows the user to specify sectors for the SLOW (TPC geometry 2)
253 // --- Simulator. SecAL (SecAU) <0 means that ALL lower (upper)
254 // --- sectors are specified, any value other than that requires at least one
255 // --- sector (lower or upper)to be specified!
256 // --- Reminder: sectors 1-24 are lower sectors (1-12 -> z>0, 13-24 -> z<0)
257 // --- sectors 25-72 are the upper ones (25-48 -> z>0, 49-72 -> z<0)
258 // --- SecLows - number of lower sectors specified (up to 6)
259 // --- SecUps - number of upper sectors specified (up to 12)
260 // --- Sens - sensitive strips for the Slow Simulator !!!
261 // --- This does NOT work if all S or L-sectors are specified, i.e.
262 // --- if SecAL or SecAU < 0
263 //
264 //
265 //-----------------------------------------------------------------------------
266
267 // gROOT->LoadMacro("SetTPCParam.C");
268 // AliTPCParam *param = SetTPCParam();
269 AliTPC *TPC = new AliTPCv2("TPC", "Default");
270
271 // All sectors included
272 TPC->SetSecAL(-1);
273 TPC->SetSecAU(-1);
274
275 }
276
277 if (iTOF)
278 {
279 //=================== TOF parameters ============================
280 AliTOF *TOF = new AliTOFv2("TOF", "normal TOF");
281 }
282
283 if (iRICH)
284 {
285 //=================== RICH parameters ===========================
286 AliRICH *RICH = new AliRICHv1("RICH", "normal RICH");
287
288 }
289
290
291 if (iZDC)
292 {
293 //=================== ZDC parameters ============================
294
295 AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
296 }
297
298 if (iCRT)
299 {
300 //=================== CRT parameters ============================
301
302 AliCRT *CRT = new AliCRTv0("CRT", "normal CRT");
303 }
304
305 if (iTRD)
306 {
307 //=================== TRD parameters ============================
308
309 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
310
311 // Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 90% Xe + 10% CO2)
312 TRD->SetGasMix(1);
313
314 // With hole in front of PHOS
315 TRD->SetPHOShole();
316 // With hole in front of RICH
317 TRD->SetRICHhole();
318 // Switch on TR
319 AliTRDsim *TRDsim = TRD->CreateTR();
320 }
321
322 if (iFMD)
323 {
324 //=================== FMD parameters ============================
325
326 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
327 FMD->SetRingsSi1(256);
328 FMD->SetRingsSi2(64);
329 FMD->SetSectorsSi1(20);
330 FMD->SetSectorsSi2(24);
331 }
332
333 if (iMUON)
334 {
335 //=================== MUON parameters ===========================
336
337 AliMUON *MUON = new AliMUONv1("MUON", "default");
338 }
339 //=================== PHOS parameters ===========================
340
341 if (iPHOS)
342 {
343 AliPHOS *PHOS = new AliPHOSv1("PHOS", "GPS2");
344 }
345
346
347 if (iPMD)
348 {
349 //=================== PMD parameters ============================
350
351 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
352
353 PMD->SetPAR(1., 1., 0.8, 0.02);
354 PMD->SetIN(6., 18., -580., 27., 27.);
355 PMD->SetGEO(0.0, 0.2, 4.);
356 PMD->SetPadSize(0.8, 1.0, 1.0, 1.5);
357
358 }
359
360 if (iEMCAL && !iRICH)
361 {
362 //=================== EMCAL parameters ============================
363 AliEMCAL *EMCAL = new AliEMCALv1("EMCAL", "EMCALArch1a");
364 }
365
366 if (iSTART)
367 {
368 //=================== START parameters ============================
369 AliSTART *START = new AliSTARTv1("START", "START Detector");
370 }
371
372
373 cout << "<== Config.C..." << endl;
374}
375
376Float_t EtaToTheta(Float_t arg){
377 return (180./TMath::Pi())*2.*atan(exp(-arg));
378}