ATLAS Offline Software
Loading...
Searching...
No Matches
TRT_StrawAlignDbSvc.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 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"
22#include "GaudiKernel/ServiceHandle.h"
23
24ATLAS_NO_CHECK_FILE_THREAD_SAFETY; // This class uses const_cast, regFcn (callback) and DataHandle. Legacy code
25
27namespace InDetDD {
28 class TRT_DetectorManager ;
29}
30
34class TRT_StrawAlignDbSvc: public extends<AthService, ITRT_StrawAlignDbSvc>
35{
36 public:
37
39 TRT_StrawAlignDbSvc( const std::string& name, ISvcLocator* pSvcLocator );
40
43
45 virtual StatusCode initialize();
46
48 virtual StatusCode finalize();
49
50 // methods to access straw alignment data
51
54
55 // methods to set straw alignment data
56
58 void setDx( const TRTCond::ExpandedIdentifier& id, float dx1, float dx2, float dxerr ) ;
59
60 // methods for persistence
61
63 StatusCode writeTextFile(const std::string& file) const;
64
66 virtual StatusCode readTextFile(const std::string& file);
67 StatusCode readTextFile(StrawDxContainer* dxcontainer,
68 const std::string& file);
69
71 StatusCode streamOutObjects () const;
72
74 StatusCode registerObjects(std::string tag, int run1, int event1, int run2, int event2) const;
75
76
78 StrawDxContainer* getDxContainer() const ;
79 const StrawDxContainer* getConstDxContainer() const ;
80
83
85 float getDx1( const Identifier& id ) const ;
87 float getDx2( const Identifier& id ) const ;
89 float getDxErr( const Identifier& id ) const ;
91 void setDx( const Identifier& id, float dx1, float dx2, float dxerr ) ;
92
93 private:
94
97 std::string m_par_strawtextfile;
99 const TRT_ID* m_trtid;
101
102 // pointers to calibration data
104
105 ToolHandle<IAthenaOutputStreamTool> m_streamer;
106
107};
108
110// inline methods
112
113inline TRT_StrawAlignDbSvc::StrawDxContainer* TRT_StrawAlignDbSvc::getDxContainer() const {
114 const StrawDxContainer* rc = getConstDxContainer();
115 return const_cast<StrawDxContainer*>(rc) ;
116}
117
118inline const TRT_StrawAlignDbSvc::StrawDxContainer*
120{
121 const StrawDxContainer* rc = nullptr;
122 if (m_dxcontainer.isValid())
123 rc = m_dxcontainer.cptr();
124 else {
125 if (m_detStore->retrieve (rc, m_par_dxcontainerkey).isFailure()) {
126 ATH_MSG_ERROR("Cannot retrieve " << m_par_dxcontainerkey);
127 }
128 }
129 return rc;
130 return const_cast<StrawDxContainer*>(rc) ;
131}
132
134TRT_StrawAlignDbSvc::trtcondid( const Identifier& id, int level) const
135{
136 return TRTCond::ExpandedIdentifier( m_trtid->barrel_ec(id),m_trtid->layer_or_wheel(id),
137 m_trtid->phi_module(id),m_trtid->straw_layer(id),
138 m_trtid->straw(id),level ) ;
139}
140
141
142inline void
143TRT_StrawAlignDbSvc::setDx( const TRTCond::ExpandedIdentifier& id,float dx1, float dx2, float dxerr )
144{
145 //std::cout << " Setting the dx1 to " << dx1 << " dx2 to " << dx2 << std::endl;
146 getDxContainer()->setDx( id, dx1, dx2, dxerr);
147}
148
149inline float
154
155inline float
160
161inline float
166
167inline void
168TRT_StrawAlignDbSvc::setDx( const Identifier& id,float dx1, float dx2, float dxerr )
169{
170 setDx( trtcondid(id,TRTCond::ExpandedIdentifier::STRAW), dx1, dx2, dxerr) ;
171}
172
173#endif // TRT_STRAWALIGNDBSVC_H
#define ATH_MSG_ERROR(x)
defines an "iterator" over instances of a given type in StoreGateSvc
#define IOVSVC_CALLBACK_ARGS
short hand for IOVSvc call back argument list, to be used when no access to formal arguments is neede...
Definition IOVSvcDefs.h:24
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
an iterator over instances of a given type in StoreGateSvc.
Definition DataHandle.h:43
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:82
TRT_StrawAlignDbSvc(const std::string &name, ISvcLocator *pSvcLocator)
constructor
const DataHandle< StrawDxContainer > m_dxcontainer
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
StatusCode IOVCallBack(IOVSVC_CALLBACK_ARGS)
IOV call back for dx objects. normally this doesn't do anything.
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
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