CMS 3D CMS Logo

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