16 embeddedIsolationTracks_(
false),
17 embeddedLeadTrack_(
false),
18 embeddedSignalTracks_(
false),
19 embeddedLeadPFCand_(
false),
20 embeddedLeadPFChargedHadrCand_(
false),
21 embeddedLeadPFNeutralCand_(
false),
22 embeddedSignalPFCands_(
false),
23 embeddedSignalPFChargedHadrCands_(
false),
24 embeddedSignalPFNeutralHadrCands_(
false),
25 embeddedSignalPFGammaCands_(
false),
26 embeddedIsolationPFCands_(
false),
27 embeddedIsolationPFChargedHadrCands_(
false),
28 embeddedIsolationPFNeutralHadrCands_(
false),
29 embeddedIsolationPFGammaCands_(
false) {}
34 embeddedIsolationTracks_(
false),
35 embeddedLeadTrack_(
false),
36 embeddedSignalTracks_(
false),
37 embeddedLeadPFCand_(
false),
38 embeddedLeadPFChargedHadrCand_(
false),
39 embeddedLeadPFNeutralCand_(
false),
40 embeddedSignalPFCands_(
false),
41 embeddedSignalPFChargedHadrCands_(
false),
42 embeddedSignalPFNeutralHadrCands_(
false),
43 embeddedSignalPFGammaCands_(
false),
44 embeddedIsolationPFCands_(
false),
45 embeddedIsolationPFChargedHadrCands_(
false),
46 embeddedIsolationPFNeutralHadrCands_(
false),
47 embeddedIsolationPFGammaCands_(
false) {
48 initFromBaseTau(aTau);
54 embeddedIsolationTracks_(
false),
55 embeddedLeadTrack_(
false),
56 embeddedSignalTracks_(
false),
57 embeddedLeadPFCand_(
false),
58 embeddedLeadPFChargedHadrCand_(
false),
59 embeddedLeadPFNeutralCand_(
false),
60 embeddedSignalPFCands_(
false),
61 embeddedSignalPFChargedHadrCands_(
false),
62 embeddedSignalPFNeutralHadrCands_(
false),
63 embeddedSignalPFGammaCands_(
false),
64 embeddedIsolationPFCands_(
false),
65 embeddedIsolationPFChargedHadrCands_(
false),
66 embeddedIsolationPFNeutralHadrCands_(
false),
67 embeddedIsolationPFGammaCands_(
false) {
68 initFromBaseTau(*aTauRef);
74 embeddedIsolationTracks_(
false),
75 embeddedLeadTrack_(
false),
76 embeddedSignalTracks_(
false),
77 embeddedLeadPFCand_(
false),
78 embeddedLeadPFChargedHadrCand_(
false),
79 embeddedLeadPFNeutralCand_(
false),
80 embeddedSignalPFCands_(
false),
81 embeddedSignalPFChargedHadrCands_(
false),
82 embeddedSignalPFNeutralHadrCands_(
false),
83 embeddedSignalPFGammaCands_(
false),
84 embeddedIsolationPFCands_(
false),
85 embeddedIsolationPFChargedHadrCands_(
false),
86 embeddedIsolationPFNeutralHadrCands_(
false),
87 embeddedIsolationPFGammaCands_(
false) {
88 initFromBaseTau(*aTauRef);
93 if (pfTau !=
nullptr) {
99 signalChargedHadrCandPtrs_.push_back(ptr);
102 signalNeutralHadrCandPtrs_.push_back(ptr);
105 signalGammaCandPtrs_.push_back(ptr);
108 isolationChargedHadrCandPtrs_.push_back(ptr);
111 isolationNeutralHadrCandPtrs_.push_back(ptr);
114 isolationGammaCandPtrs_.push_back(ptr);
116 std::vector<reco::CandidatePtr> signalLostTracks;
120 signalLostTracks.push_back(
chargedHadron.getLostTrackCandidate());
123 this->setSignalLostTracks(signalLostTracks);
138 out <<
"\tpat::Tau: ";
139 out << std::setiosflags(std::ios::right);
141 out << std::setprecision(3);
142 out <<
" E/pT/eta/phi " <<
obj.energy() <<
"/" <<
obj.pt() <<
"/" <<
obj.eta() <<
"/" <<
obj.phi();
148 if (embeddedIsolationTracks_) {
149 if (!isolationTracksTransientRefVector_.isSet()) {
151 trackRefVec->
reserve(isolationTracks_.size());
152 for (
unsigned int i = 0;
i < isolationTracks_.size();
i++) {
155 isolationTracksTransientRefVector_.set(
std::move(trackRefVec));
157 return *isolationTracksTransientRefVector_;
165 if (embeddedLeadTrack_) {
174 if (embeddedSignalTracks_) {
175 if (!signalTracksTransientRefVector_.isSet()) {
177 trackRefVec->
reserve(signalTracks_.size());
178 for (
unsigned int i = 0;
i < signalTracks_.size();
i++) {
181 signalTracksTransientRefVector_.set(
std::move(trackRefVec));
183 return *signalTracksTransientRefVector_;
191 isolationTracks_.clear();
193 for (
unsigned int i = 0;
i < trackRefVec.
size();
i++) {
194 isolationTracks_.push_back(*trackRefVec.
at(
i));
196 embeddedIsolationTracks_ =
true;
204 embeddedLeadTrack_ =
true;
210 signalTracks_.clear();
212 for (
unsigned int i = 0;
i < trackRefVec.
size();
i++) {
213 signalTracks_.push_back(*trackRefVec.
at(
i));
215 embeddedSignalTracks_ =
true;
221 genJet_.push_back(*gj);
225 const reco::GenJet* Tau::genJet()
const {
return (!genJet_.empty() ? &genJet_.front() :
nullptr); }
229 for (std::vector<IdPair>::const_iterator
it = tauIDs_.begin(), ed = tauIDs_.end();
it != ed; ++
it) {
234 ex <<
"pat::Tau: the ID " <<
name <<
" can't be found in this pat::Tau.\n";
235 ex <<
"The available IDs are: ";
236 for (std::vector<IdPair>::const_iterator
it = tauIDs_.begin(), ed = tauIDs_.end();
it != ed; ++
it) {
237 ex <<
"'" <<
it->first <<
"' ";
244 for (std::vector<IdPair>::const_iterator
it = tauIDs_.begin(), ed = tauIDs_.end();
it != ed; ++
it) {
254 <<
"Requesting a PFTau-specific information from a pat::Tau which wasn't made from a PFTau.\n";
255 return pfSpecific_[0];
259 if (pfEssential_.empty())
261 <<
"Requesting a PFTau-specific information from a pat::Tau which wasn't made from a PFTau.\n";
262 return pfEssential_[0];
268 throw cms::Exception(
"Type Error") <<
"Requesting a PFTau-specific information from a pat::Tau which wasn't " 269 "made from a PFTau.\n";
272 float Tau::dxy_Sig()
const {
273 if (pfEssential().dxy_error_ != 0)
274 return (pfEssential().dxy_ / pfEssential().dxy_error_);
291 float Tau::ip3d_Sig()
const {
292 if (pfEssential().ip3d_error_ != 0)
293 return (pfEssential().ip3d_ / pfEssential().ip3d_error_);
298 float Tau::etaetaMoment()
const {
300 return pfSpecific().etaetaMoment_;
301 throw cms::Exception(
"Type Error") <<
"Requesting a PFTau-specific information from a pat::Tau which wasn't " 302 "made from a PFTau.\n";
305 float Tau::phiphiMoment()
const {
307 return pfSpecific().phiphiMoment_;
308 throw cms::Exception(
"Type Error") <<
"Requesting a PFTau-specific information from a pat::Tau which wasn't " 309 "made from a PFTau.\n";
312 float Tau::etaphiMoment()
const {
314 return pfSpecific().etaphiMoment_;
315 throw cms::Exception(
"Type Error") <<
"Requesting a PFTau-specific information from a pat::Tau which wasn't " 316 "made from a PFTau.\n";
322 <<
"Requesting a PFTau-specific information from a pat::Tau which wasn't made from a PFTau.\n";
332 if (pfSpecific_[0].leadPFCand_.isNonnull()) {
333 leadPFCand_.push_back(*static_cast<const reco::PFCandidate*>(&*pfSpecific_[0].leadPFCand_));
334 embeddedLeadPFCand_ =
true;
342 leadPFChargedHadrCand_.clear();
343 if (pfSpecific_[0].leadPFChargedHadrCand_.isNonnull()) {
344 leadPFChargedHadrCand_.push_back(
345 *static_cast<const reco::PFCandidate*>(&*pfSpecific_[0].leadPFChargedHadrCand_));
346 embeddedLeadPFChargedHadrCand_ =
true;
354 leadPFNeutralCand_.clear();
355 if (pfSpecific_[0].leadPFNeutralCand_.isNonnull()) {
356 leadPFNeutralCand_.push_back(
357 *static_cast<const reco::PFCandidate*>(&*pfSpecific_[0].leadPFNeutralCand_));
358 embeddedLeadPFNeutralCand_ =
true;
366 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedSignalPFCands_;
367 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
368 signalPFCands_.push_back(candPtrs.at(
i));
370 embeddedSignalPFCands_ =
true;
376 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedSignalPFChargedHadrCands_;
377 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
378 signalPFChargedHadrCands_.push_back(candPtrs.at(
i));
380 embeddedSignalPFChargedHadrCands_ =
true;
386 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedSignalPFNeutrHadrCands_;
387 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
388 signalPFNeutralHadrCands_.push_back(candPtrs.at(
i));
390 embeddedSignalPFNeutralHadrCands_ =
true;
396 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedSignalPFGammaCands_;
397 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
398 signalPFGammaCands_.push_back(candPtrs.at(
i));
400 embeddedSignalPFGammaCands_ =
true;
407 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedIsolationPFCands_;
408 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
409 isolationPFCands_.push_back(candPtrs.at(
i));
411 embeddedIsolationPFCands_ =
true;
418 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedIsolationPFChargedHadrCands_;
419 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
420 isolationPFChargedHadrCands_.push_back(candPtrs.at(
i));
422 embeddedIsolationPFChargedHadrCands_ =
true;
428 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedIsolationPFNeutrHadrCands_;
429 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
430 isolationPFNeutralHadrCands_.push_back(candPtrs.at(
i));
432 embeddedIsolationPFNeutralHadrCands_ =
true;
438 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedIsolationPFGammaCands_;
439 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
440 isolationPFGammaCands_.push_back(candPtrs.at(
i));
442 embeddedIsolationPFGammaCands_ =
true;
447 throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
448 if (!pfSpecific().signalTauChargedHadronCandidates_.empty()) {
463 if (!embeddedLeadPFChargedHadrCand_) {
464 if (pfSpecific_.empty())
473 if (!embeddedLeadPFNeutralCand_) {
474 if (pfSpecific_.empty())
483 if (!embeddedLeadPFCand_) {
484 if (pfSpecific_.empty())
491 const std::vector<reco::PFCandidatePtr>& Tau::signalPFCands()
const {
492 if (embeddedSignalPFCands_) {
493 if (!signalPFCandsTransientPtrs_.isSet()) {
494 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
495 aPtrs->reserve(signalPFCands_.size());
496 for (
unsigned int i = 0;
i < signalPFCands_.size();
i++) {
499 signalPFCandsTransientPtrs_.set(
std::move(aPtrs));
501 return *signalPFCandsTransientPtrs_;
503 if (pfSpecific_.empty() || pfSpecific().selectedSignalPFCands_.empty() ||
504 !pfSpecific().selectedSignalPFCands_.front().isAvailable()) {
507 if (!signalPFCandsTransientPtrs_.isSet()) {
508 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
509 signalPFCandsTransientPtrs_.set(
std::move(aPtrs));
511 return *signalPFCandsTransientPtrs_;
513 return pfSpecific().selectedSignalPFCands_;
517 const std::vector<reco::PFCandidatePtr>& Tau::signalPFChargedHadrCands()
const {
518 if (embeddedSignalPFChargedHadrCands_) {
519 if (!signalPFChargedHadrCandsTransientPtrs_.isSet()) {
520 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
521 aPtrs->reserve(signalPFChargedHadrCands_.size());
522 for (
unsigned int i = 0;
i < signalPFChargedHadrCands_.size();
i++) {
525 signalPFChargedHadrCandsTransientPtrs_.set(
std::move(aPtrs));
527 return *signalPFChargedHadrCandsTransientPtrs_;
529 if (pfSpecific_.empty() || pfSpecific().selectedSignalPFChargedHadrCands_.empty() ||
530 !pfSpecific().selectedSignalPFChargedHadrCands_.front().isAvailable()) {
533 if (!signalPFChargedHadrCandsTransientPtrs_.isSet()) {
534 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
535 signalPFChargedHadrCandsTransientPtrs_.set(
std::move(aPtrs));
537 return *signalPFChargedHadrCandsTransientPtrs_;
539 return pfSpecific().selectedSignalPFChargedHadrCands_;
543 const std::vector<reco::PFCandidatePtr>& Tau::signalPFNeutrHadrCands()
const {
544 if (embeddedSignalPFNeutralHadrCands_) {
545 if (!signalPFNeutralHadrCandsTransientPtrs_.isSet()) {
546 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
547 aPtrs->reserve(signalPFNeutralHadrCands_.size());
548 for (
unsigned int i = 0;
i < signalPFNeutralHadrCands_.size();
i++) {
551 signalPFNeutralHadrCandsTransientPtrs_.set(
std::move(aPtrs));
553 return *signalPFNeutralHadrCandsTransientPtrs_;
555 if (pfSpecific_.empty() || pfSpecific().selectedSignalPFNeutrHadrCands_.empty() ||
556 !pfSpecific().selectedSignalPFNeutrHadrCands_.front().isAvailable()) {
559 if (!signalPFNeutralHadrCandsTransientPtrs_.isSet()) {
560 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
561 signalPFNeutralHadrCandsTransientPtrs_.set(
std::move(aPtrs));
563 return *signalPFNeutralHadrCandsTransientPtrs_;
565 return pfSpecific().selectedSignalPFNeutrHadrCands_;
569 const std::vector<reco::PFCandidatePtr>& Tau::signalPFGammaCands()
const {
570 if (embeddedSignalPFGammaCands_) {
571 if (!signalPFGammaCandsTransientPtrs_.isSet()) {
572 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
573 aPtrs->reserve(signalPFGammaCands_.size());
574 for (
unsigned int i = 0;
i < signalPFGammaCands_.size();
i++) {
577 signalPFGammaCandsTransientPtrs_.set(
std::move(aPtrs));
579 return *signalPFGammaCandsTransientPtrs_;
581 if (pfSpecific_.empty() || pfSpecific().selectedSignalPFGammaCands_.empty() ||
582 !pfSpecific().selectedSignalPFGammaCands_.front().isAvailable()) {
585 if (!signalPFGammaCandsTransientPtrs_.isSet()) {
586 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
587 signalPFGammaCandsTransientPtrs_.set(
std::move(aPtrs));
589 return *signalPFGammaCandsTransientPtrs_;
591 return pfSpecific().selectedSignalPFGammaCands_;
595 const std::vector<reco::PFRecoTauChargedHadron>& Tau::signalTauChargedHadronCandidates()
const {
596 if (pfSpecific_.empty())
597 throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
598 return pfSpecific().signalTauChargedHadronCandidates_;
601 const std::vector<reco::RecoTauPiZero>& Tau::signalPiZeroCandidates()
const {
602 if (pfSpecific_.empty())
603 throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
604 return pfSpecific().signalPiZeroCandidates_;
607 const std::vector<reco::PFCandidatePtr>& Tau::isolationPFCands()
const {
608 if (embeddedIsolationPFCands_) {
609 if (!isolationPFCandsTransientPtrs_.isSet()) {
610 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
611 aPtrs->reserve(isolationPFCands_.size());
612 for (
unsigned int i = 0;
i < isolationPFCands_.size();
i++) {
615 isolationPFCandsTransientPtrs_.set(
std::move(aPtrs));
617 return *isolationPFCandsTransientPtrs_;
619 if (pfSpecific_.empty() || pfSpecific().selectedIsolationPFCands_.empty() ||
620 !pfSpecific().selectedIsolationPFCands_.front().isAvailable()) {
623 if (!isolationPFCandsTransientPtrs_.isSet()) {
624 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
625 isolationPFCandsTransientPtrs_.set(
std::move(aPtrs));
627 return *isolationPFCandsTransientPtrs_;
629 return pfSpecific().selectedIsolationPFCands_;
633 const std::vector<reco::PFCandidatePtr>& Tau::isolationPFChargedHadrCands()
const {
634 if (embeddedIsolationPFChargedHadrCands_) {
635 if (!isolationPFChargedHadrCandsTransientPtrs_.isSet()) {
636 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
637 aPtrs->reserve(isolationPFChargedHadrCands_.size());
638 for (
unsigned int i = 0;
i < isolationPFChargedHadrCands_.size();
i++) {
641 isolationPFChargedHadrCandsTransientPtrs_.set(
std::move(aPtrs));
643 return *isolationPFChargedHadrCandsTransientPtrs_;
645 if (pfSpecific_.empty() || pfSpecific().selectedIsolationPFChargedHadrCands_.empty() ||
646 !pfSpecific().selectedIsolationPFChargedHadrCands_.front().isAvailable()) {
649 if (!isolationPFChargedHadrCandsTransientPtrs_.isSet()) {
650 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
651 isolationPFChargedHadrCandsTransientPtrs_.set(
std::move(aPtrs));
653 return *isolationPFChargedHadrCandsTransientPtrs_;
655 return pfSpecific().selectedIsolationPFChargedHadrCands_;
659 const std::vector<reco::PFCandidatePtr>& Tau::isolationPFNeutrHadrCands()
const {
660 if (embeddedIsolationPFNeutralHadrCands_) {
661 if (!isolationPFNeutralHadrCandsTransientPtrs_.isSet()) {
662 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
663 aPtrs->reserve(isolationPFNeutralHadrCands_.size());
664 for (
unsigned int i = 0;
i < isolationPFNeutralHadrCands_.size();
i++) {
667 isolationPFNeutralHadrCandsTransientPtrs_.set(
std::move(aPtrs));
669 return *isolationPFNeutralHadrCandsTransientPtrs_;
671 if (pfSpecific_.empty() || pfSpecific().selectedIsolationPFNeutrHadrCands_.empty() ||
672 !pfSpecific().selectedIsolationPFNeutrHadrCands_.front().isAvailable()) {
675 if (!isolationPFNeutralHadrCandsTransientPtrs_.isSet()) {
676 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
677 isolationPFNeutralHadrCandsTransientPtrs_.set(
std::move(aPtrs));
679 return *isolationPFNeutralHadrCandsTransientPtrs_;
681 return pfSpecific().selectedIsolationPFNeutrHadrCands_;
685 const std::vector<reco::PFCandidatePtr>& Tau::isolationPFGammaCands()
const {
686 if (embeddedIsolationPFGammaCands_) {
687 if (!isolationPFGammaCandsTransientPtrs_.isSet()) {
688 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
689 aPtrs->reserve(isolationPFGammaCands_.size());
690 for (
unsigned int i = 0;
i < isolationPFGammaCands_.size();
i++) {
693 isolationPFGammaCandsTransientPtrs_.set(
std::move(aPtrs));
695 return *isolationPFGammaCandsTransientPtrs_;
697 if (pfSpecific_.empty() || pfSpecific().selectedIsolationPFGammaCands_.empty() ||
698 !pfSpecific().selectedIsolationPFGammaCands_.front().isAvailable()) {
701 if (!isolationPFGammaCandsTransientPtrs_.isSet()) {
702 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
703 isolationPFGammaCandsTransientPtrs_.set(
std::move(aPtrs));
705 return *isolationPFGammaCandsTransientPtrs_;
707 return pfSpecific().selectedIsolationPFGammaCands_;
711 const std::vector<reco::PFRecoTauChargedHadron>& Tau::isolationTauChargedHadronCandidates()
const {
712 if (pfSpecific_.empty())
713 throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
714 return pfSpecific().isolationTauChargedHadronCandidates_;
717 const std::vector<reco::RecoTauPiZero>& Tau::isolationPiZeroCandidates()
const {
718 if (pfSpecific_.empty())
719 throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
720 return pfSpecific().isolationPiZeroCandidates_;
727 void Tau::initializeJEC(
unsigned int level,
unsigned int set) {
729 currentJECLevel(
level);
735 for (std::vector<pat::TauJetCorrFactors>::const_iterator corrFactor = jec_.begin(); corrFactor != jec_.end();
737 if (corrFactor->jecSet() ==
set)
738 return corrFactor - jec_.begin();
744 const std::vector<std::string> Tau::availableJECSets()
const {
745 std::vector<std::string> sets;
746 for (std::vector<pat::TauJetCorrFactors>::const_iterator corrFactor = jec_.begin(); corrFactor != jec_.end();
748 sets.push_back(corrFactor->jecSet());
753 const std::vector<std::string> Tau::availableJECLevels(
const int&
set)
const {
754 return set >= 0 ? jec_.at(
set).correctionLabels() : std::vector<std::string>();
760 for (
unsigned int idx = 0;
idx < jec_.size(); ++
idx) {
761 if (
set.
empty() || jec_.at(
idx).jecSet() ==
set) {
765 throw cms::Exception(
"InvalidRequest") <<
"This JEC level " <<
level <<
" does not exist. \n";
768 throw cms::Exception(
"InvalidRequest") <<
"This jet does not carry any jet energy correction factor information \n" 769 <<
"for a jet energy correction set with label " <<
set <<
"\n";
774 float Tau::jecFactor(
const unsigned int&
level,
const unsigned int&
set)
const {
775 if (!jecSetsAvailable())
776 throw cms::Exception(
"InvalidRequest") <<
"This jet does not carry any jet energy correction factor information \n";
777 if (!jecSetAvailable(
set))
778 throw cms::Exception(
"InvalidRequest") <<
"This jet does not carry any jet energy correction factor information \n" 779 <<
"for a jet energy correction set with index " <<
set <<
"\n";
780 return jec_.at(
set).correction(
level) / jec_.at(currentJECSet_).correction(currentJECLevel_);
788 for (
unsigned int idx = 0;
idx < jec_.size(); ++
idx) {
789 if (
set.
empty() || jec_.at(
idx).jecSet() ==
set) {
791 return correctedTauJet(jec_[
idx].jecLevel(
level),
idx);
793 throw cms::Exception(
"InvalidRequest") <<
"This JEC level " <<
level <<
" does not exist. \n";
796 throw cms::Exception(
"InvalidRequest") <<
"This JEC set " <<
set <<
" does not exist. \n";
801 Tau Tau::correctedTauJet(
const unsigned int&
level,
const unsigned int&
set)
const {
802 Tau correctedTauJet(*
this);
804 correctedTauJet.setP4(jecFactor(
level,
set) *
p4());
806 correctedTauJet.currentJECSet(
set);
807 correctedTauJet.currentJECLevel(
level);
808 return correctedTauJet;
816 if (leadPF.
isAvailable() || signalChargedHadrCandPtrs_.isNull())
820 if (
ret.isNull() || (
p->pt() >
ret->pt()))
829 if (leadPF.
isAvailable() || signalNeutralHadrCandPtrs_.isNull())
833 if (
ret.isNull() || (
p->pt() >
ret->pt()))
842 if (leadPF.
isAvailable() || !Tau::ExistSignalCands())
845 return Tau::signalCands()[0];
850 bool Tau::ExistSignalCands()
const {
851 return !(signalChargedHadrCandPtrs_.isNull() && signalNeutralHadrCandPtrs_.isNull() && signalGammaCandPtrs_.isNull());
854 bool Tau::ExistIsolationCands()
const {
855 return !(isolationChargedHadrCandPtrs_.isNull() && isolationNeutralHadrCandPtrs_.isNull() &&
856 isolationGammaCandPtrs_.isNull());
863 std::vector<reco::PFCandidatePtr>
r0 = signalPFCands();
865 if (!Tau::ExistSignalCands() || (!
r0.empty() &&
r0.front().isAvailable())) {
866 for (
const auto&
p : r0)
872 std::vector<std::pair<float, size_t> > pt_index;
874 ret2.
reserve(signalChargedHadrCandPtrs_.size() + signalNeutralHadrCandPtrs_.size() + signalGammaCandPtrs_.size());
875 pt_index.reserve(signalChargedHadrCandPtrs_.size() + signalNeutralHadrCandPtrs_.size() +
876 signalGammaCandPtrs_.size());
878 for (
const auto&
p : signalChargedHadrCandPtrs_) {
880 pt_index.push_back(std::make_pair(
p->pt(),
index));
883 for (
const auto&
p : signalNeutralHadrCandPtrs_) {
885 pt_index.push_back(std::make_pair(
p->pt(),
index));
888 for (
const auto&
p : signalGammaCandPtrs_) {
890 pt_index.push_back(std::make_pair(
p->pt(),
index));
893 std::sort(pt_index.begin(), pt_index.end(), std::greater<>());
894 ret.reserve(pt_index.size());
895 for (
const auto&
p : pt_index) {
896 ret.push_back(ret2[
p.second]);
905 std::vector<reco::PFCandidatePtr>
r0 = signalPFChargedHadrCands();
906 if (signalChargedHadrCandPtrs_.isNull() || (!
r0.empty() &&
r0.front().isAvailable())) {
908 for (
const auto&
p : r0)
912 return signalChargedHadrCandPtrs_;
919 std::vector<reco::PFCandidatePtr>
r0 = signalPFNeutrHadrCands();
920 if (signalNeutralHadrCandPtrs_.isNull() || (!
r0.empty() &&
r0.front().isAvailable())) {
922 for (
const auto&
p : r0)
926 return signalNeutralHadrCandPtrs_;
933 std::vector<reco::PFCandidatePtr>
r0 = signalPFGammaCands();
934 if (signalGammaCandPtrs_.isNull() || (!
r0.empty() &&
r0.front().isAvailable())) {
936 for (
const auto&
p : r0)
940 return signalGammaCandPtrs_;
947 std::vector<reco::PFCandidatePtr>
r0 = isolationPFCands();
949 if (!Tau::ExistIsolationCands() || (!
r0.empty() &&
r0.front().isAvailable())) {
950 for (
const auto&
p : r0)
956 std::vector<std::pair<float, size_t> > pt_index;
957 ret2.
reserve(isolationChargedHadrCandPtrs_.size() + isolationNeutralHadrCandPtrs_.size() +
958 isolationGammaCandPtrs_.size());
959 pt_index.reserve(isolationChargedHadrCandPtrs_.size() + isolationNeutralHadrCandPtrs_.size() +
960 isolationGammaCandPtrs_.size());
962 for (
const auto&
p : isolationChargedHadrCandPtrs_) {
964 pt_index.push_back(std::make_pair(
p->pt(),
index));
967 for (
const auto&
p : isolationNeutralHadrCandPtrs_) {
969 pt_index.push_back(std::make_pair(
p->pt(),
index));
972 for (
const auto&
p : isolationGammaCandPtrs_) {
974 pt_index.push_back(std::make_pair(
p->pt(),
index));
977 std::sort(pt_index.begin(), pt_index.end(), std::greater<>());
978 ret.reserve(pt_index.size());
979 for (
const auto&
p : pt_index) {
980 ret.push_back(ret2[
p.second]);
989 std::vector<reco::PFCandidatePtr>
r0 = isolationPFChargedHadrCands();
990 if (isolationChargedHadrCandPtrs_.isNull() || (!
r0.empty() &&
r0.front().isAvailable())) {
992 for (
const auto&
p : r0)
996 return isolationChargedHadrCandPtrs_;
1004 std::vector<reco::PFCandidatePtr>
r0 = isolationPFNeutrHadrCands();
1005 if (isolationNeutralHadrCandPtrs_.isNull() || (!
r0.empty() &&
r0.front().isAvailable())) {
1007 for (
const auto&
p : r0)
1011 return isolationNeutralHadrCandPtrs_;
1018 std::vector<reco::PFCandidatePtr>
r0 = isolationPFGammaCands();
1019 if (isolationGammaCandPtrs_.isNull() || (!
r0.empty() &&
r0.front().isAvailable())) {
1021 for (
const auto&
p : r0)
1025 return isolationGammaCandPtrs_;
1029 std::vector<reco::CandidatePtr> Tau::signalLostTracks()
const {
1030 std::vector<reco::CandidatePtr>
ret;
1033 while (this->hasUserCand(
label)) {
1041 void Tau::setSignalLostTracks(
const std::vector<reco::CandidatePtr>& ptrs) {
1043 for (
const auto& ptr : ptrs) {
1045 addUserCand(
label, ptr);
1053 if (Tau::ExistSignalCands())
1054 return Tau::signalCands().size();
1055 else if (pfSpecific_.empty())
1058 return pfSpecific().selectedSignalPFCands_.size();
1062 if (Tau::ExistSignalCands())
1063 return Tau::signalCands()[
i];
1064 else if (pfSpecific_.empty())
1067 return pfSpecific().selectedSignalPFCands_[
i];
const std::vector< reco::CandidatePtr > & signalNeutrHadrCands() const
Neutral hadrons in signal region.
embedIsolationPFNeutralHadrCands
embed in AOD externally stored isolation PFChargedHadronCandidates
embedIsolationPFChargedHadrCands
embed in AOD externally stored isolation PFCandidates
const CandidatePtr & leadChargedHadrCand() const
ret
prodAgent to be discontinued
void push_back(Ptr< T > const &iPtr)
embedSignalPFGammaCands
embed in AOD externally stored signal PFNeutralHadronCandidates
embedSignalPFCands
embed in AOD externally stored leading PFNeutral Candidate
CandidatePtr sourceCandidatePtr(size_type i) const override
value_type const at(size_type idx) const
Retrieve an element of the RefVector.
const reco::PFCandidatePtr convertToPFCandidatePtr(const reco::CandidatePtr &ptr)
InputIterator leadCand(InputIterator begin, InputIterator end)
const LorentzVector & p4() const final
four-momentum Lorentz vector
embedSignalPFNeutralHadrCands
embed in AOD externally stored signal PFChargedHadronCandidates
static std::string to_string(const XMLCh *ch)
embedSignalTracks
embed in AOD externally stored leading track
const std::vector< reco::CandidatePtr > & isolationNeutrHadrCands() const
double p() const final
magnitude of momentum vector
std::ostream & operator<<(std::ostream &, BeamSpot beam)
embedIsolationPFGammaCands
embed in AOD externally stored isolation PFNeutralHadronCandidates
embedIsolationTracks
embed in AOD externally stored signal tracks
Jets made from MC generator particles.
virtual const reco::TrackRefVector & signalTracks() const
embedLeadPFNeutralCand
embed in AOD externally stored leading PFChargedHadron candidate
virtual reco::TrackRef leadTrack() const
void reserve(size_type n)
Reserve space for RefVector.
Analysis-level tau class.
const std::vector< reco::CandidatePtr > & signalGammaCands() const
Gamma candidates in signal region.
T const * get() const
Returns C++ pointer to the item.
virtual const reco::TrackRefVector & isolationTracks() const
embedSignalPFChargedHadrCands
embed in AOD externally stored signal PFCandidates
size_type size() const
Size of the RefVector.
const std::vector< reco::CandidatePtr > & isolationChargedHadrCands() const
Charged candidates in isolation region.
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
edm::Ref< PFRecoTauChargedHadronCollection > PFRecoTauChargedHadronRef
presistent reference to a PFRecoTauChargedHadron
math::XYZTLorentzVector LorentzVector
Lorentz vector.
size_t numberOfSourceCandidatePtrs() const override
void reserve(size_type n)
Reserve space for RefVector.
const std::vector< reco::CandidatePtr > & signalChargedHadrCands() const
Charged hadrons in signal region.
Particle reconstructed by the particle flow algorithm.
const std::vector< reco::CandidatePtr > & isolationGammaCands() const
Gamma candidates in isolation region.
const std::vector< PFRecoTauChargedHadron > & signalTauChargedHadronCandidates() const
Retrieve the association of signal region PF candidates into candidate PFRecoTauChargedHadrons.
embedIsolationPFCands
embed in AOD externally stored signal PFGammaCandidates
embedLeadPFCand
embed in AOD externally stored isolation tracks embedding objects (for PFTaus only) ...
embedLeadPFChargedHadrCand
embed in AOD externally stored leading PFCandidate
edm::Ptr< PFCandidate > PFCandidatePtr
persistent Ptr to a PFCandidate
void setP4(const LorentzVector &p4) final
set 4-momentum
math::ErrorF< 3 >::type CovMatrix