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_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 9 of file DDHCalTBZposAlgo.cc.

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

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

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_hcal_DDHCalTBZposAlgo   
)

Definition at line 65 of file DDHCalTBZposAlgo.cc.

writedatasetfile.args
args
Definition: writedatasetfile.py:18
detailsBasic3DVector::z
float float float z
Definition: extBasic3DVector.h:14
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
cms::DDNamespace
Definition: DDNamespace.h:16
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
PVValHelper::eta
Definition: PVValidationHelpers.h:69
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
PixelTestBeamValidation_cfi.Position
Position
Definition: PixelTestBeamValidation_cfi.py:75
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::Volume
dd4hep::Volume Volume
Definition: DDFilteredView.h:47
geant_units::operators::convertCmToMm
constexpr NumType convertCmToMm(NumType centimeters)
Definition: GeantUnits.h:68
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
genVertex_cff.x
x
Definition: genVertex_cff.py:12
detailsBasic3DVector::y
float float y
Definition: extBasic3DVector.h:14
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
NAMESPACE_SEP
#define NAMESPACE_SEP
Definition: DDNamespace.h:85
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
child
Definition: simpleInheritance.h:11
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37