@@ -25,6 +25,7 @@ Generator::Generator(const ParameterSet &p)
25
25
fPtransCut(p.getParameter<bool >(" ApplyPtransCut" )),
26
26
fEtaCuts(p.getParameter<bool >(" ApplyEtaCuts" )),
27
27
fPhiCuts(p.getParameter<bool >(" ApplyPhiCuts" )),
28
+ fSmuon(p.getParameter<bool >(" IsSmuon" )),
28
29
theMinPhiCut(p.getParameter<double >(" MinPhiCut" )), // in radians (CMS standard)
29
30
theMaxPhiCut(p.getParameter<double >(" MaxPhiCut" )),
30
31
theMinEtaCut(p.getParameter<double >(" MinEtaCut" )),
@@ -365,7 +366,7 @@ void Generator::HepMC2G4(const HepMC::GenEvent *evt_orig, G4Event *g4evt) {
365
366
// Decay chain outside the fiducial cylinder defined by theRDecLenCut
366
367
// are used for Geant4 tracking with predefined decay channel
367
368
// In the case of decay in vacuum particle is not tracked by Geant4
368
- } else if (2 == status && x2 * x2 + y2 * y2 >= theDecRCut2 && std::abs (z2) < Z_hector) {
369
+ } else if (2 == status && x2 * x2 + y2 * y2 >= theDecRCut2 && ( fSmuon || std::abs (z2) < Z_hector) ) {
369
370
toBeAdded = true ;
370
371
if (verbose > 1 )
371
372
edm::LogVerbatim (" SimG4CoreGenerator" ) << " GenParticle barcode = " << (*pitr)->barcode () << " passed case 2"
@@ -476,7 +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
- if ((status == 2 || (status == 23 && std::abs (vp->pdg_id ()) == 1000015 ) || (status > 50 && status < 100 )) &&
480
+ bool isInList;
481
+ if (fSmuon ) {
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
+ if ((status == 2 || (status == 23 && isInList) || (status > 50 && status < 100 )) &&
480
488
(*vpdec)->end_vertex () != nullptr ) {
481
489
double x2 = (*vpdec)->end_vertex ()->position ().x ();
482
490
double y2 = (*vpdec)->end_vertex ()->position ().y ();
0 commit comments