Skip to content

Commit

Permalink
Merge pull request #40908 from civanch/fix_generator_interface_13_0
Browse files Browse the repository at this point in the history
[13_0_X] Fix generator interface to Geant4
  • Loading branch information
cmsbuild authored Mar 2, 2023
2 parents 7dd1ab1 + d301dd3 commit 14dc136
Showing 1 changed file with 7 additions and 4 deletions.
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

0 comments on commit 14dc136

Please sign in to comment.