CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
TemplatedSecondaryVertexProducer< IPTI, VTX >::SVBuilder Struct Reference
Inheritance diagram for TemplatedSecondaryVertexProducer< IPTI, VTX >::SVBuilder:

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 180 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 962 of file TemplatedSecondaryVertexProducer.cc.

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

963 {
964  if(!sv.originalTracks().empty() && sv.originalTracks()[0].trackBaseRef().isNonnull())
965  return SecondaryVertex(pv, sv, direction, withPVError);
966  else
967  {
968  edm::LogError("UnexpectedInputs") << "Building from Candidates, should not happen!";
969  return SecondaryVertex(pv, sv, direction, withPVError);
970  }
971 }
std::vector< reco::TransientTrack > const & originalTracks() const
TemplatedSecondaryVertex< VTX > SecondaryVertex

Definition at line 975 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(), reco::Candidate::p4(), p4, 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().

976 {
977  if(!sv.originalTracks().empty() && sv.originalTracks()[0].trackBaseRef().isNonnull())
978  {
979  edm::LogError("UnexpectedInputs") << "Building from Tracks, should not happen!";
980  VertexCompositePtrCandidate vtxCompPtrCand;
981 
982  vtxCompPtrCand.setCovariance(sv.vertexState().error().matrix());
983  vtxCompPtrCand.setChi2AndNdof(sv.totalChiSquared(), sv.degreesOfFreedom());
984  vtxCompPtrCand.setVertex(Candidate::Point(sv.position().x(),sv.position().y(),sv.position().z()));
985 
986  return SecondaryVertex(pv, vtxCompPtrCand, direction, withPVError);
987  }
988  else
989  {
990  VertexCompositePtrCandidate vtxCompPtrCand;
991 
992  vtxCompPtrCand.setCovariance(sv.vertexState().error().matrix());
993  vtxCompPtrCand.setChi2AndNdof(sv.totalChiSquared(), sv.degreesOfFreedom());
994  vtxCompPtrCand.setVertex(Candidate::Point(sv.position().x(),sv.position().y(),sv.position().z()));
995 
997  for(std::vector<reco::TransientTrack>::const_iterator tt = sv.originalTracks().begin(); tt != sv.originalTracks().end(); ++tt)
998  {
999  if (sv.trackWeight(*tt) < minTrackWeight)
1000  continue;
1001 
1002  const CandidatePtrTransientTrack* cptt = dynamic_cast<const CandidatePtrTransientTrack*>(tt->basicTransientTrack());
1003  if ( cptt==nullptr )
1004  edm::LogError("DynamicCastingFailed") << "Casting of TransientTrack to CandidatePtrTransientTrack failed!";
1005  else
1006  {
1007  p4 += cptt->candidate()->p4();
1008  vtxCompPtrCand.addDaughter(cptt->candidate());
1009  }
1010  }
1011  vtxCompPtrCand.setP4(p4);
1012 
1013  return SecondaryVertex(pv, vtxCompPtrCand, direction, withPVError);
1014  }
1015 }
const AlgebraicSymMatrix33 matrix() const
float totalChiSquared() const
T y() const
Definition: PV3DBase.h:63
void setVertex(const Point &vertex) override
set vertex
std::vector< reco::TransientTrack > const & originalTracks() const
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
float degreesOfFreedom() const
double p4[4]
Definition: TauolaWrapper.h:92
GlobalPoint position() const
T z() const
Definition: PV3DBase.h:64
float trackWeight(const reco::TransientTrack &track) const
CandidatePtr candidate() const override
TemplatedSecondaryVertex< VTX > SecondaryVertex
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
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:41
GlobalError error() const
Definition: VertexState.h:74
void setChi2AndNdof(double chi2, double ndof)
set chi2 and ndof
VertexState const & vertexState() const
T x() const
Definition: PV3DBase.h:62
void setP4(const LorentzVector &p4) final
set 4-momentum

Member Data Documentation

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

Definition at line 197 of file TemplatedSecondaryVertexProducer.cc.

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

Definition at line 199 of file TemplatedSecondaryVertexProducer.cc.

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

Definition at line 196 of file TemplatedSecondaryVertexProducer.cc.

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

Definition at line 198 of file TemplatedSecondaryVertexProducer.cc.