CMS 3D CMS Logo

DDTOBAxCableAlgo.cc
Go to the documentation of this file.
1 // File: DDTOBAxCableAlgo.cc
3 // Description: Equipping the axial cylinder of TOB with cables etc
5 
6 #include <cmath>
7 #include <algorithm>
8 
16 #include "CLHEP/Units/GlobalPhysicalConstants.h"
17 #include "CLHEP/Units/GlobalSystemOfUnits.h"
18 
19 
21  sectorRin(0),sectorRout(0),sectorDeltaPhi_B(0) {
22  LogDebug("TOBGeom") <<"DDTOBAxCableAlgo info: Creating an instance";
23 }
24 
26 
28  const DDVectorArguments & vArgs,
29  const DDMapArguments &,
30  const DDStringArguments & sArgs,
31  const DDStringVectorArguments & vsArgs) {
32 
34  LogDebug("TOBGeom") << "DDTOBAxCableAlgo debug: Parent " << parent().name()
35  << " NameSpace " << idNameSpace;
36 
37  sectorNumber = vsArgs["SectorNumber"];
38  sectorRin = nArgs["SectorRin"];
39  sectorRout = nArgs["SectorRout"];
40  sectorDz = nArgs["SectorDz"];
41  sectorDeltaPhi_B = nArgs["SectorDeltaPhi_B"];
42  sectorStartPhi = vArgs["SectorStartPhi"];
43  sectorMaterial_A = vsArgs["SectorMaterial_A"];
44  sectorMaterial_B = vsArgs["SectorMaterial_B"];
45  sectorMaterial_C = vsArgs["SectorMaterial_C"];
46 
47  for (int i=0; i<(int)(sectorNumber.size()); i++)
48  LogDebug("TOBGeom") << "DDTOBAxCableAlgo debug: sectorNumber[" << i
49  << "] = " << sectorNumber[i];
50 
51  LogDebug("TOBGeom") << "DDTOBAxCableAlgo debug: Axial Service Sectors half-length " << sectorDz
52  << "\tRin " << sectorRin << "\tRout = " << sectorRout
53  << "\tPhi of sectors position:";
54  for (int i=0; i<(int)(sectorNumber.size()); i++)
55  LogDebug("TOBGeom") << "\t[" << i << "]\tPhi = " << sectorStartPhi[i];
56  LogDebug("TOBGeom") << "DDTOBAxCableAlgo debug: List of materials for the sectors/3 parts";
57  //
58  LogDebug("TOBGeom") << "DDTOBAxCableAlgo debug: Sector/3 A";
59  for (int i=0; i<(int)(sectorNumber.size()); i++)
60  LogDebug("TOBGeom") << "\t[" << i << "]\tsectorMaterial_A = " << sectorMaterial_A[i];
61  //
62  LogDebug("TOBGeom") << "DDTOBAxCableAlgo debug: Sector/3 B";
63  for (int i=0; i<(int)(sectorNumber.size()); i++)
64  LogDebug("TOBGeom") << "\t[" << i << "]\tsectorMaterial_B = " << sectorMaterial_B[i];
65  //
66  LogDebug("TOBGeom") << "DDTOBAxCableAlgo debug: Sector/3 C";
67  for (int i=0; i<(int)(sectorNumber.size()); i++)
68  LogDebug("TOBGeom") << "\t[" << i << "]\tsectorMaterial_C = " << sectorMaterial_C[i];
69 
70 }
71 
73 
74  LogDebug("TOBGeom") << "==>> Constructing DDTOBAxCableAlgo...";
75  DDName tubsName(parent().name());
76 
77  // Loop over sectors (sectorNumber vector)
78  for (int i=0; i<(int)(sectorNumber.size()); i++) {
79 
80  DDSolid solid;
82  double dz, rin, rout, startphi, widthphi, deltaphi;
83 
84  // Axial Services
85  // Each sector is divided in 3 parts from phi[i] to phi[i+1]
86 
87  widthphi = ( (i+1 == (int)(sectorStartPhi.size())) ?
88  (sectorStartPhi[0]+CLHEP::twopi)-sectorStartPhi[i] :
90 
91  // First Part: A
92  name = "TOBAxService_" + sectorNumber[i] + "A";
93  dz = sectorDz;
94  rin = sectorRin;
95  rout = sectorRout;
96  startphi = sectorStartPhi[i];
97  deltaphi = 0.5 * (widthphi - sectorDeltaPhi_B);
98 
99  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz, rin,
100  rout, startphi, deltaphi);
101 
102  LogDebug("TOBGeom") << "DDTOBAxCableAlgo test: "
103  << DDName(name, idNameSpace) << " Tubs made of "
104  << sectorMaterial_A[i] << " from "
105  << startphi/CLHEP::deg << " to "
106  << (startphi+deltaphi)/CLHEP::deg << " with Rin "
107  << rin << " Rout " << rout << " ZHalf " << dz;
108 
109  DDName sectorMatName(DDSplit(sectorMaterial_A[i]).first,
111  DDMaterial sectorMatter(sectorMatName);
112  DDLogicalPart sectorLogic(DDName(name, idNameSpace), sectorMatter, solid);
113 
114  cpv.position(DDName(name,idNameSpace), tubsName, i+1, DDTranslation(),
115  DDRotation());
116  LogDebug("TOBGeom") << "DDTOBAxCableAlgo test: "
117  << DDName(name,idNameSpace) << " number " << i+1
118  << " positioned in " << tubsName
119  << " with no translation and no rotation";
120 
121  // Second Part: B
122  name = "TOBAxService_" + sectorNumber[i] + "B";
123  startphi += deltaphi;
124  deltaphi = sectorDeltaPhi_B;
125 
126  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz, rin,
127  rout, startphi, deltaphi);
128 
129  LogDebug("TOBGeom") << "DDTOBAxCableAlgo test: "
130  << DDName(name, idNameSpace) << " Tubs made of "
131  << sectorMaterial_B[i] << " from " << startphi/CLHEP::deg << " to " << (startphi+deltaphi)/CLHEP::deg
132  << " with Rin " << rin << " Rout " << rout
133  << " ZHalf " << dz;
134 
135  sectorMatName = DDName(DDSplit(sectorMaterial_B[i]).first,
136  DDSplit(sectorMaterial_B[i]).second);
137  sectorMatter = DDMaterial(sectorMatName);
138  sectorLogic = DDLogicalPart(DDName(name, idNameSpace), sectorMatter,
139  solid);
140 
141  cpv.position(DDName(name,idNameSpace), tubsName, i+1, DDTranslation(),
142  DDRotation());
143  LogDebug("TOBGeom") << "DDTOBAxCableAlgo test: "
144  << DDName(name,idNameSpace) << " number " << i+1
145  << " positioned in " << tubsName
146  << " with no translation and no rotation";
147 
148  // Third Part: C
149  name = "TOBAxService_" + sectorNumber[i] + "C";
150  startphi += deltaphi;
151  deltaphi = 0.5 * (widthphi - sectorDeltaPhi_B);
152 
153  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz, rin,
154  rout, startphi, deltaphi);
155 
156  LogDebug("TOBGeom") << "DDTOBAxCableAlgo test: "
157  << DDName(name, idNameSpace) << " Tubs made of "
158  << sectorMaterial_C[i] << " from "
159  << startphi/CLHEP::deg << " to "
160  << (startphi+deltaphi)/CLHEP::deg << " with Rin "
161  << rin << " Rout " << rout << " ZHalf " << dz;
162 
163  sectorMatName = DDName(DDSplit(sectorMaterial_C[i]).first,
164  DDSplit(sectorMaterial_C[i]).second);
165  sectorMatter = DDMaterial(sectorMatName);
166  sectorLogic = DDLogicalPart(DDName(name, idNameSpace), sectorMatter,
167  solid);
168 
169  cpv.position(DDName(name,idNameSpace), tubsName, i+1, DDTranslation(),
170  DDRotation());
171  LogDebug("TOBGeom") << "DDTOBAxCableAlgo test: "
172  << DDName(name,idNameSpace) << " number " << i+1
173  << " positioned in " << tubsName
174  << " with no translation and no rotation";
175  }
176 
177  LogDebug("TOBGeom") << "<<== End of DDTOBAxCableAlgo construction ...";
178 }
#define LogDebug(id)
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:43
std::vector< std::string > sectorMaterial_A
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
std::vector< std::string > sectorNumber
static std::string & ns()
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:68
U second(std::pair< T, U > const &p)
std::string idNameSpace
std::vector< std::string > sectorMaterial_C
std::vector< double > sectorStartPhi
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:865
~DDTOBAxCableAlgo() override
std::vector< std::string > sectorMaterial_B
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
void execute(DDCompactView &cpv) override