32 mBeamAC[0] = mBeamAC[1] = mPattern;
77 mPattern.set(bcID,
active);
79 mBeamAC[dir].set(bcID,
active);
87 for (
int dir = -1; dir < 2; dir++) {
101 for (
int i = 0;
i < nBC;
i++) {
103 firstBC += bcSpacing;
112 for (
int it = 0; it < nTrains; it++) {
114 firstBC += nBC * bcSpacing + trainSpacingInBC;
121 auto& dest = dir < 0 ? mPattern : mBeamAC[dir];
128 const std::string names[3] = {
"Interacting",
"Beam-A",
"Beam-C"};
129 for (
int id = -1;
id < 2;
id++) {
130 if (
id == dir || (dir < -1 || dir > 1)) {
131 printf(
"%s bunches\n", names[
id + 1].c_str());
136 printf(
"%c", on ?
'+' :
'-');
142 if (((
i + 1) % bcPerLine) == 0) {
160 TFile fl(fileName.data());
162 LOG(error) <<
"Failed to open " << fileName;
165 std::string nm = objName.empty() ? o2::BunchFilling::Class()->GetName() : objName;
166 auto bf =
reinterpret_cast<o2::BunchFilling*
>(fl.GetObjectChecked(nm.c_str(), o2::BunchFilling::Class()));
168 LOG(error) <<
"Did not find object named " << nm;
182 std::vector<unsigned char> input;
183 for (
unsigned char c : p) {
184 if (
c ==
'(' ||
c ==
')' || std::isdigit(
c)) {
186 }
else if (
c ==
'h' ||
c ==
'H') {
187 input.push_back(
'H');
188 }
else if (
c ==
'l' ||
c ==
'L') {
189 input.push_back(
'L');
190 }
else if (!std::isspace(
c)) {
191 throw std::runtime_error(fmt::format(
"forbidden character ({}) in input string ({})",
c, p));
196 int ibit = 0,
level = 0;
197 const unsigned char* in = input.data();
198 if (!parsePattern(in, patt, ibit,
level)) {
199 throw std::runtime_error(fmt::format(
"failed to extract BC pattern from input string ({})", p));
210 for (
int b : buckets) {
217 pattS += fmt::format(
"{}L", nh);
232 Pattern& patt = mBeamAC[ibeam];
233 for (
int b : buckets) {
246 auto setBunch = [&patt, &ibit](
bool v) {
247 if (ibit < patt.size()) {
250 throw std::runtime_error(fmt::format(
"provided pattern overflow max bunch {}", patt.size()));
256 LOG(error) <<
"Missing )";
262 for (
int i = 0;
i < repetion;
i++) {
267 }
else if (*input ==
'L') {
268 for (
int i = 0;
i < repetion;
i++) {
273 }
else if (std::isdigit(*input)) {
274 repetion =
int((*input++) -
'0');
275 while (*input && std::isdigit(*input)) {
276 repetion = repetion * 10 +
int(*(input++) -
'0');
278 }
else if (*input ==
'(') {
281 if (!parsePattern(input, patt, ibit,
level)) {
285 for (
int i = 0;
i < repetion - 1;
i++) {
286 for (
int j = ibit1;
j < ibit2;
j++) {
291 }
else if (*input ==
')') {
294 LOG(error) <<
"Incorrectly placed )";
299 LOG(error) <<
"Unexpected symbol " << *input;
void mergeWith(o2::BunchFilling const &other)
std::bitset< o2::constants::lhc::LHCMaxBunches > Pattern
void setBCTrains(int nTrains, int trainSpacingInBC, int nBC, int bcSpacing, int firstBC, int dir=-1)
static std::string buckets2PatternString(const std::vector< int > &buckets, int ibeam)
void setBCTrain(int nBC, int bcSpacing, int firstBC, int dir=-1)
std::vector< int > getFilledBCs(int dir=-1) const
void print(int dir=-2, bool filledOnly=true, int bcPerLine=20) const
int getLastFilledBC(int dir=-1) const
void setBC(int bcID, bool active=true, int dir=-1)
bool testBC(int bcID, int dir=-1) const
int getFirstFilledBC(int dir=-1) const
void setBCFilling(const std::string &patt, int dir=-1)
void setInteractingBCsFromBeams()
void buckets2BeamPattern(const std::vector< int > &buckets, int ibeam)
static BunchFilling * loadFrom(const std::string &fileName, const std::string &objName="")
static Pattern createPattern(const std::string &p)
GLboolean GLboolean GLboolean b
constexpr int LHCMaxBunches
constexpr int LHCBunch2P2BC(int bunch, BeamDirection dir)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
VectorOfTObjectPtrs other
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"