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, FSIZE = 13};
19  enum TimeParamIndex { CREATE_TIME = 0, BEGIN_TIME = 1, END_TIME = 2, DIP_TIME = 3, TSIZE =4};
21 
24  LHCInfo();
25  LHCInfo( unsigned short const & lhcFill, bool const & fromData = true );
26  ~LHCInfo();
27 
28  //constant static unsigned integer hosting the maximum number of LHC bunch slots
29  static size_t const bunchSlots = 3564;
30 
31  //constant static unsigned integer hosting the available number of LHC bunch slots
32  static size_t const availableBunchSlots = 2808;
33 
34  //reset instance
35  void setFill( unsigned short const & lhcFill, bool const & fromData );
36 
37  //getters
38  unsigned short const fillNumber() const;
39 
40  bool const isData() const;
41 
42  unsigned short const bunchesInBeam1() const;
43 
44  unsigned short const bunchesInBeam2() const;
45 
46  unsigned short const collidingBunches() const;
47 
48  unsigned short const targetBunches() const;
49 
50  FillTypeId const fillType() const;
51 
52  ParticleTypeId const particleTypeForBeam1() const;
53 
54  ParticleTypeId const particleTypeForBeam2() const;
55 
56  float const crossingAngle() const;
57 
58  float const betaStar() const;
59 
60  float const intensityForBeam1() const;
61 
62  float const intensityForBeam2() const;
63 
64  float const energy() const;
65 
66  float const delivLumi() const;
67 
68  float const recLumi() const;
69 
70  cond::Time_t const createTime() const;
71 
72  cond::Time_t const beginTime() const;
73 
74  cond::Time_t const endTime() const;
75 
76  std::string const & injectionScheme() const;
77 
78  std::vector<float> const & lumiPerBX() const;
79 
80  std::string const & lhcState() const;
81 
82  std::string const & lhcComment() const;
83 
84  std::string const & ctppsStatus() const;
85 
86  unsigned int const & lumiSection() const;
87 
88  std::vector<float> const & beam1VC() const;
89 
90  std::vector<float> const & beam2VC() const;
91 
92  std::vector<float> const & beam1RF() const;
93 
94  std::vector<float> const & beam2RF() const;
95 
96  //returns a boolean, true if the injection scheme has a leading 25ns
97  //TODO: parse the circulating bunch configuration, instead of the string.
98  bool is25nsBunchSpacing() const;
99 
100  //returns a boolean, true if the bunch slot number is in the circulating bunch configuration
101  bool isBunchInBeam1( size_t const & bunch ) const;
102 
103  bool isBunchInBeam2( size_t const & bunch ) const;
104 
105  //member functions returning *by value* a vector with all filled bunch slots
106  std::vector<unsigned short> bunchConfigurationForBeam1() const;
107 
108  std::vector<unsigned short> bunchConfigurationForBeam2() const;
109 
110  //setters
111  void setBunchesInBeam1( unsigned short const & bunches );
112 
113  void setBunchesInBeam2( unsigned short const & bunches );
114 
115  void setCollidingBunches( unsigned short const & collidingBunches );
116 
117  void setTargetBunches( unsigned short const & targetBunches );
118 
119  void setFillType( FillTypeId const & fillType );
120 
121  void setParticleTypeForBeam1( ParticleTypeId const & particleType );
122 
123  void setParticleTypeForBeam2( ParticleTypeId const & particleType );
124 
125  void setCrossingAngle( float const & angle );
126 
127  void setBetaStar( float const & betaStar );
128 
129  void setIntensityForBeam1( float const & intensity );
130 
131  void setIntensityForBeam2( float const & intensity );
132 
133  void setEnergy( float const & energy );
134 
135  void setDelivLumi( float const & delivLumi );
136 
137  void setRecLumi( float const & recLumi );
138 
139  void setCreationTime( cond::Time_t const & createTime );
140 
141  void setBeginTime( cond::Time_t const & beginTime );
142 
143  void setEndTime( cond::Time_t const & endTime );
144 
146 
147  void setLumiPerBX( std::vector<float> const & lumiPerBX);
148 
149  void setLhcState( std::string const & lhcState);
150 
151  void setLhcComment( std::string const & lhcComment);
152 
153  void setCtppsStatus( std::string const & ctppsStatus);
154 
155  void setLumiSection( unsigned int const & lumiSection);
156 
157  void setBeam1VC( std::vector<float> const & beam1VC);
158 
159  void setBeam2VC( std::vector<float> const & beam2VC);
160 
161  void setBeam1RF( std::vector<float> const & beam1RF);
162 
163  void setBeam2RF( std::vector<float> const & beam2RF);
164 
165  //sets all values in one go
166  void setInfo( unsigned short const & bunches1
167  ,unsigned short const & bunches2
168  ,unsigned short const & collidingBunches
169  ,unsigned short const & targetBunches
170  ,FillTypeId const & fillType
171  ,ParticleTypeId const & particleType1
172  ,ParticleTypeId const & particleType2
173  ,float const & angle
174  ,float const & beta
175  ,float const & intensity1
176  ,float const & intensity2
177  ,float const & energy
178  ,float const & delivLumi
179  ,float const & recLumi
180  ,cond::Time_t const & createTime
181  ,cond::Time_t const & beginTime
182  ,cond::Time_t const & endTime
183  ,std::string const & scheme
184  ,std::vector<float> const & lumiPerBX
185  ,std::string const & lhcState
186  ,std::string const & lhcComment
187  ,std::string const & ctppsStatus
188  ,unsigned int const & lumiSection
189  ,std::vector<float> const & beam1VC
190  ,std::vector<float> const & beam2VC
191  ,std::vector<float> const & beam1RF
192  ,std::vector<float> const & beam2RF
193  ,std::bitset<bunchSlots+1> const & bunchConf1
194  ,std::bitset<bunchSlots+1> const & bunchConf2 );
195 
196  //dumping values on output stream
197  void print(std::stringstream & ss) const;
198 
199  protected:
200  std::bitset<bunchSlots+1> const & bunchBitsetForBeam1() const;
201 
202  std::bitset<bunchSlots+1> const & bunchBitsetForBeam2() const;
203 
204  void setBunchBitsetForBeam1( std::bitset<bunchSlots+1> const & bunchConfiguration );
205 
206  void setBunchBitsetForBeam2( std::bitset<bunchSlots+1> const & bunchConfiguration );
207 
208  private:
209  bool m_isData;
210  std::vector<std::vector<unsigned int> > m_intParams;
211  std::vector<std::vector<float> > m_floatParams;
212  std::vector<std::vector<unsigned long long> > m_timeParams;
213  std::vector<std::vector<std::string> > m_stringParams;
214  std::bitset<bunchSlots+1> m_bunchConfiguration1, m_bunchConfiguration2;
215 
217 };
218 
219 std::ostream & operator<<( std::ostream &, LHCInfo lhcInfo );
220 
221 #endif // CondFormats_RunInfo_LHCInfo_H
const double beta
std::string const & lhcState() const
Definition: LHCInfo.cc:219
void setBeam1RF(std::vector< float > const &beam1RF)
Definition: LHCInfo.cc:381
cond::Time_t const beginTime() const
Definition: LHCInfo.cc:203
void setLumiSection(unsigned int const &lumiSection)
Definition: LHCInfo.cc:369
unsigned short const bunchesInBeam1() const
Definition: LHCInfo.cc:143
void setBeginTime(cond::Time_t const &beginTime)
Definition: LHCInfo.cc:341
std::bitset< bunchSlots+1 > const & bunchBitsetForBeam1() const
Definition: LHCInfo.cc:506
void print(std::stringstream &ss) const
Definition: LHCInfo.cc:450
bool m_isData
Definition: LHCInfo.h:209
void setEnergy(float const &energy)
Definition: LHCInfo.cc:325
FillTypeId const fillType() const
Definition: LHCInfo.cc:159
bool isBunchInBeam1(size_t const &bunch) const
Definition: LHCInfo.cc:259
FillType FillTypeId
Definition: LHCInfo.h:22
IntParamIndex
Definition: LHCInfo.h:17
void setParticleTypeForBeam2(ParticleTypeId const &particleType)
Definition: LHCInfo.cc:305
unsigned short const targetBunches() const
Definition: LHCInfo.cc:155
std::string const & injectionScheme() const
Definition: LHCInfo.cc:211
std::bitset< bunchSlots+1 > m_bunchConfiguration1
Definition: LHCInfo.h:214
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, 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:390
void setDelivLumi(float const &delivLumi)
Definition: LHCInfo.cc:329
TimeParamIndex
Definition: LHCInfo.h:19
std::string const & ctppsStatus() const
Definition: LHCInfo.cc:227
void setBeam1VC(std::vector< float > const &beam1VC)
Definition: LHCInfo.cc:373
std::vector< std::vector< float > > m_floatParams
Definition: LHCInfo.h:211
void setBunchesInBeam1(unsigned short const &bunches)
Definition: LHCInfo.cc:281
void setLhcComment(std::string const &lhcComment)
Definition: LHCInfo.cc:361
std::vector< std::vector< unsigned long long > > m_timeParams
Definition: LHCInfo.h:212
void setFill(unsigned short const &lhcFill, bool const &fromData)
Definition: LHCInfo.cc:92
float const delivLumi() const
Definition: LHCInfo.cc:191
float const crossingAngle() const
Definition: LHCInfo.cc:171
bool is25nsBunchSpacing() const
Definition: LHCInfo.cc:253
unsigned long long Time_t
Definition: Time.h:16
std::string const & lhcComment() const
Definition: LHCInfo.cc:223
void setBetaStar(float const &betaStar)
Definition: LHCInfo.cc:313
std::vector< float > const & beam1VC() const
Definition: LHCInfo.cc:235
std::vector< float > const & beam2RF() const
Definition: LHCInfo.cc:247
unsigned short const bunchesInBeam2() const
Definition: LHCInfo.cc:147
bool isBunchInBeam2(size_t const &bunch) const
Definition: LHCInfo.cc:265
void setLumiPerBX(std::vector< float > const &lumiPerBX)
Definition: LHCInfo.cc:353
void setBunchesInBeam2(unsigned short const &bunches)
Definition: LHCInfo.cc:285
std::vector< float > const & beam1RF() const
Definition: LHCInfo.cc:243
float const intensityForBeam2() const
Definition: LHCInfo.cc:183
void setBeam2RF(std::vector< float > const &beam2RF)
Definition: LHCInfo.cc:385
void setLhcState(std::string const &lhcState)
Definition: LHCInfo.cc:357
void setBeam2VC(std::vector< float > const &beam2VC)
Definition: LHCInfo.cc:377
void setCollidingBunches(unsigned short const &collidingBunches)
Definition: LHCInfo.cc:289
std::vector< std::vector< unsigned int > > m_intParams
Definition: LHCInfo.h:210
unsigned int const & lumiSection() const
Definition: LHCInfo.cc:231
ParticleType ParticleTypeId
Definition: LHCInfo.h:23
bool const isData() const
Definition: LHCInfo.cc:139
void setRecLumi(float const &recLumi)
Definition: LHCInfo.cc:333
ParticleType
Definition: LHCInfo.h:15
static size_t const availableBunchSlots
Definition: LHCInfo.h:32
cond::Time_t const endTime() const
Definition: LHCInfo.cc:207
void setParticleTypeForBeam1(ParticleTypeId const &particleType)
Definition: LHCInfo.cc:301
void setInjectionScheme(std::string const &injectionScheme)
Definition: LHCInfo.cc:349
~LHCInfo()
Definition: LHCInfo.cc:89
std::vector< float > const & beam2VC() const
Definition: LHCInfo.cc:239
std::vector< float > const & lumiPerBX() const
Definition: LHCInfo.cc:215
StringParamIndex
Definition: LHCInfo.h:20
ParticleTypeId const particleTypeForBeam1() const
Definition: LHCInfo.cc:163
#define COND_SERIALIZABLE
Definition: Serializable.h:38
FloatParamIndex
Definition: LHCInfo.h:18
void setCreationTime(cond::Time_t const &createTime)
Definition: LHCInfo.cc:337
void setTargetBunches(unsigned short const &targetBunches)
Definition: LHCInfo.cc:293
LHCInfo()
Definition: LHCInfo.cc:73
float const recLumi() const
Definition: LHCInfo.cc:195
void setCtppsStatus(std::string const &ctppsStatus)
Definition: LHCInfo.cc:365
std::bitset< bunchSlots+1 > const & bunchBitsetForBeam2() const
Definition: LHCInfo.cc:510
unsigned short const collidingBunches() const
Definition: LHCInfo.cc:151
float const betaStar() const
Definition: LHCInfo.cc:175
float const intensityForBeam1() const
Definition: LHCInfo.cc:179
float const energy() const
Definition: LHCInfo.cc:187
unsigned short const fillNumber() const
Definition: LHCInfo.cc:135
void setBunchBitsetForBeam1(std::bitset< bunchSlots+1 > const &bunchConfiguration)
Definition: LHCInfo.cc:515
void setBunchBitsetForBeam2(std::bitset< bunchSlots+1 > const &bunchConfiguration)
Definition: LHCInfo.cc:519
ParticleTypeId const particleTypeForBeam2() const
Definition: LHCInfo.cc:167
void setIntensityForBeam1(float const &intensity)
Definition: LHCInfo.cc:317
void setEndTime(cond::Time_t const &endTime)
Definition: LHCInfo.cc:345
std::ostream & operator<<(std::ostream &, LHCInfo lhcInfo)
Definition: LHCInfo.cc:523
void setIntensityForBeam2(float const &intensity)
Definition: LHCInfo.cc:321
std::bitset< bunchSlots+1 > m_bunchConfiguration2
Definition: LHCInfo.h:214
void setFillType(FillTypeId const &fillType)
Definition: LHCInfo.cc:297
cond::Time_t const createTime() const
Definition: LHCInfo.cc:199
void setCrossingAngle(float const &angle)
Definition: LHCInfo.cc:309
std::vector< unsigned short > bunchConfigurationForBeam2() const
Definition: LHCInfo.cc:276
static size_t const bunchSlots
Definition: LHCInfo.h:29
std::vector< unsigned short > bunchConfigurationForBeam1() const
Definition: LHCInfo.cc:272
FillType
Definition: LHCInfo.h:14
std::vector< std::vector< std::string > > m_stringParams
Definition: LHCInfo.h:213
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11