CMS 3D CMS Logo

LumiInfoRunHeader.cc
Go to the documentation of this file.
2 
4  std::string& fillingSchemeName,
5  std::bitset<LumiConstants::numBX>& fillingScheme)
6  : lumiProvider_(lumiProvider), fillingSchemeName_(fillingSchemeName), fillingScheme_(fillingScheme) {
8 }
9 
13 }
14 
15 //==============================================================================
16 
17 void LumiInfoRunHeader::setFillingScheme(const std::bitset<LumiConstants::numBX>& fillingScheme) {
18  fillingScheme_ = fillingScheme;
20 }
21 
22 // This function determines the bunch spacing from the filling scheme
23 // and sets bunchSpacing_ accordingly.
24 
26  int lastFilledBunch = -1;
27  int minimumSpacingFound = LumiConstants::numBX;
28 
29  for (unsigned int i = 0; i < LumiConstants::numBX; i++) {
30  if (fillingScheme_[i]) {
31  if (lastFilledBunch >= 0) {
32  int thisSpacing = i - lastFilledBunch;
33  if (thisSpacing < minimumSpacingFound)
34  minimumSpacingFound = thisSpacing;
35  }
36  lastFilledBunch = i;
37  }
38  }
39 
40  // If no bunches are filled, then just leave bunchSpacing at 0
41  if (lastFilledBunch == -1)
42  bunchSpacing_ = 0;
43  else
44  bunchSpacing_ = LumiConstants::bxSpacingInt * minimumSpacingFound;
45 }
std::bitset< LumiConstants::numBX > fillingScheme_
static const unsigned int numBX
Definition: LumiConstants.h:8
static const int bxSpacingInt
Definition: LumiConstants.h:10
LumiInfoRunHeader()
Default constructor.
std::string lumiProvider_
std::string fillingSchemeName_
bool isProductEqual(LumiInfoRunHeader const &o) const
Product compare function.
void setFillingScheme(const std::bitset< LumiConstants::numBX > &fillingScheme)
Set filling scheme.