diff --git a/DDG4/examples/CLICSidAClick.C b/DDG4/examples/CLICSidAClick.C index f2f26a3269bb87ba0eb0ffb8f6d671b90a5ca187..ff2a7f3242bf413c6ba470fe07f7f84e3ccc5ccd 100644 --- a/DDG4/examples/CLICSidAClick.C +++ b/DDG4/examples/CLICSidAClick.C @@ -1,3 +1,24 @@ +// $Id: Geant4Data.h 513 2013-04-05 14:31:53Z gaede $ +//==================================================================== +// AIDA Detector description implementation +//-------------------------------------------------------------------- +// +// Run Geant4 using DDG4 from root prompt with test objects for +// Run/Event/Sensitive actions. +// +// The Geant4 setup is programmed as a root script. +// +// Usage: +// $> root.exe +// root[0] .x <installation-directory>/examples/DDG4/examples/initAClick.C +// root[1] .L <installation-directory>/examples/DDG4/examples/CLICSidAClick.C+ +// root[2] CLICSidAClick() +// +// +// Author : M.Frank +// +//==================================================================== + #include "DDG4/Geant4Config.h" #include "DDG4/Geant4TestActions.h" diff --git a/DDG4/examples/CLICSidSimu.py b/DDG4/examples/CLICSidSimu.py index 4642ca2be267c8d71108deef2f16a77989c2938a..8244bec6b768bc64ffde1120531cf899099ea2dc 100644 --- a/DDG4/examples/CLICSidSimu.py +++ b/DDG4/examples/CLICSidSimu.py @@ -54,20 +54,10 @@ def run(): gen = DDG4.GeneratorAction(kernel,"Geant4GeneratorActionInit/GenerationInit") kernel.generatorAction().adopt(gen) - #VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV - """ - Generation of isotrope tracks using the DDG4 partcle gun: - - # Setup particle gun - gun = simple.setupGun('Gun','pi-',energy=10*GeV,isotrop=True,multiplicity=1) - gun.OutputLevel = 5 # generator_output_level - gun.Mask = 1 - #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - """ - #VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV """ Generation of isotrope tracks of a given multiplicity with overlay: + """ # First particle generator: pi+ gen = DDG4.GeneratorAction(kernel,"Geant4IsotropeGenerator/IsotropPi+"); @@ -97,57 +87,6 @@ def run(): gen.Sigma = (12*mm, 8*mm, 8*mm, 0*ns) kernel.generatorAction().adopt(gen) #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - """ - - #VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV - """ - Generation of primary particles from LCIO input files - """ - # First particle file reader - gen = DDG4.GeneratorAction(kernel,"LCIOInputAction/LCIO1"); - #gen.Input = "LCIOStdHepReader|/home/frankm/SW/data/e2e2nn_gen_1343_1.stdhep" - #gen.Input = "LCIOStdHepReader|/home/frankm/SW/data/qq_gen_128_999.stdhep" - #gen.Input = "LCIOStdHepReader|/home/frankm/SW/data/smuonLR_PointK_3TeV_BS_noBkg_run0001.stdhep" - #gen.Input = "LCIOStdHepReader|/home/frankm/SW/data/bbbb_3TeV.stdhep" - #gen.Input = "LCIOFileReader|/home/frankm/SW/data/mcparticles_pi-_5GeV.slcio" - #gen.Input = "LCIOFileReader|/home/frankm/SW/data/mcparticles_mu-_5GeV.slcio" - #gen.Input = "LCIOFileReader|/home/frankm/SW/data/bbbb_3TeV.slcio" - #gen.Input = "LCIOStdHepReader|/home/frankm/SW/data/FCC-eh.stdhep" - gen.Input = "Geant4EventReaderHepMC|/home/frankm/SW/data/data.hepmc.txt" - gen.Input = "Geant4EventReaderHepMC|/home/frankm/SW/data/sherpa-2.1.1_zjets.hepmc2g" - gen.OutputLevel = 4 # generator_output_level - gen.MomentumScale = 1.0 - gen.Mask = 1 - gen.enableUI() - kernel.generatorAction().adopt(gen) - # Install vertex smearing for this interaction - gen = DDG4.GeneratorAction(kernel,"Geant4InteractionVertexSmear/Smear1"); - gen.OutputLevel = 4 #generator_output_level - gen.Mask = 1 - gen.Offset = (-20*mm, -10*mm, -10*mm, 0*ns) - gen.Sigma = (12*mm, 8*mm, 8*mm, 0*ns) - gen.enableUI() - kernel.generatorAction().adopt(gen) - """ - # Second particle file reader - gen = DDG4.GeneratorAction(kernel,"LCIOInputAction/LCIO2"); - gen.Input = "LCIOStdHepReader|/home/frankm/SW/data/e2e2nn_gen_1343_2.stdhep" - #gen.Input = "LCIOStdHepReader|/home/frankm/SW/data/bbnn_3TeV_01.stdhep" - gen.OutputLevel = 4 # generator_output_level - gen.Mask = 2 - gen.MomentumScale = 0.1 - gen.enableUI() - kernel.generatorAction().adopt(gen) - # Install vertex smearing for this interaction - gen = DDG4.GeneratorAction(kernel,"Geant4InteractionVertexSmear/Smear2"); - gen.OutputLevel = generator_output_level - gen.Mask = 2 - gen.Offset = (20*mm, 10*mm, 10*mm, 0*ns) - gen.Sigma = (2*mm, 1*mm, 1*mm, 0*ns) - gen.enableUI() - kernel.generatorAction().adopt(gen) - """ - #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # Merge all existing interaction records gen = DDG4.GeneratorAction(kernel,"Geant4InteractionMerger/InteractionMerger") @@ -175,16 +114,6 @@ def run(): user.enableUI() part.adopt(user) - """ - rdr = DDG4.GeneratorAction(kernel,"LcioGeneratorAction/Reader") - rdr.zSpread = 0.0 - rdr.lorentzAngle = 0.0 - rdr.OutputLevel = DDG4.OutputLevel.INFO - rdr.Input = "LcioEventReader|test.data" - rdr.enableUI() - kernel.generatorAction().adopt(rdr) - """ - # Setup global filters fur use in sensntive detectors f1 = DDG4.Filter(kernel,'GeantinoRejectFilter/GeantinoRejector') f2 = DDG4.Filter(kernel,'ParticleRejectFilter/OpticalPhotonRejector') diff --git a/DDG4/examples/CLICSidSimuMarkus.py b/DDG4/examples/CLICSidSimuMarkus.py new file mode 100644 index 0000000000000000000000000000000000000000..4642ca2be267c8d71108deef2f16a77989c2938a --- /dev/null +++ b/DDG4/examples/CLICSidSimuMarkus.py @@ -0,0 +1,246 @@ +# +# +import os, time, DDG4 +from DDG4 import OutputLevel as Output +from SystemOfUnits import * +# +# +""" + + DD4hep simulation example setup using the python configuration + + @author M.Frank + @version 1.0 + +""" +def run(): + kernel = DDG4.Kernel() + lcdd = kernel.lcdd() + install_dir = os.environ['DD4hepINSTALL'] + example_dir = install_dir+'/examples/DDG4/examples'; + kernel.loadGeometry("file:"+install_dir+"/examples/CLICSiD/compact/compact.xml") + kernel.loadXML("file:"+example_dir+"/DDG4_field.xml") + DDG4.importConstants(lcdd) + + simple = DDG4.Simple(kernel) + simple.printDetectors() + # Configure UI + simple.setupCshUI() + + # Configure Run actions + run1 = DDG4.RunAction(kernel,'Geant4TestRunAction/RunInit') + run1.Property_int = 12345 + run1.Property_double = -5e15*keV + run1.Property_string = 'Startrun: Hello_2' + print run1.Property_string, run1.Property_double, run1.Property_int + run1.enableUI() + kernel.registerGlobalAction(run1) + kernel.runAction().adopt(run1) + + # Configure Event actions + prt = DDG4.EventAction(kernel,'Geant4ParticlePrint/ParticlePrint') + prt.OutputLevel = Output.INFO + prt.OutputType = 3 # Print both: table and tree + kernel.eventAction().adopt(prt) + + # Configure I/O + evt_lcio = simple.setupLCIOOutput('LcioOutput','CLICSiD_'+time.strftime('%Y-%m-%d_%H-%M')) + evt_lcio.OutputLevel = Output.ERROR + + evt_root = simple.setupROOTOutput('RootOutput','CLICSiD_'+time.strftime('%Y-%m-%d_%H-%M')) + + generator_output_level = Output.INFO + + gen = DDG4.GeneratorAction(kernel,"Geant4GeneratorActionInit/GenerationInit") + kernel.generatorAction().adopt(gen) + + #VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV + """ + Generation of isotrope tracks using the DDG4 partcle gun: + + # Setup particle gun + gun = simple.setupGun('Gun','pi-',energy=10*GeV,isotrop=True,multiplicity=1) + gun.OutputLevel = 5 # generator_output_level + gun.Mask = 1 + #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + """ + + #VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV + """ + Generation of isotrope tracks of a given multiplicity with overlay: + + # First particle generator: pi+ + gen = DDG4.GeneratorAction(kernel,"Geant4IsotropeGenerator/IsotropPi+"); + gen.Particle = 'pi+' + gen.Energy = 100 * GeV + gen.Multiplicity = 2 + gen.Mask = 1 + kernel.generatorAction().adopt(gen) + # Install vertex smearing for this interaction + gen = DDG4.GeneratorAction(kernel,"Geant4InteractionVertexSmear/SmearPi+"); + gen.Mask = 1 + gen.Offset = (20*mm, 10*mm, 10*mm, 0*ns) + gen.Sigma = (4*mm, 1*mm, 1*mm, 0*ns) + kernel.generatorAction().adopt(gen) + + # Second particle generator: e- + gen = DDG4.GeneratorAction(kernel,"Geant4IsotropeGenerator/IsotropE-"); + gen.Particle = 'e-' + gen.Energy = 25 * GeV + gen.Multiplicity = 3 + gen.Mask = 2 + kernel.generatorAction().adopt(gen) + # Install vertex smearing for this interaction + gen = DDG4.GeneratorAction(kernel,"Geant4InteractionVertexSmear/SmearE-"); + gen.Mask = 2 + gen.Offset = (-20*mm, -10*mm, -10*mm, 0*ns) + gen.Sigma = (12*mm, 8*mm, 8*mm, 0*ns) + kernel.generatorAction().adopt(gen) + #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + """ + + #VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV + """ + Generation of primary particles from LCIO input files + """ + # First particle file reader + gen = DDG4.GeneratorAction(kernel,"LCIOInputAction/LCIO1"); + #gen.Input = "LCIOStdHepReader|/home/frankm/SW/data/e2e2nn_gen_1343_1.stdhep" + #gen.Input = "LCIOStdHepReader|/home/frankm/SW/data/qq_gen_128_999.stdhep" + #gen.Input = "LCIOStdHepReader|/home/frankm/SW/data/smuonLR_PointK_3TeV_BS_noBkg_run0001.stdhep" + #gen.Input = "LCIOStdHepReader|/home/frankm/SW/data/bbbb_3TeV.stdhep" + #gen.Input = "LCIOFileReader|/home/frankm/SW/data/mcparticles_pi-_5GeV.slcio" + #gen.Input = "LCIOFileReader|/home/frankm/SW/data/mcparticles_mu-_5GeV.slcio" + #gen.Input = "LCIOFileReader|/home/frankm/SW/data/bbbb_3TeV.slcio" + #gen.Input = "LCIOStdHepReader|/home/frankm/SW/data/FCC-eh.stdhep" + gen.Input = "Geant4EventReaderHepMC|/home/frankm/SW/data/data.hepmc.txt" + gen.Input = "Geant4EventReaderHepMC|/home/frankm/SW/data/sherpa-2.1.1_zjets.hepmc2g" + gen.OutputLevel = 4 # generator_output_level + gen.MomentumScale = 1.0 + gen.Mask = 1 + gen.enableUI() + kernel.generatorAction().adopt(gen) + # Install vertex smearing for this interaction + gen = DDG4.GeneratorAction(kernel,"Geant4InteractionVertexSmear/Smear1"); + gen.OutputLevel = 4 #generator_output_level + gen.Mask = 1 + gen.Offset = (-20*mm, -10*mm, -10*mm, 0*ns) + gen.Sigma = (12*mm, 8*mm, 8*mm, 0*ns) + gen.enableUI() + kernel.generatorAction().adopt(gen) + """ + # Second particle file reader + gen = DDG4.GeneratorAction(kernel,"LCIOInputAction/LCIO2"); + gen.Input = "LCIOStdHepReader|/home/frankm/SW/data/e2e2nn_gen_1343_2.stdhep" + #gen.Input = "LCIOStdHepReader|/home/frankm/SW/data/bbnn_3TeV_01.stdhep" + gen.OutputLevel = 4 # generator_output_level + gen.Mask = 2 + gen.MomentumScale = 0.1 + gen.enableUI() + kernel.generatorAction().adopt(gen) + # Install vertex smearing for this interaction + gen = DDG4.GeneratorAction(kernel,"Geant4InteractionVertexSmear/Smear2"); + gen.OutputLevel = generator_output_level + gen.Mask = 2 + gen.Offset = (20*mm, 10*mm, 10*mm, 0*ns) + gen.Sigma = (2*mm, 1*mm, 1*mm, 0*ns) + gen.enableUI() + kernel.generatorAction().adopt(gen) + """ + #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + # Merge all existing interaction records + gen = DDG4.GeneratorAction(kernel,"Geant4InteractionMerger/InteractionMerger") + gen.OutputLevel = 4 #generator_output_level + gen.enableUI() + kernel.generatorAction().adopt(gen) + + # Finally generate Geant4 primaries + gen = DDG4.GeneratorAction(kernel,"Geant4PrimaryHandler/PrimaryHandler") + gen.OutputLevel = 4 #generator_output_level + gen.enableUI() + kernel.generatorAction().adopt(gen) + + # And handle the simulation particles. + part = DDG4.GeneratorAction(kernel,"Geant4ParticleHandler/ParticleHandler") + kernel.generatorAction().adopt(part) + #part.SaveProcesses = ['conv','Decay'] + part.SaveProcesses = ['Decay'] + part.MinimalKineticEnergy = 100*MeV + part.OutputLevel = 5 # generator_output_level + part.enableUI() + user = DDG4.Action(kernel,"Geant4TCUserParticleHandler/UserParticleHandler") + user.TrackingVolume_Zmax = DDG4.EcalEndcap_zmin + user.TrackingVolume_Rmax = DDG4.EcalBarrel_rmin + user.enableUI() + part.adopt(user) + + """ + rdr = DDG4.GeneratorAction(kernel,"LcioGeneratorAction/Reader") + rdr.zSpread = 0.0 + rdr.lorentzAngle = 0.0 + rdr.OutputLevel = DDG4.OutputLevel.INFO + rdr.Input = "LcioEventReader|test.data" + rdr.enableUI() + kernel.generatorAction().adopt(rdr) + """ + + # Setup global filters fur use in sensntive detectors + f1 = DDG4.Filter(kernel,'GeantinoRejectFilter/GeantinoRejector') + f2 = DDG4.Filter(kernel,'ParticleRejectFilter/OpticalPhotonRejector') + f2.particle = 'opticalphoton' + f3 = DDG4.Filter(kernel,'ParticleSelectFilter/OpticalPhotonSelector') + f3.particle = 'opticalphoton' + f4 = DDG4.Filter(kernel,'EnergyDepositMinimumCut') + f4.Cut = 10*MeV + f4.enableUI() + kernel.registerGlobalFilter(f1) + kernel.registerGlobalFilter(f2) + kernel.registerGlobalFilter(f3) + kernel.registerGlobalFilter(f4) + + # First the tracking detectors + seq,act = simple.setupTracker('SiVertexBarrel') + seq.adopt(f1) + #seq.adopt(f4) + act.adopt(f1) + + seq,act = simple.setupTracker('SiVertexEndcap') + seq.adopt(f1) + #seq.adopt(f4) + + seq,act = simple.setupTracker('SiTrackerBarrel') + seq,act = simple.setupTracker('SiTrackerEndcap') + seq,act = simple.setupTracker('SiTrackerForward') + # Now the calorimeters + seq,act = simple.setupCalorimeter('EcalBarrel') + seq,act = simple.setupCalorimeter('EcalEndcap') + seq,act = simple.setupCalorimeter('HcalBarrel') + seq,act = simple.setupCalorimeter('HcalEndcap') + seq,act = simple.setupCalorimeter('HcalPlug') + seq,act = simple.setupCalorimeter('MuonBarrel') + seq,act = simple.setupCalorimeter('MuonEndcap') + seq,act = simple.setupCalorimeter('LumiCal') + seq,act = simple.setupCalorimeter('BeamCal') + + # Now build the physics list: + phys = simple.setupPhysics('QGSP_BERT') + ph = DDG4.PhysicsList(kernel,'Geant4PhysicsList/Myphysics') + ph.addParticleConstructor('G4BosonConstructor') + ph.addParticleConstructor('G4LeptonConstructor') + ph.addParticleProcess('e[+-]','G4eMultipleScattering',-1,1,1) + ph.addPhysicsConstructor('G4OpticalPhysics') + ph.enableUI() + phys.adopt(ph) + + phys.dump() + + kernel.configure() + kernel.initialize() + + #DDG4.setPrintLevel(Output.DEBUG) + kernel.run() + kernel.terminate() + +if __name__ == "__main__": + run() diff --git a/DDG4/examples/CLICSidXML.C b/DDG4/examples/CLICSidXML.C new file mode 100644 index 0000000000000000000000000000000000000000..c9bce6c5ad3aa7c5c46e288ab04323a520e059e0 --- /dev/null +++ b/DDG4/examples/CLICSidXML.C @@ -0,0 +1,50 @@ +// $Id: Geant4Data.h 513 2013-04-05 14:31:53Z gaede $ +//==================================================================== +// AIDA Detector description implementation +//-------------------------------------------------------------------- +// +// Run Geant4 using DDG4 from root prompt with test objects for +// Run/Event/Sensitive actions. +// +// The Geant4 setup is programmed in the xml files to be parsed. Only +// the commands to parse these xml files is executed by root. +// +// Usage: +// $> root.exe +// root[0] .x <installation-directory>/examples/DDG4/examples/initAClick.C +// root[1] .L <installation-directory>/examples/DDG4/examples/CLICSidXML.C+ +// root[2] CLICSidAClick() +// +// +// Author : M.Frank +// +//==================================================================== +#include "DDG4/Geant4Config.h" +#include <iostream> + +using namespace DD4hep::Simulation::Setup; + +void setupG4_XML() { + std::string prefix = "file:../DD4hep.trunk"; + Kernel& kernel = Kernel::instance(Kernel::LCDD::getInstance()); + kernel.loadGeometry((prefix+"/DDExamples/CLICSiD/compact/compact.xml").c_str()); + kernel.loadXML((prefix+"/DDG4/examples/DDG4_field.xml").c_str()); + kernel.loadXML((prefix+"/DDG4/examples/sequences.xml").c_str()); + kernel.loadXML((prefix+"/DDG4/examples/physics.xml").c_str()); + kernel.property("UI") = "UI"; + kernel.configure(); + kernel.initialize(); + kernel.run(); + std::cout << "Successfully executed application .... " << std::endl; + kernel.terminate(); +} + +#if defined(G__DICTIONARY) || defined(__CINT__) || defined(__MAKECINT__) // Cint script +int CLICSidXML() +#else +int main(int, char**) // Main program if linked standalone +#endif +{ + setupG4_XML(); + return 1; +} diff --git a/DDG4/examples/README.txt b/DDG4/examples/README.txt index 09d38c9748d9843bceff0a05a1b2e208b5ec595b..bc39d5cfb9b908bb7cfe8c4d3c68336f4c32d7f7 100644 --- a/DDG4/examples/README.txt +++ b/DDG4/examples/README.txt @@ -1,14 +1,52 @@ DDG4 setup ---------- +Please note: +examples, which are regularly checked and should work +are +-- CLICSidAClick.C +-- CLIDSidXML.C +-- CLICSidSimu.py -Starting Geant4 as ROTO AClick ------------------------------- +Other AClick and python files are for temporary tests and are not supposed +to work 'out of the box'. + + +Starting Geant4 CLICSiD example as ROOT AClick +---------------------------------------------- - First adapt the initAClick script to fit your include/library pathes - load the script in root: .x initAClick.C - Then start the configuration in compiled mode in ROOT - .L exampleAClick.C+ - or - .L xmlAClick.C+ + .L CLICSidAClick.C+ +- See also instructions in CLICSidAClick.C + +Other AClick files are for temporary tests and are not supposed +to work under all circumstances. + +Once you get the Geant4 interactive prompt, enter: +/run/beamOn 1 +1 = number of events to be simulated. + + +Starting Geant4 CLICSiD example from XML +---------------------------------------- +- First adapt the initAClick script to fit your include/library pathes +- load the script in root: .x initAClick.C +- Then start the configuration in compiled mode in ROOT + .L CLICSidXML.C+ +- See also instructions in CLICSidXML.C + +Once you get the Geant4 interactive prompt, enter: +/run/beamOn 1 +1 = number of events to be simulated. + +If you do not want to run from the ROOT prompt, you could +also compile and link this script to a standalone main program. + + +Starting Geant4 CLICSiD example from python +-------------------------------------------- +$> python <installation-directory>/examples/DDG4/examples/CLICSidSimu.py -Note: these are examples only and do not necessarily produce -meaningful results. +Once you get the Geant4 interactive prompt, enter: +/run/beamOn 1 +1 = number of events to be simulated. diff --git a/DDG4/examples/physics.xml b/DDG4/examples/physics.xml index 3c9a206183e0c43db4e46ec5b5c41c4c9466e641..d869f19116bebc07978eb2feeaf1aaf6702b4a81 100644 --- a/DDG4/examples/physics.xml +++ b/DDG4/examples/physics.xml @@ -2,11 +2,11 @@ <geant4_setup> <!-- Definition of the physics list. - -- - -- Ordering values: - -- ordInActive = -1, // ordering parameter to indicate InActive DoIt - -- ordDefault = 1000, // default ordering parameter - -- ordLast = 9999 // ordering parameter to indicate the last DoIt + + Ordering values: + ordInActive = -1, // ordering parameter to indicate InActive DoIt + ordDefault = 1000, // default ordering parameter + ordLast = 9999 // ordering parameter to indicate the last DoIt --> <sequences> diff --git a/DDG4/examples/sequences.xml b/DDG4/examples/sequences.xml index 4d344897d83f8407617f93713828d1fa5fd3f8ad..9b455edcef3e9e667063bb60a9767800fbf76841 100644 --- a/DDG4/examples/sequences.xml +++ b/DDG4/examples/sequences.xml @@ -44,7 +44,7 @@ <action name="Geant4UIManager/UI"> <properties HaveVIS="0" HaveUI="1" - SetupUI="run.mac" + SetupUI="" SessionType="csh"/> </action> </actions> @@ -112,12 +112,14 @@ Property_string="'Hello_1'"/> </action> <action name="UserEvent_2"/> - <action name="Geant4Output2ROOT/RootOutput"> - <properties Control="true" Output="simple.root"/> - </action> +<!-- <action name="Geant4Output2LCIO/LCIOOutput"> <properties Control="true" Output="simple_lcio"/> </action> +--> + <action name="Geant4Output2ROOT/RootOutput"> + <properties Control="true" Output="simple.root"/> + </action> </sequence> <sequence name="Geant4GeneratorActionSequence/GeneratorAction"> <action name="Geant4ParticleGun/Gun"> diff --git a/DDG4/examples/xmlAClick.C b/DDG4/examples/xmlAClick.C index 1096deeeb566abc4627d41e53d84fdfe02a8d4e6..8fd6e188cbe36914a7f24458c6f92164ee39cc3e 100644 --- a/DDG4/examples/xmlAClick.C +++ b/DDG4/examples/xmlAClick.C @@ -1,48 +1,44 @@ +// $Id: Geant4Data.h 513 2013-04-05 14:31:53Z gaede $ +//==================================================================== +// AIDA Detector description implementation +//-------------------------------------------------------------------- +// +// Run Geant4 using DDG4 from root prompt with test objects for +// Run/Event/Sensitive actions. +// +// The Geant4 setup is programmed in the xml files to be parsed. Only +// the commands to parse these xml files is executed by root. +// +// Usage: +// $> root.exe +// root[0] .x <installation-directory>/examples/DDG4/examples/initAClick.C +// root[1] .L <installation-directory>/examples/DDG4/examples/CLICSidAClick.C+ +// root[2] CLICSidAClick() +// +// +// Author : M.Frank +// +//==================================================================== #include "DDG4/Geant4Config.h" -#if 0 -#include "DDG4/Geant4Handle.h" -#include "DDG4/Geant4Particle.h" -#include "DDG4/Geant4Kernel.h" -#include "DDG4/Geant4PhysicsList.h" -#include "DDG4/Geant4GeneratorAction.h" -#include "DDG4/Geant4RunAction.h" -#include "DDG4/Geant4EventAction.h" -#include "DDG4/Geant4TrackingAction.h" -#include "DDG4/Geant4SteppingAction.h" -#include "DDG4/Geant4StackingAction.h" -#include "DDG4/Geant4ActionPhase.h" -#include "DDG4/Geant4SensDetAction.h" -#include "DDG4/Geant4ParticleHandler.h" -#include "DDG4/Geant4UserParticleHandler.h" -#include "DDG4/ComponentUtils.h" -#include "DD4hep/LCDD.h" -#endif - #include <iostream> - -using namespace DD4hep; -using namespace DD4hep::Simulation; using namespace DD4hep::Simulation::Setup; void setupG4_XML() { std::string prefix = "file:../DD4hep.trunk"; - Geant4Kernel& kernel = Kernel::instance(Geometry::LCDD::getInstance()); + Kernel& kernel = Kernel::instance(Kernel::LCDD::getInstance()); kernel.loadGeometry((prefix+"/DDExamples/CLICSiD/compact/compact.xml").c_str()); kernel.loadXML((prefix+"/DDG4/examples/DDG4_field.xml").c_str()); kernel.loadXML((prefix+"/DDG4/examples/sequences.xml").c_str()); kernel.loadXML((prefix+"/DDG4/examples/physics.xml").c_str()); + kernel.property("UI") = "UI"; kernel.configure(); kernel.initialize(); kernel.run(); std::cout << "Successfully executed application .... " << std::endl; kernel.terminate(); -#if 0 -#endif } - void xmlAClick() { setupG4_XML(); } - diff --git a/DDG4/src/Geant4Particle.cpp b/DDG4/src/Geant4Particle.cpp index 656b95710cdf2d97eec4a71a4581e0a921f9cd61..e9f58bcb5edc228641e1c23c64a5bbf5fd9e34fe 100644 --- a/DDG4/src/Geant4Particle.cpp +++ b/DDG4/src/Geant4Particle.cpp @@ -391,7 +391,7 @@ void Geant4ParticleMap::adopt(ParticleMap& pm, TrackEquivalents& equiv) { equivalentTracks = equiv; pm.clear(); equiv.clear(); - //dumpMap(this); + //dump(); } /// Access the equivalent track id (shortcut to the usage of TrackEquivalents) @@ -400,5 +400,6 @@ int Geant4ParticleMap::particleID(int g4_id, bool) const { if ( iequiv != equivalentTracks.end() ) return (*iequiv).second; printout(ERROR,"Geant4ParticleMap","+++ No Equivalent particle for track:%d." " Monte Carlo truth record looks broken!",g4_id); + dump(); return -1; }