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