20#include <Math/SMatrix.h>
21#include <Math/SVector.h>
42 mMaxChi2 = 4. * trackMatcherParam.sigmaCut * trackMatcherParam.sigmaCut;
48 gsl::span<const mid::ROFRecord>&
midROFs, gsl::span<const mid::Track>& midTracks)
57 std::map<InteractionRecord, int> midSortedROFs{};
59 midSortedROFs[
midROFs[
i].interactionRecord] =
i;
62 for (
const auto& mchROF :
mchROFs) {
65 auto itStartMIDROF = midSortedROFs.lower_bound(mchROF.getBCData());
66 auto itEndMIDROF = midSortedROFs.upper_bound(mchROF.getBCData() + (mchROF.getBCWidth() - 1));
68 for (
auto iMCHTrack = mchROF.getFirstIdx(); iMCHTrack <= mchROF.getLastIdx(); ++iMCHTrack) {
70 double bestMatchChi2(mMaxChi2);
72 uint32_t iBestMIDTrack(0);
74 for (
auto itMIDROF = itStartMIDROF; itMIDROF != itEndMIDROF; ++itMIDROF) {
76 const auto& midROF =
midROFs[itMIDROF->second];
77 for (
auto iMIDTrack = midROF.firstEntry; iMIDTrack < midROF.firstEntry + midROF.nEntries; ++iMIDTrack) {
80 double matchChi2 =
match(mchTracks[iMCHTrack], midTracks[iMIDTrack]);
81 if (matchChi2 < bestMatchChi2) {
82 bestMatchChi2 = matchChi2;
83 iBestMIDROF = itMIDROF->second;
84 iBestMIDTrack = uint32_t(iMIDTrack);
90 if (iBestMIDROF >= 0) {
91 mMuons.emplace_back(uint32_t(iMCHTrack), iBestMIDTrack,
midROFs[iBestMIDROF].interactionRecord,
99 return mu1.getIR() < mu2.getIR();
112 mchParam[2] + mchParam[3] * dZ - midTrack.
getPositionY(),
117 SMatrix4 jacobian(ROOT::Math::SMatrixIdentity{});
120 auto sumCov = ROOT::Math::Similarity(jacobian, mchCov);
131 if (!sumCov.Invert()) {
132 LOG(error) <<
"Covariance matrix inversion failed: " << sumCov;
135 return ROOT::Math::Similarity(paramDiff, sumCov);
Configurable parameters for MCH-MID track matching.
Definition of a class to match MCH and MID tracks.
static const TrackMatcherParam & Instance()
MCH track external format.
double getZAtMID() const
get the track z position on the MID side where the parameters are evaluated
const double * getCovariancesAtMID() const
get the track parameter covariances on the MID side
const double * getParametersAtMID() const
get the track parameters on the MID side
This class defines the MID track.
float getDirectionY() const
Gets the track y direction.
float getDirectionX() const
Gets the track x direction.
@ VarX
Variance on X position.
@ VarSlopeX
Variance on X slope.
@ VarY
Variance on Y position.
@ CovXSlopeX
Covariance on X position and slope.
@ CovYSlopeY
Covariance on Y position and slope.
@ VarSlopeY
Variance on Y slope.
float getPositionY() const
Gets the track y position.
float getCovarianceParameter(CovarianceParamIndex covParam) const
returns the covariance parameter covParam
float getPositionX() const
Gets the track x position.
float getPositionZ() const
Gets the track z position.
void init()
prepare to run the matching algorithm
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
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"