CMS 3D CMS Logo

Functions
HPSPFTau.cc File Reference
#include "DataFormats/L1TParticleFlow/interface/HPSPFTau.h"
#include "FWCore/Utilities/interface/Exception.h"

Go to the source code of this file.

Functions

ostream & operator<< (ostream &os, const l1t::HPSPFTau &l1PFTau)
 
void printPFCand (ostream &os, const l1t::PFCandidate &l1PFCand, const l1t::TkPrimaryVertexRef &primaryVertex)
 
void printPFCand (ostream &os, const l1t::PFCandidate &l1PFCand, float primaryVertexZ)
 

Function Documentation

◆ operator<<()

ostream& operator<< ( ostream &  os,
const l1t::HPSPFTau l1PFTau 
)

Definition at line 24 of file HPSPFTau.cc.

24  {
25  os << "pT = " << l1PFTau.pt() << ", eta = " << l1PFTau.eta() << ", phi = " << l1PFTau.phi()
26  << " (type = " << l1PFTau.tauType() << ")" << std::endl;
27  os << "lead. ChargedPFCand:" << std::endl;
28  if (l1PFTau.leadChargedPFCand().isNonnull()) {
29  printPFCand(os, *l1PFTau.leadChargedPFCand(), l1PFTau.primaryVertex());
30  } else {
31  os << " N/A" << std::endl;
32  }
33  os << "seed:";
34  if (l1PFTau.isChargedPFCandSeeded()) {
35  os << " chargedPFCand";
36  } else if (l1PFTau.isJetSeeded()) {
37  os << " CaloJet";
38  } else {
39  cms::Exception ex("InconsistentTau");
40  ex.addContext("Calling HPSPFTau::operator <<");
41  ex.addAdditionalInfo("This tau is not seed by either a chargedPFCand or a PFJet!");
42  throw ex;
43  }
44  os << std::endl;
45  os << "signalPFCands:" << std::endl;
46  for (const auto& l1PFCand : l1PFTau.signalAllL1PFCandidates()) {
47  printPFCand(os, *l1PFCand, l1PFTau.primaryVertex());
48  }
49  os << "stripPFCands:" << std::endl;
50  for (const auto& l1PFCand : l1PFTau.stripAllL1PFCandidates()) {
51  printPFCand(os, *l1PFCand, l1PFTau.primaryVertex());
52  }
53  os << "strip pT = " << l1PFTau.stripP4().pt() << std::endl;
54  os << "isolationPFCands:" << std::endl;
55  for (const auto& l1PFCand : l1PFTau.isoAllL1PFCandidates()) {
56  printPFCand(os, *l1PFCand, l1PFTau.primaryVertex());
57  }
58  os << "isolation pT-sum: charged = " << l1PFTau.sumChargedIso() << ", neutral = " << l1PFTau.sumNeutralIso()
59  << " (charged from pileup = " << l1PFTau.sumChargedIsoPileup() << ")" << std::endl;
60  return os;
61 }

References cms::Exception::addAdditionalInfo(), cms::Exception::addContext(), reco::LeafCandidate::eta(), l1t::HPSPFTau::isChargedPFCandSeeded(), l1t::HPSPFTau::isJetSeeded(), edm::Ref< C, T, F >::isNonnull(), l1t::HPSPFTau::isoAllL1PFCandidates(), l1t::HPSPFTau::leadChargedPFCand(), reco::LeafCandidate::phi(), l1t::HPSPFTau::primaryVertex(), printPFCand(), reco::LeafCandidate::pt(), l1t::HPSPFTau::signalAllL1PFCandidates(), l1t::HPSPFTau::stripAllL1PFCandidates(), l1t::HPSPFTau::stripP4(), l1t::HPSPFTau::sumChargedIso(), l1t::HPSPFTau::sumChargedIsoPileup(), l1t::HPSPFTau::sumNeutralIso(), and l1t::HPSPFTau::tauType().

◆ printPFCand() [1/2]

void printPFCand ( ostream &  os,
const l1t::PFCandidate l1PFCand,
const l1t::TkPrimaryVertexRef primaryVertex 
)

Definition at line 63 of file HPSPFTau.cc.

63  {
64  float primaryVertexZ = (primaryVertex.isNonnull()) ? primaryVertex->zvertex() : 0.;
65  printPFCand(os, l1PFCand, primaryVertexZ);
66 }

References BeamMonitor_cff::primaryVertex.

Referenced by L1HPSPFTauBuilder::addL1PFCandidates(), operator<<(), and L1HPSPFTauBuilder::setL1PFTauSeed().

◆ printPFCand() [2/2]

void printPFCand ( ostream &  os,
const l1t::PFCandidate l1PFCand,
float  primaryVertexZ 
)

Definition at line 68 of file HPSPFTau.cc.

68  {
69  std::string typeString;
70  if (l1PFCand.id() == l1t::PFCandidate::ChargedHadron)
71  typeString = "PFChargedHadron";
72  else if (l1PFCand.id() == l1t::PFCandidate::Electron)
73  typeString = "PFElectron";
74  else if (l1PFCand.id() == l1t::PFCandidate::NeutralHadron)
75  typeString = "PFNeutralHadron";
76  else if (l1PFCand.id() == l1t::PFCandidate::Photon)
77  typeString = "PFPhoton";
78  else if (l1PFCand.id() == l1t::PFCandidate::Muon)
79  typeString = "PFMuon";
80  else
81  typeString = "N/A";
82  os << " " << typeString << " with pT = " << l1PFCand.pt() << ", eta = " << l1PFCand.eta()
83  << ", phi = " << l1PFCand.phi() << ","
84  << " mass = " << l1PFCand.mass() << ", charge = " << l1PFCand.charge();
85  if (l1PFCand.charge() != 0 && primaryVertexZ != 0.) {
86  os << " (dz = " << std::fabs(l1PFCand.pfTrack()->vertex().z() - primaryVertexZ) << ")";
87  }
88  os << std::endl;
89 }

References reco::LeafCandidate::charge(), l1t::PFCandidate::ChargedHadron, l1t::PFCandidate::Electron, reco::LeafCandidate::eta(), l1t::PFCandidate::id(), reco::LeafCandidate::mass(), l1t::PFCandidate::Muon, l1t::PFCandidate::NeutralHadron, l1t::PFCandidate::pfTrack(), reco::LeafCandidate::phi(), l1t::PFCandidate::Photon, reco::LeafCandidate::pt(), and AlCaHLTBitMon_QueryRunRegistry::string.

l1t::PFCandidate::Photon
Definition: PFCandidate.h:15
l1t::HPSPFTau::sumNeutralIso
float sumNeutralIso() const
Definition: HPSPFTau.h:67
l1t::PFCandidate::pfTrack
const PFTrackRef & pfTrack() const
Definition: PFCandidate.h:36
l1t::HPSPFTau::stripAllL1PFCandidates
const l1t::PFCandidateRefVector & stripAllL1PFCandidates() const
Definition: HPSPFTau.h:37
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
l1t::PFCandidate::Electron
Definition: PFCandidate.h:15
printPFCand
void printPFCand(ostream &os, const l1t::PFCandidate &l1PFCand, const l1t::TkPrimaryVertexRef &primaryVertex)
Definition: HPSPFTau.cc:63
BeamMonitor_cff.primaryVertex
primaryVertex
hltOfflineBeamSpot for HLTMON
Definition: BeamMonitor_cff.py:7
l1t::HPSPFTau::sumChargedIso
float sumChargedIso() const
Definition: HPSPFTau.h:66
l1t::HPSPFTau::stripP4
const reco::Particle::LorentzVector & stripP4() const
Definition: HPSPFTau.h:60
l1t::HPSPFTau::isoAllL1PFCandidates
const l1t::PFCandidateRefVector & isoAllL1PFCandidates() const
Definition: HPSPFTau.h:41
l1t::HPSPFTau::tauType
Kind tauType() const
Definition: HPSPFTau.h:58
reco::LeafCandidate::mass
double mass() const final
mass
Definition: LeafCandidate.h:131
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
l1t::HPSPFTau::signalAllL1PFCandidates
const l1t::PFCandidateRefVector & signalAllL1PFCandidates() const
Definition: HPSPFTau.h:30
l1t::PFCandidate::ChargedHadron
Definition: PFCandidate.h:15
l1t::HPSPFTau::sumChargedIsoPileup
float sumChargedIsoPileup() const
Definition: HPSPFTau.h:69
reco::LeafCandidate::charge
int charge() const final
electric charge
Definition: LeafCandidate.h:106
l1t::HPSPFTau::primaryVertex
const l1t::TkPrimaryVertexRef & primaryVertex() const
Definition: HPSPFTau.h:55
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
l1t::HPSPFTau::isJetSeeded
bool isJetSeeded() const
Definition: HPSPFTau.h:24
l1t::HPSPFTau::isChargedPFCandSeeded
bool isChargedPFCandSeeded() const
accessor functions for reco level quantities
Definition: HPSPFTau.h:23
l1t::PFCandidate::Muon
Definition: PFCandidate.h:15
l1t::PFCandidate::id
ParticleType id() const
Definition: PFCandidate.h:34
reco::LeafCandidate::phi
double phi() const final
momentum azimuthal angle
Definition: LeafCandidate.h:148
l1t::HPSPFTau::leadChargedPFCand
const l1t::PFCandidateRef & leadChargedPFCand() const
Definition: HPSPFTau.h:28
cms::Exception
Definition: Exception.h:70
l1t::PFCandidate::NeutralHadron
Definition: PFCandidate.h:15