File indexing completed on 2025-01-30 09:17:32
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <DD4hep/Printout.h>
0016 #include <DD4hep/InstanceCount.h>
0017 #include <DDG4/Geant4InputHandling.h>
0018 #include <DDG4/Geant4InteractionVertexBoost.h>
0019
0020 using namespace dd4hep::sim;
0021
0022
0023 Geant4InteractionVertexBoost::Geant4InteractionVertexBoost(Geant4Context* ctxt, const std::string& nam)
0024 : Geant4GeneratorAction(ctxt, nam)
0025 {
0026 InstanceCount::increment(this);
0027 declareProperty("Angle", m_angle = 0);
0028 declareProperty("Mask", m_mask = 1);
0029 m_needsControl = true;
0030 }
0031
0032
0033 Geant4InteractionVertexBoost::~Geant4InteractionVertexBoost() {
0034 InstanceCount::decrement(this);
0035 }
0036
0037
0038 void Geant4InteractionVertexBoost::boost(Interaction* inter) const {
0039 if ( inter ) {
0040 boostInteraction(this, inter, m_angle);
0041 return;
0042 }
0043 print("+++ No interaction of type %d present.",m_mask);
0044 }
0045
0046
0047 void Geant4InteractionVertexBoost::operator()(G4Event*) {
0048 typedef std::vector<Geant4PrimaryInteraction*> _I;
0049 Geant4PrimaryEvent* evt = context()->event().extension<Geant4PrimaryEvent>();
0050
0051 if ( m_mask >= 0 ) {
0052 Interaction* inter = evt->get(m_mask);
0053 boost(inter);
0054 return;
0055 }
0056 _I interactions = evt->interactions();
0057 for(_I::iterator i=interactions.begin(); i != interactions.end(); ++i)
0058 boost(*i);
0059 }