6 : distMax_(iConfig.getParameter<double>(
"distMax")),
10 fixDaughters_(iConfig.getParameter<
bool>(
"fixDaughters")) {
14 pf2pc_ = consumes<edm::Association<pat::PackedCandidateCollection>>(
16 pc2pf_ = consumes<edm::Association<reco::PFCandidateCollection>>(
20 produces<std::vector<pat::Jet>>();
27 auto outputs = std::make_unique<std::vector<pat::Jet>>();
30 std::vector<edm::Handle<edm::View<pat::Jet>>> algoHandles;
46 for (
auto const& ijet : *jetHandle) {
50 unsigned int index = 0;
52 for (
auto const& ialgoHandle : algoHandles) {
53 std::vector<edm::Ptr<pat::Jet>> nextSubjets;
55 for (
auto const& jjet : *ialgoHandle) {
57 for (
auto const& userfloatstr : jjet.userFloatNames()) {
58 outputs->back().addUserFloat(userfloatstr, jjet.userFloat(userfloatstr));
60 for (
auto const& userintstr : jjet.userIntNames()) {
61 outputs->back().addUserInt(userintstr, jjet.userInt(userintstr));
63 for (
auto const& usercandstr : jjet.userCandNames()) {
64 outputs->back().addUserCand(usercandstr, jjet.userCand(usercandstr));
66 for (
size_t ida = 0; ida < jjet.numberOfDaughters(); ++ida) {
79 std::vector<reco::CandidatePtr> daughtersInSubjets;
80 std::vector<reco::CandidatePtr> daughtersNew;
81 const std::vector<reco::CandidatePtr>& jdausPF =
outputs->back().daughterPtrVector();
82 std::vector<reco::CandidatePtr> jdaus;
83 jdaus.reserve(jdausPF.size());
85 for (
auto const& jdau : jdausPF) {
90 const std::vector<reco::CandidatePtr>& sjdaus = subjet->daughterPtrVector();
92 bool skipSubjet =
false;
94 if (
std::find(jdaus.begin(), jdaus.end(), dau) == jdaus.end()) {
102 daughtersInSubjets.insert(daughtersInSubjets.end(), sjdaus.begin(), sjdaus.end());
106 if (
std::find(daughtersInSubjets.begin(), daughtersInSubjets.end(), dau) == daughtersInSubjets.end()) {
107 daughtersNew.push_back(dau);
110 outputs->back().clearDaughters();
111 for (
const auto& dau : daughtersNew)
112 outputs->back().addDaughter(dau);
T getParameter(std::string const &) const
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
#define DEFINE_FWK_MODULE(type)
JetSubstructurePacker(const edm::ParameterSet &)
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
edm::EDGetTokenT< edm::View< pat::Jet > > jetToken_
void produce(edm::Event &, const edm::EventSetup &) override
std::vector< edm::EDGetTokenT< edm::View< pat::Jet > > > algoTokens_
edm::EDGetTokenT< edm::Association< reco::PFCandidateCollection > > pc2pf_
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
~JetSubstructurePacker() override
std::vector< edm::InputTag > algoTags_
edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > pf2pc_
std::vector< std::string > algoLabels_