CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
BJetEnergyRegressionMVA Class Reference
Inheritance diagram for BJetEnergyRegressionMVA:
BaseMVAValueMapProducer< pat::Jet > edm::stream::EDProducer< edm::GlobalCache< BaseMVACache > >

Public Member Functions

 BJetEnergyRegressionMVA (const edm::ParameterSet &iConfig, const BaseMVACache *cache)
 
void fillAdditionalVariables (const pat::Jet &j) override
 
void readAdditionalCollections (edm::Event &iEvent, const edm::EventSetup &) override
 to be implemented in derived classes, filling values for additional variables More...
 
- Public Member Functions inherited from BaseMVAValueMapProducer< pat::Jet >
 BaseMVAValueMapProducer (const edm::ParameterSet &iConfig, const BaseMVACache *cache)
 
void setValue (const std::string var, float val)
 
 ~BaseMVAValueMapProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< BaseMVACache > >
 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
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from BaseMVAValueMapProducer< pat::Jet >
static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
static edm::ParameterSetDescription getDescription ()
 
static void globalEndJob (const BaseMVACache *cache)
 
static std::unique_ptr< BaseMVACacheinitializeGlobalCache (const edm::ParameterSet &cfg)
 

Private Attributes

edm::Handle< std::vector< reco::Vertex > > pvs_
 
const edm::EDGetTokenT< std::vector< reco::Vertex > > pvsrc_
 
edm::Handle< double > rho_
 
edm::EDGetTokenT< double > rhosrc_
 
edm::Handle< edm::View< reco::VertexCompositePtrCandidate > > svs_
 
const edm::EDGetTokenT< edm::View< reco::VertexCompositePtrCandidate > > svsrc_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< BaseMVACache > >
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 30 of file BJetEnergyRegressionMVA.cc.

Constructor & Destructor Documentation

◆ BJetEnergyRegressionMVA()

BJetEnergyRegressionMVA::BJetEnergyRegressionMVA ( const edm::ParameterSet iConfig,
const BaseMVACache cache 
)
inlineexplicit

Definition at line 32 of file BJetEnergyRegressionMVA.cc.

34  pvsrc_(consumes<std::vector<reco::Vertex>>(iConfig.getParameter<edm::InputTag>("pvsrc"))),
35  svsrc_(consumes<edm::View<reco::VertexCompositePtrCandidate>>(iConfig.getParameter<edm::InputTag>("svsrc"))),
36  rhosrc_(consumes<double>(iConfig.getParameter<edm::InputTag>("rhosrc"))) {}
const edm::EDGetTokenT< edm::View< reco::VertexCompositePtrCandidate > > svsrc_
edm::EDGetTokenT< double > rhosrc_
const edm::EDGetTokenT< std::vector< reco::Vertex > > pvsrc_
def cache(function)
Definition: utilities.py:3

Member Function Documentation

◆ fillAdditionalVariables()

void BJetEnergyRegressionMVA::fillAdditionalVariables ( const pat::Jet j)
inlineoverridevirtual

Reimplemented from BaseMVAValueMapProducer< pat::Jet >.

Definition at line 44 of file BJetEnergyRegressionMVA.cc.

References funct::abs(), ztail::d, PbPb_ZMuSkimMuonDPG_cff::deltaR, dqmiolumiharvest::j, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, EgammaValidation_cff::pdgid, edm::Handle< T >::product(), pvs_, rho_, and BaseMVAValueMapProducer< pat::Jet >::setValue().

44  {
45  this->setValue("nPVs", pvs_->size());
46  this->setValue("rho", *(rho_.product()));
47 
48  float cone_boundaries[] = {0.05, 0.1, 0.2, 0.3, 0.4};
49  size_t ncone_boundaries = sizeof(cone_boundaries) / sizeof(float);
50  std::vector<float> emFractionEnergyRings(ncone_boundaries + 1);
51  std::vector<float> chFractionEnergyRings(ncone_boundaries + 1);
52  std::vector<float> neFractionEnergyRings(ncone_boundaries + 1);
53  std::vector<float> muFractionEnergyRings(ncone_boundaries + 1);
54  float jetRawEnergy = j.p4().E() * j.jecFactor("Uncorrected");
55  int numDaughtersPt03 = 0;
56  for (unsigned int ijcone = 0; ijcone < ncone_boundaries; ijcone++) {
57  emFractionEnergyRings[ijcone] = 0;
58  muFractionEnergyRings[ijcone] = 0;
59  chFractionEnergyRings[ijcone] = 0;
60  neFractionEnergyRings[ijcone] = 0;
61  }
62  for (const auto& d : j.daughterPtrVector()) {
63  float candDr = Geom::deltaR(d->p4(), j.p4());
64  size_t icone =
65  std::lower_bound(&cone_boundaries[0], &cone_boundaries[ncone_boundaries], candDr) - &cone_boundaries[0];
66  float candEnergy = d->energy() / jetRawEnergy;
67  int pdgid = abs(d->pdgId());
68  if (pdgid == 22 || pdgid == 11) {
69  emFractionEnergyRings[icone] += candEnergy;
70  } else if (pdgid == 13) {
71  muFractionEnergyRings[icone] += candEnergy;
72  } else if (d->charge() != 0) {
73  chFractionEnergyRings[icone] += candEnergy;
74  } else {
75  neFractionEnergyRings[icone] += candEnergy;
76  }
77  if (d->pt() > 0.3)
78  numDaughtersPt03 += 1;
79  } // end of jet daughters loop
80 
81  this->setValue("Jet_energyRing_dR0_em_Jet_rawEnergy", emFractionEnergyRings[0]);
82  this->setValue("Jet_energyRing_dR1_em_Jet_rawEnergy", emFractionEnergyRings[1]);
83  this->setValue("Jet_energyRing_dR2_em_Jet_rawEnergy", emFractionEnergyRings[2]);
84  this->setValue("Jet_energyRing_dR3_em_Jet_rawEnergy", emFractionEnergyRings[3]);
85  this->setValue("Jet_energyRing_dR4_em_Jet_rawEnergy", emFractionEnergyRings[4]);
86  // this->setValue("Jet_energyRing_dR5_em_Jet_rawEnergy", emFractionEnergyRings[5]);
87 
88  this->setValue("Jet_energyRing_dR0_ch_Jet_rawEnergy", chFractionEnergyRings[0]);
89  this->setValue("Jet_energyRing_dR1_ch_Jet_rawEnergy", chFractionEnergyRings[1]);
90  this->setValue("Jet_energyRing_dR2_ch_Jet_rawEnergy", chFractionEnergyRings[2]);
91  this->setValue("Jet_energyRing_dR3_ch_Jet_rawEnergy", chFractionEnergyRings[3]);
92  this->setValue("Jet_energyRing_dR4_ch_Jet_rawEnergy", chFractionEnergyRings[4]);
93  // this->setValue("Jet_energyRing_dR5_ch_Jet_rawEnergy", chFractionEnergyRings[5]);
94 
95  this->setValue("Jet_energyRing_dR0_mu_Jet_rawEnergy", muFractionEnergyRings[0]);
96  this->setValue("Jet_energyRing_dR1_mu_Jet_rawEnergy", muFractionEnergyRings[1]);
97  this->setValue("Jet_energyRing_dR2_mu_Jet_rawEnergy", muFractionEnergyRings[2]);
98  this->setValue("Jet_energyRing_dR3_mu_Jet_rawEnergy", muFractionEnergyRings[3]);
99  this->setValue("Jet_energyRing_dR4_mu_Jet_rawEnergy", muFractionEnergyRings[4]);
100  // this->setValue("Jet_energyRing_dR5_mu_Jet_rawEnergy", muFractionEnergyRings[5]);
101 
102  this->setValue("Jet_energyRing_dR0_neut_Jet_rawEnergy", neFractionEnergyRings[0]);
103  this->setValue("Jet_energyRing_dR1_neut_Jet_rawEnergy", neFractionEnergyRings[1]);
104  this->setValue("Jet_energyRing_dR2_neut_Jet_rawEnergy", neFractionEnergyRings[2]);
105  this->setValue("Jet_energyRing_dR3_neut_Jet_rawEnergy", neFractionEnergyRings[3]);
106  this->setValue("Jet_energyRing_dR4_neut_Jet_rawEnergy", neFractionEnergyRings[4]);
107  // this->setValue("Jet_energyRing_dR5_neut_Jet_rawEnergy", neFractionEnergyRings[5]);
108 
109  this->setValue("Jet_numDaughters_pt03", numDaughtersPt03);
110  }
T const * product() const
Definition: Handle.h:70
void setValue(const std::string var, float val)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::Handle< std::vector< reco::Vertex > > pvs_
d
Definition: ztail.py:151

◆ fillDescriptions()

static void BJetEnergyRegressionMVA::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
inlinestatic

Definition at line 112 of file BJetEnergyRegressionMVA.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and BaseMVAValueMapProducer< T >::getDescription().

112  {
114  desc.add<edm::InputTag>("pvsrc")->setComment("primary vertices input collection");
115  desc.add<edm::InputTag>("svsrc")->setComment("secondary vertices input collection");
116  desc.add<edm::InputTag>("rhosrc")->setComment("rho input collection");
117  descriptions.add("BJetEnergyRegressionMVA", desc);
118  }
static edm::ParameterSetDescription getDescription()
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ readAdditionalCollections()

void BJetEnergyRegressionMVA::readAdditionalCollections ( edm::Event ,
const edm::EventSetup  
)
inlineoverridevirtual

to be implemented in derived classes, filling values for additional variables

Reimplemented from BaseMVAValueMapProducer< pat::Jet >.

Definition at line 38 of file BJetEnergyRegressionMVA.cc.

References iEvent, pvs_, pvsrc_, rho_, rhosrc_, svs_, and svsrc_.

38  {
39  iEvent.getByToken(pvsrc_, pvs_);
40  iEvent.getByToken(svsrc_, svs_);
41  iEvent.getByToken(rhosrc_, rho_);
42  }
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< edm::View< reco::VertexCompositePtrCandidate > > svsrc_
edm::Handle< std::vector< reco::Vertex > > pvs_
edm::Handle< edm::View< reco::VertexCompositePtrCandidate > > svs_
edm::EDGetTokenT< double > rhosrc_
const edm::EDGetTokenT< std::vector< reco::Vertex > > pvsrc_

Member Data Documentation

◆ pvs_

edm::Handle<std::vector<reco::Vertex> > BJetEnergyRegressionMVA::pvs_
private

◆ pvsrc_

const edm::EDGetTokenT<std::vector<reco::Vertex> > BJetEnergyRegressionMVA::pvsrc_
private

Definition at line 121 of file BJetEnergyRegressionMVA.cc.

Referenced by readAdditionalCollections().

◆ rho_

edm::Handle<double> BJetEnergyRegressionMVA::rho_
private

◆ rhosrc_

edm::EDGetTokenT<double> BJetEnergyRegressionMVA::rhosrc_
private

Definition at line 125 of file BJetEnergyRegressionMVA.cc.

Referenced by readAdditionalCollections().

◆ svs_

edm::Handle<edm::View<reco::VertexCompositePtrCandidate> > BJetEnergyRegressionMVA::svs_
private

Definition at line 124 of file BJetEnergyRegressionMVA.cc.

Referenced by readAdditionalCollections().

◆ svsrc_

const edm::EDGetTokenT<edm::View<reco::VertexCompositePtrCandidate> > BJetEnergyRegressionMVA::svsrc_
private

Definition at line 123 of file BJetEnergyRegressionMVA.cc.

Referenced by readAdditionalCollections().