Skip to content

Commit be04421

Browse files
committed
ITS3: adapt staggering
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
1 parent a8b31f7 commit be04421

16 files changed

Lines changed: 586 additions & 398 deletions

File tree

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ namespace o2::its
3434
{
3535
class ITSTrackingInterface
3636
{
37+
public:
3738
static constexpr int NLayers{7};
3839
using VertexerN = Vertexer<NLayers>;
3940
using VertexerTraitsN = VertexerTraits<NLayers>;
4041
using TrackerN = Tracker<NLayers>;
4142
using TrackerTraitsN = TrackerTraits<NLayers>;
4243
using TimeFrameN = TimeFrame<NLayers>;
4344

44-
public:
4545
ITSTrackingInterface(bool isMC,
4646
bool doStag,
4747
int trgType,
@@ -80,6 +80,7 @@ class ITSTrackingInterface
8080
TimeFrameN* mTimeFrame = nullptr;
8181

8282
protected:
83+
virtual void requestTopologyDictionary(framework::ProcessingContext& pc);
8384
virtual void loadROF(gsl::span<const itsmft::ROFRecord>& trackROFspan,
8485
gsl::span<const itsmft::CompClusterExt> clusters,
8586
gsl::span<const unsigned char>::iterator& pattIt,
@@ -98,7 +99,7 @@ class ITSTrackingInterface
9899
const o2::itsmft::TopologyDictionary* mDict = nullptr;
99100
std::unique_ptr<TrackerN> mTracker = nullptr;
100101
std::unique_ptr<VertexerN> mVertexer = nullptr;
101-
const o2::dataformats::MeanVertexObject* mMeanVertex;
102+
const o2::dataformats::MeanVertexObject* mMeanVertex{};
102103
std::shared_ptr<BoundedMemoryResource> mMemoryPool;
103104
std::shared_ptr<tbb::task_arena> mTaskArena;
104105
};

Detectors/ITSMFT/ITS/tracking/src/TrackingInterface.cxx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ void ITSTrackingInterface::updateTimeDependentParams(framework::ProcessingContex
362362
}
363363
if (!initOnceDone) { // this params need to be queried only once
364364
initOnceDone = true;
365-
pc.inputs().get<o2::itsmft::TopologyDictionary*>("itscldict"); // just to trigger the finaliseCCDB
365+
requestTopologyDictionary(pc);
366366
pc.inputs().get<o2::itsmft::DPLAlpideParam<o2::detectors::DetID::ITS>*>("itsalppar");
367367
if (pc.inputs().getPos("itsTGeo") >= 0) {
368368
pc.inputs().get<o2::its::GeometryTGeo*>("itsTGeo");
@@ -474,6 +474,11 @@ void ITSTrackingInterface::setTraitsFromProvider(VertexerTraitsN* vertexerTraits
474474
mVertexer->setMemoryPool(mMemoryPool);
475475
}
476476

477+
void ITSTrackingInterface::requestTopologyDictionary(framework::ProcessingContext& pc)
478+
{
479+
pc.inputs().get<o2::itsmft::TopologyDictionary*>("itscldict"); // just to trigger the finaliseCCDB
480+
}
481+
477482
void ITSTrackingInterface::loadROF(gsl::span<const itsmft::ROFRecord>& trackROFspan,
478483
gsl::span<const itsmft::CompClusterExt> clusters,
479484
gsl::span<const unsigned char>::iterator& pattIt,

Detectors/Upgrades/ITS3/reconstruction/include/ITS3Reconstruction/IOUtils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ int loadROFrameDataITS3(its::TimeFrame<7>* tf,
8383
gsl::span<const itsmft::CompClusterExt> clusters,
8484
gsl::span<const unsigned char>::iterator& pattIt,
8585
const o2::its3::TopologyDictionary* dict,
86+
int layer,
8687
const dataformats::MCTruthContainer<MCCompLabel>* mcLabels = nullptr);
8788
} // namespace its3::ioutils
8889
} // namespace o2

Detectors/Upgrades/ITS3/reconstruction/include/ITS3Reconstruction/TrackingInterface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ class ITS3TrackingInterface final : public its::ITSTrackingInterface
2424
using its::ITSTrackingInterface::ITSTrackingInterface;
2525

2626
void setClusterDictionary(const o2::its3::TopologyDictionary* d) { mDict = d; }
27-
void updateTimeDependentParams(framework::ProcessingContext& pc) final;
2827
void finaliseCCDB(framework::ConcreteDataMatcher& matcher, void* obj) final;
2928

3029
protected:
30+
void requestTopologyDictionary(framework::ProcessingContext& pc) final;
3131
void loadROF(gsl::span<const itsmft::ROFRecord>& trackROFspan,
3232
gsl::span<const itsmft::CompClusterExt> clusters,
3333
gsl::span<const unsigned char>::iterator& pattIt,

Detectors/Upgrades/ITS3/reconstruction/src/IOUtils.cxx

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,21 @@ int loadROFrameDataITS3(its::TimeFrame<7>* tf,
6161
gsl::span<const itsmft::CompClusterExt> clusters,
6262
gsl::span<const unsigned char>::iterator& pattIt,
6363
const its3::TopologyDictionary* dict,
64+
int layer,
6465
const dataformats::MCTruthContainer<MCCompLabel>* mcLabels)
6566
{
6667
auto geom = its::GeometryTGeo::Instance();
6768
geom->fillMatrixCache(o2::math_utils::bit2Mask(o2::math_utils::TransformType::T2L, o2::math_utils::TransformType::L2G));
6869

69-
// tf->resetROFrameData(rofs.size()); // FIXME
70-
// tf->prepareROFrameData(rofs, clusters); FIXME
70+
tf->resetROFrameData(layer);
71+
tf->prepareROFrameData(clusters, layer);
72+
73+
// check for missing/empty/unset rofs
74+
// the code requires consistent monotonically increasing input without gaps
75+
const auto& timing = tf->getROFOverlapTableView().getLayer(layer);
76+
if (timing.mNROFsTF != rofs.size()) {
77+
LOGP(fatal, "Received inconsistent number of rofs on layer:{} expected:{} received:{}", layer, timing.mNROFsTF, rofs.size());
78+
}
7179

7280
its::bounded_vector<uint8_t> clusterSizeVec(clusters.size(), tf->getMemoryPool().get());
7381

@@ -110,22 +118,22 @@ int loadROFrameDataITS3(its::TimeFrame<7>* tf,
110118
tf->addClusterToLayer(layer, gloXYZ.x(), gloXYZ.y(), gloXYZ.z(), tf->getUnsortedClusters()[layer].size());
111119
tf->addClusterExternalIndexToLayer(layer, clusterId);
112120
}
113-
for (unsigned int iL{0}; iL < tf->getUnsortedClusters().size(); ++iL) {
114-
tf->mROFramesClusters[iL][iRof + 1] = (int)tf->getUnsortedClusters()[iL].size();
115-
}
121+
tf->mROFramesClusters[layer][iRof + 1] = (int)tf->getUnsortedClusters()[layer].size();
116122
}
117123

118-
// tf->setClusterSize(clusterSizeVec); FIXME
124+
tf->setClusterSize(layer, clusterSizeVec);
119125

120-
for (auto& v : tf->mNTrackletsPerCluster) {
121-
v.resize(tf->getUnsortedClusters()[1].size());
122-
}
123-
for (auto& v : tf->mNTrackletsPerClusterSum) {
124-
v.resize(tf->getUnsortedClusters()[1].size() + 1);
126+
if (layer == 1) {
127+
for (auto& v : tf->mNTrackletsPerCluster) {
128+
v.resize(tf->getUnsortedClusters()[1].size());
129+
}
130+
for (auto& v : tf->mNTrackletsPerClusterSum) {
131+
v.resize(tf->getUnsortedClusters()[1].size() + 1);
132+
}
125133
}
126134

127135
if (mcLabels != nullptr) {
128-
// tf->mClusterLabels = mcLabels; // FIXME
136+
tf->mClusterLabels[layer] = mcLabels;
129137
}
130138
return 0;
131139
}

Detectors/Upgrades/ITS3/reconstruction/src/TrackingInterface.cxx

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "ITS3Reconstruction/TrackingInterface.h"
1313
#include "ITS3Reconstruction/IOUtils.h"
1414
#include "ITSBase/GeometryTGeo.h"
15+
#include "ITStracking/FastMultEstConfig.h"
1516
#include "ITStracking/TrackingConfigParam.h"
1617
#include "DataFormatsITSMFT/DPLAlpideParam.h"
1718
#include "DetectorsBase/GRPGeomHelper.h"
@@ -20,30 +21,9 @@
2021
namespace o2::its3
2122
{
2223

23-
void ITS3TrackingInterface::updateTimeDependentParams(framework::ProcessingContext& pc)
24+
void ITS3TrackingInterface::requestTopologyDictionary(framework::ProcessingContext& pc)
2425
{
25-
o2::base::GRPGeomHelper::instance().checkUpdates(pc);
26-
static bool initOnceDone = false;
27-
if (!initOnceDone) { // this params need to be queried only once
28-
initOnceDone = true;
29-
pc.inputs().get<o2::its3::TopologyDictionary*>("cldict"); // just to trigger the finaliseCCDB
30-
pc.inputs().get<o2::itsmft::DPLAlpideParam<o2::detectors::DetID::ITS>*>("alppar");
31-
if (pc.inputs().getPos("itsTGeo") >= 0) {
32-
pc.inputs().get<o2::its::GeometryTGeo*>("itsTGeo");
33-
}
34-
auto geom = its::GeometryTGeo::Instance();
35-
geom->fillMatrixCache(o2::math_utils::bit2Mask(o2::math_utils::TransformType::T2L, o2::math_utils::TransformType::T2GRot, o2::math_utils::TransformType::T2G));
36-
initialise();
37-
if (pc.services().get<const o2::framework::DeviceSpec>().inputTimesliceId == 0) { // print settings only for the 1st pipeling
38-
o2::its::VertexerParamConfig::Instance().printKeyValues();
39-
o2::its::TrackerParamConfig::Instance().printKeyValues();
40-
const auto& trParams = getTracker()->getParameters();
41-
for (size_t it = 0; it < trParams.size(); it++) {
42-
const auto& par = trParams[it];
43-
LOGP(info, "recoIter#{} : {}", it, par.asString());
44-
}
45-
}
46-
}
26+
pc.inputs().get<o2::its3::TopologyDictionary*>("itscldict"); // just to trigger the finaliseCCDB
4727
}
4828

4929
void ITS3TrackingInterface::finaliseCCDB(framework::ConcreteDataMatcher& matcher, void* obj)
@@ -80,7 +60,7 @@ void ITS3TrackingInterface::loadROF(gsl::span<const itsmft::ROFRecord>& trackROF
8060
int layer,
8161
const dataformats::MCTruthContainer<MCCompLabel>* mcLabels)
8262
{
83-
// ioutils::loadROFrameDataITS3(mTimeFrame, trackROFspan, clusters, pattIt, mDict, mcLabels);
63+
ioutils::loadROFrameDataITS3(mTimeFrame, trackROFspan, clusters, pattIt, mDict, layer, mcLabels);
8464
}
8565

8666
} // namespace o2::its3

Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/Digitizer.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ class Digitizer : public TObject
5454
void init();
5555

5656
/// Steer conversion of hits to digits
57-
void process(const std::vector<itsmft::Hit>* hits, int evID, int srcID);
58-
void setEventTime(const o2::InteractionTimeRecord& irt);
57+
void process(const std::vector<itsmft::Hit>* hits, int evID, int srcID, int layer);
58+
void setEventTime(const o2::InteractionTimeRecord& irt, int layer);
5959
double getEndTimeOfROFMax() const
6060
{
6161
///< return the time corresponding to end of the last reserved ROFrame : mROFrameMax
@@ -64,7 +64,7 @@ class Digitizer : public TObject
6464

6565
void setContinuous(bool v) { mParams.setContinuous(v); }
6666
bool isContinuous() const { return mParams.isContinuous(); }
67-
void fillOutputContainer(uint32_t maxFrame = 0xffffffff);
67+
void fillOutputContainer(uint32_t maxFrame = 0xffffffff, int layer = -1);
6868

6969
// provide the common itsmft::GeometryTGeo to access matrices and segmentation
7070
void setGeometry(const o2::its::GeometryTGeo* gm) { mGeometry = gm; }
@@ -76,13 +76,19 @@ class Digitizer : public TObject
7676
mEventROFrameMin = 0xffffffff;
7777
mEventROFrameMax = 0;
7878
}
79+
void resetROFrameBounds()
80+
{
81+
mROFrameMin = 0;
82+
mROFrameMax = 0;
83+
mNewROFrame = 0;
84+
}
7985

8086
void setDeadChannelsMap(const o2::itsmft::NoiseMap* mp) { mDeadChanMap = mp; }
8187

8288
private:
83-
void processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID);
89+
void processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID, int layer);
8490
void registerDigits(o2::its3::ChipDigitsContainer& chip, uint32_t roFrame, float tInROF, int nROF,
85-
uint16_t row, uint16_t col, int nEle, o2::MCCompLabel& lbl);
91+
uint16_t row, uint16_t col, int nEle, o2::MCCompLabel& lbl, int layer);
8692

8793
ExtraDig* getExtraDigBuffer(uint32_t roFrame)
8894
{
@@ -105,6 +111,7 @@ class Digitizer : public TObject
105111
uint32_t mROFrameMin = 0; ///< lowest RO frame of current digits
106112
uint32_t mROFrameMax = 0; ///< highest RO frame of current digits
107113
uint32_t mNewROFrame = 0; ///< ROFrame corresponding to provided time
114+
bool mIsBeforeFirstRO = false;
108115

109116
uint32_t mEventROFrameMin = 0xffffffff; ///< lowest RO frame for processed events (w/o automatic noise ROFs)
110117
uint32_t mEventROFrameMax = 0; ///< highest RO frame forfor processed events (w/o automatic noise ROFs)

0 commit comments

Comments
 (0)