CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PileupJPTJetIdProducer Class Reference
Inheritance diagram for PileupJPTJetIdProducer:
edm::stream::EDProducer<>

Public Member Functions

 PileupJPTJetIdProducer (const edm::ParameterSet &)
 
 ~PileupJPTJetIdProducer () override
 
- Public Member Functions inherited from edm::stream::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
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

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

Private Attributes

bool allowMissingInputs_
 
edm::EDGetTokenT< edm::View< reco::JPTJet > > input_token_
 
edm::InputTag jets_
 
cms::PileupJPTJetIdAlgopualgo
 
int verbosity
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 20 of file PileupJPTJetIdProducer.cc.

Constructor & Destructor Documentation

◆ PileupJPTJetIdProducer()

PileupJPTJetIdProducer::PileupJPTJetIdProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 36 of file PileupJPTJetIdProducer.cc.

References allowMissingInputs_, cms::PileupJPTJetIdAlgo::bookMVAReader(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), input_token_, jets_, pualgo, and verbosity.

36  {
37  jets_ = iConfig.getParameter<edm::InputTag>("jets");
38  input_token_ = consumes<edm::View<reco::JPTJet>>(jets_);
39  verbosity = iConfig.getParameter<int>("Verbosity");
40  allowMissingInputs_ = iConfig.getUntrackedParameter<bool>("AllowMissingInputs", false);
41  pualgo = new cms::PileupJPTJetIdAlgo(iConfig);
43  produces<edm::ValueMap<float>>("JPTPUDiscriminant");
44  produces<edm::ValueMap<int>>("JPTPUId");
45 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::View< reco::JPTJet > > input_token_
cms::PileupJPTJetIdAlgo * pualgo

◆ ~PileupJPTJetIdProducer()

PileupJPTJetIdProducer::~PileupJPTJetIdProducer ( )
override

Definition at line 48 of file PileupJPTJetIdProducer.cc.

48 {}

Member Function Documentation

◆ produce()

void PileupJPTJetIdProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

|eta|<2.6

Definition at line 51 of file PileupJPTJetIdProducer.cc.

References b, gather_cfg::cout, cms::PileupJPTJetIdAlgo::fillJPTBlock(), mps_fire::i, iEvent, input_token_, metsig::jet, PDWG_EXODelayedJetMET_cff::jets, eostools::move(), beam_dqm_sourceclient-live_cfg::mva, pualgo, and verbosity.

51  {
52  using namespace edm;
53  using namespace std;
54  using namespace reco;
56  iEvent.getByToken(input_token_, jets);
57  vector<float> mva;
58  vector<int> idflag;
59  for (unsigned int i = 0; i < jets->size(); ++i) {
60  int b = -1;
61  const JPTJet& jet = jets->at(i);
62 
63  float mvapu = pualgo->fillJPTBlock(&jet);
64 
65  mva.push_back(mvapu);
66 
67  // Get PUid type
69  //WP 95% JPT PUID > 0.3
70  //WP 90% JPT PUID > 0.7
71  //WP 80% JPT PUID > 0.9
72 
73  //|eta|>=2.6
74  //WP 90% JPT PUID > -0.55
75  //WP 80% JPT PUID > -0.3
76  //WP 70% JPT PUID > -0.1
77 
78  if (fabs(jet.eta()) < 2.6) {
79  if (mvapu > 0.3)
80  b = 0;
81  if (mvapu > 0.7)
82  b = 1;
83  if (mvapu > 0.9)
84  b = 2;
85  } else {
86  if (mvapu > -0.55)
87  b = 0;
88  if (mvapu > -0.3)
89  b = 1;
90  if (mvapu > -0.1)
91  b = 2;
92  }
93 
94  idflag.push_back(b);
95 
96  if (verbosity > 0)
97  std::cout << " PUID producer::Corrected JPT Jet is " << jet.pt() << " " << jet.eta() << " " << jet.phi() << " "
98  << jet.getSpecific().Zch << std::endl;
99  }
100 
101  auto mvaout = std::make_unique<ValueMap<float>>();
102  ValueMap<float>::Filler mvafiller(*mvaout);
103  mvafiller.insert(jets, mva.begin(), mva.end());
104  mvafiller.fill();
105  iEvent.put(std::move(mvaout), "JPTPUDiscriminant");
106 
107  auto idflagout = std::make_unique<ValueMap<int>>();
108  ValueMap<int>::Filler idflagfiller(*idflagout);
109  idflagfiller.insert(jets, idflag.begin(), idflag.end());
110  idflagfiller.fill();
111  iEvent.put(std::move(idflagout), "JPTPUId");
112 }
int iEvent
Definition: GenABIO.cc:224
Jets made from CaloJets corrected for ZSP and tracks.
Definition: JPTJet.h:28
edm::EDGetTokenT< edm::View< reco::JPTJet > > input_token_
cms::PileupJPTJetIdAlgo * pualgo
double b
Definition: hdecay.h:118
float fillJPTBlock(const reco::JPTJet *jet)
fixed size matrix
HLT enums.
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ allowMissingInputs_

bool PileupJPTJetIdProducer::allowMissingInputs_
private

Definition at line 30 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer().

◆ input_token_

edm::EDGetTokenT<edm::View<reco::JPTJet> > PileupJPTJetIdProducer::input_token_
private

Definition at line 29 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer(), and produce().

◆ jets_

edm::InputTag PileupJPTJetIdProducer::jets_
private

Definition at line 28 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer().

◆ pualgo

cms::PileupJPTJetIdAlgo* PileupJPTJetIdProducer::pualgo
private

Definition at line 32 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer(), and produce().

◆ verbosity

int PileupJPTJetIdProducer::verbosity
private

Definition at line 31 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer(), and produce().