27 #include "GaudiCoreSvcVersion.h"
41 #define ON_DEBUG if (UNLIKELY(m_outputLevel <= MSG::DEBUG))
42 #define ON_VERBOSE if (UNLIKELY(m_outputLevel <= MSG::VERBOSE))
66 m_svcLocator = svcManager();
73 m_name =
"ApplicationMgr";
77 m_propertyMgr->declareProperty(
"Go", m_SIGo = 0 );
78 m_propertyMgr->declareProperty(
"Exit", m_SIExit = 0 );
79 m_propertyMgr->declareProperty(
"Dlls", m_dllNameList );
80 m_propertyMgr->declareProperty(
"ExtSvc", m_extSvcNameList );
81 m_propertyMgr->declareProperty(
"CreateSvc", m_createSvcNameList );
82 m_propertyMgr->declareProperty(
"ExtSvcCreates", m_extSvcCreates=
true );
84 m_propertyMgr->declareProperty(
"SvcMapping", m_svcMapping );
85 m_propertyMgr->declareProperty(
"SvcOptMapping", m_svcOptMapping );
87 m_propertyMgr->declareProperty(
"TopAlg", m_topAlgNameList );
88 m_propertyMgr->declareProperty(
"OutStream", m_outStreamNameList );
89 m_propertyMgr->declareProperty(
"OutStreamType", m_outStreamType =
"OutputStream" );
90 m_propertyMgr->declareProperty(
"MessageSvcType",m_messageSvcType=
"MessageSvc" );
91 m_propertyMgr->declareProperty(
"JobOptionsSvcType",
92 m_jobOptionsSvcType =
"JobOptionsSvc" );
93 m_propertyMgr->declareProperty(
s_runable, m_runableType =
"AppMgrRunable");
94 m_propertyMgr->declareProperty(
s_eventloop, m_eventLoopMgr =
"EventLoopMgr");
96 m_propertyMgr->declareProperty(
"HistogramPersistency", m_histPersName=
"NONE");
99 m_propertyMgr->declareProperty(
"JobOptionsType", m_jobOptionsType =
"FILE");
100 m_propertyMgr->declareProperty(
"JobOptionsPath", m_jobOptionsPath =
"");
101 m_propertyMgr->declareProperty(
"EvtMax", m_evtMax = -1);
102 m_propertyMgr->declareProperty(
"EvtSel", m_evtsel );
103 m_propertyMgr->declareProperty(
"OutputLevel", m_outputLevel =
MSG::INFO);
105 m_propertyMgr->declareProperty(
"MultiThreadExtSvc", m_multiThreadSvcNameList);
106 m_propertyMgr->declareProperty(
"NoOfThreads", m_noOfEvtThreads = 0);
107 m_propertyMgr->declareProperty(
"AppName", m_appName =
"ApplicationMgr");
108 m_propertyMgr->declareProperty(
"AppVersion", m_appVersion =
"");
110 m_propertyMgr->declareProperty(
"AuditTools", m_auditTools =
false);
111 m_propertyMgr->declareProperty(
"AuditServices", m_auditSvcs =
false);
112 m_propertyMgr->declareProperty(
"AuditAlgorithms", m_auditAlgs =
false);
114 m_propertyMgr->declareProperty(
"ActivateHistory", m_actHistory =
false);
115 m_propertyMgr->declareProperty(
"StatusCodeCheck", m_codeCheck =
false);
117 m_propertyMgr->declareProperty(
"Environment", m_environment);
120 m_propertyMgr->declareProperty(
"InitializationLoopCheck", m_loopCheck =
true)
122 svcManager()->setLoopCheckEnabled(m_loopCheck);
125 m_propertyMgr->declareProperty
127 m_propertiesPrint =
false,
128 "Flag to activate the printout of properties" );
130 m_propertyMgr->declareProperty(
"ReflexPluginDebugLevel", m_reflexDebugLevel = 0 );
132 m_propertyMgr->declareProperty(
"StopOnSignal", m_stopOnSignal =
false,
133 "Flag to enable/disable the signal handler that schedule a stop of the event loop");
135 m_propertyMgr->declareProperty(
"StalledEventMonitoring", m_stalledEventMonitoring =
false,
136 "Flag to enable/disable the monitoring and reporting of stalled events");
139 "Return code of the application. Set internally in case of error conditions.");
148 m_svcMapping.push_back(
"EvtDataSvc/EventDataSvc");
149 m_svcMapping.push_back(
"DetDataSvc/DetectorDataSvc");
150 m_svcMapping.push_back(
"HistogramSvc/HistogramDataSvc");
151 m_svcMapping.push_back(
"HbookCnv::PersSvc/HbookHistSvc");
152 m_svcMapping.push_back(
"RootHistCnv::PersSvc/RootHistSvc");
153 m_svcMapping.push_back(
"EvtPersistencySvc/EventPersistencySvc");
154 m_svcMapping.push_back(
"DetPersistencySvc/DetectorPersistencySvc");
155 m_svcMapping.push_back(
"HistogramPersistencySvc/HistogramPersistencySvc");
183 {
return serviceLocator()-> queryInterface ( iid , ppvi ) ; }
185 {
return svcManager() -> queryInterface ( iid , ppvi ) ; }
187 {
return algManager() -> queryInterface ( iid , ppvi ) ; }
189 {
return m_classManager -> queryInterface ( iid , ppvi ) ; }
191 {
return m_propertyMgr -> queryInterface ( iid , ppvi ) ; }
194 *ppvi =
reinterpret_cast<void*
>(m_messageSvc.get());
196 m_messageSvc->addRef();
224 fatal() <<
"Error creating JobOptionsSvc" <<
endmsg;
229 if ( !jobOptsIProp.
isValid() ) {
230 fatal() <<
"Error locating JobOptionsSvc" <<
endmsg;
235 fatal() <<
"Error setting TYPE option in JobOptionsSvc" <<
endmsg;
242 fatal() <<
"Error setting PATH option in JobOptionsSvc" <<
endmsg;
246 else if (
isEnvSet(
"JOBOPTPATH") ) {
251 <<
"Error setting PATH option in JobOptionsSvc from env"
258 "../options/job.opts"));
261 <<
"Error setting PATH option in JobOptionsSvc to default"
266 jobOptsIProp->release();
272 msgSvcIProp->release();
274 sc = jobsvc->sysInitialize();
276 fatal() <<
"Error initializing JobOptionsSvc" <<
endmsg;
279 sc = msgsvc->sysInitialize();
281 fatal() <<
"Error initializing MessageSvc" <<
endmsg;
288 fatal() <<
"Error retrieving MessageSvc." <<
endmsg;
293 fatal() <<
"Error retrieving JobOptionsSvc." <<
endmsg;
312 <<
"configure: Invalid state \"" <<
m_state <<
"\"" <<
endmsg;
333 log <<
MSG::WARNING <<
"Problems getting my properties from JobOptionsSvc"
345 <<
"=================================================================="
346 <<
"=================================================================="
359 #if GAUDICORESVC_PATCH_VERSION
371 <<
"=================================================================="
372 <<
"=================================================================="
382 <<
"List of ALL properties of "
384 <<
" #properties = " << properties.size() <<
endmsg ;
385 for ( Properties::const_iterator property = properties.begin() ;
386 properties.end() != property ; ++property )
387 { log <<
"Property ['Name': Value] = " << ( **property) <<
endmsg ; }
395 log <<
MSG::FATAL <<
"Error adding StatusCodeSvc for multiple threads" <<
endmsg;
408 const MSG::Level lvl = (!old.empty() && (old !=
"UNKNOWN" ))
412 log << lvl <<
"Setting " << name <<
" = " << value <<
endmsg;
419 Gaudi::Utils::TypeNameString
itm(*j);
421 log <<
MSG::ERROR <<
"configure: declaring svc type:'" << *j <<
"' failed." <<
endmsg;
426 Gaudi::Utils::TypeNameString
itm(*j);
428 log <<
MSG::ERROR <<
"configure: declaring svc type:'" << *j <<
"' failed." <<
endmsg;
445 log <<
MSG::ERROR <<
"Failure during external service association" <<
endmsg;
451 log <<
MSG::ERROR <<
"Failure during multi thread service creation"
485 <<
"\n Check option ApplicationMgr." <<
s_eventloop
486 <<
"\n No events will be processed." <<
endmsg;
512 log <<
MSG::FATAL <<
"Error adding HistorySvc for multiple threads"
519 log <<
MSG::INFO <<
"Application Manager Configured successfully" <<
endmsg;
536 std::string svcname(
"Gaudi::Utils::StopSignalHandler");
539 log <<
MSG::INFO <<
"Cannot instantiate " << svcname <<
"signals will be ignored" <<
endmsg;
548 log <<
MSG::INFO <<
"Cannot instantiate " << svcname <<
"signals will be ignored" <<
endmsg;
558 <<
"initialize: Invalid state \"" <<
m_state <<
"\"" <<
endmsg;
572 log <<
MSG::INFO <<
"Application Manager Initialized successfully" <<
endmsg;
606 log <<
MSG::INFO <<
"Application Manager Started successfully" <<
endmsg;
624 log <<
MSG::FATAL <<
"No event processing manager specified. Check option:"
663 log <<
MSG::INFO <<
"Application Manager Stopped successfully" <<
endmsg;
710 log <<
MSG::INFO <<
"Application Manager Finalized successfully" <<
endmsg;
738 log <<
MSG::INFO <<
"Application Manager Terminated successfully" <<
endmsg;
759 log <<
MSG::ERROR <<
"Could not get the IService interface of the MessageSvc" <<
endmsg;
761 svc->sysFinalize().ignore();
767 log <<
MSG::ERROR <<
"Could not get the IService interface of the JobOptionsSvc" <<
endmsg;
769 svc->sysFinalize().ignore();
855 log <<
MSG::FATAL <<
"Application execution failed. Ending the job."
859 log <<
MSG::FATAL <<
"Application has no runable object. Check option:"
943 throw GaudiException(
"Cannot reinitialize application if not INITIALIZED or RUNNING",
1006 props->setProperty( p ).ignore();
1017 "MinimalEventLoopMgr::createSvcNameListHandler",
1030 Gaudi::Utils::TypeNameString
item(*it++);
1031 if( (result =
svcManager()->addService(item, 10) ).isFailure()) {
1033 log <<
MSG::ERROR <<
"decodeCreateSvcNameList: Cannot create service "
1034 << item.type() <<
"/" << item.name() <<
endmsg;
1038 log <<
MSG::DEBUG <<
"decodeCreateSvcNameList: Created service "
1039 << item.type() <<
"/" << item.name() <<
endmsg;
1052 "MinimalEventLoopMgr::extSvcNameListHandler",
1068 Gaudi::Utils::TypeNameString
item(*it++);
1070 if ( (result =
svcManager()->addService(item, 10)).isFailure()) {
1072 log <<
MSG::ERROR <<
"decodeExtSvcNameList: Cannot create service "
1073 << item.type() <<
"/" << item.name() <<
endmsg;
1076 if( ( result =
svcManager()->declareSvcType(item.name(),
1077 item.type()) ).isFailure()) {
1079 log <<
MSG::ERROR <<
"decodeExtSvcNameList: Cannot declare service "
1080 << item.type() <<
"/" << item.name() <<
endmsg;
1093 "MinimalEventLoopMgr::multiThreadSvcNameListHandler",
1107 it != theNames.
end();
1109 Gaudi::Utils::TypeNameString
item(*it);
1115 <<
"decodeMultiThreadSvcNameList: Cannot create service "
1116 << item.type() <<
"/" << item.name() <<
endmsg;
1121 <<
"decodeMultiThreadSvcNameList: created service "
1122 << item.type() <<
"/" << item.name() <<
endmsg;
1137 result =
svcManager()->declareSvcType(name, type);
1139 log <<
MSG::ERROR <<
"declareMultiSvcType: Cannot declare service "
1140 << type <<
"/" << name <<
endmsg;
1143 log <<
MSG::VERBOSE <<
"declareMultiSvcType: declared service "
1144 << type <<
"/" << name <<
endmsg;
1149 result =
svcManager()->declareSvcType(thrName, type);
1151 log <<
MSG::ERROR <<
"declareMultiSvcType: Cannot declare service "
1152 << type <<
"/" << thrName <<
endmsg;
1155 log <<
MSG::VERBOSE <<
"declareMultiSvcType: declared service "
1156 << type <<
"/" << thrName <<
endmsg;
1167 using Gaudi::Utils::TypeNameString;
1171 result =
svcManager()->addService(typeName, prio);
1174 log <<
MSG::ERROR <<
"addMultiSvc: Cannot add service "
1175 << typeName.type() <<
"/" << typeName.name() <<
endmsg;
1179 << typeName.type() <<
"/" << typeName.name() <<
endmsg;
1185 result =
svcManager()->addService(TypeNameString(thrName, type), prio);
1186 if( result.isFailure() ) {
1187 log <<
MSG::ERROR <<
"addMultiSvc: Cannot add service "
1188 << type <<
"/" << thrName <<
endmsg;
1192 << type <<
"/" << thrName <<
endmsg;
1205 "MinimalEventLoopMgr::dllNameListHandler",
1224 if ( 0 == dllInList[*it] ) {
1226 }
else { ++duplicateList[*it]; }
1233 log <<
MSG::DEBUG <<
"Removed duplicate entries for modules : ";
1235 it != duplicateList.
end(); ++it ) {
1236 log << it->first <<
"(" << 1+it->second <<
")";
1237 if ( it != --duplicateList.
end() ) log <<
", ";
1251 for (it = theNames.
begin(); it != theNames.
end(); it++) {
1266 if ( !successNames.
empty() ) {
1267 log <<
MSG::INFO <<
"Successfully loaded modules : ";
1268 for (it = successNames.
begin(); it != successNames.
end(); it++) {
1270 if( (it+1) != successNames.
end()) log <<
", ";
1279 for (it = failNames.
begin(); it != failNames.
end(); it++) {
1281 if( (it+1) != failNames.
end()) log <<
", ";
1296 <<
"Updating ROOT::Reflex::PluginService::SetDebug(level) to level="