ATLAS Offline Software
Loading...
Searching...
No Matches
TimedHitPtr.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef HITMANAGEMENT_TIMEDHITPTR
6#define HITMANAGEMENT_TIMEDHITPTR
7
14
15#include <type_traits>
16
17template <typename HIT>
19public:
20 using element_type = std::add_const_t<HIT>;
21 using value_type = HIT;
24 TimedHitPtr() = default;
25 TimedHitPtr(const TimedHitPtr<HIT>& rhs) = default;
26 TimedHitPtr(TimedHitPtr<HIT>&& rhs) = default;
27
28
30 TimedHitPtr(float eventTime, const HIT* pHit, int pileupType=0) :
32
33 TimedHitPtr(float eventTime, unsigned short eventId, const HIT* pHit, int pileupType=0) :
35
40 const HIT& operator*() const { return *m_pHit; }
41 const HIT* operator->() const { return m_pHit; }
42 const HIT* get() const { return m_pHit; }
43
44 operator bool () const { return m_pHit != nullptr; }
47 unsigned short eventId() const { return m_eventId; }
48
51 int pileupType() const { return m_pileupType; }
52
55 float eventTime() const { return m_eventTime; }
56
57private:
58
60 float m_eventTime{0.f};
62 unsigned short m_eventId{0u};
64 const HIT* m_pHit{nullptr}; //don't own
65
66 template <class FHIT>
67 friend float hitTime(const TimedHitPtr<FHIT>&);
68};
69
70template <class HIT>
71inline float hitTime(const TimedHitPtr<HIT>& tHit) {
72 return tHit.m_eventTime + hitTime(*tHit);
73}
74
75
76
77template <class HIT>
78bool operator < (const TimedHitPtr<HIT>& lhs, const TimedHitPtr<HIT>& rhs ) {
79 return ( lhs.get() && rhs.get() && *lhs < *rhs);
80}
81#endif
bool operator<(const TimedHitPtr< HIT > &lhs, const TimedHitPtr< HIT > &rhs)
Definition TimedHitPtr.h:78
float hitTime(const TimedHitPtr< HIT > &tHit)
Definition TimedHitPtr.h:71
a smart pointer to a hit that also provides access to the extended timing info of the host event.
Definition TimedHitPtr.h:18
TimedHitPtr(float eventTime, unsigned short eventId, const HIT *pHit, int pileupType=0)
use this constructor when hit has a PileUpTimeEventIndex
Definition TimedHitPtr.h:33
friend float hitTime(const TimedHitPtr< FHIT > &)
const HIT & operator*() const
smart pointer interface
Definition TimedHitPtr.h:40
TimedHitPtr< HIT > & operator=(const TimedHitPtr< HIT > &rhs)=default
assignment operator
TimedHitPtr()=default
STL required constructors.
unsigned short eventId() const
Definition TimedHitPtr.h:47
const HIT * get() const
Definition TimedHitPtr.h:42
const xAOD::MuonSimHit * m_pHit
Definition TimedHitPtr.h:64
TimedHitPtr(const TimedHitPtr< HIT > &rhs)=default
TimedHitPtr(TimedHitPtr< HIT > &&rhs)=default
TimedHitPtr(float eventTime, const HIT *pHit, int pileupType=0)
minimal constructor: pass only t0 offset of bunch xing
Definition TimedHitPtr.h:30
std::add_const_t< xAOD::MuonSimHit > element_type
Definition TimedHitPtr.h:20
TimedHitPtr< HIT > & operator=(TimedHitPtr< HIT > &&rhs)=default
const HIT * operator->() const
Definition TimedHitPtr.h:41