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++"
7 #if !defined(__CINT__) || defined(__MAKECINT__)
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/AliMagWrapCheb.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/AliITSv11.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/AliACORDEv1.h"
45 #include "VZERO/AliVZEROv7.h"
46 #include <TVirtualMagField.h>
50 Int_t generatorFlag = 2;
58 kDefaultPPTrig, kDefaultPbPbTrig
61 const char * pprTrigConfName[] = {
65 Float_t EtaToTheta(Float_t arg);
66 AliGenerator *Hijing();
68 static PprTrigConf_t strig = kDefaultPPTrig;// default PP trigger configuration
72 // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
73 // Theta range given through pseudorapidity limits 22/6/2001
75 // Set Random Number seed
76 gRandom->SetSeed(0); // Set 0 to use the currecnt time
79 // libraries required by geant321
81 gSystem->Load("liblhapdf");
82 gSystem->Load("libEGPythia6");
83 gSystem->Load("libpythia6");
84 gSystem->Load("libAliPythia6");
85 gSystem->Load("libgeant321");
86 gSystem->Load("libhijing");
87 gSystem->Load("libTHijing");
91 new TGeant3TGeo("C++ Interface to Geant3");
96 rl = AliRunLoader::Open("galice.root",
97 AliConfig::GetDefaultEventFolderName(),
101 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
104 rl->SetCompressionLevel(2);
105 rl->SetNumberOfEventsPerFile(2000);
106 gAlice->SetRunLoader(rl);
108 // Set the trigger configuration
109 // gAlice->SetTriggerDescriptor(pprTrigConfName[strig]);
110 //cout<<"Trigger configuration is set to "<<pprTrigConfName[strig]<<endl;
111 AliSimulation::Instance()->SetTriggerConfig(pprTrigConfName[strig]);
112 cout<<"Trigger configuration is set to pprTrigConfName[strig] "<<endl;
115 // Set External decayer
116 TVirtualMCDecayer *decayer = new AliDecayerPythia();
118 decayer->SetForceDecay(kAll);
120 gMC->SetExternalDecayer(decayer);
121 //=======================================================================
122 // ************* STEERING parameters FOR ALICE SIMULATION **************
123 // --- Specify event type to be tracked through the ALICE setup
124 // --- All positions are in cm, angles in degrees, and P and E in GeV
127 gMC->SetProcess("DCAY",1);
128 gMC->SetProcess("PAIR",1);
129 gMC->SetProcess("COMP",1);
130 gMC->SetProcess("PHOT",1);
131 gMC->SetProcess("PFIS",0);
132 gMC->SetProcess("DRAY",0);
133 gMC->SetProcess("ANNI",1);
134 gMC->SetProcess("BREM",1);
135 gMC->SetProcess("MUNU",1);
136 gMC->SetProcess("CKOV",1);
137 gMC->SetProcess("HADR",0);
138 gMC->SetProcess("LOSS",2);
139 gMC->SetProcess("MULS",1);
140 gMC->SetProcess("RAYL",1);
142 Float_t cut = 1.e-3; // 1MeV cut by default
143 Float_t tofmax = 1.e10;
145 gMC->SetCut("CUTGAM", cut);
146 gMC->SetCut("CUTELE", cut);
147 gMC->SetCut("CUTNEU", cut);
148 gMC->SetCut("CUTHAD", cut);
149 gMC->SetCut("CUTMUO", cut);
150 gMC->SetCut("BCUTE", cut);
151 gMC->SetCut("BCUTM", cut);
152 gMC->SetCut("DCUTE", cut);
153 gMC->SetCut("DCUTM", cut);
154 gMC->SetCut("PPCUTM", cut);
155 gMC->SetCut("TOFMAX", tofmax);
157 // Special generation for Valgrind tests
158 // Each detector is fired by few particles selected
159 // to cover specific cases
162 // The cocktail itself
164 if (generatorFlag==0) {
166 AliGenCocktail *gener = new AliGenCocktail();
167 gener->SetPhiRange(0, 360);
168 // Set pseudorapidity range from -8 to 8.
169 Float_t thmin = EtaToTheta(8); // theta min. <---> eta max
170 Float_t thmax = EtaToTheta(-8); // theta max. <---> eta min
171 gener->SetThetaRange(thmin,thmax);
172 gener->SetOrigin(0., 0., 0); //vertex position
173 gener->SetSigma(0., 0., 0); //Sigma in (X,Y,Z) (cm) on IP position
176 AliGenBox *gbox2 = new AliGenBox(2300*1.8);
177 gbox2->SetPtRange(0.1,2.0); //
178 gbox2->SetPhiRange(0,360);
179 gbox2->SetThetaRange(44.,135.); // +/- 0.9 eta
180 //gbox2->SetPhiRange(250,250.5);
181 // gbox2->SetThetaRange(50.,50.1);
182 gbox2->SetPart(kPiMinus);
183 gener->AddGenerator(gbox2,"GENBOX PIONS for ITS",1);
188 AliGenHIJINGpara *gbox2=new AliGenHIJINGpara(2300*1.8); // 2300 dNdy in 2*0.9eta
189 gbox2->SetPtRange(0.06,9999999);
190 gbox2->SetPhiRange(0,360.);
191 gbox2->SetThetaRange(44.,135.); // +/- 0.9 eta
192 gener->AddGenerator(gbox2,"GenHIJINGpara PIONS for ITS",1);
197 } else if (generatorFlag==1) {
200 AliGenHijing *generHijing = new AliGenHijing(-1);
201 // centre of mass energy
202 generHijing->SetEnergyCMS(5500.);
203 generHijing->SetImpactParameterRange(0,1);
205 generHijing->SetReferenceFrame("CMS");
207 generHijing->SetProjectile("A", 208, 82);
208 generHijing->SetTarget ("A", 208, 82);
209 // tell hijing to keep the full parent child chain
210 generHijing->KeepFullEvent();
211 // enable jet quenching
212 generHijing->SetJetQuenching(1);
214 generHijing->SetShadowing(1);
215 // neutral pion and heavy particle decays switched off
216 // generHijing->SetDecaysOff(3); // 3 requested by Ana Marin
217 // Don't track spectators
218 generHijing->SetSpectators(0);
219 // kinematic selection
220 generHijing->SetSelectAll(0);
222 AliGenerator* gener = generHijing;
223 gener->SetSigma(0, 0, 0); // Sigma in (X,Y,Z) (cm) on IP position
224 gener->SetVertexSmear(kPerEvent);
228 } else if (generatorFlag==2) {
232 int nParticles = 14022;
233 AliGenHIJINGpara *gener = new AliGenHIJINGpara(nParticles);
234 gener->SetMomentumRange(0.1, 10.);
235 gener->SetPhiRange(0., 360.);
236 Float_t thmin = EtaToTheta(2.5); // theta min. <---> eta max
237 Float_t thmax = EtaToTheta(-2.5); // theta max. <---> eta min
238 gener->SetThetaRange(thmin,thmax);
239 gener->SetOrigin(0, 0, 0); //vertex position
240 gener->SetSigma(0, 0, 0); //Sigma in (X,Y,Z) (cm) on IP position
244 } else if (generatorFlag==3) {
247 AliGenHijing *generHijing = new AliGenHijing(-1);
248 generHijing->SetEnergyCMS(5500.);
249 generHijing->SetImpactParameterRange(0,5);
250 generHijing->SetReferenceFrame("CMS");
251 generHijing->SetProjectile("A", 208, 82);
252 generHijing->SetTarget ("A", 208, 82);
253 generHijing->KeepFullEvent();
254 generHijing->SetJetQuenching(1);
255 generHijing->SetShadowing(1);
256 generHijing->SetSpectators(0);
257 generHijing->SetSelectAll(0);
258 generHijing->SetPtHardMin(4.5);
260 AliGenerator* gener = generHijing;
261 gener->SetSigma(0, 0, 0); // Sigma in (X,Y,Z) (cm) on IP position
262 gener->SetVertexSmear(kPerEvent);
270 // Activate this line if you want the vertex smearing to happen
273 //VertexSmear_t perTrack;
274 //gener->SetVertexSmear(perTrack);
276 //AliMagF* field = new AliMagF("map","map",2, -1.,1., 15, AliMagF::k5kGUniform);
277 //TGeoGlobalMagField::Instance()->SetField(field);
278 TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG));
286 Int_t isUpgrade = ITSflag;
303 //=================== Alice BODY parameters =============================
304 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
308 //=================== MAG parameters ============================
309 // --- Start with Magnet since detector layouts may be depending ---
310 // --- on the selected Magnet dimensions ---
311 AliMAG *MAG = new AliMAG("MAG", "Magnet");
317 //=================== ABSO parameters ============================
318 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
323 //=================== DIPO parameters ============================
325 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
330 //=================== HALL parameters ============================
332 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
338 //=================== FRAME parameters ============================
340 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
346 //=================== SHIL parameters ============================
348 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
354 //=================== PIPE parameters ============================
356 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
361 //=================== ITS parameters ============================
364 if (isUpgrade==1) { // current ITS geometry ...
367 AliITSupgrade *ITSu = new AliITSupgrade("ITS","ITS upgrade",kTRUE);
370 } else if(isUpgrade==2) { // "New SPDs" Configuration
374 Double_t widthBP = 0.08;
375 Double_t radiusBP = 2.0-widthBP;
376 Double_t halflengthBP = 200.;
381 TArrayD xsize(nlayers); TArrayD zsize(nlayers);
382 TArrayD width(nlayers); TArrayD radii(nlayers);
384 TArrayD widthCu(nlayers); TArrayD radiiCu(nlayers);
385 TArrayS copper(nlayers);
386 TArrayD halfLengths(nlayers);
389 for(Int_t i=0; i<nlayers; i++){
391 Double_t xsz[7]={14*1e-04, 14*1e-04, 14*1e-04, 121.2e-04,121.4*1e-04,69.3*1e-04,69.3*1e-04};
392 Double_t zsz[7]={14*1e-04, 14*1e-04, 14*1e-04, 97*1e-04,97*1e-04,2875*1e-04,2875*1e-04};
394 Double_t halfL[7]={21./2, 25./2., 32./2., 22.2,29.7,43.1,48.9};
397 Double_t r[7]={2.2,3.8,6.8,14.9,23.8,39.1,43.6};
400 Double_t thick[7]={50.*1e-04,50.*1e-04,50.*1e-04,150.*1e-04,150.*1e-04,150.*1e-04,150.*1e-04};
401 width.AddAt(thick[i],i);
403 // Copper radius & thickness
404 radiiCu.AddAt(r[i]+thick[i],i);
406 widthCu.AddAt(0.0036,i);
408 widthCu.AddAt(0.0150,i);//micron
411 Int_t c[7]={1,1,1,1,1,1,1};
412 copper.AddAt(c[i],i);
415 // Silicon pixel sizes and length in Z
418 npixHalf[i]=(Int_t)(halfL[i]/zsz[i]);
420 HalfL[i]=npixHalf[i]*zsz[i];
423 npixR[i] = (Int_t)(2*TMath::Pi()*r[i]/xsz[i]);
425 xszInt[i]= 2*TMath::Pi()*r[i]/npixR[i];
426 xsize.AddAt(xszInt[i],i);
427 zsize.AddAt(zsz[i],i);
429 halfLengths.AddAt(HalfL[i],i);
433 AliITSupgrade *ITSu =
434 new AliITSupgrade("ITS","ITS upgrade",
435 width,radii,halfLengths,
436 radiiCu,widthCu,copper,
437 bp,radiusBP, widthBP, halflengthBP );
440 ITSu->SetFullSegmentation(xsize,zsize);
442 } else if (isUpgrade==3) { // "All New" Configuration
446 Double_t widthBP = 0.08;
447 Double_t radiusBP = 2.0-widthBP;
448 Double_t halflengthBP = 200.;
453 TArrayD xsize(nlayers); TArrayD zsize(nlayers);
454 TArrayD width(nlayers); TArrayD radii(nlayers);
456 TArrayD widthCu(nlayers); TArrayD radiiCu(nlayers);
457 TArrayS copper(nlayers);
458 TArrayD halfLengths(nlayers);
461 for(Int_t i=0; i<nlayers; i++){
463 Double_t xsz[7]={14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04};
464 Double_t zsz[7]={14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04};
466 Double_t halfL[7]={21./2, 25./2., 32./2., 45./2, 67./2, 107./2, 114./2};
469 Double_t r[7]={2.2,3.8,6.8,12.4,23.5,39.6,43.0};
472 Double_t thick[7]={50.*1e-04,50.*1e-04,50.*1e-04,50.*1e-04,50.*1e-04,50.*1e-04,50.*1e-04};
473 width.AddAt(thick[i],i);
475 // Copper radius & thickness
476 radiiCu.AddAt(r[i]+thick[i],i);
477 widthCu.AddAt(0.0036,i);
480 Int_t c[7]={1,1,1,1,1,1,1};
481 copper.AddAt(c[i],i);
484 // Silicon pixel sizes and length in Z
487 npixHalf[i]=(Int_t)(halfL[i]/zsz[i]);
489 HalfL[i]=npixHalf[i]*zsz[i];
492 npixR[i] = (Int_t)(2*TMath::Pi()*r[i]/xsz[i]);
494 xszInt[i]= 2*TMath::Pi()*r[i]/npixR[i];
495 xsize.AddAt(xszInt[i],i);
496 zsize.AddAt(zsz[i],i);
498 halfLengths.AddAt(HalfL[i],i);
502 AliITSupgrade *ITSu =
503 new AliITSupgrade("ITS","ITS upgrade",
504 width,radii,halfLengths,
505 radiiCu,widthCu,copper,
506 bp,radiusBP, widthBP, halflengthBP );
509 ITSu->SetFullSegmentation(xsize,zsize);
511 } else if (isUpgrade==4) { // "All New" Configuration with 8 layers
515 Double_t widthBP = 0.08;
516 Double_t radiusBP = 2.0-widthBP;
517 Double_t halflengthBP = 200.;
522 TArrayD xsize(nlayers); TArrayD zsize(nlayers);
523 TArrayD width(nlayers); TArrayD radii(nlayers);
525 TArrayD widthCu(nlayers); TArrayD radiiCu(nlayers);
526 TArrayS copper(nlayers);
527 TArrayD halfLengths(nlayers);
530 for(Int_t i=0; i<nlayers; i++){
532 Double_t xsz[8]={14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04};
533 Double_t zsz[8]={14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04};
535 Double_t halfL[8]={21./2, 25./2., 32./2., 45./2, 67./2, 114./2, 114./2, 114./2};
538 Double_t r[8]={2.2,3.8,6.8,12.4,23.5, 42.6,43.0,43.4};
541 Double_t thick[8]={50.*1e-04,50.*1e-04,50.*1e-04,50.*1e-04,50.*1e-04,50.*1e-04,50.*1e-04,50.*1e-04};
542 width.AddAt(thick[i],i);
544 // Copper radius & thickness
545 radiiCu.AddAt(r[i]+thick[i],i);
546 widthCu.AddAt(0.0036,i);
549 Int_t c[8]={1,1,1,1,1,1,1};
550 copper.AddAt(c[i],i);
553 // Silicon pixel sizes and length in Z
556 npixHalf[i]=(Int_t)(halfL[i]/zsz[i]);
558 HalfL[i]=npixHalf[i]*zsz[i];
561 npixR[i] = (Int_t)(2*TMath::Pi()*r[i]/xsz[i]);
563 xszInt[i]= 2*TMath::Pi()*r[i]/npixR[i];
564 xsize.AddAt(xszInt[i],i);
565 zsize.AddAt(zsz[i],i);
567 halfLengths.AddAt(HalfL[i],i);
571 AliITSupgrade *ITSu =
572 new AliITSupgrade("ITS","ITS upgrade",
573 width,radii,halfLengths,
574 radiiCu,widthCu,copper,
575 bp,radiusBP, widthBP, halflengthBP );
578 ITSu->SetFullSegmentation(xsize,zsize);
580 } else if (isUpgrade==5) { // "All New" Configuration with 8 layers
584 Double_t widthBP = 0.08;
585 Double_t radiusBP = 2.0-widthBP;
586 Double_t halflengthBP = 200.;
591 TArrayD xsize(nlayers); TArrayD zsize(nlayers);
592 TArrayD width(nlayers); TArrayD radii(nlayers);
594 TArrayD widthCu(nlayers); TArrayD radiiCu(nlayers);
595 TArrayS copper(nlayers);
596 TArrayD halfLengths(nlayers);
599 for(Int_t i=0; i<nlayers; i++){
601 Double_t xsz[9]={14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04};
602 Double_t zsz[9]={14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04, 14*1e-04};
604 Double_t halfL[9]={21./2, 25./2., 32./2., 45./2, 67./2, 107./2, 107./2, 114./2, 114./2};
607 Double_t r[9]={2.2,3.8,6.8,12.4,23.5, 39.6,40.0,43.0,43.4};
610 Double_t thick[9]={50.*1e-04,50.*1e-04,50.*1e-04,50.*1e-04,50.*1e-04,50.*1e-04,50.*1e-04,50.*1e-04,50.*1e-04};
611 width.AddAt(thick[i],i);
613 // Copper radius & thickness
614 radiiCu.AddAt(r[i]+thick[i],i);
615 widthCu.AddAt(0.0036,i);
618 Int_t c[9]={1,1,1,1,1,1,1};
619 copper.AddAt(c[i],i);
622 // Silicon pixel sizes and length in Z
625 npixHalf[i]=(Int_t)(halfL[i]/zsz[i]);
627 HalfL[i]=npixHalf[i]*zsz[i];
630 npixR[i] = (Int_t)(2*TMath::Pi()*r[i]/xsz[i]);
632 xszInt[i]= 2*TMath::Pi()*r[i]/npixR[i];
633 xsize.AddAt(xszInt[i],i);
634 zsize.AddAt(zsz[i],i);
636 halfLengths.AddAt(HalfL[i],i);
640 AliITSupgrade *ITSu =
641 new AliITSupgrade("ITS","ITS upgrade",
642 width,radii,halfLengths,
643 radiiCu,widthCu,copper,
644 bp,radiusBP, widthBP, halflengthBP );
647 ITSu->SetFullSegmentation(xsize,zsize);
653 AliITS *ITS = new AliITSv11("ITS","ITS v11");
660 //============================ TPC parameters ===================
661 AliTPC *TPC = new AliTPCv2("TPC", "Default");
666 //=================== TOF parameters ============================
667 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
673 //=================== HMPID parameters ===========================
674 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
681 //=================== ZDC parameters ============================
683 AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
688 //=================== TRD parameters ============================
690 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
691 AliTRDgeometry *geoTRD = TRD->GetGeometry();
692 // Partial geometry: modules at 2,3,4,6,11,12,14,15
693 // starting at 6h in positive direction
694 geoTRD->SetSMstatus(0,0);
695 geoTRD->SetSMstatus(1,0);
696 geoTRD->SetSMstatus(5,0);
697 geoTRD->SetSMstatus(7,0);
698 geoTRD->SetSMstatus(8,0);
699 geoTRD->SetSMstatus(9,0);
700 geoTRD->SetSMstatus(10,0);
701 geoTRD->SetSMstatus(13,0);
702 geoTRD->SetSMstatus(16,0);
703 geoTRD->SetSMstatus(17,0);
708 //=================== FMD parameters ============================
709 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
714 //=================== MUON parameters ===========================
715 // New MUONv1 version (geometry defined via builders)
716 AliMUON *MUON = new AliMUONv1("MUON","default");
718 //=================== PHOS parameters ===========================
722 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
728 //=================== PMD parameters ============================
729 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
734 //=================== T0 parameters ============================
735 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
740 //=================== EMCAL parameters ============================
741 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETEV1");
746 //=================== ACORDE parameters ============================
747 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
752 //=================== VZERO parameters ============================
753 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
759 Float_t EtaToTheta(Float_t arg){
760 return (180./TMath::Pi())*2.*atan(exp(-arg));
764 AliGenerator* Hijing()