Go to the documentation of this file.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:
00025
00027 enum BeamType { Unknown=-1, Fake=0, LHC=1, Tracker=2 };
00028
00030 typedef math::XYZPoint Point;
00031 enum { dimension = 7 };
00032 typedef math::Error<dimension>::type CovarianceMatrix;
00033 enum { dim3 = 3 };
00034 typedef math::Error<dim3>::type Covariance3DMatrix;
00035 enum { resdim = 2 };
00036 typedef math::Error<resdim>::type ResCovMatrix;
00037
00039 BeamSpot();
00040
00042 BeamSpot( const Point &point,
00043 double sigmaZ,
00044 double dxdz,
00045 double dydz,
00046 double BeamWidthX,
00047 const CovarianceMatrix &error,
00048 BeamType type = Unknown) {
00049 position_ = point;
00050 sigmaZ_ = sigmaZ;
00051 dxdz_ = dxdz;
00052 dydz_ = dydz;
00053 BeamWidthX_ = BeamWidthX;
00054 BeamWidthY_ = BeamWidthX;
00055 error_ = error;
00056 type_ = type;
00057 emittanceX_ = emittanceY_ = 0;
00058 betaStar_ = 0;
00059 };
00060
00061
00063 const Point & position() const { return position_; }
00065 double x0() const { return position_.X(); }
00067 double y0() const { return position_.Y(); }
00069 double z0() const { return position_.Z(); }
00070
00072 double x(const double z) const { return x0() + dxdz() * (z - z0()); }
00074 double y(const double z) const { return y0() + dydz() * (z - z0()); }
00076 const Point position(const double z) const;
00077
00078
00079
00081 double sigmaZ() const { return sigmaZ_; }
00083 double dxdz() const { return dxdz_; }
00085 double dydz() const { return dydz_; }
00087 double BeamWidthX() const { return BeamWidthX_; }
00089 double BeamWidthY() const { return BeamWidthY_; }
00091 double x0Error() const { return sqrt( error_(0,0) ); }
00093 double y0Error() const { return sqrt( error_(1,1) ); }
00095 double z0Error() const { return sqrt( error_(2,2) ); }
00097 double sigmaZ0Error() const { return sqrt ( error_(3,3) ); }
00099 double dxdzError() const { return sqrt ( error_(4,4) ); }
00101 double dydzError() const { return sqrt ( error_(5,5) ); }
00102
00104 double BeamWidthXError() const { return sqrt ( error_(6,6) );}
00106 double BeamWidthYError() const { return sqrt ( error_(6,6) );}
00107
00109 void setBeamWidthX( double v ) { BeamWidthX_ = v; }
00110 void setBeamWidthY( double v ) { BeamWidthY_ = v; }
00111
00113 double covariance( int i, int j) const {
00114 return error_(i,j);
00115 }
00117 CovarianceMatrix covariance() const { return error_; }
00119 Covariance3DMatrix covariance3D() const {
00120
00121 Covariance3DMatrix matrix;
00122 for (int j=0; j<3; j++) {
00123 for (int k=j; k<3; k++) {
00124 matrix(j,k) = error_(j,k);
00125 }
00126 }
00127 return matrix;
00128 };
00130 BeamType type() const { return type_; }
00132 void setType( BeamType type ) { type_ = type; }
00134 Covariance3DMatrix rotatedCovariance3D() const;
00135
00137 double emittanceX() const { return emittanceX_; }
00138 double emittanceY() const { return emittanceY_; }
00139 double betaStar() const { return betaStar_; }
00140 double beamWidthFromBeta( double z, double e ) const {
00141 return sqrt( e*betaStar_*(1 + pow((z-position_.Z())/betaStar_,2) ) );
00142 }
00144 void setEmittanceX( double v ) { emittanceX_ = v; }
00145 void setEmittanceY( double v ) { emittanceY_ = v; }
00146 void setbetaStar( double v ) { betaStar_ = v; }
00147
00149 void print( std::stringstream& ss ) const;
00150
00151 private:
00153 Point position_;
00155 CovarianceMatrix error_;
00156
00157 Double32_t sigmaZ_;
00158 Double32_t BeamWidthX_;
00159 Double32_t BeamWidthY_;
00160 Double32_t dxdz_;
00161 Double32_t dydz_;
00162 Double32_t emittanceX_;
00163 Double32_t emittanceY_;
00164 Double32_t betaStar_;
00165
00166 BeamType type_;
00167
00168 };
00170 std::ostream& operator<< ( std::ostream&, BeamSpot beam );
00171
00172 }
00173
00174 #endif