Skip to content
This repository was archived by the owner on May 6, 2024. It is now read-only.

Commit dfff766

Browse files
EinarElentomeichlersmith
authored andcommitted
Prettier formatting for logs
1 parent e9007ef commit dfff766

1 file changed

Lines changed: 19 additions & 16 deletions

File tree

src/SimCore/KaonPhysics.cxx

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ void KaonPhysics::setDecayProperties(
2929
kaon->GetParticleName());
3030
}
3131
if (verbosity > 1) {
32-
ldmx_log(info)
33-
<< "Decay details before setting branching ratios and lifetimes"
34-
<< std::endl;
32+
ldmx_log(info) << "Decay details (" << kaon->GetParticleName()
33+
<< ") before setting branching ratios and lifetimes"
34+
<< std::endl;
35+
DumpDecayDetails(kaon);
3536
}
3637
kaon->SetPDGLifeTime(kaon->GetPDGLifeTime() * lifetime_factor);
3738
if (kaon == G4KaonZeroLong::Definition()) {
@@ -67,9 +68,9 @@ void KaonPhysics::setDecayProperties(
6768
branching_ratios[ChargedKaonDecayChannel::pi0_mu_nu]);
6869
}
6970
if (verbosity > 0) {
70-
ldmx_log(info)
71-
<< "Decay details after setting branching ratios and lifetimes"
72-
<< std::endl;
71+
ldmx_log(info) << "Decay details (" << kaon->GetParticleName()
72+
<< ") after setting branching ratios and lifetimes"
73+
<< std::endl;
7374
DumpDecayDetails(kaon);
7475
}
7576
}
@@ -93,24 +94,26 @@ void KaonPhysics::ConstructParticle() {
9394

9495
void KaonPhysics::DumpDecayDetails(const G4ParticleDefinition* kaon) const {
9596
ldmx_log(info) << "Decay table details for " << kaon->GetParticleName()
96-
<< std::endl
97-
<< std::scientific << std::setprecision(15);
98-
ldmx_log(info) << "PDG Lifetime " << kaon->GetPDGLifeTime() << std::endl;
97+
<< std::scientific << std::setprecision(15)
98+
<< " (PDG Lifetime " << kaon->GetPDGLifeTime() << ")"
99+
<< std::endl;
99100
const auto table{kaon->GetDecayTable()};
100101
const int entries{table->entries()};
101102
for (auto i{0}; i < entries; ++i) {
102103
const auto channel{(*table)[i]};
103-
ldmx_log(info) << "Channel " << i << " Kinematics type "
104-
<< channel->GetKinematicsName() << " with BR "
105-
<< channel->GetBR() << std::endl;
106-
ldmx_log(info) << kaon->GetParticleName() << " -> ";
107104
const auto daughters{channel->GetNumberOfDaughters()};
105+
std::string products{};
106+
// N-1 to avoid extra " + "
108107
for (auto j{0}; j < daughters - 1; ++j) {
109-
ldmx_log(info) << channel->GetDaughter(j)->GetParticleName() << " + ";
108+
products += channel->GetDaughter(j)->GetParticleName();
109+
products += " + ";
110110
}
111111
// Special formatting for last one :)
112-
ldmx_log(info) << channel->GetDaughter(daughters - 1)->GetParticleName()
113-
<< std::endl;
112+
products += channel->GetDaughter(daughters - 1)->GetParticleName();
113+
ldmx_log(info) << "Channel " << i << " (" << kaon->GetParticleName()
114+
<< " -> " << products << ") Kinematics type "
115+
<< channel->GetKinematicsName() << " with BR "
116+
<< channel->GetBR() << std::endl;
114117
}
115118
}
116119

0 commit comments

Comments
 (0)