|  | ATLAS Offline Software
    | 
 
 
 
#include <TransportTool.h>
|  | 
|  | G4TransportTool (const std::string &, const std::string &, const IInterface *) | 
|  | Constructor.  More... 
 | 
|  | 
| virtual | ~G4TransportTool ()=default | 
|  | Destructor.  More... 
 | 
|  | 
| virtual StatusCode | initialize () override final | 
|  | AlgTool initialize method.  More... 
 | 
|  | 
| void initializeOnce | ATLAS_NOT_THREAD_SAFE () | 
|  | G4 initialization called only by the first tool instance.  More... 
 | 
|  | 
| virtual StatusCode | finalize () override final | 
|  | AlgTool finalize method.  More... 
 | 
|  | 
| void | finalizeOnce () | 
|  | G4 finalization called only by the first tool instance.  More... 
 | 
|  | 
| virtual StatusCode | simulate (const EventContext &ctx, ISF::ISFParticle &isp, ISF::ISFParticleContainer &secondaries, McEventCollection *mcEventCollection, std::shared_ptr< HitCollectionMap > hitCollections) override | 
|  | Simulation call for individual particles.  More... 
 | 
|  | 
| virtual StatusCode | simulateVector (const EventContext &ctx, const ISF::ISFParticleVector &particles, ISF::ISFParticleContainer &secondaries, McEventCollection *mcEventCollection, std::shared_ptr< HitCollectionMap > hitCollections, McEventCollection *shadowTruth=nullptr) override | 
|  | Simulation call for vectors of particles.  More... 
 | 
|  | 
| virtual StatusCode | setupEvent (const EventContext &, HitCollectionMap &) override | 
|  | Create data containers for an event.  More... 
 | 
|  | 
| virtual StatusCode | releaseEvent (const EventContext &, HitCollectionMap &) override | 
|  | Finalise data containers for an event.  More... 
 | 
|  | 
| virtual ISF::SimulationFlavor | simFlavor () const override | 
|  | 
| virtual StatusCode | simulate (const EventContext &, ISFParticle &, ISFParticleContainer &, McEventCollection *) | 
|  | Simulation call for individual particles.  More... 
 | 
|  | 
| virtual StatusCode | simulateVector (const EventContext &, const ISFParticleVector &, ISFParticleContainer &, McEventCollection *, McEventCollection *) | 
|  | Simulation call for vectors of particles.  More... 
 | 
|  | 
| virtual StatusCode | setupEvent (const EventContext &) | 
|  | Create data containers for an event.  More... 
 | 
|  | 
| virtual StatusCode | setupEventST (HitCollectionMap &hitCollections) | 
|  | Create data containers for an event (called by ISimulationSvc)  More... 
 | 
|  | 
| virtual StatusCode | setupEventST () | 
|  | Create data containers for an event (called by ISimulationSvc)  More... 
 | 
|  | 
| virtual StatusCode | releaseEvent (const EventContext &) | 
|  | Finalise data containers for an event.  More... 
 | 
|  | 
| virtual StatusCode | releaseEventST (HitCollectionMap &hitCollections) | 
|  | Finalise data containers for an event (called by ISimulationSvc)  More... 
 | 
|  | 
| virtual StatusCode | releaseEventST () | 
|  | Finalise data containers for an event (called by ISimulationSvc)  More... 
 | 
|  | 
|  | BaseSimulatorTool (const std::string &type, const std::string &name, const IInterface *parent) | 
|  | Standard BaseSimulatorTool constructor.  More... 
 | 
|  | 
| virtual StatusCode | sysInitialize () override | 
|  | Gaudi sysInitialize() methods.  More... 
 | 
|  | 
| const ChronoEntity * | chronoStart (const IChronoSvc::ChronoTag &tag) | 
|  | wrapper call to start chrono with given tag  More... 
 | 
|  | 
| const ChronoEntity * | chronoStop (const IChronoSvc::ChronoTag &tag) | 
|  | wrapper call to stop chrono with given tag  More... 
 | 
|  | 
|  | 
| using | passbackAction_t = G4UA::iGeant4::TrackProcessorUserActionBase | 
|  | 
| using | passbackActionMap_t = tbb::concurrent_unordered_map< std::thread::id, std::vector< passbackAction_t * >, std::hash< std::thread::id > > | 
|  | 
| Gaudi::Property< bool > | m_doTiming {this, "PrintTimingInfo", true, ""} | 
|  | 
| float | m_accumulatedEventTime {0.} | 
|  | 
| float | m_accumulatedEventTimeSq {0.} | 
|  | 
| unsigned int | m_nrOfEntries {0} | 
|  | 
| G4Timer * | m_runTimer {nullptr} | 
|  | 
| G4Timer * | m_eventTimer {nullptr} | 
|  | 
| passbackActionMap_t m_secondaryActions | ATLAS_THREAD_SAFE | 
|  | 
| Gaudi::Property< std::string > | m_mcEventCollectionName | 
|  | 
| Gaudi::Property< std::string > | m_libList {this, "Dll", "", ""} | 
|  | 
| Gaudi::Property< std::string > | m_physList {this, "Physics", "", ""} | 
|  | 
| Gaudi::Property< std::string > | m_fieldMap {this, "FieldMap", "", ""} | 
|  | 
| Gaudi::Property< bool > | m_releaseGeoModel {this, "ReleaseGeoModel", true, ""} | 
|  | 
| Gaudi::Property< bool > | m_recordFlux {this, "RecordFlux", false, ""} | 
|  | 
| Gaudi::Property< bool > | m_quietMode {this, "QuietMode", false, ""} | 
|  | 
| Gaudi::Property< std::vector< std::string > > | m_g4commands | 
|  | Commands to send to the G4 UI.  More... 
 | 
|  | 
| Gaudi::Property< bool > | m_useMT | 
|  | Activate multi-threading configuration.  More... 
 | 
|  | 
| Gaudi::Property< bool > | m_activateParallelGeometries | 
|  | 
| ServiceHandle< IAthRNGSvc > | m_rndmGenSvc | 
|  | 
| Gaudi::Property< std::string > | m_randomStreamName | 
|  | Random Stream Name.  More... 
 | 
|  | 
| ServiceHandle< IUserLimitsSvc > | m_userLimitsSvc | 
|  | 
| ServiceHandle< G4UA::IUserActionSvc > | m_userActionSvc | 
|  | user action service  More... 
 | 
|  | 
| PublicToolHandle< IDetectorConstructionTool > | m_detConstruction {this, "DetectorConstruction", "", "Tool handle of the DetectorConstruction"} | 
|  | 
| ServiceHandle< ISF::IInputConverter > | m_inputConverter | 
|  | Service to convert ISF_Particles into a G4Event.  More... 
 | 
|  | 
| ServiceHandle< IPhysicsListSvc > | m_physListSvc | 
|  | Physics List Service.  More... 
 | 
|  | 
| PublicToolHandle< ISensitiveDetectorMasterTool > | m_senDetTool | 
|  | Sensitive Detector Master Tool.  More... 
 | 
|  | 
| PublicToolHandle< IFastSimulationMasterTool > | m_fastSimTool | 
|  | Fast Simulation Master Tool.  More... 
 | 
|  | 
| PublicToolHandleArray< IPhysicsInitializationTool > | m_physicsInitializationTools {this, "PhysicsInitializationTools", {}, "Physics initialization happening after Geant4 initialization"} | 
|  | 
Geant4 AlgTool to create a ISFParticle at a volume entry/exit
- Author
- Robert Harrington 
Definition at line 67 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h.
◆ passbackAction_t
◆ passbackActionMap_t
◆ G4TransportTool()
      
        
          | iGeant4::G4TransportTool::G4TransportTool | ( | const std::string & | type, | 
        
          |  |  | const std::string & | name, | 
        
          |  |  | const IInterface * | parent | 
        
          |  | ) |  |  | 
      
 
 
◆ ~G4TransportTool()
  
  | 
        
          | virtual iGeant4::G4TransportTool::~G4TransportTool | ( |  | ) |  |  | virtualdefault | 
 
 
◆ ATLAS_NOT_THREAD_SAFE()
      
        
          | void initializeOnce iGeant4::G4TransportTool::ATLAS_NOT_THREAD_SAFE | ( |  | ) |  | 
      
 
G4 initialization called only by the first tool instance. 
This is done (for now) because we get multiple tool instances in hive. 
 
 
◆ BaseSimulatorTool()
  
  | 
        
          | ISF::BaseSimulatorTool::BaseSimulatorTool |  | inlineinherited | 
 
 
◆ chronoStart()
  
  | 
        
          | const ChronoEntity* ISF::BaseSimulatorTool::chronoStart | ( | const IChronoSvc::ChronoTag & | tag | ) |  |  | inlineinherited | 
 
 
◆ chronoStop()
  
  | 
        
          | const ChronoEntity* ISF::BaseSimulatorTool::chronoStop | ( | const IChronoSvc::ChronoTag & | tag | ) |  |  | inlineinherited | 
 
 
◆ commandLog()
  
  | 
        
          | void iGeant4::G4TransportTool::commandLog | ( | int | returnCode, |  
          |  |  | const std::string & | commandString |  
          |  | ) |  | const |  | private | 
 
This command prints a message about a G4Command depending on its returnCode. 
Definition at line 475 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.cxx.
  478   case 0: { 
ATH_MSG_DEBUG(
"G4 Command: " << commandString << 
" - Command Succeeded"); } 
break;
 
  479   case 100: { 
ATH_MSG_ERROR(
"G4 Command: " << commandString << 
" - Command Not Found!"); } 
break;
 
  481     auto* stateManager = G4StateManager::GetStateManager();
 
  482     ATH_MSG_DEBUG(
"G4 Command: " << commandString << 
" - Illegal Application State (" <<
 
  483                     stateManager->GetStateString(stateManager->GetCurrentState()) << 
")!");
 
  485   case 300: { 
ATH_MSG_ERROR(
"G4 Command: " << commandString << 
" - Parameter Out of Range!"); } 
break;
 
  486   case 400: { 
ATH_MSG_ERROR(
"G4 Command: " << commandString << 
" - Parameter Unreadable!"); } 
break;
 
  487   case 500: { 
ATH_MSG_ERROR(
"G4 Command: " << commandString << 
" - Parameter Out of Candidates!"); } 
break;
 
  488   case 600: { 
ATH_MSG_ERROR(
"G4 Command: " << commandString << 
" - Alias Not Found!"); } 
break;
 
  489   default: { 
ATH_MSG_ERROR(
"G4 Command: " << commandString << 
" - Unknown Status!"); } 
break;
 
 
 
 
◆ finalize()
  
  | 
        
          | StatusCode iGeant4::G4TransportTool::finalize | ( |  | ) |  |  | finaloverridevirtual | 
 
AlgTool finalize method. 
Definition at line 222 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.cxx.
  224   ATH_MSG_VERBOSE(
"++++++++++++  ISF G4 G4TransportTool finalized  ++++++++++++");
 
  231     ATH_MSG_ERROR(
"Failure in iGeant4::G4TransportTool::finalizeOnce: " << 
e.what());
 
  232     return StatusCode::FAILURE;
 
  241     const float sigma=(
m_nrOfEntries>2) ? std::sqrt(std::abs(avgTimeSqPerEvent - avgTimePerEvent*avgTimePerEvent)/(numEntriesFloat-2.f)) : 0;
 
  244                  "    End of run - time spent is "<<std::setprecision(4) <<
 
  246                  "    Average time per event was "<<std::setprecision(4) <<
 
  247                  avgTimePerEvent <<
" +- "<< std::setprecision(4) << 
sigma<<
endmsg<<
 
  249                  "*****************************************");
 
  252   return StatusCode::SUCCESS;
 
 
 
 
◆ finalizeOnce()
      
        
          | void iGeant4::G4TransportTool::finalizeOnce | ( |  | ) |  | 
      
 
G4 finalization called only by the first tool instance. 
This is done (for now) because we get multiple tool instances in hive. 
Definition at line 256 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.cxx.
  259   auto runMgr = G4RunManager::GetRunManager();
 
  260   runMgr->RunTermination();
 
 
 
 
◆ genEvent()
  
  | 
        
          | HepMC::GenEvent * iGeant4::G4TransportTool::genEvent | ( | McEventCollection * | mcEventCollection | ) | const |  | private | 
 
 
◆ initialize()
  
  | 
        
          | StatusCode iGeant4::G4TransportTool::initialize | ( |  | ) |  |  | finaloverridevirtual | 
 
 
◆ releaseEvent() [1/2]
  
  | 
        
          | virtual StatusCode ISF::BaseSimulatorG4Tool::releaseEvent | ( | const EventContext & |  | ) |  |  | inlinevirtualinherited | 
 
 
◆ releaseEvent() [2/2]
Finalise data containers for an event. 
- Todo:
- : strip hits of the tracks ... 
Implements ISF::BaseSimulatorG4Tool.
Definition at line 407 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.cxx.
  440     const float sigma=(
m_nrOfEntries>2) ? std::sqrt(std::abs(avgTimeSqPerEvent - avgTimePerEvent*avgTimePerEvent)/(numEntriesFloat-2.f)) : 0;
 
  441     ATH_MSG_INFO(
"\t Run:Event "<<ctx.eventID().run_number()<<
":"<<ctx.eventID().event_number() << 
"\t ("<<
m_nrOfEntries<<
"th event for this worker) took " << std::setprecision(4) <<
 
  442                  eventTime << 
" s. New average " << std::setprecision(4) <<
 
  443                  avgTimePerEvent<<
" +- "<<std::setprecision(4) << 
sigma);
 
  449   return StatusCode::SUCCESS;
 
 
 
 
◆ releaseEventST() [1/2]
  
  | 
        
          | virtual StatusCode ISF::BaseSimulatorG4Tool::releaseEventST | ( |  | ) |  |  | inlinevirtualinherited | 
 
 
◆ releaseEventST() [2/2]
  
  | 
        
          | virtual StatusCode ISF::BaseSimulatorG4Tool::releaseEventST | ( | HitCollectionMap & | hitCollections | ) |  |  | inlinevirtualinherited | 
 
Finalise data containers for an event (called by ISimulationSvc) 
Definition at line 58 of file BaseSimulatorG4Tool.h.
   59     return releaseEvent(Gaudi::Hive::currentContext(), hitCollections);
 
 
 
 
◆ setupEvent() [1/2]
  
  | 
        
          | virtual StatusCode ISF::BaseSimulatorG4Tool::setupEvent | ( | const EventContext & |  | ) |  |  | inlinevirtualinherited | 
 
 
◆ setupEvent() [2/2]
◆ setupEventST() [1/2]
  
  | 
        
          | virtual StatusCode ISF::BaseSimulatorG4Tool::setupEventST | ( |  | ) |  |  | inlinevirtualinherited | 
 
 
◆ setupEventST() [2/2]
  
  | 
        
          | virtual StatusCode ISF::BaseSimulatorG4Tool::setupEventST | ( | HitCollectionMap & | hitCollections | ) |  |  | inlinevirtualinherited | 
 
Create data containers for an event (called by ISimulationSvc) 
Definition at line 49 of file BaseSimulatorG4Tool.h.
   50     return setupEvent(Gaudi::Hive::currentContext(), hitCollections);
 
 
 
 
◆ simFlavor()
◆ simulate() [1/2]
◆ simulate() [2/2]
◆ simulateVector() [1/2]
◆ simulateVector() [2/2]
Simulation call for vectors of particles. 
Process ParticleState from particle stack
Implements ISF::BaseSimulatorG4Tool.
Definition at line 286 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.cxx.
  296     auto eventInfo = std::make_unique<AtlasG4EventUserInfo>();
 
  297     eventInfo->SetHitCollectionMap(hitCollections);
 
  299     auto inputEvent = std::make_unique<G4Event>(ctx.eventID().event_number());
 
  300     inputEvent->SetUserInformation(eventInfo.release());
 
  302     HepMC::GenEvent* shadowGenEvent =
 
  303         (shadowTruth && !shadowTruth->
empty())
 
  304             ? 
static_cast<HepMC::GenEvent*
>(shadowTruth->
back())
 
  315 #     ifdef G4MULTITHREADED 
  316         auto* workerRM = G4AtlasWorkerRunManager::GetG4AtlasWorkerRunManager();
 
  317         return workerRM->ProcessEvent(inputEvent.release());
 
  319         ATH_MSG_ERROR(
"Trying to use multi-threading in non-MT build!");
 
  324           G4AtlasRunManager::GetG4AtlasRunManager();  
 
  325       return workerRM->ProcessEvent(inputEvent.release());
 
  334     return StatusCode::FAILURE;
 
  338   auto actionsFound = m_secondaryActions.find( std::this_thread::get_id() );
 
  339   if ( actionsFound == m_secondaryActions.end() ) {
 
  341     std::vector< G4UserSteppingAction* > allActions;
 
  343     if ( !
sc.isSuccess() ) {
 
  344       ATH_MSG_ERROR( 
"Failed to retrieve secondaries from UASvc" );
 
  349     for ( G4UserSteppingAction* 
action : allActions ) {
 
  352         m_secondaryActions[ std::this_thread::get_id() ].push_back( castAction );
 
  356     actionsFound = m_secondaryActions.find( std::this_thread::get_id() );
 
  360   for ( 
auto* 
action : actionsFound->second ) {
 
  365       secondaries.splice( 
begin(secondaries), std::move(someSecondaries) );
 
  381   return StatusCode::SUCCESS;
 
 
 
 
◆ sysInitialize()
  
  | 
        
          | virtual StatusCode ISF::BaseSimulatorTool::sysInitialize | ( |  | ) |  |  | inlineoverridevirtualinherited | 
 
 
◆ ATLAS_THREAD_SAFE
◆ m_accumulatedEventTime
  
  | 
        
          | float iGeant4::G4TransportTool::m_accumulatedEventTime {0.} |  | private | 
 
 
◆ m_accumulatedEventTimeSq
  
  | 
        
          | float iGeant4::G4TransportTool::m_accumulatedEventTimeSq {0.} |  | private | 
 
 
◆ m_activateParallelGeometries
  
  | 
        
          | Gaudi::Property<bool> iGeant4::G4TransportTool::m_activateParallelGeometries |  | private | 
 
 
◆ m_chrono
  
  | 
        
          | ServiceHandle<IChronoStatSvc> ISF::BaseSimulatorTool::m_chrono {this, "ChronoStatService", "ChronoStatSvc"} |  | protectedinherited | 
 
 
◆ m_detConstruction
  
  | 
        
          | PublicToolHandle<IDetectorConstructionTool> iGeant4::G4TransportTool::m_detConstruction {this, "DetectorConstruction", "", "Tool handle of the DetectorConstruction"} |  | private | 
 
 
◆ m_doTiming
  
  | 
        
          | Gaudi::Property<bool> iGeant4::G4TransportTool::m_doTiming {this, "PrintTimingInfo", true, ""} |  | private | 
 
 
◆ m_eventTimer
  
  | 
        
          | G4Timer* iGeant4::G4TransportTool::m_eventTimer {nullptr} |  | private | 
 
 
◆ m_fastSimTool
◆ m_fieldMap
  
  | 
        
          | Gaudi::Property<std::string> iGeant4::G4TransportTool::m_fieldMap {this, "FieldMap", "", ""} |  | private | 
 
 
◆ m_g4commands
  
  | 
        
          | Gaudi::Property<std::vector<std::string> > iGeant4::G4TransportTool::m_g4commands |  | private | 
 
 
◆ m_inputConverter
◆ m_libList
  
  | 
        
          | Gaudi::Property<std::string> iGeant4::G4TransportTool::m_libList {this, "Dll", "", ""} |  | private | 
 
 
◆ m_mcEventCollectionName
  
  | 
        
          | Gaudi::Property<std::string> iGeant4::G4TransportTool::m_mcEventCollectionName |  | private | 
 
 
◆ m_nrOfEntries
  
  | 
        
          | unsigned int iGeant4::G4TransportTool::m_nrOfEntries {0} |  | private | 
 
 
◆ m_physicsInitializationTools
  
  | 
        
          | PublicToolHandleArray<IPhysicsInitializationTool> iGeant4::G4TransportTool::m_physicsInitializationTools {this, "PhysicsInitializationTools", {}, "Physics initialization happening after Geant4 initialization"} |  | private | 
 
 
◆ m_physList
  
  | 
        
          | Gaudi::Property<std::string> iGeant4::G4TransportTool::m_physList {this, "Physics", "", ""} |  | private | 
 
 
◆ m_physListSvc
◆ m_quietMode
  
  | 
        
          | Gaudi::Property<bool> iGeant4::G4TransportTool::m_quietMode {this, "QuietMode", false, ""} |  | private | 
 
 
◆ m_randomStreamName
  
  | 
        
          | Gaudi::Property<std::string> iGeant4::G4TransportTool::m_randomStreamName |  | private | 
 
 
◆ m_recordFlux
  
  | 
        
          | Gaudi::Property<bool> iGeant4::G4TransportTool::m_recordFlux {this, "RecordFlux", false, ""} |  | private | 
 
 
◆ m_releaseGeoModel
  
  | 
        
          | Gaudi::Property<bool> iGeant4::G4TransportTool::m_releaseGeoModel {this, "ReleaseGeoModel", true, ""} |  | private | 
 
 
◆ m_rndmGenSvc
◆ m_runTimer
  
  | 
        
          | G4Timer* iGeant4::G4TransportTool::m_runTimer {nullptr} |  | private | 
 
 
◆ m_senDetTool
◆ m_useMT
  
  | 
        
          | Gaudi::Property<bool> iGeant4::G4TransportTool::m_useMT |  | private | 
 
 
◆ m_userActionSvc
◆ m_userLimitsSvc
The documentation for this class was generated from the following files:
 
std::list< ISF::ISFParticle * > ISFParticleContainer
generic ISFParticle container (not necessarily a std::list!)
def retrieve(aClass, aKey=None)
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
#define ATH_MSG_VERBOSE(x)
::StatusCode StatusCode
StatusCode definition for legacy code.
std::vector< ISF::ISFParticle * > ISFParticleVector
ISFParticle vector.
const T * back() const
Access the last element in the collection as an rvalue.
A wrapper class for event-slot-local random engines.
virtual StatusCode sysInitialize() override
Perform system initialization for an algorithm.
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
#define ATH_MSG_WARNING(x)
bool empty() const noexcept
Returns true if the collection is empty.