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...
 
std::unique_ptr< 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 {}
 
std::unique_ptr< 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, "ConversionService", "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", "ImplicitCollection", ""}
 CollectionType, type of the collection: default = "ImplicitCollection". 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_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< 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< uint32_t > m_runNo {this, "RunNumber", 0, ""}
 The following are included for compatibility with McEventSelector and are not really used. More...
 
Gaudi::CheckedProperty< uint32_t > m_oldRunNo {this, "OldRunNumber", 0, ""}
 
Gaudi::Property< bool > m_overrideRunNumber {this, "OverrideRunNumber", false, ""}
 
Gaudi::Property< bool > m_overrideRunNumberFromInput {this, "OverrideRunNumberFromInput", false, ""}
 
Gaudi::CheckedProperty< uint64_t > m_firstEventNo {this, "FirstEvent", 1, ""}
 
Gaudi::CheckedProperty< uint64_t > m_eventsPerRun {this, "EventsPerRun", 1000000, ""}
 
Gaudi::CheckedProperty< uint32_t > m_firstLBNo {this, "FirstLB", 0, ""}
 
Gaudi::CheckedProperty< uint32_t > m_eventsPerLB {this, "EventsPerLB", 1000, ""}
 
Gaudi::CheckedProperty< uint32_t > m_initTimeStamp {this, "InitialTimeStamp", 0, ""}
 
Gaudi::Property< uint32_t > 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 49 of file EventSelectorAthenaPool.h.

Member Typedef Documentation

◆ CallMutex

typedef std::mutex EventSelectorAthenaPool::CallMutex
private

Definition at line 244 of file EventSelectorAthenaPool.h.

Constructor & Destructor Documentation

◆ EventSelectorAthenaPool()

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

Standard Service Constructor.

Definition at line 56 of file EventSelectorAthenaPool.cxx.

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

◆ ~EventSelectorAthenaPool()

EventSelectorAthenaPool::~EventSelectorAthenaPool ( )
virtual

Destructor.

Definition at line 80 of file EventSelectorAthenaPool.cxx.

80  {
81 }

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 755 of file EventSelectorAthenaPool.cxx.

756  {
757  std::string tokenStr;
759  if (attrList.isValid()) {
760  try {
761  tokenStr = (*attrList)["eventRef"].data<std::string>();
762  ATH_MSG_DEBUG("found AthenaAttribute, name = eventRef = " << tokenStr);
763  } catch (std::exception &e) {
764  ATH_MSG_ERROR(e.what());
765  return(StatusCode::FAILURE);
766  }
767  } else {
768  ATH_MSG_WARNING("Cannot find AthenaAttribute, key = " << m_attrListKey.value());
769  tokenStr = m_headerIterator->eventRef().toString();
770  }
771  auto token = std::make_unique<Token>();
772  token->fromString(tokenStr);
773  iop = new TokenAddress(POOL_StorageType, ClassID_traits<DataHeader>::ID(), "", "EventSelector", IPoolSvc::kInputStream, std::move(token));
774  return(StatusCode::SUCCESS);
775 }

◆ createContext()

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

create context

Definition at line 453 of file EventSelectorAthenaPool.cxx.

453  {
454  ctxt = new EventContextAthenaPool(this);
455  return(StatusCode::SUCCESS);
456 }

◆ curEvent()

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

Return the current event number.

Parameters
ctxt[IN/OUT] current event context.

Definition at line 848 of file EventSelectorAthenaPool.cxx.

848  {
849  return(m_evtCount);
850 }

◆ disconnectIfFinished()

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

Definition at line 1219 of file EventSelectorAthenaPool.cxx.

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

◆ eventStore()

StoreGateSvc * EventSelectorAthenaPool::eventStore ( ) const
private

Return pointer to active event SG.

Definition at line 83 of file EventSelectorAthenaPool.cxx.

83  {
85 }

◆ 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 1083 of file EventSelectorAthenaPool.cxx.

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

◆ finalize()

StatusCode EventSelectorAthenaPool::finalize ( )
overridevirtual

Definition at line 412 of file EventSelectorAthenaPool.cxx.

412  {
413  if (m_eventStreamingTool.empty() || !m_eventStreamingTool->isClient()) {
414  if (!m_counterTool.empty() && !m_counterTool->preFinalize().isSuccess()) {
415  ATH_MSG_WARNING("Failed to preFinalize() CounterTool");
416  }
417  for (auto& tool : m_helperTools) {
418  if (!tool->preFinalize().isSuccess()) {
419  ATH_MSG_WARNING("Failed to preFinalize() " << tool->name());
420  }
421  }
422  }
423  delete m_endIter; m_endIter = nullptr;
424  m_headerIterator = nullptr;
425  if (m_poolCollectionConverter) {
426  m_poolCollectionConverter.reset();
427  }
428  // Release AthenaSharedMemoryTool
429  if (!m_eventStreamingTool.empty() && !m_eventStreamingTool.release().isSuccess()) {
430  ATH_MSG_WARNING("Cannot release AthenaSharedMemoryTool");
431  }
432  // Release CounterTool
433  if (!m_counterTool.empty() && !m_counterTool.release().isSuccess()) {
434  ATH_MSG_WARNING("Cannot release CounterTool.");
435  }
436  // Release HelperTools
437  if (!m_helperTools.release().isSuccess()) {
438  ATH_MSG_WARNING("Cannot release " << m_helperTools);
439  }
440  // Release AthenaPoolCnvSvc
441  if (!m_athenaPoolCnvSvc.release().isSuccess()) {
442  ATH_MSG_WARNING("Cannot release " << m_athenaPoolCnvSvc.typeAndName() << ".");
443  }
444  // Release IncidentSvc
445  if (!m_incidentSvc.release().isSuccess()) {
446  ATH_MSG_WARNING("Cannot release " << m_incidentSvc.typeAndName() << ".");
447  }
448  // Finalize the Service base class.
449  return(::AthService::finalize());
450 }

◆ findEvent()

int EventSelectorAthenaPool::findEvent ( int  evtNum) const
private

Search for event with number evtNum.

Definition at line 856 of file EventSelectorAthenaPool.cxx.

856  {
857  for (std::size_t i = 0, imax = m_numEvt.size(); i < imax; i++) {
858  if (m_numEvt[i] == -1) {
859  PoolCollectionConverter pcc(m_collectionType.value() + ":" + m_collectionTree.value(),
860  m_inputCollectionsProp.value()[i],
862  m_athenaPoolCnvSvc->getPoolSvc());
863  if (!pcc.initialize().isSuccess()) {
864  break;
865  }
866  int collection_size = 0;
867  if (pcc.isValid()) {
868  pool::ICollectionCursor* hi = &pcc.selectAll();
869  collection_size = hi->size();
870  }
871  if (i > 0) {
872  m_firstEvt[i] = m_firstEvt[i - 1] + m_numEvt[i - 1];
873  } else {
874  m_firstEvt[i] = 0;
875  }
876  m_numEvt[i] = collection_size;
877  }
878  if (evtNum >= m_firstEvt[i] && evtNum < m_firstEvt[i] + m_numEvt[i]) {
879  return(i);
880  }
881  }
882  return(-1);
883 }

◆ 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 395 of file EventSelectorAthenaPool.cxx.

395  {
396  if (m_processMetadata.value()) {
397  if (m_evtCount >= 0) {
398  // Assume that the end of collection file indicates the end of payload file.
399  if (m_guid != Guid::null()) {
400  // Fire EndInputFile incident
401  FileIncident endInputFileIncident(name(), "EndInputFile", "FID:" + m_guid.toString(), m_guid.toString());
402  m_incidentSvc->fireIncident(endInputFileIncident);
403  }
404  }
405  if (isLastFile && m_firedIncident) {
406  m_firedIncident = false;
407  }
408  }
409 }

◆ getCollectionCnv()

std::unique_ptr< PoolCollectionConverter > EventSelectorAthenaPool::getCollectionCnv ( bool  throwIncidents = false) const
private

Return pointer to new PoolCollectionConverter.

Definition at line 1022 of file EventSelectorAthenaPool.cxx.

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

◆ handle()

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

Incident service handle listening for BeginProcessing and EndProcessing.

Reimplemented in DoubleEventSelectorAthenaPool.

Definition at line 1178 of file EventSelectorAthenaPool.cxx.

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

◆ initialize()

StatusCode EventSelectorAthenaPool::initialize ( )
overridevirtual

Required of all Gaudi Services.

Reimplemented in DoubleEventSelectorAthenaPool.

Definition at line 87 of file EventSelectorAthenaPool.cxx.

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

◆ inputCollectionsHandler()

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

Definition at line 74 of file EventSelectorAthenaPool.cxx.

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

◆ 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 1163 of file EventSelectorAthenaPool.cxx.

1163  {
1164  ATH_MSG_INFO("I/O finalization...");
1165  if (m_poolCollectionConverter) {
1166  m_poolCollectionConverter->disconnectDb().ignore();
1167  m_poolCollectionConverter.reset();
1168  }
1169  return(StatusCode::SUCCESS);
1170 }

◆ 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 1111 of file EventSelectorAthenaPool.cxx.

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

◆ last()

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

Definition at line 741 of file EventSelectorAthenaPool.cxx.

741  {
742  if (ctxt.identifier() == m_endIter->identifier()) {
743  ATH_MSG_DEBUG("last(): Last event in InputStream.");
744  return(StatusCode::SUCCESS);
745  }
746  return(StatusCode::FAILURE);
747 }

◆ makeClient()

StatusCode EventSelectorAthenaPool::makeClient ( int  num)
overridevirtual

Make this a client.

Definition at line 911 of file EventSelectorAthenaPool.cxx.

911  {
912  IDataShare* ds = dynamic_cast<IDataShare*>(m_athenaPoolCnvSvc.get());
913  if (ds == nullptr) {
914  ATH_MSG_ERROR("Cannot cast AthenaPoolCnvSvc to DataShare");
915  return(StatusCode::FAILURE);
916  }
917  if (ds->makeClient(num + 1).isFailure()) {
918  ATH_MSG_ERROR("Failed to switch AthenaPoolCnvSvc to DataStreaming client");
919  return(StatusCode::FAILURE);
920  }
921  if (m_eventStreamingTool.empty()) {
922  return(StatusCode::SUCCESS);
923  }
924  ATH_MSG_DEBUG("makeClient: " << m_eventStreamingTool << " = " << num);
925  std::string dummyStr;
926  return(m_eventStreamingTool->makeClient(0, dummyStr));
927 }

◆ makeServer()

StatusCode EventSelectorAthenaPool::makeServer ( int  num)
overridevirtual

Make this a server.

Definition at line 886 of file EventSelectorAthenaPool.cxx.

886  {
887  IDataShare* ds = dynamic_cast<IDataShare*>(m_athenaPoolCnvSvc.get());
888  if (ds == nullptr) {
889  ATH_MSG_ERROR("Cannot cast AthenaPoolCnvSvc to DataShare");
890  return(StatusCode::FAILURE);
891  }
892  if (num < 0) {
893  if (ds->makeServer(num - 1).isFailure()) {
894  ATH_MSG_ERROR("Failed to switch AthenaPoolCnvSvc to output DataStreaming server");
895  }
896  return(StatusCode::SUCCESS);
897  }
898  if (ds->makeServer(num + 1).isFailure()) {
899  ATH_MSG_ERROR("Failed to switch AthenaPoolCnvSvc to input DataStreaming server");
900  return(StatusCode::FAILURE);
901  }
902  if (m_eventStreamingTool.empty()) {
903  return(StatusCode::SUCCESS);
904  }
905  m_processMetadata = false;
906  ATH_MSG_DEBUG("makeServer: " << m_eventStreamingTool << " = " << num);
907  return(m_eventStreamingTool->makeServer(1, ""));
908 }

◆ 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 458 of file EventSelectorAthenaPool.cxx.

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

◆ 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 599 of file EventSelectorAthenaPool.cxx.

599  {
600  if (jump > 0) {
601  for (int i = 0; i < jump; i++) {
602  ATH_CHECK(next(ctxt));
603  }
604  return(StatusCode::SUCCESS);
605  }
606  return(StatusCode::FAILURE);
607 }

◆ nextHandleFileTransition()

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

Handle file transition at the next iteration.

Definition at line 609 of file EventSelectorAthenaPool.cxx.

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

◆ nextWithSkip()

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

Go to next event and skip if necessary.

Definition at line 688 of file EventSelectorAthenaPool.cxx.

688  {
689  ATH_MSG_DEBUG("EventSelectorAthenaPool::nextWithSkip");
690 
691  for (;;) {
692  // Check if we're at the end of file
694  if (sc.isRecoverable()) {
695  continue; // handles empty files
696  }
697  if (sc.isFailure()) {
698  return StatusCode::FAILURE;
699  }
700 
701  // Increase event count
702  ++m_evtCount;
703 
704  if (!m_counterTool.empty() && !m_counterTool->preNext().isSuccess()) {
705  ATH_MSG_WARNING("Failed to preNext() CounterTool.");
706  }
708  && (m_skipEventRanges.empty() || m_evtCount < m_skipEventRanges.front().first))
709  {
710  return StatusCode::SUCCESS;
711  } else {
712  while( !m_skipEventRanges.empty() && m_evtCount >= m_skipEventRanges.front().second ) {
713  m_skipEventRanges.erase(m_skipEventRanges.begin());
714  }
715  if (m_isSecondary.value()) {
716  ATH_MSG_INFO("skipping secondary event " << m_evtCount);
717  } else {
718  ATH_MSG_INFO("skipping event " << m_evtCount);
719  }
720  }
721  }
722 
723  return StatusCode::SUCCESS;
724 }

◆ 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 726 of file EventSelectorAthenaPool.cxx.

726  {
727  ATH_MSG_ERROR("previous() not implemented");
728  return(StatusCode::FAILURE);
729 }

◆ 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 731 of file EventSelectorAthenaPool.cxx.

731  {
732  if (jump > 0) {
733  for (int i = 0; i < jump; i++) {
734  ATH_CHECK(previous(ctxt));
735  }
736  return(StatusCode::SUCCESS);
737  }
738  return(StatusCode::FAILURE);
739 }

◆ readEvent()

StatusCode EventSelectorAthenaPool::readEvent ( int  maxevt)
overridevirtual

Read the next maxevt events.

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

Definition at line 963 of file EventSelectorAthenaPool.cxx.

963  {
964  IDataShare* ds = dynamic_cast<IDataShare*>(m_athenaPoolCnvSvc.get());
965  if (ds == nullptr) {
966  ATH_MSG_ERROR("Cannot cast AthenaPoolCnvSvc to DataShare");
967  return(StatusCode::FAILURE);
968  }
969  if (m_eventStreamingTool.empty()) {
970  ATH_MSG_ERROR("No AthenaSharedMemoryTool configured for readEvent()");
971  return(StatusCode::FAILURE);
972  }
973  ATH_MSG_VERBOSE("Called read Event " << maxevt);
974  IEvtSelector::Context* ctxt = new EventContextAthenaPool(this);
975  for (int i = 0; i < maxevt || maxevt == -1; ++i) {
976  if (!next(*ctxt).isSuccess()) {
977  if (m_evtCount == -1) {
978  ATH_MSG_VERBOSE("Called read Event and read last event from input: " << i);
979  break;
980  }
981  ATH_MSG_ERROR("Cannot read Event " << m_evtCount - 1 << " into AthenaSharedMemoryTool");
982  delete ctxt; ctxt = nullptr;
983  return(StatusCode::FAILURE);
984  } else {
985  ATH_MSG_VERBOSE("Called next, read Event " << m_evtCount - 1);
986  }
987  }
988  delete ctxt; ctxt = nullptr;
989  // End of file, wait for last event to be taken
990  StatusCode sc;
991  while ( (sc = putEvent_ST(*m_eventStreamingTool, 0, 0, 0, 0)).isRecoverable() ) {
992  while (ds->readData().isSuccess()) {
993  ATH_MSG_VERBOSE("Called last readData, while marking last event in readEvent()");
994  }
995  usleep(1000);
996  }
997  if (!sc.isSuccess()) {
998  ATH_MSG_ERROR("Cannot put last Event marker to AthenaSharedMemoryTool");
999  return(StatusCode::FAILURE);
1000  } else {
1001  sc = ds->readData();
1002  while (sc.isSuccess() || sc.isRecoverable()) {
1003  sc = ds->readData();
1004  }
1005  ATH_MSG_DEBUG("Failed last readData -> Clients are stopped, after marking last event in readEvent()");
1006  }
1007  return(StatusCode::SUCCESS);
1008 }

◆ recordAttributeList()

StatusCode EventSelectorAthenaPool::recordAttributeList ( ) const
overrideprotectedvirtual

Record AttributeList in StoreGate.

Reimplemented in DoubleEventSelectorAthenaPool.

Definition at line 1065 of file EventSelectorAthenaPool.cxx.

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

◆ reinit()

StatusCode EventSelectorAthenaPool::reinit ( ) const
private

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

Definition at line 245 of file EventSelectorAthenaPool.cxx.

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

◆ releaseContext()

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

Definition at line 777 of file EventSelectorAthenaPool.cxx.

777  {
778  return(StatusCode::SUCCESS);
779 }

◆ 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 781 of file EventSelectorAthenaPool.cxx.

782  {
783  return(StatusCode::SUCCESS);
784 }

◆ rewind()

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

Definition at line 749 of file EventSelectorAthenaPool.cxx.

749  {
750  ATH_CHECK(reinit());
751  ctxt = EventContextAthenaPool(this);
752  return(StatusCode::SUCCESS);
753 }

◆ 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 786 of file EventSelectorAthenaPool.cxx.

786  {
787 
788  if( m_inputCollectionsChanged ) {
789  StatusCode rc = reinit();
790  if( rc != StatusCode::SUCCESS ) return rc;
791  }
792 
793  long newColl = findEvent(evtNum);
794  if (newColl == -1 && evtNum >= m_firstEvt[m_curCollection] && evtNum < m_evtCount - 1) {
795  newColl = m_curCollection;
796  }
797  if (newColl == -1) {
798  m_headerIterator = nullptr;
799  ATH_MSG_INFO("seek: Reached end of Input.");
800  fireEndFileIncidents(true);
801  return(StatusCode::RECOVERABLE);
802  }
803  if (newColl != m_curCollection) {
804  if (!m_keepInputFilesOpen.value() && m_poolCollectionConverter) {
805  m_poolCollectionConverter->disconnectDb().ignore();
806  }
807  m_poolCollectionConverter.reset();
808  m_curCollection = newColl;
809  try {
810  ATH_MSG_DEBUG("Seek to item: \""
812  << "\" from the collection list.");
813  // Reset input collection iterator to the right place
814  m_inputCollectionsIterator = m_inputCollectionsProp.value().begin();
815  m_inputCollectionsIterator += m_curCollection;
816  m_poolCollectionConverter = std::make_unique<PoolCollectionConverter>(m_collectionType.value() + ":" + m_collectionTree.value(),
819  m_athenaPoolCnvSvc->getPoolSvc());
820  if (!m_poolCollectionConverter->initialize().isSuccess()) {
821  m_headerIterator = nullptr;
822  ATH_MSG_ERROR("seek: Unable to initialize PoolCollectionConverter.");
823  return(StatusCode::FAILURE);
824  }
825  // Create DataHeader iterators
826  m_headerIterator = &m_poolCollectionConverter->selectAll();
827  EventContextAthenaPool* beginIter = new EventContextAthenaPool(this);
828  m_evtCount = m_firstEvt[m_curCollection];
829  next(*beginIter).ignore();
830  ATH_MSG_DEBUG("Token " << m_headerIterator->eventRef().toString());
831  } catch (std::exception &e) {
832  m_headerIterator = nullptr;
833  ATH_MSG_ERROR(e.what());
834  return(StatusCode::FAILURE);
835  }
836  }
837 
838  if (m_headerIterator->seek(evtNum - m_firstEvt[m_curCollection]) == 0) {
839  m_headerIterator = nullptr;
840  ATH_MSG_ERROR("Did not find event, evtNum = " << evtNum);
841  return(StatusCode::FAILURE);
842  } else {
843  m_evtCount = evtNum + 1;
844  }
845  return(StatusCode::SUCCESS);
846 }

◆ 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 930 of file EventSelectorAthenaPool.cxx.

930  {
931  IDataShare* ds = dynamic_cast<IDataShare*>(m_athenaPoolCnvSvc.get());
932  if (ds == nullptr) {
933  ATH_MSG_ERROR("Cannot cast AthenaPoolCnvSvc to DataShare");
934  return(StatusCode::FAILURE);
935  }
936  if (!m_eventStreamingTool.empty() && m_eventStreamingTool->isClient()) {
937  StatusCode sc = m_eventStreamingTool->lockEvent(evtnum);
938  while (sc.isRecoverable()) {
939  usleep(1000);
940  sc = m_eventStreamingTool->lockEvent(evtnum);
941  }
942 // Send stop client and wait for restart
943  if (sc.isFailure()) {
944  if (ds->makeClient(0).isFailure()) {
945  return(StatusCode::FAILURE);
946  }
947  sc = m_eventStreamingTool->lockEvent(evtnum);
948  while (sc.isRecoverable() || sc.isFailure()) {
949  usleep(1000);
950  sc = m_eventStreamingTool->lockEvent(evtnum);
951  }
952 //FIXME
953  if (ds->makeClient(1).isFailure()) {
954  return(StatusCode::FAILURE);
955  }
956  }
957  return(sc);
958  }
959  return(StatusCode::FAILURE);
960 }

◆ 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 1011 of file EventSelectorAthenaPool.cxx.

1011  {
1012  // Fetch sizes of all collections.
1013  findEvent(-1);
1014  int sz = 0;
1015  for (std::size_t i = 0, imax = m_numEvt.size(); i < imax; i++) {
1016  sz += m_numEvt[i];
1017  }
1018  return(sz);
1019 }

◆ start()

StatusCode EventSelectorAthenaPool::start ( )
overridevirtual

Definition at line 355 of file EventSelectorAthenaPool.cxx.

355  {
356  if (m_poolCollectionConverter) {
357  // Reset iterators and apply new query
358  m_poolCollectionConverter->disconnectDb().ignore();
359  m_poolCollectionConverter.reset();
360  }
361  m_inputCollectionsIterator = m_inputCollectionsProp.value().begin();
362  m_curCollection = 0;
363  if (!m_eventStreamingTool.empty() && m_eventStreamingTool->isClient()) {
364  return(StatusCode::SUCCESS);
365  }
366  m_poolCollectionConverter = getCollectionCnv(true);
367  if (!m_poolCollectionConverter) {
368  ATH_MSG_INFO("No Events found in any Input Collections");
369  m_inputCollectionsIterator = m_inputCollectionsProp.value().end();
370  if (!m_inputCollectionsProp.value().empty()) {
371  --m_inputCollectionsIterator; //leave iterator in state of last input file
372  }
373  } else {
374  m_headerIterator = &m_poolCollectionConverter->selectAll();
375  }
376  m_evtCount = 0;
377  delete m_endIter;
378  m_endIter = nullptr;
379  m_endIter = new EventContextAthenaPool(nullptr);
380  return(StatusCode::SUCCESS);
381 }

◆ stop()

StatusCode EventSelectorAthenaPool::stop ( )
overridevirtual

Definition at line 383 of file EventSelectorAthenaPool.cxx.

383  {
384  if (!m_eventStreamingTool.empty() && m_eventStreamingTool->isClient()) {
385  return(StatusCode::SUCCESS);
386  }
387  IEvtSelector::Context* ctxt(nullptr);
388  if (!releaseContext(ctxt).isSuccess()) {
389  ATH_MSG_WARNING("Cannot release context");
390  }
391  return(StatusCode::SUCCESS);
392 }

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 251 of file EventSelectorAthenaPool.h.

Member Data Documentation

◆ ATLAS_THREAD_SAFE [1/10]

std::unique_ptr<PoolCollectionConverter> m_poolCollectionConverter EventSelectorAthenaPool::ATLAS_THREAD_SAFE {}
mutableprivate

Definition at line 173 of file EventSelectorAthenaPool.h.

◆ ATLAS_THREAD_SAFE [2/10]

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

Definition at line 174 of file EventSelectorAthenaPool.h.

◆ ATLAS_THREAD_SAFE [3/10]

Guid m_guid EventSelectorAthenaPool::ATLAS_THREAD_SAFE {}
mutableprivate

Definition at line 175 of file EventSelectorAthenaPool.h.

◆ ATLAS_THREAD_SAFE [4/10]

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

Definition at line 176 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 208 of file EventSelectorAthenaPool.h.

◆ ATLAS_THREAD_SAFE [8/10]

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

Definition at line 231 of file EventSelectorAthenaPool.h.

◆ ATLAS_THREAD_SAFE [9/10]

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

Definition at line 232 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 239 of file EventSelectorAthenaPool.h.

◆ m_athenaPoolCnvSvc

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

Definition at line 178 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 245 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 189 of file EventSelectorAthenaPool.h.

◆ m_collectionType

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

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

Definition at line 187 of file EventSelectorAthenaPool.h.

◆ m_connection

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

Connection, connection string.

Definition at line 192 of file EventSelectorAthenaPool.h.

◆ m_counterTool

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

Definition at line 209 of file EventSelectorAthenaPool.h.

◆ m_curCollection

std::atomic_long EventSelectorAthenaPool::m_curCollection {}
mutableprivate

Definition at line 230 of file EventSelectorAthenaPool.h.

◆ m_endIter

EventContextAthenaPool* EventSelectorAthenaPool::m_endIter {}
private

Definition at line 170 of file EventSelectorAthenaPool.h.

◆ m_eventsPerLB

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

Definition at line 226 of file EventSelectorAthenaPool.h.

◆ m_eventsPerRun

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

Definition at line 224 of file EventSelectorAthenaPool.h.

◆ m_eventStreamingTool

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

Definition at line 210 of file EventSelectorAthenaPool.h.

◆ m_evtCount

std::atomic_int EventSelectorAthenaPool::m_evtCount {}
mutableprivate

Definition at line 241 of file EventSelectorAthenaPool.h.

◆ m_firedIncident

std::atomic_bool EventSelectorAthenaPool::m_firedIncident {}
mutableprivate

Definition at line 242 of file EventSelectorAthenaPool.h.

◆ m_firstEventNo

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

Definition at line 222 of file EventSelectorAthenaPool.h.

◆ m_firstLBNo

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

Definition at line 225 of file EventSelectorAthenaPool.h.

◆ m_incidentSvc

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

Definition at line 179 of file EventSelectorAthenaPool.h.

◆ m_initTimeStamp

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

Definition at line 227 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 183 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 205 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 212 of file EventSelectorAthenaPool.h.

◆ m_oldRunNo

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

Definition at line 218 of file EventSelectorAthenaPool.h.

◆ m_overrideRunNumber

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

Definition at line 219 of file EventSelectorAthenaPool.h.

◆ m_overrideRunNumberFromInput

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

Definition at line 220 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 185 of file EventSelectorAthenaPool.h.

◆ m_runNo

Gaudi::CheckedProperty<uint32_t> 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 217 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 238 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 235 of file EventSelectorAthenaPool.h.

◆ m_skipEventSequenceProp

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

Definition at line 236 of file EventSelectorAthenaPool.h.

◆ m_sourceID

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

Definition at line 247 of file EventSelectorAthenaPool.h.

◆ m_timeStampInterval

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

Definition at line 228 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:741
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
beamspotman.r
def r
Definition: beamspotman.py:672
trigbs_pickEvents.ranges
ranges
Definition: trigbs_pickEvents.py:60
Guid::null
static const Guid & null()
NULL-Guid: static class method.
Definition: Guid.cxx:18
createLinkingScheme.iter
iter
Definition: createLinkingScheme.py:62
checkxAOD.ds
ds
Definition: Tools/PyUtils/bin/checkxAOD.py:260
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:1083
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:235
fitman.sz
sz
Definition: fitman.py:527
hotSpotInTAG.suffix
string suffix
Definition: hotSpotInTAG.py:185
EventSelectorAthenaPool::releaseContext
virtual StatusCode releaseContext(IEvtSelector::Context *&ctxt) const override
Definition: EventSelectorAthenaPool.cxx:777
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
EventSelectorAthenaPool::reinit
StatusCode reinit() const
Reinitialize the service when a fork() occured/was-issued.
Definition: EventSelectorAthenaPool.cxx:245
PoolCollectionConverter
This class provides an interface to POOL collections.
Definition: PoolCollectionConverter.h:27
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
EventSelectorAthenaPool::previous
virtual StatusCode previous(IEvtSelector::Context &ctxt) const override
Definition: EventSelectorAthenaPool.cxx:726
EventSelectorAthenaPool::m_incidentSvc
ServiceHandle< IIncidentSvc > m_incidentSvc
Definition: EventSelectorAthenaPool.h:179
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_athenaPoolCnvSvc
ServiceHandle< IAthenaPoolCnvSvc > m_athenaPoolCnvSvc
Definition: EventSelectorAthenaPool.h:178
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:64
EventSelectorAthenaPool::m_eventStreamingTool
ToolHandle< IAthenaIPCTool > m_eventStreamingTool
Definition: EventSelectorAthenaPool.h:210
EventSelectorAthenaPool::eventStore
StoreGateSvc * eventStore() const
Return pointer to active event SG.
Definition: EventSelectorAthenaPool.cxx:83
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
EventSelectorAthenaPool::m_firstLBNo
Gaudi::CheckedProperty< uint32_t > m_firstLBNo
Definition: EventSelectorAthenaPool.h:225
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:856
EventSelectorAthenaPool::m_callLock
CallMutex m_callLock
Definition: EventSelectorAthenaPool.h:245
EventContextAthenaPool
This class provides the context to access an event from POOL persistent store.
Definition: EventContextAthenaPool.h:21
atlasStyleMacro.icol
int icol
Definition: atlasStyleMacro.py:13
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
Token
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition: Token.h:21
IDataShare
Abstract interface for sharing data.
Definition: IDataShare.h:24
EventSelectorAthenaPool::m_counterTool
ToolHandle< IAthenaSelectorTool > m_counterTool
Definition: EventSelectorAthenaPool.h:209
TokenAddress
This class provides a Generic Transient Address for POOL tokens.
Definition: TokenAddress.h:23
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:148
IPoolSvc::kInputStream
@ kInputStream
Definition: IPoolSvc.h:39
EventSelectorAthenaPool::m_runNo
Gaudi::CheckedProperty< uint32_t > m_runNo
The following are included for compatibility with McEventSelector and are not really used.
Definition: EventSelectorAthenaPool.h:217
EventContextAthenaPool::identifier
virtual void * identifier() const
Definition: EventContextAthenaPool.h:56
TileAANtupleConfig.inputCollections
inputCollections
Definition: TileAANtupleConfig.py:145
Token::technology
int technology() const
Access technology type.
Definition: Token.h:77
EventSelectorAthenaPool::m_firedIncident
std::atomic_bool m_firedIncident
Definition: EventSelectorAthenaPool.h:242
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
EventSelectorAthenaPool::m_oldRunNo
Gaudi::CheckedProperty< uint32_t > m_oldRunNo
Definition: EventSelectorAthenaPool.h:218
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
EventSelectorAthenaPool::getCollectionCnv
std::unique_ptr< PoolCollectionConverter > getCollectionCnv(bool throwIncidents=false) const
Return pointer to new PoolCollectionConverter.
Definition: EventSelectorAthenaPool.cxx:1022
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
L1CaloPhase1Monitoring.propVal
propVal
Definition: L1CaloPhase1Monitoring.py:558
EventSelectorAthenaPool::m_isSecondary
Gaudi::Property< bool > m_isSecondary
IsSecondary, know if this is an instance of secondary event selector.
Definition: EventSelectorAthenaPool.h:183
StoreGateSvc::currentStoreGate
static StoreGateSvc * currentStoreGate()
get current StoreGate
Definition: StoreGateSvc.cxx:51
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:37
calibdata.exception
exception
Definition: calibdata.py:495
parseDir.wh
wh
Definition: parseDir.py:45
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
EventSelectorAthenaPool::fireEndFileIncidents
void fireEndFileIncidents(bool isLastFile) const
Fires the EndInputFile incident (if there is an open file) at end of selector.
Definition: EventSelectorAthenaPool.cxx:395
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
python.getProblemFolderFromLogs.el
dictionary el
Definition: getProblemFolderFromLogs.py:48
EventSelectorAthenaPool::m_makeStreamingToolClient
IntegerProperty m_makeStreamingToolClient
Make this instance a Streaming Client during first iteration automatically.
Definition: EventSelectorAthenaPool.h:212
EventSelectorAthenaPool::m_eventsPerRun
Gaudi::CheckedProperty< uint64_t > m_eventsPerRun
Definition: EventSelectorAthenaPool.h:224
StoreGateSvc::clearStore
virtual StatusCode clearStore(bool forceRemove=false) override final
clear DataStore contents: called by the event loop mgrs
Definition: StoreGateSvc.cxx:423
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:189
EventSelectorAthenaPool::inputCollectionsHandler
void inputCollectionsHandler(Gaudi::Details::PropertyBase &)
Definition: EventSelectorAthenaPool.cxx:74
EventSelectorAthenaPool::m_firstEventNo
Gaudi::CheckedProperty< uint64_t > m_firstEventNo
Definition: EventSelectorAthenaPool.h:222
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:238
pool::ICollectionCursor
Definition: ICollectionCursor.h:22
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:458
EventSelectorAthenaPool::m_processMetadata
Gaudi::Property< bool > m_processMetadata
ProcessMetadata, switch on firing of FileIncidents which will trigger processing of metadata: default...
Definition: EventSelectorAthenaPool.h:185
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:1219
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
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:45
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:452
EventSelectorAthenaPool::recordAttributeList
virtual StatusCode recordAttributeList() const override
Record AttributeList in StoreGate.
Definition: EventSelectorAthenaPool.cxx:1065
Token::toString
virtual const std::string toString() const
Retrieve the string representation of the token.
Definition: Token.cxx:129
EventSelectorAthenaPool::m_sourceID
SG::SlotSpecificObj< SG::SourceID > m_sourceID
Definition: EventSelectorAthenaPool.h:247
EventSelectorAthenaPool::nextHandleFileTransition
virtual StatusCode nextHandleFileTransition(IEvtSelector::Context &ctxt) const override
Handle file transition at the next iteration.
Definition: EventSelectorAthenaPool.cxx:609
EventSelectorAthenaPool::m_curCollection
std::atomic_long m_curCollection
Definition: EventSelectorAthenaPool.h:230
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:66
python.PyAthena.v
v
Definition: PyAthena.py:154
EventSelectorAthenaPool::m_eventsPerLB
Gaudi::CheckedProperty< uint32_t > m_eventsPerLB
Definition: EventSelectorAthenaPool.h:226
EventSelectorAthenaPool::m_endIter
EventContextAthenaPool * m_endIter
Definition: EventSelectorAthenaPool.h:170
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:73
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:241
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
pool::ICollectionCursor::size
virtual std::size_t size()=0
Returns the size of the collection.
SG::SourceID
std::string SourceID
Definition: AthenaKernel/AthenaKernel/SourceID.h:25
DEBUG
#define DEBUG
Definition: page_access.h:11
EventSelectorAthenaPool::m_initTimeStamp
Gaudi::CheckedProperty< uint32_t > m_initTimeStamp
Definition: EventSelectorAthenaPool.h:227
EventSelectorAthenaPool::m_skipEventSequenceProp
Gaudi::Property< std::vector< long > > m_skipEventSequenceProp
Definition: EventSelectorAthenaPool.h:236
copySelective.source
string source
Definition: copySelective.py:31
merge.status
status
Definition: merge.py:16
jobOptions.fileName
fileName
Definition: jobOptions.SuperChic_ALP2.py:39
EventSelectorAthenaPool::m_keepInputFilesOpen
Gaudi::Property< bool > m_keepInputFilesOpen
KeepInputFilesOpen, boolean flag to keep files open after PoolCollection reaches end: default = false...
Definition: EventSelectorAthenaPool.h:205
EventSelectorAthenaPool::m_collectionType
Gaudi::Property< std::string > m_collectionType
CollectionType, type of the collection: default = "ImplicitCollection".
Definition: EventSelectorAthenaPool.h:187
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:375
ServiceHandle
Definition: ClusterMakerTool.h:37