Skip to content

Commit

Permalink
Merge pull request #30225 from camolezi/reduce-boost-bind-LHEInterface
Browse files Browse the repository at this point in the history
Reduce boost dependency in GeneratorInterface/LHEInterface
  • Loading branch information
cmsbuild authored Jun 14, 2020
2 parents 69ec082 + 68ba9ae commit 200e55a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <string>
#include <sstream>
#include <fstream>
#include <boost/algorithm/string.hpp>

// user include files
#include "FWCore/Framework/interface/Frameworkfwd.h"
Expand Down
14 changes: 6 additions & 8 deletions GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ Description: [one line class summary]
#include <sys/resource.h>
#include "tbb/task_arena.h"

#include "boost/bind.hpp"

#include "boost/ptr_container/ptr_deque.hpp"

// user include files
Expand Down Expand Up @@ -184,7 +182,7 @@ void ExternalLHEProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe
}
std::for_each(partonLevel_->weights().begin(),
partonLevel_->weights().end(),
boost::bind(&LHEEventProduct::addWeight, product.get(), _1));
std::bind(&LHEEventProduct::addWeight, product.get(), std::placeholders::_1));
product->setScales(partonLevel_->scales());
if (nPartonMapping_.empty()) {
product->setNpLO(partonLevel_->npLO());
Expand Down Expand Up @@ -219,18 +217,18 @@ void ExternalLHEProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe

std::for_each(partonLevel_->getComments().begin(),
partonLevel_->getComments().end(),
boost::bind(&LHEEventProduct::addComment, product.get(), _1));
std::bind(&LHEEventProduct::addComment, product.get(), std::placeholders::_1));

iEvent.put(std::move(product));

if (runInfo_) {
std::unique_ptr<LHERunInfoProduct> product(new LHERunInfoProduct(*runInfo_->getHEPRUP()));
std::for_each(runInfo_->getHeaders().begin(),
runInfo_->getHeaders().end(),
boost::bind(&LHERunInfoProduct::addHeader, product.get(), _1));
std::bind(&LHERunInfoProduct::addHeader, product.get(), std::placeholders::_1));
std::for_each(runInfo_->getComments().begin(),
runInfo_->getComments().end(),
boost::bind(&LHERunInfoProduct::addComment, product.get(), _1));
std::bind(&LHERunInfoProduct::addComment, product.get(), std::placeholders::_1));

if (!runInfoProducts_.empty()) {
runInfoProducts_.front().mergeProduct(*product);
Expand Down Expand Up @@ -348,10 +346,10 @@ void ExternalLHEProducer::beginRunProduce(edm::Run& run, edm::EventSetup const&
std::unique_ptr<LHERunInfoProduct> product(new LHERunInfoProduct(*runInfo_->getHEPRUP()));
std::for_each(runInfo_->getHeaders().begin(),
runInfo_->getHeaders().end(),
boost::bind(&LHERunInfoProduct::addHeader, product.get(), _1));
std::bind(&LHERunInfoProduct::addHeader, product.get(), std::placeholders::_1));
std::for_each(runInfo_->getComments().begin(),
runInfo_->getComments().end(),
boost::bind(&LHERunInfoProduct::addComment, product.get(), _1));
std::bind(&LHERunInfoProduct::addComment, product.get(), std::placeholders::_1));

// keep a copy around in case of merging
runInfoProducts_.push_back(new LHERunInfoProduct(*product));
Expand Down
6 changes: 2 additions & 4 deletions GeneratorInterface/LHEInterface/plugins/LHESource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#include <string>
#include <memory>

#include <boost/bind.hpp>

#include "FWCore/Framework/interface/InputSourceMacros.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/EventPrincipal.h"
Expand Down Expand Up @@ -147,13 +145,13 @@ void LHESource::readEvent_(edm::EventPrincipal& eventPrincipal) {
}
std::for_each(partonLevel_->weights().begin(),
partonLevel_->weights().end(),
boost::bind(&LHEEventProduct::addWeight, product.get(), _1));
std::bind(&LHEEventProduct::addWeight, product.get(), std::placeholders::_1));
product->setScales(partonLevel_->scales());
product->setNpLO(partonLevel_->npLO());
product->setNpNLO(partonLevel_->npNLO());
std::for_each(partonLevel_->getComments().begin(),
partonLevel_->getComments().end(),
boost::bind(&LHEEventProduct::addComment, product.get(), _1));
std::bind(&LHEEventProduct::addComment, product.get(), std::placeholders::_1));

std::unique_ptr<edm::WrapperBase> edp(new edm::Wrapper<LHEEventProduct>(std::move(product)));
eventPrincipal.put(lheProvenanceHelper_.eventProductBranchDescription_,
Expand Down
6 changes: 1 addition & 5 deletions GeneratorInterface/LHEInterface/src/LHEReader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#include <vector>
#include <cstdio>

#include <boost/bind.hpp>

#include <xercesc/sax2/Attributes.hpp>
#include <xercesc/dom/DOM.hpp>

Expand All @@ -28,8 +26,6 @@

#include "XMLUtils.h"

#include "boost/lexical_cast.hpp"

XERCES_CPP_NAMESPACE_USE

namespace lhef {
Expand Down Expand Up @@ -490,7 +486,7 @@ namespace lhef {

std::for_each(handler->headers.begin(),
handler->headers.end(),
boost::bind(&LHERunInfo::addHeader, curRunInfo.get(), _1));
std::bind(&LHERunInfo::addHeader, curRunInfo.get(), std::placeholders::_1));
handler->headers.clear();
} break;

Expand Down
2 changes: 0 additions & 2 deletions GeneratorInterface/LHEInterface/src/LHERunInfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#include <cmath>
#include <cstring>

#include <boost/bind.hpp>

#include <xercesc/dom/DOM.hpp>
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/sax/HandlerBase.hpp>
Expand Down

0 comments on commit 200e55a

Please sign in to comment.