51 float cone_boundaries[] = {0.05, 0.1, 0.2, 0.3, 0.4};
52 size_t ncone_boundaries =
sizeof(cone_boundaries) /
sizeof(
float);
53 std::vector<float> emFractionEnergyRings(ncone_boundaries + 1);
54 std::vector<float> chFractionEnergyRings(ncone_boundaries + 1);
55 std::vector<float> neFractionEnergyRings(ncone_boundaries + 1);
56 std::vector<float> muFractionEnergyRings(ncone_boundaries + 1);
57 float jetRawEnergy = j.
p4().E() * j.
jecFactor(
"Uncorrected");
58 int numDaughtersPt03 = 0;
59 for (
unsigned int ijcone = 0; ijcone < ncone_boundaries; ijcone++) {
60 emFractionEnergyRings[ijcone] = 0;
61 muFractionEnergyRings[ijcone] = 0;
62 chFractionEnergyRings[ijcone] = 0;
63 neFractionEnergyRings[ijcone] = 0;
68 std::lower_bound(&cone_boundaries[0], &cone_boundaries[ncone_boundaries], candDr) - &cone_boundaries[0];
69 float candEnergy =
d->energy() / jetRawEnergy;
71 if (pdgid == 22 || pdgid == 11) {
72 emFractionEnergyRings[icone] += candEnergy;
73 }
else if (pdgid == 13) {
74 muFractionEnergyRings[icone] += candEnergy;
75 }
else if (
d->charge() != 0) {
76 chFractionEnergyRings[icone] += candEnergy;
78 neFractionEnergyRings[icone] += candEnergy;
81 numDaughtersPt03 += 1;
84 this->
setValue(
"Jet_energyRing_dR0_em_Jet_rawEnergy", emFractionEnergyRings[0]);
85 this->
setValue(
"Jet_energyRing_dR1_em_Jet_rawEnergy", emFractionEnergyRings[1]);
86 this->
setValue(
"Jet_energyRing_dR2_em_Jet_rawEnergy", emFractionEnergyRings[2]);
87 this->
setValue(
"Jet_energyRing_dR3_em_Jet_rawEnergy", emFractionEnergyRings[3]);
88 this->
setValue(
"Jet_energyRing_dR4_em_Jet_rawEnergy", emFractionEnergyRings[4]);
91 this->
setValue(
"Jet_energyRing_dR0_ch_Jet_rawEnergy", chFractionEnergyRings[0]);
92 this->
setValue(
"Jet_energyRing_dR1_ch_Jet_rawEnergy", chFractionEnergyRings[1]);
93 this->
setValue(
"Jet_energyRing_dR2_ch_Jet_rawEnergy", chFractionEnergyRings[2]);
94 this->
setValue(
"Jet_energyRing_dR3_ch_Jet_rawEnergy", chFractionEnergyRings[3]);
95 this->
setValue(
"Jet_energyRing_dR4_ch_Jet_rawEnergy", chFractionEnergyRings[4]);
98 this->
setValue(
"Jet_energyRing_dR0_mu_Jet_rawEnergy", muFractionEnergyRings[0]);
99 this->
setValue(
"Jet_energyRing_dR1_mu_Jet_rawEnergy", muFractionEnergyRings[1]);
100 this->
setValue(
"Jet_energyRing_dR2_mu_Jet_rawEnergy", muFractionEnergyRings[2]);
101 this->
setValue(
"Jet_energyRing_dR3_mu_Jet_rawEnergy", muFractionEnergyRings[3]);
102 this->
setValue(
"Jet_energyRing_dR4_mu_Jet_rawEnergy", muFractionEnergyRings[4]);
105 this->
setValue(
"Jet_energyRing_dR0_neut_Jet_rawEnergy", neFractionEnergyRings[0]);
106 this->
setValue(
"Jet_energyRing_dR1_neut_Jet_rawEnergy", neFractionEnergyRings[1]);
107 this->
setValue(
"Jet_energyRing_dR2_neut_Jet_rawEnergy", neFractionEnergyRings[2]);
108 this->
setValue(
"Jet_energyRing_dR3_neut_Jet_rawEnergy", neFractionEnergyRings[3]);
109 this->
setValue(
"Jet_energyRing_dR4_neut_Jet_rawEnergy", neFractionEnergyRings[4]);
112 this->
setValue(
"Jet_numDaughters_pt03", numDaughtersPt03);
117 desc.
add<
edm::InputTag>(
"pvsrc")->setComment(
"primary vertices input collection");
118 desc.
add<
edm::InputTag>(
"svsrc")->setComment(
"secondary vertices input collection");
120 descriptions.
add(
"BJetEnergyRegressionMVA", desc);
static edm::ParameterSetDescription getDescription()
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::Handle< double > rho_
void setValue(const std::string var, float val)
#define DEFINE_FWK_MODULE(type)
const edm::EDGetTokenT< edm::View< reco::VertexCompositePtrCandidate > > svsrc_
Abs< T >::type abs(const T &t)
const LorentzVector & p4() const final
four-momentum Lorentz vector
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)
BJetEnergyRegressionMVA(const edm::ParameterSet &iConfig)
void readAdditionalCollections(edm::Event &iEvent, const edm::EventSetup &) override
to be implemented in derived classes, filling values for additional variables
float jecFactor(const std::string &level, const std::string &flavor="none", const std::string &set="") const
const reco::CompositePtrCandidate::daughters & daughterPtrVector() const override
references to daughtes
void fillAdditionalVariables(const pat::Jet &j) override