8 #include <boost/bind.hpp> 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)
36 ,embeddedIsolationTracks_(
false)
37 ,embeddedLeadTrack_(
false)
38 ,embeddedSignalTracks_(
false)
39 ,embeddedLeadPFCand_(
false)
40 ,embeddedLeadPFChargedHadrCand_(
false)
41 ,embeddedLeadPFNeutralCand_(
false)
42 ,embeddedSignalPFCands_(
false)
43 ,embeddedSignalPFChargedHadrCands_(
false)
44 ,embeddedSignalPFNeutralHadrCands_(
false)
45 ,embeddedSignalPFGammaCands_(
false)
46 ,embeddedIsolationPFCands_(
false)
47 ,embeddedIsolationPFChargedHadrCands_(
false)
48 ,embeddedIsolationPFNeutralHadrCands_(
false)
49 ,embeddedIsolationPFGammaCands_(
false)
51 initFromBaseTau(aTau);
57 ,embeddedIsolationTracks_(
false)
58 ,embeddedLeadTrack_(
false)
59 ,embeddedSignalTracks_(
false)
60 ,embeddedLeadPFCand_(
false)
61 ,embeddedLeadPFChargedHadrCand_(
false)
62 ,embeddedLeadPFNeutralCand_(
false)
63 ,embeddedSignalPFCands_(
false)
64 ,embeddedSignalPFChargedHadrCands_(
false)
65 ,embeddedSignalPFNeutralHadrCands_(
false)
66 ,embeddedSignalPFGammaCands_(
false)
67 ,embeddedIsolationPFCands_(
false)
68 ,embeddedIsolationPFChargedHadrCands_(
false)
69 ,embeddedIsolationPFNeutralHadrCands_(
false)
70 ,embeddedIsolationPFGammaCands_(
false)
72 initFromBaseTau(*aTauRef);
78 ,embeddedIsolationTracks_(
false)
79 ,embeddedLeadTrack_(
false)
80 ,embeddedSignalTracks_(
false)
81 ,embeddedLeadPFCand_(
false)
82 ,embeddedLeadPFChargedHadrCand_(
false)
83 ,embeddedLeadPFNeutralCand_(
false)
84 ,embeddedSignalPFCands_(
false)
85 ,embeddedSignalPFChargedHadrCands_(
false)
86 ,embeddedSignalPFNeutralHadrCands_(
false)
87 ,embeddedSignalPFGammaCands_(
false)
88 ,embeddedIsolationPFCands_(
false)
89 ,embeddedIsolationPFChargedHadrCands_(
false)
90 ,embeddedIsolationPFNeutralHadrCands_(
false)
91 ,embeddedIsolationPFGammaCands_(
false)
93 initFromBaseTau(*aTauRef);
98 if (pfTau !=
nullptr){
104 signalChargedHadrCandPtrs_.push_back(ptr);
107 signalNeutralHadrCandPtrs_.push_back(ptr);
110 signalGammaCandPtrs_.push_back(ptr);
113 isolationChargedHadrCandPtrs_.push_back(ptr);
116 isolationNeutralHadrCandPtrs_.push_back(ptr);
119 isolationGammaCandPtrs_.push_back(ptr);
139 out <<
"\tpat::Tau: ";
140 out << std::setiosflags(std::ios::right);
142 out << std::setprecision(3);
143 out <<
" E/pT/eta/phi " 153 if (embeddedIsolationTracks_) {
154 if (!isolationTracksTransientRefVector_.isSet()) {
156 trackRefVec->
reserve(isolationTracks_.size());
157 for (
unsigned int i = 0;
i < isolationTracks_.size();
i++) {
160 isolationTracksTransientRefVector_.set(
std::move(trackRefVec));
162 return *isolationTracksTransientRefVector_;
171 if (embeddedLeadTrack_) {
181 if (embeddedSignalTracks_) {
182 if (!signalTracksTransientRefVector_.isSet()) {
184 trackRefVec->
reserve(signalTracks_.size());
185 for (
unsigned int i = 0;
i < signalTracks_.size();
i++) {
188 signalTracksTransientRefVector_.set(
std::move(trackRefVec));
190 return *signalTracksTransientRefVector_;
199 isolationTracks_.clear();
201 for (
unsigned int i = 0;
i < trackRefVec.
size();
i++) {
202 isolationTracks_.push_back(*trackRefVec.
at(
i));
204 embeddedIsolationTracks_ =
true;
213 embeddedLeadTrack_ =
true;
220 signalTracks_.clear();
222 for (
unsigned int i = 0;
i < trackRefVec.
size();
i++) {
223 signalTracks_.push_back(*trackRefVec.
at(
i));
225 embeddedSignalTracks_ =
true;
232 genJet_.push_back(*gj);
237 return (!genJet_.empty() ? &genJet_.front() :
nullptr);
243 for (std::vector<IdPair>::const_iterator it = tauIDs_.begin(), ed = tauIDs_.end(); it != ed; ++it) {
244 if (it->first == name)
return it->second;
247 ex <<
"pat::Tau: the ID " << name <<
" can't be found in this pat::Tau.\n";
248 ex <<
"The available IDs are: ";
249 for (std::vector<IdPair>::const_iterator it = tauIDs_.begin(), ed = tauIDs_.end(); it != ed; ++it) {
250 ex <<
"'" << it->first <<
"' ";
256 bool Tau::isTauIDAvailable(
const std::string & name)
const {
257 for (std::vector<IdPair>::const_iterator it = tauIDs_.begin(), ed = tauIDs_.end(); it != ed; ++it) {
258 if (it->first == name)
return true;
265 if (!isPFTau())
throw cms::Exception(
"Type Error") <<
"Requesting a PFTau-specific information from a pat::Tau which wasn't made from a PFTau.\n";
266 return pfSpecific_[0];
270 if (pfEssential_.empty())
throw cms::Exception(
"Type Error") <<
"Requesting a PFTau-specific information from a pat::Tau which wasn't made from a PFTau.\n";
271 return pfEssential_[0];
276 if (!isCaloTau())
throw cms::Exception(
"Type Error") <<
"Requesting a CaloTau-specific information from a pat::Tau which wasn't made from a CaloTau.\n";
277 return caloSpecific_[0];
282 if ( isCaloTau() )
return caloSpecific().p4Jet_;
284 throw cms::Exception(
"Type Error") <<
"Requesting a CaloTau/PFTau-specific information from a pat::Tau which wasn't made from either a CaloTau or a PFTau.\n";
287 float Tau::dxy_Sig()
const 289 if ( pfEssential().dxy_error_ != 0 )
return (pfEssential().dxy_/pfEssential().dxy_error_);
306 float Tau::ip3d_Sig()
const 308 if( pfEssential().ip3d_error_ != 0 )
return (pfEssential().ip3d_/pfEssential().ip3d_error_);
312 float Tau::etaetaMoment()
const 314 if ( isCaloTau() )
return caloSpecific().etaetaMoment_;
315 if ( isPFTau() )
return pfSpecific().etaetaMoment_;
316 throw cms::Exception(
"Type Error") <<
"Requesting a CaloTau/PFTau-specific information from a pat::Tau which wasn't made from either a CaloTau or a PFTau.\n";
319 float Tau::phiphiMoment()
const 321 if ( isCaloTau() )
return caloSpecific().phiphiMoment_;
322 if ( isPFTau() )
return pfSpecific().phiphiMoment_;
323 throw cms::Exception(
"Type Error") <<
"Requesting a CaloTau/PFTau-specific information from a pat::Tau which wasn't made from either a CaloTau or a PFTau.\n";
326 float Tau::etaphiMoment()
const 328 if ( isCaloTau() )
return caloSpecific().etaphiMoment_;
329 if ( isPFTau() )
return pfSpecific().etaphiMoment_;
330 throw cms::Exception(
"Type Error") <<
"Requesting a CaloTau/PFTau-specific information from a pat::Tau which wasn't made from either a CaloTau or a PFTau.\n";
335 if (!isPFTau())
throw cms::Exception(
"Type Error") <<
"Requesting a PFTau-specific information from a pat::Tau which wasn't made from a PFTau.\n";
345 if (pfSpecific_[0].leadPFCand_.isNonnull() ) {
346 leadPFCand_.push_back(*static_cast<const reco::PFCandidate*>(&*pfSpecific_[0].leadPFCand_));
347 embeddedLeadPFCand_ =
true;
355 leadPFChargedHadrCand_.clear();
356 if (pfSpecific_[0].leadPFChargedHadrCand_.isNonnull() ) {
357 leadPFChargedHadrCand_.push_back(*static_cast<const reco::PFCandidate*>(&*pfSpecific_[0].leadPFChargedHadrCand_));
358 embeddedLeadPFChargedHadrCand_ =
true;
366 leadPFNeutralCand_.clear();
367 if (pfSpecific_[0].leadPFNeutralCand_.isNonnull() ) {
368 leadPFNeutralCand_.push_back(*static_cast<const reco::PFCandidate*>(&*pfSpecific_[0].leadPFNeutralCand_));
369 embeddedLeadPFNeutralCand_ =
true;
377 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedSignalPFCands_;
378 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
379 signalPFCands_.push_back(candPtrs.at(
i));
381 embeddedSignalPFCands_ =
true;
387 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedSignalPFChargedHadrCands_;
388 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
389 signalPFChargedHadrCands_.push_back(candPtrs.at(
i));
391 embeddedSignalPFChargedHadrCands_ =
true;
397 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedSignalPFNeutrHadrCands_;
398 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
399 signalPFNeutralHadrCands_.push_back(candPtrs.at(
i));
401 embeddedSignalPFNeutralHadrCands_ =
true;
407 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedSignalPFGammaCands_;
408 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
409 signalPFGammaCands_.push_back(candPtrs.at(
i));
411 embeddedSignalPFGammaCands_ =
true;
418 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedIsolationPFCands_;
419 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
420 isolationPFCands_.push_back(candPtrs.at(
i));
422 embeddedIsolationPFCands_ =
true;
429 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedIsolationPFChargedHadrCands_;
430 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
431 isolationPFChargedHadrCands_.push_back(candPtrs.at(
i));
433 embeddedIsolationPFChargedHadrCands_ =
true;
439 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedIsolationPFNeutrHadrCands_;
440 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
441 isolationPFNeutralHadrCands_.push_back(candPtrs.at(
i));
443 embeddedIsolationPFNeutralHadrCands_ =
true;
449 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedIsolationPFGammaCands_;
450 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
451 isolationPFGammaCands_.push_back(candPtrs.at(
i));
453 embeddedIsolationPFGammaCands_ =
true;
457 if(!isPFTau() )
throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
458 if ( !pfSpecific().signalTauChargedHadronCandidates_.empty() ) {
473 if(!embeddedLeadPFChargedHadrCand_){
481 if(!embeddedLeadPFNeutralCand_){
489 if(!embeddedLeadPFCand_){
496 const std::vector<reco::PFCandidatePtr>& Tau::signalPFCands()
const {
497 if (embeddedSignalPFCands_) {
498 if (!signalPFCandsTransientPtrs_.isSet()) {
499 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
500 aPtrs->reserve(signalPFCands_.size());
501 for (
unsigned int i = 0;
i < signalPFCands_.size();
i++) {
504 signalPFCandsTransientPtrs_.set(
std::move(aPtrs));
506 return *signalPFCandsTransientPtrs_;
508 if(pfSpecific_.empty() || pfSpecific().selectedSignalPFCands_.empty() || !pfSpecific().selectedSignalPFCands_.front().isAvailable()){
511 if (!signalPFCandsTransientPtrs_.isSet()) {
512 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
513 signalPFCandsTransientPtrs_.set(
std::move(aPtrs));
515 return *signalPFCandsTransientPtrs_;
516 }
else return pfSpecific().selectedSignalPFCands_;
520 const std::vector<reco::PFCandidatePtr>& Tau::signalPFChargedHadrCands()
const {
521 if (embeddedSignalPFChargedHadrCands_) {
522 if (!signalPFChargedHadrCandsTransientPtrs_.isSet()) {
523 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
524 aPtrs->reserve(signalPFChargedHadrCands_.size());
525 for (
unsigned int i = 0;
i < signalPFChargedHadrCands_.size();
i++) {
528 signalPFChargedHadrCandsTransientPtrs_.set(
std::move(aPtrs));
530 return *signalPFChargedHadrCandsTransientPtrs_;
532 if(pfSpecific_.empty() || pfSpecific().selectedSignalPFChargedHadrCands_.empty() || !pfSpecific().selectedSignalPFChargedHadrCands_.front().isAvailable()){
535 if (!signalPFChargedHadrCandsTransientPtrs_.isSet()) {
536 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
537 signalPFChargedHadrCandsTransientPtrs_.set(
std::move(aPtrs));
539 return *signalPFChargedHadrCandsTransientPtrs_;
540 }
else return pfSpecific().selectedSignalPFChargedHadrCands_;
544 const std::vector<reco::PFCandidatePtr>& Tau::signalPFNeutrHadrCands()
const {
545 if (embeddedSignalPFNeutralHadrCands_) {
546 if (!signalPFNeutralHadrCandsTransientPtrs_.isSet()) {
547 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
548 aPtrs->reserve(signalPFNeutralHadrCands_.size());
549 for (
unsigned int i = 0;
i < signalPFNeutralHadrCands_.size();
i++) {
552 signalPFNeutralHadrCandsTransientPtrs_.set(
std::move(aPtrs));
554 return *signalPFNeutralHadrCandsTransientPtrs_;
556 if(pfSpecific_.empty() || pfSpecific().selectedSignalPFNeutrHadrCands_.empty() || !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_;
564 }
else return pfSpecific().selectedSignalPFNeutrHadrCands_;
568 const std::vector<reco::PFCandidatePtr>& Tau::signalPFGammaCands()
const {
569 if (embeddedSignalPFGammaCands_) {
570 if (!signalPFGammaCandsTransientPtrs_.isSet()) {
571 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
572 aPtrs->reserve(signalPFGammaCands_.size());
573 for (
unsigned int i = 0;
i < signalPFGammaCands_.size();
i++) {
576 signalPFGammaCandsTransientPtrs_.set(
std::move(aPtrs));
578 return *signalPFGammaCandsTransientPtrs_;
580 if(pfSpecific_.empty() || pfSpecific().selectedSignalPFGammaCands_.empty() || !pfSpecific().selectedSignalPFGammaCands_.front().isAvailable()){
583 if (!signalPFGammaCandsTransientPtrs_.isSet()) {
584 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
585 signalPFGammaCandsTransientPtrs_.set(
std::move(aPtrs));
587 return *signalPFGammaCandsTransientPtrs_;
588 }
else return pfSpecific().selectedSignalPFGammaCands_;
592 const std::vector<reco::PFRecoTauChargedHadron> & Tau::signalTauChargedHadronCandidates()
const {
593 if(pfSpecific_.empty())
throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
594 return pfSpecific().signalTauChargedHadronCandidates_;
597 const std::vector<reco::RecoTauPiZero> & Tau::signalPiZeroCandidates()
const {
598 if(pfSpecific_.empty())
throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
599 return pfSpecific().signalPiZeroCandidates_;
602 const std::vector<reco::PFCandidatePtr>& Tau::isolationPFCands()
const {
603 if (embeddedIsolationPFCands_) {
604 if (!isolationPFCandsTransientPtrs_.isSet()) {
605 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
606 aPtrs->reserve(isolationPFCands_.size());
607 for (
unsigned int i = 0;
i < isolationPFCands_.size();
i++) {
610 isolationPFCandsTransientPtrs_.set(
std::move(aPtrs));
612 return *isolationPFCandsTransientPtrs_;
614 if(pfSpecific_.empty() || pfSpecific().selectedIsolationPFCands_.empty() || !pfSpecific().selectedIsolationPFCands_.front().isAvailable()){
617 if (!isolationPFCandsTransientPtrs_.isSet()) {
618 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
619 isolationPFCandsTransientPtrs_.set(
std::move(aPtrs));
621 return *isolationPFCandsTransientPtrs_;
622 }
else return pfSpecific().selectedIsolationPFCands_;
626 const std::vector<reco::PFCandidatePtr>& Tau::isolationPFChargedHadrCands()
const {
627 if (embeddedIsolationPFChargedHadrCands_) {
628 if (!isolationPFChargedHadrCandsTransientPtrs_.isSet()) {
629 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
630 aPtrs->reserve(isolationPFChargedHadrCands_.size());
631 for (
unsigned int i = 0;
i < isolationPFChargedHadrCands_.size();
i++) {
634 isolationPFChargedHadrCandsTransientPtrs_.set(
std::move(aPtrs));
636 return *isolationPFChargedHadrCandsTransientPtrs_;
638 if(pfSpecific_.empty() || pfSpecific().selectedIsolationPFChargedHadrCands_.empty() || !pfSpecific().selectedIsolationPFChargedHadrCands_.front().isAvailable()){
641 if (!isolationPFChargedHadrCandsTransientPtrs_.isSet()) {
642 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
643 isolationPFChargedHadrCandsTransientPtrs_.set(
std::move(aPtrs));
645 return *isolationPFChargedHadrCandsTransientPtrs_;
646 }
else 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() || !pfSpecific().selectedIsolationPFNeutrHadrCands_.front().isAvailable()){
665 if (!isolationPFNeutralHadrCandsTransientPtrs_.isSet()) {
666 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
667 isolationPFNeutralHadrCandsTransientPtrs_.set(
std::move(aPtrs));
669 return *isolationPFNeutralHadrCandsTransientPtrs_;
670 }
else return pfSpecific().selectedIsolationPFNeutrHadrCands_;
674 const std::vector<reco::PFCandidatePtr>& Tau::isolationPFGammaCands()
const {
675 if (embeddedIsolationPFGammaCands_) {
676 if (!isolationPFGammaCandsTransientPtrs_.isSet()) {
677 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
678 aPtrs->reserve(isolationPFGammaCands_.size());
679 for (
unsigned int i = 0;
i < isolationPFGammaCands_.size();
i++) {
682 isolationPFGammaCandsTransientPtrs_.set(
std::move(aPtrs));
684 return *isolationPFGammaCandsTransientPtrs_;
686 if(pfSpecific_.empty() || pfSpecific().selectedIsolationPFGammaCands_.empty() || !pfSpecific().selectedIsolationPFGammaCands_.front().isAvailable()){
689 if (!isolationPFGammaCandsTransientPtrs_.isSet()) {
690 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
691 isolationPFGammaCandsTransientPtrs_.set(
std::move(aPtrs));
693 return *isolationPFGammaCandsTransientPtrs_;
694 }
else return pfSpecific().selectedIsolationPFGammaCands_;
698 const std::vector<reco::PFRecoTauChargedHadron> & Tau::isolationTauChargedHadronCandidates()
const {
699 if(pfSpecific_.empty())
throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
700 return pfSpecific().isolationTauChargedHadronCandidates_;
703 const std::vector<reco::RecoTauPiZero> & Tau::isolationPiZeroCandidates()
const {
704 if(pfSpecific_.empty())
throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
705 return pfSpecific().isolationPiZeroCandidates_;
712 void Tau::initializeJEC(
unsigned int level,
unsigned int set)
715 currentJECLevel(level);
716 setP4(jec_[
set].correction(level)*
p4());
722 for ( std::vector<pat::TauJetCorrFactors>::const_iterator corrFactor = jec_.begin();
723 corrFactor != jec_.end(); ++corrFactor ) {
724 if ( corrFactor->jecSet() == set )
return corrFactor-jec_.begin();
730 const std::vector<std::string> Tau::availableJECSets()
const 732 std::vector<std::string> sets;
733 for ( std::vector<pat::TauJetCorrFactors>::const_iterator corrFactor = jec_.begin();
734 corrFactor != jec_.end(); ++corrFactor ) {
735 sets.push_back(corrFactor->jecSet());
740 const std::vector<std::string> Tau::availableJECLevels(
const int&
set)
const 742 return set>=0 ? jec_.at(
set).correctionLabels() : std::vector<std::string>();
749 for (
unsigned int idx = 0;
idx < jec_.size(); ++
idx ) {
750 if (
set.
empty() || jec_.at(
idx).jecSet() == set ){
751 if ( jec_[
idx].jecLevel(level) >= 0 )
752 return jecFactor(jec_[
idx].jecLevel(level),
idx);
755 <<
"This JEC level " << level <<
" does not exist. \n";
759 <<
"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 767 if ( !jecSetsAvailable() )
769 <<
"This jet does not carry any jet energy correction factor information \n";
770 if ( !jecSetAvailable(
set) )
772 <<
"This jet does not carry any jet energy correction factor information \n" 773 <<
"for a jet energy correction set with index " <<
set <<
"\n";
774 return jec_.at(
set).correction(level)/jec_.at(currentJECSet_).correction(currentJECLevel_);
783 for (
unsigned int idx = 0;
idx < jec_.size(); ++
idx ) {
784 if (
set.
empty() || jec_.at(
idx).jecSet() == set ) {
785 if ( jec_[
idx].jecLevel(level) >= 0 )
786 return correctedTauJet(jec_[
idx].jecLevel(level),
idx);
789 <<
"This JEC level " << level <<
" does not exist. \n";
793 <<
"This JEC set " <<
set <<
" does not exist. \n";
798 Tau Tau::correctedTauJet(
const unsigned int& level,
const unsigned int&
set)
const 800 Tau correctedTauJet(*
this);
802 correctedTauJet.
setP4(jecFactor(level,
set)*
p4());
806 return correctedTauJet;
816 if (leadPF.
isAvailable() || signalChargedHadrCandPtrs_.isNull())
return leadPF;
819 if (ret.
isNull() || (
p->pt() > ret->
pt())) ret =
p;
828 if (leadPF.
isAvailable() || signalNeutralHadrCandPtrs_.isNull())
return leadPF;
831 if (ret.
isNull() || (
p->pt() > ret->
pt())) ret =
p;
840 if (leadPF.
isAvailable() || !Tau::ExistSignalCands())
return leadPF;
841 else return Tau::signalCands()[0];
846 bool Tau::ExistSignalCands()
const {
847 return !(signalChargedHadrCandPtrs_.isNull() && signalNeutralHadrCandPtrs_.isNull() && signalGammaCandPtrs_.isNull());
850 bool Tau::ExistIsolationCands()
const {
851 return !(isolationChargedHadrCandPtrs_.isNull() && isolationNeutralHadrCandPtrs_.isNull() && isolationGammaCandPtrs_.isNull());
858 std::vector<reco::PFCandidatePtr> r0 = signalPFCands();
860 if(!Tau::ExistSignalCands() || (!r0.empty() && r0.front().isAvailable())) {
866 std::vector<std::pair<float,size_t> > pt_index;
868 for (
const auto &
p : signalChargedHadrCandPtrs_){ ret2.
push_back(
p); pt_index.push_back(std::make_pair(
p->pt(),
index)); index++;}
869 for (
const auto &
p : signalNeutralHadrCandPtrs_){ ret2.
push_back(
p); pt_index.push_back(std::make_pair(
p->pt(),
index)); index++;}
870 for (
const auto &
p : signalGammaCandPtrs_){ ret2.
push_back(
p); pt_index.push_back(std::make_pair(
p->pt(),
index)); index++;}
871 std::sort(pt_index.begin(),pt_index.end(),
874 for(
const auto &
p : pt_index){
884 std::vector<reco::PFCandidatePtr> r0 = signalPFChargedHadrCands();
885 if(signalChargedHadrCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
890 return signalChargedHadrCandPtrs_;
898 std::vector<reco::PFCandidatePtr> r0 = signalPFNeutrHadrCands();
899 if(signalNeutralHadrCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
904 return signalNeutralHadrCandPtrs_;
911 std::vector<reco::PFCandidatePtr> r0 = signalPFGammaCands();
912 if(signalGammaCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
917 return signalGammaCandPtrs_;
924 std::vector<reco::PFCandidatePtr> r0 = isolationPFCands();
926 if(!Tau::ExistIsolationCands() || (!r0.empty() && r0.front().isAvailable())) {
932 std::vector<std::pair<float,size_t> > pt_index;
934 for (
const auto &
p : isolationChargedHadrCandPtrs_){ ret2.
push_back(
p); pt_index.push_back(std::make_pair(
p->pt(),
index)); index++;}
935 for (
const auto &
p : isolationNeutralHadrCandPtrs_){ ret2.
push_back(
p); pt_index.push_back(std::make_pair(
p->pt(),
index)); index++;}
936 for (
const auto &
p : isolationGammaCandPtrs_){ ret2.
push_back(
p); pt_index.push_back(std::make_pair(
p->pt(),
index)); index++;}
937 std::sort(pt_index.begin(),pt_index.end(),
940 for(
const auto &
p : pt_index){
950 std::vector<reco::PFCandidatePtr> r0 = isolationPFChargedHadrCands();
951 if(isolationChargedHadrCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
956 return isolationChargedHadrCandPtrs_;
964 std::vector<reco::PFCandidatePtr> r0 = isolationPFNeutrHadrCands();
965 if(isolationNeutralHadrCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
970 return isolationNeutralHadrCandPtrs_;
977 std::vector<reco::PFCandidatePtr> r0 = isolationPFGammaCands();
978 if(isolationGammaCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
983 return isolationGammaCandPtrs_;
991 size_t Tau::numberOfSourceCandidatePtrs()
const {
992 if (Tau::ExistSignalCands())
return Tau::signalCands().
size();
993 else if(pfSpecific_.empty())
return 0;
994 else return pfSpecific().selectedSignalPFCands_.size();
998 if (Tau::ExistSignalCands())
return Tau::signalCands()[
i];
1000 else return pfSpecific().selectedSignalPFCands_[
i];
virtual reco::TrackRef leadTrack() const
embedIsolationPFNeutralHadrCands
embed in AOD externally stored isolation PFChargedHadronCandidates
size_type size() const
Size of the RefVector.
double eta() const final
momentum pseudorapidity
embedIsolationPFChargedHadrCands
embed in AOD externally stored isolation PFCandidates
virtual const reco::TrackRefVector & isolationTracks() const
void push_back(Ptr< T > const &iPtr)
T const * get() const
Returns C++ pointer to the item.
embedSignalPFGammaCands
embed in AOD externally stored signal PFNeutralHadronCandidates
embedSignalPFCands
embed in AOD externally stored leading PFNeutral Candidate
double pt() const final
transverse momentum
const std::vector< reco::CandidatePtr > & signalGammaCands() const
Gamma candidates in signal region.
const reco::PFCandidatePtr convertToPFCandidatePtr(const reco::CandidatePtr &ptr)
InputIterator leadCand(InputIterator begin, InputIterator end)
embedSignalPFNeutralHadrCands
embed in AOD externally stored signal PFChargedHadronCandidates
const std::vector< reco::CandidatePtr > & isolationGammaCands() const
Gamma candidates in isolation region.
embedSignalTracks
embed in AOD externally stored leading track
const std::vector< reco::CandidatePtr > & signalNeutrHadrCands() const
Neutral hadrons in signal region.
std::ostream & operator<<(std::ostream &, BeamSpot beam)
embedIsolationPFGammaCands
embed in AOD externally stored isolation PFNeutralHadronCandidates
embedIsolationTracks
embed in AOD externally stored signal tracks
const CandidatePtr & leadChargedHadrCand() const
double energy() const final
energy
bool isNull() const
Checks for null.
Jets made from MC generator particles.
embedLeadPFNeutralCand
embed in AOD externally stored leading PFChargedHadron candidate
virtual const reco::TrackRefVector & signalTracks() const
void reserve(size_type n)
Reserve space for RefVector.
std::string currentJECLevel() const
return the name of the current step of jet energy corrections
Analysis-level tau class.
const std::vector< reco::CandidatePtr > & isolationChargedHadrCands() const
Charged candidates in isolation region.
embedSignalPFChargedHadrCands
embed in AOD externally stored signal PFCandidates
virtual double pt() const =0
transverse momentum
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
edm::Ref< PFRecoTauChargedHadronCollection > PFRecoTauChargedHadronRef
presistent reference to a PFRecoTauChargedHadron
math::XYZTLorentzVector LorentzVector
Lorentz vector.
const std::vector< reco::CandidatePtr > & signalChargedHadrCands() const
Charged hadrons in signal region.
Particle reconstructed by the particle flow algorithm.
value_type const at(size_type idx) const
Retrieve an element of the RefVector.
embedIsolationPFCands
embed in AOD externally stored signal PFGammaCandidates
const std::vector< reco::CandidatePtr > & isolationNeutrHadrCands() const
size_type size() const
Size of the RefVector.
embedLeadPFCand
embed in AOD externally stored isolation tracks embedding objects (for PFTaus only) ...
embedLeadPFChargedHadrCand
embed in AOD externally stored leading PFCandidate
std::string currentJECSet() const
returns the label of the current set of jet energy corrections
uint32_t dimension(pat::CandKinResolution::Parametrization parametrization)
Returns the number of free parameters in a parametrization (3 or 4)
edm::Ptr< PFCandidate > PFCandidatePtr
persistent Ptr to a PFCandidate
double phi() const final
momentum azimuthal angle
void setP4(const LorentzVector &p4) final
set 4-momentum
math::ErrorF< 3 >::type CovMatrix