Skip to content

Commit a20f595

Browse files
committed
Initialisation of data members
1 parent a9a7b7e commit a20f595

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

SimDataFormats/CaloAnalysis/interface/CaloParticle.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ class CaloParticle {
169169
void addRecHitAndFraction(uint32_t hit, float fraction) {
170170
hits_.emplace_back(hit);
171171
fractions_.emplace_back(fraction);
172+
++nsimhits_;
172173
}
173174

174175
/** @brief Returns list of rechit IDs and fractions for this CaloParticle */
@@ -187,11 +188,11 @@ class CaloParticle {
187188
void addSimHit(const PCaloHit &hit) { simhit_energy_ += hit.energy(); }
188189

189190
private:
190-
uint64_t nsimhits_;
191+
uint64_t nsimhits_{0};
191192
EncodedEventId event_;
192193

193-
uint32_t particleId_;
194-
float simhit_energy_;
194+
uint32_t particleId_{0};
195+
float simhit_energy_{0.f};
195196
std::vector<uint32_t> hits_;
196197
std::vector<float> fractions_;
197198

SimDataFormats/CaloAnalysis/interface/SimCluster.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ class SimCluster {
175175
void addRecHitAndFraction(uint32_t hit, float fraction) {
176176
hits_.emplace_back(hit);
177177
fractions_.emplace_back(fraction);
178+
++nsimhits_;
178179
}
179180

180181
/** @brief add rechit energy */
@@ -216,11 +217,11 @@ class SimCluster {
216217
void addSimHit(const PCaloHit &hit) { simhit_energy_ += hit.energy(); }
217218

218219
private:
219-
uint64_t nsimhits_;
220+
uint64_t nsimhits_{0};
220221
EncodedEventId event_;
221222

222-
uint32_t particleId_;
223-
float simhit_energy_;
223+
uint32_t particleId_{0};
224+
float simhit_energy_{0.f};
224225
std::vector<uint32_t> hits_;
225226
std::vector<float> fractions_;
226227
std::vector<float> energies_;

0 commit comments

Comments
 (0)