18#include "GaudiKernel/IToolSvc.h"
22#include "Identifier/Identifier.h"
28 ISvcLocator* pSvcLocator )
29 : base_class(name,pSvcLocator),
36 m_streamer(
"AthenaOutputStreamTool/CondStream1")
51 ATH_MSG_INFO (
"TRT_StrawAlignDbSvc initialize method called");
59 if( dxcontainerexists ) {
66 auto dxcontainer = std::make_unique<StrawDxContainer>();
77 return StatusCode::SUCCESS;
83 ATH_MSG_INFO (
"TRT_StrawAlignDbSvc finalize method called");
84 return StatusCode::SUCCESS;
89 ATH_MSG_INFO (
" Write straw alignment data to text file " << filename);
90 std::ofstream outfile(filename.c_str());
96 StrawDxContainer::FlatContainer packedstrawdata ;
98 dxcontainer->getall( packedstrawdata ) ;
102 << packedstrawdata.size());
104 for(
auto & it : packedstrawdata) {
107 float dx1=dxcontainer->getDx1(calid) ;
108 float dx2=dxcontainer->getDx2(calid) ;
109 float dxerr=dxcontainer->getDxErr(calid) ;
110 outfile << calid <<
" "
111 << std::setprecision(5)
112 << std::setw(12) << dx1 <<
" "
113 << std::setw(12) << dx2 <<
" "
114 << std::setw(12) << dxerr << std::endl ;
117 return StatusCode::SUCCESS ;
129 const std::string& filename)
131 ATH_MSG_INFO (
"Reading straw alignment data from text file " << filename);
135 return StatusCode::FAILURE;
137 dxcontainer->clear() ;
138 std::ifstream infile(filename.c_str()) ;
142 while ((infile >>
id >> dx1 >> dx2 >> dxerr ) ) {
143 setDx(
id,dx1,dx2,dxerr) ;
144 ATH_MSG_DEBUG (
" read from file: dx1 " << dx1 <<
" dx2 " << dx2 <<
" dxerr " << dxerr);
147 size_t dxfootprint = dxcontainer->footprint() ;
155 return StatusCode::SUCCESS ;
177 ATH_MSG_INFO (
" Streamed out and committed " << typeKeys.size() <<
" objects ");
178 return StatusCode::SUCCESS;
185 ATH_MSG_INFO (
"Run/evt1 [" << run1 <<
"," << event1 <<
"]");
186 ATH_MSG_INFO (
"Run/evt2 [" << run2 <<
"," << event2 <<
"]");
189 SmartIF<IIOVRegistrationSvc> regsvc{service(
"IOVRegistrationSvc")};
192 if (StatusCode::SUCCESS==regsvc->registerIOV(StrawDxContainer::classname(),
198 return( StatusCode::SUCCESS);
213 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
This is an interface to a tool used to register conditions objects in the Interval of Validity (IOV) ...
interface to TRT straw alignment constants
#define ATLAS_NO_CHECK_FILE_THREAD_SAFETY
Identifier for TRT detector elements in the conditions code.
TRT_StrawAlignDbSvc(const std::string &name, ISvcLocator *pSvcLocator)
constructor
virtual StatusCode readTextFile(const std::string &file)
read calibration from text file into TDS
virtual ~TRT_StrawAlignDbSvc()
destructor
StatusCode writeTextFile(const std::string &file) const
write calibration constants to flat text file
std::string m_par_strawtextfile
const InDetDD::TRT_DetectorManager * m_trtman
void setDx(const TRTCond::ExpandedIdentifier &id, float dx1, float dx2, float dxerr)
set endpoints for a TRTCond::ExpandedIdentifier
virtual StatusCode finalize()
tool finalize
StatusCode streamOutObjects() const
write the calibration objects to output, after cleaning
StatusCode IOVCallBack()
IOV call back for dx objects. normally this doesn't do anything.
virtual StatusCode initialize()
tool initialize
StrawDxContainer * getDxContainer() const
access to containers
StatusCode registerObjects(std::string tag, int run1, int event1, int run2, int event2) const
register calibration objects with the IoV service
const StrawDxContainer * getConstDxContainer() const
ServiceHandle< StoreGateSvc > m_detStore
std::string m_par_dxcontainerkey
ToolHandle< IAthenaOutputStreamTool > m_streamer