CMS 3D CMS Logo

DDTrackerLinear.cc
Go to the documentation of this file.
1 #include "DD4hep/DetFactoryHelper.h"
4 
5 using namespace std;
6 using namespace dd4hep;
7 using namespace cms;
8 
9 static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, xml_h e) {
10  cms::DDNamespace ns(ctxt, e, true);
11  DDAlgoArguments args(ctxt, e);
12  int startcn = args.find("StartCopyNo") ? args.value<int>("StartCopyNo") : 1;
13  int incrcn = args.find("IncrCopyNo") ? args.value<int>("IncrCopyNo") : 1;
14  int number = args.value<int>("Number");
15  double theta = args.value<double>("Theta");
16  double phi = args.value<double>("Phi");
17  double offset = args.value<double>("Offset");
18  double delta = args.value<double>("Delta");
19  vector<double> centre = args.value<vector<double> >("Center");
20  string rotMat = args.value<string>("Rotation");
21  Volume mother = ns.volume(args.parentName());
22  Volume child = ns.volume(args.value<string>("ChildName"));
23 
24  edm::LogVerbatim("TrackerGeom") << "DDTrackerLinear +++ Executing Algorithm. rParent:" << mother.name();
25  edm::LogVerbatim("TrackerGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace "
26  << ns.name() << "\tNumber " << number << "\tAxis (theta/phi) " << theta / dd4hep::deg
27  << ", " << phi / dd4hep::deg << "\t(Offset/Delta) " << offset << ", " << delta
28  << "\tCentre " << centre[0] << ", " << centre[1] << ", " << centre[2] << "\tRotation "
29  << rotMat;
30 
31  Position direction(sin(theta) * cos(phi), sin(theta) * sin(phi), cos(theta));
32  Position base(centre[0], centre[1], centre[2]);
33 
34  const Rotation3D& rot = ns.rotation(rotMat);
35 
36  for (int i = 0, ci = startcn; i < number; i++, ci += incrcn) {
37  Position tran = base + (offset + double(i) * delta) * direction;
38  mother.placeVolume(child, ci, Transform3D(rot, tran));
39 
40  edm::LogVerbatim("TrackerGeom") << child.name() << " number " << ci << " positioned in " << mother.name() << " at "
41  << tran << " with " << rot;
42  }
43  return cms::s_executed;
44 }
45 
46 // first argument is the type from the xml file
47 DECLARE_DDCMS_DETELEMENT(DDCMS_track_DDTrackerLinear, algorithm)
writedatasetfile.args
args
Definition: writedatasetfile.py:18
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
DECLARE_DDCMS_DETELEMENT
#define DECLARE_DDCMS_DETELEMENT(name, func)
Definition: DDPlugins.h:25
cms::DDParsingContext
Definition: DDParsingContext.h:14
cms::DDNamespace
Definition: DDNamespace.h:22
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
contentValuesFiles.number
number
Definition: contentValuesFiles.py:53
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
PixelTestBeamValidation_cfi.Position
Position
Definition: PixelTestBeamValidation_cfi.py:83
cms::DDNamespace::rotation
const dd4hep::Rotation3D & rotation(const std::string &name) const
Definition: DDNamespace.cc:170
cms::Volume
dd4hep::Volume Volume
Definition: DDFilteredView.h:47
dumpMFGeometry_cfg.delta
delta
Definition: dumpMFGeometry_cfg.py:25
DDPlugins.h
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
cms::s_executed
static constexpr long s_executed
Definition: DDAlgoArguments.h:16
align::Detector
Definition: StructureType.h:92
std
Definition: JetResolutionObject.h:76
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
dd4hep
Definition: DDPlugins.h:8
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
child
Definition: simpleInheritance.h:11
algorithm
static long algorithm(Detector &, cms::DDParsingContext &ctxt, xml_h e)
Definition: DDTrackerLinear.cc:9
newFWLiteAna.base
base
Definition: newFWLiteAna.py:92
cms::DDNamespace::name
std::string_view name() const
Definition: DDNamespace.h:79
cms::DDNamespace::volume
dd4hep::Volume volume(const std::string &name, bool exc=true) const
Definition: DDNamespace.cc:264
cms
Namespace of DDCMS conversion namespace.
Definition: ProducerAnalyzer.cc:21
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37