ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetDetDescr
TRT_Cabling
src
TRT_CablingSvc.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
//
6
// Implementation file for TRT_CablingSvc class
7
//
8
9
#include "
TRT_CablingSvc.h
"
10
11
#include "eformat/SourceIdentifier.h"
// change to new eformat v3
12
#include "
PathResolver/PathResolver.h
"
13
// Tool
14
#include "GaudiKernel/IToolSvc.h"
15
16
17
using
eformat::helper::SourceIdentifier;
18
19
// Constructor
20
TRT_CablingSvc::TRT_CablingSvc
(
const
std::string& name,
21
ISvcLocator * pSvcLocator)
22
: base_class( name, pSvcLocator )
23
{
24
}
25
26
// Initialisation
27
StatusCode
TRT_CablingSvc::initialize
( )
28
{
29
StatusCode
sc
;
30
ATH_MSG_INFO
(
"TRT_CablingSvc::initialize"
);
31
32
// Retrieve Detector Store
33
ServiceHandle<StoreGateSvc>
detStore(
"DetectorStore"
,name());
34
ATH_CHECK
(detStore.retrieve());
35
ATH_CHECK
(detStore->retrieve(
m_manager
,
"TRT"
));
36
37
// Get ToolSvc
38
SmartIF<IToolSvc> toolSvc{service(
"ToolSvc"
)};
39
ATH_CHECK
( toolSvc.isValid() );
40
41
// Get tool for filling of cabling data
42
std::string toolType;
43
if
(
m_manager
->getLayout()==
"TestBeam"
)
44
{
45
m_TRTLayout
= 1;
46
toolType =
"TRT_FillCablingData_TB04"
;
47
ATH_MSG_INFO
(
"TRT TB04 Cabling"
);
48
if
(StatusCode::SUCCESS !=toolSvc->retrieveTool(toolType,
m_cablingTool_TB
))
49
{
50
ATH_MSG_ERROR
(
" Can't get TRT_FillCablingData_TB04 tool "
);
51
return
StatusCode::FAILURE;
52
}
53
m_cabling
=
m_cablingTool_TB
->fillData();
54
}
55
// DC1
56
else
if
((
m_manager
->getLayout() ==
"Initial"
) ||
57
(
m_manager
->getLayout() ==
"Final"
) )
58
{
59
m_TRTLayout
= 6;
60
toolType =
"TRT_FillCablingData_DC3"
;
61
ATH_MSG_INFO
(
"TRT DC3 Cabling"
);
62
if
( StatusCode::SUCCESS !=
63
toolSvc->retrieveTool(toolType,
m_cablingTool_DC3
) )
64
{
65
ATH_MSG_ERROR
(
" Can't get TRT_FillCablingData_DC3 tool "
);
66
return
StatusCode::FAILURE;
67
}
68
69
m_cabling
=
m_cablingTool_DC3
->fillData();
70
71
}
72
else
if
(
m_manager
->getLayout()==
"SR1"
)
// SR1 Barrel cosmics layout
73
{
74
m_TRTLayout
= 4;
75
toolType =
"TRT_FillCablingData_SR1"
;
76
ATH_MSG_INFO
(
"TRT SR1 Cabling"
);
77
if
(StatusCode::SUCCESS !=toolSvc->retrieveTool(toolType,
m_cablingTool_SR1
))
78
{
79
ATH_MSG_ERROR
(
" Can't get TRT_FillCablingData_SR1 tool "
);
80
return
StatusCode::FAILURE;
81
}
82
83
m_cabling
=
m_cablingTool_SR1
->fillData();
84
}
85
else
if
(
m_manager
->getLayout()==
"SR1-EndcapC"
)
// SR1 EC C cosmics layout
86
{
87
m_TRTLayout
= 5;
88
toolType =
"TRT_FillCablingData_SR1_ECC"
;
89
ATH_MSG_INFO
(
"TRT SR1 Cabling"
);
90
if
( StatusCode::SUCCESS !=
91
toolSvc->retrieveTool(toolType,
m_cablingTool_SR1_ECC
) )
92
{
93
ATH_MSG_ERROR
(
" Can't get TRT_FillCablingData_SR1_ECC tool "
);
94
return
StatusCode::FAILURE;
95
}
96
97
m_cabling
=
m_cablingTool_SR1_ECC
->fillData();
98
}
99
else
100
{
101
ATH_MSG_FATAL
(
" Layout is not defined for TRT_FillCablingData ("
<<
m_manager
->getLayout() <<
")! "
);
102
return
StatusCode::FAILURE;
103
}
104
105
ATH_MSG_INFO
(
"TRT_CablingSvc::initializiation finished"
);
106
107
return
sc
;
108
}
109
110
111
std::vector<uint32_t>
TRT_CablingSvc::getRobID
(
Identifier
&
id
)
const
112
{
113
// TB Case
114
if
(
m_TRTLayout
== 1)
115
{
116
return
m_cablingTool_TB
->getRobID(
id
);
117
}
118
// SR1 Barrel
119
else
if
(
m_TRTLayout
== 4 )
120
{
121
return
m_cablingTool_SR1
->getRobID(
id
);
122
}
123
// SR1 EC C
124
else
if
(
m_TRTLayout
== 5 )
125
{
126
return
m_cablingTool_SR1_ECC
->getRobID(
id
);
127
}
128
// DC3
129
else
if
(
m_TRTLayout
== 6 )
130
{
131
return
m_cablingTool_DC3
->getRobID(
id
);
132
}
133
else
134
{
135
std::vector<uint32_t> v;
136
return
v;
137
}
138
}
139
140
Identifier
TRT_CablingSvc::getIdentifier
(
const
eformat::SubDetector&,
141
const
unsigned
& rod,
const
int
& bufferOffset,
142
IdentifierHash
& hashId)
const
143
{
144
int
intRod = (int) rod;
145
146
// TB04, SR1 or DC3 Case
147
hashId =
m_cabling
->get_identifierHashForAllStraws(intRod, bufferOffset);
148
return
m_cabling
->get_identifierForAllStraws(intRod, bufferOffset);
149
}
150
151
/*
152
* getBufferOffset( strawId ) -
153
* get Offset into ROD buffer given straw Identifier StrawId.
154
*
155
*/
156
uint32_t
TRT_CablingSvc::getBufferOffset
(
const
Identifier
&StrawId )
157
{
158
159
// DC3 Case
160
if
(
m_TRTLayout
== 6 )
161
{
162
return
m_cabling
->get_BufferOffset( StrawId );
163
}
164
else
165
{
166
ATH_MSG_FATAL
(
"TRT_CablingSvc::getBufferOffset called in invalid case !"
);
167
assert(0);
168
}
169
170
return
0;
171
}
172
173
const
std::vector<uint32_t>&
TRT_CablingSvc::getAllRods
()
const
174
{
175
return
m_cabling
->get_allRods();
176
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
PathResolver.h
TRT_CablingSvc.h
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
ServiceHandle
Definition
ClusterMakerTool.h:36
TRT_CablingSvc::m_cablingTool_TB
TRT_FillCablingData_TB04 * m_cablingTool_TB
Definition
TRT_CablingSvc.h:65
TRT_CablingSvc::m_cablingTool_DC3
TRT_FillCablingData_DC3 * m_cablingTool_DC3
Definition
TRT_CablingSvc.h:66
TRT_CablingSvc::getBufferOffset
virtual uint32_t getBufferOffset(const Identifier &StrawId) override
Definition
TRT_CablingSvc.cxx:156
TRT_CablingSvc::TRT_CablingSvc
TRT_CablingSvc(const std::string &name, ISvcLocator *pSvcLocator)
Definition
TRT_CablingSvc.cxx:20
TRT_CablingSvc::m_TRTLayout
int m_TRTLayout
Definition
TRT_CablingSvc.h:67
TRT_CablingSvc::getAllRods
virtual const std::vector< uint32_t > & getAllRods() const override
Definition
TRT_CablingSvc.cxx:173
TRT_CablingSvc::m_cablingTool_SR1
TRT_FillCablingData_SR1 * m_cablingTool_SR1
Definition
TRT_CablingSvc.h:64
TRT_CablingSvc::m_cabling
TRT_CablingData * m_cabling
Definition
TRT_CablingSvc.h:61
TRT_CablingSvc::m_manager
const InDetDD::TRT_DetectorManager * m_manager
Definition
TRT_CablingSvc.h:60
TRT_CablingSvc::m_cablingTool_SR1_ECC
TRT_FillCablingData_SR1_ECC * m_cablingTool_SR1_ECC
Definition
TRT_CablingSvc.h:63
TRT_CablingSvc::getIdentifier
virtual Identifier getIdentifier(const eformat::SubDetector &subdetector, const unsigned &rod, const int &bufferOffset, IdentifierHash &hashId) const override
Definition
TRT_CablingSvc.cxx:140
TRT_CablingSvc::initialize
virtual StatusCode initialize() override
Definition
TRT_CablingSvc.cxx:27
TRT_CablingSvc::getRobID
virtual std::vector< uint32_t > getRobID(Identifier &id) const override
Definition
TRT_CablingSvc.cxx:111
Identifier
Definition
IdentifierFieldParser.cxx:14
Generated on
for ATLAS Offline Software by
1.17.0