key4hep/k4geo

Cannot set LcioOutput.EventParametersString = {}

Closed this issue · 5 comments

!!!IMPORTANT!!!: To facilitate faster and easier response to your issue please provide in addition to the description of the issue also the following information

  • OS version: e.g. SLC6
  • Compiler version: e.g GCC 6.2
  • Package version: tag, commit ID, CVMFS release or GitHub branch
  • Reproduced by: exact steps to reproduce the problem: checkout, setup environment (iLCSoft release), cmake, build, run...
  • Input: link to input files if applicable
  • Output: full build and run log output
  • Goal: A short description of what you are trying to achieve

Ways to reproduce:

  • source /cvmfs/ilc.desy.de/sw/x86_64_gcc49_sl6/v01-19-05/init_ilcsoft.sh
  • git clone lcgeo.git
  • cd lcgeo
  • git checkout 808752baf726d1d1bedfd4e51caccd9574d7f6bb #HEAD, just for reproducibility
  • mkdir build
  • cd build
  • cmake -DBoost_NO_BOOST_CMAKE=ON ..
  • make && make install
  • cd ..
  • . bin/thislcgeo.sh
  • ddsim --compactFile SiD/compact/SiD_o2_v03/SiD_o2_v03.xml --runType batch --enableGun --gun.distribution uniform --gun.particle e- --gun.energy 15*GeV --gun.thetaMax="1*mrad" --gun.thetaMin="40*mrad" --numberOfEvents 1000 --outputFile myElectrons.slcio

Expected outcome: A file with hits
Result:

Choosing random seed for you: 1316548893
Geant4UIMessenger INFO  +++ LcioOutput> Install Geant4 control directory:/ddg4/LcioOutput/
Geant4UIMessenger INFO  +++ EventAction> Install Geant4 control directory:/ddg4/EventAction/
Traceback (most recent call last):
  File "/home/ilc/jstrube/ILC/work/lcgeo/bin/ddsim", line 16, in <module>
    RUNNER.run()
  File "/home/ilc/jstrube/ILC/work/lcgeo/lib/python/DDSim/DD4hepSimulation.py", line 336, in run
    lcOut.EventParametersString, lcOut.EventParametersInt, lcOut.EventParametersFloat = self.meta.parseEventParameters()
  File "/cvmfs/ilc.desy.de/sw/x86_64_gcc49_sl6/v01-19-05/DD4hep/v01-05/python/DDG4.py", line 275, in _set
    raise exceptions.KeyError(msg)
KeyError: 'Geant4Action::SetProperty [Unhandled]: Cannot set LcioOutput.EventParametersString = {}'
rete commented

This feature has been implemented both in DD4hep and lcgeo. If you want to use it, you need to re-compile DD4hep (from here I suppose : f5f2625f360a6d68209e24c6e8c679ac4df11fca) and then re-compile lcgeo.

What feature is this? Can I turn this off and use lcgeo master with a released DD4hep?

I've tried re-compiling DD4hep, and lcgeo again, but no success:

Geant4UIMessenger INFO  +++ LcioOutput> Install Geant4 control directory:/ddg4/LcioOutput/
Geant4UIMessenger INFO  +++ EventAction> Install Geant4 control directory:/ddg4/EventAction/
Traceback (most recent call last):
  File "../lcgeo/bin/ddsim", line 16, in <module>
    RUNNER.run()
  File "/home/ilc/jstrube/ILC/work/lcgeo/lib/python/DDSim/DD4hepSimulation.py", line 336, in run
    lcOut.EventParametersString, lcOut.EventParametersInt, lcOut.EventParametersFloat = self.meta.parseEventParameters()
  File "/home/ilc/jstrube/ILC/work/DD4hep/python/DDG4.py", line 276, in _set
    raise exceptions.KeyError(msg)
KeyError: 'Geant4Action::SetProperty [Unhandled]: Cannot set LcioOutput.EventParametersString = {}'
rete commented

The feature is that you can specify event parameters by command line that will be written in every output event.

ddsim --compactFile SiD/compact/SiD_o2_v03/SiD_o2_v03.xml \
--runType batch --enableGun --gun.distribution uniform --gun.particle e- \
--gun.energy 15*GeV --gun.thetaMax="1*mrad" --gun.thetaMin="40*mrad" \
--numberOfEvents 1000 --outputFile myElectrons.slcio \
--meta.eventParameters crossSection/f=1e-34

Nevertheless, by following your steps I can compile it and run your example simulation.
Here is the complete command set I used :

source /cvmfs/ilc.desy.de/sw/x86_64_gcc49_sl6/v01-19-05/init_ilcsoft.sh
# Install DD4hep
git clone https://github.com/AIDASoft/DD4hep.git
cd DD4hep
mkdir build && cd build
cmake -DDD4HEP_USE_GEANT4=ON -DBoost_NO_BOOST_CMAKE=ON -DDD4HEP_USE_LCIO=ON -DBUILD_TESTING=ON -DGeant4_DIR=$G4INSTALL/lib/Geant4-10.3.3 -DROOT_DIR=$ROOTSYS ..
make install
cd ..
. bin/thisdd4hep.sh
cd ..
# Install lcgeo
git clone https://github.com/iLCSoft/lcgeo.git
cd lcgeo
mkdir build && cd build
cmake -C $ILCSOFT/ILCSoft.cmake
make install
cd ..
. bin/thislcgeo.sh
# Run a simulation
ddsim --compactFile SiD/compact/SiD_o2_v03/SiD_o2_v03.xml \
--runType batch --enableGun --gun.distribution uniform --gun.particle e- \
--gun.energy 15*GeV --gun.thetaMax="1*mrad" --gun.thetaMin="40*mrad" \
--numberOfEvents 1 --outputFile myElectrons.slcio

or you just use the nightly

source /cvmfs/clicdp.cern.ch/iLCSoft/builds/nightly/x86_64-slc6-gcc7-opt/init_ilcsoft.sh

@rete That works. (only you forgot the .. after the lcgeo cmake).
Thank you! I must have used the wrong parameters for the DD4hep cmake.