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
3 changes: 2 additions & 1 deletion PWGEM/Dilepton/DataModel/lmeeMLTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,19 @@
namespace emmltrack
{
DECLARE_SOA_COLUMN(CollisionId, collisionId, int); //!
DECLARE_SOA_COLUMN(HadronicRate, hadronicRate, float); //!
DECLARE_SOA_COLUMN(PIDLabel, pidlabel, uint8_t); //!

Check failure on line 50 in PWGEM/Dilepton/DataModel/lmeeMLTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(TrackType, tracktype, uint8_t); //!

Check failure on line 51 in PWGEM/Dilepton/DataModel/lmeeMLTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(TPCNClsFound, tpcNClsFound, uint8_t); //!

Check failure on line 52 in PWGEM/Dilepton/DataModel/lmeeMLTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(TPCNClsCrossedRows, tpcNClsCrossedRows, uint8_t); //!

Check failure on line 53 in PWGEM/Dilepton/DataModel/lmeeMLTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(TPCNClsPID, tpcNClsPID, uint8_t); //!

Check failure on line 54 in PWGEM/Dilepton/DataModel/lmeeMLTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(IsForValidation, isForValidation, bool); //!
DECLARE_SOA_COLUMN(Sign, sign, short); //!
DECLARE_SOA_COLUMN(P, p, float); //!
// DECLARE_SOA_DYNAMIC_COLUMN(P, p, [](float pt, float eta) -> float { return pt * std::cosh(eta); });
DECLARE_SOA_DYNAMIC_COLUMN(MeanClusterSizeITS, meanClusterSizeITS, [](uint32_t itsClusterSizes) -> float {
int total_cluster_size = 0, nl = 0;
for (unsigned int layer = 0; layer < 7; layer++) {

Check failure on line 61 in PWGEM/Dilepton/DataModel/lmeeMLTables.h

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 = (itsClusterSizes >> (layer * 4)) & 0xf;
if (cluster_size_per_layer > 0) {
nl++;
Expand All @@ -72,7 +73,7 @@
});
DECLARE_SOA_DYNAMIC_COLUMN(MeanClusterSizeITSob, meanClusterSizeITSob, [](uint32_t itsClusterSizes) -> float {
int total_cluster_size = 0, nl = 0;
for (unsigned int layer = 3; layer < 7; layer++) {

Check failure on line 76 in PWGEM/Dilepton/DataModel/lmeeMLTables.h

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 = (itsClusterSizes >> (layer * 4)) & 0xf;
if (cluster_size_per_layer > 0) {
nl++;
Expand All @@ -89,7 +90,7 @@

// reconstructed track information
DECLARE_SOA_TABLE(EMTracksForMLPID, "AOD", "EMTRACKMLPID", //!
o2::soa::Index<>, collision::NumContrib, evsel::NumTracksInTimeRange, evsel::SumAmpFT0CInTimeRange,
o2::soa::Index<>, collision::NumContrib, evsel::NumTracksInTimeRange, evsel::SumAmpFT0CInTimeRange, emmltrack::HadronicRate,
emmltrack::P, track::Tgl, emmltrack::Sign,
track::TPCNClsFindable, emmltrack::TPCNClsFound, emmltrack::TPCNClsCrossedRows, emmltrack::TPCNClsPID,
track::TPCChi2NCl, track::TPCInnerParam,
Expand Down
2 changes: 1 addition & 1 deletion PWGEM/Dilepton/TableProducer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
# or submit itself to any jurisdiction.


o2physics_add_dpl_workflow(tree-creator-electron-ml

Check failure on line 13 in PWGEM/Dilepton/TableProducer/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name tree-creator-electron-ml does not match its file name treeCreatorElectronML.cxx. (Matches treeCreatorElectronMl.cxx.)
SOURCES treeCreatorElectronML.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(tree-creator-electron-ml-dda

Check failure on line 18 in PWGEM/Dilepton/TableProducer/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name tree-creator-electron-ml-dda does not match its file name treeCreatorElectronMLDDA.cxx. (Matches treeCreatorElectronMlDda.cxx.)
SOURCES treeCreatorElectronMLDDA.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::AnalysisCCDB
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(skimmer-primary-electron
Expand All @@ -25,7 +25,7 @@
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::MLCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(skimmer-primary-electron-qc

Check failure on line 28 in PWGEM/Dilepton/TableProducer/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name skimmer-primary-electron-qc does not match its file name skimmerPrimaryElectronQC.cxx. (Matches skimmerPrimaryElectronQc.cxx.)
SOURCES skimmerPrimaryElectronQC.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::MLCore
COMPONENT_NAME Analysis)
Expand Down
23 changes: 14 additions & 9 deletions PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "PWGLF/DataModel/LFStrangenessTables.h"

#include "Common/CCDB/RCTSelectionFlags.h"
#include "Common/CCDB/ctpRateFetcher.h"
#include "Common/Core/RecoDecay.h"
#include "Common/Core/TrackSelection.h"
#include "Common/Core/trackUtilities.h"
Expand Down Expand Up @@ -125,6 +126,7 @@ struct TreeCreatorElectronMLDDA {
// Operation and minimisation criteria
Configurable<double> d_bz_input{"d_bz_input", -999, "bz field, -999 is automatic"};
Configurable<int> useMatCorrType{"useMatCorrType", 2, "0: none, 1: TGeo, 2: LUT"};
Configurable<std::string> irSource{"irSource", "ZNC hadronic", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"};

// for zorro
Configurable<std::string> cfg_swt_names{"cfg_swt_names", "fHighTrackMult,fHighFt0cFv0Mult", "comma-separated software trigger names"};
Expand Down Expand Up @@ -298,6 +300,7 @@ struct TreeCreatorElectronMLDDA {
o2::base::MatLayerCylSet* lut = nullptr;
o2::dataformats::DCA mDcaInfoCov;
o2::aod::rctsel::RCTFlagsChecker rctChecker;
ctpRateFetcher mRateFetcher;
Zorro zorro;

std::mt19937 engine;
Expand Down Expand Up @@ -611,7 +614,7 @@ struct TreeCreatorElectronMLDDA {
}

template <typename TCollision, typename TTrack>
void fillTrackTable(TCollision const& collision, TTrack const& track, const uint8_t pidlabel)
void fillTrackTable(TCollision const& collision, TTrack const& track, const uint8_t pidlabel, const float hadronicRate)
{
if (store_ele_band_only && !isElectron(track)) {
return;
Expand Down Expand Up @@ -673,7 +676,7 @@ struct TreeCreatorElectronMLDDA {
}

if (std::find(stored_trackIds.begin(), stored_trackIds.end(), track.globalIndex()) == stored_trackIds.end()) {
emprimarytracks(collision.numContrib(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange(),
emprimarytracks(collision.numContrib(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange(), hadronicRate,
trackParCov.getP(), trackParCov.getTgl(), track.sign(),
track.tpcNClsFindable(), track.tpcNClsFound(), track.tpcNClsCrossedRows(), track.tpcNClsPID(),
track.tpcChi2NCl(), track.tpcInnerParam(),
Expand Down Expand Up @@ -816,6 +819,8 @@ struct TreeCreatorElectronMLDDA {
registry.fill(HIST("Event/hEventCounter"), 2.0); // selected
registry.fill(HIST("Event/hNumContrib"), collision.numContrib());

float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), irSource) * 1.e-3; // kHz

auto v0s_coll = v0s.sliceBy(perCollision_v0, collision.globalIndex());
for (const auto& v0 : v0s_coll) {
// auto o2v0 = v0.template v0_as<aod::V0s>();
Expand Down Expand Up @@ -850,15 +855,15 @@ struct TreeCreatorElectronMLDDA {
if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) {
registry.fill(HIST("V0/hTPCdEdx_P_Pi"), neg.tpcInnerParam(), neg.tpcSignal());
registry.fill(HIST("V0/hTOFbeta_P_Pi"), neg.tpcInnerParam(), neg.beta());
fillTrackTable(collision, neg, static_cast<uint8_t>(o2::aod::pwgem::dilepton::ml::PID_Label::kPion));
fillTrackTable(collision, neg, static_cast<uint8_t>(o2::aod::pwgem::dilepton::ml::PID_Label::kPion), hadronicRate);
}
}
if (isPion(pos) && isSelectedV0Leg(collision, pos) && isPionTightTOFreq(neg) && isSelectedV0LegTight(collision, neg)) {
registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short());
if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) {
registry.fill(HIST("V0/hTPCdEdx_P_Pi"), pos.tpcInnerParam(), pos.tpcSignal());
registry.fill(HIST("V0/hTOFbeta_P_Pi"), pos.tpcInnerParam(), pos.beta());
fillTrackTable(collision, pos, static_cast<uint8_t>(o2::aod::pwgem::dilepton::ml::PID_Label::kPion));
fillTrackTable(collision, pos, static_cast<uint8_t>(o2::aod::pwgem::dilepton::ml::PID_Label::kPion), hadronicRate);
}
}
} // end of K0S
Expand All @@ -868,15 +873,15 @@ struct TreeCreatorElectronMLDDA {
if (isProton(pos) && isSelectedV0Leg(collision, pos) && isPionTight(neg) && isSelectedV0LegTight(collision, neg)) {
registry.fill(HIST("V0/hMassLambda"), v0.mLambda());
if (v0cuts.cfg_min_mass_lambda < v0.mLambda() && v0.mLambda() < v0cuts.cfg_max_mass_lambda) {
fillTrackTable(collision, pos, static_cast<uint8_t>(o2::aod::pwgem::dilepton::ml::PID_Label::kProton));
fillTrackTable(collision, pos, static_cast<uint8_t>(o2::aod::pwgem::dilepton::ml::PID_Label::kProton), hadronicRate);
registry.fill(HIST("V0/hTPCdEdx_P_Pr"), pos.tpcInnerParam(), pos.tpcSignal());
registry.fill(HIST("V0/hTOFbeta_P_Pr"), pos.tpcInnerParam(), pos.beta());
}
} // end of Lambda
if (isPionTight(pos) && isSelectedV0LegTight(collision, pos) && isProton(neg) && isSelectedV0Leg(collision, neg)) {
registry.fill(HIST("V0/hMassAntiLambda"), v0.mAntiLambda());
if (v0cuts.cfg_min_mass_lambda < v0.mAntiLambda() && v0.mAntiLambda() < v0cuts.cfg_max_mass_lambda) {
fillTrackTable(collision, neg, static_cast<uint8_t>(o2::aod::pwgem::dilepton::ml::PID_Label::kProton));
fillTrackTable(collision, neg, static_cast<uint8_t>(o2::aod::pwgem::dilepton::ml::PID_Label::kProton), hadronicRate);
registry.fill(HIST("V0/hTPCdEdx_P_Pr"), neg.tpcInnerParam(), neg.tpcSignal());
registry.fill(HIST("V0/hTOFbeta_P_Pr"), neg.tpcInnerParam(), neg.beta());
}
Expand All @@ -890,7 +895,7 @@ struct TreeCreatorElectronMLDDA {
registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma());
if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) {
registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y());
fillTrackTable(collision, neg, static_cast<uint8_t>(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron));
fillTrackTable(collision, neg, static_cast<uint8_t>(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron), hadronicRate);
registry.fill(HIST("V0/hTPCdEdx_P_El"), neg.tpcInnerParam(), neg.tpcSignal());
registry.fill(HIST("V0/hTOFbeta_P_El"), neg.tpcInnerParam(), neg.beta());
}
Expand All @@ -901,7 +906,7 @@ struct TreeCreatorElectronMLDDA {
registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma());
if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) {
registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y());
fillTrackTable(collision, pos, static_cast<uint8_t>(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron));
fillTrackTable(collision, pos, static_cast<uint8_t>(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron), hadronicRate);
registry.fill(HIST("V0/hTPCdEdx_P_El"), pos.tpcInnerParam(), pos.tpcSignal());
registry.fill(HIST("V0/hTOFbeta_P_El"), pos.tpcInnerParam(), pos.beta());
}
Expand Down Expand Up @@ -991,7 +996,7 @@ struct TreeCreatorElectronMLDDA {
if (cascadecuts.cfg_min_mass_Omega < cascade.mOmega() && cascade.mOmega() < cascadecuts.cfg_max_mass_Omega) { // select Omega candidates
registry.fill(HIST("V0/hTPCdEdx_P_Ka"), bachelor.tpcInnerParam(), bachelor.tpcSignal());
registry.fill(HIST("V0/hTOFbeta_P_Ka"), bachelor.tpcInnerParam(), bachelor.beta());
fillTrackTable(collision, bachelor, static_cast<uint8_t>(o2::aod::pwgem::dilepton::ml::PID_Label::kKaon));
fillTrackTable(collision, bachelor, static_cast<uint8_t>(o2::aod::pwgem::dilepton::ml::PID_Label::kKaon), hadronicRate);
}
}
} // end of cascade loop
Expand Down
Loading