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
const Candidate * daughter(size_type) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
std::vector< const Candidate * > filteredObjectCandidates(int absCharge=-2) const
returns pointers to filtered objects (i.e. those not included in signal objects)
CompositeCandidate piZeroes_
std::vector< const Candidate * > neutralPionCandidates() const
returns pointers to neutral pions
size_t size_type
Definition: Candidate.h:29
const VertexCompositeCandidate & chargedPions() const
returns collection of charged pions w/ vertex information (tracks are refit)
const CompositeCandidate & neutralPions() const
returns a collection of merged Pi0s
std::vector< const Candidate * > chargedFilteredObjectCandidates() const
returns only charged filtered objects
Log< level::Error, false > LogError
const LorentzVector & p4() const final
four-momentum Lorentz vector
static std::string const input
Definition: EdmProvDump.cc:47
void setCharge(Charge q) final
set electric charge
static const unsigned char maxNumberOfPiZeroCandidatesAllowed
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void pfMasterClones(const Candidate *input, PFCandidateRefVector &toFill) const
fills master clones to PF objects (utility function)
PFCandidateRefVector associatedNeutralPFCandidates() const
returns the PFCandidates associated to the PiZero signal objects (i.e., the unmerged photons) ...
virtual int charge() const =0
electric charge
std::vector< const Candidate * > decayProductCandidates() const
returns pointers to non-filtered objects
void addDaughter(const Candidate &, const std::string &s="")
add a clone of the passed candidate as daughter
CompositeCandidate filteredObjects_
PFCandidateRefVector associatedChargedPFCandidates() const
returns the PFCandidates associated to the charged signal objects
size_type numberOfDaughters() const override
number of daughters
PFTauDecayMode * clone() const override
returns a clone of the candidate
const CompositeCandidate & filteredObjects() const
returns references to PF objects that were filtered
std::vector< const Candidate * > neutralFilteredObjectCandidates() const
returns only netural filtered objects
fixed size matrix
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:67
VertexCompositeCandidate chargedPions_
void setStatus(int status) final
set status word
void setDecayMode(hadronicTauDecayModes theDecayMode)
void setPdgId(int pdgId) final
void setP4(const LorentzVector &p4) final
set 4-momentum
PFCandidateRefVector filteredPFCandidates() const
returns the PFCandidates that were filtered
int charge() const final
electric charge
std::vector< const Candidate * > chargedPionCandidates() const
returns pointers to charged pions