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

Reduce boost dependency in PhysicsTools/TagAndProbe #30229

Merged
merged 1 commit into from Jun 17, 2020
Merged
Show file tree
Hide file tree
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
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