CMS 3D CMS Logo

Functions
DDHCalTBZposAlgo.cc File Reference
#include "DD4hep/DetFactoryHelper.h"
#include "DataFormats/Math/interface/GeantUnits.h"
#include "DetectorDescription/DDCMS/interface/DDPlugins.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

Go to the source code of this file.

Functions

static long algorithm (dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e, dd4hep::SensitiveDetector &)
 
 DD4HEP_OPEN_PLUGIN (dd4hep, ddcms_det_element_DDCMS_hcal_DDHCalTBZposAlgo)
 

Function Documentation

static long algorithm ( dd4hep::Detector &  ,
cms::DDParsingContext ctxt,
xml_h  e,
dd4hep::SensitiveDetector &   
)
static

Definition at line 9 of file DDHCalTBZposAlgo.cc.

References writedatasetfile::args, geant_units::operators::convertCmToMm(), angle_units::operators::convertRadToDeg(), funct::cos(), PVValHelper::eta, JetChargeProducer_cfi::exp, cms::DDNamespace::name(), NAMESPACE_SEP, cms::DDAlgoArguments::parentName(), makeMuonMisalignmentScenario::rot, funct::sin(), AlCaHLTBitMon_QueryRunRegistry::string, funct::tan(), theta(), cms::DDAlgoArguments::value(), and cms::DDNamespace::volume().

12  {
13  cms::DDNamespace ns(ctxt, e, true);
15  // Header section
16  std::string idNameSpace = static_cast<std::string>(ns.name()); //Namespace of this and ALL sub-parts
17  double eta = args.value<double>("Eta"); //Eta at which beam is focussed
18  double theta = 2.0 * atan(exp(-eta)); //Corresponding theta value
19  double shiftY = args.value<double>("ShiftX"); //Shift along Y
20  double shiftX = args.value<double>("ShiftY"); //Shift along X
21  double zoffset = args.value<double>("Zoffset"); //Offset in z
22  double dist = args.value<double>("Distance"); //Radial distance
23  double tilt = args.value<double>("TiltAngle"); //Tilt with respect to y-axis
24  int copyNumber = args.value<int>("Number"); //Copy Number
25  std::string childName = args.value<std::string>("ChildName"); //Children name
26  if (strchr(childName.c_str(), NAMESPACE_SEP) == nullptr)
27  childName = idNameSpace + childName;
28 #ifdef EDM_ML_DEBUG
29  edm::LogVerbatim("HCalGeom") << "DDHCalTBZposAlgo: Parameters for position"
30  << "ing--"
31  << " Eta " << eta << "\tTheta " << convertRadToDeg(theta) << "\tShifts "
32  << convertCmToMm(shiftX) << ", " << convertCmToMm(shiftY) << " along x, y "
33  << "axes; \tZoffest " << convertCmToMm(zoffset) << "\tRadial Distance "
34  << convertCmToMm(dist) << "\tTilt angle " << convertRadToDeg(tilt) << "\tcopyNumber "
35  << copyNumber;
36  edm::LogVerbatim("HCalGeom") << "DDHCalTBZposAlgo: Parent " << args.parentName() << "\tChild " << childName
37  << " NameSpace " << idNameSpace;
38 #endif
39 
40  dd4hep::Volume mother = ns.volume(args.parentName());
41  dd4hep::Volume child = ns.volume(childName);
42 
43  // Create the rotation matrices
44  double thetax = 90._deg - theta;
45  double z = zoffset + dist * tan(thetax);
46  double x = shiftX - shiftY * sin(tilt);
47  double y = shiftY * cos(tilt);
48  dd4hep::Position tran(x, y, z);
49  dd4hep::Rotation3D rot;
50  if (tilt != 0) {
51 #ifdef EDM_ML_DEBUG
52  edm::LogVerbatim("HCalGeom") << "DDHCalZposAlgo: Creating a rotation \t90, " << convertRadToDeg(tilt) << ",90,"
53  << (90 + convertRadToDeg(tilt)) << ", 0, 0";
54 #endif
55  rot = dd4hep::RotationZ(tilt);
56  }
57  mother.placeVolume(child, copyNumber, dd4hep::Transform3D(rot, tran));
58 #ifdef EDM_ML_DEBUG
59  edm::LogVerbatim("HCalGeom") << "DDHCalTBZposAlgo: " << child.name() << " number " << copyNumber << " positioned in "
60  << mother.name() << " at (" << convertCmToMm(x) << ", " << convertCmToMm(y) << ", "
61  << convertCmToMm(z) << ") with " << rot;
62 #endif
63 
64  return 1;
65 }
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
float float float z
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
constexpr NumType convertCmToMm(NumType centimeters)
Definition: GeantUnits.h:68
dd4hep::Volume Volume
#define NAMESPACE_SEP
Definition: DDNamespace.h:79
DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_hcal_DDHCalTBZposAlgo   
)

Definition at line 68 of file DDHCalTBZposAlgo.cc.