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
50 }
51 
53 
56 }
57 
58 // setters
61 }
62 
64 
67 }
68 
69 // printers
70 void BeamSpotOnlineObjects::print(std::stringstream& ss) const {
71  ss << "-----------------------------------------------------\n"
72  << " BeamSpotOnline Data\n\n"
73  << " Beam type = " << GetBeamType() << "\n"
74  << " X0 = " << GetX() << " +/- " << GetXError() << " [cm]\n"
75  << " Y0 = " << GetY() << " +/- " << GetYError() << " [cm]\n"
76  << " Z0 = " << GetZ() << " +/- " << GetZError() << " [cm]\n"
77  << " Sigma Z0 = " << GetSigmaZ() << " +/- " << GetSigmaZError() << " [cm]\n"
78  << " dxdz = " << Getdxdz() << " +/- " << GetdxdzError() << " [radians]\n"
79  << " dydz = " << Getdydz() << " +/- " << GetdydzError() << " [radians]\n"
80  << " Beam Width X = " << GetBeamWidthX() << " +/- " << GetBeamWidthXError() << " [cm]\n"
81  << " Beam Width Y = " << GetBeamWidthY() << " +/- " << GetBeamWidthYError() << " [cm]\n"
82  << " Emittance X = " << GetEmittanceX() << " [cm]\n"
83  << " Emittance Y = " << GetEmittanceY() << " [cm]\n"
84  << " Beta star = " << GetBetaStar() << " [cm]\n"
85  << " Last Lumi = " << GetLastAnalyzedLumi() << "\n"
86  << " Last Run = " << GetLastAnalyzedRun() << "\n"
87  << " Last Fill = " << GetLastAnalyzedFill() << "\n"
88  << "-----------------------------------------------------\n\n";
89 }
90 
91 std::ostream& operator<<(std::ostream& os, BeamSpotOnlineObjects beam) {
92  std::stringstream ss;
93  beam.print(ss);
94  os << ss.str();
95  return os;
96 }
BeamSpotOnlineObjects::intParams_
std::vector< std::vector< int > > intParams_
Definition: BeamSpotOnlineObjects.h:87
BeamSpotObjects::GetBeamWidthY
double GetBeamWidthY() const
get average transverse beam width
Definition: BeamSpotObjects.h:77
BeamSpotObjects::Getdxdz
double Getdxdz() const
get dxdz slope, crossing angle in XZ
Definition: BeamSpotObjects.h:79
nTracks
const unsigned int nTracks(const reco::Vertex &sv)
Definition: TemplatedVertexArbitrator.h:44
BeamSpotOnlineObjectsImpl::setOneParam
void setOneParam(std::vector< std::vector< T > > &params, size_t index, const T &value)
Definition: BeamSpotOnlineObjects.cc:32
BeamSpotOnlineObjects::GetNumPVs
int GetNumPVs() const
Definition: BeamSpotOnlineObjects.cc:52
BeamSpotOnlineObjects::NUM_TRACKS
Definition: BeamSpotOnlineObjects.h:39
BeamSpotObjects::GetSigmaZError
double GetSigmaZError() const
get sigma Z, RMS bunch length Error
Definition: BeamSpotObjects.h:91
BeamSpotOnlineObjects::SetCreationTime
void SetCreationTime(cond::Time_t val)
Definition: BeamSpotOnlineObjects.cc:65
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
BeamSpotOnlineObjects::SetNumTracks
void SetNumTracks(int val)
Definition: BeamSpotOnlineObjects.cc:59
BeamSpotObjects::GetSigmaZ
double GetSigmaZ() const
get sigma Z, RMS bunch length
Definition: BeamSpotObjects.h:73
BeamSpotObjects::GetBeamType
int GetBeamType() const
get beam type
Definition: BeamSpotObjects.h:101
BeamSpotObjects::GetZ
double GetZ() const
get Z beam position
Definition: BeamSpotObjects.h:71
BeamSpotOnlineObjects::CREATE_TIME
Definition: BeamSpotOnlineObjects.h:40
operator<<
std::ostream & operator<<(std::ostream &os, BeamSpotOnlineObjects beam)
Definition: BeamSpotOnlineObjects.cc:91
BeamSpotOnlineObjectsImpl::accessParams
T & accessParams(std::vector< T > &params, size_t index)
Definition: BeamSpotOnlineObjects.cc:14
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
SurfaceOrientation::inner
Definition: Surface.h:19
EcalCondDBWriter_cfi.beam
beam
Definition: EcalCondDBWriter_cfi.py:45
BeamSpotOnlineObjects::GetLastAnalyzedLumi
int GetLastAnalyzedLumi() const
Getters Methods.
Definition: BeamSpotOnlineObjects.h:63
BeamSpotOnlineObjects::timeParams_
std::vector< std::vector< unsigned long long > > timeParams_
Definition: BeamSpotOnlineObjects.h:90
BeamSpotObjects::GetBetaStar
double GetBetaStar() const
get beta star
Definition: BeamSpotObjects.h:107
BeamSpotObjects::GetEmittanceX
double GetEmittanceX() const
get emittance
Definition: BeamSpotObjects.h:103
BeamSpotObjects::GetXError
double GetXError() const
get X beam position Error
Definition: BeamSpotObjects.h:85
BeamSpotObjects::GetY
double GetY() const
get Y beam position
Definition: BeamSpotObjects.h:69
BeamSpotOnlineObjects::GetCreationTime
cond::Time_t GetCreationTime() const
Definition: BeamSpotOnlineObjects.cc:54
cond::Time_t
unsigned long long Time_t
Definition: Time.h:14
BeamSpotOnlineObjects::GetNumTracks
int GetNumTracks() const
Definition: BeamSpotOnlineObjects.cc:48
BeamSpotOnlineObjectsImpl::setParams
void setParams(std::vector< T > &params, size_t index, const T &value)
Definition: BeamSpotOnlineObjects.cc:39
value
Definition: value.py:1
BeamSpotOnlineObjects::GetLastAnalyzedRun
int GetLastAnalyzedRun() const
Definition: BeamSpotOnlineObjects.h:66
BeamSpotObjects::GetBeamWidthX
double GetBeamWidthX() const
get average transverse beam width
Definition: BeamSpotObjects.h:75
BeamSpotObjects::GetYError
double GetYError() const
get Y beam position Error
Definition: BeamSpotObjects.h:87
BeamSpotObjects::GetEmittanceY
double GetEmittanceY() const
get emittance
Definition: BeamSpotObjects.h:105
BeamSpotObjects::Getdydz
double Getdydz() const
get dydz slope, crossing angle in YZ
Definition: BeamSpotObjects.h:81
T
long double T
Definition: Basic3DVectorLD.h:48
BeamSpotOnlineObjects
Definition: BeamSpotOnlineObjects.h:25
relativeConstraints.value
value
Definition: relativeConstraints.py:53
BeamSpotOnlineObjects::NUM_PVS
Definition: BeamSpotOnlineObjects.h:39
BeamSpotObjects::GetZError
double GetZError() const
get Z beam position Error
Definition: BeamSpotObjects.h:89
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
BeamSpotObjects::GetdydzError
double GetdydzError() const
get dydz slope, crossing angle in YZ Error
Definition: BeamSpotObjects.h:99
BeamSpotOnlineObjects.h
BeamSpotObjects::GetBeamWidthXError
double GetBeamWidthXError() const
get average transverse beam width error ASSUME the same for X and Y
Definition: BeamSpotObjects.h:93
BeamSpotOnlineObjectsImpl
Definition: BeamSpotOnlineObjects.cc:5
BeamSpotOnlineObjects::GetLastAnalyzedFill
int GetLastAnalyzedFill() const
Definition: BeamSpotOnlineObjects.h:69
BeamSpotObjects::GetBeamWidthYError
double GetBeamWidthYError() const
get average transverse beam width error X = Y
Definition: BeamSpotObjects.h:95
BeamSpotObjects::GetX
double GetX() const
get X beam position
Definition: BeamSpotObjects.h:67
BeamSpotOnlineObjects::print
void print(std::stringstream &ss) const
Print BeamSpotOnline parameters.
Definition: BeamSpotOnlineObjects.cc:70
BeamSpotOnlineObjectsImpl::getParams
const T & getParams(const std::vector< T > &params, size_t index)
Definition: BeamSpotOnlineObjects.cc:7
BeamSpotOnlineObjects::SetNumPVs
void SetNumPVs(int val)
Definition: BeamSpotOnlineObjects.cc:63
BeamSpotOnlineObjectsImpl::getOneParam
const T & getOneParam(const std::vector< std::vector< T > > &params, size_t index)
Definition: BeamSpotOnlineObjects.cc:21
BeamSpotObjects::GetdxdzError
double GetdxdzError() const
get dxdz slope, crossing angle in XZ Error
Definition: BeamSpotObjects.h:97