ATLAS Offline Software
Loading...
Searching...
No Matches
TRT_StrawAlignDbSvc.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRT_CONDITIONSSERVICES_TRT_STRAWALIGNDBSVC_H
6#define TRT_CONDITIONSSERVICES_TRT_STRAWALIGNDBSVC_H
7
12
13#include <vector>
16#include "GaudiKernel/ToolHandle.h"
21#include "GaudiKernel/ServiceHandle.h"
22
23ATLAS_NO_CHECK_FILE_THREAD_SAFETY; // This class uses const_cast, regFcn (callback) and DataHandle. Legacy code
24
26namespace InDetDD {
27 class TRT_DetectorManager ;
28}
29
33class TRT_StrawAlignDbSvc: public extends<AthService, ITRT_StrawAlignDbSvc>
34{
35 public:
36
38 TRT_StrawAlignDbSvc( const std::string& name, ISvcLocator* pSvcLocator );
39
42
44 virtual StatusCode initialize();
45
47 virtual StatusCode finalize();
48
49 // methods to access straw alignment data
50
53
54 // methods to set straw alignment data
55
57 void setDx( const TRTCond::ExpandedIdentifier& id, float dx1, float dx2, float dxerr ) ;
58
59 // methods for persistence
60
62 StatusCode writeTextFile(const std::string& file) const;
63
65 virtual StatusCode readTextFile(const std::string& file);
66 StatusCode readTextFile(StrawDxContainer* dxcontainer,
67 const std::string& file);
68
70 StatusCode streamOutObjects () const;
71
73 StatusCode registerObjects(std::string tag, int run1, int event1, int run2, int event2) const;
74
75
77 StrawDxContainer* getDxContainer() const ;
78 const StrawDxContainer* getConstDxContainer() const ;
79
81 StatusCode IOVCallBack();
82
84 float getDx1( const Identifier& id ) const ;
86 float getDx2( const Identifier& id ) const ;
88 float getDxErr( const Identifier& id ) const ;
90 void setDx( const Identifier& id, float dx1, float dx2, float dxerr ) ;
91
92 private:
93
96 std::string m_par_strawtextfile;
98 const TRT_ID* m_trtid;
100
101 ToolHandle<IAthenaOutputStreamTool> m_streamer;
102
103};
104
106// inline methods
108
109inline TRT_StrawAlignDbSvc::StrawDxContainer* TRT_StrawAlignDbSvc::getDxContainer() const {
110 const StrawDxContainer* rc = getConstDxContainer();
111 return const_cast<StrawDxContainer*>(rc) ;
112}
113
114inline const TRT_StrawAlignDbSvc::StrawDxContainer*
116{
117 const StrawDxContainer* rc = nullptr;
118 if (m_detStore->retrieve (rc, m_par_dxcontainerkey).isFailure()) {
119 ATH_MSG_ERROR("Cannot retrieve " << m_par_dxcontainerkey);
120 }
121 return rc;
122}
123
125TRT_StrawAlignDbSvc::trtcondid( const Identifier& id, int level) const
126{
127 return TRTCond::ExpandedIdentifier( m_trtid->barrel_ec(id),m_trtid->layer_or_wheel(id),
128 m_trtid->phi_module(id),m_trtid->straw_layer(id),
129 m_trtid->straw(id),level ) ;
130}
131
132
133inline void
134TRT_StrawAlignDbSvc::setDx( const TRTCond::ExpandedIdentifier& id,float dx1, float dx2, float dxerr )
135{
136 //std::cout << " Setting the dx1 to " << dx1 << " dx2 to " << dx2 << std::endl;
137 getDxContainer()->setDx( id, dx1, dx2, dxerr);
138}
139
140inline float
145
146inline float
151
152inline float
157
158inline void
159TRT_StrawAlignDbSvc::setDx( const Identifier& id,float dx1, float dx2, float dxerr )
160{
161 setDx( trtcondid(id,TRTCond::ExpandedIdentifier::STRAW), dx1, dx2, dxerr) ;
162}
163
164#endif // TRT_STRAWALIGNDBSVC_H
#define ATH_MSG_ERROR(x)
abstract interface to TRT straw alignment constants
static Double_t rc
Class for storing/accessing trt endpoint corrections data.
This is an Identifier helper class for the TRT subdetector.
Define macros for attributes used to control the static checker.
#define ATLAS_NO_CHECK_FILE_THREAD_SAFETY
This is a tool that allows streaming out of DataObjects.
The Detector Manager for all TRT Detector elements, it acts as the interface to the detector elements...
This is an Identifier helper class for the TRT subdetector.
Definition TRT_ID.h:84
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
float getDx2(const Identifier &id) const
get shift far from electronics
float getDx1(const Identifier &id) const
get shift near electronics
StatusCode writeTextFile(const std::string &file) const
write calibration constants to flat text file
TRTCond::ExpandedIdentifier trtcondid(const Identifier &id, int level=TRTCond::ExpandedIdentifier::STRAW) const
create an TRTCond::ExpandedIdentifier from a TRTID identifier
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
float getDxErr(const Identifier &id) const
get error on shift
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
ToolHandle< IAthenaOutputStreamTool > m_streamer
Message Stream Member.
TFile * file