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  enum FloatParamIndex { CROSSING_ANGLE = 0, BETA_STAR = 1, INTENSITY_1 = 2, INTENSITY_2 = 3, ENERGY = 4, DELIV_LUMI = 5, REC_LUMI = 7, LUMI_PER_B = 8, BEAM1_VC = 9, BEAM2_VC = 10, BEAM1_RF = 11, BEAM2_RF = 12, INST_LUMI = 13, INST_LUMI_ERR = 14, FSIZE = 15};
19  enum TimeParamIndex { CREATE_TIME = 0, BEGIN_TIME = 1, END_TIME = 2, TSIZE =3};
21 
24  LHCInfo();
25  LHCInfo( const LHCInfo& rhs );
26  ~LHCInfo();
27 
28  LHCInfo* cloneFill() const;
29 
30  //constant static unsigned integer hosting the maximum number of LHC bunch slots
31  static size_t const bunchSlots = 3564;
32 
33  //constant static unsigned integer hosting the available number of LHC bunch slots
34  static size_t const availableBunchSlots = 2808;
35 
36  void setFillNumber( unsigned short lhcFill );
37 
38  //getters
39  unsigned short const fillNumber() const;
40 
41  unsigned short const bunchesInBeam1() const;
42 
43  unsigned short const bunchesInBeam2() const;
44 
45  unsigned short const collidingBunches() const;
46 
47  unsigned short const targetBunches() const;
48 
49  FillTypeId const fillType() const;
50 
51  ParticleTypeId const particleTypeForBeam1() const;
52 
53  ParticleTypeId const particleTypeForBeam2() const;
54 
55  float const crossingAngle() const;
56 
57  float const betaStar() const;
58 
59  float const intensityForBeam1() const;
60 
61  float const intensityForBeam2() const;
62 
63  float const energy() const;
64 
65  float const delivLumi() const;
66 
67  float const recLumi() const;
68 
69  float const instLumi() const;
70 
71  float const instLumiError() const;
72 
73  cond::Time_t const createTime() const;
74 
75  cond::Time_t const beginTime() const;
76 
77  cond::Time_t const endTime() const;
78 
79  std::string const & injectionScheme() const;
80 
81  std::vector<float> const & lumiPerBX() const;
82 
83  std::string const & lhcState() const;
84 
85  std::string const & lhcComment() const;
86 
87  std::string const & ctppsStatus() const;
88 
89  unsigned int const & lumiSection() const;
90 
91  std::vector<float> const & beam1VC() const;
92 
93  std::vector<float> const & beam2VC() const;
94 
95  std::vector<float> const & beam1RF() const;
96 
97  std::vector<float> const & beam2RF() const;
98 
99  std::vector<float>& beam1VC();
100 
101  std::vector<float>& beam2VC();
102 
103  std::vector<float>& beam1RF();
104 
105  std::vector<float>& beam2RF();
106 
107  //returns a boolean, true if the injection scheme has a leading 25ns
108  //TODO: parse the circulating bunch configuration, instead of the string.
109  bool is25nsBunchSpacing() const;
110 
111  //returns a boolean, true if the bunch slot number is in the circulating bunch configuration
112  bool isBunchInBeam1( size_t const & bunch ) const;
113 
114  bool isBunchInBeam2( size_t const & bunch ) const;
115 
116  //member functions returning *by value* a vector with all filled bunch slots
117  std::vector<unsigned short> bunchConfigurationForBeam1() const;
118 
119  std::vector<unsigned short> bunchConfigurationForBeam2() const;
120 
121  //setters
122  void setBunchesInBeam1( unsigned short const & bunches );
123 
124  void setBunchesInBeam2( unsigned short const & bunches );
125 
126  void setCollidingBunches( unsigned short const & collidingBunches );
127 
128  void setTargetBunches( unsigned short const & targetBunches );
129 
130  void setFillType( FillTypeId const & fillType );
131 
132  void setParticleTypeForBeam1( ParticleTypeId const & particleType );
133 
134  void setParticleTypeForBeam2( ParticleTypeId const & particleType );
135 
136  void setCrossingAngle( float const & angle );
137 
138  void setBetaStar( float const & betaStar );
139 
140  void setIntensityForBeam1( float const & intensity );
141 
142  void setIntensityForBeam2( float const & intensity );
143 
144  void setEnergy( float const & energy );
145 
146  void setDelivLumi( float const & delivLumi );
147 
148  void setRecLumi( float const & recLumi );
149 
150  void setInstLumi( float const& instLumi );
151 
152  void setInstLumiError( float const& instLumiError );
153 
154  void setCreationTime( cond::Time_t const & createTime );
155 
156  void setBeginTime( cond::Time_t const & beginTime );
157 
158  void setEndTime( cond::Time_t const & endTime );
159 
161 
162  void setLumiPerBX( std::vector<float> const & lumiPerBX);
163 
164  void setLhcState( std::string const & lhcState);
165 
166  void setLhcComment( std::string const & lhcComment);
167 
168  void setCtppsStatus( std::string const & ctppsStatus);
169 
170  void setLumiSection( unsigned int const & lumiSection);
171 
172  void setBeam1VC( std::vector<float> const & beam1VC);
173 
174  void setBeam2VC( std::vector<float> const & beam2VC);
175 
176  void setBeam1RF( std::vector<float> const & beam1RF);
177 
178  void setBeam2RF( std::vector<float> const & beam2RF);
179 
180  //sets all values in one go
181  void setInfo( unsigned short const & bunches1
182  ,unsigned short const & bunches2
183  ,unsigned short const & collidingBunches
184  ,unsigned short const & targetBunches
185  ,FillTypeId const & fillType
186  ,ParticleTypeId const & particleType1
187  ,ParticleTypeId const & particleType2
188  ,float const & angle
189  ,float const & beta
190  ,float const & intensity1
191  ,float const & intensity2
192  ,float const & energy
193  ,float const & delivLumi
194  ,float const & recLumi
195  ,float const & instLumi
196  ,float const & instLumiError
197  ,cond::Time_t const & createTime
198  ,cond::Time_t const & beginTime
199  ,cond::Time_t const & endTime
200  ,std::string const & scheme
201  ,std::vector<float> const & lumiPerBX
202  ,std::string const & lhcState
203  ,std::string const & lhcComment
204  ,std::string const & ctppsStatus
205  ,unsigned int const & lumiSection
206  ,std::vector<float> const & beam1VC
207  ,std::vector<float> const & beam2VC
208  ,std::vector<float> const & beam1RF
209  ,std::vector<float> const & beam2RF
210  ,std::bitset<bunchSlots+1> const & bunchConf1
211  ,std::bitset<bunchSlots+1> const & bunchConf2 );
212 
213  bool equals( const LHCInfo& rhs ) const;
214 
215  bool empty() const;
216 
217  //dumping values on output stream
218  void print(std::stringstream & ss) const;
219 
220  std::bitset<bunchSlots+1> const & bunchBitsetForBeam1() const;
221 
222  std::bitset<bunchSlots+1> const & bunchBitsetForBeam2() const;
223 
224  void setBunchBitsetForBeam1( std::bitset<bunchSlots+1> const & bunchConfiguration );
225 
226  void setBunchBitsetForBeam2( std::bitset<bunchSlots+1> const & bunchConfiguration );
227 
228  private:
229  bool m_isData = false;
230  std::vector<std::vector<unsigned int> > m_intParams;
231  std::vector<std::vector<float> > m_floatParams;
232  std::vector<std::vector<unsigned long long> > m_timeParams;
233  std::vector<std::vector<std::string> > m_stringParams;
234  std::bitset<bunchSlots+1> m_bunchConfiguration1, m_bunchConfiguration2;
235 
237 };
238 
239 std::ostream & operator<<( std::ostream &, LHCInfo lhcInfo );
240 
241 #endif // CondFormats_RunInfo_LHCInfo_H
bool equals(const LHCInfo &rhs) const
Definition: LHCInfo.cc:577
std::string const & lhcState() const
Definition: LHCInfo.cc:232
void setBeam1RF(std::vector< float > const &beam1RF)
Definition: LHCInfo.cc:422
cond::Time_t const beginTime() const
Definition: LHCInfo.cc:216
void setLumiSection(unsigned int const &lumiSection)
Definition: LHCInfo.cc:410
unsigned short const bunchesInBeam1() const
Definition: LHCInfo.cc:148
void setBeginTime(cond::Time_t const &beginTime)
Definition: LHCInfo.cc:382
std::bitset< bunchSlots+1 > const & bunchBitsetForBeam1() const
Definition: LHCInfo.cc:553
void print(std::stringstream &ss) const
Definition: LHCInfo.cc:495
bool m_isData
Definition: LHCInfo.h:229
void setInstLumi(float const &instLumi)
Definition: LHCInfo.cc:370
void setEnergy(float const &energy)
Definition: LHCInfo.cc:358
FillTypeId const fillType() const
Definition: LHCInfo.cc:164
bool isBunchInBeam1(size_t const &bunch) const
Definition: LHCInfo.cc:288
FillType FillTypeId
Definition: LHCInfo.h:22
LHCInfo * cloneFill() const
Definition: LHCInfo.cc:98
void setInstLumiError(float const &instLumiError)
Definition: LHCInfo.cc:374
IntParamIndex
Definition: LHCInfo.h:17
void setParticleTypeForBeam2(ParticleTypeId const &particleType)
Definition: LHCInfo.cc:338
unsigned short const targetBunches() const
Definition: LHCInfo.cc:160
std::string const & injectionScheme() const
Definition: LHCInfo.cc:224
std::bitset< bunchSlots+1 > m_bunchConfiguration1
Definition: LHCInfo.h:234
void setDelivLumi(float const &delivLumi)
Definition: LHCInfo.cc:362
TimeParamIndex
Definition: LHCInfo.h:19
std::string const & ctppsStatus() const
Definition: LHCInfo.cc:240
void setBeam1VC(std::vector< float > const &beam1VC)
Definition: LHCInfo.cc:414
std::vector< std::vector< float > > m_floatParams
Definition: LHCInfo.h:231
void setBunchesInBeam1(unsigned short const &bunches)
Definition: LHCInfo.cc:314
void setLhcComment(std::string const &lhcComment)
Definition: LHCInfo.cc:402
std::vector< std::vector< unsigned long long > > m_timeParams
Definition: LHCInfo.h:232
float const delivLumi() const
Definition: LHCInfo.cc:196
void setFillNumber(unsigned short lhcFill)
Definition: LHCInfo.cc:309
float const crossingAngle() const
Definition: LHCInfo.cc:176
float const instLumiError() const
Definition: LHCInfo.cc:208
bool is25nsBunchSpacing() const
Definition: LHCInfo.cc:282
unsigned long long Time_t
Definition: Time.h:16
std::string const & lhcComment() const
Definition: LHCInfo.cc:236
void setBetaStar(float const &betaStar)
Definition: LHCInfo.cc:346
std::vector< float > const & beam1VC() const
Definition: LHCInfo.cc:248
std::vector< float > const & beam2RF() const
Definition: LHCInfo.cc:260
unsigned short const bunchesInBeam2() const
Definition: LHCInfo.cc:152
bool isBunchInBeam2(size_t const &bunch) const
Definition: LHCInfo.cc:294
void setLumiPerBX(std::vector< float > const &lumiPerBX)
Definition: LHCInfo.cc:394
void setBunchesInBeam2(unsigned short const &bunches)
Definition: LHCInfo.cc:318
std::vector< float > const & beam1RF() const
Definition: LHCInfo.cc:256
float const intensityForBeam2() const
Definition: LHCInfo.cc:188
void setBeam2RF(std::vector< float > const &beam2RF)
Definition: LHCInfo.cc:426
void setLhcState(std::string const &lhcState)
Definition: LHCInfo.cc:398
void setBeam2VC(std::vector< float > const &beam2VC)
Definition: LHCInfo.cc:418
void setCollidingBunches(unsigned short const &collidingBunches)
Definition: LHCInfo.cc:322
std::vector< std::vector< unsigned int > > m_intParams
Definition: LHCInfo.h:230
unsigned int const & lumiSection() const
Definition: LHCInfo.cc:244
ParticleType ParticleTypeId
Definition: LHCInfo.h:23
bool empty() const
Definition: LHCInfo.cc:588
void setRecLumi(float const &recLumi)
Definition: LHCInfo.cc:366
ParticleType
Definition: LHCInfo.h:15
static size_t const availableBunchSlots
Definition: LHCInfo.h:34
float const instLumi() const
Definition: LHCInfo.cc:204
cond::Time_t const endTime() const
Definition: LHCInfo.cc:220
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:431
void setParticleTypeForBeam1(ParticleTypeId const &particleType)
Definition: LHCInfo.cc:334
void setInjectionScheme(std::string const &injectionScheme)
Definition: LHCInfo.cc:390
~LHCInfo()
Definition: LHCInfo.cc:95
std::vector< float > const & beam2VC() const
Definition: LHCInfo.cc:252
std::vector< float > const & lumiPerBX() const
Definition: LHCInfo.cc:228
StringParamIndex
Definition: LHCInfo.h:20
ParticleTypeId const particleTypeForBeam1() const
Definition: LHCInfo.cc:168
#define COND_SERIALIZABLE
Definition: Serializable.h:38
FloatParamIndex
Definition: LHCInfo.h:18
void setCreationTime(cond::Time_t const &createTime)
Definition: LHCInfo.cc:378
void setTargetBunches(unsigned short const &targetBunches)
Definition: LHCInfo.cc:326
LHCInfo()
Definition: LHCInfo.cc:73
float const recLumi() const
Definition: LHCInfo.cc:200
void setCtppsStatus(std::string const &ctppsStatus)
Definition: LHCInfo.cc:406
std::bitset< bunchSlots+1 > const & bunchBitsetForBeam2() const
Definition: LHCInfo.cc:557
unsigned short const collidingBunches() const
Definition: LHCInfo.cc:156
float const betaStar() const
Definition: LHCInfo.cc:180
float const intensityForBeam1() const
Definition: LHCInfo.cc:184
float const energy() const
Definition: LHCInfo.cc:192
unsigned short const fillNumber() const
Definition: LHCInfo.cc:144
void setBunchBitsetForBeam1(std::bitset< bunchSlots+1 > const &bunchConfiguration)
Definition: LHCInfo.cc:562
void setBunchBitsetForBeam2(std::bitset< bunchSlots+1 > const &bunchConfiguration)
Definition: LHCInfo.cc:566
ParticleTypeId const particleTypeForBeam2() const
Definition: LHCInfo.cc:172
void setIntensityForBeam1(float const &intensity)
Definition: LHCInfo.cc:350
void setEndTime(cond::Time_t const &endTime)
Definition: LHCInfo.cc:386
std::ostream & operator<<(std::ostream &, LHCInfo lhcInfo)
Definition: LHCInfo.cc:570
void setIntensityForBeam2(float const &intensity)
Definition: LHCInfo.cc:354
std::bitset< bunchSlots+1 > m_bunchConfiguration2
Definition: LHCInfo.h:234
void setFillType(FillTypeId const &fillType)
Definition: LHCInfo.cc:330
cond::Time_t const createTime() const
Definition: LHCInfo.cc:212
void setCrossingAngle(float const &angle)
Definition: LHCInfo.cc:342
std::vector< unsigned short > bunchConfigurationForBeam2() const
Definition: LHCInfo.cc:305
static size_t const bunchSlots
Definition: LHCInfo.h:31
std::vector< unsigned short > bunchConfigurationForBeam1() const
Definition: LHCInfo.cc:301
FillType
Definition: LHCInfo.h:14
std::vector< std::vector< std::string > > m_stringParams
Definition: LHCInfo.h:233
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11