1 #include "DD4hep/DetFactoryHelper.h"
9 using namespace cms_units::operators;
14 vector<string> sectorNumber = args.
vecStr(
"SectorNumber");
15 double sectorRin = args.
dble(
"SectorRin");
16 double sectorRout = args.
dble(
"SectorRout");
17 double sectorDz = args.
dble(
"SectorDz");
18 double sectorDeltaPhi_B = args.
dble(
"SectorDeltaPhi_B");
19 vector<double> sectorStartPhi = args.
vecDble(
"SectorStartPhi");
20 vector<string> sectorMaterial_A = args.
vecStr(
"SectorMaterial_A");
21 vector<string> sectorMaterial_B = args.
vecStr(
"SectorMaterial_B");
22 vector<string> sectorMaterial_C = args.
vecStr(
"SectorMaterial_C");
24 for (
int i = 0;
i < (int)(sectorNumber.size());
i++)
25 edm::LogVerbatim(
"TOBGeom") <<
"DDTOBAxCableAlgo debug: sectorNumber[" <<
i <<
"] = " << sectorNumber[
i];
27 edm::LogVerbatim(
"TOBGeom") <<
"DDTOBAxCableAlgo debug: Axial Service Sectors half-length " << sectorDz <<
"\tRin "
28 << sectorRin <<
"\tRout = " << sectorRout <<
"\tPhi of sectors position:";
29 for (
int i = 0;
i < (int)(sectorNumber.size());
i++)
31 edm::LogVerbatim(
"TOBGeom") <<
"DDTOBAxCableAlgo debug: List of materials for the sectors/3 parts";
34 for (
int i = 0;
i < (int)(sectorNumber.size());
i++)
35 edm::LogVerbatim(
"TOBGeom") <<
"\t[" <<
i <<
"]\tsectorMaterial_A = " << sectorMaterial_A[
i];
38 for (
int i = 0;
i < (int)(sectorNumber.size());
i++)
39 edm::LogVerbatim(
"TOBGeom") <<
"\t[" <<
i <<
"]\tsectorMaterial_B = " << sectorMaterial_B[
i];
42 for (
int i = 0;
i < (int)(sectorNumber.size());
i++)
43 edm::LogVerbatim(
"TOBGeom") <<
"\t[" <<
i <<
"]\tsectorMaterial_C = " << sectorMaterial_C[
i];
48 for (
int i = 0;
i < (int)(sectorNumber.size());
i++) {
51 double dz, rin, rout, startphi, widthphi, deltaphi;
56 widthphi = ((
i + 1 == (int)(sectorStartPhi.size())) ? (sectorStartPhi[0] + 2_pi) - sectorStartPhi[
i]
57 : (sectorStartPhi[
i + 1] - sectorStartPhi[
i]));
59 name =
"TOBAxService_" + sectorNumber[
i] +
"A";
63 startphi = sectorStartPhi[
i];
64 deltaphi = 0.5 * (widthphi - sectorDeltaPhi_B);
65 solid = ns.
addSolid(ns.
prepend(name), Tube(rin, rout, dz, startphi, startphi + deltaphi));
66 edm::LogVerbatim(
"TOBGeom") << solid.name() <<
" Tubs made of " << sectorMaterial_A[
i] <<
" from "
68 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " <<
dz;
70 tubsVol.placeVolume(sectorLogic, i + 1);
71 edm::LogVerbatim(
"TOBGeom") << sectorLogic.name() <<
" number " << i + 1 <<
" positioned in " << tubsName
72 <<
" with no translation and no rotation";
75 name =
"TOBAxService_" + sectorNumber[
i] +
"B";
77 deltaphi = sectorDeltaPhi_B;
78 solid = ns.
addSolid(ns.
prepend(name), Tube(rin, rout, dz, startphi, startphi + deltaphi));
79 edm::LogVerbatim(
"TOBGeom") << solid.name() <<
" Tubs made of " << sectorMaterial_B[
i] <<
" from "
81 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " <<
dz;
84 tubsVol.placeVolume(sectorLogic, i + 1);
85 edm::LogVerbatim(
"TOBGeom") << sectorLogic.name() <<
" number " << i + 1 <<
" positioned in " << tubsName
86 <<
" with no translation and no rotation";
89 name =
"TOBAxService_" + sectorNumber[
i] +
"C";
91 deltaphi = 0.5 * (widthphi - sectorDeltaPhi_B);
92 solid = ns.
addSolid(ns.
prepend(name), Tube(rin, rout, dz, startphi, startphi + deltaphi));
93 edm::LogVerbatim(
"TOBGeom") << solid.name() <<
" Tubs made of " << sectorMaterial_C[
i] <<
" from "
95 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " <<
dz;
97 tubsVol.placeVolume(sectorLogic, i + 1);
98 edm::LogVerbatim(
"TOBGeom") << sectorLogic.name() <<
" number " << i + 1 <<
" positioned in " << tubsName
99 <<
" with no translation and no rotation";
101 edm::LogVerbatim(
"TOBGeom") <<
"<<== End of DDTOBAxCableAlgo construction ...";
Log< level::Info, true > LogVerbatim
dd4hep::Volume volume(const std::string &name, bool exc=true) const
constexpr NumType convertRadToDeg(NumType radians)
dd4hep::Volume addVolume(dd4hep::Volume vol) const
#define DECLARE_DDCMS_DETELEMENT(name, func)
dd4hep::Material material(const std::string &name) const
std::string prepend(const std::string &) const
dd4hep::Solid addSolid(const std::string &name, dd4hep::Solid solid) const
std::vector< double > vecDble(const std::string &nam) const
Shortcut to access vector<double> arguments.
double dble(const std::string &nam) const
Shortcut to access double arguments.
std::vector< std::string > vecStr(const std::string &nam) const
Shortcut to access vector<string> arguments.
std::string parentName() const
Access value of rParent child node.