CMS 3D CMS Logo

Functions
DDTOBAxCableAlgo.cc File Reference
#include "DD4hep/DetFactoryHelper.h"
#include "DataFormats/Math/interface/CMSUnits.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 (Detector &, cms::DDParsingContext &ctxt, xml_h e)
 
 DD4HEP_OPEN_PLUGIN (dd4hep, ddcms_det_element_DDCMS_track_DDTOBAxCableAlgo)
 

Function Documentation

◆ algorithm()

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

Definition at line 11 of file DDTOBAxCableAlgo.cc.

11  {
12  cms::DDNamespace ns(ctxt, e, true);
13  DDAlgoArguments args(ctxt, e);
14  vector<string> sectorNumber = args.vecStr("SectorNumber"); // Id. Number of the sectors
15  double sectorRin = args.dble("SectorRin"); // Inner radius of service sectors
16  double sectorRout = args.dble("SectorRout"); // Outer radius of service sectors
17  double sectorDz = args.dble("SectorDz"); // Sector half-length
18  double sectorDeltaPhi_B = args.dble("SectorDeltaPhi_B"); // Sector B phi width [A=C=0.5*(360/sectors)]
19  vector<double> sectorStartPhi = args.vecDble("SectorStartPhi"); // Starting phi for the service sectors
20  vector<string> sectorMaterial_A = args.vecStr("SectorMaterial_A"); // Material for the A sectors
21  vector<string> sectorMaterial_B = args.vecStr("SectorMaterial_B"); // Material for the B sectors
22  vector<string> sectorMaterial_C = args.vecStr("SectorMaterial_C"); // Material for the C sectors
23 
24  for (int i = 0; i < (int)(sectorNumber.size()); i++)
25  LogDebug("TOBGeom") << "DDTOBAxCableAlgo debug: sectorNumber[" << i << "] = " << sectorNumber[i];
26 
27  LogDebug("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++)
30  LogDebug("TOBGeom") << "\t[" << i << "]\tPhi = " << sectorStartPhi[i];
31  LogDebug("TOBGeom") << "DDTOBAxCableAlgo debug: List of materials for the sectors/3 parts";
32  //
33  LogDebug("TOBGeom") << "DDTOBAxCableAlgo debug: Sector/3 A";
34  for (int i = 0; i < (int)(sectorNumber.size()); i++)
35  LogDebug("TOBGeom") << "\t[" << i << "]\tsectorMaterial_A = " << sectorMaterial_A[i];
36  //
37  LogDebug("TOBGeom") << "DDTOBAxCableAlgo debug: Sector/3 B";
38  for (int i = 0; i < (int)(sectorNumber.size()); i++)
39  LogDebug("TOBGeom") << "\t[" << i << "]\tsectorMaterial_B = " << sectorMaterial_B[i];
40  //
41  LogDebug("TOBGeom") << "DDTOBAxCableAlgo debug: Sector/3 C";
42  for (int i = 0; i < (int)(sectorNumber.size()); i++)
43  LogDebug("TOBGeom") << "\t[" << i << "]\tsectorMaterial_C = " << sectorMaterial_C[i];
44 
45  string tubsName = args.parentName();
46  Volume tubsVol = ns.volume(tubsName);
47  // Loop over sectors (sectorNumber vector)
48  for (int i = 0; i < (int)(sectorNumber.size()); i++) {
49  Solid solid;
50  string name;
51  double dz, rin, rout, startphi, widthphi, deltaphi;
52 
53  // Axial Services
54  // Each sector is divided in 3 parts from phi[i] to phi[i+1]
55 
56  widthphi = ((i + 1 == (int)(sectorStartPhi.size())) ? (sectorStartPhi[0] + 2_pi) - sectorStartPhi[i]
57  : (sectorStartPhi[i + 1] - sectorStartPhi[i]));
58  // First Part: A
59  name = "TOBAxService_" + sectorNumber[i] + "A";
60  dz = sectorDz;
61  rin = sectorRin;
62  rout = sectorRout;
63  startphi = sectorStartPhi[i];
64  deltaphi = 0.5 * (widthphi - sectorDeltaPhi_B);
65  solid = ns.addSolid(name, Tube(rin, rout, dz, startphi, startphi + deltaphi));
66  LogDebug("TOBGeom") << solid.name() << " Tubs made of " << sectorMaterial_A[i] << " from "
67  << convertRadToDeg(startphi) << " to " << convertRadToDeg((startphi + deltaphi)) << " with Rin "
68  << rin << " Rout " << rout << " ZHalf " << dz;
69  Volume sectorLogic = ns.addVolume(Volume(name, solid, ns.material(sectorMaterial_A[i])));
70  tubsVol.placeVolume(sectorLogic, i + 1); // copyNr: i+1
71  LogDebug("TOBGeom") << sectorLogic.name() << " number " << i + 1 << " positioned in " << tubsName
72  << " with no translation and no rotation";
73 
74  // Second Part: B
75  name = "TOBAxService_" + sectorNumber[i] + "B";
76  startphi += deltaphi;
77  deltaphi = sectorDeltaPhi_B;
78  solid = ns.addSolid(name, Tube(rin, rout, dz, startphi, startphi + deltaphi));
79  LogDebug("TOBGeom") << solid.name() << " Tubs made of " << sectorMaterial_B[i] << " from "
80  << convertRadToDeg(startphi) << " to " << convertRadToDeg((startphi + deltaphi)) << " with Rin "
81  << rin << " Rout " << rout << " ZHalf " << dz;
82 
83  sectorLogic = ns.addVolume(Volume(name, solid, ns.material(sectorMaterial_B[i])));
84  tubsVol.placeVolume(sectorLogic, i + 1); // copyNr: i+1
85  LogDebug("TOBGeom") << sectorLogic.name() << " number " << i + 1 << " positioned in " << tubsName
86  << " with no translation and no rotation";
87 
88  // Third Part: C
89  name = "TOBAxService_" + sectorNumber[i] + "C";
90  startphi += deltaphi;
91  deltaphi = 0.5 * (widthphi - sectorDeltaPhi_B);
92  solid = ns.addSolid(name, Tube(rin, rout, dz, startphi, startphi + deltaphi));
93  LogDebug("TOBGeom") << solid.name() << " Tubs made of " << sectorMaterial_C[i] << " from "
94  << convertRadToDeg(startphi) << " to " << convertRadToDeg((startphi + deltaphi)) << " with Rin "
95  << rin << " Rout " << rout << " ZHalf " << dz;
96  sectorLogic = ns.addVolume(Volume(name, solid, ns.material(sectorMaterial_C[i])));
97  tubsVol.placeVolume(sectorLogic, i + 1); // copyNr: i+1
98  LogDebug("TOBGeom") << sectorLogic.name() << " number " << i + 1 << " positioned in " << tubsName
99  << " with no translation and no rotation";
100  }
101  LogDebug("TOBGeom") << "<<== End of DDTOBAxCableAlgo construction ...";
102  return 1;
103 }

References cms::DDNamespace::addSolid(), cms::DDNamespace::addVolume(), writedatasetfile::args, angle_units::operators::convertRadToDeg(), PVValHelper::dz, MillePedeFileConverter_cfg::e, mps_fire::i, createfilelist::int, LogDebug, cms::DDNamespace::material(), Skims_PA_cff::name, and cms::DDNamespace::volume().

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_track_DDTOBAxCableAlgo   
)

Definition at line 106 of file DDTOBAxCableAlgo.cc.

writedatasetfile.args
args
Definition: writedatasetfile.py:18
mps_fire.i
i
Definition: mps_fire.py:428
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
cms::DDNamespace
Definition: DDNamespace.h:16
cms::Volume
dd4hep::Volume Volume
Definition: DDFilteredView.h:47
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
createfilelist.int
int
Definition: createfilelist.py:10
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
PVValHelper::dz
Definition: PVValidationHelpers.h:51
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37