Skip to content
Closed
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
45 changes: 28 additions & 17 deletions PWGEM/Dilepton/TableProducer/treeCreatorMuonML.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in PWGEM/Dilepton/TableProducer/treeCreatorMuonML.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-task]

Specify task name only when it cannot be derived from the struct name. Only append to the default name.

Check failure on line 1 in PWGEM/Dilepton/TableProducer/treeCreatorMuonML.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-task]

Specify task name only when it cannot be derived from the struct name. Only append to the default name.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand Down Expand Up @@ -79,7 +79,7 @@
Produces<aod::EMFwdTracksForML> mltable;

// Configurables
Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};

Check failure on line 82 in PWGEM/Dilepton/TableProducer/treeCreatorMuonML.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)

Check failure on line 82 in PWGEM/Dilepton/TableProducer/treeCreatorMuonML.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
Configurable<std::string> grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"};
Configurable<std::string> geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"};

Expand All @@ -88,6 +88,8 @@
Configurable<std::string> cfgZShiftPath{"cfgZShiftPath", "Users/m/mcoquet/ZShift", "CCDB path for z shift to apply to forward tracks"};
Configurable<float> cfgManualZShift{"cfgManualZShift", 0, "manual z-shift for propagation of global muon to PV"};
Configurable<float> cfgDownSampling{"cfgDownSampling", 1.1, "down sampling for fake matches"};
Configurable<float> matchingZ{"matchingZ", -77.5, "z position where matching is performed"};
Configurable<float> maxMatchingChi2MCHMFT{"maxMatchingChi2MCHMFT", 100.f, "max. chi2 for MCH-MFT matching"};

struct : ConfigurableGroup {
std::string prefix = "eventCutGroup";
Expand All @@ -107,14 +109,19 @@

struct : ConfigurableGroup {
std::string prefix = "glMuonCutGroup";
Configurable<float> minEta{"minEta", -3.6, "min. eta acceptance for MFT-MCH-MID"};
Configurable<float> maxEta{"maxEta", -2.5, "max. eta acceptance for MFT-MCH-MID"};
Configurable<float> maxMatchingChi2MCHMFT{"maxMatchingChi2MCHMFT", 100.f, "max. chi2 for MCH-MFT matching"};
Configurable<float> maxChi2{"maxChi2", 20.f, "max. chi2 for global muon"};
// Configurable<float> minEta{"minEta", -3.6, "min. eta acceptance for MFT-MCH-MID"};
// Configurable<float> maxEta{"maxEta", -2.5, "max. eta acceptance for MFT-MCH-MID"};
// Configurable<float> maxChi2{"maxChi2", 1e+10, "max. chi2 for global muon"};
Configurable<bool> refitGlobalMuon{"refitGlobalMuon", true, "flag to refit global muon"};
Configurable<float> matchingZ{"matchingZ", -77.5, "z position where matching is performed"};
} glMuonCutGroup;

struct : ConfigurableGroup {
std::string prefix = "MFTCutGroup";
Configurable<float> minPt{"minPt", 0.04f, "min. pT for MFTsa to reject crazy tracks"};
Configurable<float> minEta{"minEta", -4.1f, "min. eta acceptance for MFTsa to reject crazy tracks"};
Configurable<float> maxEta{"maxEta", -2.0f, "max. eta acceptance for MFTsa to reject crazy tracks"};
} MFTCutGroup;

o2::ccdb::CcdbApi ccdbApi;
Service<o2::ccdb::BasicCCDBManager> ccdb;
std::mt19937 engine;
Expand Down Expand Up @@ -284,6 +291,10 @@
float chi2 = fwdtrack.chi2() / (2.f * (mchtrack.nClusters() + mfttrack.nClusters()) - 5.f);
float chi2mft = mfttrack.chi2() / (2.f * mfttrack.nClusters() - 5.f);

if (mfttrack.eta() < MFTCutGroup.minEta || MFTCutGroup.maxEta < mfttrack.eta() || mfttrack.pt() < MFTCutGroup.minPt) {
return false;
}

// auto mcParticle_MFTMCHMID = fwdtrack.template mcParticle_as<aod::McParticles>(); // this is identical to mcParticle_MCHMID
auto mcParticle_MCHMID = mchtrack.template mcParticle_as<aod::McParticles>(); // this is identical to mcParticle_MFTMCHMID
auto mcParticle_MFT = mfttrack.template mcParticle_as<aod::McParticles>();
Expand All @@ -299,33 +310,33 @@
if (fwdtrack.chi2MatchMCHMID() < 0.f) { // this should never happen. only for protection.
return false;
}
if (fwdtrack.chi2MatchMCHMFT() < 0.f || glMuonCutGroup.maxMatchingChi2MCHMFT < fwdtrack.chi2MatchMCHMFT()) { // this should never happen. only for protection.
return false;
}
if (fwdtrack.chi2() < 0.f || glMuonCutGroup.maxChi2 < chi2) { // this should never happen. only for protection.
if (fwdtrack.chi2MatchMCHMFT() < 0.f || maxMatchingChi2MCHMFT < fwdtrack.chi2MatchMCHMFT()) {
return false;
}
// if (fwdtrack.chi2() < 0.f || glMuonCutGroup.maxChi2 < chi2) {
// return false;
// }
if (mfttrack.chi2() < 0.f) { // this should never happen. only for protection.
return false;
}

o2::dataformats::GlobalFwdTrack propmuonAtPV = propagateMuon(fwdtrack, fwdtrack, collision, propagationPoint::kToVertex, glMuonCutGroup.matchingZ, mBz, mZShift);
o2::dataformats::GlobalFwdTrack propmuonAtPV = propagateMuon(fwdtrack, fwdtrack, collision, propagationPoint::kToVertex, matchingZ, mBz, mZShift);
float pt = propmuonAtPV.getPt();
float eta = propmuonAtPV.getEta();
float phi = propmuonAtPV.getPhi();
// o2::math_utils::bringTo02Pi(phi);
phi = RecoDecay::constrainAngle(phi, 0, 1U);

if (eta < glMuonCutGroup.minEta || glMuonCutGroup.maxEta < eta) {
return false;
}
// if (eta < glMuonCutGroup.minEta || glMuonCutGroup.maxEta < eta) {
// return false;
// }

float dcaX = propmuonAtPV.getX() - collision.posX();
float dcaY = propmuonAtPV.getY() - collision.posY();
// float dcaZ = propmuonAtPV.getZ() - collision.posZ();
float dcaXY = std::sqrt(dcaX * dcaX + dcaY * dcaY);

o2::dataformats::GlobalFwdTrack propmuonAtPV_Matched = propagateMuon(mchtrack, mchtrack, collision, propagationPoint::kToVertex, glMuonCutGroup.matchingZ, mBz, mZShift);
o2::dataformats::GlobalFwdTrack propmuonAtPV_Matched = propagateMuon(mchtrack, mchtrack, collision, propagationPoint::kToVertex, matchingZ, mBz, mZShift);
// float ptMatchedMCHMID = propmuonAtPV_Matched.getPt();
float etaMatchedMCHMID = propmuonAtPV_Matched.getEta();
float phiMatchedMCHMID = propmuonAtPV_Matched.getPhi();
Expand All @@ -335,7 +346,7 @@
pt = propmuonAtPV_Matched.getP() * std::sin(2.f * std::atan(std::exp(-eta)));
}

o2::dataformats::GlobalFwdTrack propmuonAtDCA_Matched = propagateMuon(mchtrack, mchtrack, collision, propagationPoint::kToDCA, glMuonCutGroup.matchingZ, mBz, mZShift);
o2::dataformats::GlobalFwdTrack propmuonAtDCA_Matched = propagateMuon(mchtrack, mchtrack, collision, propagationPoint::kToDCA, matchingZ, mBz, mZShift);
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);
Expand All @@ -356,7 +367,7 @@
if constexpr (withMFTCov) {
auto mfttrackcov = mftCovs.rawIteratorAt(map_mfttrackcovs[mfttrack.globalIndex()]);
o2::track::TrackParCovFwd mftsaAtMP = getTrackParCovFwdShift(mfttrack, mZShift, mfttrackcov); // values at innermost update
mftsaAtMP.propagateToZhelix(glMuonCutGroup.matchingZ, mBz); // propagated to matching plane
mftsaAtMP.propagateToZhelix(matchingZ, mBz); // propagated to matching plane
xMFTatMP = mftsaAtMP.getX();
yMFTatMP = mftsaAtMP.getY();
xErrMFTatMP = std::sqrt(mftsaAtMP.getSigma2X());
Expand All @@ -369,7 +380,7 @@
tglErrMFTatMP = std::sqrt(mftsaAtMP.getSigma2Tanl());
phiErrMFTatMP = std::sqrt(mftsaAtMP.getSigma2Phi());

auto muonAtMP = propagateMuon(mchtrack, mchtrack, collision, propagationPoint::kToMatchingPlane, glMuonCutGroup.matchingZ, mBz, mZShift); // propagated to matching plane
auto muonAtMP = propagateMuon(mchtrack, mchtrack, collision, propagationPoint::kToMatchingPlane, matchingZ, mBz, mZShift); // propagated to matching plane
xMCHMIDatMP = muonAtMP.getX();
yMCHMIDatMP = muonAtMP.getY();
xErrMCHMIDatMP = std::sqrt(muonAtMP.getSigma2X());
Expand Down Expand Up @@ -516,5 +527,5 @@
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
return WorkflowSpec{
adaptAnalysisTask<TreeCreatorMuonML>(cfgc, TaskName{"tree-creator-muon-ml"})};

Check failure on line 530 in PWGEM/Dilepton/TableProducer/treeCreatorMuonML.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-task]

Device names tree-creator-muon-ml and tree-creator-muon-m-l generated from the specified task name tree-creator-muon-ml and from the struct name TreeCreatorMuonML, respectively, differ in hyphenation. Consider fixing capitalisation of the struct name to TreeCreatorMuonMl and removing TaskName.

Check failure on line 530 in PWGEM/Dilepton/TableProducer/treeCreatorMuonML.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-task]

Device names tree-creator-muon-ml and tree-creator-muon-m-l generated from the specified task name tree-creator-muon-ml and from the struct name TreeCreatorMuonML, respectively, differ in hyphenation. Consider fixing capitalisation of the struct name to TreeCreatorMuonMl and removing TaskName.
}
Loading