Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDSim: make setupUserFunction be documented in the steering file #1266

Merged
merged 3 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions DDG4/include/DDG4/Geant4Particle.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,13 @@ namespace dd4hep {
std::string processName() const;
/// Access to the creator process type name
std::string processTypeName() const;
/// Access patricle momentum, energy as 4 vector
/// Access particle momentum, energy as 4 vector
FourVector pxPyPzM() const;
/// Access patricle momentum, energy as 4 vector
/// Access particle momentum, energy as 4 vector
template <typename T> std::vector<T> pxPyPzM(T unit) const;
/// Access particle momentum, energy as 4 vector
ThreeVector startVertex() const;
/// Access patricle momentum, energy as 4 vector
/// Access particle momentum, energy as 4 vector
ThreeVector endVertex() const;
/// Access the Geant4 particle definition object (expensive!)
const G4ParticleDefinition *definition() const;
Expand Down
2 changes: 1 addition & 1 deletion DDG4/python/DDSim/Helper/Meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self):

def parseEventParameters(self):
"""
Parse the event parameters and return 3 event parameter dictionnaries, respectively
Parse the event parameters and return 3 event parameter dictionaries, respectively
for string, int and float parameters
"""
stringParameters, intParameters, floatParameters, allParameters = {}, {}, {}, []
Expand Down
7 changes: 5 additions & 2 deletions DDG4/python/DDSim/Helper/Physics.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


class Physics(ConfigHelper):
"""Configuration for the PhysicsList"""
"""Configuration for the PhysicsList and Monte Carlo particle selection."""

def __init__(self):
super(Physics, self).__init__()
Expand All @@ -29,6 +29,7 @@ def __init__(self):
self._alternativeDecayStatuses = set()
self._userFunctions = []
self._closeProperties()
Physics.__doc__ += "\n\n" + self.setupUserPhysics.__doc__

@property
def rejectPDGs(self):
Expand Down Expand Up @@ -161,7 +162,7 @@ def setupPhysics(self, kernel, name=None):
return seq

def setupUserPhysics(self, userFunction):
"""Add a function to setup physics plugins.
"""To load arbitrary plugins, add a function to be executed.
The function must take the DDG4.Kernel() object as the only argument.
Expand All @@ -185,5 +186,7 @@ def setupCerenkov(kernel):
return None
SIM.physics.setupUserPhysics(setupCerenkov)
# End of example
"""
self._userFunctions.append(userFunction)
2 changes: 1 addition & 1 deletion DDG4/src/Geant4Action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void Geant4Action::ContextUpdate::operator()(Geant4Action* action) const {
action->m_context = context;
if ( 0 == action->m_context ) {

cout << "EERIOR" << endl;
cout << "ERROR" << endl;

}
}
Expand Down
5 changes: 3 additions & 2 deletions DDG4/src/Geant4Handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ namespace dd4hep {
if (ptr) {
return ptr;
}
except("Geant4Handle", "Failed to convert object of type %s to handle of type %s!",
typ.first.c_str(),typ.second.c_str());
std::string _t = typeName(typeid(TYPE));
except("Geant4Handle", "Failed to convert object of type '%s' with name '%s' to handle of type '%s'!",
typ.first.c_str(),typ.second.c_str(),_t.c_str());
}
except("Geant4Handle", "Failed to create object of type %s!", typ.first.c_str());
return 0;
Expand Down
2 changes: 1 addition & 1 deletion DDG4/src/Geant4InputAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ int Geant4InputAction::readParticles(int evt_number,
Vertices& vertices,
std::vector<Particle*>& particles)
{
//in case readParticles is called diractly outside of having a run, we make sure a reader exists
//in case readParticles is called directly outside of having a run, we make sure a reader exists
createReader();
int evid = evt_number + m_firstEvent;
int status = m_reader->moveToEvent(evid);
Expand Down
Loading