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
20 changes: 14 additions & 6 deletions PWGEM/Dilepton/TableProducer/filterEoI.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/filterEoI.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/workflow-file]

Name of a workflow file must match the name of the main struct in it (without the PWG prefix). (Class implementation files should be in "Core" directories.)

Check failure on line 1 in PWGEM/Dilepton/TableProducer/filterEoI.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 @@ -35,13 +35,21 @@
kElectronFromDalitz = 0x8,
};
Produces<o2::aod::EMEoIs> emeoi;
// Configurable<int> minNElectrons{"minNElectrons", 1, "min number of e+ or e- at midrapidity"};
// Configurable<int> minNMuons{"minNMuons", 1, "min number of mu+ or mu- at forward rapidity"};
// Configurable<int> minNV0s{"minNV0s", 1, "min number of v0 photons at midrapidity"};
Configurable<bool> inheritFromOtherTask{"inheritFromOtherTask", true, "Flag to iherit all common configurables from skimmerPrimaryElectron or skimmerPrimaryMuon"};
Configurable<int> minNelectron{"minNelectron", -1, "min number of electron candidates per collision"};
Configurable<int> minNmuon{"minNmuon", -1, "min number of muon candidates per collision"};

HistogramRegistry fRegistry{"output"};
void init(o2::framework::InitContext&)
void init(o2::framework::InitContext& initContext)
{
if (inheritFromOtherTask.value) { // Inheriting from other task
getTaskOptionValue(initContext, "skimmer-primary-electron", "minNelectron", minNelectron.value, true);
getTaskOptionValue(initContext, "skimmer-primary-muon", "minNmuon", minNmuon.value, true);
}

LOGF(info, "minNelectron = %d", minNelectron.value);
LOGF(info, "minNmuon = %d", minNmuon.value);

auto hEventCounter = fRegistry.add<TH1>("hEventCounter", "hEventCounter", kTH1D, {{8, 0.5f, 8.5f}});
hEventCounter->GetXaxis()->SetBinLabel(1, "all");
hEventCounter->GetXaxis()->SetBinLabel(2, "event with electron");
Expand Down Expand Up @@ -71,14 +79,14 @@

if constexpr (static_cast<bool>(system & kElectron)) {
auto electrons_coll = electrons.sliceBy(perCollision_el, collision.globalIndex());
if (electrons_coll.size() >= 1) {
if (electrons_coll.size() >= minNelectron) {
does_electron_exist = true;
fRegistry.fill(HIST("hEventCounter"), 2);
}
}
if constexpr (static_cast<bool>(system & kFwdMuon)) {
auto muons_coll = muons.sliceBy(perCollision_mu, collision.globalIndex());
if (muons_coll.size() >= 1) {
if (muons_coll.size() >= minNmuon) {
does_fwdmuon_exist = true;
fRegistry.fill(HIST("hEventCounter"), 3);
}
Expand All @@ -92,7 +100,7 @@
}
if constexpr (static_cast<bool>(system & kElectronFromDalitz)) {
auto electronsda_coll = electronsda.sliceBy(perCollision_elda, collision.globalIndex());
if (electronsda_coll.size() >= 2) {

Check failure on line 103 in PWGEM/Dilepton/TableProducer/filterEoI.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
does_electronda_exist = true;
}
}
Expand Down Expand Up @@ -169,5 +177,5 @@
};
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
return WorkflowSpec{adaptAnalysisTask<filterEoI>(cfgc, TaskName{"filter-eoi"})};

Check failure on line 180 in PWGEM/Dilepton/TableProducer/filterEoI.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-task]

Device names filter-eoi and filter-eo-i generated from the specified task name filter-eoi and from the struct name filterEoI, respectively, differ in hyphenation. Consider fixing capitalisation of the struct name to FilterEoi and removing TaskName.
}
112 changes: 103 additions & 9 deletions PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

#include "Math/Vector4D.h"

#include <map>
#include <string>
#include <unordered_map>
#include <utility>
Expand Down Expand Up @@ -104,6 +105,7 @@
Configurable<float> maxpt_itssa{"maxpt_itssa", 0.15, "max pt for ITSsa track"};
Configurable<float> maxMeanITSClusterSize{"maxMeanITSClusterSize", 16, "max <ITS cluster size> x cos(lambda)"};
Configurable<bool> storeOnlyTrueElectronMC{"storeOnlyTrueElectronMC", false, "Flag to store only true electron in MC"};
Configurable<int> minNelectron{"minNelectron", 0, "min number of electron candidates per collision"};

// configuration for PID ML
Configurable<bool> usePIDML{"usePIDML", false, "Flag to use PID ML"};
Expand Down Expand Up @@ -176,6 +178,7 @@
fRegistry.add("Track/hMeanClusterSizeITSib", "mean cluster size ITSib;p_{pv} (GeV/c);<ITSib cluster size> #times cos(#lambda)", kTH2F, {{1000, 0, 10}, {150, 0, 15}}, false);
fRegistry.add("Track/hMeanClusterSizeITSob", "mean cluster size ITSob;p_{pv} (GeV/c);<ITSob cluster size> #times cos(#lambda)", kTH2F, {{1000, 0, 10}, {150, 0, 15}}, false);
fRegistry.add("Track/hProbElBDT", "probability to be e from BDT;p_{in} (GeV/c);BDT score;", kTH2F, {{1000, 0, 10}, {100, 0, 1}}, false);
fRegistry.add("Track/hNe", "electron counts;N_{e} per collision", kTH1F, {{51, -0.5, 50.5}}, false);
}

if (usePIDML) {
Expand Down Expand Up @@ -219,10 +222,10 @@
}

// In case override, don't proceed, please - no CCDB access required
if (d_bz_input > -990) {

Check failure on line 225 in PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
d_bz = d_bz_input;
o2::parameters::GRPMagField grpmag;
if (std::fabs(d_bz) > 1e-5) {

Check failure on line 228 in PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
grpmag.setL3Current(30000.f / (d_bz / 5.0f));
}
o2::base::Propagator::initFieldFromGRP(&grpmag);
Expand Down Expand Up @@ -270,7 +273,7 @@
}
if (storeOnlyTrueElectronMC) {
const auto& mcParticle = track.template mcParticle_as<aod::McParticles>();
if (std::abs(mcParticle.pdgCode()) != 11) {

Check failure on line 276 in PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.

Check failure on line 276 in PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
return false;
}
}
Expand Down Expand Up @@ -358,7 +361,7 @@
}

int total_cluster_size = 0, nl = 0;
for (unsigned int layer = 0; layer < 7; layer++) {

Check failure on line 364 in PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
int cluster_size_per_layer = track.itsClsSizeInLayer(layer);
if (cluster_size_per_layer > 0) {
nl++;
Expand Down Expand Up @@ -410,7 +413,7 @@
int pbin = lower_bound(binsMl.value.begin(), binsMl.value.end(), binningFeature) - binsMl.value.begin() - 1;
if (pbin < 0) {
pbin = 0;
} else if (static_cast<int>(binsMl.value.size()) - 2 < pbin) {

Check failure on line 416 in PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
pbin = static_cast<int>(binsMl.value.size()) - 2;
}
// LOGF(info, "track.tpcInnerParam() = %f (GeV/c), pbin = %d", track.tpcInnerParam(), pbin);
Expand Down Expand Up @@ -498,7 +501,6 @@
track.beta(), track.tofNSigmaEl(), /*track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(),*/
track.itsClusterSizes(),
track.itsChi2NCl(), track.tofChi2(), track.detectorMap(),
// trackParCov.getTgl(),
isAssociatedToMPC, false, probaEl, mcTunedTPCSignal);

emprimaryelectronscov(
Expand Down Expand Up @@ -601,6 +603,9 @@
Partition<MyFilteredTracks> posTracks = o2::aod::track::signed1Pt > 0.f;
Partition<MyFilteredTracks> negTracks = o2::aod::track::signed1Pt < 0.f;

std::map<std::pair<int, int>, float> mapProbEl; // map pair(collisionId, trackId) -> probaEl
std::unordered_multimap<int, int> multiMapTracksPerCollision; // collisionId -> trackIds

// ---------- for data ----------

void processRec_SA(MyCollisions const& collisions, aod::BCsWithTimestamps const&, MyFilteredTracks const& tracks)
Expand All @@ -624,12 +629,26 @@
if (!isElectron(collision, track, probaEl)) {
continue;
}

fillTrackTable<false>(collision, track, probaEl);
mapProbEl[std::make_pair(collision.globalIndex(), track.globalIndex())] = probaEl;
multiMapTracksPerCollision.insert(std::make_pair(collision.globalIndex(), track.globalIndex()));
}
} // end of collision loop

for (const auto& collision : collisions) {
int count_electrons = multiMapTracksPerCollision.count(collision.globalIndex());
fRegistry.fill(HIST("Track/hNe"), count_electrons);

if (count_electrons >= minNelectron) {
auto range_electrons = multiMapTracksPerCollision.equal_range(collision.globalIndex());
for (auto it = range_electrons.first; it != range_electrons.second; it++) {
auto track = tracks.rawIteratorAt(it->second);
fillTrackTable<false>(collision, track, mapProbEl[std::make_pair(collision.globalIndex(), track.globalIndex())]);
}
}
} // end of collision loop

mapProbEl.clear();
multiMapTracksPerCollision.clear();
stored_trackIds.clear();
stored_trackIds.shrink_to_fit();
}
Expand Down Expand Up @@ -658,10 +677,25 @@
if (!isElectron(collision, track, probaEl)) {
continue;
}
fillTrackTable<false>(collision, track, probaEl);
mapProbEl[std::make_pair(collision.globalIndex(), track.globalIndex())] = probaEl;
}
} // end of collision loop

for (const auto& collision : collisions) {
int count_electrons = multiMapTracksPerCollision.count(collision.globalIndex());
fRegistry.fill(HIST("Track/hNe"), count_electrons);

if (count_electrons >= minNelectron) {
auto range_electrons = multiMapTracksPerCollision.equal_range(collision.globalIndex());
for (auto it = range_electrons.first; it != range_electrons.second; it++) {
auto track = tracks.rawIteratorAt(it->second);
fillTrackTable<false>(collision, track, mapProbEl[std::make_pair(collision.globalIndex(), track.globalIndex())]);
}
}
} // end of collision loop

mapProbEl.clear();
multiMapTracksPerCollision.clear();
stored_trackIds.clear();
stored_trackIds.shrink_to_fit();
}
Expand Down Expand Up @@ -692,11 +726,26 @@
if (!isElectron(collision, track, probaEl)) {
continue;
}
fillTrackTable<false>(collision, track, probaEl);
mapProbEl[std::make_pair(collision.globalIndex(), track.globalIndex())] = probaEl;
}

} // end of collision loop

for (const auto& collision : collisions) {
int count_electrons = multiMapTracksPerCollision.count(collision.globalIndex());
fRegistry.fill(HIST("Track/hNe"), count_electrons);

if (count_electrons >= minNelectron) {
auto range_electrons = multiMapTracksPerCollision.equal_range(collision.globalIndex());
for (auto it = range_electrons.first; it != range_electrons.second; it++) {
auto track = tracks.rawIteratorAt(it->second);
fillTrackTable<false>(collision, track, mapProbEl[std::make_pair(collision.globalIndex(), track.globalIndex())]);
}
}
} // end of collision loop

mapProbEl.clear();
multiMapTracksPerCollision.clear();
stored_trackIds.clear();
stored_trackIds.shrink_to_fit();
}
Expand Down Expand Up @@ -728,10 +777,25 @@
if (!isElectron(collision, track, probaEl)) {
continue;
}
fillTrackTable<false>(collision, track, probaEl);
mapProbEl[std::make_pair(collision.globalIndex(), track.globalIndex())] = probaEl;
}
} // end of collision loop

for (const auto& collision : collisions) {
int count_electrons = multiMapTracksPerCollision.count(collision.globalIndex());
fRegistry.fill(HIST("Track/hNe"), count_electrons);

if (count_electrons >= minNelectron) {
auto range_electrons = multiMapTracksPerCollision.equal_range(collision.globalIndex());
for (auto it = range_electrons.first; it != range_electrons.second; it++) {
auto track = tracks.rawIteratorAt(it->second);
fillTrackTable<false>(collision, track, mapProbEl[std::make_pair(collision.globalIndex(), track.globalIndex())]);
}
}
} // end of collision loop

mapProbEl.clear();
multiMapTracksPerCollision.clear();
stored_trackIds.clear();
stored_trackIds.shrink_to_fit();
}
Expand Down Expand Up @@ -766,10 +830,25 @@
if (!isElectron(collision, track, probaEl)) {
continue;
}
fillTrackTable<true>(collision, track, probaEl);
mapProbEl[std::make_pair(collision.globalIndex(), track.globalIndex())] = probaEl;
}
} // end of collision loop

for (const auto& collision : collisions) {
int count_electrons = multiMapTracksPerCollision.count(collision.globalIndex());
fRegistry.fill(HIST("Track/hNe"), count_electrons);

if (count_electrons >= minNelectron) {
auto range_electrons = multiMapTracksPerCollision.equal_range(collision.globalIndex());
for (auto it = range_electrons.first; it != range_electrons.second; it++) {
auto track = tracks.rawIteratorAt(it->second);
fillTrackTable<true>(collision, track, mapProbEl[std::make_pair(collision.globalIndex(), track.globalIndex())]);
}
}
} // end of collision loop

mapProbEl.clear();
multiMapTracksPerCollision.clear();
stored_trackIds.clear();
stored_trackIds.shrink_to_fit();
}
Expand Down Expand Up @@ -801,10 +880,25 @@
if (!isElectron(collision, track, probaEl)) {
continue;
}
fillTrackTable<true>(collision, track, probaEl);
mapProbEl[std::make_pair(collision.globalIndex(), track.globalIndex())] = probaEl;
}
} // end of collision loop

for (const auto& collision : collisions) {
int count_electrons = multiMapTracksPerCollision.count(collision.globalIndex());
fRegistry.fill(HIST("Track/hNe"), count_electrons);

if (count_electrons >= minNelectron) {
auto range_electrons = multiMapTracksPerCollision.equal_range(collision.globalIndex());
for (auto it = range_electrons.first; it != range_electrons.second; it++) {
auto track = tracks.rawIteratorAt(it->second);
fillTrackTable<true>(collision, track, mapProbEl[std::make_pair(collision.globalIndex(), track.globalIndex())]);
}
}
} // end of collision loop

mapProbEl.clear();
multiMapTracksPerCollision.clear();
stored_trackIds.clear();
stored_trackIds.shrink_to_fit();
}
Expand Down Expand Up @@ -882,7 +976,7 @@
fRegistry.add("Track/hEtaPhi", "#eta vs. #varphi;#varphi (rad.);#eta", kTH2F, {{90, 0, 2 * M_PI}, {80, -2.0f, 2.0f}}, false);
fRegistry.add("Track/hTPCNsigmaEl", "loose track TPC PID", kTH2F, {{1000, 0.f, 10}, {100, -5, +5}});
fRegistry.add("Pair/before/uls/hMvsPt", "mass vs. pT;m_{ee} (GeV/c^{2});p_{T,ee} (GeV/c)", kTH2F, {{500, 0, 0.5}, {100, 0, 1}});
fRegistry.add("Pair/before/uls/hMvsPhiV", "mass vs. phiv;#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{90, 0.f, M_PI}, {100, 0, 1.0}});
fRegistry.add("Pair/before/uls/hMvsPhiV", "mass vs. phiv;#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{90, 0.f, M_PI}, {100, 0, 0.1}});
fRegistry.addClone("Pair/before/uls/", "Pair/before/lspp/");
fRegistry.addClone("Pair/before/uls/", "Pair/before/lsmm/");
fRegistry.addClone("Pair/before/", "Pair/after/");
Expand Down
Loading
Loading