Incrementing class versions
[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 {
26ca4b4a 274 //============================ TPC parameters ===================
1fccbbe0 275 AliTPC *TPC = new AliTPCv2("TPC", "Default");
1fccbbe0 276 }
277
278 if (iTOF)
279 {
1fccbbe0 280 //=================== TOF parameters ============================
2253ef47 281 AliTOF *TOF = new AliTOFv4T0("TOF", "normal TOF");
1fccbbe0 282 }
283
284 if (iRICH)
285 {
286 //=================== RICH parameters ===========================
67d736ee 287 AliRICH *RICH = new AliRICHv1("RICH", "normal RICH");
1fccbbe0 288 }
289
290
291 if (iZDC)
292 {
293 //=================== ZDC parameters ============================
294
295 AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
296 }
297
298 if (iTRD)
299 {
300 //=================== TRD parameters ============================
301
302 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
303
304 // Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 90% Xe + 10% CO2)
305 TRD->SetGasMix(1);
306 if (geo == kHoles) {
307 // With hole in front of PHOS
308 TRD->SetPHOShole();
309 // With hole in front of RICH
310 TRD->SetRICHhole();
311 }
312 // Switch on TR
313 AliTRDsim *TRDsim = TRD->CreateTR();
314 }
315
316 if (iFMD)
317 {
318 //=================== FMD parameters ============================
319
320 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
913c1adf 321 }
1fccbbe0 322
323 if (iMUON)
324 {
325 //=================== MUON parameters ===========================
326
327 AliMUON *MUON = new AliMUONv1("MUON", "default");
d13ed8f3 328 MUON->AddGeometryBuilder(new AliMUONSt1GeometryBuilder(MUON));
329 MUON->AddGeometryBuilder(new AliMUONSt2GeometryBuilder(MUON));
330 MUON->AddGeometryBuilder(new AliMUONSlatGeometryBuilder(MUON));
331 MUON->AddGeometryBuilder(new AliMUONTriggerGeometryBuilder(MUON));
1fccbbe0 332 }
333 //=================== PHOS parameters ===========================
334
335 if (iPHOS)
336 {
9cc36300 337 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
1fccbbe0 338 }
339
340
341 if (iPMD)
342 {
343 //=================== PMD parameters ============================
344 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
345 }
346
347 if (iSTART)
348 {
349 //=================== START parameters ============================
350 AliSTART *START = new AliSTARTv1("START", "START Detector");
351 }
352
353 if (iEMCAL)
354 {
355 //=================== EMCAL parameters ============================
4920e63e 356 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH");
1fccbbe0 357 }
358
359 if (iCRT)
360 {
361 //=================== CRT parameters ============================
362
363 AliCRT *CRT = new AliCRTv0("CRT", "normal ACORDE");
364 }
365
366 if (iVZERO)
367 {
368 //=================== CRT parameters ============================
b50ba418 369 AliVZERO *VZERO = new AliVZEROv3("VZERO", "normal VZERO");
1fccbbe0 370 }
371
372 } // end (!isSetInteractively)
373 else {
374
375 if (geo == kHoles)
376 AliRunConfiguration::SwitchHoles(kTRUE);
377 else
378 AliRunConfiguration::SwitchHoles(kFALSE);
379 }
67d736ee 380
381 cout << "End of g4ConfigCommon.C" << endl;
1fccbbe0 382}
383
384Float_t EtaToTheta(Float_t arg){
385 return (180./TMath::Pi())*2.*atan(exp(-arg));
386}