Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13_0_X] Fix generator interface to Geant4 #40908

Merged
merged 1 commit into from
Mar 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions SimG4Core/Generators/src/Generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -470,17 +470,20 @@ void Generator::particleAssignDaughters(G4PrimaryParticle *g4p, HepMC::GenPartic
// value of the code compute inside TrackWithHistory
setGenId(g4daught, (*vpdec)->barcode());

if (verbose > 2)
LogDebug("SimG4CoreGenerator") << "Assigning a " << (*vpdec)->pdg_id() << " as daughter of a " << vp->pdg_id();
int status = (*vpdec)->status();
if (verbose > 1)
LogDebug("SimG4CoreGenerator::::particleAssignDaughters")
<< "Assigning a " << (*vpdec)->pdg_id() << " as daughter of a " << vp->pdg_id() << " status=" << status;

if (((*vpdec)->status() == 2 || (*vpdec)->status() > 3) && (*vpdec)->end_vertex() != nullptr) {
if ((status == 2 || (status == 23 && std::abs(vp->pdg_id()) == 1000015) || (status > 50 && status < 100)) &&
(*vpdec)->end_vertex() != nullptr) {
double x2 = (*vpdec)->end_vertex()->position().x();
double y2 = (*vpdec)->end_vertex()->position().y();
double z2 = (*vpdec)->end_vertex()->position().z();
double dd = std::sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2));
particleAssignDaughters(g4daught, *vpdec, dd);
}
(*vpdec)->set_status(1000 + (*vpdec)->status());
(*vpdec)->set_status(1000 + status);
g4p->SetDaughter(g4daught);

if (verbose > 1)
Expand Down