 |
ATLAS Offline Software
|
Go to the documentation of this file.
11 #include <GaudiKernel/SystemOfUnits.h>
18 ATH_MSG_FATAL(
"Please provide at least one container to sort");
19 return StatusCode::FAILURE;
24 return StatusCode::SUCCESS;
34 std::stable_sort(allSimHits.begin(), allSimHits.end(),
37 const IdentifierHash hashA = m_idHelperSvc->detElementHash(a->identify());
38 const IdentifierHash hashB = m_idHelperSvc->detElementHash(a->identify());
43 if (
a->identify() !=
b->identify()) {
44 return a->identify() < b->identify();
47 const float dT =
a->globalTime() -
b->globalTime();
52 if (std::abs(
a->pdgId()) != std::abs(
b->pdgId())){
53 return a->pdgId() > b->pdgId();
57 return a->genParticleLink().barcode() <
b->genParticleLink().barcode();
59 if (m_removeDuplicates) {
60 std::vector<const xAOD::MuonSimHit*> dupFreeHits{};
61 dupFreeHits.reserve(allSimHits.size());
71 return std::ranges::find_if(dupFreeHits,
79 }) == dupFreeHits.end();
85 if (m_writeDeepCopy) {
86 ATH_CHECK(writeHandle.record(std::make_unique<xAOD::MuonSimHitContainer>(),
87 std::make_unique<xAOD::MuonSimHitAuxContainer>()));
89 xAOD::MuonSimHit* newHit = writeHandle->push_back(std::make_unique<xAOD::MuonSimHit>());
90 (*newHit) = (*copy_me);
93 ATH_CHECK(writeHandle.record(std::make_unique<xAOD::MuonSimHitContainer>(*allSimHits.asDataVector())));
95 return StatusCode::SUCCESS;
SG::ReadHandleKeyArray< xAOD::MuonSimHitContainer > m_readKeys
constexpr double tolerance
Identifier identify() const
Returns the global ATLAS identifier of the SimHit.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
DataVector adapter that acts like it holds const pointers.
#define ATH_MSG_VERBOSE(x)
int barcode() const
Return the barcode of the target particle.
Property holding a SG store/key/clid from which a ReadHandle is made.
int pdgId() const
Returns the pdgID of the traversing particle.
Handle class for recording to StoreGate.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
SG::WriteHandleKey< xAOD::MuonSimHitContainer > m_writeKey
StatusCode initialize() override
const HepMcParticleLink & genParticleLink() const
Returns the link to the HepMC particle producing this hit.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
::StatusCode StatusCode
StatusCode definition for legacy code.
Out copy_if(In first, const In &last, Out res, const Pred &p)
ConstVectorMap< 3 > localDirection() const
Returns the local direction of the traversing particle.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Eigen::Matrix< double, 3, 1 > Vector3D
StatusCode execute(const EventContext &ctx) const override
DataVector adapter that acts like it holds const pointers.
ConstVectorMap< 3 > localPosition() const
Returns the local postion of the traversing particle.
Handle class for reading from StoreGate.