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