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
18 changes: 18 additions & 0 deletions PWGEM/PhotonMeson/DataModel/gammaTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

namespace v0legmclabel
{
DECLARE_SOA_INDEX_COLUMN(EMMCParticle, emmcparticle); //!

Check failure on line 84 in PWGEM/PhotonMeson/DataModel/gammaTables.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(McMask, mcMask, uint16_t);
} // namespace v0legmclabel

Expand All @@ -96,7 +96,7 @@
// 3. EMEMCClusterMCLabels: EM MC particle ID of largest contributor to cluster
namespace emcclustermclabel
{
DECLARE_SOA_ARRAY_INDEX_COLUMN(EMMCParticle, emmcparticle); //!

Check failure on line 99 in PWGEM/PhotonMeson/DataModel/gammaTables.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.
} // namespace emcclustermclabel

// NOTE: MC labels. This table has one vector of global mc particle ids for each reconstructed emc cluster (joinable with emccluster table)
Expand Down Expand Up @@ -131,7 +131,7 @@
DECLARE_SOA_DYNAMIC_COLUMN(Tgl, tgl, [](float px, float py, float pz) -> float { return std::tan(M_PI_2 - 2 * std::atan(std::exp(-RecoDecay::eta(std::array{px, py, pz})))); });
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 134 in PWGEM/PhotonMeson/DataModel/gammaTables.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 @@ -146,7 +146,7 @@
});
DECLARE_SOA_DYNAMIC_COLUMN(MeanClusterSizeITSib, meanClusterSizeITSib, [](uint32_t itsClusterSizes) -> float {
int total_cluster_size = 0, nl = 0;
for (unsigned int layer = 0; layer < 3; layer++) {

Check failure on line 149 in PWGEM/PhotonMeson/DataModel/gammaTables.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 @@ -161,7 +161,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 164 in PWGEM/PhotonMeson/DataModel/gammaTables.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 Down Expand Up @@ -580,7 +580,7 @@
DECLARE_SOA_COLUMN(DeltaEtaSec, deltaEtaSec, std::vector<float>); //! eta values of the matched secondary tracks
DECLARE_SOA_COLUMN(TrackPSec, trackpSec, std::vector<float>); //! momentum values of the matched secondary tracks
DECLARE_SOA_COLUMN(TrackPtSec, trackptSec, std::vector<float>); //! pt values of the matched secondary tracks
DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](float e, float eta, float m = 0) -> float { return sqrt(e * e - m * m) / cosh(eta); }); //! cluster pt, mass to be given as argument when getter is called!

Check failure on line 583 in PWGEM/PhotonMeson/DataModel/gammaTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
} // namespace emccluster
DECLARE_SOA_TABLE_VERSIONED(SkimEMCClusters_000, "AOD", "SKIMEMCCLUSTER", 0, //! table of skimmed EMCal clusters
o2::soa::Index<>, skimmedcluster::CollisionId, emccluster::Definition, skimmedcluster::E, skimmedcluster::Eta, skimmedcluster::Phi,
Expand All @@ -597,6 +597,24 @@
using SkimEMCClusters = SkimEMCClusters_001;
using SkimEMCCluster = SkimEMCClusters_001::iterator;

// DECLARE_SOA_TABLE_VERSIONED(EmEmcClusters_000, "AOD", "EMEMCCLUSTER", 0, //! table of skimmed EMCal clusters
// o2::soa::Index<>, skimmedcluster::CollisionId, emccluster::Definition, skimmedcluster::E, skimmedcluster::Eta, skimmedcluster::Phi,
// skimmedcluster::M02, skimmedcluster::NCells, skimmedcluster::Time, emccluster::IsExotic, emccluster::Pt<skimmedcluster::E, skimmedcluster::Eta>);

// using EmEmcClusters = EmEmcClusters_000;
// using EmEmcCluster = EmEmcClusters_000::iterator;

// namespace trackmatching
// {
// DECLARE_SOA_INDEX_COLUMN(EmEmcCluster, emEmcCluster); //!
// } // namespace trackmatching

// DECLARE_SOA_TABLE(EmEmcMTracks, "AOD", "EMEMCMTRACK", //!
// o2::soa::Index<>, trackmatching::EmEmcClusterId, emccluster::DeltaPhi, emccluster::DeltaEta, emccluster::TrackP, emccluster::TrackPt);

// DECLARE_SOA_TABLE(EmEmcMSTracks, "AOD", "EMEMCMSTRACK", //!
// o2::soa::Index<>, trackmatching::EmEmcClusterId, emccluster::DeltaPhiSec, emccluster::DeltaEtaSec, emccluster::TrackPSec, emccluster::TrackPtSec);

DECLARE_SOA_TABLE(EMCEMEventIds, "AOD", "EMCEMEVENTID", emccluster::EMEventId); // To be joined with SkimEMCClusters table at analysis level.
// iterators
using EMCEMEventId = EMCEMEventIds::iterator;
Expand All @@ -614,10 +632,10 @@
// DECLARE_SOA_COLUMN(TrackPhi, trackphi, float); //! phi of the matched track
// DECLARE_SOA_COLUMN(TrackP, trackp, float); //! momentum of the matched track
// DECLARE_SOA_COLUMN(TrackPt, trackpt, float); //! pt of the matched track
DECLARE_SOA_DYNAMIC_COLUMN(Px, px, [](float e, float x, float y, float z, float m = 0) -> float { return x / RecoDecay::sqrtSumOfSquares(x, y, z) * sqrt(e * e - m * m); });

Check failure on line 635 in PWGEM/PhotonMeson/DataModel/gammaTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
DECLARE_SOA_DYNAMIC_COLUMN(Py, py, [](float e, float x, float y, float z, float m = 0) -> float { return y / RecoDecay::sqrtSumOfSquares(x, y, z) * sqrt(e * e - m * m); });

Check failure on line 636 in PWGEM/PhotonMeson/DataModel/gammaTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, [](float e, float x, float y, float z, float m = 0) -> float { return z / RecoDecay::sqrtSumOfSquares(x, y, z) * sqrt(e * e - m * m); });

Check failure on line 637 in PWGEM/PhotonMeson/DataModel/gammaTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](float e, float x, float y, float z, float m = 0) -> float { return RecoDecay::sqrtSumOfSquares(x, y) / RecoDecay::sqrtSumOfSquares(x, y, z) * sqrt(e * e - m * m); });

Check failure on line 638 in PWGEM/PhotonMeson/DataModel/gammaTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
DECLARE_SOA_DYNAMIC_COLUMN(Eta, eta, [](float x, float y, float z) -> float { return RecoDecay::eta(std::array{x, y, z}); });
DECLARE_SOA_DYNAMIC_COLUMN(Phi, phi, [](float x, float y) -> float { return RecoDecay::phi(x, y); });
} // namespace phoscluster
Expand Down
55 changes: 32 additions & 23 deletions PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,26 @@ struct SkimmerGammaCalo {
template <typename TCollision, typename TClusters, typename TClusterCells, typename TTracks, typename TMatchedTracks, typename TMatchedSecondaries = std::nullptr_t>
void runAnalysis(TCollision const& collision, TClusters const& emcclusters, TClusterCells const& emcclustercells, TMatchedTracks const& emcmatchedtracks, TTracks const& /*tracks*/, TMatchedSecondaries const& secondaries = nullptr)
{
const size_t NMaxMatchedTracks = 10;
// Skimmed matched tracks table
std::vector<float> vEta;
std::vector<float> vPhi;
std::vector<float> vP;
std::vector<float> vPt;
vEta.reserve(NMaxMatchedTracks);
vPhi.reserve(NMaxMatchedTracks);
vP.reserve(NMaxMatchedTracks);
vPt.reserve(NMaxMatchedTracks);

std::vector<float> vEtaSecondaries = {};
std::vector<float> vPhiSecondaries = {};
std::vector<float> vPSecondaries = {};
std::vector<float> vPtSecondaries = {};
vEtaSecondaries.reserve(NMaxMatchedTracks);
vPhiSecondaries.reserve(NMaxMatchedTracks);
vPSecondaries.reserve(NMaxMatchedTracks);
vPtSecondaries.reserve(NMaxMatchedTracks);

if (!collision.isSelected()) {
return;
}
Expand Down Expand Up @@ -168,17 +188,7 @@ struct SkimmerGammaCalo {
for (const auto& emcclustercell : groupedCells) {
tableCellEMCReco(emcclustercell.emcalclusterId(), emcclustercell.caloId());
}

// Skimmed matched tracks table
std::vector<float> vEta;
std::vector<float> vPhi;
std::vector<float> vP;
std::vector<float> vPt;
auto groupedMTs = emcmatchedtracks.sliceBy(psMTperCluster, emccluster.globalIndex());
vEta.reserve(groupedMTs.size());
vPhi.reserve(groupedMTs.size());
vP.reserve(groupedMTs.size());
vPt.reserve(groupedMTs.size());
for (const auto& emcmatchedtrack : groupedMTs) {
historeg.fill(HIST("hCaloTrackFilter"), 0);
historeg.fill(HIST("MTEtaPhiBeforeTM"), emcmatchedtrack.deltaEta(), emcmatchedtrack.deltaPhi());
Expand All @@ -199,17 +209,8 @@ struct SkimmerGammaCalo {
vPt.emplace_back(emcmatchedtrack.template track_as<aod::FullTracks>().pt());
}

std::vector<float> vEtaSecondaries = {};
std::vector<float> vPhiSecondaries = {};
std::vector<float> vPSecondaries = {};
std::vector<float> vPtSecondaries = {};

if constexpr (HasSecondaries<TMatchedSecondaries>) {
auto groupedMatchedSecondaries = secondaries.sliceBy(psMSperCluster, emccluster.globalIndex());
vEta.reserve(groupedMatchedSecondaries.size());
vPhi.reserve(groupedMatchedSecondaries.size());
vP.reserve(groupedMatchedSecondaries.size());
vPt.reserve(groupedMatchedSecondaries.size());
for (const auto& emcMatchedSecondary : groupedMatchedSecondaries) {
historeg.fill(HIST("hCaloSecondaryTrackFilter"), 0);
historeg.fill(HIST("MSTEtaPhiBeforeTM"), emcMatchedSecondary.deltaEta(), emcMatchedSecondary.deltaPhi());
Expand All @@ -219,10 +220,10 @@ struct SkimmerGammaCalo {
}
historeg.fill(HIST("hCaloSecondaryTrackFilter"), 3);
historeg.fill(HIST("MSTEtaPhiAfterTM"), emcMatchedSecondary.deltaEta(), emcMatchedSecondary.deltaPhi());
vEta.emplace_back(emcMatchedSecondary.deltaEta());
vPhi.emplace_back(emcMatchedSecondary.deltaPhi());
vP.emplace_back(emcMatchedSecondary.template track_as<aod::FullTracks>().p());
vPt.emplace_back(emcMatchedSecondary.template track_as<aod::FullTracks>().pt());
vEtaSecondaries.emplace_back(emcMatchedSecondary.deltaEta());
vPhiSecondaries.emplace_back(emcMatchedSecondary.deltaPhi());
vPSecondaries.emplace_back(emcMatchedSecondary.template track_as<aod::FullTracks>().p());
vPtSecondaries.emplace_back(emcMatchedSecondary.template track_as<aod::FullTracks>().pt());
}
}

Expand All @@ -233,6 +234,14 @@ struct SkimmerGammaCalo {

tableGammaEMCReco(emccluster.collisionId(), emccluster.definition(), emccluster.energy(), emccluster.eta(), emccluster.phi(), emccluster.m02(),
emccluster.nCells(), emccluster.time(), emccluster.isExotic(), vPhi, vEta, vP, vPt, vPhiSecondaries, vEtaSecondaries, vPSecondaries, vPtSecondaries);
vEta.clear();
vPhi.clear();
vP.clear();
vPt.clear();
vPhiSecondaries.clear();
vEtaSecondaries.clear();
vPSecondaries.clear();
vPtSecondaries.clear();
}
}

Expand Down
Loading