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 "STEER/AliMagF.h"
21 #include "STRUCT/AliBODY.h"
22 #include "STRUCT/AliMAG.h"
23 #include "STRUCT/AliABSOv3.h"
24 #include "STRUCT/AliDIPOv3.h"
25 #include "STRUCT/AliHALLv3.h"
26 #include "STRUCT/AliFRAMEv2.h"
27 #include "STRUCT/AliSHILv3.h"
28 #include "STRUCT/AliPIPEv3.h"
29 #include "ITS/AliITSv11.h"
30 #include "TPC/AliTPCv2.h"
31 #include "TOF/AliTOFv6T0.h"
32 #include "HMPID/AliHMPIDv2.h"
33 #include "ZDC/AliZDCv3.h"
34 #include "TRD/AliTRDv1.h"
35 #include "FMD/AliFMDv1.h"
36 #include "MUON/AliMUONv1.h"
37 #include "PHOS/AliPHOSv1.h"
38 #include "PMD/AliPMDv1.h"
39 #include "T0/AliT0v1.h"
40 #include "EMCAL/AliEMCALv2.h"
41 #include "ACORDE/AliACORDEv1.h"
42 #include "VZERO/AliVZEROv7.h"
45 Float_t EtaToTheta(Float_t arg);
47 AliGenerator *GenParamCalo(Int_t nPart, Int_t type, TString calo);
50 Bool_t checkGeoAndRun = kFALSE;
54 //AliLog::SetGlobalDebugLevel(2);
56 // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
57 // Theta range given through pseudorapidity limits 22/6/2001
59 // Set Random Number seed
60 //gRandom->SetSeed(123456); // Set 0 to use the currecnt time
61 AliLog::Message(AliLog::kInfo, Form("Seed for random number generation = %d",gRandom->GetSeed()), "Config.C", "Config.C", "Config()","Config.C", __LINE__);
63 // Load Pythia libraries
66 // libraries required by geant321
68 gSystem->Load("libgeant321");
71 new TGeant3TGeo("C++ Interface to Geant3");
75 AliLog::Message(AliLog::kInfo, "Creating Run Loader", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
77 rl = AliRunLoader::Open("galice.root",
78 AliConfig::GetDefaultEventFolderName(),
82 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
85 rl->SetCompressionLevel(2);
86 rl->SetNumberOfEventsPerFile(10000);
87 gAlice->SetRunLoader(rl);
89 // Set the trigger configuration
90 AliSimulation::Instance()->SetTriggerConfig("Pb-Pb");
91 cout<<"Trigger configuration is set to Pb-Pb"<<endl;
94 // Set External decayer
95 TVirtualMCDecayer *decayer = new AliDecayerPythia();
97 decayer->SetForceDecay(kAll);
99 gMC->SetExternalDecayer(decayer);
100 //=======================================================================
101 // ************* STEERING parameters FOR ALICE SIMULATION **************
102 // --- Specify event type to be tracked through the ALICE setup
103 // --- All positions are in cm, angles in degrees, and P and E in GeV
106 gMC->SetProcess("DCAY",1);
107 gMC->SetProcess("PAIR",1);
108 gMC->SetProcess("COMP",1);
109 gMC->SetProcess("PHOT",1);
110 gMC->SetProcess("PFIS",0);
111 gMC->SetProcess("DRAY",0);
112 gMC->SetProcess("ANNI",1);
113 gMC->SetProcess("BREM",1);
114 gMC->SetProcess("MUNU",1);
115 gMC->SetProcess("CKOV",1);
116 gMC->SetProcess("HADR",1);
117 gMC->SetProcess("LOSS",2);
118 gMC->SetProcess("MULS",1);
119 gMC->SetProcess("RAYL",1);
121 Float_t cut = 1.e-3; // 1MeV cut by default
122 Float_t tofmax = 1.e10;
124 gMC->SetCut("CUTGAM", cut);
125 gMC->SetCut("CUTELE", cut);
126 gMC->SetCut("CUTNEU", cut);
127 gMC->SetCut("CUTHAD", cut);
128 gMC->SetCut("CUTMUO", cut);
129 gMC->SetCut("BCUTE", cut);
130 gMC->SetCut("BCUTM", cut);
131 gMC->SetCut("DCUTE", cut);
132 gMC->SetCut("DCUTM", cut);
133 gMC->SetCut("PPCUTM", cut);
134 gMC->SetCut("TOFMAX", tofmax);
138 if (gSystem->Getenv("CONFIG_NPARTICLES"))
140 nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
143 if (gSystem->Getenv("CONFIG_YEAR"))
145 year = atoi(gSystem->Getenv("CONFIG_YEAR"));
148 AliGenBox *gener = new AliGenBox(nParticles);
149 gener->SetMomentumRange(10.,10.);
154 gener->SetPhiRange(80.0,120.0);
155 else if(year == 2011)
156 gener->SetPhiRange(80.0,180.0);
158 gener->SetPhiRange(80.0,190.0);
160 gener->SetThetaRange(EtaToTheta(0.7), EtaToTheta(-0.7));
162 // AliGenLib* lib = new AliGenPHOSlib();
163 // Int_t type = AliGenPHOSlib::kEtaFlat;
164 // AliGenParam *gener = new AliGenParam(1,lib,type,"");
165 // gener->SetMomentumRange(0,999);
166 // gener->SetPtRange(1,30);
167 // gener->SetPhiRange(80, 200.);
168 // gener->SetYRange(-2,2);
169 // gener->SetThetaRange(EtaToTheta(0.7),EtaToTheta(-0.7));
170 // gener->SetCutOnChild(1);
171 // gener->SetChildPtRange(0.1,30);
172 // gener->SetChildThetaRange(EtaToTheta(0.7),EtaToTheta(-0.7));
173 // gener->SetChildPhiRange(80, 180.);
174 // gener->SetOrigin(0,0,0); //vertex position
175 // gener->SetSigma(0,0,5.3); //Sigma in (X,Y,Z) (cm) on IP position
176 // gener->SetForceDecay(kGammaEM);
178 // //gener->SetTrackingFlag(0);
180 // AliGenCocktail *gener = new AliGenCocktail();
181 // gener->SetProjectile("A", 208, 82);
182 // gener->SetTarget ("A", 208, 82);
184 // // 1 Pi0 in EMCAL, 2010 configuration, 4 SM
185 // AliGenParam *gEMCPi0 = GenParamCalo(1, AliGenPHOSlib::kPi0Flat, "EMCAL");
186 // gener->AddGenerator(gEMCPi0,"pi0EMC", 1);
188 // // 1 Eta in EMCAL, 2010 configuration, 4 SM
189 // AliGenParam *gEMCEta = GenParamCalo(1, AliGenPHOSlib::kEtaFlat, "EMCAL");
190 // gener->AddGenerator(gEMCEta,"etaEMC", 1);
196 // Activate this line if you want the vertex smearing to happen
199 //gener->SetVertexSmear(perTrack);
201 TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG));
225 //=================== Alice BODY parameters =============================
226 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
230 //=================== MAG parameters ============================
231 // --- Start with Magnet since detector layouts may be depending ---
232 // --- on the selected Magnet dimensions ---
233 AliMAG *MAG = new AliMAG("MAG", "Magnet");
239 //=================== ABSO parameters ============================
240 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
245 //=================== DIPO parameters ============================
247 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
252 //=================== HALL parameters ============================
254 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
260 //=================== FRAME parameters ============================
262 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
267 //=================== SHIL parameters ============================
269 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
275 //=================== PIPE parameters ============================
277 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
282 //=================== ITS parameters ============================
284 AliITS *ITS = new AliITSv11("ITS","ITS v11");
289 //============================ TPC parameters ===================
290 AliTPC *TPC = new AliTPCv2("TPC", "Default");
295 //=================== TOF parameters ============================
296 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
302 //=================== HMPID parameters ===========================
303 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
310 //=================== ZDC parameters ============================
312 AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
317 //=================== TRD parameters ============================
319 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
320 AliTRDgeometry *geoTRD = TRD->GetGeometry();
321 // starting at 3h in positive direction
322 if(year==2011 || year == 2010)
323 { // not sure if good for 2010
324 // Partial geometry: modules at 0,1,7,8,9,10,11,15,16,17
325 printf("*** TRD configuration for 2011\n");
326 geoTRD->SetSMstatus(2,0);
327 geoTRD->SetSMstatus(3,0);
328 geoTRD->SetSMstatus(4,0);
329 geoTRD->SetSMstatus(5,0);
330 geoTRD->SetSMstatus(6,0);
331 geoTRD->SetSMstatus(12,0);
332 geoTRD->SetSMstatus(13,0);
333 geoTRD->SetSMstatus(14,0);
337 printf("*** TRD configuration for 2012\n");
338 geoTRD->SetSMstatus(4,0);
339 geoTRD->SetSMstatus(5,0);
340 geoTRD->SetSMstatus(12,0);
341 geoTRD->SetSMstatus(13,0);
342 geoTRD->SetSMstatus(14,0);
348 //=================== FMD parameters ============================
349 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
354 //=================== MUON parameters ===========================
355 // New MUONv1 version (geometry defined via builders)
356 AliMUON *MUON = new AliMUONv1("MUON", "default");
358 //=================== PHOS parameters ===========================
362 AliPHOS *PHOS = new AliPHOSv1("PHOS", "noCPV_Modules123");
368 //=================== PMD parameters ============================
369 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
374 //=================== T0 parameters ============================
375 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
380 //=================== EMCAL parameters ============================
381 if (year == 2010) // d phi = 40 degrees
382 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_FIRSTYEARV1", checkGeoAndRun);
383 else if (year == 2011) // d phi = 100 degrees
384 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETEV1", checkGeoAndRun);
385 else if (year > 2011) // d phi = 110 degrees
386 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE12SMV1", checkGeoAndRun);
387 else // Old configuration with 110 degrees but not perfect geometry
388 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE", checkGeoAndRun);
393 //=================== ACORDE parameters ============================
394 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
399 //=================== ACORDE parameters ============================
400 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
403 AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
407 Float_t EtaToTheta(Float_t arg){
408 return (180./TMath::Pi())*2.*atan(exp(-arg));
413 // Load Pythia related libraries
414 gSystem->Load("liblhapdf.so"); // Parton density functions
415 gSystem->Load("libEGPythia6.so"); // TGenerator interface
416 gSystem->Load("libpythia6.so"); // Pythia
417 gSystem->Load("libAliPythia6.so"); // ALICE specific
422 AliGenerator * GenParamCalo(Int_t nPart, Int_t type, TString calo)
424 // nPart of type (Pi0, Eta, Pi0Flat, EtaFlat, ...) in EMCAL or PHOS
425 // CAREFUL EMCAL year 2010 configuration
426 AliGenParam *gener = new AliGenParam(nPart,new AliGenPHOSlib(),type,"");
429 gener->SetMomentumRange(0,999);
430 gener->SetYRange(-2,2);
431 gener->SetPtRange(1,30);
433 gener->SetForceDecay(kGammaEM); // Ensure the decays are photons
434 gener->SetCutOnChild(1);
435 gener->SetChildPtRange(0.,30);
440 gener->SetPhiRange(80., 100.); // year 2010
441 //gener->SetPhiRange(80., 180.); // year 2011
442 gener->SetThetaRange(EtaToTheta(0.7),EtaToTheta(-0.7));
444 gener->SetChildThetaRange(EtaToTheta(0.7),EtaToTheta(-0.7));
445 gener->SetChildPhiRange(80., 100.); // year 2010
446 //gener->SetChildPhiRange(80., 180.); // year 2011
448 else if(calo=="PHOS")
451 gener->SetPhiRange(260., 320.);
452 gener->SetThetaRange(EtaToTheta(0.13),EtaToTheta(-0.13));
454 gener->SetChildThetaRange(EtaToTheta(0.13),EtaToTheta(-0.13));
455 gener->SetChildPhiRange(260., 320.);