Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,44 @@ struct Detector {
}
}();

/// A crossing without a hit on an inactive layer consumes zero holes in
/// both the pair test (LinkHoles.h) and the follower (Follow.h).
/// Hits can enter the fit through seeding or following, including between
/// two rows of a road and after the
/// outward walk. Inactive layers leave the other layers' material slab
/// boundaries in place (LayerMaterial.h). One bit per layer, or zero when
/// the layout has no inactive layers. ALICE 3's iTOF and oTOF use this policy.
static constexpr std::uint64_t inactiveLayers = [] {
if constexpr (requires { Layout::inactiveLayers; }) {
return static_cast<std::uint64_t>(Layout::inactiveLayers);
} else {
return std::uint64_t{0};
}
}();

/// The layers whose clusters carry their own time box, not a readout
/// frame's record (`Layout::hitTimedLayers`, a bit per layer; none if the
/// layout declares none): the measurement producer keeps a cluster's box
/// there as its converter wrote it. ALICE 3's TOF, whose box is the bunch
/// crossing that ends at the hit's time, in TRKFT3TOF. Their readout frames
/// (`FrameTiming`) only lay out the grid's time blocks.
static constexpr std::uint64_t hitTimedLayers = [] {
if constexpr (requires { Layout::hitTimedLayers; }) {
return static_cast<std::uint64_t>(Layout::hitTimedLayers);
} else {
return std::uint64_t{0};
}
}();

/// Layers are numbered barrel first, then discs.
[[nodiscard]] static constexpr bool isBarrelLayer(LayerID layer) { return hasBarrel && std::cmp_less(layer, nBarrelLayers); }

/// Whether \a layer is inactive (`inactiveLayers`).
[[nodiscard]] static constexpr bool isInactiveLayer(LayerID layer) { return std::cmp_less(layer, 64) && ((inactiveLayers >> layer) & 1U) != 0U; }

/// Whether \a layer's clusters carry their own time box (`hitTimedLayers`).
[[nodiscard]] static constexpr bool isHitTimedLayer(LayerID layer) { return std::cmp_less(layer, 64) && ((hitTimedLayers >> layer) & 1U) != 0U; }

/// Position of a disc layer within Layout::discLayers.
[[nodiscard]] static constexpr std::size_t discIndex(LayerID layer) { return static_cast<std::size_t>(layer) - static_cast<std::size_t>(nBarrelLayers); }

Expand Down

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Detectors/GenericTracking/study/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ o2_target_root_dictionary(GTrkStudy
LINKDEF src/GTrkStudyLinkDef.h)

# The sink, one unit per detector: each instantiates the tracker and its QA.
foreach(detector ITS MFT TRKFT3)
foreach(detector ITS MFT TRKFT3 TRKFT3TOF)
add_library(gtrk_sink_${detector} OBJECT src/MeasurementSinkSpec.cxx)
set_property(TARGET gtrk_sink_${detector} PROPERTY POSITION_INDEPENDENT_CODE ON)
target_compile_definitions(gtrk_sink_${detector} PRIVATE GTRK_SINK_DETECTOR=${detector})
Expand All @@ -72,12 +72,12 @@ o2_add_executable(mft-study-workflow
o2_add_executable(trk-study-workflow
SOURCES tools/gtrk-trk-study-workflow.cxx
COMPONENT_NAME gtrk
PUBLIC_LINK_LIBRARIES O2::GTrkStudy O2::DetectorsRaw O2::TRKWorkflow)
PUBLIC_LINK_LIBRARIES O2::GTrkStudy O2::DetectorsRaw O2::TRKWorkflow O2::IOTOFWorkflow)

# One unit per detector's run (TrackBench.h), the options and the dispatch in
# trackBench.cxx: the detectors compile in parallel.
o2_add_executable(track-bench
SOURCES tools/trackBench.cxx tools/trackBenchITS.cxx tools/trackBenchMFT.cxx tools/trackBenchTRKFT3.cxx
SOURCES tools/trackBench.cxx tools/trackBenchITS.cxx tools/trackBenchMFT.cxx tools/trackBenchTRKFT3.cxx tools/trackBenchTRKFT3TOF.cxx
COMPONENT_NAME gtrk
PUBLIC_LINK_LIBRARIES O2::GTrkStudy O2::Steer O2::CCDB Boost::program_options
TARGETVARNAME benchTarget)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "GenericTracking/Detectors/ITS.h"
#include "GenericTracking/Detectors/MFT.h"
#include "GenericTracking/Detectors/TRKFT3.h"
#include "GenericTracking/Detectors/TRKFT3TOF.h"

#include <concepts>
#include <cstdint>
Expand All @@ -45,9 +46,10 @@ enum class Chips : std::uint8_t { kITS,
kMFT,
kTRK };

/// Whose MC files a layout's are.
/// Whose MC files a layout's are: TRKFT3TOF's are the TRK's and FT3's, its
/// TRK sensors TRKFT3's (the TOF's hits are not read).
template <DetectorLayout Det>
requires std::same_as<Det, detectors::ITS> || std::same_as<Det, detectors::MFT> || std::same_as<Det, detectors::TRKFT3>
requires std::same_as<Det, detectors::ITS> || std::same_as<Det, detectors::MFT> || std::same_as<Det, detectors::TRKFT3> || std::same_as<Det, detectors::TRKFT3TOF>
[[nodiscard]] constexpr Chips chipsOf()
{
if constexpr (std::same_as<Det, detectors::ITS>) {
Expand Down
2 changes: 2 additions & 0 deletions Detectors/GenericTracking/study/src/MCVertexReaderSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "GenericTracking/Detectors/ITS.h"
#include "GenericTracking/Detectors/MFT.h"
#include "GenericTracking/Detectors/TRKFT3.h"
#include "GenericTracking/Detectors/TRKFT3TOF.h"
#include "GenericTracking/Workflow/DataSpecs.h"
#include "GenericTracking/Workflow/GridConfig.h"
#include "GenericTracking/Workflow/RecoParam.h"
Expand Down Expand Up @@ -171,5 +172,6 @@ DataProcessorSpec getMCVertexReaderSpec()
template DataProcessorSpec getMCVertexReaderSpec<detectors::ITS>();
template DataProcessorSpec getMCVertexReaderSpec<detectors::MFT>();
template DataProcessorSpec getMCVertexReaderSpec<detectors::TRKFT3>();
template DataProcessorSpec getMCVertexReaderSpec<detectors::TRKFT3TOF>();

} // namespace o2::gtrk::study
15 changes: 9 additions & 6 deletions Detectors/GenericTracking/study/src/MeasurementSinkSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "GenericTracking/Detectors/ITS.h"
#include "GenericTracking/Detectors/MFT.h"
#include "GenericTracking/Detectors/TRKFT3.h"
#include "GenericTracking/Detectors/TRKFT3TOF.h"
#include "GenericTracking/Tracking/Iteration.h"
#include "GenericTracking/Tracking/LayerMaterial.h"
#include "GenericTracking/Tracking/MeasurementGridBuilder.h"
Expand Down Expand Up @@ -112,6 +113,8 @@ namespace
#error "GTRK_SINK_DETECTOR names the sink's detector"
#endif
using Det = detectors::GTRK_SINK_DETECTOR;
/// ALICE 3's tracker, with or without its TOF layers: TRK's and FT3's MC files.
constexpr bool kAlice3Tracker = std::is_same_v<Det, detectors::TRKFT3> || std::is_same_v<Det, detectors::TRKFT3TOF>;
using Frame = TimeFrame<Det>;
using Tracklets = StageOutput<TrackletT>;
using Controller = workflow::TrackingInterface<Det>::Controller;
Expand Down Expand Up @@ -2918,7 +2921,7 @@ class MeasurementSinkTask : public Task
// The MC hits: the pulls with --o2-tracks, the true kinks behind the
// lost pairs and the tracks found incomplete, and the QA's outward legs.
if (mUseMC) {
mHits = openHits<Det>(ic.options().get<std::string>("mc-hits"), std::is_same_v<Det, detectors::TRKFT3> ? ic.options().get<std::string>("mc-ft3-hits") : "");
mHits = openHits<Det>(ic.options().get<std::string>("mc-hits"), kAlice3Tracker ? ic.options().get<std::string>("mc-ft3-hits") : "");
if (mHits) {
mHitIndex.emplace(*mHits);
}
Expand Down Expand Up @@ -3308,7 +3311,7 @@ class MeasurementSinkTask : public Task
const std::string name = mQAOutput->GetFile()->GetName();
if (mInterface.configured()) {
// The MC events: the signal source's, as the truth is.
streamRun(*mQAOutput, workflow::iterationCount(recoParam<Det>()), etaReach(PlacedEnvelopes<Det>::all()), findableRule(), mKinematics ? mKinematics->getNEvents(0) : 0U, std::is_same_v<Det, detectors::TRKFT3> ? 0U : (std::uint64_t{1} << Detector<Det>::nLayers) - 1U);
streamRun(*mQAOutput, workflow::iterationCount(recoParam<Det>()), etaReach(PlacedEnvelopes<Det>::all()), findableRule(), mKinematics ? mKinematics->getNEvents(0) : 0U, kAlice3Tracker ? 0U : (std::uint64_t{1} << Detector<Det>::nLayers) - 1U);
}
mQAOutput->Close();
mQAOutput.reset();
Expand Down Expand Up @@ -3594,7 +3597,7 @@ class MeasurementSinkTask : public Task
layers.push_back(crossing.layer);
}
}
if constexpr (std::is_same_v<Det, detectors::TRKFT3>) {
if constexpr (kAlice3Tracker) {
if (std::cmp_greater_equal(outward[id], findableRule().minLayers)) {
for (const auto& crossing : leg) {
outwardMasks[id] |= std::uint64_t{1} << crossing.layer;
Expand All @@ -3614,7 +3617,7 @@ class MeasurementSinkTask : public Task
}
const auto& helix = label->second.helix;
auto& extra = extras[id];
if constexpr (std::is_same_v<Det, detectors::TRKFT3>) {
if constexpr (kAlice3Tracker) {
if (const auto mask = outwardMasks.find(id); mask != outwardMasks.end()) {
extra.expectedLayerMask = mask->second;
}
Expand Down Expand Up @@ -4488,7 +4491,7 @@ class MeasurementSinkTask : public Task
{
if constexpr (std::is_same_v<Det, detectors::MFT>) {
return "sgn_HitsMFT.root";
} else if constexpr (std::is_same_v<Det, detectors::TRKFT3>) {
} else if constexpr (kAlice3Tracker) {
return "sgn_HitsTRK.root";
} else {
return "sgn_HitsITS.root";
Expand Down Expand Up @@ -4520,7 +4523,7 @@ DataProcessorSpec getMeasurementSinkSpec<Det>(bool useMC, bool withVertices, Tra
.algorithm = AlgorithmSpec{adaptFromTask<MeasurementSinkTask>(useMC, withVertices, products, conditions)},
.options = Options{{"collision-context", VariantType::String, "collisioncontext.root", {"collision context and MC-event mapping"}}, {"input-dir", VariantType::String, "none", {"input directory"}}, {"tracklet-truth-output", VariantType::String, "gtrk_tracklet_truth.csv", {"per-link pT and cot(theta) truth breakdown; empty disables"}}, {"dump-tracking-input", VariantType::String, "", {"write one timeframe's tracking input here, for o2-gtrk-track-bench"}}, {"dump-timeframe", VariantType::Int, 0, {"which timeframe --dump-tracking-input writes, counting from 0"}}, {"dump-only", VariantType::Bool, false, {"with --dump-tracking-input, the dumped timeframe is not tracked"}}, {"qa-output", VariantType::String, "", {"the MC truth QA as ROOT trees; empty disables"}}, {"outward-momenta", VariantType::Bool, false, {"with --qa-output and MC hits, the momenta tree: |p| along the outward leg of every findable electron and every 16th pion"}}, {"truth-study", VariantType::String, "", {"truth studies, <module>:<source>:<path> separated by ',': module gsf, species, decaycensus or decayfit, source truth (the particles' own rows) or tracks (the good tracks' rows), a .csv or .root path; with MC and its hits"}}, {"truth-select", VariantType::String, "", {"the truth studies' particles: key=value items separated by ';' -- origins=primary+decay+material, pdg=11+211, minPt=<GeV>, minRows=<n>, layers=<mask>, findable"}}, {"no-truth-reports", VariantType::Bool, false, {"with MC, no truth reports in the log (stages, true roads' chi2, fake anatomy): for the QA alone"}}, {"findable-min-pt", VariantType::Double, 0.1, {"the findable rule's pT floor [GeV]: the QA, the comparisons, the funnel"}}, {"o2-tracks", VariantType::String, "", {"O2's tracks of the same clusters (o2trac_its.root, mfttracks.root), compared under one set of truth rules"}}, {"mc-hits", VariantType::String, hitFileName(), {"O2's MC hits, for the pulls, the true kinks and the QA's outward legs"}}},
};
if constexpr (std::is_same_v<Det, detectors::TRKFT3>) {
if constexpr (kAlice3Tracker) {
spec.options.push_back({"mc-ft3-hits", VariantType::String, "sgn_HitsFT3.root", {"O2's MC hits of FT3's discs, with --mc-hits TRK's"}});
}
return spec;
Expand Down
6 changes: 4 additions & 2 deletions Detectors/GenericTracking/study/tools/TrackBench.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "GenericTracking/Detectors/ITS.h"
#include "GenericTracking/Detectors/MFT.h"
#include "GenericTracking/Detectors/TRKFT3.h"
#include "GenericTracking/Detectors/TRKFT3TOF.h"
#include "GenericTracking/Tracking/CpuBackend.h"
#include "GenericTracking/Tracking/MeasurementGrid.h"
#include "GenericTracking/Tracking/MeasurementGridBuilder.h"
Expand Down Expand Up @@ -1885,7 +1886,7 @@ int track(const Options& options) // NOLINT(readability-function-size): the benc
// (Conditions::orbitsPerTimeframe): its GRPECS's; ALICE 3's simulation
// writes none, and the dump's HBFUtils is its.
int orbitsPerTimeframe = 0;
if constexpr (std::same_as<Det, detectors::TRKFT3>) {
if constexpr (std::same_as<Det, detectors::TRKFT3> || std::same_as<Det, detectors::TRKFT3TOF>) {
orbitsPerTimeframe = o2::raw::HBFUtils::Instance().getNOrbitsPerTF();
} else {
const auto* ecs = ccdb.get<o2::parameters::GRPECSObject>("GLO/Config/GRPECS");
Expand Down Expand Up @@ -1971,7 +1972,7 @@ int track(const Options& options) // NOLINT(readability-function-size): the benc
throw std::runtime_error("--complete-anatomy and --truth-study need the MC truth");
}
if (!options.hits.empty()) {
hitFile = std::make_unique<study::HitFile>(options.hits, study::chipsOf<Det>(), std::is_same_v<Det, detectors::TRKFT3> ? options.ft3Hits : std::string{});
hitFile = std::make_unique<study::HitFile>(options.hits, study::chipsOf<Det>(), std::is_same_v<Det, detectors::TRKFT3> || std::is_same_v<Det, detectors::TRKFT3TOF> ? options.ft3Hits : std::string{});
hitIndex.emplace(*hitFile);
}
particleChains.emplace(study::ParticleChains::build(truth->rows, truth->particles, frame, hitIndex ? &*hitIndex : nullptr, *studyArena));
Expand Down Expand Up @@ -2777,6 +2778,7 @@ int track(const Options& options) // NOLINT(readability-function-size): the benc
extern template int track<detectors::ITS>(const Options& options);
extern template int track<detectors::MFT>(const Options& options);
extern template int track<detectors::TRKFT3>(const Options& options);
extern template int track<detectors::TRKFT3TOF>(const Options& options);

} // namespace o2::gtrk::study

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
// or submit itself to any jurisdiction.

/// \file gtrk-trk-study-workflow.cxx
/// \brief ALICE 3's TRK and FT3 clusters from O2's readers or upstream, with the study's sink (StudyWorkflow.h).
/// \brief ALICE 3's TRK and FT3 clusters from O2's readers or upstream, with the study's sink (StudyWorkflow.h);
/// with `--tof-layers` the TRKFT3TOF layout, the IOTOF's clusters too.

#include "StudyWorkflow.h"

Expand All @@ -25,11 +26,17 @@ using namespace o2::framework;
void customize(std::vector<o2::framework::CallbacksPolicy>& policies) { o2::raw::HBFUtilsInitializer::addNewTimeSliceCallback(policies); }

// NOLINTNEXTLINE(misc-use-internal-linkage)
void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions) { o2::gtrk::study::addStudyOptions(workflowOptions); }
void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
{
o2::gtrk::study::addStudyOptions(workflowOptions);
workflowOptions.push_back(ConfigParamSpec{"tof-layers", VariantType::Bool, false, {"the TRKFT3TOF layout: the IOTOF's clusters tracked as the TRK's"}});
}

#include "GenericTracking/Detectors/TRKFT3.h"
#include "GenericTracking/Detectors/TRKFT3TOF.h"

#include "Framework/runDataProcessing.h" // IWYU pragma: keep
#include "IOTOFWorkflow/ClusterReaderSpec.h"
#include "TRKWorkflow/ClusterReaderSpec.h"

#include <string>
Expand All @@ -39,7 +46,9 @@ WorkflowSpec defineDataProcessing(const ConfigContext& context)
o2::conf::ConfigurableParam::updateFromString(context.options().get<std::string>("configKeyValues"));

const bool useMC = !context.options().get<bool>("disable-mc");
auto specs = o2::gtrk::study::studyChain<o2::gtrk::detectors::TRKFT3>(context, {o2::trk::getTRKClusterReaderSpec(useMC), o2::trk::getFT3ClusterReaderSpec(useMC)});
auto specs = context.options().get<bool>("tof-layers")
? o2::gtrk::study::studyChain<o2::gtrk::detectors::TRKFT3TOF>(context, {o2::trk::getTRKClusterReaderSpec(useMC), o2::trk::getFT3ClusterReaderSpec(useMC), o2::iotof::getIOTOFClusterReaderSpec(useMC)})
: o2::gtrk::study::studyChain<o2::gtrk::detectors::TRKFT3>(context, {o2::trk::getTRKClusterReaderSpec(useMC), o2::trk::getFT3ClusterReaderSpec(useMC)});

const o2::raw::HBFUtilsInitializer hbfIni(context, specs);

Expand Down
14 changes: 8 additions & 6 deletions Detectors/GenericTracking/study/tools/trackBench.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ static int run(int argc, char** argv)
{
Options options;
bpo::options_description description("Track a dumped tracking input");
description.add_options() //
("help,h", "this message") //
("detector,d", bpo::value(&options.detector)->required(), "its, mft or trk: the ITS, the MFT or ALICE 3's barrel on O2's clusters") //
description.add_options() //
("help,h", "this message") //
("detector,d", bpo::value(&options.detector)->required(), "its, mft, trk or trktof: the ITS, the MFT, ALICE 3's barrel on O2's clusters, or with its TOF layers") //
("ccdb-url", bpo::value(&options.ccdbUrl)->default_value(o2::base::NameConf::getCCDBServer()),
"the conditions' CCDB, e.g. file://<sample>/ccdb for its snapshots: the aligned geometry (GLO/Config/GeometryAligned), the field (GLO/Config/GRPMagField, not "
"for trk) and the material LUT (GLO/Param/MatLUT, MFT/Param/MatLUT, TRK/Param/MatLUT), the sink's conditions") //
Expand Down Expand Up @@ -238,14 +238,13 @@ static int run(int argc, char** argv)

// The trial's keys and --threads go on in track, after the dump's own grid
// is known.
// The detector's parameter: GTRKRecoITS, GTRKRecoMFT, GTRKRecoTRK.
std::string detector = options.detector;
std::ranges::transform(detector, detector.begin(), [](unsigned char c) { return static_cast<char>(std::toupper(c)); });
loadConfiguration(options.config.empty() ? options.input + ".ini" : options.config, "GTRKReco" + detector);
// The conditions' CCDB: TrackBench.h reads the geometry and the material LUT from it too.
o2::ccdb::BasicCCDBManager::instance().setURL(options.ccdbUrl);
double bz = 0.;
if (options.detector == "trk") {
if (options.detector == "trk" || options.detector == "trktof") {
// ALICE 3's field is not in its GRP: O2's ALICE 3 field, as the workflow's conditions take it.
bz = alice::alice3BzKiloGauss();
o2::base::Propagator::Instance(true)->setNominalBz(static_cast<float>(bz));
Expand All @@ -263,7 +262,10 @@ static int run(int argc, char** argv)
if (options.detector == "trk") {
return track<detectors::TRKFT3>(options);
}
throw std::runtime_error("no detector called '" + options.detector + "'; its, mft or trk");
if (options.detector == "trktof") {
return track<detectors::TRKFT3TOF>(options);
}
throw std::runtime_error("no detector called '" + options.detector + "'; its, mft, trk or trktof");
}

} // namespace o2::gtrk::study
Expand Down
20 changes: 20 additions & 0 deletions Detectors/GenericTracking/study/tools/trackBenchTRKFT3TOF.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

/// \file trackBenchTRKFT3TOF.cxx
/// \brief The bench's run of TRKFT3TOF, the TRK with its TOF layers, in a unit of its own.

#include "TrackBench.h"

namespace o2::gtrk::study
{
template int track<detectors::TRKFT3TOF>(const Options& options);
} // namespace o2::gtrk::study
Loading
Loading