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
46 changes: 45 additions & 1 deletion PWGDQ/Tasks/dqEfficiency_withAssoc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#include <TString.h>

#include <algorithm>
#include <iostream>

Check failure on line 50 in PWGDQ/Tasks/dqEfficiency_withAssoc.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[include-iostream]

Do not include iostream. Use O2 logging instead.
#include <map>
#include <memory>
#include <string>
Expand Down Expand Up @@ -395,7 +395,7 @@
auto ev2 = events.rawIteratorAt(*ev2It);
// compute 2-event quantities and mark the candidate split collisions
VarManager::FillTwoEvents(ev1, ev2);
if (TMath::Abs(VarManager::fgValues[VarManager::kTwoEvDeltaZ]) < fConfigSplitCollisionsDeltaZ) { // this is a possible collision split

Check failure on line 398 in PWGDQ/Tasks/dqEfficiency_withAssoc.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
collisionSplittingMap[*ev1It] = true;
collisionSplittingMap[*ev2It] = true;
}
Expand All @@ -420,7 +420,7 @@
auto ev2 = events.rawIteratorAt(ev2It);
// compute 2-event quantities and mark the candidate split collisions
VarManager::FillTwoEvents(ev1, ev2);
if (TMath::Abs(VarManager::fgValues[VarManager::kTwoEvDeltaZ]) < fConfigSplitCollisionsDeltaZ) { // this is a possible collision split

Check failure on line 423 in PWGDQ/Tasks/dqEfficiency_withAssoc.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
collisionSplittingMap[ev1It] = true;
collisionSplittingMap[ev2It] = true;
}
Expand Down Expand Up @@ -1386,7 +1386,7 @@
if (context.mOptions.get<bool>("processDummy")) {
return;
}
bool isMCGen = context.mOptions.get<bool>("processMCGen");
bool isMCGen = context.mOptions.get<bool>("processMCGen") || context.mOptions.get<bool>("processMCGenWithGrouping");
VarManager::SetDefaultVarNames();

fEnableBarrelHistos = context.mOptions.get<bool>("processAllSkimmed") || context.mOptions.get<bool>("processBarrelOnlySkimmed") || context.mOptions.get<bool>("processBarrelOnlyWithCollSkimmed");
Expand Down Expand Up @@ -2318,6 +2318,49 @@
} // end loop over reconstructed events
}

void processMCGenWithGrouping(soa::Filtered<MyEventsVtxCovSelected> const& events,
ReducedMCEvents const& /*mcEvents*/, ReducedMCTracks const& mcTracks)
{
uint32_t mcDecision = 0;
int isig = 0;
for (auto& event : events) {
if (!event.isEventSelected_bit(0)) {
continue;
}
if (!event.has_reducedMCevent()) {
continue;
}

if (fHasTwoProngGenMCsignals) {
auto groupedMCTracks = mcTracks.sliceBy(perReducedMcEvent, event.reducedMCeventId());
groupedMCTracks.bindInternalIndicesTo(&mcTracks);
for (auto& [t1, t2] : combinations(groupedMCTracks, groupedMCTracks)) {
auto t1_raw = groupedMCTracks.rawIteratorAt(t1.globalIndex());
auto t2_raw = groupedMCTracks.rawIteratorAt(t2.globalIndex());
if (t1_raw.reducedMCeventId() == t2_raw.reducedMCeventId()) {
mcDecision = 0;
isig = 0;
for (auto& sig : fGenMCSignals) {
if (sig->GetNProngs() != 2) { // NOTE: 2-prong signals required here
continue;
}
if (sig->CheckSignal(true, t1_raw, t2_raw)) {
mcDecision |= (static_cast<uint32_t>(1) << isig);
VarManager::FillPairMC<VarManager::kDecayToMuMu>(t1, t2); // NOTE: This feature will only work for muons
fHistMan->FillHistClass(Form("MCTruthGenPairSel_%s", sig->GetName()), VarManager::fgValues);
if (useMiniTree.fConfigMiniTree) {
// WARNING! To be checked
dileptonMiniTreeGen(mcDecision, -999, t1.pt(), t1.eta(), t1.phi(), t2.pt(), t2.eta(), t2.phi());
}
}
isig++;
}
}
}
} // end loop over reconstructed events
}
}

void processDummy(MyEvents&)
{
// do nothing
Expand All @@ -2328,6 +2371,7 @@
PROCESS_SWITCH(AnalysisSameEventPairing, processBarrelOnlyWithCollSkimmed, "Run barrel only pairing, with skimmed tracks and with collision information", false);
PROCESS_SWITCH(AnalysisSameEventPairing, processMuonOnlySkimmed, "Run muon only pairing, with skimmed tracks", false);
PROCESS_SWITCH(AnalysisSameEventPairing, processMCGen, "Loop over MC particle stack and fill generator level histograms", false);
PROCESS_SWITCH(AnalysisSameEventPairing, processMCGenWithGrouping, "Loop over MC particle stack (grouped MCTracks) and fill generator level histograms", false);
PROCESS_SWITCH(AnalysisSameEventPairing, processDummy, "Dummy function, enabled only if none of the others are enabled", true);
};

Expand Down Expand Up @@ -2518,14 +2562,14 @@
}
}
// Check that the leg cut masks make sense
if (static_cast<int>(std::floor(TMath::Log2(fLegAFilterMask))) + 1 > objArray->GetEntries()) {

Check failure on line 2565 in PWGDQ/Tasks/dqEfficiency_withAssoc.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
LOGF(fatal, "fConfigLegAFilterMask has highest bit at position %d, but track-selection only has %d cuts!", static_cast<int>(std::floor(TMath::Log2(fLegAFilterMask))) + 1, objArray->GetEntries());

Check failure on line 2566 in PWGDQ/Tasks/dqEfficiency_withAssoc.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
}
if (static_cast<int>(std::floor(TMath::Log2(fLegBFilterMask))) + 1 > objArray->GetEntries()) {

Check failure on line 2568 in PWGDQ/Tasks/dqEfficiency_withAssoc.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
LOGF(fatal, "fConfigLegBFilterMask has highest bit at position %d, but track-selection only has %d cuts!", static_cast<int>(std::floor(TMath::Log2(fLegBFilterMask))) + 1, objArray->GetEntries());

Check failure on line 2569 in PWGDQ/Tasks/dqEfficiency_withAssoc.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
}
if (static_cast<int>(std::floor(TMath::Log2(fLegCFilterMask))) + 1 > objArray->GetEntries()) {

Check failure on line 2571 in PWGDQ/Tasks/dqEfficiency_withAssoc.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
LOGF(fatal, "fConfigLegCFilterMask has highest bit at position %d, but track-selection only has %d cuts!", static_cast<int>(std::floor(TMath::Log2(fLegCFilterMask))) + 1, objArray->GetEntries());

Check failure on line 2572 in PWGDQ/Tasks/dqEfficiency_withAssoc.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
}

// Get the cuts defining the legs
Expand Down Expand Up @@ -4170,7 +4214,7 @@
// The histogram classes and their components histograms are defined below depending on the name of the histogram class
//
std::unique_ptr<TObjArray> objArray(histClasses.Tokenize(";"));
for (Int_t iclass = 0; iclass < objArray->GetEntries(); ++iclass) {

Check failure on line 4217 in PWGDQ/Tasks/dqEfficiency_withAssoc.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
TString classStr = objArray->At(iclass)->GetName();
histMan->AddHistClass(classStr.Data());

Expand Down
Loading