28 base_class(
type, name, parent ),
35 declareProperty(
"Output",
m_ioBackendURL =
"ascii:hepmc.genevent.txt",
"Name of the back-end we'll use to write out the HepMC::GenEvent.\nEx: ascii:hepmc.genevent.txt" );
37 declareProperty(
"McEvents",
m_mcEventsName =
"GEN_EVENT",
"Input location of the McEventCollection to write out" );
54 if ( !evtStore().retrieve().isSuccess() ) {
56 return StatusCode::FAILURE;
64 return StatusCode::SUCCESS;
70 return StatusCode::SUCCESS;
77 if ( evtStore()->retrieve( mcEvts,
m_mcEventsName ).isFailure() ||
nullptr == mcEvts ) {
79 return StatusCode::FAILURE;
82 if ( mcEvts->
empty() ) {
84 return StatusCode::FAILURE;
89 ATH_MSG_ERROR(
"Retrieved NULL pointer to HepMC::GenEvent !!");
90 return StatusCode::FAILURE;
103 return StatusCode::SUCCESS;
109 std::string protocol =
"asciiv3";
110 std::string fileName =
"hepmc.genevent.txt";
118 std::string::size_type protocolPos = url.find(
s_protocolSep);
120 if ( std::string::npos != protocolPos ) {
121 protocol = url.substr( 0, protocolPos );
122 fileName = url.substr( protocolPos + 1, std::string::npos );
128 std::transform( protocol.begin(), protocol.end(), protocol.begin(), [](
unsigned char c){ return std::tolower(c); } );
129 if (
"ascii" == protocol ) {
130 m_ioBackend = std::make_shared<HepMC3::WriterAsciiHepMC2>( fileName.c_str());
131 }
else if (
"asciiv3" == protocol ) {
132 m_ioBackend = std::make_shared<HepMC3::WriterAscii>( fileName.c_str());
134 ATH_MSG_WARNING(
"UNKNOWN protocol [" << protocol <<
"] !!" <<
endmsg <<
"Will use [ascii] instead...");
135 protocol =
"asciiv3";
136 m_ioBackend = std::make_shared<HepMC3::WriterAscii>( fileName.c_str());
138 ATH_MSG_DEBUG(
"Using protocol [" << protocol <<
"] and write to ["<< fileName <<
"]");
#define ATH_MSG_WARNING(x)
const T * front() const
Access the first element in the collection as an rvalue.
bool empty() const noexcept
Returns true if the collection is empty.
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
HepMC3::GenEvent GenEvent