Fixes for bug #52499: Field polarities inconsistiency
[u/mrichter/AliRoot.git] / PHOS / macros / Embed / Config.C
CommitLineData
9bb2665f 1#include <TPDGCode.h>
2
70895cc0 3static Int_t eventsPerRun = 100;
4enum PprGeo_t
5{
6 kHoles, kNoHoles
7};
8
9enum PprRad_t
10{
11 kGluonRadiation, kNoGluonRadiation
12};
13
70895cc0 14// This part for configuration
15static PprGeo_t sgeo = kNoHoles;
16static PprRad_t srad = kGluonRadiation;
f7a1cc68 17static AliMagF::BMap_t smag = AliMagF::k5kG;
70895cc0 18
19// Comment line
20static TString comment;
21
22// Functions
23Float_t EtaToTheta(Float_t arg);
24
25
26void Config()
27{
9bb2665f 28
70895cc0 29 cout << "==> Config.C..." << endl;
30
31 // Set Random Number seed
32 UInt_t at = (UInt_t) gSystem->Now() ;
33 UInt_t seed = ((gSystem->GetPid()*111)%at)*137 ;
34// gRandom->SetSeed(seed);
35 gRandom->SetSeed(12345);
36 printf("MySeed: %d\n",seed) ;
37 cout<<"Seed for random number generation= "<<gRandom->GetSeed()<<endl;
38
39
40
41 // libraries required by fluka21
42
43 Bool_t isFluka = kFALSE;
44 if (isFluka) {
45 gSystem->Load("libGeom");
46 cout << "\t* Loading TFluka..." << endl;
47 gSystem->Load("libTFluka");
48
49 cout << "\t* Instantiating TFluka..." << endl;
50 new TFluka("C++ Interface to Fluka", 0/*verbositylevel*/);
51 }
52 else {
53 cout << "\t* Loading Geant3..." << endl;
54 gSystem->Load("libgeant321");
55
56 cout << "\t* Instantiating Geant3TGeo..." << endl;
57 new TGeant3TGeo("C++ Interface to Geant3");
58 }
59
60 AliRunLoader* rl=0x0;
61
62 cout<<"Config.C: Creating Run Loader ..."<<endl;
63 rl = AliRunLoader::Open("galice.root",
64 AliConfig::GetDefaultEventFolderName(),
65 "recreate");
66 if (rl == 0x0)
67 {
68 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
69 return;
70 }
71 rl->SetCompressionLevel(2);
72 rl->SetNumberOfEventsPerFile(1000);
73 gAlice->SetRunLoader(rl);
74
75 //
76 // Set External decayer
77 AliDecayer *decayer = new AliDecayerPythia();
78
79 decayer->SetForceDecay(kAll);
80 decayer->Init();
81 gMC->SetExternalDecayer(decayer);
82
83 //
84 //
85 //
86 // Physics process control
87
88 gMC->SetProcess("DCAY",1);
89 gMC->SetProcess("PAIR",1);
90 gMC->SetProcess("COMP",1);
91 gMC->SetProcess("PHOT",1);
92 gMC->SetProcess("PFIS",0);
93 gMC->SetProcess("DRAY",0); //AZ 1);
94 gMC->SetProcess("ANNI",1);
95 gMC->SetProcess("BREM",1);
96 gMC->SetProcess("MUNU",1);
97 gMC->SetProcess("CKOV",1);
98 gMC->SetProcess("HADR",1);
99 gMC->SetProcess("LOSS",2);
100 gMC->SetProcess("MULS",1);
101 gMC->SetProcess("RAYL",1);
102
103 Float_t cut = 1.e-3; // 1MeV cut by default
104 Float_t tofmax = 1.e10;
105
106 gMC->SetCut("CUTGAM", cut);
107 gMC->SetCut("CUTELE", cut);
108 gMC->SetCut("CUTNEU", cut);
109 gMC->SetCut("CUTHAD", cut);
110 gMC->SetCut("CUTMUO", cut);
111 gMC->SetCut("BCUTE", cut);
112 gMC->SetCut("BCUTM", cut);
113 gMC->SetCut("DCUTE", cut);
114 gMC->SetCut("DCUTM", cut);
115 gMC->SetCut("PPCUTM", cut);
116 gMC->SetCut("TOFMAX", tofmax);
117
118 ((AliMC*)gMC)->SetTransPar("./galice.cuts") ;
119 //
120 //=======================================================================
121 // ************* STEERING parameters FOR ALICE SIMULATION **************
122 // --- Specify event type to be tracked through the ALICE setup
123 // --- All positions are in cm, angles in degrees, and P and E in GeV
124
125 AliGenBox *gener = new AliGenBox(5);
126 gener->SetMomentumRange(0.5, 5.);
127 gener->SetPhiRange(260., 280.);
128 gener->SetThetaRange(82.,98.);
9bb2665f 129 gener->SetPart(kGamma);
70895cc0 130
131 gener->SetOrigin(0, 0, 0); //vertex position
132 gener->SetSigma(0, 0, 0); //Sigma in (X,Y,Z) (cm) on IP position
133 gener->Init() ;
134
135 //
136 // Activate this line if you want the vertex smearing to happen
137 // track by track
138 //
139 // gener->SetVertexSmear(kPerEvent) ;
140
141
142
f7a1cc68 143 if (smag == AliMagF::k2kG) {
70895cc0 144 comment = comment.Append(" | L3 field 0.2 T");
f7a1cc68 145 } else if (smag == AliMagF::k5kG) {
70895cc0 146 comment = comment.Append(" | L3 field 0.5 T");
147 }
148
149
150 if (srad == kGluonRadiation)
151 {
152 comment = comment.Append(" | Gluon Radiation On");
153
154 } else {
155 comment = comment.Append(" | Gluon Radiation Off");
156 }
157
158 if (sgeo == kHoles)
159 {
160 comment = comment.Append(" | Holes for PHOS/RICH");
161
162 } else {
163 comment = comment.Append(" | No holes for PHOS/RICH");
164 }
165
166 printf("\n \n Comment: %s \n \n", comment.Data());
167
168
169// Field (L3 0.4 T)
70895cc0 170 //Zero magnetic field
99c7d495 171 AliMagF* field = new AliMagF("Maps","Maps", 2, 0., 0., 10., AliMagF::k5kGUniform);
172 // AliMagF* field = new AliMagF("Maps","Maps", 2, -1., -1., 10., smag);
f7a1cc68 173 TGeoGlobalMagField::Instance()->SetField(field);
174
70895cc0 175 rl->CdGAFile();
70895cc0 176
177 Int_t iABSO = 0;
178 Int_t iCRT = 0;
179 Int_t iDIPO = 0;
180 Int_t iFMD = 0;
181 Int_t iFRAME = 0;
182 Int_t iHALL = 0;
183 Int_t iITS = 0;
184 Int_t iMAG = 0;
185 Int_t iMUON = 0;
186 Int_t iPHOS = 1;
187 Int_t iPIPE = 0;
188 Int_t iPMD = 0;
189 Int_t iRICH = 0;
190 Int_t iSHIL = 0;
191 Int_t iSTART = 0;
192 Int_t iTOF = 0;
193 Int_t iTPC = 0;
194 Int_t iTRD = 0;
195 Int_t iZDC = 0;
196 Int_t iEMCAL = 0;
197 Int_t iVZERO = 0;
198
199 cout << "\t* Creating the detectors ..." << endl;
200 //=================== Alice BODY parameters =============================
201 //=================== Alice BODY parameters =============================
202 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
203
204
205 if (iMAG)
206 {
207 //=================== MAG parameters ============================
208 // --- Start with Magnet since detector layouts may be depending ---
209 // --- on the selected Magnet dimensions ---
210 AliMAG *MAG = new AliMAG("MAG", "Magnet");
211 }
212
213
214 if (iABSO)
215 {
216 //=================== ABSO parameters ============================
217 AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
218 }
219
220 if (iDIPO)
221 {
222 //=================== DIPO parameters ============================
223
224 AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
225 }
226
227 if (iHALL)
228 {
229 //=================== HALL parameters ============================
230
231 AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
232 }
233
234
235 if (iFRAME)
236 {
237 //=================== FRAME parameters ============================
238
239 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
240 if (sgeo == kHoles) {
241 FRAME->SetHoles(1);
242 } else {
243 FRAME->SetHoles(0);
244 }
245 }
246
247 if (iSHIL)
248 {
249 //=================== SHIL parameters ============================
250
251 AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2");
252 }
253
254
255 if (iPIPE)
256 {
257 //=================== PIPE parameters ============================
258
259 AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
260 }
261
262 if(iITS) {
263
264 //=================== ITS parameters ============================
265 //
266 // As the innermost detector in ALICE, the Inner Tracking System "impacts" on
267 // almost all other detectors. This involves the fact that the ITS geometry
268 // still has several options to be followed in parallel in order to determine
269 // the best set-up which minimizes the induced background. All the geometries
270 // available to date are described in the following. Read carefully the comments
271 // and use the default version (the only one uncommented) unless you are making
272 // comparisons and you know what you are doing. In this case just uncomment the
273 // ITS geometry you want to use and run Aliroot.
274 //
275 // Detailed geometries:
276 //
277 //
278 //AliITS *ITS = new AliITSv5symm("ITS","Updated ITS TDR detailed version with symmetric services");
279 //
280 //AliITS *ITS = new AliITSv5asymm("ITS","Updates ITS TDR detailed version with asymmetric services");
281 //
282 AliITSvPPRasymmFMD *ITS = new AliITSvPPRasymmFMD("ITS","New ITS PPR detailed version with asymmetric services");
283 ITS->SetMinorVersion(2); // don't touch this parameter if you're not an ITS developer
284 ITS->SetReadDet(kTRUE); // don't touch this parameter if you're not an ITS developer
285 // ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det"); // don't touch this parameter if you're not an ITS developer
286 ITS->SetThicknessDet1(200.); // detector thickness on layer 1 must be in the range [100,300]
287 ITS->SetThicknessDet2(200.); // detector thickness on layer 2 must be in the range [100,300]
288 ITS->SetThicknessChip1(200.); // chip thickness on layer 1 must be in the range [150,300]
289 ITS->SetThicknessChip2(200.); // chip thickness on layer 2 must be in the range [150,300]
290 ITS->SetRails(0); // 1 --> rails in ; 0 --> rails out
291 ITS->SetCoolingFluid(1); // 1 --> water ; 0 --> freon
292
293 // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful
294 // for reconstruction !):
295 //
296 //
297 //AliITSvPPRcoarseasymm *ITS = new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version with asymmetric services");
298 //ITS->SetRails(0); // 1 --> rails in ; 0 --> rails out
299 //ITS->SetSupportMaterial(0); // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
300 //
301 //AliITS *ITS = new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version with symmetric services");
302 //ITS->SetRails(0); // 1 --> rails in ; 0 --> rails out
303 //ITS->SetSupportMaterial(0); // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
304 //
305 //
306 //
307 // Geant3 <-> EUCLID conversion
308 // ============================
309 //
310 // SetEUCLID is a flag to output (=1) or not to output (=0) both geometry and
311 // media to two ASCII files (called by default ITSgeometry.euc and
312 // ITSgeometry.tme) in a format understandable to the CAD system EUCLID.
313 // The default (=0) means that you dont want to use this facility.
314 //
315 ITS->SetEUCLID(0);
316 }
317
318 if (iTPC)
319 {
320 //============================ TPC parameters ================================
321// AliTPC *TPC = new AliTPCv0("TPC", "Default");
322 AliTPC *TPC = new AliTPCv2("TPC", "Default");
323 }
324
325
326 if (iTOF) {
327 //=================== TOF parameters ============================
328 AliTOF *TOF = new AliTOFv4T0("TOF", "normal TOF");
329 }
330
331
332 if (iRICH)
333 {
334 //=================== RICH parameters ===========================
335 AliRICH *RICH = new AliRICHv1("RICH", "normal RICH");
336
337 }
338
339
340 if (iZDC)
341 {
342 //=================== ZDC parameters ============================
343
344 AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
345 }
346
347 if (iTRD)
348 {
349 //=================== TRD parameters ============================
350
351 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
352
353 // Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 90% Xe + 10% CO2)
354 TRD->SetGasMix(1);
355 if (sgeo == kHoles) {
356 // With hole in front of PHOS
357 TRD->SetPHOShole();
358 // With hole in front of RICH
359 TRD->SetRICHhole();
360 }
361 // Switch on TR
362 AliTRDsim *TRDsim = TRD->CreateTR();
363 }
364
365 if (iFMD)
366 {
367 //=================== FMD parameters ============================
368 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
369 }
370
371 if (iMUON)
372 {
373 //=================== MUON parameters ===========================
374
375 AliMUON *MUON = new AliMUONv1("MUON", "default");
376 }
377 //=================== PHOS parameters ===========================
378
379 if (iPHOS)
380 {
381 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
382// AliPHOS *PHOS = new AliPHOSv1("PHOS", "noCPV");
383 }
384
385
386 if (iPMD)
387 {
388 //=================== PMD parameters ============================
389 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
390 }
391
392 if (iSTART)
393 {
394 //=================== START parameters ============================
395 AliSTART *START = new AliSTARTv1("START", "START Detector");
396 }
397
398 if (iEMCAL)
399 {
400 //=================== EMCAL parameters ============================
8224b11d 401 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
70895cc0 402 }
403
404 if (iCRT)
405 {
406 //=================== CRT parameters ============================
407 AliCRT *CRT = new AliCRTv0("CRT", "normal ACORDE");
408 }
409
410 if (iVZERO)
411 {
412 //=================== CRT parameters ============================
413 AliVZERO *VZERO = new AliVZEROv3("VZERO", "normal VZERO");
414 }
415
416
417}
418
419Float_t EtaToTheta(Float_t arg){
420 return (180./TMath::Pi())*2.*atan(exp(-arg));
421}
422