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.

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 }

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(), and cms::DDNamespace::volume().

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_hcal_DDHCalTBZposAlgo   
)

Definition at line 64 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: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
PVValHelper::eta
Definition: PVValidationHelpers.h:70
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
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
cms::convert2mm
constexpr NumType convert2mm(NumType length)
Definition: DDutils.h:7
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::s_executed
static constexpr long s_executed
Definition: DDAlgoArguments.h:16
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
genVertex_cff.x
x
Definition: genVertex_cff.py:13
detailsBasic3DVector::y
float float y
Definition: extBasic3DVector.h:14
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
NAMESPACE_SEP
#define NAMESPACE_SEP
Definition: DDNamespace.h:92
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
child
Definition: simpleInheritance.h:11
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37