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
14 changes: 9 additions & 5 deletions PWGEM/Dilepton/DataModel/dileptonTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -795,11 +795,11 @@ DECLARE_SOA_COLUMN(EtaMatchedMCHMIDatMP, etaMatchedMCHMIDatMP, float); //! eta o
DECLARE_SOA_COLUMN(PhiMatchedMCHMIDatMP, phiMatchedMCHMIDatMP, float); //! phi of MCH-MID track in MFT-MCH-MID track at matching plane
DECLARE_SOA_COLUMN(EtaMatchedMFTatMP, etaMatchedMFTatMP, float); //! eta of MFT track in MFT-MCH-MID track at matching plane
DECLARE_SOA_COLUMN(PhiMatchedMFTatMP, phiMatchedMFTatMP, float); //! phi of MFT track in MFT-MCH-MID track at matching plane

DECLARE_SOA_COLUMN(IsAssociatedToMPC, isAssociatedToMPC, bool); //! is associated to most probable collision
DECLARE_SOA_COLUMN(IsAmbiguous, isAmbiguous, bool); //! is ambiguous
DECLARE_SOA_COLUMN(Sign, sign, int8_t); //!
DECLARE_SOA_COLUMN(Chi2MFT, chi2MFT, float); //! chi2 of MFT standalone track
DECLARE_SOA_COLUMN(IsAssociatedToMPC, isAssociatedToMPC, bool); //! is associated to most probable collision
DECLARE_SOA_COLUMN(IsAmbiguous, isAmbiguous, bool); //! is ambiguous
DECLARE_SOA_COLUMN(IsCorrectMatchMFTMCH, isCorrectMatchMFTMCH, bool); //! is correct match between MFT and MCH, only for MC
DECLARE_SOA_COLUMN(Sign, sign, int8_t); //!
DECLARE_SOA_COLUMN(Chi2MFT, chi2MFT, float); //! chi2 of MFT standalone track
DECLARE_SOA_DYNAMIC_COLUMN(Signed1Pt, signed1Pt, [](float pt, int8_t sign) -> float { return sign * 1. / pt; });
DECLARE_SOA_DYNAMIC_COLUMN(P, p, [](float pt, float eta) -> float { return pt * std::cosh(eta); });
DECLARE_SOA_DYNAMIC_COLUMN(Px, px, [](float pt, float phi) -> float { return pt * std::cos(phi); });
Expand Down Expand Up @@ -907,6 +907,10 @@ DECLARE_SOA_TABLE(EMGlobalMuonSelfIds, "AOD", "EMGLMUSELFID", emprimarymuon::Glo
// iterators
using EMGlobalMuonSelfId = EMGlobalMuonSelfIds::iterator;

DECLARE_SOA_TABLE(EMPrimaryMuonsMatchMC, "AOD", "EMMUONMATCHMC", emprimarymuon::IsCorrectMatchMFTMCH); // To be joined with EMPrimaryMuons table at analysis level. only for MC.
// iterators
using EMPrimaryMuonMatchMC = EMPrimaryMuonsMatchMC::iterator;

namespace oldemprimarytrack
{
DECLARE_SOA_COLUMN(Sign, sign, int8_t);
Expand Down
16 changes: 12 additions & 4 deletions PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ struct skimmerPrimaryMuon {

Produces<aod::EMPrimaryMuons> emprimarymuons;
Produces<aod::EMPrimaryMuonsCov> emprimarymuonscov;
Produces<aod::EMPrimaryMuonsMatchMC> emprimarymuonsmatchmc;

// Configurables
Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
Expand Down Expand Up @@ -313,6 +314,7 @@ struct skimmerPrimaryMuon {

float deta = 999.f;
float dphi = 999.f;
bool isCorrectMatchMFTMCH = true; // by default, it is true. it is evaluated for global muons in MC.

if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) {
// apply r-absorber cut here to minimize the number of calling propagateMuon.
Expand All @@ -329,9 +331,13 @@ struct skimmerPrimaryMuon {
auto mfttrack = fwdtrack.template matchMFTTrack_as<TMFTTracks>(); // MFTsa

if constexpr (isMC) {
if (!mfttrack.has_mcParticle()) {
if (!mfttrack.has_mcParticle() || !mchtrack.has_mcParticle() || !fwdtrack.has_mcParticle()) {
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>();
isCorrectMatchMFTMCH = static_cast<bool>(mcParticle_MCHMID.globalIndex() == mcParticle_MFT.globalIndex());
}

nClustersMFT = mfttrack.nClusters();
Expand Down Expand Up @@ -475,6 +481,8 @@ struct skimmerPrimaryMuon {
// <X,TANL> <Y,TANL> <PHI,TANL> <TANL,TANL> <INVQPT,TANL>
// <X,INVQPT> <Y,INVQPT> <PHI,INVQPT> <TANL,INVQPT> <INVQPT,INVQPT>

emprimarymuonsmatchmc(isCorrectMatchMFTMCH);

if (fillQAHistograms) {
fRegistry.fill(HIST("hMuonType"), fwdtrack.trackType());
if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) {
Expand Down Expand Up @@ -1166,7 +1174,7 @@ struct skimmerPrimaryMuon {
}
PROCESS_SWITCH(skimmerPrimaryMuon, processRec_TTCA_SWT_withMFTCov, "process reconstructed info", false);

void processMC_SA(soa::Join<MyCollisions, aod::McCollisionLabels> const& collisions, MyFwdTracksMC const& fwdtracks, MFTTracksMC const& mfttracks, aod::BCsWithTimestamps const&)
void processMC_SA(soa::Join<MyCollisions, aod::McCollisionLabels> const& collisions, MyFwdTracksMC const& fwdtracks, MFTTracksMC const& mfttracks, aod::BCsWithTimestamps const&, aod::McParticles const&)
{
vec_min_chi2MatchMCHMFT.reserve(fwdtracks.size());
// vec_min_dr.reserve(fwdtracks.size());
Expand Down Expand Up @@ -1251,7 +1259,7 @@ struct skimmerPrimaryMuon {
}
PROCESS_SWITCH(skimmerPrimaryMuon, processMC_SA, "process reconstructed and MC info", false);

void processMC_TTCA(soa::Join<MyCollisions, aod::McCollisionLabels> const& collisions, MyFwdTracksMC const& fwdtracks, MFTTracksMC const& mfttracks, aod::BCsWithTimestamps const&, aod::FwdTrackAssoc const& fwdtrackIndices)
void processMC_TTCA(soa::Join<MyCollisions, aod::McCollisionLabels> const& collisions, MyFwdTracksMC const& fwdtracks, MFTTracksMC const& mfttracks, aod::BCsWithTimestamps const&, aod::FwdTrackAssoc const& fwdtrackIndices, aod::McParticles const&)
{
vec_min_chi2MatchMCHMFT.reserve(fwdtracks.size());
// vec_min_dr.reserve(fwdtracks.size());
Expand Down Expand Up @@ -1346,7 +1354,7 @@ struct skimmerPrimaryMuon {
}
PROCESS_SWITCH(skimmerPrimaryMuon, processMC_TTCA, "process reconstructed and MC info", false);

void processMC_TTCA_withMFTCov(soa::Join<MyCollisions, aod::McCollisionLabels> const& collisions, MyFwdTracksMC const& fwdtracks, MFTTracksMC const& mfttracks, aod::BCsWithTimestamps const&, aod::FwdTrackAssoc const& fwdtrackIndices, aod::MFTTracksCov const& mftCovs)
void processMC_TTCA_withMFTCov(soa::Join<MyCollisions, aod::McCollisionLabels> const& collisions, MyFwdTracksMC const& fwdtracks, MFTTracksMC const& mfttracks, aod::BCsWithTimestamps const&, aod::FwdTrackAssoc const& fwdtrackIndices, aod::MFTTracksCov const& mftCovs, aod::McParticles const&)
{
for (const auto& mfttrackConv : mftCovs) {
map_mfttrackcovs[mfttrackConv.matchMFTTrackId()] = mfttrackConv.globalIndex();
Expand Down
Loading