CMS 3D CMS Logo

GsfVertexMerger.cc
Go to the documentation of this file.
3 // #include "TrackingTools/GsfTools/interface/MahalanobisDistance.h"
5 // #include "CommonReco/GSFTools/interface/KeepingNonZeroWeightsMerger.h"
6 // #include "TrackingTools/GsfTools/interface/LargestWeightsStateMerger.h"
7 // #include "TrackingTools/GsfTools/interface/RCMultiGaussianState.h"
10 
12 
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 }
46 
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 }
64 
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 }
Handle.h
GsfVertexMerger::GsfVertexMerger
GsfVertexMerger(const edm::ParameterSet &pSet)
Definition: GsfVertexMerger.cc:13
VertexException
Common base class.
Definition: VertexException.h:12
CachingVertex< 5 >
GsfVertexMerger.h
CloseComponentsMerger
Definition: CloseComponentsMerger.h:18
MultiGaussianState
Mixture of multi-variate gaussian states.
Definition: MultiGaussianState.h:18
CachingVertex::vertexState
const VertexState & vertexState() const
Definition: CachingVertex.h:137
HLT_2018_cff.distance
distance
Definition: HLT_2018_cff.py:6417
CachingVertex::hasPrior
bool hasPrior() const
Definition: CachingVertex.h:153
GaussianStateConversions
Definition: VertexGaussianStateConversions.h:6
KullbackLeiblerDistance
Definition: KullbackLeiblerDistance.h:10
CachingVertex::priorPosition
GlobalPoint priorPosition() const
Definition: CachingVertex.h:149
DistanceBetweenComponents
Definition: DistanceBetweenComponents.h:11
CachingVertex::totalChiSquared
float totalChiSquared() const
Definition: CachingVertex.h:159
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:36
GaussianStateConversions::multiGaussianStateFromVertex
MultiGaussianState< 3 > multiGaussianStateFromVertex(const VertexState aState)
Definition: VertexGaussianStateConversions.cc:8
VertexState::weight
GlobalWeight weight() const
Definition: VertexState.h:69
VertexState::components
std::vector< VertexState > components() const
Definition: VertexState.h:90
MultiGaussianStateMerger::merge
virtual MultiState merge(const MultiState &mgs) const =0
VertexGaussianStateConversions.h
CachingVertex::tracks
std::vector< RefCountedVertexTrack > tracks() const
Definition: CachingVertex.h:147
CloseComponentsMerger.h
VertexState::weightTimesPosition
AlgebraicVector3 weightTimesPosition() const
Definition: VertexState.h:77
GsfVertexMerger::maxComponents
unsigned int maxComponents
Definition: GsfVertexMerger.h:28
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
KullbackLeiblerDistance.h
GsfVertexMerger::merge
CachingVertex< 5 > merge(const CachingVertex< 5 > &vertex) const
Definition: GsfVertexMerger.cc:47
GaussianStateConversions::vertexFromMultiGaussianState
VertexState vertexFromMultiGaussianState(const MultiGaussianState< 3 > &multiState)
Definition: VertexGaussianStateConversions.cc:27
VertexState
Definition: VertexState.h:13
CachingVertex::priorError
GlobalError priorError() const
Definition: CachingVertex.h:151
GsfVertexMerger::merger
DeepCopyPointerByClone< MultiGaussianStateMerger< 3 > > merger
Definition: GsfVertexMerger.h:27
VertexException.h