28 static const char *
const s_protocolSep =
":";
42 const std::string&
name,
43 const IInterface*
parent ) :
45 m_ioBackend( nullptr )
53 "Name of the back-end we'll use to write out the "
54 "TruthParticleContainer.\nEx: ascii:mcaod.txt" );
60 "Input location of the TruthParticleContainer to write out" );
62 declareInterface<IIOMcAodTool>(
this);
85 return StatusCode::FAILURE;
93 return StatusCode::SUCCESS;
102 return StatusCode::SUCCESS;
110 nullptr == mcParts ) {
113 return StatusCode::RECOVERABLE;
116 return write(mcParts);
125 if (
nullptr == mcParts ) {
127 return StatusCode::RECOVERABLE;
133 out <<
"---" << std::setw(5) << mcParts->
size() << std::endl;
134 for (
unsigned int i = 0;
i != mcParts->
size(); ++
i ) {
136 out <<
"P " << std::setprecision(3) << std::setw(10) <<
mc->px()
137 <<
" " << std::setprecision(3) << std::setw(10) <<
mc->py()
138 <<
" " << std::setprecision(3) << std::setw(10) <<
mc->pz()
139 <<
" " << std::setprecision(3) << std::setw(10) <<
mc->e()
140 <<
" " << std::setprecision(3) << std::setw(10) <<
mc->pdgId()
141 <<
" " << std::setprecision(3) << std::setw(10) <<
mc->charge()
142 <<
" " << std::setprecision(3) << std::setw(10) <<
HepMC::barcode(
mc->genParticle())
147 for (
unsigned int iCone = 0;
150 out <<
" " << std::setprecision(3) << std::setw(10)
156 return StatusCode::SUCCESS;
162 std::string protocol =
"ascii";
174 std::string::size_type protocolPos =
url.find(s_protocolSep);
176 if ( std::string::npos != protocolPos ) {
177 protocol =
url.substr( 0, protocolPos );
178 fileName =
url.substr( protocolPos+1, std::string::npos );
189 if (
"ascii" == protocol ) {
195 <<
"Will use [ascii] instead...");
201 ATH_MSG_DEBUG(
"Using protocol [" << protocol <<
"] and write to ["