| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Private Attributes | List of all members
CollectionCloneAlg Class Reference

Small algorithm, which allows to merge N-tuples in a generic way. More...

Inheritance diagram for CollectionCloneAlg:
[legend]
Collaboration diagram for CollectionCloneAlg:
[legend]

## Public Member Functions
| CollectionCloneAlg (const std::string &name, ISvcLocator *pSvcLocator)
| Standard algorithm constructor. More...
virtual | ~CollectionCloneAlg ()
| Standard Destructor. More...
virtual StatusCode | initialize ()
| Initialize. More...
virtual StatusCode | finalize ()
| Finalize. More...
virtual StatusCode | execute ()
| Execute procedure. More...
virtual StatusCode | book (const NTuple::Tuple *nt)
| Book the N-tuple according to the specification. More...
virtual StatusCode | checkInput (const NTuple::Tuple *clone, const NTuple::Tuple *src)
StatusCode | mergeEntries (const std::string &input)
| Merge the entries of a single input tuple into the output. More...
StatusCode | connect ()
| Connect input and output N-tuples. More...
StatusCode | mergeInputTuples ()
| Merge all N-tuple entries. More...
Public Member Functions inherited from Algorithm
| Algorithm (const std::string &name, ISvcLocator *svcloc, const std::string &version=PACKAGE_VERSION)
| Constructor. More...
| ~Algorithm () override=default
| Destructor. More...
StatusCode | sysStart () override
| Reinitialization method invoked by the framework. More...
StatusCode | sysInitialize () override
| Initialization method invoked by the framework. More...
StatusCode | sysReinitialize () override
| Reinitialization method invoked by the framework. More...
StatusCode | sysRestart () override
| Restart method invoked by the framework. More...
StatusCode | sysExecute () override
| The actions to be performed by the algorithm on an event. More...
StatusCode | sysStop () override
| System stop. More...
StatusCode | sysFinalize () override
| System finalization. More...
StatusCode | sysBeginRun () override
| beginRun method invoked by the framework. More...
StatusCode | sysEndRun () override
| endRun method invoked by the framework. More...
const std::string & | name () const override
| The identifying name of the algorithm object. More...
const Gaudi::StringKey & | nameKey () const override
const std::string & | type () const override
| The type of the algorithm object. More...
void | setType (const std::string &type) override
const std::string & | version () const override
unsigned int | index () const override
StatusCode | configure () override
| Dummy implementation of IStateful::configure() method. More...
StatusCode | terminate () override
| Dummy implementation of IStateful::terminate() method. More...
StatusCode | initialize () override
| the default (empty) implementation of IStateful::initialize() method More...
StatusCode | start () override
| the default (empty) implementation of IStateful::start() method More...
StatusCode | stop () override
| the default (empty) implementation of IStateful::stop() method More...
StatusCode | finalize () override
| the default (empty) implementation of IStateful::finalize() method More...
StatusCode | reinitialize () override
| the default (empty) implementation of IStateful::reinitialize() method More...
StatusCode | restart () override
| the default (empty) implementation of IStateful::restart() method More...
Gaudi::StateMachine::State | FSMState () const override
| returns the current state of the algorithm More...
Gaudi::StateMachine::State | targetFSMState () const override
| returns the state the algorithm will be in after the ongoing transition More...
bool | isExecuted () const override
| Has this algorithm been executed since the last reset? More...
void | setExecuted (bool state) override
| Set the executed flag to the specified state. More...
void | resetExecuted () override
| Reset the executed state of the Algorithm for the duration of the current event. More...
StatusCode | beginRun () override
| Algorithm begin run. More...
StatusCode | endRun () override
| Algorithm end run. This method is called at the end of the event loop. More...
bool | isEnabled () const override
| Is this algorithm enabled or disabled? More...
bool | filterPassed () const override
| Did this algorithm pass or fail its filter criterion for the last event? More...
void | setFilterPassed (bool state) override
| Set the filter passed flag to the specified state. More...
int | errorCount () const
| Get the number of failures of the algorithm. More...
template<class T >
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const
| Access a service by name, creating it if it doesn't already exist. More...
template<class T >
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const
| Access a service by name and type, creating it if it doesn't already exist. More...
SmartIF< IService > | service (const std::string &name, const bool createIf=true, const bool quiet=false) const
| Return a pointer to the service identified by name (or "type/name") More...
template<class T >
SmartIF< T > | service (const std::string &name, bool createIf=true, bool quiet=false) const
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
SmartIF< IChronoStatSvc > & | chronoSvc () const
| The standard Chrono & Stat service, Return a pointer to the service if present. More...
SmartIF< IChronoStatSvc > & | chronoStatService () const
| Obsoleted name, kept due to the backwards compatibility. More...
SmartIF< IDataProviderSvc > & | detSvc () const
| The standard detector data service. More...
SmartIF< IDataProviderSvc > & | detDataService () const
| Obsoleted name, kept due to the backwards compatibility. More...
SmartIF< IConversionSvc > & | detCnvSvc () const
| The standard detector data persistency conversion service. More...
SmartIF< IConversionSvc > & | detDataCnvService () const
| Obsoleted name, kept due to the backwards compatibility. More...
SmartIF< IDataProviderSvc > & | eventSvc () const
| The standard event data service. More...
SmartIF< IDataProviderSvc > & | evtSvc () const
| shortcut for method eventSvc More...
SmartIF< IDataProviderSvc > & | eventDataService () const
| Obsoleted name, kept due to the backwards compatibility. More...
SmartIF< IConversionSvc > & | eventCnvSvc () const
| The standard event data persistency conversion service. More...
SmartIF< IConversionSvc > & | eventDataCnvService () const
| Obsoleted name, kept due to the backwards compatibility. More...
SmartIF< IHistogramSvc > & | histoSvc () const
| The standard histogram service. More...
SmartIF< IHistogramSvc > & | histogramDataService () const
| Obsoleted name, kept due to the backwards compatibility. More...
SmartIF< INTupleSvc > & | ntupleSvc () const
| The standard N tuple service. More...
SmartIF< INTupleSvc > & | ntupleService () const
| Obsoleted name, kept due to the backwards compatibility. More...
SmartIF< IRndmGenSvc > & | randSvc () const
| AIDA-based NTuple service Returns a pointer to the AIDATuple service if present. More...
SmartIF< IToolSvc > & | toolSvc () const
| The standard ToolSvc service, Return a pointer to the service if present. More...
SmartIF< IExceptionSvc > & | exceptionSvc () const
| Get the exception Service. More...
SmartIF< IAlgContextSvc > & | contextSvc () const
| get Algorithm Context Service More...
SmartIF< ITimelineSvc > & | timelineSvc () const
SmartIF< ISvcLocator > & | serviceLocator () const override
| The standard service locator. More...
SmartIF< ISvcLocator > & | svcLoc () const
| shortcut for method serviceLocator More...
SmartIF< IHiveWhiteBoard > & | whiteboard () const
bool | registerContext () const
| register for Algorithm Context Service? More...
StatusCode | createSubAlgorithm (const std::string &type, const std::string &name, Algorithm *&pSubAlg)
| Create a sub algorithm. More...
const std::vector< Algorithm * > * | subAlgorithms () const
| List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms. More...
std::vector< Algorithm * > * | subAlgorithms ()
| List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms. More...
StatusCode | setProperty (const Property &p) override
| Implementation of IProperty::setProperty. More...
StatusCode | setProperty (const std::string &s) override
| Implementation of IProperty::setProperty. More...
StatusCode | setProperty (const std::string &n, const std::string &v) override
| Implementation of IProperty::setProperty. More...
StatusCode | getProperty (Property *p) const override
| Implementation of IProperty::getProperty. More...
const Property & | getProperty (const std::string &name) const override
| Implementation of IProperty::getProperty. More...
StatusCode | getProperty (const std::string &n, std::string &v) const override
| Implementation of IProperty::getProperty. More...
const std::vector< Property * > & | getProperties () const override
| Implementation of IProperty::getProperties. More...
bool | hasProperty (const std::string &name) const override
| Implementation of IProperty::hasProperty. More...
PropertyMgr * | getPropertyMgr ()
StatusCode | setProperties ()
| Set the algorithm's properties. More...
template<class T >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property. More...
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
| Declare remote named properties. More...
template<class T >
Property * | declareProperty (const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none") const
template<class T >
Property * | declareProperty (const std::string &name, ToolHandleArray< T > &hndlArr, const std::string &doc="none") const
SmartIF< IMonitorSvc > & | monitorSvc () const
| Access the monitor service. More...
template<class T >
void | declareInfo (const std::string &name, const T &var, const std::string &desc) const
| Declare monitoring information. More...
void | declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const
| Declare monitoring information (special case) More...
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value More...
EventContext * | getContext () const
| get the context More...
void | setContext (EventContext *context)
| set the context More...
virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override
virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override
virtual const DataObjIDColl & | extraInputDeps () const override
virtual const DataObjIDColl & | extraOutputDeps () const override
virtual void | acceptDHVisitor (IDataHandleVisitor *) const override
const DataObjIDColl & | inputDataObjs () const
const DataObjIDColl & | outputDataObjs () const
void | commitHandles () override
void | registerTool (IAlgTool *tool) const
void | deregisterTool (IAlgTool *tool) const
template<class T >
StatusCode | declareTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
const std::vector< IAlgTool * > & | tools () const
bool | isClonable () const override
| Specifies the clonability of the algorithm. More...
unsigned int | cardinality () const override
| Return the cardinality. More...
const std::vector< std::string > & | neededResources () const override
Public Member Functions inherited from CommonMessagingBase
virtual | ~CommonMessagingBase ()=default
| Virtual destructor. More...
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service. More...
MsgStream & | msgStream () const
| Return an uninitialized MsgStream. More...
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts. More...
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS) More...
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL) More...
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING) More...
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO) More...
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG) More...
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE) More...
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO) More...
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream More...
MSG::Level | outputLevel () const __attribute__((deprecated))
| Backward compatibility function for getting the output level. More...
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream More...

## Private Attributes
SmartIF< INTupleSvc > | m_dataSvc
| Reference to data provider service. More...
std::string | m_tupleSvc
| Name of the data provider service. More...
std::string | m_output
| Output specification. More...
std::vector< std::string > | m_inputs
| input specifications More...
std::string | m_rootName
| Name of the root leaf (obtained at initialize) More...
std::string | m_outName
| Output tuple name. More...
std::string | m_criteria
| Selection criteria (if any) More...
std::string | m_selectorName
| Selector factory. More...

## Additional Inherited Members
Public Types inherited from Algorithm
typedef Gaudi::PluginService::Factory< IAlgorithm *, const std::string &, ISvcLocator * > | Factory
Public Types inherited from CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > >
using | base_class = CommonMessaging
Protected Member Functions inherited from Algorithm
virtual void | declareInput (Gaudi::DataHandle *im) override
virtual void | declareOutput (Gaudi::DataHandle *im) override
std::vector< IAlgTool * > & | tools ()
bool | isInitialized () const override
| Has the Algorithm already been initialized? More...
bool | isFinalized () const override
| Has the Algorithm already been finalized? More...
void | setIndex (const unsigned int &idx) override
| set instantiation index of Alg More...
Protected Member Functions inherited from CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > >
void | updateMsgStreamOutputLevel (int level)
| Update the output level of the cached MsgStream. More...
Protected Attributes inherited from Algorithm
EventContext * | m_event_context
| Event specific data for multiple event processing. More...
SmartIF< PropertyMgr > | m_propertyMgr
| For management of properties. More...
std::unique_ptr< IDataHandleVisitor > | m_updateDataHandles
| Hook for for derived classes to provide a custom visitor for data handles. More...

## Detailed Description

Small algorithm, which allows to merge N-tuples in a generic way.

In the options directory an python interface is presented, which shows how to steer this algorithm in a standaqlone program.

Author
  : M.Frank

Version
  : 1.0

Definition at line 126 of file CollectionCloneAlg.cpp.

## Constructor & Destructor Documentation

CollectionCloneAlg::CollectionCloneAlg | ( | const std::string & | name,
|  | ISvcLocator * | pSvcLocator
| ) |  |
| inline

Standard algorithm constructor.

Definition at line 146 of file CollectionCloneAlg.cpp.

147 : Algorithm(name, pSvcLocator)
148 {
149 declareProperty("EvtTupleSvc", m_tupleSvc="EvtTupleSvc");
150 declareProperty("Input", m_inputs);
151 declareProperty("Output", m_output);
152 }
CollectionCloneAlg::m_tupleSvc
std::string m_tupleSvc
Name of the data provider service.
Definition: CollectionCloneAlg.cpp:130
Algorithm::declareProperty
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Algorithm.h:426
CollectionCloneAlg::m_output
std::string m_output
Output specification.
Definition: CollectionCloneAlg.cpp:132
CollectionCloneAlg::m_inputs
std::vector< std::string > m_inputs
input specifications
Definition: CollectionCloneAlg.cpp:134
Algorithm::Algorithm
Algorithm(const std::string &name, ISvcLocator *svcloc, const std::string &version=PACKAGE_VERSION)
Constructor.
Definition: Algorithm.cpp:43

virtual CollectionCloneAlg::~CollectionCloneAlg | ( |  | ) |
| inline virtual

Standard Destructor.

Definition at line 154 of file CollectionCloneAlg.cpp.

154 {
155 }

## Member Function Documentation

virtual StatusCode CollectionCloneAlg::book | ( | const NTuple::Tuple * | nt | ) |
| inline virtual

Book the N-tuple according to the specification.

Definition at line 214 of file CollectionCloneAlg.cpp.

214 {
215 MsgStream log(msgSvc(), name());
216 const INTuple::ItemContainer& items = nt->items();
217 StatusCode status = StatusCode::SUCCESS;
218 INTuple::ItemContainer::const_iterator i;
219 NTuple::Tuple* tuple = m_dataSvc->book(m_outName, nt->clID(), nt->title());
220 for (i = items.begin(); i != items.end(); ++i) {
221 long type = (*i)->type();
222 switch(type) {
223 case DataTypeInfo::UCHAR:
224 status = createItem(log, tuple, *i, (unsigned char)0);
225 break;
226 case DataTypeInfo::USHORT:
227 status = createItem(log, tuple, *i, (unsigned short)0);
228 break;
229 case DataTypeInfo::UINT:
230 status = createItem(log, tuple, *i, (unsigned int)0);
231 break;
232 case DataTypeInfo::ULONG:
233 status = createItem(log, tuple, *i, (unsigned long)0);
234 break;
235 case DataTypeInfo::CHAR:
236 status = createItem(log, tuple, *i, char(0));
237 break;
238 case DataTypeInfo::SHORT:
239 status = createItem(log, tuple, *i, short(0));
240 break;
241 case DataTypeInfo::INT:
242 status = createItem(log, tuple, *i, int(0));
243 break;
244 case DataTypeInfo::LONG:
245 status = createItem(log, tuple, *i, long(0));
246 break;
247 case DataTypeInfo::BOOL:
248 status = createItem(log, tuple, *i, false);
249 break;
250 case DataTypeInfo::FLOAT:
251 status = createItem(log, tuple, *i, float(0.0));
252 break;
253 case DataTypeInfo::DOUBLE:
254 status = createItem(log, tuple, *i, double(0.0));
255 break;
256 case DataTypeInfo::OBJECT_ADDR:
257 status = createItem(log, tuple, *i, (IOpaqueAddress*)0);
258 break;
259 case DataTypeInfo::POINTER:
260 status = createItem(log, tuple, *i, (void*)0);
261 break;
262 case DataTypeInfo::STRING:
263 // status = createItem(log, tuple, *i, (std::string*)0);
264 // break;
265 case DataTypeInfo::NTCHAR:
266 // status = createItem(log, tuple, *i, (char*)0);
267 // break;
268 case DataTypeInfo::UNKNOWN:
269 default:
270 status = StatusCode::FAILURE;
271 break;
272 }
273 }
274 return status;
275 }
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
DataTypeInfo::POINTER
Definition: DataTypeInfo.h:28
DataTypeInfo::INT
Definition: DataTypeInfo.h:25
Gaudi.Configuration.log
tuple log
Definition: Configuration.py:13
DataTypeInfo::CHAR
Definition: DataTypeInfo.h:25
INTuple::title
virtual const std::string & title() const =0
Object title.
std::vector::end
T end(T...args)
DataTypeInfo::STRING
Definition: DataTypeInfo.h:27
DataTypeInfo::SHORT
Definition: DataTypeInfo.h:25
Algorithm::type
const std::string & type() const override
The type of the algorithm object.
Definition: Algorithm.h:168
DataTypeInfo::NTCHAR
Definition: DataTypeInfo.h:27
CollectionCloneAlg::m_dataSvc
SmartIF< INTupleSvc > m_dataSvc
Reference to data provider service.
Definition: CollectionCloneAlg.cpp:128
Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:820
DataObject::clID
virtual const CLID & clID() const
Retrieve reference to class definition structure.
Definition: DataObject.cpp:68
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
DataTypeInfo::UINT
Definition: DataTypeInfo.h:24
DataTypeInfo::USHORT
Definition: DataTypeInfo.h:24
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
CollectionCloneAlg::m_outName
std::string m_outName
Output tuple name.
Definition: CollectionCloneAlg.cpp:138
DataTypeInfo::BOOL
Definition: DataTypeInfo.h:26
DataTypeInfo::UCHAR
Definition: DataTypeInfo.h:24
DataTypeInfo::ULONG
Definition: DataTypeInfo.h:24
DataTypeInfo::LONG
Definition: DataTypeInfo.h:25
DataTypeInfo::DOUBLE
Definition: DataTypeInfo.h:26
DataTypeInfo::UNKNOWN
Definition: DataTypeInfo.h:23
NTuple::Tuple
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:370
DataTypeInfo::OBJECT_ADDR
Definition: DataTypeInfo.h:28
std::vector
STL class.
std::vector::begin
T begin(T...args)
CommonMessagingBase::msgSvc
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:73
INTuple::items
virtual ItemContainer & items()=0
Access item container.
DataTypeInfo::FLOAT
Definition: DataTypeInfo.h:26
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
ana.i
list i
Definition: ana.py:128
INTupleSvc::book
virtual NTuple::Tuple * book(const std::string &fullPath, const CLID &type, const std::string &title)=0
Book Ntuple and register it with the data store.

virtual StatusCode CollectionCloneAlg::checkInput | ( | const NTuple::Tuple * | clone,
|  | const NTuple::Tuple * | src
| ) |  |
| inline virtual

Definition at line 278 of file CollectionCloneAlg.cpp.

278 {
279 MsgStream log(msgSvc(), name());
280 if ( 0 != clone && 0 != src ) {
281 const INTuple::ItemContainer& clone_items = clone->items();
282 const std::string clone_id = clone->registry()->identifier();
283 const std::string src_id = src->registry()->identifier();
284
285 INTuple::ItemContainer::const_iterator i;
286 log << MSG::ERROR;
287 for (i = clone_items.begin(); i != clone_items.end(); ++i) {
288 const INTupleItem* itm = *i;
289 const std::string& nam = itm->name();
290 const INTupleItem* src_itm = src->find(nam);
291 if ( !src_itm ) {
292 log << "Tuple item " << nam << " not present in " << src_id << endmsg;
293 return StatusCode::FAILURE;
294 }
295 if ( itm->type() != src_itm->type() ) {
296 log << "Tuple item " << nam << " are of different types in "
297 << src_id << ":" << src_itm->typeName() << " <-> "
298 << clone_id << ":" << itm->typeName() << endmsg;
299 return StatusCode::FAILURE;
300 }
301 if ( itm->ndim() != src_itm->ndim() ) {
302 log << "Tuple item " << nam << " have different dimensions in "
303 << src_id << ":" << src_itm->ndim() << " <-> "
304 << clone_id << ":" << itm->ndim() << endmsg;
305 return StatusCode::FAILURE;
306 }
307 for (int j=0; j<itm->ndim(); ++j) {
308 if ( src_itm->dim(j) != itm->dim(j) ) {
309 log << "Tuple item " << nam << " have different dimensions in "
310 << src_id << "[" << j << "]:" << src_itm->dim(j) << " <-> "
311 << clone_id << "[" << j << "]:" << itm->dim(j) << endmsg;
312 return StatusCode::FAILURE;
313 }
314 }
315 if ( itm->hasIndex() != src_itm->hasIndex() ) {
316 log << "Tuple item " << nam << " has different index colums "
317 << src_id << ":" << src_itm->hasIndex() << " <-> "
318 << clone_id << ":" << itm->hasIndex() << endmsg;
319 return StatusCode::FAILURE;
320 }
321 if ( itm->hasIndex() ) {
322 if ( itm->index() != src_itm->index() ) {
323 log << "Tuple item " << nam << " has different index colums "
324 << src_id << ":" << src_itm->index() << " <-> "
325 << clone_id << ":" << itm->index() << endmsg;
326 return StatusCode::FAILURE;
327 }
328 }
329 }
330 return StatusCode::SUCCESS;
331 }
332 return StatusCode::FAILURE;
333 }
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
INTupleItem::type
virtual long type() const =0
Type information of the item.
ana.itm
tuple itm
Definition: ana.py:57
Gaudi.Configuration.log
tuple log
Definition: Configuration.py:13
std::vector::end
T end(T...args)
INTupleItem::hasIndex
virtual bool hasIndex() const =0
Is the tuple have an index item?
DataObject::registry
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
INTupleItem::name
virtual const std::string & name() const =0
Access _Item name.
std::string
STL class.
Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:820
INTupleItem
NTuple interface class definition.
Definition: INTuple.h:26
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
INTupleItem::dim
virtual long dim(long i) const =0
Access individual dimensions.
std::vector
STL class.
std::vector::begin
T begin(T...args)
INTupleItem::ndim
virtual long ndim() const =0
Dimension.
CommonMessagingBase::msgSvc
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:73
MSG::ERROR
Definition: IMessageSvc.h:21
IRegistry::identifier
virtual const id_type & identifier() const =0
Full identifier (or key)
INTuple::items
virtual ItemContainer & items()=0
Access item container.
INTupleItem::typeName
virtual std::string typeName() const =0
Proper type name of the object.
ana.i
list i
Definition: ana.py:128
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
INTuple::find
virtual const INTupleItem * find(const std::string &name) const =0
Find an item row of the Ntuple (CONST)
INTupleItem::index
virtual const std::string & index() const =0
Access the index _Item.

StatusCode CollectionCloneAlg::connect | ( |  | ) |
| inline

Connect input and output N-tuples.

Definition at line 446 of file CollectionCloneAlg.cpp.

446 {
447 StatusCode status = StatusCode::SUCCESS;
448 for (size_t i=0; i < m_inputs.size(); ++i) {
449 NTuplePtr nt(m_dataSvc.get(), m_inputs[i]);
450 if ( !(0 == nt) ) {
451 NTuplePtr out(m_dataSvc.get(), m_outName);
452 if ( 0 == out ) {
453 status = book(nt);
454 } else {
455 status = checkInput(out, nt);
456 }
457 if ( !status.isSuccess() ) {
458 return status;
459 }
460 else if ( m_selectorName != "" ) {
461 SmartIF<ISelectStatement> stmt(ObjFactory::create(m_selectorName, serviceLocator()));
462 if ( stmt ) {
463 if ( !m_criteria.empty() ) stmt->setCriteria(m_criteria);
464 nt->attachSelector(stmt);
465 } else {
466 MsgStream log(msgSvc(), name());
467 log << MSG::ERROR << "Failed to attach tuple selector to " << m_inputs[i] << endmsg;
468 return StatusCode::FAILURE;
469 }
470 }
471 } else {
472 MsgStream log(msgSvc(), name());
473 log << MSG::ERROR << "Failed to access tuple: " << m_inputs[i] << endmsg;
474 return StatusCode::FAILURE;
475 }
476 }
477 return StatusCode::SUCCESS;
478 }
CollectionCloneAlg::m_criteria
std::string m_criteria
Selection criteria (if any)
Definition: CollectionCloneAlg.cpp:140
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
SmartIF< ISelectStatement >
std::string::empty
T empty(T...args)
CollectionCloneAlg::book
virtual StatusCode book(const NTuple::Tuple *nt)
Book the N-tuple according to the specification.
Definition: CollectionCloneAlg.cpp:214
Gaudi.Configuration.log
tuple log
Definition: Configuration.py:13
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
Algorithm::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
Definition: Algorithm.cpp:929
CollectionCloneAlg::m_dataSvc
SmartIF< INTupleSvc > m_dataSvc
Reference to data provider service.
Definition: CollectionCloneAlg.cpp:128
Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:820
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
CollectionCloneAlg::m_inputs
std::vector< std::string > m_inputs
input specifications
Definition: CollectionCloneAlg.cpp:134
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
CollectionCloneAlg::m_outName
std::string m_outName
Output tuple name.
Definition: CollectionCloneAlg.cpp:138
CollectionCloneAlg::checkInput
virtual StatusCode checkInput(const NTuple::Tuple *clone, const NTuple::Tuple *src)
Definition: CollectionCloneAlg.cpp:278
std::vector::size
T size(T...args)
SmartDataPtr
A small class used to access easily (and efficiently) data items residing in data stores...
Definition: SmartDataPtr.h:46
CommonMessagingBase::msgSvc
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:73
MSG::ERROR
Definition: IMessageSvc.h:21
CollectionCloneAlg::m_selectorName
std::string m_selectorName
Selector factory.
Definition: CollectionCloneAlg.cpp:142
ana.i
list i
Definition: ana.py:128
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

virtual StatusCode CollectionCloneAlg::execute | ( |  | ) |
| inline virtual

Execute procedure.

Definition at line 205 of file CollectionCloneAlg.cpp.

205 {
206 StatusCode status = connect();
207 if ( status.isSuccess() ) {
208 status = mergeInputTuples();
209 }
210 return status;
211 }
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
CollectionCloneAlg::mergeInputTuples
StatusCode mergeInputTuples()
Merge all N-tuple entries.
Definition: CollectionCloneAlg.cpp:481
CollectionCloneAlg::connect
StatusCode connect()
Connect input and output N-tuples.
Definition: CollectionCloneAlg.cpp:446

virtual StatusCode CollectionCloneAlg::finalize | ( |  | ) |
| inline virtual

Finalize.

Definition at line 199 of file CollectionCloneAlg.cpp.

199 {
200 m_dataSvc.reset();
201 return StatusCode::SUCCESS;
202 }
CollectionCloneAlg::m_dataSvc
SmartIF< INTupleSvc > m_dataSvc
Reference to data provider service.
Definition: CollectionCloneAlg.cpp:128
StatusCode::SUCCESS
Definition: StatusCode.h:30
SmartIF::reset
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:88

virtual StatusCode CollectionCloneAlg::initialize | ( |  | ) |
| inline virtual

Initialize.

Definition at line 158 of file CollectionCloneAlg.cpp.

158 {
159 MsgStream log(msgSvc(), name());
160 m_rootName = "";
161 m_outName = "";
162 m_criteria = "";
163 m_selectorName = "";
164 m_dataSvc = service(m_tupleSvc, true);
165 if ( !m_dataSvc ) {
166 log << MSG::ERROR << "Failed to access service \""
167 << m_tupleSvc << "\"." << endmsg;
168 return StatusCode::FAILURE;
169 }
170 std::string fun;
171 using Parser = Gaudi::Utils::AttribStringParser;
172 for (auto attrib: Parser(m_output)) {
173 switch( ::toupper(attrib.tag[0]) ) {
174 case 'D':
175 m_outName = std::move(attrib.value);
176 break;
177 case 'S':
178 m_criteria = std::move(attrib.value);
179 break;
180 case 'F':
181 fun = std::move(attrib.value);
182 break ;
183 default:
184 break;
185 }
186 }
187 if ( m_outName.empty() ) {
188 log << MSG::ERROR << "Failed to analyze output specs:" << m_output << endmsg;
189 return StatusCode::FAILURE;
190 }
191 if ( !fun.empty() || !m_criteria.empty() ) {
192 if ( !m_criteria.empty() && fun.empty() ) fun = "NTuple::Selector";
193 m_selectorName = fun;
194 }
195 return StatusCode::SUCCESS;
196 }
Gaudi::Utils::AttribStringParser
Parse attribute strings allowing iteration over the various attributes.
Definition: AttribStringParser.h:30
CollectionCloneAlg::m_tupleSvc
std::string m_tupleSvc
Name of the data provider service.
Definition: CollectionCloneAlg.cpp:130
CollectionCloneAlg::m_criteria
std::string m_criteria
Selection criteria (if any)
Definition: CollectionCloneAlg.cpp:140
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
std::string::empty
T empty(T...args)
Gaudi.Configuration.log
tuple log
Definition: Configuration.py:13
CollectionCloneAlg::m_dataSvc
SmartIF< INTupleSvc > m_dataSvc
Reference to data provider service.
Definition: CollectionCloneAlg.cpp:128
std::string
STL class.
Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:820
CollectionCloneAlg::m_output
std::string m_output
Output specification.
Definition: CollectionCloneAlg.cpp:132
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
CollectionCloneAlg::m_outName
std::string m_outName
Output tuple name.
Definition: CollectionCloneAlg.cpp:138
std::move
T move(T...args)
CollectionCloneAlg::m_rootName
std::string m_rootName
Name of the root leaf (obtained at initialize)
Definition: CollectionCloneAlg.cpp:136
fun
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:26
CommonMessagingBase::msgSvc
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:73
MSG::ERROR
Definition: IMessageSvc.h:21
Algorithm::service
StatusCode service(const std::string &name, T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: Algorithm.h:232
CollectionCloneAlg::m_selectorName
std::string m_selectorName
Selector factory.
Definition: CollectionCloneAlg.cpp:142
toupper
void toupper(std::string &s)
Definition: StatusCodeSvc.cpp:10
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode CollectionCloneAlg::mergeEntries | ( | const std::string & | input | ) |
| inline

Merge the entries of a single input tuple into the output.

Definition at line 336 of file CollectionCloneAlg.cpp.

336 {
337 MsgStream log(msgSvc(), name());
338 NTuplePtr out(m_dataSvc.get(), m_outName);
339 if ( 0 != out ) {
340 const INTuple::ItemContainer& clone_items = out->items();
341 std::vector<GenericAddress> addrVector(clone_items.size());
342 StatusCode status = StatusCode::SUCCESS;
343 NTuplePtr nt(m_dataSvc.get(), input);
344 size_t k = 0, nentry = 0;
345 if ( 0 != nt ) {
346 const INTuple::ItemContainer& source_items = nt->items();
347 for (k=0; k < source_items.size(); ++k ) {
348 if ( source_items[k]->type() == DataTypeInfo::OBJECT_ADDR ) {
349 *(IOpaqueAddress**)source_items[k]->buffer() = &addrVector[k];
350 }
351 }
352 while ( status.isSuccess() ) {
353 status = m_dataSvc->readRecord(nt.ptr());
354 if ( status.isSuccess() ) {
355 INTuple::ItemContainer::const_iterator i;
356 nentry++;
357 for (k=0,i = source_items.begin(); i != source_items.end(); ++i,++k) {
358 const INTupleItem* src_itm = *i;
359 const INTupleItem* out_itm = out->find(src_itm->name());
360 size_t size = 0;
361 switch((*i)->type()) {
362 case DataTypeInfo::UCHAR:
363 size = sizeof(unsigned char);
364 break;
365 case DataTypeInfo::USHORT:
366 size = sizeof(unsigned short);
367 break;
368 case DataTypeInfo::UINT:
369 size = sizeof(unsigned int);
370 break;
371 case DataTypeInfo::ULONG:
372 size = sizeof(unsigned long);
373 break;
374 case DataTypeInfo::CHAR:
375 size = sizeof(char);
376 break;
377 case DataTypeInfo::SHORT:
378 size = sizeof(short);
379 break;
380 case DataTypeInfo::INT:
381 size = sizeof(int);
382 break;
383 case DataTypeInfo::LONG:
384 size = sizeof(long);
385 break;
386 case DataTypeInfo::BOOL:
387 size = sizeof(bool);
388 break;
389 case DataTypeInfo::FLOAT:
390 size = sizeof(float);
391 break;
392 case DataTypeInfo::DOUBLE:
393 size = sizeof(double);
394 break;
395 case DataTypeInfo::STRING:
396 *(std::string*)out_itm->buffer() = *(std::string*)src_itm->buffer();
397 size = 0;
398 break;
399 case DataTypeInfo::NTCHAR:
400 size = ::strlen((const char*)src_itm->buffer())+1;
401 break;
402 case DataTypeInfo::POINTER:
403 {
404 *(void**)out_itm->buffer() = *(void**)src_itm->buffer();
405 size = 0;
406 }
407 break;
408 case DataTypeInfo::OBJECT_ADDR:
409 {
410 IOpaqueAddress* ppA1 = &addrVector[k];
411 IOpaqueAddress** ppA2 = (IOpaqueAddress**)out_itm->buffer();
412 *ppA2 = ppA1;
413 size = 0;
414 }
415 break;
416 case DataTypeInfo::UNKNOWN:
417 default:
418 size = 0;
419 break;
420 }
421 if ( size > 0 ) {
422 ::memcpy((void*)out_itm->buffer(), src_itm->buffer(), size*src_itm->length());
423 }
424 }
425 status = m_dataSvc->writeRecord(out.ptr());
426 if ( !status.isSuccess() ) {
427 log << MSG::ERROR << "Failed to write record " << nentry
428 << " from " << input << " to " << m_outName << endmsg;
429 }
430 }
431 }
432 log << MSG::INFO << "End of reading tuple " << input
433 << " after " << nentry << " entries." << endmsg;
434
435 if ( nentry > 0 || m_selectorName != "" ) {
436 return StatusCode::SUCCESS;
437 }
438 return StatusCode::FAILURE;
439 }
440 log << MSG::ERROR << "Failed to access input: " << input << endmsg;
441 }
442 return StatusCode::FAILURE;
443 }
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
DataTypeInfo::POINTER
Definition: DataTypeInfo.h:28
DataTypeInfo::INT
Definition: DataTypeInfo.h:25
Gaudi.Configuration.log
tuple log
Definition: Configuration.py:13
DataTypeInfo::CHAR
Definition: DataTypeInfo.h:25
std::vector::end
T end(T...args)
DataTypeInfo::STRING
Definition: DataTypeInfo.h:27
DataTypeInfo::SHORT
Definition: DataTypeInfo.h:25
Algorithm::type
const std::string & type() const override
The type of the algorithm object.
Definition: Algorithm.h:168
DataTypeInfo::NTCHAR
Definition: DataTypeInfo.h:27
INTupleItem::name
virtual const std::string & name() const =0
Access _Item name.
CollectionCloneAlg::m_dataSvc
SmartIF< INTupleSvc > m_dataSvc
Reference to data provider service.
Definition: CollectionCloneAlg.cpp:128
std::string
STL class.
Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:820
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
INTupleItem
NTuple interface class definition.
Definition: INTuple.h:26
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
DataTypeInfo::UINT
Definition: DataTypeInfo.h:24
DataTypeInfo::USHORT
Definition: DataTypeInfo.h:24
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
INTupleSvc::writeRecord
virtual StatusCode writeRecord(NTuple::Tuple *tuple)=0
Write single record to N tuple.
CollectionCloneAlg::m_outName
std::string m_outName
Output tuple name.
Definition: CollectionCloneAlg.cpp:138
DataTypeInfo::BOOL
Definition: DataTypeInfo.h:26
DataTypeInfo::UCHAR
Definition: DataTypeInfo.h:24
DataTypeInfo::ULONG
Definition: DataTypeInfo.h:24
DataTypeInfo::LONG
Definition: DataTypeInfo.h:25
DataTypeInfo::DOUBLE
Definition: DataTypeInfo.h:26
DataTypeInfo::UNKNOWN
Definition: DataTypeInfo.h:23
std::vector::size
T size(T...args)
DataTypeInfo::OBJECT_ADDR
Definition: DataTypeInfo.h:28
std::vector
STL class.
std::vector::begin
T begin(T...args)
INTupleSvc::readRecord
virtual StatusCode readRecord(NTuple::Tuple *tuple)=0
Read single record from N tuple.
SmartDataPtr
A small class used to access easily (and efficiently) data items residing in data stores...
Definition: SmartDataPtr.h:46
CommonMessagingBase::msgSvc
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:73
MSG::ERROR
Definition: IMessageSvc.h:21
DataTypeInfo::FLOAT
Definition: DataTypeInfo.h:26
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
MSG::INFO
Definition: IMessageSvc.h:19
CollectionCloneAlg::m_selectorName
std::string m_selectorName
Selector factory.
Definition: CollectionCloneAlg.cpp:142
ana.i
list i
Definition: ana.py:128
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
INTupleItem::length
virtual long length() const =0
Access the buffer length.
INTupleItem::buffer
virtual const void * buffer() const =0
Access data buffer (CONST)

StatusCode CollectionCloneAlg::mergeInputTuples | ( |  | ) |
| inline

Merge all N-tuple entries.

Definition at line 481 of file CollectionCloneAlg.cpp.

481 {
482 MsgStream log(msgSvc(), name());
483 for( const auto& input : m_inputs ) {
484 StatusCode sc = mergeEntries(input);
485 if ( !sc.isSuccess() ) {
486 log << MSG::ERROR << "Failed to merge tuple:" << input << endmsg;
487 return sc;
488 }
489 }
490 return StatusCode::SUCCESS;
491 }
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Gaudi.Configuration.log
tuple log
Definition: Configuration.py:13
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
merge_files.sc
int sc
Definition: merge_files.py:167
CollectionCloneAlg::mergeEntries
StatusCode mergeEntries(const std::string &input)
Merge the entries of a single input tuple into the output.
Definition: CollectionCloneAlg.cpp:336
Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:820
CollectionCloneAlg::m_inputs
std::vector< std::string > m_inputs
input specifications
Definition: CollectionCloneAlg.cpp:134
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
CommonMessagingBase::msgSvc
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:73
MSG::ERROR
Definition: IMessageSvc.h:21
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

## Member Data Documentation

std::string CollectionCloneAlg::m_criteria
| private

Selection criteria (if any)

Definition at line 140 of file CollectionCloneAlg.cpp.

SmartIF<INTupleSvc> CollectionCloneAlg::m_dataSvc
| private

Reference to data provider service.

Definition at line 128 of file CollectionCloneAlg.cpp.

std::vector<std::string> CollectionCloneAlg::m_inputs
| private

input specifications

Definition at line 134 of file CollectionCloneAlg.cpp.

std::string CollectionCloneAlg::m_outName
| private

Output tuple name.

Definition at line 138 of file CollectionCloneAlg.cpp.

std::string CollectionCloneAlg::m_output
| private

Output specification.

Definition at line 132 of file CollectionCloneAlg.cpp.

std::string CollectionCloneAlg::m_rootName
| private

Name of the root leaf (obtained at initialize)

Definition at line 136 of file CollectionCloneAlg.cpp.

std::string CollectionCloneAlg::m_selectorName
| private

Selector factory.

Definition at line 142 of file CollectionCloneAlg.cpp.

std::string CollectionCloneAlg::m_tupleSvc
| private

Name of the data provider service.

Definition at line 130 of file CollectionCloneAlg.cpp.

The documentation for this class was generated from the following file:

- GaudiSvc/src/NTupleSvc/CollectionCloneAlg.cpp