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