56 float cone_boundaries[] = { 0.05, 0.1, 0.2, 0.3,0.4 };
57 size_t ncone_boundaries =
sizeof(cone_boundaries)/
sizeof(
float);
58 std::vector<float> emFractionEnergyRings(ncone_boundaries+1);
59 std::vector<float> chFractionEnergyRings(ncone_boundaries+1);
60 std::vector<float> neFractionEnergyRings(ncone_boundaries+1);
61 std::vector<float> muFractionEnergyRings(ncone_boundaries+1);
62 float jetRawEnergy=j.
p4().E()*j.
jecFactor(
"Uncorrected");
63 int numDaughtersPt03=0;
64 for (
unsigned int ijcone = 0; ijcone<ncone_boundaries; ijcone++){
65 emFractionEnergyRings[ijcone] = 0;
66 muFractionEnergyRings[ijcone] = 0;
67 chFractionEnergyRings[ijcone] = 0;
68 neFractionEnergyRings[ijcone] = 0;
72 size_t icone = std::lower_bound(&cone_boundaries[0],&cone_boundaries[ncone_boundaries],candDr) - &cone_boundaries[0];
73 float candEnergy =
d->energy()/jetRawEnergy;
75 if( pdgid == 22 || pdgid == 11 ) {
76 emFractionEnergyRings[icone] += candEnergy;
77 }
else if ( pdgid == 13 ) {
78 muFractionEnergyRings[icone] += candEnergy;
79 }
else if (
d->charge() != 0 ) {
80 chFractionEnergyRings[icone] += candEnergy;
82 neFractionEnergyRings[icone] += candEnergy;
84 if(
d->pt()>0.3) numDaughtersPt03+=1;
87 this->
setValue(
"Jet_energyRing_dR0_em_Jet_rawEnergy", emFractionEnergyRings[0]);
88 this->
setValue(
"Jet_energyRing_dR1_em_Jet_rawEnergy", emFractionEnergyRings[1]);
89 this->
setValue(
"Jet_energyRing_dR2_em_Jet_rawEnergy", emFractionEnergyRings[2]);
90 this->
setValue(
"Jet_energyRing_dR3_em_Jet_rawEnergy", emFractionEnergyRings[3]);
91 this->
setValue(
"Jet_energyRing_dR4_em_Jet_rawEnergy", emFractionEnergyRings[4]);
94 this->
setValue(
"Jet_energyRing_dR0_ch_Jet_rawEnergy", chFractionEnergyRings[0]);
95 this->
setValue(
"Jet_energyRing_dR1_ch_Jet_rawEnergy", chFractionEnergyRings[1]);
96 this->
setValue(
"Jet_energyRing_dR2_ch_Jet_rawEnergy", chFractionEnergyRings[2]);
97 this->
setValue(
"Jet_energyRing_dR3_ch_Jet_rawEnergy", chFractionEnergyRings[3]);
98 this->
setValue(
"Jet_energyRing_dR4_ch_Jet_rawEnergy", chFractionEnergyRings[4]);
101 this->
setValue(
"Jet_energyRing_dR0_mu_Jet_rawEnergy", muFractionEnergyRings[0]);
102 this->
setValue(
"Jet_energyRing_dR1_mu_Jet_rawEnergy", muFractionEnergyRings[1]);
103 this->
setValue(
"Jet_energyRing_dR2_mu_Jet_rawEnergy", muFractionEnergyRings[2]);
104 this->
setValue(
"Jet_energyRing_dR3_mu_Jet_rawEnergy", muFractionEnergyRings[3]);
105 this->
setValue(
"Jet_energyRing_dR4_mu_Jet_rawEnergy", muFractionEnergyRings[4]);
108 this->
setValue(
"Jet_energyRing_dR0_neut_Jet_rawEnergy", neFractionEnergyRings[0]);
109 this->
setValue(
"Jet_energyRing_dR1_neut_Jet_rawEnergy", neFractionEnergyRings[1]);
110 this->
setValue(
"Jet_energyRing_dR2_neut_Jet_rawEnergy", neFractionEnergyRings[2]);
111 this->
setValue(
"Jet_energyRing_dR3_neut_Jet_rawEnergy", neFractionEnergyRings[3]);
112 this->
setValue(
"Jet_energyRing_dR4_neut_Jet_rawEnergy", neFractionEnergyRings[4]);
115 this->
setValue(
"Jet_numDaughters_pt03",numDaughtersPt03);
121 desc.
add<
edm::InputTag>(
"pvsrc")->setComment(
"primary vertices input collection");
122 desc.
add<
edm::InputTag>(
"svsrc")->setComment(
"secondary vertices input collection");
124 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 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)
double deltaR(double eta1, double eta2, double phi1, double phi2)
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