Skip to content

Commit 0b61e9a

Browse files
authored
Merge branch 'AliceO2Group:dev' into new-detector4
2 parents 914e929 + 662f864 commit 0b61e9a

40 files changed

+493
-414
lines changed

DataFormats/simulation/include/SimulationDataFormat/TrackReference.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class TrackReference
171171
float mTrackLength = 0; ///< track length from its origin in cm
172172
float mTof = 0; ///< time of flight in cm
173173
Int_t mUserId = 0; ///< optional Id defined by user
174-
Int_t mDetectorId = 0; ///< Detector Id
174+
Int_t mDetectorId = -1; ///< sensitive Detector Id (-1 if unknown or in passive material)
175175
SimTrackStatus mStatus; ///< encoding the track status
176176

177177
friend std::ostream& operator<<(std::ostream&, const TrackReference&);

Detectors/AOD/src/AODProducerWorkflowSpec.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2717,7 +2717,7 @@ AODProducerWorkflowDPL::TrackQA AODProducerWorkflowDPL::processBarrelTrackQA(int
27172717
if (auto itsContGID = data.getITSContributorGID(trackIndex); itsContGID.isIndexSet() && itsContGID.getSource() != GIndex::ITSAB) {
27182718
const auto& itsOrig = data.getITSTrack(itsContGID);
27192719
o2::track::TrackPar gloCopy = trackPar;
2720-
o2::track::TrackPar itsCopy = itsOrig;
2720+
o2::track::TrackPar itsCopy = itsOrig.getParamOut();
27212721
o2::track::TrackPar tpcCopy = tpcOrig;
27222722
if (prop->propagateToX(gloCopy, o2::aod::track::trackQARefRadius, prop->getNominalBz(), o2::base::Propagator::MAX_SIN_PHI, o2::base::Propagator::MAX_STEP, mMatCorr) &&
27232723
prop->propagateToAlphaX(tpcCopy, gloCopy.getAlpha(), o2::aod::track::trackQARefRadius, false, o2::base::Propagator::MAX_SIN_PHI, o2::base::Propagator::MAX_STEP, 1, mMatCorr) &&

Detectors/ITSMFT/ITS/tracking/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ o2_add_library(ITStracking
3636
O2::ITSReconstruction
3737
O2::ITSMFTReconstruction
3838
O2::DataFormatsITS
39-
PRIVATE_LINK_LIBRARIES TBB::tbb)
39+
PRIVATE_LINK_LIBRARIES
40+
O2::Steer
41+
TBB::tbb)
4042

4143
o2_add_library(ITSTrackingInterface
4244
TARGETVARNAME targetName

Detectors/ITSMFT/ITS/tracking/GPU/cuda/TrackerTraitsGPU.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ void TrackerTraitsGPU<nLayers>::findRoads(const int iteration)
246246
this->mTrkParams[0].MaxChi2ClusterAttachment,
247247
this->mTrkParams[0].MaxChi2NDF,
248248
mTimeFrameGPU->getDevicePropagator(),
249-
this->mCorrType,
249+
this->mTrkParams[0].CorrType,
250250
conf.nBlocks,
251251
conf.nThreads);
252252
}
@@ -268,7 +268,7 @@ void TrackerTraitsGPU<nLayers>::findRoads(const int iteration)
268268
this->mTrkParams[0].MaxChi2ClusterAttachment, // float maxChi2ClusterAttachment
269269
this->mTrkParams[0].MaxChi2NDF, // float maxChi2NDF
270270
mTimeFrameGPU->getDevicePropagator(), // const o2::base::Propagator* propagator
271-
this->mCorrType, // o2::base::PropagatorImpl<float>::MatCorrType
271+
this->mTrkParams[0].CorrType, // o2::base::PropagatorImpl<float>::MatCorrType
272272
conf.nBlocks,
273273
conf.nThreads);
274274

Detectors/ITSMFT/ITS/tracking/GPU/cuda/TrackingKernels.cu

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,30 +58,43 @@ namespace gpu
5858
{
5959

6060
template <typename T>
61-
class TypedAllocator : public thrust::device_allocator<T>
62-
{
63-
public:
61+
struct TypedAllocator {
6462
using value_type = T;
65-
using pointer = T*;
63+
using pointer = thrust::device_ptr<T>;
64+
using const_pointer = thrust::device_ptr<const T>;
65+
using size_type = std::size_t;
66+
using difference_type = std::ptrdiff_t;
67+
68+
TypedAllocator() noexcept : mInternalAllocator(nullptr) {}
69+
explicit TypedAllocator(ExternalAllocator* a) noexcept : mInternalAllocator(a) {}
6670

6771
template <typename U>
68-
struct rebind {
69-
using other = TypedAllocator<U>;
70-
};
72+
TypedAllocator(const TypedAllocator<U>& o) noexcept : mInternalAllocator(o.mInternalAllocator)
73+
{
74+
}
7175

72-
explicit TypedAllocator(ExternalAllocator* allocPtr)
73-
: mInternalAllocator(allocPtr) {}
76+
pointer allocate(size_type n)
77+
{
78+
void* raw = mInternalAllocator->allocate(n * sizeof(T));
79+
return thrust::device_pointer_cast(static_cast<T*>(raw));
80+
}
7481

75-
T* allocate(size_t n)
82+
void deallocate(pointer p, size_type n) noexcept
7683
{
77-
return reinterpret_cast<T*>(mInternalAllocator->allocate(n * sizeof(T)));
84+
if (!p) {
85+
return;
86+
}
87+
void* raw = thrust::raw_pointer_cast(p);
88+
mInternalAllocator->deallocate(static_cast<char*>(raw), n * sizeof(T));
7889
}
7990

80-
void deallocate(T* p, size_t n)
91+
bool operator==(TypedAllocator const& o) const noexcept
92+
{
93+
return mInternalAllocator == o.mInternalAllocator;
94+
}
95+
bool operator!=(TypedAllocator const& o) const noexcept
8196
{
82-
char* raw_ptr = reinterpret_cast<char*>(p);
83-
size_t bytes = n * sizeof(T);
84-
mInternalAllocator->deallocate(raw_ptr, bytes); // redundant as internal dealloc is no-op.
97+
return !(*this == o);
8598
}
8699

87100
private:

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

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -26,36 +26,8 @@
2626
#include "DetectorsBase/Propagator.h"
2727
#include "ITStracking/Constants.h"
2828

29-
namespace o2
29+
namespace o2::its
3030
{
31-
namespace its
32-
{
33-
34-
enum class TrackingMode {
35-
Sync,
36-
Async,
37-
Cosmics,
38-
Unset, // Special value to leave a default in case we want to override via Configurable Params
39-
};
40-
41-
std::string asString(TrackingMode mode);
42-
std::ostream& operator<<(std::ostream& os, TrackingMode v);
43-
44-
template <typename Param>
45-
class Configuration : public Param
46-
{
47-
public:
48-
static Configuration<Param>& getInstance()
49-
{
50-
static Configuration<Param> instance;
51-
return instance;
52-
}
53-
Configuration(const Configuration<Param>&) = delete;
54-
const Configuration<Param>& operator=(const Configuration<Param>&) = delete;
55-
56-
private:
57-
Configuration() = default;
58-
};
5931

6032
struct TrackingParameters {
6133
int CellMinimumLevel() const noexcept { return MinTrackLength - constants::ClustersPerCell + 1; }
@@ -140,6 +112,8 @@ struct VertexingParameters {
140112
int zSpan = -1;
141113
bool SaveTimeBenchmarks = false;
142114

115+
bool useTruthSeeding = false; // overwrite found vertices with MC events
116+
143117
int nThreads = 1;
144118
bool PrintMemory = false; // print allocator usage in epilog report
145119
size_t MaxMemory = std::numeric_limits<size_t>::max();
@@ -166,7 +140,24 @@ struct TimeFrameGPUParameters {
166140
int maxGPUMemoryGB = -1;
167141
};
168142

169-
} // namespace its
170-
} // namespace o2
143+
namespace TrackingMode
144+
{
145+
enum Type : int8_t {
146+
Unset = -1, // Special value to leave a default in case we want to override via Configurable Params
147+
Sync = 0,
148+
Async = 1,
149+
Cosmics = 2,
150+
Off = 3,
151+
};
152+
153+
Type fromString(std::string_view str);
154+
std::string toString(Type mode);
155+
156+
std::vector<TrackingParameters> getTrackingParameters(Type mode);
157+
std::vector<VertexingParameters> getVertexingParameters(Type mode);
158+
159+
}; // namespace TrackingMode
160+
161+
} // namespace o2::its
171162

172163
#endif /* TRACKINGITSU_INCLUDE_CONFIGURATION_H_ */

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ class Tracker
7171
void setParameters(const std::vector<TrackingParameters>& p) { mTrkParams = p; }
7272
void setMemoryPool(std::shared_ptr<BoundedMemoryResource>& pool) { mMemoryPool = pool; }
7373
std::vector<TrackingParameters>& getParameters() { return mTrkParams; }
74-
void getGlobalConfiguration();
7574
void setBz(float bz) { mTraits->setBz(bz); }
76-
void setCorrType(const o2::base::PropagatorImpl<float>::MatCorrType type) { mTraits->setCorrType(type); }
7775
bool isMatLUT() const { return mTraits->isMatLUT(); }
7876
void setNThreads(int n, std::shared_ptr<tbb::task_arena>& arena) { mTraits->setNThreads(n, arena); }
7977
void printSummary() const;

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ class TrackerTraits
6565

6666
virtual void setBz(float bz);
6767
float getBz() const { return mBz; }
68-
void setCorrType(const o2::base::PropagatorImpl<float>::MatCorrType type) { mCorrType = type; }
6968
bool isMatLUT() const;
7069
virtual const char* getName() const noexcept { return "CPU"; }
7170
virtual bool isGPU() const noexcept { return false; }
@@ -99,7 +98,6 @@ class TrackerTraits
9998
std::shared_ptr<tbb::task_arena> mTaskArena;
10099

101100
protected:
102-
o2::base::PropagatorImpl<float>::MatCorrType mCorrType = o2::base::PropagatorImpl<float>::MatCorrType::USEMatCorrNONE;
103101
o2::gpu::GPUChainITS* mChain = nullptr;
104102
TimeFrame<nLayers>* mTimeFrame;
105103
std::vector<TrackingParameters> mTrkParams;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ struct VertexerParamConfig : public o2::conf::ConfigurableParamHelper<VertexerPa
4848
int ZBins = 1; // z-phi index table configutation: number of z bins
4949
int PhiBins = 128; // z-phi index table configutation: number of phi bins
5050

51+
bool useTruthSeeding{false}; // overwrite seeding vertices with MC truth
52+
5153
int nThreads = 1;
5254
bool printMemory = false;
5355
size_t maxMemory = std::numeric_limits<size_t>::max();

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

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,7 @@ class ITSTrackingInterface
6868

6969
// Custom
7070
void setTraitsFromProvider(VertexerTraits*, TrackerTraits7*, TimeFrame7*);
71-
void setTrackingMode(TrackingMode mode = TrackingMode::Unset)
72-
{
73-
if (mode == TrackingMode::Unset) {
74-
LOGP(fatal, "ITS Tracking mode Unset is meant to be a default. Specify the mode");
75-
}
76-
mMode = mode;
77-
}
71+
void setTrackingMode(TrackingMode::Type mode = TrackingMode::Unset) { mMode = mode; }
7872

7973
auto getTracker() const { return mTracker.get(); }
8074
auto getVertexer() const { return mVertexer.get(); }
@@ -86,14 +80,13 @@ class ITSTrackingInterface
8680
gsl::span<const itsmft::CompClusterExt> clusters,
8781
gsl::span<const unsigned char>::iterator& pattIt,
8882
const dataformats::MCTruthContainer<MCCompLabel>* mcLabels);
89-
void getConfiguration(framework::ProcessingContext& pc);
9083

9184
private:
9285
bool mIsMC = false;
9386
bool mRunVertexer = true;
9487
bool mCosmicsProcessing = false;
9588
int mUseTriggers = 0;
96-
TrackingMode mMode = TrackingMode::Unset;
89+
TrackingMode::Type mMode = TrackingMode::Unset;
9790
bool mOverrideBeamEstimation = false;
9891
const o2::itsmft::TopologyDictionary* mDict = nullptr;
9992
std::unique_ptr<Tracker> mTracker = nullptr;

0 commit comments

Comments
 (0)