CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ( const edm::ParameterSet pSet)

Definition at line 13 of file GsfVertexMerger.cc.

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

Referenced by clone().

14 {
15 
16  maxComponents = pSet.getParameter<int>("maxNbrComponents");
17  std::string mergerName = pSet.getParameter<std::string>("merger");
18  std::string distanceName = pSet.getParameter<std::string>("distance");
19 
20  if ( mergerName=="CloseComponentsMerger" ) {
22 
23  if ( distanceName=="KullbackLeiblerDistance" )
24  distance = new KullbackLeiblerDistance<3>();
25 // else if ( distanceName=="MahalanobisDistance" )
26 // distance = new MahalanobisDistance();
27  else
28  throw VertexException("GsfVertexMerger: Distance type "+distanceName+" unknown. Check distance parameter in GsfMergerParameters PSet");
29 
31  delete distance;
32  }
33 // else if ( mergerName=="LargestWeightsStateMerger" )
34 // merger = new LargestWeightsStateMerger(maxComponents);
35  else
36  throw VertexException("GsfVertexMerger: Merger type "+mergerName+" 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 
46 }
T getParameter(std::string const &) const
DeepCopyPointerByClone< MultiGaussianStateMerger< 3 > > merger
Common base class.
unsigned int maxComponents
GsfVertexMerger::~GsfVertexMerger ( )
inline

Definition at line 19 of file GsfVertexMerger.h.

19 {}

Member Function Documentation

GsfVertexMerger* GsfVertexMerger::clone ( void  ) const
inline

Definition at line 25 of file GsfVertexMerger.h.

References GsfVertexMerger().

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

25  {
26  return new GsfVertexMerger(* this);
27  }
GsfVertexMerger(const edm::ParameterSet &pSet)
CachingVertex< 5 > GsfVertexMerger::merge ( const CachingVertex< 5 > &  vertex) const

Definition at line 48 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().

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

Definition at line 66 of file GsfVertexMerger.cc.

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

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

Member Data Documentation

unsigned int GsfVertexMerger::maxComponents
private

Definition at line 31 of file GsfVertexMerger.h.

Referenced by GsfVertexMerger(), and merge().

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

Definition at line 30 of file GsfVertexMerger.h.

Referenced by GsfVertexMerger(), and merge().