CMS 3D CMS Logo

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 namespace reco {
20 
21  class BeamSpot {
22  public:
24  enum BeamType { Unknown = -1, Fake = 0, LHC = 1, Tracker = 2 };
25 
28  enum { dimension = 7 };
30  enum { dim3 = 3 };
32  enum { resdim = 2 };
34 
36  BeamSpot();
37 
39  BeamSpot(const Point& point,
40  double sigmaZ,
41  double dxdz,
42  double dydz,
43  double BeamWidthX,
44  const CovarianceMatrix& error,
45  BeamType type = Unknown) {
46  position_ = point;
47  sigmaZ_ = sigmaZ;
48  dxdz_ = dxdz;
49  dydz_ = dydz;
52  error_ = error;
53  type_ = type;
55  betaStar_ = 0;
56  };
57 
59  const Point& position() const { return position_; }
61  double x0() const { return position_.X(); }
63  double y0() const { return position_.Y(); }
65  double z0() const { return position_.Z(); }
66 
68  double x(const double z) const { return x0() + dxdz() * (z - z0()); }
70  double y(const double z) const { return y0() + dydz() * (z - z0()); }
72  const Point position(const double z) const;
73  // const Point position(const double z) const {Point pos(x(z),y(z),z); return pos;}
74 
76  double sigmaZ() const { return sigmaZ_; }
78  double dxdz() const { return dxdz_; }
80  double dydz() const { return dydz_; }
82  double BeamWidthX() const { return BeamWidthX_; }
84  double BeamWidthY() const { return BeamWidthY_; }
86  double x0Error() const { return sqrt(error_(0, 0)); }
88  double y0Error() const { return sqrt(error_(1, 1)); }
90  double z0Error() const { return sqrt(error_(2, 2)); }
92  double sigmaZ0Error() const { return sqrt(error_(3, 3)); }
94  double dxdzError() const { return sqrt(error_(4, 4)); }
96  double dydzError() const { return sqrt(error_(5, 5)); }
97 
99  double BeamWidthXError() const { return sqrt(error_(6, 6)); }
101  double BeamWidthYError() const { return sqrt(error_(6, 6)); }
102 
104  void setBeamWidthX(double v) { BeamWidthX_ = v; }
105  void setBeamWidthY(double v) { BeamWidthY_ = v; }
106 
108  double covariance(int i, int j) const { return error_(i, j); }
110  CovarianceMatrix covariance() const { return error_; }
112  Covariance3DMatrix covariance3D() const {
113  Covariance3DMatrix matrix;
114  for (int j = 0; j < 3; j++) {
115  for (int k = j; k < 3; k++) {
116  matrix(j, k) = error_(j, k);
117  }
118  }
119  return matrix;
120  };
122  BeamType type() const { return type_; }
126  Covariance3DMatrix rotatedCovariance3D() const;
127 
129  double emittanceX() const { return emittanceX_; }
130  double emittanceY() const { return emittanceY_; }
131  double betaStar() const { return betaStar_; }
132  double beamWidthFromBeta(double z, double e) const {
133  return sqrt(e * betaStar_ * (1 + pow((z - position_.Z()) / betaStar_, 2)));
134  }
136  void setEmittanceX(double v) { emittanceX_ = v; }
137  void setEmittanceY(double v) { emittanceY_ = v; }
138  void setbetaStar(double v) { betaStar_ = v; }
139 
141  void print(std::stringstream& ss) const;
142 
143  private:
145  Point position_;
147  CovarianceMatrix error_;
148 
149  Double32_t sigmaZ_;
150  Double32_t BeamWidthX_;
151  Double32_t BeamWidthY_;
152  Double32_t dxdz_;
153  Double32_t dydz_;
154  Double32_t emittanceX_;
155  Double32_t emittanceY_;
156  Double32_t betaStar_;
157 
159  };
161  std::ostream& operator<<(std::ostream&, BeamSpot beam);
162 
163 } // namespace reco
164 
165 #endif
type
Definition: HCALResponse.h:21
math::Error< dimension >::type CovarianceMatrix
Definition: BeamSpot.h:29
double z0() const
z coordinate
Definition: BeamSpot.h:65
BeamType
beam spot flags
Definition: BeamSpot.h:24
double sigmaZ0Error() const
error on sigma z
Definition: BeamSpot.h:92
Covariance3DMatrix covariance3D() const
return only 3D position covariance matrix
Definition: BeamSpot.h:112
math::Error< dim3 >::type Covariance3DMatrix
Definition: BeamSpot.h:31
void setbetaStar(double v)
Definition: BeamSpot.h:138
Double32_t dxdz_
Definition: BeamSpot.h:152
double dydzError() const
error on dydz
Definition: BeamSpot.h:96
BeamSpot()
default constructor
Definition: BeamSpot.cc:23
Double32_t emittanceX_
Definition: BeamSpot.h:154
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:27
ErrorD< N >::type type
Definition: Error.h:32
CovarianceMatrix covariance() const
return full covariance matrix of dim 7
Definition: BeamSpot.h:110
CovarianceMatrix error_
errors
Definition: BeamSpot.h:147
double beamWidthFromBeta(double z, double e) const
Definition: BeamSpot.h:132
double emittanceX() const
additional information
Definition: BeamSpot.h:129
void setType(BeamType type)
set beam type
Definition: BeamSpot.h:124
double betaStar() const
Definition: BeamSpot.h:131
Double32_t BeamWidthX_
Definition: BeamSpot.h:150
double dydz() const
dydz slope
Definition: BeamSpot.h:80
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:66
void setBeamWidthY(double v)
Definition: BeamSpot.h:105
double emittanceY() const
Definition: BeamSpot.h:130
double dxdzError() const
error on dxdz
Definition: BeamSpot.h:94
Point position_
position
Definition: BeamSpot.h:145
void setEmittanceY(double v)
Definition: BeamSpot.h:137
T sqrt(T t)
Definition: SSEVec.h:19
Double32_t emittanceY_
Definition: BeamSpot.h:155
double BeamWidthX() const
beam width X
Definition: BeamSpot.h:82
double BeamWidthYError() const
error on beam width Y, assume error in X = Y
Definition: BeamSpot.h:101
BeamSpot(const Point &point, double sigmaZ, double dxdz, double dydz, double BeamWidthX, const CovarianceMatrix &error, BeamType type=Unknown)
constructor from values
Definition: BeamSpot.h:39
double BeamWidthXError() const
error on beam width X, assume error in X = Y
Definition: BeamSpot.h:99
double z0Error() const
error on z
Definition: BeamSpot.h:90
double dxdz() const
dxdz slope
Definition: BeamSpot.h:78
double x0Error() const
error on x
Definition: BeamSpot.h:86
double y0Error() const
error on y
Definition: BeamSpot.h:88
void print(std::stringstream &ss) const
print information
Definition: BeamSpot.cc:47
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:68
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
double sigmaZ() const
sigma z
Definition: BeamSpot.h:76
double BeamWidthY() const
beam width Y
Definition: BeamSpot.h:84
double covariance(int i, int j) const
(i,j)-th element of error matrix
Definition: BeamSpot.h:108
fixed size matrix
void setBeamWidthX(double v)
Definition: BeamSpot.h:104
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:70
Double32_t BeamWidthY_
Definition: BeamSpot.h:151
double y0() const
y coordinate
Definition: BeamSpot.h:63
math::Error< resdim >::type ResCovMatrix
Definition: BeamSpot.h:33
const Point & position() const
position
Definition: BeamSpot.h:59
BeamType type_
Definition: BeamSpot.h:158
Covariance3DMatrix rotatedCovariance3D() const
Definition: BeamSpot.cc:73
void setEmittanceX(double v)
Definition: BeamSpot.h:136
Double32_t betaStar_
Definition: BeamSpot.h:156
Double32_t sigmaZ_
Definition: BeamSpot.h:149
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
*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:122
double x0() const
x coordinate
Definition: BeamSpot.h:61
Double32_t dydz_
Definition: BeamSpot.h:153