ATLAS Offline Software
TRT_CalDbTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRT_CALDBTOOL_H
6 #define TRT_CALDBTOOL_H
7 
13 // STL
14 #include <mutex>
15 //Gaudi includes
16 #include "GaudiKernel/IInterface.h"
17 #include "GaudiKernel/ToolHandle.h"
18 #include "GaudiKernel/EventContext.h"
19 #include "GaudiKernel/ContextSpecificPtr.h"
20 #include "GaudiKernel/ICondSvc.h"
21 // Storegate
23 //Athena
25 // TRT
26 #include "InDetIdentifier/TRT_ID.h"
27 
28 
29 
33 class TRT_CalDbTool: public extends<AthAlgTool, ITRT_CalDbTool>
34 {
35  public:
37 
38 
40  TRT_CalDbTool( const std::string& type, const std::string& name, const IInterface* parent);
41 
43  virtual ~TRT_CalDbTool() = default;
44 
46  virtual StatusCode initialize() override;
47 
49  virtual StatusCode finalize() override;
50 
51 
52  // methods to access calibration data
53 
55  virtual float getT0( const Identifier& id, int level = TRTCond::ExpandedIdentifier::STRAW ) const override;
56 
58  virtual const TRTCond::RtRelation* getRtRelation( const Identifier& id, int level = TRTCond::ExpandedIdentifier::STRAW ) const override;
59 
61  virtual const TRTCond::RtRelation* getErrors( const Identifier& id, int level = TRTCond::ExpandedIdentifier::STRAW ) const override;
62 
64  virtual const TRTCond::RtRelation* getSlopes( const Identifier& id, int level = TRTCond::ExpandedIdentifier::STRAW ) const override;
65 
67  virtual double driftRadius(const double& time, float& t0, const Identifier& ident, bool& found) const override;
68 
70  virtual double driftError(const double& time, const Identifier& ident, bool& found) const override;
71 
73  virtual double driftSlope(const double& time, const Identifier& ident, bool& found) const override;
74 
77 
78 
79 
81  virtual const RtRelationContainer* getRtContainer() const override;
82  virtual const RtRelationContainer* getErrContainer() const override;
83  virtual const RtRelationContainer* getSlopeContainer() const override;
84  virtual const StrawT0Container* getT0Container() const override;
85 
86  private:
87  const TRT_ID* m_trtId;
88 
90  SG::ReadCondHandleKey<RtRelationContainer> m_rtReadKey{this,"RtFolderName","/TRT/Calib/RT","r-t relation in-key"};
91  SG::ReadCondHandleKey<RtRelationContainer> m_errReadKey{this,"ErrorFolderName","/TRT/Calib/errors2d","error on r in-key"};
92  SG::ReadCondHandleKey<RtRelationContainer> m_slopeReadKey{this,"ErrorSlopeFolderName","/TRT/Calib/slopes","slope of error in-key"};
93  SG::ReadCondHandleKey<StrawT0Container> m_t0ReadKey{this,"T0FolderName","/TRT/Calib/T0","t0 in-key"};
94 
95 };
96 
98 // inline methods
100 
103 {
106  m_trtId->straw(id),level ) ;
107 }
108 
109 inline const TRTCond::RtRelation*
111 {
112  const RtRelationContainer* rc = getRtContainer();
113  if(!rc) return 0;
114  return rc->get(trtcondid(id,level)) ;
115 }
116 
117 inline const TRTCond::RtRelation*
118 TRT_CalDbTool::getErrors( const Identifier& id, int level ) const
119 {
120  const RtRelationContainer* rc = getErrContainer();
121  if(!rc) return 0;
122  return rc->get(trtcondid(id,level)) ;
123 }
124 
125 inline const TRTCond::RtRelation*
127 {
128  const RtRelationContainer* rc = getSlopeContainer();
129  if(!rc) return 0;
130  return rc->get(trtcondid(id,level)) ;
131 }
132 
133 inline float
134 TRT_CalDbTool::getT0( const Identifier& id, int level ) const
135 {
136  const StrawT0Container* rc = getT0Container();
137  return rc->getT0(trtcondid(id,level)) ;
138 }
139 
140 
141 
142 #endif // TRT_CALDBTOOL_H
TRT_CalDbTool::driftSlope
virtual double driftSlope(const double &time, const Identifier &ident, bool &found) const override
get a drift radius error for a given drifttime
Definition: TRT_CalDbTool.cxx:136
ALFA_EventTPCnv_Dict::t0
std::vector< ALFA_RawData_p1 > t0
Definition: ALFA_EventTPCnvDict.h:42
TRT_CalDbTool::getSlopes
virtual const TRTCond::RtRelation * getSlopes(const Identifier &id, int level=TRTCond::ExpandedIdentifier::STRAW) const override
get errors for an identifier
Definition: TRT_CalDbTool.h:126
TRT_ID.h
This is an Identifier helper class for the TRT subdetector. This class is a factory for creating comp...
TRT_CalDbTool::finalize
virtual StatusCode finalize() override
tool finalize
Definition: TRT_CalDbTool.cxx:54
TRT_CalDbTool::driftRadius
virtual double driftRadius(const double &time, float &t0, const Identifier &ident, bool &found) const override
get a drift radius for a given leading edge time
Definition: TRT_CalDbTool.cxx:87
TRT_CalDbTool
Definition: TRT_CalDbTool.h:34
TRT_CalDbTool::getErrors
virtual const TRTCond::RtRelation * getErrors(const Identifier &id, int level=TRTCond::ExpandedIdentifier::STRAW) const override
get errors for an identifier
Definition: TRT_CalDbTool.h:118
TRT_CalDbTool::getSlopeContainer
virtual const RtRelationContainer * getSlopeContainer() const override
Definition: TRT_CalDbTool.cxx:73
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
TRT_CalDbTool::trtcondid
virtual TRTCond::ExpandedIdentifier trtcondid(const Identifier &id, int level=TRTCond::ExpandedIdentifier::STRAW) const override
create an TRTCond::ExpandedIdentifier from a TRTID identifier
Definition: TRT_CalDbTool.h:102
TRT_CalDbTool::m_trtId
const TRT_ID * m_trtId
id helper
Definition: TRT_CalDbTool.h:87
TRTCond::RtRelation
Definition: RtRelation.h:27
TRT_CalDbTool::getRtContainer
virtual const RtRelationContainer * getRtContainer() const override
access to calibration constant containers
Definition: TRT_CalDbTool.cxx:61
TRT_ID::straw
int straw(const Identifier &id) const
Definition: TRT_ID.h:902
TRT_CalDbTool::driftError
virtual double driftError(const double &time, const Identifier &ident, bool &found) const override
get a drift radius error for a given drifttime
Definition: TRT_CalDbTool.cxx:119
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
TRT_CalDbTool::~TRT_CalDbTool
virtual ~TRT_CalDbTool()=default
destructor
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TRT_CalDbTool::initialize
virtual StatusCode initialize() override
tool initialize
Definition: TRT_CalDbTool.cxx:28
ITRT_CalDbTool.h
abstract interface to TRT calibration constants
TRT_ID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: TRT_ID.h:866
TRT_ID::straw_layer
int straw_layer(const Identifier &id) const
Definition: TRT_ID.h:893
TRT_ID::layer_or_wheel
int layer_or_wheel(const Identifier &id) const
Definition: TRT_ID.h:884
ReadCondHandleKey.h
TRT_CalDbTool::m_t0ReadKey
SG::ReadCondHandleKey< StrawT0Container > m_t0ReadKey
Definition: TRT_CalDbTool.h:93
TRT_CalDbTool::getT0Container
virtual const StrawT0Container * getT0Container() const override
Definition: TRT_CalDbTool.cxx:79
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
TRTCond::ExpandedIdentifier::STRAW
@ STRAW
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:37
TRT::Hit::ident
@ ident
Definition: HitInfo.h:77
TRT_ID::phi_module
int phi_module(const Identifier &id) const
Definition: TRT_ID.h:875
TRT_CalDbTool::TRT_CalDbTool
TRT_CalDbTool(const std::string &type, const std::string &name, const IInterface *parent)
typedefs, enums etc
Definition: TRT_CalDbTool.cxx:22
TRT_CalDbTool::m_rtReadKey
SG::ReadCondHandleKey< RtRelationContainer > m_rtReadKey
ReadHandle keys.
Definition: TRT_CalDbTool.h:90
SG::ReadCondHandleKey< RtRelationContainer >
TRT_ID
Definition: TRT_ID.h:84
TRT_CalDbTool::getRtRelation
virtual const TRTCond::RtRelation * getRtRelation(const Identifier &id, int level=TRTCond::ExpandedIdentifier::STRAW) const override
get an rtrelation for an identifier
Definition: TRT_CalDbTool.h:110
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TRT_CalDbTool::getErrContainer
virtual const RtRelationContainer * getErrContainer() const override
Definition: TRT_CalDbTool.cxx:67
TRT_CalDbTool::getT0
virtual float getT0(const Identifier &id, int level=TRTCond::ExpandedIdentifier::STRAW) const override
get T0 for an identifier
Definition: TRT_CalDbTool.h:134
TRTCond::ExpandedIdentifier
Identifier for TRT detector elements in the conditions code.
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:30
TRT_CalDbTool::m_errReadKey
SG::ReadCondHandleKey< RtRelationContainer > m_errReadKey
Definition: TRT_CalDbTool.h:91
TRT_CalDbTool::m_slopeReadKey
SG::ReadCondHandleKey< RtRelationContainer > m_slopeReadKey
Definition: TRT_CalDbTool.h:92
Identifier
Definition: IdentifierFieldParser.cxx:14