CollectionCloneAlg Class Reference

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

Inheritance diagram for CollectionCloneAlg:
Collaboration diagram for CollectionCloneAlg:

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...
 
virtual ~Algorithm ()
 Destructor. More...
 
virtual StatusCode sysStart ()
 Reinitialization method invoked by the framework. More...
 
virtual StatusCode sysInitialize ()
 Initialization method invoked by the framework. More...
 
virtual StatusCode sysReinitialize ()
 Reinitialization method invoked by the framework. More...
 
virtual StatusCode sysRestart ()
 Restart method invoked by the framework. More...
 
virtual StatusCode sysExecute ()
 The actions to be performed by the algorithm on an event. More...
 
virtual StatusCode sysStop ()
 System stop. More...
 
virtual StatusCode sysFinalize ()
 System finalization. More...
 
virtual StatusCode sysBeginRun ()
 beginRun method invoked by the framework. More...
 
virtual StatusCode sysEndRun ()
 endRun method invoked by the framework. More...
 
virtual const std::string & name () const
 The identifying name of the algorithm object. More...
 
virtual const std::string & version () const
 The version of the algorithm. More...
 
virtual StatusCode configure ()
 Dummy implementation of IStateful::configure() method. More...
 
virtual StatusCode terminate ()
 Dummy implementation of IStateful::terminate() method. More...
 
virtual StatusCode start ()
 the default (empty) implementation of IStateful::start() method More...
 
virtual StatusCode stop ()
 the default (empty) implementation of IStateful::stop() method More...
 
virtual StatusCode reinitialize ()
 the default (empty) implementation of IStateful::reinitialize() method More...
 
virtual StatusCode restart ()
 the default (empty) implementation of IStateful::restart() method More...
 
virtual bool isExecuted () const
 Has this algorithm been executed since the last reset? More...
 
virtual void setExecuted (bool state)
 Set the executed flag to the specified state. More...
 
virtual void resetExecuted ()
 Reset the executed state of the Algorithm for the duration of the current event. More...
 
virtual StatusCode beginRun ()
 Algorithm begin run. More...
 
virtual StatusCode endRun ()
 Algorithm end run. This method is called at the end of the event loop. More...
 
virtual Gaudi::StateMachine::State FSMState () const
 returns the current state of the algorithm More...
 
virtual Gaudi::StateMachine::State targetFSMState () const
 returns the state the algorithm will be in after the ongoing transition More...
 
virtual bool isEnabled () const
 Is this algorithm enabled or disabled? More...
 
virtual bool filterPassed () const
 Did this algorithm pass or fail its filter criterion for the last event? More...
 
virtual void setFilterPassed (bool state)
 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< IServiceservice (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...
 
void setOutputLevel (int level)
 Set the output level for current algorithm. More...
 
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< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
SmartIF< IMessageSvc > & messageService () 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< ISvcLocator > & serviceLocator () const
 The standard service locator. More...
 
SmartIF< ISvcLocator > & svcLoc () const
 shortcut for method serviceLocator More...
 
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...
 
std::vector< Algorithm * > * subAlgorithms () const
 List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms. More...
 
virtual StatusCode setProperty (const Property &p)
 Implementation of IProperty::setProperty. More...
 
virtual StatusCode setProperty (const std::string &s)
 Implementation of IProperty::setProperty. More...
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Implementation of IProperty::setProperty. More...
 
virtual StatusCode getProperty (Property *p) const
 Implementation of IProperty::getProperty. More...
 
virtual const PropertygetProperty (const std::string &name) const
 Implementation of IProperty::getProperty. More...
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Implementation of IProperty::getProperty. More...
 
virtual const std::vector< Property * > & getProperties () const
 Implementation of IProperty::getProperties. More...
 
virtual bool hasProperty (const std::string &name) const
 Implementation of IProperty::hasProperty. More...
 
StatusCode setProperties ()
 Set the algorithm's properties. More...
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property. More...
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties. More...
 
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...
 
 Algorithm (const std::string &name, ISvcLocator *svcloc, const std::string &version=PACKAGE_VERSION)
 Constructor. More...
 
virtual ~Algorithm ()
 Destructor. More...
 
virtual StatusCode sysStart ()
 Reinitialization method invoked by the framework. More...
 
virtual StatusCode sysInitialize ()
 Initialization method invoked by the framework. More...
 
virtual StatusCode sysReinitialize ()
 Reinitialization method invoked by the framework. More...
 
virtual StatusCode sysRestart ()
 Restart method invoked by the framework. More...
 
virtual StatusCode sysExecute ()
 The actions to be performed by the algorithm on an event. More...
 
virtual StatusCode sysStop ()
 System stop. More...
 
virtual StatusCode sysFinalize ()
 System finalization. More...
 
virtual StatusCode sysBeginRun ()
 beginRun method invoked by the framework. More...
 
virtual StatusCode sysEndRun ()
 endRun method invoked by the framework. More...
 
virtual const std::string & name () const
 The identifying name of the algorithm object. More...
 
virtual const std::string & version () const
 The version of the algorithm. More...
 
virtual StatusCode configure ()
 Dummy implementation of IStateful::configure() method. More...
 
virtual StatusCode terminate ()
 Dummy implementation of IStateful::terminate() method. More...
 
virtual StatusCode start ()
 the default (empty) implementation of IStateful::start() method More...
 
virtual StatusCode stop ()
 the default (empty) implementation of IStateful::stop() method More...
 
virtual StatusCode reinitialize ()
 the default (empty) implementation of IStateful::reinitialize() method More...
 
virtual StatusCode restart ()
 the default (empty) implementation of IStateful::restart() method More...
 
virtual bool isExecuted () const
 Has this algorithm been executed since the last reset? More...
 
virtual void setExecuted (bool state)
 Set the executed flag to the specified state. More...
 
virtual void resetExecuted ()
 Reset the executed state of the Algorithm for the duration of the current event. More...
 
virtual StatusCode beginRun ()
 Algorithm begin run. More...
 
virtual StatusCode endRun ()
 Algorithm end run. This method is called at the end of the event loop. More...
 
virtual Gaudi::StateMachine::State FSMState () const
 returns the current state of the algorithm More...
 
virtual Gaudi::StateMachine::State targetFSMState () const
 returns the state the algorithm will be in after the ongoing transition More...
 
virtual bool isEnabled () const
 Is this algorithm enabled or disabled? More...
 
virtual bool filterPassed () const
 Did this algorithm pass or fail its filter criterion for the last event? More...
 
virtual void setFilterPassed (bool state)
 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< IServiceservice (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...
 
void setOutputLevel (int level)
 Set the output level for current algorithm. More...
 
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< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
SmartIF< IMessageSvc > & messageService () 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< ISvcLocator > & serviceLocator () const
 The standard service locator. More...
 
SmartIF< ISvcLocator > & svcLoc () const
 shortcut for method serviceLocator More...
 
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...
 
std::vector< Algorithm * > * subAlgorithms () const
 List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms. More...
 
virtual StatusCode setProperty (const Property &p)
 Implementation of IProperty::setProperty. More...
 
virtual StatusCode setProperty (const std::string &s)
 Implementation of IProperty::setProperty. More...
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Implementation of IProperty::setProperty. More...
 
virtual StatusCode getProperty (Property *p) const
 Implementation of IProperty::getProperty. More...
 
virtual const PropertygetProperty (const std::string &name) const
 Implementation of IProperty::getProperty. More...
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Implementation of IProperty::getProperty. More...
 
virtual const std::vector< Property * > & getProperties () const
 Implementation of IProperty::getProperties. More...
 
virtual bool hasProperty (const std::string &name) const
 Implementation of IProperty::hasProperty. More...
 
StatusCode setProperties ()
 Set the algorithm's properties. More...
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property. More...
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties. More...
 
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...
 
- Public Member Functions inherited from extend_interfaces3< IAlgorithm, IProperty, IStateful >
virtual ~extend_interfaces3 ()
 Virtual destructor. More...
 
virtual ~extend_interfaces3 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IAlgorithm
 DeclareInterfaceID (IAlgorithm, 4, 0)
 InterfaceID. More...
 
 DeclareInterfaceID (IAlgorithm, 4, 0)
 InterfaceID. More...
 
- Public Member Functions inherited from INamedInterface
 DeclareInterfaceID (INamedInterface, 1, 0)
 InterfaceID. More...
 
virtual ~INamedInterface ()
 Virtual destructor (always needed for abstract classes). More...
 
 DeclareInterfaceID (INamedInterface, 1, 0)
 InterfaceID. More...
 
virtual ~INamedInterface ()
 Virtual destructor (always needed for abstract classes). More...
 
- Public Member Functions inherited from IInterface
virtual void * i_cast (const InterfaceID &) const =0
 main cast function More...
 
virtual std::vector< std::string > getInterfaceNames () const =0
 Returns a vector of strings containing the names of all the implemented interfaces. More...
 
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long release ()=0
 Release Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)=0
 Set the void** to the pointer to the requested interface of the instance. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 
virtual void * i_cast (const InterfaceID &) const =0
 main cast function More...
 
virtual std::vector< std::string > getInterfaceNames () const =0
 Returns a vector of strings containing the names of all the implemented interfaces. More...
 
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long release ()=0
 Release Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)=0
 Set the void** to the pointer to the requested interface of the instance. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IProperty
 DeclareInterfaceID (IProperty, 2, 1)
 InterfaceID. More...
 
 DeclareInterfaceID (IProperty, 2, 1)
 InterfaceID. More...
 
- Public Member Functions inherited from IStateful
 DeclareInterfaceID (IStateful, 1, 0)
 InterfaceID. More...
 
virtual ~IStateful ()
 
 DeclareInterfaceID (IStateful, 1, 0)
 InterfaceID. More...
 
virtual ~IStateful ()
 

Private Attributes

INTupleSvcm_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
 
typedef Gaudi::PluginService::Factory< IAlgorithm *, const std::string &, ISvcLocator * > Factory
 
- Public Types inherited from implements3< IAlgorithm, IProperty, IStateful >
typedef implements3 base_class
 Typedef to this class. More...
 
typedef implements3 base_class
 Typedef to this class. More...
 
typedef extend_interfaces3< IAlgorithm, IProperty, IStatefulextend_interfaces_base
 Typedef to the base of this class. More...
 
typedef extend_interfaces3< IAlgorithm, IProperty, IStatefulextend_interfaces_base
 Typedef to the base of this class. More...
 
typedef extend_interfaces_base::ext_iids interfaces
 MPL set of all the implemented interfaces. More...
 
typedef extend_interfaces_base::ext_iids interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from extend_interfaces3< IAlgorithm, IProperty, IStateful >
typedef mpl::fold< typename IAlgorithm::iid::iids::type, typename mpl::fold< typename IProperty::iid::iids::type, typename IStateful::iid::iids::type, mpl::insert< mpl::_1, mpl::_2 > >::type, mpl::insert< mpl::_1, mpl::_2 > >::type ext_iids
 MPL set of interfaces extended by this one. More...
 
typedef mpl::fold< typename IAlgorithm::iid::iids::type, typename mpl::fold< typename IProperty::iid::iids::type, typename IStateful::iid::iids::type, mpl::insert< mpl::_1, mpl::_2 > >::type, mpl::insert< mpl::_1, mpl::_2 > >::type ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IInterface
enum  Status {
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR,
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR
}
 Return status. More...
 
enum  Status {
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR,
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR
}
 Return status. More...
 
typedef Gaudi::InterfaceId< IInterface, 0, 0 > iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 
typedef Gaudi::InterfaceId< IInterface, 0, 0 > iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 
- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 
- Protected Member Functions inherited from Algorithm
bool isInitialized () const
 Has the Algorithm already been initialized? More...
 
bool isFinalized () const
 Has the Algorithm already been finalized? More...
 
int outputLevel () const
 retrieve the Algorithm output level More...
 
IntegerPropertyoutputLevelProperty ()
 Accessor for the Message level property. More...
 
void initOutputLevel (Property &prop)
 callback for output level property More...
 
bool isInitialized () const
 Has the Algorithm already been initialized? More...
 
bool isFinalized () const
 Has the Algorithm already been finalized? More...
 
int outputLevel () const
 retrieve the Algorithm output level More...
 
IntegerPropertyoutputLevelProperty ()
 Accessor for the Message level property. More...
 
void initOutputLevel (Property &prop)
 callback for output level property 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), m_dataSvc(0)
148  {
149  declareProperty("EvtTupleSvc", m_tupleSvc="EvtTupleSvc");
150  declareProperty("Input", m_inputs);
151  declareProperty("Output", m_output);
152  }
std::string m_tupleSvc
Name of the data provider service.
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Algorithm.h:402
std::string m_output
Output specification.
std::vector< std::string > m_inputs
input specifications
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
INTupleSvc * m_dataSvc
Reference to data provider service.
Algorithm(const std::string &name, ISvcLocator *svcloc, const std::string &version=PACKAGE_VERSION)
Constructor.
Definition: Algorithm.cpp:28
virtual CollectionCloneAlg::~CollectionCloneAlg ( )
inlinevirtual

Standard Destructor.

Definition at line 154 of file CollectionCloneAlg.cpp.

154  {
155  }

Member Function Documentation

virtual StatusCode CollectionCloneAlg::book ( const NTuple::Tuple nt)
inlinevirtual

Book the N-tuple according to the specification.

Definition at line 216 of file CollectionCloneAlg.cpp.

216  {
217  MsgStream log(msgSvc(), name());
218  const INTuple::ItemContainer& items = nt->items();
220  INTuple::ItemContainer::const_iterator i;
221  NTuple::Tuple* tuple = m_dataSvc->book(m_outName, nt->clID(), nt->title());
222  for (i = items.begin(); i != items.end(); ++i) {
223  long type = (*i)->type();
224  switch(type) {
225  case DataTypeInfo::UCHAR:
226  status = createItem(log, tuple, *i, (unsigned char)0);
227  break;
229  status = createItem(log, tuple, *i, (unsigned short)0);
230  break;
231  case DataTypeInfo::UINT:
232  status = createItem(log, tuple, *i, (unsigned int)0);
233  break;
234  case DataTypeInfo::ULONG:
235  status = createItem(log, tuple, *i, (unsigned long)0);
236  break;
237  case DataTypeInfo::CHAR:
238  status = createItem(log, tuple, *i, char(0));
239  break;
240  case DataTypeInfo::SHORT:
241  status = createItem(log, tuple, *i, short(0));
242  break;
243  case DataTypeInfo::INT:
244  status = createItem(log, tuple, *i, int(0));
245  break;
246  case DataTypeInfo::LONG:
247  status = createItem(log, tuple, *i, long(0));
248  break;
249  case DataTypeInfo::BOOL:
250  status = createItem(log, tuple, *i, false);
251  break;
252  case DataTypeInfo::FLOAT:
253  status = createItem(log, tuple, *i, float(0.0));
254  break;
256  status = createItem(log, tuple, *i, double(0.0));
257  break;
259  status = createItem(log, tuple, *i, (IOpaqueAddress*)0);
260  break;
262  status = createItem(log, tuple, *i, (void*)0);
263  break;
265 // status = createItem(log, tuple, *i, (std::string*)0);
266 // break;
268 // status = createItem(log, tuple, *i, (char*)0);
269 // break;
271  default:
272  status = StatusCode::FAILURE;
273  break;
274  }
275  }
276  return status;
277  }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
std::vector< INTupleItem * > ItemContainer
Definition: INTuple.h:86
virtual const std::string & title() const =0
Object title.
virtual const CLID & clID() const
Retrieve reference to class definition structure.
Definition: DataObject.cpp:58
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
std::string m_outName
Output tuple name.
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
INTupleSvc * m_dataSvc
Reference to data provider service.
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:367
virtual ItemContainer & items()=0
Access item container.
Opaque address interface definition.
list i
Definition: ana.py:128
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.
string type
Definition: gaudirun.py:151
virtual StatusCode CollectionCloneAlg::checkInput ( const NTuple::Tuple clone,
const NTuple::Tuple src 
)
inlinevirtual

Definition at line 280 of file CollectionCloneAlg.cpp.

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

Connect input and output N-tuples.

Definition at line 448 of file CollectionCloneAlg.cpp.

448  {
450  for (size_t i=0; i < m_inputs.size(); ++i) {
452  if ( !(0 == nt) ) {
454  if ( 0 == out ) {
455  status = book(nt);
456  }
457  else {
458  status = checkInput(out, nt);
459  }
460  if ( !status.isSuccess() ) {
461  return status;
462  }
463  else if ( m_selectorName != "" ) {
464  SmartIF<ISelectStatement> stmt(ObjFactory::create(m_selectorName, serviceLocator()));
465  if ( stmt.isValid( ) ) {
466  if ( m_criteria.length() > 0 ) stmt->setCriteria(m_criteria);
467  nt->attachSelector(stmt);
468  }
469  else {
470  MsgStream log(msgSvc(), name());
471  log << MSG::ERROR << "Failed to attach tuple selector to " << m_inputs[i] << endmsg;
472  return StatusCode::FAILURE;
473  }
474  }
475  }
476  else {
477  MsgStream log(msgSvc(), name());
478  log << MSG::ERROR << "Failed to access tuple: " << m_inputs[i] << endmsg;
479  return StatusCode::FAILURE;
480  }
481  }
482  return StatusCode::SUCCESS;
483  }
std::string m_criteria
Selection criteria (if any)
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:14
SmartIF< ISvcLocator > & serviceLocator() const
The standard service locator.
Definition: Algorithm.cpp:1091
virtual StatusCode book(const NTuple::Tuple *nt)
Book the N-tuple according to the specification.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
std::vector< std::string > m_inputs
input specifications
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
std::string m_outName
Output tuple name.
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
INTupleSvc * m_dataSvc
Reference to data provider service.
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
virtual StatusCode checkInput(const NTuple::Tuple *clone, const NTuple::Tuple *src)
A small class used to access easily (and efficiently) data items residing in data stores...
Definition: SmartDataPtr.h:46
std::string m_selectorName
Selector factory.
list i
Definition: ana.py:128
virtual StatusCode CollectionCloneAlg::execute ( )
inlinevirtual

Execute procedure.

Implements IAlgorithm.

Definition at line 207 of file CollectionCloneAlg.cpp.

207  {
208  StatusCode status = connect();
209  if ( status.isSuccess() ) {
210  status = mergeInputTuples();
211  }
212  return status;
213  }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
StatusCode mergeInputTuples()
Merge all N-tuple entries.
StatusCode connect()
Connect input and output N-tuples.
virtual StatusCode CollectionCloneAlg::finalize ( )
inlinevirtual

Finalize.

Reimplemented from Algorithm.

Definition at line 200 of file CollectionCloneAlg.cpp.

200  {
201  if ( m_dataSvc ) m_dataSvc->release();
202  m_dataSvc = 0;
203  return StatusCode::SUCCESS;
204  }
INTupleSvc * m_dataSvc
Reference to data provider service.
virtual unsigned long release()=0
Release Interface instance.
virtual StatusCode CollectionCloneAlg::initialize ( )
inlinevirtual

Initialize.

Reimplemented from Algorithm.

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 = "";
165  if ( sc.isSuccess() ) {
166  std::string fun;
167  using Parser = Gaudi::Utils::AttribStringParser;
168  for (auto attrib: Parser(m_output)) {
169  switch( ::toupper(attrib.tag[0]) ) {
170  case 'D':
171  m_outName = std::move(attrib.value);
172  break;
173  case 'S':
174  m_criteria = std::move(attrib.value);
175  break;
176  case 'F':
177  fun = std::move(attrib.value);
178  break ;
179  default:
180  break;
181  }
182  }
183  if ( m_outName.empty() ) {
184  log << MSG::ERROR << "Failed to analyze output specs:" << m_output << endmsg;
185  return StatusCode::FAILURE;
186  }
187  if ( fun.length() > 0 || m_criteria.length() > 0 ) {
188  if ( m_criteria.length() > 0 && fun.length() == 0 ) fun = "NTuple::Selector";
190  return StatusCode::SUCCESS;
191  }
192  return sc;
193  }
194  log << MSG::ERROR << "Failed to access service \""
195  << m_tupleSvc << "\"." << endmsg;
196  return sc;
197  }
std::string m_tupleSvc
Name of the data provider service.
std::string m_criteria
Selection criteria (if any)
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
std::string m_output
Output specification.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
std::string m_outName
Output tuple name.
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
INTupleSvc * m_dataSvc
Reference to data provider service.
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
std::string m_rootName
Name of the root leaf (obtained at initialize)
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:27
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:210
std::string m_selectorName
Selector factory.
void toupper(std::string &s)
StatusCode CollectionCloneAlg::mergeEntries ( const std::string &  input)
inline

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

Definition at line 338 of file CollectionCloneAlg.cpp.

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

Merge all N-tuple entries.

Definition at line 486 of file CollectionCloneAlg.cpp.

486  {
487  MsgStream log(msgSvc(), name());
488  for (size_t inp=0; inp < m_inputs.size(); ++inp) {
490  if ( !sc.isSuccess() ) {
491  log << MSG::ERROR << "Failed to merge tuple:" << m_inputs[inp] << endmsg;
492  return sc;
493  }
494  }
495  return StatusCode::SUCCESS;
496  }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
StatusCode mergeEntries(const std::string &input)
Merge the entries of a single input tuple into the output.
std::vector< std::string > m_inputs
input specifications
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896

Member Data Documentation

std::string CollectionCloneAlg::m_criteria
private

Selection criteria (if any)

Definition at line 140 of file CollectionCloneAlg.cpp.

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: