Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:12

0001 #ifndef KinematicParticle_H
0002 #define KinematicParticle_H
0003 
0004 #include "RecoVertex/KinematicFitPrimitives/interface/ParticleMass.h"
0005 #include "RecoVertex/KinematicFitPrimitives/interface/KinematicState.h"
0006 #include "RecoVertex/VertexPrimitives/interface/LinearizedTrackState.h"
0007 
0008 #include "DataFormats/GeometrySurface/interface/ReferenceCounted.h"
0009 
0010 /**
0011  * Abstract base class for KinematicParticles
0012  * created out of Physics objects of different types
0013  * Common access methods are implemented here.
0014  * All the virtual abstract methods should be 
0015  * implemented by user.
0016  */
0017 
0018 class KinematicConstraint;
0019 class KinematicTree;
0020 
0021 class KinematicParticle : public ReferenceCounted {
0022 public:
0023   typedef ReferenceCountingPointer<LinearizedTrackState<6> > RefCountedLinearizedTrackState;
0024 
0025   friend class KinematicParticleVertexFitter;
0026   friend class KinematicTree;
0027 
0028   /**
0029  * Default constructor: does not create
0030  * a valid particle. Method is needed for
0031  * debugging purposes only.
0032  */
0033   KinematicParticle() {}
0034 
0035   ~KinematicParticle() override;
0036 
0037   /**
0038  * Comparison by contents operators
0039  * Returns TRUE if initial PhysicsObjects
0040  * match(if they exist). If not, 
0041  * compares the initial KinematicStates
0042  * Retunes true if they match.
0043  * Should be implemented by user
0044  */
0045   virtual bool operator==(const KinematicParticle& other) const = 0;
0046 
0047   virtual bool operator==(const ReferenceCountingPointer<KinematicParticle>& other) const = 0;
0048 
0049   virtual bool operator!=(const KinematicParticle& other) const = 0;
0050 
0051   /**
0052  * Comparison by adress operator
0053  * Has NO physical meaning
0054  * To be used inside graph only
0055  */
0056   virtual bool operator<(const KinematicParticle& other) const;
0057 
0058   /**
0059  * Access to the kinematic state
0060  * with which particle was first created
0061  */
0062   virtual KinematicState initialState() const;
0063 
0064   /**
0065  * Access to the last calculated kinematic state
0066  */
0067   virtual KinematicState currentState() const;
0068 
0069   /**
0070  * Access to KinematicState of particle
0071  * at given point. The current state of particle 
0072  * does not change after this operation.
0073  */
0074   virtual KinematicState stateAtPoint(const GlobalPoint& point) const = 0;
0075 
0076   /**
0077  * Method producing new particle out of the current 
0078  * one and RefittedState obtained from kinematic fitting.
0079  * To be used by Fitter classes only. Method should be
0080  * implemented by used for every specific type of KinematicParticle
0081  */
0082   virtual ReferenceCountingPointer<KinematicParticle> refittedParticle(const KinematicState& state,
0083                                                                        float chi2,
0084                                                                        float ndf,
0085                                                                        KinematicConstraint* cons = nullptr) const = 0;
0086 
0087   /**
0088  * Method returning LinearizedTrackState of the particle needed for
0089  * Kalman flter vertex fit. Should be implemented by user.  For track(helix)-like
0090  * objects one can use the ParticleLinearizedTrackStateFactory class.
0091  */
0092   virtual RefCountedLinearizedTrackState particleLinearizedTrackState(const GlobalPoint& point) const = 0;
0093 
0094   /**
0095  * Returns last constraint aplied to
0096  * this particle.
0097  */
0098   virtual KinematicConstraint* lastConstraint() const;
0099 
0100   /**
0101  * Returns the state of Kinematic Particle before
0102  * last constraint was aplied
0103  */
0104   virtual ReferenceCountingPointer<KinematicParticle> previousParticle() const;
0105 
0106   /**
0107  * Returns the pointer to the kinematic
0108  * tree (if any) current particle belongs to
0109  * 0 pointer
0110  * returned in case  not any tree is built yet
0111  */
0112   virtual KinematicTree* correspondingTree() const;
0113 
0114   /**
0115  * Access metods for chi2 and
0116  * number of degrees of freedom
0117  */
0118   virtual float chiSquared() const;
0119 
0120   virtual float degreesOfFreedom() const;
0121 
0122   const MagneticField* magneticField() const { return theField; }
0123 
0124   reco::TransientTrack refittedTransientTrack() const;
0125 
0126 protected:
0127   virtual void setTreePointer(KinematicTree* tr) const;
0128 
0129   /**
0130  * Data members which should be initialized by user in 
0131  * derived classes
0132  */
0133 
0134   const MagneticField* theField;
0135 
0136   //pointer to the tree current
0137   //particle  belongs to
0138   mutable KinematicTree* tree;
0139 
0140   //last constraint applied
0141   mutable KinematicConstraint* lConstraint;
0142 
0143   //previous particle
0144   mutable ReferenceCountingPointer<KinematicParticle> pState;
0145 
0146   //initial kinematic state of
0147   //current particle
0148   KinematicState initState;
0149 
0150   //particle state at point
0151   mutable KinematicState cState;
0152 
0153   //chi2 and number of degrees of freedom
0154   float chi2;
0155 
0156   float ndf;
0157 };
0158 #endif