Skip to content

Commit

Permalink
Merge pull request #15 from alibuild/alibot-cleanup-9425
Browse files Browse the repository at this point in the history
Please consider the following formatting changes to #9425
  • Loading branch information
mcoquet642 authored Jan 21, 2025
2 parents e5f866e + 4896f43 commit 9f7fbf0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 36 deletions.
69 changes: 34 additions & 35 deletions PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -722,34 +722,34 @@ struct TableMakerMC {
fMftIndexMap[track.globalIndex()] = mftTrack.lastIndex();
if (!track.has_mcParticle()) {
mftLabels(-1, 0, 0); // this is the case when there is no matched MCParticle
} else {
auto mctrack = track.template mcParticle_as<aod::McParticles>();
VarManager::FillTrackMC(mcTracks, mctrack);
} else {
auto mctrack = track.template mcParticle_as<aod::McParticles>();
VarManager::FillTrackMC(mcTracks, mctrack);

mcflags = 0;
int i = 0; // runs over the MC signals
// check all the specified signals and fill histograms for MC truth matched tracks
for (auto& sig : fMCSignals) {
if (sig.CheckSignal(true, mctrack)) {
mcflags |= (static_cast<uint16_t>(1) << i);
// If detailed QA is on, fill histograms for each MC signal and track cut combination
if (fDoDetailedQA) {
fHistMan->FillHistClass(Form("MFTTrack_%s", sig.GetName()), VarManager::fgValues); // fill the reconstructed truth
mcflags = 0;
int i = 0; // runs over the MC signals
// check all the specified signals and fill histograms for MC truth matched tracks
for (auto& sig : fMCSignals) {
if (sig.CheckSignal(true, mctrack)) {
mcflags |= (static_cast<uint16_t>(1) << i);
// If detailed QA is on, fill histograms for each MC signal and track cut combination
if (fDoDetailedQA) {
fHistMan->FillHistClass(Form("MFTTrack_%s", sig.GetName()), VarManager::fgValues); // fill the reconstructed truth
}
}
i++;
}
i++;
}

// if the MC truth particle corresponding to this reconstructed track is not already written,
// add it to the skimmed stack
if (!(fLabelsMap.find(mctrack.globalIndex()) != fLabelsMap.end())) {
fLabelsMap[mctrack.globalIndex()] = trackCounter;
fLabelsMapReversed[trackCounter] = mctrack.globalIndex();
fMCFlags[mctrack.globalIndex()] = mcflags;
trackCounter++;
// if the MC truth particle corresponding to this reconstructed track is not already written,
// add it to the skimmed stack
if (!(fLabelsMap.find(mctrack.globalIndex()) != fLabelsMap.end())) {
fLabelsMap[mctrack.globalIndex()] = trackCounter;
fLabelsMapReversed[trackCounter] = mctrack.globalIndex();
fMCFlags[mctrack.globalIndex()] = mcflags;
trackCounter++;
}
mftLabels(fLabelsMap.find(mctrack.globalIndex())->second, track.mcMask(), mcflags);
}
mftLabels(fLabelsMap.find(mctrack.globalIndex())->second, track.mcMask(), mcflags);
}
}
mftAssoc(fCollIndexMap[collision.globalIndex()], fMftIndexMap[track.globalIndex()]);
}
Expand All @@ -762,15 +762,14 @@ struct TableMakerMC {
for (const auto& muon : muons) {
if (static_cast<int>(muon.trackType()) < 2) {
auto muonID = muon.matchMCHTrackId();
auto chi2 = muon.chi2MatchMCHMFT();
if (mCandidates.find(muonID) == mCandidates.end())
{
mCandidates[muonID] = {chi2, muon.globalIndex()};
} else {
auto chi2 = muon.chi2MatchMCHMFT();
if (mCandidates.find(muonID) == mCandidates.end()) {
mCandidates[muonID] = {chi2, muon.globalIndex()};
} else {
if (chi2 < mCandidates[muonID].first) {
mCandidates[muonID] = {chi2, muon.globalIndex()};
}
}
}
}
}
}
for (auto& pairCand : mCandidates) {
Expand All @@ -796,10 +795,10 @@ struct TableMakerMC {
for (const auto& assoc : muonAssocs) {
// get the muon
auto muon = assoc.template fwdtrack_as<TMuons>();
if (fConfigVariousOptions.fKeepBestMatch && static_cast<int>(muon.trackType()) < 2){
if (fConfigVariousOptions.fKeepBestMatch && static_cast<int>(muon.trackType()) < 2) {
if (fBestMatch.find(muon.globalIndex()) == fBestMatch.end()) {
continue;
}
}
}

trackFilteringTag = uint8_t(0);
Expand Down Expand Up @@ -1052,9 +1051,9 @@ struct TableMakerMC {
if constexpr (static_cast<bool>(TMuonFillMap)) {
if constexpr (static_cast<bool>(TMFTFillMap)) {
auto groupedMuonIndices = fwdTrackAssocs.sliceBy(fwdtrackIndicesPerCollision, origIdx);
if (fConfigVariousOptions.fKeepBestMatch){
skimBestMuonMatches(muons);
}
if (fConfigVariousOptions.fKeepBestMatch) {
skimBestMuonMatches(muons);
}
skimMuons<TMuonFillMap, TMFTFillMap>(collision, muons, groupedMuonIndices, mcParticles, mftTracks);
} else {
auto groupedMuonIndices = fwdTrackAssocs.sliceBy(fwdtrackIndicesPerCollision, origIdx);
Expand Down
2 changes: 1 addition & 1 deletion PWGDQ/Tasks/dqEfficiency_withAssoc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1665,7 +1665,7 @@ struct AnalysisSameEventPairing {
t1.chi2MatchMCHMID(), t2.chi2MatchMCHMID(),
t1.chi2MatchMCHMFT(), t2.chi2MatchMCHMFT(),
t1.chi2(), t2.chi2(),
t1.reducedMCTrack().pt(), t1.reducedMCTrack().eta(), t1.reducedMCTrack().phi(), t1.reducedMCTrack().e(),
t1.reducedMCTrack().pt(), t1.reducedMCTrack().eta(), t1.reducedMCTrack().phi(), t1.reducedMCTrack().e(),
t2.reducedMCTrack().pt(), t2.reducedMCTrack().eta(), t2.reducedMCTrack().phi(), t2.reducedMCTrack().e(),
t1.reducedMCTrack().vx(), t1.reducedMCTrack().vy(), t1.reducedMCTrack().vz(), t1.reducedMCTrack().vt(),
t2.reducedMCTrack().vx(), t2.reducedMCTrack().vy(), t2.reducedMCTrack().vz(), t2.reducedMCTrack().vt(),
Expand Down

0 comments on commit 9f7fbf0

Please sign in to comment.