Geometry
MuonNumbering
src
MuonDDDNumbering.cc
Go to the documentation of this file.
1
#include "
Geometry/MuonNumbering/interface/MuonDDDNumbering.h
"
2
#include "
Geometry/MuonNumbering/interface/MuonBaseNumber.h
"
3
#include "
Geometry/MuonNumbering/interface/MuonGeometryConstants.h
"
4
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
5
6
//#define LOCAL_DEBUG
7
8
MuonDDDNumbering::MuonDDDNumbering
(
const
MuonGeometryConstants
&muonConstants) {
9
// Get constant values from muonConstants
10
theLevelPart
= muonConstants.
getValue
(
"level"
);
11
theSuperPart
= muonConstants.
getValue
(
"super"
);
12
theBasePart
= muonConstants.
getValue
(
"base"
);
13
theStartCopyNo
= muonConstants.
getValue
(
"xml_starts_with_copyno"
);
14
15
// some consistency checks
16
17
if
(
theBasePart
!= 1) {
18
edm::LogWarning
(
"Geometry"
) <<
"MuonDDDNumbering finds unusual base constant:"
<<
theBasePart
;
19
}
20
if
(
theSuperPart
< 100) {
21
edm::LogWarning
(
"Geometry"
) <<
"MuonDDDNumbering finds unusual super constant:"
<<
theSuperPart
;
22
}
23
if
(
theLevelPart
< 10 *
theSuperPart
) {
24
edm::LogWarning
(
"Geometry"
) <<
"MuonDDDNumbering finds unusual level constant:"
<<
theLevelPart
;
25
}
26
if
((
theStartCopyNo
!= 0) && (
theStartCopyNo
!= 1)) {
27
edm::LogWarning
(
"Geometry"
) <<
"MuonDDDNumbering finds unusual start value for copy numbers:"
<<
theStartCopyNo
;
28
}
29
30
#ifdef LOCAL_DEBUG
31
edm::LogVerbatim
(
"Geometry"
) <<
"MuonDDDNumbering configured with"
32
<<
" Level = "
<<
theLevelPart
<<
" Super = "
<<
theSuperPart
33
<<
" Base = "
<<
theBasePart
<<
" StartCopyNo = "
<<
theStartCopyNo
;
34
#endif
35
}
36
37
MuonBaseNumber
MuonDDDNumbering::geoHistoryToBaseNumber
(
const
DDGeoHistory
&history)
const
{
38
MuonBaseNumber
num
;
39
40
#ifdef LOCAL_DEBUG
41
edm::LogVerbatim
(
"Geometry"
) <<
"MuonDDDNumbering create MuonBaseNumber for "
<< history;
42
#endif
43
44
//loop over all parents and check
45
DDGeoHistory::const_iterator cur = history.begin();
46
DDGeoHistory::const_iterator
end
= history.end();
47
while
(cur !=
end
) {
48
const
DDLogicalPart
&ddlp = cur->logicalPart();
49
const
int
tag
=
getInt
(
"CopyNoTag"
, ddlp) /
theLevelPart
;
50
if
(
tag
> 0) {
51
const
int
offset
=
getInt
(
"CopyNoOffset"
, ddlp);
52
const
int
copyno = (cur->copyno()) +
offset
%
theSuperPart
;
53
const
int
super =
offset
/
theSuperPart
;
54
num
.addBase(
tag
, super, copyno -
theStartCopyNo
);
55
}
56
cur++;
57
}
58
59
#ifdef LOCAL_DEBUG
60
edm::LogVerbatim
(
"Geometry"
) <<
"MuonDDDNumbering::"
<<
num
.getLevels();
61
for
(
int
i
= 1;
i
<=
num
.getLevels();
i
++) {
62
edm::LogVerbatim
(
"Geometry"
) <<
"["
<<
i
<<
"] "
<<
num
.getSuperNo(
i
) <<
" "
<<
num
.getBaseNo(
i
);
63
}
64
#endif
65
66
return
num
;
67
}
68
69
MuonBaseNumber
MuonDDDNumbering::geoHistoryToBaseNumber
(
const
cms::ExpandedNodes
&
nodes
)
const
{
70
MuonBaseNumber
num
;
71
72
int
ctr
(0);
73
for
(
auto
const
&it :
nodes
.tags) {
74
int
tag
= it /
theLevelPart
;
75
if
(
tag
> 0) {
76
int
offset
=
nodes
.offsets[
ctr
];
77
int
copyno =
nodes
.copyNos[
ctr
] +
offset
%
theSuperPart
;
78
int
super =
offset
/
theSuperPart
;
79
num
.addBase(
tag
, super, copyno -
theStartCopyNo
);
80
}
81
++
ctr
;
82
}
83
return
num
;
84
}
85
86
int
MuonDDDNumbering::getInt
(
const
std::string
&
s
,
const
DDLogicalPart
&
part
)
const
{
87
DDValue
val
(
s
);
88
std::vector<const DDsvalues_type *>
result
=
part
.specifics();
89
std::vector<const DDsvalues_type *>::iterator it =
result
.begin();
90
bool
foundIt =
false
;
91
for
(; it !=
result
.end(); ++it) {
92
foundIt =
DDfetch
(*it,
val
);
93
if
(foundIt)
94
break
;
95
}
96
if
(foundIt) {
97
std::vector<double>
temp
=
val
.doubles();
98
if
(
temp
.size() != 1) {
99
edm::LogError
(
"Geometry"
) <<
"MuonDDDNumbering:: ERROR: I need only 1 "
<<
s
<<
" in DDLogicalPart "
100
<<
part
.name();
101
abort();
102
}
103
return
int
(
temp
[0]);
104
}
else
105
return
0;
106
}
MuonGeometryConstants
Definition:
MuonGeometryConstants.h:20
mps_fire.i
i
Definition:
mps_fire.py:355
DDGeoHistory
std::vector< DDExpandedNode > DDGeoHistory
Geometrical 'path' of the current node up to the root-node.
Definition:
DDExpandedNode.h:82
MessageLogger.h
MuonDDDNumbering::geoHistoryToBaseNumber
MuonBaseNumber geoHistoryToBaseNumber(const DDGeoHistory &history) const
Definition:
MuonDDDNumbering.cc:37
MuonGeometryConstants.h
groupFilesInBlocks.temp
list temp
Definition:
groupFilesInBlocks.py:142
end
#define end
Definition:
vmac.h:39
alignCSCRings.s
s
Definition:
alignCSCRings.py:92
MuonDDDNumbering::MuonDDDNumbering
MuonDDDNumbering(const MuonGeometryConstants &muonConstants)
Definition:
MuonDDDNumbering.cc:8
part
part
Definition:
HCALResponse.h:20
MuonDDDNumbering::theStartCopyNo
int theStartCopyNo
Definition:
MuonDDDNumbering.h:38
MuonDDDNumbering::theBasePart
int theBasePart
Definition:
MuonDDDNumbering.h:37
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition:
GlobalPosition_Frontier_DevDB_cff.py:11
class-composition.nodes
nodes
Definition:
class-composition.py:75
DDfetch
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition:
DDsvalues.cc:79
MuonDDDNumbering::theLevelPart
int theLevelPart
Definition:
MuonDDDNumbering.h:35
MuonDDDNumbering::getInt
int getInt(const std::string &s, const DDLogicalPart &part) const
Definition:
MuonDDDNumbering.cc:86
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition:
MessageLogger.h:141
edm::LogError
Definition:
MessageLogger.h:183
dqmiodatasetharvest.ctr
ctr
Definition:
dqmiodatasetharvest.py:191
MuonBaseNumber.h
cms::ExpandedNodes
Definition:
ExpandedNodes.h:26
DDLogicalPart
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
Definition:
DDLogicalPart.h:93
createfilelist.int
int
Definition:
createfilelist.py:10
edm::LogVerbatim
Definition:
MessageLogger.h:297
MuonGeometryConstants::getValue
int getValue(const std::string &name) const
Definition:
MuonGeometryConstants.cc:8
EgammaValidation_cff.num
num
Definition:
EgammaValidation_cff.py:34
MuonBaseNumber
Definition:
MuonBaseNumber.h:21
heppy_batch.val
val
Definition:
heppy_batch.py:351
MuonDDDNumbering::theSuperPart
int theSuperPart
Definition:
MuonDDDNumbering.h:36
DDValue
Definition:
DDValue.h:21
mps_fire.result
result
Definition:
mps_fire.py:303
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition:
hltrates_dqm_sourceclient-live_cfg.py:78
MuonDDDNumbering.h
Generated for CMSSW Reference Manual by
1.8.16