00001 #ifndef BeamSpot_BeamSpot_h 00002 #define BeamSpot_BeamSpot_h 00003 00014 #include <Rtypes.h> 00015 #include "DataFormats/Math/interface/Error.h" 00016 #include "DataFormats/Math/interface/Point3D.h" 00017 #include <string> 00018 #include <sstream> 00019 00020 00021 namespace reco { 00022 00023 class BeamSpot { 00024 public: 00026 typedef math::XYZPoint Point; 00027 enum { dimension = 7 }; 00028 typedef math::Error<dimension>::type CovarianceMatrix; 00029 enum { dim3 = 3 }; 00030 typedef math::Error<dim3>::type Covariance3DMatrix; 00031 enum { resdim = 2 }; 00032 typedef math::Error<resdim>::type ResCovMatrix; 00033 00035 BeamSpot(); 00036 00038 BeamSpot( const Point &point, 00039 double sigmaZ, 00040 double dxdz, 00041 double dydz, 00042 double BeamWidth, 00043 const CovarianceMatrix &error) { 00044 position_ = point; 00045 sigmaZ_ = sigmaZ; 00046 dxdz_ = dxdz; 00047 dydz_ = dydz; 00048 BeamWidth_ = BeamWidth; 00049 error_ = error; 00050 }; 00051 00053 void dummy(); 00055 const Point & position() const { return position_; } 00057 double x0() const { return position_.X(); } 00059 double y0() const { return position_.Y(); } 00061 double z0() const { return position_.Z(); } 00063 double sigmaZ() const { return sigmaZ_; } 00065 double dxdz() const { return dxdz_; } 00067 double dydz() const { return dydz_; } 00069 double BeamWidth() const { return BeamWidth_; } 00071 double x0Error() const { return sqrt( error_(0,0) ); } 00073 double y0Error() const { return sqrt( error_(1,1) ); } 00075 double z0Error() const { return sqrt( error_(2,2) ); } 00077 double sigmaZ0Error() const { return sqrt ( error_(3,3) ); } 00079 double dxdzError() const { return sqrt ( error_(4,4) ); } 00081 double dydzError() const { return sqrt ( error_(5,5) ); } 00082 00084 double BeamWidthError() const { return sqrt ( error_(6,6) );} 00086 double covariance( int i, int j) const { 00087 return error_(i,j); 00088 } 00090 CovarianceMatrix covariance() const { return error_; } 00092 Covariance3DMatrix covariance3D() const { 00093 00094 Covariance3DMatrix matrix; 00095 for (int j=0; j<3; j++) { 00096 for (int k=j; k<3; k++) { 00097 matrix(j,k) = error_(j,k); 00098 } 00099 } 00100 return matrix; 00101 }; 00102 00103 Covariance3DMatrix rotatedCovariance3D() const; 00104 00106 void print( std::stringstream& ss ) const; 00107 00108 private: 00110 Point position_; 00112 CovarianceMatrix error_; 00113 00114 Double32_t sigmaZ_; 00115 Double32_t BeamWidth_; 00116 Double32_t dxdz_; 00117 Double32_t dydz_; 00118 00119 00120 }; 00122 std::ostream& operator<< ( std::ostream&, BeamSpot beam ); 00123 00124 } 00125 00126 #endif