 |
ATLAS Offline Software
|
Go to the documentation of this file.
12 #include "Gaudi/Interfaces/IOptionsSvc.h"
13 #include "GaudiKernel/IAlgTool.h"
14 #include "GaudiKernel/IEvtSelector.h"
15 #include "GaudiKernel/IIncidentSvc.h"
16 #include "GaudiKernel/IIoComponentMgr.h"
17 #include "GaudiKernel/IOpaqueAddress.h"
18 #include "GaudiKernel/FileIncident.h"
19 #include "GaudiKernel/System.h"
32 #include "boost/bind/bind.hpp"
43 bool leftString(std::string&
s,
char sc) {
44 if (
const auto pos =
s.find(
sc);
pos != std::string::npos) {
55 : base_class(
name, pSvcLocator )
56 , m_inputDataStore(
"StoreGateSvc/InputMetaDataStore",
name )
57 , m_outputDataStore(
"StoreGateSvc/MetaDataStore",
name )
58 , m_fileMgr(
"FileMgr",
name )
59 , m_incSvc(
"IncidentSvc",
name )
60 , m_outSeqSvc(
"OutputStreamSequencerSvc",
name )
61 , m_persToClid{ {
"DataHeader_p5", 222376821 },
62 {
"EventStreamInfo_p3", 167728019 },
63 {
"ByteStreamMetadataContainer_p1", 1076128893 },
64 {
"IOVMetaDataContainer_p1", 1316383046 },
65 {
"xAOD::EventFormat_v1", 243004407 },
66 {
"xAOD::CutBookkeeperContainer_v1", 1234982351 },
67 {
"xAOD::CutBookkeeperAuxContainer_v1", 1147935274 },
68 {
"xAOD::TriggerMenuContainer_v1", 1107011239 },
69 {
"DataVector<xAOD::TriggerMenu_v1>", 1107011239 },
70 {
"xAOD::TriggerMenuAuxContainer_v1", 1212409402 },
71 {
"xAOD::TriggerMenuJsonContainer_v1", 1221262614 },
72 {
"DataVector<xAOD::TriggerMenuJson_v1>", 1221262614 },
73 {
"xAOD::TriggerMenuJsonAuxContainer_v1", 373045213 },
74 {
"xAOD::LumiBlockRangeContainer_v1", 1115934851 },
75 {
"DataVector<xAOD::LumiBlockRange_v1>", 1115934851 },
76 {
"xAOD::LumiBlockRangeAuxContainer_v1", 1251061086 },
77 {
"xAOD::FileMetaData_v1", 178309087 },
78 {
"xAOD::FileMetaDataAuxInfo_v1", 73252552 },
79 {
"xAOD::RingSetConfContainer_v1", 1157997427 },
80 {
"DataVector<xAOD::RingSetConf_v1>", 1157997427 },
81 {
"xAOD::RingSetConfAuxContainer_v1", 1307745126 },
82 {
"xAOD::TruthMetaDataContainer_v1", 1188015687 },
83 {
"DataVector<xAOD::TruthMetaData_v1>", 1188015687 },
84 {
"xAOD::TruthMetaDataAuxContainer_v1", 1094306618 } } {}
115 m_incSvc->addListener(
this,
"FirstInputFile", 80,
true);
116 m_incSvc->addListener(
this,
"BeginInputFile", 80,
true);
117 m_incSvc->addListener(
this,
"EndInputFile", 10,
true);
118 m_incSvc->addListener(
this,
"BeginInputMemFile", 80,
true);
119 m_incSvc->addListener(
this,
"EndInputMemFile", 10,
true);
127 if (!joSvc.retrieve().isSuccess()) {
130 if (joSvc->has(
"EventSelector.InputCollections")) {
133 if (!evtsel.retrieve().isSuccess()) {
141 return(StatusCode::SUCCESS);
146 if (!
m_incSvc.release().isSuccess()) {
165 return(StatusCode::SUCCESS);
172 Incident metaDataStopIncident(
name(),
"MetaDataStop");
173 m_incSvc->fireIncident(metaDataStopIncident);
174 return(StatusCode::SUCCESS);
180 return(StatusCode::SUCCESS);
183 std::list<SG::ObjectWithVersion<DataHeader> > allVersions;
185 if (!
sc.isSuccess()) {
186 ATH_MSG_WARNING(
"Could not retrieve all versions for DataHeader, will not read Metadata");
192 if (dataHeader ==
nullptr) {
193 ATH_MSG_ERROR(
"Could not get DataHeader, will not read Metadata");
194 return(StatusCode::FAILURE);
197 const CLID clid = dhe.getPrimaryClassID();
200 std::string
key = dhe.getKey();
201 if (verNumber != 0) {
204 tads.push_back(dhe.getAddress(
key));
209 return(StatusCode::SUCCESS);
214 const FileIncident* fileInc =
dynamic_cast<const FileIncident*
>(&inc);
215 if (fileInc ==
nullptr) {
216 ATH_MSG_ERROR(
"Unable to get FileName from EndInputFile incident");
217 return StatusCode::FAILURE;
219 const std::string
guid = fileInc->fileGuid();
220 const std::string
fileName = fileInc->fileName();
222 if (!
fileName.starts_with(
"BSF:")) {
235 if (
tool->beginInputFile(
guid).isFailure()) {
237 rc = StatusCode::FAILURE;
245 const FileIncident* fileInc =
dynamic_cast<const FileIncident*
>(&inc);
246 if (fileInc ==
nullptr) {
247 ATH_MSG_ERROR(
"Unable to get FileName from EndInputFile incident");
248 return StatusCode::FAILURE;
250 const std::string
guid = fileInc->fileGuid();
251 ATH_MSG_DEBUG(
"retireMetadataSource: " << fileInc->fileName());
257 return StatusCode::SUCCESS;
263 return StatusCode::SUCCESS;
269 if (
tool->metaDataStop().isFailure()) {
271 rc = StatusCode::FAILURE;
295 if (
tool->metaDataStop().isFailure()) {
297 rc = StatusCode::FAILURE;
316 return StatusCode::SUCCESS;
321 const FileIncident* fileInc =
dynamic_cast<const FileIncident*
>(&inc);
322 if (fileInc ==
nullptr) {
323 ATH_MSG_ERROR(
"Unable to get FileName from EndInputFile incident");
326 const std::string
fileName = fileInc->fileName();
329 if (inc.type() ==
"FirstInputFile") {
331 using namespace boost::placeholders;
333 if (
m_fileMgr->regAction(std::move(boa), Io::OPEN).isFailure()) {
334 ATH_MSG_FATAL(
"Cannot register ROOT file open action with FileMgr.");
339 }
else if (inc.type() ==
"BeginInputFile" || inc.type() ==
"BeginInputMemFile") {
343 }
else if (inc.type() ==
"EndInputFile" || inc.type() ==
"EndInputMemFile") {
357 FileIncident inc(
"transitionMetaDataFile",
"EndInputFile",
"dummyMetaInputFileName",
"");
363 Incident metaDataStopIncident(
name(),
"MetaDataStop");
364 m_incSvc->fireIncident(metaDataStopIncident);
375 return(StatusCode::SUCCESS);
387 return(StatusCode::SUCCESS);
391 return(StatusCode::SUCCESS);
398 if(
pos==std::string::npos )
return "";
417 std::string
fileName = tokenStr.substr(tokenStr.find(
"[FILE=") + 6);
419 std::string
className = tokenStr.substr(tokenStr.find(
"[PNAME=") + 7);
421 std::string contName = tokenStr.substr(tokenStr.find(
"[CONT=") + 6);
422 leftString(contName,
']');
423 std::size_t pos1 = contName.find(
'(');
424 std::string
keyName = contName.substr(pos1 + 1, contName.size() - pos1 - 2);
425 std::size_t pos2 =
keyName.find(
'/');
426 if (pos2 != std::string::npos)
keyName =
keyName.substr(pos2 + 1);
427 std::string numName = tokenStr.substr(tokenStr.find(
"[NUM=") + 5);
428 leftString(numName,
']');
429 unsigned long num = 0;
430 std::istringstream iss(numName);
436 if( clid == 178309087 ) {
442 if( clid == 73252552 ) {
453 const unsigned long ipar[2] = {
num , 0 };
454 IOpaqueAddress* opqAddr =
nullptr;
461 ATH_MSG_FATAL(
"addProxyToInputMetaDataStore: Cannot create address for " << tokenStr);
462 return(StatusCode::FAILURE);
465 delete opqAddr; opqAddr =
nullptr;
466 ATH_MSG_FATAL(
"addProxyToInputMetaDataStore: Cannot create proxy for " << tokenStr);
467 return(StatusCode::FAILURE);
470 ATH_MSG_FATAL(
"addProxyToInputMetaDataStore: Cannot access data for " << tokenStr);
471 return(StatusCode::FAILURE);
475 ATH_MSG_WARNING(
"addProxyToInputMetaDataStore: Cannot symlink to AuxStore for " << tokenStr);
477 return(StatusCode::SUCCESS);
485 ATH_MSG_DEBUG(
"MetaDataSvc called without MetaDataContainer set.");
486 return(StatusCode::SUCCESS);
488 if (
fileName.starts_with(
"BSF:")) {
490 }
else if (
fileName.compare(0, 3,
"SHM")==0) {
493 const std::string
par[2] = {
497 const std::string parOld[2] = {
501 for (
int verNumber = 0; verNumber < 100; verNumber++) {
504 ATH_MSG_DEBUG(
"initInputMetaDataStore: MetaData Store already contains DataHeader, key = " << myVersKey);
506 const unsigned long ipar[2] = { (
unsigned long)verNumber , 0 };
507 IOpaqueAddress* opqAddr =
nullptr;
514 delete opqAddr; opqAddr =
nullptr;
515 ATH_MSG_WARNING(
"initInputMetaDataStore: Cannot create proxy for DataHeader, key = " << myVersKey);
519 std::list<SG::TransientAddress*> tList;
522 CLID clid = tad->clID();
523 ATH_MSG_VERBOSE(
"initInputMetaDataStore: add proxy for clid = " << clid <<
", key = " << tad->name());
525 ATH_MSG_DEBUG(
"initInputMetaDataStore: MetaData Store already contains clid = " << clid <<
", key = " << tad->name());
528 ATH_MSG_ERROR(
"initInputMetaDataStore: Cannot create proxy for clid = " << clid <<
", key = " << tad->name());
529 return StatusCode::FAILURE;
533 for (
CLID tclid : tad->transientID()) {
537 clid <<
"/" << tad->name() <<
" to " << tclid);
546 return(StatusCode::SUCCESS);
559 ATH_MSG_DEBUG(
"Not translating metadata item ID #" << itemID);
563 std::string itemName;
565 if (
m_classIDSvc->getTypeNameOfID(itemID, itemName).isSuccess()) {
566 const std::string contName =
std::format(
"MetaCont<{}>", itemName);
567 ATH_MSG_DEBUG(
"Transforming " << contName <<
" to " << itemName
569 if (
m_classIDSvc->getIDOfTypeName(contName, contID).isSuccess())
585 <<
" ClassID: " << itemID);
597 <<
" ClassID: " << itemID);
constexpr char AUX_POSTFIX[]
Common post-fix for the names of auxiliary containers in StoreGate.
This file contains the class definition for the OutputStreamSequencerSvc class.
#define ATH_MSG_VERBOSE(x)
std::string typeinfoName(const std::type_info &ti)
Convert a type_info to a demangled string.
::StatusCode StatusCode
StatusCode definition for legacy code.
a StoreGateSvc key with a version number. Notice that StoreGate does not order multiple instances of ...
Default, invalid implementation of ClassID_traits.
uint32_t CLID
The Class ID type.
virtual StatusCode shmProxy(const std::string &filename) override
Loads file metadata from memory shared between streams in SharedWriter This function clears the input...
#define ATH_MSG_WARNING(x)
std::list< SG::TransientAddress * > tadList
virtual long repSvcType() const override
Retrieve the class type of the data store the converter uses.
virtual StatusCode disconnectOutput(const std::string &output)
Disconnect output files from the service.
associate a data object with its VersionedKey The object is held by a ReadHandle to delay its retriev...