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
FillInfo::bunchesInBeam2
unsigned const short bunchesInBeam2() const
Definition: FillInfo.cc:145
FillInfo::XE54
Definition: FillInfo.h:16
FillInfo::AR18
Definition: FillInfo.h:16
FillInfo::setBunchesInBeam2
void setBunchesInBeam2(unsigned short const &bunches)
Definition: FillInfo.cc:207
FillInfo::m_particles2
ParticleTypeId m_particles2
Definition: FillInfo.h:153
FillInfo::setParticleTypeForBeam1
void setParticleTypeForBeam1(ParticleTypeId const &particleType)
Definition: FillInfo.cc:215
FillInfo::targetBunches
unsigned const short targetBunches() const
Definition: FillInfo.cc:149
FillInfo::setParticleTypeForBeam2
void setParticleTypeForBeam2(ParticleTypeId const &particleType)
Definition: FillInfo.cc:217
FillInfo::setCrossingAngle
void setCrossingAngle(float const &angle)
Definition: FillInfo.cc:219
FillInfo::m_bunches1
unsigned short m_bunches1
Definition: FillInfo.h:151
FillInfo::setTargetBunches
void setTargetBunches(unsigned short const &targetBunches)
Definition: FillInfo.cc:211
zMuMuMuonUserData.beta
beta
Definition: zMuMuMuonUserData.py:10
FillInfo
Definition: FillInfo.h:13
Time.h
FillInfo::m_lhcFill
unsigned short m_lhcFill
Definition: FillInfo.h:150
FillInfo::ParticleTypeId
ParticleType ParticleTypeId
Definition: FillInfo.h:18
FillInfo::injectionScheme
const std::string & injectionScheme() const
Definition: FillInfo.cc:173
FillInfo::crossingAngle
const float crossingAngle() const
Definition: FillInfo.cc:157
COND_SERIALIZABLE
#define COND_SERIALIZABLE
Definition: Serializable.h:39
FillInfo::isData
const bool isData() const
Definition: FillInfo.cc:141
FillInfo::m_createTime
cond::Time_t m_createTime
Definition: FillInfo.h:155
FillInfo::print
void print(std::stringstream &ss) const
Definition: FillInfo.cc:276
operator<<
std::ostream & operator<<(std::ostream &, FillInfo fillInfo)
Definition: FillInfo.cc:321
FillInfo::COSMICS
Definition: FillInfo.h:15
FillInfo::bunchBitsetForBeam1
const std::bitset< bunchSlots+1 > & bunchBitsetForBeam1() const
Definition: FillInfo.cc:308
FillInfo::particleTypeForBeam2
const ParticleTypeId particleTypeForBeam2() const
Definition: FillInfo.cc:155
FillInfo::m_collidingBunches
unsigned short m_collidingBunches
Definition: FillInfo.h:151
FillInfo::FillInfo
FillInfo()
Definition: FillInfo.cc:72
FillInfo::bunchSlots
static const size_t bunchSlots
Definition: FillInfo.h:24
FillInfo::m_particles1
ParticleTypeId m_particles1
Definition: FillInfo.h:153
FillInfo::availableBunchSlots
static const size_t availableBunchSlots
Definition: FillInfo.h:27
FillInfo::NONE
Definition: FillInfo.h:16
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
FillInfo::m_intensity1
float m_intensity1
Definition: FillInfo.h:154
FillInfo::setBunchBitsetForBeam2
void setBunchBitsetForBeam2(std::bitset< bunchSlots+1 > const &bunchConfiguration)
Definition: FillInfo.cc:317
FillInfo::fillNumber
unsigned const short fillNumber() const
Definition: FillInfo.cc:139
FillInfo::setCreationTime
void setCreationTime(cond::Time_t const &createTime)
Definition: FillInfo.cc:229
FillInfo::bunchConfigurationForBeam1
std::vector< unsigned short > bunchConfigurationForBeam1() const
Definition: FillInfo.cc:196
FillInfo::m_injectionScheme
std::string m_injectionScheme
Definition: FillInfo.h:156
FillInfo::FillTypeId
FillType FillTypeId
Definition: FillInfo.h:17
FillInfo::setBetaStar
void setBetaStar(float const &betaStar)
Definition: FillInfo.cc:221
FillInfo::setIntensityForBeam2
void setIntensityForBeam2(float const &intensity)
Definition: FillInfo.cc:225
FillInfo::setBeamInfo
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
FillInfo::setCollidingBunches
void setCollidingBunches(unsigned short const &collidingBunches)
Definition: FillInfo.cc:209
FillInfo::IONS
Definition: FillInfo.h:15
FillInfo::m_intensity2
float m_intensity2
Definition: FillInfo.h:154
FillInfo::m_targetBunches
unsigned short m_targetBunches
Definition: FillInfo.h:151
FillInfo::D
Definition: FillInfo.h:16
FillInfo::isBunchInBeam2
bool isBunchInBeam2(size_t const &bunch) const
Definition: FillInfo.cc:189
FillInfo::isBunchInBeam1
bool isBunchInBeam1(size_t const &bunch) const
Definition: FillInfo.cc:183
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FillInfo::endTime
const cond::Time_t endTime() const
Definition: FillInfo.cc:171
FillInfo::setIntensityForBeam1
void setIntensityForBeam1(float const &intensity)
Definition: FillInfo.cc:223
FillInfo::setEndTime
void setEndTime(cond::Time_t const &endTime)
Definition: FillInfo.cc:233
cond::Time_t
unsigned long long Time_t
Definition: Time.h:14
FillInfo::bunchBitsetForBeam2
const std::bitset< bunchSlots+1 > & bunchBitsetForBeam2() const
Definition: FillInfo.cc:310
FillInfo::PROTON
Definition: FillInfo.h:16
Serializable.h
FillInfo::m_crossingAngle
float m_crossingAngle
Definition: FillInfo.h:154
FillInfo::beginTime
const cond::Time_t beginTime() const
Definition: FillInfo.cc:169
FillInfo::m_betastar
float m_betastar
Definition: FillInfo.h:154
FillInfo::m_beginTime
cond::Time_t m_beginTime
Definition: FillInfo.h:155
FillInfo::setInjectionScheme
void setInjectionScheme(std::string const &injectionScheme)
Definition: FillInfo.cc:235
FillInfo::setFillType
void setFillType(FillTypeId const &fillType)
Definition: FillInfo.cc:213
FillInfo::m_bunches2
unsigned short m_bunches2
Definition: FillInfo.h:151
FillInfo::bunchConfigurationForBeam2
std::vector< unsigned short > bunchConfigurationForBeam2() const
Definition: FillInfo.cc:200
FillInfo::intensityForBeam2
const float intensityForBeam2() const
Definition: FillInfo.cc:163
FillInfo::UNKNOWN
Definition: FillInfo.h:15
generator_cfi.scheme
scheme
Definition: generator_cfi.py:22
FillInfo::energy
const float energy() const
Definition: FillInfo.cc:165
FillInfo::createTime
const cond::Time_t createTime() const
Definition: FillInfo.cc:167
FillInfo::FillType
FillType
Definition: FillInfo.h:15
FillInfo::m_bunchConfiguration1
std::bitset< bunchSlots+1 > m_bunchConfiguration1
Definition: FillInfo.h:160
FillInfo::fillType
const FillTypeId fillType() const
Definition: FillInfo.cc:151
FillInfo::m_isData
bool m_isData
Definition: FillInfo.h:149
FillInfo::setBunchBitsetForBeam1
void setBunchBitsetForBeam1(std::bitset< bunchSlots+1 > const &bunchConfiguration)
Definition: FillInfo.cc:313
FillInfo::is25nsBunchSpacing
bool is25nsBunchSpacing() const
Definition: FillInfo.cc:177
FillInfo::PB82
Definition: FillInfo.h:16
angle
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
FillInfo::m_endTime
cond::Time_t m_endTime
Definition: FillInfo.h:155
FillInfo::m_energy
float m_energy
Definition: FillInfo.h:154
FillInfo::GAP
Definition: FillInfo.h:15
FillInfo::collidingBunches
unsigned const short collidingBunches() const
Definition: FillInfo.cc:147
FillInfo::setFill
void setFill(unsigned short const &lhcFill, bool const &fromData=true)
Definition: FillInfo.cc:115
FillInfo::bunchesInBeam1
unsigned const short bunchesInBeam1() const
Definition: FillInfo.cc:143
FillInfo::m_bunchConfiguration2
std::bitset< bunchSlots+1 > m_bunchConfiguration2
Definition: FillInfo.h:160
FillInfo::intensityForBeam1
const float intensityForBeam1() const
Definition: FillInfo.cc:161
FillInfo::setBeginTime
void setBeginTime(cond::Time_t const &beginTime)
Definition: FillInfo.cc:231
PbPb_ZMuSkimMuonDPG_cff.particleType
particleType
Definition: PbPb_ZMuSkimMuonDPG_cff.py:27
FillInfo::m_fillType
FillTypeId m_fillType
Definition: FillInfo.h:152
FillInfo::setBunchesInBeam1
void setBunchesInBeam1(unsigned short const &bunches)
Definition: FillInfo.cc:205
FillInfo::~FillInfo
~FillInfo()
Definition: FillInfo.cc:112
FillInfo::setEnergy
void setEnergy(float const &energy)
Definition: FillInfo.cc:227
FillInfo::PROTONS
Definition: FillInfo.h:15
FillInfo::betaStar
const float betaStar() const
Definition: FillInfo.cc:159
FillInfo::particleTypeForBeam1
const ParticleTypeId particleTypeForBeam1() const
Definition: FillInfo.cc:153
FillInfo::ParticleType
ParticleType
Definition: FillInfo.h:16