ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonDetDescr
MuonAGDDDescription
src
sTGCDetectorHelper.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
MuonAGDDDescription/sTGCDetectorHelper.h
"
6
#include "
MuonAGDDDescription/sTGCDetectorDescription.h
"
7
#include "
AGDDKernel/AGDDDetectorStore.h
"
8
#include "
AGDDKernel/AGDDPositionerStore.h
"
9
#include "
AGDDKernel/AGDDDetectorPositioner.h
"
10
#include "
AGDDControl/AGDDController.h
"
11
12
#include <vector>
13
14
extern
int
myatoi
(std::string_view
str
);
15
16
sTGCDetectorHelper::sTGCDetectorHelper
()
17
{
18
if
(
m_svc
.retrieve().isFailure()) {
19
std::abort();
20
}
21
IAGDDtoGeoSvc::LockedController
c =
m_svc
->getController();
22
detectorList
vl= c->GetDetectorStore().GetDetectorList();
23
24
for
(
const
auto
& vl_iter: vl)
25
{
26
sTGCDetectorDescription
* st=
dynamic_cast<
sTGCDetectorDescription
*
>
(vl_iter.second);
27
if
(st) {
28
m_sTGCList
[vl_iter.first]=st;
29
m_sTGCListSubType
[vl_iter.second->subType()]=st;
30
}
31
}
32
33
}
34
35
sTGCDetectorDescription
*
sTGCDetectorHelper::Get_sTGCDetector
(
char
type
,
int
ieta,
int
iphi,
int
layer,
char
side)
36
{
37
sTGCDetectorDescription
* tgc=
nullptr
;
38
39
IAGDDtoGeoSvc::LockedController
c =
m_svc
->getController();
40
AGDDPositionerStore
& ps = c->GetPositionerStore();
41
for
(
unsigned
int
i=0;i<ps.size();i++)
42
{
43
AGDDDetectorPositioner
* dp=
dynamic_cast<
AGDDDetectorPositioner
*
>
(ps[i]);
44
if
(dp)
45
{
46
if
(dp->ID.detectorType !=
"sTGC"
)
continue
;
47
std::string_view dad=dp->ID.detectorAddress;
48
49
char
dtype=dad[3];
50
char
dctype=
'L'
;
51
if
(dtype==
'3'
) dctype=
'S'
;
52
if
(dctype!=
type
)
continue
;
53
int
deta=
myatoi
(dad.substr(5,1));
54
if
(deta!=ieta)
continue
;
55
int
dphi=
myatoi
(dad.substr(12,1));
56
if
(dphi!=iphi)
continue
;
57
int
dlayer=
myatoi
(dad.substr(7,1));
58
if
(dlayer!=layer)
continue
;
59
char
dside=dad[13];
60
if
(dside!=side)
continue
;
61
62
tgc=
dynamic_cast<
sTGCDetectorDescription
*
>
(dp->theDetector);
63
}
64
if
(tgc)
break
;
65
}
66
if
(!tgc) std::cout<<
" could not find a positioned sTGC!!!! "
<<std::endl;
67
return
tgc;
68
}
69
70
AGDDPositionedDetector
sTGCDetectorHelper::Get_sTGCPositionedDetector
(
char
type
,
int
ieta,
int
iphi,
int
layer,
char
side)
71
{
72
sTGCDetectorDescription
* tgc=
nullptr
;
73
AGDDDetectorPositioner
* dp=
nullptr
;
74
75
IAGDDtoGeoSvc::LockedController
c =
m_svc
->getController();
76
AGDDPositionerStore
& ps = c->GetPositionerStore();
77
for
(
unsigned
int
i=0;i<ps.size();i++)
78
{
79
dp=
dynamic_cast<
AGDDDetectorPositioner
*
>
(ps[i]);
80
if
(dp)
81
{
82
if
(dp->ID.detectorType !=
"sTGC"
)
continue
;
83
std::string_view dad=dp->ID.detectorAddress;
84
85
char
dtype=dad[3];
86
char
dctype=
'L'
;
87
if
(dtype==
'3'
) dctype=
'S'
;
88
if
(dctype!=
type
)
continue
;
89
int
deta=
myatoi
(dad.substr(5,1));
90
if
(deta!=ieta)
continue
;
91
int
dphi=
myatoi
(dad.substr(12,1));
92
if
(dphi!=iphi)
continue
;
93
int
dlayer=
myatoi
(dad.substr(7,1));
94
if
(dlayer!=layer)
continue
;
95
char
dside=dad[13];
96
if
(dside!=side)
continue
;
97
98
tgc=
dynamic_cast<
sTGCDetectorDescription
*
>
(dp->theDetector);
99
}
100
if
(tgc)
break
;
101
}
102
if
(!tgc) std::cout<<
" could not find a positioned sTGC!!!! "
<<std::endl;
103
AGDDPositionedDetector
p_sTGC(tgc,dp);
104
return
p_sTGC;
105
}
106
107
sTGCDetectorDescription
*
sTGCDetectorHelper::Get_sTGCDetectorType
(
const
std::string&
type
)
108
{
109
if
(
auto
itr =
m_sTGCList
.find(
type
); itr !=
m_sTGCList
.end())
return
itr->second;
110
return
nullptr
;
111
}
112
113
sTGCDetectorDescription
*
sTGCDetectorHelper::Get_sTGCDetectorSubType
(
const
std::string&
type
)
114
{
115
if
(
auto
itr =
m_sTGCListSubType
.find(
type
); itr !=
m_sTGCListSubType
.end())
return
itr->second;
116
return
nullptr
;
117
}
118
119
sTGCDetectorDescription
*
sTGCDetectorHelper::Get_sTGCDetectorType
(std::string_view
type
)
120
{
121
for
(
const
auto
&
pair
:
m_sTGCList
){
122
if
(
pair
.first ==
type
)
return
pair
.second;
123
}
124
return
nullptr
;
125
}
126
127
sTGCDetectorDescription
*
sTGCDetectorHelper::Get_sTGCDetectorSubType
(std::string_view
type
)
128
{
129
for
(
const
auto
&
pair
:
m_sTGCListSubType
){
130
if
(
pair
.first ==
type
)
return
pair
.second;
131
}
132
return
nullptr
;
133
}
134
135
IAGDDtoGeoSvc::LockedController
sTGCDetectorHelper::Get_Controller
()
136
{
137
return
m_svc
->getController();
138
}
AGDDController.h
AGDDDetectorPositioner.h
AGDDDetectorStore.h
detectorList
std::map< std::string, AGDDDetector * > detectorList
Definition
AGDDDetectorStore.h:15
AGDDPositionerStore.h
myatoi
int myatoi(std::string_view str)
Definition
MMDetectorHelper.cxx:34
AGDDDetectorPositioner
Definition
AGDDDetectorPositioner.h:39
AGDDPositionerStore
Definition
AGDDPositionerStore.h:14
IAGDDtoGeoSvc::LockedController
CxxUtils::LockedPointer< AGDDController > LockedController
Definition
IAGDD2GeoSvc.h:26
pair
STL class.
sTGCDetectorDescription
Definition
sTGCDetectorDescription.h:51
sTGCDetectorHelper::Get_sTGCPositionedDetector
AGDDPositionedDetector Get_sTGCPositionedDetector(char type, int ieta, int iphi, int layer=1, char side='A')
Definition
sTGCDetectorHelper.cxx:70
sTGCDetectorHelper::m_sTGCListSubType
sTGCMapSubType m_sTGCListSubType
Definition
sTGCDetectorHelper.h:41
sTGCDetectorHelper::Get_Controller
IAGDDtoGeoSvc::LockedController Get_Controller()
Definition
sTGCDetectorHelper.cxx:135
sTGCDetectorHelper::m_sTGCList
sTGCMap m_sTGCList
Definition
sTGCDetectorHelper.h:40
sTGCDetectorHelper::m_svc
ServiceHandle< IAGDDtoGeoSvc > m_svc
Definition
sTGCDetectorHelper.h:42
sTGCDetectorHelper::Get_sTGCDetector
sTGCDetectorDescription * Get_sTGCDetector(char type, int ieta, int iphi, int layer=1, char side='A')
Definition
sTGCDetectorHelper.cxx:35
sTGCDetectorHelper::Get_sTGCDetectorType
sTGCDetectorDescription * Get_sTGCDetectorType(const std::string &type)
Definition
sTGCDetectorHelper.cxx:107
sTGCDetectorHelper::Get_sTGCDetectorSubType
sTGCDetectorDescription * Get_sTGCDetectorSubType(const std::string &type)
Definition
sTGCDetectorHelper.cxx:113
sTGCDetectorHelper::sTGCDetectorHelper
sTGCDetectorHelper()
Definition
sTGCDetectorHelper.cxx:16
str
Definition
BTagTrackIpAccessor.cxx:11
sTGCDetectorDescription.h
myatoi
int myatoi(std::string_view str)
Definition
MMDetectorHelper.cxx:34
sTGCDetectorHelper.h
AGDDPositionedDetector
std::pair< sTGCDetectorDescription *, AGDDDetectorPositioner * > AGDDPositionedDetector
Definition
sTGCDetectorHelper.h:22
type
Generated on
for ATLAS Offline Software by
1.17.0