Skip to content

Commit

Permalink
Use std::abs and call the boost function only for particles that pass…
Browse files Browse the repository at this point in the history
… the pt and status requirements
  • Loading branch information
stahlleiton committed May 5, 2017
1 parent 28286f1 commit ff3f79e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 25 deletions.
16 changes: 10 additions & 6 deletions GeneratorInterface/GenFilters/src/MCSingleParticleFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ betaBoost(iConfig.getUntrackedParameter("BetaBoost",0.))
}

// check if beta is smaller than 1
if (abs(betaBoost) >= 1 ){
if (std::abs(betaBoost) >= 1 ){
edm::LogError("MCSingleParticleFilter") << "Input beta boost is >= 1 !";
}

Expand Down Expand Up @@ -99,11 +99,15 @@ bool MCSingleParticleFilter::filter(edm::Event& iEvent, const edm::EventSetup& i
for (unsigned int i = 0; i < particleID.size(); i++){
if (particleID[i] == (*p)->pdg_id() || particleID[i] == 0) {

HepMC::FourVector mom = zboost((*p)->momentum());
if ( mom.perp() > ptMin[i] && mom.eta() > etaMin[i]
&& mom.eta() < etaMax[i] && ((*p)->status() == status[i] || status[i] == 0)) {
accepted = true;
}
if ( (*p)->momentum().perp() > ptMin[i]
&& ((*p)->status() == status[i] || status[i] == 0)) {

HepMC::FourVector mom = zboost((*p)->momentum());
if ( mom.eta() > etaMin[i] && mom.eta() < etaMax[i] ) {
accepted = true;
}

}

}
}
Expand Down
42 changes: 23 additions & 19 deletions GeneratorInterface/GenFilters/src/MCSmartSingleParticleFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ betaBoost(iConfig.getUntrackedParameter("BetaBoost",0.))
}

// check if beta is smaller than 1
if (abs(betaBoost) >= 1 ){
if (std::abs(betaBoost) >= 1 ){
edm::LogError("MCSmartSingleParticleFilter") << "Input beta boost is >= 1 !";
}

Expand Down Expand Up @@ -154,26 +154,30 @@ bool MCSmartSingleParticleFilter::filter(edm::Event& iEvent, const edm::EventSet

for (unsigned int i = 0; i < particleID.size(); i++){
if (particleID[i] == (*p)->pdg_id() || particleID[i] == 0) {

HepMC::FourVector mom = zboost((*p)->momentum());
if ( mom.rho() > pMin[i] && mom.perp() > ptMin[i]
&& mom.eta() > etaMin[i] && mom.eta() < etaMax[i]
&& ((*p)->status() == status[i] || status[i] == 0)) {

if (!((*p)->production_vertex())) continue;
if ( (*p)->momentum().perp() > ptMin[i]
&& ((*p)->status() == status[i] || status[i] == 0)) {

HepMC::FourVector mom = zboost((*p)->momentum());
if ( mom.rho() > pMin[i]
&& mom.eta() > etaMin[i] && mom.eta() < etaMax[i]) {

if (!((*p)->production_vertex())) continue;

double decx = (*p)->production_vertex()->position().x();
double decy = (*p)->production_vertex()->position().y();
double decrad = sqrt(decx*decx+decy*decy);
if (decrad<decayRadiusMin[i] ) continue;
if (decrad>decayRadiusMax[i] ) continue;

double decz = (*p)->production_vertex()->position().z();
if (decz<decayZMin[i] ) continue;
if (decz>decayZMax[i] ) continue;

accepted = true;
}
double decx = (*p)->production_vertex()->position().x();
double decy = (*p)->production_vertex()->position().y();
double decrad = sqrt(decx*decx+decy*decy);
if (decrad<decayRadiusMin[i] ) continue;
if (decrad>decayRadiusMax[i] ) continue;

double decz = (*p)->production_vertex()->position().z();
if (decz<decayZMin[i] ) continue;
if (decz>decayZMax[i] ) continue;

accepted = true;
}

}

}
}
Expand Down

0 comments on commit ff3f79e

Please sign in to comment.