CMS 3D CMS Logo

LHCInfo.h
Go to the documentation of this file.
1 #ifndef CondFormats_RunInfo_LHCInfo_H
2 #define CondFormats_RunInfo_LHCInfo_H
3 
6 #include <bitset>
7 #include <iostream>
8 #include <string>
9 #include <sstream>
10 #include <vector>
11 
12 class LHCInfo {
13 public:
14  enum FillType { UNKNOWN = 0, PROTONS = 1, IONS = 2, COSMICS = 3, GAP = 4 };
15  enum ParticleType { NONE = 0, PROTON = 1, PB82 = 2, AR18 = 3, D = 4, XE54 = 5 };
16 
18  LHC_FILL = 0,
19  BUNCHES_1 = 1,
20  BUNCHES_2 = 2,
23  FILL_TYPE = 5,
27  ISIZE = 9
28  };
31  BETA_STAR = 1,
34  ENERGY = 4,
36  REC_LUMI = 7,
38  BEAM1_VC = 9,
39  BEAM2_VC = 10,
40  BEAM1_RF = 11,
41  BEAM2_RF = 12,
42  INST_LUMI = 13,
44  FSIZE = 15
45  };
46  enum TimeParamIndex { CREATE_TIME = 0, BEGIN_TIME = 1, END_TIME = 2, TSIZE = 3 };
48 
51  LHCInfo();
52  LHCInfo(const LHCInfo& rhs);
53  ~LHCInfo();
54 
55  LHCInfo* cloneFill() const;
56 
57  //constant static unsigned integer hosting the maximum number of LHC bunch slots
58  static size_t const bunchSlots = 3564;
59 
60  //constant static unsigned integer hosting the available number of LHC bunch slots
61  static size_t const availableBunchSlots = 2808;
62 
63  void setFillNumber(unsigned short lhcFill);
64 
65  //getters
66  unsigned short const fillNumber() const;
67 
68  unsigned short const bunchesInBeam1() const;
69 
70  unsigned short const bunchesInBeam2() const;
71 
72  unsigned short const collidingBunches() const;
73 
74  unsigned short const targetBunches() const;
75 
76  FillTypeId const fillType() const;
77 
78  ParticleTypeId const particleTypeForBeam1() const;
79 
80  ParticleTypeId const particleTypeForBeam2() const;
81 
82  float const crossingAngle() const;
83 
84  float const betaStar() const;
85 
86  float const intensityForBeam1() const;
87 
88  float const intensityForBeam2() const;
89 
90  float const energy() const;
91 
92  float const delivLumi() const;
93 
94  float const recLumi() const;
95 
96  float const instLumi() const;
97 
98  float const instLumiError() const;
99 
100  cond::Time_t const createTime() const;
101 
102  cond::Time_t const beginTime() const;
103 
104  cond::Time_t const endTime() const;
105 
106  std::string const& injectionScheme() const;
107 
108  std::vector<float> const& lumiPerBX() const;
109 
110  std::string const& lhcState() const;
111 
112  std::string const& lhcComment() const;
113 
114  std::string const& ctppsStatus() const;
115 
116  unsigned int const& lumiSection() const;
117 
118  std::vector<float> const& beam1VC() const;
119 
120  std::vector<float> const& beam2VC() const;
121 
122  std::vector<float> const& beam1RF() const;
123 
124  std::vector<float> const& beam2RF() const;
125 
126  std::vector<float>& beam1VC();
127 
128  std::vector<float>& beam2VC();
129 
130  std::vector<float>& beam1RF();
131 
132  std::vector<float>& beam2RF();
133 
134  //returns a boolean, true if the injection scheme has a leading 25ns
135  //TODO: parse the circulating bunch configuration, instead of the string.
136  bool is25nsBunchSpacing() const;
137 
138  //returns a boolean, true if the bunch slot number is in the circulating bunch configuration
139  bool isBunchInBeam1(size_t const& bunch) const;
140 
141  bool isBunchInBeam2(size_t const& bunch) const;
142 
143  //member functions returning *by value* a vector with all filled bunch slots
144  std::vector<unsigned short> bunchConfigurationForBeam1() const;
145 
146  std::vector<unsigned short> bunchConfigurationForBeam2() const;
147 
148  //setters
149  void setBunchesInBeam1(unsigned short const& bunches);
150 
151  void setBunchesInBeam2(unsigned short const& bunches);
152 
153  void setCollidingBunches(unsigned short const& collidingBunches);
154 
155  void setTargetBunches(unsigned short const& targetBunches);
156 
157  void setFillType(FillTypeId const& fillType);
158 
159  void setParticleTypeForBeam1(ParticleTypeId const& particleType);
160 
161  void setParticleTypeForBeam2(ParticleTypeId const& particleType);
162 
163  void setCrossingAngle(float const& angle);
164 
165  void setBetaStar(float const& betaStar);
166 
167  void setIntensityForBeam1(float const& intensity);
168 
169  void setIntensityForBeam2(float const& intensity);
170 
171  void setEnergy(float const& energy);
172 
173  void setDelivLumi(float const& delivLumi);
174 
175  void setRecLumi(float const& recLumi);
176 
177  void setInstLumi(float const& instLumi);
178 
179  void setInstLumiError(float const& instLumiError);
180 
182 
183  void setBeginTime(cond::Time_t const& beginTime);
184 
185  void setEndTime(cond::Time_t const& endTime);
186 
188 
189  void setLumiPerBX(std::vector<float> const& lumiPerBX);
190 
191  void setLhcState(std::string const& lhcState);
192 
193  void setLhcComment(std::string const& lhcComment);
194 
196 
197  void setLumiSection(unsigned int const& lumiSection);
198 
199  void setBeam1VC(std::vector<float> const& beam1VC);
200 
201  void setBeam2VC(std::vector<float> const& beam2VC);
202 
203  void setBeam1RF(std::vector<float> const& beam1RF);
204 
205  void setBeam2RF(std::vector<float> const& beam2RF);
206 
207  //sets all values in one go
208  void setInfo(unsigned short const& bunches1,
209  unsigned short const& bunches2,
210  unsigned short const& collidingBunches,
211  unsigned short const& targetBunches,
212  FillTypeId const& fillType,
213  ParticleTypeId const& particleType1,
214  ParticleTypeId const& particleType2,
215  float const& angle,
216  float const& beta,
217  float const& intensity1,
218  float const& intensity2,
219  float const& energy,
220  float const& delivLumi,
221  float const& recLumi,
222  float const& instLumi,
223  float const& instLumiError,
224  cond::Time_t const& createTime,
225  cond::Time_t const& beginTime,
226  cond::Time_t const& endTime,
227  std::string const& scheme,
228  std::vector<float> const& lumiPerBX,
229  std::string const& lhcState,
230  std::string const& lhcComment,
231  std::string const& ctppsStatus,
232  unsigned int const& lumiSection,
233  std::vector<float> const& beam1VC,
234  std::vector<float> const& beam2VC,
235  std::vector<float> const& beam1RF,
236  std::vector<float> const& beam2RF,
237  std::bitset<bunchSlots + 1> const& bunchConf1,
238  std::bitset<bunchSlots + 1> const& bunchConf2);
239 
240  bool equals(const LHCInfo& rhs) const;
241 
242  bool empty() const;
243 
244  //dumping values on output stream
245  void print(std::stringstream& ss) const;
246 
247  std::bitset<bunchSlots + 1> const& bunchBitsetForBeam1() const;
248 
249  std::bitset<bunchSlots + 1> const& bunchBitsetForBeam2() const;
250 
251  void setBunchBitsetForBeam1(std::bitset<bunchSlots + 1> const& bunchConfiguration);
252 
253  void setBunchBitsetForBeam2(std::bitset<bunchSlots + 1> const& bunchConfiguration);
254 
255 private:
256  bool m_isData = false;
257  std::vector<std::vector<unsigned int> > m_intParams;
258  std::vector<std::vector<float> > m_floatParams;
259  std::vector<std::vector<unsigned long long> > m_timeParams;
260  std::vector<std::vector<std::string> > m_stringParams;
261  std::bitset<bunchSlots + 1> m_bunchConfiguration1, m_bunchConfiguration2;
262 
264 };
265 
266 std::ostream& operator<<(std::ostream&, LHCInfo lhcInfo);
267 
268 #endif // CondFormats_RunInfo_LHCInfo_H
bool equals(const LHCInfo &rhs) const
Definition: LHCInfo.cc:520
std::string const & lhcState() const
Definition: LHCInfo.cc:212
void setBeam1RF(std::vector< float > const &beam1RF)
Definition: LHCInfo.cc:364
cond::Time_t const beginTime() const
Definition: LHCInfo.cc:202
void setLumiSection(unsigned int const &lumiSection)
Definition: LHCInfo.cc:352
unsigned short const bunchesInBeam1() const
Definition: LHCInfo.cc:160
void setBeginTime(cond::Time_t const &beginTime)
Definition: LHCInfo.cc:326
std::bitset< bunchSlots+1 > const & bunchBitsetForBeam1() const
Definition: LHCInfo.cc:500
void print(std::stringstream &ss) const
Definition: LHCInfo.cc:437
bool m_isData
Definition: LHCInfo.h:256
void setInstLumi(float const &instLumi)
Definition: LHCInfo.cc:316
void setEnergy(float const &energy)
Definition: LHCInfo.cc:310
FillTypeId const fillType() const
Definition: LHCInfo.cc:170
bool isBunchInBeam1(size_t const &bunch) const
Definition: LHCInfo.cc:244
FillType FillTypeId
Definition: LHCInfo.h:49
LHCInfo * cloneFill() const
Definition: LHCInfo.cc:96
void setInstLumiError(float const &instLumiError)
Definition: LHCInfo.cc:318
IntParamIndex
Definition: LHCInfo.h:17
void setParticleTypeForBeam2(ParticleTypeId const &particleType)
Definition: LHCInfo.cc:294
unsigned short const targetBunches() const
Definition: LHCInfo.cc:168
std::string const & injectionScheme() const
Definition: LHCInfo.cc:206
void setDelivLumi(float const &delivLumi)
Definition: LHCInfo.cc:312
TimeParamIndex
Definition: LHCInfo.h:46
std::string const & ctppsStatus() const
Definition: LHCInfo.cc:216
void setBeam1VC(std::vector< float > const &beam1VC)
Definition: LHCInfo.cc:356
std::vector< std::vector< float > > m_floatParams
Definition: LHCInfo.h:258
void setBunchesInBeam1(unsigned short const &bunches)
Definition: LHCInfo.cc:270
void setLhcComment(std::string const &lhcComment)
Definition: LHCInfo.cc:344
std::vector< std::vector< unsigned long long > > m_timeParams
Definition: LHCInfo.h:259
float const delivLumi() const
Definition: LHCInfo.cc:192
void setFillNumber(unsigned short lhcFill)
Definition: LHCInfo.cc:265
float const crossingAngle() const
Definition: LHCInfo.cc:182
float const instLumiError() const
Definition: LHCInfo.cc:198
bool is25nsBunchSpacing() const
Definition: LHCInfo.cc:238
unsigned long long Time_t
Definition: Time.h:14
std::string const & lhcComment() const
Definition: LHCInfo.cc:214
void setBetaStar(float const &betaStar)
Definition: LHCInfo.cc:300
std::vector< float > const & beam1VC() const
Definition: LHCInfo.cc:220
std::vector< float > const & beam2RF() const
Definition: LHCInfo.cc:226
unsigned short const bunchesInBeam2() const
Definition: LHCInfo.cc:162
bool isBunchInBeam2(size_t const &bunch) const
Definition: LHCInfo.cc:250
void setLumiPerBX(std::vector< float > const &lumiPerBX)
Definition: LHCInfo.cc:336
void setBunchesInBeam2(unsigned short const &bunches)
Definition: LHCInfo.cc:274
std::vector< float > const & beam1RF() const
Definition: LHCInfo.cc:224
float const intensityForBeam2() const
Definition: LHCInfo.cc:188
void setBeam2RF(std::vector< float > const &beam2RF)
Definition: LHCInfo.cc:368
void setLhcState(std::string const &lhcState)
Definition: LHCInfo.cc:340
void setBeam2VC(std::vector< float > const &beam2VC)
Definition: LHCInfo.cc:360
void setCollidingBunches(unsigned short const &collidingBunches)
Definition: LHCInfo.cc:278
std::vector< std::vector< unsigned int > > m_intParams
Definition: LHCInfo.h:257
unsigned int const & lumiSection() const
Definition: LHCInfo.cc:218
ParticleType ParticleTypeId
Definition: LHCInfo.h:50
bool empty() const
Definition: LHCInfo.cc:538
void setRecLumi(float const &recLumi)
Definition: LHCInfo.cc:314
std::bitset< bunchSlots+1 > m_bunchConfiguration1
Definition: LHCInfo.h:261
std::bitset< bunchSlots+1 > m_bunchConfiguration2
Definition: LHCInfo.h:261
ParticleType
Definition: LHCInfo.h:15
static size_t const availableBunchSlots
Definition: LHCInfo.h:61
float const instLumi() const
Definition: LHCInfo.cc:196
cond::Time_t const endTime() const
Definition: LHCInfo.cc:204
void setInfo(unsigned short const &bunches1, unsigned short const &bunches2, unsigned short const &collidingBunches, unsigned short const &targetBunches, FillTypeId const &fillType, ParticleTypeId const &particleType1, ParticleTypeId const &particleType2, float const &angle, float const &beta, float const &intensity1, float const &intensity2, float const &energy, float const &delivLumi, float const &recLumi, float const &instLumi, float const &instLumiError, cond::Time_t const &createTime, cond::Time_t const &beginTime, cond::Time_t const &endTime, std::string const &scheme, std::vector< float > const &lumiPerBX, std::string const &lhcState, std::string const &lhcComment, std::string const &ctppsStatus, unsigned int const &lumiSection, std::vector< float > const &beam1VC, std::vector< float > const &beam2VC, std::vector< float > const &beam1RF, std::vector< float > const &beam2RF, std::bitset< bunchSlots+1 > const &bunchConf1, std::bitset< bunchSlots+1 > const &bunchConf2)
Definition: LHCInfo.cc:373
void setParticleTypeForBeam1(ParticleTypeId const &particleType)
Definition: LHCInfo.cc:290
void setInjectionScheme(std::string const &injectionScheme)
Definition: LHCInfo.cc:332
~LHCInfo()
Definition: LHCInfo.cc:94
std::vector< float > const & beam2VC() const
Definition: LHCInfo.cc:222
std::vector< float > const & lumiPerBX() const
Definition: LHCInfo.cc:210
StringParamIndex
Definition: LHCInfo.h:47
ParticleTypeId const particleTypeForBeam1() const
Definition: LHCInfo.cc:174
#define COND_SERIALIZABLE
Definition: Serializable.h:38
FloatParamIndex
Definition: LHCInfo.h:29
void setCreationTime(cond::Time_t const &createTime)
Definition: LHCInfo.cc:322
void setTargetBunches(unsigned short const &targetBunches)
Definition: LHCInfo.cc:282
LHCInfo()
Definition: LHCInfo.cc:73
float const recLumi() const
Definition: LHCInfo.cc:194
void setCtppsStatus(std::string const &ctppsStatus)
Definition: LHCInfo.cc:348
std::bitset< bunchSlots+1 > const & bunchBitsetForBeam2() const
Definition: LHCInfo.cc:502
unsigned short const collidingBunches() const
Definition: LHCInfo.cc:164
float const betaStar() const
Definition: LHCInfo.cc:184
float const intensityForBeam1() const
Definition: LHCInfo.cc:186
float const energy() const
Definition: LHCInfo.cc:190
unsigned short const fillNumber() const
Definition: LHCInfo.cc:158
void setBunchBitsetForBeam1(std::bitset< bunchSlots+1 > const &bunchConfiguration)
Definition: LHCInfo.cc:505
void setBunchBitsetForBeam2(std::bitset< bunchSlots+1 > const &bunchConfiguration)
Definition: LHCInfo.cc:509
ParticleTypeId const particleTypeForBeam2() const
Definition: LHCInfo.cc:178
void setIntensityForBeam1(float const &intensity)
Definition: LHCInfo.cc:302
void setEndTime(cond::Time_t const &endTime)
Definition: LHCInfo.cc:330
std::ostream & operator<<(std::ostream &, LHCInfo lhcInfo)
Definition: LHCInfo.cc:513
void setIntensityForBeam2(float const &intensity)
Definition: LHCInfo.cc:306
void setFillType(FillTypeId const &fillType)
Definition: LHCInfo.cc:286
cond::Time_t const createTime() const
Definition: LHCInfo.cc:200
void setCrossingAngle(float const &angle)
Definition: LHCInfo.cc:298
std::vector< unsigned short > bunchConfigurationForBeam2() const
Definition: LHCInfo.cc:261
static size_t const bunchSlots
Definition: LHCInfo.h:58
std::vector< unsigned short > bunchConfigurationForBeam1() const
Definition: LHCInfo.cc:257
FillType
Definition: LHCInfo.h:14
std::vector< std::vector< std::string > > m_stringParams
Definition: LHCInfo.h:260
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11