CMS 3D CMS Logo

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