14#include "GaudiKernel/ServiceHandle.h"
45 std::vector<std::string>::iterator GeoWriterNameItr =
m_GeoWriterNames.begin();
90 ATH_MSG_INFO(
"Retrieving default server streaming tool");
105 return StatusCode::SUCCESS;
117 bool isR4PinThisEvent =
false;
124 PyObject* pHelper = PyImport_ImportModule(
"EventDisplaysOnline.EventDisplaysOnlineHelpers");
128 ATH_MSG_WARNING(
"Failed to import EventDisplaysOnline.EventDisplaysOnlineHelpers module");
129 return StatusCode::FAILURE;
133 PyObject* Ready4Physics = PyObject_GetAttrString(pHelper,
"Ready4Physics");
134 if (!Ready4Physics || !PyCallable_Check(Ready4Physics)) {
136 ATH_MSG_WARNING(
"Could not find or call Ready4Physics function in EventDisplaysOnline.EventDisplaysOnlineHelpers module");
139 PyObject* r4p = PyObject_CallFunctionObjArgs(Ready4Physics, NULL);
145 isR4PinThisEvent = PyObject_IsTrue(r4p);
148 ATH_MSG_INFO(
"ATLAS was not ready for physics at the start of this job, but is now, so stopping job so that the partition can restart the jobs with any new configuration, i.e. after a warm start to pick back up pixel hits");
149 return StatusCode::FAILURE;
154 Py_XDECREF(Ready4Physics);
163 unsigned int runNo = 0, lumiBlock = 0;
168 std::string eventProperty =
"default";
171 std::string geometryVersion =
"default";
176 if (
evtStore()->retrieve(eventInfo).isFailure()){
178 return StatusCode::FAILURE;
184 <<
", lumiBlock: " << eventInfo->
lumiBlock()
185 <<
", timeStamp: " << eventInfo->
timeStamp()
186 <<
", bcid: " << eventInfo->
bcid()
200 ATH_MSG_INFO(
"Got a new run number, a new run has started whilst this job was running, stopping now to let the partition restart the jobs and pick up any new configuration");
201 return StatusCode::FAILURE;
209 unsigned int mcChannelNo = 0;
223 <<
" Index : " << subevt.index()
224 <<
" Provenance : " << subevt.type()
230 <<
" BCID : " << sevt->
bcid()
243 if ( mcChannelNo != 0 ){ runNo = mcChannelNo + 140000000; }
244 ATH_MSG_DEBUG(
" runNumber for filename: " << runNo <<
", eventNumber: " << eventNo);
251 if ( mcChannelNo != 0 ) lumiBlock = -1;
254 if ( lumiBlock > 1000000 ) { lumiBlock = 0; }
262 time_t unixtime = (time_t) eventInfo->
timeStamp();
264 localtime_r(&unixtime, &time);
265 strftime(dateTime, 32,
"%Y-%m-%d %H:%M:%S %Z", &time);
267 gmtime_r(&unixtime, &utctime);
268 found1 = (
DataType(dateTime).toString().find(
"CEST"));
269 found2 = (
DataType(dateTime).toString().find(
"CET"));
270 if (
int(found1)<0 &&
int(found2)<0 ){
271 strftime(dateTime, 32,
"%Y-%m-%d %H:%M:%S UTC", &utctime);
272 ATH_MSG_DEBUG(
" TIME NOT CET/CEST. Adjusted to:" << dateTime );
277 if ( mcChannelNo != 0 ){ dateTime[0] =
'\0'; }
282 if (
m_FormatTool->StartEvent(eventNo, runNo, dateTime, lumiBlock, eventProperty, geometryVersion).isFailure() ){
284 return StatusCode::FAILURE;
298 if ((*DataRetrieverItr)->retrieve(
m_FormatTool).isFailure()) {
299 ATH_MSG_WARNING(
"Failed to fill " << (*DataRetrieverItr)->dataTypeName() );
301 ATH_MSG_DEBUG(
"Filled: " << (*DataRetrieverItr)->dataTypeName() );
304 }
catch ( std::exception& ex ){
306 ATH_MSG_FATAL(
"Caught exception in " << (*DataRetrieverItr)->name()
307 <<
" while retrieving data for " << (*DataRetrieverItr)->dataTypeName()
308 <<
" : " << ex.what() );
310 return StatusCode::FAILURE;
320 return StatusCode::FAILURE;
339 return StatusCode::SUCCESS;
356 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
ServiceHandle< StoreGateSvc > & evtStore()
ToolHandle< JiveXML::IStreamTool > m_StreamToServerTool
AlgoJiveXML(const std::string &name, ISvcLocator *pSvcLocator)
ToolHandle< JiveXML::IStreamTool > m_StreamToFileTool
Streaming tools that pass the formatted XML text into a file, to a server, etc.
ToolHandle< JiveXML::IFormatTool > m_FormatTool
Handle to the formatting tool, which is passed on to the data retrievers and converts the data into X...
StatusCode execute()
Execute - called for every event.
Gaudi::Property< bool > m_writeToFile
StatusCode initialize()
Initialize - called once in the beginning.
uint32_t m_previousRunNumber
Gaudi::Property< bool > m_onlineMode
StatusCode finalize()
Finalize called once in the end.
Gaudi::Property< bool > m_writeGeometry
Gaudi::Property< bool > m_ready4PhysicsAtStart
Gaudi::Property< std::vector< std::string > > m_GeoWriterNames
Gaudi::Property< std::string > m_geometryVersionIn
ToolHandleArray< JiveXML::IDataRetriever > m_DataRetrieverTools
The list of DataRetrievers.
Gaudi::Property< std::string > m_AtlasRelease
Writes the inner detector and calorimeter geometry to an XML file for use with Atlantis.
virtual StatusCode writeGeometry() override
Writes the inner detector and calorimeter geometry to an XML file.
Class describing the properties of one pileup sub-event.
uint64_t mcEventNumber() const
The MC generator's event number.
uint32_t lumiBlock() const
The current event's luminosity block number.
uint32_t eventTypeBitmask() const
The event type bitmask.
uint32_t bcid() const
The bunch crossing ID of the event.
float averageInteractionsPerCrossing() const
Average interactions per crossing for all BCIDs - for out-of-time pile-up.
float actualInteractionsPerCrossing() const
Average interactions per crossing for the current BCID - for in-time pile-up.
uint32_t timeStamp() const
POSIX time in seconds from 1970. January 1st.
const std::vector< SubEvent > & subEvents() const
Get the pileup events that were used in the simulation.
uint32_t runNumber() const
The current event's run number.
uint32_t mcChannelNumber() const
The MC generator's channel number.
uint32_t timeStampNSOffset() const
Nanosecond time offset wrt. the time stamp.
uint64_t eventNumber() const
The current event's event number.
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
std::pair< std::string, std::string > TagType
Defines a tag as a pair of strings.
EventInfo_v1 EventInfo
Definition of the latest event info version.