Geometry
TrackerCommonData
plugins
dd4hep
DDTECCoolAlgo.cc
Go to the documentation of this file.
1
#include "DD4hep/DetFactoryHelper.h"
2
#include "DD4hep/Printout.h"
3
#include "
DataFormats/Math/interface/CMSUnits.h
"
4
#include "
DetectorDescription/DDCMS/interface/DDPlugins.h
"
5
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
6
7
#include <sstream>
8
9
using namespace
std
;
10
using namespace
dd4hep
;
11
using namespace
cms
;
12
using namespace
cms_units::operators
;
13
14
static
long
algorithm
(
Detector
&
/* description */
,
cms::DDParsingContext
& ctxt, xml_h
e
,
SensitiveDetector
&
/* sens */
) {
15
cms::DDNamespace
ns(ctxt,
e
,
true
);
16
DDAlgoArguments
args
(ctxt,
e
);
17
int
startCopyNo =
args
.find(
"StartCopyNo"
) ?
args
.value<
int
>(
"StartCopyNo"
) : 1;
18
double
rPosition =
args
.value<
double
>(
"RPosition"
);
19
vector<double> phiPosition =
args
.value<vector<double> >(
"PhiPosition"
);
20
vector<string> coolInsert =
args
.value<vector<string> >(
"CoolInsert"
);
21
Volume
mother = ns.
volume
(
args
.parentName());
22
23
LogDebug
(
"TECGeom"
) <<
"DDTECCoolAlgo debug: Parent "
<< mother.name() <<
" NameSpace "
<< ns.
name
()
24
<<
" at radial Position "
<< rPosition;
25
if
(phiPosition.size() == coolInsert.size()) {
26
for
(
int
i
= 0;
i
< (
int
)(phiPosition.size());
i
++) {
27
LogDebug
(
"TECGeom"
) <<
"DDTECCoolAlgo debug: Insert["
<<
i
<<
"]: "
<< coolInsert.at(
i
) <<
" at Phi "
28
<<
convertRadToDeg
(phiPosition.at(
i
));
29
}
30
}
else
{
31
LogDebug
(
"TECGeom"
) <<
"DDTECCoolAlgo ERROR: Number of inserts does not match the numer of PhiPositions!"
;
32
}
33
34
int
copyNo = startCopyNo;
35
// loop over the inserts to be placed
36
for
(
int
i
= 0;
i
< (
int
)(coolInsert.size());
i
++) {
37
Volume
child
= ns.
volume
(ns.
realName
(coolInsert.at(
i
)));
38
// get positions
39
double
xpos = rPosition *
cos
(phiPosition.at(
i
));
40
double
ypos = -rPosition *
sin
(phiPosition.at(
i
));
41
// place inserts
42
Position
tran(xpos, ypos, 0.0);
43
mother.placeVolume(
child
, copyNo, tran);
44
LogDebug
(
"TECGeom"
) <<
"DDTECCoolAlgo test "
<<
child
.name() <<
"["
<< copyNo <<
"] positioned in "
<< mother.name()
45
<<
" at "
<< tran <<
" phi "
<<
convertRadToDeg
(phiPosition.at(
i
)) <<
" r "
<< rPosition;
46
copyNo++;
47
}
48
LogDebug
(
"TECGeom"
) <<
"DDTECCoolAlgo Finished...."
;
49
return
1;
50
}
51
52
// first argument is the type from the xml file
53
DECLARE_DDCMS_DETELEMENT
(DDCMS_track_DDTECCoolAlgo,
algorithm
)
writedatasetfile.args
args
Definition:
writedatasetfile.py:18
cms::DDNamespace::realName
std::string realName(const std::string &) const
Definition:
DDNamespace.cc:73
mps_fire.i
i
Definition:
mps_fire.py:355
cms_units::operators
Definition:
CMSUnits.h:13
MessageLogger.h
DECLARE_DDCMS_DETELEMENT
#define DECLARE_DDCMS_DETELEMENT(name, func)
Definition:
DDPlugins.h:30
cms::DDParsingContext
Definition:
DDParsingContext.h:14
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition:
angle_units.h:21
cms::DDNamespace
Definition:
DDNamespace.h:16
SensitiveDetector
Definition:
SensitiveDetector.h:25
funct::sin
Sin< T >::type sin(const T &t)
Definition:
Sin.h:22
funct::cos
Cos< T >::type cos(const T &t)
Definition:
Cos.h:22
PixelTestBeamValidation_cfi.Position
Position
Definition:
PixelTestBeamValidation_cfi.py:62
cms::Volume
dd4hep::Volume Volume
Definition:
DDFilteredView.h:45
LogDebug
#define LogDebug(id)
Definition:
MessageLogger.h:670
DDPlugins.h
createfilelist.int
int
Definition:
createfilelist.py:10
cms::DDAlgoArguments
Definition:
DDAlgoArguments.h:28
align::Detector
Definition:
StructureType.h:86
std
Definition:
JetResolutionObject.h:76
dd4hep
Definition:
DDPlugins.h:8
CMSUnits.h
child
Definition:
simpleInheritance.h:11
cms::DDNamespace::name
std::string_view name() const
Definition:
DDNamespace.h:68
cms::DDNamespace::volume
dd4hep::Volume volume(const std::string &name, bool exc=true) const
Definition:
DDNamespace.cc:190
cms
Namespace of DDCMS conversion namespace.
Definition:
ProducerAnalyzer.cc:21
algorithm
static long algorithm(Detector &, cms::DDParsingContext &ctxt, xml_h e, SensitiveDetector &)
Definition:
DDTECCoolAlgo.cc:14
MillePedeFileConverter_cfg.e
e
Definition:
MillePedeFileConverter_cfg.py:37
Generated for CMSSW Reference Manual by
1.8.16