CMS 3D CMS Logo

Public Member Functions | Private Attributes

GsfVertexMerger Class Reference

#include <GsfVertexMerger.h>

List of all members.

Public Member Functions

GsfVertexMergerclone () const
 GsfVertexMerger (const edm::ParameterSet &pSet)
VertexState merge (const VertexState &vertex) const
CachingVertex< 5 > merge (const CachingVertex< 5 > &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 edm::ParameterSet::getParameter(), maxComponents, and merger.

Referenced by clone().

{

  maxComponents = pSet.getParameter<int>("maxNbrComponents");
  std::string mergerName = pSet.getParameter<std::string>("merger");
  std::string distanceName = pSet.getParameter<std::string>("distance");

  if ( mergerName=="CloseComponentsMerger" ) {
    DistanceBetweenComponents<3>* distance;

    if ( distanceName=="KullbackLeiblerDistance" )
      distance = new KullbackLeiblerDistance<3>();
//     else if ( distanceName=="MahalanobisDistance" )
//       distance = new MahalanobisDistance();
    else 
      throw VertexException("GsfVertexMerger: Distance type "+distanceName+" unknown. Check distance parameter in GsfMergerParameters PSet");
    
    merger = new CloseComponentsMerger<3>(maxComponents, distance);
    delete distance;
  } 
//   else if ( mergerName=="LargestWeightsStateMerger" )
//     merger = new LargestWeightsStateMerger(maxComponents);
  else 
    throw VertexException("GsfVertexMerger: Merger type "+mergerName+" unknown. Check merger parameter in GsfMergerParameters PSet");

//   else if ( mergerName=="KeepingNonZeroWeightsMerger" )
//     merger = new KeepingNonZeroWeightsMerger();

//   std::string mergerName = "test";
//   edm::ESHandle<MultiGaussianStateMerger> mergerProducer;
//   iRecord.get(mergerName,mergerProducer);
//   merger = (MultiGaussianStateMerger *) mergerProducer.product();

}
GsfVertexMerger::~GsfVertexMerger ( ) [inline]

Definition at line 19 of file GsfVertexMerger.h.

{}

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().

                                  {
    return new GsfVertexMerger(* this);
  }
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().

{
  if (oldVertex.vertexState().components().size() <= maxComponents) 
        return oldVertex;

  VertexState newVertexState = merge(oldVertex.vertexState());

  if  (oldVertex.hasPrior()) {
    return CachingVertex<5>(oldVertex.priorPosition(), oldVertex.priorError(),
                newVertexState.weightTimesPosition(), newVertexState.weight(),
                oldVertex.tracks(), oldVertex.totalChiSquared());
  } else {
    return CachingVertex<5>(newVertexState, oldVertex.tracks(), 
                oldVertex.totalChiSquared());
  }
}
VertexState GsfVertexMerger::merge ( const VertexState vertex) const

Definition at line 66 of file GsfVertexMerger.cc.

References VertexState::components(), maxComponents, merger, GaussianStateConversions::multiGaussianStateFromVertex(), and GaussianStateConversions::vertexFromMultiGaussianState().

{
  using namespace GaussianStateConversions;

  if (oldVertex.components().size() <= maxComponents) 
        return oldVertex;

  MultiGaussianState<3> multiGaussianState(multiGaussianStateFromVertex(oldVertex));
  MultiGaussianState<3> finalState(merger->merge(multiGaussianState));
  return vertexFromMultiGaussianState(finalState);
}

Member Data Documentation

unsigned int GsfVertexMerger::maxComponents [private]

Definition at line 31 of file GsfVertexMerger.h.

Referenced by GsfVertexMerger(), and merge().

Definition at line 30 of file GsfVertexMerger.h.

Referenced by GsfVertexMerger(), and merge().