 |
ATLAS Offline Software
|
Go to the documentation of this file.
8 #include "G4SDManager.hh"
25 template <
class SDType,
class HitContainerType>
27 const std::string&
name,
const std::string& hitCollectionName)
28 : G4VSensitiveDetector(
name),
29 m_hitCollName(hitCollectionName),
30 m_hitColl(hitCollectionName) {}
35 template <
class SDType,
class HitContainerType>
37 m_sdList.push_back(std::move(
sd));
43 template <
class SDType,
class HitContainerType>
45 if (!m_hitColl.isValid()) {
46 if (verboseLevel >= 5) {
47 G4cout << GetName() <<
" \tDEBUG\t"
48 <<
"Initializing hit container: " << m_hitCollName << G4endl;
50 m_hitColl = std::make_unique<HitContainerType>();
57 template <
class SDType,
class HitContainerType>
59 G4TouchableHistory*) {
61 description <<
"ProcessHits: this SD shouldn't be assigned to volumes!";
62 G4Exception(GetName(),
"SDError", FatalException,
description);
69 template <
class SDType,
class HitContainerType>
71 if (!m_hitColl.isValid()) {
72 G4cerr << GetName() <<
" \tERROR\t" <<
"Hit collection WriteHandle is "
73 <<
"invalid!" << G4endl;
74 throw std::runtime_error(
"Invalid hit container WriteHandle: " +
78 for (
auto&
sd : m_sdList) {
79 sd->EndOfAthenaEvent(&*m_hitColl);
SDWrapper(const std::string &name, const std::string &hitCollectionName)
Construct the wrapper from the output collection name.
void EndOfAthenaEvent()
Gather the hits into the WriteHandle from all the SDs.
virtual void Initialize(G4HCofThisEvent *) override final
Beginning of G4 event; initialize the hit collection.
Common sensitive detector class for LAr systems.
Class for collection of StepInfo class (G4 hits) copied and modified version to ISF.
A template class which wraps multiple sensitive detectors.
void addSD(std::unique_ptr< SDType > sd)
Add an SD to this wrapper.
virtual bool ProcessHits(G4Step *, G4TouchableHistory *) override final
This method should not be called. It will throw.
std::string description
glabal timer - how long have I taken so far?