CMS 3D CMS Logo

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() [1/2]

KinematicParticleVertexFitter::KinematicParticleVertexFitter ( )

Constructor with LMSLinearizationPointFinder used as default.

Definition at line 15 of file KinematicParticleVertexFitter.cc.

References defaultParameters(), and setup().

15  {
17  setup(pSet);
18 }
void setup(const edm::ParameterSet &pSet)

◆ KinematicParticleVertexFitter() [2/2]

KinematicParticleVertexFitter::KinematicParticleVertexFitter ( const edm::ParameterSet pSet)

Definition at line 20 of file KinematicParticleVertexFitter.cc.

References setup().

20 { setup(pSet); }
void setup(const edm::ParameterSet &pSet)

◆ ~KinematicParticleVertexFitter()

KinematicParticleVertexFitter::~KinematicParticleVertexFitter ( )

Definition at line 34 of file KinematicParticleVertexFitter.cc.

References fitter, pointFinder, and vFactory.

34  {
35  delete vFactory;
36  delete pointFinder;
37  delete fitter;
38 }

Member Function Documentation

◆ defaultParameters()

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

Definition at line 40 of file KinematicParticleVertexFitter.cc.

References edm::ParameterSet::addParameter().

Referenced by KinematicParticleVertexFitter().

40  {
41  edm::ParameterSet pSet;
42  pSet.addParameter<double>("maxDistance", 0.01);
43  pSet.addParameter<int>("maxNbrOfIterations", 100); //10
44  return pSet;
45 }
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:136

◆ fit()

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 47 of file KinematicParticleVertexFitter.cc.

References FinalTreeBuilder::buildTree(), relativeConstraints::error, fitter, LinearizationPointFinder::getLinearizationPoint(), mps_fire::i, input, sistrip::SpyUtilities::isValid(), LogDebug, ecalTrigSettings_cff::particles, pointFinder, InputSort::sort(), VertexFitter< N >::vertex(), VertexTrackFactory< N >::vertexTrack(), vFactory, L1BJetProducer_cff::vtx, and TrackKinematicStatePropagator::willPropagateToTheTransversePCA().

Referenced by KineExample::analyze(), and trackingPlots.Iteration::modules().

48  {
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 }
std::pair< std::vector< RefCountedKinematicParticle >, std::vector< FreeTrajectoryState > > sort(const std::vector< RefCountedKinematicParticle > &particles) const
Definition: InputSort.cc:5
bool willPropagateToTheTransversePCA(const KinematicState &state, const GlobalPoint &point) const override
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
Common base class.
RefCountedVertexTrack vertexTrack(const RefCountedLinearizedTrackState lt, const VertexState vs, float weight=1.0) const
static std::string const input
Definition: EdmProvDump.cc:50
virtual CachingVertex< N > vertex(const std::vector< reco::TransientTrack > &tracks) const =0
RefCountedKinematicTree buildTree(const CachingVertex< 6 > &vtx, const std::vector< RefCountedKinematicParticle > &input) const
virtual GlobalPoint getLinearizationPoint(const std::vector< reco::TransientTrack > &) const =0
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
#define LogDebug(id)

◆ setup()

void KinematicParticleVertexFitter::setup ( const edm::ParameterSet pSet)
private

Definition at line 22 of file KinematicParticleVertexFitter.cc.

References fitter, pointFinder, and vFactory.

Referenced by KinematicParticleVertexFitter().

Member Data Documentation

◆ fitter

VertexFitter<6>* KinematicParticleVertexFitter::fitter
private

Definition at line 58 of file KinematicParticleVertexFitter.h.

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

◆ pointFinder

LinearizationPointFinder* KinematicParticleVertexFitter::pointFinder
private

Definition at line 59 of file KinematicParticleVertexFitter.h.

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

◆ vFactory

VertexTrackFactory<6>* KinematicParticleVertexFitter::vFactory
private

Definition at line 60 of file KinematicParticleVertexFitter.h.

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