CMS 3D CMS Logo

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::CompositeCandidatecomposite () 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 BPHRecoConstCandPtr &comp)
 add a previously reconstructed particle giving it a name More...
 
virtual void addP (const std::string &name, const reco::Candidate *daug, double mass=-1.0)
 
 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, BPHRecoConstCandPtrcMap
 
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() [1/4]

BPHDecayMomentum::BPHDecayMomentum ( const BPHDecayMomentum x)
delete

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

◆ ~BPHDecayMomentum()

BPHDecayMomentum::~BPHDecayMomentum ( )
virtual

Destructor

Definition at line 53 of file BPHDecayMomentum.cc.

53  {
54  // delete all clones
55  int n = dList.size();
56  while (n--)
57  delete dList[n];
58 }

References dList, and dqmiodumpmetadata::n.

◆ BPHDecayMomentum() [2/4]

BPHDecayMomentum::BPHDecayMomentum ( )
protected

Definition at line 32 of file BPHDecayMomentum.cc.

32 : oldMom(true) { dList.reserve(2); }

References dList.

◆ BPHDecayMomentum() [3/4]

BPHDecayMomentum::BPHDecayMomentum ( const std::map< std::string, Component > &  daugMap)
protected

◆ BPHDecayMomentum() [4/4]

BPHDecayMomentum::BPHDecayMomentum ( const std::map< std::string, Component > &  daugMap,
const std::map< std::string, BPHRecoConstCandPtr compMap 
)
protected

Member Function Documentation

◆ addP() [1/2]

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

add a previously reconstructed particle giving it a name

◆ addP() [2/2]

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

◆ clonesList()

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

Definition at line 154 of file BPHDecayMomentum.cc.

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 }

References reco::Candidate::begin(), clonesMap, AlCaHLTBitMon_QueryRunRegistry::comp, compList, dList, dMap, mps_splice::entry, mps_fire::i, EgHLTOffHistBins_cfi::mass, dqmiodumpmetadata::n, Skims_PA_cff::name, nList, and reco::Candidate::setMass().

◆ compNames()

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.

71 { return nComp; }

References nComp.

Referenced by BPHRecoCandidate::fill().

◆ componentList()

const vector< BPHDecayMomentum::Component > & BPHDecayMomentum::componentList ( ) const
protected

Definition at line 118 of file BPHDecayMomentum.cc.

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 }

References compList.

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

◆ composite()

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.

63  {
64  if (oldMom)
66  return compCand;
67 }

References compCand, computeMomentum(), and oldMom.

Referenced by BPHPlusMinusCandidate::composite().

◆ computeMomentum()

void BPHDecayMomentum::computeMomentum ( ) const
privatevirtual

Definition at line 225 of file BPHDecayMomentum.cc.

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 }

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

Referenced by composite(), and daughFull().

◆ daughComp()

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.

89  {
90  // return the list of previously reconstructed particles
91  return cList;
92 }

References cList.

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

◆ daughFull()

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.

75  {
76  // compute total momentum to update the full list of decay products
77  if (oldMom)
79  return dFull;
80 }

References computeMomentum(), dFull, and oldMom.

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

◆ daughters()

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.

73 { return dList; }

References dList.

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

◆ daugNames()

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.

69 { return nList; }

References nList.

Referenced by BPHRecoCandidate::fill().

◆ dCompList()

void BPHDecayMomentum::dCompList ( )
private

Definition at line 188 of file BPHDecayMomentum.cc.

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 }

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

◆ fill()

virtual void BPHDecayMomentum::fill ( BPHRecoCandidate ptr,
int  level 
) const
protectedpure virtual

Implemented in BPHRecoCandidate.

◆ fillDaug()

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

Definition at line 215 of file BPHDecayMomentum.cc.

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 }

References cList, dList, and dqmiodumpmetadata::n.

Referenced by computeMomentum().

◆ getComp()

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.

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 }

References cMap, AlCaHLTBitMon_QueryRunRegistry::comp, get, and Skims_PA_cff::name.

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

◆ getDaug()

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.

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 }

References AlCaHLTBitMon_QueryRunRegistry::comp, dMap, get, getComp(), and Skims_PA_cff::name.

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

◆ operator=()

BPHDecayMomentum& BPHDecayMomentum::operator= ( const BPHDecayMomentum x)
delete

◆ originalReco()

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.

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 }

References clonesMap.

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

◆ setNotUpdated()

void BPHDecayMomentum::setNotUpdated ( ) const
protectedvirtual

Reimplemented in BPHKinematicFit, BPHDecayVertex, BPHPlusMinusCandidate, and BPHPlusMinusVertex.

Definition at line 149 of file BPHDecayMomentum.cc.

149  {
150  oldMom = true;
151  return;
152 }

References oldMom.

Referenced by BPHDecayVertex::setNotUpdated().

◆ sumMomentum()

void BPHDecayMomentum::sumMomentum ( const std::vector< const reco::Candidate * >  dl) const
privatevirtual

Definition at line 207 of file BPHDecayMomentum.cc.

207  {
208  // add the particles to pat::CompositeCandidate
209  int n = dl.size();
210  while (n--)
211  compCand.addDaughter(*dl[n]);
212  return;
213 }

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

Referenced by computeMomentum().

Friends And Related Function Documentation

◆ BPHRecoBuilder

friend class BPHRecoBuilder
friend

Definition at line 36 of file BPHDecayMomentum.h.

Member Data Documentation

◆ cList

std::vector<BPHRecoConstCandPtr> BPHDecayMomentum::cList
private

◆ clonesMap

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().

◆ cMap

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

Definition at line 148 of file BPHDecayMomentum.h.

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

◆ compCand

pat::CompositeCandidate BPHDecayMomentum::compCand
mutableprivate

◆ compList

std::vector<Component> BPHDecayMomentum::compList
private

Definition at line 134 of file BPHDecayMomentum.h.

Referenced by clonesList(), and componentList().

◆ dFull

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

Definition at line 155 of file BPHDecayMomentum.h.

Referenced by computeMomentum(), and daughFull().

◆ dList

std::vector<const reco::Candidate*> BPHDecayMomentum::dList
private

◆ dMap

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

◆ nComp

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

Definition at line 138 of file BPHDecayMomentum.h.

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

◆ nList

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

Definition at line 137 of file BPHDecayMomentum.h.

Referenced by clonesList(), and daugNames().

◆ oldMom

bool BPHDecayMomentum::oldMom
mutableprivate

Definition at line 154 of file BPHDecayMomentum.h.

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

mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
reco::Candidate::setMass
virtual void setMass(double m)=0
set particle mass
mps_splice.entry
entry
Definition: mps_splice.py:68
BPHDecayMomentum::cMap
std::map< std::string, BPHRecoConstCandPtr > cMap
Definition: BPHDecayMomentum.h:148
pos
Definition: PixelAliasList.h:18
AlCaHLTBitMon_QueryRunRegistry.comp
comp
Definition: AlCaHLTBitMon_QueryRunRegistry.py:249
BPHDecayMomentum::compList
std::vector< Component > compList
Definition: BPHDecayMomentum.h:134
BPHDecayMomentum::sumMomentum
virtual void sumMomentum(const std::vector< const reco::Candidate * > dl) const
Definition: BPHDecayMomentum.cc:207
BPHDecayMomentum::computeMomentum
virtual void computeMomentum() const
Definition: BPHDecayMomentum.cc:225
BPHDecayMomentum::dList
std::vector< const reco::Candidate * > dList
Definition: BPHDecayMomentum.h:142
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
BPHDecayMomentum::oldMom
bool oldMom
Definition: BPHDecayMomentum.h:154
BPHDecayMomentum::fillDaug
virtual void fillDaug(std::vector< const reco::Candidate * > &ad) const
Definition: BPHDecayMomentum.cc:215
reco::CompositeCandidate::addDaughter
void addDaughter(const Candidate &, const std::string &s="")
add a clone of the passed candidate as daughter
Definition: CompositeCandidate.cc:108
cand
Definition: decayParser.h:32
BPHDecayMomentum::clonesMap
std::map< const reco::Candidate *, const reco::Candidate * > clonesMap
Definition: BPHDecayMomentum.h:151
BPHDecayMomentum::getComp
virtual BPHRecoConstCandPtr getComp(const std::string &name) const
Definition: BPHDecayMomentum.cc:106
BPHDecayMomentum::nComp
std::vector< std::string > nComp
Definition: BPHDecayMomentum.h:138
get
#define get
BPHDecayMomentum::dFull
std::vector< const reco::Candidate * > dFull
Definition: BPHDecayMomentum.h:155
reco::Candidate
Definition: Candidate.h:27
BPHDecayMomentum::nList
std::vector< std::string > nList
Definition: BPHDecayMomentum.h:137
reco::CompositeCandidate::clearDaughters
void clearDaughters()
clear daughters
Definition: CompositeCandidate.h:71
EgHLTOffHistBins_cfi.mass
mass
Definition: EgHLTOffHistBins_cfi.py:34
AddFourMomenta::set
void set(reco::Candidate &c) const
set up a candidate
Definition: AddFourMomenta.cc:6
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
AddFourMomenta
Definition: AddFourMomenta.h:18
BPHRecoCandidate
Definition: BPHRecoCandidate.h:46
BPHDecayMomentum::dMap
std::map< std::string, const reco::Candidate * > dMap
Definition: BPHDecayMomentum.h:147
reco::Candidate::begin
const_iterator begin() const
first daughter const_iterator
Definition: Candidate.h:143
BPHDecayMomentum::cList
std::vector< BPHRecoConstCandPtr > cList
Definition: BPHDecayMomentum.h:143
BPHDecayMomentum::compCand
pat::CompositeCandidate compCand
Definition: BPHDecayMomentum.h:156
BPHRecoConstCandPtr
BPHGenericPtr< const BPHRecoCandidate >::type BPHRecoConstCandPtr
Definition: BPHRecoCandidatePtr.h:9