13 #include "GaudiKernel/IIncidentSvc.h"
14 #include "GaudiKernel/FileIncident.h"
15 #include "GaudiKernel/ConcurrencyFlags.h"
21 m_metaDataSvc(
"MetaDataSvc",
name),
22 m_fileSequenceNumber(-1)
35 if (!incsvc.retrieve().isSuccess()) {
37 return(StatusCode::FAILURE);
41 incsvc->addListener(
this, IncidentType::BeginProcessing, 100);
47 return StatusCode::FAILURE;
61 return(StatusCode::SUCCESS);
69 return(StatusCode::SUCCESS);
77 return(::AthService::queryInterface(riid, ppvInterface));
80 return(StatusCode::SUCCESS);
85 return Gaudi::Concurrency::ConcurrencyFlags::numConcurrentEvents() > 1;
96 auto slot = Gaudi::Hive::currentContext().slot();
97 bool has_context = ( slot != EventContext::INVALID_CONTEXT_ID );
99 if( !has_context ) slot = 0;
102 << (!has_context?
" NO event context":
"") );
106 const FileIncident* fileInc =
dynamic_cast<const FileIncident*
>(&inc);
107 if (fileInc !=
nullptr) {
108 rangeID = fileInc->fileName();
109 ATH_MSG_DEBUG(
"Requested (through incident) Next Event Range filename extension: " << rangeID);
112 if( rangeID ==
"dummy" ) {
118 bool disconnect {
true };
120 throw GaudiException(
"Cannot transition MetaData",
name(), StatusCode::FAILURE);
128 std::lock_guard lockg(
m_mutex );
130 if( rangeID.empty() ) {
131 std::ostringstream
n;
134 ATH_MSG_DEBUG(
"Default next event range filename extension: " << rangeID);
150 bool disconnect {
false };
152 if( !
m_metaDataSvc->transitionMetaDataFile(
"" , disconnect ).isSuccess() ) {
153 throw GaudiException(
"Cannot transition MetaData",
name(), StatusCode::FAILURE);
157 else if( inc.type() == IncidentType::BeginProcessing ) {
160 std::lock_guard lockg(
m_mutex );
177 std::lock_guard lockg(
m_mutex );
179 std::string fileNameCore = orgFileName, fileNameExt;
180 std::size_t sepPos = orgFileName.find(
'[');
181 if (sepPos != std::string::npos) {
182 fileNameCore = orgFileName.substr(0, sepPos);
183 fileNameExt = orgFileName.substr(sepPos);
185 std::ostringstream
n;
186 n << fileNameCore <<
"." << rangeID << fileNameExt;
199 if( !
inUse() )
return "";
200 auto slot = Gaudi::Hive::currentContext().slot();
201 if( slot == EventContext::INVALID_CONTEXT_ID ) slot = 0;
202 std::lock_guard lockg(
m_mutex );
210 auto slot = Gaudi::Hive::currentContext().slot();
211 if( slot == EventContext::INVALID_CONTEXT_ID ) slot = 0;
212 std::lock_guard lockg(
m_mutex );
214 throw std::runtime_error(
"OutputStreamSequencer::setRangeID(): slot out of range");
224 std::lock_guard lockg(
m_mutex );
234 std::lock_guard lockg(
m_mutex );