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