ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
EventSelectorAthenaPool Class Reference

This class is the EventSelector for event data. More...

#include <EventSelectorAthenaPool.h>

Inheritance diagram for EventSelectorAthenaPool:
Collaboration diagram for EventSelectorAthenaPool:

Public Member Functions

 EventSelectorAthenaPool (const std::string &name, ISvcLocator *pSvcLocator)
 Standard Service Constructor. More...
 
virtual ~EventSelectorAthenaPool ()
 Destructor. More...
 
virtual StatusCode initialize () override
 Required of all Gaudi Services. More...
 
virtual StatusCode start () override
 
virtual StatusCode stop () override
 
virtual StatusCode finalize () override
 
virtual StatusCode createContext (IEvtSelector::Context *&ctxt) const override
 create context More...
 
virtual StatusCode next (IEvtSelector::Context &ctxt) const override
 
virtual StatusCode next (IEvtSelector::Context &ctxt, int jump) const override
 
virtual StatusCode previous (IEvtSelector::Context &ctxt) const override
 
virtual StatusCode previous (IEvtSelector::Context &ctxt, int jump) const override
 
virtual StatusCode last (IEvtSelector::Context &ctxt) const override
 
virtual StatusCode rewind (IEvtSelector::Context &ctxt) const override
 
virtual StatusCode createAddress (const IEvtSelector::Context &ctxt, IOpaqueAddress *&iop) const override
 
virtual StatusCode releaseContext (IEvtSelector::Context *&ctxt) const override
 
virtual StatusCode resetCriteria (const std::string &criteria, IEvtSelector::Context &ctxt) const override
 Set a selection criteria. More...
 
virtual StatusCode seek (Context &ctxt, int evtnum) const override
 Seek to a given event number. More...
 
virtual int curEvent (const Context &ctxt) const override
 Return the current event number. More...
 
virtual int size (Context &ctxt) const override
 Return the size of the collection. More...
 
virtual StatusCode makeServer (int num) override
 Make this a server. More...
 
virtual StatusCode makeClient (int num) override
 Make this a client. More...
 
virtual StatusCode share (int evtnum) override
 Request to share a given event number. More...
 
virtual StatusCode readEvent (int maxevt) override
 Read the next maxevt events. More...
 
virtual StatusCode io_reinit () override
 Callback method to reinitialize the internal state of the component for I/O purposes (e.g. upon fork(2)) More...
 
virtual StatusCode io_finalize () override
 Callback method to finalize the internal state of the component for I/O purposes (e.g. before fork(2)) More...
 
virtual void handle (const Incident &incident) override
 Incident service handle listening for BeginProcessing and EndProcessing. More...
 

Protected Member Functions

virtual StatusCode nextHandleFileTransition (IEvtSelector::Context &ctxt) const override
 Handle file transition at the next iteration. More...
 
virtual StatusCode nextWithSkip (IEvtSelector::Context &ctxt) const override
 Go to next event and skip if necessary. More...
 
virtual StatusCode recordAttributeList () const override
 Record AttributeList in StoreGate. More...
 
virtual StatusCode fillAttributeList (coral::AttributeList *attrList, const std::string &suffix, bool copySource) const override
 Fill AttributeList with specific items from the selector and a suffix. More...
 
virtual bool disconnectIfFinished (const SG::SourceID &fid) const override
 

Private Types

typedef std::mutex CallMutex
 

Private Member Functions

StoreGateSvceventStore () const
 Return pointer to active event SG. More...
 
StatusCode reinit () const
 Reinitialize the service when a fork() occured/was-issued. More...
 
PoolCollectionConvertergetCollectionCnv (bool throwIncidents=false) const
 Return pointer to new PoolCollectionConverter. More...
 
int findEvent (int evtNum) const
 Search for event with number evtNum. More...
 
void fireEndFileIncidents (bool isLastFile) const
 Fires the EndInputFile incident (if there is an open file) at end of selector. More...
 
void inputCollectionsHandler (Gaudi::Details::PropertyBase &)
 

Private Attributes

EventContextAthenaPoolm_endIter {}
 
PoolCollectionConverter *m_poolCollectionConverter ATLAS_THREAD_SAFE {}
 
pool::ICollectionCursor *m_headerIterator ATLAS_THREAD_SAFE {}
 
Guid m_guid ATLAS_THREAD_SAFE {}
 
std::map< SG::SourceID, int > m_activeEventsPerSource ATLAS_THREAD_SAFE
 
ServiceHandle< IAthenaPoolCnvSvcm_athenaPoolCnvSvc {this, "AthenaPoolCnvSvc", "AthenaPoolCnvSvc", ""}
 
ServiceHandle< IIncidentSvc > m_incidentSvc {this, "IncidentSvc", "IncidentSvc", ""}
 
Gaudi::Property< bool > m_isSecondary {this, "IsSecondary", false, ""}
 IsSecondary, know if this is an instance of secondary event selector. More...
 
Gaudi::Property< bool > m_processMetadata {this, "ProcessMetadata", true, ""}
 ProcessMetadata, switch on firing of FileIncidents which will trigger processing of metadata: default = true. More...
 
Gaudi::Property< std::string > m_collectionType {this, "CollectionType", "ImplicitROOT", ""}
 CollectionType, type of the collection: default = "ImplicitROOT". More...
 
Gaudi::Property< std::string > m_collectionTree {this, "CollectionTree", APRDefaults::TTreeNames::DataHeader, ""}
 CollectionTree, prefix of the collection TTree: default = "POOLContainer". More...
 
Gaudi::Property< std::string > m_connection {this, "Connection", "", ""}
 Connection, connection string. More...
 
Gaudi::Property< std::string > m_refName {this, "RefName", "", ""}
 RefName, attribute name. More...
 
Gaudi::Property< std::string > m_attrListKey {this, "AttributeListKey", "Input", ""}
 AttributeList SG key. More...
 
Gaudi::Property< std::vector< std::string > > m_inputCollectionsProp {this, "InputCollections", {}, ""}
 InputCollections, vector with names of the input collections. More...
 
std::vector< std::string >::const_iterator m_inputCollectionsIterator ATLAS_THREAD_SAFE
 
bool m_inputCollectionsChanged ATLAS_THREAD_SAFE
 flag to notify the EvSel that the inputs were changed and reinit() needs to be called ASAP More...
 
Gaudi::Property< std::string > m_query {this, "Query", "", ""}
 Query string passed to APR when opening DataHeader container (kind of useless). More...
 
Gaudi::Property< bool > m_keepInputFilesOpen {this, "KeepInputFilesOpen", false, ""}
 KeepInputFilesOpen, boolean flag to keep files open after PoolCollection reaches end: default = false. More...
 
ToolHandleArray< IAthenaSelectorTool > m_helperTools ATLAS_THREAD_SAFE {this}
 HelperTools, vector of names of AlgTools that are executed by the EventSelector. More...
 
ToolHandle< IAthenaSelectorToolm_counterTool {this, "CounterTool", "", ""}
 
ToolHandle< IAthenaIPCToolm_eventStreamingTool {this, "SharedMemoryTool", "", ""}
 
IntegerProperty m_makeStreamingToolClient {this,"MakeStreamingToolClient",0}
 Make this instance a Streaming Client during first iteration automatically. More...
 
Gaudi::CheckedProperty< int > m_runNo {this, "RunNumber", 0, ""}
 The following are included for compatibility with McEventSelector and are not really used. More...
 
Gaudi::CheckedProperty< int > m_oldRunNo {this, "OldRunNumber", 0, ""}
 
Gaudi::Property< bool > m_overrideRunNumber {this, "OverrideRunNumber", false, ""}
 
Gaudi::Property< bool > m_overrideRunNumberFromInput {this, "OverrideRunNumberFromInput", false, ""}
 
Gaudi::CheckedProperty< int > m_firstEventNo {this, "FirstEvent", 1, ""}
 
Gaudi::CheckedProperty< int > m_eventsPerRun {this, "EventsPerRun", 1000000, ""}
 
Gaudi::CheckedProperty< int > m_firstLBNo {this, "FirstLB", 0, ""}
 
Gaudi::CheckedProperty< int > m_eventsPerLB {this, "EventsPerLB", 1000, ""}
 
Gaudi::CheckedProperty< int > m_initTimeStamp {this, "InitialTimeStamp", 0, ""}
 
Gaudi::Property< int > m_timeStampInterval {this, "TimeStampInterval", 0, ""}
 
std::atomic_long m_curCollection {}
 
std::vector< int > m_numEvt ATLAS_THREAD_SAFE
 
std::vector< int > m_firstEvt ATLAS_THREAD_SAFE
 
Gaudi::Property< int > m_skipEvents {this, "SkipEvents", 0, ""}
 SkipEvents, numbers of events to skip: default = 0. More...
 
Gaudi::Property< std::vector< long > > m_skipEventSequenceProp {this, "SkipEventSequence", {}, ""}
 
Gaudi::Property< std::string > m_skipEventRangesProp {this, "SkipEventRanges", {}, ""}
 Skip Events - comma separated list of event to skip, ranges with '-': <start> - <end> More...
 
std::vector< std::pair< long, long > > m_skipEventRanges ATLAS_THREAD_SAFE
 
std::atomic_int m_evtCount {}
 
std::atomic_bool m_firedIncident {}
 
CallMutex m_callLock
 
SG::SlotSpecificObj< SG::SourceIDm_sourceID
 

Friends

class DoubleEventSelectorAthenaPool
 make the DoubleEventSelectorAthenaPool a friend so it can access the internal EventSelectorAthenaPool methods and members More...
 

Detailed Description

This class is the EventSelector for event data.

Definition at line 47 of file EventSelectorAthenaPool.h.

Member Typedef Documentation

◆ CallMutex

typedef std::mutex EventSelectorAthenaPool::CallMutex
private

Definition at line 247 of file EventSelectorAthenaPool.h.

Constructor & Destructor Documentation

◆ EventSelectorAthenaPool()

EventSelectorAthenaPool::EventSelectorAthenaPool ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Standard Service Constructor.

Definition at line 58 of file EventSelectorAthenaPool.cxx.

58  :
59  base_class(name, pSvcLocator)
60 {
61  declareProperty("HelperTools", m_helperTools);
62 
63  // TODO: validate if those are even used
64  m_runNo.verifier().setLower(0);
65  m_oldRunNo.verifier().setLower(0);
66  m_eventsPerRun.verifier().setLower(0);
67  m_firstEventNo.verifier().setLower(1);
68  m_firstLBNo.verifier().setLower(0);
69  m_eventsPerLB.verifier().setLower(0);
70  m_initTimeStamp.verifier().setLower(0);
71 
73  m_inputCollectionsChanged = false;
74 }

◆ ~EventSelectorAthenaPool()

EventSelectorAthenaPool::~EventSelectorAthenaPool ( )
virtual

Destructor.

Definition at line 82 of file EventSelectorAthenaPool.cxx.

82  {
83 }

Member Function Documentation

◆ createAddress()

StatusCode EventSelectorAthenaPool::createAddress ( const IEvtSelector::Context &  ctxt,
IOpaqueAddress *&  iop 
) const
overridevirtual
Parameters
ctxt[IN] current event context.
iop[OUT] pointer to IOpaqueAddress reference of selection context.

Definition at line 768 of file EventSelectorAthenaPool.cxx.

769  {
770  std::string tokenStr;
772  if (attrList.isValid()) {
773  try {
774  if (m_refName.value().empty()) {
775  tokenStr = (*attrList)["eventRef"].data<std::string>();
776  ATH_MSG_DEBUG("found AthenaAttribute, name = eventRef = " << tokenStr);
777  } else {
778  tokenStr = (*attrList)[m_refName.value() + "_ref"].data<std::string>();
779  ATH_MSG_DEBUG("found AthenaAttribute, name = " << m_refName.value() << "_ref = " << tokenStr);
780  }
781  } catch (std::exception &e) {
782  ATH_MSG_ERROR(e.what());
783  return(StatusCode::FAILURE);
784  }
785  } else {
786  ATH_MSG_WARNING("Cannot find AthenaAttribute, key = " << m_attrListKey.value());
787  tokenStr = m_poolCollectionConverter->retrieveToken(m_headerIterator, m_refName.value());
788  }
789  Token* token = new Token;
790  token->fromString(tokenStr);
791  iop = new TokenAddress(POOL_StorageType, ClassID_traits<DataHeader>::ID(), "", "EventSelector", IPoolSvc::kInputStream, token);
792  return(StatusCode::SUCCESS);
793 }

◆ createContext()

StatusCode EventSelectorAthenaPool::createContext ( IEvtSelector::Context *&  ctxt) const
overridevirtual

create context

Definition at line 468 of file EventSelectorAthenaPool.cxx.

468  {
469  ctxt = new EventContextAthenaPool(this);
470  return(StatusCode::SUCCESS);
471 }

◆ curEvent()

int EventSelectorAthenaPool::curEvent ( const Context &  ctxt) const
overridevirtual

Return the current event number.

Parameters
ctxt[IN/OUT] current event context.

Definition at line 872 of file EventSelectorAthenaPool.cxx.

872  {
873  return(m_evtCount);
874 }

◆ disconnectIfFinished()

bool EventSelectorAthenaPool::disconnectIfFinished ( const SG::SourceID fid) const
overrideprotectedvirtual

Definition at line 1228 of file EventSelectorAthenaPool.cxx.

1229 {
1230  if( m_eventStreamingTool.empty() && m_activeEventsPerSource.find(fid) != m_activeEventsPerSource.end()
1231  && m_activeEventsPerSource[fid] <= 0 && m_guid != fid ) {
1232  // Explicitly disconnect file corresponding to old FID to release memory
1233  if( !m_keepInputFilesOpen.value() ) {
1234  // Assume that the end of collection file indicates the end of payload file.
1235  if (m_processMetadata.value()) {
1236  FileIncident endInputFileIncident(name(), "EndInputFile", "FID:" + fid, fid);
1237  m_incidentSvc->fireIncident(endInputFileIncident);
1238  }
1239  ATH_MSG_INFO("Disconnecting input sourceID: " << fid );
1240  m_athenaPoolCnvSvc->getPoolSvc()->disconnectDb("FID:" + fid, IPoolSvc::kInputStream).ignore();
1241  m_activeEventsPerSource.erase( fid );
1242  return true;
1243  }
1244  }
1245  return false;
1246 }

◆ eventStore()

StoreGateSvc * EventSelectorAthenaPool::eventStore ( ) const
private

Return pointer to active event SG.

Definition at line 85 of file EventSelectorAthenaPool.cxx.

85  {
87 }

◆ fillAttributeList()

StatusCode EventSelectorAthenaPool::fillAttributeList ( coral::AttributeList *  attrList,
const std::string &  suffix,
bool  copySource 
) const
overrideprotectedvirtual

Fill AttributeList with specific items from the selector and a suffix.

Definition at line 1092 of file EventSelectorAthenaPool.cxx.

1093 {
1094  const pool::TokenList& tokenList = m_headerIterator->currentRow().tokenList();
1095  for (pool::TokenList::const_iterator iter = tokenList.begin(), last = tokenList.end(); iter != last; ++iter) {
1096  attrList->extend(iter.tokenName() + suffix, "string");
1097  (*attrList)[iter.tokenName() + suffix].data<std::string>() = iter->toString();
1098  ATH_MSG_DEBUG("record AthenaAttribute, name = " << iter.tokenName() + suffix << " = " << iter->toString() << ".");
1099  }
1100 
1101  std::string eventRef = "eventRef";
1102  if (m_isSecondary.value()) {
1103  eventRef.append(suffix);
1104  }
1105  attrList->extend(eventRef, "string");
1106  (*attrList)[eventRef].data<std::string>() = m_headerIterator->eventRef().toString();
1107  ATH_MSG_DEBUG("record AthenaAttribute, name = " + eventRef + " = " << m_headerIterator->eventRef().toString() << ".");
1108 
1109  if (copySource) {
1110  const coral::AttributeList& sourceAttrList = m_headerIterator->currentRow().attributeList();
1111  for (const auto &attr : sourceAttrList) {
1112  attrList->extend(attr.specification().name() + suffix, attr.specification().type());
1113  (*attrList)[attr.specification().name() + suffix] = attr;
1114  }
1115  }
1116 
1117  return StatusCode::SUCCESS;
1118 }

◆ finalize()

StatusCode EventSelectorAthenaPool::finalize ( )
overridevirtual

Definition at line 427 of file EventSelectorAthenaPool.cxx.

427  {
428  if (m_eventStreamingTool.empty() || !m_eventStreamingTool->isClient()) {
429  if (!m_counterTool.empty() && !m_counterTool->preFinalize().isSuccess()) {
430  ATH_MSG_WARNING("Failed to preFinalize() CounterTool");
431  }
432  for (auto& tool : m_helperTools) {
433  if (!tool->preFinalize().isSuccess()) {
434  ATH_MSG_WARNING("Failed to preFinalize() " << tool->name());
435  }
436  }
437  }
438  delete m_endIter; m_endIter = nullptr;
439  m_headerIterator = nullptr;
440  if (m_poolCollectionConverter != nullptr) {
441  delete m_poolCollectionConverter; m_poolCollectionConverter = nullptr;
442  }
443  // Release AthenaSharedMemoryTool
444  if (!m_eventStreamingTool.empty() && !m_eventStreamingTool.release().isSuccess()) {
445  ATH_MSG_WARNING("Cannot release AthenaSharedMemoryTool");
446  }
447  // Release CounterTool
448  if (!m_counterTool.empty() && !m_counterTool.release().isSuccess()) {
449  ATH_MSG_WARNING("Cannot release CounterTool.");
450  }
451  // Release HelperTools
452  if (!m_helperTools.release().isSuccess()) {
453  ATH_MSG_WARNING("Cannot release " << m_helperTools);
454  }
455  // Release AthenaPoolCnvSvc
456  if (!m_athenaPoolCnvSvc.release().isSuccess()) {
457  ATH_MSG_WARNING("Cannot release " << m_athenaPoolCnvSvc.typeAndName() << ".");
458  }
459  // Release IncidentSvc
460  if (!m_incidentSvc.release().isSuccess()) {
461  ATH_MSG_WARNING("Cannot release " << m_incidentSvc.typeAndName() << ".");
462  }
463  // Finalize the Service base class.
464  return(::AthService::finalize());
465 }

◆ findEvent()

int EventSelectorAthenaPool::findEvent ( int  evtNum) const
private

Search for event with number evtNum.

Definition at line 880 of file EventSelectorAthenaPool.cxx.

880  {
881  for (std::size_t i = 0, imax = m_numEvt.size(); i < imax; i++) {
882  if (m_numEvt[i] == -1) {
883  PoolCollectionConverter pcc(m_collectionType.value() + ":" + m_collectionTree.value(),
884  m_inputCollectionsProp.value()[i],
886  m_query.value(),
887  m_athenaPoolCnvSvc->getPoolSvc());
888  if (!pcc.initialize().isSuccess()) {
889  break;
890  }
891  int collection_size = 0;
892  if (pcc.isValid()) {
893  pool::ICollectionCursor* hi = &pcc.executeQuery();
894  ICollectionSize* cs = dynamic_cast<ICollectionSize*>(hi);
895  if (cs == nullptr) {
896  break;
897  }
898  collection_size = cs->size();
899  }
900  if (i > 0) {
901  m_firstEvt[i] = m_firstEvt[i - 1] + m_numEvt[i - 1];
902  } else {
903  m_firstEvt[i] = 0;
904  }
905  m_numEvt[i] = collection_size;
906  }
907  if (evtNum >= m_firstEvt[i] && evtNum < m_firstEvt[i] + m_numEvt[i]) {
908  return(i);
909  }
910  }
911  return(-1);
912 }

◆ fireEndFileIncidents()

void EventSelectorAthenaPool::fireEndFileIncidents ( bool  isLastFile) const
private

Fires the EndInputFile incident (if there is an open file) at end of selector.

Definition at line 410 of file EventSelectorAthenaPool.cxx.

410  {
411  if (m_processMetadata.value()) {
412  if (m_evtCount >= 0) {
413  // Assume that the end of collection file indicates the end of payload file.
414  if (m_guid != Guid::null()) {
415  // Fire EndInputFile incident
416  FileIncident endInputFileIncident(name(), "EndInputFile", "FID:" + m_guid.toString(), m_guid.toString());
417  m_incidentSvc->fireIncident(endInputFileIncident);
418  }
419  }
420  if (isLastFile && m_firedIncident) {
421  m_firedIncident = false;
422  }
423  }
424 }

◆ getCollectionCnv()

PoolCollectionConverter * EventSelectorAthenaPool::getCollectionCnv ( bool  throwIncidents = false) const
private

Return pointer to new PoolCollectionConverter.

Definition at line 1030 of file EventSelectorAthenaPool.cxx.

1030  {
1031  while (m_inputCollectionsIterator != m_inputCollectionsProp.value().end()) {
1032  if (m_curCollection != 0) {
1033  m_numEvt[m_curCollection] = m_evtCount - m_firstEvt[m_curCollection];
1034  m_curCollection++;
1035  m_firstEvt[m_curCollection] = m_evtCount;
1036  }
1037  ATH_MSG_DEBUG("Try item: \"" << *m_inputCollectionsIterator << "\" from the collection list.");
1038  PoolCollectionConverter* pCollCnv = new PoolCollectionConverter(m_collectionType.value() + ":" + m_collectionTree.value(),
1039  *m_inputCollectionsIterator,
1041  m_query.value(),
1042  m_athenaPoolCnvSvc->getPoolSvc());
1043  StatusCode status = pCollCnv->initialize();
1044  if (!status.isSuccess()) {
1045  // Close previous collection.
1046  delete pCollCnv; pCollCnv = nullptr;
1047  if (!status.isRecoverable()) {
1048  ATH_MSG_ERROR("Unable to initialize PoolCollectionConverter.");
1049  throw GaudiException("Unable to read: " + *m_inputCollectionsIterator, name(), StatusCode::FAILURE);
1050  } else {
1051  ATH_MSG_ERROR("Unable to open: " << *m_inputCollectionsIterator);
1052  throw GaudiException("Unable to open: " + *m_inputCollectionsIterator, name(), StatusCode::FAILURE);
1053  }
1054  } else {
1055  if (!pCollCnv->isValid().isSuccess()) {
1056  delete pCollCnv; pCollCnv = nullptr;
1057  ATH_MSG_DEBUG("No events found in: " << *m_inputCollectionsIterator << " skipped!!!");
1058  if (throwIncidents && m_processMetadata.value()) {
1059  FileIncident beginInputFileIncident(name(), "BeginInputFile", *m_inputCollectionsIterator);
1060  m_incidentSvc->fireIncident(beginInputFileIncident);
1061  FileIncident endInputFileIncident(name(), "EndInputFile", "eventless " + *m_inputCollectionsIterator);
1062  m_incidentSvc->fireIncident(endInputFileIncident);
1063  }
1064  m_athenaPoolCnvSvc->getPoolSvc()->disconnectDb(*m_inputCollectionsIterator).ignore();
1065  ++m_inputCollectionsIterator;
1066  } else {
1067  return(pCollCnv);
1068  }
1069  }
1070  }
1071  return(nullptr);
1072 }

◆ handle()

void EventSelectorAthenaPool::handle ( const Incident &  incident)
overridevirtual

Incident service handle listening for BeginProcessing and EndProcessing.

Reimplemented in DoubleEventSelectorAthenaPool.

Definition at line 1187 of file EventSelectorAthenaPool.cxx.

1188 {
1189  SG::SourceID fid;
1190  if (inc.type() == IncidentType::BeginProcessing) {
1191  if ( Atlas::hasExtendedEventContext(inc.context()) ) {
1192  fid = Atlas::getExtendedEventContext(inc.context()).proxy()->sourceID();
1193  }
1194  *m_sourceID.get(inc.context()) = fid;
1195  }
1196  else {
1197  fid = *m_sourceID.get(inc.context());
1198  }
1199 
1200  if( fid.empty() ) {
1201  ATH_MSG_WARNING("could not read event source ID from incident event context");
1202  return;
1203  }
1204  if( m_activeEventsPerSource.find( fid ) == m_activeEventsPerSource.end()) {
1205  ATH_MSG_DEBUG("Incident handler ignoring unknown input FID: " << fid );
1206  return;
1207  }
1208  ATH_MSG_DEBUG("** MN Incident handler " << inc.type() << " Event source ID=" << fid );
1209  if( inc.type() == IncidentType::BeginProcessing ) {
1210  // increment the events-per-file counter for FID
1211  m_activeEventsPerSource[fid]++;
1212  } else if( inc.type() == IncidentType::EndProcessing ) {
1213  m_activeEventsPerSource[fid]--;
1214  disconnectIfFinished( fid );
1215  *m_sourceID.get(inc.context()) = "";
1216  }
1217  if( msgLvl(MSG::DEBUG) ) {
1218  for( auto& source: m_activeEventsPerSource )
1219  msg(MSG::DEBUG) << "SourceID: " << source.first << " active events: " << source.second << endmsg;
1220  }
1221 }

◆ initialize()

StatusCode EventSelectorAthenaPool::initialize ( )
overridevirtual

Required of all Gaudi Services.

Reimplemented in DoubleEventSelectorAthenaPool.

Definition at line 89 of file EventSelectorAthenaPool.cxx.

89  {
90 
91  m_autoRetrieveTools = false;
92  m_checkToolDeps = false;
93 
94  if (m_isSecondary.value()) {
95  ATH_MSG_DEBUG("Initializing secondary event selector " << name());
96  } else {
97  ATH_MSG_DEBUG("Initializing " << name());
98  }
99 
100  if (!::AthService::initialize().isSuccess()) {
101  ATH_MSG_FATAL("Cannot initialize AthService base class.");
102  return(StatusCode::FAILURE);
103  }
104  // Check for input collection
105  if (m_inputCollectionsProp.value().empty()) {
106  ATH_MSG_FATAL("Use the property: EventSelector.InputCollections = "
107  << "[ \"<collectionName>\" ] (list of collections)");
108  return(StatusCode::FAILURE);
109  }
110  boost::char_separator<char> sep_coma(","), sep_hyph("-");
111  boost::tokenizer ranges(m_skipEventRangesProp.value(), sep_coma);
112  for( const std::string& r: ranges ) {
113  boost::tokenizer fromto(r, sep_hyph);
114  auto from_iter = fromto.begin();
115  std::stringstream strstr1( *from_iter );
116  long from, to;
117  strstr1 >> from;
118  if( ++from_iter != fromto.end() ) {
119  std::stringstream strstr2( *from_iter );
120  strstr2 >> to;
121  } else {
122  to = from;
123  }
124  m_skipEventRanges.push_back( std::pair(from,to) );
125  }
126 
127  for( auto v : m_skipEventSequenceProp.value() ) {
128  m_skipEventRanges.push_back( std::pair(v,v) );
129  }
130  std::sort(m_skipEventRanges.begin(), m_skipEventRanges.end());
131  if( msgLvl(MSG::DEBUG) ) {
132  std::stringstream skip_ranges_ss;
133  for( auto& r: m_skipEventRanges ) {
134  if( not skip_ranges_ss.str().empty() ) skip_ranges_ss << ", ";
135  skip_ranges_ss << r.first;
136  if( r.first != r.second) skip_ranges_ss << "-" << r.second;
137  }
138  if( not skip_ranges_ss.str().empty() )
139  ATH_MSG_DEBUG("Events to skip: " << skip_ranges_ss.str());
140  }
141  // CollectionType must be one of:
142  if (m_collectionType.value() != "ExplicitROOT" && m_collectionType.value() != "ImplicitROOT") {
143  ATH_MSG_FATAL("EventSelector.CollectionType must be one of: ExplicitROOT, ImplicitROOT (default)");
144  return(StatusCode::FAILURE);
145  }
146  // Get IncidentSvc
147  if (!m_incidentSvc.retrieve().isSuccess()) {
148  ATH_MSG_FATAL("Cannot get " << m_incidentSvc.typeAndName() << ".");
149  return(StatusCode::FAILURE);
150  }
151  // Listen to the Event Processing incidents
152  if (m_eventStreamingTool.empty()) {
153  m_incidentSvc->addListener(this, IncidentType::BeginProcessing, 0);
154  m_incidentSvc->addListener(this, IncidentType::EndProcessing, 0);
155  }
156 
157  // Get AthenaPoolCnvSvc
158  if (!m_athenaPoolCnvSvc.retrieve().isSuccess()) {
159  ATH_MSG_FATAL("Cannot get " << m_athenaPoolCnvSvc.typeAndName() << ".");
160  return(StatusCode::FAILURE);
161  }
162  // Get CounterTool (if configured)
163  if (!m_counterTool.empty() && !m_counterTool.retrieve().isSuccess()) {
164  ATH_MSG_FATAL("Cannot get CounterTool.");
165  return(StatusCode::FAILURE);
166  }
167  // Get HelperTools
168  if (!m_helperTools.retrieve().isSuccess()) {
169  ATH_MSG_FATAL("Cannot get " << m_helperTools);
170  return(StatusCode::FAILURE);
171  }
172  // Get SharedMemoryTool (if configured)
173  if (!m_eventStreamingTool.empty() && !m_eventStreamingTool.retrieve().isSuccess()) {
174  ATH_MSG_FATAL("Cannot get " << m_eventStreamingTool.typeAndName() << "");
175  return(StatusCode::FAILURE);
176  } else if (m_makeStreamingToolClient.value() == -1) {
177  std::string dummyStr;
178  if (!m_eventStreamingTool->makeClient(m_makeStreamingToolClient.value(), dummyStr).isSuccess()) {
179  ATH_MSG_ERROR("Could not make AthenaPoolCnvSvc a Share Client");
180  return(StatusCode::FAILURE);
181  }
182  }
183 
184  // Ensure the xAODCnvSvc is listed in the EventPersistencySvc
185  ServiceHandle<IProperty> epSvc("EventPersistencySvc", name());
186  std::vector<std::string> propVal;
187  if (!Gaudi::Parsers::parse(propVal , epSvc->getProperty("CnvServices").toString()).isSuccess()) {
188  ATH_MSG_FATAL("Cannot get EventPersistencySvc Property for CnvServices");
189  return(StatusCode::FAILURE);
190  }
191  bool foundCnvSvc = false;
192  for (const auto& property : propVal) {
193  if (property == m_athenaPoolCnvSvc.type()) { foundCnvSvc = true; }
194  }
195  if (!foundCnvSvc) {
196  propVal.push_back(m_athenaPoolCnvSvc.type());
197  if (!epSvc->setProperty("CnvServices", Gaudi::Utils::toString(propVal)).isSuccess()) {
198  ATH_MSG_FATAL("Cannot set EventPersistencySvc Property for CnvServices");
199  return(StatusCode::FAILURE);
200  }
201  }
202 
203  // Register this service for 'I/O' events
204  ServiceHandle<IIoComponentMgr> iomgr("IoComponentMgr", name());
205  if (!iomgr.retrieve().isSuccess()) {
206  ATH_MSG_FATAL("Could not retrieve IoComponentMgr !");
207  return(StatusCode::FAILURE);
208  }
209  if (!iomgr->io_register(this).isSuccess()) {
210  ATH_MSG_FATAL("Could not register myself with the IoComponentMgr !");
211  return(StatusCode::FAILURE);
212  }
213  // Register input file's names with the I/O manager
214  const std::vector<std::string>& incol = m_inputCollectionsProp.value();
215  bool allGood = true;
216  std::string fileName, fileType;
217  for (std::size_t icol = 0, imax = incol.size(); icol < imax; icol++) {
218  if (incol[icol].substr(0, 4) == "LFN:" || incol[icol].substr(0, 4) == "FID:") {
219  m_athenaPoolCnvSvc->getPoolSvc()->lookupBestPfn(incol[icol], fileName, fileType);
220  } else {
221  fileName = incol[icol];
222  }
223  if (fileName.substr(0, 4) == "PFN:") {
224  fileName = fileName.substr(4);
225  }
226  if (!iomgr->io_register(this, IIoComponentMgr::IoMode::READ, incol[icol], fileName).isSuccess()) {
227  ATH_MSG_FATAL("could not register [" << incol[icol] << "] for output !");
228  allGood = false;
229  } else {
230  ATH_MSG_VERBOSE("io_register[" << this->name() << "](" << incol[icol] << ") [ok]");
231  }
232  }
233  if (!allGood) {
234  return(StatusCode::FAILURE);
235  }
236 
237  // Connect to PersistencySvc
238  if (!m_athenaPoolCnvSvc->getPoolSvc()->connect(pool::ITransaction::READ, IPoolSvc::kInputStream).isSuccess()) {
239  ATH_MSG_FATAL("Cannot connect to POOL PersistencySvc.");
240  return(StatusCode::FAILURE);
241  }
242  // Jump to reinit() to execute common init/reinit actions
243  m_guid = Guid::null();
244  return reinit();
245 }

◆ inputCollectionsHandler()

void EventSelectorAthenaPool::inputCollectionsHandler ( Gaudi::Details::PropertyBase &  )
private

Definition at line 76 of file EventSelectorAthenaPool.cxx.

76  {
77  if (this->FSMState() != Gaudi::StateMachine::OFFLINE) {
78  m_inputCollectionsChanged = true;
79  }
80 }

◆ io_finalize()

StatusCode EventSelectorAthenaPool::io_finalize ( )
overridevirtual

Callback method to finalize the internal state of the component for I/O purposes (e.g. before fork(2))

Definition at line 1172 of file EventSelectorAthenaPool.cxx.

1172  {
1173  ATH_MSG_INFO("I/O finalization...");
1174  if (m_poolCollectionConverter != nullptr) {
1175  m_poolCollectionConverter->disconnectDb().ignore();
1176  delete m_poolCollectionConverter; m_poolCollectionConverter = nullptr;
1177  }
1178  return(StatusCode::SUCCESS);
1179 }

◆ io_reinit()

StatusCode EventSelectorAthenaPool::io_reinit ( )
overridevirtual

Callback method to reinitialize the internal state of the component for I/O purposes (e.g. upon fork(2))

Definition at line 1120 of file EventSelectorAthenaPool.cxx.

1120  {
1121  ATH_MSG_INFO("I/O reinitialization...");
1122  if (m_poolCollectionConverter != nullptr) {
1123  m_poolCollectionConverter->disconnectDb().ignore();
1124  delete m_poolCollectionConverter; m_poolCollectionConverter = nullptr;
1125  }
1126  m_headerIterator = nullptr;
1127  ServiceHandle<IIoComponentMgr> iomgr("IoComponentMgr", name());
1128  if (!iomgr.retrieve().isSuccess()) {
1129  ATH_MSG_FATAL("Could not retrieve IoComponentMgr !");
1130  return(StatusCode::FAILURE);
1131  }
1132  if (!iomgr->io_hasitem(this)) {
1133  ATH_MSG_FATAL("IoComponentMgr does not know about myself !");
1134  return(StatusCode::FAILURE);
1135  }
1136  if (!m_eventStreamingTool.empty() && m_eventStreamingTool->isClient()) {
1137  m_guid = Guid::null();
1138  return(this->reinit());
1139  }
1140  std::vector<std::string> inputCollections = m_inputCollectionsProp.value();
1141  std::set<std::size_t> updatedIndexes;
1142  for (std::size_t i = 0, imax = m_inputCollectionsProp.value().size(); i < imax; i++) {
1143  if (updatedIndexes.find(i) != updatedIndexes.end()) continue;
1144  std::string savedName = inputCollections[i];
1145  std::string &fname = inputCollections[i];
1146  if (!iomgr->io_contains(this, fname)) {
1147  ATH_MSG_ERROR("IoComponentMgr does not know about [" << fname << "] !");
1148  return(StatusCode::FAILURE);
1149  }
1150  if (!iomgr->io_retrieve(this, fname).isSuccess()) {
1151  ATH_MSG_FATAL("Could not retrieve new value for [" << fname << "] !");
1152  return(StatusCode::FAILURE);
1153  }
1154  if (savedName != fname) {
1155  ATH_MSG_DEBUG("Mapping value for [" << savedName << "] to [" << fname << "]");
1156  m_athenaPoolCnvSvc->getPoolSvc()->renamePfn(savedName, fname);
1157  }
1158  updatedIndexes.insert(i);
1159  for (std::size_t j = i + 1; j < imax; j++) {
1160  if (inputCollections[j] == savedName) {
1161  inputCollections[j] = fname;
1162  updatedIndexes.insert(j);
1163  }
1164  }
1165  }
1166  // all good... copy over.
1168  m_guid = Guid::null();
1169  return reinit();
1170 }

◆ last()

StatusCode EventSelectorAthenaPool::last ( IEvtSelector::Context &  ctxt) const
overridevirtual
Parameters
ctxt[IN/OUT] current event context is interated to last event.

Definition at line 754 of file EventSelectorAthenaPool.cxx.

754  {
755  if (ctxt.identifier() == m_endIter->identifier()) {
756  ATH_MSG_DEBUG("last(): Last event in InputStream.");
757  return(StatusCode::SUCCESS);
758  }
759  return(StatusCode::FAILURE);
760 }

◆ makeClient()

StatusCode EventSelectorAthenaPool::makeClient ( int  num)
overridevirtual

Make this a client.

Definition at line 935 of file EventSelectorAthenaPool.cxx.

935  {
936  if (m_athenaPoolCnvSvc->makeClient(num + 1).isFailure()) {
937  ATH_MSG_ERROR("Failed to switch AthenaPoolCnvSvc to DataStreaming client");
938  return(StatusCode::FAILURE);
939  }
940  if (m_eventStreamingTool.empty()) {
941  return(StatusCode::SUCCESS);
942  }
943  ATH_MSG_DEBUG("makeClient: " << m_eventStreamingTool << " = " << num);
944  std::string dummyStr;
945  return(m_eventStreamingTool->makeClient(0, dummyStr));
946 }

◆ makeServer()

StatusCode EventSelectorAthenaPool::makeServer ( int  num)
overridevirtual

Make this a server.

Definition at line 915 of file EventSelectorAthenaPool.cxx.

915  {
916  if (num < 0) {
917  if (m_athenaPoolCnvSvc->makeServer(num - 1).isFailure()) {
918  ATH_MSG_ERROR("Failed to switch AthenaPoolCnvSvc to output DataStreaming server");
919  }
920  return(StatusCode::SUCCESS);
921  }
922  if (m_athenaPoolCnvSvc->makeServer(num + 1).isFailure()) {
923  ATH_MSG_ERROR("Failed to switch AthenaPoolCnvSvc to input DataStreaming server");
924  return(StatusCode::FAILURE);
925  }
926  if (m_eventStreamingTool.empty()) {
927  return(StatusCode::SUCCESS);
928  }
929  m_processMetadata = false;
930  ATH_MSG_DEBUG("makeServer: " << m_eventStreamingTool << " = " << num);
931  return(m_eventStreamingTool->makeServer(1, ""));
932 }

◆ next() [1/2]

StatusCode EventSelectorAthenaPool::next ( IEvtSelector::Context &  ctxt) const
overridevirtual
Parameters
ctxt[IN/OUT] current event context is interated to next event.

Reimplemented in DoubleEventSelectorAthenaPool.

Definition at line 473 of file EventSelectorAthenaPool.cxx.

473  {
474  std::lock_guard<CallMutex> lockGuard(m_callLock);
475  if (!m_eventStreamingTool.empty() && m_eventStreamingTool->isClient()) {
476  if (m_makeStreamingToolClient.value() == -1) {
478  while (sc.isRecoverable()) {
479  usleep(1000);
480  sc = m_eventStreamingTool->lockEvent(m_evtCount);
481  }
482  }
483  // Increase event count
484  ++m_evtCount;
485  void* tokenStr = nullptr;
486  unsigned int status = 0;
487  StatusCode sc = m_eventStreamingTool->getLockedEvent(&tokenStr, status);
488  if (sc.isRecoverable()) {
489  delete [] (char*)tokenStr; tokenStr = nullptr;
490  // Return end iterator
491  ctxt = *m_endIter;
492  // This is not a real failure but a Gaudi way of handling "end of job"
493  return(StatusCode::FAILURE);
494  }
495  if (sc.isFailure()) {
496  ATH_MSG_FATAL("Cannot get NextEvent from AthenaSharedMemoryTool");
497  delete [] (char*)tokenStr; tokenStr = nullptr;
498  return(StatusCode::FAILURE);
499  }
500  if (!eventStore()->clearStore().isSuccess()) {
501  ATH_MSG_WARNING("Cannot clear Store");
502  }
503  std::unique_ptr<AthenaAttributeList> athAttrList(new AthenaAttributeList());
504  athAttrList->extend("eventRef", "string");
505  (*athAttrList)["eventRef"].data<std::string>() = std::string((char*)tokenStr);
507  if (!wh.record(std::move(athAttrList)).isSuccess()) {
508  delete [] (char*)tokenStr; tokenStr = nullptr;
509  ATH_MSG_ERROR("Cannot record AttributeList to StoreGate " << StoreID::storeName(eventStore()->storeID()));
510  return(StatusCode::FAILURE);
511  }
512  Token token;
513  token.fromString(std::string((char*)tokenStr));
514  delete [] (char*)tokenStr; tokenStr = nullptr;
515  Guid guid = token.dbID();
516  if (guid != m_guid && m_processMetadata.value()) {
517  if (m_evtCount >= 0 && m_guid != Guid::null()) {
518  // Fire EndInputFile incident
519  FileIncident endInputFileIncident(name(), "EndInputFile", "FID:" + m_guid.toString(), m_guid.toString());
520  m_incidentSvc->fireIncident(endInputFileIncident);
521  }
522  m_guid = guid;
523  FileIncident beginInputFileIncident(name(), "BeginInputFile", "FID:" + m_guid.toString(), m_guid.toString());
524  m_incidentSvc->fireIncident(beginInputFileIncident);
525  }
526  return(StatusCode::SUCCESS);
527  }
528  for (const auto& tool : m_helperTools) {
529  if (!tool->preNext().isSuccess()) {
530  ATH_MSG_WARNING("Failed to preNext() " << tool->name());
531  }
532  }
533  for (;;) {
534  // Handle possible file transition
536  if (sc.isRecoverable()) {
537  continue; // handles empty files
538  }
539  if (sc.isFailure()) {
540  return StatusCode::FAILURE;
541  }
542  // Increase event count
543  ++m_evtCount;
544  if (!m_counterTool.empty() && !m_counterTool->preNext().isSuccess()) {
545  ATH_MSG_WARNING("Failed to preNext() CounterTool.");
546  }
548  && (m_skipEventRanges.empty() || m_evtCount < m_skipEventRanges.front().first))
549  {
550  if (!m_eventStreamingTool.empty() && m_eventStreamingTool->isServer()) {
551  std::string token = m_headerIterator->eventRef().toString();
552  StatusCode sc;
553  while ( (sc = putEvent_ST(*m_eventStreamingTool,
554  m_evtCount - 1, token.c_str(),
555  token.length() + 1, 0)).isRecoverable() ) {
556  while (m_athenaPoolCnvSvc->readData().isSuccess()) {
557  ATH_MSG_VERBOSE("Called last readData, while putting next event in next()");
558  }
559  // Nothing to do right now, trigger alternative (e.g. caching) here? Currently just fast loop.
560  }
561  if (!sc.isSuccess()) {
562  ATH_MSG_ERROR("Cannot put Event " << m_evtCount - 1 << " to AthenaSharedMemoryTool");
563  return(StatusCode::FAILURE);
564  }
565  } else {
566  if (!m_isSecondary.value()) {
567  if (!eventStore()->clearStore().isSuccess()) {
568  ATH_MSG_WARNING("Cannot clear Store");
569  }
570  if (!recordAttributeList().isSuccess()) {
571  ATH_MSG_ERROR("Failed to record AttributeList.");
572  return(StatusCode::FAILURE);
573  }
574  }
575  }
576  StatusCode status = StatusCode::SUCCESS;
577  for (const auto& tool : m_helperTools) {
578  StatusCode toolStatus = tool->postNext();
579  if (toolStatus.isRecoverable()) {
580  ATH_MSG_INFO("Request skipping event from: " << tool->name());
581  if (status.isSuccess()) {
582  status = StatusCode::RECOVERABLE;
583  }
584  } else if (toolStatus.isFailure()) {
585  ATH_MSG_WARNING("Failed to postNext() " << tool->name());
586  status = StatusCode::FAILURE;
587  }
588  }
589  if (status.isRecoverable()) {
590  ATH_MSG_INFO("skipping event " << m_evtCount);
591  } else if (status.isFailure()) {
592  ATH_MSG_WARNING("Failed to postNext() HelperTool.");
593  } else {
594  if (!m_counterTool.empty() && !m_counterTool->postNext().isSuccess()) {
595  ATH_MSG_WARNING("Failed to postNext() CounterTool.");
596  }
597  break;
598  }
599  } else {
600  while( !m_skipEventRanges.empty() && m_evtCount >= m_skipEventRanges.front().second ) {
601  m_skipEventRanges.erase(m_skipEventRanges.begin());
602  }
603  ATH_MSG_INFO("skipping event " << m_evtCount);
604  }
605  }
606  return(StatusCode::SUCCESS);
607 }

◆ next() [2/2]

StatusCode EventSelectorAthenaPool::next ( IEvtSelector::Context &  ctxt,
int  jump 
) const
overridevirtual
Parameters
ctxt[IN/OUT] current event context is interated to next event.
jump[IN] number of events to jump (currently not supported).

Reimplemented in DoubleEventSelectorAthenaPool.

Definition at line 609 of file EventSelectorAthenaPool.cxx.

609  {
610  if (jump > 0) {
611  for (int i = 0; i < jump; i++) {
612  ATH_CHECK(next(ctxt));
613  }
614  return(StatusCode::SUCCESS);
615  }
616  return(StatusCode::FAILURE);
617 }

◆ nextHandleFileTransition()

StatusCode EventSelectorAthenaPool::nextHandleFileTransition ( IEvtSelector::Context &  ctxt) const
overrideprotectedvirtual

Handle file transition at the next iteration.

Definition at line 619 of file EventSelectorAthenaPool.cxx.

620 {
621  if( m_inputCollectionsChanged ) {
622  StatusCode rc = reinit();
623  if( rc != StatusCode::SUCCESS ) return rc;
624  }
625  else { // advance to the next (not needed after reinit)
626  // Check if we're at the end of file
627  if (m_headerIterator == nullptr || m_headerIterator->next() == 0) {
628  m_headerIterator = nullptr;
629  // Close previous collection.
630  delete m_poolCollectionConverter; m_poolCollectionConverter = nullptr;
631 
632  // zero the current DB ID (m_guid) before disconnect() to indicate it is no longer in use
633  const SG::SourceID old_guid = m_guid.toString();
634  m_guid = Guid::null();
635  disconnectIfFinished( old_guid );
636 
637  // check if somebody updated Inputs in the EOF incident (like VP1 does)
638  if( m_inputCollectionsChanged ) {
639  StatusCode rc = reinit();
640  if( rc != StatusCode::SUCCESS ) return rc;
641  } else {
642  // Open next file from inputCollections list.
643  ++m_inputCollectionsIterator;
644  // Create PoolCollectionConverter for input file
645  m_poolCollectionConverter = getCollectionCnv(true);
646  if (m_poolCollectionConverter == nullptr) {
647  // Return end iterator
648  ctxt = *m_endIter;
649  // This is not a real failure but a Gaudi way of handling "end of job"
650  return StatusCode::FAILURE;
651  }
652  // Get DataHeader iterator
653  m_headerIterator = &m_poolCollectionConverter->executeQuery();
654 
655  // Return RECOVERABLE to mark we should still continue
656  return StatusCode::RECOVERABLE;
657  }
658  }
659  }
660 
661  const Token& headRef = m_refName.value().empty()?
662  m_headerIterator->eventRef()
663  : m_headerIterator->currentRow().tokenList()[m_refName.value() + "_ref"];
664  const Guid guid = headRef.dbID();
665  const int tech = headRef.technology();
666  ATH_MSG_VERBOSE("next(): DataHeder Token=" << headRef.toString() );
667 
668  if (guid != m_guid) {
669  // we are starting reading from a new DB. Check if the old one needs to be retired
670  if (m_guid != Guid::null()) {
671  // zero the current DB ID (m_guid) before trying disconnect() to indicate it is no longer in use
672  const SG::SourceID old_guid = m_guid.toString();
673  m_guid = Guid::null();
674  disconnectIfFinished( old_guid );
675  }
676  m_guid = guid;
677  m_activeEventsPerSource[guid.toString()] = 0;
678  // Fire BeginInputFile incident if current InputCollection is a payload file;
679  // otherwise, ascertain whether the pointed-to file is reachable before firing any incidents and/or proceeding
680  if (m_collectionType.value() == "ImplicitROOT") {
681  // For now, we can only deal with input metadata from POOL files, but we know we have a POOL file here
682  if (!m_athenaPoolCnvSvc->setInputAttributes(*m_inputCollectionsIterator).isSuccess()) {
683  ATH_MSG_ERROR("Failed to set input attributes.");
684  return(StatusCode::FAILURE);
685  }
686  if (m_processMetadata.value()) {
687  FileIncident beginInputFileIncident(name(), "BeginInputFile", *m_inputCollectionsIterator, m_guid.toString());
688  m_incidentSvc->fireIncident(beginInputFileIncident);
689  }
690  } else {
691  // Check if File is BS
692  if (tech != 0x00001000 && m_processMetadata.value()) {
693  FileIncident beginInputFileIncident(name(), "BeginInputFile", "FID:" + m_guid.toString(), m_guid.toString());
694  m_incidentSvc->fireIncident(beginInputFileIncident);
695  }
696  }
697  } // end if (guid != m_guid)
698  return StatusCode::SUCCESS;
699 }

◆ nextWithSkip()

StatusCode EventSelectorAthenaPool::nextWithSkip ( IEvtSelector::Context &  ctxt) const
overrideprotectedvirtual

Go to next event and skip if necessary.

Definition at line 701 of file EventSelectorAthenaPool.cxx.

701  {
702  ATH_MSG_DEBUG("EventSelectorAthenaPool::nextWithSkip");
703 
704  for (;;) {
705  // Check if we're at the end of file
707  if (sc.isRecoverable()) {
708  continue; // handles empty files
709  }
710  if (sc.isFailure()) {
711  return StatusCode::FAILURE;
712  }
713 
714  // Increase event count
715  ++m_evtCount;
716 
717  if (!m_counterTool.empty() && !m_counterTool->preNext().isSuccess()) {
718  ATH_MSG_WARNING("Failed to preNext() CounterTool.");
719  }
721  && (m_skipEventRanges.empty() || m_evtCount < m_skipEventRanges.front().first))
722  {
723  return StatusCode::SUCCESS;
724  } else {
725  while( !m_skipEventRanges.empty() && m_evtCount >= m_skipEventRanges.front().second ) {
726  m_skipEventRanges.erase(m_skipEventRanges.begin());
727  }
728  if (m_isSecondary.value()) {
729  ATH_MSG_INFO("skipping secondary event " << m_evtCount);
730  } else {
731  ATH_MSG_INFO("skipping event " << m_evtCount);
732  }
733  }
734  }
735 
736  return StatusCode::SUCCESS;
737 }

◆ previous() [1/2]

StatusCode EventSelectorAthenaPool::previous ( IEvtSelector::Context &  ctxt) const
overridevirtual
Parameters
ctxt[IN/OUT] current event context is interated to previous event.

Definition at line 739 of file EventSelectorAthenaPool.cxx.

739  {
740  ATH_MSG_ERROR("previous() not implemented");
741  return(StatusCode::FAILURE);
742 }

◆ previous() [2/2]

StatusCode EventSelectorAthenaPool::previous ( IEvtSelector::Context &  ctxt,
int  jump 
) const
overridevirtual
Parameters
ctxt[IN/OUT] current event context is interated to previous event.
jump[IN] number of events to jump (currently not supported).

Definition at line 744 of file EventSelectorAthenaPool.cxx.

744  {
745  if (jump > 0) {
746  for (int i = 0; i < jump; i++) {
747  ATH_CHECK(previous(ctxt));
748  }
749  return(StatusCode::SUCCESS);
750  }
751  return(StatusCode::FAILURE);
752 }

◆ readEvent()

StatusCode EventSelectorAthenaPool::readEvent ( int  maxevt)
overridevirtual

Read the next maxevt events.

Parameters
evtnum[IN] The number of events to read.

Definition at line 977 of file EventSelectorAthenaPool.cxx.

977  {
978  if (m_eventStreamingTool.empty()) {
979  ATH_MSG_ERROR("No AthenaSharedMemoryTool configured for readEvent()");
980  return(StatusCode::FAILURE);
981  }
982  ATH_MSG_VERBOSE("Called read Event " << maxevt);
983  IEvtSelector::Context* ctxt = new EventContextAthenaPool(this);
984  for (int i = 0; i < maxevt || maxevt == -1; ++i) {
985  if (!next(*ctxt).isSuccess()) {
986  if (m_evtCount == -1) {
987  ATH_MSG_VERBOSE("Called read Event and read last event from input: " << i);
988  break;
989  }
990  ATH_MSG_ERROR("Cannot read Event " << m_evtCount - 1 << " into AthenaSharedMemoryTool");
991  delete ctxt; ctxt = nullptr;
992  return(StatusCode::FAILURE);
993  } else {
994  ATH_MSG_VERBOSE("Called next, read Event " << m_evtCount - 1);
995  }
996  }
997  delete ctxt; ctxt = nullptr;
998  // End of file, wait for last event to be taken
999  StatusCode sc;
1000  while ( (sc = putEvent_ST(*m_eventStreamingTool, 0, 0, 0, 0)).isRecoverable() ) {
1001  while (m_athenaPoolCnvSvc->readData().isSuccess()) {
1002  ATH_MSG_VERBOSE("Called last readData, while marking last event in readEvent()");
1003  }
1004  usleep(1000);
1005  }
1006  if (!sc.isSuccess()) {
1007  ATH_MSG_ERROR("Cannot put last Event marker to AthenaSharedMemoryTool");
1008  return(StatusCode::FAILURE);
1009  } else {
1010  sc = m_athenaPoolCnvSvc->readData();
1011  while (sc.isSuccess() || sc.isRecoverable()) {
1012  sc = m_athenaPoolCnvSvc->readData();
1013  }
1014  ATH_MSG_DEBUG("Failed last readData -> Clients are stopped, after marking last event in readEvent()");
1015  }
1016  return(StatusCode::SUCCESS);
1017 }

◆ recordAttributeList()

StatusCode EventSelectorAthenaPool::recordAttributeList ( ) const
overrideprotectedvirtual

Record AttributeList in StoreGate.

Reimplemented in DoubleEventSelectorAthenaPool.

Definition at line 1074 of file EventSelectorAthenaPool.cxx.

1074  {
1075  // Get access to AttributeList
1076  ATH_MSG_DEBUG("Get AttributeList from the collection");
1077  // MN: accessing only attribute list, ignoring token list
1078  const coral::AttributeList& attrList = m_headerIterator->currentRow().attributeList();
1079  ATH_MSG_DEBUG("AttributeList size " << attrList.size());
1080  std::unique_ptr<AthenaAttributeList> athAttrList(new AthenaAttributeList(attrList));
1081  // Fill the new attribute list
1082  ATH_CHECK(fillAttributeList(athAttrList.get(), "", false));
1083  // Write the AttributeList
1085  if (!wh.record(std::move(athAttrList)).isSuccess()) {
1086  ATH_MSG_ERROR("Cannot record AttributeList to StoreGate " << StoreID::storeName(eventStore()->storeID()));
1087  return(StatusCode::FAILURE);
1088  }
1089  return(StatusCode::SUCCESS);
1090 }

◆ reinit()

StatusCode EventSelectorAthenaPool::reinit ( ) const
private

Reinitialize the service when a fork() occured/was-issued.

Definition at line 247 of file EventSelectorAthenaPool.cxx.

247  {
248  ATH_MSG_DEBUG("reinitialization...");
249 
250  // reset markers
251  m_numEvt.resize(m_inputCollectionsProp.value().size(), -1);
252  for( auto& el : m_numEvt ) el = -1;
253  m_firstEvt.resize(m_inputCollectionsProp.value().size(), -1);
254  for( auto& el : m_firstEvt ) el = -1;
255 
256  // Initialize InputCollectionsIterator
257  m_inputCollectionsIterator = m_inputCollectionsProp.value().begin();
258  m_curCollection = 0;
259  if (!m_firstEvt.empty()) {
260  m_firstEvt[0] = 0;
261  }
262  m_inputCollectionsChanged = false;
263  m_evtCount = 0;
264  m_headerIterator = 0;
265  if (!m_eventStreamingTool.empty() && m_eventStreamingTool->isClient()) {
266  ATH_MSG_INFO("Done reinitialization for shared reader client");
267  return(StatusCode::SUCCESS);
268  }
269  bool retError = false;
270  for (auto& tool : m_helperTools) {
271  if (!tool->postInitialize().isSuccess()) {
272  ATH_MSG_FATAL("Failed to postInitialize() " << tool->name());
273  retError = true;
274  }
275  }
276  if (retError) {
277  ATH_MSG_FATAL("Failed to postInitialize() helperTools");
278  return(StatusCode::FAILURE);
279  }
280 
281  ATH_MSG_INFO("EventSelection with query " << m_query.value());
282  // Create an m_poolCollectionConverter to read the objects in
283  m_poolCollectionConverter = getCollectionCnv();
284  if (m_poolCollectionConverter == nullptr) {
285  ATH_MSG_INFO("No Events found in any Input Collections");
286  if (m_processMetadata.value()) {
287  m_inputCollectionsIterator = m_inputCollectionsProp.value().end();
288  if (!m_inputCollectionsProp.value().empty()) --m_inputCollectionsIterator;
289  //NOTE (wb may 2016): this will make the FirstInputFile incident correspond to last file in the collection ... if want it to be first file then move iterator to begin and then move above two lines below this incident firing
290  if (m_collectionType.value() == "ImplicitROOT" && !m_firedIncident && !m_inputCollectionsProp.value().empty()) {
291  FileIncident firstInputFileIncident(name(), "FirstInputFile", *m_inputCollectionsIterator);
292  m_incidentSvc->fireIncident(firstInputFileIncident);
293  m_firedIncident = true;
294  }
295  }
296  return(StatusCode::SUCCESS);
297  }
298  // Check for valid header name
299  if (!m_refName.value().empty()) {
300  if (m_collectionType.value() == "ExplicitROOT") {
301  ATH_MSG_INFO("Using collection ref name: " << m_refName.value());
302  } else {
303  ATH_MSG_INFO("Using implicit collection, ignore ref name: " << m_refName.value());
304  }
305  } else if (m_collectionType.value() == "ExplicitROOT") {
306  ATH_MSG_INFO("Using standard collection ref ");
307  }
308  // Get DataHeader iterator
309  try {
310  m_headerIterator = &m_poolCollectionConverter->executeQuery();
311  } catch (std::exception &e) {
312  ATH_MSG_FATAL("Cannot open implicit collection - check data/software version.");
313  ATH_MSG_ERROR(e.what());
314  return(StatusCode::FAILURE);
315  }
316  while (m_headerIterator == nullptr || m_headerIterator->next() == 0) { // no selected events
317  if (m_poolCollectionConverter != nullptr) {
318  m_poolCollectionConverter->disconnectDb().ignore();
319  delete m_poolCollectionConverter; m_poolCollectionConverter = nullptr;
320  }
321  ++m_inputCollectionsIterator;
322  m_poolCollectionConverter = getCollectionCnv();
323  if (m_poolCollectionConverter != nullptr) {
324  m_headerIterator = &m_poolCollectionConverter->executeQuery();
325  } else {
326  break;
327  }
328  }
329  if (m_poolCollectionConverter == nullptr || m_headerIterator == nullptr) { // no event selected in any collection
330  m_inputCollectionsIterator = m_inputCollectionsProp.value().begin();
331  m_curCollection = 0;
332  m_poolCollectionConverter = getCollectionCnv();
333  if (m_poolCollectionConverter == nullptr) {
334  return(StatusCode::SUCCESS);
335  }
336  m_headerIterator = &m_poolCollectionConverter->selectAll();
337  while (m_headerIterator == nullptr || m_headerIterator->next() == 0) { // empty collection
338  if (m_poolCollectionConverter != nullptr) {
339  m_poolCollectionConverter->disconnectDb().ignore();
340  delete m_poolCollectionConverter; m_poolCollectionConverter = nullptr;
341  }
342  ++m_inputCollectionsIterator;
343  m_poolCollectionConverter = getCollectionCnv();
344  if (m_poolCollectionConverter != nullptr) {
345  m_headerIterator = &m_poolCollectionConverter->selectAll();
346  } else {
347  break;
348  }
349  }
350  }
351  if (m_poolCollectionConverter == nullptr || m_headerIterator == nullptr) {
352  return(StatusCode::SUCCESS);
353  }
354  const Token& headRef = m_refName.value().empty()?
355  m_headerIterator->eventRef()
356  : m_headerIterator->currentRow().tokenList()[m_refName.value() + "_ref"];
357  const std::string fid = headRef.dbID().toString();
358  const int tech = headRef.technology();
359  ATH_MSG_VERBOSE("reinit(): First DataHeder Token=" << headRef.toString() );
360 
361  // Check if File is BS, for which Incident is thrown by SingleEventInputSvc
362  if (tech != 0x00001000 && m_processMetadata.value() && !m_firedIncident) {
363  FileIncident firstInputFileIncident(name(), "FirstInputFile", "FID:" + fid, fid);
364  m_incidentSvc->fireIncident(firstInputFileIncident);
365  m_firedIncident = true;
366  }
367  return(StatusCode::SUCCESS);
368 }

◆ releaseContext()

StatusCode EventSelectorAthenaPool::releaseContext ( IEvtSelector::Context *&  ctxt) const
overridevirtual
Parameters
ctxt[IN] current event context is released.

Definition at line 795 of file EventSelectorAthenaPool.cxx.

795  {
796  return(StatusCode::SUCCESS);
797 }

◆ resetCriteria()

StatusCode EventSelectorAthenaPool::resetCriteria ( const std::string &  criteria,
IEvtSelector::Context &  ctxt 
) const
overridevirtual

Set a selection criteria.

Parameters
criteriafilter predicate (SQL-style WHERE clause)
ctxt[IN] current event context.

Definition at line 799 of file EventSelectorAthenaPool.cxx.

800  {
801  return(StatusCode::SUCCESS);
802 }

◆ rewind()

StatusCode EventSelectorAthenaPool::rewind ( IEvtSelector::Context &  ctxt) const
overridevirtual
Parameters
ctxt[IN/OUT] current event context is rewound to first event.

Definition at line 762 of file EventSelectorAthenaPool.cxx.

762  {
763  ATH_CHECK(reinit());
764  ctxt = EventContextAthenaPool(this);
765  return(StatusCode::SUCCESS);
766 }

◆ seek()

StatusCode EventSelectorAthenaPool::seek ( Context &  ctxt,
int  evtnum 
) const
overridevirtual

Seek to a given event number.

Parameters
ctxt[IN/OUT] current event context.
evtnum[IN] The event number to which to seek.

Reimplemented in DoubleEventSelectorAthenaPool.

Definition at line 804 of file EventSelectorAthenaPool.cxx.

804  {
805 
806  if( m_inputCollectionsChanged ) {
807  StatusCode rc = reinit();
808  if( rc != StatusCode::SUCCESS ) return rc;
809  }
810 
811  long newColl = findEvent(evtNum);
812  if (newColl == -1 && evtNum >= m_firstEvt[m_curCollection] && evtNum < m_evtCount - 1) {
813  newColl = m_curCollection;
814  }
815  if (newColl == -1) {
816  m_headerIterator = nullptr;
817  ATH_MSG_INFO("seek: Reached end of Input.");
818  fireEndFileIncidents(true);
819  return(StatusCode::RECOVERABLE);
820  }
821  if (newColl != m_curCollection) {
822  if (!m_keepInputFilesOpen.value() && m_poolCollectionConverter != nullptr) {
823  m_poolCollectionConverter->disconnectDb().ignore();
824  }
825  delete m_poolCollectionConverter; m_poolCollectionConverter = nullptr;
826  m_curCollection = newColl;
827  try {
828  ATH_MSG_DEBUG("Seek to item: \""
830  << "\" from the collection list.");
831  // Reset input collection iterator to the right place
832  m_inputCollectionsIterator = m_inputCollectionsProp.value().begin();
833  m_inputCollectionsIterator += m_curCollection;
834  m_poolCollectionConverter = new PoolCollectionConverter(m_collectionType.value() + ":" + m_collectionTree.value(),
837  m_query.value(),
838  m_athenaPoolCnvSvc->getPoolSvc());
839  if (!m_poolCollectionConverter->initialize().isSuccess()) {
840  m_headerIterator = nullptr;
841  ATH_MSG_ERROR("seek: Unable to initialize PoolCollectionConverter.");
842  return(StatusCode::FAILURE);
843  }
844  // Create DataHeader iterators
845  m_headerIterator = &m_poolCollectionConverter->executeQuery();
846  EventContextAthenaPool* beginIter = new EventContextAthenaPool(this);
847  m_evtCount = m_firstEvt[m_curCollection];
848  next(*beginIter).ignore();
849  ATH_MSG_DEBUG("Token " << m_headerIterator->eventRef().toString());
850  } catch (std::exception &e) {
851  m_headerIterator = nullptr;
852  ATH_MSG_ERROR(e.what());
853  return(StatusCode::FAILURE);
854  }
855  }
856 
857  pool::IPositionSeek* is = dynamic_cast<pool::IPositionSeek*>(m_headerIterator);
858  if (is == nullptr) {
859  ATH_MSG_ERROR("Container does not allow seeking.");
860  return(StatusCode::FAILURE);
861  }
862  if (is->seek(evtNum - m_firstEvt[m_curCollection]) == 0) {
863  m_headerIterator = nullptr;
864  ATH_MSG_ERROR("Did not find event, evtNum = " << evtNum);
865  return(StatusCode::FAILURE);
866  } else {
867  m_evtCount = evtNum + 1;
868  }
869  return(StatusCode::SUCCESS);
870 }

◆ share()

StatusCode EventSelectorAthenaPool::share ( int  evtnum)
overridevirtual

Request to share a given event number.

Parameters
evtnum[IN] The event number to share.

Definition at line 949 of file EventSelectorAthenaPool.cxx.

949  {
950  if (!m_eventStreamingTool.empty() && m_eventStreamingTool->isClient()) {
951  StatusCode sc = m_eventStreamingTool->lockEvent(evtnum);
952  while (sc.isRecoverable()) {
953  usleep(1000);
954  sc = m_eventStreamingTool->lockEvent(evtnum);
955  }
956 // Send stop client and wait for restart
957  if (sc.isFailure()) {
958  if (m_athenaPoolCnvSvc->makeClient(0).isFailure()) {
959  return(StatusCode::FAILURE);
960  }
961  sc = m_eventStreamingTool->lockEvent(evtnum);
962  while (sc.isRecoverable() || sc.isFailure()) {
963  usleep(1000);
964  sc = m_eventStreamingTool->lockEvent(evtnum);
965  }
966 //FIXME
967  if (m_athenaPoolCnvSvc->makeClient(1).isFailure()) {
968  return(StatusCode::FAILURE);
969  }
970  }
971  return(sc);
972  }
973  return(StatusCode::FAILURE);
974 }

◆ size()

int EventSelectorAthenaPool::size ( Context &  ctxt) const
overridevirtual

Return the size of the collection.

Parameters
ctxt[IN/OUT] current event context.

Reimplemented in DoubleEventSelectorAthenaPool.

Definition at line 1020 of file EventSelectorAthenaPool.cxx.

1020  {
1021  // Fetch sizes of all collections.
1022  findEvent(-1);
1023  int sz = 0;
1024  for (std::size_t i = 0, imax = m_numEvt.size(); i < imax; i++) {
1025  sz += m_numEvt[i];
1026  }
1027  return(sz);
1028 }

◆ start()

StatusCode EventSelectorAthenaPool::start ( )
overridevirtual

Definition at line 370 of file EventSelectorAthenaPool.cxx.

370  {
371  if (m_poolCollectionConverter != nullptr) {
372  // Reset iterators and apply new query
373  m_poolCollectionConverter->disconnectDb().ignore();
374  delete m_poolCollectionConverter; m_poolCollectionConverter = nullptr;
375  }
376  m_inputCollectionsIterator = m_inputCollectionsProp.value().begin();
377  m_curCollection = 0;
378  if (!m_eventStreamingTool.empty() && m_eventStreamingTool->isClient()) {
379  return(StatusCode::SUCCESS);
380  }
381  m_poolCollectionConverter = getCollectionCnv(true);
382  if (m_poolCollectionConverter == nullptr) {
383  ATH_MSG_INFO("No Events found in any Input Collections");
384  m_inputCollectionsIterator = m_inputCollectionsProp.value().end();
385  if (!m_inputCollectionsProp.value().empty()) {
386  --m_inputCollectionsIterator; //leave iterator in state of last input file
387  }
388  } else {
389  m_headerIterator = &m_poolCollectionConverter->executeQuery(/*m_query.value()*/);
390  }
391  m_evtCount = 0;
392  delete m_endIter;
393  m_endIter = nullptr;
394  m_endIter = new EventContextAthenaPool(nullptr);
395  return(StatusCode::SUCCESS);
396 }

◆ stop()

StatusCode EventSelectorAthenaPool::stop ( )
overridevirtual

Definition at line 398 of file EventSelectorAthenaPool.cxx.

398  {
399  if (!m_eventStreamingTool.empty() && m_eventStreamingTool->isClient()) {
400  return(StatusCode::SUCCESS);
401  }
402  IEvtSelector::Context* ctxt(nullptr);
403  if (!releaseContext(ctxt).isSuccess()) {
404  ATH_MSG_WARNING("Cannot release context");
405  }
406  return(StatusCode::SUCCESS);
407 }

Friends And Related Function Documentation

◆ DoubleEventSelectorAthenaPool

friend class DoubleEventSelectorAthenaPool
friend

make the DoubleEventSelectorAthenaPool a friend so it can access the internal EventSelectorAthenaPool methods and members

Definition at line 254 of file EventSelectorAthenaPool.h.

Member Data Documentation

◆ ATLAS_THREAD_SAFE [1/10]

PoolCollectionConverter* m_poolCollectionConverter EventSelectorAthenaPool::ATLAS_THREAD_SAFE {}
mutableprivate

Definition at line 171 of file EventSelectorAthenaPool.h.

◆ ATLAS_THREAD_SAFE [2/10]

pool::ICollectionCursor* m_headerIterator EventSelectorAthenaPool::ATLAS_THREAD_SAFE {}
mutableprivate

Definition at line 172 of file EventSelectorAthenaPool.h.

◆ ATLAS_THREAD_SAFE [3/10]

Guid m_guid EventSelectorAthenaPool::ATLAS_THREAD_SAFE {}
mutableprivate

Definition at line 173 of file EventSelectorAthenaPool.h.

◆ ATLAS_THREAD_SAFE [4/10]

std::map<SG::SourceID, int> m_activeEventsPerSource EventSelectorAthenaPool::ATLAS_THREAD_SAFE
mutableprivate

Definition at line 174 of file EventSelectorAthenaPool.h.

◆ ATLAS_THREAD_SAFE [5/10]

std::vector<std::string>::const_iterator m_inputCollectionsIterator EventSelectorAthenaPool::ATLAS_THREAD_SAFE
mutableprivate

Definition at line 198 of file EventSelectorAthenaPool.h.

◆ ATLAS_THREAD_SAFE [6/10]

bool m_inputCollectionsChanged EventSelectorAthenaPool::ATLAS_THREAD_SAFE
mutableprivate

flag to notify the EvSel that the inputs were changed and reinit() needs to be called ASAP

Definition at line 201 of file EventSelectorAthenaPool.h.

◆ ATLAS_THREAD_SAFE [7/10]

ToolHandleArray<IAthenaSelectorTool> m_helperTools EventSelectorAthenaPool::ATLAS_THREAD_SAFE {this}
mutableprivate

HelperTools, vector of names of AlgTools that are executed by the EventSelector.

Definition at line 211 of file EventSelectorAthenaPool.h.

◆ ATLAS_THREAD_SAFE [8/10]

std::vector<int> m_numEvt EventSelectorAthenaPool::ATLAS_THREAD_SAFE
mutableprivate

Definition at line 234 of file EventSelectorAthenaPool.h.

◆ ATLAS_THREAD_SAFE [9/10]

std::vector<int> m_firstEvt EventSelectorAthenaPool::ATLAS_THREAD_SAFE
mutableprivate

Definition at line 235 of file EventSelectorAthenaPool.h.

◆ ATLAS_THREAD_SAFE [10/10]

std::vector<std::pair<long,long> > m_skipEventRanges EventSelectorAthenaPool::ATLAS_THREAD_SAFE
mutableprivate

Definition at line 242 of file EventSelectorAthenaPool.h.

◆ m_athenaPoolCnvSvc

ServiceHandle<IAthenaPoolCnvSvc> EventSelectorAthenaPool::m_athenaPoolCnvSvc {this, "AthenaPoolCnvSvc", "AthenaPoolCnvSvc", ""}
private

Definition at line 176 of file EventSelectorAthenaPool.h.

◆ m_attrListKey

Gaudi::Property<std::string> EventSelectorAthenaPool::m_attrListKey {this, "AttributeListKey", "Input", ""}
private

AttributeList SG key.

Definition at line 194 of file EventSelectorAthenaPool.h.

◆ m_callLock

CallMutex EventSelectorAthenaPool::m_callLock
mutableprivate

Definition at line 248 of file EventSelectorAthenaPool.h.

◆ m_collectionTree

Gaudi::Property<std::string> EventSelectorAthenaPool::m_collectionTree {this, "CollectionTree", APRDefaults::TTreeNames::DataHeader, ""}
private

CollectionTree, prefix of the collection TTree: default = "POOLContainer".

Definition at line 187 of file EventSelectorAthenaPool.h.

◆ m_collectionType

Gaudi::Property<std::string> EventSelectorAthenaPool::m_collectionType {this, "CollectionType", "ImplicitROOT", ""}
private

CollectionType, type of the collection: default = "ImplicitROOT".

Definition at line 185 of file EventSelectorAthenaPool.h.

◆ m_connection

Gaudi::Property<std::string> EventSelectorAthenaPool::m_connection {this, "Connection", "", ""}
private

Connection, connection string.

Definition at line 190 of file EventSelectorAthenaPool.h.

◆ m_counterTool

ToolHandle<IAthenaSelectorTool> EventSelectorAthenaPool::m_counterTool {this, "CounterTool", "", ""}
private

Definition at line 212 of file EventSelectorAthenaPool.h.

◆ m_curCollection

std::atomic_long EventSelectorAthenaPool::m_curCollection {}
mutableprivate

Definition at line 233 of file EventSelectorAthenaPool.h.

◆ m_endIter

EventContextAthenaPool* EventSelectorAthenaPool::m_endIter {}
private

Definition at line 168 of file EventSelectorAthenaPool.h.

◆ m_eventsPerLB

Gaudi::CheckedProperty<int> EventSelectorAthenaPool::m_eventsPerLB {this, "EventsPerLB", 1000, ""}
private

Definition at line 229 of file EventSelectorAthenaPool.h.

◆ m_eventsPerRun

Gaudi::CheckedProperty<int> EventSelectorAthenaPool::m_eventsPerRun {this, "EventsPerRun", 1000000, ""}
private

Definition at line 227 of file EventSelectorAthenaPool.h.

◆ m_eventStreamingTool

ToolHandle<IAthenaIPCTool> EventSelectorAthenaPool::m_eventStreamingTool {this, "SharedMemoryTool", "", ""}
private

Definition at line 213 of file EventSelectorAthenaPool.h.

◆ m_evtCount

std::atomic_int EventSelectorAthenaPool::m_evtCount {}
mutableprivate

Definition at line 244 of file EventSelectorAthenaPool.h.

◆ m_firedIncident

std::atomic_bool EventSelectorAthenaPool::m_firedIncident {}
mutableprivate

Definition at line 245 of file EventSelectorAthenaPool.h.

◆ m_firstEventNo

Gaudi::CheckedProperty<int> EventSelectorAthenaPool::m_firstEventNo {this, "FirstEvent", 1, ""}
private

Definition at line 225 of file EventSelectorAthenaPool.h.

◆ m_firstLBNo

Gaudi::CheckedProperty<int> EventSelectorAthenaPool::m_firstLBNo {this, "FirstLB", 0, ""}
private

Definition at line 228 of file EventSelectorAthenaPool.h.

◆ m_incidentSvc

ServiceHandle<IIncidentSvc> EventSelectorAthenaPool::m_incidentSvc {this, "IncidentSvc", "IncidentSvc", ""}
private

Definition at line 177 of file EventSelectorAthenaPool.h.

◆ m_initTimeStamp

Gaudi::CheckedProperty<int> EventSelectorAthenaPool::m_initTimeStamp {this, "InitialTimeStamp", 0, ""}
private

Definition at line 230 of file EventSelectorAthenaPool.h.

◆ m_inputCollectionsProp

Gaudi::Property<std::vector<std::string> > EventSelectorAthenaPool::m_inputCollectionsProp {this, "InputCollections", {}, ""}
private

InputCollections, vector with names of the input collections.

Definition at line 197 of file EventSelectorAthenaPool.h.

◆ m_isSecondary

Gaudi::Property<bool> EventSelectorAthenaPool::m_isSecondary {this, "IsSecondary", false, ""}
private

IsSecondary, know if this is an instance of secondary event selector.

Definition at line 181 of file EventSelectorAthenaPool.h.

◆ m_keepInputFilesOpen

Gaudi::Property<bool> EventSelectorAthenaPool::m_keepInputFilesOpen {this, "KeepInputFilesOpen", false, ""}
private

KeepInputFilesOpen, boolean flag to keep files open after PoolCollection reaches end: default = false.

Needed for PilUp to run without PoolFileCatalog. Relies on POOL to close files when reaching DB_AGE_LIMIT.

Definition at line 208 of file EventSelectorAthenaPool.h.

◆ m_makeStreamingToolClient

IntegerProperty EventSelectorAthenaPool::m_makeStreamingToolClient {this,"MakeStreamingToolClient",0}
private

Make this instance a Streaming Client during first iteration automatically.

Definition at line 215 of file EventSelectorAthenaPool.h.

◆ m_oldRunNo

Gaudi::CheckedProperty<int> EventSelectorAthenaPool::m_oldRunNo {this, "OldRunNumber", 0, ""}
private

Definition at line 221 of file EventSelectorAthenaPool.h.

◆ m_overrideRunNumber

Gaudi::Property<bool> EventSelectorAthenaPool::m_overrideRunNumber {this, "OverrideRunNumber", false, ""}
private

Definition at line 222 of file EventSelectorAthenaPool.h.

◆ m_overrideRunNumberFromInput

Gaudi::Property<bool> EventSelectorAthenaPool::m_overrideRunNumberFromInput {this, "OverrideRunNumberFromInput", false, ""}
private

Definition at line 223 of file EventSelectorAthenaPool.h.

◆ m_processMetadata

Gaudi::Property<bool> EventSelectorAthenaPool::m_processMetadata {this, "ProcessMetadata", true, ""}
private

ProcessMetadata, switch on firing of FileIncidents which will trigger processing of metadata: default = true.

Definition at line 183 of file EventSelectorAthenaPool.h.

◆ m_query

Gaudi::Property<std::string> EventSelectorAthenaPool::m_query {this, "Query", "", ""}
private

Query string passed to APR when opening DataHeader container (kind of useless).

Definition at line 204 of file EventSelectorAthenaPool.h.

◆ m_refName

Gaudi::Property<std::string> EventSelectorAthenaPool::m_refName {this, "RefName", "", ""}
private

RefName, attribute name.

Definition at line 192 of file EventSelectorAthenaPool.h.

◆ m_runNo

Gaudi::CheckedProperty<int> EventSelectorAthenaPool::m_runNo {this, "RunNumber", 0, ""}
private

The following are included for compatibility with McEventSelector and are not really used.

However runNo, oldRunNo and overrideRunNumberFromInput are used to reset run number for simulated events, needed to use condition

Definition at line 220 of file EventSelectorAthenaPool.h.

◆ m_skipEventRangesProp

Gaudi::Property<std::string> EventSelectorAthenaPool::m_skipEventRangesProp {this, "SkipEventRanges", {}, ""}
private

Skip Events - comma separated list of event to skip, ranges with '-': <start> - <end>

Definition at line 241 of file EventSelectorAthenaPool.h.

◆ m_skipEvents

Gaudi::Property<int> EventSelectorAthenaPool::m_skipEvents {this, "SkipEvents", 0, ""}
private

SkipEvents, numbers of events to skip: default = 0.

Definition at line 238 of file EventSelectorAthenaPool.h.

◆ m_skipEventSequenceProp

Gaudi::Property<std::vector<long> > EventSelectorAthenaPool::m_skipEventSequenceProp {this, "SkipEventSequence", {}, ""}
private

Definition at line 239 of file EventSelectorAthenaPool.h.

◆ m_sourceID

SG::SlotSpecificObj<SG::SourceID> EventSelectorAthenaPool::m_sourceID
private

Definition at line 250 of file EventSelectorAthenaPool.h.

◆ m_timeStampInterval

Gaudi::Property<int> EventSelectorAthenaPool::m_timeStampInterval {this, "TimeStampInterval", 0, ""}
private

Definition at line 231 of file EventSelectorAthenaPool.h.


The documentation for this class was generated from the following files:
EventSelectorAthenaPool::last
virtual StatusCode last(IEvtSelector::Context &ctxt) const override
Definition: EventSelectorAthenaPool.cxx:754
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
beamspotman.r
def r
Definition: beamspotman.py:676
trigbs_pickEvents.ranges
ranges
Definition: trigbs_pickEvents.py:60
ICollectionSize::size
virtual int size()=0
Return the size of the collection.
Guid::null
static const Guid & null()
NULL-Guid: static class method.
Definition: Guid.cxx:18
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:50
EventSelectorAthenaPool::fillAttributeList
virtual StatusCode fillAttributeList(coral::AttributeList *attrList, const std::string &suffix, bool copySource) const override
Fill AttributeList with specific items from the selector and a suffix.
Definition: EventSelectorAthenaPool.cxx:1092
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
EventSelectorAthenaPool::m_skipEvents
Gaudi::Property< int > m_skipEvents
SkipEvents, numbers of events to skip: default = 0.
Definition: EventSelectorAthenaPool.h:238
fitman.sz
sz
Definition: fitman.py:527
hotSpotInTAG.suffix
string suffix
Definition: hotSpotInTAG.py:186
EventSelectorAthenaPool::releaseContext
virtual StatusCode releaseContext(IEvtSelector::Context *&ctxt) const override
Definition: EventSelectorAthenaPool.cxx:795
Gaudi::Parsers::parse
StatusCode parse(std::tuple< Tup... > &tup, const Gaudi::Parsers::InputData &input)
Definition: CaloGPUClusterAndCellDataMonitorOptions.h:284
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
pool::IPositionSeek::seek
virtual bool seek(long long int position)=0
Seek to a given position in the collection.
EventSelectorAthenaPool::m_oldRunNo
Gaudi::CheckedProperty< int > m_oldRunNo
Definition: EventSelectorAthenaPool.h:221
EventSelectorAthenaPool::m_runNo
Gaudi::CheckedProperty< int > m_runNo
The following are included for compatibility with McEventSelector and are not really used.
Definition: EventSelectorAthenaPool.h:220
EventSelectorAthenaPool::reinit
StatusCode reinit() const
Reinitialize the service when a fork() occured/was-issued.
Definition: EventSelectorAthenaPool.cxx:247
PoolCollectionConverter
This class provides an interface to POOL collections.
Definition: PoolCollectionConverter.h:27
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
EventSelectorAthenaPool::previous
virtual StatusCode previous(IEvtSelector::Context &ctxt) const override
Definition: EventSelectorAthenaPool.cxx:739
EventSelectorAthenaPool::m_incidentSvc
ServiceHandle< IIncidentSvc > m_incidentSvc
Definition: EventSelectorAthenaPool.h:177
initialize
void initialize()
Definition: run_EoverP.cxx:894
Atlas::hasExtendedEventContext
bool hasExtendedEventContext(const EventContext &ctx)
Test whether a context object has an extended context installed.
Definition: ExtendedEventContext.cxx:23
EventSelectorAthenaPool::m_firstEventNo
Gaudi::CheckedProperty< int > m_firstEventNo
Definition: EventSelectorAthenaPool.h:225
EventSelectorAthenaPool::m_athenaPoolCnvSvc
ServiceHandle< IAthenaPoolCnvSvc > m_athenaPoolCnvSvc
Definition: EventSelectorAthenaPool.h:176
SG::SlotSpecificObj::get
T * get(const EventContext &ctx)
Return pointer to the object for slot given by ctx.
Token::dbID
const Guid & dbID() const
Access database identifier.
Definition: Token.h:62
EventSelectorAthenaPool::m_eventStreamingTool
ToolHandle< IAthenaIPCTool > m_eventStreamingTool
Definition: EventSelectorAthenaPool.h:213
EventSelectorAthenaPool::m_query
Gaudi::Property< std::string > m_query
Query string passed to APR when opening DataHeader container (kind of useless).
Definition: EventSelectorAthenaPool.h:204
EventSelectorAthenaPool::eventStore
StoreGateSvc * eventStore() const
Return pointer to active event SG.
Definition: EventSelectorAthenaPool.cxx:85
Guid::toString
const std::string toString() const
Automatic conversion to string representation.
Definition: Guid.cxx:58
pool::TokenList::end
iterator end()
Returns a forward iterator pointing to last element in Token list.
Definition: TokenList.h:224
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
EventSelectorAthenaPool::findEvent
int findEvent(int evtNum) const
Search for event with number evtNum.
Definition: EventSelectorAthenaPool.cxx:880
EventSelectorAthenaPool::m_callLock
CallMutex m_callLock
Definition: EventSelectorAthenaPool.h:248
EventContextAthenaPool
This class provides the context to access an event from POOL persistent store.
Definition: EventContextAthenaPool.h:21
PoolCollectionConverter::isValid
StatusCode isValid() const
Check whether has valid pool::ICollection*.
Definition: PoolCollectionConverter.cxx:123
atlasStyleMacro.icol
int icol
Definition: atlasStyleMacro.py:13
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
EventSelectorAthenaPool::m_refName
Gaudi::Property< std::string > m_refName
RefName, attribute name.
Definition: EventSelectorAthenaPool.h:192
Token
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition: Token.h:21
EventSelectorAthenaPool::m_counterTool
ToolHandle< IAthenaSelectorTool > m_counterTool
Definition: EventSelectorAthenaPool.h:212
TokenAddress
This class provides a Generic Transient Address for POOL tokens.
Definition: TokenAddress.h:21
Atlas::getExtendedEventContext
const ExtendedEventContext & getExtendedEventContext(const EventContext &ctx)
Retrieve an extended context from a context object.
Definition: ExtendedEventContext.cxx:32
pool::TokenList
Definition: TokenList.h:24
Token::fromString
Token & fromString(const std::string &from)
Build from the string representation of a token.
Definition: Token.cxx:133
IPoolSvc::kInputStream
@ kInputStream
Definition: IPoolSvc.h:39
EventContextAthenaPool::identifier
virtual void * identifier() const
Definition: EventContextAthenaPool.h:56
TileAANtupleConfig.inputCollections
inputCollections
Definition: TileAANtupleConfig.py:133
Token::technology
int technology() const
Access technology type.
Definition: Token.h:75
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
EventSelectorAthenaPool::m_firedIncident
std::atomic_bool m_firedIncident
Definition: EventSelectorAthenaPool.h:245
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EventSelectorAthenaPool::m_attrListKey
Gaudi::Property< std::string > m_attrListKey
AttributeList SG key.
Definition: EventSelectorAthenaPool.h:194
lumiFormat.i
int i
Definition: lumiFormat.py:85
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
EventSelectorAthenaPool::m_eventsPerLB
Gaudi::CheckedProperty< int > m_eventsPerLB
Definition: EventSelectorAthenaPool.h:229
L1CaloPhase1Monitoring.propVal
propVal
Definition: L1CaloPhase1Monitoring.py:451
EventSelectorAthenaPool::m_eventsPerRun
Gaudi::CheckedProperty< int > m_eventsPerRun
Definition: EventSelectorAthenaPool.h:227
EventSelectorAthenaPool::m_isSecondary
Gaudi::Property< bool > m_isSecondary
IsSecondary, know if this is an instance of secondary event selector.
Definition: EventSelectorAthenaPool.h:181
StoreGateSvc::currentStoreGate
static StoreGateSvc * currentStoreGate()
get current StoreGate
Definition: StoreGateSvc.cxx:69
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:40
calibdata.exception
exception
Definition: calibdata.py:496
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
parseDir.wh
wh
Definition: parseDir.py:46
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ICollectionSize
Abstract interface for finding the size of an event collection.
Definition: ICollectionSize.h:26
EventSelectorAthenaPool::fireEndFileIncidents
void fireEndFileIncidents(bool isLastFile) const
Fires the EndInputFile incident (if there is an open file) at end of selector.
Definition: EventSelectorAthenaPool.cxx:410
AthenaAttributeList
An AttributeList represents a logical row of attributes in a metadata table. The name and type of eac...
Definition: PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:45
EventSelectorAthenaPool::m_makeStreamingToolClient
IntegerProperty m_makeStreamingToolClient
Make this instance a Streaming Client during first iteration automatically.
Definition: EventSelectorAthenaPool.h:215
StoreGateSvc::clearStore
virtual StatusCode clearStore(bool forceRemove=false) override final
clear DataStore contents: called by the event loop mgrs
Definition: StoreGateSvc.cxx:450
EventSelectorAthenaPool::m_firstLBNo
Gaudi::CheckedProperty< int > m_firstLBNo
Definition: EventSelectorAthenaPool.h:228
imax
int imax(int i, int j)
Definition: TileLaserTimingTool.cxx:33
checkRpcDigits.allGood
bool allGood
Loop over the SDOs & Digits.
Definition: checkRpcDigits.py:171
EventSelectorAthenaPool::m_collectionTree
Gaudi::Property< std::string > m_collectionTree
CollectionTree, prefix of the collection TTree: default = "POOLContainer".
Definition: EventSelectorAthenaPool.h:187
EventSelectorAthenaPool::inputCollectionsHandler
void inputCollectionsHandler(Gaudi::Details::PropertyBase &)
Definition: EventSelectorAthenaPool.cxx:76
EventSelectorAthenaPool::m_skipEventRangesProp
Gaudi::Property< std::string > m_skipEventRangesProp
Skip Events - comma separated list of event to skip, ranges with '-': <start> - <end>
Definition: EventSelectorAthenaPool.h:241
pool::ICollectionCursor
Definition: ICollectionCursor.h:21
pool_uuid.guid
guid
Definition: pool_uuid.py:112
trigbs_pickEvents.num
num
Definition: trigbs_pickEvents.py:76
pool::TokenList::const_iterator
Constant forward iterator class for navigation of TokenList objects.
Definition: TokenList.h:164
EventSelectorAthenaPool::next
virtual StatusCode next(IEvtSelector::Context &ctxt) const override
Definition: EventSelectorAthenaPool.cxx:473
EventSelectorAthenaPool::m_initTimeStamp
Gaudi::CheckedProperty< int > m_initTimeStamp
Definition: EventSelectorAthenaPool.h:230
EventSelectorAthenaPool::m_processMetadata
Gaudi::Property< bool > m_processMetadata
ProcessMetadata, switch on firing of FileIncidents which will trigger processing of metadata: default...
Definition: EventSelectorAthenaPool.h:183
pool::TokenList::extend
void extend(const std::string &name)
Extends the Token list by one element.
EventSelectorAthenaPool::disconnectIfFinished
virtual bool disconnectIfFinished(const SG::SourceID &fid) const override
Definition: EventSelectorAthenaPool.cxx:1228
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
EventSelectorAthenaPool::m_inputCollectionsProp
Gaudi::Property< std::vector< std::string > > m_inputCollectionsProp
InputCollections, vector with names of the input collections.
Definition: EventSelectorAthenaPool.h:197
pool::READ
@ READ
Definition: Database/APR/StorageSvc/StorageSvc/pool.h:68
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
EventSelectorAthenaPool::recordAttributeList
virtual StatusCode recordAttributeList() const override
Record AttributeList in StoreGate.
Definition: EventSelectorAthenaPool.cxx:1074
Token::toString
virtual const std::string toString() const
Retrieve the string representation of the token.
Definition: Token.cxx:114
EventSelectorAthenaPool::m_sourceID
SG::SlotSpecificObj< SG::SourceID > m_sourceID
Definition: EventSelectorAthenaPool.h:250
EventSelectorAthenaPool::nextHandleFileTransition
virtual StatusCode nextHandleFileTransition(IEvtSelector::Context &ctxt) const override
Handle file transition at the next iteration.
Definition: EventSelectorAthenaPool.cxx:619
EventSelectorAthenaPool::m_curCollection
std::atomic_long m_curCollection
Definition: EventSelectorAthenaPool.h:233
pool::TokenList::begin
iterator begin()
Returns a forward iterator pointing to first element in Token list.
Definition: TokenList.h:218
CxxUtils::to
CONT to(RANGE &&r)
Definition: ranges.h:39
python.AthDsoLogger.fname
string fname
Definition: AthDsoLogger.py:67
python.PyAthena.v
v
Definition: PyAthena.py:154
EventSelectorAthenaPool::m_endIter
EventContextAthenaPool * m_endIter
Definition: EventSelectorAthenaPool.h:168
PoolCollectionConverter::initialize
StatusCode initialize()
Required by all Gaudi Services.
Definition: PoolCollectionConverter.cxx:69
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
Guid
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
Definition: Guid.h:20
EventSelectorAthenaPool::m_evtCount
std::atomic_int m_evtCount
Definition: EventSelectorAthenaPool.h:244
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
pool::ITransaction::READ
@ READ
Definition: ITransaction.h:29
SG::SourceID
std::string SourceID
Definition: AthenaKernel/AthenaKernel/SourceID.h:23
DEBUG
#define DEBUG
Definition: page_access.h:11
pool::IPositionSeek
Abstract interface for seeking inside a collection.
Definition: IPositionSeek.h:26
EventSelectorAthenaPool::m_skipEventSequenceProp
Gaudi::Property< std::vector< long > > m_skipEventSequenceProp
Definition: EventSelectorAthenaPool.h:239
EventSelectorAthenaPool::getCollectionCnv
PoolCollectionConverter * getCollectionCnv(bool throwIncidents=false) const
Return pointer to new PoolCollectionConverter.
Definition: EventSelectorAthenaPool.cxx:1030
copySelective.source
string source
Definition: copySelective.py:32
merge.status
status
Definition: merge.py:17
EventSelectorAthenaPool::m_keepInputFilesOpen
Gaudi::Property< bool > m_keepInputFilesOpen
KeepInputFilesOpen, boolean flag to keep files open after PoolCollection reaches end: default = false...
Definition: EventSelectorAthenaPool.h:208
EventSelectorAthenaPool::m_collectionType
Gaudi::Property< std::string > m_collectionType
CollectionType, type of the collection: default = "ImplicitROOT".
Definition: EventSelectorAthenaPool.h:185
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
StoreID::storeName
static const std::string & storeName(const StoreID::type &s)
Definition: StoreID.cxx:77
python.trfValidateRootFile.rc
rc
Definition: trfValidateRootFile.py:349
ServiceHandle
Definition: ClusterMakerTool.h:37