CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions
VertexTimeAlgorithmLegacy4D Class Reference

#include <VertexTimeAlgorithmLegacy4D.h>

Inheritance diagram for VertexTimeAlgorithmLegacy4D:
VertexTimeAlgorithmBase

Public Member Functions

void setEvent (edm::Event &iEvent, edm::EventSetup const &iSetup) override
 
bool vertexTime (float &vtxTime, float &vtxTimeError, TransientVertex const &vtx) const override
 
 VertexTimeAlgorithmLegacy4D (const edm::ParameterSet &conf, edm::ConsumesCollector &iC)
 
 ~VertexTimeAlgorithmLegacy4D () override=default
 
- Public Member Functions inherited from VertexTimeAlgorithmBase
virtual void fill_vertex_times (std::vector< TransientVertex > &pvs)
 
VertexTimeAlgorithmBaseoperator= (const VertexTimeAlgorithmBase &)=delete
 
 VertexTimeAlgorithmBase (const edm::ParameterSet &conf, edm::ConsumesCollector &iC)
 
 VertexTimeAlgorithmBase (const VertexTimeAlgorithmBase &)=delete
 
virtual ~VertexTimeAlgorithmBase ()=default
 

Static Public Member Functions

static void fillPSetDescription (edm::ParameterSetDescription &iDesc)
 
- Static Public Member Functions inherited from VertexTimeAlgorithmBase
static void fillPSetDescription (edm::ParameterSetDescription &iDesc)
 

Detailed Description

Definition at line 10 of file VertexTimeAlgorithmLegacy4D.h.

Constructor & Destructor Documentation

◆ VertexTimeAlgorithmLegacy4D()

VertexTimeAlgorithmLegacy4D::VertexTimeAlgorithmLegacy4D ( const edm::ParameterSet conf,
edm::ConsumesCollector iC 
)

Definition at line 13 of file VertexTimeAlgorithmLegacy4D.cc.

14  : VertexTimeAlgorithmBase(iConfig, iCC) {}
VertexTimeAlgorithmBase(const edm::ParameterSet &conf, edm::ConsumesCollector &iC)

◆ ~VertexTimeAlgorithmLegacy4D()

VertexTimeAlgorithmLegacy4D::~VertexTimeAlgorithmLegacy4D ( )
overridedefault

Member Function Documentation

◆ fillPSetDescription()

void VertexTimeAlgorithmLegacy4D::fillPSetDescription ( edm::ParameterSetDescription iDesc)
static

Definition at line 16 of file VertexTimeAlgorithmLegacy4D.cc.

References VertexTimeAlgorithmBase::fillPSetDescription().

Referenced by PrimaryVertexProducer::fillDescriptions().

16  {
18 }
static void fillPSetDescription(edm::ParameterSetDescription &iDesc)

◆ setEvent()

void VertexTimeAlgorithmLegacy4D::setEvent ( edm::Event iEvent,
edm::EventSetup const &  iSetup 
)
overridevirtual

Implements VertexTimeAlgorithmBase.

Definition at line 20 of file VertexTimeAlgorithmLegacy4D.cc.

20 {};

◆ vertexTime()

bool VertexTimeAlgorithmLegacy4D::vertexTime ( float &  vtxTime,
float &  vtxTimeError,
TransientVertex const &  vtx 
) const
overridevirtual

estimate the vertex time and time uncertainty for transient vertex

returns true when a valid time has been determined, otherwise return false

Implements VertexTimeAlgorithmBase.

Definition at line 22 of file VertexTimeAlgorithmLegacy4D.cc.

References TransientTrackBuilder::defaultInvalidTrackTimeReso, submitPVResolutionJobs::err, mathSSE::sqrt(), hcalRecHitTable_cff::time, L1BJetProducer_cff::vtx, and w().

22  {
23  const auto num_track = vtx.originalTracks().size();
24  if (num_track == 0) {
25  return false;
26  }
27 
28  double sumwt = 0.;
29  double sumwt2 = 0.;
30  double sumw = 0.;
31  double vartime = 0.;
32 
33  for (const auto& trk : vtx.originalTracks()) {
34  const double time = trk.timeExt();
35  const double err = trk.dtErrorExt();
37  continue; // tracks with no time information, as implemented in TransientTrackBuilder.cc l.17
38  const double inverr = err > 0. ? 1.0 / err : 0.;
39  const double w = inverr * inverr;
40  sumwt += w * time;
41  sumwt2 += w * time * time;
42  sumw += w;
43  }
44 
45  if (sumw > 0) {
46  double sumsq = sumwt2 - sumwt * sumwt / sumw;
47  double chisq = num_track > 1 ? sumsq / double(num_track - 1) : sumsq / double(num_track);
48  vartime = chisq / sumw;
49 
50  vtxTime = sumwt / sumw;
51  vtxTimeError = sqrt(vartime);
52  return true;
53  }
54 
55  vtxTime = 0;
56  vtxTimeError = 1.;
57  return false;
58 }
T w() const
T sqrt(T t)
Definition: SSEVec.h:19
static constexpr float defaultInvalidTrackTimeReso