ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonReconstruction
MuonRecUtils
MuonStationIntersectCond
src
MuonIntersectGeoData.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
#include "
MuonStationIntersectCond/MuonIntersectGeoData.h
"
6
7
#include <TString.h>
// for Form
8
9
#include "
MuonCondData/MdtCondDbData.h
"
10
#include "
MuonIdHelpers/IMuonIdHelperSvc.h
"
11
#include "
MuonReadoutGeometry/MdtReadoutElement.h
"
12
#include "
MuonReadoutGeometry/MuonDetectorManager.h
"
13
14
namespace
Muon
{
15
16
MuonIntersectGeoData::~MuonIntersectGeoData
() =
default
;
17
MuonIntersectGeoData::MuonIntersectGeoData
() =
default
;
18
MuonIntersectGeoData::MuonIntersectGeoData
(MsgStream& log,
const
MuonGM::MuonDetectorManager
* detMgr,
19
const
IMuonIdHelperSvc
* idHelperSvc,
const
MdtCondDbData
* dbData) :
20
m_idHelperSvc
{idHelperSvc},
m_dbData
{dbData} {
21
m_geometry
.resize(
m_idHelperSvc
->mdtIdHelper().detectorElement_hash_max());
22
for
(
unsigned
int
n = 0; n <
m_geometry
.size(); ++n) {
23
IdentifierHash
id_hash{n};
24
const
MuonGM::MdtReadoutElement
* mdt_ele = detMgr->
getMdtReadoutElement
(id_hash);
25
// The Mdt intersectionGeometry relies on the first multi layer. We can skip the other layers
26
if
(!mdt_ele || mdt_ele->
getMultilayer
() != 1)
continue
;
27
m_geometry
[id_hash] = std::make_unique<Muon::MdtIntersectGeometry>(log, mdt_ele->
identify
(), idHelperSvc, detMgr, dbData);
28
}
29
}
30
31
std::vector<std::shared_ptr<const Muon::MdtIntersectGeometry>>
MuonIntersectGeoData::getStationGeometry
(
const
Identifier
&
id
)
const
{
32
// get ids of geometry associated with identifier
33
std::vector<Identifier> chambers =
binPlusneighbours
(
id
);
34
35
// vector to store result
36
std::vector<std::shared_ptr<const Muon::MdtIntersectGeometry>> stations;
37
stations.reserve(chambers.size());
38
// loop over bins, retrieve geometry
39
for
(
const
Identifier
& chId : chambers) {
40
if
(
m_dbData
&& !
m_dbData
->isGood(chId)) {
continue
; }
41
std::shared_ptr<const MdtIntersectGeometry> chamb =
getChamber
(chId);
42
if
(chamb) stations.push_back(std::move(chamb));
43
}
44
return
stations;
45
}
46
std::shared_ptr<const MdtIntersectGeometry>
MuonIntersectGeoData::getChamber
(
const
Identifier
& chId)
const
{
47
IdentifierHash
hash{0};
48
const
MdtIdHelper
& idHelper{
m_idHelperSvc
->mdtIdHelper()};
49
if
(idHelper.
get_detectorElement_hash
(idHelper.
multilayerID
(chId), hash))
return
nullptr
;
50
return
hash <
m_geometry
.size() ?
m_geometry
[hash] :
nullptr
;
51
}
52
53
Muon::MuonStationIntersect
MuonIntersectGeoData::tubesCrossedByTrack
(
const
MuonGM::MuonDetectorManager
* detMgr,
54
const
Identifier
&
id
,
const
Amg::Vector3D
& pos,
55
const
Amg::Vector3D
& dir)
const
{
56
std::vector<std::shared_ptr<const Muon::MdtIntersectGeometry>> stations =
getStationGeometry
(
id
);
57
58
Muon::MuonStationIntersect::TubeIntersects
tubeIntersects;
59
for
(std::shared_ptr<const Muon::MdtIntersectGeometry>& it : stations) {
60
Muon::MuonStationIntersect
intersect = it->intersection(detMgr, pos, dir);
61
tubeIntersects.insert(tubeIntersects.end(), intersect.tubeIntersects().begin(), intersect.tubeIntersects().end());
62
}
63
64
Muon::MuonStationIntersect
intersection
{std::move(tubeIntersects)};
65
return
intersection
;
66
}
67
68
std::vector<Identifier>
MuonIntersectGeoData::binPlusneighbours
(
const
Identifier
&
id
)
const
{
69
std::vector<Identifier> chIds;
70
int
stName
=
m_idHelperSvc
->mdtIdHelper().stationName(
id
);
71
int
stPhi =
m_idHelperSvc
->mdtIdHelper().stationPhi(
id
);
72
int
stEta =
m_idHelperSvc
->mdtIdHelper().stationEta(
id
);
73
bool
isBarrel
=
m_idHelperSvc
->mdtIdHelper().isBarrel(
id
);
74
auto
[stEtaMin, stEtaMax] =
m_idHelperSvc
->mdtIdHelper().stationEtaMinMax(
id
);
75
76
int
chEtaLeft = stEta - 1;
77
int
chEtaRight = stEta + 1;
78
79
80
81
// chamber with smallest eta
82
if
(chEtaLeft < stEtaMin) chEtaLeft = -999;
83
84
// chamber with largest eta
85
if
(chEtaRight > stEtaMax) chEtaRight = -999;
86
87
using namespace
MuonStationIndex
;
88
ChIndex
chIndex
=
m_idHelperSvc
->chamberIndex(
id
);
89
90
// special treatment of EOS chambers
91
if
(
chIndex
== ChIndex::EOS) {
92
chEtaRight = -999;
93
chEtaLeft = -999;
94
}
95
96
if
(
isBarrel
) {
97
// eta = 0 doesn't exist take next
98
if
(chEtaLeft == 0) chEtaLeft -= 1;
99
if
(chEtaRight == 0) chEtaRight += 1;
100
}
else
{
101
// do not combined positive and negative endcaps
102
if
(chEtaLeft == 0) chEtaLeft = -999;
103
if
(chEtaRight == 0) chEtaRight = -999;
104
}
105
106
// no neighbours for BIS8
107
if
(
chIndex
== ChIndex::BIS && std::abs(stEta) == 8) {
108
chEtaLeft = -999;
109
chEtaRight = -999;
110
}
111
112
// BIS 8 never neighbour of a chamber
113
if
(
chIndex
== ChIndex::BIS) {
114
if
(std::abs(chEtaLeft) == 8) chEtaLeft = -999;
115
if
(std::abs(chEtaRight) == 8) chEtaRight = -999;
116
}
117
118
if
((
chIndex
== ChIndex::EIS ||
chIndex
== ChIndex::EIL) && !
m_idHelperSvc
->hasCSC()) {
119
//Chambers can only be -5, -4, 4, 5
120
if
( std::abs(chEtaLeft) != 5 && std::abs(chEtaLeft) != 4 ) chEtaLeft = -999;
121
if
( std::abs(chEtaRight) != 5 && std::abs(chEtaRight) != 4 ) chEtaRight = -999;
122
}
123
124
if
(chEtaLeft != -999 &&
125
m_idHelperSvc
->mdtIdHelper().validElement(
m_idHelperSvc
->mdtIdHelper().elementID(
stName
, chEtaLeft, stPhi)))
126
chIds.push_back(
m_idHelperSvc
->mdtIdHelper().elementID(
stName
, chEtaLeft, stPhi));
127
chIds.push_back(
m_idHelperSvc
->mdtIdHelper().elementID(
id
));
128
if
(chEtaRight != -999 &&
129
m_idHelperSvc
->mdtIdHelper().validElement(
m_idHelperSvc
->mdtIdHelper().elementID(
stName
, chEtaRight, stPhi)))
130
chIds.push_back(
m_idHelperSvc
->mdtIdHelper().elementID(
stName
, chEtaRight, stPhi));
131
132
// if (msgLvl(MSG::VERBOSE)) {
133
// ATH_MSG_VERBOSE(" returning chambers for id " << m_idHelperSvc->toString(id) << " ids " << chIds.size() << " eta " <<
134
// chEtaLeft
135
// << " " << stEta << " " << chEtaRight << " chambers: ");
136
// for (unsigned int i = 0; i < chIds.size(); ++i) ATH_MSG_VERBOSE(m_idHelperSvc->toString(chIds[i]));
137
// }
138
139
return
chIds;
140
}
141
142
}
// namespace Muon
IMuonIdHelperSvc.h
MdtCondDbData.h
MdtReadoutElement.h
MuonDetectorManager.h
MuonIntersectGeoData.h
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
MdtCondDbData
Definition
MdtCondDbData.h:24
MdtIdHelper
Definition
MdtIdHelper.h:61
MdtIdHelper::multilayerID
Identifier multilayerID(const Identifier &channeldID) const
Definition
MdtIdHelper.cxx:337
MdtIdHelper::get_detectorElement_hash
virtual int get_detectorElement_hash(const Identifier &id, IdentifierHash &hash_id) const override
Definition
MdtIdHelper.cxx:330
MuonGM::MdtReadoutElement
Definition
MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtReadoutElement.h:51
MuonGM::MdtReadoutElement::getMultilayer
int getMultilayer() const
Returns the multilayer represented by the readout element.
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition
MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:51
MuonGM::MuonDetectorManager::getMdtReadoutElement
const MdtReadoutElement * getMdtReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition
MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:216
MuonGM::MuonReadoutElement::identify
Identifier identify() const override final
Returns the ATLAS Identifier of the MuonReadOutElement.
Definition
MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h:173
Muon::IMuonIdHelperSvc
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
Definition
IMuonIdHelperSvc.h:27
Muon::MuonIntersectGeoData::m_geometry
std::vector< std::shared_ptr< MdtIntersectGeometry > > m_geometry
Definition
MuonIntersectGeoData.h:40
Muon::MuonIntersectGeoData::getStationGeometry
std::vector< std::shared_ptr< const MdtIntersectGeometry > > getStationGeometry(const Identifier &id) const
get geometry description of the given chamber + neighbouring chambers
Definition
MuonIntersectGeoData.cxx:31
Muon::MuonIntersectGeoData::m_idHelperSvc
const IMuonIdHelperSvc * m_idHelperSvc
Definition
MuonIntersectGeoData.h:41
Muon::MuonIntersectGeoData::m_dbData
const MdtCondDbData * m_dbData
Definition
MuonIntersectGeoData.h:42
Muon::MuonIntersectGeoData::MuonIntersectGeoData
MuonIntersectGeoData()
Muon::MuonIntersectGeoData::tubesCrossedByTrack
Muon::MuonStationIntersect tubesCrossedByTrack(const MuonGM::MuonDetectorManager *detMgr, const Identifier &id, const Amg::Vector3D &pos, const Amg::Vector3D &dir) const
Definition
MuonIntersectGeoData.cxx:53
Muon::MuonIntersectGeoData::getChamber
std::shared_ptr< const MdtIntersectGeometry > getChamber(const Identifier &id) const
get a pointer to the cached chamber
Definition
MuonIntersectGeoData.cxx:46
Muon::MuonIntersectGeoData::binPlusneighbours
std::vector< Identifier > binPlusneighbours(const Identifier &id) const
Definition
MuonIntersectGeoData.cxx:68
Muon::MuonIntersectGeoData::~MuonIntersectGeoData
~MuonIntersectGeoData()
Muon::MuonStationIntersect
Definition
MuonStationIntersect.h:12
Muon::MuonStationIntersect::TubeIntersects
std::vector< MuonTubeIntersect > TubeIntersects
Definition
MuonStationIntersect.h:14
intersection
std::vector< std::string > intersection(std::vector< std::string > &v1, std::vector< std::string > &v2)
Definition
compareFlatTrees.cxx:25
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition
GeoPrimitives.h:47
Identifier
Definition
IdentifierFieldParser.cxx:14
Muon::MuonStationIndex
Definition
MuonStationIndex.h:14
Muon::MuonStationIndex::chIndex
ChIndex chIndex(const std::string &index)
convert ChIndex name string to enum
Definition
MuonStationIndex.cxx:12
Muon::MuonStationIndex::isBarrel
bool isBarrel(const ChIndex index)
Returns true if the chamber index points to a barrel chamber.
Muon::MuonStationIndex::stName
const std::string & stName(StIndex index)
convert StIndex into a string
Definition
MuonStationIndex.cxx:105
Muon::MuonStationIndex::ChIndex
ChIndex
enum to classify the different chamber layers in the muon spectrometer
Definition
MuonStationIndex.h:16
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition
TrackSystemController.h:46
Generated on
for ATLAS Offline Software by
1.17.0