12#include "../Framework/Core/src/ArrowSupport.h"
14#include "Monitoring/Monitoring.h"
19#include "HepMC3/GenEvent.h"
20#include "HepMC3/GenParticle.h"
21#include "HepMC3/GenVertex.h"
22#include "HepMC3/ReaderAscii.h"
23#include "HepMC3/ReaderAsciiHepMC2.h"
50 LOGP(fatal,
"Cannot open HEPMC kine file {}", (std::string)
hepmcFileName);
58 HepMC3::GenEvent
event;
63 LOGP(warn,
"Failed to read from HEPMC input file");
70 mcHeader.SetEventID(
event.event_number());
71 mcHeader.SetVertex(
event.event_pos().px(),
event.event_pos().py(),
event.event_pos().pz());
72 auto xsecInfo =
event.cross_section();
73 if (xsecInfo !=
nullptr) {
80 if (scale !=
nullptr) {
84 if (nMPI !=
nullptr) {
91 }
else if (scode !=
nullptr) {
94 auto pdfInfo =
event.pdf_info();
95 if (pdfInfo !=
nullptr) {
106 auto heavyIon =
event.heavy_ion();
107 if (heavyIon !=
nullptr) {
121 mcHeader.
putInfo(
"eccentricity", (
float)heavyIon->eccentricity);
126 auto particles =
event.particles();
127 for (
auto const& particle : particles) {
128 auto parents = particle->parents();
129 auto has_parents = parents.size() > 0;
130 auto children = particle->children();
131 auto has_children = children.size() > 0;
132 auto p = particle->momentum();
133 auto v = particle->production_vertex();
136 has_parents ? parents.front()->id() : -1, has_parents ? parents.back()->id() : -1,
137 has_children ? children.front()->id() : -1, has_children ? children.back()->id() : -1,
138 p.px(), p.py(), p.pz(),
139 v->position().x(),
v->position().y(),
v->position().z(),
140 v->position().t(), 0);
152 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));
162 auto spec = adaptAnalysisTask<O2simHepmcPublisher>(cfgc);
163 spec.outputs.emplace_back(
"MC",
"MCHEADER", 0, Lifetime::Timeframe);
164 spec.outputs.emplace_back(
"MC",
"MCTRACKS", 0, Lifetime::Timeframe);
Definition of the MCTrack class.
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.
Defining PrimaryVertex explicitly as messageable.
std::vector< DataProcessorSpec > WorkflowSpec
WorkflowSpec defineDataProcessing(ConfigContext const &cfgc)
This function hooks up the the workflow specifications into the DPL driver.
Configurable< int > aggregate
Configurable< std::string > hepmcFileName
void run(o2::framework::ProcessingContext &pc)
void init(o2::framework::InitContext &)
std::vector< o2::MCTrack > mcTracks
std::shared_ptr< HepMC3::Reader > hepMCReader
Configurable< bool > hepmcv2
Configurable< int > maxEvents
static ServiceSpec arrowBackendSpec()
static AlgorithmSpec wrapWithRateLimiting(AlgorithmSpec spec)