CMS 3D CMS Logo

KinematicConstrainedVertexFitter Class Reference

Class fitting the veretx out of set of tracks via usual LMS with Lagrange multipliers. More...

#include <RecoVertex/KinematicFit/interface/KinematicConstrainedVertexFitter.h>

List of all members.

Public Member Functions

RefCountedKinematicTree fit (vector< RefCountedKinematicParticle > part, MultiTrackKinematicConstraint *cs) const
 If multitrack constraint is empty, the output will be just a simple vertex fit performed by LMS with Lagrange multipliers method.
 KinematicConstrainedVertexFitter (const LinearizationPointFinder &fnd)
 Constructor with user-provided LinearizationPointFinder.
 KinematicConstrainedVertexFitter ()
 Default constructor using LMSLinearizationPointFinder.
 ~KinematicConstrainedVertexFitter ()

Private Member Functions

void readParameters ()

Private Attributes

LinearizationPointFinderfinder
ConstrainedTreeBuildertBuilder
float theMaxDiff
int theMaxStep
KinematicConstrainedVertexUpdatorupdator
VertexKinematicConstraintvCons


Detailed Description

Class fitting the veretx out of set of tracks via usual LMS with Lagrange multipliers.

Additional constraints can be applyed to the tracks during the vertex fit (solves non-factorizabele cases) Example: Vertex fit with collinear tracks..

Kirill Prokofiev September 2003.

Definition at line 23 of file KinematicConstrainedVertexFitter.h.


Constructor & Destructor Documentation

KinematicConstrainedVertexFitter::KinematicConstrainedVertexFitter (  ) 

Default constructor using LMSLinearizationPointFinder.

Definition at line 10 of file KinematicConstrainedVertexFitter.cc.

References finder, readParameters(), tBuilder, updator, and vCons.

KinematicConstrainedVertexFitter::KinematicConstrainedVertexFitter ( const LinearizationPointFinder fnd  ) 

Constructor with user-provided LinearizationPointFinder.

Definition at line 19 of file KinematicConstrainedVertexFitter.cc.

References LinearizationPointFinder::clone(), finder, readParameters(), tBuilder, updator, and vCons.

00020 {
00021  
00022  finder = fnd.clone();
00023  vCons = new VertexKinematicConstraint();
00024  updator = new KinematicConstrainedVertexUpdator();
00025  tBuilder = new ConstrainedTreeBuilder;
00026  readParameters();
00027 }

KinematicConstrainedVertexFitter::~KinematicConstrainedVertexFitter (  ) 

Definition at line 29 of file KinematicConstrainedVertexFitter.cc.

References finder, tBuilder, updator, and vCons.

00030 {
00031  delete finder;
00032  delete vCons;
00033  delete updator;
00034  delete tBuilder;
00035 }


Member Function Documentation

RefCountedKinematicTree KinematicConstrainedVertexFitter::fit ( vector< RefCountedKinematicParticle part,
MultiTrackKinematicConstraint cs 
) const

If multitrack constraint is empty, the output will be just a simple vertex fit performed by LMS with Lagrange multipliers method.

Definition at line 51 of file KinematicConstrainedVertexFitter.cc.

References funct::abs(), ConstrainedTreeBuilder::buildTree(), edm::eq(), finder, LinearizationPointFinder::getLinearizationPoint(), i, iggi_31X_cfg::input, j, InputSort::sort(), tBuilder, theMaxDiff, KinematicConstrainedVertexUpdator::update(), updator, VertexKinematicConstraint::value(), MultiTrackKinematicConstraint::value(), vCons, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by KineExample::analyze().

00053 {
00054  if(part.size()<2) throw VertexException("KinematicConstrainedVertexFitter::input states are less than 2");
00055   
00056 //sorting out the input particles
00057  InputSort iSort;
00058  pair<vector<RefCountedKinematicParticle>, vector<FreeTrajectoryState> > input = iSort.sort(part);
00059  const vector<RefCountedKinematicParticle> & prt  = input.first;
00060  const vector<FreeTrajectoryState> & fStates = input.second;
00061 
00062 // linearization point: 
00063  GlobalPoint linPoint  = finder->getLinearizationPoint(fStates);
00064 
00065 //initial parameters:  
00066  int vSize = prt.size();
00067  AlgebraicVector inPar(3 + 7*vSize,0);
00068 
00069 //final parameters 
00070  AlgebraicVector finPar(3 + 7*vSize,0);
00071 
00072 //initial covariance 
00073  AlgebraicMatrix inCov(3 + 7*vSize,3 + 7*vSize,0);
00074 
00075 //making initial vector of parameters and initial particle-related covariance
00076  int nSt = 0;   
00077  vector<KinematicState> inStates;
00078  for(vector<RefCountedKinematicParticle>::const_iterator i = prt.begin(); i!=prt.end(); i++)
00079  {
00080   AlgebraicVector prPar = asHepVector<7>((*i)->stateAtPoint(linPoint).kinematicParameters().vector());
00081   for(int j = 1; j<8; j++){inPar(3 + 7*nSt + j) = prPar(j);}
00082   AlgebraicSymMatrix l_cov  = asHepMatrix<7>((*i)->stateAtPoint(linPoint).kinematicParametersError().matrix());
00083   inCov.sub(4 + 7*nSt,4 + 7*nSt ,l_cov); 
00084   inStates.push_back((*i)->stateAtPoint(linPoint));
00085   ++nSt;
00086  }
00087 
00088 //initial vertex error matrix components (huge error method)
00089 //and vertex related initial vector components
00090  double in_er = 100.;
00091  inCov(1,1) = in_er;
00092  inCov(2,2) = in_er;
00093  inCov(3,3) = in_er;
00094  
00095  inPar(1) = linPoint.x();
00096  inPar(2) = linPoint.y();
00097  inPar(3) = linPoint.z(); 
00098  
00099 //constraint equations value and number of iterations 
00100  double eq;   
00101  int nit = 0; 
00102  
00103  vector<KinematicState> lStates = inStates;
00104  GlobalPoint lPoint  = linPoint;
00105  RefCountedKinematicVertex rVtx;
00106  AlgebraicMatrix refCCov;
00107 
00108 //iterarions over the updator: each time updated parameters 
00109 //are taken as new linearization point 
00110  do{ 
00111   eq = 0.;
00112   pair< pair< vector<KinematicState>, AlgebraicMatrix >,RefCountedKinematicVertex> lRes = 
00113                                       updator->update(inPar,inCov,lStates,lPoint,cs);
00114   lStates = lRes.first.first;
00115   rVtx = lRes.second;
00116   lPoint = rVtx->position(); 
00117   AlgebraicVector vValue = vCons->value(lStates, lPoint);
00118   for(int i = 1; i<vValue.num_row();++i)
00119   {eq += abs(vValue(i));}
00120   if(cs !=0)
00121   {
00122    AlgebraicVector cVal = cs->value(lStates, lPoint);
00123    for(int i = 1; i<cVal.num_row();++i)
00124    {eq += abs(cVal(i));}
00125   }
00126   refCCov = lRes.first.second;
00127   nit++;
00128  }while(nit<theMaxStep && eq>theMaxDiff);
00129 
00130 // cout<<"number of relinearizations "<<nit<<endl;
00131 // cout<<"value obtained: "<<eq<<endl;
00132 
00133 //making refitted particles out of refitted states.
00134 //none of the operations above violates the order of particles 
00135  if(prt.size() != lStates.size()) throw VertexException("KinematicConstrainedVertexFitter::updator failure");
00136  vector<RefCountedKinematicParticle>::const_iterator i;
00137  vector<KinematicState>::const_iterator j;
00138  vector<RefCountedKinematicParticle> rParticles;
00139  for(i = prt.begin(),j = lStates.begin(); i != prt.end(),j != lStates.end(); ++i,++j)
00140  {
00141   rParticles.push_back((*i)->refittedParticle((*j),rVtx->chiSquared(),rVtx->degreesOfFreedom()));
00142  }   
00143  
00144 // cout<<"Constrained Vertex Fitter covariance: "<<refCCov <<endl;
00145  return  tBuilder->buildTree(rParticles,rVtx,refCCov); 
00146 }

void KinematicConstrainedVertexFitter::readParameters (  )  [private]

Definition at line 37 of file KinematicConstrainedVertexFitter.cc.

References theMaxDiff, and theMaxStep.

Referenced by KinematicConstrainedVertexFitter().

00038 {
00039 //FIXME
00040 //  static SimpleConfigurable<double>
00041 //    maxEquationValueConfigurable(0.01,"KinematicConstrainedVertexFitterVertexFitter:maximumValue");
00042 //  theMaxDiff = maxEquationValueConfigurable.value();
00043 // 
00044 //  static SimpleConfigurable<int>
00045 //    maxStepConfigurable(10,"KinematicConstrainedVertexFitter:maximumNumberOfIterations");
00046 //  theMaxStep = maxStepConfigurable.value();
00047   theMaxDiff = 0.01;
00048   theMaxStep = 10;
00049 }


Member Data Documentation

LinearizationPointFinder* KinematicConstrainedVertexFitter::finder [private]

Definition at line 55 of file KinematicConstrainedVertexFitter.h.

Referenced by fit(), KinematicConstrainedVertexFitter(), and ~KinematicConstrainedVertexFitter().

ConstrainedTreeBuilder* KinematicConstrainedVertexFitter::tBuilder [private]

Definition at line 58 of file KinematicConstrainedVertexFitter.h.

Referenced by fit(), KinematicConstrainedVertexFitter(), and ~KinematicConstrainedVertexFitter().

float KinematicConstrainedVertexFitter::theMaxDiff [private]

Definition at line 53 of file KinematicConstrainedVertexFitter.h.

Referenced by fit(), and readParameters().

int KinematicConstrainedVertexFitter::theMaxStep [private]

Definition at line 54 of file KinematicConstrainedVertexFitter.h.

Referenced by readParameters().

KinematicConstrainedVertexUpdator* KinematicConstrainedVertexFitter::updator [private]

Definition at line 56 of file KinematicConstrainedVertexFitter.h.

Referenced by fit(), KinematicConstrainedVertexFitter(), and ~KinematicConstrainedVertexFitter().

VertexKinematicConstraint* KinematicConstrainedVertexFitter::vCons [private]

Definition at line 57 of file KinematicConstrainedVertexFitter.h.

Referenced by fit(), KinematicConstrainedVertexFitter(), and ~KinematicConstrainedVertexFitter().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:26:21 2009 for CMSSW by  doxygen 1.5.4