Skip to content

Commit 4897a6a

Browse files
committed
ITS: add containedIn to TS
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
1 parent 5453589 commit 4897a6a

File tree

1 file changed

+12
-0
lines changed
  • DataFormats/Detectors/ITSMFT/ITS/include/DataFormatsITS

1 file changed

+12
-0
lines changed

DataFormats/Detectors/ITSMFT/ITS/include/DataFormatsITS/TimeEstBC.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,29 +35,40 @@ class TimeEstBC : public o2::dataformats::TimeStampWithError<TimeStampType, Time
3535
public:
3636
GPUhdDefault() TimeEstBC() = default;
3737
GPUhdi() TimeEstBC(TimeStampType t, TimeStampErrorType e) : Base(t, e) {}
38+
3839
// convert to symmetric center+-half representation
3940
GPUhdi() its::TimeStamp makeSymmetrical() const noexcept
4041
{
4142
const auto start = static_cast<float>(this->getTimeStamp());
4243
const float half = (float)this->getTimeStampError() / 2.f;
4344
return {start + half, half};
4445
}
46+
4547
// check if timestamps overlap within their interval
4648
GPUhdi() bool isCompatible(const TimeEstBC& o) const noexcept
4749
{
4850
return this->upper() > o.lower() && o.upper() > this->lower();
4951
}
52+
53+
// check if this time interval is fully contained within o
54+
GPUhdi() bool isContainedIn(const TimeEstBC& o) const noexcept
55+
{
56+
return this->lower() >= o.lower() && this->upper() <= o.upper();
57+
}
58+
5059
GPUhdi() TimeEstBC& operator+=(const TimeEstBC& o) noexcept
5160
{
5261
add(o);
5362
return *this;
5463
}
64+
5565
GPUhdi() TimeEstBC operator+(const TimeEstBC& o) const noexcept
5666
{
5767
TimeEstBC res = *this;
5868
res += o;
5969
return res;
6070
}
71+
6172
// upper bound of interval t0+tE
6273
GPUhdi() TimeStampType upper() const noexcept
6374
{
@@ -66,6 +77,7 @@ class TimeEstBC : public o2::dataformats::TimeStampWithError<TimeStampType, Time
6677
constexpr TimeStampType max = std::numeric_limits<TimeStampType>::max();
6778
return (t > (max - e)) ? max : t + e;
6879
}
80+
6981
// lower bound of interval t0
7082
GPUhdi() TimeStampType lower() const noexcept
7183
{

0 commit comments

Comments
 (0)