CMS 3D CMS Logo

Functions
DDHCalTBZposAlgo.cc File Reference
#include "DD4hep/DetFactoryHelper.h"
#include "DataFormats/Math/interface/angle_units.h"
#include "DetectorDescription/DDCMS/interface/DDPlugins.h"
#include "DetectorDescription/DDCMS/interface/DDutils.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_OPEN_PLUGIN (dd4hep, ddcms_det_element_DDCMS_hcal_DDHCalTBZposAlgo)
 

Function Documentation

◆ algorithm()

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

Definition at line 10 of file DDHCalTBZposAlgo.cc.

References writedatasetfile::args, cms::convert2mm(), angle_units::operators::convertRadToDeg(), funct::cos(), MillePedeFileConverter_cfg::e, PVValHelper::eta, JetChargeProducer_cfi::exp, cms::DDNamespace::name(), NAMESPACE_SEP, PixelTestBeamValidation_cfi::Position, makeMuonMisalignmentScenario::rot, cms::s_executed, funct::sin(), AlCaHLTBitMon_QueryRunRegistry::string, funct::tan(), theta(), cms::DDNamespace::volume(), and x.

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

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_hcal_DDHCalTBZposAlgo   
)

Definition at line 64 of file DDHCalTBZposAlgo.cc.