34 template <
class T,
typename C = std::vector<
typename T::ConstituentTypeFwdPtr>>
45 unpackAK8_{params.getParameter<
bool>(
"unpackAK8")}
47 produces<JetsOutput>();
48 produces<ConstituentsOutput>(
"constituents");
54 desc.
add<
edm::InputTag>(
"src")->setComment(
"InputTag used for retrieving jets in event.");
55 desc.
add<
std::string>(
"cut")->setComment(
"Cut used by which to select jets. For example:\n" 56 " \"pt > 100.0 && abs(rapidity()) < 2.4\".");
57 desc.
add<
bool>(
"unpackAK8",
false)->setComment(
"Assume the jets are AK8 jets from miniAOD and need to be unpacked.");
73 auto jets = std::make_unique<JetsOutput>();
74 auto candsOut = std::make_unique<ConstituentsOutput>();
81 for (
auto const&
jet : *h_jets) {
88 for (
unsigned int ida {}; ida <
jet.numberOfDaughters(); ++ida) {
89 candsOut->emplace_back(
initptr(
jet.daughterPtr(ida)) );
95 for (
unsigned int ida {}; ida <
jet.numberOfDaughters(); ++ida) {
96 auto const & dau =
jet.daughterPtr(ida);
97 if ( dau->numberOfDaughters() == 0 ) {
98 candsOut->emplace_back(
initptr(dau) );
100 auto const * dauJet =
dynamic_cast<pat::Jet const *
>(dau.get());
101 for (
unsigned int jda {}; jda < dauJet->numberOfDaughters(); ++jda ) {
102 candsOut->emplace_back(
initptr(dauJet->daughterPtr(jda)) );
T getParameter(std::string const &) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
StringCutObjectSelector< T > const selector_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
JetConstituentSelector(edm::ParameterSet const ¶ms)
Container::value_type value_type
void addDefault(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< edm::View< T > > const srcToken_
Analysis-level calorimeter jet class.
void produce(edm::Event &iEvent, edm::EventSetup const &iSetup) override
typename C::value_type ValueType
std::vector< T > JetsOutput
ConstituentsOutput::value_type const initptr(edm::Ptr< reco::Candidate > const &dau) const