7 #include <boost/bind.hpp> 15 ,embeddedIsolationTracks_(
false)
16 ,embeddedLeadTrack_(
false)
17 ,embeddedSignalTracks_(
false)
18 ,embeddedLeadPFCand_(
false)
19 ,embeddedLeadPFChargedHadrCand_(
false)
20 ,embeddedLeadPFNeutralCand_(
false)
21 ,embeddedSignalPFCands_(
false)
22 ,embeddedSignalPFChargedHadrCands_(
false)
23 ,embeddedSignalPFNeutralHadrCands_(
false)
24 ,embeddedSignalPFGammaCands_(
false)
25 ,embeddedIsolationPFCands_(
false)
26 ,embeddedIsolationPFChargedHadrCands_(
false)
27 ,embeddedIsolationPFNeutralHadrCands_(
false)
28 ,embeddedIsolationPFGammaCands_(
false)
35 ,embeddedIsolationTracks_(
false)
36 ,embeddedLeadTrack_(
false)
37 ,embeddedSignalTracks_(
false)
38 ,embeddedLeadPFCand_(
false)
39 ,embeddedLeadPFChargedHadrCand_(
false)
40 ,embeddedLeadPFNeutralCand_(
false)
41 ,embeddedSignalPFCands_(
false)
42 ,embeddedSignalPFChargedHadrCands_(
false)
43 ,embeddedSignalPFNeutralHadrCands_(
false)
44 ,embeddedSignalPFGammaCands_(
false)
45 ,embeddedIsolationPFCands_(
false)
46 ,embeddedIsolationPFChargedHadrCands_(
false)
47 ,embeddedIsolationPFNeutralHadrCands_(
false)
48 ,embeddedIsolationPFGammaCands_(
false)
51 if (pfTau !=
nullptr){
62 ,embeddedIsolationTracks_(
false)
63 ,embeddedLeadTrack_(
false)
64 ,embeddedSignalTracks_(
false)
65 ,embeddedLeadPFCand_(
false)
66 ,embeddedLeadPFChargedHadrCand_(
false)
67 ,embeddedLeadPFNeutralCand_(
false)
68 ,embeddedSignalPFCands_(
false)
69 ,embeddedSignalPFChargedHadrCands_(
false)
70 ,embeddedSignalPFNeutralHadrCands_(
false)
71 ,embeddedSignalPFGammaCands_(
false)
72 ,embeddedIsolationPFCands_(
false)
73 ,embeddedIsolationPFChargedHadrCands_(
false)
74 ,embeddedIsolationPFNeutralHadrCands_(
false)
75 ,embeddedIsolationPFGammaCands_(
false)
78 if (pfTau !=
nullptr){
89 ,embeddedIsolationTracks_(
false)
90 ,embeddedLeadTrack_(
false)
91 ,embeddedSignalTracks_(
false)
92 ,embeddedLeadPFCand_(
false)
93 ,embeddedLeadPFChargedHadrCand_(
false)
94 ,embeddedLeadPFNeutralCand_(
false)
95 ,embeddedSignalPFCands_(
false)
96 ,embeddedSignalPFChargedHadrCands_(
false)
97 ,embeddedSignalPFNeutralHadrCands_(
false)
98 ,embeddedSignalPFGammaCands_(
false)
99 ,embeddedIsolationPFCands_(
false)
100 ,embeddedIsolationPFChargedHadrCands_(
false)
101 ,embeddedIsolationPFNeutralHadrCands_(
false)
102 ,embeddedIsolationPFGammaCands_(
false)
105 if (pfTau !=
nullptr){
122 out <<
"\tpat::Tau: ";
123 out << std::setiosflags(std::ios::right);
125 out << std::setprecision(3);
126 out <<
" E/pT/eta/phi " 136 if (embeddedIsolationTracks_) {
137 if (!isolationTracksTransientRefVector_.isSet()) {
139 trackRefVec->
reserve(isolationTracks_.size());
140 for (
unsigned int i = 0;
i < isolationTracks_.size();
i++) {
143 isolationTracksTransientRefVector_.set(
std::move(trackRefVec));
145 return *isolationTracksTransientRefVector_;
154 if (embeddedLeadTrack_) {
164 if (embeddedSignalTracks_) {
165 if (!signalTracksTransientRefVector_.isSet()) {
167 trackRefVec->
reserve(signalTracks_.size());
168 for (
unsigned int i = 0;
i < signalTracks_.size();
i++) {
171 signalTracksTransientRefVector_.set(
std::move(trackRefVec));
173 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;
196 embeddedLeadTrack_ =
true;
203 signalTracks_.clear();
205 for (
unsigned int i = 0;
i < trackRefVec.
size();
i++) {
206 signalTracks_.push_back(*trackRefVec.
at(
i));
208 embeddedSignalTracks_ =
true;
215 genJet_.push_back(*gj);
220 return (!genJet_.empty() ? &genJet_.front() :
nullptr);
226 for (std::vector<IdPair>::const_iterator it = tauIDs_.begin(), ed = tauIDs_.end(); it != ed; ++it) {
227 if (it->first == name)
return it->second;
230 ex <<
"pat::Tau: the ID " << name <<
" can't be found in this pat::Tau.\n";
231 ex <<
"The available IDs are: ";
232 for (std::vector<IdPair>::const_iterator it = tauIDs_.begin(), ed = tauIDs_.end(); it != ed; ++it) {
233 ex <<
"'" << it->first <<
"' ";
239 bool Tau::isTauIDAvailable(
const std::string & name)
const {
240 for (std::vector<IdPair>::const_iterator it = tauIDs_.begin(), ed = tauIDs_.end(); it != ed; ++it) {
241 if (it->first == name)
return true;
248 if (!isPFTau())
throw cms::Exception(
"Type Error") <<
"Requesting a PFTau-specific information from a pat::Tau which wasn't made from a PFTau.\n";
249 return pfSpecific_[0];
253 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";
254 return pfEssential_[0];
259 if (!isCaloTau())
throw cms::Exception(
"Type Error") <<
"Requesting a CaloTau-specific information from a pat::Tau which wasn't made from a CaloTau.\n";
260 return caloSpecific_[0];
265 if ( isCaloTau() )
return caloSpecific().p4Jet_;
267 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";
270 float Tau::dxy_Sig()
const 272 if ( pfEssential().dxy_error_ != 0 )
return (pfEssential().dxy_/pfEssential().dxy_error_);
289 float Tau::ip3d_Sig()
const 291 if( pfEssential().ip3d_error_ != 0 )
return (pfEssential().ip3d_/pfEssential().ip3d_error_);
295 float Tau::etaetaMoment()
const 297 if ( isCaloTau() )
return caloSpecific().etaetaMoment_;
298 if ( isPFTau() )
return pfSpecific().etaetaMoment_;
299 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";
302 float Tau::phiphiMoment()
const 304 if ( isCaloTau() )
return caloSpecific().phiphiMoment_;
305 if ( isPFTau() )
return pfSpecific().phiphiMoment_;
306 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";
309 float Tau::etaphiMoment()
const 311 if ( isCaloTau() )
return caloSpecific().etaphiMoment_;
312 if ( isPFTau() )
return pfSpecific().etaphiMoment_;
313 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";
318 if (!isPFTau())
throw cms::Exception(
"Type Error") <<
"Requesting a PFTau-specific information from a pat::Tau which wasn't made from a PFTau.\n";
328 if (pfSpecific_[0].leadPFCand_.isNonnull() ) {
329 leadPFCand_.push_back(*pfSpecific_[0].leadPFCand_);
330 embeddedLeadPFCand_ =
true;
338 leadPFChargedHadrCand_.clear();
339 if (pfSpecific_[0].leadPFChargedHadrCand_.isNonnull() ) {
340 leadPFChargedHadrCand_.push_back(*pfSpecific_[0].leadPFChargedHadrCand_);
341 embeddedLeadPFChargedHadrCand_ =
true;
349 leadPFNeutralCand_.clear();
350 if (pfSpecific_[0].leadPFNeutralCand_.isNonnull() ) {
351 leadPFNeutralCand_.push_back(*pfSpecific_[0].leadPFNeutralCand_);
352 embeddedLeadPFNeutralCand_ =
true;
360 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedSignalPFCands_;
361 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
362 signalPFCands_.push_back(*candPtrs.at(
i));
364 embeddedSignalPFCands_ =
true;
370 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedSignalPFChargedHadrCands_;
371 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
372 signalPFChargedHadrCands_.push_back(*candPtrs.at(
i));
374 embeddedSignalPFChargedHadrCands_ =
true;
380 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedSignalPFNeutrHadrCands_;
381 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
382 signalPFNeutralHadrCands_.push_back(*candPtrs.at(
i));
384 embeddedSignalPFNeutralHadrCands_ =
true;
390 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedSignalPFGammaCands_;
391 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
392 signalPFGammaCands_.push_back(*candPtrs.at(
i));
394 embeddedSignalPFGammaCands_ =
true;
401 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedIsolationPFCands_;
402 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
403 isolationPFCands_.push_back(*candPtrs.at(
i));
405 embeddedIsolationPFCands_ =
true;
412 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedIsolationPFChargedHadrCands_;
413 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
414 isolationPFChargedHadrCands_.push_back(*candPtrs.at(
i));
416 embeddedIsolationPFChargedHadrCands_ =
true;
422 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedIsolationPFNeutrHadrCands_;
423 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
424 isolationPFNeutralHadrCands_.push_back(*candPtrs.at(
i));
426 embeddedIsolationPFNeutralHadrCands_ =
true;
432 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedIsolationPFGammaCands_;
433 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
434 isolationPFGammaCands_.push_back(*candPtrs.at(
i));
436 embeddedIsolationPFGammaCands_ =
true;
440 if(!isPFTau() )
throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
441 if ( !pfSpecific().signalTauChargedHadronCandidates_.empty() ) {
449 if(!embeddedLeadPFChargedHadrCand_){
451 else return pfSpecific().leadPFChargedHadrCand_;
457 if(!embeddedLeadPFNeutralCand_){
459 else return pfSpecific().leadPFNeutralCand_;
465 if(!embeddedLeadPFCand_){
467 return pfSpecific().leadPFCand_;
472 const std::vector<reco::PFCandidatePtr>& Tau::signalPFCands()
const {
473 if (embeddedSignalPFCands_) {
474 if (!signalPFCandsTransientPtrs_.isSet()) {
475 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
476 aPtrs->reserve(signalPFCands_.size());
477 for (
unsigned int i = 0;
i < signalPFCands_.size();
i++) {
480 signalPFCandsTransientPtrs_.set(
std::move(aPtrs));
482 return *signalPFCandsTransientPtrs_;
484 if(pfSpecific_.empty() || pfSpecific().selectedSignalPFCands_.empty() || !pfSpecific().selectedSignalPFCands_.front().isAvailable()){
487 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
488 signalPFCandsTransientPtrs_.set(
std::move(aPtrs));
489 return *signalPFCandsTransientPtrs_;
490 }
else return pfSpecific().selectedSignalPFCands_;
494 const std::vector<reco::PFCandidatePtr>& Tau::signalPFChargedHadrCands()
const {
495 if (embeddedSignalPFChargedHadrCands_) {
496 if (!signalPFChargedHadrCandsTransientPtrs_.isSet()) {
497 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
498 aPtrs->reserve(signalPFChargedHadrCands_.size());
499 for (
unsigned int i = 0;
i < signalPFChargedHadrCands_.size();
i++) {
502 signalPFChargedHadrCandsTransientPtrs_.set(
std::move(aPtrs));
504 return *signalPFChargedHadrCandsTransientPtrs_;
506 if(pfSpecific_.empty() || pfSpecific().selectedSignalPFChargedHadrCands_.empty() || !pfSpecific().selectedSignalPFChargedHadrCands_.front().isAvailable()){
509 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
510 signalPFChargedHadrCandsTransientPtrs_.set(
std::move(aPtrs));
511 return *signalPFChargedHadrCandsTransientPtrs_;
512 }
else return pfSpecific().selectedSignalPFChargedHadrCands_;
516 const std::vector<reco::PFCandidatePtr>& Tau::signalPFNeutrHadrCands()
const {
517 if (embeddedSignalPFNeutralHadrCands_) {
518 if (!signalPFNeutralHadrCandsTransientPtrs_.isSet()) {
519 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
520 aPtrs->reserve(signalPFNeutralHadrCands_.size());
521 for (
unsigned int i = 0;
i < signalPFNeutralHadrCands_.size();
i++) {
524 signalPFNeutralHadrCandsTransientPtrs_.set(
std::move(aPtrs));
526 return *signalPFNeutralHadrCandsTransientPtrs_;
528 if(pfSpecific_.empty() || pfSpecific().selectedSignalPFNeutrHadrCands_.empty() || !pfSpecific().selectedSignalPFNeutrHadrCands_.front().isAvailable()){
531 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
532 signalPFNeutralHadrCandsTransientPtrs_.set(
std::move(aPtrs));
533 return *signalPFNeutralHadrCandsTransientPtrs_;
534 }
else return pfSpecific().selectedSignalPFNeutrHadrCands_;
538 const std::vector<reco::PFCandidatePtr>& Tau::signalPFGammaCands()
const {
539 if (embeddedSignalPFGammaCands_) {
540 if (!signalPFGammaCandsTransientPtrs_.isSet()) {
541 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
542 aPtrs->reserve(signalPFGammaCands_.size());
543 for (
unsigned int i = 0;
i < signalPFGammaCands_.size();
i++) {
546 signalPFGammaCandsTransientPtrs_.set(
std::move(aPtrs));
548 return *signalPFGammaCandsTransientPtrs_;
550 if(pfSpecific_.empty() || pfSpecific().selectedSignalPFGammaCands_.empty() || !pfSpecific().selectedSignalPFGammaCands_.front().isAvailable()){
553 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
554 signalPFGammaCandsTransientPtrs_.set(
std::move(aPtrs));
555 return *signalPFGammaCandsTransientPtrs_;
556 }
else return pfSpecific().selectedSignalPFGammaCands_;
560 const std::vector<reco::PFRecoTauChargedHadron> & Tau::signalTauChargedHadronCandidates()
const {
561 if(pfSpecific_.empty())
throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
562 return pfSpecific().signalTauChargedHadronCandidates_;
565 const std::vector<reco::RecoTauPiZero> & Tau::signalPiZeroCandidates()
const {
566 if(pfSpecific_.empty())
throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
567 return pfSpecific().signalPiZeroCandidates_;
570 const std::vector<reco::PFCandidatePtr>& Tau::isolationPFCands()
const {
571 if (embeddedIsolationPFCands_) {
572 if (!isolationPFCandsTransientPtrs_.isSet()) {
573 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
574 aPtrs->reserve(isolationPFCands_.size());
575 for (
unsigned int i = 0;
i < isolationPFCands_.size();
i++) {
578 isolationPFCandsTransientPtrs_.set(
std::move(aPtrs));
580 return *isolationPFCandsTransientPtrs_;
582 if(pfSpecific_.empty() || pfSpecific().selectedIsolationPFCands_.empty() || !pfSpecific().selectedIsolationPFCands_.front().isAvailable()){
585 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
586 isolationPFCandsTransientPtrs_.set(
std::move(aPtrs));
587 return *isolationPFCandsTransientPtrs_;
588 }
else return pfSpecific().selectedIsolationPFCands_;
592 const std::vector<reco::PFCandidatePtr>& Tau::isolationPFChargedHadrCands()
const {
593 if (embeddedIsolationPFChargedHadrCands_) {
594 if (!isolationPFChargedHadrCandsTransientPtrs_.isSet()) {
595 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
596 aPtrs->reserve(isolationPFChargedHadrCands_.size());
597 for (
unsigned int i = 0;
i < isolationPFChargedHadrCands_.size();
i++) {
600 isolationPFChargedHadrCandsTransientPtrs_.set(
std::move(aPtrs));
602 return *isolationPFChargedHadrCandsTransientPtrs_;
604 if(pfSpecific_.empty() || pfSpecific().selectedIsolationPFChargedHadrCands_.empty() || !pfSpecific().selectedIsolationPFChargedHadrCands_.front().isAvailable()){
607 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
608 isolationPFChargedHadrCandsTransientPtrs_.set(
std::move(aPtrs));
609 return *isolationPFChargedHadrCandsTransientPtrs_;
610 }
else return pfSpecific().selectedIsolationPFChargedHadrCands_;
614 const std::vector<reco::PFCandidatePtr>& Tau::isolationPFNeutrHadrCands()
const {
615 if (embeddedIsolationPFNeutralHadrCands_) {
616 if (!isolationPFNeutralHadrCandsTransientPtrs_.isSet()) {
617 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
618 aPtrs->reserve(isolationPFNeutralHadrCands_.size());
619 for (
unsigned int i = 0;
i < isolationPFNeutralHadrCands_.size();
i++) {
622 isolationPFNeutralHadrCandsTransientPtrs_.set(
std::move(aPtrs));
624 return *isolationPFNeutralHadrCandsTransientPtrs_;
626 if(pfSpecific_.empty() || pfSpecific().selectedIsolationPFNeutrHadrCands_.empty() || !pfSpecific().selectedIsolationPFNeutrHadrCands_.front().isAvailable()){
629 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
630 isolationPFNeutralHadrCandsTransientPtrs_.set(
std::move(aPtrs));
631 return *isolationPFNeutralHadrCandsTransientPtrs_;
632 }
else return pfSpecific().selectedIsolationPFNeutrHadrCands_;
636 const std::vector<reco::PFCandidatePtr>& Tau::isolationPFGammaCands()
const {
637 if (embeddedIsolationPFGammaCands_) {
638 if (!isolationPFGammaCandsTransientPtrs_.isSet()) {
639 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
640 aPtrs->reserve(isolationPFGammaCands_.size());
641 for (
unsigned int i = 0;
i < isolationPFGammaCands_.size();
i++) {
644 isolationPFGammaCandsTransientPtrs_.set(
std::move(aPtrs));
646 return *isolationPFGammaCandsTransientPtrs_;
648 if(pfSpecific_.empty() || pfSpecific().selectedIsolationPFGammaCands_.empty() || !pfSpecific().selectedIsolationPFGammaCands_.front().isAvailable()){
651 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
652 isolationPFGammaCandsTransientPtrs_.set(
std::move(aPtrs));
653 return *isolationPFGammaCandsTransientPtrs_;
654 }
else return pfSpecific().selectedIsolationPFGammaCands_;
658 const std::vector<reco::PFRecoTauChargedHadron> & Tau::isolationTauChargedHadronCandidates()
const {
659 if(pfSpecific_.empty())
throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
660 return pfSpecific().isolationTauChargedHadronCandidates_;
663 const std::vector<reco::RecoTauPiZero> & Tau::isolationPiZeroCandidates()
const {
664 if(pfSpecific_.empty())
throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
665 return pfSpecific().isolationPiZeroCandidates_;
672 void Tau::initializeJEC(
unsigned int level,
unsigned int set)
675 currentJECLevel(level);
676 setP4(jec_[
set].correction(level)*
p4());
682 for ( std::vector<pat::TauJetCorrFactors>::const_iterator corrFactor = jec_.begin();
683 corrFactor != jec_.end(); ++corrFactor ) {
684 if ( corrFactor->jecSet() == set )
return corrFactor-jec_.begin();
690 const std::vector<std::string> Tau::availableJECSets()
const 692 std::vector<std::string> sets;
693 for ( std::vector<pat::TauJetCorrFactors>::const_iterator corrFactor = jec_.begin();
694 corrFactor != jec_.end(); ++corrFactor ) {
695 sets.push_back(corrFactor->jecSet());
700 const std::vector<std::string> Tau::availableJECLevels(
const int&
set)
const 702 return set>=0 ? jec_.at(
set).correctionLabels() : std::vector<std::string>();
709 for (
unsigned int idx = 0;
idx < jec_.size(); ++
idx ) {
710 if (
set.
empty() || jec_.at(
idx).jecSet() == set ){
711 if ( jec_[
idx].jecLevel(level) >= 0 )
712 return jecFactor(jec_[
idx].jecLevel(level),
idx);
715 <<
"This JEC level " << level <<
" does not exist. \n";
719 <<
"This jet does not carry any jet energy correction factor information \n" 720 <<
"for a jet energy correction set with label " <<
set <<
"\n";
725 float Tau::jecFactor(
const unsigned int& level,
const unsigned int&
set)
const 727 if ( !jecSetsAvailable() )
729 <<
"This jet does not carry any jet energy correction factor information \n";
730 if ( !jecSetAvailable(
set) )
732 <<
"This jet does not carry any jet energy correction factor information \n" 733 <<
"for a jet energy correction set with index " <<
set <<
"\n";
734 return jec_.at(
set).correction(level)/jec_.at(currentJECSet_).correction(currentJECLevel_);
743 for (
unsigned int idx = 0;
idx < jec_.size(); ++
idx ) {
744 if (
set.
empty() || jec_.at(
idx).jecSet() == set ) {
745 if ( jec_[
idx].jecLevel(level) >= 0 )
746 return correctedTauJet(jec_[
idx].jecLevel(level),
idx);
749 <<
"This JEC level " << level <<
" does not exist. \n";
753 <<
"This JEC set " <<
set <<
" does not exist. \n";
758 Tau Tau::correctedTauJet(
const unsigned int& level,
const unsigned int&
set)
const 760 Tau correctedTauJet(*
this);
762 correctedTauJet.
setP4(jecFactor(level,
set)*
p4());
766 return correctedTauJet;
776 if (leadPF.
isAvailable() || signalChargedHadrCandPtrs_.isNull())
return leadPF;
779 if (ret.
isNull() || (
p->pt() > ret->
pt())) ret =
p;
788 if (leadPF.
isAvailable() || signalNeutralHadrCandPtrs_.isNull())
return leadPF;
791 if (ret.
isNull() || (
p->pt() > ret->
pt())) ret =
p;
800 if (leadPF.
isAvailable() || !Tau::ExistSignalCands())
return leadPF;
801 else return Tau::signalCands()[0];
806 bool Tau::ExistSignalCands()
const {
807 return !(signalChargedHadrCandPtrs_.isNull() && signalNeutralHadrCandPtrs_.isNull() && signalGammaCandPtrs_.isNull());
810 bool Tau::ExistIsolationCands()
const {
811 return !(isolationChargedHadrCandPtrs_.isNull() && isolationNeutralHadrCandPtrs_.isNull() && isolationGammaCandPtrs_.isNull());
818 std::vector<reco::PFCandidatePtr> r0 = signalPFCands();
820 if(!Tau::ExistSignalCands() || (!r0.empty() && r0.front().isAvailable())) {
826 std::vector<std::pair<float,size_t> > pt_index;
828 for (
const auto &
p : signalChargedHadrCandPtrs_){ ret2.
push_back(
p); pt_index.push_back(std::make_pair(
p->pt(),
index)); index++;}
829 for (
const auto &
p : signalNeutralHadrCandPtrs_){ ret2.
push_back(
p); pt_index.push_back(std::make_pair(
p->pt(),
index)); index++;}
830 for (
const auto &
p : signalGammaCandPtrs_){ ret2.
push_back(
p); pt_index.push_back(std::make_pair(
p->pt(),
index)); index++;}
831 std::sort(pt_index.begin(),pt_index.end(),
834 for(
const auto &
p : pt_index){
844 std::vector<reco::PFCandidatePtr> r0 = signalPFChargedHadrCands();
845 if(signalChargedHadrCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
850 return signalChargedHadrCandPtrs_;
858 std::vector<reco::PFCandidatePtr> r0 = signalPFNeutrHadrCands();
859 if(signalNeutralHadrCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
864 return signalNeutralHadrCandPtrs_;
871 std::vector<reco::PFCandidatePtr> r0 = signalPFGammaCands();
872 if(signalGammaCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
877 return signalGammaCandPtrs_;
884 std::vector<reco::PFCandidatePtr> r0 = isolationPFCands();
886 if(!Tau::ExistIsolationCands() || (!r0.empty() && r0.front().isAvailable())) {
892 std::vector<std::pair<float,size_t> > pt_index;
894 for (
const auto &
p : isolationChargedHadrCandPtrs_){ ret2.
push_back(
p); pt_index.push_back(std::make_pair(
p->pt(),
index)); index++;}
895 for (
const auto &
p : isolationNeutralHadrCandPtrs_){ ret2.
push_back(
p); pt_index.push_back(std::make_pair(
p->pt(),
index)); index++;}
896 for (
const auto &
p : isolationGammaCandPtrs_){ ret2.
push_back(
p); pt_index.push_back(std::make_pair(
p->pt(),
index)); index++;}
897 std::sort(pt_index.begin(),pt_index.end(),
900 for(
const auto &
p : pt_index){
910 std::vector<reco::PFCandidatePtr> r0 = isolationPFChargedHadrCands();
911 if(isolationChargedHadrCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
916 return isolationChargedHadrCandPtrs_;
924 std::vector<reco::PFCandidatePtr> r0 = isolationPFNeutrHadrCands();
925 if(isolationNeutralHadrCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
930 return isolationNeutralHadrCandPtrs_;
937 std::vector<reco::PFCandidatePtr> r0 = isolationPFGammaCands();
938 if(isolationGammaCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
943 return isolationGammaCandPtrs_;
951 size_t Tau::numberOfSourceCandidatePtrs()
const {
952 if (Tau::ExistSignalCands())
return Tau::signalCands().
size();
953 else if(pfSpecific_.empty())
return 0;
954 else return pfSpecific().selectedSignalPFCands_.size();
958 if (Tau::ExistSignalCands())
return Tau::signalCands()[
i];
960 else return pfSpecific().selectedSignalPFCands_[
i];
value_type const * get() const
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
embedSignalPFNeutralHadrCands
embed in AOD externally stored signal PFChargedHadronCandidates
embedSignalTracks
embed in AOD externally stored leading track
std::ostream & operator<<(std::ostream &, BeamSpot beam)
embedIsolationPFGammaCands
embed in AOD externally stored isolation PFNeutralHadronCandidates
embedIsolationTracks
embed in AOD externally stored signal tracks
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.
InputIterator leadPFCand(InputIterator begin, InputIterator end)
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.
value_type const at(size_type idx) const
Retrieve an element of the RefVector.
embedIsolationPFCands
embed in AOD externally stored signal PFGammaCandidates
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