35 svsrc_(consumes<edm::
View<
reco::VertexCompositePtrCandidate>>(iConfig.getParameter<edm::
InputTag>(
"svsrc"))),
36 rhosrc_(consumes<double>(iConfig.getParameter<edm::
InputTag>(
"rhosrc"))) {}
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;
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;
75 neFractionEnergyRings[icone] += candEnergy;
78 numDaughtersPt03 += 1;
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]);
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]);
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]);
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]);
109 this->
setValue(
"Jet_numDaughters_pt03", numDaughtersPt03);
114 desc.
add<
edm::InputTag>(
"pvsrc")->setComment(
"primary vertices input collection");
115 desc.
add<
edm::InputTag>(
"svsrc")->setComment(
"secondary vertices input collection");
117 descriptions.
add(
"BJetEnergyRegressionMVA", desc);
static edm::ParameterSetDescription getDescription()
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
edm::Handle< double > rho_
void setValue(const std::string var, float val)
const LorentzVector & p4() const final
four-momentum Lorentz vector
const edm::EDGetTokenT< edm::View< reco::VertexCompositePtrCandidate > > svsrc_
Abs< T >::type abs(const T &t)
BJetEnergyRegressionMVA(const edm::ParameterSet &iConfig, const BaseMVACache *cache)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::Handle< std::vector< reco::Vertex > > pvs_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::Handle< edm::View< reco::VertexCompositePtrCandidate > > svs_
edm::EDGetTokenT< double > rhosrc_
const edm::EDGetTokenT< std::vector< reco::Vertex > > pvsrc_
T const * product() const
Analysis-level calorimeter jet class.
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const reco::CompositePtrCandidate::daughters & daughterPtrVector() const override
references to daughtes
void readAdditionalCollections(edm::Event &iEvent, const edm::EventSetup &) override
to be implemented in derived classes, filling values for additional variables
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
float jecFactor(const std::string &level, const std::string &flavor="none", const std::string &set="") const
void fillAdditionalVariables(const pat::Jet &j) override