CMS 3D CMS Logo

FillInfo.h
Go to the documentation of this file.
1 #ifndef CondFormats_RunInfo_FillInfo_H
2 #define CondFormats_RunInfo_FillInfo_H
3 
5 
7 #include <bitset>
8 #include <iostream>
9 #include <string>
10 #include <sstream>
11 #include <vector>
12 
13 class FillInfo {
14 public:
15  enum FillType { UNKNOWN = 0, PROTONS = 1, IONS = 2, COSMICS = 3, GAP = 4 };
16  enum ParticleType { NONE = 0, PROTON = 1, PB82 = 2, AR18 = 3, D = 4, XE54 = 5 };
19  FillInfo();
20  FillInfo(unsigned short const &lhcFill, bool const &fromData = true);
21  ~FillInfo();
22 
23  //constant static unsigned integer hosting the maximum number of LHC bunch slots
24  static size_t const bunchSlots = 3564;
25 
26  //constant static unsigned integer hosting the available number of LHC bunch slots
27  static size_t const availableBunchSlots = 2808;
28 
29  //reset instance
30  void setFill(unsigned short const &lhcFill, bool const &fromData = true);
31 
32  //getters
33  unsigned short const fillNumber() const;
34 
35  bool const isData() const;
36 
37  unsigned short const bunchesInBeam1() const;
38 
39  unsigned short const bunchesInBeam2() const;
40 
41  unsigned short const collidingBunches() const;
42 
43  unsigned short const targetBunches() const;
44 
45  FillTypeId const fillType() const;
46 
48 
50 
51  float const crossingAngle() const;
52 
53  float const betaStar() const;
54 
55  float const intensityForBeam1() const;
56 
57  float const intensityForBeam2() const;
58 
59  float const energy() const;
60 
61  cond::Time_t const createTime() const;
62 
63  cond::Time_t const beginTime() const;
64 
65  cond::Time_t const endTime() const;
66 
67  std::string const &injectionScheme() const;
68 
69  //returns a boolean, true if the injection scheme has a leading 25ns
70  //TODO: parse the circulating bunch configuration, instead of the string.
71  bool is25nsBunchSpacing() const;
72 
73  //returns a boolean, true if the bunch slot number is in the circulating bunch configuration
74  bool isBunchInBeam1(size_t const &bunch) const;
75 
76  bool isBunchInBeam2(size_t const &bunch) const;
77 
78  //member functions returning *by value* a vector with all filled bunch slots
79  std::vector<unsigned short> bunchConfigurationForBeam1() const;
80 
81  std::vector<unsigned short> bunchConfigurationForBeam2() const;
82 
83  //setters
84  void setBunchesInBeam1(unsigned short const &bunches);
85 
86  void setBunchesInBeam2(unsigned short const &bunches);
87 
88  void setCollidingBunches(unsigned short const &collidingBunches);
89 
90  void setTargetBunches(unsigned short const &targetBunches);
91 
92  void setFillType(FillTypeId const &fillType);
93 
95 
97 
98  void setCrossingAngle(float const &angle);
99 
100  void setBetaStar(float const &betaStar);
101 
102  void setIntensityForBeam1(float const &intensity);
103 
104  void setIntensityForBeam2(float const &intensity);
105 
106  void setEnergy(float const &energy);
107 
109 
110  void setBeginTime(cond::Time_t const &beginTime);
111 
112  void setEndTime(cond::Time_t const &endTime);
113 
115 
116  //sets all values in one go
117  void setBeamInfo(unsigned short const &bunches1,
118  unsigned short const &bunches2,
119  unsigned short const &collidingBunches,
120  unsigned short const &targetBunches,
121  FillTypeId const &fillType,
122  ParticleTypeId const &particleType1,
123  ParticleTypeId const &particleType2,
124  float const &angle,
125  float const &beta,
126  float const &intensity1,
127  float const &intensity2,
128  float const &energy,
129  cond::Time_t const &createTime,
130  cond::Time_t const &beginTime,
131  cond::Time_t const &endTime,
132  std::string const &scheme,
133  std::bitset<bunchSlots + 1> const &bunchConf1,
134  std::bitset<bunchSlots + 1> const &bunchConf2);
135 
136  //dumping values on output stream
137  void print(std::stringstream &ss) const;
138 
139 protected:
140  std::bitset<bunchSlots + 1> const &bunchBitsetForBeam1() const;
141 
142  std::bitset<bunchSlots + 1> const &bunchBitsetForBeam2() const;
143 
144  void setBunchBitsetForBeam1(std::bitset<bunchSlots + 1> const &bunchConfiguration);
145 
146  void setBunchBitsetForBeam2(std::bitset<bunchSlots + 1> const &bunchConfiguration);
147 
148 private:
149  bool m_isData;
150  unsigned short m_lhcFill;
157  //BEWARE: since CMS counts bunches starting from one,
158  //the size of the bitset must be incremented by one,
159  //in order to avoid off-by-one
160  std::bitset<bunchSlots + 1> m_bunchConfiguration1, m_bunchConfiguration2;
161 
163 };
164 
165 std::ostream &operator<<(std::ostream &, FillInfo fillInfo);
166 
167 #endif // CondFormats_RunInfo_FillInfo_H
float const intensityForBeam2() const
Definition: FillInfo.cc:163
ParticleTypeId m_particles1
Definition: FillInfo.h:153
float const crossingAngle() const
Definition: FillInfo.cc:157
void setBetaStar(float const &betaStar)
Definition: FillInfo.cc:221
void setCrossingAngle(float const &angle)
Definition: FillInfo.cc:219
std::bitset< bunchSlots+1 > m_bunchConfiguration2
Definition: FillInfo.h:160
std::vector< unsigned short > bunchConfigurationForBeam2() const
Definition: FillInfo.cc:200
unsigned short m_bunches1
Definition: FillInfo.h:151
ParticleType
Definition: FillInfo.h:16
unsigned short const fillNumber() const
Definition: FillInfo.cc:139
unsigned short m_bunches2
Definition: FillInfo.h:151
void setBeamInfo(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, cond::Time_t const &createTime, cond::Time_t const &beginTime, cond::Time_t const &endTime, std::string const &scheme, std::bitset< bunchSlots+1 > const &bunchConf1, std::bitset< bunchSlots+1 > const &bunchConf2)
Definition: FillInfo.cc:238
bool isBunchInBeam1(size_t const &bunch) const
Definition: FillInfo.cc:183
void setCollidingBunches(unsigned short const &collidingBunches)
Definition: FillInfo.cc:209
std::ostream & operator<<(std::ostream &, FillInfo fillInfo)
Definition: FillInfo.cc:321
float const energy() const
Definition: FillInfo.cc:165
void setBunchBitsetForBeam2(std::bitset< bunchSlots+1 > const &bunchConfiguration)
Definition: FillInfo.cc:317
cond::Time_t m_beginTime
Definition: FillInfo.h:155
void setIntensityForBeam2(float const &intensity)
Definition: FillInfo.cc:225
unsigned short m_lhcFill
Definition: FillInfo.h:150
void setBunchBitsetForBeam1(std::bitset< bunchSlots+1 > const &bunchConfiguration)
Definition: FillInfo.cc:313
unsigned short const bunchesInBeam2() const
Definition: FillInfo.cc:145
void setFillType(FillTypeId const &fillType)
Definition: FillInfo.cc:213
float m_crossingAngle
Definition: FillInfo.h:154
static size_t const availableBunchSlots
Definition: FillInfo.h:27
float m_betastar
Definition: FillInfo.h:154
void setIntensityForBeam1(float const &intensity)
Definition: FillInfo.cc:223
std::string m_injectionScheme
Definition: FillInfo.h:156
void setBunchesInBeam1(unsigned short const &bunches)
Definition: FillInfo.cc:205
ParticleTypeId const particleTypeForBeam2() const
Definition: FillInfo.cc:155
FillInfo()
Definition: FillInfo.cc:72
cond::Time_t const beginTime() const
Definition: FillInfo.cc:169
std::bitset< bunchSlots+1 > m_bunchConfiguration1
Definition: FillInfo.h:160
ParticleType ParticleTypeId
Definition: FillInfo.h:18
cond::Time_t const endTime() const
Definition: FillInfo.cc:171
unsigned short const collidingBunches() const
Definition: FillInfo.cc:147
unsigned long long Time_t
Definition: Time.h:14
std::bitset< bunchSlots+1 > const & bunchBitsetForBeam1() const
Definition: FillInfo.cc:308
void setParticleTypeForBeam2(ParticleTypeId const &particleType)
Definition: FillInfo.cc:217
void setEndTime(cond::Time_t const &endTime)
Definition: FillInfo.cc:233
cond::Time_t m_endTime
Definition: FillInfo.h:155
unsigned short m_targetBunches
Definition: FillInfo.h:151
bool isBunchInBeam2(size_t const &bunch) const
Definition: FillInfo.cc:189
float m_energy
Definition: FillInfo.h:154
FillType FillTypeId
Definition: FillInfo.h:17
void setTargetBunches(unsigned short const &targetBunches)
Definition: FillInfo.cc:211
std::vector< unsigned short > bunchConfigurationForBeam1() const
Definition: FillInfo.cc:196
FillTypeId m_fillType
Definition: FillInfo.h:152
bool is25nsBunchSpacing() const
Definition: FillInfo.cc:177
void print(std::stringstream &ss) const
Definition: FillInfo.cc:276
void setFill(unsigned short const &lhcFill, bool const &fromData=true)
Definition: FillInfo.cc:115
static size_t const bunchSlots
Definition: FillInfo.h:24
~FillInfo()
Definition: FillInfo.cc:112
FillTypeId const fillType() const
Definition: FillInfo.cc:151
bool m_isData
Definition: FillInfo.h:149
unsigned short m_collidingBunches
Definition: FillInfo.h:151
float m_intensity1
Definition: FillInfo.h:154
#define COND_SERIALIZABLE
Definition: Serializable.h:39
void setParticleTypeForBeam1(ParticleTypeId const &particleType)
Definition: FillInfo.cc:215
float const intensityForBeam1() const
Definition: FillInfo.cc:161
std::bitset< bunchSlots+1 > const & bunchBitsetForBeam2() const
Definition: FillInfo.cc:310
cond::Time_t m_createTime
Definition: FillInfo.h:155
cond::Time_t const createTime() const
Definition: FillInfo.cc:167
unsigned short const bunchesInBeam1() const
Definition: FillInfo.cc:143
void setBeginTime(cond::Time_t const &beginTime)
Definition: FillInfo.cc:231
std::string const & injectionScheme() const
Definition: FillInfo.cc:173
ParticleTypeId const particleTypeForBeam1() const
Definition: FillInfo.cc:153
void setBunchesInBeam2(unsigned short const &bunches)
Definition: FillInfo.cc:207
ParticleTypeId m_particles2
Definition: FillInfo.h:153
void setEnergy(float const &energy)
Definition: FillInfo.cc:227
float const betaStar() const
Definition: FillInfo.cc:159
unsigned short const targetBunches() const
Definition: FillInfo.cc:149
bool const isData() const
Definition: FillInfo.cc:141
void setCreationTime(cond::Time_t const &createTime)
Definition: FillInfo.cc:229
void setInjectionScheme(std::string const &injectionScheme)
Definition: FillInfo.cc:235
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
float m_intensity2
Definition: FillInfo.h:154