108 auto pOut = std::make_unique<reco::JPTJetCollection>();
109 auto pOut1 = std::make_unique<reco::CaloJetCollection>();
111 double scaleJPT = 1.;
115 for (
auto const& oldjet : addjets_h) {
124 auto const& mycalo = addjets_h[icalo];
125 std::vector<edm::Ptr<reco::Track> > tracksinjet =
jet.tracks();
128 for (
auto const& itrack : tracksinjet) {
129 for (
auto const& ixtrp : iExtrapolations) {
130 if (ixtrp.positions().empty())
133 double mydphi =
deltaPhi(ixtrp.track()->phi(), itrack->phi());
134 if (fabs(ixtrp.track()->pt() - itrack->pt()) > 0.001 || fabs(ixtrp.track()->eta() - itrack->eta()) > 0.001 ||
138 if (itrack.id() != ixtrp.track().id() || itrack.key() != ixtrp.track().key())
172 reco::JPTJet fJet(
p4,
jet.primaryVertex()->position(), jptspe, mycalo.getJetConstituents());
173 pOut->push_back(fJet);
174 pOut1->push_back(mycalo);
179 for (
auto const& oldjet : jets_h) {
183 double factorZSP = 1.;
201 corrected.
py() * scaleJPT,
202 corrected.
pz() * scaleJPT,
203 corrected.
energy() * scaleJPT);
235 double deEta2Tr = 0.;
236 double dePhi2Tr = 0.;
240 double denominator_tracks = 0.;
245 double deR =
deltaR((*it)->eta(), (*it)->phi(),
p4.eta(),
p4.phi());
246 double deEta = (*it)->eta() -
p4.eta();
247 double dePhi =
deltaPhi((*it)->phi(),
p4.phi());
248 if ((**it).ptError() / (**it).pt() < 0.1) {
249 deR2Tr = deR2Tr + deR * deR * (*it)->pt();
250 deEta2Tr = deEta2Tr + deEta * deEta * (*it)->pt();
251 dePhi2Tr = dePhi2Tr + dePhi * dePhi * (*it)->pt();
252 denominator_tracks = denominator_tracks + (*it)->pt();
253 Zch = Zch + (*it)->pt();
255 Pout2 = Pout2 + (**it).p() * (**it).p() - (Zch *
p4.P()) * (Zch *
p4.P());
262 double deR =
deltaR((*it)->eta(), (*it)->phi(),
p4.eta(),
p4.phi());
263 double deEta = (*it)->eta() -
p4.eta();
264 double dePhi =
deltaPhi((*it)->phi(),
p4.phi());
265 if ((**it).ptError() / (**it).pt() < 0.1) {
266 deR2Tr = deR2Tr + deR * deR * (*it)->pt();
267 deEta2Tr = deEta2Tr + deEta * deEta * (*it)->pt();
268 dePhi2Tr = dePhi2Tr + dePhi * dePhi * (*it)->pt();
269 denominator_tracks = denominator_tracks + (*it)->pt();
270 Zch = Zch + (*it)->pt();
272 Pout2 = Pout2 + (**it).p() * (**it).p() - (Zch *
p4.P()) * (Zch *
p4.P());
278 double deR =
deltaR((*it)->eta(), (*it)->phi(),
p4.eta(),
p4.phi());
279 double deEta = (*it)->eta() -
p4.eta();
280 double dePhi =
deltaPhi((*it)->phi(),
p4.phi());
281 if ((**it).ptError() / (**it).pt() < 0.1) {
282 deR2Tr = deR2Tr + deR * deR * (*it)->pt();
283 deEta2Tr = deEta2Tr + deEta * deEta * (*it)->pt();
284 dePhi2Tr = dePhi2Tr + dePhi * dePhi * (*it)->pt();
285 denominator_tracks = denominator_tracks + (*it)->pt();
286 Zch = Zch + (*it)->pt();
288 Pout2 = Pout2 + (**it).p() * (**it).p() - (Zch *
p4.P()) * (Zch *
p4.P());
295 Zch = Zch + (*it)->pt();
298 it !=
muons.inVertexOutOfCalo_.end();
300 Zch = Zch + (*it)->pt();
303 it !=
elecs.inVertexOutOfCalo_.end();
305 Zch = Zch + (*it)->pt();
314 if (denominator_tracks != 0) {
315 deR2Tr = deR2Tr / denominator_tracks;
316 deEta2Tr = deEta2Tr / denominator_tracks;
317 dePhi2Tr = dePhi2Tr / denominator_tracks;
341 pOut->push_back(fJet);