47 : name_(iConfig.getParameter<
std::
string>(
"name")),
48 candIdxName_(iConfig.getParameter<
std::
string>(
"candIdxName")),
49 candIdxDoc_(iConfig.getParameter<
std::
string>(
"candIdxDoc")),
52 jetCut_(iConfig.getParameter<
std::
string>(
"jetCut")) {
53 produces<nanoaod::FlatTable>(
name_);
54 produces<std::vector<reco::CandidatePtr>>();
63 auto outCands = std::make_unique<std::vector<reco::CandidatePtr>>();
67 iEvent.getByToken(cand_token_, cands_);
68 auto candPtrs = cands_->ptrs();
73 std::vector<T> jetsPassCut;
84 std::vector<int> parentJetIdx;
85 std::vector<int> candIdx;
92 std::vector<reco::CandidatePtr>
const &
daughters =
jet.daughterPtrVector();
94 auto candInNewList =
std::find(candPtrs.begin(), candPtrs.end(),
cand);
95 if (candInNewList == candPtrs.end()) {
98 outCands->push_back(
cand);
99 parentJetIdx.push_back(
jetIdx);
100 candIdx.push_back(candInNewList - candPtrs.begin());
104 auto candTable = std::make_unique<nanoaod::FlatTable>(outCands->size(), name_,
false);
106 candTable->addColumn<
int>(candIdxName_, candIdx, candIdxDoc_);
109 std::string parentJetIdxDoc(
"Index of the parent jet");
111 parentJetIdxName =
"genJetIdx";
112 parentJetIdxDoc =
"Index of the parent gen jet";
114 candTable->addColumn<
int>(parentJetIdxName, parentJetIdx, parentJetIdxDoc);
120 template <
typename T>
edm::EDGetTokenT< edm::View< T > > jet_token_
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
const std::string candIdxName_
SimpleJetConstituentTableProducer< pat::Jet > SimplePatJetConstituentTableProducer
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
~SimpleJetConstituentTableProducer() override
const StringCutObjectSelector< T > jetCut_
SimpleJetConstituentTableProducer< reco::GenJet > SimpleGenJetConstituentTableProducer
void produce(edm::Event &, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
SimpleJetConstituentTableProducer(const edm::ParameterSet &)
edm::Handle< reco::CandidateView > cands_
const std::string candIdxDoc_
edm::EDGetTokenT< reco::CandidateView > cand_token_
edm::View< Candidate > CandidateView
view of a collection containing candidates
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)