228 const auto *patJet =
dynamic_cast<const pat::Jet *
>(&
jet);
240 const float etasign = jet.
eta() > 0 ? 1 : -1;
242 std::map<reco::CandidatePtr::key_type, float> puppi_wgt_cache;
248 wgt = pack_cand->puppiWeight();
249 }
else if (reco_cand) {
251 wgt = (*puppi_value_map_)[
cand];
259 puppi_wgt_cache[
cand.key()] = wgt;
263 std::vector<reco::CandidatePtr>
daughters;
277 trkinfo.buildTrackInfo(&(*
cand), jet_dir, jet_ref_track_dir, *
pv_);
281 daughters.push_back(
cand);
284 std::vector<btagbtvdeep::SortingClass<reco::CandidatePtr>> c_sorted;
287 for (
const auto &
cand : daughters) {
289 trkinfo.buildTrackInfo(&(*
cand), jet_dir, jet_ref_track_dir, *
pv_);
290 c_sorted.emplace_back(
cand,
291 trkinfo.getTrackSip2dSig(),
296 for (
unsigned int i = 0;
i < c_sorted.size();
i++) {
297 const auto &
c = c_sorted.at(
i);
298 const auto &
cand =
c.get();
299 daughters.at(
i) =
cand;
307 return puppi_wgt_cache.at(a.
key()) * a->pt() > puppi_wgt_cache.at(
b.key()) *
b->pt();
311 std::sort(daughters.begin(), daughters.end(), [](
const auto &
a,
const auto &
b) {
return a->pt() >
b->pt(); });
321 const auto *trk = reco_cand->bestTrack();
325 for (
const auto &
cand : daughters) {
330 ((packed_cand && !packed_cand->hasTrackDetails()) || (reco_cand && !useTrackProperties(reco_cand))))
337 float hcal_fraction = 0.;
338 if (packed_cand->pdgId() == 1 || packed_cand->pdgId() == 130) {
339 hcal_fraction = packed_cand->hcalFraction();
340 }
else if (packed_cand->isIsolatedChargedHadron()) {
341 hcal_fraction = packed_cand->rawHcalFraction();
344 fts.
fill(
"pfcand_hcalFrac", hcal_fraction);
345 fts.
fill(
"pfcand_VTX_ass", packed_cand->pvAssociationQuality());
346 fts.
fill(
"pfcand_lostInnerHits", packed_cand->lostInnerHits());
347 fts.
fill(
"pfcand_quality", packed_cand->bestTrack() ? packed_cand->bestTrack()->qualityMask() : 0);
349 fts.
fill(
"pfcand_charge", packed_cand->charge());
350 fts.
fill(
"pfcand_isEl",
std::abs(packed_cand->pdgId()) == 11);
351 fts.
fill(
"pfcand_isMu",
std::abs(packed_cand->pdgId()) == 13);
352 fts.
fill(
"pfcand_isChargedHad",
std::abs(packed_cand->pdgId()) == 211);
353 fts.
fill(
"pfcand_isGamma",
std::abs(packed_cand->pdgId()) == 22);
354 fts.
fill(
"pfcand_isNeutralHad",
std::abs(packed_cand->pdgId()) == 130);
357 fts.
fill(
"pfcand_dz", ip_sign * packed_cand->dz());
358 fts.
fill(
"pfcand_dxy", ip_sign * packed_cand->dxy());
359 fts.
fill(
"pfcand_dzsig", packed_cand->bestTrack() ? ip_sign * packed_cand->dz() / packed_cand->dzError() : 0);
360 fts.
fill(
"pfcand_dxysig", packed_cand->bestTrack() ? ip_sign * packed_cand->dxy() / packed_cand->dxyError() : 0);
362 }
else if (reco_cand) {
364 int pv_ass_quality = 0;
367 pv_ass_quality = (*pvasq_value_map_)[
cand];
374 fts.
fill(
"pfcand_hcalFrac", reco_cand->hcalEnergy() / (reco_cand->ecalEnergy() + reco_cand->hcalEnergy()));
375 fts.
fill(
"pfcand_VTX_ass", vtx_ass);
379 fts.
fill(
"pfcand_charge", reco_cand->charge());
380 fts.
fill(
"pfcand_isEl",
std::abs(reco_cand->pdgId()) == 11);
381 fts.
fill(
"pfcand_isMu",
std::abs(reco_cand->pdgId()) == 13);
382 fts.
fill(
"pfcand_isChargedHad",
std::abs(reco_cand->pdgId()) == 211);
383 fts.
fill(
"pfcand_isGamma",
std::abs(reco_cand->pdgId()) == 22);
384 fts.
fill(
"pfcand_isNeutralHad",
std::abs(reco_cand->pdgId()) == 130);
387 const auto *trk = reco_cand->bestTrack();
390 fts.
fill(
"pfcand_dz", dz);
391 fts.
fill(
"pfcand_dzsig", trk ? dz / trk->dzError() : 0);
392 fts.
fill(
"pfcand_dxy", dxy);
393 fts.
fill(
"pfcand_dxysig", trk ? dxy / trk->dxyError() : 0);
397 fts.
fill(
"pfcand_puppiw", puppi_wgt_cache.at(
cand.key()));
399 fts.
fill(
"pfcand_etarel", etasign * (candP4.eta() - jet.
eta()));
404 fts.
fill(
"pfcand_ptrel", candP4.pt() / jet.
pt());
406 fts.
fill(
"pfcand_erel", candP4.energy() / jet.
energy());
409 fts.
fill(
"pfcand_mask", 1);
414 fts.
fill(
"pfcand_drminsv", drminpfcandsv);
417 if (patJet->nSubjetCollections() > 0) {
418 auto subjets = patJet->subjets();
420 return p1->
pt() >
p2->pt();
425 fts.
fill(
"pfcand_drsubjet1", -1);
426 fts.
fill(
"pfcand_drsubjet2", -1);
431 trk = packed_cand->bestTrack();
432 }
else if (reco_cand && useTrackProperties(reco_cand)) {
433 trk = reco_cand->bestTrack();
439 auto cov = [&](
unsigned i,
unsigned j) {
return trk->
covariance(i, j); };
440 fts.
fill(
"pfcand_dptdpt", cov(0, 0));
441 fts.
fill(
"pfcand_detadeta", cov(1, 1));
442 fts.
fill(
"pfcand_dphidphi", cov(2, 2));
443 fts.
fill(
"pfcand_dxydxy", cov(3, 3));
444 fts.
fill(
"pfcand_dzdz", cov(4, 4));
445 fts.
fill(
"pfcand_dxydz", cov(3, 4));
446 fts.
fill(
"pfcand_dphidxy", cov(2, 3));
447 fts.
fill(
"pfcand_dlambdadz", cov(1, 4));
450 trkinfo.buildTrackInfo(&(*
cand), jet_dir, jet_ref_track_dir, *
pv_);
451 fts.
fill(
"pfcand_btagEtaRel", trkinfo.getTrackEtaRel());
452 fts.
fill(
"pfcand_btagPtRatio", trkinfo.getTrackPtRatio());
453 fts.
fill(
"pfcand_btagPParRatio", trkinfo.getTrackPParRatio());
454 fts.
fill(
"pfcand_btagSip2dVal", ip_sign * trkinfo.getTrackSip2dVal());
455 fts.
fill(
"pfcand_btagSip2dSig", ip_sign * trkinfo.getTrackSip2dSig());
456 fts.
fill(
"pfcand_btagSip3dVal", ip_sign * trkinfo.getTrackSip3dVal());
457 fts.
fill(
"pfcand_btagSip3dSig", ip_sign * trkinfo.getTrackSip3dSig());
458 fts.
fill(
"pfcand_btagJetDistVal", trkinfo.getTrackJetDistVal());
460 fts.
fill(
"pfcand_normchi2", 999);
462 fts.
fill(
"pfcand_dptdpt", 0);
463 fts.
fill(
"pfcand_detadeta", 0);
464 fts.
fill(
"pfcand_dphidphi", 0);
465 fts.
fill(
"pfcand_dxydxy", 0);
466 fts.
fill(
"pfcand_dzdz", 0);
467 fts.
fill(
"pfcand_dxydz", 0);
468 fts.
fill(
"pfcand_dphidxy", 0);
469 fts.
fill(
"pfcand_dlambdadz", 0);
471 fts.
fill(
"pfcand_btagEtaRel", 0);
472 fts.
fill(
"pfcand_btagPtRatio", 0);
473 fts.
fill(
"pfcand_btagPParRatio", 0);
474 fts.
fill(
"pfcand_btagSip2dVal", 0);
475 fts.
fill(
"pfcand_btagSip2dSig", 0);
476 fts.
fill(
"pfcand_btagSip3dVal", 0);
477 fts.
fill(
"pfcand_btagSip3dSig", 0);
478 fts.
fill(
"pfcand_btagJetDistVal", 0);
constexpr double deltaPhi(double phi1, double phi2)
float quality_from_pfcand(const reco::PFCandidate &pfcand)
double eta() const final
momentum pseudorapidity
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
static const std::vector< std::string > particle_features_
bool use_pvasq_value_map_
double px() const final
x coordinate of momentum vector
double pt() const final
transverse momentum
bool use_puppi_value_map_
const Point & position() const
position
virtual const daughters & daughterPtrVector() const
references to daughtes
size_t numberOfDaughters() const override
number of daughters
const bool include_neutrals_
Vector momentum() const final
spatial momentum vector
edm::ESHandle< TransientTrackBuilder > track_builder_
float mindrsvpfcand(const std::vector< reco::VertexCompositePtrCandidate > &svs, const reco::Candidate *cand, float mindr=0.4)
void reserve(const std::string &name, unsigned capacity)
double pz() const final
z coordinate of momentum vector
CovarianceMatrix covariance() const
return track covariance matrix
double energy() const final
energy
Abs< T >::type abs(const T &t)
float vtx_ass_from_pfcand(const reco::PFCandidate &pfcand, int pv_ass_quality, const reco::VertexRef &pv)
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
XYZVectorD XYZVector
spatial vector with cartesian internal representation
edm::Handle< SVCollection > svs_
edm::Handle< CandidateView > pfcands_
double py() const final
y coordinate of momentum vector
Analysis-level calorimeter jet class.
void fill(const std::string &name, float value)
float lost_inner_hits_from_pfcand(const reco::PFCandidate &pfcand)
const double max_sip3dsig_
Particle reconstructed by the particle flow algorithm.
const double min_pt_for_track_properties_
const double min_puppi_wgt_
const bool sort_by_sip2dsig_