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