Skip to content

Commit 2a20074

Browse files
committed
Allow to specify the starting orbit as a fractional value
Allow to provide the start orbit as a fraction (e.g, 32.7). This will determine the starting bunch crossing relative to the integral orbit part. In result, this allows to construct collisions starting somewhere within an orbit ... not only at the start.
1 parent 688eac2 commit 2a20074

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Steer/src/CollisionContextTool.cxx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ struct Options {
4545
bool printContext = false;
4646
std::string bcpatternfile;
4747
int tfid = 0; // tfid -> used to calculate start orbit for collisions
48+
double firstFractionalOrbit; // capture orbit and bunch crossing via decimal number
4849
uint32_t firstOrbit = 0; // first orbit in run (orbit offset)
50+
uint32_t firstBC = 0; // first bunch crossing (relative to firstOrbit) of the first interaction;
4951
int orbitsPerTF = 256; // number of orbits per timeframe --> used to calculate start orbit for collisions
5052
bool useexistingkinematics = false;
5153
bool noEmptyTF = false; // prevent empty timeframes; the first interaction will be shifted backwards to fall within the range given by Options.orbits
@@ -196,7 +198,7 @@ bool parseOptions(int argc, char* argv[], Options& optvalues)
196198
"orbitsPerTF", bpo::value<int>(&optvalues.orbitsPerTF)->default_value(256), "Orbits per timeframes")(
197199
"use-existing-kine", "Read existing kinematics to adjust event counts")(
198200
"timeframeID", bpo::value<int>(&optvalues.tfid)->default_value(0), "Timeframe id of the first timeframe int this context. Allows to generate contexts for different start orbits")(
199-
"first-orbit", bpo::value<uint32_t>(&optvalues.firstOrbit)->default_value(0), "First orbit in the run (HBFUtils.firstOrbit)")(
201+
"first-orbit", bpo::value<double>(&optvalues.firstFractionalOrbit)->default_value(0), "First (fractional) orbit in the run (HBFUtils.firstOrbit + BC from decimal)")(
200202
"maxCollsPerTF", bpo::value<int>(&optvalues.maxCollsPerTF)->default_value(-1), "Maximal number of MC collisions to put into one timeframe. By default no constraint.")(
201203
"noEmptyTF", bpo::bool_switch(&optvalues.noEmptyTF), "Enforce to have at least one collision")("configKeyValues", bpo::value<std::string>(&optvalues.configKeyValues)->default_value(""), "Semicolon separated key=value strings (e.g.: 'TPC.gasDensity=1;...')")("with-vertices", "Assign vertices to collisions.")("timestamp", bpo::value<long>(&optvalues.timestamp)->default_value(-1L), "Timestamp for CCDB queries / anchoring");
202204

@@ -221,6 +223,14 @@ bool parseOptions(int argc, char* argv[], Options& optvalues)
221223
if (vm.count("with-vertices")) {
222224
optvalues.genVertices = true;
223225
}
226+
227+
// fix the first orbit and bunch crossing
228+
// auto orbitbcpair = parseOrbitAndBC(optvalues.firstIRString);
229+
optvalues.firstOrbit = (uint32_t)optvalues.firstFractionalOrbit;
230+
optvalues.firstBC = (uint32_t)((optvalues.firstFractionalOrbit - 1. * optvalues.firstOrbit) * o2::constants::lhc::LHCMaxBunches);
231+
LOG(info) << "First orbit " << optvalues.firstOrbit;
232+
LOG(info) << "First BC " << optvalues.firstBC;
233+
224234
} catch (const bpo::error& e) {
225235
std::cerr << e.what() << "\n\n";
226236
std::cerr << "Error parsing options; Available options:\n";
@@ -285,7 +295,7 @@ int main(int argc, char* argv[])
285295
o2::InteractionTimeRecord record;
286296
// this loop makes sure that the first collision is within the range of orbits asked (if noEmptyTF is enabled)
287297
do {
288-
sampler.setFirstIR(o2::InteractionRecord(0, orbitstart));
298+
sampler.setFirstIR(o2::InteractionRecord(options.firstBC, orbitstart));
289299
sampler.init();
290300
record = sampler.generateCollisionTime();
291301
} while (options.noEmptyTF && usetimeframelength && record.orbit >= orbitstart + options.orbits);

0 commit comments

Comments
 (0)