3 // Configuration for the Geant3 simulations as Reference to Geant4 simulations
6 #if !defined(__CINT__) || defined(__MAKECINT__)
11 #include <TVirtualMC.h>
12 #include <TGeant3TGeo.h>
13 #include "STEER/AliRunLoader.h"
14 #include "STEER/AliRun.h"
15 #include "STEER/AliConfig.h"
16 #include "PYTHIA6/AliDecayerPythia.h"
17 #include "PYTHIA6/AliGenPythia.h"
18 #include "TDPMjet/AliGenDPMjet.h"
19 #include "STEER/AliMagFCheb.h"
20 #include "STRUCT/AliBODY.h"
21 #include "STRUCT/AliMAG.h"
22 #include "STRUCT/AliABSOv3.h"
23 #include "STRUCT/AliDIPOv3.h"
24 #include "STRUCT/AliHALLv3.h"
25 #include "STRUCT/AliFRAMEv2.h"
26 #include "STRUCT/AliSHILv3.h"
27 #include "STRUCT/AliPIPEv3.h"
28 #include "ITS/AliITSv11.h"
29 #include "TPC/AliTPCv2.h"
30 #include "TOF/AliTOFv6T0.h"
31 #include "HMPID/AliHMPIDv3.h"
32 #include "ZDC/AliZDCv4.h"
33 #include "TRD/AliTRDv1.h"
34 #include "TRD/AliTRDgeometry.h"
35 #include "FMD/AliFMDv1.h"
36 #include "MUON/AliMUONv1.h"
37 #include "PHOS/AliPHOSv1.h"
38 #include "PHOS/AliPHOSSimParam.h"
39 #include "PMD/AliPMDv1.h"
40 #include "T0/AliT0v1.h"
41 #include "EMCAL/AliEMCALv2.h"
42 #include "ACORDE/AliACORDEv1.h"
43 #include "VZERO/AliVZEROv7.h"
49 kPythia6, kPythia6D6T, kPythia6ATLAS, kPythia6ATLAS_Flat, kPythiaPerugia0, kPhojet, kRunMax
52 const char * pprRunName[] = {
53 "kPythia6", "kPythia6D6T", "kPythia6ATLAS", "kPythia6ATLAS_Flat", "kPythiaPerugia0", "kPhojet"
58 kNoField, k5kG, kFieldMax
61 const char * pprField[] = {
68 kDefaultPPTrig, kDefaultPbPbTrig
71 const char * pprTrigConfName[] = {
77 AliGenerator *MbPythia();
78 AliGenerator *MbPythiaTuneD6T();
79 AliGenerator *MbPhojet();
80 void ProcessEnvironmentVars();
82 // Geterator, field, beam energy
83 static PDC06Proc_t proc = kPhojet;
84 static Mag_t mag = k5kG;
85 static Float_t energy = 10000; // energy in CMS
86 static Int_t runNumber = 0;
87 static PprTrigConf_t strig = kDefaultPPTrig; // default pp trigger configuration
88 //========================//
89 // Set Random Number seed //
90 //========================//
92 static UInt_t seed = dt.Get();
95 static TString comment;
101 // Get settings from environment variables
102 ProcessEnvironmentVars();
104 gRandom->SetSeed(seed);
105 cerr<<"Seed for random number generation= "<<seed<<endl;
107 // Libraries required by geant321
108 #if defined(__CINT__)
109 gSystem->Load("liblhapdf"); // Parton density functions
110 gSystem->Load("libEGPythia6"); // TGenerator interface
111 if (proc == kPythia6 || proc == kPhojet) {
112 gSystem->Load("libpythia6"); // Pythia 6.2
114 gSystem->Load("libpythia6.4.21"); // Pythia 6.4
116 gSystem->Load("libAliPythia6"); // ALICE specific implementations
117 gSystem->Load("libgeant321");
120 new TGeant3TGeo("C++ Interface to Geant3");
122 //=======================================================================
123 // Create the output file
126 AliRunLoader* rl=0x0;
128 cout<<"Config.C: Creating Run Loader ..."<<endl;
129 rl = AliRunLoader::Open("galice.root",
130 AliConfig::GetDefaultEventFolderName(),
134 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
137 rl->SetCompressionLevel(2);
138 rl->SetNumberOfEventsPerFile(1000);
139 gAlice->SetRunLoader(rl);
140 // gAlice->SetGeometryFromFile("geometry.root");
141 // gAlice->SetGeometryFromCDB();
143 // Set the trigger configuration: proton-proton
145 AliSimulation::Instance()->SetTriggerConfig(pprTrigConfName[strig]);
146 cout <<"Trigger configuration is set to "<<pprTrigConfName[strig]<<endl;
148 //=======================================================================
149 // ************* STEERING parameters FOR ALICE SIMULATION **************
150 // --- Specify event type to be tracked through the ALICE setup
151 // --- All positions are in cm, angles in degrees, and P and E in GeV
154 gMC->SetProcess("DCAY",1);
155 gMC->SetProcess("PAIR",1);
156 gMC->SetProcess("COMP",1);
157 gMC->SetProcess("PHOT",1);
158 gMC->SetProcess("PFIS",0);
159 gMC->SetProcess("DRAY",0);
160 gMC->SetProcess("ANNI",1);
161 gMC->SetProcess("BREM",1);
162 gMC->SetProcess("MUNU",1);
163 gMC->SetProcess("CKOV",1);
164 gMC->SetProcess("HADR",1);
165 gMC->SetProcess("LOSS",2);
166 gMC->SetProcess("MULS",1);
167 gMC->SetProcess("RAYL",1);
169 Float_t cut = 1.e-3; // 1MeV cut by default
170 Float_t tofmax = 1.e10;
172 gMC->SetCut("CUTGAM", cut);
173 gMC->SetCut("CUTELE", cut);
174 gMC->SetCut("CUTNEU", cut);
175 gMC->SetCut("CUTHAD", cut);
176 gMC->SetCut("CUTMUO", cut);
177 gMC->SetCut("BCUTE", cut);
178 gMC->SetCut("BCUTM", cut);
179 gMC->SetCut("DCUTE", cut);
180 gMC->SetCut("DCUTM", cut);
181 gMC->SetCut("PPCUTM", cut);
182 gMC->SetCut("TOFMAX", tofmax);
187 //======================//
188 // Set External decayer //
189 //======================//
190 TVirtualMCDecayer* decayer = new AliDecayerPythia();
191 decayer->SetForceDecay(kAll);
193 gMC->SetExternalDecayer(decayer);
195 //=========================//
196 // Generator Configuration //
197 //=========================//
198 AliGenerator* gener = 0x0;
200 if (proc == kPythia6) {
202 } else if (proc == kPythia6D6T) {
203 gener = MbPythiaTuneD6T();
204 } else if (proc == kPythia6ATLAS) {
205 gener = MbPythiaTuneATLAS();
206 } else if (proc == kPythiaPerugia0) {
207 gener = MbPythiaTunePerugia0();
208 } else if (proc == kPythia6ATLAS_Flat) {
209 gener = MbPythiaTuneATLAS_Flat();
210 } else if (proc == kPhojet) {
217 // Size of the interaction diamond
219 Float_t sigmaz = 5.4 / TMath::Sqrt(2.); // [cm]
221 //sigmaz = 10.5 / TMath::Sqrt(2.); // [cm]
224 sigmaz = 6.3 / TMath::Sqrt(2.); // [cm]
230 Float_t betast = 10.0; // beta* [m]
231 if (runNumber >= 117048) betast = 2.0;
232 if (runNumber > 122375) betast = 3.5; // starting with fill 1179
235 Float_t eps = 5.0e-6; // emittance [m]
236 Float_t gamma = energy / 2.0 / 0.938272; // relativistic gamma [1]
237 Float_t sigmaxy = TMath::Sqrt(eps * betast / gamma) / TMath::Sqrt(2.) * 100.; // [cm]
238 printf("\n \n Diamond size x-y: %10.3e z: %10.3e\n \n", sigmaxy, sigmaz);
240 gener->SetSigma(sigmaxy, sigmaxy, sigmaz); // Sigma in (X,Y,Z) (cm) on IP position
241 gener->SetVertexSmear(kPerEvent);
244 printf("\n \n Comment: %s \n \n", comment.Data());
271 //=================== Alice BODY parameters =============================
272 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
277 //=================== MAG parameters ============================
278 // --- Start with Magnet since detector layouts may be depending ---
279 // --- on the selected Magnet dimensions ---
280 AliMAG *MAG = new AliMAG("MAG", "Magnet");
286 //=================== ABSO parameters ============================
287 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
292 //=================== DIPO parameters ============================
294 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
299 //=================== HALL parameters ============================
301 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
307 //=================== FRAME parameters ============================
309 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
315 //=================== SHIL parameters ============================
317 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
323 //=================== PIPE parameters ============================
325 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
330 //=================== ITS parameters ============================
332 AliITS *ITS = new AliITSv11("ITS","ITS v11");
337 //============================ TPC parameters =====================
339 AliTPC *TPC = new AliTPCv2("TPC", "Default");
344 //=================== TOF parameters ============================
346 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
352 //=================== HMPID parameters ===========================
354 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
361 //=================== ZDC parameters ============================
363 AliZDC *ZDC = new AliZDCv4("ZDC", "normal ZDC");
364 //Collimators aperture
365 ZDC->SetVCollSideCAperture(0.85);
366 ZDC->SetVCollSideCCentre(0.);
367 ZDC->SetVCollSideAAperture(0.75);
368 ZDC->SetVCollSideACentre(0.);
378 //=================== TRD parameters ============================
380 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
381 AliTRDgeometry *geoTRD = TRD->GetGeometry();
382 // Partial geometry: modules at 0,1,7,8,9,16,17
383 // starting at 3h in positive direction
384 geoTRD->SetSMstatus(2,0);
385 geoTRD->SetSMstatus(3,0);
386 geoTRD->SetSMstatus(4,0);
387 geoTRD->SetSMstatus(5,0);
388 geoTRD->SetSMstatus(6,0);
389 geoTRD->SetSMstatus(11,0);
390 geoTRD->SetSMstatus(12,0);
391 geoTRD->SetSMstatus(13,0);
392 geoTRD->SetSMstatus(14,0);
393 geoTRD->SetSMstatus(15,0);
394 geoTRD->SetSMstatus(16,0);
399 //=================== FMD parameters ============================
401 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
406 //=================== MUON parameters ===========================
407 // New MUONv1 version (geometry defined via builders)
408 AliMUON *MUON = new AliMUONv1("MUON", "default");
409 // activate trigger efficiency by cells
410 MUON->SetTriggerEffCells(1);
415 //=================== PHOS parameters ===========================
417 AliPHOS *PHOS = new AliPHOSv1("PHOS", "noCPV_Modules123");
424 //=================== PMD parameters ============================
426 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
431 //=================== T0 parameters ============================
432 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
437 //=================== EMCAL parameters ============================
439 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_FIRSTYEARV1");
444 //=================== ACORDE parameters ============================
446 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
451 //=================== ACORDE parameters ============================
453 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
460 AliGenerator* MbPythia()
462 comment = comment.Append(" pp: Pythia low-pt");
465 AliGenPythia* pythia = new AliGenPythia(-1);
466 pythia->SetMomentumRange(0, 999999.);
467 pythia->SetThetaRange(0., 180.);
468 pythia->SetYRange(-12.,12.);
469 pythia->SetPtRange(0,1000.);
470 pythia->SetProcess(kPyMb);
471 pythia->SetEnergyCMS(energy);
476 AliGenerator* MbPythiaTuneD6T()
478 comment = comment.Append(" pp: Pythia low-pt");
481 AliGenPythia* pythia = new AliGenPythia(-1);
482 pythia->SetMomentumRange(0, 999999.);
483 pythia->SetThetaRange(0., 180.);
484 pythia->SetYRange(-12.,12.);
485 pythia->SetPtRange(0,1000.);
486 pythia->SetProcess(kPyMb);
487 pythia->SetEnergyCMS(energy);
489 // 109 D6T : Rick Field's CDF Tune D6T (NB: needs CTEQ6L pdfs externally)
490 pythia->SetTune(109); // F I X
491 pythia->SetStrucFunc(kCTEQ6l);
496 AliGenerator* MbPythiaTunePerugia0()
498 comment = comment.Append(" pp: Pythia low-pt (Perugia0)");
501 AliGenPythia* pythia = new AliGenPythia(-1);
502 pythia->SetMomentumRange(0, 999999.);
503 pythia->SetThetaRange(0., 180.);
504 pythia->SetYRange(-12.,12.);
505 pythia->SetPtRange(0,1000.);
506 pythia->SetProcess(kPyMb);
507 pythia->SetEnergyCMS(energy);
510 pythia->SetTune(320);
511 pythia->UseNewMultipleInteractionsScenario();
512 pythia->SetCrossingAngle(0,0.000280);
519 AliGenerator* MbPythiaTuneATLAS()
521 comment = comment.Append(" pp: Pythia low-pt");
524 AliGenPythia* pythia = new AliGenPythia(-1);
525 pythia->SetMomentumRange(0, 999999.);
526 pythia->SetThetaRange(0., 180.);
527 pythia->SetYRange(-12.,12.);
528 pythia->SetPtRange(0,1000.);
529 pythia->SetProcess(kPyMb);
530 pythia->SetEnergyCMS(energy);
532 // C 306 ATLAS-CSC: Arthur Moraes' (new) ATLAS tune (needs CTEQ6L externally)
533 pythia->SetTune(306);
534 pythia->SetStrucFunc(kCTEQ6l);
539 AliGenerator* MbPythiaTuneATLAS_Flat()
541 AliGenPythia* pythia = MbPythiaTuneATLAS();
543 comment = comment.Append("; flat multiplicity distribution");
545 // set high multiplicity trigger
546 // this weight achieves a flat multiplicity distribution
549 0.234836, 0.103484, 0.00984802, 0.0199906, 0.0260018, 0.0208481, 0.0101477, 0.00146998, -0.00681513, -0.0114928,
550 -0.0113352, -0.0102012, -0.00895238, -0.00534961, -0.00261648, -0.000819048, 0.00130816, 0.00177978, 0.00373838, 0.00566255,
551 0.00628156, 0.00687458, 0.00668017, 0.00702917, 0.00810848, 0.00876167, 0.00832783, 0.00848518, 0.0107709, 0.0106849,
552 0.00933702, 0.00912525, 0.0106553, 0.0102785, 0.0101756, 0.010962, 0.00957103, 0.00970448, 0.0117133, 0.012271,
553 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113,
554 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113,
555 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113,
556 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113,
557 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113,
558 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113,
559 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
560 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
565 0.00168216, 0.000743548, 0.00103125, 0.00108605, 0.00117101, 0.00124577, 0.00129119, 0.00128341, 0.00121421, 0.00112431,
566 0.00100588, 0.000895078, 0.000790314, 0.000711673, 0.000634547, 0.000589133, 0.000542763, 0.000509552, 0.000487375, 0.000468906,
567 0.000460196, 0.000455806, 0.00044843, 0.000449317, 0.00045007, 0.000458016, 0.000461167, 0.000474742, 0.00050161, 0.00051637,
568 0.000542336, 0.000558854, 0.000599169, 0.000611982, 0.000663855, 0.000696322, 0.000722825, 0.000771686, 0.000838023, 0.000908317,
569 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003,
570 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003,
571 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003,
572 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003,
573 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003,
574 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003,
575 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
576 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
579 TH1F *weight = new TH1F("newweight","newweight",120,-0.5,119.5);
581 weight->SetContent(cont);
582 weight->SetError(err);
584 Int_t limit = weight->GetRandom();
585 pythia->SetTriggerChargedMultiplicity(limit, 1.4);
587 comment = comment.Append(Form("; multiplicity threshold set to %d in |eta| < 1.4", limit));
592 AliGenerator* MbPhojet()
594 comment = comment.Append(" pp: Pythia low-pt");
597 #if defined(__CINT__)
598 gSystem->Load("libDPMJET"); // Parton density functions
599 gSystem->Load("libTDPMjet"); // Parton density functions
601 AliGenDPMjet* dpmjet = new AliGenDPMjet(-1);
602 dpmjet->SetMomentumRange(0, 999999.);
603 dpmjet->SetThetaRange(0., 180.);
604 dpmjet->SetYRange(-12.,12.);
605 dpmjet->SetPtRange(0,1000.);
606 dpmjet->SetProcess(kDpmMb);
607 dpmjet->SetEnergyCMS(energy);
608 dpmjet->SetCrossingAngle(0,0.000280);
612 void ProcessEnvironmentVars()
615 if (gSystem->Getenv("CONFIG_RUN_TYPE")) {
616 for (Int_t iRun = 0; iRun < kRunMax; iRun++) {
617 if (strcmp(gSystem->Getenv("CONFIG_RUN_TYPE"), pprRunName[iRun])==0) {
618 proc = (PDC06Proc_t)iRun;
619 cout<<"Run type set to "<<pprRunName[iRun]<<endl;
625 if (gSystem->Getenv("CONFIG_FIELD")) {
626 for (Int_t iField = 0; iField < kFieldMax; iField++) {
627 if (strcmp(gSystem->Getenv("CONFIG_FIELD"), pprField[iField])==0) {
629 cout<<"Field set to "<<pprField[iField]<<endl;
635 if (gSystem->Getenv("CONFIG_ENERGY")) {
636 energy = atoi(gSystem->Getenv("CONFIG_ENERGY"));
637 cout<<"Energy set to "<<energy<<" GeV"<<endl;
640 // Random Number seed
641 if (gSystem->Getenv("CONFIG_SEED")) {
642 seed = atoi(gSystem->Getenv("CONFIG_SEED"));
646 if (gSystem->Getenv("DC_RUN")) {
647 runNumber = atoi(gSystem->Getenv("DC_RUN"));