File indexing completed on 2024-04-06 12:01:56
0001 #ifndef BEAMSPOTOBJECTS_H
0002 #define BEAMSPOTOBJECTS_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #include "CondFormats/Serialization/interface/Serializable.h"
0015
0016 #include <cmath>
0017 #include <sstream>
0018 #include <cstring>
0019
0020 class BeamSpotObjects {
0021 public:
0022
0023 BeamSpotObjects() : sigmaZ_(0), beamwidthX_(0), beamwidthY_(0), dxdz_(0), dydz_(0), type_(-1) {
0024 beamwidthXError_ = 0;
0025 beamwidthYError_ = 0;
0026 emittanceX_ = 0;
0027 emittanceY_ = 0;
0028 betaStar_ = 0;
0029 std::memset(position_, 0, sizeof position_);
0030 std::memset(covariance_, 0, sizeof covariance_);
0031 }
0032
0033 virtual ~BeamSpotObjects() {}
0034
0035
0036 void setPosition(double x, double y, double z) {
0037 position_[0] = x;
0038 position_[1] = y;
0039 position_[2] = z;
0040 };
0041
0042 void setSigmaZ(double val) { sigmaZ_ = val; }
0043
0044 void setdxdz(double val) { dxdz_ = val; }
0045
0046 void setdydz(double val) { dydz_ = val; }
0047
0048 void setBeamWidthX(double val) { beamwidthX_ = val; }
0049
0050 void setBeamWidthY(double val) { beamwidthY_ = val; }
0051
0052 void setBeamWidthXError(double val) { beamwidthXError_ = val; }
0053
0054 void setBeamWidthYError(double val) { beamwidthYError_ = val; }
0055
0056 void setCovariance(int i, int j, double val) { covariance_[i][j] = val; }
0057
0058 void setType(int type) { type_ = type; }
0059
0060 void setEmittanceX(double val) { emittanceX_ = val; }
0061
0062 void setEmittanceY(double val) { emittanceY_ = val; }
0063
0064 void setBetaStar(double val) { betaStar_ = val; }
0065
0066
0067 double x() const { return position_[0]; }
0068
0069 double y() const { return position_[1]; }
0070
0071 double z() const { return position_[2]; }
0072
0073 double sigmaZ() const { return sigmaZ_; }
0074
0075 double beamWidthX() const { return beamwidthX_; }
0076
0077 double beamWidthY() const { return beamwidthY_; }
0078
0079 double dxdz() const { return dxdz_; }
0080
0081 double dydz() const { return dydz_; }
0082
0083 double covariance(int i, int j) const { return covariance_[i][j]; }
0084
0085 double xError() const { return sqrt(covariance_[0][0]); }
0086
0087 double yError() const { return sqrt(covariance_[1][1]); }
0088
0089 double zError() const { return sqrt(covariance_[2][2]); }
0090
0091 double sigmaZError() const { return sqrt(covariance_[3][3]); }
0092
0093 double beamWidthXError() const { return sqrt(covariance_[6][6]); }
0094
0095 double beamWidthYError() const { return sqrt(covariance_[6][6]); }
0096
0097 double dxdzError() const { return sqrt(covariance_[4][4]); }
0098
0099 double dydzError() const { return sqrt(covariance_[5][5]); }
0100
0101 int beamType() const { return type_; }
0102
0103 double emittanceX() const { return emittanceX_; }
0104
0105 double emittanceY() const { return emittanceY_; }
0106
0107 double betaStar() const { return betaStar_; }
0108
0109
0110 void print(std::stringstream& ss) const;
0111
0112 protected:
0113 double position_[3];
0114 double sigmaZ_;
0115 double beamwidthX_;
0116 double beamwidthY_;
0117 double beamwidthXError_;
0118 double beamwidthYError_;
0119 double dxdz_;
0120 double dydz_;
0121 double covariance_[7][7];
0122 int type_;
0123 double emittanceX_;
0124 double emittanceY_;
0125 double betaStar_;
0126
0127 COND_SERIALIZABLE;
0128 };
0129
0130 std::ostream& operator<<(std::ostream&, BeamSpotObjects beam);
0131
0132 #endif