CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends
BPHDecayMomentum Class Referenceabstract

#include <BPHDecayMomentum.h>

Inheritance diagram for BPHDecayMomentum:
BPHDecayVertex BPHKinematicFit BPHPlusMinusVertex BPHRecoCandidate BPHPlusMinusCandidate BPHPlusMinusCandidate

Classes

struct  Component
 

Public Member Functions

 BPHDecayMomentum (const BPHDecayMomentum &x)=delete
 
virtual const std::vector
< std::string > & 
compNames () const
 
virtual const
pat::CompositeCandidate
composite () const
 get a composite by the simple sum of simple particles More...
 
virtual const std::vector
< BPHRecoConstCandPtr > & 
daughComp () const
 
virtual const std::vector
< const reco::Candidate * > & 
daughFull () const
 
virtual const std::vector
< const reco::Candidate * > & 
daughters () const
 
virtual const std::vector
< std::string > & 
daugNames () const
 
virtual BPHRecoConstCandPtr getComp (const std::string &name) const
 
virtual const reco::CandidategetDaug (const std::string &name) const
 
BPHDecayMomentumoperator= (const BPHDecayMomentum &x)=delete
 
virtual const reco::CandidateoriginalReco (const reco::Candidate *daug) const
 get the original particle from the clone More...
 
virtual ~BPHDecayMomentum ()
 

Protected Member Functions

virtual void addP (const std::string &name, const reco::Candidate *daug, double mass=-1.0)
 
virtual void addP (const std::string &name, const BPHRecoConstCandPtr &comp)
 add a previously reconstructed particle giving it a name More...
 
 BPHDecayMomentum ()
 
 BPHDecayMomentum (const std::map< std::string, Component > &daugMap)
 
 BPHDecayMomentum (const std::map< std::string, Component > &daugMap, const std::map< std::string, BPHRecoConstCandPtr > compMap)
 
const std::vector< Component > & componentList () const
 
virtual void fill (BPHRecoCandidate *ptr, int level) const =0
 
virtual void setNotUpdated () const
 

Private Member Functions

void clonesList (const std::map< std::string, Component > &daugMap)
 
virtual void computeMomentum () const
 
void dCompList ()
 
virtual void fillDaug (std::vector< const reco::Candidate * > &ad) const
 
virtual void sumMomentum (const std::vector< const reco::Candidate * > dl) const
 

Private Attributes

std::vector< BPHRecoConstCandPtrcList
 
std::map< const
reco::Candidate *, const
reco::Candidate * > 
clonesMap
 
std::map< std::string,
BPHRecoConstCandPtr
cMap
 
pat::CompositeCandidate compCand
 
std::vector< ComponentcompList
 
std::vector< const
reco::Candidate * > 
dFull
 
std::vector< const
reco::Candidate * > 
dList
 
std::map< std::string, const
reco::Candidate * > 
dMap
 
std::vector< std::string > nComp
 
std::vector< std::string > nList
 
bool oldMom
 

Friends

class BPHRecoBuilder
 

Detailed Description

Description: Lowest-level base class to contain decay products and compute total momentum

Author
Paolo Ronchese INFN Padova

Definition at line 35 of file BPHDecayMomentum.h.

Constructor & Destructor Documentation

BPHDecayMomentum::BPHDecayMomentum ( const BPHDecayMomentum x)
delete

Constructors are protected this object can exist only as part of a derived class

BPHDecayMomentum::~BPHDecayMomentum ( )
virtual

Destructor

Definition at line 53 of file BPHDecayMomentum.cc.

References dList, and dqmiodumpmetadata::n.

53  {
54  // delete all clones
55  int n = dList.size();
56  while (n--)
57  delete dList[n];
58 }
std::vector< const reco::Candidate * > dList
BPHDecayMomentum::BPHDecayMomentum ( )
protected

Definition at line 32 of file BPHDecayMomentum.cc.

References dList.

32 : oldMom(true) { dList.reserve(2); }
std::vector< const reco::Candidate * > dList
BPHDecayMomentum::BPHDecayMomentum ( const std::map< std::string, Component > &  daugMap)
protected
BPHDecayMomentum::BPHDecayMomentum ( const std::map< std::string, Component > &  daugMap,
const std::map< std::string, BPHRecoConstCandPtr compMap 
)
protected

Member Function Documentation

virtual void BPHDecayMomentum::addP ( const std::string &  name,
const reco::Candidate daug,
double  mass = -1.0 
)
protectedvirtual

add a simple particle giving it a name particles are cloned, eventually specifying a different mass

virtual void BPHDecayMomentum::addP ( const std::string &  name,
const BPHRecoConstCandPtr comp 
)
protectedvirtual

add a previously reconstructed particle giving it a name

void BPHDecayMomentum::clonesList ( const std::map< std::string, Component > &  daugMap)
private

Definition at line 154 of file BPHDecayMomentum.cc.

References reco::Candidate::begin(), BPHDecayMomentum::Component::cand, reco::Candidate::clone(), clonesMap, compList, dList, dMap, mps_splice::entry, mps_fire::i, ResonanceBuilder::mass, BPHDecayMomentum::Component::mass, dqmiodumpmetadata::n, mergeVDriftHistosByStation::name, nList, and reco::Candidate::setMass().

154  {
155  int n = daugMap.size();
156  dList.resize(n);
157  nList.resize(n);
158  // reset and fill a list
159  // to be used in the creation of other bases of BPHRecoCandidate
160  compList.clear();
161  compList.reserve(n);
162  // loop over daughters
163  int i = 0;
164  double mass;
165  reco::Candidate* dnew;
166  map<string, Component>::const_iterator iter = daugMap.begin();
167  map<string, Component>::const_iterator iend = daugMap.end();
168  while (iter != iend) {
169  const pair<string, Component>& entry = *iter++;
170  const Component& comp = entry.second;
171  const reco::Candidate* cand = comp.cand;
172  // store component for usage
173  // in the creation of other bases of BPHRecoCandidate
174  compList.push_back(comp);
175  // clone particle and store it with its name
176  dList[i] = dnew = cand->clone();
177  const string& name = nList[i++] = entry.first;
178  dMap[name] = dnew;
179  clonesMap[dnew] = cand;
180  // set daughter mass if requested
181  mass = comp.mass;
182  if (mass > 0)
183  dnew->setMass(mass);
184  }
185  return;
186 }
virtual double mass() const =0
mass
std::map< std::string, const reco::Candidate * > dMap
std::vector< const reco::Candidate * > dList
std::vector< Component > compList
virtual Candidate * clone() const =0
returns a clone of the Candidate object
std::map< const reco::Candidate *, const reco::Candidate * > clonesMap
list entry
Definition: mps_splice.py:68
const_iterator begin() const
first daughter const_iterator
Definition: Candidate.h:143
std::vector< std::string > nList
virtual void setMass(double m)=0
set particle mass
const vector< string > & BPHDecayMomentum::compNames ( ) const
virtual

get the list of names of previously reconstructed particles e.g. in JPsi -> mu+mu- returns an empty list in B+ -> JPsi K+ returns the name used for the JPsi in Bs -> JPsi Phi returns the two names used for JPsi and Phi

Definition at line 71 of file BPHDecayMomentum.cc.

References nComp.

Referenced by BPHRecoCandidate::fill(), and BPHKinematicFit::numParticles().

71 { return nComp; }
std::vector< std::string > nComp
const vector< BPHDecayMomentum::Component > & BPHDecayMomentum::componentList ( ) const
protected

Definition at line 118 of file BPHDecayMomentum.cc.

References compList.

Referenced by BPHDecayVertex::BPHDecayVertex(), and BPHKinematicFit::BPHKinematicFit().

118  {
119  // return an object filled in the constructor
120  // to be used in the creation of other bases of BPHRecoCandidate
121  return compList;
122 }
std::vector< Component > compList
const pat::CompositeCandidate & BPHDecayMomentum::composite ( ) const
virtual

get a composite by the simple sum of simple particles

Operations

Reimplemented in BPHPlusMinusCandidate.

Definition at line 63 of file BPHDecayMomentum.cc.

References compCand, computeMomentum(), and oldMom.

Referenced by BPHPlusMinusCandidate::composite().

63  {
64  if (oldMom)
66  return compCand;
67 }
virtual void computeMomentum() const
pat::CompositeCandidate compCand
void BPHDecayMomentum::computeMomentum ( ) const
privatevirtual

Definition at line 225 of file BPHDecayMomentum.cc.

References reco::CompositeCandidate::clearDaughters(), compCand, dFull, fillDaug(), oldMom, AddFourMomenta::set(), and sumMomentum().

Referenced by composite(), and daughFull().

225  {
226  // reset full list of daughters
227  dFull.clear();
228  fillDaug(dFull);
229  // reset and fill pat::CompositeCandidate
232  // compute the total momentum
233  AddFourMomenta addP4;
234  addP4.set(compCand);
235  oldMom = false;
236  return;
237 }
virtual void sumMomentum(const std::vector< const reco::Candidate * > dl) const
std::vector< const reco::Candidate * > dFull
virtual void fillDaug(std::vector< const reco::Candidate * > &ad) const
void clearDaughters()
clear daughters
pat::CompositeCandidate compCand
void set(reco::Candidate &c) const
set up a candidate
const vector< BPHRecoConstCandPtr > & BPHDecayMomentum::daughComp ( ) const
virtual

get the list of previously reconstructed particles e.g. in JPsi -> mu+mu- returns an empty list in B+ -> JPsi K+ returns the JPsi in Bs -> JPsi Phi returns the JPsi and Phi

Definition at line 89 of file BPHDecayMomentum.cc.

References cList.

Referenced by BPHKinematicFit::addParticles(), BPHDecayVertex::BPHDecayVertex(), BPHKinematicFit::BPHKinematicFit(), and BPHKinematicFit::fitMomentum().

89  {
90  // return the list of previously reconstructed particles
91  return cList;
92 }
std::vector< BPHRecoConstCandPtr > cList
const vector< const reco::Candidate * > & BPHDecayMomentum::daughFull ( ) const
virtual

get the full list of simple particles produced in the decay, directly or through cascade decays e.g. in B+ -> JPsi K+ ; JPsi -> mu+mu- returns the mu+, mu-, K+ in Bs -> JPsi Phi; JPsi -> mu+mu-; Phi -> K+K- returns the mu+, mu-, K+, K- (clones are actually returned)

Definition at line 75 of file BPHDecayMomentum.cc.

References computeMomentum(), dFull, and oldMom.

Referenced by BPHKinematicFit::buildParticles(), and BPHDecayVertex::tTracks().

75  {
76  // compute total momentum to update the full list of decay products
77  if (oldMom)
79  return dFull;
80 }
virtual void computeMomentum() const
std::vector< const reco::Candidate * > dFull
const vector< const reco::Candidate * > & BPHDecayMomentum::daughters ( ) const
virtual

get the list of simple particles directly produced in the decay e.g. in JPsi -> mu+mu- returns the two muons in B+ -> JPsi K+ returns the K+ in Bs -> JPsi Phi returns an empty list (clones are actually returned)

Definition at line 73 of file BPHDecayMomentum.cc.

References dList.

Referenced by BPHKinematicFit::addParticles(), BPHDecayVertex::BPHDecayVertex(), BPHKinematicFit::BPHKinematicFit(), BPHWriteSpecificDecay::fill(), BPHKinematicFit::fitMomentum(), BPHKinematicFit::numParticles(), and BPHPlusMinusCandidate::phiDiff().

73 { return dList; }
std::vector< const reco::Candidate * > dList
const vector< string > & BPHDecayMomentum::daugNames ( ) const
virtual

get the list of names of simple particles directly produced in the decay e.g. in JPsi -> mu+mu- returns the two names used for muons in B+ -> JPsi K+ returns the name used for the K+ in Bs -> JPsi Phi returns an empty list

Definition at line 69 of file BPHDecayMomentum.cc.

References nList.

Referenced by BPHRecoCandidate::fill().

69 { return nList; }
std::vector< std::string > nList
void BPHDecayMomentum::dCompList ( )
private

Definition at line 188 of file BPHDecayMomentum.cc.

References cList, clonesMap, cMap, AlCaHLTBitMon_QueryRunRegistry::comp, mps_splice::entry, mps_fire::i, dqmiodumpmetadata::n, and nComp.

188  {
189  // fill lists of previously reconstructed particles and their names
190  // and retrieve cascade decay products
191  int n = cMap.size();
192  cList.resize(n);
193  nComp.resize(n);
194  int i = 0;
195  map<string, BPHRecoConstCandPtr>::const_iterator iter = cMap.begin();
196  map<string, BPHRecoConstCandPtr>::const_iterator iend = cMap.end();
197  while (iter != iend) {
198  const pair<string, BPHRecoConstCandPtr>& entry = *iter++;
199  nComp[i] = entry.first;
200  BPHRecoConstCandPtr comp = entry.second;
201  cList[i++] = comp;
202  clonesMap.insert(comp->clonesMap.begin(), comp->clonesMap.end());
203  }
204  return;
205 }
std::vector< BPHRecoConstCandPtr > cList
BPHGenericPtr< const BPHRecoCandidate >::type BPHRecoConstCandPtr
std::map< const reco::Candidate *, const reco::Candidate * > clonesMap
list entry
Definition: mps_splice.py:68
std::vector< std::string > nComp
std::map< std::string, BPHRecoConstCandPtr > cMap
virtual void BPHDecayMomentum::fill ( BPHRecoCandidate ptr,
int  level 
) const
protectedpure virtual

Implemented in BPHRecoCandidate.

void BPHDecayMomentum::fillDaug ( std::vector< const reco::Candidate * > &  ad) const
privatevirtual

Definition at line 215 of file BPHDecayMomentum.cc.

References cList, dList, and dqmiodumpmetadata::n.

Referenced by computeMomentum().

215  {
216  // recursively fill the list of simple particles, produced
217  // directly or in cascade decays
218  ad.insert(ad.end(), dList.begin(), dList.end());
219  int n = cList.size();
220  while (n--)
221  cList[n]->fillDaug(ad);
222  return;
223 }
std::vector< BPHRecoConstCandPtr > cList
std::vector< const reco::Candidate * > dList
BPHRecoConstCandPtr BPHDecayMomentum::getComp ( const std::string &  name) const
virtual

get a previously reconstructed particle from the name return null pointer if not found

Definition at line 106 of file BPHDecayMomentum.cc.

References cMap, AlCaHLTBitMon_QueryRunRegistry::comp, and getComp().

Referenced by BPHRecoCandidate::fill(), getComp(), getDaug(), BPHKinematicFit::getIndependentFit(), BPHKinematicFit::numParticles(), BPHKinematicFit::setIndependentFit(), BPHKinematicFit::splitKP(), and BPHWriteSpecificDecay::write().

106  {
107  // return a previously reconstructed particle from the name
108  // return null pointer if not found
109  string::size_type pos = name.find('/');
110  if (pos != string::npos) {
111  const BPHRecoCandidate* comp = getComp(name.substr(0, pos)).get();
112  return (comp == nullptr ? nullptr : comp->getComp(name.substr(pos + 1)));
113  }
114  map<const string, BPHRecoConstCandPtr>::const_iterator iter = cMap.find(name);
115  return (iter != cMap.end() ? iter->second : nullptr);
116 }
uint16_t size_type
virtual BPHRecoConstCandPtr getComp(const std::string &name) const
std::map< std::string, BPHRecoConstCandPtr > cMap
const reco::Candidate * BPHDecayMomentum::getDaug ( const std::string &  name) const
virtual

get a simple particle from the name return null pointer if not found

Definition at line 94 of file BPHDecayMomentum.cc.

References AlCaHLTBitMon_QueryRunRegistry::comp, dMap, getComp(), and getDaug().

Referenced by BPHWriteSpecificDecay::fill(), BPHRecoCandidate::fill(), getDaug(), and BPHOniaToMuMuBuilder::getOriginalCandidate().

94  {
95  // return a simple particle from the name
96  // return null pointer if not found
97  string::size_type pos = name.find('/');
98  if (pos != string::npos) {
99  const BPHRecoCandidate* comp = getComp(name.substr(0, pos)).get();
100  return (comp == nullptr ? nullptr : comp->getDaug(name.substr(pos + 1)));
101  }
102  map<const string, const reco::Candidate*>::const_iterator iter = dMap.find(name);
103  return (iter != dMap.end() ? iter->second : nullptr);
104 }
std::map< std::string, const reco::Candidate * > dMap
uint16_t size_type
virtual BPHRecoConstCandPtr getComp(const std::string &name) const
virtual const reco::Candidate * getDaug(const std::string &name) const
BPHDecayMomentum& BPHDecayMomentum::operator= ( const BPHDecayMomentum x)
delete
const reco::Candidate * BPHDecayMomentum::originalReco ( const reco::Candidate daug) const
virtual

get the original particle from the clone

Definition at line 82 of file BPHDecayMomentum.cc.

References clonesMap.

Referenced by BPHDecayVertex::BPHDecayVertex(), BPHKinematicFit::BPHKinematicFit(), BPHWriteSpecificDecay::fill(), BPHRecoCandidate::fill(), BPHOniaToMuMuBuilder::getOriginalCandidate(), and BPHDecayVertex::tTracks().

82  {
83  // return the original particle for a given clone
84  // return null pointer if not found
85  map<const reco::Candidate*, const reco::Candidate*>::const_iterator iter = clonesMap.find(daug);
86  return (iter != clonesMap.end() ? iter->second : nullptr);
87 }
std::map< const reco::Candidate *, const reco::Candidate * > clonesMap
void BPHDecayMomentum::setNotUpdated ( ) const
protectedvirtual

Reimplemented in BPHKinematicFit, BPHDecayVertex, BPHPlusMinusCandidate, and BPHPlusMinusVertex.

Definition at line 149 of file BPHDecayMomentum.cc.

References oldMom.

Referenced by BPHDecayVertex::setNotUpdated().

149  {
150  oldMom = true;
151  return;
152 }
void BPHDecayMomentum::sumMomentum ( const std::vector< const reco::Candidate * >  dl) const
privatevirtual

Definition at line 207 of file BPHDecayMomentum.cc.

References reco::CompositeCandidate::addDaughter(), compCand, and dqmiodumpmetadata::n.

Referenced by computeMomentum().

207  {
208  // add the particles to pat::CompositeCandidate
209  int n = dl.size();
210  while (n--)
211  compCand.addDaughter(*dl[n]);
212  return;
213 }
void addDaughter(const Candidate &, const std::string &s="")
add a clone of the passed candidate as daughter
pat::CompositeCandidate compCand

Friends And Related Function Documentation

friend class BPHRecoBuilder
friend

Definition at line 36 of file BPHDecayMomentum.h.

Member Data Documentation

std::vector<BPHRecoConstCandPtr> BPHDecayMomentum::cList
private
std::map<const reco::Candidate*, const reco::Candidate*> BPHDecayMomentum::clonesMap
private

Definition at line 151 of file BPHDecayMomentum.h.

Referenced by clonesList(), dCompList(), and originalReco().

std::map<std::string, BPHRecoConstCandPtr> BPHDecayMomentum::cMap
private

Definition at line 148 of file BPHDecayMomentum.h.

Referenced by BPHKinematicFit::BPHKinematicFit(), dCompList(), and getComp().

pat::CompositeCandidate BPHDecayMomentum::compCand
mutableprivate
std::vector<Component> BPHDecayMomentum::compList
private

Definition at line 134 of file BPHDecayMomentum.h.

Referenced by clonesList(), and componentList().

std::vector<const reco::Candidate*> BPHDecayMomentum::dFull
mutableprivate

Definition at line 155 of file BPHDecayMomentum.h.

Referenced by computeMomentum(), and daughFull().

std::vector<const reco::Candidate*> BPHDecayMomentum::dList
private
std::map<std::string, const reco::Candidate*> BPHDecayMomentum::dMap
private
std::vector<std::string> BPHDecayMomentum::nComp
private

Definition at line 138 of file BPHDecayMomentum.h.

Referenced by compNames(), dCompList(), and BPHRecoCandidate::fill().

std::vector<std::string> BPHDecayMomentum::nList
private

Definition at line 137 of file BPHDecayMomentum.h.

Referenced by clonesList(), and daugNames().

bool BPHDecayMomentum::oldMom
mutableprivate

Definition at line 154 of file BPHDecayMomentum.h.

Referenced by composite(), computeMomentum(), daughFull(), and setNotUpdated().