CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
PileupJetIDVarProducer Class Reference
Inheritance diagram for PileupJetIDVarProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PileupJetIDVarProducer (const edm::ParameterSet &iConfig)
 
 ~PileupJetIDVarProducer () 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 noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
bool wantsStreamLuminosityBlocks () const noexcept final
 
bool wantsStreamRuns () const noexcept 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices 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 Member Functions

void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 

Private Attributes

edm::EDGetTokenT< edm::View< pat::Jet > > srcJet_
 
edm::EDGetTokenT< edm::ValueMap< StoredPileupJetIdentifier > > srcPileupJetId_
 

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 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 13 of file PileupJetIDVarProducer.cc.

Constructor & Destructor Documentation

◆ PileupJetIDVarProducer()

PileupJetIDVarProducer::PileupJetIDVarProducer ( const edm::ParameterSet iConfig)
inlineexplicit

Definition at line 15 of file PileupJetIDVarProducer.cc.

19  produces<edm::ValueMap<float>>("dR2Mean");
20  produces<edm::ValueMap<float>>("majW");
21  produces<edm::ValueMap<float>>("minW");
22  produces<edm::ValueMap<float>>("frac01");
23  produces<edm::ValueMap<float>>("frac02");
24  produces<edm::ValueMap<float>>("frac03");
25  produces<edm::ValueMap<float>>("frac04");
26  produces<edm::ValueMap<float>>("ptD");
27  produces<edm::ValueMap<float>>("beta");
28  produces<edm::ValueMap<float>>("pull");
29  produces<edm::ValueMap<float>>("jetR");
30  produces<edm::ValueMap<float>>("jetRchg");
31  produces<edm::ValueMap<int>>("nCharged");
32  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::ValueMap< StoredPileupJetIdentifier > > srcPileupJetId_
edm::EDGetTokenT< edm::View< pat::Jet > > srcJet_

◆ ~PileupJetIDVarProducer()

PileupJetIDVarProducer::~PileupJetIDVarProducer ( )
inlineoverride

Definition at line 33 of file PileupJetIDVarProducer.cc.

33 {};

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 166 of file PileupJetIDVarProducer.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), and submitPVResolutionJobs::desc.

166  {
167  //The following says we do not know what parameters are allowed so do no validation
168  // Please change this to state exactly what you do use, even if it is no parameters
170  desc.add<edm::InputTag>("srcJet")->setComment("pat::Jet input collection");
171  desc.add<edm::InputTag>("srcPileupJetId")->setComment("StoredPileupJetIdentifier ValueMap input collection");
172  descriptions.addWithDefaultLabel(desc);
173 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ produce()

void PileupJetIDVarProducer::produce ( edm::StreamID  streamID,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 46 of file PileupJetIDVarProducer.cc.

References HLT_2024v14_cff::beta, edm::helper::Filler< Map >::fill(), iEvent, edm::helper::Filler< Map >::insert(), metsig::jet, LHEJetFilter_cfi::jetR, eostools::move(), HLT_2024v14_cff::nCharged, jetsAK4_CHS_cff::ptD, electrons_cff::srcJet, srcJet_, and srcPileupJetId_.

46  {
47  auto srcJet = iEvent.getHandle(srcJet_);
48  const auto& pileupJetIdProd = iEvent.get(srcPileupJetId_);
49 
50  unsigned int nJet = srcJet->size();
51 
52  std::vector<float> dR2Mean(nJet, -1);
53  std::vector<float> majW(nJet, -1);
54  std::vector<float> minW(nJet, -1);
55  std::vector<float> frac01(nJet, -1);
56  std::vector<float> frac02(nJet, -1);
57  std::vector<float> frac03(nJet, -1);
58  std::vector<float> frac04(nJet, -1);
59  std::vector<float> ptD(nJet, -1);
60  std::vector<float> beta(nJet, -1);
61  std::vector<float> pull(nJet, -1);
62  std::vector<float> jetR(nJet, -1);
63  std::vector<float> jetRchg(nJet, -1);
64  std::vector<int> nCharged(nJet, -1);
65 
66  for (unsigned int ij = 0; ij < nJet; ij++) {
67  auto jet = srcJet->ptrAt(ij);
68 
69  edm::RefToBase<pat::Jet> jetRef = srcJet->refAt(ij);
70 
71  dR2Mean[ij] = pileupJetIdProd[jetRef].dR2Mean();
72  majW[ij] = pileupJetIdProd[jetRef].majW();
73  minW[ij] = pileupJetIdProd[jetRef].minW();
74  frac01[ij] = pileupJetIdProd[jetRef].frac01();
75  frac02[ij] = pileupJetIdProd[jetRef].frac02();
76  frac03[ij] = pileupJetIdProd[jetRef].frac03();
77  frac04[ij] = pileupJetIdProd[jetRef].frac04();
78  ptD[ij] = pileupJetIdProd[jetRef].ptD();
79  beta[ij] = pileupJetIdProd[jetRef].beta();
80  pull[ij] = pileupJetIdProd[jetRef].pull();
81  jetR[ij] = pileupJetIdProd[jetRef].jetR();
82  jetRchg[ij] = pileupJetIdProd[jetRef].jetRchg();
83  nCharged[ij] = pileupJetIdProd[jetRef].nCharged();
84  }
85 
86  std::unique_ptr<edm::ValueMap<float>> dR2MeanV(new edm::ValueMap<float>());
87  edm::ValueMap<float>::Filler filler_dR2Mean(*dR2MeanV);
88  filler_dR2Mean.insert(srcJet, dR2Mean.begin(), dR2Mean.end());
89  filler_dR2Mean.fill();
90  iEvent.put(std::move(dR2MeanV), "dR2Mean");
91 
92  std::unique_ptr<edm::ValueMap<float>> majWV(new edm::ValueMap<float>());
93  edm::ValueMap<float>::Filler filler_majW(*majWV);
94  filler_majW.insert(srcJet, majW.begin(), majW.end());
95  filler_majW.fill();
96  iEvent.put(std::move(majWV), "majW");
97 
98  std::unique_ptr<edm::ValueMap<float>> minWV(new edm::ValueMap<float>());
99  edm::ValueMap<float>::Filler filler_minW(*minWV);
100  filler_minW.insert(srcJet, minW.begin(), minW.end());
101  filler_minW.fill();
102  iEvent.put(std::move(minWV), "minW");
103 
104  std::unique_ptr<edm::ValueMap<float>> frac01V(new edm::ValueMap<float>());
105  edm::ValueMap<float>::Filler filler_frac01(*frac01V);
106  filler_frac01.insert(srcJet, frac01.begin(), frac01.end());
107  filler_frac01.fill();
108  iEvent.put(std::move(frac01V), "frac01");
109 
110  std::unique_ptr<edm::ValueMap<float>> frac02V(new edm::ValueMap<float>());
111  edm::ValueMap<float>::Filler filler_frac02(*frac02V);
112  filler_frac02.insert(srcJet, frac02.begin(), frac02.end());
113  filler_frac02.fill();
114  iEvent.put(std::move(frac02V), "frac02");
115 
116  std::unique_ptr<edm::ValueMap<float>> frac03V(new edm::ValueMap<float>());
117  edm::ValueMap<float>::Filler filler_frac03(*frac03V);
118  filler_frac03.insert(srcJet, frac03.begin(), frac03.end());
119  filler_frac03.fill();
120  iEvent.put(std::move(frac03V), "frac03");
121 
122  std::unique_ptr<edm::ValueMap<float>> frac04V(new edm::ValueMap<float>());
123  edm::ValueMap<float>::Filler filler_frac04(*frac04V);
124  filler_frac04.insert(srcJet, frac04.begin(), frac04.end());
125  filler_frac04.fill();
126  iEvent.put(std::move(frac04V), "frac04");
127 
128  std::unique_ptr<edm::ValueMap<float>> ptDV(new edm::ValueMap<float>());
129  edm::ValueMap<float>::Filler filler_ptD(*ptDV);
130  filler_ptD.insert(srcJet, ptD.begin(), ptD.end());
131  filler_ptD.fill();
132  iEvent.put(std::move(ptDV), "ptD");
133 
134  std::unique_ptr<edm::ValueMap<float>> betaV(new edm::ValueMap<float>());
135  edm::ValueMap<float>::Filler filler_beta(*betaV);
136  filler_beta.insert(srcJet, beta.begin(), beta.end());
137  filler_beta.fill();
138  iEvent.put(std::move(betaV), "beta");
139 
140  std::unique_ptr<edm::ValueMap<float>> pullV(new edm::ValueMap<float>());
141  edm::ValueMap<float>::Filler filler_pull(*pullV);
142  filler_pull.insert(srcJet, pull.begin(), pull.end());
143  filler_pull.fill();
144  iEvent.put(std::move(pullV), "pull");
145 
146  std::unique_ptr<edm::ValueMap<float>> jetRV(new edm::ValueMap<float>());
147  edm::ValueMap<float>::Filler filler_jetR(*jetRV);
148  filler_jetR.insert(srcJet, jetR.begin(), jetR.end());
149  filler_jetR.fill();
150  iEvent.put(std::move(jetRV), "jetR");
151 
152  std::unique_ptr<edm::ValueMap<float>> jetRchgV(new edm::ValueMap<float>());
153  edm::ValueMap<float>::Filler filler_jetRchg(*jetRchgV);
154  filler_jetRchg.insert(srcJet, jetRchg.begin(), jetRchg.end());
155  filler_jetRchg.fill();
156  iEvent.put(std::move(jetRchgV), "jetRchg");
157 
158  std::unique_ptr<edm::ValueMap<int>> nChargedV(new edm::ValueMap<int>());
159  edm::ValueMap<int>::Filler filler_nCharged(*nChargedV);
160  filler_nCharged.insert(srcJet, nCharged.begin(), nCharged.end());
161  filler_nCharged.fill();
162  iEvent.put(std::move(nChargedV), "nCharged");
163 }
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< edm::ValueMap< StoredPileupJetIdentifier > > srcPileupJetId_
edm::EDGetTokenT< edm::View< pat::Jet > > srcJet_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ srcJet_

edm::EDGetTokenT<edm::View<pat::Jet> > PileupJetIDVarProducer::srcJet_
private

Definition at line 41 of file PileupJetIDVarProducer.cc.

Referenced by produce().

◆ srcPileupJetId_

edm::EDGetTokenT<edm::ValueMap<StoredPileupJetIdentifier> > PileupJetIDVarProducer::srcPileupJetId_
private

Definition at line 42 of file PileupJetIDVarProducer.cc.

Referenced by produce().