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
21 changes: 19 additions & 2 deletions PWGEM/Dilepton/DataModel/lmeeMLTables.h
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/DataModel/lmeeMLTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Provide mandatory file documentation.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand All @@ -8,7 +8,7 @@
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

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

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \author is missing, incorrect or misplaced.

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

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \brief is missing, incorrect or misplaced.

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

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \file is missing, incorrect or misplaced.
#include <vector>
#include "Framework/AnalysisDataModel.h"
#include "Common/DataModel/PIDResponse.h"
Expand Down Expand Up @@ -48,11 +48,12 @@
DECLARE_SOA_COLUMN(TrackType, tracktype, int); //!
DECLARE_SOA_COLUMN(TPCNClsFound, tpcNClsFound, int); //!
DECLARE_SOA_COLUMN(TPCNClsCrossedRows, tpcNClsCrossedRows, int); //!
DECLARE_SOA_COLUMN(IsForValidation, isForValidation, bool); //!
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;

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

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
for (unsigned int layer = 0; layer < 7; layer++) {

Check failure on line 55 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;

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

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
if (cluster_size_per_layer > 0) {
nl++;
}
Expand All @@ -64,6 +65,21 @@
return 0;
}
});
DECLARE_SOA_DYNAMIC_COLUMN(MeanClusterSizeITSob, meanClusterSizeITSob, [](uint32_t itsClusterSizes) -> float {
int total_cluster_size = 0, nl = 0;

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

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
for (unsigned int layer = 3; layer < 7; layer++) {

Check failure on line 70 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;

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

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
if (cluster_size_per_layer > 0) {
nl++;
}
total_cluster_size += cluster_size_per_layer;
}
if (nl > 0) {
return static_cast<float>(total_cluster_size) / static_cast<float>(nl);
} else {
return 0;
}
});
} // namespace emprimarytrack

// reconstructed track information
Expand All @@ -75,11 +91,12 @@
track::TPCChi2NCl, track::TPCInnerParam,
track::TPCSignal, pidtpc::TPCNSigmaEl, pidtpc::TPCNSigmaMu, pidtpc::TPCNSigmaPi, pidtpc::TPCNSigmaKa, pidtpc::TPCNSigmaPr,
pidtofbeta::Beta, pidtof::TOFNSigmaEl, pidtof::TOFNSigmaMu, pidtof::TOFNSigmaPi, pidtof::TOFNSigmaKa, pidtof::TOFNSigmaPr,
track::ITSClusterSizes, track::ITSChi2NCl, track::TOFChi2, track::DetectorMap, emprimarytrack::PIDLabel, emprimarytrack::TrackType,
track::ITSClusterSizes, track::ITSChi2NCl, track::TOFChi2, track::DetectorMap, emprimarytrack::PIDLabel, emprimarytrack::TrackType, emprimarytrack::IsForValidation,

// dynamic column
emprimarytrack::P<track::Pt, track::Eta>,
emprimarytrack::MeanClusterSizeITS<track::ITSClusterSizes>);
emprimarytrack::MeanClusterSizeITS<track::ITSClusterSizes>,
emprimarytrack::MeanClusterSizeITSob<track::ITSClusterSizes>);

// iterators
using EMPrimaryTrack = EMPrimaryTracks::iterator;
Expand Down
72 changes: 31 additions & 41 deletions PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ using MyTracks = soa::Join<aod::TracksIU, aod::TracksExtra, aod::TracksCovIU,
using MyTrack = MyTracks::iterator;

struct TreeCreatorElectronMLDDA {
enum class EM_V0_Label : int { // Reconstructed V0
kUndef = -1,
kGamma = 0,
kK0S = 1,
kLambda = 2,
kAntiLambda = 3,
};
// enum class EM_V0_Label : int { // Reconstructed V0
// kUndef = -1,
// kGamma = 0,
// kK0S = 1,
// kLambda = 2,
// kAntiLambda = 3,
// };

SliceCache cache;
Produces<o2::aod::EMPrimaryTracks> emprimarytracks; // flat table containing collision + track information
Expand Down Expand Up @@ -151,6 +151,7 @@ struct TreeCreatorElectronMLDDA {
Configurable<double> d_bz_input{"d_bz_input", -999, "bz field, -999 is automatic"};
Configurable<int> useMatCorrType{"useMatCorrType", 0, "0: none, 1: TGeo, 2: LUT"};

Configurable<float> downscaling_track{"downscaling_track", 1e-4, "down scaling factor to store track"};
Configurable<float> downscaling_electron{"downscaling_electron", 0.005, "down scaling factor to store electron"};
Configurable<float> downscaling_pion{"downscaling_pion", 0.001, "down scaling factor to store pion"};
Configurable<float> downscaling_kaon{"downscaling_kaon", 1.1, "down scaling factor to store kaon"};
Expand All @@ -167,12 +168,12 @@ struct TreeCreatorElectronMLDDA {
Configurable<float> cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 0.7, "max fraction of shared clusters in TPC"};
Configurable<int> cfg_min_ncrossedrows_tpc{"cfg_min_ncrossedrows_tpc", 70, "min ncrossed rows"};
Configurable<int> cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"};
Configurable<int> cfg_min_ncluster_its{"cfg_min_ncluster_its", 2, "min ncluster its"};
Configurable<int> cfg_min_ncluster_itsib{"cfg_min_ncluster_itsib", 0, "min ncluster itsib"};
Configurable<int> cfg_min_ncluster_its{"cfg_min_ncluster_its", 4, "min ncluster its"};
Configurable<int> cfg_min_ncluster_itsib{"cfg_min_ncluster_itsib", 1, "min ncluster itsib"};
Configurable<float> cfg_max_chi2tpc{"cfg_max_chi2tpc", 5.0, "max chi2/NclsTPC"};
Configurable<float> cfg_max_chi2its{"cfg_max_chi2its", 6.0, "max chi2/NclsITS"};
Configurable<float> cfg_max_dcaxy{"cfg_max_dcaxy", 0.3, "max dca XY in cm"};
Configurable<float> cfg_max_dcaz{"cfg_max_dcaz", 0.3, "max dca Z in cm"};
Configurable<float> cfg_max_dcaxy{"cfg_max_dcaxy", 1.0, "max dca XY in cm"};
Configurable<float> cfg_max_dcaz{"cfg_max_dcaz", 1.0, "max dca Z in cm"};
} trackcuts;

struct : ConfigurableGroup {
Expand Down Expand Up @@ -513,7 +514,7 @@ struct TreeCreatorElectronMLDDA {
}

template <typename TCollision, typename TTrack>
void fillTrackTable(TCollision const& collision, TTrack const& track, const int pidlabel, const int tracktype)
void fillTrackTable(TCollision const& collision, TTrack const& track, const int pidlabel, const int tracktype, const bool isForValidation)
{
if (std::find(stored_trackIds.begin(), stored_trackIds.end(), track.globalIndex()) == stored_trackIds.end()) {
mDcaInfoCov.set(999, 999, 999, 999, 999);
Expand All @@ -532,7 +533,7 @@ struct TreeCreatorElectronMLDDA {
track.tpcChi2NCl(), track.tpcInnerParam(),
track.tpcSignal(), track.tpcNSigmaEl(), track.tpcNSigmaMu(), track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(),
track.beta(), track.tofNSigmaEl(), track.tofNSigmaMu(), track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(),
track.itsClusterSizes(), track.itsChi2NCl(), track.tofChi2(), track.detectorMap(), pidlabel, tracktype);
track.itsClusterSizes(), track.itsChi2NCl(), track.tofChi2(), track.detectorMap(), pidlabel, tracktype, isForValidation);
stored_trackIds.emplace_back(track.globalIndex());
}
}
Expand Down Expand Up @@ -594,18 +595,18 @@ struct TreeCreatorElectronMLDDA {
registry.fill(HIST("V0/hTPCdEdx_P_Pi"), pos.p(), pos.tpcSignal());
registry.fill(HIST("V0/hTOFbeta_P_Pi"), pos.p(), pos.beta());
if (dist01(engine) < downscaling_pion) {
fillTrackTable(collision, pos, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kPion), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kSecondary));
fillTrackTable(collision, pos, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kPion), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kSecondary), false);
}
if (dist01(engine) < downscaling_pion) {
fillTrackTable(collision, neg, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kPion), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kSecondary));
fillTrackTable(collision, neg, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kPion), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kSecondary), false);
}
}
}
if (isProton(pos) && isPionTight(neg)) {
registry.fill(HIST("V0/hMassLambda"), v0.mLambda());
if (v0cuts.cfg_min_mass_lambda < v0.mLambda() && v0.mLambda() < v0cuts.cfg_max_mass_lambda) {
if (dist01(engine) < downscaling_proton) {
fillTrackTable(collision, pos, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kProton), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kSecondary));
fillTrackTable(collision, pos, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kProton), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kSecondary), false);
}
registry.fill(HIST("V0/hTPCdEdx_P_Pr"), pos.p(), pos.tpcSignal());
registry.fill(HIST("V0/hTOFbeta_P_Pr"), pos.p(), pos.beta());
Expand All @@ -615,7 +616,7 @@ struct TreeCreatorElectronMLDDA {
registry.fill(HIST("V0/hMassAntiLambda"), v0.mAntiLambda());
if (v0cuts.cfg_min_mass_lambda < v0.mAntiLambda() && v0.mAntiLambda() < v0cuts.cfg_max_mass_lambda) {
if (dist01(engine) < downscaling_proton) {
fillTrackTable(collision, neg, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kProton), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kSecondary));
fillTrackTable(collision, neg, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kProton), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kSecondary), false);
}
registry.fill(HIST("V0/hTPCdEdx_P_Pr"), neg.p(), neg.tpcSignal());
registry.fill(HIST("V0/hTOFbeta_P_Pr"), neg.p(), neg.beta());
Expand All @@ -627,10 +628,10 @@ 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)) {
if (dist01(engine) < downscaling_electron) {
fillTrackTable(collision, pos, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kElectron), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kSecondary));
fillTrackTable(collision, pos, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kElectron), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kSecondary), false);
}
if (dist01(engine) < downscaling_electron) {
fillTrackTable(collision, neg, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kElectron), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kSecondary));
fillTrackTable(collision, neg, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kElectron), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kSecondary), false);
}
registry.fill(HIST("V0/hTPCdEdx_P_El"), neg.p(), neg.tpcSignal());
registry.fill(HIST("V0/hTOFbeta_P_El"), neg.p(), neg.beta());
Expand Down Expand Up @@ -665,10 +666,10 @@ struct TreeCreatorElectronMLDDA {
registry.fill(HIST("V0/hTOFbeta_P_El"), pos.p(), pos.beta());

if (dist01(engine) < downscaling_electron) {
fillTrackTable(collision, neg, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kElectron), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kPrimary)); // secondary in primary electron candidates
fillTrackTable(collision, neg, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kElectron), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kPrimary), false); // secondary in primary electron candidates
}
if (dist01(engine) < downscaling_electron) {
fillTrackTable(collision, pos, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kElectron), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kPrimary)); // secondary in primary electron candidates
fillTrackTable(collision, pos, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kElectron), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kPrimary), false); // secondary in primary electron candidates
}
}
} // end of ULS pair loop
Expand Down Expand Up @@ -755,31 +756,20 @@ struct TreeCreatorElectronMLDDA {
registry.fill(HIST("V0/hTPCdEdx_P_Ka"), bachelor.p(), bachelor.tpcSignal());
registry.fill(HIST("V0/hTOFbeta_P_Ka"), bachelor.p(), bachelor.beta());
if (dist01(engine) < downscaling_kaon) {
fillTrackTable(collision, bachelor, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kKaon), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kPrimary));
fillTrackTable(collision, bachelor, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kKaon), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kPrimary), false);
}
}
}
} // end of cascade loop

// auto tracks_coll = tracks.sliceBy(perCollision_track, collision.globalIndex());
// for (const auto& track : tracks_coll) {
// if (!isSelectedTrack(collision, track)) {
// continue;
// }
// registry.fill(HIST("PrimaryTrack/hTPCdEdx_P"), track.p(), track.tpcSignal());
// registry.fill(HIST("PrimaryTrack/hTOFbeta_P"), track.p(), track.beta());
// registry.fill(HIST("PrimaryTrack/hITSClusterSize_P"), track.p(), meanClusterSizeITS<0, 7>(track) * std::cos(std::atan(track.tgl())));
// registry.fill(HIST("PrimaryTrack/hTPCNsigmaEl_P"), track.p(), track.tpcNSigmaEl());
// registry.fill(HIST("PrimaryTrack/hTOFNsigmaEl_P"), track.p(), track.tofNSigmaEl());
// registry.fill(HIST("PrimaryTrack/hTPCNsigmaMu_P"), track.p(), track.tpcNSigmaMu());
// registry.fill(HIST("PrimaryTrack/hTOFNsigmaMu_P"), track.p(), track.tofNSigmaMu());
// registry.fill(HIST("PrimaryTrack/hTPCNsigmaPi_P"), track.p(), track.tpcNSigmaPi());
// registry.fill(HIST("PrimaryTrack/hTOFNsigmaPi_P"), track.p(), track.tofNSigmaPi());
// registry.fill(HIST("PrimaryTrack/hTPCNsigmaKa_P"), track.p(), track.tpcNSigmaKa());
// registry.fill(HIST("PrimaryTrack/hTOFNsigmaKa_P"), track.p(), track.tofNSigmaKa());
// registry.fill(HIST("PrimaryTrack/hTPCNsigmaPr_P"), track.p(), track.tpcNSigmaPr());
// registry.fill(HIST("PrimaryTrack/hTOFNsigmaPr_P"), track.p(), track.tofNSigmaPr());
// } // end of track loop
const auto& tracks_coll = tracks.sliceBy(perCollision_track, collision.globalIndex());
for (const auto& track : tracks_coll) {
if (isSelectedTrack(collision, track) && (v0cuts.cfg_min_TPCNsigmaEl < track.tpcNSigmaEl() && track.tpcNSigmaEl() < v0cuts.cfg_max_TPCNsigmaEl)) {
if (dist01(engine) < downscaling_track) {
fillTrackTable(collision, track, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kUnDef), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kPrimary), true);
}
}
} // end of track loop

} // end of collision loop
stored_trackIds.clear();
Expand Down
Loading
Loading