CMS 3D CMS Logo

DDTECPhiAltAlgo.cc
Go to the documentation of this file.
1 #include "DD4hep/DetFactoryHelper.h"
5 
6 using namespace std;
7 using namespace dd4hep;
8 using namespace cms;
9 using namespace cms_units::operators;
10 
11 static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, xml_h e) {
12  cms::DDNamespace ns(ctxt, e, true);
13  DDAlgoArguments args(ctxt, e);
14  Volume mother = ns.volume(args.parentName());
15  Volume child = ns.volume(args.childName());
16  double startAngle = args.value<double>("StartAngle"); //Start angle
17  double incrAngle = args.value<double>("IncrAngle"); //Increment in angle
18  double radius = args.value<double>("Radius"); //Radius
19  double zIn = args.value<double>("ZIn"); //z position for the even ones
20  double zOut = args.value<double>("ZOut"); //z position for the odd ones
21  int number = args.value<double>("Number"); //Number of copies
22  int startCopyNo = args.find("StartCopyNo") ? args.value<int>("StartCopyNo") : 1; //Start copy number
23  int incrCopyNo = args.find("IncrCopyNo") ? args.value<int>("IncrCopyNo") : 1; //Increment in copy number
24 
25  edm::LogVerbatim("TECGeom") << "debug: Parameters for "
26  << "positioning--"
27  << "\tStartAngle " << convertRadToDeg(startAngle) << "\tIncrAngle "
28  << convertRadToDeg(incrAngle) << "\tZ in/out " << zIn << ", " << zOut << "\tCopy Numbers "
29  << number << " Start/Increment " << startCopyNo << ", " << incrCopyNo;
30  edm::LogVerbatim("TECGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace "
31  << ns.name();
32 
33  if (number > 0) {
34  double theta = 90._deg;
35  int copyNo = startCopyNo;
36  for (int i = 0; i < number; i++) {
37  double phiz = startAngle + i * incrAngle;
38  double phix = phiz + 90._deg;
39  Rotation3D rotation = makeRotation3D(theta, phix, 0e0, 0e0, theta, phiz);
40  Position tran(radius * cos(phiz), radius * sin(phiz), (i % 2 == 0) ? zIn : zOut);
41  mother.placeVolume(child, copyNo, Transform3D(rotation, tran));
42  edm::LogVerbatim("TECGeom") << "test: " << child.name() << " number " << copyNo << " positioned in "
43  << mother.name() << " at " << tran << " with " << rotation;
44  copyNo += incrCopyNo;
45  }
46  }
47  return 1;
48 }
49 
50 // first argument is the type from the xml file
51 DECLARE_DDCMS_DETELEMENT(DDCMS_track_DDTECPhiAltAlgo, algorithm)
writedatasetfile.args
args
Definition: writedatasetfile.py:18
mps_fire.i
i
Definition: mps_fire.py:428
cms_units::operators
Definition: CMSUnits.h:13
MessageLogger.h
DECLARE_DDCMS_DETELEMENT
#define DECLARE_DDCMS_DETELEMENT(name, func)
Definition: DDPlugins.h:25
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:22
cms::makeRotation3D
DDRotationMatrix makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
Definition: DDAlgoArguments.cc:20
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::Volume
dd4hep::Volume Volume
Definition: DDFilteredView.h:47
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
DDPlugins.h
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
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
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
CMSUnits.h
child
Definition: simpleInheritance.h:11
algorithm
static long algorithm(Detector &, cms::DDParsingContext &ctxt, xml_h e)
Definition: DDTECPhiAltAlgo.cc:11
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