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

bsunanda:Run2-alca37 Fix bug to avoid run-time error for Pythia8 #13720

Merged
merged 1 commit into from
Mar 15, 2016
Merged
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
14 changes: 8 additions & 6 deletions GeneratorInterface/GenFilters/src/PythiaFilterIsolatedTrack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,26 +105,28 @@ bool PythiaFilterIsolatedTrack::filter(edm::Event& iEvent, edm::EventSetup const
std::vector<const HepMC::GenParticle *> seeds;

// fill the vector of charged particles and seeds in the event
for(HepMC::GenEvent::particle_const_iterator iter=myGenEvent->particles_begin(); iter!=myGenEvent->particles_end(); ++iter) {
for (HepMC::GenEvent::particle_const_iterator iter=myGenEvent->particles_begin(); iter!=myGenEvent->particles_end(); ++iter) {
const HepMC::GenParticle *p=*iter;
if (!(pdt->particle(p->pdg_id()))) continue;
int charge3 = pdt->particle(p->pdg_id())->ID().threeCharge();
int status = p->status();
double momentum = p->momentum().rho();
double abseta = fabs(p->momentum().eta());

// only consider stable, charged particles
if(abs(charge3)==3 && status==1 && momentum>MinIsolTrackMom_ && abseta<MaxSeedEta_+0.5) {
if (abs(charge3)==3 && status==1 && momentum>MinIsolTrackMom_ && abseta<MaxSeedEta_+0.5) {
chargedParticles.push_back(p);
if(momentum>MinSeedMom_ && abseta<MaxSeedEta_) {
if (momentum>MinSeedMom_ && abseta<MaxSeedEta_) {
seeds.push_back(p);
}
}
}

// loop over all the seeds and see if any of them are isolated
unsigned int ntrk(0);
for(std::vector<const HepMC::GenParticle *>::const_iterator it1=seeds.begin(); it1!=seeds.end(); ++it1) {
for (std::vector<const HepMC::GenParticle *>::const_iterator it1=seeds.begin(); it1!=seeds.end(); ++it1) {
const HepMC::GenParticle *p1=*it1;
if (!(pdt->particle(p1->pdg_id()))) continue;
if (p1->pdg_id() < -100 || p1->pdg_id() > 100 || (!onlyHadrons_)) { // Select hadrons only
std::pair<double,double> EtaPhi1=GetEtaPhiAtEcal(p1->momentum().eta(),
p1->momentum().phi(),
Expand All @@ -134,7 +136,7 @@ bool PythiaFilterIsolatedTrack::filter(edm::Event& iEvent, edm::EventSetup const

// loop over all of the other charged particles in the event, and see if any are close by
bool failsIso=false;
for(std::vector<const HepMC::GenParticle *>::const_iterator it2=chargedParticles.begin(); it2!=chargedParticles.end(); ++it2) {
for (std::vector<const HepMC::GenParticle *>::const_iterator it2=chargedParticles.begin(); it2!=chargedParticles.end(); ++it2) {
const HepMC::GenParticle *p2=*it2;

// don't consider the seed particle among the other charge particles
Expand All @@ -149,7 +151,7 @@ bool PythiaFilterIsolatedTrack::filter(edm::Event& iEvent, edm::EventSetup const
// find out how far apart the particles are
// if the seed fails the isolation requirement, try a different seed
// occasionally allow a seed to pass to isolation requirement
if(getDistInCM(EtaPhi1.first, EtaPhi1.second, EtaPhi2.first, EtaPhi2.second) < IsolCone_) {
if (getDistInCM(EtaPhi1.first, EtaPhi1.second, EtaPhi2.first, EtaPhi2.second) < IsolCone_) {
failsIso=true;
break;
}
Expand Down