54 LOG(info) <<
"initializing track matching";
56 auto config = ic.
options().
get<std::string>(
"mch-config");
57 if (!config.empty()) {
62 auto stop = [
this]() {
63 LOG(info) <<
"track matching duration = " << mElapsedTime.count() <<
" s";
73 auto mchTracks = pc.
inputs().
get<gsl::span<mch::TrackMCH>>(
"mchtracks");
75 auto midTracks = pc.
inputs().
get<gsl::span<mid::Track>>(
"midtracks");
77 auto tStart = std::chrono::high_resolution_clock::now();
79 auto tEnd = std::chrono::high_resolution_clock::now();
80 mElapsedTime += tEnd - tStart;
85 auto mchTrackLabels = pc.
inputs().
get<gsl::span<MCCompLabel>>(
"mchtracklabels");
86 auto midTrackLabels = pc.
inputs().
get<gsl::span<MCCompLabel>>(
"midtracklabels");
88 std::vector<MCCompLabel> muonLabels;
89 for (
const auto& muon : mTrackMatcher.
getMuons()) {
90 const auto& mchTrackLabel = mchTrackLabels[muon.getMCHRef().getIndex()];
91 const auto& midTrackLabel = midTrackLabels[muon.getMIDRef().getIndex()];
92 muonLabels.push_back(mchTrackLabel);
94 muonLabels.back().setFakeFlag(midTrackLabel.compare(mchTrackLabel) != 1);
104 std::chrono::duration<double> mElapsedTime{};
110 std::vector<InputSpec> inputSpecs{
InputSpec{
"mchrofs",
"MCH",
"TRACKROFS", 0, Lifetime::Timeframe},
111 InputSpec{
"mchtracks",
"MCH",
"TRACKS", 0, Lifetime::Timeframe},
112 InputSpec{
"midrofs",
"MID",
"TRACKROFS", 0, Lifetime::Timeframe},
113 InputSpec{
"midtracks",
"MID",
"TRACKS", 0, Lifetime::Timeframe}};
115 std::vector<OutputSpec> outputSpecs{
OutputSpec{{
"muontracks"},
"GLO",
"MTC_MCHMID", 0, Lifetime::Timeframe}};
118 inputSpecs.emplace_back(
InputSpec{
"mchtracklabels",
"MCH",
"TRACKLABELS", 0, Lifetime::Timeframe});
119 inputSpecs.emplace_back(
InputSpec{
"midtracklabels",
"MID",
"TRACKLABELS", 0, Lifetime::Timeframe});
121 outputSpecs.emplace_back(
OutputSpec{{
"muontracklabels"},
"GLO",
"MCMTC_MCHMID", 0, Lifetime::Timeframe});
129 Options{{
"mch-config", VariantType::String,
"", {
"JSON or INI file with matching parameters"}}}};
Definition of the MUON track.
Definition of the MCH track.
Definition of a data processor to match MCH and MID tracks.
Definition of a class to match MCH and MID tracks.
static void updateFromFile(std::string const &, std::string const ¶msList="", bool unchangedOnly=false)
T get(const char *key) const
void snapshot(const Output &spec, T const &object)
ServiceRegistryRef services()
ConfigParamRegistry const & options()
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
InputRecord & inputs()
The inputs associated with this processing context.
TrackMatcherTask(bool useMC=false)
void run(ProcessingContext &pc)
run the track matching
void init(InitContext &ic)
prepare the track matching
Class to match MCH and MID tracks.
void init()
prepare to run the matching algorithm
const std::vector< TrackMCHMID > & getMuons() const
get the MCH-MID matched tracks
void match(gsl::span< const mch::ROFRecord > &mchROFs, gsl::span< const mch::TrackMCH > &mchTracks, gsl::span< const mid::ROFRecord > &midROFs, gsl::span< const mid::Track > &midTracks)
run the matching algorithm
GLuint const GLchar * name
Defining PrimaryVertex explicitly as messageable.
std::vector< ConfigParamSpec > Options
DataProcessorSpec getTrackMatcherSpec(bool useMC, const char *name)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::vector< o2::mid::ROFRecord > midROFs
std::vector< o2::mch::ROFRecord > mchROFs
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"