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
97 }
98 
100 
103 }
104 
107 }
108 
109 void BeamSpotOnlineObjects::setMeanPV(float meanPVs) {
111 }
112 
115 }
116 
119 }
120 
123 }
124 
127 }
128 
131 }
132 
135 }
136 
139 }
140 
143 }
144 
147 }
148 
149 // printers
150 void BeamSpotOnlineObjects::print(std::stringstream& ss) const {
151  ss << "-----------------------------------------------------\n"
152  << " BeamSpotOnline Data\n\n"
153  << " Beam type = " << beamType() << "\n"
154  << " X0 = " << x() << " +/- " << xError() << " [cm]\n"
155  << " Y0 = " << y() << " +/- " << yError() << " [cm]\n"
156  << " Z0 = " << z() << " +/- " << zError() << " [cm]\n"
157  << " Sigma Z0 = " << sigmaZ() << " +/- " << sigmaZError() << " [cm]\n"
158  << " dxdz = " << dxdz() << " +/- " << dxdzError() << " [radians]\n"
159  << " dydz = " << dydz() << " +/- " << dydzError() << " [radians]\n"
160  << " Beam Width X = " << beamWidthX() << " +/- " << beamWidthXError() << " [cm]\n"
161  << " Beam Width Y = " << beamWidthY() << " +/- " << beamWidthYError() << " [cm]\n"
162  << " Emittance X = " << emittanceX() << " [cm]\n"
163  << " Emittance Y = " << emittanceY() << " [cm]\n"
164  << " Beta star = " << betaStar() << " [cm]\n"
165  << " Last Lumi = " << lastAnalyzedLumi() << "\n"
166  << " Last Run = " << lastAnalyzedRun() << "\n"
167  << " Last Fill = " << lastAnalyzedFill() << "\n"
168  << "-----------------------------------------------------\n\n";
169 }
170 
171 std::ostream& operator<<(std::ostream& os, BeamSpotOnlineObjects beam) {
172  std::stringstream ss;
173  beam.print(ss);
174  os << ss.str();
175  return os;
176 }
double emittanceX() const
get emittance
int lastAnalyzedLumi() const
Getters Methods.
double dxdzError() const
get dxdz slope, crossing angle in XZ Error
cond::Time_t creationTime() const
double z() const
get Z beam position
void setStartTimeStamp(cond::Time_t val)
double dydz() const
get dydz slope, crossing angle in YZ
void print(std::stringstream &ss) const
Print BeamSpotOnline parameters.
T & accessParams(std::vector< T > &params, size_t index)
std::ostream & operator<<(std::ostream &os, BeamSpotOnlineObjects beam)
std::string to_string(const V &value)
Definition: OMSAccess.h:71
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)
void setOneParam(std::vector< std::vector< T > > &params, size_t index, const T &value)
void setEndTime(std::string val)
string startTime
double beamWidthYError() const
get average transverse beam width error X = Y
unsigned long long Time_t
Definition: Time.h:14
cond::Time_t endTimeStamp() const
double zError() const
get Z beam position Error
double x() const
get X beam position
Definition: value.py:1
std::vector< std::vector< std::string > > stringParams_
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 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 setCreationTime(cond::Time_t val)
string lumiRange
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
string endTime
void setParams(std::vector< T > &params, size_t index, const T &value)