CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
GsfVertexMerger Class Reference

#include <GsfVertexMerger.h>

Public Member Functions

GsfVertexMergerclone () const
 
 GsfVertexMerger (const edm::ParameterSet &pSet)
 
CachingVertex< 5 > merge (const CachingVertex< 5 > &vertex) const
 
VertexState merge (const VertexState &vertex) const
 
 ~GsfVertexMerger ()
 

Private Attributes

unsigned int maxComponents
 
DeepCopyPointerByClone< MultiGaussianStateMerger< 3 > > merger
 

Detailed Description

Definition at line 15 of file GsfVertexMerger.h.

Constructor & Destructor Documentation

◆ GsfVertexMerger()

GsfVertexMerger::GsfVertexMerger ( const edm::ParameterSet pSet)

Definition at line 13 of file GsfVertexMerger.cc.

References HLT_2022v12_cff::distance, edm::ParameterSet::getParameter(), maxComponents, merger, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by clone().

13  {
14  maxComponents = pSet.getParameter<int>("maxNbrComponents");
15  std::string mergerName = pSet.getParameter<std::string>("merger");
16  std::string distanceName = pSet.getParameter<std::string>("distance");
17 
18  if (mergerName == "CloseComponentsMerger") {
20 
21  if (distanceName == "KullbackLeiblerDistance")
23  // else if ( distanceName=="MahalanobisDistance" )
24  // distance = new MahalanobisDistance();
25  else
26  throw VertexException("GsfVertexMerger: Distance type " + distanceName +
27  " unknown. Check distance parameter in GsfMergerParameters PSet");
28 
30  delete distance;
31  }
32  // else if ( mergerName=="LargestWeightsStateMerger" )
33  // merger = new LargestWeightsStateMerger(maxComponents);
34  else
35  throw VertexException("GsfVertexMerger: Merger type " + mergerName +
36  " unknown. Check merger parameter in GsfMergerParameters PSet");
37 
38  // else if ( mergerName=="KeepingNonZeroWeightsMerger" )
39  // merger = new KeepingNonZeroWeightsMerger();
40 
41  // std::string mergerName = "test";
42  // edm::ESHandle<MultiGaussianStateMerger> mergerProducer;
43  // iRecord.get(mergerName,mergerProducer);
44  // merger = (MultiGaussianStateMerger *) mergerProducer.product();
45 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
Common base class.
DeepCopyPointerByClone< MultiGaussianStateMerger< 3 > > merger
unsigned int maxComponents

◆ ~GsfVertexMerger()

GsfVertexMerger::~GsfVertexMerger ( )
inline

Definition at line 18 of file GsfVertexMerger.h.

18 {}

Member Function Documentation

◆ clone()

GsfVertexMerger* GsfVertexMerger::clone ( void  ) const
inline

Definition at line 24 of file GsfVertexMerger.h.

References GsfVertexMerger().

Referenced by GsfVertexSmoother::GsfVertexSmoother(), and GsfVertexUpdator::GsfVertexUpdator().

24 { return new GsfVertexMerger(*this); }
GsfVertexMerger(const edm::ParameterSet &pSet)

◆ merge() [1/2]

CachingVertex< 5 > GsfVertexMerger::merge ( const CachingVertex< 5 > &  vertex) const

Definition at line 47 of file GsfVertexMerger.cc.

References VertexState::components(), CachingVertex< N >::hasPrior(), maxComponents, CachingVertex< N >::priorError(), CachingVertex< N >::priorPosition(), CachingVertex< N >::totalChiSquared(), CachingVertex< N >::tracks(), CachingVertex< N >::vertexState(), VertexState::weight(), and VertexState::weightTimesPosition().

Referenced by GsfVertexUpdator::add(), and GsfVertexSmoother::smooth().

47  {
48  if (oldVertex.vertexState().components().size() <= maxComponents)
49  return oldVertex;
50 
51  VertexState newVertexState = merge(oldVertex.vertexState());
52 
53  if (oldVertex.hasPrior()) {
54  return CachingVertex<5>(oldVertex.priorPosition(),
55  oldVertex.priorError(),
56  newVertexState.weightTimesPosition(),
57  newVertexState.weight(),
58  oldVertex.tracks(),
59  oldVertex.totalChiSquared());
60  } else {
61  return CachingVertex<5>(newVertexState, oldVertex.tracks(), oldVertex.totalChiSquared());
62  }
63 }
CachingVertex< 5 > merge(const CachingVertex< 5 > &vertex) const
GlobalWeight weight() const
Definition: VertexState.h:69
unsigned int maxComponents
AlgebraicVector3 weightTimesPosition() const
Definition: VertexState.h:77

◆ merge() [2/2]

VertexState GsfVertexMerger::merge ( const VertexState vertex) const

Definition at line 65 of file GsfVertexMerger.cc.

References VertexState::components(), maxComponents, MultiGaussianStateMerger< N >::merge(), merger, GaussianStateConversions::multiGaussianStateFromVertex(), and GaussianStateConversions::vertexFromMultiGaussianState().

65  {
66  using namespace GaussianStateConversions;
67 
68  if (oldVertex.components().size() <= maxComponents)
69  return oldVertex;
70 
71  MultiGaussianState<3> multiGaussianState(multiGaussianStateFromVertex(oldVertex));
72  MultiGaussianState<3> finalState(merger->merge(multiGaussianState));
73  return vertexFromMultiGaussianState(finalState);
74 }
MultiGaussianState< 3 > multiGaussianStateFromVertex(const VertexState aState)
virtual MultiState merge(const MultiState &mgs) const =0
VertexState vertexFromMultiGaussianState(const MultiGaussianState< 3 > &multiState)
Mixture of multi-variate gaussian states.
DeepCopyPointerByClone< MultiGaussianStateMerger< 3 > > merger
unsigned int maxComponents

Member Data Documentation

◆ maxComponents

unsigned int GsfVertexMerger::maxComponents
private

Definition at line 28 of file GsfVertexMerger.h.

Referenced by GsfVertexMerger(), and merge().

◆ merger

DeepCopyPointerByClone<MultiGaussianStateMerger<3> > GsfVertexMerger::merger
private

Definition at line 27 of file GsfVertexMerger.h.

Referenced by GsfVertexMerger(), and merge().