CMS 3D CMS Logo

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

#include <BPHDecayVertex.h>

Inheritance diagram for BPHDecayVertex:
BPHDecayMomentum BPHKinematicFit BPHPlusMinusVertex BPHRecoCandidate BPHPlusMinusCandidate BPHPlusMinusCandidate

Public Member Functions

 BPHDecayVertex (const BPHDecayVertex &x)=delete
 
const edm::EventSetupgetEventSetup () const
 retrieve EventSetup More...
 
const reco::TrackgetTrack (const reco::Candidate *cand) const
 get Track for a daughter More...
 
const std::string & getTrackSearchList (const reco::Candidate *cand) const
 retrieve track search list More...
 
reco::TransientTrackgetTransientTrack (const reco::Candidate *cand) const
 get TransientTrack for a daughter More...
 
BPHDecayVertexoperator= (const BPHDecayVertex &x)=delete
 
const std::vector< const
reco::Track * > & 
tracks () const
 get list of Tracks More...
 
const std::vector
< reco::TransientTrack > & 
transientTracks () const
 get list of TransientTracks More...
 
virtual bool validTracks () const
 check for valid reconstructed vertex More...
 
virtual bool validVertex () const
 
virtual const reco::Vertexvertex (VertexFitter< 5 > *fitter=nullptr, const reco::BeamSpot *bs=nullptr, const GlobalPoint *priorPos=nullptr, const GlobalError *priorError=nullptr) const
 get reconstructed vertex More...
 
 ~BPHDecayVertex () override
 
- Public Member Functions inherited from BPHDecayMomentum
 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 addV (const std::string &name, const reco::Candidate *daug, const std::string &searchList, double mass)
 
virtual void addV (const std::string &name, const BPHRecoConstCandPtr &comp)
 add a previously reconstructed particle giving it a name More...
 
 BPHDecayVertex (const edm::EventSetup *es)
 
 BPHDecayVertex (const BPHDecayVertex *ptr, const edm::EventSetup *es)
 
void setNotUpdated () const override
 
- Protected Member Functions inherited from BPHDecayMomentum
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
 

Private Member Functions

virtual void fitVertex (VertexFitter< 5 > *fitter, const reco::BeamSpot *bs, const GlobalPoint *priorPos, const GlobalError *priorError) const
 
virtual void tTracks () const
 

Private Attributes

const edm::EventSetupevSetup
 
reco::Vertex fittedVertex
 
bool oldTracks
 
bool oldVertex
 
std::vector< const reco::Track * > rTracks
 
reco::BeamSpot const * savedBS
 
VertexFitter< 5 > * savedFitter
 
GlobalError const * savedPE
 
GlobalPoint const * savedPP
 
std::map< const
reco::Candidate *, std::string > 
searchMap
 
std::map< const
reco::Candidate *, const
reco::Track * > 
tkMap
 
std::vector< reco::TransientTracktrTracks
 
std::map< const
reco::Candidate
*, reco::TransientTrack * > 
ttMap
 
bool validTks
 

Detailed Description

Description: Mid-level base class to reconstruct decay vertex

Author
Paolo Ronchese INFN Padova

Definition at line 43 of file BPHDecayVertex.h.

Constructor & Destructor Documentation

BPHDecayVertex::BPHDecayVertex ( const BPHDecayVertex x)
delete

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

BPHDecayVertex::~BPHDecayVertex ( )
override

Destructor

Definition at line 86 of file BPHDecayVertex.cc.

86 {}
BPHDecayVertex::BPHDecayVertex ( const edm::EventSetup es)
protected

Definition at line 42 of file BPHDecayVertex.cc.

43  : evSetup(es),
44  oldTracks(true),
45  oldVertex(true),
46  validTks(false),
47  savedFitter(nullptr),
48  savedBS(nullptr),
49  savedPP(nullptr),
50  savedPE(nullptr) {}
VertexFitter< 5 > * savedFitter
reco::BeamSpot const * savedBS
GlobalError const * savedPE
const edm::EventSetup * evSetup
GlobalPoint const * savedPP
BPHDecayVertex::BPHDecayVertex ( const BPHDecayVertex ptr,
const edm::EventSetup es 
)
protected

Definition at line 52 of file BPHDecayVertex.cc.

References c, BPHDecayMomentum::Component::cand, BPHDecayMomentum::componentList(), BPHDecayMomentum::daughComp(), BPHDecayMomentum::daughters(), BPHDecayMomentum::dMap, mps_fire::i, dqmiolumiharvest::j, visualization-live-secondInstance_cfg::m, dqmiodumpmetadata::n, BPHDecayMomentum::originalReco(), BPHDecayMomentum::Component::searchList, and searchMap.

53  : evSetup(es),
54  oldTracks(true),
55  oldVertex(true),
56  validTks(false),
57  savedFitter(nullptr),
58  savedBS(nullptr),
59  savedPP(nullptr),
60  savedPE(nullptr) {
61  map<const reco::Candidate*, const reco::Candidate*> iMap;
62  const vector<const reco::Candidate*>& daug = daughters();
63  const vector<Component>& list = ptr->componentList();
64  int i;
65  int n = daug.size();
66  for (i = 0; i < n; ++i) {
67  const reco::Candidate* cand = daug[i];
68  iMap[originalReco(cand)] = cand;
69  }
70  for (i = 0; i < n; ++i) {
71  const Component& c = list[i];
72  searchMap[iMap[c.cand]] = c.searchList;
73  }
74  const vector<BPHRecoConstCandPtr>& dComp = daughComp();
75  int j;
76  int m = dComp.size();
77  for (j = 0; j < m; ++j) {
78  const map<const reco::Candidate*, string>& dMap = dComp[j]->searchMap;
79  searchMap.insert(dMap.begin(), dMap.end());
80  }
81 }
const edm::EventSetup & c
VertexFitter< 5 > * savedFitter
std::map< std::string, const reco::Candidate * > dMap
std::map< const reco::Candidate *, std::string > searchMap
virtual const std::vector< const reco::Candidate * > & daughters() const
const std::vector< Component > & componentList() const
reco::BeamSpot const * savedBS
GlobalError const * savedPE
virtual const reco::Candidate * originalReco(const reco::Candidate *daug) const
get the original particle from the clone
const edm::EventSetup * evSetup
GlobalPoint const * savedPP
virtual const std::vector< BPHRecoConstCandPtr > & daughComp() const

Member Function Documentation

virtual void BPHDecayVertex::addV ( const std::string &  name,
const reco::Candidate daug,
const std::string &  searchList,
double  mass 
)
protectedvirtual

add a simple particle giving it a name and specifying an option list to search for the associated track

virtual void BPHDecayVertex::addV ( const std::string &  name,
const BPHRecoConstCandPtr comp 
)
protectedvirtual

add a previously reconstructed particle giving it a name

void BPHDecayVertex::fitVertex ( VertexFitter< 5 > *  fitter,
const reco::BeamSpot bs,
const GlobalPoint priorPos,
const GlobalError priorError 
) const
privatevirtual

Definition at line 221 of file BPHDecayVertex.cc.

References cms::cuda::bs, cppFunctionSkipper::exception, fittedVertex, oldTracks, oldVertex, savedBS, savedFitter, savedPE, savedPP, trTracks, tTracks(), and VertexFitter< N >::vertex().

Referenced by vertex().

224  {
225  oldVertex = false;
226  savedFitter = fitter;
227  savedBS = bs;
228  savedPP = priorPos;
229  savedPE = priorError;
230  if (oldTracks)
231  tTracks();
232  if (trTracks.size() < 2)
233  return;
234  try {
235  if (bs == nullptr) {
236  if (priorPos == nullptr) {
237  TransientVertex tv = fitter->vertex(trTracks);
238  fittedVertex = tv;
239  } else {
240  if (priorError == nullptr) {
241  TransientVertex tv = fitter->vertex(trTracks, *priorPos);
242  fittedVertex = tv;
243  } else {
244  TransientVertex tv = fitter->vertex(trTracks, *priorPos, *priorError);
245  fittedVertex = tv;
246  }
247  }
248  } else {
249  TransientVertex tv = fitter->vertex(trTracks, *bs);
250  fittedVertex = tv;
251  }
252  } catch (std::exception const&) {
253  reco::Vertex tv;
254  fittedVertex = tv;
255  edm::LogPrint("FitFailed") << "BPHDecayVertex::fitVertex: "
256  << "vertex fit failed";
257  }
258  return;
259 }
VertexFitter< 5 > * savedFitter
virtual void tTracks() const
std::vector< reco::TransientTrack > trTracks
virtual CachingVertex< N > vertex(const std::vector< reco::TransientTrack > &tracks) const =0
reco::BeamSpot const * savedBS
GlobalError const * savedPE
Log< level::Warning, true > LogPrint
reco::Vertex fittedVertex
GlobalPoint const * savedPP
const edm::EventSetup * BPHDecayVertex::getEventSetup ( ) const

retrieve EventSetup

Definition at line 152 of file BPHDecayVertex.cc.

References evSetup.

Referenced by BPHPlusMinusCandidate::clone(), and BPHRecoCandidate::clone().

152 { return evSetup; }
const edm::EventSetup * evSetup
const reco::Track * BPHDecayVertex::getTrack ( const reco::Candidate cand) const

get Track for a daughter

Definition at line 129 of file BPHDecayVertex.cc.

References oldTracks, tkMap, and tTracks().

129  {
130  if (oldTracks)
131  tTracks();
132  map<const reco::Candidate*, const reco::Track*>::const_iterator iter = tkMap.find(cand);
133  map<const reco::Candidate*, const reco::Track*>::const_iterator iend = tkMap.end();
134  return (iter != iend ? iter->second : nullptr);
135 }
virtual void tTracks() const
std::map< const reco::Candidate *, const reco::Track * > tkMap
const string & BPHDecayVertex::getTrackSearchList ( const reco::Candidate cand) const

retrieve track search list

Definition at line 154 of file BPHDecayVertex.cc.

References searchMap.

Referenced by BPHRecoCandidate::fill().

154  {
155  static string dum = "";
156  map<const reco::Candidate*, string>::const_iterator iter = searchMap.find(cand);
157  if (iter != searchMap.end())
158  return iter->second;
159  return dum;
160 }
std::map< const reco::Candidate *, std::string > searchMap
reco::TransientTrack * BPHDecayVertex::getTransientTrack ( const reco::Candidate cand) const

get TransientTrack for a daughter

Definition at line 143 of file BPHDecayVertex.cc.

References oldTracks, ttMap, and tTracks().

Referenced by BPHKinematicFit::addParticles().

143  {
144  if (oldTracks)
145  tTracks();
146  map<const reco::Candidate*, reco::TransientTrack*>::const_iterator iter = ttMap.find(cand);
147  map<const reco::Candidate*, reco::TransientTrack*>::const_iterator iend = ttMap.end();
148  return (iter != iend ? iter->second : nullptr);
149 }
virtual void tTracks() const
std::map< const reco::Candidate *, reco::TransientTrack * > ttMap
BPHDecayVertex& BPHDecayVertex::operator= ( const BPHDecayVertex x)
delete
void BPHDecayVertex::setNotUpdated ( ) const
overrideprotectedvirtual

Reimplemented from BPHDecayMomentum.

Reimplemented in BPHKinematicFit, BPHPlusMinusCandidate, and BPHPlusMinusVertex.

Definition at line 175 of file BPHDecayVertex.cc.

References oldTracks, oldVertex, BPHDecayMomentum::setNotUpdated(), and validTks.

Referenced by BPHPlusMinusVertex::setNotUpdated(), and BPHKinematicFit::setNotUpdated().

175  {
177  oldTracks = oldVertex = true;
178  validTks = false;
179  return;
180 }
virtual void setNotUpdated() const
const vector< const reco::Track * > & BPHDecayVertex::tracks ( void  ) const

get list of Tracks

Definition at line 123 of file BPHDecayVertex.cc.

References oldTracks, rTracks, and tTracks().

123  {
124  if (oldTracks)
125  tTracks();
126  return rTracks;
127 }
virtual void tTracks() const
std::vector< const reco::Track * > rTracks
const vector< reco::TransientTrack > & BPHDecayVertex::transientTracks ( ) const

get list of TransientTracks

Definition at line 137 of file BPHDecayVertex.cc.

References oldTracks, trTracks, and tTracks().

Referenced by BPHPlusMinusVertex::computeApp().

137  {
138  if (oldTracks)
139  tTracks();
140  return trTracks;
141 }
virtual void tTracks() const
std::vector< reco::TransientTrack > trTracks
void BPHDecayVertex::tTracks ( ) const
privatevirtual

Definition at line 182 of file BPHDecayVertex.cc.

References reco::Candidate::charge(), BPHDecayMomentum::daughFull(), evSetup, edm::EventSetup::get(), BPHTrackReference::getTrack(), dqmiodumpmetadata::n, oldTracks, BPHDecayMomentum::originalReco(), rTracks, searchMap, tkMap, cmsswSequenceInfo::tp, trTracks, ttMap, and validTks.

Referenced by fitVertex(), getTrack(), getTransientTrack(), tracks(), transientTracks(), and validTracks().

182  {
183  oldTracks = false;
184  rTracks.clear();
185  trTracks.clear();
186  tkMap.clear();
187  ttMap.clear();
189  evSetup->get<TransientTrackRecord>().get("TransientTrackBuilder", ttB);
190  const vector<const reco::Candidate*>& dL = daughFull();
191  int n = dL.size();
192  trTracks.reserve(n);
193  validTks = true;
194  while (n--) {
195  const reco::Candidate* rp = dL[n];
196  tkMap[rp] = nullptr;
197  ttMap[rp] = nullptr;
198  if (!rp->charge())
199  continue;
200  const reco::Track* tp;
201  const char* searchList = "cfhp";
202  map<const reco::Candidate*, string>::const_iterator iter = searchMap.find(rp);
203  if (iter != searchMap.end())
204  searchList = iter->second.c_str();
205  tp = BPHTrackReference::getTrack(*originalReco(rp), searchList);
206  if (tp == nullptr) {
207  edm::LogPrint("DataNotFound") << "BPHDecayVertex::tTracks: "
208  << "no track for reco::(PF)Candidate";
209  validTks = false;
210  continue;
211  }
212  rTracks.push_back(tp);
213  trTracks.push_back(ttB->build(tp));
214  reco::TransientTrack* ttp = &trTracks.back();
215  tkMap[rp] = tp;
216  ttMap[rp] = ttp;
217  }
218  return;
219 }
std::vector< reco::TransientTrack > trTracks
std::map< const reco::Candidate *, std::string > searchMap
static const reco::Track * getTrack(const reco::Candidate &rc, const char *modeList="cfhbpmnigset", char *modeFlag=nullptr)
std::map< const reco::Candidate *, reco::TransientTrack * > ttMap
virtual int charge() const =0
electric charge
Log< level::Warning, true > LogPrint
virtual const reco::Candidate * originalReco(const reco::Candidate *daug) const
get the original particle from the clone
std::map< const reco::Candidate *, const reco::Track * > tkMap
const edm::EventSetup * evSetup
T get() const
Definition: EventSetup.h:88
virtual const std::vector< const reco::Candidate * > & daughFull() const
std::vector< const reco::Track * > rTracks
bool BPHDecayVertex::validTracks ( ) const
virtual

check for valid reconstructed vertex

Operations

Definition at line 91 of file BPHDecayVertex.cc.

References oldTracks, tTracks(), and validTks.

91  {
92  if (oldTracks)
93  tTracks();
94  return validTks;
95 }
virtual void tTracks() const
bool BPHDecayVertex::validVertex ( ) const
virtual

Definition at line 97 of file BPHDecayVertex.cc.

References fittedVertex, reco::Vertex::isValid(), validTks, and vertex().

97  {
98  vertex();
99  return validTks && fittedVertex.isValid();
100 }
bool isValid() const
Tells whether the vertex is valid.
Definition: Vertex.h:72
virtual const reco::Vertex & vertex(VertexFitter< 5 > *fitter=nullptr, const reco::BeamSpot *bs=nullptr, const GlobalPoint *priorPos=nullptr, const GlobalError *priorError=nullptr) const
get reconstructed vertex
reco::Vertex fittedVertex
const reco::Vertex & BPHDecayVertex::vertex ( VertexFitter< 5 > *  fitter = nullptr,
const reco::BeamSpot bs = nullptr,
const GlobalPoint priorPos = nullptr,
const GlobalError priorError = nullptr 
) const
virtual

get reconstructed vertex

Definition at line 102 of file BPHDecayVertex.cc.

References fittedVertex, fitVertex(), oldVertex, savedBS, savedFitter, savedPE, and savedPP.

Referenced by Tau.Tau::dxy(), BPHWriteSpecificDecay::fill(), and validVertex().

105  {
106  if ((fitter == nullptr) && (bs == nullptr) && (priorPos == nullptr) && (priorError == nullptr)) {
107  fitter = savedFitter;
108  bs = savedBS;
109  priorPos = savedPP;
110  priorError = savedPE;
111  }
112  if (oldVertex || (fitter != savedFitter) || (bs != savedBS) || (priorPos != savedPP) || (priorError != savedPE)) {
113  if (fitter != nullptr) {
114  fitVertex(fitter, bs, priorPos, priorError);
115  } else {
116  KalmanVertexFitter kvf(true);
117  fitVertex(&kvf, bs, priorPos, priorError);
118  }
119  }
120  return fittedVertex;
121 }
VertexFitter< 5 > * savedFitter
reco::BeamSpot const * savedBS
GlobalError const * savedPE
virtual void fitVertex(VertexFitter< 5 > *fitter, const reco::BeamSpot *bs, const GlobalPoint *priorPos, const GlobalError *priorError) const
reco::Vertex fittedVertex
GlobalPoint const * savedPP

Member Data Documentation

const edm::EventSetup* BPHDecayVertex::evSetup
private

Definition at line 104 of file BPHDecayVertex.h.

Referenced by getEventSetup(), and tTracks().

reco::Vertex BPHDecayVertex::fittedVertex
mutableprivate

Definition at line 117 of file BPHDecayVertex.h.

Referenced by fitVertex(), validVertex(), and vertex().

bool BPHDecayVertex::oldTracks
mutableprivate
bool BPHDecayVertex::oldVertex
mutableprivate

Definition at line 111 of file BPHDecayVertex.h.

Referenced by fitVertex(), setNotUpdated(), and vertex().

std::vector<const reco::Track*> BPHDecayVertex::rTracks
mutableprivate

Definition at line 113 of file BPHDecayVertex.h.

Referenced by tracks(), and tTracks().

reco::BeamSpot const* BPHDecayVertex::savedBS
mutableprivate

Definition at line 119 of file BPHDecayVertex.h.

Referenced by fitVertex(), and vertex().

VertexFitter<5>* BPHDecayVertex::savedFitter
mutableprivate

Definition at line 118 of file BPHDecayVertex.h.

Referenced by fitVertex(), and vertex().

GlobalError const* BPHDecayVertex::savedPE
mutableprivate

Definition at line 121 of file BPHDecayVertex.h.

Referenced by fitVertex(), and vertex().

GlobalPoint const* BPHDecayVertex::savedPP
mutableprivate

Definition at line 120 of file BPHDecayVertex.h.

Referenced by fitVertex(), and vertex().

std::map<const reco::Candidate*, std::string> BPHDecayVertex::searchMap
private

Definition at line 107 of file BPHDecayVertex.h.

Referenced by BPHDecayVertex(), getTrackSearchList(), and tTracks().

std::map<const reco::Candidate*, const reco::Track*> BPHDecayVertex::tkMap
mutableprivate

Definition at line 115 of file BPHDecayVertex.h.

Referenced by getTrack(), and tTracks().

std::vector<reco::TransientTrack> BPHDecayVertex::trTracks
mutableprivate

Definition at line 114 of file BPHDecayVertex.h.

Referenced by fitVertex(), transientTracks(), and tTracks().

std::map<const reco::Candidate*, reco::TransientTrack*> BPHDecayVertex::ttMap
mutableprivate

Definition at line 116 of file BPHDecayVertex.h.

Referenced by getTransientTrack(), and tTracks().

bool BPHDecayVertex::validTks
mutableprivate

Definition at line 112 of file BPHDecayVertex.h.

Referenced by setNotUpdated(), tTracks(), validTracks(), and validVertex().