From a20f5958d5889208a7e6341d7d136e0b70125be6 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Fri, 3 Dec 2021 11:59:48 +0100 Subject: [PATCH] Initialisation of data members --- SimDataFormats/CaloAnalysis/interface/CaloParticle.h | 7 ++++--- SimDataFormats/CaloAnalysis/interface/SimCluster.h | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/SimDataFormats/CaloAnalysis/interface/CaloParticle.h b/SimDataFormats/CaloAnalysis/interface/CaloParticle.h index 2549634143279..4946351601de1 100644 --- a/SimDataFormats/CaloAnalysis/interface/CaloParticle.h +++ b/SimDataFormats/CaloAnalysis/interface/CaloParticle.h @@ -169,6 +169,7 @@ class CaloParticle { void addRecHitAndFraction(uint32_t hit, float fraction) { hits_.emplace_back(hit); fractions_.emplace_back(fraction); + ++nsimhits_; } /** @brief Returns list of rechit IDs and fractions for this CaloParticle */ @@ -187,11 +188,11 @@ class CaloParticle { void addSimHit(const PCaloHit &hit) { simhit_energy_ += hit.energy(); } private: - uint64_t nsimhits_; + uint64_t nsimhits_{0}; EncodedEventId event_; - uint32_t particleId_; - float simhit_energy_; + uint32_t particleId_{0}; + float simhit_energy_{0.f}; std::vector hits_; std::vector fractions_; diff --git a/SimDataFormats/CaloAnalysis/interface/SimCluster.h b/SimDataFormats/CaloAnalysis/interface/SimCluster.h index 30b75545cc0dd..c9bc57edbc5a3 100644 --- a/SimDataFormats/CaloAnalysis/interface/SimCluster.h +++ b/SimDataFormats/CaloAnalysis/interface/SimCluster.h @@ -175,6 +175,7 @@ class SimCluster { void addRecHitAndFraction(uint32_t hit, float fraction) { hits_.emplace_back(hit); fractions_.emplace_back(fraction); + ++nsimhits_; } /** @brief add rechit energy */ @@ -216,11 +217,11 @@ class SimCluster { void addSimHit(const PCaloHit &hit) { simhit_energy_ += hit.energy(); } private: - uint64_t nsimhits_; + uint64_t nsimhits_{0}; EncodedEventId event_; - uint32_t particleId_; - float simhit_energy_; + uint32_t particleId_{0}; + float simhit_energy_{0.f}; std::vector hits_; std::vector fractions_; std::vector energies_;