CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
52 const std::vector<PFCandidatePtr>& PFRecoTauChargedHadron::getNeutralPFCandidates() const
53 {
54  return neutralPFCandidates_;
55 }
56 
58 {
60 }
61 
63 {
64  return algo_;
65 }
66 
68 {
69  return (algo_ == algo);
70 }
71 
72 namespace
73 {
74  std::string getPFCandidateType(reco::PFCandidate::ParticleType pfCandidateType)
75  {
76  if ( pfCandidateType == reco::PFCandidate::X ) return "undefined";
77  else if ( pfCandidateType == reco::PFCandidate::h ) return "PFChargedHadron";
78  else if ( pfCandidateType == reco::PFCandidate::e ) return "PFElectron";
79  else if ( pfCandidateType == reco::PFCandidate::mu ) return "PFMuon";
80  else if ( pfCandidateType == reco::PFCandidate::gamma ) return "PFGamma";
81  else if ( pfCandidateType == reco::PFCandidate::h0 ) return "PFNeutralHadron";
82  else if ( pfCandidateType == reco::PFCandidate::h_HF ) return "HF_had";
83  else if ( pfCandidateType == reco::PFCandidate::egamma_HF ) return "HF_em";
84  else assert(0);
85  }
86 }
87 
88 void PFRecoTauChargedHadron::print(std::ostream& stream) const
89 {
90  stream << " Pt = " << this->pt() << ", eta = " << this->eta() << ", phi = " << this->phi() << " (mass = " << this->mass() << ")" << std::endl;
91  stream << " charge = " << this->charge() << " (pdgId = " << this->pdgId() << ")" << std::endl;
92  stream << "charged PFCandidate";
94  stream << " (" << chargedPFCandidate_.id() << ":" << chargedPFCandidate_.key() << "):"
95  << " Pt = " << chargedPFCandidate_->pt() << ", eta = " << chargedPFCandidate_->eta() << ", phi = " << chargedPFCandidate_->phi()
96  << " (type = " << getPFCandidateType(chargedPFCandidate_->particleId()) << ")" << std::endl;
97  } else {
98  stream << ": N/A" << std::endl;
99  }
100  stream << "reco::Track: ";
101  if ( track_.isNonnull() ) {
102  stream << "Pt = " << track_->pt() << " +/- " << track_->ptError() << ", eta = " << track_->eta() << ", phi = " << track_->phi() << std::endl;
103  } else {
104  stream << "N/A" << std::endl;
105  }
106  stream << "neutral PFCandidates:";
107  if ( neutralPFCandidates_.size() >= 1 ) {
108  stream << std::endl;
109  int idx = 0;
110  for ( std::vector<PFCandidatePtr>::const_iterator neutralPFCandidate = neutralPFCandidates_.begin();
111  neutralPFCandidate != neutralPFCandidates_.end(); ++neutralPFCandidate ) {
112  stream << " #" << idx << " (" << neutralPFCandidate->id() << ":" << neutralPFCandidate->key() << "):"
113  << " Pt = " << (*neutralPFCandidate)->pt() << ", eta = " << (*neutralPFCandidate)->eta() << ", phi = " << (*neutralPFCandidate)->phi()
114  << " (type = " << getPFCandidateType((*neutralPFCandidate)->particleId()) << ")" << std::endl;
115  ++idx;
116  }
117  } else {
118  stream << " ";
119  stream << "N/A" << std::endl;
120  }
121  stream << "position@ECAL entrance: x = " << this->positionAtECALEntrance().x() << ", y = " << this->positionAtECALEntrance().y() << ", z = " << this->positionAtECALEntrance().z()
122  << " (eta = " << this->positionAtECALEntrance().eta() << ", phi = " << this->positionAtECALEntrance().phi() << ")" << std::endl;
123  std::string algo_string = "undefined";
124  if ( algo_ == kChargedPFCandidate ) algo_string = "chargedPFCandidate";
125  else if ( algo_ == kTrack ) algo_string = "Track";
126  else if ( algo_ == kPFNeutralHadron ) algo_string = "PFNeutralHadron";
127  stream << "algo = " << algo_string << std::endl;
128 }
129 
130 std::ostream& operator<<(std::ostream& stream, const reco::PFRecoTauChargedHadron& c)
131 {
132  c.print(stream);
133  return stream;
134 }
135 }
int Charge
electric charge type
Definition: Candidate.h:39
PFRecoTauChargedHadronAlgorithm algo() const
Algorithm that built this charged hadron.
algo_(conf.existsAs< bool >("Correct")?conf.getParameter< bool >("Correct"):true, conf.getParameter< double >("e9e25Cut"), conf.getParameter< double >("intercept2DCut"), conf.existsAs< bool >("intercept2DSlope")?conf.getParameter< double >("intercept2DSlope"):defaultSlope2D_, conf.getParameter< std::vector< double > >("e1e9Cut"), conf.getParameter< std::vector< double > >("eCOREe9Cut"), conf.getParameter< std::vector< double > >("eSeLCut"), hfvars_)
ParticleType
particle types
Definition: PFCandidate.h:44
key_type key() const
Definition: Ptr.h:169
virtual int pdgId() const GCC11_FINAL
PDG identifier.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
Definition: Point3D.h:10
void print(std::ostream &stream=std::cout) const
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:71
double p4[4]
Definition: TauolaWrapper.h:92
virtual int charge() const =0
electric charge
const TrackPtr & getTrack() const
reference to reco::Track
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:152
PFRecoTauChargedHadronAlgorithm algo_
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
virtual float mass() const GCC11_FINAL
mass
virtual int charge() const GCC11_FINAL
electric charge
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
const std::vector< PFCandidatePtr > & getNeutralPFCandidates() const
references to additional neutral PFCandidates
std::vector< PFCandidatePtr > neutralPFCandidates_
ProductID id() const
Accessor for product ID.
Definition: Ptr.h:164
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:41
bool algoIs(PFRecoTauChargedHadronAlgorithm algo) const
Check whether a given algo produced this charged hadron.
math::XYZPoint Point
point in the space
Definition: Candidate.h:45
tuple status
Definition: ntuplemaker.py:245
virtual float pt() const GCC11_FINAL
transverse momentum
virtual void setPdgId(int pdgId) GCC11_FINAL
const math::XYZPointF & positionAtECALEntrance() const
position at ECAL entrance
const PFCandidatePtr & getChargedPFCandidate() const
reference to &quot;charged&quot; PFCandidate (either charged PFCandidate or PFNeutralHadron) ...