Geometry
MuonNumbering
src
DTNumberingScheme.cc
Go to the documentation of this file.
1
#include "
Geometry/MuonNumbering/interface/DTNumberingScheme.h
"
2
#include "
DataFormats/MuonDetId/interface/DTWireId.h
"
3
#include "
Geometry/MuonNumbering/interface/MuonBaseNumber.h
"
4
#include "
Geometry/MuonNumbering/interface/MuonGeometryConstants.h
"
5
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
6
7
//#define LOCAL_DEBUG
8
9
DTNumberingScheme::DTNumberingScheme
(
const
MuonGeometryConstants
& muonConstants) {
initMe
(muonConstants); }
10
11
void
DTNumberingScheme::initMe
(
const
MuonGeometryConstants
& muonConstants) {
12
int
theLevelPart = muonConstants.
getValue
(
"level"
);
13
theRegionLevel
= muonConstants.
getValue
(
"mb_region"
) / theLevelPart;
14
theWheelLevel
= muonConstants.
getValue
(
"mb_wheel"
) / theLevelPart;
15
theStationLevel
= muonConstants.
getValue
(
"mb_station"
) / theLevelPart;
16
theSuperLayerLevel
= muonConstants.
getValue
(
"mb_superlayer"
) / theLevelPart;
17
theLayerLevel
= muonConstants.
getValue
(
"mb_layer"
) / theLevelPart;
18
theWireLevel
= muonConstants.
getValue
(
"mb_wire"
) / theLevelPart;
19
#ifdef LOCAL_DEBUG
20
edm::LogVerbatim
(
"DTNumberingScheme"
) <<
"Initialize DTNumberingScheme"
21
<<
"\ntheRegionLevel "
<<
theRegionLevel
<<
"\ntheWheelLevel "
<<
theWheelLevel
22
<<
"\ntheStationLevel "
<<
theStationLevel
<<
"\ntheSuperLayerLevel "
23
<<
theSuperLayerLevel
<<
"\ntheLayerLevel "
<<
theLayerLevel
24
<<
"\ntheWireLevel "
<<
theWireLevel
;
25
#endif
26
}
27
28
int
DTNumberingScheme::baseNumberToUnitNumber
(
const
MuonBaseNumber
&
num
) {
29
#ifdef LOCAL_DEBUG
30
edm::LogVerbatim
(
"DTNumberingScheme"
) <<
"DTNumbering "
<<
num
.getLevels();
31
for
(
int
level
= 1;
level
<=
num
.getLevels();
level
++) {
32
edm::LogVerbatim
(
"DTNumberingScheme"
) <<
level
<<
" "
<<
num
.getSuperNo(
level
) <<
" "
<<
num
.getBaseNo(
level
);
33
}
34
#endif
35
if
(
num
.getLevels() !=
theWireLevel
) {
36
edm::LogWarning
(
"DTNumberingScheme"
) <<
"DTNumberingScheme::BNToUN: BaseNumber has "
<<
num
.getLevels()
37
<<
" levels, need "
<<
theWireLevel
;
38
return
0;
39
}
40
41
// // Meaningful ranges are enforced by DTWireId, (which
42
// // however allows for 0 in wire, layer, superlayer!!!)
43
//
44
// if ((wire_id < 1) || (wire_id > 100)) {
45
// std::cout << "DTNumberingScheme: ";
46
// std::cout << "wire id out of range: ";
47
// std::cout << wire_id <<std::endl;
48
// }
49
50
// if ((layer_id < 1) || (layer_id > 4)) {
51
// std::cout << "DTNumberingScheme: ";
52
// std::cout << "layer id out of range: ";
53
// std::cout << layer_id <<std::endl;
54
// }
55
56
// if ((superlayer_id < 1) || (superlayer_id > 3)) {
57
// std::cout << "DTNumberingScheme: ";
58
// std::cout << "super-layer id out of range: ";
59
// std::cout << superlayer_id <<std::endl;
60
// }
61
62
return
getDetId
(
num
);
63
}
64
65
int
DTNumberingScheme::getDetId
(
const
MuonBaseNumber
&
num
)
const
{
66
int
wire_id = 0;
67
int
layer_id = 0;
68
int
superlayer_id = 0;
69
int
sector_id = 0;
70
int
station_id = 0;
71
int
wheel_id = 0;
72
73
//decode significant barrel levels
74
decode
(
num
, wire_id, layer_id, superlayer_id, sector_id, station_id, wheel_id);
75
76
// These ranges are enforced by DTWireId
77
// if ((sector_id < 1) || (sector_id > 14)) {
78
// std::cout << "DTNumberingScheme: ";
79
// std::cout << "sector id out of range: ";
80
// std::cout << sector_id <<std::endl;
81
// }
82
83
// if ((station_id < 1) || (station_id > 4)) {
84
// std::cout << "DTNumberingScheme: ";
85
// std::cout << "station id out of range: ";
86
// std::cout << station_id <<std::endl;
87
// }
88
89
// if ((wheel_id < -2) || (wheel_id > 2)) {
90
// std::cout << "DTNumberingScheme: ";
91
// std::cout << "wheel id out of range: ";
92
// std::cout << wheel_id <<std::endl;
93
// }
94
95
DTWireId
id
(wheel_id, station_id, sector_id, superlayer_id, layer_id, wire_id);
96
97
#ifdef LOCAL_DEBUG
98
edm::LogVerbatim
(
"DTNumberingScheme"
) <<
"DTNumberingScheme: "
<<
id
;
99
#endif
100
101
return
id
.rawId();
102
}
103
104
void
DTNumberingScheme::decode
(
const
MuonBaseNumber
&
num
,
105
int
& wire_id,
106
int
& layer_id,
107
int
& superlayer_id,
108
int
& sector_id,
109
int
& station_id,
110
int
& wheel_id)
const
{
111
for
(
int
level
= 1;
level
<=
num
.getLevels();
level
++) {
112
//decode
113
if
(
level
==
theWheelLevel
) {
114
const
int
copyno =
num
.getBaseNo(
level
);
115
wheel_id = copyno - 2;
116
117
}
else
if
(
level
==
theStationLevel
) {
118
const
int
station_tag =
num
.getSuperNo(
level
);
119
const
int
copyno =
num
.getBaseNo(
level
);
120
station_id = station_tag;
121
sector_id = copyno + 1;
122
123
}
else
if
(
level
==
theSuperLayerLevel
) {
124
const
int
copyno =
num
.getBaseNo(
level
);
125
superlayer_id = copyno + 1;
126
127
}
else
if
(
level
==
theLayerLevel
) {
128
const
int
copyno =
num
.getBaseNo(
level
);
129
layer_id = copyno + 1;
130
131
}
else
if
(
level
==
theWireLevel
) {
132
const
int
copyno =
num
.getBaseNo(
level
);
133
wire_id = copyno + 1;
134
}
135
}
136
}
personalPlayback.level
level
Definition:
personalPlayback.py:22
MuonGeometryConstants
Definition:
MuonGeometryConstants.h:20
DTNumberingScheme::theLayerLevel
int theLayerLevel
Definition:
DTNumberingScheme.h:43
MessageLogger.h
DTNumberingScheme::initMe
void initMe(const MuonGeometryConstants &muonConstants)
Definition:
DTNumberingScheme.cc:11
MuonGeometryConstants.h
DTNumberingScheme::theWireLevel
int theWireLevel
Definition:
DTNumberingScheme.h:44
DTNumberingScheme::theStationLevel
int theStationLevel
Definition:
DTNumberingScheme.h:41
DTNumberingScheme::getDetId
int getDetId(const MuonBaseNumber &num) const
Definition:
DTNumberingScheme.cc:65
DTNumberingScheme::baseNumberToUnitNumber
int baseNumberToUnitNumber(const MuonBaseNumber &num) override
Definition:
DTNumberingScheme.cc:28
DTWireId
Definition:
DTWireId.h:12
DTNumberingScheme::theRegionLevel
int theRegionLevel
Definition:
DTNumberingScheme.h:39
edm::LogWarning
Definition:
MessageLogger.h:141
MuonBaseNumber.h
edm::LogVerbatim
Definition:
MessageLogger.h:297
MuonGeometryConstants::getValue
int getValue(const std::string &name) const
Definition:
MuonGeometryConstants.cc:8
DTNumberingScheme.h
EgammaValidation_cff.num
num
Definition:
EgammaValidation_cff.py:34
MuonBaseNumber
Definition:
MuonBaseNumber.h:21
DTWireId.h
triggerObjects_cff.id
id
Definition:
triggerObjects_cff.py:31
DTNumberingScheme::theSuperLayerLevel
int theSuperLayerLevel
Definition:
DTNumberingScheme.h:42
DTNumberingScheme::decode
void decode(const MuonBaseNumber &num, int &wire_id, int &layer_id, int &superlayer_id, int §or_id, int &station_id, int &wheel_id) const
Definition:
DTNumberingScheme.cc:104
DTNumberingScheme::DTNumberingScheme
DTNumberingScheme(const MuonGeometryConstants &muonConstants)
Definition:
DTNumberingScheme.cc:9
DTNumberingScheme::theWheelLevel
int theWheelLevel
Definition:
DTNumberingScheme.h:40
Generated for CMSSW Reference Manual by
1.8.16