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
50 }
51 
53 
56 }
57 
59 
61 
64 }
65 
67 
70 }
71 
74 }
75 
78 }
79 
82 }
83 
86 }
87 
90 }
91 
94 }
95 
96 // setters
99 }
100 
102 
105 }
106 
109 }
110 
111 void BeamSpotOnlineObjects::SetMeanPV(float meanPVs) {
113 }
114 
117 }
118 
121 }
122 
125 }
126 
129 }
130 
133 }
134 
137 }
138 
141 }
142 
145 }
146 
149 }
150 
151 // printers
152 void BeamSpotOnlineObjects::print(std::stringstream& ss) const {
153  ss << "-----------------------------------------------------\n"
154  << " BeamSpotOnline Data\n\n"
155  << " Beam type = " << GetBeamType() << "\n"
156  << " X0 = " << GetX() << " +/- " << GetXError() << " [cm]\n"
157  << " Y0 = " << GetY() << " +/- " << GetYError() << " [cm]\n"
158  << " Z0 = " << GetZ() << " +/- " << GetZError() << " [cm]\n"
159  << " Sigma Z0 = " << GetSigmaZ() << " +/- " << GetSigmaZError() << " [cm]\n"
160  << " dxdz = " << Getdxdz() << " +/- " << GetdxdzError() << " [radians]\n"
161  << " dydz = " << Getdydz() << " +/- " << GetdydzError() << " [radians]\n"
162  << " Beam Width X = " << GetBeamWidthX() << " +/- " << GetBeamWidthXError() << " [cm]\n"
163  << " Beam Width Y = " << GetBeamWidthY() << " +/- " << GetBeamWidthYError() << " [cm]\n"
164  << " Emittance X = " << GetEmittanceX() << " [cm]\n"
165  << " Emittance Y = " << GetEmittanceY() << " [cm]\n"
166  << " Beta star = " << GetBetaStar() << " [cm]\n"
167  << " Last Lumi = " << GetLastAnalyzedLumi() << "\n"
168  << " Last Run = " << GetLastAnalyzedRun() << "\n"
169  << " Last Fill = " << GetLastAnalyzedFill() << "\n"
170  << "-----------------------------------------------------\n\n";
171 }
172 
173 std::ostream& operator<<(std::ostream& os, BeamSpotOnlineObjects beam) {
174  std::stringstream ss;
175  beam.print(ss);
176  os << ss.str();
177  return os;
178 }
double Getdydz() const
get dydz slope, crossing angle in YZ
std::string GetStartTime() const
double GetY() const
get Y beam position
T & accessParams(std::vector< T > &params, size_t index)
cond::Time_t GetCreationTime() const
std::string GetLumiRange() const
double GetSigmaZ() const
get sigma Z, RMS bunch length
cond::Time_t GetStartTimeStamp() const
double GetBeamWidthX() const
get average transverse beam width
int GetLastAnalyzedLumi() const
Getters Methods.
void SetEndTime(std::string val)
double GetYError() const
get Y beam position Error
double GetBeamWidthYError() const
get average transverse beam width error X = Y
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
double GetBeamWidthY() const
get average transverse beam width
std::vector< std::vector< int > > intParams_
std::string GetEndTime() const
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)
double GetEmittanceX() const
get emittance
unsigned long long Time_t
Definition: Time.h:14
void SetStartTimeStamp(cond::Time_t val)
int GetBeamType() const
get beam type
double GetdydzError() const
get dydz slope, crossing angle in YZ Error
double GetZ() const
get Z beam position
std::vector< std::vector< std::string > > stringParams_
double Getdxdz() const
get dxdz slope, crossing angle in XZ
void SetStartTime(std::string val)
double GetdxdzError() const
get dxdz slope, crossing angle in XZ Error
double GetBeamWidthXError() const
get average transverse beam width error ASSUME the same for X and Y
double GetSigmaZError() const
get sigma Z, RMS bunch length Error
std::vector< std::vector< unsigned long long > > timeParams_
double GetX() const
get X beam position
void SetLumiRange(std::string val)
double GetXError() const
get X beam position Error
double GetBetaStar() const
get beta star
std::vector< std::vector< float > > floatParams_
const T & getParams(const std::vector< T > &params, size_t index)
void SetEndTimeStamp(cond::Time_t val)
void print(std::stringstream &ss) const
Print BeamSpotOnline parameters.
double GetEmittanceY() const
get emittance
long double T
double GetZError() const
get Z beam position Error
cond::Time_t GetEndTimeStamp() const
void setParams(std::vector< T > &params, size_t index, const T &value)
void SetCreationTime(cond::Time_t val)