CMS 3D CMS Logo

PFRecoTauChargedHadron.cc
Go to the documentation of this file.
2 
4 
5 namespace reco {
6 
9  algo_(kUndefined)
10 {}
11 
14  algo_(algo)
15 {
16  if ( q > 0. ) this->setPdgId(+211);
17  else if ( q < 0. ) this->setPdgId(-211);
18 }
19 
21  const Point& vtx,
22  int status, bool integerCharge,
24  : CompositePtrCandidate(q, p4, vtx, 211, status, integerCharge),
25  algo_(algo)
26 {
27  if ( q > 0. ) this->setPdgId(+211);
28  else if ( q < 0. ) this->setPdgId(-211);
29 }
30 
33  algo_(algo)
34 {
35  if ( c.charge() > 0. ) this->setPdgId(+211);
36  else if ( c.charge() < 0. ) this->setPdgId(-211);
37 }
38 
40 {}
41 
43 {
44  return chargedPFCandidate_;
45 }
46 
48 {
49  return track_;
50 }
51 
53 {
54  return lostTrackCandidate_;
55 }
56 
57 const std::vector<CandidatePtr>& PFRecoTauChargedHadron::getNeutralPFCandidates() const
58 {
59  return neutralPFCandidates_;
60 }
61 
63 {
65 }
66 
68 {
69  return algo_;
70 }
71 
73 {
74  return (algo_ == algo);
75 }
76 
77 void PFRecoTauChargedHadron::print(std::ostream& stream) const
78 {
79  stream << " Pt = " << this->pt() << ", eta = " << this->eta() << ", phi = " << this->phi() << " (mass = " << this->mass() << ")" << std::endl;
80  stream << " charge = " << this->charge() << " (pdgId = " << this->pdgId() << ")" << std::endl;
81  stream << "charged PFCandidate";
83  stream << " (" << chargedPFCandidate_.id() << ":" << chargedPFCandidate_.key() << "):"
84  << " Pt = " << chargedPFCandidate_->pt() << ", eta = " << chargedPFCandidate_->eta() << ", phi = " << chargedPFCandidate_->phi()
85  << " (pdgId = " << chargedPFCandidate_->pdgId() << ")" << std::endl;
86  } else {
87  stream << ": N/A" << std::endl;
88  }
89  stream << "reco::Track: ";
90  if ( track_.isNonnull() ) {
91  stream << "Pt = " << track_->pt() << " +/- " << track_->ptError() << ", eta = " << track_->eta() << ", phi = " << track_->phi() << std::endl;
92  } else if ( lostTrackCandidate_.isNonnull() ) {
93  stream << "(lostTrackCandidate: " << lostTrackCandidate_.id() << ":" << lostTrackCandidate_.key() << "):"
94  << " Pt = " << lostTrackCandidate_->pt() << ", eta = " << lostTrackCandidate_->eta() << ", phi = " << lostTrackCandidate_->phi() << std::endl;
95  } else {
96  stream << "N/A" << std::endl;
97  }
98  stream << "neutral PFCandidates:";
99  if ( !neutralPFCandidates_.empty() ) {
100  stream << std::endl;
101  int idx = 0;
102  for ( std::vector<CandidatePtr>::const_iterator neutralPFCandidate = neutralPFCandidates_.begin();
103  neutralPFCandidate != neutralPFCandidates_.end(); ++neutralPFCandidate ) {
104  stream << " #" << idx << " (" << neutralPFCandidate->id() << ":" << neutralPFCandidate->key() << "):"
105  << " Pt = " << (*neutralPFCandidate)->pt() << ", eta = " << (*neutralPFCandidate)->eta() << ", phi = " << (*neutralPFCandidate)->phi()
106  << " (pdgId = " << (*neutralPFCandidate)->pdgId() << ")" << std::endl;
107  ++idx;
108  }
109  } else {
110  stream << " ";
111  stream << "N/A" << std::endl;
112  }
113  stream << "position@ECAL entrance: x = " << this->positionAtECALEntrance().x() << ", y = " << this->positionAtECALEntrance().y() << ", z = " << this->positionAtECALEntrance().z()
114  << " (eta = " << this->positionAtECALEntrance().eta() << ", phi = " << this->positionAtECALEntrance().phi() << ")" << std::endl;
115  std::string algo_string = "undefined";
116  if ( algo_ == kChargedPFCandidate ) algo_string = "chargedPFCandidate";
117  else if ( algo_ == kTrack ) algo_string = "Track";
118  else if ( algo_ == kPFNeutralHadron ) algo_string = "PFNeutralHadron";
119  stream << "algo = " << algo_string << std::endl;
120 }
121 
122 std::ostream& operator<<(std::ostream& stream, const reco::PFRecoTauChargedHadron& c)
123 {
124  c.print(stream);
125  return stream;
126 }
127 }
int pdgId() const final
PDG identifier.
int Charge
electric charge type
Definition: Candidate.h:35
PFRecoTauChargedHadronAlgorithm algo() const
Algorithm that built this charged hadron.
double eta() const final
momentum pseudorapidity
key_type key() const
Definition: Ptr.h:185
double pt() const final
transverse momentum
int charge() const final
electric charge
Definition: LeafCandidate.h:91
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
Definition: Point3D.h:10
~PFRecoTauChargedHadron() override
destructor
void print(std::ostream &stream=std::cout) const
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:71
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
std::vector< CandidatePtr > neutralPFCandidates_
const TrackPtr & getTrack() const
reference to reco::Track
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:168
PFRecoTauChargedHadronAlgorithm algo_
ProductID id() const
Accessor for product ID.
Definition: Ptr.h:180
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
virtual int charge() const =0
electric charge
fixed size matrix
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:55
int status() const final
status word
bool algoIs(PFRecoTauChargedHadronAlgorithm algo) const
Check whether a given algo produced this charged hadron.
const CandidatePtr & getChargedPFCandidate() const
reference to "charged" PFCandidate (either charged PFCandidate or PFNeutralHadron) ...
double phi() const final
momentum azimuthal angle
void setPdgId(int pdgId) final
const math::XYZPointF & positionAtECALEntrance() const
position at ECAL entrance
double mass() const final
mass
const std::vector< CandidatePtr > & getNeutralPFCandidates() const
references to additional neutral PFCandidates
const CandidatePtr & getLostTrackCandidate() const
reference to "lostTrack Candidate" when chadron built with tracks stored as pat::PackedCandidates ...