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 | Public Attributes
TemplatedSecondaryVertexProducer< IPTI, VTX >::SVBuilder Struct Reference

Public Member Functions

SecondaryVertex operator() (const TransientVertex &sv) const
 
SecondaryVertex operator() (const VTX &sv) const
 
template<>
TemplatedSecondaryVertexProducer
< TrackIPTagInfo, reco::Vertex >
::SecondaryVertex 
operator() (const TransientVertex &sv) const
 
template<>
TemplatedSecondaryVertexProducer
< CandIPTagInfo,
reco::VertexCompositePtrCandidate >
::SecondaryVertex 
operator() (const TransientVertex &sv) const
 
 SVBuilder (const reco::Vertex &pv, const GlobalVector &direction, bool withPVError, double minTrackWeight)
 

Public Attributes

const GlobalVectordirection
 
double minTrackWeight
 
const Vertexpv
 
bool withPVError
 

Detailed Description

template<class IPTI, class VTX>
struct TemplatedSecondaryVertexProducer< IPTI, VTX >::SVBuilder

Definition at line 181 of file TemplatedSecondaryVertexProducer.cc.

Constructor & Destructor Documentation

template<class IPTI, class VTX>
TemplatedSecondaryVertexProducer< IPTI, VTX >::SVBuilder::SVBuilder ( const reco::Vertex pv,
const GlobalVector direction,
bool  withPVError,
double  minTrackWeight 
)
inline

Member Function Documentation

template<class IPTI, class VTX>
SecondaryVertex TemplatedSecondaryVertexProducer< IPTI, VTX >::SVBuilder::operator() ( const TransientVertex sv) const
template<class IPTI, class VTX>
SecondaryVertex TemplatedSecondaryVertexProducer< IPTI, VTX >::SVBuilder::operator() ( const VTX &  sv) const
inline

Definition at line 971 of file TemplatedSecondaryVertexProducer.cc.

References TemplatedSecondaryVertexProducer< IPTI, VTX >::SVBuilder::direction, TransientVertex::originalTracks(), TemplatedSecondaryVertexProducer< IPTI, VTX >::SVBuilder::pv, and TemplatedSecondaryVertexProducer< IPTI, VTX >::SVBuilder::withPVError.

971  {
972  if (!sv.originalTracks().empty() && sv.originalTracks()[0].trackBaseRef().isNonnull())
973  return SecondaryVertex(pv, sv, direction, withPVError);
974  else {
975  edm::LogError("UnexpectedInputs") << "Building from Candidates, should not happen!";
976  return SecondaryVertex(pv, sv, direction, withPVError);
977  }
978 }
Log< level::Error, false > LogError
std::vector< reco::TransientTrack > const & originalTracks() const
TemplatedSecondaryVertex< VTX > SecondaryVertex

Definition at line 982 of file TemplatedSecondaryVertexProducer.cc.

References reco::CompositePtrCandidate::addDaughter(), reco::CandidatePtrTransientTrack::candidate(), TransientVertex::degreesOfFreedom(), VertexState::error(), GlobalErrorBase< T, ErrorWeightType >::matrix(), TemplatedSecondaryVertexProducer< IPTI, VTX >::minTrackWeight, TransientVertex::originalTracks(), TransientVertex::position(), MetAnalyzer::pv(), reco::VertexCompositePtrCandidate::setChi2AndNdof(), reco::VertexCompositePtrCandidate::setCovariance(), reco::LeafCandidate::setP4(), reco::LeafCandidate::setVertex(), TransientVertex::totalChiSquared(), TransientVertex::trackWeight(), groupFilesInBlocks::tt, TransientVertex::vertexState(), TemplatedSecondaryVertexProducer< IPTI, VTX >::withPVError, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

983  {
984  if (!sv.originalTracks().empty() && sv.originalTracks()[0].trackBaseRef().isNonnull()) {
985  edm::LogError("UnexpectedInputs") << "Building from Tracks, should not happen!";
986  VertexCompositePtrCandidate vtxCompPtrCand;
987 
988  vtxCompPtrCand.setCovariance(sv.vertexState().error().matrix());
989  vtxCompPtrCand.setChi2AndNdof(sv.totalChiSquared(), sv.degreesOfFreedom());
990  vtxCompPtrCand.setVertex(Candidate::Point(sv.position().x(), sv.position().y(), sv.position().z()));
991 
992  return SecondaryVertex(pv, vtxCompPtrCand, direction, withPVError);
993  } else {
994  VertexCompositePtrCandidate vtxCompPtrCand;
995 
996  vtxCompPtrCand.setCovariance(sv.vertexState().error().matrix());
997  vtxCompPtrCand.setChi2AndNdof(sv.totalChiSquared(), sv.degreesOfFreedom());
998  vtxCompPtrCand.setVertex(Candidate::Point(sv.position().x(), sv.position().y(), sv.position().z()));
999 
1001  for (std::vector<reco::TransientTrack>::const_iterator tt = sv.originalTracks().begin();
1002  tt != sv.originalTracks().end();
1003  ++tt) {
1004  if (sv.trackWeight(*tt) < minTrackWeight)
1005  continue;
1006 
1007  const CandidatePtrTransientTrack *cptt =
1008  dynamic_cast<const CandidatePtrTransientTrack *>(tt->basicTransientTrack());
1009  if (cptt == nullptr)
1010  edm::LogError("DynamicCastingFailed") << "Casting of TransientTrack to CandidatePtrTransientTrack failed!";
1011  else {
1012  p4 += cptt->candidate()->p4();
1013  vtxCompPtrCand.addDaughter(cptt->candidate());
1014  }
1015  }
1016  vtxCompPtrCand.setP4(p4);
1017 
1018  return SecondaryVertex(pv, vtxCompPtrCand, direction, withPVError);
1019  }
1020 }
CandidatePtr candidate() const override
const AlgebraicSymMatrix33 matrix() const
float totalChiSquared() const
T y() const
Definition: PV3DBase.h:60
Log< level::Error, false > LogError
void setVertex(const Point &vertex) override
set vertex
std::vector< reco::TransientTrack > const & originalTracks() const
float degreesOfFreedom() const
GlobalPoint position() const
T z() const
Definition: PV3DBase.h:61
float trackWeight(const reco::TransientTrack &track) const
TemplatedSecondaryVertex< VTX > SecondaryVertex
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
void setCovariance(const CovarianceMatrix &m)
set covariance matrix
void addDaughter(const CandidatePtr &)
add a daughter via a reference
math::XYZPoint Point
point in the space
Definition: Candidate.h:40
GlobalError error() const
Definition: VertexState.h:64
void setChi2AndNdof(double chi2, double ndof)
set chi2 and ndof
VertexState const & vertexState() const
T x() const
Definition: PV3DBase.h:59
void setP4(const LorentzVector &p4) final
set 4-momentum

Member Data Documentation

template<class IPTI, class VTX>
const GlobalVector& TemplatedSecondaryVertexProducer< IPTI, VTX >::SVBuilder::direction
template<class IPTI, class VTX>
double TemplatedSecondaryVertexProducer< IPTI, VTX >::SVBuilder::minTrackWeight

Definition at line 191 of file TemplatedSecondaryVertexProducer.cc.

template<class IPTI, class VTX>
const Vertex& TemplatedSecondaryVertexProducer< IPTI, VTX >::SVBuilder::pv
template<class IPTI, class VTX>
bool TemplatedSecondaryVertexProducer< IPTI, VTX >::SVBuilder::withPVError