| The Gaudi Framework v32r1 (f65d50dc)

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...
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...

## 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

## ◆ Properties

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

Definition at line 52 of file EventSelectorDataStream.h.

## Constructor & Destructor Documentation

## ◆ ~EventSelectorDataStream()

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

Standard Destructor.

## ◆ EventSelectorDataStream()

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

Standard Constructor.

Definition at line 35 of file EventSelectorDataStream.cpp.

36 : m_name{std::move( nam )}, m_definition{std::move( def )}, m_pSvcLocator( svcloc ) {}
EventSelectorDataStream::m_pSvcLocator
ISvcLocator * m_pSvcLocator
Reference to service locator.
Definition: EventSelectorDataStream.h:68
std::move
T move(T... args)
EventSelectorDataStream::m_definition
std::string m_definition
Definition string.
Definition: EventSelectorDataStream.h:58
EventSelectorDataStream::m_name
std::string m_name
Name.
Definition: EventSelectorDataStream.h:56

## Member Function Documentation

## ◆ criteria()

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

Retrieve stream criteria.

Definition at line 94 of file EventSelectorDataStream.h.

94 { return m_criteria; }
EventSelectorDataStream::m_criteria
std::string m_criteria
Criteria.
Definition: EventSelectorDataStream.h:60

## ◆ dbName()

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

Retrieve stream dbName.

Definition at line 96 of file EventSelectorDataStream.h.

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

## ◆ definition()

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

Retrieve definition string.

Definition at line 100 of file EventSelectorDataStream.h.

100 { return m_definition; }
EventSelectorDataStream::m_definition
std::string m_definition
Definition string.
Definition: EventSelectorDataStream.h:58

## ◆ finalize()

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

Finalize stream and release resources.

Definition at line 179 of file EventSelectorDataStream.cpp.

179 {
180 setSelector( nullptr );
181 m_properties.clear();
182 m_initialized = false;
183 return StatusCode::SUCCESS;
184 }
EventSelectorDataStream::m_initialized
bool m_initialized
Initialization state.
Definition: EventSelectorDataStream.h:72
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
std::vector::clear
T clear(T... args)
EventSelectorDataStream::m_properties
Properties m_properties
Properties vector.
Definition: EventSelectorDataStream.h:70
EventSelectorDataStream::setSelector
virtual void setSelector(IEvtSelector *pSelector)
Attach event selector object.
Definition: EventSelectorDataStream.cpp:39

## ◆ initialize()

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

Parse input criteria.

Definition at line 56 of file EventSelectorDataStream.cpp.

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

## ◆ isInitialized()

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

Check initialization status.

Definition at line 104 of file EventSelectorDataStream.h.

104 { return m_initialized; }
EventSelectorDataStream::m_initialized
bool m_initialized
Initialization state.
Definition: EventSelectorDataStream.h:72

## ◆ name()

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

Retrieve stream name.

Definition at line 92 of file EventSelectorDataStream.h.

92 { return m_name; }
EventSelectorDataStream::m_name
std::string m_name
Name.
Definition: EventSelectorDataStream.h:56

## ◆ properties()

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

Access properties.

Definition at line 90 of file EventSelectorDataStream.h.

90 { return m_properties; }
EventSelectorDataStream::m_properties
Properties m_properties
Properties vector.
Definition: EventSelectorDataStream.h:70

## ◆ property() [1/2]

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

Allow access to individual properties by name.

Definition at line 42 of file EventSelectorDataStream.cpp.

42 {
43 auto i = std::find_if( std::begin( m_properties ), std::end( m_properties ),
44 [&]( const Gaudi::Property<std::string>& j ) { return j.name() == nam; } );
45 return i != std::end( m_properties ) ? &( *i ) : nullptr;
46 }
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:352
std::end
T end(T... args)
Gaudi::Details::PropertyBase::name
const std::string name() const
property name
Definition: Property.h:36
std::find_if
T find_if(T... args)
EventSelectorDataStream::m_properties
Properties m_properties
Properties vector.
Definition: EventSelectorDataStream.h:70
std::begin
T begin(T... args)

## ◆ property() [2/2]

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

Allow access to individual properties by name (CONST)

Definition at line 49 of file EventSelectorDataStream.cpp.

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

## ◆ selector()

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

Retrieve event selector object.

Definition at line 102 of file EventSelectorDataStream.h.

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

## ◆ selectorType()

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

Retrieve event selector type.

Definition at line 98 of file EventSelectorDataStream.h.

98 { return m_selectorType; }
EventSelectorDataStream::m_selectorType
std::string m_selectorType
Event selector type.
Definition: EventSelectorDataStream.h:64

## ◆ setSelector()

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

Attach event selector object.

Definition at line 39 of file EventSelectorDataStream.cpp.

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

## Friends And Related Function Documentation

## ◆ operator<< [1/2]

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

Output friend for MsgStream.

Definition at line 25 of file EventSelectorDataStream.cpp.

25 {
26 return s << "Stream:" << obj.name() << " Def:" << obj.definition();
27 }
EventSelectorDataStream::name
const std::string & name() const
Retrieve stream name.
Definition: EventSelectorDataStream.h:92
EventSelectorDataStream::definition
const std::string & definition() const
Retrieve definition string.
Definition: EventSelectorDataStream.h:100
gaudirun.s
string s
Definition: gaudirun.py:316

## ◆ operator<< [2/2]

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

Output friend for standard I/O.

Definition at line 30 of file EventSelectorDataStream.cpp.

30 {
31 return s << "Stream:" << obj.name() << " Def:" << obj.definition();
32 }
EventSelectorDataStream::name
const std::string & name() const
Retrieve stream name.
Definition: EventSelectorDataStream.h:92
EventSelectorDataStream::definition
const std::string & definition() const
Retrieve definition string.
Definition: EventSelectorDataStream.h:100
gaudirun.s
string s
Definition: gaudirun.py:316

## Member Data Documentation

## ◆ m_criteria

std::string EventSelectorDataStream::m_criteria
| protected

Criteria.

Definition at line 60 of file EventSelectorDataStream.h.

## ◆ m_dbName

std::string EventSelectorDataStream::m_dbName
| protected

String with name of the db as parsed.

Definition at line 62 of file EventSelectorDataStream.h.

## ◆ m_definition

std::string EventSelectorDataStream::m_definition
| protected

Definition string.

Definition at line 58 of file EventSelectorDataStream.h.

## ◆ m_initialized

bool EventSelectorDataStream::m_initialized = false
| protected

Initialization state.

Definition at line 72 of file EventSelectorDataStream.h.

## ◆ m_name

std::string EventSelectorDataStream::m_name
| protected

Name.

Definition at line 56 of file EventSelectorDataStream.h.

## ◆ m_properties

Properties EventSelectorDataStream::m_properties
| protected

Properties vector.

Definition at line 70 of file EventSelectorDataStream.h.

## ◆ m_pSelector

SmartIF<IEvtSelector> EventSelectorDataStream::m_pSelector
| protected

Pointer to valid selector.

Definition at line 66 of file EventSelectorDataStream.h.

## ◆ m_pSvcLocator

ISvcLocator* EventSelectorDataStream::m_pSvcLocator
| protected

Reference to service locator.

Definition at line 68 of file EventSelectorDataStream.h.

## ◆ m_selectorType

std::string EventSelectorDataStream::m_selectorType
| protected

Event selector type.

Definition at line 64 of file EventSelectorDataStream.h.

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

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