CMS 3D CMS Logo

PFTauDecayMode.cc
Go to the documentation of this file.
3 
4 namespace reco {
6  const CompositeCandidate& piZeroes,
7  const CompositeCandidate& filteredObjects) {
9  piZeroes_ = piZeroes;
11 
12  // determine decay mode
13  unsigned int nCharged = chargedPions_.numberOfDaughters();
14  unsigned int nNeutral = piZeroes_.numberOfDaughters();
15  hadronicTauDecayModes hadronicTauDecayIndex =
16  static_cast<hadronicTauDecayModes>(((nCharged - 1) * (maxNumberOfPiZeroCandidatesAllowed + 1) + nNeutral));
18  hadronicTauDecayIndex = static_cast<hadronicTauDecayModes>(tauDecayOther);
19  this->setDecayMode(hadronicTauDecayIndex);
20 
21  // setup Particle base
22  for (size_type iCand = 0; iCand < nCharged; ++iCand) {
23  const Candidate* theCandToAdd = chargedPions_.daughter(iCand);
24  this->addDaughter(*theCandToAdd);
25  }
26  for (size_type iCand = 0; iCand < nNeutral; ++iCand) {
27  const Candidate* theCandToAdd = piZeroes_.daughter(iCand);
28  this->addDaughter(*theCandToAdd);
29  }
30 
32  this->setP4(chargedPions_.p4() + piZeroes_.p4());
33  this->setStatus(2); //decayed
34  this->setPdgId(12); //everyone's favorite lepton!
35  }
36 
37  PFTauDecayMode* PFTauDecayMode::clone() const { return new PFTauDecayMode(*this); }
38 
40 
42 
44 
45  std::vector<const Candidate*> PFTauDecayMode::chargedPionCandidates() const {
46  size_type numberOfChargedPions = chargedPions_.numberOfDaughters();
47  std::vector<const Candidate*> output;
48  for (size_type iterCand = 0; iterCand < numberOfChargedPions; ++iterCand)
49  output.push_back(chargedPions_.daughter(iterCand));
50  return output;
51  }
52 
53  std::vector<const Candidate*> PFTauDecayMode::neutralPionCandidates() const {
54  size_type numberOfChargedPions = piZeroes_.numberOfDaughters();
55  std::vector<const Candidate*> output;
56  for (size_type iterCand = 0; iterCand < numberOfChargedPions; ++iterCand)
57  output.push_back(piZeroes_.daughter(iterCand));
58  return output;
59  }
60 
61  std::vector<const Candidate*> PFTauDecayMode::decayProductCandidates() const {
62  std::vector<const Candidate*> output = this->chargedPionCandidates();
63  std::vector<const Candidate*> neutralObjects = this->neutralPionCandidates();
64 
65  output.insert(output.end(), neutralObjects.begin(), neutralObjects.end());
66  return output;
67  }
68 
69  std::vector<const Candidate*> PFTauDecayMode::filteredObjectCandidates(int absCharge) const {
70  size_t numberOfFilteredObjects = filteredObjects_.numberOfDaughters();
71  std::vector<const Candidate*> output;
72  for (size_t iFilteredCand = 0; iFilteredCand < numberOfFilteredObjects; ++iFilteredCand) {
73  const Candidate* myCand = filteredObjects_.daughter(iFilteredCand);
74  if (absCharge < 0 || abs(myCand->charge()) == absCharge)
75  output.push_back(myCand);
76  }
77  return output;
78  }
79 
80  std::vector<const Candidate*> PFTauDecayMode::chargedFilteredObjectCandidates() const {
81  return filteredObjectCandidates(1);
82  }
83 
84  std::vector<const Candidate*> PFTauDecayMode::neutralFilteredObjectCandidates() const {
85  return filteredObjectCandidates(0);
86  }
87 
89  if (input->numberOfDaughters() == 0) //we have reached a leaf
90  {
91  if (input->hasMasterClone()) // has a master clone
92  {
93  PFCandidateRef theCandRef = input->masterClone().castTo<PFCandidateRef>();
94  toFill.push_back(theCandRef);
95  } else
96  edm::LogError("PFTauDecayMode")
97  << "Error in pfMasterClones(...) - found a leaf candidate with no Master clone reference!";
98  } else // recurse down composite chain
99  {
100  size_type numberOfDaughters = input->numberOfDaughters();
101  for (size_type iCand = 0; iCand < numberOfDaughters; ++iCand) {
102  const Candidate* currentCand = input->daughter(iCand);
103  pfMasterClones(currentCand, toFill);
104  }
105  }
106  }
107 
110  const Candidate* input = static_cast<const Candidate*>(&chargedPions_);
111  if (input->numberOfDaughters())
113  return output;
114  }
115 
118  const Candidate* input = static_cast<const Candidate*>(&piZeroes_);
119  if (input->numberOfDaughters())
121  return output;
122  }
123 
126  const Candidate* input = static_cast<const Candidate*>(&filteredObjects_);
127  if (input->numberOfDaughters())
129  return output;
130  }
131 
132 } // namespace reco
reco::LeafCandidate::setPdgId
void setPdgId(int pdgId) final
Definition: LeafCandidate.h:178
reco::PFTauDecayMode::neutralPions
const CompositeCandidate & neutralPions() const
returns a collection of merged Pi0s
Definition: PFTauDecayMode.cc:41
input
static const std::string input
Definition: EdmProvDump.cc:48
MessageLogger.h
HLT_FULL_cff.nCharged
nCharged
Definition: HLT_FULL_cff.py:33268
reco::PFTauDecayMode::PFTauDecayMode
PFTauDecayMode()
Definition: PFTauDecayMode.h:53
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
reco::PFTauDecayMode::maxNumberOfPiZeroCandidatesAllowed
const static unsigned char maxNumberOfPiZeroCandidatesAllowed
Definition: PFTauDecayMode.h:30
reco::PFTauDecayMode::associatedNeutralPFCandidates
PFCandidateRefVector associatedNeutralPFCandidates() const
returns the PFCandidates associated to the PiZero signal objects (i.e., the unmerged photons)
Definition: PFTauDecayMode.cc:116
edm::RefVector< PFCandidateCollection >
reco::VertexCompositeCandidate
Definition: VertexCompositeCandidate.h:16
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
reco::PFTauDecayMode::chargedPionCandidates
std::vector< const Candidate * > chargedPionCandidates() const
returns pointers to charged pions
Definition: PFTauDecayMode.cc:45
edm::Ref< PFCandidateCollection >
reco::PFTauDecayMode::filteredPFCandidates
PFCandidateRefVector filteredPFCandidates() const
returns the PFCandidates that were filtered
Definition: PFTauDecayMode.cc:124
reco::PFTauDecayMode::filteredObjects_
CompositeCandidate filteredObjects_
Definition: PFTauDecayMode.h:112
reco::PFTauDecayMode::filteredObjectCandidates
std::vector< const Candidate * > filteredObjectCandidates(int absCharge=-2) const
returns pointers to filtered objects (i.e. those not included in signal objects)
Definition: PFTauDecayMode.cc:69
reco::PFTauDecayMode::piZeroes_
CompositeCandidate piZeroes_
Definition: PFTauDecayMode.h:111
reco::PFTauDecayMode::filteredObjects
const CompositeCandidate & filteredObjects() const
returns references to PF objects that were filtered
Definition: PFTauDecayMode.cc:43
reco::PFTauDecayMode::chargedFilteredObjectCandidates
std::vector< const Candidate * > chargedFilteredObjectCandidates() const
returns only charged filtered objects
Definition: PFTauDecayMode.cc:80
reco::Candidate::charge
virtual int charge() const =0
electric charge
reco::CompositeCandidate::addDaughter
void addDaughter(const Candidate &, const std::string &s="")
add a clone of the passed candidate as daughter
Definition: CompositeCandidate.cc:108
reco::PFTauDecayMode::tauDecayOther
Definition: PFTauDecayMode.h:50
reco::PFTauDecayMode::setDecayMode
void setDecayMode(hadronicTauDecayModes theDecayMode)
Definition: PFTauDecayMode.h:76
reco::PFTauDecayMode::associatedChargedPFCandidates
PFCandidateRefVector associatedChargedPFCandidates() const
returns the PFCandidates associated to the charged signal objects
Definition: PFTauDecayMode.cc:108
reco::LeafCandidate::p4
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:114
reco::LeafCandidate::charge
int charge() const final
electric charge
Definition: LeafCandidate.h:106
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
edm::RefVector::push_back
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:67
reco::LeafCandidate::setStatus
void setStatus(int status) final
set status word
Definition: LeafCandidate.h:182
reco::Candidate
Definition: Candidate.h:27
reco::CompositeCandidate::numberOfDaughters
size_type numberOfDaughters() const override
number of daughters
Definition: CompositeCandidate.cc:41
reco::LeafCandidate::setP4
void setP4(const LorentzVector &p4) final
set 4-momentum
Definition: LeafCandidate.h:158
reco::PFTauDecayMode::hadronicTauDecayModes
hadronicTauDecayModes
Definition: PFTauDecayMode.h:32
reco::PFTauDecayMode::neutralFilteredObjectCandidates
std::vector< const Candidate * > neutralFilteredObjectCandidates() const
returns only netural filtered objects
Definition: PFTauDecayMode.cc:84
reco::PFTauDecayMode::chargedPions
const VertexCompositeCandidate & chargedPions() const
returns collection of charged pions w/ vertex information (tracks are refit)
Definition: PFTauDecayMode.cc:39
reco::LeafCandidate::setCharge
void setCharge(Charge q) final
set electric charge
Definition: LeafCandidate.h:108
reco::PFTauDecayMode::clone
PFTauDecayMode * clone() const override
returns a clone of the candidate
Definition: PFTauDecayMode.cc:37
reco::PFTauDecayMode::pfMasterClones
void pfMasterClones(const Candidate *input, PFCandidateRefVector &toFill) const
fills master clones to PF objects (utility function)
Definition: PFTauDecayMode.cc:88
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
reco::CompositeCandidate::daughter
const Candidate * daughter(size_type) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode)
Definition: CompositeCandidate.cc:30
reco::PFTauDecayMode::decayProductCandidates
std::vector< const Candidate * > decayProductCandidates() const
returns pointers to non-filtered objects
Definition: PFTauDecayMode.cc:61
PFTauDecayMode.h
reco::Candidate::size_type
size_t size_type
Definition: Candidate.h:29
reco::CompositeCandidate
Definition: CompositeCandidate.h:21
reco::PFTauDecayMode::neutralPionCandidates
std::vector< const Candidate * > neutralPionCandidates() const
returns pointers to neutral pions
Definition: PFTauDecayMode.cc:53
reco::PFTauDecayMode::chargedPions_
VertexCompositeCandidate chargedPions_
Definition: PFTauDecayMode.h:110
reco::PFTauDecayMode
Definition: PFTauDecayMode.h:27