ATLAS Offline Software
Public Types | Public Member Functions | Private Attributes | List of all members
LArG4::detail::SDWrapper< SDType, HitContainerType > Class Template Reference

A template class which wraps multiple sensitive detectors. More...

#include <SDWrapper.h>

Inheritance diagram for LArG4::detail::SDWrapper< SDType, HitContainerType >:
Collaboration diagram for LArG4::detail::SDWrapper< SDType, HitContainerType >:

Public Types

using SDList_t = std::vector< std::unique_ptr< SDType > >
 Alias to the SD list type. More...
 

Public Member Functions

 SDWrapper (const std::string &name, const std::string &hitCollectionName, const std::string &deadHitCollectionName="")
 Construct the wrapper from the output collection name. More...
 
void addSD (std::unique_ptr< SDType > sd)
 Add an SD to this wrapper. More...
 
void addFastSimSD (const std::string &fastSimSDName)
 Add a (non-owned) fast-sim SD by name. More...
 
virtual void Initialize (G4HCofThisEvent *) override final
 Beginning of G4 event; initialize the hit collection. More...
 
virtual bool ProcessHits (G4Step *, G4TouchableHistory *) override final
 This method should not be called. It will throw. More...
 
void EndOfAthenaEvent ()
 Gather the hits into the WriteHandle from all the SDs. More...
 
void EndOfAthenaEvent ()
 

Private Attributes

std::string m_hitCollName
 The hit container name. More...
 
SG::WriteHandle< HitContainerType > m_hitColl
 The hit container handle. More...
 
std::string m_deadHitCollName
 The hit container name. More...
 
SG::WriteHandle< HitContainerType > m_deadHitColl
 The hit container handle. More...
 
SDList_t m_sdList
 The list of sensitive detectors that I own and manage. More...
 
std::string m_fastSimSDName
 A fastsim SD name that I do not own but invoke in order to share my hit container. More...
 

Detailed Description

template<class SDType, class HitContainerType>
class LArG4::detail::SDWrapper< SDType, HitContainerType >

A template class which wraps multiple sensitive detectors.

Allows for SD tools to manage several SDs which collaborate to fill one hit container in a multi-threading-friendly way. The wrapper owns the WriteHandle for the hit container and gathers hits from each SD at the end of an event.

The inheritance from G4VSensitiveDetector is merely a trick so the SD tool can save this object in the SensitiveDetectorBase thread-local container. It also allows to create the hit container at the right time via the SD Initialize method invoked by Geant4.

Clients shouldn't use this generic template directly, but should use the explicitly allowed specializations given below.

Author
Steve Farrell Steve.nosp@m.n.Fa.nosp@m.rrell.nosp@m.@cer.nosp@m.n.ch

Definition at line 52 of file LArCalorimeter/LArG4/LArG4Code/LArG4Code/SDWrapper.h.

Member Typedef Documentation

◆ SDList_t

template<class SDType , class HitContainerType >
using LArG4::detail::SDWrapper< SDType, HitContainerType >::SDList_t = std::vector< std::unique_ptr<SDType> >

Alias to the SD list type.

Definition at line 58 of file LArCalorimeter/LArG4/LArG4Code/LArG4Code/SDWrapper.h.

Constructor & Destructor Documentation

◆ SDWrapper()

template<class SDType , class HitContainerType >
LArG4::detail::SDWrapper< SDType, HitContainerType >::SDWrapper ( const std::string &  name,
const std::string &  hitCollectionName,
const std::string &  deadHitCollectionName = "" 
)

Construct the wrapper from the output collection name.

Member Function Documentation

◆ addFastSimSD()

template<class SDType , class HitContainerType >
void LArG4::detail::SDWrapper< SDType, HitContainerType >::addFastSimSD ( const std::string &  fastSimSDName)

Add a (non-owned) fast-sim SD by name.

◆ addSD()

template<class SDType , class HitContainerType >
void LArG4::detail::SDWrapper< SDType, HitContainerType >::addSD ( std::unique_ptr< SDType >  sd)

Add an SD to this wrapper.

◆ EndOfAthenaEvent() [1/2]

template<class SDType , class HitContainerType >
void LArG4::detail::SDWrapper< SDType, HitContainerType >::EndOfAthenaEvent ( )

Gather the hits into the WriteHandle from all the SDs.

◆ EndOfAthenaEvent() [2/2]

◆ Initialize()

template<class SDType , class HitContainerType >
virtual void LArG4::detail::SDWrapper< SDType, HitContainerType >::Initialize ( G4HCofThisEvent *  )
finaloverridevirtual

Beginning of G4 event; initialize the hit collection.

◆ ProcessHits()

template<class SDType , class HitContainerType >
virtual bool LArG4::detail::SDWrapper< SDType, HitContainerType >::ProcessHits ( G4Step *  ,
G4TouchableHistory *   
)
finaloverridevirtual

This method should not be called. It will throw.

Member Data Documentation

◆ m_deadHitColl

template<class SDType , class HitContainerType >
SG::WriteHandle<HitContainerType> LArG4::detail::SDWrapper< SDType, HitContainerType >::m_deadHitColl
private

The hit container handle.

Definition at line 94 of file LArCalorimeter/LArG4/LArG4Code/LArG4Code/SDWrapper.h.

◆ m_deadHitCollName

template<class SDType , class HitContainerType >
std::string LArG4::detail::SDWrapper< SDType, HitContainerType >::m_deadHitCollName
private

The hit container name.

Definition at line 91 of file LArCalorimeter/LArG4/LArG4Code/LArG4Code/SDWrapper.h.

◆ m_fastSimSDName

template<class SDType , class HitContainerType >
std::string LArG4::detail::SDWrapper< SDType, HitContainerType >::m_fastSimSDName
private

A fastsim SD name that I do not own but invoke in order to share my hit container.

For now I'm assuming there is only one.

Definition at line 101 of file LArCalorimeter/LArG4/LArG4Code/LArG4Code/SDWrapper.h.

◆ m_hitColl

template<class SDType , class HitContainerType >
SG::WriteHandle<HitContainerType> LArG4::detail::SDWrapper< SDType, HitContainerType >::m_hitColl
private

The hit container handle.

Definition at line 88 of file LArCalorimeter/LArG4/LArG4Code/LArG4Code/SDWrapper.h.

◆ m_hitCollName

template<class SDType , class HitContainerType >
std::string LArG4::detail::SDWrapper< SDType, HitContainerType >::m_hitCollName
private

The hit container name.

Definition at line 85 of file LArCalorimeter/LArG4/LArG4Code/LArG4Code/SDWrapper.h.

◆ m_sdList

template<class SDType , class HitContainerType >
SDList_t LArG4::detail::SDWrapper< SDType, HitContainerType >::m_sdList
private

The list of sensitive detectors that I own and manage.

Definition at line 97 of file LArCalorimeter/LArG4/LArG4Code/LArG4Code/SDWrapper.h.


The documentation for this class was generated from the following file: