diff --git a/Examples/options/tut_detsim_pan_matrix.py b/Examples/options/tut_detsim_pan_matrix.py index 4da9e96c384a425e72b5a5b6a4ab9a9cb98a933f..1d5bd4561d3f5bd4318455d7c6a9a54df88c5aa2 100644 --- a/Examples/options/tut_detsim_pan_matrix.py +++ b/Examples/options/tut_detsim_pan_matrix.py @@ -63,7 +63,8 @@ from Configurables import GenPrinter gun = GtGunTool("GtGunTool") gun.Particles = ["gamma","gamma"] -gun.Energies = [10, 10] # GeV +gun.EnergyMins= [10, 10] # GeV +gun.EnergyMaxs= [10, 10] # GeV gun.ThetaMins = [90, 90] # degree gun.ThetaMaxs = [90, 90] # degree gun.PhiMins = [0, 1 ] # degree diff --git a/Generator/src/GtGunTool.cpp b/Generator/src/GtGunTool.cpp index 9af8c82f7cf9ac28ba80a2f5442b1bace5b1ba93..df29f4a2821f0324d574fc71e316bd05f3054447 100644 --- a/Generator/src/GtGunTool.cpp +++ b/Generator/src/GtGunTool.cpp @@ -16,7 +16,7 @@ GtGunTool::initialize() { return StatusCode::FAILURE; } - if (m_energies.value().size() != m_particles.value().size()) { + if (m_energymins.value().size() != m_particles.value().size()) { error() << "Mismatched energies and particles." << endmsg; return StatusCode::FAILURE; } @@ -79,7 +79,7 @@ GtGunTool::mutate(MyHepMC::GenEvent& event) { } } - double energy = m_energies.value()[i]; + double energy = m_energymins.value()[i]==m_energymaxs.value()[i] ? m_energymins.value()[i] : CLHEP::RandFlat::shoot(m_energymins.value()[i], m_energymaxs.value()[i]); // create the MC particle edm4hep::MCParticle mcp = event.m_mc_vec.create(); diff --git a/Generator/src/GtGunTool.h b/Generator/src/GtGunTool.h index 22b02a811a19be2ce5a16ca1cdd4726635a0be4b..388c14d4d555bc4d3b436ebc90fabdca26f22337 100644 --- a/Generator/src/GtGunTool.h +++ b/Generator/src/GtGunTool.h @@ -34,7 +34,8 @@ private: Gaudi::Property<std::vector<std::string>> m_particles{this, "Particles"}; - Gaudi::Property<std::vector<double>> m_energies{this, "Energies"}; + Gaudi::Property<std::vector<double>> m_energymins{this, "EnergyMins"}; + Gaudi::Property<std::vector<double>> m_energymaxs{this, "EnergyMaxs"}; Gaudi::Property<std::vector<double>> m_thetamins{this, "ThetaMins"}; Gaudi::Property<std::vector<double>> m_thetamaxs{this, "ThetaMaxs"};