Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:28:23

0001 #ifndef RecoVertex_VertexPrimitives_VertexState_H
0002 #define RecoVertex_VertexPrimitives_VertexState_H
0003 
0004 #include "RecoVertex/VertexPrimitives/interface/BasicVertexState.h"
0005 #include "RecoVertex/VertexPrimitives/interface/BasicSingleVertexState.h"
0006 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
0007 #include <vector>
0008 
0009 /** Class containing a measurement of a vertex. Some data is calculated
0010  * on demand to improve performance.
0011  */
0012 
0013 class VertexState final : private BasicVertexState::Proxy {
0014   using Base = BasicVertexState::Proxy;
0015   using BSVS = BasicSingleVertexState;
0016 
0017 public:
0018   VertexState() {}
0019   VertexState(VertexState const&) = default;
0020   VertexState(VertexState&&) = default;
0021   VertexState& operator=(const VertexState&) = default;
0022   VertexState& operator=(VertexState&&) = default;
0023 
0024   // template<typename... Args>
0025   //  VertexState(Args && ...args) :
0026   //  Base ( new BSVS ( std::forward<Args>(args)...)){}
0027 
0028   explicit VertexState(BasicVertexState* p) : Base(p) {}
0029 
0030   explicit VertexState(const reco::BeamSpot& beamSpot)
0031       : Base(new BSVS(
0032             GlobalPoint(Basic3DVector<float>(beamSpot.position())), GlobalError(beamSpot.rotatedCovariance3D()), 1.0)) {
0033   }
0034 
0035   VertexState(const GlobalPoint& pos, const GlobalError& posErr, const double& weightInMix = 1.0)
0036       : Base(new BSVS(pos, posErr, weightInMix)) {}
0037 
0038   VertexState(const GlobalPoint& pos, const GlobalWeight& posWeight, const double& weightInMix = 1.0)
0039       : Base(new BSVS(pos, posWeight, weightInMix)) {}
0040 
0041   VertexState(const AlgebraicVector3& weightTimesPosition,
0042               const GlobalWeight& posWeight,
0043               const double& weightInMix = 1.0)
0044       : Base(new BSVS(weightTimesPosition, posWeight, weightInMix)) {}
0045 
0046   // with time
0047   VertexState(const GlobalPoint& pos, const double time, const GlobalError& posTimeErr, const double& weightInMix = 1.0)
0048       : Base(new BSVS(pos, time, posTimeErr, weightInMix)) {}
0049 
0050   VertexState(const GlobalPoint& pos,
0051               const double time,
0052               const GlobalWeight& posTimeWeight,
0053               const double& weightInMix = 1.0)
0054       : Base(new BSVS(pos, time, posTimeWeight, weightInMix)) {}
0055 
0056   VertexState(const AlgebraicVector4& weightTimesPosition,
0057               const GlobalWeight& posTimeWeight,
0058               const double& weightInMix = 1.0)
0059       : Base(new BSVS(weightTimesPosition, posTimeWeight, weightInMix)) {}
0060 
0061   //3D covariance matrices (backwards compatible)
0062   GlobalPoint position() const { return data().position(); }
0063 
0064   GlobalError error() const { return data().error(); }
0065 
0066   // with time, full cov
0067   GlobalError error4D() const { return data().error4D(); }
0068 
0069   GlobalWeight weight() const { return data().weight(); }
0070 
0071   GlobalWeight weight4D() const { return data().weight4D(); }
0072 
0073   double time() const { return data().time(); }
0074 
0075   double timeError() const { return data().timeError(); }
0076 
0077   AlgebraicVector3 weightTimesPosition() const { return data().weightTimesPosition(); }
0078 
0079   AlgebraicVector4 weightTimesPosition4D() const { return data().weightTimesPosition4D(); }
0080 
0081   double weightInMixture() const { return data().weightInMixture(); }
0082 
0083   /** conversion to VertexSeed
0084    */
0085   //   RefCountedVertexSeed seedWithoutTracks() const
0086   //   {
0087   //     return data().seedWithoutTracks();
0088   //   }
0089 
0090   std::vector<VertexState> components() const { return data().components(); }
0091 
0092   /// Make the ReferenceCountingProxy method to check validity public
0093   bool isValid() const { return Base::isValid() && data().isValid(); }
0094 
0095   bool is4D() const { return data().is4D(); }
0096 };
0097 
0098 #endif