21#include "Gaudi/Property.h"
36 char operator() (
char c)
const {
return std::tolower(c); }
47 ISvcLocator* pSvcLocator ) :
58 descr =
"List of INavigable4Momentum containers one wants to dump";
62 std::vector<std::string> inav4momContainersName( 0 );
65 descr =
"Name of the output stream where we'll dump informations from the";
66 descr +=
" INavigable4MomentumCollection object(s).";
67 descr +=
" Valid stream names are: \n";
68 descr +=
" - \"MsgStream\"\n";
69 descr +=
" - \"stderr\"\n";
70 descr +=
" - \"stdout\"\n";
71 descr +=
" - \"/path/to/some/file\".";
101 <<
"] containers:" );
102 for ( std::vector<std::string>::const_iterator
112 return StatusCode::SUCCESS;
118 return StatusCode::SUCCESS;
125 typedef std::vector<std::string>::const_iterator ContNameIterator;
127 for ( ContNameIterator
135 if ( !
dump( *itr ).isSuccess() ) {
142 return StatusCode::SUCCESS;
155 <<
"] INavigable4MomentumCollection in StoreGate !" );
156 return StatusCode::RECOVERABLE;
159 const INav4Moms_t * coll = 0;
160 if ( !
evtStore()->retrieve( coll, collName ).isSuccess() ||
163 ATH_MSG_WARNING(
"Could not retrieve any INavigable4MomentumCollection at ["
164 << collName <<
"] !!" );
165 return StatusCode::RECOVERABLE;
168 std::ostringstream out;
170 const std::size_t iMax = coll->size();
171 out <<
"Retrieved [" << collName <<
"] ==> size = " << iMax <<
"\n";
172 if ( coll->empty() ) {
173 return StatusCode::SUCCESS;
177 typedef std::set<const INavigable4Momentum*, P4Sorters::Descending::Pt> Coll_t;
178 Coll_t inav4moms( coll->begin(), coll->end() );
182 if ( 0 !=
m_outputStream ) { (*m_outputStream) << out.str() << std::flush;
186 return StatusCode::SUCCESS;
205 std::transform( streamName.begin(), streamName.end(),
209 const std::string stdout =
"stdout";
210 const std::string stderr =
"stderr";
211 const std::string msgstream =
"msgstream";
213 if ( streamName == msgstream ) {
215 }
else if ( streamName == stdout ) {
217 }
else if ( streamName == stderr ) {
221 std::ios::out | std::ios::trunc );
#define ATH_MSG_WARNING(x)
DataVector< INavigable4Momentum > INavigable4MomentumCollection
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
StringArrayProperty m_inav4momContainersName
List of INavigable4Momentum containers one wants to dump.
virtual ~INav4MomDumper()
Destructor:
std::ostream * m_outputStream
pointer to the file descriptor in case the output stream is not a "MsgStream"
StatusCode dump(const std::string &collName)
Prints out (on the configured output stream) the content of an INavigable4MomentumCollection object,...
StringProperty m_outputStreamName
Name of the output stream where we'll dump informations from the INav4MomAssocs object.
virtual StatusCode initialize()
virtual StatusCode finalize()
void setupOutputStream(Gaudi::Details::PropertyBase &outputStreamName)
Callback method to configure the output stream into which we'll dump the informations from INavigable...
INav4MomDumper()
Default constructor:
virtual StatusCode execute()
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
std::ostream & dump(std::ostream &out, const I4MomIter iBeg, const I4MomIter iEnd)
Helper to stream out a range of I4Momentum objects.