6 distMax_( iConfig.getParameter<double>(
"distMax") ),
7 jetToken_(consumes<
edm::
View<
pat::
Jet> >( iConfig.getParameter<
edm::InputTag>(
"jetSrc") )),
8 algoLabels_( iConfig.getParameter<
std::vector<
std::
string> > (
"algoLabels") ),
9 algoTags_ (iConfig.getParameter<
std::vector<
edm::InputTag> > (
"algoTags" )),
10 fixDaughters_(iConfig.getParameter<
bool>(
"fixDaughters"))
18 produces<std::vector<pat::Jet> > ();
32 auto outputs = std::make_unique<std::vector<pat::Jet>>();
35 std::vector< edm::Handle< edm::View<pat::Jet> > > algoHandles;
51 for (
auto const & ijet : *jetHandle ) {
55 unsigned int index = 0;
57 for (
auto const & ialgoHandle : algoHandles ) {
58 std::vector< edm::Ptr<pat::Jet> > nextSubjets;
60 for (
auto const & jjet : *ialgoHandle ) {
62 for (
auto const & userfloatstr : jjet.userFloatNames() ) {
63 outputs->back().addUserFloat( userfloatstr, jjet.userFloat(userfloatstr) );
65 for (
auto const & userintstr : jjet.userIntNames() ) {
66 outputs->back().addUserInt( userintstr, jjet.userInt(userintstr) );
68 for (
auto const & usercandstr : jjet.userCandNames() ) {
69 outputs->back().addUserCand( usercandstr, jjet.userCand(usercandstr) );
71 for (
size_t ida = 0; ida < jjet.numberOfDaughters(); ++ida ) {
85 std::vector<reco::CandidatePtr> daughtersInSubjets;
86 std::vector<reco::CandidatePtr> daughtersNew;
87 const std::vector<reco::CandidatePtr> & jdausPF =
outputs->back().daughterPtrVector();
88 std::vector<reco::CandidatePtr> jdaus;
89 jdaus.reserve( jdausPF.size() );
91 for (
auto const & jdau : jdausPF ) {
96 const std::vector<reco::CandidatePtr> & sjdaus = subjet->daughterPtrVector();
98 bool skipSubjet =
false;
100 if (
std::find(jdaus.begin(), jdaus.end(), dau) == jdaus.end()) {
105 if (skipSubjet)
continue;
107 daughtersInSubjets.insert(daughtersInSubjets.end(), sjdaus.begin(), sjdaus.end());
111 if (
std::find(daughtersInSubjets.begin(), daughtersInSubjets.end(), dau) == daughtersInSubjets.end()) {
112 daughtersNew.push_back( dau );
115 outputs->back().clearDaughters();
116 for (
const auto & dau : daughtersNew)
outputs->back().addDaughter(dau);
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
std::vector< edm::EDGetTokenT< edm::View< pat::Jet > > > algoTokens_
JetSubstructurePacker(const edm::ParameterSet &)
edm::EDGetTokenT< edm::Association< reco::PFCandidateCollection > > pc2pf_
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
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_