CMS 3D CMS Logo

BeamSpotOnlineObjects.cc
Go to the documentation of this file.
2 
3 #include <iostream>
4 
6  template <typename T>
7  const T& getParams(const std::vector<T>& params, size_t index) {
8  if (index >= params.size())
9  throw std::out_of_range("Parameter with index " + std::to_string(index) + " is out of range.");
10  return params[index];
11  }
12 
13  template <typename T>
14  T& accessParams(std::vector<T>& params, size_t index) {
15  if (index >= params.size())
16  throw std::out_of_range("Parameter with index " + std::to_string(index) + " is out of range.");
17  return params[index];
18  }
19 
20  template <typename T>
21  const T& getOneParam(const std::vector<std::vector<T> >& params, size_t index) {
22  if (index >= params.size())
23  throw std::out_of_range("Parameter with index " + std::to_string(index) + " is out of range.");
24  const std::vector<T>& inner = params[index];
25  if (inner.empty())
26  throw std::out_of_range("Parameter with index " + std::to_string(index) + " type=" + typeid(T).name() +
27  " has no value stored.");
28  return inner[0];
29  }
30 
31  template <typename T>
32  void setOneParam(std::vector<std::vector<T> >& params, size_t index, const T& value) {
33  if (index >= params.size())
34  throw std::out_of_range("Parameter with index " + std::to_string(index) + " is out of range.");
35  params[index] = std::vector<T>(1, value);
36  }
37 
38  template <typename T>
39  void setParams(std::vector<T>& params, size_t index, const T& value) {
40  if (index >= params.size())
41  throw std::out_of_range("Parameter with index " + std::to_string(index) + " is out of range.");
42  params[index] = value;
43  }
44 
45 } //namespace BeamSpotOnlineObjectsImpl
46 
47 // getters
49 
51 
54 }
55 
57 
59 
62 }
63 
65 
68 }
69 
72 }
73 
76 }
77 
80 }
81 
84 }
85 
88 }
89 
92 }
93 
94 // setters
96  setType(bs.beamType());
97  setPosition(bs.x(), bs.y(), bs.z());
98  setSigmaZ(bs.sigmaZ());
99  setdxdz(bs.dxdz());
100  setdydz(bs.dydz());
101  setBeamWidthX(bs.beamWidthX());
102  setBeamWidthY(bs.beamWidthY());
103  setBeamWidthXError(bs.beamWidthXError());
104  setBeamWidthYError(bs.beamWidthYError());
105  setEmittanceX(bs.emittanceX());
106  setEmittanceY(bs.emittanceY());
107  setBetaStar(bs.betaStar());
108 
109  for (int i = 0; i < 7; ++i) {
110  for (int j = 0; j < 7; ++j) {
111  setCovariance(i, j, bs.covariance(i, j));
112  }
113  }
114 }
115 
118 }
119 
121 
124 }
125 
128 }
129 
130 void BeamSpotOnlineObjects::setMeanPV(float meanPVs) {
132 }
133 
136 }
137 
140 }
141 
144 }
145 
148 }
149 
152 }
153 
156 }
157 
160 }
161 
164 }
165 
168 }
169 
170 // printers
171 void BeamSpotOnlineObjects::print(std::stringstream& ss) const {
172  ss << "-----------------------------------------------------\n"
173  << " BeamSpotOnline Data\n\n"
174  << " Beam type = " << beamType() << "\n"
175  << " X0 = " << x() << " +/- " << xError() << " [cm]\n"
176  << " Y0 = " << y() << " +/- " << yError() << " [cm]\n"
177  << " Z0 = " << z() << " +/- " << zError() << " [cm]\n"
178  << " Sigma Z0 = " << sigmaZ() << " +/- " << sigmaZError() << " [cm]\n"
179  << " dxdz = " << dxdz() << " +/- " << dxdzError() << " [radians]\n"
180  << " dydz = " << dydz() << " +/- " << dydzError() << " [radians]\n"
181  << " Beam Width X = " << beamWidthX() << " +/- " << beamWidthXError() << " [cm]\n"
182  << " Beam Width Y = " << beamWidthY() << " +/- " << beamWidthYError() << " [cm]\n"
183  << " Emittance X = " << emittanceX() << " [cm]\n"
184  << " Emittance Y = " << emittanceY() << " [cm]\n"
185  << " Beta star = " << betaStar() << " [cm]\n"
186  << " Last Lumi = " << lastAnalyzedLumi() << "\n"
187  << " Last Run = " << lastAnalyzedRun() << "\n"
188  << " Last Fill = " << lastAnalyzedFill() << "\n"
189  << "-----------------------------------------------------\n\n";
190 }
191 
192 std::ostream& operator<<(std::ostream& os, BeamSpotOnlineObjects beam) {
193  std::stringstream ss;
194  beam.print(ss);
195  os << ss.str();
196  return os;
197 }
double emittanceX() const
get emittance
void setBeamWidthYError(double val)
set beam width Y error
int lastAnalyzedLumi() const
Getters Methods.
double dxdzError() const
get dxdz slope, crossing angle in XZ Error
cond::Time_t creationTime() const
void setCovariance(int i, int j, double val)
set i,j element of the full covariance matrix 7x7
double z() const
get Z beam position
void setStartTimeStamp(cond::Time_t val)
double dydz() const
get dydz slope, crossing angle in YZ
void setEmittanceY(double val)
set emittance
void print(std::stringstream &ss) const
Print BeamSpotOnline parameters.
T & accessParams(std::vector< T > &params, size_t index)
void setBetaStar(double val)
set beta star
std::ostream & operator<<(std::ostream &os, BeamSpotOnlineObjects beam)
std::string endTime() const
void setEndTimeStamp(cond::Time_t val)
double beamWidthX() const
get average transverse beam width
std::string lumiRange() const
std::string startTime() const
int beamType() const
get beam type
std::vector< std::vector< int > > intParams_
const T & getOneParam(const std::vector< std::vector< T > > &params, size_t index)
static std::string to_string(const XMLCh *ch)
void setOneParam(std::vector< std::vector< T > > &params, size_t index, const T &value)
void setType(int type)
set beam type
void setEndTime(std::string val)
void setEmittanceX(double val)
set emittance
double beamWidthYError() const
get average transverse beam width error X = Y
unsigned long long Time_t
Definition: Time.h:14
void setdydz(double val)
set dydz slope, crossing angle in XZ
cond::Time_t endTimeStamp() const
double zError() const
get Z beam position Error
void copyFromBeamSpotObject(const BeamSpotObjects &bs)
Setters Methods.
double x() const
get X beam position
Definition: value.py:1
std::vector< std::vector< std::string > > stringParams_
void setdxdz(double val)
set dxdz slope, crossing angle
double beamWidthY() const
get average transverse beam width
double y() const
get Y beam position
std::vector< std::vector< unsigned long long > > timeParams_
double xError() const
get X beam position Error
cond::Time_t startTimeStamp() const
time_t endTimeStamp
void setBeamWidthXError(double val)
set beam width X error
void setSigmaZ(double val)
set sigma Z, RMS bunch length
void setLumiRange(std::string val)
double sigmaZ() const
get sigma Z, RMS bunch length
std::vector< std::vector< float > > floatParams_
double emittanceY() const
get emittance
double betaStar() const
get beta star
double dydzError() const
get dydz slope, crossing angle in YZ Error
double beamWidthXError() const
get average transverse beam width error ASSUME the same for X and Y
const T & getParams(const std::vector< T > &params, size_t index)
void setStartTime(std::string val)
void setPosition(double x, double y, double z)
set XYZ position
void setBeamWidthX(double val)
set average transverse beam width X
void setCreationTime(cond::Time_t val)
double sigmaZError() const
get sigma Z, RMS bunch length Error
double yError() const
get Y beam position Error
long double T
double dxdz() const
get dxdz slope, crossing angle in XZ
void setBeamWidthY(double val)
set average transverse beam width Y
void setParams(std::vector< T > &params, size_t index, const T &value)