File indexing completed on 2025-01-30 09:17:45
0001 #include "DD4hep/Printout.h"
0002 #include "DDG4/Geant4Config.h"
0003
0004 using namespace std;
0005 using namespace dd4hep;
0006 using namespace dd4hep::sim::Setup;
0007
0008 int setupG4_CINT() {
0009 typedef dd4hep::sim::Geant4Kernel Kernel;
0010 Kernel& kernel = Kernel::instance(dd4hep::Detector::getInstance());
0011 string install_dir = getenv("DD4hepINSTALL");
0012 string ddg4_examples = install_dir+"/examples/DDG4/examples";
0013 char text[256];
0014
0015
0016 kernel.loadGeometry(("file:"+install_dir+"/examples/ClientTests/compact/IronCylinder.xml").c_str());
0017 kernel.loadXML(("file:"+ddg4_examples+"/DDG4_field.xml").c_str());
0018 kernel.setOutputLevel("Geant4Converter",DEBUG);
0019 kernel.setOutputLevel("RootOutput",INFO);
0020 kernel.setOutputLevel("ShellHandler",DEBUG);
0021 kernel.setOutputLevel("Gun",INFO);
0022 kernel.property("UI") = "UI";
0023 kernel.printProperties();
0024
0025
0026 Action ui(kernel,"Geant4UIManager/UI");
0027 ui["HaveVIS"] = true;
0028 ui["HaveUI"] = true;
0029 ui["SessionType"] = "csh";
0030 kernel.registerGlobalAction(ui);
0031
0032
0033 time_t tim;
0034 ::time(&tim);
0035 struct tm *tm = ::localtime(&tim);
0036 ::strftime(text,sizeof(text),"FCC_HCAL_%Y-%m-%d_%H-%M.root",tm);
0037 EventAction evt_root(kernel,"Geant4Output2ROOT/RootOutput");
0038 evt_root["Control"] = true;
0039 evt_root["Output"] = (const char*)text;
0040 evt_root["HandleMCTruth"] = false;
0041 evt_root->enableUI();
0042 kernel.eventAction().adopt(evt_root);
0043
0044 GenAction gun(kernel,"Geant4ParticleGun/Gun");
0045 gun["energy"] = 10.0*GeV;
0046 gun["particle"] = "pi-";
0047 gun["multiplicity"] = 1;
0048 gun["isotrop"] = true;
0049 gun->enableUI();
0050 kernel.generatorAction().adopt(gun);
0051
0052
0053 Filter f1(kernel,"GeantinoRejectFilter/GeantinoRejector");
0054 kernel.registerGlobalFilter(f1);
0055
0056
0057 SensitiveSeq seq_hc(kernel,"Geant4SensDetActionSequence/HcalBarrel");
0058 Sensitive act_hc(kernel,"Geant4SimpleCalorimeterAction/HcalBarrelHandler","HcalBarrel");
0059 seq_hc->adopt(f1);
0060 seq_hc->adopt(act_hc);
0061
0062 SensitiveSeq seq_cs(kernel,"Geant4SensDetActionSequence/ContainmentShell");
0063 Sensitive act_cs(kernel,"Geant4EscapeCounter/ShellHandler","ContainmentShell");
0064 seq_cs->adopt(act_cs);
0065
0066
0067 printout(INFO,"FCC_Hcal","PhysicsList:%p",&kernel.physicsList());
0068 PhysicsActionSeq phys(&kernel.physicsList());
0069 phys["extends"] = "QGSP_BERT";
0070 phys->enableUI();
0071 phys->dump();
0072
0073 kernel.configure();
0074 kernel.initialize();
0075 kernel.run();
0076 printout(INFO,"FCC_Hcal","Successfully executed application .... ");
0077 kernel.terminate();
0078 return 0;
0079 }
0080
0081 #if defined(G__DICTIONARY) || defined(__CINT__) || defined(__MAKECINT__)
0082 int FCC_Hcal()
0083 #else
0084 int main(int, char**)
0085 #endif
0086 {
0087 return setupG4_CINT();
0088 }