CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
BeamSpotOnlineObjects.cc
Go to the documentation of this file.
2 
3 #include <iostream>
4 
5 namespace BeamSpotOnlineObjectsImpl {
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 z() const
get Z beam position
void setStartTimeStamp(cond::Time_t val)
double yError() const
get Y beam position Error
double emittanceY() const
get emittance
double emittanceX() const
get emittance
double xError() const
get X beam position Error
std::string lumiRange() const
T & accessParams(std::vector< T > &params, size_t index)
double dydzError() const
get dydz slope, crossing angle in YZ Error
double beamWidthY() const
get average transverse beam width
std::string to_string(const V &value)
Definition: OMSAccess.h:71
double dxdzError() const
get dxdz slope, crossing angle in XZ Error
double y() const
get Y beam position
double dxdz() const
get dxdz slope, crossing angle in XZ
double zError() const
get Z beam position Error
void setEndTimeStamp(cond::Time_t val)
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
double beamWidthYError() const
get average transverse beam width error X = Y
cond::Time_t creationTime() const
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)
double sigmaZ() const
get sigma Z, RMS bunch length
unsigned long long Time_t
Definition: Time.h:14
cond::Time_t startTimeStamp() const
int lastAnalyzedLumi() const
Getters Methods.
double beamWidthX() const
get average transverse beam width
std::string startTime() const
cond::Time_t endTimeStamp() const
std::vector< std::vector< std::string > > stringParams_
double x() const
get X beam position
double sigmaZError() const
get sigma Z, RMS bunch length Error
double betaStar() const
get beta star
std::vector< std::vector< unsigned long long > > timeParams_
void setLumiRange(std::string val)
std::vector< std::vector< float > > floatParams_
double dydz() const
get dydz slope, crossing angle in YZ
int beamType() const
get beam type
const T & getParams(const std::vector< T > &params, size_t index)
void setStartTime(std::string val)
void print(std::stringstream &ss) const
Print BeamSpotOnline parameters.
void setCreationTime(cond::Time_t val)
long double T
double beamWidthXError() const
get average transverse beam width error ASSUME the same for X and Y
std::string endTime() const
void setParams(std::vector< T > &params, size_t index, const T &value)