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)
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)
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)
122 out <<
"\tpat::Tau: ";
123 out << std::setiosflags(std::ios::right);
124 out << std::setiosflags(std::ios::fixed);
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_;
181 void Tau::embedIsolationTracks() {
182 isolationTracks_.clear();
184 for (
unsigned int i = 0;
i < trackRefVec.
size();
i++) {
185 isolationTracks_.push_back(*trackRefVec.
at(
i));
187 embeddedIsolationTracks_ =
true;
192 void Tau::embedLeadTrack() {
196 embeddedLeadTrack_ =
true;
202 void Tau::embedSignalTracks(){
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_.size() > 0 ? &genJet_.front() : 0);
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::etaetaMoment()
const
291 if ( isCaloTau() )
return caloSpecific().etaetaMoment_;
292 if ( isPFTau() )
return pfSpecific().etaetaMoment_;
293 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";
296 float Tau::phiphiMoment()
const
298 if ( isCaloTau() )
return caloSpecific().phiphiMoment_;
299 if ( isPFTau() )
return pfSpecific().phiphiMoment_;
300 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";
303 float Tau::etaphiMoment()
const
305 if ( isCaloTau() )
return caloSpecific().etaphiMoment_;
306 if ( isPFTau() )
return pfSpecific().etaphiMoment_;
307 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";
310 void Tau::setDecayMode(
int decayMode)
312 if (!isPFTau())
throw cms::Exception(
"Type Error") <<
"Requesting a PFTau-specific information from a pat::Tau which wasn't made from a PFTau.\n";
313 pfEssential_[0].decayMode_ = decayMode;
317 void Tau::embedLeadPFCand() {
322 if (pfSpecific_[0].leadPFCand_.isNonnull() ) {
323 leadPFCand_.push_back(*pfSpecific_[0].leadPFCand_);
324 embeddedLeadPFCand_ =
true;
328 void Tau::embedLeadPFChargedHadrCand() {
332 leadPFChargedHadrCand_.clear();
333 if (pfSpecific_[0].leadPFChargedHadrCand_.isNonnull() ) {
334 leadPFChargedHadrCand_.push_back(*pfSpecific_[0].leadPFChargedHadrCand_);
335 embeddedLeadPFChargedHadrCand_ =
true;
339 void Tau::embedLeadPFNeutralCand() {
343 leadPFNeutralCand_.clear();
344 if (pfSpecific_[0].leadPFNeutralCand_.isNonnull() ) {
345 leadPFNeutralCand_.push_back(*pfSpecific_[0].leadPFNeutralCand_);
346 embeddedLeadPFNeutralCand_ =
true;
350 void Tau::embedSignalPFCands() {
354 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedSignalPFCands_;
355 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
356 signalPFCands_.push_back(*candPtrs.at(
i));
358 embeddedSignalPFCands_ =
true;
360 void Tau::embedSignalPFChargedHadrCands() {
364 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedSignalPFChargedHadrCands_;
365 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
366 signalPFChargedHadrCands_.push_back(*candPtrs.at(
i));
368 embeddedSignalPFChargedHadrCands_ =
true;
370 void Tau::embedSignalPFNeutralHadrCands() {
374 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedSignalPFNeutrHadrCands_;
375 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
376 signalPFNeutralHadrCands_.push_back(*candPtrs.at(
i));
378 embeddedSignalPFNeutralHadrCands_ =
true;
380 void Tau::embedSignalPFGammaCands() {
384 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedSignalPFGammaCands_;
385 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
386 signalPFGammaCands_.push_back(*candPtrs.at(
i));
388 embeddedSignalPFGammaCands_ =
true;
391 void Tau::embedIsolationPFCands() {
395 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedIsolationPFCands_;
396 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
397 isolationPFCands_.push_back(*candPtrs.at(
i));
399 embeddedIsolationPFCands_ =
true;
402 void Tau::embedIsolationPFChargedHadrCands() {
406 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedIsolationPFChargedHadrCands_;
407 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
408 isolationPFChargedHadrCands_.push_back(*candPtrs.at(
i));
410 embeddedIsolationPFChargedHadrCands_ =
true;
412 void Tau::embedIsolationPFNeutralHadrCands() {
416 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedIsolationPFNeutrHadrCands_;
417 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
418 isolationPFNeutralHadrCands_.push_back(*candPtrs.at(
i));
420 embeddedIsolationPFNeutralHadrCands_ =
true;
422 void Tau::embedIsolationPFGammaCands() {
426 std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedIsolationPFGammaCands_;
427 for (
unsigned int i = 0;
i < candPtrs.size();
i++) {
428 isolationPFGammaCands_.push_back(*candPtrs.at(
i));
430 embeddedIsolationPFGammaCands_ =
true;
434 if(!isPFTau() )
throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
435 if ( pfSpecific().signalTauChargedHadronCandidates_.size() > 0 ) {
443 if(!embeddedLeadPFChargedHadrCand_){
445 else return pfSpecific().leadPFChargedHadrCand_;
451 if(!embeddedLeadPFNeutralCand_){
453 else return pfSpecific().leadPFNeutralCand_;
459 if(!embeddedLeadPFCand_){
461 return pfSpecific().leadPFCand_;
466 const std::vector<reco::PFCandidatePtr>& Tau::signalPFCands()
const {
467 if (embeddedSignalPFCands_) {
468 if (!signalPFCandsTransientPtrs_.isSet()) {
469 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
470 aPtrs->reserve(signalPFCands_.size());
471 for (
unsigned int i = 0;
i < signalPFCands_.size();
i++) {
474 signalPFCandsTransientPtrs_.set(std::move(aPtrs));
476 return *signalPFCandsTransientPtrs_;
478 if(pfSpecific_.empty() || pfSpecific().selectedSignalPFCands_.empty() || !pfSpecific().selectedSignalPFCands_.front().isAvailable()){
481 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
482 signalPFCandsTransientPtrs_.set(std::move(aPtrs));
483 return *signalPFCandsTransientPtrs_;
484 }
else return pfSpecific().selectedSignalPFCands_;
488 const std::vector<reco::PFCandidatePtr>& Tau::signalPFChargedHadrCands()
const {
489 if (embeddedSignalPFChargedHadrCands_) {
490 if (!signalPFChargedHadrCandsTransientPtrs_.isSet()) {
491 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
492 aPtrs->reserve(signalPFChargedHadrCands_.size());
493 for (
unsigned int i = 0;
i < signalPFChargedHadrCands_.size();
i++) {
496 signalPFChargedHadrCandsTransientPtrs_.set(std::move(aPtrs));
498 return *signalPFChargedHadrCandsTransientPtrs_;
500 if(pfSpecific_.empty() || pfSpecific().selectedSignalPFChargedHadrCands_.empty() || !pfSpecific().selectedSignalPFChargedHadrCands_.front().isAvailable()){
503 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
504 signalPFChargedHadrCandsTransientPtrs_.set(std::move(aPtrs));
505 return *signalPFChargedHadrCandsTransientPtrs_;
506 }
else return pfSpecific().selectedSignalPFChargedHadrCands_;
510 const std::vector<reco::PFCandidatePtr>& Tau::signalPFNeutrHadrCands()
const {
511 if (embeddedSignalPFNeutralHadrCands_) {
512 if (!signalPFNeutralHadrCandsTransientPtrs_.isSet()) {
513 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
514 aPtrs->reserve(signalPFNeutralHadrCands_.size());
515 for (
unsigned int i = 0;
i < signalPFNeutralHadrCands_.size();
i++) {
518 signalPFNeutralHadrCandsTransientPtrs_.set(std::move(aPtrs));
520 return *signalPFNeutralHadrCandsTransientPtrs_;
522 if(pfSpecific_.empty() || pfSpecific().selectedSignalPFNeutrHadrCands_.empty() || !pfSpecific().selectedSignalPFNeutrHadrCands_.front().isAvailable()){
525 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
526 signalPFNeutralHadrCandsTransientPtrs_.set(std::move(aPtrs));
527 return *signalPFNeutralHadrCandsTransientPtrs_;
528 }
else return pfSpecific().selectedSignalPFNeutrHadrCands_;
532 const std::vector<reco::PFCandidatePtr>& Tau::signalPFGammaCands()
const {
533 if (embeddedSignalPFGammaCands_) {
534 if (!signalPFGammaCandsTransientPtrs_.isSet()) {
535 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
536 aPtrs->reserve(signalPFGammaCands_.size());
537 for (
unsigned int i = 0;
i < signalPFGammaCands_.size();
i++) {
540 signalPFGammaCandsTransientPtrs_.set(std::move(aPtrs));
542 return *signalPFGammaCandsTransientPtrs_;
544 if(pfSpecific_.empty() || pfSpecific().selectedSignalPFGammaCands_.empty() || !pfSpecific().selectedSignalPFGammaCands_.front().isAvailable()){
547 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
548 signalPFGammaCandsTransientPtrs_.set(std::move(aPtrs));
549 return *signalPFGammaCandsTransientPtrs_;
550 }
else return pfSpecific().selectedSignalPFGammaCands_;
554 const std::vector<reco::PFRecoTauChargedHadron> & Tau::signalTauChargedHadronCandidates()
const {
555 if(pfSpecific_.empty())
throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
556 return pfSpecific().signalTauChargedHadronCandidates_;
559 const std::vector<reco::RecoTauPiZero> & Tau::signalPiZeroCandidates()
const {
560 if(pfSpecific_.empty())
throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
561 return pfSpecific().signalPiZeroCandidates_;
564 const std::vector<reco::PFCandidatePtr>& Tau::isolationPFCands()
const {
565 if (embeddedIsolationPFCands_) {
566 if (!isolationPFCandsTransientPtrs_.isSet()) {
567 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
568 aPtrs->reserve(isolationPFCands_.size());
569 for (
unsigned int i = 0;
i < isolationPFCands_.size();
i++) {
572 isolationPFCandsTransientPtrs_.set(std::move(aPtrs));
574 return *isolationPFCandsTransientPtrs_;
576 if(pfSpecific_.empty() || pfSpecific().selectedIsolationPFCands_.empty() || !pfSpecific().selectedIsolationPFCands_.front().isAvailable()){
579 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
580 isolationPFCandsTransientPtrs_.set(std::move(aPtrs));
581 return *isolationPFCandsTransientPtrs_;
582 }
else return pfSpecific().selectedIsolationPFCands_;
586 const std::vector<reco::PFCandidatePtr>& Tau::isolationPFChargedHadrCands()
const {
587 if (embeddedIsolationPFChargedHadrCands_) {
588 if (!isolationPFChargedHadrCandsTransientPtrs_.isSet()) {
589 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
590 aPtrs->reserve(isolationPFChargedHadrCands_.size());
591 for (
unsigned int i = 0;
i < isolationPFChargedHadrCands_.size();
i++) {
594 isolationPFChargedHadrCandsTransientPtrs_.set(std::move(aPtrs));
596 return *isolationPFChargedHadrCandsTransientPtrs_;
598 if(pfSpecific_.empty() || pfSpecific().selectedIsolationPFChargedHadrCands_.empty() || !pfSpecific().selectedIsolationPFChargedHadrCands_.front().isAvailable()){
601 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
602 isolationPFChargedHadrCandsTransientPtrs_.set(std::move(aPtrs));
603 return *isolationPFChargedHadrCandsTransientPtrs_;
604 }
else return pfSpecific().selectedIsolationPFChargedHadrCands_;
608 const std::vector<reco::PFCandidatePtr>& Tau::isolationPFNeutrHadrCands()
const {
609 if (embeddedIsolationPFNeutralHadrCands_) {
610 if (!isolationPFNeutralHadrCandsTransientPtrs_.isSet()) {
611 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
612 aPtrs->reserve(isolationPFNeutralHadrCands_.size());
613 for (
unsigned int i = 0;
i < isolationPFNeutralHadrCands_.size();
i++) {
616 isolationPFNeutralHadrCandsTransientPtrs_.set(std::move(aPtrs));
618 return *isolationPFNeutralHadrCandsTransientPtrs_;
620 if(pfSpecific_.empty() || pfSpecific().selectedIsolationPFNeutrHadrCands_.empty() || !pfSpecific().selectedIsolationPFNeutrHadrCands_.front().isAvailable()){
623 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
624 isolationPFNeutralHadrCandsTransientPtrs_.set(std::move(aPtrs));
625 return *isolationPFNeutralHadrCandsTransientPtrs_;
626 }
else return pfSpecific().selectedIsolationPFNeutrHadrCands_;
630 const std::vector<reco::PFCandidatePtr>& Tau::isolationPFGammaCands()
const {
631 if (embeddedIsolationPFGammaCands_) {
632 if (!isolationPFGammaCandsTransientPtrs_.isSet()) {
633 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
634 aPtrs->reserve(isolationPFGammaCands_.size());
635 for (
unsigned int i = 0;
i < isolationPFGammaCands_.size();
i++) {
638 isolationPFGammaCandsTransientPtrs_.set(std::move(aPtrs));
640 return *isolationPFGammaCandsTransientPtrs_;
642 if(pfSpecific_.empty() || pfSpecific().selectedIsolationPFGammaCands_.empty() || !pfSpecific().selectedIsolationPFGammaCands_.front().isAvailable()){
645 std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{
new std::vector<reco::PFCandidatePtr>{}};
646 isolationPFGammaCandsTransientPtrs_.set(std::move(aPtrs));
647 return *isolationPFGammaCandsTransientPtrs_;
648 }
else return pfSpecific().selectedIsolationPFGammaCands_;
652 const std::vector<reco::PFRecoTauChargedHadron> & Tau::isolationTauChargedHadronCandidates()
const {
653 if(pfSpecific_.empty())
throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
654 return pfSpecific().isolationTauChargedHadronCandidates_;
657 const std::vector<reco::RecoTauPiZero> & Tau::isolationPiZeroCandidates()
const {
658 if(pfSpecific_.empty())
throw cms::Exception(
"Type Error") <<
"Requesting content that is not stored in miniAOD.\n";
659 return pfSpecific().isolationPiZeroCandidates_;
666 void Tau::initializeJEC(
unsigned int level,
unsigned int set)
669 currentJECLevel(level);
670 setP4(jec_[set].correction(level)*
p4());
676 for ( std::vector<pat::TauJetCorrFactors>::const_iterator corrFactor = jec_.begin();
677 corrFactor != jec_.end(); ++corrFactor ) {
678 if ( corrFactor->jecSet() == set )
return corrFactor-jec_.begin();
684 const std::vector<std::string> Tau::availableJECSets()
const
686 std::vector<std::string> sets;
687 for ( std::vector<pat::TauJetCorrFactors>::const_iterator corrFactor = jec_.begin();
688 corrFactor != jec_.end(); ++corrFactor ) {
689 sets.push_back(corrFactor->jecSet());
694 const std::vector<std::string> Tau::availableJECLevels(
const int& set)
const
696 return set>=0 ? jec_.at(set).correctionLabels() : std::vector<std::string>();
703 for (
unsigned int idx = 0;
idx < jec_.size(); ++
idx ) {
704 if ( set.empty() || jec_.at(
idx).jecSet() == set ){
705 if ( jec_[
idx].jecLevel(level) >= 0 )
706 return jecFactor(jec_[
idx].jecLevel(level),
idx);
709 <<
"This JEC level " << level <<
" does not exist. \n";
713 <<
"This jet does not carry any jet energy correction factor information \n"
714 <<
"for a jet energy correction set with label " << set <<
"\n";
719 float Tau::jecFactor(
const unsigned int& level,
const unsigned int& set)
const
721 if ( !jecSetsAvailable() )
723 <<
"This jet does not carry any jet energy correction factor information \n";
724 if ( !jecSetAvailable(set) )
726 <<
"This jet does not carry any jet energy correction factor information \n"
727 <<
"for a jet energy correction set with index " << set <<
"\n";
728 return jec_.at(set).correction(level)/jec_.at(currentJECSet_).correction(currentJECLevel_);
737 for (
unsigned int idx = 0;
idx < jec_.size(); ++
idx ) {
738 if ( set.empty() || jec_.at(
idx).jecSet() == set ) {
739 if ( jec_[
idx].jecLevel(level) >= 0 )
740 return correctedTauJet(jec_[
idx].jecLevel(level),
idx);
743 <<
"This JEC level " << level <<
" does not exist. \n";
747 <<
"This JEC set " << set <<
" does not exist. \n";
752 Tau Tau::correctedTauJet(
const unsigned int& level,
const unsigned int& set)
const
754 Tau correctedTauJet(*
this);
756 correctedTauJet.setP4(jecFactor(level, set)*
p4());
758 correctedTauJet.currentJECSet(set);
759 correctedTauJet.currentJECLevel(level);
760 return correctedTauJet;
770 if (leadPF.
isAvailable() || signalChargedHadrCandPtrs_.isNull())
return leadPF;
773 if (ret.
isNull() || (
p->pt() > ret->pt())) ret =
p;
782 if (leadPF.
isAvailable() || signalNeutralHadrCandPtrs_.isNull())
return leadPF;
785 if (ret.
isNull() || (
p->pt() > ret->pt())) ret =
p;
794 if (leadPF.
isAvailable() || !Tau::ExistSignalCands())
return leadPF;
795 else return Tau::signalCands()[0];
800 bool Tau::ExistSignalCands()
const {
801 return !(signalChargedHadrCandPtrs_.isNull() && signalNeutralHadrCandPtrs_.isNull() && signalGammaCandPtrs_.isNull());
804 bool Tau::ExistIsolationCands()
const {
805 return !(isolationChargedHadrCandPtrs_.isNull() && isolationNeutralHadrCandPtrs_.isNull() && isolationGammaCandPtrs_.isNull());
812 std::vector<reco::PFCandidatePtr> r0 = signalPFCands();
814 if(!Tau::ExistSignalCands() || (!r0.empty() && r0.front().isAvailable())) {
820 std::vector<std::pair<float,size_t> > pt_index;
822 for (
const auto &
p : signalChargedHadrCandPtrs_){ ret2.
push_back(
p); pt_index.push_back(std::make_pair(
p->pt(),
index)); index++;}
823 for (
const auto &
p : signalNeutralHadrCandPtrs_){ ret2.
push_back(
p); pt_index.push_back(std::make_pair(
p->pt(),
index)); index++;}
824 for (
const auto &
p : signalGammaCandPtrs_){ ret2.
push_back(
p); pt_index.push_back(std::make_pair(
p->pt(),
index)); index++;}
825 std::sort(pt_index.begin(),pt_index.end(),
828 for(
const auto &
p : pt_index){
838 std::vector<reco::PFCandidatePtr> r0 = signalPFChargedHadrCands();
839 if(signalChargedHadrCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
844 return signalChargedHadrCandPtrs_;
852 std::vector<reco::PFCandidatePtr> r0 = signalPFNeutrHadrCands();
853 if(signalNeutralHadrCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
858 return signalNeutralHadrCandPtrs_;
865 std::vector<reco::PFCandidatePtr> r0 = signalPFGammaCands();
866 if(signalGammaCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
871 return signalGammaCandPtrs_;
878 std::vector<reco::PFCandidatePtr> r0 = isolationPFCands();
880 if(!Tau::ExistIsolationCands() || (!r0.empty() && r0.front().isAvailable())) {
886 std::vector<std::pair<float,size_t> > pt_index;
888 for (
const auto &
p : isolationChargedHadrCandPtrs_){ ret2.
push_back(
p); pt_index.push_back(std::make_pair(
p->pt(),
index)); index++;}
889 for (
const auto &
p : isolationNeutralHadrCandPtrs_){ ret2.
push_back(
p); pt_index.push_back(std::make_pair(
p->pt(),
index)); index++;}
890 for (
const auto &
p : isolationGammaCandPtrs_){ ret2.
push_back(
p); pt_index.push_back(std::make_pair(
p->pt(),
index)); index++;}
891 std::sort(pt_index.begin(),pt_index.end(),
894 for(
const auto &
p : pt_index){
904 std::vector<reco::PFCandidatePtr> r0 = isolationPFChargedHadrCands();
905 if(isolationChargedHadrCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
910 return isolationChargedHadrCandPtrs_;
918 std::vector<reco::PFCandidatePtr> r0 = isolationPFNeutrHadrCands();
919 if(isolationNeutralHadrCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
924 return isolationNeutralHadrCandPtrs_;
931 std::vector<reco::PFCandidatePtr> r0 = isolationPFGammaCands();
932 if(isolationGammaCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
937 return isolationGammaCandPtrs_;
946 if (Tau::ExistSignalCands())
return Tau::signalCands().size();
947 else if(pfSpecific_.empty())
return 0;
948 else return pfSpecific().selectedSignalPFCands_.size();
952 if (Tau::ExistSignalCands())
return Tau::signalCands()[
i];
954 else return pfSpecific().selectedSignalPFCands_[
i];
value_type const * get() const
virtual reco::TrackRef leadTrack() const
virtual double p() const
magnitude of momentum vector
virtual const reco::TrackRefVector & isolationTracks() const
void push_back(Ptr< T > const &iPtr)
T const * get() const
Returns C++ pointer to the item.
virtual void setP4(const LorentzVector &p4)
set 4-momentum
virtual double eta() const
momentum pseudorapidity
virtual double pt() const
transverse momentum
virtual double energy() const
energy
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Analysis-level lepton class.
bool isNull() const
Checks for null.
virtual CandidatePtr sourceCandidatePtr(size_type i) const
Jets made from MC generator particles.
virtual const reco::TrackRefVector & signalTracks() const
void reserve(size_type n)
Reserve space for RefVector.
Analysis-level tau class.
InputIterator leadPFCand(InputIterator begin, InputIterator end)
virtual size_t numberOfSourceCandidatePtrs() const
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
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.
size_type size() const
Size of the RefVector.
volatile std::atomic< bool > shutdown_flag false
edm::Ptr< PFCandidate > PFCandidatePtr
persistent Ptr to a PFCandidate
virtual double phi() const
momentum azimuthal angle
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
math::ErrorF< 3 >::type CovMatrix