CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BeamSpot.h
Go to the documentation of this file.
1 #ifndef BeamSpot_BeamSpot_h
2 #define BeamSpot_BeamSpot_h
3 
13 #include <Rtypes.h>
16 #include <string>
17 #include <sstream>
18 
19 
20 namespace reco {
21 
22  class BeamSpot {
23  public:
24 
26  enum BeamType { Unknown=-1, Fake=0, LHC=1, Tracker=2 };
27 
30  enum { dimension = 7 };
32  enum { dim3 = 3 };
34  enum { resdim = 2 };
36 
38  BeamSpot();
39 
41  BeamSpot( const Point &point,
42  double sigmaZ,
43  double dxdz,
44  double dydz,
45  double BeamWidthX,
46  const CovarianceMatrix &error,
47  BeamType type = Unknown) {
48  position_ = point;
49  sigmaZ_ = sigmaZ;
50  dxdz_ = dxdz;
51  dydz_ = dydz;
54  error_ = error;
55  type_ = type;
57  betaStar_ = 0;
58  };
59 
60 
62  const Point & position() const { return position_; }
64  double x0() const { return position_.X(); }
66  double y0() const { return position_.Y(); }
68  double z0() const { return position_.Z(); }
69 
71  double x(const double z) const { return x0() + dxdz() * (z - z0()); }
73  double y(const double z) const { return y0() + dydz() * (z - z0()); }
75  const Point position(const double z) const;
76  // const Point position(const double z) const {Point pos(x(z),y(z),z); return pos;}
77 
78 
80  double sigmaZ() const { return sigmaZ_; }
82  double dxdz() const { return dxdz_; }
84  double dydz() const { return dydz_; }
86  double BeamWidthX() const { return BeamWidthX_; }
88  double BeamWidthY() const { return BeamWidthY_; }
90  double x0Error() const { return sqrt( error_(0,0) ); }
92  double y0Error() const { return sqrt( error_(1,1) ); }
94  double z0Error() const { return sqrt( error_(2,2) ); }
96  double sigmaZ0Error() const { return sqrt ( error_(3,3) ); }
98  double dxdzError() const { return sqrt ( error_(4,4) ); }
100  double dydzError() const { return sqrt ( error_(5,5) ); }
101 
103  double BeamWidthXError() const { return sqrt ( error_(6,6) );}
105  double BeamWidthYError() const { return sqrt ( error_(6,6) );}
106 
108  void setBeamWidthX( double v ) { BeamWidthX_ = v; }
109  void setBeamWidthY( double v ) { BeamWidthY_ = v; }
110 
112  double covariance( int i, int j) const {
113  return error_(i,j);
114  }
116  CovarianceMatrix covariance() const { return error_; }
119 
121  for (int j=0; j<3; j++) {
122  for (int k=j; k<3; k++) {
123  matrix(j,k) = error_(j,k);
124  }
125  }
126  return matrix;
127  };
129  BeamType type() const { return type_; }
131  void setType( BeamType type ) { type_ = type; }
134 
136  double emittanceX() const { return emittanceX_; }
137  double emittanceY() const { return emittanceY_; }
138  double betaStar() const { return betaStar_; }
139  double beamWidthFromBeta( double z, double e ) const {
140  return sqrt( e*betaStar_*(1 + pow((z-position_.Z())/betaStar_,2) ) );
141  }
143  void setEmittanceX( double v ) { emittanceX_ = v; }
144  void setEmittanceY( double v ) { emittanceY_ = v; }
145  void setbetaStar( double v ) { betaStar_ = v; }
146 
148  void print( std::stringstream& ss ) const;
149 
150  private:
155 
156  Double32_t sigmaZ_;
157  Double32_t BeamWidthX_;
158  Double32_t BeamWidthY_;
159  Double32_t dxdz_;
160  Double32_t dydz_;
161  Double32_t emittanceX_;
162  Double32_t emittanceY_;
163  Double32_t betaStar_;
164 
166 
167  };
169  std::ostream& operator<< ( std::ostream&, BeamSpot beam );
170 
171 }
172 
173 #endif
type
Definition: HCALResponse.h:21
math::Error< dimension >::type CovarianceMatrix
Definition: BeamSpot.h:31
double z0() const
z coordinate
Definition: BeamSpot.h:68
BeamType
beam spot flags
Definition: BeamSpot.h:26
int i
Definition: DBlmapReader.cc:9
double sigmaZ0Error() const
error on sigma z
Definition: BeamSpot.h:96
Covariance3DMatrix covariance3D() const
return only 3D position covariance matrix
Definition: BeamSpot.h:118
math::Error< dim3 >::type Covariance3DMatrix
Definition: BeamSpot.h:33
void setbetaStar(double v)
Definition: BeamSpot.h:145
Double32_t dxdz_
Definition: BeamSpot.h:159
double dydzError() const
error on dydz
Definition: BeamSpot.h:100
BeamSpot()
default constructor
Definition: BeamSpot.cc:24
Double32_t emittanceX_
Definition: BeamSpot.h:161
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:29
ErrorD< N >::type type
Definition: Error.h:29
CovarianceMatrix covariance() const
return full covariance matrix of dim 7
Definition: BeamSpot.h:116
CovarianceMatrix error_
errors
Definition: BeamSpot.h:154
double beamWidthFromBeta(double z, double e) const
Definition: BeamSpot.h:139
float float float z
double emittanceX() const
additional information
Definition: BeamSpot.h:136
void setType(BeamType type)
set beam type
Definition: BeamSpot.h:131
double betaStar() const
Definition: BeamSpot.h:138
Double32_t BeamWidthX_
Definition: BeamSpot.h:157
double dydz() const
dydz slope
Definition: BeamSpot.h:84
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:71
void setBeamWidthY(double v)
Definition: BeamSpot.h:109
double emittanceY() const
Definition: BeamSpot.h:137
double dxdzError() const
error on dxdz
Definition: BeamSpot.h:98
Point position_
position
Definition: BeamSpot.h:152
void setEmittanceY(double v)
Definition: BeamSpot.h:144
T sqrt(T t)
Definition: SSEVec.h:48
math::XYZPoint Point
Double32_t emittanceY_
Definition: BeamSpot.h:162
int j
Definition: DBlmapReader.cc:9
double BeamWidthX() const
beam width X
Definition: BeamSpot.h:86
double BeamWidthYError() const
error on beam width Y, assume error in X = Y
Definition: BeamSpot.h:105
BeamSpot(const Point &point, double sigmaZ, double dxdz, double dydz, double BeamWidthX, const CovarianceMatrix &error, BeamType type=Unknown)
constructor from values
Definition: BeamSpot.h:41
double BeamWidthXError() const
error on beam width X, assume error in X = Y
Definition: BeamSpot.h:103
double z0Error() const
error on z
Definition: BeamSpot.h:94
double dxdz() const
dxdz slope
Definition: BeamSpot.h:82
double x0Error() const
error on x
Definition: BeamSpot.h:90
int k[5][pyjets_maxn]
double y0Error() const
error on y
Definition: BeamSpot.h:92
void print(std::stringstream &ss) const
print information
Definition: BeamSpot.cc:50
double x(const double z) const
x coordinate of the beeam spot position at a given z value (it takes into account the dxdz slope) ...
Definition: BeamSpot.h:71
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
double sigmaZ() const
sigma z
Definition: BeamSpot.h:80
double BeamWidthY() const
beam width Y
Definition: BeamSpot.h:88
double covariance(int i, int j) const
(i,j)-th element of error matrix
Definition: BeamSpot.h:112
void setBeamWidthX(double v)
Definition: BeamSpot.h:108
double y(const double z) const
y coordinate of the beeam spot position at a given z value (it takes into account the dydz slope) ...
Definition: BeamSpot.h:73
Double32_t BeamWidthY_
Definition: BeamSpot.h:158
double y0() const
y coordinate
Definition: BeamSpot.h:66
math::Error< resdim >::type ResCovMatrix
Definition: BeamSpot.h:35
const Point & position() const
position
Definition: BeamSpot.h:62
BeamType type_
Definition: BeamSpot.h:165
Covariance3DMatrix rotatedCovariance3D() const
Definition: BeamSpot.cc:78
void setEmittanceX(double v)
Definition: BeamSpot.h:143
Double32_t betaStar_
Definition: BeamSpot.h:163
Double32_t sigmaZ_
Definition: BeamSpot.h:156
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
BeamType type() const
return beam type
Definition: BeamSpot.h:129
double x0() const
x coordinate
Definition: BeamSpot.h:64
Double32_t dydz_
Definition: BeamSpot.h:160