Skip to content

Commit c9acd57

Browse files
f3schshahor02mpuccio
authored
ITS: staggering (#15188)
* ITS: staggered tracking Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: various fixes also for GPU Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: fix vertexer and move new types Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: format Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: account for layer ROF bias in tracker Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: sort tracks in time by lower edge Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: ensure mc labels are nullptr Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITSMFT: account for possible delay of received ROFs Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: staggered STF decoder Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: fix track time-assignment Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: output vertices Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: add macro to check staggering in data Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * Adapt ITS/MFT CTF machinery to staggered data * Fix compilation of ALICE3 tracking with staggering * ITS: modify staggering macro Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITSMFT: runtime staggering option Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITSMFT: fix instantiation in namespace Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS3: fix compilation Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * Raw,CTF: add option to specify base cache dir for remote files Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: tracking same as dev Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: add back datastreams Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITSMFT: improve logging Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: add rofs for vertices back Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * add copyright to macro Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: hide print functions for device code Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITSMFT: add shim file for alpide param Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * try to fix macro compilation Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * Avoid wildcarded subspecs in Digit/ClusterWriter * ITS: fix rof lut to work properly with added errors Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * Fix/add some staggering options * Add ITS/MFT staggering options to dpl-workflow.sh To activate ITS or MFT staggering in the topology generation, export ITSSTAGGERED=1 or MFTSTAGGERED=1 respectively * ITS: try fix for QC Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: fix ROFLookpTables warning Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: fix tracklet formatting Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: set BCData properly for ROFs Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: remove deprecated settings Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: fix cluster label access for non-staggered Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITSMFT: fix staggering wfx option for digit-writer-workflow Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * Fix loop condition for ITS tracking layers * Fix/add some staggering options * Add ITS/MFT staggering options to dpl-workflow.sh To activate ITS or MFT staggering in the topology generation, export ITSSTAGGERED=1 or MFTSTAGGERED=1 respectively * ITSMFT: fix staggering wfx option for digit-writer-workflow Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * Fix loop condition for ITS tracking layers * Make ITS vertex messageable * remove unused variable * Add/fix staggering options to all workflows reading ITS,MFT clusters To pass the sim-challenge test. W/o this option even <workflow> -h leads to a crash. Strictly speaking, one could use in the DPLAlpideParamInitializer::isITSStaggeringEnabled and DPLAlpideParamInitializer::isMFTStaggeringEnabled a test ic.options().hasOption(stagITSOpt) and ic.options().hasOption(stagMFTOpt) before testing the option itself. But better to have an explicit detection of missing staggering option. * ITSMFT: fix digit reader Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * Remove leftover NROFs configurable from dpl-workflow.sh * ITS: fix time assignments Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: fix degenerate LSE for matrix solving Comparing the output of dev and this PR, I saw plently of cases where the system of equation was fully degenerate and produced to different floating instructions and compiler optimizations slightly different results. The solution is to discard the vertex cand. if the LSE becomes degenerate as not to produce non-sense solutions. Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: fix macro Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * MFT: fix track writer Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: fix gpu compile due change in vertexer types Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: move lookup table creation to proper place Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * Move FastMultEstimation to ITS tracking library * ITS: add containedIn to TS Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: fix vertexer Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: improve STFDecoder&Clusterer error messages and account for delay longer that ROF Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * Implement new kind of multiplicity mask * Adapt GPU code to the new mult mask * ITS: finalize tracking code Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: remove deltaRof for vertexer Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: report current timeslice Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * Vertex: also print time error Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * ITS: speedup vertexer Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> --------- Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> Co-authored-by: shahoian <ruben.shahoyan@cern.ch> Co-authored-by: Maximiliano Puccio <maximiliano.puccio@cern.ch>
1 parent 85fad07 commit c9acd57

File tree

216 files changed

+6352
-7206
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

216 files changed

+6352
-7206
lines changed

DataFormats/Detectors/GlobalTracking/src/RecoContainer.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include "ReconstructionDataFormats/TrackMCHMID.h"
3535
#include "DataFormatsITSMFT/TrkClusRef.h"
3636
#include "DataFormatsITSMFT/TopologyDictionary.h"
37-
#include "ITSMFTBase/DPLAlpideParam.h"
37+
#include "DataFormatsITSMFT/DPLAlpideParam.h"
3838
// FIXME: ideally, the data formats definition should be independent of the framework
3939
// collectData is using the input of ProcessingContext to extract the first valid
4040
// header and the TF orbit from it

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: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
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+
using TimeStampType = uint32_t;
27+
using TimeStampErrorType = uint16_t;
28+
// this is an symmetric time error [t0-tE, t0+tE]
29+
using TimeStamp = o2::dataformats::TimeStampWithError<float, float>;
30+
// this is an asymmetric time interval [t0, t0+tE] used for internal calculations
31+
class TimeEstBC : public o2::dataformats::TimeStampWithError<TimeStampType, TimeStampErrorType>
32+
{
33+
using Base = o2::dataformats::TimeStampWithError<TimeStampType, TimeStampErrorType>;
34+
35+
public:
36+
GPUhdDefault() TimeEstBC() = default;
37+
GPUhdi() TimeEstBC(TimeStampType t, TimeStampErrorType e) : Base(t, e) {}
38+
39+
// convert to symmetric center+-half representation
40+
GPUhdi() its::TimeStamp makeSymmetrical() const noexcept
41+
{
42+
const auto start = static_cast<float>(this->getTimeStamp());
43+
const float half = (float)this->getTimeStampError() / 2.f;
44+
return {start + half, half};
45+
}
46+
47+
// check if timestamps overlap within their interval
48+
GPUhdi() bool isCompatible(const TimeEstBC& o) const noexcept
49+
{
50+
return this->upper() > o.lower() && o.upper() > this->lower();
51+
}
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+
59+
GPUhdi() TimeEstBC& operator+=(const TimeEstBC& o) noexcept
60+
{
61+
add(o);
62+
return *this;
63+
}
64+
65+
GPUhdi() TimeEstBC operator+(const TimeEstBC& o) const noexcept
66+
{
67+
TimeEstBC res = *this;
68+
res += o;
69+
return res;
70+
}
71+
72+
// upper bound of interval t0+tE
73+
GPUhdi() TimeStampType upper() const noexcept
74+
{
75+
TimeStampType t = this->getTimeStamp();
76+
TimeStampType e = this->getTimeStampError();
77+
constexpr TimeStampType max = std::numeric_limits<TimeStampType>::max();
78+
return (t > (max - e)) ? max : t + e;
79+
}
80+
81+
// lower bound of interval t0
82+
GPUhdi() TimeStampType lower() const noexcept
83+
{
84+
return this->getTimeStamp();
85+
}
86+
87+
private:
88+
// intersect with the other timestamp
89+
// this assumes already that both overlap
90+
GPUhdi() void add(const TimeEstBC& o) noexcept
91+
{
92+
const TimeStampType lo = o2::gpu::CAMath::Max(this->lower(), o.lower());
93+
const TimeStampType hi = o2::gpu::CAMath::Min(this->upper(), o.upper());
94+
this->setTimeStamp(lo);
95+
this->setTimeStampError(static_cast<TimeStampErrorType>(hi - lo));
96+
}
97+
98+
ClassDefNV(TimeEstBC, 1);
99+
};
100+
101+
} // namespace o2::its
102+
103+
#endif

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
1+
// Copyright 2019-2026 CERN and copyright holders of ALICE O2.
22
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
33
// All rights not expressly granted are reserved.
44
//
@@ -16,11 +16,12 @@
1616
#ifndef ALICEO2_ITS_TRACKITS_H
1717
#define ALICEO2_ITS_TRACKITS_H
1818

19-
#include <vector>
19+
#include <cstdint>
2020

2121
#include "GPUCommonDef.h"
2222
#include "ReconstructionDataFormats/Track.h"
2323
#include "CommonDataFormat/RangeReference.h"
24+
#include "DataFormatsITS/TimeEstBC.h"
2425

2526
namespace o2
2627
{
@@ -35,8 +36,7 @@ namespace its
3536
class TrackITS : public o2::track::TrackParCov
3637
{
3738
enum UserBits {
38-
kNextROF = 1 << 28,
39-
kSharedClusters = 1 << 29
39+
kSharedClusters = 1 << 28
4040
};
4141

4242
using Cluster = o2::itsmft::Cluster;
@@ -93,6 +93,9 @@ class TrackITS : public o2::track::TrackParCov
9393

9494
bool isBetter(const TrackITS& best, float maxChi2) const;
9595

96+
GPUhdi() auto& getTimeStamp() { return mTime; }
97+
GPUhdi() const auto& getTimeStamp() const { return mTime; }
98+
9699
GPUhdi() o2::track::TrackParCov& getParamIn() { return *this; }
97100
GPUhdi() const o2::track::TrackParCov& getParamIn() const { return *this; }
98101

@@ -122,8 +125,6 @@ class TrackITS : public o2::track::TrackParCov
122125
}
123126
int getNFakeClusters() const;
124127

125-
void setNextROFbit(bool toggle = true) { mClusterSizes = toggle ? (mClusterSizes | kNextROF) : (mClusterSizes & ~kNextROF); }
126-
bool hasHitInNextROF() const { return mClusterSizes & kNextROF; }
127128
void setSharedClusters(bool toggle = true) { mClusterSizes = toggle ? (mClusterSizes | kSharedClusters) : (mClusterSizes & ~kSharedClusters); }
128129
bool hasSharedClusters() const { return mClusterSizes & kSharedClusters; }
129130

@@ -157,9 +158,10 @@ class TrackITS : public o2::track::TrackParCov
157158
ClusRefs mClusRef; ///< references on clusters
158159
float mChi2 = 0.; ///< Chi2 for this track
159160
uint32_t mPattern = 0; ///< layers pattern
160-
unsigned int mClusterSizes = 0u;
161+
uint32_t mClusterSizes = 0u; ///< 4bit packed cluster sizes
162+
TimeStamp mTime; ///< track time stamp with error in BC since start of TF, symmetrical
161163

162-
ClassDefNV(TrackITS, 6);
164+
ClassDefNV(TrackITS, 7);
163165
};
164166

165167
class TrackITSExt : public TrackITS
@@ -169,15 +171,13 @@ class TrackITSExt : public TrackITS
169171
static constexpr int MaxClusters = 16; /// Prepare for overlaps and new detector configurations
170172
using TrackITS::TrackITS; // inherit base constructors
171173

172-
GPUh() TrackITSExt(o2::track::TrackParCov&& parCov, short ncl, float chi2,
173-
o2::track::TrackParCov&& outer, std::array<int, MaxClusters> cls)
174+
GPUh() TrackITSExt(o2::track::TrackParCov&& parCov, short ncl, float chi2, o2::track::TrackParCov&& outer, std::array<int, MaxClusters> cls)
174175
: TrackITS(parCov, chi2, outer), mIndex{cls}
175176
{
176177
setNumberOfClusters(ncl);
177178
}
178179

179-
GPUh() TrackITSExt(o2::track::TrackParCov& parCov, short ncl, float chi2, std::uint32_t rof,
180-
o2::track::TrackParCov& outer, std::array<int, MaxClusters> cls)
180+
GPUh() TrackITSExt(o2::track::TrackParCov& parCov, short ncl, float chi2, std::uint32_t rof, o2::track::TrackParCov& outer, std::array<int, MaxClusters> cls)
181181
: TrackITS(parCov, chi2, outer), mIndex{cls}
182182
{
183183
setNumberOfClusters(ncl);
@@ -212,7 +212,7 @@ class TrackITSExt : public TrackITS
212212

213213
private:
214214
std::array<int, MaxClusters> mIndex = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; ///< Indices of associated clusters
215-
ClassDefNV(TrackITSExt, 2);
215+
ClassDefNV(TrackITSExt, 3);
216216
};
217217
} // namespace its
218218
} // namespace o2
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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 "GPUCommonDef.h"
16+
#ifndef GPUCA_GPUCODE_DEVICE
17+
#include <type_traits>
18+
#endif
19+
#include "ReconstructionDataFormats/Vertex.h"
20+
#include "SimulationDataFormat/MCCompLabel.h"
21+
#include "DataFormatsITS/TimeEstBC.h"
22+
23+
namespace o2::its
24+
{
25+
// NOTE: this uses the internal asymmetrical time reprenstation!
26+
using Vertex = o2::dataformats::Vertex<o2::its::TimeEstBC>;
27+
using VertexLabel = std::pair<o2::MCCompLabel, float>;
28+
} // namespace o2::its
29+
30+
#ifndef GPUCA_GPUCODE_DEVICE
31+
/// Defining ITS Vertex explicitly as messageable
32+
namespace o2::framework
33+
{
34+
template <typename T>
35+
struct is_messageable;
36+
template <>
37+
struct is_messageable<o2::dataformats::Vertex<o2::its::TimeEstBC>> : std::true_type {
38+
};
39+
} // namespace o2::framework
40+
#endif
41+
42+
#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
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
#include "DataFormatsITS/TimeEstBC.h"
13+
ClassImp(o2::its::TimeEstBC);

DataFormats/Detectors/ITSMFT/common/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2019-2020 CERN and copyright holders of ALICE O2.
1+
# Copyright 2019-2026 CERN and copyright holders of ALICE O2.
22
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
33
# All rights not expressly granted are reserved.
44
#
@@ -20,13 +20,18 @@ o2_add_library(DataFormatsITSMFT
2020
src/TopologyDictionary.cxx
2121
src/TimeDeadMap.cxx
2222
src/CTF.cxx
23+
src/DPLAlpideParam.cxx
24+
src/DPLAlpideParamInitializer.cxx
2325
PUBLIC_LINK_LIBRARIES O2::ITSMFTBase
26+
O2::DetectorsCommonDataFormats
2427
O2::ReconstructionDataFormats
28+
O2::CommonUtils
2529
Microsoft.GSL::GSL)
2630

2731
o2_target_root_dictionary(DataFormatsITSMFT
2832
HEADERS include/DataFormatsITSMFT/ROFRecord.h
2933
include/DataFormatsITSMFT/Digit.h
34+
include/DataFormatsITSMFT/DPLAlpideParam.h
3035
include/DataFormatsITSMFT/GBTCalibData.h
3136
include/DataFormatsITSMFT/NoiseMap.h
3237
include/DataFormatsITSMFT/TimeDeadMap.h

DataFormats/Detectors/ITSMFT/common/include/DataFormatsITSMFT/CTF.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ struct CTFHeader : public o2::ctf::CTFDictHeader {
3636
uint32_t nPatternBytes = 0; /// number of bytes for explict patterns
3737
uint32_t firstOrbit = 0; /// 1st orbit of TF
3838
uint16_t firstBC = 0; /// 1st BC of TF
39-
ClassDefNV(CTFHeader, 2);
39+
uint8_t maxStreams = 1; /// Number of streams per TF (== NLayers for staggered ITS/MFT readout, 1 for non-staggered one)
40+
uint8_t streamID = 0; /// ID of the stream (0:maxStreams-1)
41+
ClassDefNV(CTFHeader, 3);
4042
};
4143

4244
/// Compressed but not yet entropy-encoded clusters

0 commit comments

Comments
 (0)