@@ -26,6 +26,7 @@ Generator::Generator(const ParameterSet &p)
26
26
fEtaCuts(p.getParameter<bool >(" ApplyEtaCuts" )),
27
27
fPhiCuts(p.getParameter<bool >(" ApplyPhiCuts" )),
28
28
fFixG4Primary(p.getParameter<bool >(" FixG4Primary" )),
29
+ fSlepton(p.getParameter<bool >(" IsSlepton" )),
29
30
theMinPhiCut(p.getParameter<double >(" MinPhiCut" )), // in radians (CMS standard)
30
31
theMaxPhiCut(p.getParameter<double >(" MaxPhiCut" )),
31
32
theMinEtaCut(p.getParameter<double >(" MinEtaCut" )),
@@ -366,7 +367,7 @@ void Generator::HepMC2G4(const HepMC::GenEvent *evt_orig, G4Event *g4evt) {
366
367
// Decay chain outside the fiducial cylinder defined by theRDecLenCut
367
368
// are used for Geant4 tracking with predefined decay channel
368
369
// 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) ) {
370
371
toBeAdded = true ;
371
372
if (verbose > 1 )
372
373
edm::LogVerbatim (" SimG4CoreGenerator" ) << " GenParticle barcode = " << (*pitr)->barcode () << " passed case 2"
@@ -476,9 +477,14 @@ void Generator::particleAssignDaughters(G4PrimaryParticle *g4p, HepMC::GenPartic
476
477
LogDebug (" SimG4CoreGenerator::particleAssignDaughters" )
477
478
<< " Assigning a " << (*vpdec)->pdg_id () << " as daughter of a " << vp->pdg_id () << " status=" << status;
478
479
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 ;
482
488
483
489
if ((status == 2 || checkStatus) && (*vpdec)->end_vertex () != nullptr ) {
484
490
double x2 = (*vpdec)->end_vertex ()->position ().x ();
0 commit comments