CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 175 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 900 of file TemplatedSecondaryVertexProducer.cc.

References reco::CompositePtrCandidate::addDaughter(), reco::CandidatePtrTransientTrack::candidate(), TransientVertex::degreesOfFreedom(), VertexState::error(), GlobalErrorBase< T, ErrorWeightType >::matrix_new(), TemplatedSecondaryVertexProducer< IPTI, VTX >::minTrackWeight, TransientVertex::originalTracks(), 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().

901 {
902  if(sv.originalTracks().size()>0 && sv.originalTracks()[0].trackBaseRef().isNonnull())
903  {
904  edm::LogError("UnexpectedInputs") << "Building from Tracks, should not happen!";
905  VertexCompositePtrCandidate vtxCompPtrCand;
906 
907  vtxCompPtrCand.setCovariance(sv.vertexState().error().matrix_new());
908  vtxCompPtrCand.setChi2AndNdof(sv.totalChiSquared(), sv.degreesOfFreedom());
909  vtxCompPtrCand.setVertex(Candidate::Point(sv.position().x(),sv.position().y(),sv.position().z()));
910 
911  return SecondaryVertex(pv, vtxCompPtrCand, direction, withPVError);
912  }
913  else
914  {
915  VertexCompositePtrCandidate vtxCompPtrCand;
916 
917  vtxCompPtrCand.setCovariance(sv.vertexState().error().matrix_new());
918  vtxCompPtrCand.setChi2AndNdof(sv.totalChiSquared(), sv.degreesOfFreedom());
919  vtxCompPtrCand.setVertex(Candidate::Point(sv.position().x(),sv.position().y(),sv.position().z()));
920 
922  for(std::vector<reco::TransientTrack>::const_iterator tt = sv.originalTracks().begin(); tt != sv.originalTracks().end(); ++tt)
923  {
924  if (sv.trackWeight(*tt) < minTrackWeight)
925  continue;
926 
927  const CandidatePtrTransientTrack* cptt = dynamic_cast<const CandidatePtrTransientTrack*>(tt->basicTransientTrack());
928  if ( cptt==0 )
929  edm::LogError("DynamicCastingFailed") << "Casting of TransientTrack to CandidatePtrTransientTrack failed!";
930  else
931  {
932  p4 += cptt->candidate()->p4();
933  vtxCompPtrCand.addDaughter(cptt->candidate());
934  }
935  }
936  vtxCompPtrCand.setP4(p4);
937 
938  return SecondaryVertex(pv, vtxCompPtrCand, direction, withPVError);
939  }
940 }
float totalChiSquared() const
T y() const
Definition: PV3DBase.h:63
virtual void setP4(const LorentzVector &p4)
set 4-momentum
const AlgebraicSymMatrix33 & matrix_new() const
std::vector< reco::TransientTrack > const & originalTracks() const
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
virtual void setVertex(const Point &vertex)
set vertex
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:55
void setChi2AndNdof(double chi2, double ndof)
set chi2 and ndof
VertexState const & vertexState() const
T x() const
Definition: PV3DBase.h:62

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 194 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