12#include "../Framework/Core/src/ArrowSupport.h"
14#include "Monitoring/Monitoring.h"
22#include <TStopwatch.h>
50 std::unique_ptr<o2::eventgen::GeneratorService>
genservice;
61 LOG(error) <<
"Could not parse vtxMode";
69 if (
nEvents <= std::numeric_limits<unsigned int>::max()) {
70 unsigned int castNEvents =
static_cast<unsigned int>(
nEvents);
79 LOG(warn) <<
"Not yet supported. This needs definition of a timestamp and fetching of the MeanVertex CCDB object";
85 outfile.reset(
new TFile(kineoutfilename.c_str(),
"RECREATE"));
86 outtree.reset(
new TTree(
"o2sim",
"o2sim"));
92 std::vector<o2::MCTrack> mctracks;
94 auto mctrack_ptr = &mctracks;
97 br->SetAddress(&mctrack_ptr);
102 genservice->generateEvent_MCTracks(mctracks, mcheader);
114 pc.
services().
get<o2::monitoring::Monitoring>().send(o2::monitoring::Metric{(uint64_t)
tfCounter,
"df-sent"}.addTag(o2::monitoring::tags::Key::Subsystem, o2::monitoring::tags::Value::DPL));
115 bool time_expired =
false;
118 time_expired =
timer.RealTime() >
ttl;
121 LOG(info) <<
"TTL expired after " <<
eventCounter <<
" events ... sending end-of-stream";
140 auto spec = adaptAnalysisTask<GeneratorTask>(cfgc);
141 spec.outputs.emplace_back(
"MC",
"MCHEADER", 0, Lifetime::Timeframe);
142 spec.outputs.emplace_back(
"MC",
"MCTRACKS", 0, Lifetime::Timeframe);
Definition of the Detector class.
Definition of the Names Generator class.
Definition of the MCTrack class.
static std::string getMCKinematicsFileName(const std::string_view prefix=STANDARDSIMPREFIX)
static void updateFromFile(std::string const &, std::string const ¶msList="", bool unchangedOnly=false)
static void updateFromString(std::string const &)
static bool parseVertexModeString(std::string const &vertexstring, o2::conf::VertexMode &mode)
A class offering convenient generator configuration and encapsulation of lower level classes....
static void setTotalNEvents(unsigned int &n)
void snapshot(const Output &spec, T const &object)
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
ServiceRegistryRef services()
The services registry associated with this processing context.
static ULong_t setGRandomSeed(ULong_t seed=0)
WorkflowSpec defineDataProcessing(ConfigContext const &cfgc)
This function hooks up the the workflow specifications into the DPL driver.
GLenum const GLfloat * params
TBranch * getOrMakeBranch(TTree &tree, const char *brname, T *ptr)
Defining PrimaryVertex explicitly as messageable.
std::vector< DataProcessorSpec > WorkflowSpec
Configurable< int > aggregate
Configurable< std::string > outputPrefix
void run(o2::framework::ProcessingContext &pc)
std::unique_ptr< TTree > outtree
std::unique_ptr< o2::eventgen::GeneratorService > genservice
Configurable< long > seed
Configurable< std::string > trigger
Configurable< GenCount > eventNum
Configurable< int64_t > ttl
Configurable< std::string > iniFile
Configurable< std::string > generator
void init(o2::framework::InitContext &)
Configurable< std::string > vtxModeArg
std::unique_ptr< TFile > outfile
static ServiceSpec arrowBackendSpec()
static AlgorithmSpec wrapWithRateLimiting(AlgorithmSpec spec)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"