]> git.uio.no Git - u/mrichter/AliRoot.git/blob - test/gun/Config.C
Final TOF version: 18 modules with holes for PHOS (Annalisa)
[u/mrichter/AliRoot.git] / test / gun / Config.C
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>
9 #include <TPDGCode.h>
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"
25 #include "STRUCT/AliABSOv3.h"
26 #include "STRUCT/AliDIPOv3.h"
27 #include "STRUCT/AliHALLv3.h"
28 #include "STRUCT/AliFRAMEv2.h"
29 #include "STRUCT/AliSHILv3.h"
30 #include "STRUCT/AliPIPEv3.h"
31 #include "ITS/AliITSv11Hybrid.h"
32 #include "TPC/AliTPCv2.h"
33 #include "TOF/AliTOFv6T0.h"
34 #include "HMPID/AliHMPIDv3.h"
35 #include "ZDC/AliZDCv3.h"
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
48 enum PprTrigConf_t
49 {
50     kDefaultPPTrig, kDefaultPbPbTrig
51 };
52
53 const char * pprTrigConfName[] = {
54     "p-p","Pb-Pb"
55 };
56
57 Float_t EtaToTheta(Float_t arg);
58
59 static PprTrigConf_t strig = kDefaultPPTrig;// default PP trigger configuration
60
61 void 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__)
72     gSystem->Load("liblhapdf");
73     gSystem->Load("libEGPythia6");
74     gSystem->Load("libpythia6");
75     gSystem->Load("libAliPythia6");
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);
163     pG1->SetPart(kProton);
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);
170     pG2->SetPart(kPiPlus);
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);
177     pG3->SetPart(kPiMinus);
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);
184     pG4->SetPart(kKPlus);
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);
191     pG5->SetPart(kKMinus);
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);
198     pG6->SetPart(kProtonBar);
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);
205     pG7->SetPart(kPiMinus);
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);
214     pG8->SetPart(kElectron);
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);
221     pG9->SetPart(kPositron);
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);
233     gphos->SetPart(kGamma);
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);
242     gemcal->SetPart(kGamma);
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);
250     gmuon1->SetPart(kMuonMinus);           // Muons
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);
257     gmuon2->SetPart(kMuonPlus);           // Muons
258     gener->AddGenerator(gmuon2,"GENBOX MUON1",1);
259
260     //TOF
261     AliGenFixed *gtof=new AliGenFixed(1);
262     gtof->SetPart(kProton);
263     gtof->SetMomentum(2.5);
264     gtof->SetTheta(95);
265     gtof->SetPhi(340);
266     gener->AddGenerator(gtof,"Proton for TOF",1);
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);
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)
317     AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., 2);
318     field->SetL3ConstField(1); //Using const. field in the barrel if 0
319     gAlice->SetField(field);    
320
321
322     Int_t   iABSO  =  1;
323     Int_t   iDIPO  =  1;
324     Int_t   iFMD   =  1;
325     Int_t   iFRAME =  1;
326     Int_t   iHALL  =  1;
327     Int_t   iITS   =  1;
328     Int_t   iMAG   =  1;
329     Int_t   iMUON  =  1;
330     Int_t   iPHOS  =  1;
331     Int_t   iPIPE  =  1;
332     Int_t   iPMD   =  1;
333     Int_t   iHMPID  =  1;
334     Int_t   iSHIL  =  1;
335     Int_t   iT0 =  1;
336     Int_t   iTOF   =  1;
337     Int_t   iTPC   =  1;
338     Int_t   iTRD   =  1;
339     Int_t   iZDC   =  1;
340     Int_t   iEMCAL =  1;
341     Int_t   iACORDE   =  0;
342     Int_t   iVZERO =  1;
343     rl->CdGAFile();
344     //=================== Alice BODY parameters =============================
345     AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
346
347     if (iMAG)
348     {
349         //=================== MAG parameters ============================
350         // --- Start with Magnet since detector layouts may be depending ---
351         // --- on the selected Magnet dimensions ---
352         AliMAG *MAG = new AliMAG("MAG", "Magnet");
353     }
354
355
356     if (iABSO)
357     {
358         //=================== ABSO parameters ============================
359         AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
360     }
361
362     if (iDIPO)
363     {
364         //=================== DIPO parameters ============================
365
366         AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
367     }
368
369     if (iHALL)
370     {
371         //=================== HALL parameters ============================
372
373         AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
374     }
375
376
377     if (iFRAME)
378     {
379         //=================== FRAME parameters ============================
380
381         AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
382         FRAME->SetHoles(1);
383     }
384
385     if (iSHIL)
386     {
387         //=================== SHIL parameters ============================
388
389         AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
390     }
391
392
393     if (iPIPE)
394     {
395         //=================== PIPE parameters ============================
396
397         AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
398     }
399  
400     if (iITS)
401     {
402         //=================== ITS parameters ============================
403
404         AliITS *ITS  = new AliITSv11Hybrid("ITS","ITS v11Hybrid");
405     }
406
407     if (iTPC)
408     {
409         //============================ TPC parameters ===================
410         AliTPC *TPC = new AliTPCv2("TPC", "Default");
411     }
412
413
414     if (iTOF) {
415         //=================== TOF parameters ============================
416         AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
417      }
418
419
420     if (iHMPID)
421     {
422         //=================== HMPID parameters ===========================
423         AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
424
425     }
426
427
428     if (iZDC)
429     {
430         //=================== ZDC parameters ============================
431
432         AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
433     }
434
435     if (iTRD)
436     {
437         //=================== TRD parameters ============================
438
439         AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
440         AliTRDgeometry *geoTRD = TRD->GetGeometry();
441         // Partial geometry: modules at 2,3,4,6,11,12,14,15
442         // starting at 6h in positive direction
443         geoTRD->SetSMstatus(0,0);
444         geoTRD->SetSMstatus(1,0);
445         geoTRD->SetSMstatus(5,0);
446         geoTRD->SetSMstatus(7,0);
447         geoTRD->SetSMstatus(8,0);
448         geoTRD->SetSMstatus(9,0);
449         geoTRD->SetSMstatus(10,0);
450         geoTRD->SetSMstatus(13,0);
451         geoTRD->SetSMstatus(16,0);
452         geoTRD->SetSMstatus(17,0);
453     }
454
455     if (iFMD)
456     {
457         //=================== FMD parameters ============================
458         AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
459    }
460
461     if (iMUON)
462     {
463         //=================== MUON parameters ===========================
464         // New MUONv1 version (geometry defined via builders)
465         AliMUON *MUON = new AliMUONv1("MUON","default");
466     }
467     //=================== PHOS parameters ===========================
468
469     if (iPHOS)
470     {
471         AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
472     }
473
474
475     if (iPMD)
476     {
477         //=================== PMD parameters ============================
478         AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
479     }
480
481     if (iT0)
482     {
483         //=================== T0 parameters ============================
484         AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
485     }
486
487     if (iEMCAL)
488     {
489         //=================== EMCAL parameters ============================
490         AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH_77_TRD1_2X2_FINAL_110DEG");
491     }
492
493      if (iACORDE)
494     {
495         //=================== ACORDE parameters ============================
496         AliACORDE *ACORDE = new AliACORDEv0("ACORDE", "normal ACORDE");
497     }
498
499      if (iVZERO)
500     {
501         //=================== VZERO parameters ============================
502         AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
503     }
504
505
506 }
507
508 Float_t EtaToTheta(Float_t arg){
509   return (180./TMath::Pi())*2.*atan(exp(-arg));
510 }