| The Gaudi Framework v27r1

- 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< StringProperty > | 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...
StringProperty * | property (const std::string &nam)
| Allow access to individual properties by name. More...
const StringProperty * | 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< StringProperty > EventSelectorDataStream::Properties

Definition at line 51 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:66
std::move
T move(T...args)
EventSelectorDataStream::m_definition
std::string m_definition
Definition string.
Definition: EventSelectorDataStream.h:56
EventSelectorDataStream::m_name
std::string m_name
Name.
Definition: EventSelectorDataStream.h:54

## Member Function Documentation

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

Retrieve stream criteria.

Definition at line 95 of file EventSelectorDataStream.h.

95 {
96 return m_criteria;
97 }
EventSelectorDataStream::m_criteria
std::string m_criteria
Criteria.
Definition: EventSelectorDataStream.h:58

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

Retrieve stream dbName.

Definition at line 99 of file EventSelectorDataStream.h.

99 {
100 return m_dbName;
101 }
EventSelectorDataStream::m_dbName
std::string m_dbName
String with name of the db as parsed.
Definition: EventSelectorDataStream.h:60

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

Retrieve definition string.

Definition at line 107 of file EventSelectorDataStream.h.

107 {
108 return m_definition;
109 }
EventSelectorDataStream::m_definition
std::string m_definition
Definition string.
Definition: EventSelectorDataStream.h:56

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

Finalize stream and release resources.

Definition at line 193 of file EventSelectorDataStream.cpp.

193 {
194 setSelector(nullptr);
195 m_properties.clear();
196 m_initialized = false;
197 return StatusCode::SUCCESS;
198 }
EventSelectorDataStream::m_initialized
bool m_initialized
Initialization state.
Definition: EventSelectorDataStream.h:70
StatusCode::SUCCESS
Definition: StatusCode.h:30
std::vector::clear
T clear(T...args)
EventSelectorDataStream::m_properties
Properties m_properties
Properties vector.
Definition: EventSelectorDataStream.h:68
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.

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

115 {
116 return m_initialized;
117 }
EventSelectorDataStream::m_initialized
bool m_initialized
Initialization state.
Definition: EventSelectorDataStream.h:70

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

Retrieve stream name.

Definition at line 91 of file EventSelectorDataStream.h.

91 {
92 return m_name;
93 }
EventSelectorDataStream::m_name
std::string m_name
Name.
Definition: EventSelectorDataStream.h:54

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

Access properties.

Definition at line 87 of file EventSelectorDataStream.h.

87 {
88 return m_properties;
89 }
EventSelectorDataStream::m_properties
Properties m_properties
Properties vector.
Definition: EventSelectorDataStream.h:68

StringProperty * EventSelectorDataStream::property | ( | const std::string & | nam | ) |

Allow access to individual properties by name.

Definition at line 48 of file EventSelectorDataStream.cpp.

48 {
49 auto i = std::find_if( std::begin(m_properties), std::end(m_properties),
50 [&](const StringProperty& j ) { return j.name() == nam ; } );
51 return i!=std::end(m_properties) ? &(*i) : nullptr;
52 }
Property::name
const std::string & name() const
property name
Definition: Property.h:45
std::end
T end(T...args)
SimpleProperty< std::string >
std::find_if
T find_if(T...args)
EventSelectorDataStream::m_properties
Properties m_properties
Properties vector.
Definition: EventSelectorDataStream.h:68
std::begin
T begin(T...args)
ana.i
list i
Definition: ana.py:128

const StringProperty * EventSelectorDataStream::property | ( | const std::string & | nam | ) | const

Allow access to individual properties by name (CONST)

Definition at line 55 of file EventSelectorDataStream.cpp.

55 {
56 auto i = std::find_if( std::begin(m_properties), std::end(m_properties),
57 [&](const StringProperty& j ) { return j.name() == nam ; } );
58 return i!=std::end(m_properties) ? &(*i) : nullptr;
59 }
Property::name
const std::string & name() const
property name
Definition: Property.h:45
std::end
T end(T...args)
SimpleProperty< std::string >
std::find_if
T find_if(T...args)
EventSelectorDataStream::m_properties
Properties m_properties
Properties vector.
Definition: EventSelectorDataStream.h:68
std::begin
T begin(T...args)
ana.i
list i
Definition: ana.py:128

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

Retrieve event selector object.

Definition at line 111 of file EventSelectorDataStream.h.

111 {
112 return m_pSelector.get();
113 }
EventSelectorDataStream::m_pSelector
SmartIF< IEvtSelector > m_pSelector
Pointer to valid selector.
Definition: EventSelectorDataStream.h:64
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76

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

Retrieve event selector type.

Definition at line 103 of file EventSelectorDataStream.h.

103 {
104 return m_selectorType;
105 }
EventSelectorDataStream::m_selectorType
std::string m_selectorType
Event selector type.
Definition: EventSelectorDataStream.h:62

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

Attach event selector object.

Definition at line 43 of file EventSelectorDataStream.cpp.

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

## Friends And Related Function Documentation

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

Output friend for MsgStream.

Definition at line 27 of file EventSelectorDataStream.cpp.

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

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

Output friend for standard I/O.

Definition at line 32 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:91
EventSelectorDataStream::definition
const std::string & definition() const
Retrieve definition string.
Definition: EventSelectorDataStream.h:107

## Member Data Documentation

std::string EventSelectorDataStream::m_criteria
| protected

Criteria.

Definition at line 58 of file EventSelectorDataStream.h.

std::string EventSelectorDataStream::m_dbName
| protected

String with name of the db as parsed.

Definition at line 60 of file EventSelectorDataStream.h.

std::string EventSelectorDataStream::m_definition
| protected

Definition string.

Definition at line 56 of file EventSelectorDataStream.h.

bool EventSelectorDataStream::m_initialized = false
| protected

Initialization state.

Definition at line 70 of file EventSelectorDataStream.h.

std::string EventSelectorDataStream::m_name
| protected

Name.

Definition at line 54 of file EventSelectorDataStream.h.

Properties EventSelectorDataStream::m_properties
| protected

Properties vector.

Definition at line 68 of file EventSelectorDataStream.h.

SmartIF<IEvtSelector> EventSelectorDataStream::m_pSelector
| protected

Pointer to valid selector.

Definition at line 64 of file EventSelectorDataStream.h.

ISvcLocator* EventSelectorDataStream::m_pSvcLocator
| protected

Reference to service locator.

Definition at line 66 of file EventSelectorDataStream.h.

std::string EventSelectorDataStream::m_selectorType
| protected

Event selector type.

Definition at line 62 of file EventSelectorDataStream.h.

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

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