4#ifndef MUONSENSITIVEDETECTORSR4_MUONSENSITIVEDETECTOR_H
5#define MUONSENSITIVEDETECTORSR4_MUONSENSITIVEDETECTOR_H
18#include <G4VSensitiveDetector.hh>
34 std::unique_ptr<xAOD::MuonSimHitContainer>
container{std::make_unique<xAOD::MuonSimHitContainer>()};
36 std::unique_ptr<xAOD::MuonSimHitAuxContainer>
auxContainer{std::make_unique<xAOD::MuonSimHitAuxContainer>()};
47 const std::string& output_key,
48 const std::string& trf_storeKey,
54 virtual void Initialize(G4HCofThisEvent* HCE)
override final;
80 const G4Step* hitStep);
92 const G4Step* hitStep);
103 const double globTime,
104 const G4Step* hitStep);
117 auto simHitVec = Extract<MuonG4R4::MuonSimHitsVec>(hitCollectionName);
119 THROW_EXCEPTION(
"The Muon sim hit collection "<<hitCollectionName<<
" does not exist");
122 return writeHandle.
record(std::move(simHitVec->container),
123 std::move(simHitVec->auxContainer));
Handle class for recording to StoreGate.
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
StatusCode Record(std::string const &sgKey, std::string const &hitCollectionName, EventContext const &ctx)
Record the hit collection hitCollectionName to the StoreGate sgKey.
const MuonGMR4::MuonDetectorManager * m_detMgr
Pointer to the underlying detector manager.
~MuonSensitiveDetector()=default
default desructor
xAOD::MuonSimHit * lastSnapShot(const Identifier &gasGapId, const G4Step *hitStep)
Returns the last snap shot of the traversing particle.
ActsTrk::GeometryContext getGeoContext(const EventContext &ctx) const
Returns the current geometry context in the event.
virtual void Initialize(G4HCofThisEvent *HCE) override final
Create the output container at the beginning of the event.
MuonSensitiveDetector(const std::string &name, const std::string &output_key, const std::string &trf_storeKey, const MuonGMR4::MuonDetectorManager *detMgr)
Constructor.
SG::ReadHandleKey< ActsTrk::DetectorAlignStore > m_trfCacheKey
ReadHandleKey to the DetectorAlignmentStore caching the relevant transformations needed in this event...
xAOD::MuonSimHit * propagateAndSaveStrip(const Identifier &hitId, const Amg::Transform3D &toGasGap, const G4Step *hitStep)
Records the G4Step in the sim hit.
bool processStep(const G4Step *step) const
Checks whether the current step shall be processed at all.
std::string m_writeKey
Key under which the output container is stored in the G4 event.
xAOD::MuonSimHit * saveHit(const Identifier &hitId, const Amg::Vector3D &hitPos, const Amg::Vector3D &hitDir, const double globTime, const G4Step *hitStep)
Saves the current Step as a xAOD::MuonSimHit snapshot.
xAOD::MuonSimHitContainer * m_outContainer
Pointer to the MuonSimHit output container.
Property holding a SG store/key/clid from which a ReadHandle is made.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
Include the common definitions from the MuonReadoutGeometry.
MuonSimHitContainer_v1 MuonSimHitContainer
Define the version of the pixel cluster container.
MuonSimHit_v1 MuonSimHit
Defined the version of the MuonSimHit.
MuonSimHitsVec()
Default constructor to connect the xAOD container with the Aux store class.
std::unique_ptr< xAOD::MuonSimHitAuxContainer > auxContainer
Auxiliary container actully holding the sim hit variables.
std::unique_ptr< xAOD::MuonSimHitContainer > container
Container to which the new sim hits will be appended.
#define THROW_EXCEPTION(MESSAGE)