| # Gaudi Framework, version v21r10p1 |

Home |  | Generated: 29 Jul 2010

# EventSelectorDataStream Class Reference

Definition of class EventSelectorDataStream. More...

`#include <EventSelectorDataStream.h>`

Inheritance diagram for EventSelectorDataStream:

[legend]
Collaboration diagram for EventSelectorDataStream:

[legend]

List of all members.

## Public Types
typedef std::vector < StringProperty > | Properties
## Public Member Functions
| EventSelectorDataStream (const std::string &nam, const std::string &def, ISvcLocator *svcloc)
| Standard Constructor.
virtual void | setSelector (IEvtSelector *pSelector)
| Attach event selector object.
virtual StatusCode | initialize ()
| Parse input criteria.
virtual StatusCode | finalize ()
| Finalize stream and release resources.
StringProperty * | property (const std::string &nam)
| Allow access to individual properties by name.
const StringProperty * | property (const std::string &nam) const
| Allow access to individual properties by name (CONST).
const Properties & | properties ()
| Access properties.
const std::string & | name () const
| Retrieve stream name.
const std::string & | criteria () const
| Retrieve stream criteria.
const std::string & | dbName () const
| Retrieve stream dbName.
const std::string & | selectorType () const
| Retrieve event selector type.
const std::string & | definition () const
| Retrieve definition string.
IEvtSelector * | selector () const
| Retrieve event selector object.
bool | isInitialized () const
| Check initialization status.
## Protected Member Functions
virtual | ~EventSelectorDataStream ()
| Standard Destructor.
## Protected Attributes
std::string | m_name
| Name.
std::string | m_definition
| Definition string.
std::string | m_criteria
| Criteria.
std::string | m_dbName
| String with name of the db as parsed.
std::string | m_selectorType
| Event selector type.
IEvtSelector * | m_pSelector
| Pointer to valid selector.
ISvcLocator * | m_pSvcLocator
| Reference to service locator.
Properties * | m_properties
| Properties vector.
bool | m_initialized
| Initialization state.
## Friends
MsgStream & | operator<< (MsgStream &s, const EventSelectorDataStream &obj)
| Output friend for MsgStream.
std::ostream & | operator<< (std::ostream &s, const EventSelectorDataStream &obj)
| Output friend for standard I/O.

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

EventSelectorDataStream::~EventSelectorDataStream | ( |  | ) | `[protected, virtual]`

Standard Destructor.

Definition at line 50 of file EventSelectorDataStream.cpp.

    00050                                                     {
    00051   setSelector(0);
    00052   delete m_properties;
    00053 }

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

Standard Constructor.

Definition at line 39 of file EventSelectorDataStream.cpp.

    00040 : m_pSelector(0),
    00041   m_pSvcLocator(svcloc)
    00042 {
    00043   m_name = nam;
    00044   m_definition = def;
    00045   m_initialized = false;
    00046   m_properties = new Properties();
    00047 }

## Member Function Documentation

void EventSelectorDataStream::setSelector | ( | IEvtSelector * | pSelector | ) | `[virtual]`

Attach event selector object.

Definition at line 56 of file EventSelectorDataStream.cpp.

    00056                                                                    {
    00057   if ( 0 != pSelector   )  pSelector->addRef();
    00058   if ( 0 != m_pSelector )  m_pSelector->release();
    00059   m_pSelector = pSelector;
    00060 }

StatusCode EventSelectorDataStream::initialize | ( |  | ) | `[virtual]`

Parse input criteria.

Definition at line 83 of file EventSelectorDataStream.cpp.

    00083                                                  {
    00084   bool isData = true;
    00085   std::string auth, dbtyp, collsvc, item, crit, sel, svc, stmt;
    00086   std::string cnt    = "/Event";
    00087   std::string db     = "<Unknown>";
    00088   Tokenizer tok(true);
    00089
    00090   SmartIF<IDataManagerSvc> eds(m_pSvcLocator->service("EventDataSvc"));
    00091   if( !eds.isValid() ) {
    00092     std::cout << "ERROR: Unable to localize interface IDataManagerSvc from service EventDataSvc"
    00093               << std::endl;
    00094     return StatusCode::FAILURE;
    00095   }
    00096   else {
    00097     cnt = eds->rootName();
    00098   }
    00099   m_selectorType = m_criteria = m_dbName= "";
    00100   m_properties->erase(m_properties->begin(), m_properties->end());
    00101
    00102   tok.analyse(m_definition, " ", "", "", "=", "'", "'");
    00103   for ( Tokenizer::Items::iterator i = tok.items().begin(); i != tok.items().end(); i++ )   {
    00104     long hash = -1;
    00105     const std::string& tag = (*i).tag();
    00106     const std::string& val = (*i).value();
    00107     switch( ::toupper(tag[0]) )    {
    00108     case 'A':
    00109       auth = val;
    00110       break;
    00111     case 'C':
    00112       svc  = "EvtTupleSvc";
    00113       isData = false;
    00114     case 'E':
    00115       hash = val.find('#');
    00116       if ( hash > 0 )   {
    00117         cnt  = val.substr(0,hash);
    00118         item = val.substr(hash+1, val.length()-hash-1);
    00119       }
    00120       else    {
    00121         cnt  = val;
    00122         item = "Address";
    00123       }
    00124       break;
    00125     case 'D':
    00126       m_criteria     = "FILE " + val;
    00127       m_dbName=val;
    00128       break;
    00129     case 'F':
    00130       switch( ::toupper(tag[1]) )    {
    00131       case 'I':
    00132         m_criteria   = "FILE " + val;
    00133         m_dbName=val;
    00134         break;
    00135       case 'U':
    00136         stmt = val;
    00137         break;
    00138       default:
    00139         break;
    00140       }
    00141       break;
    00142     case 'J':
    00143       m_criteria     = "JOBID " + val;
    00144       m_dbName=val;
    00145       dbtyp          = "SICB";
    00146       break;
    00147     case 'T':
    00148       switch( ::toupper(tag[1]) )    {
    00149       case 'Y':
    00150         dbtyp = val;
    00151         break;
    00152       default:
    00153         break;
    00154       }
    00155       break;
    00156     case 'S':
    00157       switch( ::toupper(tag[1]) )    {
    00158       case 'E':
    00159         sel = val;
    00160         break;
    00161       case 'V':
    00162         svc = val;
    00163         collsvc = val;
    00164         break;
    00165       default:
    00166         break;
    00167       }
    00168       break;
    00169     default:
    00170       m_properties->push_back(StringProperty(tag,val));
    00171       break;
    00172     }
    00173   }
    00174   if ( !isData )    { // Unfortunately options do not come in order...
    00175     m_selectorType = "EventCollectionSelector";
    00176     svc  = "EvtTupleSvc";
    00177   }
    00178   else if ( dbtyp.substr(0,4) == "POOL" )    {
    00179     m_selectorType = "PoolDbEvtSelector";
    00180   }
    00181   else if ( svc.empty() ) {
    00182     m_selectorType = "DbEvtSelector";
    00183   }
    00184   else  {
    00185     m_selectorType = svc;
    00186   }
    00187   StatusCode status = StatusCode::SUCCESS;
    00188   if ( svc.length() == 0 && dbtyp.length() != 0 )    {
    00189     SmartIF<IPersistencySvc> ipers(m_pSvcLocator->service("EventPersistencySvc"));
    00190     if ( ipers.isValid() )   {
    00191       IConversionSvc* icnvSvc = 0;
    00192       status = ipers->getService(dbtyp, icnvSvc);
    00193       if ( status.isSuccess() )   {
    00194         IService* isvc = 0;
    00195         status = icnvSvc->queryInterface(IService::interfaceID(), pp_cast<void>(&isvc));
    00196         if ( status.isSuccess() )   {
    00197           svc = isvc->name();
    00198           isvc->release();
    00199         }
    00200       }
    00201     }
    00202   }
    00203   m_properties->push_back( StringProperty("Function",      stmt));
    00204   m_properties->push_back( StringProperty("CnvService",    svc));
    00205   m_properties->push_back( StringProperty("Authentication",auth));
    00206   m_properties->push_back( StringProperty("Container",     cnt));
    00207   m_properties->push_back( StringProperty("Item",          item));
    00208   m_properties->push_back( StringProperty("Criteria",      sel));
    00209   m_properties->push_back( StringProperty("DbType",        dbtyp));
    00210   m_properties->push_back( StringProperty("DB",            m_criteria));
    00211   if ( !isData && !collsvc.empty() )    {
    00212     m_properties->push_back( StringProperty("DbService",   collsvc));
    00213   }
    00214
    00215   m_initialized = status.isSuccess();
    00216   return status;
    00217 }

StatusCode EventSelectorDataStream::finalize | ( |  | ) | `[virtual]`

Finalize stream and release resources.

Definition at line 220 of file EventSelectorDataStream.cpp.

    00220                                                {
    00221   setSelector(0);
    00222   if ( m_properties )  {
    00223     m_properties->clear();
    00224   }
    00225   m_initialized = false;
    00226   return StatusCode::SUCCESS;
    00227 }

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

Allow access to individual properties by name.

Definition at line 63 of file EventSelectorDataStream.cpp.

    00063                                                                          {
    00064   for ( Properties::iterator i = m_properties->begin(); i != m_properties->end(); i++ )   {
    00065     if ( (*i).name() == nam )    {
    00066       return &(*i);
    00067     }
    00068   }
    00069   return 0;
    00070 }

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

Allow access to individual properties by name (CONST).

Definition at line 73 of file EventSelectorDataStream.cpp.

    00073                                                                                      {
    00074   for ( Properties::const_iterator i = m_properties->begin(); i != m_properties->end(); i++ )   {
    00075     if ( (*i).name() == nam )    {
    00076       return &(*i);
    00077     }
    00078   }
    00079   return 0;
    00080 }

const Properties& EventSelectorDataStream::properties | ( |  | ) | `[inline]`

Access properties.

Definition at line 87 of file EventSelectorDataStream.h.

    00087                                     {
    00088     return *m_properties;
    00089   }

const std::string& EventSelectorDataStream::name | ( |  | ) | const`[inline]`

Retrieve stream name.

Definition at line 91 of file EventSelectorDataStream.h.

    00091                                     {
    00092     return m_name;
    00093   }

const std::string& EventSelectorDataStream::criteria | ( |  | ) | const`[inline]`

Retrieve stream criteria.

Definition at line 95 of file EventSelectorDataStream.h.

    00095                                         {
    00096     return m_criteria;
    00097   }

const std::string& EventSelectorDataStream::dbName | ( |  | ) | const`[inline]`

Retrieve stream dbName.

Definition at line 99 of file EventSelectorDataStream.h.

    00099                                       {
    00100     return m_dbName;
    00101   }

const std::string& EventSelectorDataStream::selectorType | ( |  | ) | const`[inline]`

Retrieve event selector type.

Definition at line 103 of file EventSelectorDataStream.h.

    00103                                             {
    00104     return m_selectorType;
    00105   }

const std::string& EventSelectorDataStream::definition | ( |  | ) | const`[inline]`

Retrieve definition string.

Definition at line 107 of file EventSelectorDataStream.h.

    00107                                         {
    00108     return m_definition;
    00109   }

IEvtSelector* EventSelectorDataStream::selector | ( |  | ) | const`[inline]`

Retrieve event selector object.

Definition at line 111 of file EventSelectorDataStream.h.

    00111                                    {
    00112     return m_pSelector;
    00113   }

bool EventSelectorDataStream::isInitialized | ( |  | ) | const`[inline]`

Check initialization status.

Definition at line 115 of file EventSelectorDataStream.h.

    00115                                 {
    00116     return m_initialized;
    00117   }

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

    00027                                                                            {
    00028   s << "Stream:"   << obj.name() << " Def:" << obj.definition();
    00029   return s;
    00030 }

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

Output friend for standard I/O.

Definition at line 33 of file EventSelectorDataStream.cpp.

    00033                                                                              {
    00034   s << "Stream:"   << obj.name() << " Def:" << obj.definition();
    00035   return s;
    00036 }

## Member Data Documentation

std::string EventSelectorDataStream::m_name`[protected]`

Name.

Definition at line 54 of file EventSelectorDataStream.h.

std::string EventSelectorDataStream::m_definition`[protected]`

Definition string.

Definition at line 56 of file EventSelectorDataStream.h.

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_selectorType`[protected]`

Event selector type.

Definition at line 62 of file EventSelectorDataStream.h.

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.

Properties* EventSelectorDataStream::m_properties`[protected]`

Properties vector.

Definition at line 68 of file EventSelectorDataStream.h.

bool EventSelectorDataStream::m_initialized`[protected]`

Initialization state.

Definition at line 70 of file EventSelectorDataStream.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r10p1/GaudiKernel/GaudiKernel/EventSelectorDataStream.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r10p1/GaudiKernel/src/Lib/EventSelectorDataStream.cpp