Skip to content

Commit da9f060

Browse files
authored
Merge pull request #47484 from 24LopezR/DDM_124X_FixDisplacedSUSYSim
[124X] Fix for long-lived slepton simulation
2 parents 71f41a6 + a79604b commit da9f060

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed
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()

Diff for: SimG4Core/Application/python/g4SimHits_cfi.py

+9
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@
257257
ApplyLumiMonitorCuts = cms.bool(False), ## primary for lumi monitors
258258
Verbosity = cms.untracked.int32(0),
259259
FixG4Primary = cms.bool(False),
260+
IsSlepton = cms.bool(False),
260261
PDGselection = cms.PSet(
261262
PDGfilterSel = cms.bool(False), ## filter out unwanted particles
262263
PDGfilter = cms.vint32(21,1,2,3,4,5,6) ## list of unwanted particles (gluons and quarks)
@@ -694,3 +695,11 @@
694695
hgcaltb.toModify(g4SimHits,
695696
OnlySDs = ['AHcalSensitiveDetector', 'HGCSensitiveDetector', 'HGCalTB1601SensitiveDetector', 'HcalTB06BeamDetector']
696697
)
698+
699+
##
700+
## Fix for long-lived slepton simulation
701+
##
702+
from Configuration.ProcessModifiers.fixLongLivedSleptonSim_cff import fixLongLivedSleptonSim
703+
fixLongLivedSleptonSim.toModify( g4SimHits,
704+
Generator = dict(IsSlepton = True)
705+
)

Diff for: SimG4Core/Generators/interface/Generator.h

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class Generator {
4646
bool fPhiCuts;
4747
bool fFixG4Primary;
4848
bool fFiductialCuts;
49+
bool fSlepton;
4950
double theMinPhiCut;
5051
double theMaxPhiCut;
5152
double theMinEtaCut;

Diff for: SimG4Core/Generators/src/Generator.cc

+10-4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Generator::Generator(const ParameterSet &p)
2626
fEtaCuts(p.getParameter<bool>("ApplyEtaCuts")),
2727
fPhiCuts(p.getParameter<bool>("ApplyPhiCuts")),
2828
fFixG4Primary(p.getParameter<bool>("FixG4Primary")),
29+
fSlepton(p.getParameter<bool>("IsSlepton")),
2930
theMinPhiCut(p.getParameter<double>("MinPhiCut")), // in radians (CMS standard)
3031
theMaxPhiCut(p.getParameter<double>("MaxPhiCut")),
3132
theMinEtaCut(p.getParameter<double>("MinEtaCut")),
@@ -366,7 +367,7 @@ void Generator::HepMC2G4(const HepMC::GenEvent *evt_orig, G4Event *g4evt) {
366367
// Decay chain outside the fiducial cylinder defined by theRDecLenCut
367368
// are used for Geant4 tracking with predefined decay channel
368369
// In the case of decay in vacuum particle is not tracked by Geant4
369-
} else if (2 == status && x2 * x2 + y2 * y2 >= theDecRCut2 && std::abs(z2) < Z_hector) {
370+
} else if (2 == status && x2 * x2 + y2 * y2 >= theDecRCut2 && (fSlepton || std::abs(z2) < Z_hector)) {
370371
toBeAdded = true;
371372
if (verbose > 1)
372373
edm::LogVerbatim("SimG4CoreGenerator") << "GenParticle barcode = " << (*pitr)->barcode() << " passed case 2"
@@ -476,9 +477,14 @@ void Generator::particleAssignDaughters(G4PrimaryParticle *g4p, HepMC::GenPartic
476477
LogDebug("SimG4CoreGenerator::particleAssignDaughters")
477478
<< "Assigning a " << (*vpdec)->pdg_id() << " as daughter of a " << vp->pdg_id() << " status=" << status;
478479

479-
bool checkStatus = fFixG4Primary
480-
? ((status == 23 && std::abs(vp->pdg_id()) == 1000015) || (status > 50 && status < 100))
481-
: status > 3;
480+
bool isInList;
481+
if (fSlepton) {
482+
std::vector<int> fParticleList = {1000011, 1000013, 1000015, 2000011, 2000013, 2000015};
483+
isInList = (std::find(fParticleList.begin(), fParticleList.end(), std::abs(vp->pdg_id())) != fParticleList.end());
484+
} else {
485+
isInList = std::abs(vp->pdg_id()) == 1000015;
486+
}
487+
bool checkStatus = fFixG4Primary ? ((status == 23 && isInList) || (status > 50 && status < 100)) : status > 3;
482488

483489
if ((status == 2 || checkStatus) && (*vpdec)->end_vertex() != nullptr) {
484490
double x2 = (*vpdec)->end_vertex()->position().x();

0 commit comments

Comments
 (0)