Skip to content

Commit d890ddd

Browse files
committed
reduce diff
1 parent 5648de8 commit d890ddd

6 files changed

Lines changed: 14 additions & 336 deletions

File tree

Examples/Io/Root/include/ActsExamples/Io/Root/RootParticleWriter.hpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,6 @@ class RootParticleWriter final : public WriterT<SimParticleContainer> {
152152
std::vector<std::int32_t> m_numberOfHits;
153153
/// Particle outcome
154154
std::vector<std::uint32_t> m_outcome;
155-
156-
/// Job-wide counters for conditions that would otherwise be logged per
157-
/// particle. Summarised in @c finalize. Protected by @c m_writeMutex.
158-
std::size_t m_nTotal = 0;
159-
std::size_t m_nCharged = 0;
160-
std::size_t m_nNonFinite = 0;
161-
std::size_t m_nZeroCharge = 0;
162-
std::size_t m_nGlobalToLocalFailed = 0;
163-
std::size_t m_nPropagationFailed = 0;
164155
};
165156

166157
} // namespace ActsExamples

Examples/Io/Root/src/RootParticleWriter.cpp

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -111,27 +111,6 @@ ProcessCode RootParticleWriter::finalize() {
111111
ACTS_INFO("Wrote particles to tree '" << m_cfg.treeName << "' in '"
112112
<< m_cfg.filePath << "'");
113113

114-
if (m_nNonFinite > 0) {
115-
ACTS_WARNING(m_nNonFinite << " / " << m_nTotal
116-
<< " particle(s) had non-finite mass or charge");
117-
}
118-
if (m_nZeroCharge > 0) {
119-
ACTS_WARNING(m_nZeroCharge
120-
<< " / " << m_nTotal
121-
<< " zero-charge particle(s) linearly extrapolated to "
122-
"perigee");
123-
}
124-
if (m_nGlobalToLocalFailed > 0) {
125-
ACTS_ERROR(m_nGlobalToLocalFailed
126-
<< " / " << m_nZeroCharge
127-
<< " global-to-local transformation(s) failed");
128-
}
129-
if (m_nPropagationFailed > 0) {
130-
ACTS_ERROR(m_nPropagationFailed
131-
<< " / " << m_nCharged
132-
<< " propagation(s) to perigee surface failed");
133-
}
134-
135114
return ProcessCode::SUCCESS;
136115
}
137116

@@ -142,7 +121,6 @@ ProcessCode RootParticleWriter::writeT(const AlgorithmContext& ctx,
142121

143122
m_eventId = ctx.eventNumber;
144123
for (const auto& particle : particles) {
145-
++m_nTotal;
146124
m_particleHash.push_back(particle.particleId().hash());
147125
m_particleType.push_back(particle.pdg());
148126
m_process.push_back(static_cast<std::uint32_t>(particle.process()));
@@ -158,7 +136,7 @@ ProcessCode RootParticleWriter::writeT(const AlgorithmContext& ctx,
158136

159137
// particle constants
160138
if (!std::isfinite(particle.mass()) || !std::isfinite(particle.charge())) {
161-
++m_nNonFinite;
139+
ACTS_WARNING("Particle mass or charge is not finite, can't write it");
162140
}
163141

164142
m_m.push_back(
@@ -219,7 +197,8 @@ ProcessCode RootParticleWriter::writeT(const AlgorithmContext& ctx,
219197

220198
// Neutral particles have no helix -> linearly extrapolate to perigee
221199
if (particle.charge() == 0) {
222-
++m_nZeroCharge;
200+
ACTS_WARNING(
201+
"Particle has zero charge, linearly extrapolating to perigee");
223202
// Initialize the truth particle info
224203
auto perigeeD0 = NaNfloat;
225204
auto perigeeZ0 = NaNfloat;
@@ -233,7 +212,7 @@ ProcessCode RootParticleWriter::writeT(const AlgorithmContext& ctx,
233212
perigeeD0 = lpResult.value()[Acts::BoundIndices::eBoundLoc0];
234213
perigeeZ0 = lpResult.value()[Acts::BoundIndices::eBoundLoc1];
235214
} else {
236-
++m_nGlobalToLocalFailed;
215+
ACTS_ERROR("Global to local transformation did not succeed.");
237216
}
238217
// truth parameters at perigee are the same as at production vertex
239218
m_perigeePhi.push_back(Acts::clampValue<float>(particle.phi()));
@@ -258,7 +237,6 @@ ProcessCode RootParticleWriter::writeT(const AlgorithmContext& ctx,
258237
continue;
259238
}
260239

261-
++m_nCharged;
262240
// Charged particles: propagate helix to perigee
263241
// Build a propagator and propagate the *truth parameters* to the
264242
// perigee Stepper + propagator
@@ -283,7 +261,7 @@ ProcessCode RootParticleWriter::writeT(const AlgorithmContext& ctx,
283261
// Do the propagation to the perigee surface
284262
auto propRes = propagator->propagate(startParams, *pSurface, pOptions);
285263
if (!propRes.ok() || !propRes->endParameters.has_value()) {
286-
++m_nPropagationFailed;
264+
ACTS_ERROR("Propagation to perigee surface failed.");
287265
m_perigeePhi.push_back(NaNfloat);
288266
m_perigeeTheta.push_back(NaNfloat);
289267
m_perigeeQop.push_back(NaNfloat);

Examples/Scripts/Python/edm4hep_to_parquet.py

Lines changed: 0 additions & 143 deletions
This file was deleted.

Examples/Scripts/Python/hepmc3_merge.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def main():
3232
help="If None, the HepMC3 will read the entire file to determine the number of available events.",
3333
)
3434
parser.add_argument(
35-
"--pileup", "--pu", type=Path, help="Pileup file", required=False
35+
"--pileup", "--pu", type=Path, help="Pileup file", required=True
3636
)
3737
parser.add_argument("--output", "-o", type=Path, help="Output file", required=True)
3838
parser.add_argument("--force", "-f", action="store_true", help="Force overwrite")
@@ -68,7 +68,7 @@ def main():
6868

6969
if not args.hard_scatter.exists():
7070
raise FileNotFoundError(f"Hard scatter file {args.hard_scatter} does not exist")
71-
if args.pileup is not None and not args.pileup.exists():
71+
if not args.pileup.exists():
7272
raise FileNotFoundError(f"Pileup file {args.pileup} does not exist")
7373

7474
extensions = {
@@ -98,13 +98,12 @@ def main():
9898

9999
rng = acts.examples.RandomNumbers(seed=42)
100100
HepMC3Reader = acts.examples.hepmc3.HepMC3Reader
101-
inputs = [HepMC3Reader.Input.Fixed(args.hard_scatter, 1)]
102-
if args.pileup is not None:
103-
inputs.append(HepMC3Reader.Input.Fixed(args.pileup, args.pileup_multiplicity))
104-
105101
s.addReader(
106102
HepMC3Reader(
107-
inputs=inputs,
103+
inputs=[
104+
HepMC3Reader.Input.Fixed(args.hard_scatter, 1),
105+
HepMC3Reader.Input.Fixed(args.pileup, args.pileup_multiplicity),
106+
],
108107
level=acts.logging.INFO,
109108
outputEvent="hepmc3_event",
110109
checkEventNumber=False, # This is not generally guaranteed for arbitrary inputs

Examples/Scripts/Python/propagation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,5 +153,5 @@ def runPropagation(
153153
outputDir=os.getcwd() + "/propagation",
154154
s=None,
155155
decorators=contextDecorators,
156-
sterileLogger=False,
156+
sterileLogger=True,
157157
).run()

0 commit comments

Comments
 (0)