ATLAS Offline Software
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 
15 #include <type_traits>
16 
17 template <class HIT>
18 class TimedHitPtr {
19 public:
20  using value_type = HIT;
21  using const_value_type = const HIT;
23  TimedHitPtr() = default;
24  TimedHitPtr(const TimedHitPtr<HIT>& rhs) = default;
25  TimedHitPtr(TimedHitPtr<HIT>&& rhs) = default;
26 
27 
29  TimedHitPtr(float eventTime, const HIT* pHit, int pileupType=0) :
32  TimedHitPtr(float eventTime, unsigned short eventId, const HIT* pHit, int pileupType=0) :
34 
39  const HIT& operator*() const { return *m_pHit; }
40  const HIT* operator->() const { return m_pHit; }
41  const HIT* get() const { return m_pHit; }
42 
45  unsigned short eventId() const { return m_eventId; }
46 
49  int pileupType() const { return m_pileupType; }
50 
53  float eventTime() const { return m_eventTime; }
54 
55 private:
56 
58  float m_eventTime{0.f};
60  unsigned short m_eventId{0u};
61  int m_pileupType{0};
62  const HIT* m_pHit{nullptr}; //don't own
63 
64  template <class FHIT>
65  friend float hitTime(const TimedHitPtr<FHIT>&);
66 };
67 
68 template <class HIT>
69 inline float hitTime(const TimedHitPtr<HIT>& tHit) {
70  return tHit.m_eventTime + hitTime(*tHit);
71 }
72 
73 
74 
75 template <class HIT>
76 bool operator < (const TimedHitPtr<HIT>& lhs, const TimedHitPtr<HIT>& rhs ) {
77  return ( lhs.get() && rhs.get() && *lhs < *rhs);
78 }
79 #endif
TimedHitPtr::m_pileupType
int m_pileupType
Definition: TimedHitPtr.h:61
TimedHitPtr< CSCSimHit >::const_value_type
const HIT const_value_type
Definition: TimedHitPtr.h:21
TimedHitPtr::operator=
TimedHitPtr< HIT > & operator=(const TimedHitPtr< HIT > &rhs)=default
assignment operator
TimedHitPtr::TimedHitPtr
TimedHitPtr(float eventTime, unsigned short eventId, const HIT *pHit, int pileupType=0)
use this constructor when hit has a PileUpTimeEventIndex
Definition: TimedHitPtr.h:32
TimedHitPtr::operator=
TimedHitPtr< HIT > & operator=(TimedHitPtr< HIT > &&rhs)=default
TimedHitPtr::m_eventId
unsigned short m_eventId
the index in PileUpEventInfo of the component event hosting this hit
Definition: TimedHitPtr.h:60
TimedHitPtr::operator->
const HIT * operator->() const
Definition: TimedHitPtr.h:40
TimedHitPtr
a smart pointer to a hit that also provides access to the extended timing info of the host event....
Definition: SCT_SurfaceChargesGenerator.h:77
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
TimedHitPtr::eventTime
float eventTime() const
t0 offset of the bunch xing containing the hit in ns.
Definition: TimedHitPtr.h:53
TimedHitPtr::pileupType
int pileupType() const
the type of event which the hit came from (signal, low pt minbias, high pt minbias,...
Definition: TimedHitPtr.h:49
TimedHitPtr::get
const HIT * get() const
Definition: TimedHitPtr.h:41
TimedHitPtr::TimedHitPtr
TimedHitPtr(TimedHitPtr< HIT > &&rhs)=default
TimedHitPtr::m_eventTime
float m_eventTime
t0 offset of the bunch xing in ns
Definition: TimedHitPtr.h:58
TimedHitPtr::TimedHitPtr
TimedHitPtr(const TimedHitPtr< HIT > &rhs)=default
TimedHitPtr::hitTime
friend float hitTime(const TimedHitPtr< FHIT > &)
TimedHitPtr::m_pHit
const HIT * m_pHit
Definition: TimedHitPtr.h:62
TimedHitPtr::operator*
const HIT & operator*() const
smart pointer interface
Definition: TimedHitPtr.h:39
hitTime
float hitTime(const TimedHitPtr< HIT > &tHit)
Definition: TimedHitPtr.h:69
TimedHitPtr::eventId
unsigned short eventId() const
the index of the component event in PileUpEventInfo.
Definition: TimedHitPtr.h:45
TimedHitPtr::TimedHitPtr
TimedHitPtr()=default
STL required constructors.
value_type
Definition: EDM_MasterSearch.h:11
operator<
bool operator<(const TimedHitPtr< HIT > &lhs, const TimedHitPtr< HIT > &rhs)
Definition: TimedHitPtr.h:76
TimedHitPtr::TimedHitPtr
TimedHitPtr(float eventTime, const HIT *pHit, int pileupType=0)
minimal constructor: pass only t0 offset of bunch xing
Definition: TimedHitPtr.h:29