CMS 3D CMS Logo

DDTOBRadCableAlgo.cc
Go to the documentation of this file.
1 // File: DDTOBRadCableAlgo.cc
3 // Description: Equipping the side disks of TOB with cables etc
5 
15 #include "CLHEP/Units/GlobalPhysicalConstants.h"
16 #include "CLHEP/Units/GlobalSystemOfUnits.h"
17 
18 #include <string>
19 #include <vector>
20 
21 using namespace std;
22 
23 class DDTOBRadCableAlgo : public DDAlgorithm {
24 public:
25  //Constructor and Destructor
27  ~DDTOBRadCableAlgo() override;
28 
29  void initialize(const DDNumericArguments& nArgs,
30  const DDVectorArguments& vArgs,
31  const DDMapArguments& mArgs,
32  const DDStringArguments& sArgs,
33  const DDStringVectorArguments& vsArgs) override;
34 
35  void execute(DDCompactView& cpv) override;
36 
37 private:
38  string idNameSpace; // Namespace of this and ALL sub-parts
39 
40  double diskDz; // Disk thickness
41  double rMax; // Maximum radius
42  double cableT; // Cable thickness
43  vector<double> rodRin; // Radii for inner rods
44  vector<double> rodRout; // Radii for outer rods
45  vector<string> cableM; // Materials for cables
46  double connW; // Connector width
47  double connT; // Connector thickness
48  vector<string> connM; // Materials for connectors
49  vector<double> coolR1; // Radii for cooling manifold
50  vector<double> coolR2; // Radii for return cooling manifold
51  double coolRin; // Inner radius of cooling manifold
52  double coolRout1; // Outer radius of cooling manifold
53  double coolRout2; // Outer radius of cooling fluid in cooling manifold
54  double coolStartPhi1; // Starting Phi of cooling manifold
55  double coolDeltaPhi1; // Phi Range of cooling manifold
56  double coolStartPhi2; // Starting Phi of cooling fluid in of cooling manifold
57  double coolDeltaPhi2; // Phi Range of of cooling fluid in cooling manifold
58  string coolM1; // Material for cooling manifold
59  string coolM2; // Material for cooling fluid
60  vector<string> names; // Names of layers
61 };
62 
64  : rodRin(0),
65  rodRout(0),
66  cableM(0),
67  connM(0),
68  coolR1(0),
69  coolR2(0),
70  coolRin(0),
71  coolRout1(0),
72  coolRout2(0),
73  coolStartPhi1(0),
74  coolDeltaPhi1(0),
75  coolStartPhi2(0),
76  coolDeltaPhi2(0),
77  names(0) {
78  LogDebug("TOBGeom") << "DDTOBRadCableAlgo info: Creating an instance";
79 }
80 
82 
84  const DDVectorArguments& vArgs,
85  const DDMapArguments&,
86  const DDStringArguments& sArgs,
87  const DDStringVectorArguments& vsArgs) {
89  DDName parentName = parent().name();
90  LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Parent " << parentName << " NameSpace " << idNameSpace;
91 
92  diskDz = nArgs["DiskDz"];
93  rMax = nArgs["RMax"];
94  cableT = nArgs["CableT"];
95  rodRin = vArgs["RodRin"];
96  rodRout = vArgs["RodRout"];
97  cableM = vsArgs["CableMaterial"];
98  LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Disk Half width " << diskDz << "\tRMax " << rMax
99  << "\tCable Thickness " << cableT << "\tRadii of disk position and cable materials:";
100  for (int i = 0; i < (int)(rodRin.size()); i++)
101  LogDebug("TOBGeom") << "\t[" << i << "]\tRin = " << rodRin[i] << "\tRout = " << rodRout[i] << " " << cableM[i];
102 
103  connW = nArgs["ConnW"];
104  connT = nArgs["ConnT"];
105  connM = vsArgs["ConnMaterial"];
106  LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Connector Width = " << connW << "\tThickness = " << connT
107  << "\tMaterials: ";
108  for (int i = 0; i < (int)(connM.size()); i++)
109  LogDebug("TOBGeom") << "\tconnM[" << i << "] = " << connM[i];
110 
111  coolR1 = vArgs["CoolR1"];
112  coolR2 = vArgs["CoolR2"];
113  coolRin = nArgs["CoolRin"];
114  coolRout1 = nArgs["CoolRout1"];
115  coolRout2 = nArgs["CoolRout2"];
116  coolStartPhi1 = nArgs["CoolStartPhi1"];
117  coolDeltaPhi1 = nArgs["CoolDeltaPhi1"];
118  coolStartPhi2 = nArgs["CoolStartPhi2"];
119  coolDeltaPhi2 = nArgs["CoolDeltaPhi2"];
120  coolM1 = sArgs["CoolMaterial1"];
121  coolM2 = sArgs["CoolMaterial2"];
122  LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Cool Manifold Torus Rin = " << coolRin << " Rout = " << coolRout1
123  << "\t Phi start = " << coolStartPhi1 << " Phi Range = " << coolDeltaPhi1
124  << "\t Material = " << coolM1 << "\t Radial positions:";
125  for (int i = 0; i < (int)(coolR1.size()); i++)
126  LogDebug("TOBGeom") << "\t[" << i << "]\tR = " << coolR1[i];
127  for (int i = 0; i < (int)(coolR2.size()); i++)
128  LogDebug("TOBGeom") << "\t[" << i << "]\tR = " << coolR2[i];
129  LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Cooling Fluid Torus Rin = " << coolRin << " Rout = " << coolRout2
130  << "\t Phi start = " << coolStartPhi2 << " Phi Range = " << coolDeltaPhi2
131  << "\t Material = " << coolM2 << "\t Radial positions:";
132  for (int i = 0; i < (int)(coolR1.size()); i++)
133  LogDebug("TOBGeom") << "\t[" << i << "]\tR = " << coolR1[i];
134  for (int i = 0; i < (int)(coolR2.size()); i++)
135  LogDebug("TOBGeom") << "\t[" << i << "]\tR = " << coolR2[i];
136 
137  names = vsArgs["RingName"];
138  for (int i = 0; i < (int)(names.size()); i++)
139  LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: names[" << i << "] = " << names[i];
140 }
141 
143  LogDebug("TOBGeom") << "==>> Constructing DDTOBRadCableAlgo...";
144  DDName diskName = parent().name();
145 
146  // Loop over sub disks
147  for (int i = 0; i < (int)(names.size()); i++) {
148  DDSolid solid;
149  string name;
150  double dz, rin, rout;
151 
152  // Cooling Manifolds
153  name = "TOBCoolingManifold" + names[i] + "a";
154  dz = coolRout1;
155  DDName manifoldName_a(name, idNameSpace);
157  LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " << DDName(name, idNameSpace) << " Torus made of " << coolM1
158  << " from " << coolStartPhi1 / CLHEP::deg << " to "
159  << (coolStartPhi1 + coolDeltaPhi1) / CLHEP::deg << " with Rin " << coolRin << " Rout "
160  << coolRout1 << " R torus " << coolR1[i];
161  DDName coolManifoldName_a(DDSplit(coolM1).first, DDSplit(coolM1).second);
162  DDMaterial coolManifoldMatter_a(coolManifoldName_a);
163  DDLogicalPart coolManifoldLogic_a(DDName(name, idNameSpace), coolManifoldMatter_a, solid);
164 
165  DDTranslation r1(0, 0, (dz - diskDz));
166  cpv.position(DDName(name, idNameSpace), diskName, i + 1, r1, DDRotation());
167  LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " << DDName(name, idNameSpace) << " number " << i + 1
168  << " positioned in " << diskName << " at " << r1 << " with no rotation";
169  // Cooling Fluid (in Cooling Manifold)
170  name = "TOBCoolingManifoldFluid" + names[i] + "a";
171  solid =
173  LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " << DDName(name, idNameSpace) << " Torus made of " << coolM2
174  << " from " << coolStartPhi2 / CLHEP::deg << " to "
175  << (coolStartPhi2 + coolDeltaPhi2) / CLHEP::deg << " with Rin " << coolRin << " Rout "
176  << coolRout2 << " R torus " << coolR1[i];
177  DDName coolManifoldFluidName_a(DDSplit(coolM2).first, DDSplit(coolM2).second);
178  DDMaterial coolManifoldFluidMatter_a(coolManifoldFluidName_a);
179  DDLogicalPart coolManifoldFluidLogic_a(DDName(name, idNameSpace), coolManifoldFluidMatter_a, solid);
180  cpv.position(DDName(name, idNameSpace), manifoldName_a, i + 1, DDTranslation(), DDRotation());
181  LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " << DDName(name, idNameSpace) << " number " << i + 1
182  << " positioned in " << coolManifoldName_a << " with no translation and no rotation";
183  //
184  name = "TOBCoolingManifold" + names[i] + "r";
185  dz = coolRout1;
186  DDName manifoldName_r(name, idNameSpace);
188  LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " << DDName(name, idNameSpace) << " Torus made of " << coolM1
189  << " from " << coolStartPhi1 / CLHEP::deg << " to "
190  << (coolStartPhi1 + coolDeltaPhi1) / CLHEP::deg << " with Rin " << coolRin << " Rout "
191  << coolRout1 << " R torus " << coolR2[i];
192  DDName coolManifoldName_r(DDSplit(coolM1).first, DDSplit(coolM1).second);
193  DDMaterial coolManifoldMatter_r(coolManifoldName_r);
194  DDLogicalPart coolManifoldLogic_r(DDName(name, idNameSpace), coolManifoldMatter_r, solid);
195 
196  r1 = DDTranslation(0, 0, (dz - diskDz));
197  cpv.position(DDName(name, idNameSpace), diskName, i + 1, r1, DDRotation());
198  LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " << DDName(name, idNameSpace) << " number " << i + 1
199  << " positioned in " << diskName << " at " << r1 << " with no rotation";
200  // Cooling Fluid (in Cooling Manifold)
201  name = "TOBCoolingManifoldFluid" + names[i] + "r";
202  solid =
204  LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " << DDName(name, idNameSpace) << " Torus made of " << coolM2
205  << " from " << coolStartPhi2 / CLHEP::deg << " to "
206  << (coolStartPhi2 + coolDeltaPhi2) / CLHEP::deg << " with Rin " << coolRin << " Rout "
207  << coolRout2 << " R torus " << coolR2[i];
208  DDName coolManifoldFluidName_r(DDSplit(coolM2).first, DDSplit(coolM2).second);
209  DDMaterial coolManifoldFluidMatter_r(coolManifoldFluidName_r);
210  DDLogicalPart coolManifoldFluidLogic_r(DDName(name, idNameSpace), coolManifoldFluidMatter_r, solid);
211  cpv.position(DDName(name, idNameSpace), manifoldName_r, i + 1, DDTranslation(), DDRotation());
212  LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " << DDName(name, idNameSpace) << " number " << i + 1
213  << " positioned in " << coolManifoldName_r << " with no translation and no rotation";
214 
215  // Connectors
216  name = "TOBConn" + names[i];
217  dz = 0.5 * connT;
218  rin = 0.5 * (rodRin[i] + rodRout[i]) - 0.5 * connW;
219  rout = 0.5 * (rodRin[i] + rodRout[i]) + 0.5 * connW;
220  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz, rin, rout, 0, CLHEP::twopi);
221  LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " << DDName(name, idNameSpace) << " Tubs made of " << connM[i]
222  << " from 0 to " << CLHEP::twopi / CLHEP::deg << " with Rin " << rin << " Rout " << rout
223  << " ZHalf " << dz;
224  DDName connName(DDSplit(connM[i]).first, DDSplit(connM[i]).second);
225  DDMaterial connMatter(connName);
226  DDLogicalPart connLogic(DDName(name, idNameSpace), connMatter, solid);
227 
228  DDTranslation r2(0, 0, (dz - diskDz));
229  cpv.position(DDName(name, idNameSpace), diskName, i + 1, r2, DDRotation());
230  LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " << DDName(name, idNameSpace) << " number " << i + 1
231  << " positioned in " << diskName << " at " << r2 << " with no rotation";
232 
233  // Now the radial cable
234  name = "TOBRadServices" + names[i];
235  rin = 0.5 * (rodRin[i] + rodRout[i]);
236  rout = (i + 1 == (int)(names.size()) ? rMax : 0.5 * (rodRin[i + 1] + rodRout[i + 1]));
237  vector<double> pgonZ;
238  pgonZ.emplace_back(-0.5 * cableT);
239  pgonZ.emplace_back(cableT * (rin / rMax - 0.5));
240  pgonZ.emplace_back(0.5 * cableT);
241  vector<double> pgonRmin;
242  pgonRmin.emplace_back(rin);
243  pgonRmin.emplace_back(rin);
244  pgonRmin.emplace_back(rin);
245  vector<double> pgonRmax;
246  pgonRmax.emplace_back(rout);
247  pgonRmax.emplace_back(rout);
248  pgonRmax.emplace_back(rout);
249  solid = DDSolidFactory::polycone(DDName(name, idNameSpace), 0, CLHEP::twopi, pgonZ, pgonRmin, pgonRmax);
250  LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " << DDName(name, idNameSpace) << " Polycone made of " << cableM[i]
251  << " from 0 to " << CLHEP::twopi / CLHEP::deg << " and with " << pgonZ.size() << " sections";
252  for (int ii = 0; ii < (int)(pgonZ.size()); ii++)
253  LogDebug("TOBGeom") << "\t[" << ii << "]\tZ = " << pgonZ[ii] << "\tRmin = " << pgonRmin[ii]
254  << "\tRmax = " << pgonRmax[ii];
255  DDName cableName(DDSplit(cableM[i]).first, DDSplit(cableM[i]).second);
256  DDMaterial cableMatter(cableName);
257  DDLogicalPart cableLogic(DDName(name, idNameSpace), cableMatter, solid);
258 
259  DDTranslation r3(0, 0, (diskDz - (i + 0.5) * cableT));
260  cpv.position(DDName(name, idNameSpace), diskName, i + 1, r3, DDRotation());
261  LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " << DDName(name, idNameSpace) << " number " << i + 1
262  << " positioned in " << diskName << " at " << r3 << " with no rotation";
263  }
264 
265  LogDebug("TOBGeom") << "<<== End of DDTOBRadCableAlgo construction ...";
266 }
267 
268 DEFINE_EDM_PLUGIN(DDAlgorithmFactory, DDTOBRadCableAlgo, "track:DDTOBRadCableAlgo");
DDTOBRadCableAlgo::rodRout
vector< double > rodRout
Definition: DDTOBRadCableAlgo.cc:44
DDTOBRadCableAlgo::diskDz
double diskDz
Definition: DDTOBRadCableAlgo.cc:40
DDTOBRadCableAlgo::coolM2
string coolM2
Definition: DDTOBRadCableAlgo.cc:59
DDCurrentNamespace.h
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
DDTOBRadCableAlgo
Definition: DDTOBRadCableAlgo.cc:23
DDName
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
DDTOBRadCableAlgo::coolM1
string coolM1
Definition: DDTOBRadCableAlgo.cc:58
DDSplit.h
DDTOBRadCableAlgo::initialize
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
Definition: DDTOBRadCableAlgo.cc:83
DDTOBRadCableAlgo::connT
double connT
Definition: DDTOBRadCableAlgo.cc:47
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
DDTOBRadCableAlgo::coolStartPhi1
double coolStartPhi1
Definition: DDTOBRadCableAlgo.cc:54
DDTOBRadCableAlgo::idNameSpace
string idNameSpace
Definition: DDTOBRadCableAlgo.cc:38
DDTOBRadCableAlgo::coolRin
double coolRin
Definition: DDTOBRadCableAlgo.cc:51
DDMaterial
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
DDTOBRadCableAlgo::rMax
double rMax
Definition: DDTOBRadCableAlgo.cc:41
DDTranslation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:124
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
DDTOBRadCableAlgo::cableT
double cableT
Definition: DDTOBRadCableAlgo.cc:42
DDSolidFactory::tubs
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:653
DDSolid.h
DDTOBRadCableAlgo::DDTOBRadCableAlgo
DDTOBRadCableAlgo()
Definition: DDTOBRadCableAlgo.cc:63
DDTOBRadCableAlgo::names
vector< string > names
Definition: DDTOBRadCableAlgo.cc:60
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
DDTOBRadCableAlgo::coolStartPhi2
double coolStartPhi2
Definition: DDTOBRadCableAlgo.cc:56
DDTOBRadCableAlgo::connM
vector< string > connM
Definition: DDTOBRadCableAlgo.cc:48
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
DDTOBRadCableAlgo::coolR1
vector< double > coolR1
Definition: DDTOBRadCableAlgo.cc:49
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
DDTOBRadCableAlgo::~DDTOBRadCableAlgo
~DDTOBRadCableAlgo() override
Definition: DDTOBRadCableAlgo.cc:81
DDTOBRadCableAlgo::execute
void execute(DDCompactView &cpv) override
Definition: DDTOBRadCableAlgo.cc:142
edmplugin::PluginFactory
Definition: PluginFactory.h:34
DDTOBRadCableAlgo::connW
double connW
Definition: DDTOBRadCableAlgo.cc:46
DDLogicalPart
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
Definition: DDLogicalPart.h:93
DDTypes.h
diffTwoXMLs.r2
r2
Definition: diffTwoXMLs.py:73
DDMaterial.h
createfilelist.int
int
Definition: createfilelist.py:10
DDTOBRadCableAlgo::coolR2
vector< double > coolR2
Definition: DDTOBRadCableAlgo.cc:50
DDSolidFactory::polycone
static DDSolid polycone(const DDName &name, double startPhi, double deltaPhi, const std::vector< double > &z, const std::vector< double > &rmin, const std::vector< double > &rmax)
Creates a polycone (refere to Geant3 or Geant4 documentation)
Definition: DDSolid.cc:537
DDLogicalPart.h
ReadMapType< double >
DDSolidFactory::torus
static DDSolid torus(const DDName &name, double rMin, double rMax, double rTorus, double startPhi, double deltaPhi)
Definition: DDSolid.cc:648
DDAlgorithm.h
std
Definition: JetResolutionObject.h:76
PVValHelper::dz
Definition: PVValidationHelpers.h:51
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
DDTOBRadCableAlgo::coolRout1
double coolRout1
Definition: DDTOBRadCableAlgo.cc:52
DDCurrentNamespace::ns
static std::string & ns()
Definition: DDCurrentNamespace.cc:3
DDTOBRadCableAlgo::rodRin
vector< double > rodRin
Definition: DDTOBRadCableAlgo.cc:43
DDTOBRadCableAlgo::coolRout2
double coolRout2
Definition: DDTOBRadCableAlgo.cc:53
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
DDSolid
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
initialize
static AlgebraicMatrix initialize()
Definition: BeamSpotTransientTrackingRecHit.cc:24
DDTOBRadCableAlgo::cableM
vector< string > cableM
Definition: DDTOBRadCableAlgo.cc:45
DDAlgorithmFactory.h
class-composition.parent
parent
Definition: class-composition.py:88
cuy.ii
ii
Definition: cuy.py:590
DDTOBRadCableAlgo::coolDeltaPhi2
double coolDeltaPhi2
Definition: DDTOBRadCableAlgo.cc:57
DDTOBRadCableAlgo::coolDeltaPhi1
double coolDeltaPhi1
Definition: DDTOBRadCableAlgo.cc:55
DDSplit
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
Definition: DDSplit.cc:3
DDCompactView::position
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
Definition: DDCompactView.cc:76
DDRotation
ROOT::Math::Rotation3D DDRotation
Definition: DDEcalEndcapAlgo.cc:16