CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
PATPuppiJetSpecificProducer Class Reference
Inheritance diagram for PATPuppiJetSpecificProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PATPuppiJetSpecificProducer (const edm::ParameterSet &cfg)
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 
 ~PATPuppiJetSpecificProducer () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::EDGetTokenT< edm::View< pat::Jet > > jets_token
 
edm::InputTag srcjets_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 24 of file PATPuppiJetSpecificsProducer.cc.

Constructor & Destructor Documentation

◆ PATPuppiJetSpecificProducer()

PATPuppiJetSpecificProducer::PATPuppiJetSpecificProducer ( const edm::ParameterSet cfg)
explicit

Definition at line 37 of file PATPuppiJetSpecificsProducer.cc.

References looper::cfg, jets_token, and srcjets_.

37  {
38  srcjets_ = cfg.getParameter<edm::InputTag>("src");
39  jets_token = consumes<edm::View<pat::Jet> >(srcjets_);
40 
41  produces<edm::ValueMap<float> >("puppiMultiplicity");
42  produces<edm::ValueMap<float> >("neutralPuppiMultiplicity");
43  produces<edm::ValueMap<float> >("neutralHadronPuppiMultiplicity");
44  produces<edm::ValueMap<float> >("photonPuppiMultiplicity");
45  produces<edm::ValueMap<float> >("HFHadronPuppiMultiplicity");
46  produces<edm::ValueMap<float> >("HFEMPuppiMultiplicity");
47 }
edm::EDGetTokenT< edm::View< pat::Jet > > jets_token

◆ ~PATPuppiJetSpecificProducer()

PATPuppiJetSpecificProducer::~PATPuppiJetSpecificProducer ( )
inlineoverride

Definition at line 27 of file PATPuppiJetSpecificsProducer.cc.

27 {}

Member Function Documentation

◆ fillDescriptions()

void PATPuppiJetSpecificProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 140 of file PATPuppiJetSpecificsProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

140  {
142  desc.add<edm::InputTag>("src", edm::InputTag("slimmedJets"));
143  descriptions.add("patPuppiJetSpecificProducer", desc);
144 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void PATPuppiJetSpecificProducer::produce ( edm::StreamID  ,
edm::Event evt,
const edm::EventSetup es 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 49 of file PATPuppiJetSpecificsProducer.cc.

References funct::abs(), HltBtagPostValidation_cff::c, edm::helper::Filler< Map >::fill(), edm::Event::getByToken(), mps_fire::i, edm::helper::Filler< Map >::insert(), PDWG_EXODelayedJetMET_cff::jets, jets_token, eostools::move(), pat::PackedCandidate::pdgId(), pat::PackedCandidate::puppiWeight(), edm::Event::put(), and mps_merge::weight.

49  {
52 
53  std::vector<float> puppiMultiplicities;
54  std::vector<float> neutralPuppiMultiplicities;
55  std::vector<float> neutralHadronPuppiMultiplicities;
56  std::vector<float> photonPuppiMultiplicities;
57  std::vector<float> HFHadronPuppiMultiplicities;
58  std::vector<float> HFEMPuppiMultiplicities;
59 
60  for (auto const& c : *jets) {
61  float puppiMultiplicity = 0;
62  float neutralPuppiMultiplicity = 0;
63  float neutralHadronPuppiMultiplicity = 0;
64  float photonPuppiMultiplicity = 0;
65  float HFHadronPuppiMultiplicity = 0;
66  float HFEMPuppiMultiplicity = 0;
67 
68  for (unsigned i = 0; i < c.numberOfDaughters(); i++) {
69  const pat::PackedCandidate& dau = static_cast<const pat::PackedCandidate&>(*c.daughter(i));
70  auto weight = dau.puppiWeight();
71  puppiMultiplicity += weight;
72  // This logic is taken from RecoJets/JetProducers/src/JetSpecific.cc
73  switch (std::abs(dau.pdgId())) {
74  case 130: //PFCandidate::h0 : // neutral hadron
75  neutralHadronPuppiMultiplicity += weight;
76  neutralPuppiMultiplicity += weight;
77  break;
78  case 22: //PFCandidate::gamma: // photon
79  photonPuppiMultiplicity += weight;
80  neutralPuppiMultiplicity += weight;
81  break;
82  case 1: // PFCandidate::h_HF : // hadron in HF
83  HFHadronPuppiMultiplicity += weight;
84  neutralPuppiMultiplicity += weight;
85  break;
86  case 2: //PFCandidate::egamma_HF : // electromagnetic in HF
87  HFEMPuppiMultiplicity += weight;
88  neutralPuppiMultiplicity += weight;
89  break;
90  }
91  }
92 
93  puppiMultiplicities.push_back(puppiMultiplicity);
94  neutralPuppiMultiplicities.push_back(neutralPuppiMultiplicity);
95  neutralHadronPuppiMultiplicities.push_back(neutralHadronPuppiMultiplicity);
96  photonPuppiMultiplicities.push_back(photonPuppiMultiplicity);
97  HFHadronPuppiMultiplicities.push_back(HFHadronPuppiMultiplicity);
98  HFEMPuppiMultiplicities.push_back(HFEMPuppiMultiplicity);
99  }
100 
101  std::unique_ptr<edm::ValueMap<float> > puppiMultiplicities_out(new edm::ValueMap<float>());
102  edm::ValueMap<float>::Filler puppiMultiplicities_filler(*puppiMultiplicities_out);
103  puppiMultiplicities_filler.insert(jets, puppiMultiplicities.begin(), puppiMultiplicities.end());
104  puppiMultiplicities_filler.fill();
105  evt.put(std::move(puppiMultiplicities_out), "puppiMultiplicity");
106 
107  std::unique_ptr<edm::ValueMap<float> > neutralPuppiMultiplicities_out(new edm::ValueMap<float>());
108  edm::ValueMap<float>::Filler neutralPuppiMultiplicities_filler(*neutralPuppiMultiplicities_out);
109  neutralPuppiMultiplicities_filler.insert(jets, neutralPuppiMultiplicities.begin(), neutralPuppiMultiplicities.end());
110  neutralPuppiMultiplicities_filler.fill();
111  evt.put(std::move(neutralPuppiMultiplicities_out), "neutralPuppiMultiplicity");
112 
113  std::unique_ptr<edm::ValueMap<float> > neutralHadronPuppiMultiplicities_out(new edm::ValueMap<float>());
114  edm::ValueMap<float>::Filler neutralHadronPuppiMultiplicities_filler(*neutralHadronPuppiMultiplicities_out);
115  neutralHadronPuppiMultiplicities_filler.insert(
116  jets, neutralHadronPuppiMultiplicities.begin(), neutralHadronPuppiMultiplicities.end());
117  neutralHadronPuppiMultiplicities_filler.fill();
118  evt.put(std::move(neutralHadronPuppiMultiplicities_out), "neutralHadronPuppiMultiplicity");
119 
120  std::unique_ptr<edm::ValueMap<float> > photonPuppiMultiplicities_out(new edm::ValueMap<float>());
121  edm::ValueMap<float>::Filler photonPuppiMultiplicities_filler(*photonPuppiMultiplicities_out);
122  photonPuppiMultiplicities_filler.insert(jets, photonPuppiMultiplicities.begin(), photonPuppiMultiplicities.end());
123  photonPuppiMultiplicities_filler.fill();
124  evt.put(std::move(photonPuppiMultiplicities_out), "photonPuppiMultiplicity");
125 
126  std::unique_ptr<edm::ValueMap<float> > HFHadronPuppiMultiplicities_out(new edm::ValueMap<float>());
127  edm::ValueMap<float>::Filler HFHadronPuppiMultiplicities_filler(*HFHadronPuppiMultiplicities_out);
128  HFHadronPuppiMultiplicities_filler.insert(
129  jets, HFHadronPuppiMultiplicities.begin(), HFHadronPuppiMultiplicities.end());
130  HFHadronPuppiMultiplicities_filler.fill();
131  evt.put(std::move(HFHadronPuppiMultiplicities_out), "HFHadronPuppiMultiplicity");
132 
133  std::unique_ptr<edm::ValueMap<float> > HFEMPuppiMultiplicities_out(new edm::ValueMap<float>());
134  edm::ValueMap<float>::Filler HFEMPuppiMultiplicities_filler(*HFEMPuppiMultiplicities_out);
135  HFEMPuppiMultiplicities_filler.insert(jets, HFEMPuppiMultiplicities.begin(), HFEMPuppiMultiplicities.end());
136  HFEMPuppiMultiplicities_filler.fill();
137  evt.put(std::move(HFEMPuppiMultiplicities_out), "HFEMPuppiMultiplicity");
138 }
float puppiWeight() const
edm::EDGetTokenT< edm::View< pat::Jet > > jets_token
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
Definition: weight.py:1
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:540
int pdgId() const override
PDG identifier.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ jets_token

edm::EDGetTokenT<edm::View<pat::Jet> > PATPuppiJetSpecificProducer::jets_token
private

Definition at line 34 of file PATPuppiJetSpecificsProducer.cc.

Referenced by PATPuppiJetSpecificProducer(), and produce().

◆ srcjets_

edm::InputTag PATPuppiJetSpecificProducer::srcjets_
private

Definition at line 33 of file PATPuppiJetSpecificsProducer.cc.

Referenced by PATPuppiJetSpecificProducer().