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 Member Functions | Private Attributes
KinematicParticleVertexFitter Class Reference

#include <KinematicParticleVertexFitter.h>

Public Member Functions

RefCountedKinematicTree fit (const std::vector< RefCountedKinematicParticle > &particles) const
 
 KinematicParticleVertexFitter ()
 
 KinematicParticleVertexFitter (const edm::ParameterSet &pSet)
 
 ~KinematicParticleVertexFitter ()
 

Private Member Functions

edm::ParameterSet defaultParameters () const
 
void setup (const edm::ParameterSet &pSet)
 

Private Attributes

VertexFitter< 6 > * fitter
 
LinearizationPointFinderpointFinder
 
VertexTrackFactory< 6 > * vFactory
 

Detailed Description

Class creating a kinematic particle out of set of daughter particles. Daughter particles are supposed to come from a common vertex. Arbitrary VerexFitter can be used to fit the common vertex and refit the daughter particles with the knowledge of vertex. The Kinematic Vertex is also created and the resulting KinematicParticle points on it.

Kirill Prokofiev, December 2002

Definition at line 25 of file KinematicParticleVertexFitter.h.

Constructor & Destructor Documentation

KinematicParticleVertexFitter::KinematicParticleVertexFitter ( )

Constructor with LMSLinearizationPointFinder used as default.

Definition at line 15 of file KinematicParticleVertexFitter.cc.

References defaultParameters(), and setup().

16 {
18  setup(pSet);
19 }
edm::ParameterSet defaultParameters() const
void setup(const edm::ParameterSet &pSet)
KinematicParticleVertexFitter::KinematicParticleVertexFitter ( const edm::ParameterSet pSet)

Definition at line 21 of file KinematicParticleVertexFitter.cc.

References setup().

22 {
23  setup(pSet);
24 }
void setup(const edm::ParameterSet &pSet)
KinematicParticleVertexFitter::~KinematicParticleVertexFitter ( )

Definition at line 42 of file KinematicParticleVertexFitter.cc.

References fitter, pointFinder, and vFactory.

43 {
44  delete vFactory;
45  delete pointFinder;
46  delete fitter;
47 }

Member Function Documentation

edm::ParameterSet KinematicParticleVertexFitter::defaultParameters ( ) const
private

Definition at line 49 of file KinematicParticleVertexFitter.cc.

References edm::ParameterSet::addParameter().

Referenced by KinematicParticleVertexFitter().

50 {
51  edm::ParameterSet pSet;
52  pSet.addParameter<double>("maxDistance", 0.01);
53  pSet.addParameter<int>("maxNbrOfIterations", 100); //10
54  return pSet;
55 }
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:143
RefCountedKinematicTree KinematicParticleVertexFitter::fit ( const std::vector< RefCountedKinematicParticle > &  particles) const

Fit method taking set of particles, fitting them to the common vertex and creating tree out of them. Input particles can belong to kinmaticTrees. In such a case it should be TOP particle of corresponding tree.

Definition at line 57 of file KinematicParticleVertexFitter.cc.

References FinalTreeBuilder::buildTree(), relativeConstraints::error, fitter, LinearizationPointFinder::getLinearizationPoint(), i, input, CachingVertex< N >::isValid(), LogDebug, pointFinder, InputSort::sort(), VertexFitter< N >::vertex(), VertexTrackFactory< N >::vertexTrack(), vFactory, and TrackKinematicStatePropagator::willPropagateToTheTransversePCA().

Referenced by KineExample::analyze(), and PFTau3ProngReco::produce().

58 {
59  typedef ReferenceCountingPointer<VertexTrack<6> > RefCountedVertexTrack;
60 //sorting the input
61  if(particles.size()<2) throw VertexException("KinematicParticleVertexFitter::input states are less than 2");
62  InputSort iSort;
63  std::pair<std::vector<RefCountedKinematicParticle>, std::vector<FreeTrajectoryState> > input = iSort.sort(particles);
64  std::vector<RefCountedKinematicParticle> & newPart = input.first;
65  std::vector<FreeTrajectoryState> & freeStates = input.second;
66 
67  GlobalPoint linPoint = pointFinder->getLinearizationPoint(freeStates);
68 
69 // cout<<"Linearization point found"<<endl;
70 
71 //making initial veretx seed with lin point as position and a fake error
73  we(0,0)=we(1,1)=we(2,2) = 10000.;
74  GlobalError error(we);
75  VertexState state(linPoint, error);
76 
77 //vector of Vertex Tracks to fit
78  std::vector<RefCountedVertexTrack> ttf;
80  for(auto const & i : newPart){
81  if( !(i)->currentState().isValid() || !propagator_.willPropagateToTheTransversePCA((i)->currentState(), linPoint) ) {
82  // std::cout << "Here's the bad state." << std::endl;
83  return ReferenceCountingPointer<KinematicTree>(new KinematicTree()); // return invalid vertex
84  }
85  ttf.push_back(vFactory->vertexTrack((i)->particleLinearizedTrackState(linPoint),state,1.));
86  }
87 
88 // //debugging code to check neutrals:
89 // for(std::vector<RefCountedVertexTrack>::const_iterator i = ttf.begin(); i!=ttf.end(); i++)
90 // {
91 // // cout<<"predicted state momentum error"<<(*i)->linearizedTrack()->predictedStateMomentumError()<<endl;
92 // // cout<<"Momentum jacobian"<<(*i)->linearizedTrack()->momentumJacobian() <<endl;
93 // // cout<<"predicted state momentum "<<(*i)->linearizedTrack()->predictedStateMomentum()<<endl;
94 // // cout<<"constant term"<<(*i)->linearizedTrack()->constantTerm()<<endl;
95 //
96 // }
97 
98  CachingVertex<6> vtx = fitter->vertex(ttf);
99  if (!vtx.isValid()) {
100  LogDebug("RecoVertex/KinematicParticleVertexFitter")
101  << "Fitted position is invalid. Returned Tree is invalid\n";
102  return ReferenceCountingPointer<KinematicTree>(new KinematicTree()); // return invalid vertex
103  }
104  FinalTreeBuilder tBuilder;
105  return tBuilder.buildTree(vtx, newPart);
106 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
RefCountedKinematicTree buildTree(const CachingVertex< 6 > &vtx, const std::vector< RefCountedKinematicParticle > &input) const
RefCountedVertexTrack vertexTrack(const RefCountedLinearizedTrackState lt, const VertexState vs, float weight=1.0) const
Common base class.
virtual bool willPropagateToTheTransversePCA(const KinematicState &state, const GlobalPoint &point) const
static std::string const input
Definition: EdmProvDump.cc:43
std::pair< std::vector< RefCountedKinematicParticle >, std::vector< FreeTrajectoryState > > sort(const std::vector< RefCountedKinematicParticle > &particles) const
Definition: InputSort.cc:6
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
virtual CachingVertex< N > vertex(const std::vector< reco::TransientTrack > &tracks) const =0
virtual GlobalPoint getLinearizationPoint(const std::vector< reco::TransientTrack > &) const =0
bool isValid() const
Definition: CachingVertex.h:96
void KinematicParticleVertexFitter::setup ( const edm::ParameterSet pSet)
private

Definition at line 27 of file KinematicParticleVertexFitter.cc.

References fitter, pointFinder, and vFactory.

Referenced by KinematicParticleVertexFitter().

Member Data Documentation

VertexFitter<6>* KinematicParticleVertexFitter::fitter
private

Definition at line 62 of file KinematicParticleVertexFitter.h.

Referenced by fit(), setup(), and ~KinematicParticleVertexFitter().

LinearizationPointFinder* KinematicParticleVertexFitter::pointFinder
private

Definition at line 63 of file KinematicParticleVertexFitter.h.

Referenced by fit(), setup(), and ~KinematicParticleVertexFitter().

VertexTrackFactory<6>* KinematicParticleVertexFitter::vFactory
private

Definition at line 64 of file KinematicParticleVertexFitter.h.

Referenced by fit(), setup(), and ~KinematicParticleVertexFitter().