CMS 3D CMS Logo

Tau.cc
Go to the documentation of this file.
1 //
2 //
3 
7 #include <algorithm>
8 #include <functional>
9 
10 using namespace pat;
11 using namespace std::placeholders;
12 
14 Tau::Tau()
15  : Lepton<reco::BaseTau>(),
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) {}
30 
32 Tau::Tau(const reco::BaseTau& aTau)
33  : Lepton<reco::BaseTau>(aTau),
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);
49 }
50 
53  : Lepton<reco::BaseTau>(aTauRef),
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);
69 }
70 
72 Tau::Tau(const edm::Ptr<reco::BaseTau>& aTauRef)
73  : Lepton<reco::BaseTau>(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);
89 }
90 
91 void Tau::initFromBaseTau(const reco::BaseTau& aTau) {
92  const reco::PFTau* pfTau = dynamic_cast<const reco::PFTau*>(&aTau);
93  if (pfTau != nullptr) {
94  // If PFTau is made from PackedCandidates, directly fill slimmed version
95  // without PFSpecific
96  const pat::PackedCandidate* pc = dynamic_cast<const pat::PackedCandidate*>(pfTau->leadChargedHadrCand().get());
97  if (pc != nullptr) {
98  for (const auto& ptr : pfTau->signalChargedHadrCands())
99  signalChargedHadrCandPtrs_.push_back(ptr);
100 
101  for (const auto& ptr : pfTau->signalNeutrHadrCands())
102  signalNeutralHadrCandPtrs_.push_back(ptr);
103 
104  for (const auto& ptr : pfTau->signalGammaCands())
105  signalGammaCandPtrs_.push_back(ptr);
106 
107  for (const auto& ptr : pfTau->isolationChargedHadrCands())
108  isolationChargedHadrCandPtrs_.push_back(ptr);
109 
110  for (const auto& ptr : pfTau->isolationNeutrHadrCands())
111  isolationNeutralHadrCandPtrs_.push_back(ptr);
112 
113  for (const auto& ptr : pfTau->isolationGammaCands())
114  isolationGammaCandPtrs_.push_back(ptr);
115 
116  std::vector<reco::CandidatePtr> signalLostTracks;
117  for (const auto& chargedHadron : pfTau->signalTauChargedHadronCandidates()) {
119  chargedHadron.getLostTrackCandidate().isNonnull()) {
120  signalLostTracks.push_back(chargedHadron.getLostTrackCandidate());
121  }
122  }
123  this->setSignalLostTracks(signalLostTracks);
124  } else {
125  pfSpecific_.push_back(pat::tau::TauPFSpecific(*pfTau));
126  }
127  pfEssential_.push_back(pat::tau::TauPFEssential(*pfTau));
128  }
129 }
130 
132 Tau::~Tau() {}
133 
134 std::ostream& reco::operator<<(std::ostream& out, const pat::Tau& obj) {
135  if (!out)
136  return out;
137 
138  out << "\tpat::Tau: ";
139  out << std::setiosflags(std::ios::right);
140  out << std::setiosflags(std::ios::fixed);
141  out << std::setprecision(3);
142  out << " E/pT/eta/phi " << obj.energy() << "/" << obj.pt() << "/" << obj.eta() << "/" << obj.phi();
143  return out;
144 }
145 
147 const reco::TrackRefVector& Tau::isolationTracks() const {
148  if (embeddedIsolationTracks_) {
149  if (!isolationTracksTransientRefVector_.isSet()) {
150  std::unique_ptr<reco::TrackRefVector> trackRefVec{new reco::TrackRefVector{}};
151  trackRefVec->reserve(isolationTracks_.size());
152  for (unsigned int i = 0; i < isolationTracks_.size(); i++) {
153  trackRefVec->push_back(reco::TrackRef(&isolationTracks_, i));
154  }
155  isolationTracksTransientRefVector_.set(std::move(trackRefVec));
156  }
157  return *isolationTracksTransientRefVector_;
158  } else {
160  }
161 }
162 
165  if (embeddedLeadTrack_) {
166  return reco::TrackRef(&leadTrack_, 0);
167  } else {
168  return reco::BaseTau::leadTrack();
169  }
170 }
171 
174  if (embeddedSignalTracks_) {
175  if (!signalTracksTransientRefVector_.isSet()) {
176  std::unique_ptr<reco::TrackRefVector> trackRefVec{new reco::TrackRefVector{}};
177  trackRefVec->reserve(signalTracks_.size());
178  for (unsigned int i = 0; i < signalTracks_.size(); i++) {
179  trackRefVec->push_back(reco::TrackRef(&signalTracks_, i));
180  }
181  signalTracksTransientRefVector_.set(std::move(trackRefVec));
182  }
183  return *signalTracksTransientRefVector_;
184  } else {
186  }
187 }
188 
191  isolationTracks_.clear();
193  for (unsigned int i = 0; i < trackRefVec.size(); i++) {
194  isolationTracks_.push_back(*trackRefVec.at(i));
195  }
196  embeddedIsolationTracks_ = true;
197 }
198 
200 void Tau::embedLeadTrack() {
201  leadTrack_.clear();
202  if (reco::BaseTau::leadTrack().isNonnull()) {
203  leadTrack_.push_back(*reco::BaseTau::leadTrack());
204  embeddedLeadTrack_ = true;
205  }
206 }
207 
209 void Tau::embedSignalTracks() {
210  signalTracks_.clear();
212  for (unsigned int i = 0; i < trackRefVec.size(); i++) {
213  signalTracks_.push_back(*trackRefVec.at(i));
214  }
215  embeddedSignalTracks_ = true;
216 }
217 
219 void Tau::setGenJet(const reco::GenJetRef& gj) {
220  genJet_.clear();
221  genJet_.push_back(*gj);
222 }
223 
225 const reco::GenJet* Tau::genJet() const { return (!genJet_.empty() ? &genJet_.front() : nullptr); }
226 
227 // method to retrieve a tau ID (or throw)
228 float Tau::tauID(const std::string& name) const {
229  for (std::vector<IdPair>::const_iterator it = tauIDs_.begin(), ed = tauIDs_.end(); it != ed; ++it) {
230  if (it->first == name)
231  return it->second;
232  }
233  cms::Exception ex("Key not found");
234  ex << "pat::Tau: the ID " << name << " can't be found in this pat::Tau.\n";
235  ex << "The available IDs are: ";
236  for (std::vector<IdPair>::const_iterator it = tauIDs_.begin(), ed = tauIDs_.end(); it != ed; ++it) {
237  ex << "'" << it->first << "' ";
238  }
239  ex << ".\n";
240  throw ex;
241 }
242 // check if an ID is there
243 bool Tau::isTauIDAvailable(const std::string& name) const {
244  for (std::vector<IdPair>::const_iterator it = tauIDs_.begin(), ed = tauIDs_.end(); it != ed; ++it) {
245  if (it->first == name)
246  return true;
247  }
248  return false;
249 }
250 
251 const pat::tau::TauPFSpecific& Tau::pfSpecific() const {
252  if (!isPFTau())
253  throw cms::Exception("Type Error")
254  << "Requesting a PFTau-specific information from a pat::Tau which wasn't made from a PFTau.\n";
255  return pfSpecific_[0];
256 }
257 
258 const pat::tau::TauPFEssential& Tau::pfEssential() const {
259  if (pfEssential_.empty())
260  throw cms::Exception("Type Error")
261  << "Requesting a PFTau-specific information from a pat::Tau which wasn't made from a PFTau.\n";
262  return pfEssential_[0];
263 }
264 
265 reco::Candidate::LorentzVector Tau::p4Jet() const {
266  if (isPFTau())
267  return reco::Candidate::LorentzVector(pfEssential().p4Jet_);
268  throw cms::Exception("Type Error") << "Requesting a PFTau-specific information from a pat::Tau which wasn't "
269  "made from a PFTau.\n";
270 }
271 
272 float Tau::dxy_Sig() const {
273  if (pfEssential().dxy_error_ != 0)
274  return (pfEssential().dxy_ / pfEssential().dxy_error_);
275  else
276  return 0.;
277 }
278 
279 pat::tau::TauPFEssential::CovMatrix Tau::flightLengthCov() const {
281  const pat::tau::TauPFEssential::CovMatrix& sv = secondaryVertexCov();
282  const pat::tau::TauPFEssential::CovMatrix& pv = primaryVertexCov();
283  for (int i = 0; i < dimension; ++i) {
284  for (int j = 0; j < dimension; ++j) {
285  cov(i, j) = sv(i, j) + pv(i, j);
286  }
287  }
288  return cov;
289 }
290 
291 float Tau::ip3d_Sig() const {
292  if (pfEssential().ip3d_error_ != 0)
293  return (pfEssential().ip3d_ / pfEssential().ip3d_error_);
294  else
295  return 0.;
296 }
297 
298 float Tau::etaetaMoment() const {
299  if (isPFTau())
300  return pfSpecific().etaetaMoment_;
301  throw cms::Exception("Type Error") << "Requesting a PFTau-specific information from a pat::Tau which wasn't "
302  "made from a PFTau.\n";
303 }
304 
305 float Tau::phiphiMoment() const {
306  if (isPFTau())
307  return pfSpecific().phiphiMoment_;
308  throw cms::Exception("Type Error") << "Requesting a PFTau-specific information from a pat::Tau which wasn't "
309  "made from a PFTau.\n";
310 }
311 
312 float Tau::etaphiMoment() const {
313  if (isPFTau())
314  return pfSpecific().etaphiMoment_;
315  throw cms::Exception("Type Error") << "Requesting a PFTau-specific information from a pat::Tau which wasn't "
316  "made from a PFTau.\n";
317 }
318 
319 void Tau::setDecayMode(int decayMode) {
320  if (!isPFTau())
321  throw cms::Exception("Type Error")
322  << "Requesting a PFTau-specific information from a pat::Tau which wasn't made from a PFTau.\n";
323  pfEssential_[0].decayMode_ = decayMode;
324 }
325 
327 void Tau::embedLeadPFCand() {
328  if (!isPFTau()) { //additional check with warning in pat::tau producer
329  return;
330  }
331  leadPFCand_.clear();
332  if (pfSpecific_[0].leadPFCand_.isNonnull()) {
333  leadPFCand_.push_back(*static_cast<const reco::PFCandidate*>(&*pfSpecific_[0].leadPFCand_)); //already set in C-tor
334  embeddedLeadPFCand_ = true;
335  }
336 }
339  if (!isPFTau()) { //additional check with warning in pat::tau producer
340  return;
341  }
342  leadPFChargedHadrCand_.clear();
343  if (pfSpecific_[0].leadPFChargedHadrCand_.isNonnull()) {
344  leadPFChargedHadrCand_.push_back(
345  *static_cast<const reco::PFCandidate*>(&*pfSpecific_[0].leadPFChargedHadrCand_)); //already set in C-tor
346  embeddedLeadPFChargedHadrCand_ = true;
347  }
348 }
351  if (!isPFTau()) { //additional check with warning in pat::tau producer
352  return;
353  }
354  leadPFNeutralCand_.clear();
355  if (pfSpecific_[0].leadPFNeutralCand_.isNonnull()) {
356  leadPFNeutralCand_.push_back(
357  *static_cast<const reco::PFCandidate*>(&*pfSpecific_[0].leadPFNeutralCand_)); //already set in C-tor
358  embeddedLeadPFNeutralCand_ = true;
359  }
360 }
361 
363  if (!isPFTau()) { //additional check with warning in pat::tau producer
364  return;
365  }
366  std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedSignalPFCands_;
367  for (unsigned int i = 0; i < candPtrs.size(); i++) {
368  signalPFCands_.push_back(candPtrs.at(i));
369  }
370  embeddedSignalPFCands_ = true;
371 }
373  if (!isPFTau()) { //additional check with warning in pat::tau producer
374  return;
375  }
376  std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedSignalPFChargedHadrCands_;
377  for (unsigned int i = 0; i < candPtrs.size(); i++) {
378  signalPFChargedHadrCands_.push_back(candPtrs.at(i));
379  }
380  embeddedSignalPFChargedHadrCands_ = true;
381 }
383  if (!isPFTau()) { //additional check with warning in pat::tau producer
384  return;
385  }
386  std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedSignalPFNeutrHadrCands_;
387  for (unsigned int i = 0; i < candPtrs.size(); i++) {
388  signalPFNeutralHadrCands_.push_back(candPtrs.at(i));
389  }
390  embeddedSignalPFNeutralHadrCands_ = true;
391 }
393  if (!isPFTau()) { //additional check with warning in pat::tau producer
394  return;
395  }
396  std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedSignalPFGammaCands_;
397  for (unsigned int i = 0; i < candPtrs.size(); i++) {
398  signalPFGammaCands_.push_back(candPtrs.at(i));
399  }
400  embeddedSignalPFGammaCands_ = true;
401 }
402 
404  if (!isPFTau()) { //additional check with warning in pat::tau producer
405  return;
406  }
407  std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedIsolationPFCands_;
408  for (unsigned int i = 0; i < candPtrs.size(); i++) {
409  isolationPFCands_.push_back(candPtrs.at(i));
410  }
411  embeddedIsolationPFCands_ = true;
412 }
413 
415  if (!isPFTau()) { //additional check with warning in pat::tau producer
416  return;
417  }
418  std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedIsolationPFChargedHadrCands_;
419  for (unsigned int i = 0; i < candPtrs.size(); i++) {
420  isolationPFChargedHadrCands_.push_back(candPtrs.at(i));
421  }
422  embeddedIsolationPFChargedHadrCands_ = true;
423 }
425  if (!isPFTau()) { //additional check with warning in pat::tau producer
426  return;
427  }
428  std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedIsolationPFNeutrHadrCands_;
429  for (unsigned int i = 0; i < candPtrs.size(); i++) {
430  isolationPFNeutralHadrCands_.push_back(candPtrs.at(i));
431  }
432  embeddedIsolationPFNeutralHadrCands_ = true;
433 }
435  if (!isPFTau()) { //additional check with warning in pat::tau producer
436  return;
437  }
438  std::vector<reco::PFCandidatePtr> candPtrs = pfSpecific_[0].selectedIsolationPFGammaCands_;
439  for (unsigned int i = 0; i < candPtrs.size(); i++) {
440  isolationPFGammaCands_.push_back(candPtrs.at(i));
441  }
442  embeddedIsolationPFGammaCands_ = true;
443 }
444 
445 reco::PFRecoTauChargedHadronRef Tau::leadTauChargedHadronCandidate() const {
446  if (!isPFTau())
447  throw cms::Exception("Type Error") << "Requesting content that is not stored in miniAOD.\n";
448  if (!pfSpecific().signalTauChargedHadronCandidates_.empty()) {
449  return reco::PFRecoTauChargedHadronRef(&pfSpecific().signalTauChargedHadronCandidates_, 0);
450  } else {
452  }
453 }
454 
456  const reco::PFCandidate* pf_cand = dynamic_cast<const reco::PFCandidate*>(&*ptr);
457  if (pf_cand)
458  return edm::Ptr<reco::PFCandidate>(ptr);
459  return reco::PFCandidatePtr();
460 }
461 
462 const reco::PFCandidatePtr Tau::leadPFChargedHadrCand() const {
463  if (!embeddedLeadPFChargedHadrCand_) {
464  if (pfSpecific_.empty())
465  return reco::PFCandidatePtr();
466  else
467  return convertToPFCandidatePtr(pfSpecific().leadPFChargedHadrCand_);
468  } else
469  return reco::PFCandidatePtr(&leadPFChargedHadrCand_, 0);
470 }
471 
472 const reco::PFCandidatePtr Tau::leadPFNeutralCand() const {
473  if (!embeddedLeadPFNeutralCand_) {
474  if (pfSpecific_.empty())
475  return reco::PFCandidatePtr();
476  else
477  return convertToPFCandidatePtr(pfSpecific().leadPFNeutralCand_);
478  } else
479  return reco::PFCandidatePtr(&leadPFNeutralCand_, 0);
480 }
481 
482 const reco::PFCandidatePtr Tau::leadPFCand() const {
483  if (!embeddedLeadPFCand_) {
484  if (pfSpecific_.empty())
485  return reco::PFCandidatePtr();
486  return convertToPFCandidatePtr(pfSpecific().leadPFCand_);
487  } else
488  return reco::PFCandidatePtr(&leadPFCand_, 0);
489 }
490 
491 const std::vector<reco::PFCandidatePtr>& Tau::signalPFCands() const {
492  if (embeddedSignalPFCands_) {
493  if (!signalPFCandsTransientPtrs_.isSet()) {
494  std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{new std::vector<reco::PFCandidatePtr>{}};
495  aPtrs->reserve(signalPFCands_.size());
496  for (unsigned int i = 0; i < signalPFCands_.size(); i++) {
497  aPtrs->push_back(reco::PFCandidatePtr(&signalPFCands_, i));
498  }
499  signalPFCandsTransientPtrs_.set(std::move(aPtrs));
500  }
501  return *signalPFCandsTransientPtrs_;
502  } else {
503  if (pfSpecific_.empty() || pfSpecific().selectedSignalPFCands_.empty() ||
504  !pfSpecific().selectedSignalPFCands_.front().isAvailable()) {
505  // this part of code is called when reading from patTuple or miniAOD
506  // it returns empty collection in correct format so it can be substituted by reco::Candidates if available
507  if (!signalPFCandsTransientPtrs_.isSet()) {
508  std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{new std::vector<reco::PFCandidatePtr>{}};
509  signalPFCandsTransientPtrs_.set(std::move(aPtrs));
510  }
511  return *signalPFCandsTransientPtrs_;
512  } else
513  return pfSpecific().selectedSignalPFCands_;
514  }
515 }
516 
517 const std::vector<reco::PFCandidatePtr>& Tau::signalPFChargedHadrCands() const {
518  if (embeddedSignalPFChargedHadrCands_) {
519  if (!signalPFChargedHadrCandsTransientPtrs_.isSet()) {
520  std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{new std::vector<reco::PFCandidatePtr>{}};
521  aPtrs->reserve(signalPFChargedHadrCands_.size());
522  for (unsigned int i = 0; i < signalPFChargedHadrCands_.size(); i++) {
523  aPtrs->push_back(reco::PFCandidatePtr(&signalPFChargedHadrCands_, i));
524  }
525  signalPFChargedHadrCandsTransientPtrs_.set(std::move(aPtrs));
526  }
527  return *signalPFChargedHadrCandsTransientPtrs_;
528  } else {
529  if (pfSpecific_.empty() || pfSpecific().selectedSignalPFChargedHadrCands_.empty() ||
530  !pfSpecific().selectedSignalPFChargedHadrCands_.front().isAvailable()) {
531  // this part of code is called when reading from patTuple or miniAOD
532  // it returns empty collection in correct format so it can be substituted by reco::Candidates if available
533  if (!signalPFChargedHadrCandsTransientPtrs_.isSet()) {
534  std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{new std::vector<reco::PFCandidatePtr>{}};
535  signalPFChargedHadrCandsTransientPtrs_.set(std::move(aPtrs));
536  }
537  return *signalPFChargedHadrCandsTransientPtrs_;
538  } else
539  return pfSpecific().selectedSignalPFChargedHadrCands_;
540  }
541 }
542 
543 const std::vector<reco::PFCandidatePtr>& Tau::signalPFNeutrHadrCands() const {
544  if (embeddedSignalPFNeutralHadrCands_) {
545  if (!signalPFNeutralHadrCandsTransientPtrs_.isSet()) {
546  std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{new std::vector<reco::PFCandidatePtr>{}};
547  aPtrs->reserve(signalPFNeutralHadrCands_.size());
548  for (unsigned int i = 0; i < signalPFNeutralHadrCands_.size(); i++) {
549  aPtrs->push_back(reco::PFCandidatePtr(&signalPFNeutralHadrCands_, i));
550  }
551  signalPFNeutralHadrCandsTransientPtrs_.set(std::move(aPtrs));
552  }
553  return *signalPFNeutralHadrCandsTransientPtrs_;
554  } else {
555  if (pfSpecific_.empty() || pfSpecific().selectedSignalPFNeutrHadrCands_.empty() ||
556  !pfSpecific().selectedSignalPFNeutrHadrCands_.front().isAvailable()) {
557  // this part of code is called when reading from patTuple or miniAOD
558  // it returns empty collection in correct format so it can be substituted by reco::Candidates if available
559  if (!signalPFNeutralHadrCandsTransientPtrs_.isSet()) {
560  std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{new std::vector<reco::PFCandidatePtr>{}};
561  signalPFNeutralHadrCandsTransientPtrs_.set(std::move(aPtrs));
562  }
563  return *signalPFNeutralHadrCandsTransientPtrs_;
564  } else
565  return pfSpecific().selectedSignalPFNeutrHadrCands_;
566  }
567 }
568 
569 const std::vector<reco::PFCandidatePtr>& Tau::signalPFGammaCands() const {
570  if (embeddedSignalPFGammaCands_) {
571  if (!signalPFGammaCandsTransientPtrs_.isSet()) {
572  std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{new std::vector<reco::PFCandidatePtr>{}};
573  aPtrs->reserve(signalPFGammaCands_.size());
574  for (unsigned int i = 0; i < signalPFGammaCands_.size(); i++) {
575  aPtrs->push_back(reco::PFCandidatePtr(&signalPFGammaCands_, i));
576  }
577  signalPFGammaCandsTransientPtrs_.set(std::move(aPtrs));
578  }
579  return *signalPFGammaCandsTransientPtrs_;
580  } else {
581  if (pfSpecific_.empty() || pfSpecific().selectedSignalPFGammaCands_.empty() ||
582  !pfSpecific().selectedSignalPFGammaCands_.front().isAvailable()) {
583  // this part of code is called when reading from patTuple or miniAOD
584  // it returns empty collection in correct format so it can be substituted by reco::Candidates if available
585  if (!signalPFGammaCandsTransientPtrs_.isSet()) {
586  std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{new std::vector<reco::PFCandidatePtr>{}};
587  signalPFGammaCandsTransientPtrs_.set(std::move(aPtrs));
588  }
589  return *signalPFGammaCandsTransientPtrs_;
590  } else
591  return pfSpecific().selectedSignalPFGammaCands_;
592  }
593 }
594 
595 const std::vector<reco::PFRecoTauChargedHadron>& Tau::signalTauChargedHadronCandidates() const {
596  if (pfSpecific_.empty())
597  throw cms::Exception("Type Error") << "Requesting content that is not stored in miniAOD.\n";
598  return pfSpecific().signalTauChargedHadronCandidates_;
599 }
600 
601 const std::vector<reco::RecoTauPiZero>& Tau::signalPiZeroCandidates() const {
602  if (pfSpecific_.empty())
603  throw cms::Exception("Type Error") << "Requesting content that is not stored in miniAOD.\n";
604  return pfSpecific().signalPiZeroCandidates_;
605 }
606 
607 const std::vector<reco::PFCandidatePtr>& Tau::isolationPFCands() const {
608  if (embeddedIsolationPFCands_) {
609  if (!isolationPFCandsTransientPtrs_.isSet()) {
610  std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{new std::vector<reco::PFCandidatePtr>{}};
611  aPtrs->reserve(isolationPFCands_.size());
612  for (unsigned int i = 0; i < isolationPFCands_.size(); i++) {
613  aPtrs->push_back(reco::PFCandidatePtr(&isolationPFCands_, i));
614  }
615  isolationPFCandsTransientPtrs_.set(std::move(aPtrs));
616  }
617  return *isolationPFCandsTransientPtrs_;
618  } else {
619  if (pfSpecific_.empty() || pfSpecific().selectedIsolationPFCands_.empty() ||
620  !pfSpecific().selectedIsolationPFCands_.front().isAvailable()) {
621  // this part of code is called when reading from patTuple or miniAOD
622  // it returns empty collection in correct format so it can be substituted by reco::Candidates if available
623  if (!isolationPFCandsTransientPtrs_.isSet()) {
624  std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{new std::vector<reco::PFCandidatePtr>{}};
625  isolationPFCandsTransientPtrs_.set(std::move(aPtrs));
626  }
627  return *isolationPFCandsTransientPtrs_;
628  } else
629  return pfSpecific().selectedIsolationPFCands_;
630  }
631 }
632 
633 const std::vector<reco::PFCandidatePtr>& Tau::isolationPFChargedHadrCands() const {
634  if (embeddedIsolationPFChargedHadrCands_) {
635  if (!isolationPFChargedHadrCandsTransientPtrs_.isSet()) {
636  std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{new std::vector<reco::PFCandidatePtr>{}};
637  aPtrs->reserve(isolationPFChargedHadrCands_.size());
638  for (unsigned int i = 0; i < isolationPFChargedHadrCands_.size(); i++) {
639  aPtrs->push_back(reco::PFCandidatePtr(&isolationPFChargedHadrCands_, i));
640  }
641  isolationPFChargedHadrCandsTransientPtrs_.set(std::move(aPtrs));
642  }
643  return *isolationPFChargedHadrCandsTransientPtrs_;
644  } else {
645  if (pfSpecific_.empty() || pfSpecific().selectedIsolationPFChargedHadrCands_.empty() ||
646  !pfSpecific().selectedIsolationPFChargedHadrCands_.front().isAvailable()) {
647  // this part of code is called when reading from patTuple or miniAOD
648  // it returns empty collection in correct format so it can be substituted by reco::Candidates if available
649  if (!isolationPFChargedHadrCandsTransientPtrs_.isSet()) {
650  std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{new std::vector<reco::PFCandidatePtr>{}};
651  isolationPFChargedHadrCandsTransientPtrs_.set(std::move(aPtrs));
652  }
653  return *isolationPFChargedHadrCandsTransientPtrs_;
654  } else
655  return pfSpecific().selectedIsolationPFChargedHadrCands_;
656  }
657 }
658 
659 const std::vector<reco::PFCandidatePtr>& Tau::isolationPFNeutrHadrCands() const {
660  if (embeddedIsolationPFNeutralHadrCands_) {
661  if (!isolationPFNeutralHadrCandsTransientPtrs_.isSet()) {
662  std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{new std::vector<reco::PFCandidatePtr>{}};
663  aPtrs->reserve(isolationPFNeutralHadrCands_.size());
664  for (unsigned int i = 0; i < isolationPFNeutralHadrCands_.size(); i++) {
665  aPtrs->push_back(reco::PFCandidatePtr(&isolationPFNeutralHadrCands_, i));
666  }
667  isolationPFNeutralHadrCandsTransientPtrs_.set(std::move(aPtrs));
668  }
669  return *isolationPFNeutralHadrCandsTransientPtrs_;
670  } else {
671  if (pfSpecific_.empty() || pfSpecific().selectedIsolationPFNeutrHadrCands_.empty() ||
672  !pfSpecific().selectedIsolationPFNeutrHadrCands_.front().isAvailable()) {
673  // this part of code is called when reading from patTuple or miniAOD
674  // it returns empty collection in correct format so it can be substituted by reco::Candidates if available
675  if (!isolationPFNeutralHadrCandsTransientPtrs_.isSet()) {
676  std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{new std::vector<reco::PFCandidatePtr>{}};
677  isolationPFNeutralHadrCandsTransientPtrs_.set(std::move(aPtrs));
678  }
679  return *isolationPFNeutralHadrCandsTransientPtrs_;
680  } else
681  return pfSpecific().selectedIsolationPFNeutrHadrCands_;
682  }
683 }
684 
685 const std::vector<reco::PFCandidatePtr>& Tau::isolationPFGammaCands() const {
686  if (embeddedIsolationPFGammaCands_) {
687  if (!isolationPFGammaCandsTransientPtrs_.isSet()) {
688  std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{new std::vector<reco::PFCandidatePtr>{}};
689  aPtrs->reserve(isolationPFGammaCands_.size());
690  for (unsigned int i = 0; i < isolationPFGammaCands_.size(); i++) {
691  aPtrs->push_back(reco::PFCandidatePtr(&isolationPFGammaCands_, i));
692  }
693  isolationPFGammaCandsTransientPtrs_.set(std::move(aPtrs));
694  }
695  return *isolationPFGammaCandsTransientPtrs_;
696  } else {
697  if (pfSpecific_.empty() || pfSpecific().selectedIsolationPFGammaCands_.empty() ||
698  !pfSpecific().selectedIsolationPFGammaCands_.front().isAvailable()) {
699  // this part of code is called when reading from patTuple or miniAOD
700  // it returns empty collection in correct format so it can be substituted by reco::Candidates if available
701  if (!isolationPFGammaCandsTransientPtrs_.isSet()) {
702  std::unique_ptr<std::vector<reco::PFCandidatePtr> > aPtrs{new std::vector<reco::PFCandidatePtr>{}};
703  isolationPFGammaCandsTransientPtrs_.set(std::move(aPtrs));
704  }
705  return *isolationPFGammaCandsTransientPtrs_;
706  } else
707  return pfSpecific().selectedIsolationPFGammaCands_;
708  }
709 }
710 
711 const std::vector<reco::PFRecoTauChargedHadron>& Tau::isolationTauChargedHadronCandidates() const {
712  if (pfSpecific_.empty())
713  throw cms::Exception("Type Error") << "Requesting content that is not stored in miniAOD.\n";
714  return pfSpecific().isolationTauChargedHadronCandidates_;
715 }
716 
717 const std::vector<reco::RecoTauPiZero>& Tau::isolationPiZeroCandidates() const {
718  if (pfSpecific_.empty())
719  throw cms::Exception("Type Error") << "Requesting content that is not stored in miniAOD.\n";
720  return pfSpecific().isolationPiZeroCandidates_;
721 }
722 
725 
726 // initialize the jet to a given JEC level during creation starting from Uncorrected
727 void Tau::initializeJEC(unsigned int level, unsigned int set) {
728  currentJECSet(set);
729  currentJECLevel(level);
730  setP4(jec_[set].correction(level) * p4());
731 }
732 
734 int Tau::jecSet(const std::string& set) const {
735  for (std::vector<pat::TauJetCorrFactors>::const_iterator corrFactor = jec_.begin(); corrFactor != jec_.end();
736  ++corrFactor) {
737  if (corrFactor->jecSet() == set)
738  return corrFactor - jec_.begin();
739  }
740  return -1;
741 }
742 
744 const std::vector<std::string> Tau::availableJECSets() const {
745  std::vector<std::string> sets;
746  for (std::vector<pat::TauJetCorrFactors>::const_iterator corrFactor = jec_.begin(); corrFactor != jec_.end();
747  ++corrFactor) {
748  sets.push_back(corrFactor->jecSet());
749  }
750  return sets;
751 }
752 
753 const std::vector<std::string> Tau::availableJECLevels(const int& set) const {
754  return set >= 0 ? jec_.at(set).correctionLabels() : std::vector<std::string>();
755 }
756 
759 float Tau::jecFactor(const std::string& level, const std::string& set) const {
760  for (unsigned int idx = 0; idx < jec_.size(); ++idx) {
761  if (set.empty() || jec_.at(idx).jecSet() == set) {
762  if (jec_[idx].jecLevel(level) >= 0)
763  return jecFactor(jec_[idx].jecLevel(level), idx);
764  else
765  throw cms::Exception("InvalidRequest") << "This JEC level " << level << " does not exist. \n";
766  }
767  }
768  throw cms::Exception("InvalidRequest") << "This jet does not carry any jet energy correction factor information \n"
769  << "for a jet energy correction set with label " << set << "\n";
770 }
771 
774 float Tau::jecFactor(const unsigned int& level, const unsigned int& set) const {
775  if (!jecSetsAvailable())
776  throw cms::Exception("InvalidRequest") << "This jet does not carry any jet energy correction factor information \n";
777  if (!jecSetAvailable(set))
778  throw cms::Exception("InvalidRequest") << "This jet does not carry any jet energy correction factor information \n"
779  << "for a jet energy correction set with index " << set << "\n";
780  return jec_.at(set).correction(level) / jec_.at(currentJECSet_).correction(currentJECLevel_);
781 }
782 
785 Tau Tau::correctedTauJet(const std::string& level, const std::string& set) const {
786  // rescale p4 of the jet; the update of current values is
787  // done within the called jecFactor function
788  for (unsigned int idx = 0; idx < jec_.size(); ++idx) {
789  if (set.empty() || jec_.at(idx).jecSet() == set) {
790  if (jec_[idx].jecLevel(level) >= 0)
791  return correctedTauJet(jec_[idx].jecLevel(level), idx);
792  else
793  throw cms::Exception("InvalidRequest") << "This JEC level " << level << " does not exist. \n";
794  }
795  }
796  throw cms::Exception("InvalidRequest") << "This JEC set " << set << " does not exist. \n";
797 }
798 
801 Tau Tau::correctedTauJet(const unsigned int& level, const unsigned int& set) const {
802  Tau correctedTauJet(*this);
803  //rescale p4 of the jet
804  correctedTauJet.setP4(jecFactor(level, set) * p4());
805  // update current level and set
806  correctedTauJet.currentJECSet(set);
807  correctedTauJet.currentJECLevel(level);
808  return correctedTauJet;
809 }
810 
813 // return the leading candidate from signal(PF)ChargedHadrCandPtrs_ collection
814 const reco::CandidatePtr Tau::leadChargedHadrCand() const {
815  const reco::PFCandidatePtr leadPF = leadPFChargedHadrCand();
816  if (leadPF.isAvailable() || signalChargedHadrCandPtrs_.isNull())
817  return leadPF;
819  for (const reco::CandidatePtr& p : signalChargedHadrCandPtrs_) {
820  if (ret.isNull() || (p->pt() > ret->pt()))
821  ret = p;
822  }
823  return ret;
824 }
825 
827 const reco::CandidatePtr Tau::leadNeutralCand() const {
828  const reco::PFCandidatePtr leadPF = leadPFNeutralCand();
829  if (leadPF.isAvailable() || signalNeutralHadrCandPtrs_.isNull())
830  return leadPF;
832  for (const reco::CandidatePtr& p : signalNeutralHadrCandPtrs_) {
833  if (ret.isNull() || (p->pt() > ret->pt()))
834  ret = p;
835  }
836  return ret;
837 }
838 
840 const reco::CandidatePtr Tau::leadCand() const {
841  const reco::PFCandidatePtr leadPF = leadPFCand();
842  if (leadPF.isAvailable() || !Tau::ExistSignalCands())
843  return leadPF;
844  else
845  return Tau::signalCands()[0];
846 }
847 
849 
850 bool Tau::ExistSignalCands() const {
851  return !(signalChargedHadrCandPtrs_.isNull() && signalNeutralHadrCandPtrs_.isNull() && signalGammaCandPtrs_.isNull());
852 }
853 
854 bool Tau::ExistIsolationCands() const {
855  return !(isolationChargedHadrCandPtrs_.isNull() && isolationNeutralHadrCandPtrs_.isNull() &&
856  isolationGammaCandPtrs_.isNull());
857 }
858 
861 
862 reco::CandidatePtrVector Tau::signalCands() const {
863  std::vector<reco::PFCandidatePtr> r0 = signalPFCands();
865  if (!Tau::ExistSignalCands() || (!r0.empty() && r0.front().isAvailable())) {
866  for (const auto& p : r0)
867  ret.push_back(p);
868  return ret;
869  } else {
872  std::vector<std::pair<float, size_t> > pt_index;
873  size_t index = 0;
874  ret2.reserve(signalChargedHadrCandPtrs_.size() + signalNeutralHadrCandPtrs_.size() + signalGammaCandPtrs_.size());
875  pt_index.reserve(signalChargedHadrCandPtrs_.size() + signalNeutralHadrCandPtrs_.size() +
876  signalGammaCandPtrs_.size());
877 
878  for (const auto& p : signalChargedHadrCandPtrs_) {
879  ret2.push_back(p);
880  pt_index.push_back(std::make_pair(p->pt(), index));
881  index++;
882  }
883  for (const auto& p : signalNeutralHadrCandPtrs_) {
884  ret2.push_back(p);
885  pt_index.push_back(std::make_pair(p->pt(), index));
886  index++;
887  }
888  for (const auto& p : signalGammaCandPtrs_) {
889  ret2.push_back(p);
890  pt_index.push_back(std::make_pair(p->pt(), index));
891  index++;
892  }
893  std::sort(pt_index.begin(), pt_index.end(), std::greater<>());
894  ret.reserve(pt_index.size());
895  for (const auto& p : pt_index) {
896  ret.push_back(ret2[p.second]);
897  }
898  return ret;
899  }
900 }
901 
904 reco::CandidatePtrVector Tau::signalChargedHadrCands() const {
905  std::vector<reco::PFCandidatePtr> r0 = signalPFChargedHadrCands();
906  if (signalChargedHadrCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
908  for (const auto& p : r0)
909  ret.push_back(p);
910  return ret;
911  } else {
912  return signalChargedHadrCandPtrs_;
913  }
914 }
915 
918 reco::CandidatePtrVector Tau::signalNeutrHadrCands() const {
919  std::vector<reco::PFCandidatePtr> r0 = signalPFNeutrHadrCands();
920  if (signalNeutralHadrCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
922  for (const auto& p : r0)
923  ret.push_back(p);
924  return ret;
925  } else {
926  return signalNeutralHadrCandPtrs_;
927  }
928 }
929 
932 reco::CandidatePtrVector Tau::signalGammaCands() const {
933  std::vector<reco::PFCandidatePtr> r0 = signalPFGammaCands();
934  if (signalGammaCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
936  for (const auto& p : r0)
937  ret.push_back(p);
938  return ret;
939  } else {
940  return signalGammaCandPtrs_;
941  }
942 }
943 
946 reco::CandidatePtrVector Tau::isolationCands() const {
947  std::vector<reco::PFCandidatePtr> r0 = isolationPFCands();
949  if (!Tau::ExistIsolationCands() || (!r0.empty() && r0.front().isAvailable())) {
950  for (const auto& p : r0)
951  ret.push_back(p);
952  return ret;
953  } else {
956  std::vector<std::pair<float, size_t> > pt_index;
957  ret2.reserve(isolationChargedHadrCandPtrs_.size() + isolationNeutralHadrCandPtrs_.size() +
958  isolationGammaCandPtrs_.size());
959  pt_index.reserve(isolationChargedHadrCandPtrs_.size() + isolationNeutralHadrCandPtrs_.size() +
960  isolationGammaCandPtrs_.size());
961  size_t index = 0;
962  for (const auto& p : isolationChargedHadrCandPtrs_) {
963  ret2.push_back(p);
964  pt_index.push_back(std::make_pair(p->pt(), index));
965  index++;
966  }
967  for (const auto& p : isolationNeutralHadrCandPtrs_) {
968  ret2.push_back(p);
969  pt_index.push_back(std::make_pair(p->pt(), index));
970  index++;
971  }
972  for (const auto& p : isolationGammaCandPtrs_) {
973  ret2.push_back(p);
974  pt_index.push_back(std::make_pair(p->pt(), index));
975  index++;
976  }
977  std::sort(pt_index.begin(), pt_index.end(), std::greater<>());
978  ret.reserve(pt_index.size());
979  for (const auto& p : pt_index) {
980  ret.push_back(ret2[p.second]);
981  }
982  return ret;
983  }
984 }
985 
988 reco::CandidatePtrVector Tau::isolationChargedHadrCands() const {
989  std::vector<reco::PFCandidatePtr> r0 = isolationPFChargedHadrCands();
990  if (isolationChargedHadrCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
992  for (const auto& p : r0)
993  ret.push_back(p);
994  return ret;
995  } else {
996  return isolationChargedHadrCandPtrs_;
997  }
998 }
999 
1002 reco::CandidatePtrVector Tau::isolationNeutrHadrCands() const {
1004  std::vector<reco::PFCandidatePtr> r0 = isolationPFNeutrHadrCands();
1005  if (isolationNeutralHadrCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
1007  for (const auto& p : r0)
1008  ret.push_back(p);
1009  return ret;
1010  } else {
1011  return isolationNeutralHadrCandPtrs_;
1012  }
1013 }
1014 
1017 reco::CandidatePtrVector Tau::isolationGammaCands() const {
1018  std::vector<reco::PFCandidatePtr> r0 = isolationPFGammaCands();
1019  if (isolationGammaCandPtrs_.isNull() || (!r0.empty() && r0.front().isAvailable())) {
1021  for (const auto& p : r0)
1022  ret.push_back(p);
1023  return ret;
1024  } else {
1025  return isolationGammaCandPtrs_;
1026  }
1027 }
1028 
1029 std::vector<reco::CandidatePtr> Tau::signalLostTracks() const {
1030  std::vector<reco::CandidatePtr> ret;
1031  unsigned int i = 0;
1032  std::string label = "_lostTrack_" + std::to_string(i);
1033  while (this->hasUserCand(label)) {
1034  ret.push_back(userCand(label));
1035  i++;
1036  label = "_lostTrack_" + std::to_string(i);
1037  }
1038  return ret;
1039 }
1040 
1041 void Tau::setSignalLostTracks(const std::vector<reco::CandidatePtr>& ptrs) {
1042  unsigned int i = 0;
1043  for (const auto& ptr : ptrs) {
1044  std::string label = "_lostTrack_" + std::to_string(i);
1045  addUserCand(label, ptr);
1046  i++;
1047  }
1048 }
1049 
1052 size_t Tau::numberOfSourceCandidatePtrs() const {
1053  if (Tau::ExistSignalCands())
1054  return Tau::signalCands().size();
1055  else if (pfSpecific_.empty())
1056  return 0;
1057  else
1058  return pfSpecific().selectedSignalPFCands_.size();
1059 }
1062  if (Tau::ExistSignalCands())
1063  return Tau::signalCands()[i];
1064  else if (pfSpecific_.empty())
1065  return reco::CandidatePtr();
1066  else
1067  return pfSpecific().selectedSignalPFCands_[i];
1068 }
~Tau() override
const std::vector< reco::CandidatePtr > & signalNeutrHadrCands() const
Neutral hadrons in signal region.
Definition: PFTau.cc:80
embedIsolationPFNeutralHadrCands
embed in AOD externally stored isolation PFChargedHadronCandidates
embedIsolationPFChargedHadrCands
embed in AOD externally stored isolation PFCandidates
const CandidatePtr & leadChargedHadrCand() const
Definition: PFTau.cc:63
ret
prodAgent to be discontinued
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:149
embedSignalPFGammaCands
embed in AOD externally stored signal PFNeutralHadronCandidates
embedSignalPFCands
embed in AOD externally stored leading PFNeutral Candidate
CandidatePtr sourceCandidatePtr(size_type i) const override
std::string to_string(const V &value)
Definition: OMSAccess.h:71
value_type const at(size_type idx) const
Retrieve an element of the RefVector.
Definition: RefVector.h:83
const reco::PFCandidatePtr convertToPFCandidatePtr(const reco::CandidatePtr &ptr)
Definition: Tau.cc:455
uint16_t size_type
bool isAvailable() const
Definition: Ptr.h:230
InputIterator leadCand(InputIterator begin, InputIterator end)
const LorentzVector & p4() const final
four-momentum Lorentz vector
embedSignalPFNeutralHadrCands
embed in AOD externally stored signal PFChargedHadronCandidates
Definition: HeavyIon.h:7
static const int tauID
Definition: TopGenEvent.h:20
char const * label
embedSignalTracks
embed in AOD externally stored leading track
const std::vector< reco::CandidatePtr > & isolationNeutrHadrCands() const
Definition: PFTau.cc:95
double p() const final
magnitude of momentum vector
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:66
embedIsolationPFGammaCands
embed in AOD externally stored isolation PFNeutralHadronCandidates
embedIsolationTracks
embed in AOD externally stored signal tracks
Tau()
default constructor
def pv(vc)
Definition: MetAnalyzer.py:7
Jets made from MC generator particles.
Definition: GenJet.h:23
virtual const reco::TrackRefVector & signalTracks() const
Definition: BaseTau.cc:26
embedLeadPFNeutralCand
embed in AOD externally stored leading PFChargedHadron candidate
virtual reco::TrackRef leadTrack() const
Definition: BaseTau.cc:24
unsigned int index
Definition: LeafCandidate.h:31
void reserve(size_type n)
Reserve space for RefVector.
Definition: RefVector.h:108
Analysis-level tau class.
Definition: Tau.h:53
const std::vector< reco::CandidatePtr > & signalGammaCands() const
Gamma candidates in signal region.
Definition: PFTau.cc:84
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:139
virtual const reco::TrackRefVector & isolationTracks() const
Definition: BaseTau.cc:28
Definition: Tau.py:1
embedSignalPFChargedHadrCands
embed in AOD externally stored signal PFCandidates
size_type size() const
Size of the RefVector.
Definition: RefVector.h:102
const std::vector< reco::CandidatePtr > & isolationChargedHadrCands() const
Charged candidates in isolation region.
Definition: PFTau.cc:89
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
edm::Ref< PFRecoTauChargedHadronCollection > PFRecoTauChargedHadronRef
presistent reference to a PFRecoTauChargedHadron
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
size_t numberOfSourceCandidatePtrs() const override
Tau()
Definition: Tau.h:22
void reserve(size_type n)
Reserve space for RefVector.
Definition: PtrVectorBase.h:95
const std::vector< reco::CandidatePtr > & signalChargedHadrCands() const
Charged hadrons in signal region.
Definition: PFTau.cc:76
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
fixed size matrix
const std::vector< reco::CandidatePtr > & isolationGammaCands() const
Gamma candidates in isolation region.
Definition: PFTau.cc:99
const std::vector< PFRecoTauChargedHadron > & signalTauChargedHadronCandidates() const
Retrieve the association of signal region PF candidates into candidate PFRecoTauChargedHadrons.
Definition: PFTau.cc:287
embedIsolationPFCands
embed in AOD externally stored signal PFGammaCandidates
Definition: Lepton.py:1
embedLeadPFCand
embed in AOD externally stored isolation tracks embedding objects (for PFTaus only) ...
embedLeadPFChargedHadrCand
embed in AOD externally stored leading PFCandidate
edm::Ptr< PFCandidate > PFCandidatePtr
persistent Ptr to a PFCandidate
void setP4(const LorentzVector &p4) final
set 4-momentum
def move(src, dest)
Definition: eostools.py:511
math::ErrorF< 3 >::type CovMatrix