CMS 3D CMS Logo

KinematicParticleVertexFitter.cc
Go to the documentation of this file.
2 // #include "Vertex/LinearizationPointFinders/interface/LMSLinearizationPointFinder.h"
14 
17  setup(pSet);
18 }
19 
21 
25 
29  SequentialVertexSmoother<6> smoother(vtu, vse, covCalc);
32 }
33 
35  delete vFactory;
36  delete pointFinder;
37  delete fitter;
38 }
39 
41  edm::ParameterSet pSet;
42  pSet.addParameter<double>("maxDistance", 0.01);
43  pSet.addParameter<int>("maxNbrOfIterations", 100); //10
44  return pSet;
45 }
46 
48  const std::vector<RefCountedKinematicParticle> &particles) const {
49  typedef ReferenceCountingPointer<VertexTrack<6> > RefCountedVertexTrack;
50  //sorting the input
51  if (particles.size() < 2)
52  throw VertexException("KinematicParticleVertexFitter::input states are less than 2");
53  InputSort iSort;
54  std::pair<std::vector<RefCountedKinematicParticle>, std::vector<FreeTrajectoryState> > input = iSort.sort(particles);
55  std::vector<RefCountedKinematicParticle> &newPart = input.first;
56  std::vector<FreeTrajectoryState> &freeStates = input.second;
57 
58  GlobalPoint linPoint = pointFinder->getLinearizationPoint(freeStates);
59 
60  // cout<<"Linearization point found"<<endl;
61 
62  //making initial veretx seed with lin point as position and a fake error
64  we(0, 0) = we(1, 1) = we(2, 2) = 10000.;
65  GlobalError error(we);
66  VertexState state(linPoint, error);
67 
68  //vector of Vertex Tracks to fit
69  std::vector<RefCountedVertexTrack> ttf;
71  for (auto const &i : newPart) {
72  if (!(i)->currentState().isValid() || !propagator_.willPropagateToTheTransversePCA((i)->currentState(), linPoint)) {
73  // std::cout << "Here's the bad state." << std::endl;
74  return ReferenceCountingPointer<KinematicTree>(new KinematicTree()); // return invalid vertex
75  }
76  ttf.push_back(vFactory->vertexTrack((i)->particleLinearizedTrackState(linPoint), state, 1.));
77  }
78 
79  // //debugging code to check neutrals:
80  // for(std::vector<RefCountedVertexTrack>::const_iterator i = ttf.begin(); i!=ttf.end(); i++)
81  // {
82  // // cout<<"predicted state momentum error"<<(*i)->linearizedTrack()->predictedStateMomentumError()<<endl;
83  // // cout<<"Momentum jacobian"<<(*i)->linearizedTrack()->momentumJacobian() <<endl;
84  // // cout<<"predicted state momentum "<<(*i)->linearizedTrack()->predictedStateMomentum()<<endl;
85  // // cout<<"constant term"<<(*i)->linearizedTrack()->constantTerm()<<endl;
86  //
87  // }
88 
90  if (!vtx.isValid()) {
91  LogDebug("RecoVertex/KinematicParticleVertexFitter") << "Fitted position is invalid. Returned Tree is invalid\n";
92  return ReferenceCountingPointer<KinematicTree>(new KinematicTree()); // return invalid vertex
93  }
94  FinalTreeBuilder tBuilder;
95  return tBuilder.buildTree(vtx, newPart);
96 }
KalmanVertexUpdator
Definition: KalmanVertexUpdator.h:13
AlgebraicSymMatrix33
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
Definition: AlgebraicROOTObjects.h:21
mps_fire.i
i
Definition: mps_fire.py:428
input
static const std::string input
Definition: EdmProvDump.cc:48
MessageLogger.h
InputSort
Definition: InputSort.h:14
KalmanVertexTrackUpdator
Definition: KalmanVertexTrackUpdator.h:17
VertexException
Common base class.
Definition: VertexException.h:12
CachingVertex
Definition: CachingVertex.h:22
KinematicParticleVertexFitter::~KinematicParticleVertexFitter
~KinematicParticleVertexFitter()
Definition: KinematicParticleVertexFitter.cc:34
KinematicTree
Definition: KinematicTree.h:36
TrackKinematicStatePropagator::willPropagateToTheTransversePCA
bool willPropagateToTheTransversePCA(const KinematicState &state, const GlobalPoint &point) const override
Definition: TrackKinematicStatePropagator.cc:53
ReferenceCountingPointer< KinematicTree >
KalmanTrackToTrackCovCalculator.h
relativeConstraints.error
error
Definition: relativeConstraints.py:53
KinematicParticleVertexFitter.h
ecalTrigSettings_cff.particles
particles
Definition: ecalTrigSettings_cff.py:11
SequentialVertexSmoother
Definition: SequentialVertexSmoother.h:15
TrackKinematicStatePropagator
Definition: TrackKinematicStatePropagator.h:17
KalmanTrackToTrackCovCalculator
Definition: KalmanTrackToTrackCovCalculator.h:13
DefaultLinearizationPointFinder.h
KalmanSmoothedVertexChi2Estimator
Definition: KalmanSmoothedVertexChi2Estimator.h:14
SequentialVertexFitter
Definition: SequentialVertexFitter.h:34
SequentialVertexSmoother.h
Point3DBase< float, GlobalTag >
sistrip::SpyUtilities::isValid
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
Definition: SiStripSpyUtilities.cc:124
KinematicParticleVertexFitter::KinematicParticleVertexFitter
KinematicParticleVertexFitter()
Definition: KinematicParticleVertexFitter.cc:15
KinematicParticleVertexFitter::fit
RefCountedKinematicTree fit(const std::vector< RefCountedKinematicParticle > &particles) const
Definition: KinematicParticleVertexFitter.cc:47
FinalTreeBuilder.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::ParameterSet
Definition: ParameterSet.h:47
VertexFitter::vertex
virtual CachingVertex< N > vertex(const std::vector< reco::TransientTrack > &tracks) const =0
VertexTrackFactory< 6 >
ParticleKinematicLinearizedTrackStateFactory
Definition: ParticleKinematicLinearizedTrackStateFactory.h:9
edm::ParameterSet::addParameter
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:135
FinalTreeBuilder
Definition: FinalTreeBuilder.h:16
KalmanVertexTrackUpdator.h
KalmanVertexUpdator.h
GlobalErrorBase< double, ErrorMatrixTag >
DefaultLinearizationPointFinder
Definition: DefaultLinearizationPointFinder.h:13
SequentialVertexFitter.h
KinematicParticleVertexFitter::vFactory
VertexTrackFactory< 6 > * vFactory
Definition: KinematicParticleVertexFitter.h:60
VertexTrackFactory::vertexTrack
RefCountedVertexTrack vertexTrack(const RefCountedLinearizedTrackState lt, const VertexState vs, float weight=1.0) const
Definition: VertexTrackFactory.h:27
Migration.h
KinematicParticleVertexFitter::pointFinder
LinearizationPointFinder * pointFinder
Definition: KinematicParticleVertexFitter.h:59
InputSort::sort
std::pair< std::vector< RefCountedKinematicParticle >, std::vector< FreeTrajectoryState > > sort(const std::vector< RefCountedKinematicParticle > &particles) const
Definition: InputSort.cc:5
RunInfoPI::state
state
Definition: RunInfoPayloadInspectoHelper.h:16
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:18
VertexState
Definition: VertexState.h:13
KinematicParticleVertexFitter::defaultParameters
edm::ParameterSet defaultParameters() const
Definition: KinematicParticleVertexFitter.cc:40
LinearizationPointFinder::getLinearizationPoint
virtual GlobalPoint getLinearizationPoint(const std::vector< reco::TransientTrack > &) const =0
KinematicParticleVertexFitter::setup
void setup(const edm::ParameterSet &pSet)
Definition: KinematicParticleVertexFitter.cc:22
VertexException.h
FinalTreeBuilder::buildTree
RefCountedKinematicTree buildTree(const CachingVertex< 6 > &vtx, const std::vector< RefCountedKinematicParticle > &input) const
Definition: FinalTreeBuilder.cc:19
KinematicParticleVertexFitter::fitter
VertexFitter< 6 > * fitter
Definition: KinematicParticleVertexFitter.h:58
KalmanSmoothedVertexChi2Estimator.h