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
17 changes: 17 additions & 0 deletions PWGDQ/Core/MCSignalLibrary.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1471,12 +1471,29 @@
signal = new MCSignal(name, "D0", {prong}, {-1});
return signal;
}
if (!nameStr.compare("nonPromptD0")) {
MCProng prong(2, {Pdg::kD0, 503}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false});
signal = new MCSignal(name, "Non-prompt D0", {prong}, {-1});
return signal;
}
if (!nameStr.compare("D0FS")) {
MCProng prong(1, {Pdg::kD0}, {true}, {false}, {0}, {0}, {false});
prong.SetSourceBit(0, MCProng::kHEPMCFinalState);
signal = new MCSignal(name, "D0", {prong}, {-1});
return signal;
}
if (!nameStr.compare("KPiFromD0")) {
MCProng prongKaon(2, {321, Pdg::kD0}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false});
MCProng prongPion(2, {211, Pdg::kD0}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false});
signal = new MCSignal(name, "Kaon and pion pair from D0", {prongKaon, prongPion}, {1, 1});
return signal;
}
if (!nameStr.compare("KPiFromD0Reflected")) {
MCProng prongFalseKaon(2, {211, Pdg::kD0}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false});
MCProng prongFalsePion(2, {321, Pdg::kD0}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false});
signal = new MCSignal(name, "Kaon and pion pair from D0 with reflected mass assumption", {prongFalseKaon, prongFalsePion}, {1, 1});
return signal;
}
if (!nameStr.compare("Dcharged")) {
MCProng prong(1, {Pdg::kDPlus}, {true}, {false}, {0}, {0}, {false});
signal = new MCSignal(name, "D+/-", {prong}, {-1});
Expand Down Expand Up @@ -1891,7 +1908,7 @@
// Get the common ancestors array
std::vector<int8_t> commonAncestors;
if (signal.HasMember("commonAncestors")) {
for (auto& v : signal.FindMember("commonAncestors")->value.GetArray()) {

Check failure on line 1911 in PWGDQ/Core/MCSignalLibrary.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
commonAncestors.push_back(v.GetInt());
LOG(debug) << "common ancestor " << v.GetInt();
}
Expand Down Expand Up @@ -1966,13 +1983,13 @@
return false;
}
std::vector<uint32_t> nSourceBits;
for (auto& ii : prongJSON->FindMember("sourceBits")->value.GetArray()) {

Check failure on line 1986 in PWGDQ/Core/MCSignalLibrary.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if (!ii.IsArray()) {
LOG(fatal) << "The sourceBits field should be an array of arrays of MCProng::Source";
return false;
}
nSourceBits.push_back(ii.GetArray().Size());
for (auto& iii : ii.GetArray()) {

Check failure on line 1992 in PWGDQ/Core/MCSignalLibrary.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if (MCProng::fgSourceNames.find(iii.GetString()) == MCProng::fgSourceNames.end()) {
LOG(fatal) << "Source " << iii.GetString() << " not implemented in MCProng";
return false;
Expand All @@ -1985,7 +2002,7 @@
return false;
}
int iElem = 0;
for (auto& ii : prongJSON->FindMember("excludeSource")->value.GetArray()) {

Check failure on line 2005 in PWGDQ/Core/MCSignalLibrary.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if (!ii.IsArray()) {
LOG(fatal) << "The excludeSource field should be an array of arrays of bool";
return false;
Expand Down Expand Up @@ -2063,13 +2080,13 @@
LOG(debug) << "n: " << n;
// Get the array of PDG codes
std::vector<int> pdgs;
for (auto& pdg : prongJSON->FindMember("pdgs")->value.GetArray()) {

Check failure on line 2083 in PWGDQ/Core/MCSignalLibrary.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
pdgs.push_back(pdg.GetInt());
LOG(debug) << "pdgs: " << pdg.GetInt();
}
// get the array of booleans for check both charges option
std::vector<bool> checkBothCharges;
for (auto& ii : prongJSON->FindMember("checkBothCharges")->value.GetArray()) {

Check failure on line 2089 in PWGDQ/Core/MCSignalLibrary.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
checkBothCharges.push_back(ii.GetBool());
LOG(debug) << "check both charges " << ii.GetBool();
}
Expand All @@ -2077,7 +2094,7 @@
// get the array of booleans for the excludePDG option, defaults to false
std::vector<bool> excludePDG;
if (prongJSON->HasMember("excludePDG")) {
for (auto& ii : prongJSON->FindMember("excludePDG")->value.GetArray()) {

Check failure on line 2097 in PWGDQ/Core/MCSignalLibrary.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
excludePDG.push_back(ii.GetBool());
LOG(debug) << "exclude pdg " << ii.GetBool();
}
Expand All @@ -2090,9 +2107,9 @@
// get the source bits, and transform from string to int
std::vector<std::vector<int>> sourceBitsVec;
if (prongJSON->HasMember("sourceBits")) {
for (auto& ii : prongJSON->FindMember("sourceBits")->value.GetArray()) {

Check failure on line 2110 in PWGDQ/Core/MCSignalLibrary.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
std::vector<int> sourceBits;
for (auto& iii : ii.GetArray()) {

Check failure on line 2112 in PWGDQ/Core/MCSignalLibrary.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
sourceBits.push_back(MCProng::fgSourceNames[iii.GetString()]);
LOG(debug) << "source bit " << iii.GetString();
}
Expand All @@ -2102,7 +2119,7 @@
// prepare the exclusion source options if specified
std::vector<std::vector<bool>> excludeSourceVec;
if (prongJSON->HasMember("excludeSource")) {
for (auto& ii : prongJSON->FindMember("excludeSource")->value.GetArray()) {

Check failure on line 2122 in PWGDQ/Core/MCSignalLibrary.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
std::vector<bool> excludeSource;
for (auto& iii : ii.GetArray()) {
excludeSource.push_back(iii.GetBool());
Expand Down
43 changes: 37 additions & 6 deletions PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// The skimmed MC stack includes the MC truth particles corresponding to the list of user specified MC signals (see MCsignal.h)
// and the MC truth particles corresponding to the reconstructed tracks selected by the specified track cuts on reconstructed data.

#include <cstdint>
#include <iostream>
#include <map>
#include <string>
Expand Down Expand Up @@ -86,6 +87,7 @@ using MyMuonsWithCov = soa::Join<aod::FwdTracks, aod::FwdTracksCov, aod::McFwdTr

using MyEvents = soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels>;
using MyEventsWithMults = soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::MultsExtra, aod::McCollisionLabels>;
using MyEventsWithMultsAndRapidityGapFilter = soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::MultsExtra, aod::McCollisionLabels, aod::DQRapidityGapFilter>;
using MyEventsWithCent = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs, aod::McCollisionLabels>;
using MyEventsWithCentAndMults = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs, aod::Mults, aod::MultsExtra, aod::McCollisionLabels>;
using MFTTrackLabeled = soa::Join<o2::aod::MFTTracks, aod::McMFTTrackLabels>;
Expand All @@ -95,6 +97,7 @@ constexpr static uint32_t gkEventFillMap = VarManager::ObjTypes::BC | VarManager
constexpr static uint32_t gkEventFillMapWithMults = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision | VarManager::ObjTypes::CollisionMult | VarManager::ObjTypes::CollisionMultExtra;
// constexpr static uint32_t gkEventFillMapWithCent = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision | VarManager::ObjTypes::CollisionCent;
constexpr static uint32_t gkEventFillMapWithCentAndMults = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision | VarManager::ObjTypes::CollisionCent | VarManager::CollisionMult | VarManager::CollisionMultExtra;
constexpr static uint32_t gkEventFillMapWithMultsRapidityGapFilter = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision | VarManager::ObjTypes::CollisionMult | VarManager::ObjTypes::CollisionMultExtra | VarManager::ObjTypes::RapidityGapFilter;
// constexpr static uint32_t gkEventMCFillMap = VarManager::ObjTypes::CollisionMC;
// constexpr static uint32_t gkTrackFillMap = VarManager::ObjTypes::Track | VarManager::ObjTypes::TrackExtra | VarManager::ObjTypes::TrackDCA | VarManager::ObjTypes::TrackSelection | VarManager::ObjTypes::TrackPID;
constexpr static uint32_t gkTrackFillMapWithCov = VarManager::ObjTypes::Track | VarManager::ObjTypes::TrackExtra | VarManager::ObjTypes::TrackDCA | VarManager::ObjTypes::TrackSelection | VarManager::ObjTypes::TrackCov | VarManager::ObjTypes::TrackPID;
Expand Down Expand Up @@ -236,7 +239,7 @@ struct TableMakerMC {
{
// Check whether barrel or muon are enabled
bool isProcessBCenabled = context.mOptions.get<bool>("processPP");
bool isBarrelEnabled = (context.mOptions.get<bool>("processPP") || context.mOptions.get<bool>("processPPBarrelOnly") || context.mOptions.get<bool>("processPbPbBarrelOnly"));
bool isBarrelEnabled = (context.mOptions.get<bool>("processPP") || context.mOptions.get<bool>("processPPBarrelOnly") || context.mOptions.get<bool>("processPbPbBarrelOnly") || context.mOptions.get<bool>("processPbPbWithFilterBarrelOnly"));
bool isMuonEnabled = (context.mOptions.get<bool>("processPP") || context.mOptions.get<bool>("processPPMuonOnlyBasic") || context.mOptions.get<bool>("processPPMuonOnly") || context.mOptions.get<bool>("processPbPbMuonOnly"));
// Make sure at least one process function is enabled
if (!(isProcessBCenabled || isBarrelEnabled || isMuonEnabled)) {
Expand Down Expand Up @@ -553,6 +556,13 @@ struct TableMakerMC {
}
(reinterpret_cast<TH2I*>(fStatsList->At(0)))->Fill(1.0, static_cast<float>(o2::aod::evsel::kNsel));

// apply the event filter
if constexpr ((TEventFillMap & VarManager::ObjTypes::RapidityGapFilter) > 0) {
if (!collision.eventFilter()) {
continue;
}
}

auto bc = collision.template bc_as<BCsWithTimestamps>();
// store the selection decisions
uint64_t tag = static_cast<uint64_t>(0);
Expand All @@ -562,6 +572,10 @@ struct TableMakerMC {
if (bcEvSel.globalIndex() != bc.globalIndex()) {
tag |= (static_cast<uint64_t>(1) << 0);
}
// Put the 8 first bits of the event filter in the last 8 bits of the tag
if constexpr ((TEventFillMap & VarManager::ObjTypes::RapidityGapFilter) > 0) {
tag |= (collision.eventFilter() << 56);
}

// Compute BC and event quantities and fill histograms
VarManager::ResetValues(0, VarManager::kNEventWiseVariables);
Expand Down Expand Up @@ -602,16 +616,25 @@ struct TableMakerMC {
event(tag, bc.runNumber(), collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), collision.collisionTime(), collision.collisionTimeRes());
if constexpr ((TEventFillMap & VarManager::ObjTypes::CollisionMult) > 0) {
multTPC = collision.multTPC();
multFV0A = collision.multFV0A();
multFV0C = collision.multFV0C();
multFT0A = collision.multFT0A();
multFT0C = collision.multFT0C();
multFDDA = collision.multFDDA();
multFDDC = collision.multFDDC();
multZNA = collision.multZNA();
multZNC = collision.multZNC();
multTracklets = collision.multTracklets();
multTracksPV = collision.multNTracksPV();
if constexpr ((TEventFillMap & VarManager::ObjTypes::RapidityGapFilter) > 0) {
// Use the FIT signals from the nearest BC with FIT amplitude above threshold
multFV0A = collision.newBcMultFV0A();
multFT0A = collision.newBcMultFT0A();
multFT0C = collision.newBcMultFT0C();
multFDDA = collision.newBcMultFDDA();
multFDDC = collision.newBcMultFDDC();
} else {
multFV0A = collision.multFV0A();
multFT0A = collision.multFT0A();
multFT0C = collision.multFT0C();
multFDDA = collision.multFDDA();
multFDDC = collision.multFDDC();
}
}
if constexpr ((TEventFillMap & VarManager::ObjTypes::CollisionCent) > 0) {
centFT0C = collision.centFT0C();
Expand Down Expand Up @@ -1338,6 +1361,13 @@ struct TableMakerMC {
fullSkimming<gkEventFillMapWithCentAndMults, gkTrackFillMapWithCov, 0u, 0u>(collisions, bcs, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr, mcCollisions, mcParticles);
}

void processPbPbWithFilterBarrelOnly(MyEventsWithMultsAndRapidityGapFilter const& collisions, aod::BCsWithTimestamps const& bcs,
MyBarrelTracksWithCov const& tracksBarrel, aod::TrackAssoc const& trackAssocs,
aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles)
{
fullSkimming<gkEventFillMapWithMultsRapidityGapFilter, gkTrackFillMapWithCov, 0u, 0u>(collisions, bcs, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr, mcCollisions, mcParticles);
}

void processPbPbMuonOnly(MyEventsWithCentAndMults const& collisions, aod::BCsWithTimestamps const& bcs,
MyMuonsWithCov const& tracksMuon, MFTTrackLabeled const& mftTracks,
aod::FwdTrackAssoc const& fwdTrackAssocs, aod::MFTTrackAssoc const& mftAssocs,
Expand All @@ -1363,6 +1393,7 @@ struct TableMakerMC {
PROCESS_SWITCH(TableMakerMC, processPPMuonOnly, "Produce only muon skims, pp settings", false);
PROCESS_SWITCH(TableMakerMC, processPbPb, "Produce both barrel and muon skims, PbPb settings", false);
PROCESS_SWITCH(TableMakerMC, processPbPbBarrelOnly, "Produce only barrel skims, PbPb settings", false);
PROCESS_SWITCH(TableMakerMC, processPbPbWithFilterBarrelOnly, "Produce only barrel skims, pp settings with rapidity gap filter ", false);
PROCESS_SWITCH(TableMakerMC, processPbPbMuonOnly, "Produce only muon skims, PbPb settings", false);
PROCESS_SWITCH(TableMakerMC, processOnlyBCs, "Analyze the BCs to store sampled lumi", false);
};
Expand Down
Loading
Loading