Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef KinematicState_H
0002 #define KinematicState_H
0003 
0004 #include "RecoVertex/KinematicFitPrimitives/interface/KinematicParameters.h"
0005 #include "RecoVertex/KinematicFitPrimitives/interface/KinematicParametersError.h"
0006 #include "RecoVertex/KinematicFitPrimitives/interface/ParticleMass.h"
0007 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
0008 #include "MagneticField/Engine/interface/MagneticField.h"
0009 
0010 /**
0011  * Class  providing  a state of particle needed
0012  * for Kinematic Fit. 
0013  *
0014  * Kirill Prokofiev, March 2003
0015  */
0016 
0017 class KinematicState {
0018 public:
0019   /**
0020    * Default constructor for internal
0021    * KinematicFitPrimitives library needs
0022    * only
0023    */
0024   KinematicState() { vl = false; }
0025 
0026   /**
0027    * Constructor taking directly KinematicParameters
0028    * KinematicError and Charge. To be used with
0029    * proper KinematicStateBuilder.
0030    */
0031 
0032   KinematicState(const KinematicParameters& parameters,
0033                  const KinematicParametersError& error,
0034                  const TrackCharge& charge,
0035                  const MagneticField* field);
0036 
0037   KinematicState(const FreeTrajectoryState& state, const ParticleMass& mass, float m_sigma)
0038       : fts(state),
0039         param(state.position().x(),
0040               state.position().y(),
0041               state.position().z(),
0042               state.momentum().x(),
0043               state.momentum().y(),
0044               state.momentum().z(),
0045               mass),
0046         err(state.cartesianError(), m_sigma),
0047         vl(true) {}
0048 
0049   bool operator==(const KinematicState& other) const;
0050 
0051   /**
0052    * The mass of the particle
0053    */
0054   ParticleMass mass() const { return param.vector()[6]; }
0055 
0056   /**
0057  * Access methods to parameters
0058  * and private data
0059  */
0060 
0061   KinematicParameters const& kinematicParameters() const { return param; }
0062 
0063   KinematicParametersError const& kinematicParametersError() const { return err; }
0064 
0065   GlobalTrajectoryParameters const& trajectoryParameters() const { return fts.parameters(); }
0066 
0067   GlobalVector globalMomentum() const { return fts.momentum(); }
0068 
0069   GlobalPoint globalPosition() const { return fts.position(); }
0070 
0071   TrackCharge particleCharge() const { return fts.charge(); }
0072 
0073   /**
0074  * KinematicState -> FreeTrajectoryState 
0075  * converter
0076  */
0077   FreeTrajectoryState freeTrajectoryState() const { return fts; }
0078 
0079   bool isValid() const { return vl; }
0080 
0081   GlobalVector magneticFieldInInverseGeV(const GlobalPoint& x) const {
0082     return trajectoryParameters().magneticFieldInInverseGeV(x);
0083   }
0084   GlobalVector magneticFieldInInverseGeV() const { return trajectoryParameters().magneticFieldInInverseGeV(); }
0085 
0086   const MagneticField* magneticField() const { return &trajectoryParameters().magneticField(); }
0087 
0088 private:
0089   FreeTrajectoryState fts;
0090   KinematicParameters param;
0091   KinematicParametersError err;
0092 
0093   bool vl;
0094 };
0095 #endif