ATLAS Offline Software
Loading...
Searching...
No Matches
DoubleEventSelectorAthenaPool Class Reference

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

#include <DoubleEventSelectorAthenaPool.h>

Inheritance diagram for DoubleEventSelectorAthenaPool:
Collaboration diagram for DoubleEventSelectorAthenaPool:

Public Member Functions

 DoubleEventSelectorAthenaPool (const std::string &name, ISvcLocator *pSvcLocator)
 Standard Service Constructor.
virtual ~DoubleEventSelectorAthenaPool ()
 Destructor.
virtual StatusCode initialize () override
 Initialize function.
virtual StatusCode next (IEvtSelector::Context &ctxt) const override
virtual StatusCode next (IEvtSelector::Context &ctxt, int jump) const override
virtual StatusCode seek (Context &ctxt, int evtNum) const override
 Seek to a given event number.
virtual int size (Context &ctxt) const override
 Return the size of the collection.
virtual void handle (const Incident &incident) override
 Incident service handle listening for BeginProcessing and EndProcessing.
virtual StatusCode start () override
virtual StatusCode stop () override
virtual StatusCode finalize () override
virtual StatusCode createContext (IEvtSelector::Context *&ctxt) const override
 create context
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.
virtual int curEvent (const Context &ctxt) const override
 Return the current event number.
virtual StatusCode io_reinit () override
 Callback method to reinitialize the internal state of the component for I/O purposes (e.g. upon fork(2)).
virtual StatusCode io_finalize () override
 Callback method to finalize the internal state of the component for I/O purposes (e.g. before fork(2)).

Protected Member Functions

virtual StatusCode nextHandleFileTransition (IEvtSelector::Context &ctxt) const override
 Handle file transition at the next iteration.
virtual StatusCode nextWithSkip (IEvtSelector::Context &ctxt) const override
 Go to next event and skip if necessary.
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.
virtual bool disconnectIfFinished (const SG::SourceID &fid) const override
 Disconnect DB if all events from the source FID were processed and the Selector moved to another file.

Private Types

typedef std::mutex CallMutex

Private Member Functions

virtual StatusCode recordAttributeList () const override
 Record AttributeList in StoreGate.
StoreGateSvc * eventStore () const
 Return pointer to active event SG.
StatusCode reinit () const
 Reinitialize the service when a fork() occurred/was-issued.
std::unique_ptr< pool::Collection > getCollection (bool throwIncidents=false) const
 Return pointer to new Collection.
StatusCode openCollection (std::string &inputCollection, std::unique_ptr< pool::Collection > &poolCollection, std::string *lastError=nullptr) const
 Open a collection by name.
void disconnectCollection () const
 Disconnect current collection DB if open.
int findEvent (int evtNum) const
 Search for event with number evtNum.
void inputCollectionsHandler (Gaudi::Details::PropertyBase &)

Private Attributes

ServiceHandle< ISecondaryEventSelector > m_secondarySelector {this, "SecondaryEventSelector", "SecondaryEventSelector", ""}
Gaudi::Property< std::string > m_secondaryAttrListSuffix {this, "SecondaryAttrListSuffix", "secondary", ""}
bool m_secondaryByteStream {}
SG::SlotSpecificObj< SG::SourceID > m_sourceID1
SG::SlotSpecificObj< SG::SourceID > m_sourceID2
EventContextAthenaPool * m_endIter {}
std::unique_ptr< pool::Collection > m_poolCollection ATLAS_THREAD_SAFE {}
std::string m_curCollectionName ATLAS_THREAD_SAFE
std::unique_ptr< pool::CollectionCursor > m_headerIterator ATLAS_THREAD_SAFE {}
Guid m_guid ATLAS_THREAD_SAFE {}
std::map< SG::SourceID, int > m_activeEventsPerSource ATLAS_THREAD_SAFE
std::optional< InputFileIncidentGuard > m_inputFileGuard ATLAS_THREAD_SAFE
 RAII guard: guarantees a matching EndInputFile for every BeginInputFile.
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
ToolHandleArray< IAthenaSelectorTool > m_helperTools ATLAS_THREAD_SAFE {this, "HelperTools", {}, ""}
 HelperTools, vector of names of AlgTools that are executed by the EventSelector.
std::vector< int > m_numEvt ATLAS_THREAD_SAFE
std::vector< int > m_firstEvt ATLAS_THREAD_SAFE
std::vector< std::pair< long, long > > m_skipEventRanges ATLAS_THREAD_SAFE
ServiceHandle< IAthenaPoolCnvSvc > m_athenaPoolCnvSvc {this, "ConversionService", "AthenaPoolCnvSvc", ""}
ServiceHandle< IPoolSvc > m_poolSvc {this, "PoolSvc", "PoolSvc", ""}
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.
Gaudi::Property< bool > m_processMetadata {this, "ProcessMetadata", true, ""}
 ProcessMetadata, switch on firing of FileIncidents which will trigger processing of metadata: default = true.
std::string m_attrListKey {"Input"}
 AttributeList SG key.
Gaudi::Property< std::vector< std::string > > m_inputCollectionsProp {this, "InputCollections", {}, ""}
 InputCollections, vector with names of the input collections.
Gaudi::Property< bool > m_keepInputFilesOpen {this, "KeepInputFilesOpen", false, ""}
 KeepInputFilesOpen, boolean flag to keep files open after PoolCollection reaches end: default = false.
ToolHandle< IAthenaSelectorTool > m_counterTool {this, "CounterTool", "", ""}
Gaudi::CheckedProperty< uint32_t > m_runNo {this, "RunNumber", 0, ""}
 The following are included for compatibility with McEventSelector and are not really used.
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 {}
Gaudi::Property< int > m_skipEvents {this, "SkipEvents", 0, ""}
 SkipEvents, numbers of events to skip: default = 0.
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>.
std::atomic_int m_evtCount {}
std::atomic_bool m_firedIncident {}
CallMutex m_callLock
SG::SlotSpecificObj< SG::SourceID > m_sourceID

Detailed Description

This class is the EventSelector for event data.

Definition at line 26 of file DoubleEventSelectorAthenaPool.h.

Member Typedef Documentation

◆ CallMutex

typedef std::mutex EventSelectorAthenaPool::CallMutex
privateinherited

Definition at line 227 of file EventSelectorAthenaPool.h.

Constructor & Destructor Documentation

◆ DoubleEventSelectorAthenaPool()

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

Standard Service Constructor.

Definition at line 23 of file DoubleEventSelectorAthenaPool.cxx.

24 : EventSelectorAthenaPool(name, pSvcLocator)
25{
26}
EventSelectorAthenaPool(const std::string &name, ISvcLocator *pSvcLocator)
Standard Service Constructor.

◆ ~DoubleEventSelectorAthenaPool()

DoubleEventSelectorAthenaPool::~DoubleEventSelectorAthenaPool ( )
virtual

Destructor.

Definition at line 29 of file DoubleEventSelectorAthenaPool.cxx.

29{}

Member Function Documentation

◆ createAddress()

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

Definition at line 556 of file EventSelectorAthenaPool.cxx.

557 {
558 std::string tokenStr;
559 SG::ReadHandle<AthenaAttributeList> attrList(m_attrListKey, eventStore()->name());
560 if (attrList.isValid()) {
561 try {
562 tokenStr = (*attrList)["eventRef"].data<std::string>();
563 ATH_MSG_DEBUG("found AthenaAttribute, name = eventRef = " << tokenStr);
564 } catch (std::exception &e) {
565 ATH_MSG_ERROR(e.what());
566 return StatusCode::FAILURE;
567 }
568 } else {
569 ATH_MSG_WARNING("Cannot find AthenaAttribute, key = " << m_attrListKey);
570 tokenStr = m_headerIterator->eventRef().toString();
571 }
572 auto token = std::make_unique<Token>();
573 token->fromString(tokenStr);
574 m_incidentSvc->fireIncident(Incident(tokenStr, "ProcessEventAttributes"));
575 iop = new TokenAddress(pool::POOL_StorageType.type(), ClassID_traits<DataHeader>::ID(), "", "EventSelector", IPoolSvc::kInputStream, std::move(token));
576 return StatusCode::SUCCESS;
577}
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
StoreGateSvc * eventStore() const
Return pointer to active event SG.
ServiceHandle< IIncidentSvc > m_incidentSvc
std::string m_attrListKey
AttributeList SG key.
@ kInputStream
Definition IPoolSvc.h:37
static const DbType POOL_StorageType
Definition DbType.h:84

◆ createContext()

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

create context

Definition at line 336 of file EventSelectorAthenaPool.cxx.

336 {
337 ctxt = new EventContextAthenaPool(this);
338 return StatusCode::SUCCESS;
339}

◆ curEvent()

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

Return the current event number.

Parameters
ctxt[IN/OUT] current event context.

Definition at line 650 of file EventSelectorAthenaPool.cxx.

650 {
651 return(m_evtCount);
652}

◆ disconnectCollection()

void EventSelectorAthenaPool::disconnectCollection ( ) const
privateinherited

Disconnect current collection DB if open.

Definition at line 722 of file EventSelectorAthenaPool.cxx.

722 {
723 if (m_poolCollection) {
724 if (!m_curCollectionName.empty()) {
725 m_poolSvc->disconnectDb(m_curCollectionName).ignore();
726 m_curCollectionName.clear();
727 }
728 m_poolCollection.reset();
729 }
730}
ServiceHandle< IPoolSvc > m_poolSvc

◆ disconnectIfFinished()

bool EventSelectorAthenaPool::disconnectIfFinished ( const SG::SourceID & fid) const
overrideprotectedvirtualinherited

Disconnect DB if all events from the source FID were processed and the Selector moved to another file.

Definition at line 912 of file EventSelectorAthenaPool.cxx.

913{
914 if( m_activeEventsPerSource.find(fid) != m_activeEventsPerSource.end()
915 && m_activeEventsPerSource[fid] <= 0 && m_guid != fid ) {
916 // Explicitly disconnect file corresponding to old FID to release memory.
917 // EndInputFile is handled by the InputFileIncidentGuard.
918 if( !m_keepInputFilesOpen.value() ) {
919 ATH_MSG_INFO("Disconnecting input sourceID: " << fid );
920 m_poolSvc->disconnectDb("FID:" + fid, IPoolSvc::kInputStream).ignore();
921 m_activeEventsPerSource.erase( fid );
922 return true;
923 }
924 }
925 return false;
926}
#define ATH_MSG_INFO(x,...)
Gaudi::Property< bool > m_keepInputFilesOpen
KeepInputFilesOpen, boolean flag to keep files open after PoolCollection reaches end: default = false...

◆ eventStore()

StoreGateSvc * EventSelectorAthenaPool::eventStore ( ) const
privateinherited

Return pointer to active event SG.

Definition at line 69 of file EventSelectorAthenaPool.cxx.

69 {
71}
static StoreGateSvc * currentStoreGate()
get current StoreGate

◆ fillAttributeList()

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

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

Definition at line 790 of file EventSelectorAthenaPool.cxx.

791{
792 const auto& row = m_headerIterator->currentRow();
793 attrList->extend( row.tokenName() + suffix, "string" );
794 (*attrList)[ row.tokenName() + suffix ].data<std::string>() = row.token().toString();
795 ATH_MSG_DEBUG("record AthenaAttribute, name = " << row.tokenName() + suffix << " = " << row.token().toString() << ".");
796
797 std::string eventRef = "eventRef";
798 if (m_isSecondary.value()) {
799 eventRef.append(suffix);
800 }
801 attrList->extend(eventRef, "string");
802 (*attrList)[eventRef].data<std::string>() = m_headerIterator->eventRef().toString();
803 ATH_MSG_DEBUG("record AthenaAttribute, name = " + eventRef + " = " << m_headerIterator->eventRef().toString() << ".");
804
805 if (copySource) {
806 const coral::AttributeList& sourceAttrList = m_headerIterator->currentRow().attributeList();
807 for (const auto &attr : sourceAttrList) {
808 attrList->extend(attr.specification().name() + suffix, attr.specification().type());
809 (*attrList)[attr.specification().name() + suffix] = attr;
810 }
811 }
812
813 return StatusCode::SUCCESS;
814}
Gaudi::Property< bool > m_isSecondary
IsSecondary, know if this is an instance of secondary event selector.
row
Appending html table to final .html summary file.

◆ finalize()

StatusCode EventSelectorAthenaPool::finalize ( )
overridevirtualinherited

Definition at line 318 of file EventSelectorAthenaPool.cxx.

318 {
319 if (!m_counterTool.empty() && !m_counterTool->preFinalize().isSuccess()) {
320 ATH_MSG_WARNING("Failed to preFinalize() CounterTool");
321 }
322 for (auto& tool : m_helperTools) {
323 if (!tool->preFinalize().isSuccess()) {
324 ATH_MSG_WARNING("Failed to preFinalize() " << tool->name());
325 }
326 }
327 delete m_endIter; m_endIter = nullptr;
328 m_headerIterator = nullptr;
329 m_poolCollection.reset();
330 m_curCollectionName.clear();
331 // Finalize the Service base class.
332 return ::AthService::finalize();
333}
ToolHandle< IAthenaSelectorTool > m_counterTool
EventContextAthenaPool * m_endIter

◆ findEvent()

int EventSelectorAthenaPool::findEvent ( int evtNum) const
privateinherited

Search for event with number evtNum.

Definition at line 658 of file EventSelectorAthenaPool.cxx.

658 {
659 for (std::size_t i = 0, imax = m_numEvt.size(); i < imax; i++) {
660 if (m_numEvt[i] == -1) {
661 std::string collName = m_inputCollectionsProp.value()[i];
662 std::string lastError;
663 std::unique_ptr<pool::Collection> coll;
664 StatusCode status = openCollection(collName, coll, &lastError);
665 if (!status.isSuccess()) {
666 break;
667 }
668 int collection_size = 0;
669 if (coll) {
670 std::unique_ptr<pool::CollectionCursor> hi = coll->cursor();
671 collection_size = hi->size();
672 }
673 else {
674 ATH_MSG_ERROR( lastError );
675 }
676 if (i > 0) {
677 m_firstEvt[i] = m_firstEvt[i - 1] + m_numEvt[i - 1];
678 } else {
679 m_firstEvt[i] = 0;
680 }
681 m_numEvt[i] = collection_size;
682 }
683 if (evtNum >= m_firstEvt[i] && evtNum < m_firstEvt[i] + m_numEvt[i]) {
684 return(i);
685 }
686 }
687 return(-1);
688}
int imax(int i, int j)
Gaudi::Property< std::vector< std::string > > m_inputCollectionsProp
InputCollections, vector with names of the input collections.
StatusCode openCollection(std::string &inputCollection, std::unique_ptr< pool::Collection > &poolCollection, std::string *lastError=nullptr) const
Open a collection by name.
::StatusCode StatusCode
StatusCode definition for legacy code.
status
Definition merge.py:16

◆ getCollection()

std::unique_ptr< pool::Collection > EventSelectorAthenaPool::getCollection ( bool throwIncidents = false) const
privateinherited

Return pointer to new Collection.

Definition at line 733 of file EventSelectorAthenaPool.cxx.

733 {
734 while (m_inputCollectionsIterator != m_inputCollectionsProp.value().end()) {
735 if (m_curCollection != 0) {
736 m_numEvt[m_curCollection] = m_evtCount - m_firstEvt[m_curCollection];
738 m_firstEvt[m_curCollection] = m_evtCount;
739 }
740 ATH_MSG_DEBUG("Try item: \"" << *m_inputCollectionsIterator << "\" from the collection list.");
741 std::string collName = *m_inputCollectionsIterator;
742 std::unique_ptr<pool::Collection> coll;
743 StatusCode status = openCollection(collName, coll);
744 if (!status.isSuccess()) {
745 if (!status.isRecoverable()) {
746 ATH_MSG_ERROR("Unable to initialize Collection.");
747 throw GaudiException("Unable to read: " + *m_inputCollectionsIterator, name(), StatusCode::FAILURE);
748 } else {
749 ATH_MSG_ERROR("Unable to open: " << *m_inputCollectionsIterator);
750 throw GaudiException("Unable to open: " + *m_inputCollectionsIterator, name(), StatusCode::FAILURE);
751 }
752 } else {
753 if (!coll) {
754 ATH_MSG_DEBUG("No events found in: " << *m_inputCollectionsIterator << " skipped!!!");
755 if (throwIncidents && m_processMetadata.value()) {
756 // Scoped guard: fires BeginInputFile now, EndInputFile at scope exit
758 *m_inputCollectionsIterator, {},
759 "eventless " + *m_inputCollectionsIterator);
760 }
761 m_poolSvc->disconnectDb(*m_inputCollectionsIterator).ignore();
762 ++m_inputCollectionsIterator;
763 } else {
764 m_curCollectionName = collName;
765 return coll;
766 }
767 }
768 }
769 return nullptr;
770}
Gaudi::Property< bool > m_processMetadata
ProcessMetadata, switch on firing of FileIncidents which will trigger processing of metadata: default...
static InputFileIncidentGuard begin(IIncidentSvc &incSvc, std::string_view source, std::string_view beginFileName, std::string_view guid, std::string_view endFileName={}, std::string_view beginType=IncidentType::BeginInputFile, std::string_view endType=IncidentType::EndInputFile)
Factory: fire the begin incident and return a guard whose destructor fires the matching end incident.

◆ handle()

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

Incident service handle listening for BeginProcessing and EndProcessing.

Reimplemented from EventSelectorAthenaPool.

Definition at line 191 of file DoubleEventSelectorAthenaPool.cxx.

192{
193 ATH_MSG_DEBUG("DoubleEventSelectorAthenaPool::handle");
194
195 if (not Atlas::hasExtendedEventContext(inc.context()) ) {
196 ATH_MSG_WARNING("No extended event context available.");
197 return;
198 }
199
200 SG::SourceID fid1;
201 if (inc.type() == IncidentType::BeginProcessing) {
202 if ( Atlas::hasExtendedEventContext(inc.context()) ) {
203 fid1 = Atlas::getExtendedEventContext(inc.context()).proxy()->sourceID();
204 }
205 *m_sourceID1.get(inc.context()) = fid1;
206 }
207 else {
208 fid1 = *m_sourceID1.get(inc.context());
209 }
210
211 if( fid1.empty() ) {
212 ATH_MSG_WARNING("could not read event source ID from incident event context with key EventSelector");
213 return;
214 }
215
216 ATH_MSG_DEBUG("** MN Incident handler " << inc.type() << " Event source ID=" << fid1 );
217 if( inc.type() == IncidentType::BeginProcessing ) {
218 // increment the events-per-file counter for FID
219 m_activeEventsPerSource[fid1]++;
220 } else if( inc.type() == IncidentType::EndProcessing ) {
221 m_activeEventsPerSource[fid1]--;
222 disconnectIfFinished( fid1 );
223 *m_sourceID1.get(inc.context()) = "";
224 }
225 if( msgLvl(MSG::DEBUG) ) {
226 for( auto& source: m_activeEventsPerSource )
227 msg(MSG::DEBUG) << "SourceID: " << source.first << " active events: " << source.second << endmsg;
228 }
229
230 // Nothing to do if secondary event selector is ByteStream
232 return;
233 }
234
235 // Secondary guid
236 SG::SourceID fid2;
237 if (inc.type() == IncidentType::BeginProcessing) {
238 if ( Atlas::hasExtendedEventContext(inc.context()) ) {
239 fid2 = Atlas::getExtendedEventContext(inc.context()).proxy()->sourceID("SecondaryEventSelector");
240 }
241 *m_sourceID2.get(inc.context()) = fid2;
242 }
243 else {
244 fid2 = *m_sourceID2.get(inc.context());
245 }
246
247 if( fid2.empty() ) {
248 ATH_MSG_WARNING("could not read event source ID from incident event context with key SecondaryEventSelector");
249 return;
250 }
251
252 ATH_MSG_DEBUG("** MN Incident handler " << inc.type() << " Event source ID=" << fid2 );
253 if( inc.type() == IncidentType::BeginProcessing ) {
254 // increment the events-per-file counter for FID
255 m_activeEventsPerSource[fid2]++;
256 } else if( inc.type() == IncidentType::EndProcessing ) {
257 m_activeEventsPerSource[fid2]--;
258 m_secondarySelector->disconnectIfFinished( fid2 );
259 *m_sourceID2.get(inc.context()) = "";
260 }
261 if( msgLvl(MSG::DEBUG) ) {
262 for( auto& source: m_activeEventsPerSource )
263 msg(MSG::DEBUG) << "SourceID: " << source.first << " active events: " << source.second << endmsg;
264 }
265}
#define endmsg
SG::SlotSpecificObj< SG::SourceID > m_sourceID2
SG::SlotSpecificObj< SG::SourceID > m_sourceID1
ServiceHandle< ISecondaryEventSelector > m_secondarySelector
virtual bool disconnectIfFinished(const SG::SourceID &fid) const override
Disconnect DB if all events from the source FID were processed and the Selector moved to another file...
const ExtendedEventContext & getExtendedEventContext(const EventContext &ctx)
Retrieve an extended context from a context object.
bool hasExtendedEventContext(const EventContext &ctx)
Test whether a context object has an extended context installed.
MsgStream & msg
Definition testRead.cxx:32

◆ initialize()

StatusCode DoubleEventSelectorAthenaPool::initialize ( )
overridevirtual

Initialize function.

Reimplemented from EventSelectorAthenaPool.

Definition at line 32 of file DoubleEventSelectorAthenaPool.cxx.

33{
35
37 if (dynamic_cast<EventSelectorAthenaPool *>(&*(m_secondarySelector)) == nullptr) {
39 }
40
41 return StatusCode::SUCCESS;
42}
#define ATH_CHECK
Evaluate an expression and check for errors.
virtual StatusCode initialize() override
Required of all Gaudi Services.

◆ inputCollectionsHandler()

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

Definition at line 60 of file EventSelectorAthenaPool.cxx.

60 {
61 if (this->FSMState() != Gaudi::StateMachine::OFFLINE) {
62 m_inputCollectionsChanged = true;
63 }
64}

◆ io_finalize()

StatusCode EventSelectorAthenaPool::io_finalize ( )
overridevirtualinherited

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

Definition at line 857 of file EventSelectorAthenaPool.cxx.

857 {
858 ATH_MSG_INFO("I/O finalization...");
859 // Fire EndInputFile before disconnecting — file data is still accessible here
860 m_inputFileGuard.reset();
862 return StatusCode::SUCCESS;
863}
void disconnectCollection() const
Disconnect current collection DB if open.

◆ io_reinit()

StatusCode EventSelectorAthenaPool::io_reinit ( )
overridevirtualinherited

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

Definition at line 816 of file EventSelectorAthenaPool.cxx.

816 {
817 ATH_MSG_INFO("I/O reinitialization...");
819 m_headerIterator = nullptr;
820 ServiceHandle<IIoComponentMgr> iomgr("IoComponentMgr", name());
821 if (!iomgr.retrieve().isSuccess()) {
822 ATH_MSG_FATAL("Could not retrieve IoComponentMgr !");
823 return StatusCode::FAILURE;
824 }
825 if (!iomgr->io_hasitem(this)) {
826 ATH_MSG_FATAL("IoComponentMgr does not know about myself !");
827 return StatusCode::FAILURE;
828 }
829 std::vector<std::string> inputCollections = m_inputCollectionsProp.value();
830 std::set<std::size_t> updatedIndexes;
831 for (std::size_t i = 0, imax = m_inputCollectionsProp.value().size(); i < imax; i++) {
832 if (updatedIndexes.find(i) != updatedIndexes.end()) continue;
833 std::string savedName = inputCollections[i];
834 std::string &fname = inputCollections[i];
835 if (!iomgr->io_contains(this, fname)) {
836 ATH_MSG_ERROR("IoComponentMgr does not know about [" << fname << "] !");
837 return StatusCode::FAILURE;
838 }
839 if (!iomgr->io_retrieve(this, fname).isSuccess()) {
840 ATH_MSG_FATAL("Could not retrieve new value for [" << fname << "] !");
841 return StatusCode::FAILURE;
842 }
843 updatedIndexes.insert(i);
844 for (std::size_t j = i + 1; j < imax; j++) {
845 if (inputCollections[j] == savedName) {
847 updatedIndexes.insert(j);
848 }
849 }
850 }
851 // all good... copy over.
853 m_guid = Guid::null();
854 return reinit();
855}
#define ATH_MSG_FATAL(x,...)
StatusCode reinit() const
Reinitialize the service when a fork() occurred/was-issued.
static const Guid & null() noexcept
NULL-Guid: static class method.
Definition Guid.cxx:14
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)

◆ last()

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

Definition at line 542 of file EventSelectorAthenaPool.cxx.

542 {
543 if (ctxt.identifier() == m_endIter->identifier()) {
544 ATH_MSG_DEBUG("last(): Last event in InputStream.");
545 return StatusCode::SUCCESS;
546 }
547 return StatusCode::FAILURE;
548}

◆ next() [1/2]

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

Reimplemented from EventSelectorAthenaPool.

Definition at line 45 of file DoubleEventSelectorAthenaPool.cxx.

46{
47 ATH_MSG_DEBUG("DoubleEventSelectorAthenaPool::next");
48
49 std::lock_guard<CallMutex> lockGuard(m_callLock);
50 if (!eventStore()->clearStore().isSuccess()) {
51 ATH_MSG_WARNING("Cannot clear Store");
52 }
53 for (const auto& tool : m_helperTools) {
54 if (!tool->preNext().isSuccess()) {
55 ATH_MSG_WARNING("Failed to preNext() " << tool->name());
56 }
57 }
58
59 for (;;) {
60 // Move in the primary file (with skipping)
61 if (nextWithSkip(ctxt).isFailure()) {
62 return StatusCode::FAILURE;
63 }
64
65 // Check if we're at the end of secondary file
66 if (m_secondarySelector->nextWithSkip(ctxt).isFailure()) {
67 return StatusCode::FAILURE;
68 }
69
70 // Record the attribute list
71 if (!recordAttributeList().isSuccess()) {
72 ATH_MSG_ERROR("Failed to record AttributeList.");
73 return StatusCode::FAILURE;
74 }
75
76 StatusCode status = StatusCode::SUCCESS;
77 for (const auto& tool : m_helperTools) {
78 StatusCode toolStatus = tool->postNext();
79 if (toolStatus.isRecoverable()) {
80 ATH_MSG_INFO("Request skipping event from: " << tool->name());
81 if (status.isSuccess()) {
82 status = StatusCode::RECOVERABLE;
83 }
84 } else if (toolStatus.isFailure()) {
85 ATH_MSG_WARNING("Failed to postNext() " << tool->name());
86 status = StatusCode::FAILURE;
87 }
88 }
89 if (status.isRecoverable()) {
90 ATH_MSG_INFO("skipping event " << m_evtCount);
91 } else if (status.isFailure()) {
92 ATH_MSG_WARNING("Failed to postNext() HelperTool.");
93 } else {
94 if (!m_counterTool.empty() && !m_counterTool->postNext().isSuccess()) {
95 ATH_MSG_WARNING("Failed to postNext() CounterTool.");
96 }
97 break;
98 }
99 }
100
101 return StatusCode::SUCCESS;
102}
virtual StatusCode recordAttributeList() const override
Record AttributeList in StoreGate.
virtual StatusCode nextWithSkip(IEvtSelector::Context &ctxt) const override
Go to next event and skip if necessary.

◆ next() [2/2]

StatusCode DoubleEventSelectorAthenaPool::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 from EventSelectorAthenaPool.

Definition at line 105 of file DoubleEventSelectorAthenaPool.cxx.

106{
107 ATH_MSG_DEBUG("DoubleEventSelectorAthenaPool::next(jump)");
108
109 if (jump > 0) {
110 for (int i = 0; i < jump; i++) {
111 if (!next(ctxt).isSuccess()) {
112 return StatusCode::FAILURE;
113 }
114 }
115 return StatusCode::SUCCESS;
116 }
117
118 return StatusCode::FAILURE;
119}
virtual StatusCode next(IEvtSelector::Context &ctxt) const override

◆ nextHandleFileTransition()

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

Handle file transition at the next iteration.

Definition at line 414 of file EventSelectorAthenaPool.cxx.

415{
416 if( m_inputCollectionsChanged ) {
417 StatusCode rc = reinit();
418 if( rc != StatusCode::SUCCESS ) return rc;
419 }
420 else { // advance to the next (not needed after reinit)
421 // Check if we're at the end of file
422 if (m_headerIterator == nullptr || m_headerIterator->next() == 0) {
423 m_headerIterator = nullptr;
424 // Close previous collection.
425 m_poolCollection.reset();
426
427 // Fire EndInputFile while data is still accessible, then disconnect
428 m_inputFileGuard.reset();
429 const SG::SourceID old_guid = m_guid.toString();
430 m_guid = Guid::null();
431 disconnectIfFinished( old_guid );
432
433 // check if somebody updated Inputs in the EOF incident (like VP1 does)
434 if( m_inputCollectionsChanged ) {
435 StatusCode rc = reinit();
436 if( rc != StatusCode::SUCCESS ) return rc;
437 } else {
438 // Open next file from inputCollections list.
439 if (m_inputCollectionsIterator == m_inputCollectionsProp.value().end()) {
440 m_poolCollection = nullptr;
441 }
442 else {
443 ++m_inputCollectionsIterator;
444 // Create Collection for input file
445 m_poolCollection = getCollection(true);
446 }
447 if (!m_poolCollection) {
448 // Return end iterator
449 ctxt = *m_endIter;
450 // This is not a real failure but a Gaudi way of handling "end of job"
451 return StatusCode::FAILURE;
452 }
453 // Get DataHeader iterator
454 m_headerIterator = m_poolCollection->cursor();
455
456 // Return RECOVERABLE to mark we should still continue
457 return StatusCode::RECOVERABLE;
458 }
459 }
460 }
461 const Token& headRef = m_headerIterator->eventRef();
462 const Guid guid = headRef.dbID();
463 ATH_MSG_VERBOSE("next(): DataHeder Token=" << headRef.toString() );
464
465 if (guid != m_guid) {
466 // we are starting reading from a new DB. Check if the old one needs to be retired
467 if (m_guid != Guid::null()) {
468 // zero the current DB ID (m_guid) before trying disconnect() to indicate it is no longer in use
469 const SG::SourceID old_guid = m_guid.toString();
470 m_guid = Guid::null();
471 // EndInputFile is fired by the guard transition() below; just disconnect here
472 disconnectIfFinished( old_guid );
473 }
474 m_guid = guid;
475 m_activeEventsPerSource[guid.toString()] = 0;
476 if (!m_athenaPoolCnvSvc->setInputAttributes(*m_inputCollectionsIterator).isSuccess()) {
477 ATH_MSG_ERROR("Failed to set input attributes.");
478 return StatusCode::FAILURE;
479 }
480 if(m_processMetadata.value()) {
482 *m_inputCollectionsIterator, m_guid.toString(),
483 /*endFileName=*/{});
484 }
485 } // end if (guid != m_guid)
486 return StatusCode::SUCCESS;
487}
#define ATH_MSG_VERBOSE(x,...)
static Double_t rc
std::unique_ptr< pool::Collection > getCollection(bool throwIncidents=false) const
Return pointer to new Collection.
ServiceHandle< IAthenaPoolCnvSvc > m_athenaPoolCnvSvc
static void transition(std::optional< InputFileIncidentGuard > &guard, IIncidentSvc &incSvc, std::string_view source, std::string_view beginFileName, std::string_view guid, std::string_view endFileName={}, std::string_view beginType=IncidentType::BeginInputFile, std::string_view endType=IncidentType::EndInputFile)
Replace the guard in an optional, with strict End-before-Begin ordering.
const std::string toString() const
Retrieve the string representation of the token.
Definition Token.cxx:135
const Guid & dbID() const
Access database identifier.
Definition Token.h:65

◆ nextWithSkip()

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

Go to next event and skip if necessary.

Definition at line 489 of file EventSelectorAthenaPool.cxx.

489 {
490 ATH_MSG_DEBUG("EventSelectorAthenaPool::nextWithSkip");
491
492 for (;;) {
493 // Check if we're at the end of file
495 if (sc.isRecoverable()) {
496 continue; // handles empty files
497 }
498 if (sc.isFailure()) {
499 return StatusCode::FAILURE;
500 }
501
502 // Increase event count
503 ++m_evtCount;
504
505 if (!m_counterTool.empty() && !m_counterTool->preNext().isSuccess()) {
506 ATH_MSG_WARNING("Failed to preNext() CounterTool.");
507 }
509 && (m_skipEventRanges.empty() || m_evtCount < m_skipEventRanges.front().first))
510 {
511 return StatusCode::SUCCESS;
512 } else {
513 while( !m_skipEventRanges.empty() && m_evtCount >= m_skipEventRanges.front().second ) {
514 m_skipEventRanges.erase(m_skipEventRanges.begin());
515 }
516 if (m_isSecondary.value()) {
517 ATH_MSG_INFO("skipping secondary event " << m_evtCount);
518 } else {
519 ATH_MSG_INFO("skipping event " << m_evtCount);
520 }
521 }
522 }
523
524 return StatusCode::SUCCESS;
525}
static Double_t sc
Gaudi::Property< int > m_skipEvents
SkipEvents, numbers of events to skip: default = 0.
virtual StatusCode nextHandleFileTransition(IEvtSelector::Context &ctxt) const override
Handle file transition at the next iteration.

◆ openCollection()

StatusCode EventSelectorAthenaPool::openCollection ( std::string & inputCollection,
std::unique_ptr< pool::Collection > & poolCollection,
std::string * lastError = nullptr ) const
privateinherited

Open a collection by name.

Definition at line 697 of file EventSelectorAthenaPool.cxx.

699 {
700 if (!inputCollection.starts_with("PFN:")
701 && !inputCollection.starts_with("LFN:")
702 && !inputCollection.starts_with("FID:")) {
703 inputCollection = std::format("PFN:{}", inputCollection);
704 }
705 StatusCode sc = m_poolSvc->connectCollection(inputCollection, "Input", IPoolSvc::kInputStream);
706 try {
707 auto fileDescr = m_poolSvc->getInputFileDescriptor(IPoolSvc::kInputStream, inputCollection);
708 poolCollection = std::make_unique<pool::Collection>(fileDescr);
709 if (lastError) lastError->clear();
710 } catch (const std::exception &e) {
711 if (lastError) {
712 *lastError = std::format("Failed to open collection '{}': {}", inputCollection, e.what());
713 }
714 poolCollection.reset();
715 }
716 if (sc.isRecoverable() || poolCollection == nullptr) {
717 return m_poolSvc->checkCollection(inputCollection, IPoolSvc::kInputStream, poolCollection == nullptr);
718 }
719 return StatusCode::SUCCESS;
720}

◆ previous() [1/2]

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

Definition at line 527 of file EventSelectorAthenaPool.cxx.

527 {
528 ATH_MSG_ERROR("previous() not implemented");
529 return StatusCode::FAILURE;
530}

◆ previous() [2/2]

StatusCode EventSelectorAthenaPool::previous ( IEvtSelector::Context & ctxt,
int jump ) const
overridevirtualinherited
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 532 of file EventSelectorAthenaPool.cxx.

532 {
533 if (jump > 0) {
534 for (int i = 0; i < jump; i++) {
535 ATH_CHECK(previous(ctxt));
536 }
537 return StatusCode::SUCCESS;
538 }
539 return StatusCode::FAILURE;
540}
virtual StatusCode previous(IEvtSelector::Context &ctxt) const override

◆ recordAttributeList()

StatusCode DoubleEventSelectorAthenaPool::recordAttributeList ( ) const
overrideprivatevirtual

Record AttributeList in StoreGate.

Reimplemented from EventSelectorAthenaPool.

Definition at line 148 of file DoubleEventSelectorAthenaPool.cxx.

149{
150 ATH_MSG_DEBUG("DoubleEventSelectorAthenaPool::recordAttributeList");
151
152 // Get access to AttributeList
153 ATH_MSG_DEBUG("Get AttributeList from the collection");
154 // MN: accessing only attribute list, ignoring token list
155 const coral::AttributeList& attrList = m_headerIterator->currentRow().attributeList();
156 ATH_MSG_DEBUG("AttributeList size " << attrList.size());
157 std::unique_ptr<AthenaAttributeList> athAttrList{};
158
159 // Decide what to do based on the type of secondary file
161 // Create empty attribute list
162 athAttrList = std::make_unique<AthenaAttributeList>();
163 // Always add ByteStream as primary input
164 ATH_CHECK(m_secondarySelector->fillAttributeList(athAttrList.get(), "", false));
165
166 // Then fill the new attribute list from the primary file
167 ATH_MSG_DEBUG("Append primary attribute list properties to the secondary one with a suffix: " << m_secondaryAttrListSuffix.value());
168 ATH_CHECK(fillAttributeList(athAttrList.get(), "_" + m_secondaryAttrListSuffix.value(), true));
169 } else {
170 // Create a new attribute list from the primary input one
171 athAttrList = std::make_unique<AthenaAttributeList>(attrList);
172 // Fill the new attribute list from the primary file
173 ATH_CHECK(fillAttributeList(athAttrList.get(), "", false));
174
175 // Fill the new attribute list from the secondary file
176 ATH_MSG_DEBUG("Append secondary attribute list properties to the primary one with a suffix: " << m_secondaryAttrListSuffix.value());
177 ATH_CHECK(m_secondarySelector->fillAttributeList(athAttrList.get(), "_" + m_secondaryAttrListSuffix.value(), true));
178 }
179
180 // Add info about secondary input
181 athAttrList->extend("hasSecondaryInput", "bool");
182 (*athAttrList)["hasSecondaryInput"].data<bool>() = true;
183
184 SG::WriteHandle<AthenaAttributeList> wh(m_attrListKey, eventStore()->name());
185 ATH_CHECK(wh.record(std::move(athAttrList)));
186
187 return StatusCode::SUCCESS;
188}
Gaudi::Property< std::string > m_secondaryAttrListSuffix
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.
str wh
Definition parseDir.py:45

◆ reinit()

StatusCode EventSelectorAthenaPool::reinit ( ) const
privateinherited

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

Definition at line 181 of file EventSelectorAthenaPool.cxx.

181 {
182 ATH_MSG_DEBUG("reinitialization...");
183
184 // reset markers
185 m_numEvt.resize(m_inputCollectionsProp.value().size(), -1);
186 m_firstEvt.resize(m_inputCollectionsProp.value().size(), -1);
187
188 // Initialize InputCollectionsIterator
189 m_inputCollectionsIterator = m_inputCollectionsProp.value().begin();
190 m_curCollection = 0;
191 if (!m_firstEvt.empty()) {
192 m_firstEvt[0] = 0;
193 }
194 m_inputCollectionsChanged = false;
195 m_evtCount = 0;
196 m_headerIterator = 0;
197 bool retError = false;
198 for (auto& tool : m_helperTools) {
199 if (!tool->postInitialize().isSuccess()) {
200 ATH_MSG_FATAL("Failed to postInitialize() " << tool->name());
201 retError = true;
202 }
203 }
204 if (retError) {
205 ATH_MSG_FATAL("Failed to postInitialize() helperTools");
206 return StatusCode::FAILURE;
207 }
208
209 // Create an m_poolCollection to read the objects in
210 m_poolCollection = getCollection();
211 if (!m_poolCollection) {
212 ATH_MSG_INFO("No Events found in any Input Collections");
213 if (m_processMetadata.value()) {
214 m_inputCollectionsIterator = m_inputCollectionsProp.value().end();
215 if (!m_inputCollectionsProp.value().empty()) --m_inputCollectionsIterator;
216 //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
217 if( !m_firedIncident && !m_inputCollectionsProp.value().empty() ) {
218 FileIncident firstInputFileIncident(name(), "FirstInputFile", *m_inputCollectionsIterator);
219 m_incidentSvc->fireIncident(firstInputFileIncident);
220 m_firedIncident = true;
221 }
222 }
223 return StatusCode::SUCCESS;
224 }
225 // Get DataHeader iterator
226 try {
227 m_headerIterator = m_poolCollection->cursor();
228 } catch (std::exception &e) {
229 ATH_MSG_FATAL("Cannot open input collection - check data/software version.");
230 ATH_MSG_ERROR(e.what());
231 return StatusCode::FAILURE;
232 }
233 while (m_headerIterator == nullptr || m_headerIterator->next() == 0) { // no selected events
235 if (m_inputCollectionsIterator == m_inputCollectionsProp.value().end()) {
236 m_poolCollection = nullptr;
237 }
238 else {
239 ++m_inputCollectionsIterator;
240 m_poolCollection = getCollection();
241 }
242 if (m_poolCollection) {
243 m_headerIterator = m_poolCollection->cursor();
244 } else {
245 break;
246 }
247 }
248 if (!m_poolCollection || m_headerIterator == nullptr) { // no event selected in any collection
249 m_inputCollectionsIterator = m_inputCollectionsProp.value().begin();
250 m_curCollection = 0;
251 m_poolCollection = getCollection();
252 if (!m_poolCollection) {
253 return StatusCode::SUCCESS;
254 }
255 m_headerIterator = m_poolCollection->cursor();
256 while (m_headerIterator == nullptr || m_headerIterator->next() == 0) { // empty collection
258 ++m_inputCollectionsIterator;
259 m_poolCollection = getCollection();
260 if (m_poolCollection) {
261 m_headerIterator = m_poolCollection->cursor();
262 } else {
263 break;
264 }
265 }
266 }
267 if (!m_poolCollection || m_headerIterator == nullptr) {
268 return StatusCode::SUCCESS;
269 }
270 const Token& headRef = m_headerIterator->eventRef();
271 const std::string fid = headRef.dbID().toString();
272 const int tech = headRef.technology();
273 ATH_MSG_VERBOSE("reinit(): First DataHeder Token=" << headRef.toString() );
274
275 // Check if File is BS, for which Incident is thrown by SingleEventInputSvc
276 if (tech != 0x00001000 && m_processMetadata.value() && !m_firedIncident) {
277 FileIncident firstInputFileIncident(name(), "FirstInputFile", "FID:" + fid, fid);
278 m_incidentSvc->fireIncident(firstInputFileIncident);
279 m_firedIncident = true;
280 }
281 return StatusCode::SUCCESS;
282}
constexpr void toString(std::span< char, StrLen > buf, bool uppercase=true) const noexcept
Automatic conversion to string representation.
int technology() const
Access technology type.
Definition Token.h:78

◆ releaseContext()

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

Definition at line 579 of file EventSelectorAthenaPool.cxx.

579 {
580 return StatusCode::SUCCESS;
581}

◆ resetCriteria()

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

Set a selection criteria.

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

Definition at line 583 of file EventSelectorAthenaPool.cxx.

584 {
585 return StatusCode::SUCCESS;
586}

◆ rewind()

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

Definition at line 550 of file EventSelectorAthenaPool.cxx.

550 {
551 ATH_CHECK(reinit());
552 ctxt = EventContextAthenaPool(this);
553 return StatusCode::SUCCESS;
554}

◆ seek()

StatusCode DoubleEventSelectorAthenaPool::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 from EventSelectorAthenaPool.

Definition at line 122 of file DoubleEventSelectorAthenaPool.cxx.

123{
124 ATH_MSG_DEBUG("DoubleEventSelectorAthenaPool::seek");
125
127 ATH_CHECK(m_secondarySelector->seek(ctxt, evtNum));
128
129 return StatusCode::SUCCESS;
130}
virtual StatusCode seek(Context &ctxt, int evtnum) const override
Seek to a given event number.

◆ size()

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

Return the size of the collection.

Parameters
ctxt[IN/OUT] current event context.

Reimplemented from EventSelectorAthenaPool.

Definition at line 133 of file DoubleEventSelectorAthenaPool.cxx.

134{
135 ATH_MSG_DEBUG("DoubleEventSelectorAthenaPool::size");
136
137 int sz1 = EventSelectorAthenaPool::size(ctxt);
138 int sz2 = m_secondarySelector->size(ctxt);
139
140 if (sz2 < sz1) {
141 ATH_MSG_WARNING("Fewer secondary input events than primary input events. Expect trouble!");
142 }
143
144 return sz1;
145}
virtual int size(Context &ctxt) const override
Return the size of the collection.

◆ start()

StatusCode EventSelectorAthenaPool::start ( )
overridevirtualinherited

Definition at line 284 of file EventSelectorAthenaPool.cxx.

284 {
286 m_inputCollectionsIterator = m_inputCollectionsProp.value().begin();
287 m_curCollection = 0;
288 m_poolCollection = getCollection(true);
289 if (!m_poolCollection) {
290 ATH_MSG_INFO("No Events found in any Input Collections");
291 m_inputCollectionsIterator = m_inputCollectionsProp.value().end();
292 if (!m_inputCollectionsProp.value().empty()) {
293 --m_inputCollectionsIterator; //leave iterator in state of last input file
294 }
295 } else {
296 m_headerIterator = m_poolCollection->cursor();
297 }
298 m_evtCount = 0;
299 delete m_endIter;
300 m_endIter = nullptr;
301 m_endIter = new EventContextAthenaPool(nullptr);
302 return StatusCode::SUCCESS;
303}

◆ stop()

StatusCode EventSelectorAthenaPool::stop ( )
overridevirtualinherited

Definition at line 305 of file EventSelectorAthenaPool.cxx.

305 {
306 // Fire EndInputFile for any file still open (the event loop may end
307 // before the file is fully read).
308 m_inputFileGuard.reset();
309
310 IEvtSelector::Context* ctxt(nullptr);
311 if (!releaseContext(ctxt).isSuccess()) {
312 ATH_MSG_WARNING("Cannot release context");
313 }
314 return StatusCode::SUCCESS;
315}
virtual StatusCode releaseContext(IEvtSelector::Context *&ctxt) const override

Member Data Documentation

◆ ATLAS_THREAD_SAFE [1/12]

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

Definition at line 222 of file EventSelectorAthenaPool.h.

◆ ATLAS_THREAD_SAFE [2/12]

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

Definition at line 215 of file EventSelectorAthenaPool.h.

◆ ATLAS_THREAD_SAFE [3/12]

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

Definition at line 214 of file EventSelectorAthenaPool.h.

◆ ATLAS_THREAD_SAFE [4/12]

ToolHandleArray<IAthenaSelectorTool> m_helperTools EventSelectorAthenaPool::ATLAS_THREAD_SAFE {this, "HelperTools", {}, ""}
mutableprivateinherited

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

Definition at line 194 of file EventSelectorAthenaPool.h.

194{this, "HelperTools", {}, ""};

◆ ATLAS_THREAD_SAFE [5/12]

bool m_inputCollectionsChanged EventSelectorAthenaPool::ATLAS_THREAD_SAFE
mutableprivateinherited

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

Definition at line 187 of file EventSelectorAthenaPool.h.

◆ ATLAS_THREAD_SAFE [6/12]

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

Definition at line 184 of file EventSelectorAthenaPool.h.

◆ ATLAS_THREAD_SAFE [7/12]

std::optional<InputFileIncidentGuard> m_inputFileGuard EventSelectorAthenaPool::ATLAS_THREAD_SAFE
mutableprivateinherited

RAII guard: guarantees a matching EndInputFile for every BeginInputFile.

Definition at line 167 of file EventSelectorAthenaPool.h.

◆ ATLAS_THREAD_SAFE [8/12]

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

Definition at line 165 of file EventSelectorAthenaPool.h.

◆ ATLAS_THREAD_SAFE [9/12]

Guid m_guid EventSelectorAthenaPool::ATLAS_THREAD_SAFE {}
mutableprivateinherited

Definition at line 164 of file EventSelectorAthenaPool.h.

164{};

◆ ATLAS_THREAD_SAFE [10/12]

std::unique_ptr<pool::CollectionCursor> m_headerIterator EventSelectorAthenaPool::ATLAS_THREAD_SAFE {}
mutableprivateinherited

Definition at line 163 of file EventSelectorAthenaPool.h.

163{};

◆ ATLAS_THREAD_SAFE [11/12]

std::string m_curCollectionName EventSelectorAthenaPool::ATLAS_THREAD_SAFE
mutableprivateinherited

Definition at line 162 of file EventSelectorAthenaPool.h.

◆ ATLAS_THREAD_SAFE [12/12]

std::unique_ptr<pool::Collection> m_poolCollection EventSelectorAthenaPool::ATLAS_THREAD_SAFE {}
mutableprivateinherited

Definition at line 161 of file EventSelectorAthenaPool.h.

161{};

◆ m_athenaPoolCnvSvc

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

Definition at line 169 of file EventSelectorAthenaPool.h.

169{this, "ConversionService", "AthenaPoolCnvSvc", ""};

◆ m_attrListKey

std::string EventSelectorAthenaPool::m_attrListKey {"Input"}
privateinherited

AttributeList SG key.

Definition at line 180 of file EventSelectorAthenaPool.h.

180{"Input"};

◆ m_callLock

CallMutex EventSelectorAthenaPool::m_callLock
mutableprivateinherited

Definition at line 228 of file EventSelectorAthenaPool.h.

◆ m_counterTool

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

Definition at line 195 of file EventSelectorAthenaPool.h.

195{this, "CounterTool", "", ""};

◆ m_curCollection

std::atomic_long EventSelectorAthenaPool::m_curCollection {}
mutableprivateinherited

Definition at line 213 of file EventSelectorAthenaPool.h.

213{};

◆ m_endIter

EventContextAthenaPool* EventSelectorAthenaPool::m_endIter {}
privateinherited

Definition at line 160 of file EventSelectorAthenaPool.h.

160{};

◆ m_eventsPerLB

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

Definition at line 209 of file EventSelectorAthenaPool.h.

209{this, "EventsPerLB", 1000, ""};

◆ m_eventsPerRun

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

Definition at line 207 of file EventSelectorAthenaPool.h.

207{this, "EventsPerRun", 1000000, ""};

◆ m_evtCount

std::atomic_int EventSelectorAthenaPool::m_evtCount {}
mutableprivateinherited

Definition at line 224 of file EventSelectorAthenaPool.h.

224{}; // internal count of events

◆ m_firedIncident

std::atomic_bool EventSelectorAthenaPool::m_firedIncident {}
mutableprivateinherited

Definition at line 225 of file EventSelectorAthenaPool.h.

225{};

◆ m_firstEventNo

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

Definition at line 205 of file EventSelectorAthenaPool.h.

205{this, "FirstEvent", 1, ""};

◆ m_firstLBNo

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

Definition at line 208 of file EventSelectorAthenaPool.h.

208{this, "FirstLB", 0, ""};

◆ m_incidentSvc

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

Definition at line 171 of file EventSelectorAthenaPool.h.

171{this, "IncidentSvc", "IncidentSvc", ""};

◆ m_initTimeStamp

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

Definition at line 210 of file EventSelectorAthenaPool.h.

210{this, "InitialTimeStamp", 0, ""};

◆ m_inputCollectionsProp

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

InputCollections, vector with names of the input collections.

Definition at line 183 of file EventSelectorAthenaPool.h.

183{this, "InputCollections", {}, ""};

◆ m_isSecondary

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

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

Definition at line 175 of file EventSelectorAthenaPool.h.

175{this, "IsSecondary", false, ""};

◆ m_keepInputFilesOpen

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

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

191{this, "KeepInputFilesOpen", false, ""};

◆ m_oldRunNo

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

Definition at line 201 of file EventSelectorAthenaPool.h.

201{this, "OldRunNumber", 0, ""};

◆ m_overrideRunNumber

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

Definition at line 202 of file EventSelectorAthenaPool.h.

202{this, "OverrideRunNumber", false, ""};

◆ m_overrideRunNumberFromInput

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

Definition at line 203 of file EventSelectorAthenaPool.h.

203{this, "OverrideRunNumberFromInput", false, ""};

◆ m_poolSvc

ServiceHandle<IPoolSvc> EventSelectorAthenaPool::m_poolSvc {this, "PoolSvc", "PoolSvc", ""}
privateinherited

Definition at line 170 of file EventSelectorAthenaPool.h.

170{this, "PoolSvc", "PoolSvc", ""};

◆ m_processMetadata

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

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

Definition at line 177 of file EventSelectorAthenaPool.h.

177{this, "ProcessMetadata", true, ""};

◆ m_runNo

Gaudi::CheckedProperty<uint32_t> EventSelectorAthenaPool::m_runNo {this, "RunNumber", 0, ""}
privateinherited

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

200{this, "RunNumber", 0, ""};

◆ m_secondaryAttrListSuffix

Gaudi::Property<std::string> DoubleEventSelectorAthenaPool::m_secondaryAttrListSuffix {this, "SecondaryAttrListSuffix", "secondary", ""}
private

Definition at line 67 of file DoubleEventSelectorAthenaPool.h.

67{this, "SecondaryAttrListSuffix", "secondary", ""};

◆ m_secondaryByteStream

bool DoubleEventSelectorAthenaPool::m_secondaryByteStream {}
private

Definition at line 70 of file DoubleEventSelectorAthenaPool.h.

70{};

◆ m_secondarySelector

ServiceHandle<ISecondaryEventSelector> DoubleEventSelectorAthenaPool::m_secondarySelector {this, "SecondaryEventSelector", "SecondaryEventSelector", ""}
private

Definition at line 65 of file DoubleEventSelectorAthenaPool.h.

65{this, "SecondaryEventSelector", "SecondaryEventSelector", ""};

◆ m_skipEventRangesProp

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

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

Definition at line 221 of file EventSelectorAthenaPool.h.

221{this, "SkipEventRanges", {}, ""};

◆ m_skipEvents

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

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

Definition at line 218 of file EventSelectorAthenaPool.h.

218{this, "SkipEvents", 0, ""};

◆ m_skipEventSequenceProp

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

Definition at line 219 of file EventSelectorAthenaPool.h.

219{this, "SkipEventSequence", {}, ""};

◆ m_sourceID

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

Definition at line 230 of file EventSelectorAthenaPool.h.

◆ m_sourceID1

SG::SlotSpecificObj<SG::SourceID> DoubleEventSelectorAthenaPool::m_sourceID1
private

Definition at line 72 of file DoubleEventSelectorAthenaPool.h.

◆ m_sourceID2

SG::SlotSpecificObj<SG::SourceID> DoubleEventSelectorAthenaPool::m_sourceID2
private

Definition at line 73 of file DoubleEventSelectorAthenaPool.h.

◆ m_timeStampInterval

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

Definition at line 211 of file EventSelectorAthenaPool.h.

211{this, "TimeStampInterval", 0, ""};

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