Skip to content

Commit

Permalink
Merge pull request #30229 from camolezi/reduce-boost-bind-TagAndProbe
Browse files Browse the repository at this point in the history
Reduce boost dependency in PhysicsTools/TagAndProbe
  • Loading branch information
cmsbuild committed Jun 17, 2020
2 parents 307acb1 + 22cfade commit 69a9041
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions PhysicsTools/TagAndProbe/interface/BaseTreeFiller.h
Expand Up @@ -30,7 +30,6 @@
#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"

#include <TTree.h>
#include <boost/utility.hpp>

/** Class that makes a TTree with:
- variables from a Probe
Expand Down Expand Up @@ -133,9 +132,11 @@ namespace tnp {
mutable std::vector<reco::CandidateBaseRef> passingProbes_;
};

// This class inherits from boost::noncopyable, as copying it would break the addresses in the TTree
class BaseTreeFiller : boost::noncopyable {
// This class is noncopyable, as copying it would break the addresses in the TTree
class BaseTreeFiller {
public:
BaseTreeFiller(const BaseTreeFiller &) = delete;
BaseTreeFiller &operator=(const BaseTreeFiller &) = delete;
/// specify the name of the TTree, and the configuration for it
BaseTreeFiller(const char *name, const edm::ParameterSet &config, edm::ConsumesCollector &&iC)
: BaseTreeFiller(name, config, iC){};
Expand Down
5 changes: 3 additions & 2 deletions PhysicsTools/TagAndProbe/plugins/ProbeTreeProducer.cc
Expand Up @@ -13,7 +13,6 @@

#include <memory>
#include <cctype>
#include "boost/bind.hpp"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDFilter.h"
#include "FWCore/Framework/interface/Event.h"
Expand Down Expand Up @@ -87,7 +86,9 @@ bool ProbeTreeProducer::filter(edm::Event& iEvent, const edm::EventSetup& iSetup
}
// sort only if a function was provided
if (!sortDescendingBy_.empty())
sort(selectedProbes.begin(), selectedProbes.end(), boost::bind(&Pair::second, _1) > boost::bind(&Pair::second, _2));
sort(selectedProbes.begin(), selectedProbes.end(), [&](auto& arg1, auto& arg2) {
return arg1.second > arg2.second;
});
// fill the first maxProbes_ into the tree
for (size_t i = 0; i < (maxProbes_ < 0 ? selectedProbes.size() : std::min((size_t)maxProbes_, selectedProbes.size()));
++i) {
Expand Down

0 comments on commit 69a9041

Please sign in to comment.