Skip to content

Commit 9026690

Browse files
committed
ITS: fix vertexer and move new types
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
1 parent 724ab6a commit 9026690

File tree

19 files changed

+151
-124
lines changed

19 files changed

+151
-124
lines changed

DataFormats/Detectors/ITSMFT/ITS/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@
1111

1212
o2_add_library(DataFormatsITS
1313
SOURCES src/TrackITS.cxx
14+
src/TimeEstBC.cxx
1415
PUBLIC_LINK_LIBRARIES O2::ReconstructionDataFormats
16+
O2::SimulationDataFormat
1517
O2::DataFormatsITSMFT)
1618

1719
o2_target_root_dictionary(DataFormatsITS
18-
HEADERS include/DataFormatsITS/TrackITS.h)
20+
HEADERS include/DataFormatsITS/TrackITS.h
21+
include/DataFormatsITS/Vertex.h
22+
include/DataFormatsITS/TimeEstBC.h)
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// Copyright 2019-2026 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
#ifndef O2_TRACKINGITS_TIMEESTBC_H_
13+
#define O2_TRACKINGITS_TIMEESTBC_H_
14+
15+
#include <limits>
16+
#include <cstdint>
17+
#include "CommonDataFormat/TimeStamp.h"
18+
#include "GPUCommonRtypes.h"
19+
#include "GPUCommonDef.h"
20+
#include "GPUCommonMath.h"
21+
22+
namespace o2::its
23+
{
24+
// Time estimates are given in BC
25+
// error needs to cover maximum 1 orbit
26+
// this is an symmetric time error [t0-tE, t0+tE)
27+
using TimeStampType = uint32_t;
28+
using TimeStampErrorType = uint16_t;
29+
class TimeEstBC : public o2::dataformats::TimeStampWithError<TimeStampType, TimeStampErrorType>
30+
{
31+
public:
32+
using Base = o2::dataformats::TimeStampWithError<TimeStampType, TimeStampErrorType>;
33+
GPUhdDefault() TimeEstBC() = default;
34+
GPUhdi() TimeEstBC(TimeStampType t, TimeStampErrorType e) : Base(t, e) {}
35+
36+
// check if timestamps overlap within their interval
37+
GPUhdi() bool isCompatible(const TimeEstBC& o) const noexcept
38+
{
39+
return !(upper() <= o.lower() || o.upper() <= lower());
40+
}
41+
42+
GPUhdi() TimeEstBC& operator+=(const TimeEstBC& o) noexcept
43+
{
44+
add(o);
45+
return *this;
46+
}
47+
48+
GPUhdi() TimeEstBC operator+(const TimeEstBC& o) const noexcept
49+
{
50+
TimeEstBC res = *this;
51+
res += o;
52+
return res;
53+
}
54+
55+
private:
56+
// add the other timestmap to this one
57+
// this assumes already that both overlap
58+
GPUhdi() void add(const TimeEstBC& o) noexcept
59+
{
60+
const TimeStampType lo = o2::gpu::CAMath::Max(lower(), o.lower());
61+
const TimeStampType hi = o2::gpu::CAMath::Min(upper(), o.upper());
62+
const TimeStampType half = (hi - lo) / 2u;
63+
this->setTimeStamp(lo + half);
64+
this->setTimeStampError(static_cast<TimeStampErrorType>(half));
65+
}
66+
67+
GPUhdi() TimeStampType upper() const noexcept
68+
{
69+
TimeStampType t = this->getTimeStamp();
70+
TimeStampType e = this->getTimeStampError();
71+
constexpr TimeStampType max = std::numeric_limits<TimeStampType>::max();
72+
return (t > (max - e)) ? max : t + e;
73+
}
74+
75+
GPUhdi() TimeStampType lower() const noexcept
76+
{
77+
TimeStampType t = this->getTimeStamp();
78+
TimeStampType e = this->getTimeStampError();
79+
return (t > e) ? (t - e) : 0u;
80+
}
81+
82+
ClassDefNV(TimeEstBC, 1);
83+
};
84+
} // namespace o2::its
85+
86+
#endif
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2019-2026 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
#ifndef O2_TRACKINGITS_VERTEX_H_
13+
#define O2_TRACKINGITS_VERTEX_H_
14+
15+
#include "ReconstructionDataFormats/Vertex.h"
16+
#include "SimulationDataFormat/MCCompLabel.h"
17+
#include "DataFormatsITS/TimeEstBC.h"
18+
19+
namespace o2::its
20+
{
21+
using Vertex = o2::dataformats::Vertex<o2::its::TimeEstBC>;
22+
using VertexLabel = std::pair<o2::MCCompLabel, float>;
23+
} // namespace o2::its
24+
25+
#endif

DataFormats/Detectors/ITSMFT/ITS/src/DataFormatsITSLinkDef.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,14 @@
1414
#pragma link off all globals;
1515
#pragma link off all classes;
1616
#pragma link off all functions;
17+
1718
#pragma link C++ class o2::its::TrackITS + ;
1819
#pragma link C++ class std::vector < o2::its::TrackITS> + ;
1920

21+
#pragma link C++ class o2::its::TimeEstBC + ;
22+
#pragma link C++ class std::vector < o2::its::TimeEstBC> + ;
23+
24+
#pragma link C++ class o2::dataformats::Vertex < o2::its::TimeEstBC> + ;
25+
#pragma link C++ class std::vector < o2::dataformats::Vertex < o2::its::TimeEstBC>> + ;
26+
2027
#endif

Detectors/ITSMFT/ITS/tracking/src/Definitions.cxx renamed to DataFormats/Detectors/ITSMFT/ITS/src/TimeEstBC.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12-
#include "ITStracking/Definitions.h"
12+
#include "DataFormatsITS/TimeEstBC.h"
1313
ClassImp(o2::its::TimeEstBC);

Detectors/ITSMFT/ITS/tracking/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ o2_add_library(ITStracking
2222
src/ClusterLines.cxx
2323
src/Vertexer.cxx
2424
src/VertexerTraits.cxx
25-
src/Definitions.cxx
2625
PUBLIC_LINK_LIBRARIES
2726
O2::GPUCommon
2827
Microsoft.GSL::GSL

Detectors/ITSMFT/ITS/tracking/include/ITStracking/Cell.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#define TRACKINGITSU_INCLUDE_CACELL_H_
1818

1919
#include "ITStracking/Constants.h"
20-
#include "ITStracking/Definitions.h"
20+
#include "DataFormatsITS/TimeEstBC.h"
2121
#include "ReconstructionDataFormats/Track.h"
2222
#include "GPUCommonDef.h"
2323

Detectors/ITSMFT/ITS/tracking/include/ITStracking/Cluster.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <array>
2020
#include "ITStracking/Constants.h"
2121
#include "GPUCommonRtypes.h"
22+
#include "GPUCommonDef.h"
2223

2324
namespace o2::its
2425
{

Detectors/ITSMFT/ITS/tracking/include/ITStracking/ClusterLines.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "ITStracking/Tracklet.h"
2121
#include "GPUCommonRtypes.h"
2222
#include "GPUCommonMath.h"
23+
#include "GPUCommonDef.h"
2324
#include "GPUCommonLogger.h"
2425

2526
namespace o2::its

Detectors/ITSMFT/ITS/tracking/include/ITStracking/Constants.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <array>
2020
#include <utility>
2121

22-
#include "ITStracking/Definitions.h"
22+
#include "GPUCommonDef.h"
2323
#include "GPUCommonDefAPI.h"
2424

2525
namespace o2::its::constants

0 commit comments

Comments
 (0)