3 // Configuration for the Geant4 production 2010
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 "PYTHIA6/AliGenPythia.h"
19 #include "TDPMjet/AliGenDPMjet.h"
20 #include "STEER/AliMagFCheb.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/AliITSv11Hybrid.h"
30 #include "TPC/AliTPCv2.h"
31 #include "TOF/AliTOFv6T0.h"
32 #include "HMPID/AliHMPIDv3.h"
33 #include "ZDC/AliZDCv3.h"
34 #include "TRD/AliTRDv1.h"
35 #include "TRD/AliTRDgeometry.h"
36 #include "FMD/AliFMDv1.h"
37 #include "MUON/AliMUONv1.h"
38 #include "PHOS/AliPHOSv1.h"
39 #include "PHOS/AliPHOSSimParam.h"
40 #include "PMD/AliPMDv1.h"
41 #include "T0/AliT0v1.h"
42 #include "EMCAL/AliEMCALv2.h"
43 #include "ACORDE/AliACORDEv1.h"
44 #include "VZERO/AliVZEROv7.h"
50 kPythia6, kPythia6D6T, kPythia6ATLAS, kPythia6ATLAS_Flat, kPythiaPerugia0, kPhojet, kRunMax
53 const char * pprRunName[] = {
54 "kPythia6", "kPythia6D6T", "kPythia6ATLAS", "kPythia6ATLAS_Flat", "kPythiaPerugia0", "kPhojet"
59 kNoField, k5kG, kFieldMax
62 const char * pprField[] = {
68 QGSP_BERT_EMV,CHIPS,QGSP_BERT_CHIPS,QGSP_BERT_EMV_OPTICAL, CHIPS_OPTICAL, QGSP_BERT_CHIPS_OPTICAL, kListMax
71 const char * physicsListName[] = {
72 "QGSP_BERT_EMV", "CHIPS", "QGSP_BERT_CHIPS",
73 "QGSP_BERT_EMV_OPTICAL", "CHIPS_OPTICAL", "QGSP_BERT_CHIPS_OPTICAL"
78 kDefaultPPTrig, kDefaultPbPbTrig
81 const char * pprTrigConfName[] = {
87 AliGenerator *MbPythia();
88 AliGenerator *MbPythiaTuneD6T();
89 AliGenerator *MbPhojet();
90 void ProcessEnvironmentVars();
92 // Geterator, field, beam energy
93 static PDC06Proc_t proc = kPhojet;
94 static Mag_t mag = k5kG;
95 static Float_t energy = 10000; // energy in CMS
96 static Int_t runNumber = 0;
97 static PprTrigConf_t strig = kDefaultPPTrig; // default pp trigger configuration
98 static PhysicsList_t physicslist = QGSP_BERT_EMV;
100 //========================//
101 // Set Random Number seed //
102 //========================//
104 static UInt_t seed = dt.Get();
107 static TString comment;
113 // Get settings from environment variables
114 ProcessEnvironmentVars();
116 gRandom->SetSeed(seed);
117 cerr<<"Seed for random number generation= "<<seed<<endl;
119 // Libraries required by geant321
120 #if defined(__CINT__)
121 gSystem->Load("liblhapdf"); // Parton density functions
122 gSystem->Load("libEGPythia6"); // TGenerator interface
123 if (proc == kPythia6 || proc == kPhojet) {
124 gSystem->Load("libpythia6"); // Pythia 6.2
126 gSystem->Load("libpythia6.4.21"); // Pythia 6.4
128 gSystem->Load("libAliPythia6"); // ALICE specific implementations
129 // gSystem->Load("libgeant321");
132 // new TGeant3TGeo("C++ Interface to Geant3");
134 //=======================================================================
135 // Create the output file
138 AliRunLoader* rl=0x0;
140 cout<<"Config.C: Creating Run Loader ..."<<endl;
141 rl = AliRunLoader::Open("galice.root",
142 AliConfig::GetDefaultEventFolderName(),
146 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
149 rl->SetCompressionLevel(2);
150 rl->SetNumberOfEventsPerFile(1000);
151 gAlice->SetRunLoader(rl);
152 // gAlice->SetGeometryFromFile("geometry.root");
153 // gAlice->SetGeometryFromCDB();
155 // Set the trigger configuration: proton-proton
157 AliSimulation::Instance()->SetTriggerConfig(pprTrigConfName[strig]);
158 cout <<"Trigger configuration is set to "<<pprTrigConfName[strig]<<endl;
186 //=================== Alice BODY parameters =============================
187 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
192 //=================== MAG parameters ============================
193 // --- Start with Magnet since detector layouts may be depending ---
194 // --- on the selected Magnet dimensions ---
195 AliMAG *MAG = new AliMAG("MAG", "Magnet");
201 //=================== ABSO parameters ============================
202 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
207 //=================== DIPO parameters ============================
209 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
214 //=================== HALL parameters ============================
216 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
222 //=================== FRAME parameters ============================
224 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
230 //=================== SHIL parameters ============================
232 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
238 //=================== PIPE parameters ============================
240 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
245 //=================== ITS parameters ============================
247 AliITS *ITS = new AliITSv11Hybrid("ITS","ITS v11Hybrid");
252 //============================ TPC parameters =====================
254 AliTPC *TPC = new AliTPCv2("TPC", "Default");
255 TPC->SetPrimaryIonisation();// not used with Geant3
260 //=================== TOF parameters ============================
262 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
268 //=================== HMPID parameters ===========================
270 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
277 //=================== ZDC parameters ============================
279 AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
280 //Collimators aperture
281 ZDC->SetVCollSideCAperture(0.85);
282 ZDC->SetVCollSideCCentre(0.);
283 ZDC->SetVCollSideAAperture(0.75);
284 ZDC->SetVCollSideACentre(0.);
294 //=================== TRD parameters ============================
296 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
297 AliTRDgeometry *geoTRD = TRD->GetGeometry();
298 // Partial geometry: modules at 0,1,7,8,9,16,17
299 // starting at 3h in positive direction
300 geoTRD->SetSMstatus(2,0);
301 geoTRD->SetSMstatus(3,0);
302 geoTRD->SetSMstatus(4,0);
303 geoTRD->SetSMstatus(5,0);
304 geoTRD->SetSMstatus(6,0);
305 geoTRD->SetSMstatus(11,0);
306 geoTRD->SetSMstatus(12,0);
307 geoTRD->SetSMstatus(13,0);
308 geoTRD->SetSMstatus(14,0);
309 geoTRD->SetSMstatus(15,0);
310 geoTRD->SetSMstatus(16,0);
315 //=================== FMD parameters ============================
317 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
322 //=================== MUON parameters ===========================
323 // New MUONv1 version (geometry defined via builders)
324 AliMUON *MUON = new AliMUONv1("MUON", "default");
325 // activate trigger efficiency by cells
326 MUON->SetTriggerEffCells(1);
331 //=================== PHOS parameters ===========================
333 AliPHOS *PHOS = new AliPHOSv1("PHOS", "noCPV_Modules123");
340 //=================== PMD parameters ============================
342 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
347 //=================== T0 parameters ============================
348 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
353 //=================== EMCAL parameters ============================
355 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_FIRSTYEARV1");
360 //=================== ACORDE parameters ============================
362 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
367 //=================== ACORDE parameters ============================
369 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
373 // Load Geant4 + Geant4 VMC libraries
375 if (gClassTable->GetID("TGeant4") == -1) {
376 TString g4libsMacro = "$G4INSTALL/macro/g4libs.C";
377 //TString g4libsMacro = "$ALICE/geant4_vmc/examples/macro/g4libs.C";
378 //Load Geant4 libraries
379 if (!gInterpreter->IsLoaded(g4libsMacro.Data())) {
380 gROOT->LoadMacro(g4libsMacro.Data());
381 gInterpreter->ProcessLine("g4libs()");
390 TG4RunConfiguration* runConfiguration=0x0;
391 for (Int_t iList = 0; iList < kListMax; iList++) {
392 if(iList<kListMax/2){
393 if(physicslist == iList){
395 new TG4RunConfiguration("geomRoot",
396 physicsListName[iList],
397 "specialCuts+stackPopper+stepLimiter",
401 else if(iList>=kListMax/2){//add "optical" PL to HadronPhysicsList
402 if(physicslist == iList){
404 new TG4RunConfiguration("geomRoot",
405 Form("%s+optical",physicsListName[iList-kListMax/2]),
406 "specialCuts+stackPopper+stepLimiter",
411 geant4 = new TGeant4("TGeant4", "The Geant4 Monte Carlo", runConfiguration);
412 cout << "Geant4 has been created." << endl;
415 cout << "Monte Carlo has been already created." << endl;
420 // Customization of Geant4 VMC
422 geant4->ProcessGeantCommand("/mcVerbose/all 1");
423 geant4->ProcessGeantCommand("/mcVerbose/geometryManager 1");
424 geant4->ProcessGeantCommand("/mcVerbose/opGeometryManager 1");
425 geant4->ProcessGeantCommand("/mcTracking/loopVerbose 1");
426 geant4->ProcessGeantCommand("/mcPhysics/rangeCuts 0.01 mm");
427 geant4->ProcessGeantCommand("/mcPhysics/selectOpProcess Scintillation");
428 geant4->ProcessGeantCommand("/mcPhysics/setOpProcessActivation false");
429 geant4->ProcessGeantCommand("/mcVerbose/composedPhysicsList 2");
430 geant4->ProcessGeantCommand("/mcTracking/skipNeutrino true");
431 // geant4->ProcessGeantCommand("/mcDet/setMaxStepInLowDensityMaterials 1 cm");
435 //=======================================================================
436 // ************* STEERING parameters FOR ALICE SIMULATION **************
437 // --- Specify event type to be tracked through the ALICE setup
438 // --- All positions are in cm, angles in degrees, and P and E in GeV
441 gMC->SetProcess("DCAY",1);
442 gMC->SetProcess("PAIR",1);
443 gMC->SetProcess("COMP",1);
444 gMC->SetProcess("PHOT",1);
445 gMC->SetProcess("PFIS",0);
446 gMC->SetProcess("DRAY",0);
447 gMC->SetProcess("ANNI",1);
448 gMC->SetProcess("BREM",1);
449 gMC->SetProcess("MUNU",1);
450 gMC->SetProcess("CKOV",1);
451 gMC->SetProcess("HADR",1);
452 gMC->SetProcess("LOSS",2);
453 gMC->SetProcess("MULS",1);
454 gMC->SetProcess("RAYL",1);
456 Float_t cut = 1.e-3; // 1MeV cut by default
457 Float_t tofmax = 1.e10;
459 gMC->SetCut("CUTGAM", cut);
460 gMC->SetCut("CUTELE", cut);
461 gMC->SetCut("CUTNEU", cut);
462 gMC->SetCut("CUTHAD", cut);
463 gMC->SetCut("CUTMUO", cut);
464 gMC->SetCut("BCUTE", cut);
465 gMC->SetCut("BCUTM", cut);
466 gMC->SetCut("DCUTE", cut);
467 gMC->SetCut("DCUTM", cut);
468 gMC->SetCut("PPCUTM", cut);
469 gMC->SetCut("TOFMAX", tofmax);
474 //======================//
475 // Set External decayer //
476 //======================//
477 TVirtualMCDecayer* decayer = new AliDecayerPythia();
478 decayer->SetForceDecay(kAll);
480 gMC->SetExternalDecayer(decayer);
482 //=========================//
483 // Generator Configuration //
484 //=========================//
485 AliGenerator* gener = 0x0;
487 if (proc == kPythia6) {
489 } else if (proc == kPythia6D6T) {
490 gener = MbPythiaTuneD6T();
491 } else if (proc == kPythia6ATLAS) {
492 gener = MbPythiaTuneATLAS();
493 } else if (proc == kPythiaPerugia0) {
494 gener = MbPythiaTunePerugia0();
495 } else if (proc == kPythia6ATLAS_Flat) {
496 gener = MbPythiaTuneATLAS_Flat();
497 } else if (proc == kPhojet) {
504 // Size of the interaction diamond
506 Float_t sigmaz = 5.4 / TMath::Sqrt(2.); // [cm]
508 //sigmaz = 10.5 / TMath::Sqrt(2.); // [cm]
511 sigmaz = 6.3 / TMath::Sqrt(2.); // [cm]
517 Float_t betast = 10.0; // beta* [m]
518 if (runNumber >= 117048) betast = 2.0;
519 if (runNumber > 122375) betast = 3.5; // starting with fill 1179
522 Float_t eps = 5.0e-6; // emittance [m]
523 Float_t gamma = energy / 2.0 / 0.938272; // relativistic gamma [1]
524 Float_t sigmaxy = TMath::Sqrt(eps * betast / gamma) / TMath::Sqrt(2.) * 100.; // [cm]
525 printf("\n \n Diamond size x-y: %10.3e z: %10.3e\n \n", sigmaxy, sigmaz);
527 gener->SetSigma(sigmaxy, sigmaxy, sigmaz); // Sigma in (X,Y,Z) (cm) on IP position
528 gener->SetVertexSmear(kPerEvent);
531 printf("\n \n Comment: %s \n \n", comment.Data());
539 AliGenerator* MbPythia()
541 comment = comment.Append(" pp: Pythia low-pt");
544 AliGenPythia* pythia = new AliGenPythia(-1);
545 pythia->SetMomentumRange(0, 999999.);
546 pythia->SetThetaRange(0., 180.);
547 pythia->SetYRange(-12.,12.);
548 pythia->SetPtRange(0,1000.);
549 pythia->SetProcess(kPyMb);
550 pythia->SetEnergyCMS(energy);
555 AliGenerator* MbPythiaTuneD6T()
557 comment = comment.Append(" pp: Pythia low-pt");
560 AliGenPythia* pythia = new AliGenPythia(-1);
561 pythia->SetMomentumRange(0, 999999.);
562 pythia->SetThetaRange(0., 180.);
563 pythia->SetYRange(-12.,12.);
564 pythia->SetPtRange(0,1000.);
565 pythia->SetProcess(kPyMb);
566 pythia->SetEnergyCMS(energy);
568 // 109 D6T : Rick Field's CDF Tune D6T (NB: needs CTEQ6L pdfs externally)
569 pythia->SetTune(109); // F I X
570 pythia->SetStrucFunc(kCTEQ6l);
575 AliGenerator* MbPythiaTunePerugia0()
577 comment = comment.Append(" pp: Pythia low-pt (Perugia0)");
580 AliGenPythia* pythia = new AliGenPythia(-1);
581 pythia->SetMomentumRange(0, 999999.);
582 pythia->SetThetaRange(0., 180.);
583 pythia->SetYRange(-12.,12.);
584 pythia->SetPtRange(0,1000.);
585 pythia->SetProcess(kPyMb);
586 pythia->SetEnergyCMS(energy);
589 pythia->SetTune(320);
590 pythia->UseNewMultipleInteractionsScenario();
591 pythia->SetCrossingAngle(0,0.000280);
598 AliGenerator* MbPythiaTuneATLAS()
600 comment = comment.Append(" pp: Pythia low-pt");
603 AliGenPythia* pythia = new AliGenPythia(-1);
604 pythia->SetMomentumRange(0, 999999.);
605 pythia->SetThetaRange(0., 180.);
606 pythia->SetYRange(-12.,12.);
607 pythia->SetPtRange(0,1000.);
608 pythia->SetProcess(kPyMb);
609 pythia->SetEnergyCMS(energy);
611 // C 306 ATLAS-CSC: Arthur Moraes' (new) ATLAS tune (needs CTEQ6L externally)
612 pythia->SetTune(306);
613 pythia->SetStrucFunc(kCTEQ6l);
618 AliGenerator* MbPythiaTuneATLAS_Flat()
620 AliGenPythia* pythia = MbPythiaTuneATLAS();
622 comment = comment.Append("; flat multiplicity distribution");
624 // set high multiplicity trigger
625 // this weight achieves a flat multiplicity distribution
628 0.234836, 0.103484, 0.00984802, 0.0199906, 0.0260018, 0.0208481, 0.0101477, 0.00146998, -0.00681513, -0.0114928,
629 -0.0113352, -0.0102012, -0.00895238, -0.00534961, -0.00261648, -0.000819048, 0.00130816, 0.00177978, 0.00373838, 0.00566255,
630 0.00628156, 0.00687458, 0.00668017, 0.00702917, 0.00810848, 0.00876167, 0.00832783, 0.00848518, 0.0107709, 0.0106849,
631 0.00933702, 0.00912525, 0.0106553, 0.0102785, 0.0101756, 0.010962, 0.00957103, 0.00970448, 0.0117133, 0.012271,
632 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113,
633 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113,
634 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113,
635 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113,
636 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113,
637 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113, 0.0113,
638 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
639 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
644 0.00168216, 0.000743548, 0.00103125, 0.00108605, 0.00117101, 0.00124577, 0.00129119, 0.00128341, 0.00121421, 0.00112431,
645 0.00100588, 0.000895078, 0.000790314, 0.000711673, 0.000634547, 0.000589133, 0.000542763, 0.000509552, 0.000487375, 0.000468906,
646 0.000460196, 0.000455806, 0.00044843, 0.000449317, 0.00045007, 0.000458016, 0.000461167, 0.000474742, 0.00050161, 0.00051637,
647 0.000542336, 0.000558854, 0.000599169, 0.000611982, 0.000663855, 0.000696322, 0.000722825, 0.000771686, 0.000838023, 0.000908317,
648 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003,
649 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003,
650 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003,
651 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003,
652 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003,
653 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003, 0.0003,
654 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
655 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
658 TH1F *weight = new TH1F("newweight","newweight",120,-0.5,119.5);
660 weight->SetContent(cont);
661 weight->SetError(err);
663 Int_t limit = weight->GetRandom();
664 pythia->SetTriggerChargedMultiplicity(limit, 1.4);
666 comment = comment.Append(Form("; multiplicity threshold set to %d in |eta| < 1.4", limit));
671 AliGenerator* MbPhojet()
673 comment = comment.Append(" pp: Pythia low-pt");
676 #if defined(__CINT__)
677 gSystem->Load("libdpmjet"); // Parton density functions
678 gSystem->Load("libTDPMjet"); // Parton density functions
680 AliGenDPMjet* dpmjet = new AliGenDPMjet(-1);
681 dpmjet->SetMomentumRange(0, 999999.);
682 dpmjet->SetThetaRange(0., 180.);
683 dpmjet->SetYRange(-12.,12.);
684 dpmjet->SetPtRange(0,1000.);
685 dpmjet->SetProcess(kDpmMb);
686 dpmjet->SetEnergyCMS(energy);
687 dpmjet->SetCrossingAngle(0,0.000280);
691 void ProcessEnvironmentVars()
694 if (gSystem->Getenv("CONFIG_RUN_TYPE")) {
695 for (Int_t iRun = 0; iRun < kRunMax; iRun++) {
696 if (strcmp(gSystem->Getenv("CONFIG_RUN_TYPE"), pprRunName[iRun])==0) {
697 proc = (PDC06Proc_t)iRun;
698 cout<<"Run type set to "<<pprRunName[iRun]<<endl;
704 if (gSystem->Getenv("CONFIG_FIELD")) {
705 for (Int_t iField = 0; iField < kFieldMax; iField++) {
706 if (strcmp(gSystem->Getenv("CONFIG_FIELD"), pprField[iField])==0) {
708 cout<<"Field set to "<<pprField[iField]<<endl;
714 if (gSystem->Getenv("CONFIG_ENERGY")) {
715 energy = atoi(gSystem->Getenv("CONFIG_ENERGY"));
716 cout<<"Energy set to "<<energy<<" GeV"<<endl;
719 // Random Number seed
720 if (gSystem->Getenv("CONFIG_SEED")) {
721 seed = atoi(gSystem->Getenv("CONFIG_SEED"));
725 if (gSystem->Getenv("DC_RUN")) {
726 runNumber = atoi(gSystem->Getenv("DC_RUN"));
730 if (gSystem->Getenv("CONFIG_PHYSICSLIST")) {
731 for (Int_t iList = 0; iList < kListMax; iList++) {
732 if (strcmp(gSystem->Getenv("CONFIG_PHYSICSLIST"), physicsListName[iList])==0){
733 physicslist = (PhysicsList_t)iList;
734 cout<<"Physics list set to "<< physicsListName[iList]<<endl;