83 std::vector<float> jet_leadConstNeHadEF(
jets->size(), 0.f);
84 std::vector<float> jet_leadConstNeHadPuppiWeight(
jets->size(), 0.f);
86 std::vector<float> jet_leadConstChHadEF(
jets->size(), 0.f);
87 std::vector<float> jet_leadConstChHadPuppiWeight(
jets->size(), 0.f);
89 std::vector<float> jet_leadConstPhotonEF(
jets->size(), 0.f);
90 std::vector<float> jet_leadConstPhotonPuppiWeight(
jets->size(), 0.f);
92 std::vector<float> jet_leadConstElectronEF(
jets->size(), 0.f);
93 std::vector<float> jet_leadConstElectronPuppiWeight(
jets->size(), 0.f);
95 std::vector<float> jet_leadConstMuonEF(
jets->size(), 0.f);
96 std::vector<float> jet_leadConstMuonPuppiWeight(
jets->size(), 0.f);
98 std::vector<float> jet_leadConstHFHADEF(
jets->size(), 0.f);
99 std::vector<float> jet_leadConstHFHADPuppiWeight(
jets->size(), 0.f);
101 std::vector<float> jet_leadConstHFEMEF(
jets->size(), 0.f);
102 std::vector<float> jet_leadConstHFEMPuppiWeight(
jets->size(), 0.f);
105 for (std::size_t jet_idx = 0; jet_idx <
jets->size(); jet_idx++) {
106 const auto&
jet = (*jets)[jet_idx];
108 float jet_energy_raw =
jet.energy();
110 jet_energy_raw =
jet.correctedJet(0).energy();
121 float leadConstNeHadPuppiWeight = 1.f;
122 float leadConstChHadPuppiWeight = 1.f;
123 float leadConstPhotonPuppiWeight = 1.f;
124 float leadConstElectronPuppiWeight = 1.f;
125 float leadConstMuonPuppiWeight = 1.f;
126 float leadConstHFHADPuppiWeight = 1.f;
127 float leadConstHFEMPuppiWeight = 1.f;
139 puppiw = (*puppi_value_map_)[dau];
142 <<
"use fallback_puppi_weight option to use " << puppiw <<
" for cand as default";
148 if (
abs(dau->pdgId()) == 130) {
149 if (leadConstNeHad.
isNull() ||
150 (puppiw * dau->energy() > leadConstNeHadPuppiWeight * leadConstNeHad->energy())) {
151 leadConstNeHad = dau;
152 leadConstNeHadPuppiWeight = puppiw;
154 }
else if (
abs(dau->pdgId()) == 211) {
155 if (leadConstChHad.
isNull() ||
156 (puppiw * dau->energy() > leadConstChHadPuppiWeight * leadConstChHad->energy())) {
157 leadConstChHad = dau;
158 leadConstChHadPuppiWeight = puppiw;
160 }
else if (
abs(dau->pdgId()) == 22) {
161 if (leadConstPhoton.
isNull() ||
162 (puppiw * dau->energy() > leadConstPhotonPuppiWeight * leadConstPhoton->energy())) {
163 leadConstPhoton = dau;
164 leadConstPhotonPuppiWeight = puppiw;
166 }
else if (
abs(dau->pdgId()) == 11) {
167 if (leadConstElectron.
isNull() ||
168 (puppiw * dau->energy() > leadConstElectronPuppiWeight * leadConstElectron->energy())) {
169 leadConstElectron = dau;
170 leadConstElectronPuppiWeight = puppiw;
172 }
else if (
abs(dau->pdgId()) == 13) {
173 if (leadConstMuon.
isNull() || (puppiw * dau->energy() > leadConstMuonPuppiWeight * leadConstMuon->energy())) {
175 leadConstMuonPuppiWeight = puppiw;
177 }
else if (
abs(dau->pdgId()) == 1) {
178 if (leadConstHFHAD.
isNull() ||
179 (puppiw * dau->energy() > leadConstHFHADPuppiWeight * leadConstHFHAD->energy())) {
180 leadConstHFHAD = dau;
181 leadConstHFHADPuppiWeight = puppiw;
183 }
else if (
abs(dau->pdgId()) == 2) {
184 if (leadConstHFEM.
isNull() || (puppiw * dau->energy() > leadConstHFEMPuppiWeight * leadConstHFEM->energy())) {
186 leadConstHFEMPuppiWeight = puppiw;
192 jet_leadConstNeHadEF[jet_idx] = (leadConstNeHad->energy() * leadConstNeHadPuppiWeight) / jet_energy_raw;
193 jet_leadConstNeHadPuppiWeight[jet_idx] = leadConstNeHadPuppiWeight;
196 jet_leadConstChHadEF[jet_idx] = (leadConstChHad->energy() * leadConstChHadPuppiWeight) / jet_energy_raw;
197 jet_leadConstChHadPuppiWeight[jet_idx] = leadConstChHadPuppiWeight;
200 jet_leadConstPhotonEF[jet_idx] = (leadConstPhoton->energy() * leadConstPhotonPuppiWeight) / jet_energy_raw;
201 jet_leadConstPhotonPuppiWeight[jet_idx] = leadConstPhotonPuppiWeight;
204 jet_leadConstElectronEF[jet_idx] = (leadConstElectron->energy() * leadConstElectronPuppiWeight) / jet_energy_raw;
205 jet_leadConstElectronPuppiWeight[jet_idx] = leadConstElectronPuppiWeight;
208 jet_leadConstMuonEF[jet_idx] = (leadConstMuon->energy() * leadConstMuonPuppiWeight) / jet_energy_raw;
209 jet_leadConstMuonPuppiWeight[jet_idx] = leadConstMuonPuppiWeight;
212 jet_leadConstHFHADEF[jet_idx] = (leadConstHFHAD->energy() * leadConstHFHADPuppiWeight) / jet_energy_raw;
213 jet_leadConstHFHADPuppiWeight[jet_idx] = leadConstHFHADPuppiWeight;
216 jet_leadConstHFEMEF[jet_idx] = (leadConstHFEM->energy() * leadConstHFEMPuppiWeight) / jet_energy_raw;
217 jet_leadConstHFEMPuppiWeight[jet_idx] = leadConstHFEMPuppiWeight;
edm::EDGetTokenT< edm::View< T > > jet_token_
void PutValueMapInEvent(edm::Event &, const edm::Handle< edm::View< T >> &, const std::vector< float > &, std::string)
const bool fallback_puppi_weight_
bool isNull() const
Checks for null.
bool isNonnull() const
Checks for non-null.
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< edm::ValueMap< float > > puppi_value_map_token_
bool use_puppi_value_map_