Skip to content
Merged
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
122 changes: 93 additions & 29 deletions Common/TableProducer/fwdtrackPropagation.cxx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// 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.
Expand All @@ -13,7 +13,7 @@
/// \brief Common task to produce propagated forward tracks
/// \author Maurice Coquet <maurice.louis.coquet@cern.ch>
/// \author Luca Micheletti <luca.micheletti@cern.ch>
/// \author Daiki Sekihata <daiki.sekihata@cern.ch>

Check warning on line 16 in Common/TableProducer/fwdtrackPropagation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \file is missing, incorrect or misplaced.

#include <string>
#include <map>
Expand Down Expand Up @@ -64,15 +64,19 @@
Configurable<float> minRabs{"minRabs", 17.6, "min. R at absorber end"};
Configurable<float> midRabs{"midRabs", 26.5, "middle R at absorber end for pDCA cut"};
Configurable<float> maxRabs{"maxRabs", 89.5, "max. R at absorber end"};
Configurable<float> maxDCAxy{"maxDCAxy", 1e+10, "max. DCAxy for global muons"};
Configurable<float> maxPDCAforLargeR{"maxPDCAforLargeR", 324.f, "max. pDCA for large R at absorber end"};
Configurable<float> maxPDCAforSmallR{"maxPDCAforSmallR", 594.f, "max. pDCA for small R at absorber end"};
Configurable<float> maxMatchingChi2MCHMFT{"maxMatchingChi2MCHMFT", 50.f, "max. chi2 for MCH-MFT matching"};
Configurable<float> maxChi2{"maxChi2", 1e+6, "max. chi2 for muon tracking"};
Configurable<bool> refitGlobalMuon{"refitGlobalMuon", false, "flag to refit global muon"};
Configurable<bool> applyEtaCutToSAinGL{"applyEtaCutToSAinGL", false, "flag to apply eta cut to samuon in global muon"};
Configurable<float> maxChi2SA{"maxChi2SA", 1e+6, "max. chi2 for standalone muon"};
Configurable<float> maxChi2GL{"maxChi2GL", 1e+6, "max. chi2 for global muon"};
Configurable<bool> refitGlobalMuon{"refitGlobalMuon", true, "flag to refit global muon"};
Configurable<bool> applyDEtaDPhi{"cfgApplyDEtaDPhi", false, "flag to apply deta-dphi elliptic cut"};
Configurable<float> minDEta{"minDEta", 0.1, "min deta between MFT-MCH-MID and its attached MID-MCH at PV"};
Configurable<float> minDPhi{"minDPhi", 0.1, "min dphi between MFT-MCH-MID and its attached MID-MCH at PV"};

HistogramRegistry fRegistry{"fRegistry"};
static constexpr std::string_view muon_types[5] = {"MFTMCHMID/", "MFTMCHMIDOtherMatch/", "MFTMCH/", "MCHMID/", "MCH/"};

Check warning on line 79 in Common/TableProducer/fwdtrackPropagation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.

void init(o2::framework::InitContext&)
{
Expand Down Expand Up @@ -125,8 +129,8 @@

fRegistry.add("MFTMCHMID/hPt", "pT;p_{T} (GeV/c)", kTH1F, {{100, 0.0f, 10}}, false);
fRegistry.add("MFTMCHMID/hRelDiffPt", "pT resolution;p_{T} (GeV/c);#Deltap_{T}/p_{T}", kTH2F, {{100, 0.0f, 10}, {200, 0, 0.2}}, false);
fRegistry.add("MFTMCHMID/hEtaPhi", "#eta vs. #varphi;#varphi (rad.);#eta", kTH2F, {{180, 0, 2 * M_PI}, {60, -5.f, -2.f}}, false);

Check warning on line 132 in Common/TableProducer/fwdtrackPropagation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pi-multiple-fraction]

Use multiples/fractions of PI defined in o2::constants::math.

Check warning on line 132 in Common/TableProducer/fwdtrackPropagation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[external-pi]

Use the PI constant (and its multiples and fractions) defined in o2::constants::math.
fRegistry.add("MFTMCHMID/hEtaPhi_MatchedMCHMID", "#eta vs. #varphi;#varphi (rad.);#eta", kTH2F, {{180, 0, 2 * M_PI}, {60, -5.f, -2.f}}, false);

Check warning on line 133 in Common/TableProducer/fwdtrackPropagation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pi-multiple-fraction]

Use multiples/fractions of PI defined in o2::constants::math.

Check warning on line 133 in Common/TableProducer/fwdtrackPropagation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[external-pi]

Use the PI constant (and its multiples and fractions) defined in o2::constants::math.
fRegistry.add("MFTMCHMID/hDiffCollId", "difference in collision index;collisionId_{TTCA} - collisionId_{MP}", kTH1F, {{41, -20.5, +20.5}}, false);
fRegistry.add("MFTMCHMID/hSign", "sign;sign", kTH1F, {{3, -1.5, +1.5}}, false);
fRegistry.add("MFTMCHMID/hNclusters", "Nclusters;Nclusters", kTH1F, {{21, -0.5f, 20.5}}, false);
Expand All @@ -138,9 +142,9 @@
fRegistry.add("MFTMCHMID/hChi2MatchMCHMID", "chi2 match MCH-MID;chi2", kTH1F, {{100, 0.0f, 100}}, false);
fRegistry.add("MFTMCHMID/hChi2MatchMCHMFT", "chi2 match MCH-MFT;chi2", kTH1F, {{100, 0.0f, 100}}, false);
fRegistry.add("MFTMCHMID/hMatchScoreMCHMFT", "match score MCH-MFT;score", kTH1F, {{100, 0.0f, 100}}, false);
fRegistry.add("MFTMCHMID/hDCAxy2D", "DCA x vs. y;DCA_{x} (cm);DCA_{y} (cm)", kTH2F, {{200, -0.1, 0.1}, {200, -0.1, +0.1}}, false);
fRegistry.add("MFTMCHMID/hDCAxy2D", "DCA x vs. y;DCA_{x} (cm);DCA_{y} (cm)", kTH2F, {{200, -0.5, 0.5}, {200, -0.5, +0.5}}, false);
fRegistry.add("MFTMCHMID/hDCAxy2DinSigma", "DCA x vs. y in sigma;DCA_{x} (#sigma);DCA_{y} (#sigma)", kTH2F, {{200, -10, 10}, {200, -10, +10}}, false);
fRegistry.add("MFTMCHMID/hDCAxy", "DCAxy;DCA_{xy} (cm);", kTH1F, {{100, 0, 0.1}}, false);
fRegistry.add("MFTMCHMID/hDCAxy", "DCAxy;DCA_{xy} (cm);", kTH1F, {{100, 0, 1}}, false);
fRegistry.add("MFTMCHMID/hDCAxyinSigma", "DCAxy in sigma;DCA_{xy} (#sigma);", kTH1F, {{100, 0, 10}}, false);
fRegistry.addClone("MFTMCHMID/", "MCHMID/");
fRegistry.add("MFTMCHMID/hDCAxResolutionvsPt", "DCA_{x} vs. p_{T};p_{T} (GeV/c);DCA_{x} resolution (#mum);", kTH2F, {{100, 0, 10.f}, {500, 0, 500}}, false);
Expand All @@ -149,36 +153,111 @@
fRegistry.add("MCHMID/hDCAyResolutionvsPt", "DCA_{y} vs. p_{T};p_{T} (GeV/c);DCA_{y} resolution (#mum);", kTH2F, {{100, 0, 10.f}, {500, 0, 5e+5}}, false);
}

bool isSelected(const float pt, const float eta, const float rAtAbsorberEnd, const float pDCA, const float chi2, const uint8_t trackType, const float etaMatchedMCHMID)
bool isSelected(const float pt, const float eta, const float rAtAbsorberEnd, const float pDCA, const float chi2, const uint8_t trackType, const float dcaXY)
{
if (pt < minPt || maxPt < pt) {
return false;
}

if (rAtAbsorberEnd < minRabs || maxRabs < rAtAbsorberEnd) {
return false;
}

if (chi2 < 0.f || maxChi2 < chi2) {
if (rAtAbsorberEnd < midRabs ? pDCA > maxPDCAforSmallR : pDCA > maxPDCAforLargeR) {
return false;
}

if (trackType == static_cast<uint8_t>(o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack)) {
if (eta < minEtaGL || maxEtaGL < eta) {
return false;
}
if (applyEtaCutToSAinGL && (etaMatchedMCHMID < minEtaSA || maxEtaSA < etaMatchedMCHMID)) {
if (maxDCAxy < dcaXY) {
return false;
}
if (chi2 < 0.f || maxChi2GL < chi2) {
return false;
}
} else if (trackType == static_cast<uint8_t>(o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack)) {
if (eta < minEtaSA || maxEtaSA < eta) {
return false;
}
if (chi2 < 0.f || maxChi2SA < chi2) {
return false;
}
} else {
return false;
}

if (rAtAbsorberEnd < midRabs ? pDCA > maxPDCAforSmallR : pDCA > maxPDCAforLargeR) {
return true;
}

template <typename TFwdTracks, typename TMFTTracks, typename TCollision, typename TTarget, typename TCandidates>
bool isBestMatch(TCollision const& collision, TTarget const& target, TCandidates const& candidates)
{
std::map<int64_t, float> map_chi2MFTMCH;

Check warning on line 195 in Common/TableProducer/fwdtrackPropagation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
for (const auto& matchedtrack : candidates) { // MFT-MCH-MID or MFT-MCH
if (matchedtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) {
continue;
}
o2::dataformats::GlobalFwdTrack propmuonAtPV = propagateMuon(matchedtrack, collision, propagationPoint::kToVertex);
float eta = propmuonAtPV.getEta();
float phi = propmuonAtPV.getPhi();
if (refitGlobalMuon) {
const auto& mfttrack = matchedtrack.template matchMFTTrack_as<TMFTTracks>();
eta = mfttrack.eta();
phi = mfttrack.phi();
}
o2::math_utils::bringTo02Pi(phi);
if (eta < minEtaGL || maxEtaGL < eta) {
continue;
}

const auto& mchtrack = matchedtrack.template matchMCHTrack_as<TFwdTracks>(); // MCH-MID
o2::dataformats::GlobalFwdTrack propmuonAtPV_Matched = propagateMuon(mchtrack, collision, propagationPoint::kToVertex);

Check warning on line 214 in Common/TableProducer/fwdtrackPropagation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
float etaMatchedMCHMID = propmuonAtPV_Matched.getEta();
float phiMatchedMCHMID = propmuonAtPV_Matched.getPhi();
o2::math_utils::bringTo02Pi(phiMatchedMCHMID);

float deta = etaMatchedMCHMID - eta;
float dphi = phiMatchedMCHMID - phi;
o2::math_utils::bringToPMPi(dphi);
if (applyDEtaDPhi && std::sqrt(std::pow(deta / minDEta, 2) + std::pow(dphi / minDPhi, 2)) > 1.f) {
continue;
}

if (matchedtrack.chi2() < 0.f || maxChi2GL < matchedtrack.chi2()) {
continue;
}

float rAtAbsorberEnd = matchedtrack.rAtAbsorberEnd(); // this works only for GlobalMuonTrack
if (rAtAbsorberEnd < minRabs || maxRabs < rAtAbsorberEnd) {
continue;
}
o2::dataformats::GlobalFwdTrack propmuonAtDCA = propagateMuon(matchedtrack, collision, propagationPoint::kToDCA);
float dcaX = propmuonAtDCA.getX() - collision.posX();
float dcaY = propmuonAtDCA.getY() - collision.posY();
float dcaXY = std::sqrt(dcaX * dcaX + dcaY * dcaY);
if (maxDCAxy < dcaXY) {
continue;
}

o2::dataformats::GlobalFwdTrack propmuonAtDCA_Matched = propagateMuon(mchtrack, collision, propagationPoint::kToDCA);

Check warning on line 242 in Common/TableProducer/fwdtrackPropagation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
float dcaX_Matched = propmuonAtDCA_Matched.getX() - collision.posX();
float dcaY_Matched = propmuonAtDCA_Matched.getY() - collision.posY();
float dcaXY_Matched = std::sqrt(dcaX_Matched * dcaX_Matched + dcaY_Matched * dcaY_Matched);
float pDCA = mchtrack.p() * dcaXY_Matched;

if (rAtAbsorberEnd < midRabs ? pDCA > maxPDCAforSmallR : pDCA > maxPDCAforLargeR) {
continue;
}

map_chi2MFTMCH[matchedtrack.globalIndex()] = matchedtrack.chi2MatchMCHMFT();
}
if (map_chi2MFTMCH.begin()->first != target.globalIndex()) { // search for minimum matching chi2
map_chi2MFTMCH.clear();
return false;
}
map_chi2MFTMCH.clear();

if (target.chi2MatchMCHMFT() > maxMatchingChi2MCHMFT) {
return false;
}
return true;
Expand All @@ -188,23 +267,11 @@
void fillFwdTrackTable(TCollision const& collision, TFwdTrack fwdtrack, TFwdTracks const& fwdtracks, TMFTTracks const&, const bool isAmbiguous)
{
if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) {
std::map<int64_t, float> map_chi2MFTMCH;
const auto& matchedGlobalTracks = fwdtracks.sliceBy(perMFTTrack, fwdtrack.matchMFTTrackId()); // MFT-MCH-MID or MFT-MCH
for (const auto& matchedtrack : matchedGlobalTracks) {
if (matchedtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) {
map_chi2MFTMCH[matchedtrack.globalIndex()] = matchedtrack.chi2MatchMCHMFT();
}
}
if (map_chi2MFTMCH.begin()->first != fwdtrack.globalIndex()) { // search for minimum chi2
map_chi2MFTMCH.clear();
return;
}
map_chi2MFTMCH.clear();

if (fwdtrack.chi2MatchMCHMFT() > maxMatchingChi2MCHMFT) {
if (!isBestMatch<TFwdTracks, TMFTTracks>(collision, fwdtrack, matchedGlobalTracks)) {
return;
}
} // reduce useless propagation
} // find the best match between MFT and MCH-MID

o2::dataformats::GlobalFwdTrack propmuonAtPV = propagateMuon(fwdtrack, collision, propagationPoint::kToVertex);
o2::dataformats::GlobalFwdTrack propmuonAtDCA = propagateMuon(fwdtrack, collision, propagationPoint::kToDCA);
Expand Down Expand Up @@ -240,9 +307,6 @@

if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) {
const auto& mchtrack = fwdtrack.template matchMCHTrack_as<TFwdTracks>(); // MCH-MID
// etaMatchedMCHMID = mchtrack.eta();
// phiMatchedMCHMID = mchtrack.phi();
// o2::math_utils::bringTo02Pi(phiMatchedMCHMID);
o2::dataformats::GlobalFwdTrack propmuonAtPV_Matched = propagateMuon(mchtrack, collision, propagationPoint::kToVertex);
etaMatchedMCHMID = propmuonAtPV_Matched.getEta();
phiMatchedMCHMID = propmuonAtPV_Matched.getPhi();
Expand Down Expand Up @@ -276,7 +340,7 @@
return;
}

if (!isSelected(pt, eta, rAtAbsorberEnd, pDCA, fwdtrack.chi2(), fwdtrack.trackType(), etaMatchedMCHMID)) {
if (!isSelected(pt, eta, rAtAbsorberEnd, pDCA, fwdtrack.chi2(), fwdtrack.trackType(), dcaXY)) {
return;
}

Expand Down
6 changes: 3 additions & 3 deletions PWGEM/Dilepton/Core/SingleTrackQC.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,13 @@ struct SingleTrackQC {
fRegistry.addClone("Track/positive/", "Track/negative/");
} else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) {
const AxisSpec axis_pt{ConfPtlBins, "p_{T,#mu} (GeV/c)"};
const AxisSpec axis_eta{100, -6, -1, "#eta_{#mu}"};
const AxisSpec axis_phi{180, 0, 2 * M_PI, "#varphi_{#mu} (rad.)"};
const AxisSpec axis_eta{50, -6, -1, "#eta_{#mu}"};
const AxisSpec axis_phi{90, 0, 2 * M_PI, "#varphi_{#mu} (rad.)"};
const AxisSpec axis_dca{ConfDCABins, "DCA_{#mu}^{XY} (#sigma)"};

// track info
fRegistry.add("Track/positive/hs", "rec. single muon", kTHnSparseD, {axis_pt, axis_eta, axis_phi, axis_dca}, true);
fRegistry.add("Track/positive/hEtaPhi_MatchMCHMID", "#eta vs. #varphi of matched MCHMID", kTH2F, {axis_phi, axis_eta}, false);
fRegistry.add("Track/positive/hEtaPhi_MatchMCHMID", "#eta vs. #varphi of matched MCHMID", kTH2F, {{180, 0, 2.f * M_PI}, {100, -6, -1}}, false);
fRegistry.add("Track/positive/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{400, -20, 20}}, false);
fRegistry.add("Track/positive/hTrackType", "track type", kTH1F, {{6, -0.5f, 5.5}}, false);
fRegistry.add("Track/positive/hDCAxy", "DCA x vs. y;DCA_{x} (cm);DCA_{y} (cm)", kTH2F, {{200, -0.5f, 0.5f}, {200, -0.5f, 0.5f}}, false);
Expand Down
6 changes: 3 additions & 3 deletions PWGEM/Dilepton/Core/SingleTrackQCMC.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ struct SingleTrackQCMC {
}
} else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) {
const AxisSpec axis_pt{ConfPtlBins, "p_{T,#mu} (GeV/c)"};
const AxisSpec axis_eta{100, -6, -1, "#eta_{#mu}"};
const AxisSpec axis_phi{180, 0.0, 2 * M_PI, "#varphi_{#mu} (rad.)"};
const AxisSpec axis_eta{50, -6, -1, "#eta_{#mu}"};
const AxisSpec axis_phi{90, 0.0, 2 * M_PI, "#varphi_{#mu} (rad.)"};
const AxisSpec axis_dca{ConfDCABins, "DCA_{#mu}^{XY} (#sigma)"};
const AxisSpec axis_charge_gen{3, -1.5, +1.5, "true charge"};

Expand All @@ -329,7 +329,7 @@ struct SingleTrackQCMC {
// track info
fRegistry.add("Track/lf/positive/hs", "rec. single muon", kTHnSparseD, {axis_pt, axis_eta, axis_phi, axis_dca, axis_charge_gen}, true);
if (cfgFillQA) {
fRegistry.add("Track/lf/positive/hEtaPhi_MatchMCHMID", "#eta vs. #varphi of matched MCHMID", kTH2F, {axis_phi, axis_eta}, false);
fRegistry.add("Track/lf/positive/hEtaPhi_MatchMCHMID", "#eta vs. #varphi of matched MCHMID", kTH2F, {{180, 0, 2.f * M_PI}, {100, -6, -1}}, false);
fRegistry.add("Track/lf/positive/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{400, -20, 20}}, false);
fRegistry.add("Track/lf/positive/hTrackType", "track type", kTH1F, {{6, -0.5f, 5.5}}, false);
fRegistry.add("Track/lf/positive/hDCAxy", "DCA x vs. y;DCA_{x} (cm);DCA_{y} (cm)", kTH2F, {{200, -0.5f, 0.5f}, {200, -0.5f, 0.5f}}, false);
Expand Down
Loading
Loading