All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TagCollectionStream Class Reference

Specialized output stream class for event tag collections, where the basic Event entry point should be placed as well into the collection itself. More...

#include <PersistencySvc/TagCollectionStream.h>

Inheritance diagram for TagCollectionStream:
Collaboration diagram for TagCollectionStream:

Public Member Functions

 TagCollectionStream (const std::string &name, ISvcLocator *pSvcLocator)
 Standard algorithm Constructor. More...
 
virtual ~TagCollectionStream ()
 Standard Destructor. More...
 
virtual StatusCode initialize ()
 Initialize TagCollectionStream. More...
 
virtual StatusCode finalize ()
 Terminate TagCollectionStream. More...
 
- Public Member Functions inherited from OutputStream
 OutputStream (const std::string &name, ISvcLocator *pSvcLocator)
 Standard algorithm Constructor. More...
 
virtual ~OutputStream ()
 Standard Destructor. More...
 
virtual StatusCode execute ()
 Working entry point. More...
 
virtual StatusCode connectConversionSvc ()
 
virtual bool collect (IRegistry *dir, int level)
 Store agent's classback. More...
 
virtual StatusCode collectObjects ()
 Collect all objects to be written to the output stream. More...
 
void clearItems (Items &itms)
 Clear item list. More...
 
void addItem (Items &itms, const std::string &descriptor)
 Add item to output streamer list. More...
 
void clearSelection ()
 Clear list of selected objects. More...
 
IDataSelectorselectedObjects ()
 Return the list of selected objects. 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...
 
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...
 
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...
 
- Public Member Functions inherited from IAlgorithm
 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...
 
- 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...
 
- Public Member Functions inherited from IProperty
 DeclareInterfaceID (IProperty, 2, 0)
 InterfaceID. More...
 
- Public Member Functions inherited from IStateful
 DeclareInterfaceID (IStateful, 1, 0)
 InterfaceID. More...
 
virtual ~IStateful ()
 

Protected Member Functions

virtual StatusCode writeObjects ()
 OutputStream override: Select the different objects and write them to file. More...
 
virtual StatusCode connectAddress ()
 Connect address column, if not already connected. More...
 
StatusCode writeData ()
 Write data objects. More...
 
StatusCode writeTuple ()
 Write tuple data. More...
 
StatusCode writeRecord ()
 Write full event record. More...
 
- Protected Member Functions inherited from OutputStream
StatusCode decodeAcceptAlgs ()
 Decode list of Algorithms that this stream accepts. More...
 
void acceptAlgsHandler (Property &theProp)
 Handler for AcceptAlgs Property. More...
 
StatusCode decodeRequireAlgs ()
 Decode list of Algorithms that this stream requires. More...
 
void requireAlgsHandler (Property &theProp)
 Handler for RequireAlgs Property. More...
 
StatusCode decodeVetoAlgs ()
 Decode list of Algorithms that this stream is vetoed by. More...
 
void vetoAlgsHandler (Property &theProp)
 Handler for VetoAlgs Property. More...
 
AlgorithmdecodeAlgorithm (const std::string &theName)
 Decode a single algorithm name. More...
 
StatusCode decodeAlgorithms (StringArrayProperty &theNames, std::vector< Algorithm * > *theAlgs)
 Decode specified list of Algorithms. More...
 
bool isEventAccepted () const
 Test whether this event should be output. More...
 
DataStoreItemfindItem (const std::string &path)
 Find single item identified by its path (exact match) More...
 
virtual bool hasInput () const
 Tell if the instance has been configured with input items or not. 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...
 

Protected Attributes

std::string m_addrLeaf
 Property: Name of the address leaf in the transient event store. More...
 
std::string m_addrColName
 Property: Name of the address column of the tag collection. More...
 
std::string m_tagName
 Property: Name of the tag collection in the transient store. More...
 
std::string m_collSvcName
 Property: Name of the collection service. More...
 
bool m_objectsFirst
 Property: Flag to indicate that the objects should be written first. More...
 
INTupleItemm_addrColumn
 NTuple column to hold the opaque address of the address leaf. More...
 
std::string m_topLeafName
 Name of the top leaf (performance cache) More...
 
bool m_isTopLeaf
 Short cut flag to indicate if the address leaf is the top leaf (performace cache) More...
 
INTupleSvcm_collectionSvc
 Keep reference to the tuple service. More...
 
GenericAddressm_addr
 Address buffer. More...
 
NTuple::Item< IOpaqueAddress * > m_item
 Address item buffer. More...
 
- Protected Attributes inherited from OutputStream
SmartIF< IIncidentSvcm_incidentSvc
 Reference to the incident service. More...
 
bool m_doPreLoad
 Flag indicating whether data pre-loading should be performed. More...
 
bool m_doPreLoadOpt
 Flag indicating whether optional items should be preloaded. More...
 
bool m_verifyItems
 Flag to indicate that item consistency should be checked. More...
 
std::string m_storeName
 Name of the service managing the data store. More...
 
std::string m_persName
 Name of the persistency service capable to write data from the store. More...
 
std::string m_output
 Name of the output file specification. More...
 
std::string m_outputName
 Name of the output file. More...
 
std::string m_outputType
 Output type: NEW(NEW,CREATE,WRITE,RECREATE), UPDATE) More...
 
OutputStreamAgentm_agent
 Keep reference of agent. More...
 
SmartIF< IDataProviderSvcm_pDataProvider
 Keep reference to the data provider service. More...
 
SmartIF< IDataManagerSvcm_pDataManager
 Keep reference to the data manager service. More...
 
SmartIF< IConversionSvcm_pConversionSvc
 Keep reference to the data conversion service. More...
 
DataStoreItemm_currentItem
 Keep track of the current item. More...
 
ItemNames m_itemNames
 Vector of item names. More...
 
Items m_itemList
 Vector of items to be saved to this stream. More...
 
ItemNames m_optItemNames
 Vector of item names. More...
 
Items m_optItemList
 Vector of optional items to be saved to this stream. More...
 
AlgDependentItemNames m_algDependentItemList
 Mapping between algorithm names, and a list of items for which, if the algorithm in question accepted the event, they should be also stored. More...
 
AlgDependentItems m_algDependentItems
 Items to be saved for specific algorithms. More...
 
IDataSelector m_objects
 Collection of objects being selected. More...
 
int m_events
 Number of events written to this output stream. More...
 
StringArrayProperty m_acceptNames
 Vector of names of Algorithms that this stream accepts. More...
 
StringArrayProperty m_requireNames
 Vector of names of Algorithms that this stream requires. More...
 
StringArrayProperty m_vetoNames
 Vector of names of Algorithms that this stream is vetoed by. More...
 
std::vector< Algorithm * > * m_acceptAlgs
 Vector of Algorithms that this stream accepts. More...
 
std::vector< Algorithm * > * m_requireAlgs
 Vector of Algorithms that this stream requires. More...
 
std::vector< Algorithm * > * m_vetoAlgs
 Vector of Algorithms that this stream is vetoed by. More...
 
bool m_fireIncidents
 should I fire incidents for writing opening/closing etc? More...
 

Additional Inherited Members

- Public Types inherited from OutputStream
typedef std::vector
< DataStoreItem * > 
Items
 
typedef std::vector< std::string > ItemNames
 
typedef std::map< Algorithm
*, Items
AlgDependentItems
 
typedef std::map< std::string,
ItemNames
AlgDependentItemNames
 
- Public Types inherited from Algorithm
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 extend_interfaces3
< IAlgorithm, IProperty,
IStateful
extend_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...
 
- 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...
 
- Public Types inherited from IInterface
enum  Status { 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...
 
- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 

Detailed Description

Specialized output stream class for event tag collections, where the basic Event entry point should be placed as well into the collection itself.

The TagCollectionStream is a rather specialized object combining features of NTuple I/O and object I/O. The main working points are:

1) Write a "normal" tag collection. The address column [property AddressColumn, default:"Address"] is added to the Ntuple identified by its name [mandatory property Collection]. The address column is set to the opaque address of the specified leaf [property "AddressLeaf", default:"/Event"]. The NTuple must be registered to the TES of the service [property: TagCollectionSvc, default:"NTupleSvc"]. This is the normal mode event tag collections work.

2) Write a tag collection with "REDIRECTED INPUT". Example: The collection is created from an intermediate file (MINI DST), but the Address column of the NTuple should point to the file e.g. containing the raw data.

  • Set the property "AddressLeaf" to something different from "/Event" e.g. "/Event/DAQ/RawEvent"

Note: The actual address of "/Event" get changed. No other output should be created after writing such a tag collection.

3) Write an "EMBEDDED COLLECTION". In this mode the OutputStream and the NTuple stream are combined. depending on the property TagCollectionStream.ObjectsFirst the objects are written first and the the tags. The tag file and the file containing the objects may be identical.

Note:

  • Also if the OutputStream features are NOT used, the options must still be properly set.
  • Tags or objects are only written to the output stream if the event is accepted according to the output stream criteria (veto algorithms, etc.)
  • If the address column is not present in the N-tuple (ie. it was not added by the N-tuple creator), it is automatically added at the first write attempt.
  • If the logical N-tuple output file is not yet connected to the tuple service, it is automatically connected to the the same as the OutputStream device.

Author: M.Frank Version: 1.0

Definition at line 63 of file TagCollectionStream.h.

Constructor & Destructor Documentation

TagCollectionStream::TagCollectionStream ( const std::string &  name,
ISvcLocator pSvcLocator 
)

Standard algorithm Constructor.

Definition at line 18 of file TagCollectionStream.cpp.

19  : OutputStream(nam, pSvc), m_addrColumn(0),
20  m_isTopLeaf(false), m_collectionSvc(0)
21 {
22  declareProperty("AddressLeaf", m_addrLeaf = "/Event" );
23  declareProperty("AddressColumn", m_addrColName = "Address");
24  declareProperty("TagCollectionSvc", m_collSvcName = "NTupleSvc");
25  declareProperty("ObjectsFirst", m_objectsFirst = true);
26  declareProperty("Collection", m_tagName );
27  m_addr = new GenericAddress();
28 }
std::string m_addrColName
Property: Name of the address column of the tag collection.
std::string m_tagName
Property: Name of the tag collection in the transient store.
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Algorithm.h:397
INTupleItem * m_addrColumn
NTuple column to hold the opaque address of the address leaf.
Generic Transient Address.
bool m_objectsFirst
Property: Flag to indicate that the objects should be written first.
std::string m_addrLeaf
Property: Name of the address leaf in the transient event store.
std::string m_collSvcName
Property: Name of the collection service.
INTupleSvc * m_collectionSvc
Keep reference to the tuple service.
OutputStream(const std::string &name, ISvcLocator *pSvcLocator)
Standard algorithm Constructor.
GenericAddress * m_addr
Address buffer.
bool m_isTopLeaf
Short cut flag to indicate if the address leaf is the top leaf (performace cache) ...
TagCollectionStream::~TagCollectionStream ( )
virtual

Standard Destructor.

Definition at line 31 of file TagCollectionStream.cpp.

31  {
32  delete m_addr;
33 }
GenericAddress * m_addr
Address buffer.

Member Function Documentation

StatusCode TagCollectionStream::connectAddress ( )
protectedvirtual

Connect address column, if not already connected.

Definition at line 36 of file TagCollectionStream.cpp.

36  {
37  MsgStream log(msgSvc(), name());
39  if ( nt ) {
40  m_addrColumn = nt->find(m_addrColName);
41  if ( 0 == m_addrColumn ) {
42  StatusCode sc = nt->addItem (m_addrColName,m_item);
43  if ( sc.isSuccess() ) {
44  m_addrColumn = m_item.operator->();
45  return sc;
46  }
47  log << MSG::ERROR << "Failed to add the address column:"
48  << m_addrColName << " to the tag collection " << m_tagName
49  << endmsg;
50  return sc;
51  }
52  return StatusCode::SUCCESS;
53  }
54  log << MSG::ERROR << "Failed to connect to the tag collection "
55  << m_tagName << endmsg;
56  return StatusCode::FAILURE;
57 }
std::string m_addrColName
Property: Name of the address column of the tag collection.
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
std::string m_tagName
Property: Name of the tag collection in the transient store.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
INTupleItem * m_addrColumn
NTuple column to hold the opaque address of the address leaf.
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
A small class used to access easily (and efficiently) data items residing in data stores...
Definition: SmartDataPtr.h:46
INTupleSvc * m_collectionSvc
Keep reference to the tuple service.
NTuple::Item< IOpaqueAddress * > m_item
Address item buffer.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode TagCollectionStream::finalize ( )
virtual

Terminate TagCollectionStream.

Reimplemented from OutputStream.

Definition at line 114 of file TagCollectionStream.cpp.

114  {
115  MsgStream log(msgSvc(), name());
118  m_collectionSvc = 0;
119  m_addrColumn = 0;
120  return status;
121 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
INTupleItem * m_addrColumn
NTuple column to hold the opaque address of the address leaf.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual StatusCode finalize()
Terminate OutputStream.
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
virtual unsigned long release()=0
Release Interface instance.
INTupleSvc * m_collectionSvc
Keep reference to the tuple service.
StatusCode TagCollectionStream::initialize ( )
virtual

Initialize TagCollectionStream.

Reimplemented from OutputStream.

Definition at line 60 of file TagCollectionStream.cpp.

60  {
61  std::string log_node, log_file, logical_name;
63  if ( sc.isSuccess() ) {
64  Tokenizer tok(true);
65  tok.analyse(m_output, " ", "", "", "=", "'", "'");
66  m_output = "";
67  for(Tokenizer::Items::iterator i = tok.items().begin(); i != tok.items().end(); ++i) {
68  const std::string& tag = (*i).tag();
69  const std::string& val = (*i).value();
70  switch( ::toupper(tag[0]) ) {
71  case 'C':
72  m_tagName = val;
73  break;
74  case 'A':
75  m_addrLeaf = val;
76  break;
77  default:
78  m_output += tag + "='" + val + "' ";
79  break;
80  }
81  }
82  std::string::size_type idx = m_tagName[0]==SEPARATOR ? m_tagName.find(SEPARATOR,1) : 0;
83  log_node = m_tagName.substr(idx,m_tagName.find(SEPARATOR,idx+1));
84  log_file = log_node + " " + m_output + " SHARED='YES'";
85  }
86  m_addrColumn = 0; // reset pointer to item column
87  sc = OutputStream::initialize(); // Now initialize the base class
88  if ( sc.isSuccess() ) {
90  if ( src_mgr.isValid() ) {
92  if ( data_mgr.isValid() ) {
93  logical_name = data_mgr->rootName();
94  logical_name += SEPARATOR;
95  logical_name += log_node;
96  m_topLeafName = m_addrLeaf.substr(0,m_addrLeaf.find(SEPARATOR,m_addrLeaf[0]=='/' ? 1 : 0));
98  if ( src_mgr->isConnected(logical_name) ) {
99  return sc;
100  }
101  sc = src_mgr->connect(log_file);
102  if ( sc.isSuccess() ) {
103  return sc;
104  }
105  }
106  }
107  }
108  MsgStream log(msgSvc(), name());
109  log << MSG::ERROR << "Failed to initialize TagCollection Stream." << endmsg;
110  return StatusCode::FAILURE;
111 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
std::string m_tagName
Property: Name of the tag collection in the transient store.
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:14
constexpr char SEPARATOR
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
INTupleItem * m_addrColumn
NTuple column to hold the opaque address of the address leaf.
std::string m_addrLeaf
Property: Name of the address leaf in the transient event store.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
STL Include files.
Definition: Tokenizer.h:24
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
std::string m_collSvcName
Property: Name of the collection service.
INTupleSvc * m_collectionSvc
Keep reference to the tuple 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:207
std::string m_output
Name of the output file specification.
Definition: OutputStream.h:47
list i
Definition: ana.py:128
virtual StatusCode initialize()
Initialize OutputStream.
void toupper(std::string &s)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool m_isTopLeaf
Short cut flag to indicate if the address leaf is the top leaf (performace cache) ...
std::string m_topLeafName
Name of the top leaf (performance cache)
StatusCode TagCollectionStream::writeData ( )
protected

Write data objects.

Definition at line 135 of file TagCollectionStream.cpp.

135  {
137  if ( !sc.isSuccess() ) {
138  MsgStream log(msgSvc(), name());
139  log << MSG::ERROR << "Failed to write tag collection " << m_tagName << ". "
140  << "[Object write error]" << endmsg;
141  }
142  return sc;
143 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
std::string m_tagName
Property: Name of the tag collection in the transient store.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
virtual StatusCode writeObjects()
Select the different objects and write them to file.
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
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode TagCollectionStream::writeObjects ( )
protectedvirtual

OutputStream override: Select the different objects and write them to file.

Reimplemented from OutputStream.

Definition at line 154 of file TagCollectionStream.cpp.

154  {
156  if ( status.isSuccess() ) {
157  status = m_objectsFirst ? writeData() : StatusCode::SUCCESS;
158  if ( status.isSuccess() ) {
159  if ( !m_addrColName.empty() ) {
161  if ( top != 0 ) {
162  IOpaqueAddress* pA = top->registry()->address();
163  if ( pA != 0 ) {
164  std::string* par = (std::string*)m_addr->par();
165  unsigned long* ipar = (unsigned long*)m_addr->ipar();
166  m_addr->setClID(pA->clID());
167  m_addr->setSvcType(pA->svcType());
168  par[0] = pA->par()[0];
169  par[1] = pA->par()[1];
170  ipar[0] = pA->ipar()[0];
171  ipar[1] = pA->ipar()[1];
173  if ( m_isTopLeaf ) {
174  return writeRecord();
175  }
176  // Handle redirection mode. Normal tag collection mode
177  // is the same like leaving this out....
179  if ( 0 != leaf ) {
180  IOpaqueAddress* redir = leaf->registry()->address();
181  if ( redir ) {
182  par[0] = redir->par()[0];
183  ipar[0] = ~0x0;
184  ipar[1] = redir->ipar()[1];
185  return writeRecord();
186  }
187  MsgStream log3(msgSvc(), name());
188  log3 << MSG::ERROR << "Failed to write tag collection " << m_tagName << ". "
189  << m_addrLeaf << "'s address not found." << endmsg;
190  return StatusCode::FAILURE;
191  }
192  MsgStream log2(msgSvc(), name());
193  log2 << MSG::ERROR << "Failed to write tag collection " << m_tagName << ". "
194  << m_addrLeaf << " not found." << endmsg;
195  return StatusCode::FAILURE;
196  }
197  MsgStream log1(msgSvc(), name());
198  log1 << MSG::ERROR << "Failed to write tag collection " << m_tagName << ". "
199  << m_topLeafName << "'s address not found." << endmsg;
200  return StatusCode::FAILURE;
201  }
202  MsgStream log0(msgSvc(), name());
203  log0 << MSG::ERROR << "Failed to write tag collection " << m_tagName << ". "
204  << m_topLeafName << " not found." << endmsg;
205  return StatusCode::FAILURE;
206  }
207  }
208  }
209  return status;
210 }
std::string m_addrColName
Property: Name of the address column of the tag collection.
virtual const std::string * par() const =0
Retrieve String parameters.
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
std::string m_tagName
Property: Name of the tag collection in the transient store.
virtual StatusCode connectAddress()
Connect address column, if not already connected.
void setSvcType(long typ)
Access : set the storage type of the class id.
Normal successful completion.
Definition: IInterface.h:219
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
StatusCode writeData()
Write data objects.
INTupleItem * m_addrColumn
NTuple column to hold the opaque address of the address leaf.
virtual long svcType() const =0
Retrieve service type.
bool m_objectsFirst
Property: Flag to indicate that the objects should be written first.
std::string m_addrLeaf
Property: Name of the address leaf in the transient event store.
StatusCode writeRecord()
Write full event record.
virtual const std::string * par() const
Retrieve string parameters.
void setClID(const CLID &clid)
Access : Set class ID of the link.
virtual const unsigned long * ipar() const
Retrieve integer parameters.
virtual const CLID & clID() const =0
Retrieve class information from link.
virtual IRegistry * registry() const =0
Update branch name.
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
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
SmartIF< IDataProviderSvc > & eventSvc() const
The standard event data service.
A small class used to access easily (and efficiently) data items residing in data stores...
Definition: SmartDataPtr.h:46
Opaque address interface definition.
virtual const unsigned long * ipar() const =0
Access to generic link parameters.
GenericAddress * m_addr
Address buffer.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool m_isTopLeaf
Short cut flag to indicate if the address leaf is the top leaf (performace cache) ...
std::string m_topLeafName
Name of the top leaf (performance cache)
virtual const void * buffer() const =0
Access data buffer (CONST)
StatusCode TagCollectionStream::writeRecord ( )
protected

Write full event record.

Definition at line 146 of file TagCollectionStream.cpp.

146  {
147  if ( writeTuple().isSuccess() ) {
149  }
150  return StatusCode::FAILURE;
151 }
StatusCode writeData()
Write data objects.
StatusCode writeTuple()
Write tuple data.
bool m_objectsFirst
Property: Flag to indicate that the objects should be written first.
StatusCode TagCollectionStream::writeTuple ( )
protected

Write tuple data.

Definition at line 124 of file TagCollectionStream.cpp.

124  {
126  if ( !sc.isSuccess() ) {
127  MsgStream log(msgSvc(), name());
128  log << MSG::ERROR << "Failed to write tag collection " << m_tagName << ". "
129  << "[Tuple write error]" << endmsg;
130  }
131  return sc;
132 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
std::string m_tagName
Property: Name of the tag collection in the transient store.
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
virtual StatusCode writeRecord(NTuple::Tuple *tuple)=0
Write single record to N tuple.
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
INTupleSvc * m_collectionSvc
Keep reference to the tuple service.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

Member Data Documentation

GenericAddress* TagCollectionStream::m_addr
protected

Address buffer.

Definition at line 85 of file TagCollectionStream.h.

std::string TagCollectionStream::m_addrColName
protected

Property: Name of the address column of the tag collection.

Definition at line 69 of file TagCollectionStream.h.

INTupleItem* TagCollectionStream::m_addrColumn
protected

NTuple column to hold the opaque address of the address leaf.

Definition at line 77 of file TagCollectionStream.h.

std::string TagCollectionStream::m_addrLeaf
protected

Property: Name of the address leaf in the transient event store.

Definition at line 67 of file TagCollectionStream.h.

INTupleSvc* TagCollectionStream::m_collectionSvc
protected

Keep reference to the tuple service.

Definition at line 83 of file TagCollectionStream.h.

std::string TagCollectionStream::m_collSvcName
protected

Property: Name of the collection service.

Definition at line 73 of file TagCollectionStream.h.

bool TagCollectionStream::m_isTopLeaf
protected

Short cut flag to indicate if the address leaf is the top leaf (performace cache)

Definition at line 81 of file TagCollectionStream.h.

NTuple::Item<IOpaqueAddress*> TagCollectionStream::m_item
protected

Address item buffer.

Definition at line 87 of file TagCollectionStream.h.

bool TagCollectionStream::m_objectsFirst
protected

Property: Flag to indicate that the objects should be written first.

Definition at line 75 of file TagCollectionStream.h.

std::string TagCollectionStream::m_tagName
protected

Property: Name of the tag collection in the transient store.

Definition at line 71 of file TagCollectionStream.h.

std::string TagCollectionStream::m_topLeafName
protected

Name of the top leaf (performance cache)

Definition at line 79 of file TagCollectionStream.h.


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