CMS 3D CMS Logo

RecoTauPiZero.cc
Go to the documentation of this file.
4 
5 namespace reco {
6 
8  size_t nGammas = 0;
9  size_t nDaughters = numberOfDaughters();
10  for (size_t i = 0; i < nDaughters; ++i) {
11  if (daughter(i)->pdgId() == 22)
12  ++nGammas;
13  }
14  return nGammas;
15  }
16 
18  size_t nElectrons = 0;
19  size_t nDaughters = numberOfDaughters();
20  for (size_t i = 0; i < nDaughters; ++i) {
21  if (std::abs(daughter(i)->pdgId()) == 11)
22  ++nElectrons;
23  }
24  return nElectrons;
25  }
26 
27  double RecoTauPiZero::maxDeltaPhi() const {
28  double maxDPhi = 0;
29  size_t nDaughters = numberOfDaughters();
30  for (size_t i = 0; i < nDaughters; ++i) {
31  double dPhi = std::fabs(deltaPhi(*this, *daughter(i)));
32  if (dPhi > maxDPhi)
33  maxDPhi = dPhi;
34  }
35  return maxDPhi;
36  }
37 
38  double RecoTauPiZero::maxDeltaEta() const {
39  double maxDEta = 0;
40  size_t nDaughters = numberOfDaughters();
41  for (size_t i = 0; i < nDaughters; ++i) {
42  double dEta = std::fabs(eta() - daughter(i)->eta());
43  if (dEta > maxDEta)
44  maxDEta = dEta;
45  }
46  return maxDEta;
47  }
48 
50 
52 
53  namespace {
54  std::string getPFCandidateType(reco::PFCandidate::ParticleType pfCandidateType) {
55  if (pfCandidateType == reco::PFCandidate::X)
56  return "undefined";
57  else if (pfCandidateType == reco::PFCandidate::h)
58  return "PFChargedHadron";
59  else if (pfCandidateType == reco::PFCandidate::e)
60  return "PFElectron";
61  else if (pfCandidateType == reco::PFCandidate::mu)
62  return "PFMuon";
63  else if (pfCandidateType == reco::PFCandidate::gamma)
64  return "PFGamma";
65  else if (pfCandidateType == reco::PFCandidate::h0)
66  return "PFNeutralHadron";
67  else if (pfCandidateType == reco::PFCandidate::h_HF)
68  return "HF_had";
69  else if (pfCandidateType == reco::PFCandidate::egamma_HF)
70  return "HF_em";
71  else
72  assert(0);
73  }
74  } // namespace
75 
76  void RecoTauPiZero::print(std::ostream& stream) const {
77  std::cout << "Pt = " << this->pt() << ", eta = " << this->eta() << ", phi = " << this->phi() << std::endl;
78  size_t numDaughters = this->numberOfDaughters();
79  for (size_t iDaughter = 0; iDaughter < numDaughters; ++iDaughter) {
80  const reco::PFCandidate* daughter = dynamic_cast<const reco::PFCandidate*>(this->daughterPtr(iDaughter).get());
81  std::cout << " daughter #" << iDaughter << " (" << getPFCandidateType(daughter->particleId()) << "):"
82  << " Pt = " << daughter->pt() << ", eta = " << daughter->eta() << ", phi = " << daughter->phi()
83  << std::endl;
84  }
85  }
86 
87  std::ostream& operator<<(std::ostream& out, const reco::RecoTauPiZero& piZero) {
88  if (!out)
89  return out;
90  piZero.print(out);
91  return out;
92  }
93 } // namespace reco
mps_fire.i
i
Definition: mps_fire.py:428
reco::PFCandidate::e
Definition: PFCandidate.h:47
PFCandidate.h
reco::deltaPhi
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
custom_jme_cff.nElectrons
nElectrons
Definition: custom_jme_cff.py:149
deltaPhi.h
reco::Candidate::eta
virtual double eta() const =0
momentum pseudorapidity
reco::RecoTauPiZero::maxDeltaPhi
double maxDeltaPhi() const
Maximum DeltaPhi between a constituent and the four vector.
Definition: RecoTauPiZero.cc:27
cms::cuda::stream
cudaStream_t stream
Definition: HistoContainer.h:57
gather_cfg.cout
cout
Definition: gather_cfg.py:144
reco::PFCandidate::h
Definition: PFCandidate.h:46
reco::PFCandidate::h_HF
Definition: PFCandidate.h:51
reco::Candidate::pt
virtual double pt() const =0
transverse momentum
cms::cuda::assert
assert(be >=bs)
reco::RecoTauPiZero::numberOfElectrons
size_t numberOfElectrons() const
Number of electron constituents.
Definition: RecoTauPiZero.cc:17
HLT_FULL_cff.maxDPhi
maxDPhi
Definition: HLT_FULL_cff.py:9146
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
HLT_FULL_cff.dPhi
dPhi
Definition: HLT_FULL_cff.py:13702
RecoTauPiZero.h
reco::PFCandidate::X
Definition: PFCandidate.h:45
cmsdt::algo
algo
Definition: constants.h:164
reco::RecoTauPiZero::maxDeltaEta
double maxDeltaEta() const
Maxmum DeltaEta between a constituent and the four vector.
Definition: RecoTauPiZero.cc:38
reco::PFCandidate::mu
Definition: PFCandidate.h:48
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
reco::LeafCandidate::get
T get() const
get a component
Definition: LeafCandidate.h:239
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
reco::LeafCandidate::pdgId
int pdgId() const final
PDG identifier.
Definition: LeafCandidate.h:176
reco::PFCandidate::egamma_HF
Definition: PFCandidate.h:52
reco::RecoTauPiZero::print
void print(std::ostream &out=std::cout) const
Definition: RecoTauPiZero.cc:76
reco::operator<<
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:66
reco::PFCandidate::gamma
Definition: PFCandidate.h:49
reco::RecoTauPiZero::algoName_
PiZeroAlgorithm algoName_
Definition: RecoTauPiZero.h:89
reco::RecoTauPiZero::numberOfGammas
size_t numberOfGammas() const
Number of PFGamma constituents.
Definition: RecoTauPiZero.cc:7
reco::CompositePtrCandidate::numberOfDaughters
size_t numberOfDaughters() const override
number of daughters
Definition: CompositePtrCandidate.cc:18
reco::RecoTauPiZero
Definition: RecoTauPiZero.h:7
reco::LeafCandidate::phi
double phi() const final
momentum azimuthal angle
Definition: LeafCandidate.h:148
HLT_FULL_cff.dEta
dEta
Definition: HLT_FULL_cff.py:13701
reco::PFCandidate::h0
Definition: PFCandidate.h:50
reco::CompositePtrCandidate::daughter
const Candidate * daughter(size_type) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode)
Definition: CompositePtrCandidate.cc:10
reco::PFCandidate
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
reco::RecoTauPiZero::algo
PiZeroAlgorithm algo() const
Algorithm that built this piZero.
Definition: RecoTauPiZero.cc:49
reco::PFCandidate::ParticleType
ParticleType
particle types
Definition: PFCandidate.h:44
reco::Candidate::phi
virtual double phi() const =0
momentum azimuthal angle
reco::RecoTauPiZero::algoIs
bool algoIs(PiZeroAlgorithm algo) const
Check whether a given algo produced this pi zero.
Definition: RecoTauPiZero.cc:51
reco::RecoTauPiZero::PiZeroAlgorithm
PiZeroAlgorithm
Definition: RecoTauPiZero.h:9
reco::CompositePtrCandidate::daughterPtr
virtual CandidatePtr daughterPtr(size_type i) const
reference to daughter at given position
Definition: CompositePtrCandidate.h:61