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
45 changes: 17 additions & 28 deletions PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
if (fillQAHistogram) {
fRegistry.add("Track/hPt", "pT;p_{T} (GeV/c)", kTH1F, {{1000, 0.0f, 10}}, false);
fRegistry.add("Track/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{400, -20, 20}}, false);
fRegistry.add("Track/hEtaPhi", "#eta vs. #varphi;#varphi (rad.);#eta", kTH2F, {{180, 0, 2 * M_PI}, {20, -1.0f, 1.0f}}, false);

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

View workflow job for this annotation

GitHub Actions / O2 linter

[pi-multiple-fraction]

Use multiples/fractions of PI defined in o2::constants::math.

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

View workflow job for this annotation

GitHub Actions / O2 linter

[external-pi]

Use the PI constant (and its multiples and fractions) defined in o2::constants::math.
fRegistry.add("Track/hDCAxyz", "DCA xy vs. z;DCA_{xy} (cm);DCA_{z} (cm)", kTH2F, {{200, -1.0f, 1.0f}, {200, -1.0f, 1.0f}}, false);
fRegistry.add("Track/hDCAxyzSigma", "DCA xy vs. z;DCA_{xy} (#sigma);DCA_{z} (#sigma)", kTH2F, {{200, -10.0f, 10.0f}, {200, -10.0f, 10.0f}}, false);
fRegistry.add("Track/hDCAxyRes_Pt", "DCA_{xy} resolution vs. pT;p_{T} (GeV/c);DCA_{xy} resolution (#mum)", kTH2F, {{1000, 0, 10}, {500, 0., 500}}, false);
Expand Down Expand Up @@ -217,10 +217,10 @@
}

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

Check failure on line 220 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 223 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 @@ -268,7 +268,7 @@
}
if (storeOnlyTrueElectronMC) {
const auto& mcParticle = track.template mcParticle_as<aod::McParticles>();
if (std::abs(mcParticle.pdgCode()) != 11) {

Check failure on line 271 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 271 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 @@ -354,7 +354,7 @@

if (track.hasITS() && !track.hasTPC() && !track.hasTRD() && !track.hasTOF()) {
int total_cluster_size = 0, nl = 0;
for (unsigned int layer = 0; layer < 7; layer++) {

Check failure on line 357 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 All @@ -370,33 +370,15 @@
return true;
}

template <typename TCollision, typename TTrack>
bool isElectron(TCollision const& collision, TTrack const& track)
template <typename TTrack>
bool isElectron(TTrack const& track)
{
if (includeITSsa && (track.hasITS() && !track.hasTPC() && !track.hasTRD() && !track.hasTOF())) {
return true;
}

if (usePIDML) {
if (track.tpcNSigmaEl() < minTPCNsigmaEl || maxTPCNsigmaEl < track.tpcNSigmaEl()) {
return false;
}
if (track.hasTOF() && (maxTOFNsigmaEl < std::fabs(track.tofNSigmaEl()))) {
return false;
}

// return false;
o2::dataformats::DCA mDcaInfoCov;
mDcaInfoCov.set(999, 999, 999, 999, 999);
auto trackParCov = getTrackParCov(track);
trackParCov.setPID(o2::track::PID::Electron);
mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()});
mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ());
o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov);

std::vector<float> inputFeatures = mlResponseSingleTrack.getInputFeatures(track, trackParCov, collision);
float binningFeature = mlResponseSingleTrack.getBinningFeature(track, trackParCov, collision);
return mlResponseSingleTrack.isSelectedMl(inputFeatures, binningFeature);
return true;
} else {
return isElectron_TPChadrej(track) || isElectron_TOFreq(track);
}
Expand Down Expand Up @@ -457,6 +439,13 @@
mcTunedTPCSignal = track.mcTunedTPCSignal();
}

float probaEl = 1.0;
if (usePIDML) {
std::vector<float> inputFeatures = mlResponseSingleTrack.getInputFeatures(track, trackParCov, collision);
float binningFeature = mlResponseSingleTrack.getBinningFeature(track, trackParCov, collision);
probaEl = mlResponseSingleTrack.isSelectedMl(inputFeatures, binningFeature);
}

emprimaryelectrons(collision.globalIndex(), track.globalIndex(), track.sign(),
pt_recalc, eta_recalc, phi_recalc,
dcaXY, dcaZ, trackParCov.getSigmaY2(), trackParCov.getSigmaZY(), trackParCov.getSigmaZ2(),
Expand All @@ -467,7 +456,7 @@
track.itsClusterSizes(),
track.itsChi2NCl(), track.tofChi2(), track.detectorMap(),
// trackParCov.getTgl(),
isAssociatedToMPC, false, 1.f, mcTunedTPCSignal);
isAssociatedToMPC, false, probaEl, mcTunedTPCSignal);

emprimaryelectronscov(
trackParCov.getX(),
Expand Down Expand Up @@ -584,7 +573,7 @@

auto tracks_per_coll = tracks.sliceBy(perCol, collision.globalIndex());
for (const auto& track : tracks_per_coll) {
if (!checkTrack<false>(collision, track) || !isElectron(collision, track)) {
if (!checkTrack<false>(collision, track) || !isElectron(track)) {
continue;
}
fillTrackTable<false>(collision, track);
Expand Down Expand Up @@ -613,7 +602,7 @@

for (const auto& trackId : trackIdsThisCollision) {
auto track = trackId.template track_as<MyTracks>();
if (!checkTrack<false>(collision, track) || !isElectron(collision, track)) {
if (!checkTrack<false>(collision, track) || !isElectron(track)) {
continue;
}
fillTrackTable<false>(collision, track);
Expand Down Expand Up @@ -643,7 +632,7 @@

auto tracks_per_coll = tracks.sliceBy(perCol, collision.globalIndex());
for (const auto& track : tracks_per_coll) {
if (!checkTrack<false>(collision, track) || !isElectron(collision, track)) {
if (!checkTrack<false>(collision, track) || !isElectron(track)) {
continue;
}
fillTrackTable<false>(collision, track);
Expand Down Expand Up @@ -675,7 +664,7 @@

for (const auto& trackId : trackIdsThisCollision) {
auto track = trackId.template track_as<MyTracks>();
if (!checkTrack<false>(collision, track) || !isElectron(collision, track)) {
if (!checkTrack<false>(collision, track) || !isElectron(track)) {
continue;
}
fillTrackTable<false>(collision, track);
Expand Down Expand Up @@ -709,7 +698,7 @@

auto tracks_per_coll = tracks.sliceBy(perCol, collision.globalIndex());
for (const auto& track : tracks_per_coll) {
if (!checkTrack<true>(collision, track) || !isElectron(collision, track)) {
if (!checkTrack<true>(collision, track) || !isElectron(track)) {
continue;
}
fillTrackTable<true>(collision, track);
Expand Down Expand Up @@ -740,7 +729,7 @@

for (const auto& trackId : trackIdsThisCollision) {
auto track = trackId.template track_as<MyTracksMC>();
if (!checkTrack<true>(collision, track) || !isElectron(collision, track)) {
if (!checkTrack<true>(collision, track) || !isElectron(track)) {
continue;
}
fillTrackTable<true>(collision, track);
Expand Down Expand Up @@ -823,10 +812,10 @@
void addHistograms()
{
fRegistry.add("Track/hPt", "pT;p_{T} (GeV/c)", kTH1F, {{1000, 0.0f, 10}}, false);
fRegistry.add("Track/hEtaPhi", "#eta vs. #varphi;#varphi (rad.);#eta", kTH2F, {{90, 0, 2 * M_PI}, {80, -2.0f, 2.0f}}, false);

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

View workflow job for this annotation

GitHub Actions / O2 linter

[pi-multiple-fraction]

Use multiples/fractions of PI defined in o2::constants::math.

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

View workflow job for this annotation

GitHub Actions / O2 linter

[external-pi]

Use the PI constant (and its multiples and fractions) defined in o2::constants::math.
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, 0.1}});

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

View workflow job for this annotation

GitHub Actions / O2 linter

[external-pi]

Use the PI constant (and its multiples and fractions) defined in o2::constants::math.
fRegistry.addClone("Pair/before/uls/", "Pair/before/lspp/");
fRegistry.addClone("Pair/before/uls/", "Pair/before/lsmm/");
fRegistry.addClone("Pair/before/", "Pair/after/");
Expand Down
36 changes: 16 additions & 20 deletions PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -420,26 +420,15 @@ struct skimmerPrimaryElectronQC {
template <typename TTrack>
bool isElectron(TTrack const& track)
{
if (track.hasTPC() && (trackcut.minTPCNsigmaEl < track.tpcNSigmaEl() && track.tpcNSigmaEl() < trackcut.maxTPCNsigmaEl)) {
return true; // accept ITSsa too
} else {
return false;
if (track.hasTPC()) {
if (trackcut.minTPCNsigmaEl < track.tpcNSigmaEl() && track.tpcNSigmaEl() < trackcut.maxTPCNsigmaEl) {
return true;
} else {
return false;
}
} else { // accept ITSsa too
return true;
}

// if (usePIDML) {
// mDcaInfoCov.set(999, 999, 999, 999, 999);
// auto trackParCov = getTrackParCov(track);
// trackParCov.setPID(o2::track::PID::Electron);
// mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()});
// mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ());
// o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov);

// std::vector<float> inputFeatures = mlResponseSingleTrack.getInputFeatures(track, trackParCov, collision);
// float binningFeature = mlResponseSingleTrack.getBinningFeature(track, trackParCov, collision);
// return mlResponseSingleTrack.isSelectedMl(inputFeatures, binningFeature);
// } else {
// return isElectronTPC(track);
// }
}

template <typename TTrack>
Expand Down Expand Up @@ -474,6 +463,13 @@ struct skimmerPrimaryElectronQC {
mcTunedTPCSignal = track.mcTunedTPCSignal();
}

float probaEl = 1.0;
if (usePIDML) {
std::vector<float> inputFeatures = mlResponseSingleTrack.getInputFeatures(track, trackParCov, collision);
float binningFeature = mlResponseSingleTrack.getBinningFeature(track, trackParCov, collision);
probaEl = mlResponseSingleTrack.isSelectedMl(inputFeatures, binningFeature);
}

emprimaryelectrons(collision.globalIndex(), track.globalIndex(), track.sign(),
pt_recalc, eta_recalc, phi_recalc,
dcaXY, dcaZ, trackParCov.getSigmaY2(), trackParCov.getSigmaZY(), trackParCov.getSigmaZ2(),
Expand All @@ -484,7 +480,7 @@ struct skimmerPrimaryElectronQC {
track.itsClusterSizes(),
track.itsChi2NCl(), track.tofChi2(), track.detectorMap(),
// trackParCov.getTgl(),
isAssociatedToMPC, false, 1.f, mcTunedTPCSignal);
isAssociatedToMPC, false, probaEl, mcTunedTPCSignal);

emprimaryelectronscov(
trackParCov.getX(),
Expand Down
Loading