]> git.uio.no Git - u/mrichter/AliRoot.git/blame - test/gun/Config.C
Fixes for bug #52499: Field polarities inconsistiency
[u/mrichter/AliRoot.git] / test / gun / Config.C
CommitLineData
3928b038 1// One can use the configuration macro in compiled mode by
2// root [0] gSystem->Load("libgeant321");
3// root [0] gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include\
4// -I$ALICE_ROOT -I$ALICE/geant3/TGeant3");
5// root [0] .x grun.C(1,"Config.C++")
6
7#if !defined(__CINT__) || defined(__MAKECINT__)
8#include <Riostream.h>
9bb2665f 9#include <TPDGCode.h>
3928b038 10#include <TRandom.h>
11#include <TSystem.h>
12#include <TVirtualMC.h>
13#include <TGeant3TGeo.h>
14#include "STEER/AliRunLoader.h"
15#include "STEER/AliRun.h"
16#include "STEER/AliConfig.h"
17#include "PYTHIA6/AliDecayerPythia.h"
18#include "EVGEN/AliGenCocktail.h"
19#include "EVGEN/AliGenHIJINGpara.h"
20#include "EVGEN/AliGenFixed.h"
21#include "EVGEN/AliGenBox.h"
f7a1cc68 22#include "STEER/AliMagF.h"
3928b038 23#include "STRUCT/AliBODY.h"
24#include "STRUCT/AliMAG.h"
96fb3353 25#include "STRUCT/AliABSOv3.h"
26#include "STRUCT/AliDIPOv3.h"
27#include "STRUCT/AliHALLv3.h"
3928b038 28#include "STRUCT/AliFRAMEv2.h"
96fb3353 29#include "STRUCT/AliSHILv3.h"
30#include "STRUCT/AliPIPEv3.h"
99887042 31#include "ITS/AliITSv11Hybrid.h"
3928b038 32#include "TPC/AliTPCv2.h"
0d7ef405 33#include "TOF/AliTOFv6T0.h"
99887042 34#include "HMPID/AliHMPIDv3.h"
cb14d625 35#include "ZDC/AliZDCv3.h"
3928b038 36#include "TRD/AliTRDv1.h"
37#include "TRD/AliTRDgeometry.h"
38#include "FMD/AliFMDv1.h"
39#include "MUON/AliMUONv1.h"
40#include "PHOS/AliPHOSv1.h"
41#include "PMD/AliPMDv1.h"
42#include "T0/AliT0v1.h"
43#include "EMCAL/AliEMCALv2.h"
f7882672 44#include "ACORDE/AliACORDEv1.h"
3928b038 45#include "VZERO/AliVZEROv7.h"
46#endif
47
48enum PprTrigConf_t
49{
50 kDefaultPPTrig, kDefaultPbPbTrig
51};
52
53const char * pprTrigConfName[] = {
54 "p-p","Pb-Pb"
55};
56
57Float_t EtaToTheta(Float_t arg);
58
59static PprTrigConf_t strig = kDefaultPPTrig;// default PP trigger configuration
60
61void Config()
62{
63 // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
64 // Theta range given through pseudorapidity limits 22/6/2001
65
66 // Set Random Number seed
67 gRandom->SetSeed(123456); // Set 0 to use the currecnt time
68
69
70 // libraries required by geant321
71#if defined(__CINT__)
f1e07bdc 72 gSystem->Load("liblhapdf");
73 gSystem->Load("libEGPythia6");
74 gSystem->Load("libpythia6");
75 gSystem->Load("libAliPythia6");
3928b038 76 gSystem->Load("libgeant321");
77#endif
78
79 new TGeant3TGeo("C++ Interface to Geant3");
80
81 AliRunLoader* rl=0x0;
82
83
84 rl = AliRunLoader::Open("galice.root",
85 AliConfig::GetDefaultEventFolderName(),
86 "recreate");
87 if (rl == 0x0)
88 {
89 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
90 return;
91 }
92 rl->SetCompressionLevel(2);
93 rl->SetNumberOfEventsPerFile(3);
94 gAlice->SetRunLoader(rl);
95
96 // Set the trigger configuration
97 gAlice->SetTriggerDescriptor(pprTrigConfName[strig]);
98 cout<<"Trigger configuration is set to "<<pprTrigConfName[strig]<<endl;
99
100 //
101 // Set External decayer
102 TVirtualMCDecayer *decayer = new AliDecayerPythia();
103
104 decayer->SetForceDecay(kAll);
105 decayer->Init();
106 gMC->SetExternalDecayer(decayer);
107 //=======================================================================
108 // ************* STEERING parameters FOR ALICE SIMULATION **************
109 // --- Specify event type to be tracked through the ALICE setup
110 // --- All positions are in cm, angles in degrees, and P and E in GeV
111
112
113 gMC->SetProcess("DCAY",1);
114 gMC->SetProcess("PAIR",1);
115 gMC->SetProcess("COMP",1);
116 gMC->SetProcess("PHOT",1);
117 gMC->SetProcess("PFIS",0);
118 gMC->SetProcess("DRAY",0);
119 gMC->SetProcess("ANNI",1);
120 gMC->SetProcess("BREM",1);
121 gMC->SetProcess("MUNU",1);
122 gMC->SetProcess("CKOV",1);
123 gMC->SetProcess("HADR",1);
124 gMC->SetProcess("LOSS",2);
125 gMC->SetProcess("MULS",1);
126 gMC->SetProcess("RAYL",1);
127
128 Float_t cut = 1.e-3; // 1MeV cut by default
129 Float_t tofmax = 1.e10;
130
131 gMC->SetCut("CUTGAM", cut);
132 gMC->SetCut("CUTELE", cut);
133 gMC->SetCut("CUTNEU", cut);
134 gMC->SetCut("CUTHAD", cut);
135 gMC->SetCut("CUTMUO", cut);
136 gMC->SetCut("BCUTE", cut);
137 gMC->SetCut("BCUTM", cut);
138 gMC->SetCut("DCUTE", cut);
139 gMC->SetCut("DCUTM", cut);
140 gMC->SetCut("PPCUTM", cut);
141 gMC->SetCut("TOFMAX", tofmax);
142
143 // Special generation for Valgrind tests
144 // Each detector is fired by few particles selected
145 // to cover specific cases
146
147
148 // The cocktail iitself
149
150 AliGenCocktail *gener = new AliGenCocktail();
151 gener->SetPhiRange(0, 360);
152 // Set pseudorapidity range from -8 to 8.
153 Float_t thmin = EtaToTheta(8); // theta min. <---> eta max
154 Float_t thmax = EtaToTheta(-8); // theta max. <---> eta min
155 gener->SetThetaRange(thmin,thmax);
156 gener->SetOrigin(0, 0, 0); //vertex position
157 gener->SetSigma(0, 0, 0); //Sigma in (X,Y,Z) (cm) on IP position
158
159
160 // Particle guns for the barrel part (taken from RichConfig)
161
162 AliGenFixed *pG1=new AliGenFixed(1);
9bb2665f 163 pG1->SetPart(kProton);
3928b038 164 pG1->SetMomentum(2.5);
165 pG1->SetTheta(109.5-3);
166 pG1->SetPhi(10);
167 gener->AddGenerator(pG1,"g1",1);
168
169 AliGenFixed *pG2=new AliGenFixed(1);
9bb2665f 170 pG2->SetPart(kPiPlus);
3928b038 171 pG2->SetMomentum(1.0);
172 pG2->SetTheta( 90.0-3);
173 pG2->SetPhi(10);
174 gener->AddGenerator(pG2,"g2",1);
175
176 AliGenFixed *pG3=new AliGenFixed(1);
9bb2665f 177 pG3->SetPart(kPiMinus);
3928b038 178 pG3->SetMomentum(1.5);
179 pG3->SetTheta(109.5-3);
180 pG3->SetPhi(30);
181 gener->AddGenerator(pG3,"g3",1);
182
183 AliGenFixed *pG4=new AliGenFixed(1);
9bb2665f 184 pG4->SetPart(kKPlus);
3928b038 185 pG4->SetMomentum(0.7);
186 pG4->SetTheta( 90.0-3);
187 pG4->SetPhi(30);
188 gener->AddGenerator(pG4,"g4",1);
189
190 AliGenFixed *pG5=new AliGenFixed(1);
9bb2665f 191 pG5->SetPart(kKMinus);
3928b038 192 pG5->SetMomentum(1.0);
193 pG5->SetTheta( 70.0-3);
194 pG5->SetPhi(30);
195 gener->AddGenerator(pG5,"g5",1);
196
197 AliGenFixed *pG6=new AliGenFixed(1);
9bb2665f 198 pG6->SetPart(kProtonBar);
3928b038 199 pG6->SetMomentum(2.5);
200 pG6->SetTheta( 90.0-3);
201 pG6->SetPhi(50);
202 gener->AddGenerator(pG6,"g6",1);
203
204 AliGenFixed *pG7=new AliGenFixed(1);
9bb2665f 205 pG7->SetPart(kPiMinus);
3928b038 206 pG7->SetMomentum(0.7);
207 pG7->SetTheta( 70.0-3);
208 pG7->SetPhi(50);
209 gener->AddGenerator(pG7,"g7",1);
210
211 // Electrons for TRD
212
213 AliGenFixed *pG8=new AliGenFixed(1);
9bb2665f 214 pG8->SetPart(kElectron);
3928b038 215 pG8->SetMomentum(1.2);
216 pG8->SetTheta( 95.0);
217 pG8->SetPhi(190);
218 gener->AddGenerator(pG8,"g8",1);
219
220 AliGenFixed *pG9=new AliGenFixed(1);
9bb2665f 221 pG9->SetPart(kPositron);
3928b038 222 pG9->SetMomentum(1.2);
223 pG9->SetTheta( 85.0);
224 pG9->SetPhi(190);
225 gener->AddGenerator(pG9,"g9",1);
226
227 // PHOS
228
229 AliGenBox *gphos = new AliGenBox(1);
230 gphos->SetMomentumRange(10,11.);
231 gphos->SetPhiRange(270.5,270.7);
232 gphos->SetThetaRange(90.5,90.7);
9bb2665f 233 gphos->SetPart(kGamma);
3928b038 234 gener->AddGenerator(gphos,"GENBOX GAMMA for PHOS",1);
235
236 // EMCAL
237
238 AliGenBox *gemcal = new AliGenBox(1);
239 gemcal->SetMomentumRange(10,11.);
240 gemcal->SetPhiRange(90.5,199.5);
241 gemcal->SetThetaRange(90.5,90.7);
9bb2665f 242 gemcal->SetPart(kGamma);
3928b038 243 gener->AddGenerator(gemcal,"GENBOX GAMMA for EMCAL",1);
244
245 // MUON
246 AliGenBox * gmuon1 = new AliGenBox(1);
247 gmuon1->SetMomentumRange(20.,20.1);
248 gmuon1->SetPhiRange(0., 360.);
249 gmuon1->SetThetaRange(171.000,178.001);
9bb2665f 250 gmuon1->SetPart(kMuonMinus); // Muons
3928b038 251 gener->AddGenerator(gmuon1,"GENBOX MUON1",1);
252
253 AliGenBox * gmuon2 = new AliGenBox(1);
254 gmuon2->SetMomentumRange(20.,20.1);
255 gmuon2->SetPhiRange(0., 360.);
256 gmuon2->SetThetaRange(171.000,178.001);
9bb2665f 257 gmuon2->SetPart(kMuonPlus); // Muons
3928b038 258 gener->AddGenerator(gmuon2,"GENBOX MUON1",1);
259
260 //TOF
261 AliGenFixed *gtof=new AliGenFixed(1);
9bb2665f 262 gtof->SetPart(kProton);
3928b038 263 gtof->SetMomentum(2.5);
264 gtof->SetTheta(95);
6b61de21 265 gtof->SetPhi(340);
3928b038 266 gener->AddGenerator(gtof,"Proton for TOF",1);
6b61de21 267
268 //FMD1
269 AliGenFixed *gfmd1=new AliGenFixed(1);
270 gfmd1->SetPart(kGamma);
271 gfmd1->SetMomentum(25);
272 gfmd1->SetTheta(1.8);
273 gfmd1->SetPhi(10);
274 gener->AddGenerator(gfmd1,"Gamma for FMD1",1);
275
276 //FMD2i
277 AliGenFixed *gfmd2i=new AliGenFixed(1);
278 gfmd2i->SetPart(kPiPlus);
279 gfmd2i->SetMomentum(1.5);
280 gfmd2i->SetTheta(7.3);
281 gfmd2i->SetPhi(20);
282 gener->AddGenerator(gfmd2i,"Pi+ for FMD2i",1);
283
284 //FMD2o
285 AliGenFixed *gfmd2o=new AliGenFixed(1);
286 gfmd2o->SetPart(kPiMinus);
287 gfmd2o->SetMomentum(1.5);
288 gfmd2o->SetTheta(16.1);
289 gfmd2o->SetPhi(30);
290 gener->AddGenerator(gfmd2o,"Pi- for FMD2o",1);
291
292 //FMD3o
293 AliGenFixed *gfmd3o=new AliGenFixed(1);
294 gfmd3o->SetPart(kPiPlus);
295 gfmd3o->SetMomentum(1.5);
296 gfmd3o->SetTheta(163.9);
297 gfmd3o->SetPhi(40);
298 gener->AddGenerator(gfmd3o,"Pi+ for FMD3o",1);
299
300 //FMD3i
301 AliGenFixed *gfmd3i=new AliGenFixed(1);
302 gfmd3i->SetPart(kPiMinus);
303 gfmd3i->SetMomentum(1.5);
304 gfmd3i->SetTheta(170.5);
305 gfmd3i->SetPhi(50);
306 gener->AddGenerator(gfmd3i,"Pi- for FMD3i",1);
3928b038 307
308 gener->Init();
309
310
311 //
312 // Activate this line if you want the vertex smearing to happen
313 // track by track
314 //
315 //gener->SetVertexSmear(perTrack);
316 // Field (L3 0.5 T)
99c7d495 317 TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 2, -1., -1., 10., AliMagF::k5kG));
3928b038 318
319 Int_t iABSO = 1;
320 Int_t iDIPO = 1;
321 Int_t iFMD = 1;
322 Int_t iFRAME = 1;
323 Int_t iHALL = 1;
324 Int_t iITS = 1;
325 Int_t iMAG = 1;
326 Int_t iMUON = 1;
327 Int_t iPHOS = 1;
328 Int_t iPIPE = 1;
329 Int_t iPMD = 1;
330 Int_t iHMPID = 1;
331 Int_t iSHIL = 1;
332 Int_t iT0 = 1;
333 Int_t iTOF = 1;
334 Int_t iTPC = 1;
335 Int_t iTRD = 1;
336 Int_t iZDC = 1;
337 Int_t iEMCAL = 1;
338 Int_t iACORDE = 0;
339 Int_t iVZERO = 1;
340 rl->CdGAFile();
341 //=================== Alice BODY parameters =============================
342 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
343
344 if (iMAG)
345 {
346 //=================== MAG parameters ============================
347 // --- Start with Magnet since detector layouts may be depending ---
348 // --- on the selected Magnet dimensions ---
349 AliMAG *MAG = new AliMAG("MAG", "Magnet");
350 }
351
352
353 if (iABSO)
354 {
355 //=================== ABSO parameters ============================
96fb3353 356 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
3928b038 357 }
358
359 if (iDIPO)
360 {
361 //=================== DIPO parameters ============================
362
96fb3353 363 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
3928b038 364 }
365
366 if (iHALL)
367 {
368 //=================== HALL parameters ============================
369
96fb3353 370 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
3928b038 371 }
372
373
374 if (iFRAME)
375 {
376 //=================== FRAME parameters ============================
377
378 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
bab433b3 379 FRAME->SetHoles(1);
3928b038 380 }
381
382 if (iSHIL)
383 {
384 //=================== SHIL parameters ============================
385
96fb3353 386 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
3928b038 387 }
388
389
390 if (iPIPE)
391 {
392 //=================== PIPE parameters ============================
393
96fb3353 394 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
3928b038 395 }
396
e89fa83b 397 if (iITS)
398 {
399 //=================== ITS parameters ============================
3928b038 400
99887042 401 AliITS *ITS = new AliITSv11Hybrid("ITS","ITS v11Hybrid");
3928b038 402 }
403
404 if (iTPC)
405 {
406 //============================ TPC parameters ===================
407 AliTPC *TPC = new AliTPCv2("TPC", "Default");
408 }
409
410
411 if (iTOF) {
412 //=================== TOF parameters ============================
0d7ef405 413 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
3928b038 414 }
415
416
417 if (iHMPID)
418 {
419 //=================== HMPID parameters ===========================
99887042 420 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
3928b038 421
422 }
423
424
425 if (iZDC)
426 {
427 //=================== ZDC parameters ============================
428
cb14d625 429 AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
3928b038 430 }
431
432 if (iTRD)
433 {
434 //=================== TRD parameters ============================
435
436 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
437 AliTRDgeometry *geoTRD = TRD->GetGeometry();
438 // Partial geometry: modules at 2,3,4,6,11,12,14,15
439 // starting at 6h in positive direction
440 geoTRD->SetSMstatus(0,0);
441 geoTRD->SetSMstatus(1,0);
442 geoTRD->SetSMstatus(5,0);
443 geoTRD->SetSMstatus(7,0);
444 geoTRD->SetSMstatus(8,0);
445 geoTRD->SetSMstatus(9,0);
446 geoTRD->SetSMstatus(10,0);
447 geoTRD->SetSMstatus(13,0);
448 geoTRD->SetSMstatus(16,0);
449 geoTRD->SetSMstatus(17,0);
450 }
451
452 if (iFMD)
453 {
454 //=================== FMD parameters ============================
455 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
456 }
457
458 if (iMUON)
459 {
460 //=================== MUON parameters ===========================
461 // New MUONv1 version (geometry defined via builders)
462 AliMUON *MUON = new AliMUONv1("MUON","default");
463 }
464 //=================== PHOS parameters ===========================
465
466 if (iPHOS)
467 {
468 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
469 }
470
471
472 if (iPMD)
473 {
474 //=================== PMD parameters ============================
475 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
476 }
477
478 if (iT0)
479 {
480 //=================== T0 parameters ============================
481 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
482 }
483
484 if (iEMCAL)
485 {
486 //=================== EMCAL parameters ============================
8224b11d 487 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
3928b038 488 }
489
490 if (iACORDE)
491 {
492 //=================== ACORDE parameters ============================
f7882672 493 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
3928b038 494 }
495
496 if (iVZERO)
497 {
498 //=================== VZERO parameters ============================
499 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
500 }
501
502
503}
504
505Float_t EtaToTheta(Float_t arg){
506 return (180./TMath::Pi())*2.*atan(exp(-arg));
507}