11 using namespace std::placeholders;
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);
92 const reco::PFTau* pfTau = dynamic_cast<const reco::PFTau*>(&aTau);
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);
129 out <<
"\tpat::Tau: ";
130 out << std::setiosflags(std::ios::right);
132 out << std::setprecision(3);
133 out <<
" E/pT/eta/phi " <<
obj.energy() <<
"/" <<
obj.pt() <<
"/" <<
obj.eta() <<
"/" <<
obj.phi();
139 if (embeddedIsolationTracks_) {
140 if (!isolationTracksTransientRefVector_.isSet()) {
142 trackRefVec->
reserve(isolationTracks_.size());
143 for (
unsigned int i = 0;
i < isolationTracks_.size();
i++) {
146 isolationTracksTransientRefVector_.set(
std::move(trackRefVec));
148 return *isolationTracksTransientRefVector_;
156 if (embeddedLeadTrack_) {
165 if (embeddedSignalTracks_) {
166 if (!signalTracksTransientRefVector_.isSet()) {
168 trackRefVec->
reserve(signalTracks_.size());
169 for (
unsigned int i = 0;
i < signalTracks_.size();
i++) {
172 signalTracksTransientRefVector_.set(
std::move(trackRefVec));
174 return *signalTracksTransientRefVector_;
182 isolationTracks_.clear();
184 for (
unsigned int i = 0;
i < trackRefVec.
size();
i++) {
185 isolationTracks_.push_back(*trackRefVec.
at(
i));
187 embeddedIsolationTracks_ =
true;
195 embeddedLeadTrack_ =
true;
201 signalTracks_.clear();
203 for (
unsigned int i = 0;
i < trackRefVec.
size();
i++) {
204 signalTracks_.push_back(*trackRefVec.
at(
i));
206 embeddedSignalTracks_ =
true;
212 genJet_.push_back(*gj);
216 const reco::GenJet* Tau::genJet()
const {
return (!genJet_.empty() ? &genJet_.front() :
nullptr); }
220 for (std::vector<IdPair>::const_iterator it = tauIDs_.begin(), ed = tauIDs_.end(); it != ed; ++it) {
221 if (it->first ==
name)
225 ex <<
"pat::Tau: the ID " <<
name <<
" can't be found in this pat::Tau.\n";
226 ex <<
"The available IDs are: ";
227 for (std::vector<IdPair>::const_iterator it = tauIDs_.begin(), ed = tauIDs_.end(); it != ed; ++it) {
228 ex <<
"'" << it->first <<
"' ";
235 for (std::vector<IdPair>::const_iterator it = tauIDs_.begin(), ed = tauIDs_.end(); it != ed; ++it) {
236 if (it->first ==
name)
245 <<
"Requesting a PFTau-specific information from a pat::Tau which wasn't made from a PFTau.\n";
246 return pfSpecific_[0];
250 if (pfEssential_.empty())
252 <<
"Requesting a PFTau-specific information from a pat::Tau which wasn't made from a PFTau.\n";
253 return pfEssential_[0];
259 throw cms::Exception(
"Type Error") <<
"Requesting a PFTau-specific information from a pat::Tau which wasn't "
260 "made from a PFTau.\n";
263 float Tau::dxy_Sig()
const {
264 if (pfEssential().dxy_error_ != 0)
265 return (pfEssential().dxy_ / pfEssential().dxy_error_);
282 float Tau::ip3d_Sig()
const {
283 if (pfEssential().ip3d_error_ != 0)
284 return (pfEssential().ip3d_ / pfEssential().ip3d_error_);
289 float Tau::etaetaMoment()
const {
291 return pfSpecific().etaetaMoment_;
292 throw cms::Exception(
"Type Error") <<
"Requesting a PFTau-specific information from a pat::Tau which wasn't "
293 "made from a PFTau.\n";
296 float Tau::phiphiMoment()
const {
298 return pfSpecific().phiphiMoment_;
299 throw cms::Exception(
"Type Error") <<
"Requesting a PFTau-specific information from a pat::Tau which wasn't "
300 "made from a PFTau.\n";
303 float Tau::etaphiMoment()
const {
305 return pfSpecific().etaphiMoment_;
306 throw cms::Exception(
"Type Error") <<
"Requesting a PFTau-specific information from a pat::Tau which wasn't "
307 "made from a PFTau.\n";
313 <<
"Requesting a PFTau-specific information from a pat::Tau which wasn't made from a PFTau.\n";
323 if (pfSpecific_[0].leadPFCand_.isNonnull()) {
324 leadPFCand_.push_back(*static_cast<const reco::PFCandidate*>(&*pfSpecific_[0].leadPFCand_));
325 embeddedLeadPFCand_ =
true;
333 leadPFChargedHadrCand_.clear();
334 if (pfSpecific_[0].leadPFChargedHadrCand_.isNonnull()) {
335 leadPFChargedHadrCand_.push_back(
336 *static_cast<const reco::PFCandidate*>(&*pfSpecific_[0].leadPFChargedHadrCand_));
337 embeddedLeadPFChargedHadrCand_ =
true;
345 leadPFNeutralCand_.clear();
346 if (pfSpecific_[0].leadPFNeutralCand_.isNonnull()) {
347 leadPFNeutralCand_.push_back(
348 *static_cast<const reco::PFCandidate*>(&*pfSpecific_[0].leadPFNeutralCand_));
349 embeddedLeadPFNeutralCand_ =
true;
357 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedSignalPFCands_;
358 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
359 signalPFCands_.push_back(candPtrs.at(
i));
361 embeddedSignalPFCands_ =
true;
367 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedSignalPFChargedHadrCands_;
368 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
369 signalPFChargedHadrCands_.push_back(candPtrs.at(
i));
371 embeddedSignalPFChargedHadrCands_ =
true;
377 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedSignalPFNeutrHadrCands_;
378 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
379 signalPFNeutralHadrCands_.push_back(candPtrs.at(
i));
381 embeddedSignalPFNeutralHadrCands_ =
true;
387 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedSignalPFGammaCands_;
388 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
389 signalPFGammaCands_.push_back(candPtrs.at(
i));
391 embeddedSignalPFGammaCands_ =
true;
398 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedIsolationPFCands_;
399 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
400 isolationPFCands_.push_back(candPtrs.at(
i));
402 embeddedIsolationPFCands_ =
true;
409 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedIsolationPFChargedHadrCands_;
410 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
411 isolationPFChargedHadrCands_.push_back(candPtrs.at(
i));
413 embeddedIsolationPFChargedHadrCands_ =
true;
419 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedIsolationPFNeutrHadrCands_;
420 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
421 isolationPFNeutralHadrCands_.push_back(candPtrs.at(
i));
423 embeddedIsolationPFNeutralHadrCands_ =
true;
429 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedIsolationPFGammaCands_;
430 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
431 isolationPFGammaCands_.push_back(candPtrs.at(
i));
433 embeddedIsolationPFGammaCands_ =
true;
438 throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
439 if (!pfSpecific().signalTauChargedHadronCandidates_.empty()) {
447 const reco::PFCandidate* pf_cand = dynamic_cast<const reco::PFCandidate*>(&*ptr);
454 if (!embeddedLeadPFChargedHadrCand_) {
455 if (pfSpecific_.empty())
464 if (!embeddedLeadPFNeutralCand_) {
465 if (pfSpecific_.empty())
474 if (!embeddedLeadPFCand_) {
475 if (pfSpecific_.empty())
482 const std::vector<reco::PFCandidatePtr>& Tau::signalPFCands()
const {
483 if (embeddedSignalPFCands_) {
484 if (!signalPFCandsTransientPtrs_.isSet()) {
485 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
486 aPtrs->reserve(signalPFCands_.size());
487 for (
unsigned int i = 0;
i < signalPFCands_.size();
i++) {
490 signalPFCandsTransientPtrs_.set(
std::move(aPtrs));
492 return *signalPFCandsTransientPtrs_;
494 if (pfSpecific_.empty() || pfSpecific().selectedSignalPFCands_.empty() ||
495 !pfSpecific().selectedSignalPFCands_.front().isAvailable()) {
498 if (!signalPFCandsTransientPtrs_.isSet()) {
499 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
500 signalPFCandsTransientPtrs_.set(
std::move(aPtrs));
502 return *signalPFCandsTransientPtrs_;
504 return pfSpecific().selectedSignalPFCands_;
508 const std::vector<reco::PFCandidatePtr>& Tau::signalPFChargedHadrCands()
const {
509 if (embeddedSignalPFChargedHadrCands_) {
510 if (!signalPFChargedHadrCandsTransientPtrs_.isSet()) {
511 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
512 aPtrs->reserve(signalPFChargedHadrCands_.size());
513 for (
unsigned int i = 0;
i < signalPFChargedHadrCands_.size();
i++) {
516 signalPFChargedHadrCandsTransientPtrs_.set(
std::move(aPtrs));
518 return *signalPFChargedHadrCandsTransientPtrs_;
520 if (pfSpecific_.empty() || pfSpecific().selectedSignalPFChargedHadrCands_.empty() ||
521 !pfSpecific().selectedSignalPFChargedHadrCands_.front().isAvailable()) {
524 if (!signalPFChargedHadrCandsTransientPtrs_.isSet()) {
525 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
526 signalPFChargedHadrCandsTransientPtrs_.set(
std::move(aPtrs));
528 return *signalPFChargedHadrCandsTransientPtrs_;
530 return pfSpecific().selectedSignalPFChargedHadrCands_;
534 const std::vector<reco::PFCandidatePtr>& Tau::signalPFNeutrHadrCands()
const {
535 if (embeddedSignalPFNeutralHadrCands_) {
536 if (!signalPFNeutralHadrCandsTransientPtrs_.isSet()) {
537 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
538 aPtrs->reserve(signalPFNeutralHadrCands_.size());
539 for (
unsigned int i = 0;
i < signalPFNeutralHadrCands_.size();
i++) {
542 signalPFNeutralHadrCandsTransientPtrs_.set(
std::move(aPtrs));
544 return *signalPFNeutralHadrCandsTransientPtrs_;
546 if (pfSpecific_.empty() || pfSpecific().selectedSignalPFNeutrHadrCands_.empty() ||
547 !pfSpecific().selectedSignalPFNeutrHadrCands_.front().isAvailable()) {
550 if (!signalPFNeutralHadrCandsTransientPtrs_.isSet()) {
551 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
552 signalPFNeutralHadrCandsTransientPtrs_.set(
std::move(aPtrs));
554 return *signalPFNeutralHadrCandsTransientPtrs_;
556 return pfSpecific().selectedSignalPFNeutrHadrCands_;
560 const std::vector<reco::PFCandidatePtr>& Tau::signalPFGammaCands()
const {
561 if (embeddedSignalPFGammaCands_) {
562 if (!signalPFGammaCandsTransientPtrs_.isSet()) {
563 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
564 aPtrs->reserve(signalPFGammaCands_.size());
565 for (
unsigned int i = 0;
i < signalPFGammaCands_.size();
i++) {
568 signalPFGammaCandsTransientPtrs_.set(
std::move(aPtrs));
570 return *signalPFGammaCandsTransientPtrs_;
572 if (pfSpecific_.empty() || pfSpecific().selectedSignalPFGammaCands_.empty() ||
573 !pfSpecific().selectedSignalPFGammaCands_.front().isAvailable()) {
576 if (!signalPFGammaCandsTransientPtrs_.isSet()) {
577 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
578 signalPFGammaCandsTransientPtrs_.set(
std::move(aPtrs));
580 return *signalPFGammaCandsTransientPtrs_;
582 return pfSpecific().selectedSignalPFGammaCands_;
586 const std::vector<reco::PFRecoTauChargedHadron>& Tau::signalTauChargedHadronCandidates()
const {
587 if (pfSpecific_.empty())
588 throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
589 return pfSpecific().signalTauChargedHadronCandidates_;
592 const std::vector<reco::RecoTauPiZero>& Tau::signalPiZeroCandidates()
const {
593 if (pfSpecific_.empty())
594 throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
595 return pfSpecific().signalPiZeroCandidates_;
598 const std::vector<reco::PFCandidatePtr>& Tau::isolationPFCands()
const {
599 if (embeddedIsolationPFCands_) {
600 if (!isolationPFCandsTransientPtrs_.isSet()) {
601 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
602 aPtrs->reserve(isolationPFCands_.size());
603 for (
unsigned int i = 0;
i < isolationPFCands_.size();
i++) {
606 isolationPFCandsTransientPtrs_.set(
std::move(aPtrs));
608 return *isolationPFCandsTransientPtrs_;
610 if (pfSpecific_.empty() || pfSpecific().selectedIsolationPFCands_.empty() ||
611 !pfSpecific().selectedIsolationPFCands_.front().isAvailable()) {
614 if (!isolationPFCandsTransientPtrs_.isSet()) {
615 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
616 isolationPFCandsTransientPtrs_.set(
std::move(aPtrs));
618 return *isolationPFCandsTransientPtrs_;
620 return pfSpecific().selectedIsolationPFCands_;
624 const std::vector<reco::PFCandidatePtr>& Tau::isolationPFChargedHadrCands()
const {
625 if (embeddedIsolationPFChargedHadrCands_) {
626 if (!isolationPFChargedHadrCandsTransientPtrs_.isSet()) {
627 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
628 aPtrs->reserve(isolationPFChargedHadrCands_.size());
629 for (
unsigned int i = 0;
i < isolationPFChargedHadrCands_.size();
i++) {
632 isolationPFChargedHadrCandsTransientPtrs_.set(
std::move(aPtrs));
634 return *isolationPFChargedHadrCandsTransientPtrs_;
636 if (pfSpecific_.empty() || pfSpecific().selectedIsolationPFChargedHadrCands_.empty() ||
637 !pfSpecific().selectedIsolationPFChargedHadrCands_.front().isAvailable()) {
640 if (!isolationPFChargedHadrCandsTransientPtrs_.isSet()) {
641 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
642 isolationPFChargedHadrCandsTransientPtrs_.set(
std::move(aPtrs));
644 return *isolationPFChargedHadrCandsTransientPtrs_;
646 return pfSpecific().selectedIsolationPFChargedHadrCands_;
650 const std::vector<reco::PFCandidatePtr>& Tau::isolationPFNeutrHadrCands()
const {
651 if (embeddedIsolationPFNeutralHadrCands_) {
652 if (!isolationPFNeutralHadrCandsTransientPtrs_.isSet()) {
653 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
654 aPtrs->reserve(isolationPFNeutralHadrCands_.size());
655 for (
unsigned int i = 0;
i < isolationPFNeutralHadrCands_.size();
i++) {
658 isolationPFNeutralHadrCandsTransientPtrs_.set(
std::move(aPtrs));
660 return *isolationPFNeutralHadrCandsTransientPtrs_;
662 if (pfSpecific_.empty() || pfSpecific().selectedIsolationPFNeutrHadrCands_.empty() ||
663 !pfSpecific().selectedIsolationPFNeutrHadrCands_.front().isAvailable()) {
666 if (!isolationPFNeutralHadrCandsTransientPtrs_.isSet()) {
667 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
668 isolationPFNeutralHadrCandsTransientPtrs_.set(
std::move(aPtrs));
670 return *isolationPFNeutralHadrCandsTransientPtrs_;
672 return pfSpecific().selectedIsolationPFNeutrHadrCands_;
676 const std::vector<reco::PFCandidatePtr>& Tau::isolationPFGammaCands()
const {
677 if (embeddedIsolationPFGammaCands_) {
678 if (!isolationPFGammaCandsTransientPtrs_.isSet()) {
679 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
680 aPtrs->reserve(isolationPFGammaCands_.size());
681 for (
unsigned int i = 0;
i < isolationPFGammaCands_.size();
i++) {
684 isolationPFGammaCandsTransientPtrs_.set(
std::move(aPtrs));
686 return *isolationPFGammaCandsTransientPtrs_;
688 if (pfSpecific_.empty() || pfSpecific().selectedIsolationPFGammaCands_.empty() ||
689 !pfSpecific().selectedIsolationPFGammaCands_.front().isAvailable()) {
692 if (!isolationPFGammaCandsTransientPtrs_.isSet()) {
693 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
694 isolationPFGammaCandsTransientPtrs_.set(
std::move(aPtrs));
696 return *isolationPFGammaCandsTransientPtrs_;
698 return pfSpecific().selectedIsolationPFGammaCands_;
702 const std::vector<reco::PFRecoTauChargedHadron>& Tau::isolationTauChargedHadronCandidates()
const {
703 if (pfSpecific_.empty())
704 throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
705 return pfSpecific().isolationTauChargedHadronCandidates_;
708 const std::vector<reco::RecoTauPiZero>& Tau::isolationPiZeroCandidates()
const {
709 if (pfSpecific_.empty())
710 throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
711 return pfSpecific().isolationPiZeroCandidates_;
718 void Tau::initializeJEC(
unsigned int level,
unsigned int set) {
720 currentJECLevel(
level);
726 for (std::vector<pat::TauJetCorrFactors>::const_iterator corrFactor = jec_.begin(); corrFactor != jec_.end();
728 if (corrFactor->jecSet() == set)
729 return corrFactor - jec_.begin();
735 const std::vector<std::string> Tau::availableJECSets()
const {
736 std::vector<std::string> sets;
737 for (std::vector<pat::TauJetCorrFactors>::const_iterator corrFactor = jec_.begin(); corrFactor != jec_.end();
739 sets.push_back(corrFactor->jecSet());
744 const std::vector<std::string> Tau::availableJECLevels(
const int& set)
const {
745 return set >= 0 ? jec_.at(set).correctionLabels() : std::vector<std::string>();
751 for (
unsigned int idx = 0;
idx < jec_.size(); ++
idx) {
752 if (set.empty() || jec_.at(
idx).jecSet() == set) {
756 throw cms::Exception(
"InvalidRequest") <<
"This JEC level " <<
level <<
" does not exist. \n";
759 throw cms::Exception(
"InvalidRequest") <<
"This jet does not carry any jet energy correction factor information \n"
760 <<
"for a jet energy correction set with label " << set <<
"\n";
765 float Tau::jecFactor(
const unsigned int&
level,
const unsigned int& set)
const {
766 if (!jecSetsAvailable())
767 throw cms::Exception(
"InvalidRequest") <<
"This jet does not carry any jet energy correction factor information \n";
768 if (!jecSetAvailable(set))
769 throw cms::Exception(
"InvalidRequest") <<
"This jet does not carry any jet energy correction factor information \n"
770 <<
"for a jet energy correction set with index " << set <<
"\n";
771 return jec_.at(set).correction(
level) / jec_.at(currentJECSet_).correction(currentJECLevel_);
779 for (
unsigned int idx = 0;
idx < jec_.size(); ++
idx) {
780 if (set.empty() || jec_.at(
idx).jecSet() == set) {
782 return correctedTauJet(jec_[
idx].jecLevel(
level),
idx);
784 throw cms::Exception(
"InvalidRequest") <<
"This JEC level " <<
level <<
" does not exist. \n";
787 throw cms::Exception(
"InvalidRequest") <<
"This JEC set " << set <<
" does not exist. \n";
792 Tau Tau::correctedTauJet(
const unsigned int&
level,
const unsigned int& set)
const {
793 Tau correctedTauJet(*
this);
795 correctedTauJet.setP4(jecFactor(
level, set) *
p4());
797 correctedTauJet.currentJECSet(set);
798 correctedTauJet.currentJECLevel(
level);
799 return correctedTauJet;
807 if (leadPF.
isAvailable() || signalChargedHadrCandPtrs_.isNull())
811 if (
ret.isNull() || (
p->pt() >
ret->pt()))
820 if (leadPF.
isAvailable() || signalNeutralHadrCandPtrs_.isNull())
824 if (
ret.isNull() || (
p->pt() >
ret->pt()))
833 if (leadPF.
isAvailable() || !Tau::ExistSignalCands())
836 return Tau::signalCands()[0];
841 bool Tau::ExistSignalCands()
const {
842 return !(signalChargedHadrCandPtrs_.isNull() && signalNeutralHadrCandPtrs_.isNull() && signalGammaCandPtrs_.isNull());
845 bool Tau::ExistIsolationCands()
const {
846 return !(isolationChargedHadrCandPtrs_.isNull() && isolationNeutralHadrCandPtrs_.isNull() &&
847 isolationGammaCandPtrs_.isNull());
854 std::vector<reco::PFCandidatePtr> r0 = signalPFCands();
856 if (!Tau::ExistSignalCands() || (!r0.empty() && r0.front().isAvailable())) {
857 for (
const auto&
p : r0)
863 std::vector<std::pair<float, size_t> > pt_index;
865 ret2.
reserve(signalChargedHadrCandPtrs_.size() + signalNeutralHadrCandPtrs_.size() + signalGammaCandPtrs_.size());
866 pt_index.reserve(signalChargedHadrCandPtrs_.size() + signalNeutralHadrCandPtrs_.size() +
867 signalGammaCandPtrs_.size());
869 for (
const auto&
p : signalChargedHadrCandPtrs_) {
871 pt_index.push_back(std::make_pair(
p->pt(),
index));
874 for (
const auto&
p : signalNeutralHadrCandPtrs_) {
876 pt_index.push_back(std::make_pair(
p->pt(),
index));
879 for (
const auto&
p : signalGammaCandPtrs_) {
881 pt_index.push_back(std::make_pair(
p->pt(),
index));
884 std::sort(pt_index.begin(), pt_index.end(), std::greater<>());
885 ret.reserve(pt_index.size());
886 for (
const auto&
p : pt_index) {
887 ret.push_back(ret2[
p.second]);
896 std::vector<reco::PFCandidatePtr> r0 = signalPFChargedHadrCands();
897 if (signalChargedHadrCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
899 for (
const auto&
p : r0)
903 return signalChargedHadrCandPtrs_;
910 std::vector<reco::PFCandidatePtr> r0 = signalPFNeutrHadrCands();
911 if (signalNeutralHadrCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
913 for (
const auto&
p : r0)
917 return signalNeutralHadrCandPtrs_;
924 std::vector<reco::PFCandidatePtr> r0 = signalPFGammaCands();
925 if (signalGammaCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
927 for (
const auto&
p : r0)
931 return signalGammaCandPtrs_;
938 std::vector<reco::PFCandidatePtr> r0 = isolationPFCands();
940 if (!Tau::ExistIsolationCands() || (!r0.empty() && r0.front().isAvailable())) {
941 for (
const auto&
p : r0)
947 std::vector<std::pair<float, size_t> > pt_index;
948 ret2.
reserve(isolationChargedHadrCandPtrs_.size() + isolationNeutralHadrCandPtrs_.size() +
949 isolationGammaCandPtrs_.size());
950 pt_index.reserve(isolationChargedHadrCandPtrs_.size() + isolationNeutralHadrCandPtrs_.size() +
951 isolationGammaCandPtrs_.size());
953 for (
const auto&
p : isolationChargedHadrCandPtrs_) {
955 pt_index.push_back(std::make_pair(
p->pt(),
index));
958 for (
const auto&
p : isolationNeutralHadrCandPtrs_) {
960 pt_index.push_back(std::make_pair(
p->pt(),
index));
963 for (
const auto&
p : isolationGammaCandPtrs_) {
965 pt_index.push_back(std::make_pair(
p->pt(),
index));
968 std::sort(pt_index.begin(), pt_index.end(), std::greater<>());
969 ret.reserve(pt_index.size());
970 for (
const auto&
p : pt_index) {
971 ret.push_back(ret2[
p.second]);
980 std::vector<reco::PFCandidatePtr> r0 = isolationPFChargedHadrCands();
981 if (isolationChargedHadrCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
983 for (
const auto&
p : r0)
987 return isolationChargedHadrCandPtrs_;
995 std::vector<reco::PFCandidatePtr> r0 = isolationPFNeutrHadrCands();
996 if (isolationNeutralHadrCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
998 for (
const auto&
p : r0)
1002 return isolationNeutralHadrCandPtrs_;
1009 std::vector<reco::PFCandidatePtr> r0 = isolationPFGammaCands();
1010 if (isolationGammaCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
1012 for (
const auto&
p : r0)
1016 return isolationGammaCandPtrs_;
1023 if (Tau::ExistSignalCands())
1024 return Tau::signalCands().size();
1025 else if (pfSpecific_.empty())
1028 return pfSpecific().selectedSignalPFCands_.size();
1032 if (Tau::ExistSignalCands())
1033 return Tau::signalCands()[
i];
1034 else if (pfSpecific_.empty())
1037 return pfSpecific().selectedSignalPFCands_[
i];