ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonCalib
MuonCalibStandAlone
MuonCalibStandAloneBase
src
NtupleStationId.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
MuonCalibStandAloneBase/NtupleStationId.h
"
6
7
#include "
AthenaKernel/getMessageSvc.h
"
8
#include "GaudiKernel/MsgStream.h"
9
#include "
Identifier/IdContext.h
"
10
#include "
MuonIdHelpers/MdtIdHelper.h
"
11
#include "
MuonReadoutGeometry/MdtReadoutElement.h
"
12
#include "
MuonReadoutGeometry/MuonDetectorManager.h
"
13
14
namespace
MuonCalib
{
15
16
bool
NtupleStationId::Initialize
(
const
std::string& station,
const
int
&
eta
,
const
int
&
phi
,
const
int
& ml,
const
int
& author) {
17
MuonFixedId
id;
18
if
(station ==
"ANY"
) {
19
m_station
= -1;
20
}
else
{
21
m_station
=
id
.stationStringToFixedStationNumber(station);
22
if
(
m_station
< 0)
return
false
;
23
}
24
m_eta
=
eta
;
25
m_phi
=
phi
;
26
m_ml
= ml;
27
m_author
= author;
28
m_geom_ok
=
false
;
29
return
true
;
30
}
31
32
void
NtupleStationId::SetStation
(
const
std::string& station) {
33
MuonFixedId
id;
34
m_station
=
id
.stationStringToFixedStationNumber(station);
35
}
36
37
bool
NtupleStationId::InitializeGeometry
(
const
MdtIdHelper
& mdtIdHelper,
const
MuonGM::MuonDetectorManager
* detMgr) {
38
MuonFixedId
fid;
39
MsgStream log(
Athena::getMessageSvc
(),
"NtupleStationId"
);
40
if
(
m_station
== -1 ||
m_phi
< 0 ||
m_eta
== -99) {
41
log << MSG::WARNING <<
"NtupleStationId::InitializeGeometry: Cannot initialize geometry for multi station id"
<<
endmsg
;
42
m_geom_ok
=
false
;
43
return
false
;
44
}
45
Identifier
id(mdtIdHelper.
elementID
(fid.
stationNumberToFixedStationString
(
m_station
),
m_eta
,
m_phi
));
46
m_n_ml
= mdtIdHelper.
numberOfMultilayers
(
id
);
47
// loop on multilayers
48
for
(
int
i = 0; i <
m_n_ml
; i++) {
49
const
MuonGM::MdtReadoutElement
* detEl_ml = detMgr->
getMdtReadoutElement
(mdtIdHelper.
channelID
(
id
, 1 + i, 1, 1));
50
m_layer_min
[i] = 1;
51
if
(!detEl_ml) {
52
log << MSG::WARNING <<
regionId
() <<
" ml "
<< i <<
"does not exist in current geometry"
<<
endmsg
;
53
return
false
;
54
}
55
m_layer_max
[i] = detEl_ml->
getNLayers
();
56
m_n_layer
[i] =
m_layer_max
[i] -
m_layer_min
[i] + 1;
57
m_tube_min
[i] = 1;
58
m_tube_max
[i] = detEl_ml->
getNtubesperlayer
();
59
m_n_tubes
[i] =
m_tube_max
[i] -
m_tube_min
[i] + 1;
60
}
61
MdtBasicRegionHash
hash;
62
IdContext
idCont = mdtIdHelper.
module_context
();
63
mdtIdHelper.
get_hash
(
id
, hash, &idCont);
64
m_region_hash
=
static_cast<
int
>
(hash);
65
m_geom_ok
=
true
;
66
return
true
;
67
}
68
69
std::string
NtupleStationId::regionId
()
const
{
70
MuonFixedId
id;
71
std::ostringstream id_stream;
72
if
(
m_station
< 0) {
73
id_stream <<
"ANY"
;
74
}
else
{
75
id_stream <<
id
.stationNumberToFixedStationString(
m_station
);
76
}
77
id_stream <<
"_"
;
78
if
(
m_phi
>= 0) {
79
id_stream <<
m_phi
;
80
}
else
{
81
id_stream <<
"ANY"
;
82
}
83
id_stream <<
"_"
;
84
if
(
m_eta
!= -99) {
85
id_stream <<
m_eta
;
86
}
else
{
87
id_stream <<
"ANY"
;
88
}
89
if
(
m_ml
> 0) { id_stream <<
"_"
<<
m_ml
; }
90
return
id_stream.str();
91
}
92
93
int
NtupleStationId::FixedId
()
const
{
94
if
(
m_station
< 0 ||
m_eta
== -99 ||
m_phi
< 0)
return
-1;
95
MuonFixedId
id;
96
id
.set_mdt();
97
if
(!
id
.setStationName(
m_station
))
return
-1;
98
if
(!
id
.setStationEta(
m_eta
))
return
-1;
99
if
(!
id
.setStationPhi(
m_phi
))
return
-1;
100
return
id
.mdtChamberId().getIdInt();
101
}
102
103
}
// namespace MuonCalib
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
IdContext.h
MdtIdHelper.h
MdtReadoutElement.h
MuonDetectorManager.h
NtupleStationId.h
IdContext
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition
IdContext.h:26
MdtIdHelper
Definition
MdtIdHelper.h:61
MdtIdHelper::elementID
Identifier elementID(int stationName, int stationEta, int stationPhi) const
Definition
MdtIdHelper.cxx:634
MdtIdHelper::numberOfMultilayers
int numberOfMultilayers(const Identifier &id) const
Definition
MdtIdHelper.cxx:500
MdtIdHelper::channelID
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int tubeLayer, int tube) const
Definition
MdtIdHelper.cxx:663
MuonCalib::MuonFixedId
Implements fixed identifiers not dependent upon Athena Identifier for internal use in the calibration...
Definition
MuonFixedId.h:50
MuonCalib::MuonFixedId::stationNumberToFixedStationString
static std::string stationNumberToFixedStationString(const int station)
Definition
MuonFixedId.h:747
MuonCalib::NtupleStationId::m_eta
int m_eta
Definition
NtupleStationId.h:209
MuonCalib::NtupleStationId::Initialize
void Initialize(const MuonFixedId &id)
initialize function
Definition
NtupleStationId.h:69
MuonCalib::NtupleStationId::m_ml
int m_ml
Definition
NtupleStationId.h:209
MuonCalib::NtupleStationId::InitializeGeometry
bool InitializeGeometry(const MdtIdHelper &mdtIdHelper, const MuonGM::MuonDetectorManager *detMgr)
initialize geometry information
Definition
NtupleStationId.cxx:37
MuonCalib::NtupleStationId::m_n_tubes
int m_n_tubes[2]
Definition
NtupleStationId.h:212
MuonCalib::NtupleStationId::m_n_layer
int m_n_layer[2]
Definition
NtupleStationId.h:212
MuonCalib::NtupleStationId::m_geom_ok
bool m_geom_ok
Definition
NtupleStationId.h:215
MuonCalib::NtupleStationId::SetStation
void SetStation(const std::string &station)
set station, eta or phi seperately
Definition
NtupleStationId.cxx:32
MuonCalib::NtupleStationId::m_author
int m_author
Definition
NtupleStationId.h:210
MuonCalib::NtupleStationId::m_tube_min
int m_tube_min[2]
Definition
NtupleStationId.h:214
MuonCalib::NtupleStationId::m_region_hash
int m_region_hash
geo model information
Definition
NtupleStationId.h:212
MuonCalib::NtupleStationId::m_tube_max
int m_tube_max[2]
Definition
NtupleStationId.h:214
MuonCalib::NtupleStationId::m_layer_min
int m_layer_min[2]
Definition
NtupleStationId.h:213
MuonCalib::NtupleStationId::regionId
std::string regionId() const
return the region id string
Definition
NtupleStationId.cxx:69
MuonCalib::NtupleStationId::FixedId
int FixedId() const
Definition
NtupleStationId.cxx:93
MuonCalib::NtupleStationId::m_station
int m_station
id
Definition
NtupleStationId.h:209
MuonCalib::NtupleStationId::m_layer_max
int m_layer_max[2]
Definition
NtupleStationId.h:213
MuonCalib::NtupleStationId::m_phi
int m_phi
Definition
NtupleStationId.h:209
MuonCalib::NtupleStationId::m_n_ml
int m_n_ml
Definition
NtupleStationId.h:212
MuonGM::MdtReadoutElement
Definition
MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtReadoutElement.h:51
MuonGM::MdtReadoutElement::getNLayers
int getNLayers() const
Returns the number of tube layers inside the multilayer.
MuonGM::MdtReadoutElement::getNtubesperlayer
int getNtubesperlayer() const
Returns the number of tubes in each tube layer.
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
MuonIdHelper::module_context
IdContext module_context() const
id for module
Definition
MuonIdHelper.cxx:738
MuonIdHelper::get_hash
virtual int get_hash(const Identifier &id, IdentifierHash &hash_id, const IdContext *context=0) const override
Create hash id from compact id (return == 0 for OK).
Definition
MuonIdHelper.cxx:148
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition
getMessageSvc.cxx:20
Identifier
Definition
IdentifierFieldParser.cxx:14
MuonCalib
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition
CscCalcPed.cxx:21
MuonCalib::MdtBasicRegionHash
IdentifierHash MdtBasicRegionHash
define type MdtBasicRegionHash for the smallest possible MDT calibration region
Definition
NtupleStationId.h:26
Generated on
for ATLAS Offline Software by
1.17.0