Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
Go to the documentation of this file.
10 #include <GeoModelKernel/throwExcept.h>
14 #include <G4Geantino.hh>
15 #include <G4ChargedGeantino.hh>
26 MuonSensitiveDetector::MuonSensitiveDetector(
const std::string&
name,
27 const std::string& output_key,
28 const std::string& trfStore_key,
30 G4VSensitiveDetector{
name},
32 m_writeHandle{output_key},
33 m_trfCacheKey{trfStore_key},
35 m_trfCacheKey.initialize().ignore();
42 if (!
m_writeHandle.recordNonConst(std::make_unique<xAOD::MuonSimHitContainer>(),
43 std::make_unique<xAOD::MuonSimHitAuxContainer>()).isSuccess()) {
51 if (!trfStoreHandle.isValid()) {
54 gctx.setStore(std::make_unique<DetectorAlignStore>(*trfStoreHandle));
58 const G4Track* currentTrack = aStep->GetTrack();
59 ATH_MSG_VERBOSE(
"Check whether step pdgId: "<<(*currentTrack)<<
" will be processed.");
62 if (aStep->GetStepLength() < std::numeric_limits<float>::epsilon() || currentTrack->GetVelocity() < velCutOff) {
67 if (currentTrack->GetDefinition()->GetPDGCharge() == 0.0) {
69 return currentTrack->GetDefinition() == G4Geantino::GeantinoDefinition() ||
70 currentTrack->GetDefinition() == G4ChargedGeantino::ChargedGeantinoDefinition();
76 const G4Step* aStep) {
78 const G4Track* currentTrack = aStep->GetTrack();
89 if (std::abs(currentTrack->GetParticleDefinition()->GetPDGEncoding()) == 11 && prevHit) {
93 locHitDir = (locPostStep - locPreStep).
unit();
95 const Amg::Vector3D locHitPos = 0.5* (locPreStep + locPostStep);
97 <<
", deposit: "<<aStep->GetTotalEnergyDeposit()<<
", -- local coords: "
100 <<
", deposit: "<<aStep->GetTotalEnergyDeposit());
102 const double globalTime = currentTrack->GetGlobalTime() + locHitDir.dot(locPostStep - locHitPos) / currentTrack->GetVelocity();
113 const double globTime,
114 const G4Step* aStep) {
115 const G4Track* currentTrack = aStep->GetTrack();
121 hit =
m_writeHandle->push_back(std::make_unique<xAOD::MuonSimHit>());
124 dec_G4TrkId(*hit) = currentTrack->GetTrackID();
128 hit->
setMass(currentTrack->GetDefinition()->GetPDGMass());
130 hit->
setPdgId(currentTrack->GetDefinition()->GetPDGEncoding());
137 <<
", pdgId: "<<hit->
pdgId()
139 <<
", trackId: "<<currentTrack->GetTrackID()<<
", "
147 const G4Step* hitStep) {
153 trkHelper.GenerateParticleLink() !=
m_writeHandle->back()->genParticleLink() ||
154 dec_G4TrkId(*
m_writeHandle->back()) != hitStep->GetTrack()->GetTrackID()) {
void setIdentifier(const Identifier &id)
Sets the global ATLAS identifier.
SG::WriteHandle< xAOD::MuonSimHitContainer > m_writeHandle
float stepLength() const
Returns the path length of the G4 step.
const MuonGMR4::MuonDetectorManager * m_detMgr
Pointer to the underlying detector manager.
bool processStep(const G4Step *step) const
Checks whether the current step shall be processed at all.
void setPdgId(int id)
Sets the pdgID of the traversing particle.
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.
SG::ReadHandleKey< ActsTrk::DetectorAlignStore > m_trfCacheKey
ReadHandleKey to the DetectorAlignmentStore caching the relevant transformations needed in this event...
MeasVector< N > toStorage(const AmgVector(N)&amgVec)
Converts the double precision of the AmgVector into the floating point storage precision of the MeasV...
virtual void Initialize(G4HCofThisEvent *HCE) override final
Create the output container at the beginning of the event.
void setLocalPosition(MeasVector< 3 > vec)
Sets the local position of the traversing particle.
#define ATH_MSG_VERBOSE(x)
void setGenParticleLink(const HepMcParticleLink &link)
Sets the link to the HepMC particle producing this hit.
int pdgId() const
Returns the pdgID of the traversing particle.
xAOD::MuonSimHit * propagateAndSaveStrip(const Identifier &hitId, const Amg::Transform3D &toGasGap, const G4Step *hitStep)
void setMass(const float m)
set the rest-mass of the traversing particle
Amg::Vector3D Hep3VectorToEigen(const CLHEP::Hep3Vector &CLHEPvector)
Converts a CLHEP-based CLHEP::Hep3Vector into an Eigen-based Amg::Vector3D.
HepMC::ConstGenParticlePtr cptr() const
Dereference.
float kineticEnergy() const
Returns the kinetic energy of the traversing particle.
void setKineticEnergy(const float energy)
Sets the kinetic energy of the traversing particle.
Include the common definitions from the MuonReadoutGeometry.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
const HepMcParticleLink & genParticleLink() const
Returns the link to the HepMC particle producing this hit.
Eigen::Affine3d Transform3D
virtual std::string toStringGasGap(const Identifier &id) const =0
print all fields up to gas gap to string
Class to provide easy MsgStream access and capabilities.
ConstVectorMap< 3 > localDirection() const
Returns the local direction of the traversing particle.
void setStepLength(const float length)
Set the path length of the G4 step.
Include the GeoPrimitives which need to be put first.
void setEnergyDeposit(const float deposit)
Sets the energy deposited by the traversing particle inside the gas volume.
void setLocalDirection(MeasVector< 3 > vec)
Sets the local direction of the traversing particle.
Eigen::Matrix< double, 3, 1 > Vector3D
#define THROW_EXCEPTION(MESSAGE)
xAOD::MuonSimHit * lastSnapShot(const Identifier &gasGapId, const G4Step *hitStep)
Returns the last snap shot of the traversing particle.
virtual std::string toString(const Identifier &id) const =0
print all fields to string
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Returns a pointer to the central MuonIdHelperSvc.
ConstVectorMap< 3 > localPosition() const
Returns the local postion of the traversing particle.
float energyDeposit() const
Returns the energy deposited by the traversing particle inside the gas volume.
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Scalar mag() const
mag method
void setGlobalTime(const float time)
Sets the time of the traversing particle.
ActsGeometryContext getGeoContext() const
Returns the current geometry context in the event.