CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 ( const edm::ParameterSet iConfig)
explicit

Definition at line 36 of file PileupJPTJetIdProducer.cc.

References allowMissingInputs_, 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);
42  pualgo->bookMVAReader();
43  produces<edm::ValueMap<float>>("JPTPUDiscriminant");
44  produces<edm::ValueMap<int>>("JPTPUId");
45 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::View< reco::JPTJet > > input_token_
cms::PileupJPTJetIdAlgo * pualgo
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
PileupJPTJetIdProducer::~PileupJPTJetIdProducer ( )
override

Definition at line 48 of file PileupJPTJetIdProducer.cc.

48 {}

Member Function Documentation

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, reco::LeafCandidate::eta(), cms::PileupJPTJetIdAlgo::fillJPTBlock(), edm::Event::getByToken(), reco::JPTJet::getSpecific(), mps_fire::i, input_token_, metsig::jet, fwrapper::jets, eostools::move(), beam_dqm_sourceclient-live_cfg::mva, reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), pualgo, edm::Event::put(), dt_dqm_sourceclient_common_cff::reco, verbosity, and reco::JPTJet::Specific::Zch.

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 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
double pt() const final
transverse momentum
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
const Specific & getSpecific() const
block accessors
Definition: JPTJet.h:136
Jets made from CaloJets corrected for ZSP and tracks.
Definition: JPTJet.h:28
vector< PseudoJet > jets
def move
Definition: eostools.py:511
edm::EDGetTokenT< edm::View< reco::JPTJet > > input_token_
cms::PileupJPTJetIdAlgo * pualgo
double b
Definition: hdecay.h:118
float fillJPTBlock(const reco::JPTJet *jet)
tuple cout
Definition: gather_cfg.py:144
double phi() const final
momentum azimuthal angle
double eta() const final
momentum pseudorapidity

Member Data Documentation

bool PileupJPTJetIdProducer::allowMissingInputs_
private

Definition at line 30 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer().

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

Definition at line 29 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer(), and produce().

edm::InputTag PileupJPTJetIdProducer::jets_
private

Definition at line 28 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer().

cms::PileupJPTJetIdAlgo* PileupJPTJetIdProducer::pualgo
private

Definition at line 32 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer(), and produce().

int PileupJPTJetIdProducer::verbosity
private

Definition at line 31 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer(), and produce().