Skip to content

Commit 99aad7a

Browse files
authored
Merge a94a33b into sapling-pr-archive-ehellbar
2 parents 042aa05 + a94a33b commit 99aad7a

17 files changed

Lines changed: 226 additions & 71 deletions

File tree

Detectors/ITSMFT/ITS/tracking/GPU/ITStrackingGPU/TrackingKernels.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ void trackSeedHandler(CellSeed<nLayers>* trackSeeds,
219219
const float maxChi2ClusterAttachment,
220220
const float maxChi2NDF,
221221
const int reseedIfShorter,
222+
const bool repeatRefitOut,
222223
const bool shiftRefToCluster,
223224
const o2::base::Propagator* propagator,
224225
const o2::base::PropagatorF::MatCorrType matCorrType,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ void TrackerTraitsGPU<nLayers>::findRoads(const int iteration)
336336
startLevel, // const int startLevel,
337337
this->mTrkParams[0].MaxChi2ClusterAttachment, // float maxChi2ClusterAttachment
338338
this->mTrkParams[0].MaxChi2NDF, // float maxChi2NDF
339+
this->mTrkParams[0].RepeatRefitOut,
339340
this->mTrkParams[0].ReseedIfShorter,
340341
this->mTrkParams[0].ShiftRefToCluster,
341342
mTimeFrameGPU->getDevicePropagator(), // const o2::base::Propagator* propagator

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ GPUg() void __launch_bounds__(256, 1) fitTrackSeedsKernel(
291291
const float maxChi2ClusterAttachment,
292292
const float maxChi2NDF,
293293
const int reseedIfShorter,
294+
const bool repeatRefitOut,
294295
const bool shifRefToCluster,
295296
const o2::base::Propagator* propagator,
296297
const o2::base::PropagatorF::MatCorrType matCorrType)
@@ -337,6 +338,34 @@ GPUg() void __launch_bounds__(256, 1) fitTrackSeedsKernel(
337338
if (!fitSuccess || temporaryTrack.getPt() < minPts[nLayers - temporaryTrack.getNClusters()]) {
338339
continue;
339340
}
341+
if (repeatRefitOut) { // repeat outward refit seeding and linearizing with the stable inward fit result
342+
o2::track::TrackParCov saveInw{temporaryTrack};
343+
linRef = saveInw; // use refitted track as lin.reference
344+
float saveChi2 = temporaryTrack.getChi2();
345+
temporaryTrack.resetCovariance();
346+
temporaryTrack.setCov(temporaryTrack.getQ2Pt() * temporaryTrack.getQ2Pt() * temporaryTrack.getCov()[o2::track::CovLabels::kSigQ2Pt2], o2::track::CovLabels::kSigQ2Pt2);
347+
temporaryTrack.setChi2(0);
348+
fitSuccess = fitTrack(temporaryTrack, // TrackITSExt& track,
349+
0, // int lastLayer,
350+
nLayers, // int firstLayer,
351+
1, // int firstCluster,
352+
maxChi2ClusterAttachment, // float maxChi2ClusterAttachment,
353+
maxChi2NDF, // float maxChi2NDF,
354+
o2::constants::math::VeryBig, // float maxQoverPt,
355+
0, // nCl,
356+
bz, // float bz,
357+
foundTrackingFrameInfo, // TrackingFrameInfo** trackingFrameInfo,
358+
propagator, // const o2::base::Propagator* propagator,
359+
matCorrType, // o2::base::PropagatorF::MatCorrType matCorrType
360+
&linRef,
361+
shifRefToCluster);
362+
if (!fitSuccess) {
363+
continue;
364+
}
365+
temporaryTrack.getParamOut() = temporaryTrack.getParamIn();
366+
temporaryTrack.getParamIn() = saveInw;
367+
temporaryTrack.setChi2(saveChi2);
368+
}
340369
tracks[iCurrentTrackSeedIndex] = temporaryTrack;
341370
}
342371
}
@@ -1174,6 +1203,7 @@ void trackSeedHandler(CellSeed<nLayers>* trackSeeds,
11741203
const float maxChi2ClusterAttachment,
11751204
const float maxChi2NDF,
11761205
const int reseedIfShorter,
1206+
const bool repeatRefitOut,
11771207
const bool shiftRefToCluster,
11781208
const o2::base::Propagator* propagator,
11791209
const o2::base::PropagatorF::MatCorrType matCorrType,
@@ -1195,6 +1225,7 @@ void trackSeedHandler(CellSeed<nLayers>* trackSeeds,
11951225
maxChi2ClusterAttachment, // float
11961226
maxChi2NDF, // float
11971227
reseedIfShorter, // int
1228+
repeatRefitOut, // bool
11981229
shiftRefToCluster, // bool
11991230
propagator, // const o2::base::Propagator*
12001231
matCorrType); // o2::base::PropagatorF::MatCorrType
@@ -1375,6 +1406,7 @@ template void trackSeedHandler(CellSeed<7>* trackSeeds,
13751406
const float maxChi2ClusterAttachment,
13761407
const float maxChi2NDF,
13771408
const int reseedIfShorter,
1409+
const bool repeatRefitOut,
13781410
const bool shiftRefToCluster,
13791411
const o2::base::Propagator* propagator,
13801412
const o2::base::PropagatorF::MatCorrType matCorrType,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ struct TrackingParameters {
6969
int ReseedIfShorter = 6; // reseed for the final fit track with the length shorter than this
7070
std::vector<float> MinPt = {0.f, 0.f, 0.f, 0.f};
7171
unsigned char StartLayerMask = 0x7F;
72+
bool RepeatRefitOut = true; // repeat outward refit using inward refit as a seed
7273
bool ShiftRefToCluster = true; // TrackFit: after update shift the linearization reference to cluster
7374
bool FindShortTracks = false;
7475
bool PerPrimaryVertexProcessing = false;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ struct TrackerParamConfig : public o2::conf::ConfigurableParamHelper<TrackerPara
9898
int nIterations = MaxIter; // overwrite the number of iterations
9999
int reseedIfShorter = 6; // for the final refit reseed the track with circle if they are shorter than this value
100100
bool shiftRefToCluster{true}; // TrackFit: after update shift the linearization reference to cluster
101+
bool repeatRefitOut{false}; // repeat outward refit using inward refit as a seed
101102
bool createArtefactLabels{false}; // create on-the-fly labels for the artefacts
102103

103104
int nThreads = 1;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ std::vector<TrackingParameters> TrackingMode::getTrackingParameters(TrackingMode
187187
p.MinPt[lslot] *= bFactor;
188188
}
189189
p.ReseedIfShorter = tc.reseedIfShorter;
190+
p.RepeatRefitOut = tc.repeatRefitOut;
190191
p.ShiftRefToCluster = tc.shiftRefToCluster;
191192
p.createArtefactLabels = tc.createArtefactLabels;
192193

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,22 @@ void TrackerTraits<nLayers>::findRoads(const int iteration)
778778
if (!fitSuccess || temporaryTrack.getPt() < mTrkParams[iteration].MinPt[mTrkParams[iteration].NLayers - temporaryTrack.getNClusters()]) {
779779
return 0;
780780
}
781+
if (mTrkParams[0].RepeatRefitOut) { // repeat outward refit seeding and linearizing with the stable inward fit result
782+
o2::track::TrackParCov saveInw{temporaryTrack};
783+
linRef = saveInw; // use refitted track as lin.reference
784+
float saveChi2 = temporaryTrack.getChi2();
785+
temporaryTrack.resetCovariance();
786+
temporaryTrack.setCov(temporaryTrack.getQ2Pt() * temporaryTrack.getQ2Pt() * temporaryTrack.getCov()[o2::track::CovLabels::kSigQ2Pt2], o2::track::CovLabels::kSigQ2Pt2);
787+
temporaryTrack.setChi2(0);
788+
fitSuccess = fitTrack(temporaryTrack, 0, mTrkParams[0].NLayers, 1, mTrkParams[0].MaxChi2ClusterAttachment, mTrkParams[0].MaxChi2NDF, o2::constants::math::VeryBig, 0, &linRef);
789+
if (!fitSuccess) {
790+
return 0;
791+
}
792+
temporaryTrack.getParamOut() = temporaryTrack.getParamIn();
793+
temporaryTrack.getParamIn() = saveInw;
794+
temporaryTrack.setChi2(saveChi2);
795+
}
796+
781797
if constexpr (decltype(Tag)::value == PassMode::OnePass::value) {
782798
tracks.push_back(temporaryTrack);
783799
} else if constexpr (decltype(Tag)::value == PassMode::TwoPassCount::value) {

Detectors/TRD/workflow/include/TRDWorkflow/TRDPulseHeightSpec.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class PuseHeightDevice : public o2::framework::Task
6969
mPulseHeight->reset();
7070
mPulseHeight->process();
7171
pc.outputs().snapshot(Output{"TRD", "PULSEHEIGHT", 0}, mPulseHeight->getPHData());
72+
pc.outputs().snapshot(Output{"TRD", "PULSEHEIGHTHD", 0}, mPulseHeight->getPHDataHD());
7273
if (pc.transitionState() == TransitionHandlingState::Requested) {
7374
LOG(info) << "Run stop requested, finalizing";
7475
mRunStopRequested = true;
@@ -103,6 +104,7 @@ DataProcessorSpec getTRDPulseHeightSpec(GID::mask_t src, bool digitsFromReader)
103104

104105
std::vector<OutputSpec> outputs;
105106
outputs.emplace_back(o2::header::gDataOriginTRD, "PULSEHEIGHT", 0, Lifetime::Timeframe);
107+
outputs.emplace_back(o2::header::gDataOriginTRD, "PULSEHEIGHTHD", 0, Lifetime::Timeframe);
106108

107109
bool isTPCavailable = false;
108110
if (GID::includesSource(GID::Source::ITSTPC, src)) {

Framework/AnalysisSupport/src/AODWriterHelpers.cxx

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ const static std::unordered_map<OutputObjHandlingPolicy, std::string> ROOTfileNa
6262

6363
AlgorithmSpec AODWriterHelpers::getOutputTTreeWriter(ConfigContext const& ctx)
6464
{
65-
auto& ac = ctx.services().get<DanglingEdgesContext>();
6665
auto dod = AnalysisSupportHelpers::getDataOutputDirector(ctx);
6766
int compressionLevel = 505;
6867
if (ctx.options().hasOption("aod-writer-compression")) {
6968
compressionLevel = ctx.options().get<int>("aod-writer-compression");
7069
}
71-
return AlgorithmSpec{[dod, outputInputs = ac.outputsInputsAOD, compressionLevel](InitContext& ic) -> std::function<void(ProcessingContext&)> {
70+
return AlgorithmSpec{[dod, compressionLevel](InitContext& ic) -> std::function<void(ProcessingContext&)> {
71+
auto outputInputs = ic.services().get<DanglingEdgesContext>().outputsInputsAOD;
7272
LOGP(debug, "======== getGlobalAODSink::Init ==========");
7373

7474
// find out if any table needs to be saved
@@ -241,14 +241,13 @@ AlgorithmSpec AODWriterHelpers::getOutputTTreeWriter(ConfigContext const& ctx)
241241
};
242242
}
243243

244-
AlgorithmSpec AODWriterHelpers::getOutputObjHistWriter(ConfigContext const& ctx)
244+
AlgorithmSpec AODWriterHelpers::getOutputObjHistWriter(ConfigContext const& /*ctx*/)
245245
{
246-
using namespace monitoring;
247-
auto& ac = ctx.services().get<DanglingEdgesContext>();
248-
auto tskmap = ac.outTskMap;
249-
auto objmap = ac.outObjHistMap;
250-
251-
return AlgorithmSpec{[objmap, tskmap](InitContext& ic) -> std::function<void(ProcessingContext&)> {
246+
return AlgorithmSpec{[](InitContext& ic) -> std::function<void(ProcessingContext&)> {
247+
using namespace monitoring;
248+
auto& dec = ic.services().get<DanglingEdgesContext>();
249+
auto tskmap = dec.outTskMap;
250+
auto objmap = dec.outObjHistMap;
252251
auto& callbacks = ic.services().get<CallbackService>();
253252
auto inputObjects = std::make_shared<std::vector<std::pair<InputObjectRoute, InputObject>>>();
254253

@@ -278,7 +277,7 @@ AlgorithmSpec AODWriterHelpers::getOutputObjHistWriter(ConfigContext const& ctx)
278277

279278
callbacks.set<CallbackService::Id::EndOfStream>(endofdatacb);
280279
return [inputObjects, objmap, tskmap](ProcessingContext& pc) mutable -> void {
281-
auto mergePart = [&inputObjects, &objmap, &tskmap, &pc](DataRef const& ref) {
280+
auto mergePart = [&inputObjects, &objmap, &tskmap](DataRef const& ref) {
282281
O2_SIGNPOST_ID_GENERATE(hid, histogram_registry);
283282
O2_SIGNPOST_START(histogram_registry, hid, "mergePart", "Merging histogram");
284283
if (!ref.header) {
@@ -474,7 +473,7 @@ AlgorithmSpec AODWriterHelpers::getOutputObjHistWriter(ConfigContext const& ctx)
474473
};
475474
O2_SIGNPOST_ID_GENERATE(rid, histogram_registry);
476475
O2_SIGNPOST_START(histogram_registry, rid, "processParts", "Start merging %zu parts received together.", pc.inputs().getNofParts(0));
477-
for (int pi = 0; pi < pc.inputs().getNofParts(0); ++pi) {
476+
for (auto pi = 0U; pi < pc.inputs().getNofParts(0); ++pi) {
478477
mergePart(pc.inputs().get("x", pi));
479478
}
480479
O2_SIGNPOST_END(histogram_registry, rid, "processParts", "Done histograms in multipart message.");

Framework/CCDBSupport/src/AnalysisCCDBHelpers.cxx

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -67,38 +67,39 @@ void fillValidRoutes(CCDBFetcherHelper& helper, std::vector<o2::framework::Outpu
6767
}
6868
} // namespace
6969

70-
AlgorithmSpec AnalysisCCDBHelpers::fetchFromCCDB(ConfigContext const& ctx)
70+
AlgorithmSpec AnalysisCCDBHelpers::fetchFromCCDB(ConfigContext const& /*ctx*/)
7171
{
72-
auto& ac = ctx.services().get<DanglingEdgesContext>();
73-
std::vector<std::shared_ptr<arrow::Schema>> schemas;
74-
auto schemaMetadata = std::make_shared<arrow::KeyValueMetadata>();
72+
return adaptStateful([](ConfigParamRegistry const& options, DeviceSpec const& spec, InitContext& ic) {
73+
auto& dec = ic.services().get<DanglingEdgesContext>();
74+
std::vector<std::shared_ptr<arrow::Schema>> schemas;
75+
auto schemaMetadata = std::make_shared<arrow::KeyValueMetadata>();
7576

76-
for (auto& input : ac.analysisCCDBInputs) {
77-
std::vector<std::shared_ptr<arrow::Field>> fields;
78-
schemaMetadata->Append("outputRoute", DataSpecUtils::describe(input));
79-
schemaMetadata->Append("outputBinding", input.binding);
77+
for (auto& input : dec.analysisCCDBInputs) {
78+
std::vector<std::shared_ptr<arrow::Field>> fields;
79+
schemaMetadata->Append("outputRoute", DataSpecUtils::describe(input));
80+
schemaMetadata->Append("outputBinding", input.binding);
8081

81-
for (auto& m : input.metadata) {
82-
// Save the list of input tables
83-
if (m.name.starts_with("input:")) {
84-
auto name = m.name.substr(6);
85-
schemaMetadata->Append("sourceTable", name);
86-
schemaMetadata->Append("sourceMatcher", DataSpecUtils::describe(std::get<ConcreteDataMatcher>(DataSpecUtils::fromMetadataString(m.defaultValue.get<std::string>()).matcher)));
87-
continue;
88-
}
89-
// Ignore the non ccdb: entries
90-
if (!m.name.starts_with("ccdb:")) {
91-
continue;
82+
for (auto& m : input.metadata) {
83+
// Save the list of input tables
84+
if (m.name.starts_with("input:")) {
85+
auto name = m.name.substr(6);
86+
schemaMetadata->Append("sourceTable", name);
87+
schemaMetadata->Append("sourceMatcher", DataSpecUtils::describe(std::get<ConcreteDataMatcher>(DataSpecUtils::fromMetadataString(m.defaultValue.get<std::string>()).matcher)));
88+
continue;
89+
}
90+
// Ignore the non ccdb: entries
91+
if (!m.name.starts_with("ccdb:")) {
92+
continue;
93+
}
94+
// Create the schema of the output
95+
auto metadata = std::make_shared<arrow::KeyValueMetadata>();
96+
metadata->Append("url", m.defaultValue.asString());
97+
auto columnName = m.name.substr(strlen("ccdb:"));
98+
fields.emplace_back(std::make_shared<arrow::Field>(columnName, arrow::binary_view(), false, metadata));
9299
}
93-
// Create the schema of the output
94-
auto metadata = std::make_shared<arrow::KeyValueMetadata>();
95-
metadata->Append("url", m.defaultValue.asString());
96-
auto columnName = m.name.substr(strlen("ccdb:"));
97-
fields.emplace_back(std::make_shared<arrow::Field>(columnName, arrow::binary_view(), false, metadata));
100+
schemas.emplace_back(std::make_shared<arrow::Schema>(fields, schemaMetadata));
98101
}
99-
schemas.emplace_back(std::make_shared<arrow::Schema>(fields, schemaMetadata));
100-
}
101-
return adaptStateful([schemas](CallbackService& callbacks, ConfigParamRegistry const& options, DeviceSpec const& spec) {
102+
102103
std::shared_ptr<CCDBFetcherHelper> helper = std::make_shared<CCDBFetcherHelper>();
103104
CCDBFetcherHelper::initialiseHelper(*helper, options);
104105
std::unordered_map<std::string, int> bindings;
@@ -129,11 +130,11 @@ AlgorithmSpec AnalysisCCDBHelpers::fetchFromCCDB(ConfigContext const& ctx)
129130
int outputRouteIndex = bindings.at(outRouteDesc);
130131
auto& spec = helper->routes[outputRouteIndex].matcher;
131132
std::vector<std::shared_ptr<arrow::BinaryViewBuilder>> builders;
132-
for (auto& _ : schema->fields()) {
133+
for (auto const& _ : schema->fields()) {
133134
builders.emplace_back(std::make_shared<arrow::BinaryViewBuilder>());
134135
}
135136

136-
for (size_t ci = 0; ci < timestampColumn->num_chunks(); ++ci) {
137+
for (auto ci = 0; ci < timestampColumn->num_chunks(); ++ci) {
137138
std::shared_ptr<arrow::Array> chunk = timestampColumn->chunk(ci);
138139
auto const* timestamps = chunk->data()->GetValuesSafe<size_t>(1);
139140

0 commit comments

Comments
 (0)