Geometry
ForwardCommonData
plugins
dd4hep
DDBHMAngular.cc
Go to the documentation of this file.
1
#include "
DataFormats/Math/interface/GeantUnits.h
"
2
#include "
DetectorDescription/Core/interface/DDSplit.h
"
3
#include "
DetectorDescription/DDCMS/interface/DDPlugins.h
"
4
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
5
#include "DD4hep/DetFactoryHelper.h"
6
7
//#define EDM_ML_DEBUG
8
using namespace
geant_units::operators
;
9
10
static
long
algorithm
(
dd4hep::Detector
&
/* description */
,
11
cms::DDParsingContext
& ctxt,
12
xml_h
e
,
13
dd4hep::SensitiveDetector&
/* sens */
) {
14
cms::DDNamespace
ns(ctxt,
e
,
true
);
15
cms::DDAlgoArguments
args
(ctxt,
e
);
16
int
units
=
args
.value<
int
>(
"number"
);
17
double
rr
=
args
.value<
double
>(
"radius"
);
18
double
dphi =
args
.value<
double
>(
"deltaPhi"
);
19
#ifdef EDM_ML_DEBUG
20
edm::LogVerbatim
(
"ForwardGeom"
) <<
"DDBHMAngular debug: Parameters for positioning-- "
<<
units
21
<<
" copies at radius "
<<
convertMmToCm
(
rr
) <<
" cm with delta(phi) "
22
<<
convertRadToDeg
(dphi);
23
#endif
24
std::string
rotMat =
args
.value<
std::string
>(
"Rotation"
);
25
std::string
childName =
args
.value<
std::string
>(
"ChildName"
);
26
dd4hep::Volume
parent
= ns.
volume
(
args
.parentName());
27
dd4hep::Volume
child
= ns.
volume
(ns.
prepend
(childName));
28
#ifdef EDM_ML_DEBUG
29
edm::LogVerbatim
(
"ForwardGeom"
) <<
"DDBHMAngular debug: Parent "
<<
parent
.name() <<
"\tChild "
<<
child
.name()
30
<<
"\tRotation matrix "
<< rotMat;
31
#endif
32
std::string
rotstr =
DDSplit
(rotMat).first;
33
dd4hep::Rotation3D
rot
;
34
if
(rotstr !=
"NULL"
) {
35
rot
= ns.
rotation
(rotMat);
36
}
37
static
const
int
startpos = 16;
38
static
const
double
fac1
= 0.5;
39
static
const
double
fac2
= 1.5;
40
for
(
int
jj
= 0;
jj
<
units
;
jj
++) {
41
double
driverX(0), driverY(0), driverZ(0);
42
if
(
jj
< startpos) {
43
driverX =
rr
*
cos
((
jj
+
fac1
) * dphi);
44
driverY =
sqrt
(
rr
*
rr
- driverX * driverX);
45
}
else
if
(
jj
== startpos) {
46
driverX =
rr
*
cos
((startpos -
fac1
) * dphi);
47
driverY = -
sqrt
(
rr
*
rr
- driverX * driverX);
48
}
else
if
(
jj
== startpos + 1) {
49
driverX =
rr
*
cos
((startpos -
fac2
) * dphi);
50
driverY = -
sqrt
(
rr
*
rr
- driverX * driverX);
51
}
else
if
(
jj
== startpos + 2) {
52
driverX =
rr
*
cos
(
fac1
* dphi);
53
driverY = -
sqrt
(
rr
*
rr
- driverX * driverX);
54
}
else
if
(
jj
== startpos + 3) {
55
driverX =
rr
*
cos
(
fac2
* dphi);
56
driverY = -
sqrt
(
rr
*
rr
- driverX * driverX);
57
}
58
dd4hep::Position
tran(driverX, driverY, driverZ);
59
60
parent
.placeVolume(
child
,
jj
+ 1, dd4hep::Transform3D(
rot
, tran));
61
#ifdef EDM_ML_DEBUG
62
edm::LogVerbatim
(
"ForwardGeom"
) <<
"DDBHMAngular test: "
<<
child
.name() <<
" number "
<<
jj
+ 1
63
<<
" positioned in "
<<
parent
.name() <<
" at "
<< tran <<
" with "
<<
rot
;
64
#endif
65
}
66
return
1;
67
}
68
69
// first argument is the type from the xml file
70
DECLARE_DDCMS_DETELEMENT
(DDCMS_forward_DDBHMAngular,
algorithm
)
writedatasetfile.args
args
Definition:
writedatasetfile.py:18
MessageLogger.h
DECLARE_DDCMS_DETELEMENT
#define DECLARE_DDCMS_DETELEMENT(name, func)
Definition:
DDPlugins.h:30
cms::DDParsingContext
Definition:
DDParsingContext.h:14
findQualityFiles.rr
string rr
Definition:
findQualityFiles.py:185
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition:
angle_units.h:21
cms::DDNamespace
Definition:
DDNamespace.h:16
DDSplit.h
isotrackTrainRegressor.fac2
def fac2(jeta)
Definition:
isotrackTrainRegressor.py:113
geant_units::operators
Definition:
GeantUnits.h:18
units
TString units(TString variable, Char_t axis)
funct::cos
Cos< T >::type cos(const T &t)
Definition:
Cos.h:22
mathSSE::sqrt
T sqrt(T t)
Definition:
SSEVec.h:19
cms::DDNamespace::prepend
std::string prepend(const std::string &) const
Definition:
DDNamespace.cc:66
PixelTestBeamValidation_cfi.Position
Position
Definition:
PixelTestBeamValidation_cfi.py:62
cms::DDNamespace::rotation
const dd4hep::Rotation3D & rotation(const std::string &name) const
Definition:
DDNamespace.cc:130
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
cms::Volume
dd4hep::Volume Volume
Definition:
DDFilteredView.h:45
GeantUnits.h
DDPlugins.h
edm::LogVerbatim
Definition:
MessageLogger.h:297
cms::DDAlgoArguments
Definition:
DDAlgoArguments.h:28
align::Detector
Definition:
StructureType.h:86
algorithm
static long algorithm(dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e, dd4hep::SensitiveDetector &)
Definition:
DDBHMAngular.cc:10
findQualityFiles.jj
string jj
Definition:
findQualityFiles.py:188
makeMuonMisalignmentScenario.rot
rot
Definition:
makeMuonMisalignmentScenario.py:322
geant_units::operators::convertMmToCm
constexpr NumType convertMmToCm(NumType millimeters)
Definition:
GeantUnits.h:62
child
Definition:
simpleInheritance.h:11
class-composition.parent
parent
Definition:
class-composition.py:88
cms::DDNamespace::volume
dd4hep::Volume volume(const std::string &name, bool exc=true) const
Definition:
DDNamespace.cc:190
DDSplit
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
Definition:
DDSplit.cc:3
isotrackTrainRegressor.fac1
def fac1(jeta)
Definition:
isotrackTrainRegressor.py:107
MillePedeFileConverter_cfg.e
e
Definition:
MillePedeFileConverter_cfg.py:37
Generated for CMSSW Reference Manual by
1.8.16