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 ) {
71 auto dxcontainer = std::make_unique<StrawDxContainer>();
82 return StatusCode::SUCCESS;
88 ATH_MSG_INFO (
"TRT_StrawAlignDbSvc finalize method called");
89 return StatusCode::SUCCESS;
94 ATH_MSG_INFO (
" Write straw alignment data to text file " << filename);
95 std::ofstream outfile(filename.c_str());
101 StrawDxContainer::FlatContainer packedstrawdata ;
103 dxcontainer->getall( packedstrawdata ) ;
107 << packedstrawdata.size());
109 for(
auto & it : packedstrawdata) {
112 float dx1=dxcontainer->getDx1(calid) ;
113 float dx2=dxcontainer->getDx2(calid) ;
114 float dxerr=dxcontainer->getDxErr(calid) ;
115 outfile << calid <<
" "
116 << std::setprecision(5)
117 << std::setw(12) << dx1 <<
" "
118 << std::setw(12) << dx2 <<
" "
119 << std::setw(12) << dxerr << std::endl ;
122 return StatusCode::SUCCESS ;
134 const std::string& filename)
136 ATH_MSG_INFO (
"Reading straw alignment data from text file " << filename);
140 return StatusCode::FAILURE;
142 dxcontainer->clear() ;
143 std::ifstream infile(filename.c_str()) ;
147 while ((infile >>
id >> dx1 >> dx2 >> dxerr ) ) {
148 setDx(
id,dx1,dx2,dxerr) ;
149 ATH_MSG_DEBUG (
" read from file: dx1 " << dx1 <<
" dx2 " << dx2 <<
" dxerr " << dxerr);
152 size_t dxfootprint = dxcontainer->footprint() ;
160 return StatusCode::SUCCESS ;
182 ATH_MSG_INFO (
" Streamed out and committed " << typeKeys.size() <<
" objects ");
183 return StatusCode::SUCCESS;
190 ATH_MSG_INFO (
"Run/evt1 [" << run1 <<
"," << event1 <<
"]");
191 ATH_MSG_INFO (
"Run/evt2 [" << run2 <<
"," << event2 <<
"]");
194 SmartIF<IIOVRegistrationSvc> regsvc{service(
"IOVRegistrationSvc")};
197 if (StatusCode::SUCCESS==regsvc->registerIOV(StrawDxContainer::classname(),
203 return( StatusCode::SUCCESS);
218 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