Skip to content

Commit 06a9594

Browse files
authored
[PWGEM,Tools] Update EMCal Conversion ML Model and enable batching of… (#17768)
1 parent 1b767c3 commit 06a9594

6 files changed

Lines changed: 336 additions & 209 deletions

File tree

PWGEM/PhotonMeson/Core/EMBitFlags.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,18 @@ class EMBitFlags
3737

3838
/// \brief check bit i
3939
/// \param i index of bit that should be checked
40+
/// \return false if the bit was set before
4041
[[nodiscard]] bool test(std::size_t i) const;
4142

42-
/// \brief set bit i
43+
/// \brief set bit i to false
4344
/// \param i index of bit which value should be set
4445
void set(std::size_t i);
4546

46-
/// \brief reset bit i
47+
/// \brief reset bit i to true
4748
/// \param i index of bit which value should be reset
4849
void reset(std::size_t i);
4950

50-
/// \brief resetting all flags to false
51+
/// \brief resetting all flags to true
5152
void clear();
5253

5354
/// \brief reserve space in the underlying storage for nBits bits

PWGEM/PhotonMeson/Core/EMCConversionCandidate.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#define PWGEM_PHOTONMESON_CORE_EMCCONVERSIONCANDIDATE_H_
1818

1919
#include <concepts>
20+
#include <cstdint>
2021

2122
namespace o2::analysis::em
2223
{
@@ -34,6 +35,13 @@ concept IsEmcConversionCandidate = requires(T const& c) {
3435
{ c.e2() } -> std::convertible_to<float>;
3536
{ c.e1() } -> std::convertible_to<float>;
3637
{ c.deltaPhi() } -> std::convertible_to<float>;
38+
{ c.harmonicEt() } -> std::convertible_to<float>;
39+
{ c.m021() } -> std::convertible_to<float>;
40+
{ c.m022() } -> std::convertible_to<float>;
41+
{ c.time1() } -> std::convertible_to<float>;
42+
{ c.time2() } -> std::convertible_to<float>;
43+
{ c.ncell1() } -> std::convertible_to<uint8_t>;
44+
{ c.ncell2() } -> std::convertible_to<uint8_t>;
3745
};
3846

3947
struct EMCConversionCandidate {
@@ -46,6 +54,13 @@ struct EMCConversionCandidate {
4654
float mE2;
4755
float mE1;
4856
float mDeltaPhi;
57+
float mHarmonicEt;
58+
float mM021;
59+
float mM022;
60+
float mTime1;
61+
float mTime2;
62+
uint8_t mNcell1;
63+
uint8_t mNcell2;
4964

5065
[[nodiscard]] float minv() const { return mMinv; }
5166
[[nodiscard]] float deltaEta() const { return mDeltaEta; }
@@ -56,6 +71,13 @@ struct EMCConversionCandidate {
5671
[[nodiscard]] float e2() const { return mE2; }
5772
[[nodiscard]] float e1() const { return mE1; }
5873
[[nodiscard]] float deltaPhi() const { return mDeltaPhi; }
74+
[[nodiscard]] float harmonicEt() const { return mHarmonicEt; }
75+
[[nodiscard]] float m021() const { return mM021; }
76+
[[nodiscard]] float m022() const { return mM022; }
77+
[[nodiscard]] float time1() const { return mTime1; }
78+
[[nodiscard]] float time2() const { return mTime2; }
79+
[[nodiscard]] uint8_t ncell1() const { return mNcell1; }
80+
[[nodiscard]] uint8_t ncell2() const { return mNcell2; }
5981
};
6082

6183
} // namespace o2::analysis::em

PWGEM/PhotonMeson/Core/EmMlResponseEMCConversion.h

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,14 @@ enum class InputFeaturesEMCConversion : uint8_t {
5454
totE,
5555
e2,
5656
e1,
57-
deltaPhi
57+
deltaPhi,
58+
harmonicEt,
59+
m021,
60+
m022,
61+
time1,
62+
time2,
63+
ncell1,
64+
ncell2
5865
};
5966

6067
template <typename TypeOutputScore = float>
@@ -65,9 +72,9 @@ class EmMlResponseEMCConversion : public MlResponse<TypeOutputScore>
6572
virtual ~EmMlResponseEMCConversion() = default;
6673

6774
template <o2::analysis::em::IsEmcConversionCandidate TCandidate>
68-
std::vector<float> getInputFeatures(TCandidate const& candidate)
75+
void getInputFeatures(TCandidate const& candidate, std::vector<float>& inputFeatures)
6976
{
70-
std::vector<float> inputFeatures;
77+
inputFeatures.clear();
7178
for (const auto& idx : MlResponse<TypeOutputScore>::mCachedIndices) {
7279
switch (idx) {
7380
CHECK_AND_FILL_VEC_EMC_CONV(minv)
@@ -79,9 +86,15 @@ class EmMlResponseEMCConversion : public MlResponse<TypeOutputScore>
7986
CHECK_AND_FILL_VEC_EMC_CONV(e2)
8087
CHECK_AND_FILL_VEC_EMC_CONV(e1)
8188
CHECK_AND_FILL_VEC_EMC_CONV(deltaPhi)
89+
CHECK_AND_FILL_VEC_EMC_CONV(harmonicEt)
90+
CHECK_AND_FILL_VEC_EMC_CONV(m021)
91+
CHECK_AND_FILL_VEC_EMC_CONV(m022)
92+
CHECK_AND_FILL_VEC_EMC_CONV(time1)
93+
CHECK_AND_FILL_VEC_EMC_CONV(time2)
94+
CHECK_AND_FILL_VEC_EMC_CONV(ncell1)
95+
CHECK_AND_FILL_VEC_EMC_CONV(ncell2)
8296
}
8397
}
84-
return inputFeatures;
8598
}
8699

87100
protected:
@@ -90,7 +103,10 @@ class EmMlResponseEMCConversion : public MlResponse<TypeOutputScore>
90103
MlResponse<TypeOutputScore>::mAvailableInputFeatures = {
91104
FILL_MAP_EMC_CONV(minv), FILL_MAP_EMC_CONV(deltaEta), FILL_MAP_EMC_CONV(deltaR),
92105
FILL_MAP_EMC_CONV(phiv), FILL_MAP_EMC_CONV(rConv), FILL_MAP_EMC_CONV(totE),
93-
FILL_MAP_EMC_CONV(e2), FILL_MAP_EMC_CONV(e1), FILL_MAP_EMC_CONV(deltaPhi)};
106+
FILL_MAP_EMC_CONV(e2), FILL_MAP_EMC_CONV(e1), FILL_MAP_EMC_CONV(deltaPhi),
107+
FILL_MAP_EMC_CONV(harmonicEt), FILL_MAP_EMC_CONV(m021), FILL_MAP_EMC_CONV(m022),
108+
FILL_MAP_EMC_CONV(time1), FILL_MAP_EMC_CONV(time2), FILL_MAP_EMC_CONV(ncell1),
109+
FILL_MAP_EMC_CONV(ncell2)};
94110
}
95111
};
96112

0 commit comments

Comments
 (0)