CMS 3D CMS Logo

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