CMS 3D CMS Logo

Functions
DDHCalFibreBundle.cc File Reference
#include "DataFormats/Math/interface/GeantUnits.h"
#include "DetectorDescription/DDCMS/interface/DDPlugins.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "DD4hep/DetFactoryHelper.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_DDHCalFibreBundle)
 

Function Documentation

◆ algorithm()

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

Definition at line 10 of file DDHCalFibreBundle.cc.

10  {
11  cms::DDNamespace ns(ctxt, e, true);
13  // Header section
14  double deltaPhi = args.value<double>("DeltaPhi");
15  double deltaZ = args.value<double>("DeltaZ");
16  int numberPhi = args.value<int>("NumberPhi");
17  std::string material = args.value<std::string>("Material");
18  std::vector<double> areaSection = args.value<std::vector<double> >("AreaSection");
19  std::vector<double> rStart = args.value<std::vector<double> >("RadiusStart");
20  std::vector<double> rEnd = args.value<std::vector<double> >("RadiusEnd");
21  std::vector<int> bundle = args.value<std::vector<int> >("Bundles");
22  double tilt = args.value<double>("TiltAngle");
23  std::string childPrefix = args.value<std::string>("Child");
24 #ifdef EDM_ML_DEBUG
25  edm::LogVerbatim("HCalGeom") << "DDHCalFibreBundle: Parent " << args.parentName() << " with " << bundle.size()
26  << " children with prefix " << childPrefix << ", material " << material << " with "
27  << numberPhi << " bundles along phi; width of"
28  << " mother " << deltaZ << " along Z, " << convertRadToDeg(deltaPhi)
29  << " along phi and with " << rStart.size() << " different bundle types";
30  for (unsigned int i = 0; i < areaSection.size(); ++i)
31  edm::LogVerbatim("HCalGeom") << "DDHCalFibreBundle: Child[" << i << "] Area " << convertCm2ToMm2(areaSection[i])
32  << " R at Start " << convertCmToMm(rStart[i]) << " R at End "
33  << convertCmToMm(rEnd[i]);
34  edm::LogVerbatim("HCalGeom") << "DDHCalFibreBundle: NameSpace " << ns.name() << " Tilt Angle "
35  << convertRadToDeg(tilt) << " Bundle type at different positions";
36  for (unsigned int i = 0; i < bundle.size(); ++i) {
37  edm::LogVerbatim("HCalGeom") << "DDHCalFibreBundle: Position[" << i << "] "
38  << " with Type " << bundle[i];
39  }
40 #endif
41 
42  dd4hep::Volume mother = ns.volume(args.parentName());
43  dd4hep::Material matter = ns.material(material);
44 
45  // Create the rotation matrices
46  double dPhi = deltaPhi / numberPhi;
47  std::vector<dd4hep::Rotation3D> rotation;
48  dd4hep::Rotation3D rot;
49  for (int i = 0; i < numberPhi; ++i) {
50  double phi = -0.5 * deltaPhi + (i + 0.5) * dPhi;
51  rot = dd4hep::RotationZ(phi);
52 #ifdef EDM_ML_DEBUG
53  double phideg = convertRadToDeg(phi);
54  edm::LogVerbatim("HCalGeom") << "DDHCalFibreBundle: Creating a new rotation " << 90 << "," << phideg << "," << 90
55  << "," << (phideg + 90) << ", 0, 0";
56 #endif
57  rotation.emplace_back(rot);
58  }
59 
60  // Create the solids and logical parts
61  std::vector<dd4hep::Volume> logs;
62  for (unsigned int i = 0; i < areaSection.size(); ++i) {
63  double r0 = rEnd[i] / std::cos(tilt);
64  double dStart = areaSection[i] / (2 * dPhi * rStart[i]);
65  double dEnd = areaSection[i] / (2 * dPhi * r0);
66  std::string name = childPrefix + std::to_string(i);
67  dd4hep::Solid solid = dd4hep::ConeSegment(
68  name, 0.5 * deltaZ, rStart[i] - dStart, rStart[i] + dStart, r0 - dEnd, r0 + dEnd, -0.5 * dPhi, 0.5 * dPhi);
69 #ifdef EDM_ML_DEBUG
70  edm::LogVerbatim("HCalGeom") << "DDHCalFibreBundle: Creating a new solid " << name << " a cons with dZ " << deltaZ
71  << " rStart " << rStart[i] - dStart << ":" << rStart[i] + dStart << " rEnd "
72  << r0 - dEnd << ":" << r0 + dEnd << " Phi " << convertRadToDeg(-0.5 * dPhi) << ":"
73  << convertRadToDeg(0.5 * dPhi);
74 #endif
75  dd4hep::Volume log(name, solid, matter);
76  logs.emplace_back(log);
77  }
78 
79  // Now posiiton them
80  int copy = 0;
81  int nY = static_cast<int>(bundle.size()) / numberPhi;
82  for (unsigned int i = 0; i < bundle.size(); i++) {
83  int ir = static_cast<int>(i) / nY;
84  if (ir >= numberPhi)
85  ir = numberPhi - 1;
86  int ib = bundle[i];
87  copy++;
88  if (ib >= 0 && ib < (int)(logs.size())) {
89  mother.placeVolume(logs[ib], copy, rotation[ir]);
90 #ifdef EDM_ML_DEBUG
91  edm::LogVerbatim("HCalGeom") << "DDHCalFibreBundle: " << logs[ib].name() << " number " << copy
92  << " positioned in " << mother.name() << " at (0, 0, 0) with " << rotation[ir];
93 #endif
94  }
95  }
96  return 1;
97 }

References writedatasetfile::args, geant_units::operators::convertCm2ToMm2(), geant_units::operators::convertCmToMm(), angle_units::operators::convertRadToDeg(), filterCSVwithJSON::copy, funct::cos(), SiPixelRawToDigiRegional_cfi::deltaPhi, HLT_FULL_cff::dPhi, MillePedeFileConverter_cfg::e, mps_fire::i, cuy::ib, dqm-mbProfile::log, cms::DDNamespace::material(), g4SimHits_cfi::Material, Skims_PA_cff::name, cms::DDNamespace::name(), makeMuonMisalignmentScenario::rot, idealTransformation::rotation, AlCaHLTBitMon_QueryRunRegistry::string, and cms::DDNamespace::volume().

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_hcal_DDHCalFibreBundle   
)

Definition at line 100 of file DDHCalFibreBundle.cc.

writedatasetfile.args
args
Definition: writedatasetfile.py:18
mps_fire.i
i
Definition: mps_fire.py:428
geant_units::operators::convertCm2ToMm2
constexpr NumType convertCm2ToMm2(NumType centimeters)
Definition: GeantUnits.h:74
g4SimHits_cfi.Material
Material
Definition: g4SimHits_cfi.py:560
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
cms::DDNamespace
Definition: DDNamespace.h:16
HLT_FULL_cff.dPhi
dPhi
Definition: HLT_FULL_cff.py:13768
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::Volume
dd4hep::Volume Volume
Definition: DDFilteredView.h:47
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
geant_units::operators::convertCmToMm
constexpr NumType convertCmToMm(NumType centimeters)
Definition: GeantUnits.h:68
PVValHelper::phi
Definition: PVValidationHelpers.h:68
cuy.ib
ib
Definition: cuy.py:662
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
edm::Log
Definition: MessageLogger.h:70
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37