2 // Configuration for the first physics production 2008
5 // One can use the configuration macro in compiled mode by
6 // root [0] gSystem->Load("libgeant321");
7 // root [0] gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include\
8 // -I$ALICE_ROOT -I$ALICE/geant3/TGeant3");
9 // root [0] .x grun.C(1,"Config.C++")
11 #if !defined(__CINT__) || defined(__MAKECINT__)
12 #include <Riostream.h>
16 #include <TVirtualMC.h>
17 #include <TGeant3TGeo.h>
18 #include "STEER/AliRunLoader.h"
19 #include "STEER/AliRun.h"
20 #include "STEER/AliConfig.h"
21 #include "PYTHIA6/AliDecayerPythia.h"
22 #include "PYTHIA6/AliGenPythia.h"
23 #include "TDPMjet/AliGenDPMjet.h"
24 #include "STEER/AliMagF.h"
25 #include "STRUCT/AliBODY.h"
26 #include "STRUCT/AliMAG.h"
27 #include "STRUCT/AliABSOv3.h"
28 #include "STRUCT/AliDIPOv3.h"
29 #include "STRUCT/AliHALLv3.h"
30 #include "STRUCT/AliFRAMEv2.h"
31 #include "STRUCT/AliSHILv3.h"
32 #include "STRUCT/AliPIPEv3.h"
33 #include "ITS/AliITSv11Hybrid.h"
34 #include "TPC/AliTPCv2.h"
35 #include "TOF/AliTOFv6T0.h"
36 #include "HMPID/AliHMPIDv3.h"
37 #include "ZDC/AliZDCv3.h"
38 #include "TRD/AliTRDv1.h"
39 #include "TRD/AliTRDgeometry.h"
40 #include "FMD/AliFMDv1.h"
41 #include "MUON/AliMUONv1.h"
42 #include "PHOS/AliPHOSv1.h"
43 #include "PHOS/AliPHOSSimParam.h"
44 #include "PMD/AliPMDv1.h"
45 #include "T0/AliT0v1.h"
46 #include "EMCAL/AliEMCALv2.h"
47 #include "ACORDE/AliACORDEv1.h"
48 #include "VZERO/AliVZEROv7.h"
54 kPythia6, kPhojet, kRunMax
57 const char * pprRunName[] = {
61 const char * pprField[] = {
67 AliGenerator *MbPythia();
68 AliGenerator *MbPhojet();
69 void ProcessEnvironmentVars();
71 // Geterator, field, beam energy
72 static PDC06Proc_t proc = kPhojet;
73 static AliMagF::BMap_t mag = AliMagF::k5kG;
74 static Float_t energy = 10000; // energy in CMS
75 //========================//
76 // Set Random Number seed //
77 //========================//
79 static UInt_t seed = dt.Get();
82 static TString comment;
88 // Get settings from environment variables
89 ProcessEnvironmentVars();
91 gRandom->SetSeed(seed);
92 cerr<<"Seed for random number generation= "<<seed<<endl;
94 // Libraries required by geant321
96 gSystem->Load("liblhapdf"); // Parton density functions
97 gSystem->Load("libEGPythia6"); // TGenerator interface
98 gSystem->Load("libpythia6"); // Pythia
99 gSystem->Load("libAliPythia6"); // ALICE specific implementations
100 gSystem->Load("libgeant321");
103 new TGeant3TGeo("C++ Interface to Geant3");
105 //=======================================================================
106 // Create the output file
109 AliRunLoader* rl=0x0;
111 cout<<"Config.C: Creating Run Loader ..."<<endl;
112 rl = AliRunLoader::Open("galice.root",
113 AliConfig::GetDefaultEventFolderName(),
117 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
120 rl->SetCompressionLevel(2);
121 rl->SetNumberOfEventsPerFile(1000);
122 gAlice->SetRunLoader(rl);
123 // gAlice->SetGeometryFromFile("geometry.root");
124 // gAlice->SetGeometryFromCDB();
126 // Set the trigger configuration: proton-proton
127 gAlice->SetTriggerDescriptor("p-p");
130 //=======================================================================
131 // ************* STEERING parameters FOR ALICE SIMULATION **************
132 // --- Specify event type to be tracked through the ALICE setup
133 // --- All positions are in cm, angles in degrees, and P and E in GeV
136 gMC->SetProcess("DCAY",1);
137 gMC->SetProcess("PAIR",1);
138 gMC->SetProcess("COMP",1);
139 gMC->SetProcess("PHOT",1);
140 gMC->SetProcess("PFIS",0);
141 gMC->SetProcess("DRAY",0);
142 gMC->SetProcess("ANNI",1);
143 gMC->SetProcess("BREM",1);
144 gMC->SetProcess("MUNU",1);
145 gMC->SetProcess("CKOV",1);
146 gMC->SetProcess("HADR",1);
147 gMC->SetProcess("LOSS",2);
148 gMC->SetProcess("MULS",1);
149 gMC->SetProcess("RAYL",1);
151 Float_t cut = 1.e-3; // 1MeV cut by default
152 Float_t tofmax = 1.e10;
154 gMC->SetCut("CUTGAM", cut);
155 gMC->SetCut("CUTELE", cut);
156 gMC->SetCut("CUTNEU", cut);
157 gMC->SetCut("CUTHAD", cut);
158 gMC->SetCut("CUTMUO", cut);
159 gMC->SetCut("BCUTE", cut);
160 gMC->SetCut("BCUTM", cut);
161 gMC->SetCut("DCUTE", cut);
162 gMC->SetCut("DCUTM", cut);
163 gMC->SetCut("PPCUTM", cut);
164 gMC->SetCut("TOFMAX", tofmax);
169 //======================//
170 // Set External decayer //
171 //======================//
172 TVirtualMCDecayer* decayer = new AliDecayerPythia();
173 decayer->SetForceDecay(kAll);
175 gMC->SetExternalDecayer(decayer);
177 //=========================//
178 // Generator Configuration //
179 //=========================//
180 // Create pileup generator
181 AliGenPileup *pileup = new AliGenPileup();
183 AliGenerator* gener = 0x0;
185 if (proc == kPythia6) {
187 } else if (proc == kPhojet) {
191 // Set the pileup interaction generator
192 // The second argument is the pileup rate
193 // in terms of event rate per bunch crossing
194 pileup->SetGenerator(gener,0.01);
195 // Set the beam time structure
196 // Details on the syntax in STEER/AliTriggerBCMask
197 pileup->SetBCMask("72(1H1L)3420L");
198 // Examples of the pileup rate and beam structure settings
199 // Most of the information is taken from the LHC commissionning page
200 // rate from 0.01 (at 900GeV) to 0.76 (at 14TeV)
201 // 1 bunch/orbit - bc-mask = "1H3563L"
202 // 43 bunches/orbit - bc-mask = "43(1H80L)81L"
203 // 72 bunches/orbit - bc-mask = "72(1H1L)3420L" (50ns mode)
204 // Please note that most of these setting should be cross-checked because
205 // for example the 43 bunches mode is taken at CMS IP and not the ALICE one.
207 // Generate the trigger interaction
208 pileup->GenerateTrigInteraction(kTRUE);
212 pileup->SetOrigin(0., 0., 0.); // vertex position
215 // Size of the interaction diamond
217 Float_t sigmaz = 5.4 / TMath::Sqrt(2.); // [cm]
219 sigmaz = 10.5 / TMath::Sqrt(2.); // [cm]
222 Float_t betast = 10; // beta* [m]
223 Float_t eps = 3.75e-6; // emittance [m]
224 Float_t gamma = energy / 2.0 / 0.938272; // relativistic gamma [1]
225 Float_t sigmaxy = TMath::Sqrt(eps * betast / gamma) / TMath::Sqrt(2.) * 100.; // [cm]
226 printf("\n \n Diamond size x-y: %10.3e z: %10.3e\n \n", sigmaxy, sigmaz);
228 pileup->SetSigma(sigmaxy, sigmaxy, sigmaz); // Sigma in (X,Y,Z) (cm) on IP position
229 pileup->SetCutVertexZ(3.); // Truncate at 3 sigma
230 pileup->SetVertexSmear(kPerEvent);
236 AliMagF* field = 0x0;
237 if (mag == kNoField) {
238 comment = comment.Append(" | L3 field 0.0 T");
239 field = new AliMagF("Maps","Maps", 2, 0., 0., 10., AliMagF::k2kG);
240 } else if (mag == AliMagF::k5kG) {
241 comment = comment.Append(" | L3 field 0.5 T");
242 field = new AliMagF("Maps","Maps", 2, 1., 1., 10., AliMagF::k5kG);
244 printf("\n \n Comment: %s \n \n", comment.Data());
245 TGeoGlobalMagField::Instance()->SetField(field);
272 //=================== Alice BODY parameters =============================
273 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
278 //=================== MAG parameters ============================
279 // --- Start with Magnet since detector layouts may be depending ---
280 // --- on the selected Magnet dimensions ---
281 AliMAG *MAG = new AliMAG("MAG", "Magnet");
287 //=================== ABSO parameters ============================
288 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
293 //=================== DIPO parameters ============================
295 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
300 //=================== HALL parameters ============================
302 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
308 //=================== FRAME parameters ============================
310 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
316 //=================== SHIL parameters ============================
318 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
324 //=================== PIPE parameters ============================
326 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
331 //=================== ITS parameters ============================
333 AliITS *ITS = new AliITSv11Hybrid("ITS","ITS v11Hybrid");
338 //============================ TPC parameters =====================
340 AliTPC *TPC = new AliTPCv2("TPC", "Default");
345 //=================== TOF parameters ============================
347 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
353 //=================== HMPID parameters ===========================
355 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
362 //=================== ZDC parameters ============================
364 AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
369 //=================== TRD parameters ============================
371 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
372 AliTRDgeometry *geoTRD = TRD->GetGeometry();
373 // Partial geometry: modules at 0,8,9,17
374 // starting at 3h in positive direction
375 geoTRD->SetSMstatus(1,0);
376 geoTRD->SetSMstatus(2,0);
377 geoTRD->SetSMstatus(3,0);
378 geoTRD->SetSMstatus(4,0);
379 geoTRD->SetSMstatus(5,0);
380 geoTRD->SetSMstatus(6,0);
381 geoTRD->SetSMstatus(7,0);
382 geoTRD->SetSMstatus(10,0);
383 geoTRD->SetSMstatus(11,0);
384 geoTRD->SetSMstatus(12,0);
385 geoTRD->SetSMstatus(13,0);
386 geoTRD->SetSMstatus(14,0);
387 geoTRD->SetSMstatus(15,0);
388 geoTRD->SetSMstatus(16,0);
393 //=================== FMD parameters ============================
395 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
400 //=================== MUON parameters ===========================
401 // New MUONv1 version (geometry defined via builders)
403 AliMUON *MUON = new AliMUONv1("MUON", "default");
408 //=================== PHOS parameters ===========================
410 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
411 //Set simulation parameters different from the default ones.
412 AliPHOSSimParam* simEmc = AliPHOSSimParam::GetInstance() ;
414 // APD noise of warm (+20C) PHOS:
415 // a2 = a1*(Y1/Y2)*(M1/M2), where a1 = 0.012 is APD noise at -25C,
416 // Y1 = 4.3 photo-electrons/MeV, Y2 = 1.7 p.e/MeV - light yields at -25C and +20C,
417 // M1 = 50, M2 = 50 - APD gain factors chosen for t1 = -25C and t2 = +20C,
418 // Y = MeanLightYield*APDEfficiency.
420 Float_t apdNoise = 0.012*2.5;
421 simEmc->SetAPDNoise(apdNoise);
423 //Raw Light Yield at +20C
424 simEmc->SetMeanLightYield(18800);
426 //ADC channel width at +18C.
427 simEmc->SetADCchannelW(0.0125);
433 //=================== PMD parameters ============================
435 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
440 //=================== T0 parameters ============================
441 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
446 //=================== EMCAL parameters ============================
448 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
453 //=================== ACORDE parameters ============================
455 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
460 //=================== ACORDE parameters ============================
462 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
469 AliGenerator* MbPythia()
471 comment = comment.Append(" pp at 14 TeV: Pythia low-pt");
474 AliGenPythia* pythia = new AliGenPythia(-1);
475 pythia->SetMomentumRange(0, 999999.);
476 pythia->SetThetaRange(0., 180.);
477 pythia->SetYRange(-12.,12.);
478 pythia->SetPtRange(0,1000.);
479 pythia->SetProcess(kPyMb);
480 pythia->SetEnergyCMS(energy);
485 AliGenerator* MbPhojet()
487 comment = comment.Append(" pp at 14 TeV: Pythia low-pt");
490 #if defined(__CINT__)
491 gSystem->Load("libdpmjet"); // Parton density functions
492 gSystem->Load("libTDPMjet"); // Parton density functions
494 AliGenDPMjet* dpmjet = new AliGenDPMjet(-1);
495 dpmjet->SetMomentumRange(0, 999999.);
496 dpmjet->SetThetaRange(0., 180.);
497 dpmjet->SetYRange(-12.,12.);
498 dpmjet->SetPtRange(0,1000.);
499 dpmjet->SetProcess(kDpmMb);
500 dpmjet->SetEnergyCMS(energy);
505 void ProcessEnvironmentVars()
508 if (gSystem->Getenv("CONFIG_RUN_TYPE")) {
509 for (Int_t iRun = 0; iRun < kRunMax; iRun++) {
510 if (strcmp(gSystem->Getenv("CONFIG_RUN_TYPE"), pprRunName[iRun])==0) {
511 proc = (PDC06Proc_t)iRun;
512 cout<<"Run type set to "<<pprRunName[iRun]<<endl;
518 if (gSystem->Getenv("CONFIG_FIELD")) {
519 for (Int_t iField = 0; iField < kFieldMax; iField++) {
520 if (strcmp(gSystem->Getenv("CONFIG_FIELD"), pprField[iField])==0) {
522 cout<<"Field set to "<<pprField[iField]<<endl;
528 if (gSystem->Getenv("CONFIG_ENERGY")) {
529 energy = atoi(gSystem->Getenv("CONFIG_ENERGY"));
530 cout<<"Energy set to "<<energy<<" GeV"<<endl;
533 // Random Number seed
534 if (gSystem->Getenv("CONFIG_SEED")) {
535 seed = atoi(gSystem->Getenv("CONFIG_SEED"));