Skip to content

Commit bca3950

Browse files
authored
[PWGEM] Fix clang-tidy warnings and errors in EMCal cuts related files (#17045)
1 parent b8eeab9 commit bca3950

5 files changed

Lines changed: 32 additions & 27 deletions

File tree

PWGEM/PhotonMeson/Core/EMBitFlags.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ std::size_t EMBitFlags::size() const
3333
bool EMBitFlags::test(std::size_t i) const
3434
{
3535
assert(i < mSize);
36-
return mBits[word(i)] & mask(i);
36+
return static_cast<bool>(mBits[word(i)] & mask(i));
3737
}
3838

3939
void EMBitFlags::set(std::size_t i)

PWGEM/PhotonMeson/Core/EMBitFlags.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ class EMBitFlags
3333
explicit EMBitFlags(std::size_t nBits = 0);
3434

3535
/// \brief get number of stored bits
36-
std::size_t size() const;
36+
[[nodiscard]] std::size_t size() const;
3737

3838
/// \brief check bit i
3939
/// \param i index of bit that should be checked
40-
bool test(std::size_t i) const;
40+
[[nodiscard]] bool test(std::size_t i) const;
4141

4242
/// \brief set bit i
4343
/// \param i index of bit which value should be set

PWGEM/PhotonMeson/Core/EMCPhotonCut.cxx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,11 @@
1919

2020
#include <Framework/Logger.h>
2121

22-
#include <Rtypes.h>
23-
2422
#include <string>
2523

26-
ClassImp(EMCPhotonCut);
27-
28-
const char* EMCPhotonCut::mCutNames[static_cast<int>(EMCPhotonCut::EMCPhotonCuts::kNCuts)] = {"Definition", "Energy", "NCell", "M02", "Timing", "TrackMatching", "SecTrackMatching", "Exotic"};
24+
std::array<std::string, static_cast<std::size_t>(EMCPhotonCut::EMCPhotonCuts::kNCuts)> EMCPhotonCut::mCutNames = {"Definition", "Energy", "NCell", "M02", "Timing", "TrackMatching", "SecTrackMatching", "Exotic"};
2925

30-
void EMCPhotonCut::SetClusterizer(std::string clusterDefinitionString)
26+
void EMCPhotonCut::SetClusterizer(const std::string& clusterDefinitionString)
3127
{
3228
mDefinition = static_cast<int>(o2::aod::emcalcluster::getClusterDefinitionFromString(clusterDefinitionString));
3329
LOG(info) << "EMCal Photon Cut, set cluster definition to: " << mDefinition << " (" << clusterDefinitionString << ")";

PWGEM/PhotonMeson/Core/EMCPhotonCut.h

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ class EMCPhotonCut
130130
kSecondary,
131131
};
132132

133-
const std::string getName() const { return name; }
134-
const std::string getTitle() const { return title; }
133+
const std::string& getName() const { return name; }
134+
const std::string& getTitle() const { return title; }
135135

136-
static const char* mCutNames[static_cast<int>(EMCPhotonCuts::kNCuts)];
136+
static std::array<std::string, static_cast<std::size_t>(EMCPhotonCut::EMCPhotonCuts::kNCuts)> mCutNames;
137137

138138
static constexpr auto getClusterId(o2::soa::is_iterator auto const& t)
139139
{
@@ -253,7 +253,7 @@ class EMCPhotonCut
253253
void fillBeforeClusterHistogram(o2::soa::is_iterator auto const& cluster, o2::framework::HistogramRegistry* fRegistry = nullptr) const
254254
{
255255

256-
if (mDoQA == false || fRegistry == nullptr) {
256+
if (!mDoQA || fRegistry == nullptr) {
257257
return;
258258
}
259259

@@ -269,7 +269,7 @@ class EMCPhotonCut
269269
void fillAfterClusterHistogram(o2::soa::is_iterator auto const& cluster, o2::framework::HistogramRegistry* fRegistry = nullptr) const
270270
{
271271

272-
if (mDoQA == false || fRegistry == nullptr) {
272+
if (!mDoQA || fRegistry == nullptr) {
273273
return;
274274
}
275275

@@ -421,8 +421,6 @@ class EMCPhotonCut
421421
return mMinTime <= cluster.time() && cluster.time() <= mMaxTime;
422422

423423
case EMCPhotonCuts::kTM:
424-
return false;
425-
426424
case EMCPhotonCuts::kSecondaryTM:
427425
return false;
428426

@@ -593,7 +591,7 @@ class EMCPhotonCut
593591
// Setters
594592
/// \brief Set clusterizer
595593
/// \param clusterDefinitionString name of the clusterizer
596-
void SetClusterizer(std::string clusterDefinitionString = "kV3Default");
594+
void SetClusterizer(const std::string& clusterDefinitionString = "kV3Default");
597595

598596
/// \brief Set minimum cluster energy
599597
/// \param min minimum cluster energy
@@ -639,7 +637,7 @@ class EMCPhotonCut
639637
/// \param c c in a + (pT + b)^c
640638
void SetTrackMatchingEtaParams(float a, float b, float c)
641639
{
642-
mTrackMatchingEtaParams = {a, b, c};
640+
mTrackMatchingEtaParams = {.a = a, .b = b, .c = c};
643641
}
644642

645643
/// \brief Set parameters for track matching delta phi = a + (pT + b)^c
@@ -648,7 +646,7 @@ class EMCPhotonCut
648646
/// \param c c in a + (pT + b)^c
649647
void SetTrackMatchingPhiParams(float a, float b, float c)
650648
{
651-
mTrackMatchingPhiParams = {a, b, c};
649+
mTrackMatchingPhiParams = {.a = a, .b = b, .c = c};
652650
}
653651

654652
/// \brief Set parameters for secondary track matching delta eta = a + (pT + b)^c
@@ -657,7 +655,7 @@ class EMCPhotonCut
657655
/// \param c c in a + (pT + b)^c
658656
void SetSecTrackMatchingEtaParams(float a, float b, float c)
659657
{
660-
mSecTrackMatchingEtaParams = {a, b, c};
658+
mSecTrackMatchingEtaParams = {.a = a, .b = b, .c = c};
661659
}
662660

663661
/// \brief Set parameters for secondary track matching delta phi = a + (pT + b)^c
@@ -666,7 +664,7 @@ class EMCPhotonCut
666664
/// \param c c in a + (pT + b)^c
667665
void SetSecTrackMatchingPhiParams(float a, float b, float c)
668666
{
669-
mSecTrackMatchingPhiParams = {a, b, c};
667+
mSecTrackMatchingPhiParams = {.a = a, .b = b, .c = c};
670668
}
671669

672670
/// \brief calculate delta eta for track matching at given track pT
@@ -721,10 +719,10 @@ class EMCPhotonCut
721719
mutable uint nAccClusterPerColl{0}; ///< running number of accepted cluster per collision used for QA
722720
mutable int currentCollID{-1}; ///< running collision ID of clusters used for QA
723721

724-
TrackMatchingParams mTrackMatchingEtaParams = {-1.f, 0.f, 0.f};
725-
TrackMatchingParams mTrackMatchingPhiParams = {-1.f, 0.f, 0.f};
726-
TrackMatchingParams mSecTrackMatchingEtaParams = {-1.f, 0.f, 0.f};
727-
TrackMatchingParams mSecTrackMatchingPhiParams = {-1.f, 0.f, 0.f};
722+
TrackMatchingParams mTrackMatchingEtaParams = {.a = -1.f, .b = 0.f, .c = 0.f};
723+
TrackMatchingParams mTrackMatchingPhiParams = {.a = -1.f, .b = 0.f, .c = 0.f};
724+
TrackMatchingParams mSecTrackMatchingEtaParams = {.a = -1.f, .b = 0.f, .c = 0.f};
725+
TrackMatchingParams mSecTrackMatchingPhiParams = {.a = -1.f, .b = 0.f, .c = 0.f};
728726
};
729727

730728
#endif // PWGEM_PHOTONMESON_CORE_EMCPHOTONCUT_H_

PWGEM/PhotonMeson/Tasks/emcalQC.cxx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ struct EmcalQC {
9999

100100
struct : ConfigurableGroup {
101101
std::string prefix = "axis_group";
102-
ConfigurableAxis thnConfigAxisE{"thnConfigAxisE", {100, 0., 20.}, "pT axis for photon candidates"};
102+
ConfigurableAxis thnConfigAxisE{"thnConfigAxisE", {100, 0., 20.}, "energy axis for photon candidates"};
103+
ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {100, 0., 20.}, "pT axis for matched tracks"};
103104
} axisGroup;
104105

105106
void defineEMEventCut()
@@ -151,7 +152,8 @@ struct EmcalQC {
151152
defineEMCCut();
152153
defineEMEventCut();
153154

154-
const AxisSpec thnAxisE{axisGroup.thnConfigAxisE, "#it{p}_{T} (GeV/#it{c})"};
155+
const AxisSpec thnAxisE{axisGroup.thnConfigAxisE, "#it{E}} (GeV)"};
156+
const AxisSpec thnAxisPt{axisGroup.thnConfigAxisPt, "#it{p}_{T} (GeV/#it{c})"};
155157
const AxisSpec thAxisdEta{200, -0.06, 0.06, "#Delta#eta"};
156158
const AxisSpec thAxisdPhi{200, -0.06, 0.06, "#Delta#varphi (rad)"};
157159

@@ -171,6 +173,11 @@ struct EmcalQC {
171173
fRegistry.add("Cluster/hDeltaEtaPhiClosestPrimTracks", "#Delta#eta #Delta#varphi distribution of the Closest matched prim. track", HistType::kTH3D, {thAxisdEta, thAxisdPhi, thnAxisE}, false);
172174
fRegistry.add("Cluster/hDeltaEtaPhiAllSecTracks", "#Delta#eta #Delta#varphi distribution of all matched sec. tracks", HistType::kTH3D, {thAxisdEta, thAxisdPhi, thnAxisE}, false);
173175
fRegistry.add("Cluster/hDeltaEtaPhiClosestSecTracks", "#Delta#eta #Delta#varphi distribution of the Closest matched sec. track", HistType::kTH3D, {thAxisdEta, thAxisdPhi, thnAxisE}, false);
176+
177+
fRegistry.add("Cluster/hDeltaEtaPhiAllPrimTracksTrackPt", "#Delta#eta #Delta#varphi distribution of all matched prim. tracks", HistType::kTH3D, {thAxisdEta, thAxisdPhi, thnAxisPt}, false);
178+
fRegistry.add("Cluster/hDeltaEtaPhiClosestPrimTracksTrackPt", "#Delta#eta #Delta#varphi distribution of the Closest matched prim. track", HistType::kTH3D, {thAxisdEta, thAxisdPhi, thnAxisPt}, false);
179+
fRegistry.add("Cluster/hDeltaEtaPhiAllSecTracksTrackPt", "#Delta#eta #Delta#varphi distribution of all matched sec. tracks", HistType::kTH3D, {thAxisdEta, thAxisdPhi, thnAxisPt}, false);
180+
fRegistry.add("Cluster/hDeltaEtaPhiClosestSecTracksTrackPt", "#Delta#eta #Delta#varphi distribution of the Closest matched sec. track", HistType::kTH3D, {thAxisdEta, thAxisdPhi, thnAxisPt}, false);
174181
}
175182
}
176183

@@ -294,16 +301,20 @@ struct EmcalQC {
294301
if (primTracksPerCluster.size() > 0) {
295302
const auto closestPrimTrack = primTracksPerCluster.begin();
296303
fRegistry.fill(HIST("Cluster/hDeltaEtaPhiClosestPrimTracks"), closestPrimTrack.deltaEta(), closestPrimTrack.deltaPhi(), cluster.e());
304+
fRegistry.fill(HIST("Cluster/hDeltaEtaPhiClosestPrimTracksTrackPt"), closestPrimTrack.deltaEta(), closestPrimTrack.deltaPhi(), closestPrimTrack.trackPt());
297305
}
298306
for (const auto& matchedPrimTrack : primTracksPerCluster) {
299307
fRegistry.fill(HIST("Cluster/hDeltaEtaPhiAllPrimTracks"), matchedPrimTrack.deltaEta(), matchedPrimTrack.deltaPhi(), cluster.e());
308+
fRegistry.fill(HIST("Cluster/hDeltaEtaPhiAllPrimTracksTrackPt"), matchedPrimTrack.deltaEta(), matchedPrimTrack.deltaPhi(), matchedPrimTrack.trackPt());
300309
}
301310
if (secTracksPerCluster.size() > 0) {
302311
const auto closestSecTrack = secTracksPerCluster.begin();
303312
fRegistry.fill(HIST("Cluster/hDeltaEtaPhiClosestSecTracks"), closestSecTrack.deltaEta(), closestSecTrack.deltaPhi(), cluster.e());
313+
fRegistry.fill(HIST("Cluster/hDeltaEtaPhiClosestSecTracksTrackPt"), closestSecTrack.deltaEta(), closestSecTrack.deltaPhi(), closestSecTrack.trackPt());
304314
}
305315
for (const auto& matchedSecTrack : secTracksPerCluster) {
306316
fRegistry.fill(HIST("Cluster/hDeltaEtaPhiAllSecTracks"), matchedSecTrack.deltaEta(), matchedSecTrack.deltaPhi(), cluster.e());
317+
fRegistry.fill(HIST("Cluster/hDeltaEtaPhiAllSecTracksTrackPt"), matchedSecTrack.deltaEta(), matchedSecTrack.deltaPhi(), matchedSecTrack.trackPt());
307318
}
308319

309320
if (!fEMCCut.IsSelectedEMCal(EMCPhotonCut::EMCPhotonCuts::kTM, cluster, primTracksPerCluster)) { // Check whether cluster passes this cluster requirement, if not, fill why in the next row

0 commit comments

Comments
 (0)