bugfix for an issue with recent autoconf versions on Ubuntu 10
[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
1c9ead20 308 //VZERO C
309 AliGenFixed *gv0c=new AliGenFixed(1);
310 gv0c->SetPart(kPiPlus);
311 gv0c->SetMomentum(1.5);
312 gv0c->SetTheta(170);
313 gv0c->SetPhi(50);
314 gener->AddGenerator(gv0c,"Pi+ for V0C",1);
315
316 //VZERO A
317 AliGenFixed *gv0a=new AliGenFixed(1);
318 gv0a->SetPart(kPiMinus);
319 gv0a->SetMomentum(1.5);
320 gv0a->SetTheta(1.5);
321 gv0a->SetPhi(70);
322 gener->AddGenerator(gv0a,"Pi- for V0A",1);
323
3928b038 324 gener->Init();
325
326
327 //
328 // Activate this line if you want the vertex smearing to happen
329 // track by track
330 //
331 //gener->SetVertexSmear(perTrack);
332 // Field (L3 0.5 T)
4642ac4b 333 TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG));
3928b038 334
335 Int_t iABSO = 1;
336 Int_t iDIPO = 1;
337 Int_t iFMD = 1;
338 Int_t iFRAME = 1;
339 Int_t iHALL = 1;
340 Int_t iITS = 1;
341 Int_t iMAG = 1;
342 Int_t iMUON = 1;
343 Int_t iPHOS = 1;
344 Int_t iPIPE = 1;
345 Int_t iPMD = 1;
346 Int_t iHMPID = 1;
347 Int_t iSHIL = 1;
348 Int_t iT0 = 1;
349 Int_t iTOF = 1;
350 Int_t iTPC = 1;
351 Int_t iTRD = 1;
352 Int_t iZDC = 1;
353 Int_t iEMCAL = 1;
354 Int_t iACORDE = 0;
355 Int_t iVZERO = 1;
356 rl->CdGAFile();
357 //=================== Alice BODY parameters =============================
358 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
359
360 if (iMAG)
361 {
362 //=================== MAG parameters ============================
363 // --- Start with Magnet since detector layouts may be depending ---
364 // --- on the selected Magnet dimensions ---
365 AliMAG *MAG = new AliMAG("MAG", "Magnet");
366 }
367
368
369 if (iABSO)
370 {
371 //=================== ABSO parameters ============================
96fb3353 372 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
3928b038 373 }
374
375 if (iDIPO)
376 {
377 //=================== DIPO parameters ============================
378
96fb3353 379 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
3928b038 380 }
381
382 if (iHALL)
383 {
384 //=================== HALL parameters ============================
385
96fb3353 386 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
3928b038 387 }
388
389
390 if (iFRAME)
391 {
392 //=================== FRAME parameters ============================
393
394 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
bab433b3 395 FRAME->SetHoles(1);
3928b038 396 }
397
398 if (iSHIL)
399 {
400 //=================== SHIL parameters ============================
401
96fb3353 402 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
3928b038 403 }
404
405
406 if (iPIPE)
407 {
408 //=================== PIPE parameters ============================
409
96fb3353 410 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
3928b038 411 }
412
e89fa83b 413 if (iITS)
414 {
415 //=================== ITS parameters ============================
3928b038 416
99887042 417 AliITS *ITS = new AliITSv11Hybrid("ITS","ITS v11Hybrid");
3928b038 418 }
419
420 if (iTPC)
421 {
422 //============================ TPC parameters ===================
423 AliTPC *TPC = new AliTPCv2("TPC", "Default");
424 }
425
426
427 if (iTOF) {
428 //=================== TOF parameters ============================
0d7ef405 429 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
3928b038 430 }
431
432
433 if (iHMPID)
434 {
435 //=================== HMPID parameters ===========================
99887042 436 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
3928b038 437
438 }
439
440
441 if (iZDC)
442 {
443 //=================== ZDC parameters ============================
444
cb14d625 445 AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
3928b038 446 }
447
448 if (iTRD)
449 {
450 //=================== TRD parameters ============================
451
452 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
453 AliTRDgeometry *geoTRD = TRD->GetGeometry();
7da2a4e8 454 // Partial geometry: modules at 0,1,7,8,9,10,17
455 // starting at 3h in positive direction
456 geoTRD->SetSMstatus(2,0);
457 geoTRD->SetSMstatus(3,0);
458 geoTRD->SetSMstatus(4,0);
3928b038 459 geoTRD->SetSMstatus(5,0);
7da2a4e8 460 geoTRD->SetSMstatus(6,0);
461 geoTRD->SetSMstatus(11,0);
462 geoTRD->SetSMstatus(12,0);
3928b038 463 geoTRD->SetSMstatus(13,0);
7da2a4e8 464 geoTRD->SetSMstatus(14,0);
465 geoTRD->SetSMstatus(15,0);
3928b038 466 geoTRD->SetSMstatus(16,0);
3928b038 467 }
468
469 if (iFMD)
470 {
471 //=================== FMD parameters ============================
472 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
473 }
474
475 if (iMUON)
476 {
477 //=================== MUON parameters ===========================
478 // New MUONv1 version (geometry defined via builders)
479 AliMUON *MUON = new AliMUONv1("MUON","default");
480 }
481 //=================== PHOS parameters ===========================
482
483 if (iPHOS)
484 {
485 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
486 }
487
488
489 if (iPMD)
490 {
491 //=================== PMD parameters ============================
492 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
493 }
494
495 if (iT0)
496 {
497 //=================== T0 parameters ============================
498 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
499 }
500
501 if (iEMCAL)
502 {
503 //=================== EMCAL parameters ============================
8224b11d 504 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
3928b038 505 }
506
507 if (iACORDE)
508 {
509 //=================== ACORDE parameters ============================
f7882672 510 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
3928b038 511 }
512
513 if (iVZERO)
514 {
515 //=================== VZERO parameters ============================
516 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
517 }
518
519
520}
521
522Float_t EtaToTheta(Float_t arg){
523 return (180./TMath::Pi())*2.*atan(exp(-arg));
524}