Geometry
MuonCommonData
plugins
dd4hep
DDMuonAngular.cc
Go to the documentation of this file.
1
#include "DD4hep/DetFactoryHelper.h"
2
#include "
DataFormats/Math/interface/angle_units.h
"
3
#include "
DetectorDescription/DDCMS/interface/DDPlugins.h
"
4
#include "
DetectorDescription/DDCMS/interface/DDutils.h
"
5
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
6
7
//#define EDM_ML_DEBUG
8
9
using namespace
angle_units::operators
;
10
11
static
long
algorithm
(
dd4hep::Detector
&
/* description */
,
cms::DDParsingContext
& context, xml_h element) {
12
cms::DDNamespace
ns(context, element,
true
);
13
cms::DDAlgoArguments
args
(context, element);
14
15
int
n
=
args
.value<
int
>(
"n"
);
16
int
startCopyNo =
args
.find(
"startCopyNo"
) ?
args
.value<
int
>(
"startCopyNo"
) : 1;
17
int
incrCopyNo =
args
.find(
"incrCopyNo"
) ?
args
.value<
int
>(
"incrCopyNo"
) : 1;
18
float
startAngle =
args
.value<
float
>(
"startAngle"
);
19
float
stepAngle =
args
.value<
float
>(
"stepAngle"
);
20
float
zoffset =
args
.value<
float
>(
"zoffset"
);
21
std::string
rotns =
args
.value<
std::string
>(
"RotNameSpace"
);
22
dd4hep::Volume
mother = ns.
volume
(
args
.parentName());
23
std::string
childName =
args
.value<
std::string
>(
"ChildName"
);
24
childName = ns.
prepend
(childName);
25
dd4hep::Volume
child
= ns.
volume
(childName);
26
27
#ifdef EDM_ML_DEBUG
28
edm::LogVerbatim
(
"MuonGeom"
) <<
"DDMuonAngular: Parameters for positioning:: n "
<<
n
<<
" Start, Step "
29
<<
convertRadToDeg
(startAngle) <<
", "
<<
convertRadToDeg
(stepAngle) <<
", zoffset "
30
<<
cms::convert2mm
(zoffset) <<
", RotNameSpace "
<< rotns;
31
edm::LogVerbatim
(
"MuonGeom"
) <<
"DDMuonAngular: Parent "
<< mother.name() <<
"\tChild "
<<
child
.name()
32
<<
" NameSpace "
<< ns.
name
();
33
#endif
34
double
phi = startAngle;
35
int
copyNo = startCopyNo;
36
37
for
(
int
i
= 0;
i
<
n
; ++
i
) {
38
double
phitmp = phi;
39
if
(phitmp >= 2._pi)
40
phitmp -= 2._pi;
41
dd4hep::Rotation3D
rotation
=
cms::makeRotation3D
(90._deg, phitmp, 90._deg, 90._deg + phitmp, 0., 0.);
42
std::string
rotstr = ns.
nsName
(
child
.name()) + std::to_string(phitmp * 10.);
43
auto
irot = context.
rotations
.find(ns.
prepend
(rotstr));
44
if
(irot != context.
rotations
.end()) {
45
rotation
= ns.
rotation
(ns.
prepend
(rotstr));
46
}
47
dd4hep::Position
tran(0., 0., zoffset);
48
mother.placeVolume(
child
, copyNo, dd4hep::Transform3D(
rotation
, tran));
49
#ifdef EDM_ML_DEBUG
50
edm::LogVerbatim
(
"MuonGeom"
) <<
"DDMuonAngular:"
<<
child
.name() <<
" number "
<< copyNo <<
" positioned in "
51
<< mother.name() <<
" at (0,0,"
<<
cms::convert2mm
(zoffset) <<
") with "
<< rotstr
52
<<
": "
<<
rotation
;
53
#endif
54
phi += stepAngle;
55
copyNo += incrCopyNo;
56
}
57
return
cms::s_executed
;
58
}
59
60
// first argument is the type from the xml file
61
DECLARE_DDCMS_DETELEMENT
(DDCMS_muon_DDMuonAngular,
algorithm
)
writedatasetfile.args
args
Definition:
writedatasetfile.py:18
mps_fire.i
i
Definition:
mps_fire.py:428
MessageLogger.h
dqmiodumpmetadata.n
n
Definition:
dqmiodumpmetadata.py:28
DECLARE_DDCMS_DETELEMENT
#define DECLARE_DDCMS_DETELEMENT(name, func)
Definition:
DDPlugins.h:25
cms::DDParsingContext
Definition:
DDParsingContext.h:13
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition:
angle_units.h:21
cms::DDNamespace
Definition:
DDNamespace.h:16
cms::makeRotation3D
DDRotationMatrix makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
Definition:
DDAlgoArguments.cc:20
algorithm
static long algorithm(dd4hep::Detector &, cms::DDParsingContext &context, xml_h element)
Definition:
DDMuonAngular.cc:11
cms::DDParsingContext::rotations
std::unordered_map< std::string, dd4hep::Rotation3D > rotations
Definition:
DDParsingContext.h:71
cms::DDNamespace::prepend
std::string prepend(const std::string &) const
Definition:
DDNamespace.cc:60
PixelTestBeamValidation_cfi.Position
Position
Definition:
PixelTestBeamValidation_cfi.py:75
cms::DDNamespace::rotation
const dd4hep::Rotation3D & rotation(const std::string &name) const
Definition:
DDNamespace.cc:125
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
cms::Volume
dd4hep::Volume Volume
Definition:
DDFilteredView.h:47
idealTransformation.rotation
dictionary rotation
Definition:
idealTransformation.py:1
angle_units::operators
Definition:
angle_units.h:11
DDPlugins.h
cms::convert2mm
constexpr NumType convert2mm(NumType length)
Definition:
DDutils.h:7
cms::DDAlgoArguments
Definition:
DDAlgoArguments.h:28
cms::s_executed
static constexpr long s_executed
Definition:
DDAlgoArguments.h:16
align::Detector
Definition:
StructureType.h:92
cms::DDNamespace::nsName
static std::string nsName(const std::string &)
Definition:
DDNamespace.cc:83
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition:
MessageLogger.h:128
angle_units.h
child
Definition:
simpleInheritance.h:11
cms::DDNamespace::name
std::string_view name() const
Definition:
DDNamespace.h:72
cms::DDNamespace::volume
dd4hep::Volume volume(const std::string &name, bool exc=true) const
Definition:
DDNamespace.cc:205
DDutils.h
Generated for CMSSW Reference Manual by
1.8.16