Skip to content

Commit 0fafb40

Browse files
authored
Merge branch 'main' into FEMCupdate20250501
2 parents 3249c9d + 7f33b79 commit 0fafb40

File tree

7 files changed

+31
-16
lines changed

7 files changed

+31
-16
lines changed

src/algorithms/calorimetry/CalorimeterHitDigi.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,10 @@ void CalorimeterHitDigi::process(const CalorimeterHitDigi::Input& input,
248248
0LL);
249249
}
250250

251-
if (edep > 1.e-3)
251+
if (edep > 1.e-3) {
252252
trace("E sim {} \t adc: {} \t time: {}\t maxtime: {} \t tdc: {} \t corrMeanScale: {}", edep,
253253
adc, time, m_cfg.capTime, tdc, corrMeanScale_value);
254+
}
254255

255256
rawhit.setCellID(leading_hit.getCellID());
256257
rawhit.setAmplitude(adc > m_cfg.capADC ? m_cfg.capADC : adc);

src/algorithms/calorimetry/ImagingClusterReco.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,9 @@ ImagingClusterReco::get_primary(const edm4hep::CaloHitContribution& contrib) con
319319
// can be improved!!
320320
edm4hep::MCParticle primary = contributor;
321321
while (primary.parents_size() > 0) {
322-
if (primary.getGeneratorStatus() != 0)
322+
if (primary.getGeneratorStatus() != 0) {
323323
break;
324+
}
324325
primary = primary.getParents(0);
325326
}
326327
return primary;

src/algorithms/calorimetry/SimCalorimeterHitProcessor.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ edm4hep::MCParticle lookup_primary(const edm4hep::CaloHitContribution& contrib)
7777

7878
edm4hep::MCParticle primary = contributor;
7979
while (primary.parents_size() > 0) {
80-
if (primary.getGeneratorStatus() != 0)
80+
if (primary.getGeneratorStatus() != 0) {
8181
break;
82+
}
8283
primary = primary.getParents(0);
8384
}
8485
return primary;

src/algorithms/digi/SiliconPulseDiscretization.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,11 @@ void SiliconPulseDiscretization::process(const SiliconPulseDiscretization::Input
9393
outPulse.setTime(startTime);
9494

9595
// stop at the next cycle
96+
// NOLINTNEXTLINE(clang-analyzer-security.FloatLoopCounter, security.FloatLoopCounter)
9697
for (double currTime = startTime; currTime < startTime + m_cfg.EICROC_period;
97-
currTime += m_cfg.local_period)
98+
currTime += m_cfg.local_period) {
9899
outPulse.addToAdcCounts(this->_interpolateOrZero(graph, currTime, tMin, tMax));
100+
}
99101
}
100102
}
101103
} // SiliconPulseDiscretization:process

src/algorithms/tracking/LGADHitClustering.cc

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,11 @@ void LGADHitClustering::_calcCluster(const Output& output,
8787
}
8888
// weigh all hits by ADC value
8989
auto pos = m_seg->position(hit.getCellID());
90-
if (hit.getEdep() < 0)
90+
if (hit.getEdep() < 0) {
9191
error("Edep for hit at cellID{} is negative. Please check the accuracy of your energy "
9292
"calibration. ",
9393
hit.getCellID());
94+
}
9495
const auto Edep = hit.getEdep();
9596
ave_x += Edep * pos.x();
9697
ave_y += Edep * pos.y();
@@ -129,8 +130,9 @@ void LGADHitClustering::_calcCluster(const Output& output,
129130
cov(1, 1) = sigma2_y;
130131
cov(0, 1) = cov(1, 0) = 0.0;
131132

132-
for (const auto& w : weights)
133+
for (const auto& w : weights) {
133134
cluster.addToWeights(w);
135+
}
134136

135137
edm4eic::Cov3f covariance;
136138
edm4hep::Vector2f locPos{static_cast<float>(ave_x / mm), static_cast<float>(ave_y / mm)};
@@ -139,8 +141,9 @@ void LGADHitClustering::_calcCluster(const Output& output,
139141
auto volID = context->identifier;
140142
const auto& surfaceMap = m_acts_context->surfaceMap();
141143
const auto is = surfaceMap.find(volID);
142-
if (is == surfaceMap.end())
144+
if (is == surfaceMap.end()) {
143145
error("vol_id ({}) not found in m_surfaces.", volID);
146+
}
144147

145148
const Acts::Surface* surface = is->second;
146149

@@ -178,22 +181,25 @@ void LGADHitClustering::process(const LGADHitClustering::Input& input,
178181
for (const auto& neighborCandidates : cellNeighbors) {
179182
auto it = hitIDsByCells.find(neighborCandidates);
180183
if (it != hitIDsByCells.end()) {
181-
for (const auto& hitID1 : hitIDs)
184+
for (const auto& hitID1 : hitIDs) {
182185
for (const auto& hitID2 : it->second) {
183186
const auto& hit1 = calibrated_hits->at(hitID1);
184187
const auto& hit2 = calibrated_hits->at(hitID2);
185188
// only consider hits with time difference < deltaT as the same cluster
186-
if (std::fabs(hit1.getTime() - hit2.getTime()) < m_cfg.deltaT)
189+
if (std::fabs(hit1.getTime() - hit2.getTime()) < m_cfg.deltaT) {
187190
uf.merge(hitID1, hitID2);
191+
}
188192
}
193+
}
189194
}
190195
}
191196
}
192197

193198
// group hits by cluster parent index according to union find algorithm
194199
std::unordered_map<int, std::vector<edm4eic::TrackerHit>> clusters;
195-
for (size_t hitID = 0; hitID < calibrated_hits->size(); ++hitID)
200+
for (size_t hitID = 0; hitID < calibrated_hits->size(); ++hitID) {
196201
clusters[uf.find(hitID)].push_back(calibrated_hits->at(hitID));
202+
}
197203

198204
// calculated weighted averages
199205
for (auto& [_, cluster] : clusters) {
@@ -227,13 +233,15 @@ LGADHitClustering::getLocalSegmentation(const dd4hep::rec::CellID& cellID) const
227233
}
228234

229235
LGADHitClustering::UnionFind::UnionFind(int n) : mParent(n, 0), mRank(n, 0) {
230-
for (int i = 0; i < n; ++i)
236+
for (int i = 0; i < n; ++i) {
231237
mParent[i] = i;
238+
}
232239
}
233240

234241
int LGADHitClustering::UnionFind::find(int id) {
235-
if (mParent[id] == id)
242+
if (mParent[id] == id) {
236243
return id;
244+
}
237245
return mParent[id] = find(mParent[id]); // path compression
238246
}
239247

@@ -242,11 +250,11 @@ void LGADHitClustering::UnionFind::merge(int id1, int id2) {
242250
auto root2 = find(id2);
243251

244252
if (root1 != root2) {
245-
if (mRank[root1] > mRank[root2])
253+
if (mRank[root1] > mRank[root2]) {
246254
mParent[root2] = root1;
247-
else if (mRank[root1] < mRank[root2])
255+
} else if (mRank[root1] < mRank[root2]) {
248256
mParent[root1] = root2;
249-
else {
257+
} else {
250258
mParent[root1] = root2;
251259
mRank[root2]++;
252260
}

src/services/io/podio/JEventProcessorPODIO.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ void JEventProcessorPODIO::FindCollectionsToWrite(const std::shared_ptr<const JE
447447
for (const std::string& col : all_collections) {
448448
if (m_output_exclude_collections.find(col) == m_output_exclude_collections.end()) {
449449
m_collections_to_write.push_back(col);
450-
m_log->info("Persisting collection '{}'", col);
450+
m_log->debug("Persisting collection '{}'", col);
451451
}
452452
}
453453
} else {

src/services/io/podio/JEventSourcePODIO.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ template <> struct fmt::formatter<podio::version::Version> : ostream_formatter {
4848
/// \param collection_name name of the collection which will be used as the factory tag for these objects
4949
//------------------------------------------------------------------------------
5050
struct InsertingVisitor {
51+
// NOLINTBEGIN(cppcoreguidelines-avoid-const-or-ref-data-members): Lifetime of referenced objects is guaranteed beyond visitor lifetime in this pattern
5152
JEvent& m_event;
5253
const std::string& m_collection_name;
54+
// NOLINTEND(cppcoreguidelines-avoid-const-or-ref-data-members)
5355

5456
InsertingVisitor(JEvent& event, const std::string& collection_name)
5557
: m_event(event), m_collection_name(collection_name) {};

0 commit comments

Comments
 (0)