Skip to content

Commit

Permalink
apply code-format
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-pitt committed Nov 16, 2022
1 parent 5e4a18f commit d57dd95
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class TaggedProtonHepMCFilter : public BaseHepMCFilter {
private:
const int proton_PDGID_ = 2212;
const int neutron_PDGID_ = 2112;
const float OneOverbeamEnergy_ = 1./6500;
const float OneOverbeamEnergy_ = 1.0 / 6500.0;
double xiMin_ = 0.02;
double xiMax_ = 0.2;
int nProtons_ = 2;
Expand Down
4 changes: 2 additions & 2 deletions GeneratorInterface/Core/src/HepMCFilterDriver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ HepMCFilterDriver::HepMCFilterDriver(const edm::ParameterSet& pset)
filter_ = new PartonShowerBsHepMCFilter(filterParameters);
} else if (filterName == "PartonShowerCsHepMCFilter") {
filter_ = new PartonShowerCsHepMCFilter(filterParameters);
} else if (filterName=="TaggedProtonHepMCFilter") {
filter_ = new TaggedProtonHepMCFilter(filterParameters);
} else if (filterName == "TaggedProtonHepMCFilter") {
filter_ = new TaggedProtonHepMCFilter(filterParameters);
} else if (filterName == "EmbeddingHepMCFilter") {
filter_ = new EmbeddingHepMCFilter(filterParameters);
} else if (filterName == "PythiaHepMCFilterGammaGamma") {
Expand Down
22 changes: 9 additions & 13 deletions GeneratorInterface/Core/src/TaggedProtonHepMCFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,22 @@

TaggedProtonHepMCFilter::TaggedProtonHepMCFilter(const edm::ParameterSet &iConfig)
: xiMin_(iConfig.getParameter<double>("xiMin")),
xiMax_(iConfig.getParameter<double>("xiMax")),
nProtons_(iConfig.getParameter<int>("nProtons"))
{
}
xiMax_(iConfig.getParameter<double>("xiMax")),
nProtons_(iConfig.getParameter<int>("nProtons")) {}

TaggedProtonHepMCFilter::~TaggedProtonHepMCFilter() {}

bool TaggedProtonHepMCFilter::filter(const HepMC::GenEvent *evt) {

// Going through the particle list, and count good protons
int nGoodProtons = 0;
for (HepMC::GenEvent::particle_const_iterator particle = evt->particles_begin();
particle != evt->particles_end(); ++particle) {

for (HepMC::GenEvent::particle_const_iterator particle = evt->particles_begin(); particle != evt->particles_end();
++particle) {
if ((*particle)->pdg_id() == proton_PDGID_ && 1 == (*particle)->status()) {
HepMC::FourVector p4 = (*particle)->momentum();
double xi = (1.0 - std::abs(p4.pz())*OneOverbeamEnergy_);
if ( xi>xiMin_ && xi < xiMax_) nGoodProtons++;
HepMC::FourVector p4 = (*particle)->momentum();
double xi = (1.0 - std::abs(p4.pz()) * OneOverbeamEnergy_);
if (xi > xiMin_ && xi < xiMax_)
nGoodProtons++;
}
}
return (nGoodProtons>=nProtons_);
return (nGoodProtons >= nProtons_);
}

0 comments on commit d57dd95

Please sign in to comment.