| The Gaudi Framework v29r1 (5cd95fa2)

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

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

Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
EventSelectorDataStream Class Reference

Definition of class EventSelectorDataStream. More...

`#include <GaudiKernel/EventSelectorDataStream.h>`

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

## Public Types
typedef std::vector< Gaudi::Property< std::string > > | Properties
Public Types inherited from implements< IInterface >
using | base_class = implements< Interfaces... >
| Typedef to this class. More...
using | extend_interfaces_base = extend_interfaces< Interfaces... >
| Typedef to the base of this class. More...
using | iids = typename extend_interfaces_base::ext_iids
Public Types inherited from extend_interfaces< Interfaces... >
using | ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
| take union of the ext_iids of all Interfaces... More...

## Public Member Functions
| EventSelectorDataStream (std::string nam, std::string def, ISvcLocator *svcloc)
| Standard Constructor. More...
virtual void | setSelector (IEvtSelector *pSelector)
| Attach event selector object. More...
virtual StatusCode | initialize ()
| Parse input criteria. More...
virtual StatusCode | finalize ()
| Finalize stream and release resources. More...
Gaudi::Property< std::string > * | property (const std::string &nam)
| Allow access to individual properties by name. More...
const Gaudi::Property< std::string > * | property (const std::string &nam) const
| Allow access to individual properties by name (CONST) More...
const Properties & | properties ()
| Access properties. More...
const std::string & | name () const
| Retrieve stream name. More...
const std::string & | criteria () const
| Retrieve stream criteria. More...
const std::string & | dbName () const
| Retrieve stream dbName. More...
const std::string & | selectorType () const
| Retrieve event selector type. More...
const std::string & | definition () const
| Retrieve definition string. More...
IEvtSelector * | selector () const
| Retrieve event selector object. More...
bool | isInitialized () const
| Check initialization status. More...
Public Member Functions inherited from implements< IInterface >
void * | i_cast (const InterfaceID &tid) const override
| Implementation of IInterface::i_cast. More...
StatusCode | queryInterface (const InterfaceID &ti, void **pp) override
| Implementation of IInterface::queryInterface. More...
std::vector< std::string > | getInterfaceNames () const override
| Implementation of IInterface::getInterfaceNames. More...
| implements ()=default
| Default constructor. More...
| implements (const implements &)
| Copy constructor (zero the reference count) More...
implements & | operator= (const implements &)
| Assignment operator (do not touch the reference count). More...
| ~implements () override=default
| Virtual destructor. More...
unsigned long | addRef () override
| Reference Interface instance. More...
unsigned long | release () override
| Release Interface instance. More...
unsigned long | refCount () const override
| Current reference count. More...
Public Member Functions inherited from extend_interfaces< Interfaces... >
| ~extend_interfaces () override=default
| Virtual destructor. More...

## Protected Member Functions
virtual | ~EventSelectorDataStream ()=default
| Standard Destructor. More...

## Protected Attributes
std::string | m_name
| Name. More...
std::string | m_definition
| Definition string. More...
std::string | m_criteria
| Criteria. More...
std::string | m_dbName
| String with name of the db as parsed. More...
std::string | m_selectorType
| Event selector type. More...
SmartIF< IEvtSelector > | m_pSelector
| Pointer to valid selector. More...
ISvcLocator * | m_pSvcLocator
| Reference to service locator. More...
Properties | m_properties
| Properties vector. More...
bool | m_initialized = false
| Initialization state. More...
Protected Attributes inherited from implements< IInterface >
std::atomic_ulong | m_refCount
| Reference counter. More...

## Friends
MsgStream & | operator<< (MsgStream &s, const EventSelectorDataStream &obj)
| Output friend for MsgStream. More...
std::ostream & | operator<< (std::ostream &s, const EventSelectorDataStream &obj)
| Output friend for standard I/O. More...

## Detailed Description

Definition of class EventSelectorDataStream.

Small class which eases the management of multiple input streams for the event selector.

History: +------—+-------------------------------------------—+---------—+ | Date | Comment | Who | +------—+-------------------------------------------—+---------—+ | 3/10/00 | Initial version | M.Frank | +------—+-------------------------------------------—+---------—+ | 4/09/09 | Added m_dbName and dbName() | R. Lambert | +------—+-------------------------------------------—+---------—+

Author
  Markus Frank
  R. Lambert

Version
  1.0

Definition at line 45 of file EventSelectorDataStream.h.

## Member Typedef Documentation

typedef std::vector<Gaudi::Property<std::string> > EventSelectorDataStream::Properties

Definition at line 53 of file EventSelectorDataStream.h.

## Constructor & Destructor Documentation

virtual EventSelectorDataStream::~EventSelectorDataStream | ( |  | ) |
| protected virtual default

Standard Destructor.

EventSelectorDataStream::EventSelectorDataStream | ( | std::string | nam,
|  | std::string | def,
|  | ISvcLocator * | svcloc
| ) |  |

Standard Constructor.

Definition at line 37 of file EventSelectorDataStream.cpp.

38 : m_name{std::move( nam )}, m_definition{std::move( def )}, m_pSvcLocator( svcloc )
39 {
40 }
EventSelectorDataStream::m_pSvcLocator
ISvcLocator * m_pSvcLocator
Reference to service locator.
Definition: EventSelectorDataStream.h:69
std::move
T move(T...args)
EventSelectorDataStream::m_definition
std::string m_definition
Definition string.
Definition: EventSelectorDataStream.h:59
EventSelectorDataStream::m_name
std::string m_name
Name.
Definition: EventSelectorDataStream.h:57

## Member Function Documentation

const std::string& EventSelectorDataStream::criteria | ( |  | ) | const
| inline

Retrieve stream criteria.

Definition at line 95 of file EventSelectorDataStream.h.

95 { return m_criteria; }
EventSelectorDataStream::m_criteria
std::string m_criteria
Criteria.
Definition: EventSelectorDataStream.h:61

const std::string& EventSelectorDataStream::dbName | ( |  | ) | const
| inline

Retrieve stream dbName.

Definition at line 97 of file EventSelectorDataStream.h.

97 { return m_dbName; }
EventSelectorDataStream::m_dbName
std::string m_dbName
String with name of the db as parsed.
Definition: EventSelectorDataStream.h:63

const std::string& EventSelectorDataStream::definition | ( |  | ) | const
| inline

Retrieve definition string.

Definition at line 101 of file EventSelectorDataStream.h.

101 { return m_definition; }
EventSelectorDataStream::m_definition
std::string m_definition
Definition string.
Definition: EventSelectorDataStream.h:59

StatusCode EventSelectorDataStream::finalize | ( |  | ) |
| virtual

Finalize stream and release resources.

Definition at line 188 of file EventSelectorDataStream.cpp.

189 {
190 setSelector( nullptr );
191 m_properties.clear();
192 m_initialized = false;
193 return StatusCode::SUCCESS;
194 }
EventSelectorDataStream::m_initialized
bool m_initialized
Initialization state.
Definition: EventSelectorDataStream.h:73
StatusCode::SUCCESS
Definition: StatusCode.h:31
std::vector::clear
T clear(T...args)
EventSelectorDataStream::m_properties
Properties m_properties
Properties vector.
Definition: EventSelectorDataStream.h:71
EventSelectorDataStream::setSelector
virtual void setSelector(IEvtSelector *pSelector)
Attach event selector object.
Definition: EventSelectorDataStream.cpp:43

StatusCode EventSelectorDataStream::initialize | ( |  | ) |
| virtual

Parse input criteria.

Definition at line 62 of file EventSelectorDataStream.cpp.

63 {
64 bool isData = true;
65 std::string auth, dbtyp, collsvc, item, crit, sel, svc, stmt;
66 std::string cnt = "/Event";
67 std::string db = "<Unknown>";
68
69 auto eds = m_pSvcLocator->service<IDataManagerSvc>( "EventDataSvc" );
70 if ( !eds ) {
71 std::cout << "ERROR: Unable to localize interface IDataManagerSvc from service EventDataSvc" << std::endl;
72 return StatusCode::FAILURE;
73 } else {
74 cnt = eds->rootName();
75 }
76 m_selectorType = m_criteria = m_dbName = "";
77 m_properties.clear();
78
79 using Parser = Gaudi::Utils::AttribStringParser;
80 for ( auto attrib : Parser( m_definition ) ) {
81 long hash = -1;
82 switch (::toupper( attrib.tag[0] ) ) {
83 case 'A':
84 auth = std::move( attrib.value );
85 break;
86 case 'C':
87 svc = "EvtTupleSvc";
88 isData = false;
89 /* FALLTHROUGH */
90 case 'E':
91 hash = attrib.value.find( '#' );
92 if ( hash > 0 ) {
93 cnt = attrib.value.substr( 0, hash );
94 item = attrib.value.substr( hash + 1 );
95 } else {
96 cnt = std::move( attrib.value );
97 item = "Address";
98 }
99 break;
100 case 'D':
101 m_criteria = "FILE " + attrib.value;
102 m_dbName = std::move( attrib.value );
103 break;
104 case 'F':
105 switch (::toupper( attrib.tag[1] ) ) {
106 case 'I':
107 m_criteria = "FILE " + attrib.value;
108 m_dbName = std::move( attrib.value );
109 break;
110 case 'U':
111 stmt = std::move( attrib.value );
112 break;
113 default:
114 break;
115 }
116 break;
117 case 'J':
118 m_criteria = "JOBID " + attrib.value;
119 m_dbName = std::move( attrib.value );
120 dbtyp = "SICB";
121 break;
122 case 'T':
123 switch (::toupper( attrib.tag[1] ) ) {
124 case 'Y':
125 dbtyp = std::move( attrib.value );
126 break;
127 default:
128 break;
129 }
130 break;
131 case 'S':
132 switch (::toupper( attrib.tag[1] ) ) {
133 case 'E':
134 sel = std::move( attrib.value );
135 break;
136 case 'V':
137 svc = std::move( attrib.value );
138 collsvc = svc;
139 break;
140 default:
141 break;
142 }
143 break;
144 default:
145 m_properties.emplace_back( attrib.tag, attrib.value );
146 break;
147 }
148 }
149 if ( !isData ) { // Unfortunately options do not come in order...
150 m_selectorType = "EventCollectionSelector";
151 svc = "EvtTupleSvc";
152 } else if ( dbtyp.compare( 0, 4, "POOL" ) == 0 ) {
153 m_selectorType = "PoolDbEvtSelector";
154 } else if ( svc.empty() ) {
155 m_selectorType = "DbEvtSelector";
156 } else {
157 m_selectorType = svc;
158 }
159 StatusCode status = StatusCode::SUCCESS;
160 if ( svc.empty() && !dbtyp.empty() ) {
161 auto ipers = m_pSvcLocator->service<IPersistencySvc>( "EventPersistencySvc" );
162 if ( ipers ) {
163 IConversionSvc* icnvSvc = nullptr;
164 status = ipers->getService( dbtyp, icnvSvc );
165 if ( status.isSuccess() ) {
166 auto isvc = SmartIF<INamedInterface>{icnvSvc};
167 if ( isvc ) svc = isvc->name();
168 }
169 }
170 }
171 m_properties.emplace_back( "Function", stmt );
172 m_properties.emplace_back( "CnvService", svc );
173 m_properties.emplace_back( "Authentication", auth );
174 m_properties.emplace_back( "Container", cnt );
175 m_properties.emplace_back( "Item", item );
176 m_properties.emplace_back( "Criteria", sel );
177 m_properties.emplace_back( "DbType", dbtyp );
178 m_properties.emplace_back( "DB", m_criteria );
179 if ( !isData && !collsvc.empty() ) {
180 m_properties.emplace_back( "DbService", collsvc );
181 }
182
183 m_initialized = status.isSuccess();
184 return status;
185 }
Gaudi::Utils::AttribStringParser
Parse attribute strings allowing iteration over the various attributes.
Definition: AttribStringParser.h:32
EventSelectorDataStream::m_initialized
bool m_initialized
Initialization state.
Definition: EventSelectorDataStream.h:73
StatusCode::SUCCESS
Definition: StatusCode.h:31
SmartIF< INamedInterface >
std::string::empty
T empty(T...args)
StatusCode::FAILURE
Definition: StatusCode.h:31
IConversionSvc
Definition: IConversionSvc.h:37
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
std::endl
T endl(T...args)
IOTest.sel
sel
Definition: IOTest.py:95
EventSelectorDataStream::m_criteria
std::string m_criteria
Criteria.
Definition: EventSelectorDataStream.h:61
EventSelectorDataStream::m_selectorType
std::string m_selectorType
Event selector type.
Definition: EventSelectorDataStream.h:65
std::string
STL class.
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:79
EventSelectorDataStream::m_pSvcLocator
ISvcLocator * m_pSvcLocator
Reference to service locator.
Definition: EventSelectorDataStream.h:69
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
std::vector::clear
T clear(T...args)
std::move
T move(T...args)
EventSelectorDataStream::m_definition
std::string m_definition
Definition string.
Definition: EventSelectorDataStream.h:59
std::string::find
T find(T...args)
EventSelectorDataStream::m_properties
Properties m_properties
Properties vector.
Definition: EventSelectorDataStream.h:71
IDataManagerSvc
Definition: IDataManagerSvc.h:45
std::string::substr
T substr(T...args)
IPersistencySvc
Data persistency service interface.
Definition: IPersistencySvc.h:19
EventSelectorDataStream::m_dbName
std::string m_dbName
String with name of the db as parsed.
Definition: EventSelectorDataStream.h:63
std::cout
toupper
void toupper(std::string &s)
Definition: StatusCodeSvc.cpp:10
std::string::compare
T compare(T...args)
std::vector::emplace_back
T emplace_back(T...args)

bool EventSelectorDataStream::isInitialized | ( |  | ) | const
| inline

Check initialization status.

Definition at line 105 of file EventSelectorDataStream.h.

105 { return m_initialized; }
EventSelectorDataStream::m_initialized
bool m_initialized
Initialization state.
Definition: EventSelectorDataStream.h:73

const std::string& EventSelectorDataStream::name | ( |  | ) | const
| inline

Retrieve stream name.

Definition at line 93 of file EventSelectorDataStream.h.

93 { return m_name; }
EventSelectorDataStream::m_name
std::string m_name
Name.
Definition: EventSelectorDataStream.h:57

const Properties& EventSelectorDataStream::properties | ( |  | ) |
| inline

Access properties.

Definition at line 91 of file EventSelectorDataStream.h.

91 { return m_properties; }
EventSelectorDataStream::m_properties
Properties m_properties
Properties vector.
Definition: EventSelectorDataStream.h:71

Gaudi::Property< std::string > * EventSelectorDataStream::property | ( | const std::string & | nam | ) |

Allow access to individual properties by name.

Definition at line 46 of file EventSelectorDataStream.cpp.

47 {
48 auto i = std::find_if( std::begin( m_properties ), std::end( m_properties ),
49 [&]( const Gaudi::Property<std::string>& j ) { return j.name() == nam; } );
50 return i != std::end( m_properties ) ? &( *i ) : nullptr;
51 }
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:319
Gaudi::Details::PropertyBase::name
const std::string name() const
property name
Definition: Property.h:40
std::end
T end(T...args)
std::find_if
T find_if(T...args)
EventSelectorDataStream::m_properties
Properties m_properties
Properties vector.
Definition: EventSelectorDataStream.h:71
std::begin
T begin(T...args)

const Gaudi::Property< std::string > * EventSelectorDataStream::property | ( | const std::string & | nam | ) | const

Allow access to individual properties by name (CONST)

Definition at line 54 of file EventSelectorDataStream.cpp.

55 {
56 auto i = std::find_if( std::begin( m_properties ), std::end( m_properties ),
57 [&]( const Gaudi::Property<std::string>& j ) { return j.name() == nam; } );
58 return i != std::end( m_properties ) ? &( *i ) : nullptr;
59 }
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:319
Gaudi::Details::PropertyBase::name
const std::string name() const
property name
Definition: Property.h:40
std::end
T end(T...args)
std::find_if
T find_if(T...args)
EventSelectorDataStream::m_properties
Properties m_properties
Properties vector.
Definition: EventSelectorDataStream.h:71
std::begin
T begin(T...args)

IEvtSelector* EventSelectorDataStream::selector | ( |  | ) | const
| inline

Retrieve event selector object.

Definition at line 103 of file EventSelectorDataStream.h.

103 { return m_pSelector.get(); }
EventSelectorDataStream::m_pSelector
SmartIF< IEvtSelector > m_pSelector
Pointer to valid selector.
Definition: EventSelectorDataStream.h:67
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:82

const std::string& EventSelectorDataStream::selectorType | ( |  | ) | const
| inline

Retrieve event selector type.

Definition at line 99 of file EventSelectorDataStream.h.

99 { return m_selectorType; }
EventSelectorDataStream::m_selectorType
std::string m_selectorType
Event selector type.
Definition: EventSelectorDataStream.h:65

void EventSelectorDataStream::setSelector | ( | IEvtSelector * | pSelector | ) |
| virtual

Attach event selector object.

Definition at line 43 of file EventSelectorDataStream.cpp.

43 { m_pSelector = pSelector; }
EventSelectorDataStream::m_pSelector
SmartIF< IEvtSelector > m_pSelector
Pointer to valid selector.
Definition: EventSelectorDataStream.h:67

## Friends And Related Function Documentation

MsgStream& operator<< | ( | MsgStream & | s,
|  | const EventSelectorDataStream & | obj
| ) |  |
| friend

Output friend for MsgStream.

Definition at line 25 of file EventSelectorDataStream.cpp.

26 {
27 return s << "Stream:" << obj.name() << " Def:" << obj.definition();
28 }
EventSelectorDataStream::name
const std::string & name() const
Retrieve stream name.
Definition: EventSelectorDataStream.h:93
EventSelectorDataStream::definition
const std::string & definition() const
Retrieve definition string.
Definition: EventSelectorDataStream.h:101

std::ostream& operator<< | ( | std::ostream & | s,
|  | const EventSelectorDataStream & | obj
| ) |  |
| friend

Output friend for standard I/O.

Definition at line 31 of file EventSelectorDataStream.cpp.

32 {
33 return s << "Stream:" << obj.name() << " Def:" << obj.definition();
34 }
EventSelectorDataStream::name
const std::string & name() const
Retrieve stream name.
Definition: EventSelectorDataStream.h:93
EventSelectorDataStream::definition
const std::string & definition() const
Retrieve definition string.
Definition: EventSelectorDataStream.h:101

## Member Data Documentation

std::string EventSelectorDataStream::m_criteria
| protected

Criteria.

Definition at line 61 of file EventSelectorDataStream.h.

std::string EventSelectorDataStream::m_dbName
| protected

String with name of the db as parsed.

Definition at line 63 of file EventSelectorDataStream.h.

std::string EventSelectorDataStream::m_definition
| protected

Definition string.

Definition at line 59 of file EventSelectorDataStream.h.

bool EventSelectorDataStream::m_initialized = false
| protected

Initialization state.

Definition at line 73 of file EventSelectorDataStream.h.

std::string EventSelectorDataStream::m_name
| protected

Name.

Definition at line 57 of file EventSelectorDataStream.h.

Properties EventSelectorDataStream::m_properties
| protected

Properties vector.

Definition at line 71 of file EventSelectorDataStream.h.

SmartIF<IEvtSelector> EventSelectorDataStream::m_pSelector
| protected

Pointer to valid selector.

Definition at line 67 of file EventSelectorDataStream.h.

ISvcLocator* EventSelectorDataStream::m_pSvcLocator
| protected

Reference to service locator.

Definition at line 69 of file EventSelectorDataStream.h.

std::string EventSelectorDataStream::m_selectorType
| protected

Event selector type.

Definition at line 65 of file EventSelectorDataStream.h.

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

- GaudiKernel/GaudiKernel/EventSelectorDataStream.h
- GaudiKernel/src/Lib/EventSelectorDataStream.cpp