CMS 3D CMS Logo

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

◆ SVBuilder()

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

◆ operator()() [1/4]

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

◆ operator()() [2/4]

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

◆ operator()() [3/4]

Definition at line 973 of file TemplatedSecondaryVertexProducer.cc.

References TemplatedSecondaryVertexProducer< IPTI, VTX >::SVBuilder::direction, pfDeepBoostedJetPreprocessParams_cfi::sv, and TemplatedSecondaryVertexProducer< IPTI, VTX >::SVBuilder::withPVError.

973  {
974  if (!sv.originalTracks().empty() && sv.originalTracks()[0].trackBaseRef().isNonnull())
976  else {
977  edm::LogError("UnexpectedInputs") << "Building from Candidates, should not happen!";
979  }
980 }
Log< level::Error, false > LogError
TemplatedSecondaryVertex< VTX > SecondaryVertex

◆ operator()() [4/4]

Definition at line 984 of file TemplatedSecondaryVertexProducer.cc.

References reco::CompositePtrCandidate::addDaughter(), reco::CandidatePtrTransientTrack::candidate(), TemplatedSecondaryVertexProducer< IPTI, VTX >::minTrackWeight, reco::Candidate::p4(), reco::VertexCompositePtrCandidate::setChi2AndNdof(), reco::VertexCompositePtrCandidate::setCovariance(), reco::LeafCandidate::setP4(), reco::LeafCandidate::setVertex(), pfDeepBoostedJetPreprocessParams_cfi::sv, groupFilesInBlocks::tt, and TemplatedSecondaryVertexProducer< IPTI, VTX >::withPVError.

985  {
986  if (!sv.originalTracks().empty() && sv.originalTracks()[0].trackBaseRef().isNonnull()) {
987  edm::LogError("UnexpectedInputs") << "Building from Tracks, should not happen!";
988  VertexCompositePtrCandidate vtxCompPtrCand;
989 
990  vtxCompPtrCand.setCovariance(sv.vertexState().error().matrix());
991  vtxCompPtrCand.setChi2AndNdof(sv.totalChiSquared(), sv.degreesOfFreedom());
992  vtxCompPtrCand.setVertex(Candidate::Point(sv.position().x(), sv.position().y(), sv.position().z()));
993 
994  return SecondaryVertex(pv, vtxCompPtrCand, direction, withPVError);
995  } else {
996  VertexCompositePtrCandidate vtxCompPtrCand;
997 
998  vtxCompPtrCand.setCovariance(sv.vertexState().error().matrix());
999  vtxCompPtrCand.setChi2AndNdof(sv.totalChiSquared(), sv.degreesOfFreedom());
1000  vtxCompPtrCand.setVertex(Candidate::Point(sv.position().x(), sv.position().y(), sv.position().z()));
1001 
1003  for (std::vector<reco::TransientTrack>::const_iterator tt = sv.originalTracks().begin();
1004  tt != sv.originalTracks().end();
1005  ++tt) {
1006  if (sv.trackWeight(*tt) < minTrackWeight)
1007  continue;
1008 
1009  const CandidatePtrTransientTrack *cptt =
1010  dynamic_cast<const CandidatePtrTransientTrack *>(tt->basicTransientTrack());
1011  if (cptt == nullptr)
1012  edm::LogError("DynamicCastingFailed") << "Casting of TransientTrack to CandidatePtrTransientTrack failed!";
1013  else {
1014  p4 += cptt->candidate()->p4();
1015  vtxCompPtrCand.addDaughter(cptt->candidate());
1016  }
1017  }
1018  vtxCompPtrCand.setP4(p4);
1019 
1020  return SecondaryVertex(pv, vtxCompPtrCand, direction, withPVError);
1021  }
1022 }
CandidatePtr candidate() const override
Log< level::Error, false > LogError
void setVertex(const Point &vertex) override
set vertex
Definition: TTTypes.h:54
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
void setChi2AndNdof(double chi2, double ndof)
set chi2 and ndof
void setP4(const LorentzVector &p4) final
set 4-momentum
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector

Member Data Documentation

◆ direction

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

◆ minTrackWeight

template<class IPTI, class VTX>
double TemplatedSecondaryVertexProducer< IPTI, VTX >::SVBuilder::minTrackWeight

Definition at line 191 of file TemplatedSecondaryVertexProducer.cc.

◆ pv

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

Definition at line 188 of file TemplatedSecondaryVertexProducer.cc.

◆ withPVError

template<class IPTI, class VTX>
bool TemplatedSecondaryVertexProducer< IPTI, VTX >::SVBuilder::withPVError