38std::vector<int> generateIntegers(
size_t size,
int min,
int max)
40 std::uniform_int_distribution<int> distribution(
min,
max);
41 std::mt19937 generator(std::random_device{}());
42 std::vector<int>
data;
44 data.emplace_back(distribution(generator));
50 for (
auto i = 0;
i <
data.size(); ++
i) {
63std::vector<o2::dcs::DataPointCompositeObject>
generate(
const std::vector<o2::dcs::test::HintType> hints,
67 std::vector<o2::dcs::DataPointCompositeObject> dataPoints;
70 auto dsec =
d.Convert();
74 std::string refDate =
d.AsSQLString();
76 auto GenerateVisitor = [refDate](
const auto&
t) {
80 for (
const auto& hint : hints) {
81 auto dpcoms = std::visit(GenerateVisitor, hint);
82 for (
auto dp : dpcoms) {
83 dataPoints.push_back(dp);
87 auto indices = generateIntegers(fraction * dataPoints.size(), 0, dataPoints.size() - 1);
88 std::vector<o2::dcs::DataPointCompositeObject> tmp;
92 dataPoints.push_back(tmp[
i]);
118 float mDeltaFraction;
119 std::vector<o2::dcs::test::HintType> mDataPointHints;
123DCSRandomDataGenerator::DCSRandomDataGenerator(std::vector<o2::dcs::test::HintType> hints,
130 mDeltaFraction = ic.
options().
get<
float>(
"delta-fraction");
137 uint64_t tfid = o2::header::get<o2::framework::DataProcessingHeader*>((*input).header)->startTime;
138 if (tfid >= mMaxTF) {
139 LOG(info) <<
"Data generator reached TF " << tfid <<
", stopping";
144 bool generateFBI = (mTFs % mMaxCyclesNoFullMap == 0);
146 float fraction = (generateFBI ? 1.0 : mDeltaFraction);
149 auto dpcoms =
generate(mDataPointHints, fraction, tfid);
151 LOG(info) <<
"***************** TF " << tfid <<
" has generated " << dpcoms.size() <<
" DPs";
153 auto timeNow = std::chrono::system_clock::now();
154 timingInfo.creation = std::chrono::duration_cast<std::chrono::milliseconds>(timeNow.time_since_epoch()).count();
166 std::string desc{detName};
167 desc +=
"DATAPOINTS";
174 "dcs-random-data-generator",
176 Outputs{{{
"outputDCS"},
"DCS", dd}},
177 AlgorithmSpec{adaptFromTask<DCSRandomDataGenerator>(hints, dd)},
179 {
"max-timeframes", VariantType::Int64, 99999999999ll, {
"max TimeFrames to generate"}},
180 {
"delta-fraction", VariantType::Float, 0.05f, {
"fraction of data points to put in the delta"}},
181 {
"max-cycles-no-full-map", VariantType::Int64, 6000ll, {
"max num of cycles between the sending of 2 full maps"}}}};
header::DataDescription description
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events d
T get(const char *key) const
void snapshot(const Output &spec, T const &object)
ConfigParamRegistry const & options()
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
InputRecord & inputs()
The inputs associated with this processing context.
ServiceRegistryRef services()
The services registry associated with this processing context.
virtual void init(InitContext &context)
virtual void run(ProcessingContext &context)=0
GLsizei GLenum const void * indices
o2::framework::DataProcessorSpec getDCSRandomDataGeneratorSpec(std::vector< HintType > hints={}, const char *detName="TOF")
std::vector< DataPointCompositeObject > generateRandomDataPoints(const std::vector< std::string > &aliases, T min, T max, std::string refDate="")
Defining ITS Vertex explicitly as messageable.
@ Me
Only quit this data processor.
std::vector< InputSpec > Inputs
std::vector< OutputSpec > Outputs
Enum< T >::Iterator begin(Enum< T >)
TLorentzVector generate(Vec3D &vtx, std::vector< o2::track::TrackParCov > &vctr, float bz, TGenPhaseSpace &genPHS, double parMass, const std::vector< double > &dtMass, std::vector< int > forceQ)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"