|
ATLAS Offline Software
|
Go to the documentation of this file.
11 #include "CLHEP/Vector/LorentzVector.h"
35 ATH_MSG_ERROR(
"Something went wrong with setting up the vertex positioning from file '"
37 return StatusCode::FAILURE;
43 ATH_MSG_ERROR(
"Something went wrong with setting up the run/event number overrides from file'"
45 return StatusCode::FAILURE;
51 return StatusCode::SUCCESS;
58 return StatusCode::SUCCESS;
64 ATH_MSG_INFO(
"Will read in vertex positions from file.");
68 return StatusCode::FAILURE;
76 unsigned int numReadIn(0);
80 int r = fscanf(vfile,
"%i %i %lf %lf %lf\n", &vrun, &vevent, &vx, &vy, &vz);
84 <<
"/"<<vevent<<
" "<<vx<<
","<<vy<<
","<<vz);
89 if ( curCoordinates.size()!=0) {
90 ATH_MSG_WARNING(
"Already position information for run/event "<<vrun<<
"/"<<vevent
91 <<
", size=" << curCoordinates.size() );
94 curCoordinates.resize(3);
97 curCoordinates[0] = vx;
98 curCoordinates[1] = vy;
99 curCoordinates[2] = vz;
113 ATH_MSG_VERBOSE(
"Read " << numReadIn <<
" vertex position entries from file.");
114 return StatusCode::SUCCESS;
123 return StatusCode::FAILURE;
136 int r = fscanf(vefile,
"svcMgr.EvtIdModifierSvc.add_modifier(run_nbr=%i, evt_nbr=%i, time_stamp=%i, lbk_nbr=%i, nevts=%i)\n",
137 &verun, &veevent, &vetime, &velbn, &ven);
141 ATH_MSG_DEBUG(
"Read "<<
r<<
" vertex positioning run/event values: "
142 <<verun<<
"/"<<veevent<<
" "<<vetime<<
"," <<velbn<<
","<<ven );
156 ATH_MSG_VERBOSE(
"Read " << numReadIn <<
" vertex positioning run/event entries from file.");
157 return StatusCode::SUCCESS;
167 static std::atomic<size_t> runEventNumbersIndex(0);
168 ATH_MSG_DEBUG(
"Retrieving event info from event file, position " << runEventNumbersIndex);
171 ++runEventNumbersIndex;
191 ATH_MSG_DEBUG(
"Got vertex offset: " << updatedVertexPosition[0] <<
" " <<
192 updatedVertexPosition[1] <<
" " << updatedVertexPosition[2]);
194 if (updatedVertexPosition.size()!=3) {
195 ATH_MSG_ERROR(
"Vertex position requested, but no info found in map for run/event: " <<
200 CLHEP::HepLorentzVector *vertexOffset =
201 new CLHEP::HepLorentzVector( updatedVertexPosition[0], updatedVertexPosition[1],
202 updatedVertexPosition[2], 0. );
Gaudi::Property< std::string > m_runEventNumbersFile
run and event number overrides according to file (to be used optionally in combination with 'set vert...
StatusCode finalize() override final
Athena algtool's Hooks.
std::vector< double > XYZCoordinates
uint64_t eventNumber() const
The current event's event number.
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Name of the EventInfo object in StoreGate.
#define ATH_MSG_VERBOSE(x)
VertexPositionFromFile(const std::string &t, const std::string &n, const IInterface *p)
Constructor with parameters.
StatusCode initialize() override final
Athena algtool's Hooks.
uint32_t runNumber() const
The current event's run number.
EventCoordinatesMap m_vertexPositionMap
vertex position for (run,event) pairs
StatusCode readVertexPosFile()
read-in and cache vertex positions from file
::StatusCode StatusCode
StatusCode definition for legacy code.
CLHEP::HepLorentzVector * generate(const EventContext &ctx) const override final
returns current shift
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
std::vector< int > m_vertexPositionEventNum
event number override vector
std::vector< int > m_vertexPositionRunNum
run number override vector
Gaudi::Property< std::string > m_vertexPositionFile
set vertex position by file
#define ATH_MSG_WARNING(x)
StatusCode readRunEventNumFile()
read-in and cache run/event number overrides locally for vertex positioning
Handle class for reading from StoreGate.
std::pair< int, int > RunEventPair
using typedefs to make code more readable for (run,event) -> (x,y,z) mapping