Skip to content

Commit 7ad065f

Browse files
authored
Merge pull request #47197 from 24LopezR/DDM_150X_SimProcModif
Process modifier for displaced SUSY simulation fix
2 parents 087cdad + 629245f commit 7ad065f

File tree

6 files changed

+28
-7
lines changed

6 files changed

+28
-7
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import FWCore.ParameterSet.Config as cms
2+
3+
# Designed to disable a bug affecting long lived slepton decays in HepMC-G4 interface
4+
fixLongLivedSleptonSim = cms.Modifier()

SimG4Core/Application/python/g4SimHits_cfi.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@
285285
MinPhiCut = cms.double(-3.14159265359), ## (radians)
286286
MaxPhiCut = cms.double(3.14159265359), ## according to CMS conventions
287287
ApplyLumiMonitorCuts = cms.bool(False), ## primary for lumi monitors
288-
IsSmuon = cms.bool(False),
288+
IsSlepton = cms.bool(False),
289289
Verbosity = cms.untracked.int32(0),
290290
PDGselection = cms.PSet(
291291
PDGfilterSel = cms.bool(False), ## filter out unwanted particles
@@ -790,3 +790,11 @@
790790
HGCSD = dict(
791791
HitCollection = 2)
792792
)
793+
794+
##
795+
## Fix for long-lived slepton simulation
796+
##
797+
from Configuration.ProcessModifiers.fixLongLivedSleptonSim_cff import fixLongLivedSleptonSim
798+
dd4hep.toModify( g4SimHits,
799+
Generator = dict(IsSlepton = True)
800+
)

SimG4Core/Generators/interface/Generator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Generator {
4545
bool fEtaCuts;
4646
bool fPhiCuts;
4747
bool fFiductialCuts;
48-
bool fSmuon;
48+
bool fSlepton;
4949
double theMinPhiCut;
5050
double theMaxPhiCut;
5151
double theMinEtaCut;

SimG4Core/Generators/interface/Generator3.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class Generator3 {
4545
bool fEtaCuts;
4646
bool fPhiCuts;
4747
bool fFiductialCuts;
48+
bool fSlepton;
4849
double theMinPhiCut;
4950
double theMaxPhiCut;
5051
double theMinEtaCut;

SimG4Core/Generators/src/Generator.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Generator::Generator(const ParameterSet &p)
2525
fPtransCut(p.getParameter<bool>("ApplyPtransCut")),
2626
fEtaCuts(p.getParameter<bool>("ApplyEtaCuts")),
2727
fPhiCuts(p.getParameter<bool>("ApplyPhiCuts")),
28-
fSmuon(p.getParameter<bool>("IsSmuon")),
28+
fSlepton(p.getParameter<bool>("IsSlepton")),
2929
theMinPhiCut(p.getParameter<double>("MinPhiCut")), // in radians (CMS standard)
3030
theMaxPhiCut(p.getParameter<double>("MaxPhiCut")),
3131
theMinEtaCut(p.getParameter<double>("MinEtaCut")),
@@ -366,7 +366,7 @@ void Generator::HepMC2G4(const HepMC::GenEvent *evt_orig, G4Event *g4evt) {
366366
// Decay chain outside the fiducial cylinder defined by theRDecLenCut
367367
// are used for Geant4 tracking with predefined decay channel
368368
// In the case of decay in vacuum particle is not tracked by Geant4
369-
} else if (2 == status && x2 * x2 + y2 * y2 >= theDecRCut2 && (fSmuon || std::abs(z2) < Z_hector)) {
369+
} else if (2 == status && x2 * x2 + y2 * y2 >= theDecRCut2 && (fSlepton || std::abs(z2) < Z_hector)) {
370370
toBeAdded = true;
371371
if (verbose > 1)
372372
edm::LogVerbatim("SimG4CoreGenerator") << "GenParticle barcode = " << (*pitr)->barcode() << " passed case 2"
@@ -478,7 +478,7 @@ void Generator::particleAssignDaughters(G4PrimaryParticle *g4p, HepMC::GenPartic
478478
<< "Assigning a " << (*vpdec)->pdg_id() << " as daughter of a " << vp->pdg_id() << " status=" << status;
479479

480480
bool isInList;
481-
if (fSmuon) {
481+
if (fSlepton) {
482482
std::vector<int> fParticleList = {1000011, 1000013, 1000015, 2000011, 2000013, 2000015};
483483
isInList = (std::find(fParticleList.begin(), fParticleList.end(), std::abs(vp->pdg_id())) != fParticleList.end());
484484
} else {

SimG4Core/Generators/src/Generator3.cc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Generator3::Generator3(const ParameterSet &p)
2727
fPtransCut(p.getParameter<bool>("ApplyPtransCut")),
2828
fEtaCuts(p.getParameter<bool>("ApplyEtaCuts")),
2929
fPhiCuts(p.getParameter<bool>("ApplyPhiCuts")),
30+
fSlepton(p.getParameter<bool>("IsSlepton")),
3031
theMinPhiCut(p.getParameter<double>("MinPhiCut")), // in radians (CMS standard)
3132
theMaxPhiCut(p.getParameter<double>("MaxPhiCut")),
3233
theMinEtaCut(p.getParameter<double>("MinEtaCut")),
@@ -367,7 +368,7 @@ void Generator3::HepMC2G4(const HepMC3::GenEvent *evt_orig, G4Event *g4evt) {
367368
// Decay chain outside the fiducial cylinder defined by theRDecLenCut
368369
// are used for Geant4 tracking with predefined decay channel
369370
// In the case of decay in vacuum particle is not tracked by Geant4
370-
} else if (2 == status && x2 * x2 + y2 * y2 >= theDecRCut2 && std::abs(z2) < Z_hector) {
371+
} else if (2 == status && x2 * x2 + y2 * y2 >= theDecRCut2 && (fSlepton || std::abs(z2) < Z_hector)) {
371372
toBeAdded = true;
372373
if (verbose > 1)
373374
edm::LogVerbatim("SimG4CoreGenerator3") << "GenParticle barcode = " << pitr->id() << " passed case 2"
@@ -477,7 +478,14 @@ void Generator3::particleAssignDaughters(G4PrimaryParticle *g4p, HepMC3::GenPart
477478
LogDebug("SimG4CoreGenerator3::::particleAssignDaughters")
478479
<< "Assigning a " << vpdec->pid() << " as daughter of a " << vp->pid() << " status=" << status;
479480

480-
if ((status == 2 || (status == 23 && std::abs(vp->pid()) == 1000015) || (status > 50 && status < 100)) &&
481+
bool isInList;
482+
if (fSlepton) {
483+
std::vector<int> fParticleList = {1000011, 1000013, 1000015, 2000011, 2000013, 2000015};
484+
isInList = (std::find(fParticleList.begin(), fParticleList.end(), std::abs(vp->pdg_id())) != fParticleList.end());
485+
} else {
486+
isInList = std::abs(vp->pdg_id()) == 1000015;
487+
}
488+
if ((status == 2 || (status == 23 && isInList) || (status > 50 && status < 100)) &&
481489
vpdec->end_vertex() != nullptr) {
482490
double x2 = vpdec->end_vertex()->position().x();
483491
double y2 = vpdec->end_vertex()->position().y();

0 commit comments

Comments
 (0)