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
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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
 
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)
 
 ~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
 
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::vector< ModuleDescription const * > &modules, 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
 
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 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
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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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<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)
 

Detailed Description

Definition at line 13 of file PileupJetIDVarProducer.cc.

Constructor & Destructor Documentation

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
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::ValueMap< StoredPileupJetIdentifier > > srcPileupJetId_
edm::EDGetTokenT< edm::View< pat::Jet > > srcJet_
PileupJetIDVarProducer::~PileupJetIDVarProducer ( )
inlineoverride

Definition at line 33 of file PileupJetIDVarProducer.cc.

References fillDescriptions(), and produce().

33 {};

Member Function Documentation

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

Definition at line 169 of file PileupJetIDVarProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), DEFINE_FWK_MODULE, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ~PileupJetIDVarProducer().

169  {
170  //The following says we do not know what parameters are allowed so do no validation
171  // Please change this to state exactly what you do use, even if it is no parameters
173  desc.add<edm::InputTag>("srcJet")->setComment("jet input collection");
174  desc.add<edm::InputTag>("srcPileupJetId")->setComment("StoredPileupJetIdentifier name");
175  std::string modname;
176  modname += "PileupJetIDVarProducer";
177  descriptions.add(modname, desc);
178 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void PileupJetIDVarProducer::produce ( edm::StreamID  streamID,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivate

Definition at line 46 of file PileupJetIDVarProducer.cc.

References pfBoostedDoubleSVAK8TagInfos_cfi::beta, edm::helper::Filler< Map >::fill(), edm::Event::getByToken(), edm::helper::Filler< Map >::insert(), metsig::jet, eostools::move(), hpstanc_transforms::nCharged, jets_cff::ptD, edm::Event::put(), electrons_cff::srcJet, srcJet_, and srcPileupJetId_.

Referenced by ~PileupJetIDVarProducer().

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

Member Data Documentation

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

Definition at line 41 of file PileupJetIDVarProducer.cc.

Referenced by produce().

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

Definition at line 42 of file PileupJetIDVarProducer.cc.

Referenced by produce().