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

backport from 93X to 71X - for neutral non-detectable exotic - send their daughters to Geant4 #20108

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions SimG4Core/Generators/BuildFile.xml
Expand Up @@ -5,6 +5,7 @@
<use name="FWCore/MessageLogger"/>
<use name="SimDataFormats/GeneratorProducts"/>
<use name="boost"/>
<use name="heppdt"/>
<use name="geant4core"/>
<use name="rootmath"/>
<use name="expat"/>
1 change: 1 addition & 0 deletions SimG4Core/Generators/interface/Generator.h
Expand Up @@ -34,6 +34,7 @@ class Generator

bool particlePassesPrimaryCuts(const G4ThreeVector& p) const;
bool isExotic(HepMC::GenParticle* p) const;
bool isExoticNonDetectable(HepMC::GenParticle* p) const;
void particleAssignDaughters(G4PrimaryParticle * p, HepMC::GenParticle * hp,
double length);
void setGenId(G4PrimaryParticle* p, int id) const
Expand Down
20 changes: 18 additions & 2 deletions SimG4Core/Generators/src/Generator.cc
Expand Up @@ -6,6 +6,8 @@

#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include "HepPDT/ParticleID.hh"

#include "G4Event.hh"

#include "G4HEPEvtParticle.hh"
Expand Down Expand Up @@ -150,7 +152,7 @@ void Generator::HepMC2G4(const HepMC::GenEvent * evt_orig, G4Event * g4evt)
// 2: particles are decayed by generator but need to be propagated by GEANT
// 3: particles are decayed by generator but do not need to be propagated by GEANT
int status = (*pitr)->status();
if (status > 3 && isExotic(*pitr)) {
if (status > 3 && isExotic(*pitr) && (!(isExoticNonDetectable(*pitr)))) {
// In Pythia 8, there are many status codes besides 1, 2, 3.
// By setting the status to 2 for exotic particles, they will be checked:
// if its decay vertex is outside the beampipe, it will be propagated by GEANT.
Expand Down Expand Up @@ -226,7 +228,7 @@ void Generator::HepMC2G4(const HepMC::GenEvent * evt_orig, G4Event * g4evt)
double decay_length = 0.0;
int status = (*pitr)->status();

if (status > 3 && isExotic(*pitr)) {
if (status > 3 && isExotic(*pitr) && (!(isExoticNonDetectable(*pitr))) ) {
status = 2;
}

Expand Down Expand Up @@ -525,6 +527,20 @@ bool Generator::isExotic(HepMC::GenParticle* p) const
return false;
}

bool Generator::isExoticNonDetectable(HepMC::GenParticle* p) const
{
int pdgid = abs(p->pdg_id());
HepPDT::ParticleID pid(p->pdg_id());
int charge = pid.threeCharge();
if ((charge==0) && (pdgid >= 1000000 && pdgid < 1000040)) // SUSY
{
return true;
}

return false;
}



void Generator::nonBeamEvent2G4(const HepMC::GenEvent * evt, G4Event * g4evt)
{
Expand Down