CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DDHCalTBCableAlgo Class Reference

#include <DDHCalTBCableAlgo.h>

Inheritance diagram for DDHCalTBCableAlgo:

Public Member Functions

 DDHCalTBCableAlgo ()
 
void execute (DDCompactView &cpv) override
 
void initialize (const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
 
 ~DDHCalTBCableAlgo () override
 

Private Attributes

std::string absMat
 
double gap2
 
std::string genMat
 
std::string idName
 
std::string idNameSpace
 
double length1
 
double length2
 
int nhalf
 
int nsectors
 
int nsectortot
 
double rin
 
std::vector< double > rmax
 
std::string rotns
 
std::vector< double > theta
 
double thick
 
double width1
 
double width2
 
std::vector< double > zoff
 

Detailed Description

Definition at line 10 of file DDHCalTBCableAlgo.h.

Constructor & Destructor Documentation

DDHCalTBCableAlgo::DDHCalTBCableAlgo ( )

Definition at line 21 of file DDHCalTBCableAlgo.cc.

21  : theta(0),rmax(0),zoff(0) {
22 #ifdef EDM_ML_DEBUG
23  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: Creating an instance";
24 #endif
25 }
std::vector< double > theta
std::vector< double > rmax
std::vector< double > zoff
DDHCalTBCableAlgo::~DDHCalTBCableAlgo ( )
override

Definition at line 27 of file DDHCalTBCableAlgo.cc.

27 {}

Member Function Documentation

void DDHCalTBCableAlgo::execute ( DDCompactView cpv)
override

Definition at line 78 of file DDHCalTBCableAlgo.cc.

References absMat, alpha, DDSolidFactory::box(), geant_units::operators::convertRadToDeg(), funct::cos(), DDBase< N, C >::ddname(), DDrot(), DDSplit(), PVValHelper::dy, PVValHelper::dz, plotBeamSpotDB::first, formatAsDegreesInInteger(), gap2, genMat, mps_fire::i, idName, idNameSpace, cuy::ii, length1, length2, dataset::name, DDBase< N, C >::name(), nhalf, nsectors, nsectortot, class-composition::parent, phi, DDSolidFactory::polyhedra(), DDCompactView::position(), diffTwoXMLs::r1, diffTwoXMLs::r2, rin, rmax, makeMuonMisalignmentScenario::rot, idealTransformation::rotation, rotns, edm::second(), funct::sin(), AlCaHLTBitMon_QueryRunRegistry::string, funct::tan(), theta, thick, DDSolidFactory::trap(), width1, width2, and zoff.

78  {
79 
80 #ifdef EDM_ML_DEBUG
81  edm::LogVerbatim("HCalGeom") << "==>> Constructing DDHCalTBCableAlgo...";
82 #endif
83 
84  double alpha = 1._pi/nsectors;
85  double dphi = nsectortot*2._pi/nsectors;
86 
87  double zstep0 = zoff[1]+rmax[1]*tan(theta[1])+(rin-rmax[1])*tan(theta[2]);
88  double zstep1 = zstep0+thick/cos(theta[2]);
89  double zstep2 = zoff[3];
90 
91  double rstep0 = rin + (zstep2-zstep1)/tan(theta[2]);
92  double rstep1 = rin + (zstep1-zstep0)/tan(theta[2]);
93 
94  std::vector<double> pgonZ = {zstep0, zstep1, zstep2,
95  zstep2+thick/cos(theta[2])};
96 
97  std::vector<double> pgonRmin = {rin, rin, rstep0, rmax[2]};
98  std::vector<double> pgonRmax = {rin, rstep1, rmax[2], rmax[2]};
99 
100  std::string name("Null");
101  DDSolid solid;
103  nsectortot, -alpha, dphi, pgonZ,
104  pgonRmin, pgonRmax);
105 #ifdef EDM_ML_DEBUG
106  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: "
108  << " Polyhedra made of " << genMat << " with "
109  << nsectortot << " sectors from "
110  << convertRadToDeg(-alpha) << " to "
111  << convertRadToDeg(-alpha+dphi) << " and with "
112  << pgonZ.size() << " sections";
113  for (unsigned int i = 0; i <pgonZ.size(); i++)
114  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << pgonZ[i] << "\tRmin = "
115  << pgonRmin[i] << "\tRmax = " << pgonRmax[i];
116 #endif
118  DDMaterial matter(matname);
119  DDLogicalPart genlogic(solid.ddname(), matter, solid);
120 
121  DDName parentName = parent().name();
122  DDTranslation r0(0.0, 0.0, 0.0);
123  DDRotation rot;
124  cpv.position(DDName(idName, idNameSpace), parentName, 1, r0, rot);
125 #ifdef EDM_ML_DEBUG
126  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: "
128  << " number 1 positioned in " << parentName
129  << " at " << r0 << " with "<<rot;
130 #endif
131  if (nhalf != 1) {
132  rot = DDRotation(DDName("180D", rotns));
133  cpv.position(DDName(idName, idNameSpace), parentName, 2, r0, rot);
134 #ifdef EDM_ML_DEBUG
135  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: "
137  <<" number 2 positioned in " << parentName
138  << " at " << r0 << " with " << rot;
139 #endif
140  }
141 
142  //Construct sector (from -alpha to +alpha)
143  name = idName + "Module";
144 #ifdef EDM_ML_DEBUG
145  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: "
146  << DDName(name,idNameSpace)
147  << " Polyhedra made of " << genMat
148  << " with 1 sector from "
149  << convertRadToDeg(-alpha) << " to "
150  << convertRadToDeg(alpha) << " and with "
151  << pgonZ.size() << " sections";
152  for (unsigned int i = 0; i < pgonZ.size(); i++)
153  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << pgonZ[i] << "\tRmin = "
154  << pgonRmin[i] << "\tRmax = " << pgonRmax[i];
155 #endif
157  1, -alpha, 2*alpha, pgonZ,
158  pgonRmin, pgonRmax);
159  DDLogicalPart seclogic(solid.ddname(), matter, solid);
160 
161  for (int ii=0; ii<nsectortot; ii++) {
162  double phi = ii*2*alpha;
164  std::string rotstr("NULL");
165  if (phi != 0) {
166  rotstr = "R" + formatAsDegreesInInteger(phi);
167  rotation = DDRotation(DDName(rotstr, rotns));
168  if (!rotation) {
169 #ifdef EDM_ML_DEBUG
170  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: Creating a new "
171  << "rotation " << rotstr << "\t90,"
172  << convertRadToDeg(phi) << ",90,"
173  << (90+convertRadToDeg(phi)) << ", 0, 0";
174 #endif
175  rotation = DDrot(DDName(rotstr, idNameSpace), 90._deg, phi, 90._deg,
176  (90._deg+phi), 0, 0);
177  }
178  }
179 
180  cpv.position(seclogic, genlogic, ii+1, DDTranslation(0.0, 0.0, 0.0),
181  rotation);
182 #ifdef EDM_ML_DEBUG
183  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: " << seclogic.name()
184  << " number " << ii+1 << " positioned in "
185  << genlogic.name() << " at (0,0,0) with "
186  << rotation;
187 #endif
188  }
189 
190  //Now a trapezoid of air
191  double rinl = pgonRmin[0] + thick * sin(theta[2]);
192  double routl = pgonRmax[2] - thick * sin(theta[2]);
193  double dx1 = rinl * tan(alpha);
194  double dx2 = 0.90 * routl * tan(alpha);
195  double dy = 0.50 * thick;
196  double dz = 0.50 * (routl -rinl);
197  name = idName + "Trap";
198  solid = DDSolidFactory::trap(DDName(name, idNameSpace), dz, 0, 0, dy, dx1,
199  dx1, 0, dy, dx2, dx2, 0);
200 #ifdef EDM_ML_DEBUG
201  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: " << solid.name()
202  << " Trap made of " << genMat
203  << " of dimensions " << dz << ", 0, 0, "
204  << dy << ", " << dx1 << ", " << dx1
205  << ", 0, " << dy << ", " << dx2 << ", " << dx2
206  <<", 0";
207 #endif
208  DDLogicalPart glog(solid.ddname(), matter, solid);
209 
210  std::string rotstr = name;
211 #ifdef EDM_ML_DEBUG
212  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: Creating a rotation: "
213  << rotstr << "\t90, 270, "
214  << (180-convertRadToDeg(theta[2]))
215  << ", 0, " << (90-convertRadToDeg(theta[2]))
216  << ", 0";
217 #endif
218  rot = DDrot(DDName(rotstr, idNameSpace), 90._deg, 270._deg,
219  (180._deg-theta[2]), 0, (90._deg-theta[2]), 0);
220  DDTranslation r1(0.5*(rinl+routl), 0, 0.5*(pgonZ[1]+pgonZ[2]));
221  cpv.position(glog, seclogic, 1, r1, rot);
222 #ifdef EDM_ML_DEBUG
223  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: " << glog.name()
224  << " number 1 positioned in " << seclogic.name()
225  << " at " << r1 << " with " << rot;
226 #endif
227  //Now the cable of type 1
228  name = idName + "Cable1";
229  double phi = atan((dx2-dx1)/(2*dz));
230  double xmid = 0.5*(dx1+dx2)-1.0;
232  0.5*thick, 0.5*length1);
233 #ifdef EDM_ML_DEBUG
234  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: " << solid.name()
235  << " Box made of " << absMat << " of dimension "
236  << 0.5*width1 << ", " << 0.5*thick << ", "
237  << 0.5*length1;
238 #endif
239  DDName absname(DDSplit(absMat).first, DDSplit(absMat).second);
240  DDMaterial absmatter(absname);
241  DDLogicalPart cablog1(solid.ddname(), absmatter, solid);
242 
243  rotstr = idName + "Left";
244 #ifdef EDM_ML_DEBUG
245  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: Creating a rotation "
246  << rotstr << "\t" << (90+convertRadToDeg(phi))
247  << ", 0, 90, 90, " << convertRadToDeg(phi)
248  << ", 0";
249 #endif
250  DDRotation rot2 = DDrot(DDName(rotstr, idNameSpace), (90._deg+phi), 0.0,
251  90._deg, 90._deg, phi, 0.0);
252  DDTranslation r2((xmid-0.5*width1*cos(phi)), 0, 0);
253  cpv.position(cablog1, glog, 1, r2, rot2);
254 #ifdef EDM_ML_DEBUG
255  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: " << cablog1.name()
256  << " number 1 positioned in " << glog.name()
257  << " at " << r2 << " with " << rot2;
258 #endif
259  rotstr = idName + "Right";
260 #ifdef EDM_ML_DEBUG
261  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: Creating a rotation "
262  << rotstr << "\t" << (90-convertRadToDeg(phi))
263  << ", 0, 90, 90, " << convertRadToDeg(-phi)
264  << ", 0";
265 #endif
266  DDRotation rot3 = DDrot(DDName(rotstr, idNameSpace), (90._deg-phi), 0,
267  90._deg, 90._deg, -phi, 0);
268  DDTranslation r3(-(xmid-0.5*width1*cos(phi)), 0, 0);
269  cpv.position(cablog1, glog, 2, r3, rot3);
270 #ifdef EDM_ML_DEBUG
271  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: " << cablog1.name()
272  << " number 2 positioned in " << glog.name()
273  << " at " << r3 << " with " << rot3;
274 #endif
275  //Now the cable of type 2
276  name = idName + "Cable2";
278  0.5*thick, 0.5*length2);
279 #ifdef EDM_ML_DEBUG
280  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: " << solid.name()
281  << " Box made of " << absMat << " of dimension "
282  << 0.5*width2 << ", " << 0.5*thick << ", "
283  << 0.5*length2;
284 #endif
285  DDLogicalPart cablog2(solid.ddname(), absmatter, solid);
286 
287  double xpos = 0.5*(width2+gap2);
288  cpv.position(cablog2, glog, 1, DDTranslation(xpos, 0.0, 0.0), DDRotation());
289 #ifdef EDM_ML_DEBUG
290  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: " << cablog2.name()
291  << " number 1 positioned in " << glog.name()
292  << " at (" << xpos << ", 0, 0) with no "
293  << "rotation";
294 #endif
295  cpv.position(cablog2, glog, 2, DDTranslation(-xpos, 0.0, 0.0), DDRotation());
296 #ifdef EDM_ML_DEBUG
297  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: " << cablog2.name()
298  << " number 2 positioned in " << glog.name()
299  << " at (" <<-xpos << ", 0, 0) with no "
300  << "rotation";
301 
302  edm::LogVerbatim("HCalGeom") << "<<== End of DDHCalTBCableAlgo construction";
303 #endif
304 }
std::vector< double > theta
float alpha
Definition: AMPTWrapper.h:95
std::vector< double > rmax
const N & name() const
Definition: DDBase.h:74
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:43
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
constexpr NumType convertRadToDeg(NumType radians)
Definition: GeantUnits.h:98
std::string formatAsDegreesInInteger(double radianVal)
Definition: DDTypes.cc:86
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)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
DDRotation DDrot(const DDName &name, std::unique_ptr< DDRotationMatrix > rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:80
static DDSolid trap(const DDName &name, double pDz, double pTheta, double pPhi, double pDy1, double pDx1, double pDx2, double pAlp1, double pDy2, double pDx3, double pDx4, double pAlp2)
Definition: DDSolid.cc:792
static DDSolid box(const DDName &name, double xHalf, double yHalf, double zHalf)
Creates a box with side length 2*xHalf, 2*yHalf, 2*zHalf.
Definition: DDSolid.cc:704
ii
Definition: cuy.py:590
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
std::vector< double > zoff
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
std::string idNameSpace
static DDSolid polyhedra(const DDName &name, int sides, double startPhi, double deltaPhi, const std::vector< double > &z, const std::vector< double > &rmin, const std::vector< double > &rmax)
Creates a polyhedra (refere to Geant3 or Geant4 documentation)
Definition: DDSolid.cc:730
const N & ddname() const
Definition: DDBase.h:76
void DDHCalTBCableAlgo::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)
override

Definition at line 30 of file DDHCalTBCableAlgo.cc.

References absMat, gap2, genMat, mps_fire::i, idName, idNameSpace, createfilelist::int, length1, length2, nhalf, DDCurrentNamespace::ns(), nsectors, nsectortot, class-composition::parent, rin, rmax, rotns, theta, thick, width1, width2, and zoff.

34  {
35 
36  genMat = sArgs["MaterialName"];
37  nsectors = int (nArgs["NSector"]);
38  nsectortot = int (nArgs["NSectorTot"]);
39  nhalf = int (nArgs["NHalf"]);
40  rin = nArgs["RIn"];
41  theta = vArgs["Theta"];
42  rmax = vArgs["RMax"];
43  zoff = vArgs["ZOff"];
44 
45  absMat = sArgs["AbsMatName"];
46  thick = nArgs["Thickness"];
47  width1 = nArgs["Width1"];
48  length1 = nArgs["Length1"];
49  width2 = nArgs["Width2"];
50  length2 = nArgs["Length2"];
51  gap2 = nArgs["Gap2"];
52 
53 #ifdef EDM_ML_DEBUG
54  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: General material "
55  << genMat << "\tSectors " << nsectors << ", "
56  << nsectortot << "\tHalves " << nhalf
57  << "\tRin " << rin;
58  for (unsigned int i = 0; i < theta.size(); i++)
59  edm::LogVerbatim("HCalGeom") << "\t" << i << " Theta " << theta[i]
60  << " rmax " << rmax[i] << " zoff " << zoff[i];
61  edm::LogVerbatim("HCalGeom") << "\tCable mockup made of " << absMat
62  << "\tThick " << thick << "\tLength and width "
63  << length1 << ", " << width1 <<" and "
64  << length2 << ", " << width2 << " Gap " << gap2;
65 #endif
66  idName = sArgs["MotherName"];
68  rotns = sArgs["RotNameSpace"];
69 #ifdef EDM_ML_DEBUG
70  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: Parent "
71  << parent().name() << " idName " << idName
72  << " NameSpace " << idNameSpace
73  << " for solids etc. and " << rotns
74  << " for rotations";
75 #endif
76 }
std::vector< double > theta
std::vector< double > rmax
static std::string & ns()
std::vector< double > zoff
std::string idNameSpace

Member Data Documentation

std::string DDHCalTBCableAlgo::absMat
private

Definition at line 34 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

double DDHCalTBCableAlgo::gap2
private

Definition at line 38 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

std::string DDHCalTBCableAlgo::genMat
private

Definition at line 26 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

std::string DDHCalTBCableAlgo::idName
private

Definition at line 40 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

std::string DDHCalTBCableAlgo::idNameSpace
private

Definition at line 41 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

double DDHCalTBCableAlgo::length1
private

Definition at line 36 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

double DDHCalTBCableAlgo::length2
private

Definition at line 37 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

int DDHCalTBCableAlgo::nhalf
private

Definition at line 29 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

int DDHCalTBCableAlgo::nsectors
private

Definition at line 27 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

int DDHCalTBCableAlgo::nsectortot
private

Definition at line 28 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

double DDHCalTBCableAlgo::rin
private

Definition at line 30 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

std::vector<double> DDHCalTBCableAlgo::rmax
private

Definition at line 32 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

std::string DDHCalTBCableAlgo::rotns
private

Definition at line 42 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

std::vector<double> DDHCalTBCableAlgo::theta
private

Definition at line 31 of file DDHCalTBCableAlgo.h.

Referenced by execute(), initialize(), and Tau.Tau::zImpact().

double DDHCalTBCableAlgo::thick
private

Definition at line 35 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

double DDHCalTBCableAlgo::width1
private

Definition at line 36 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

double DDHCalTBCableAlgo::width2
private

Definition at line 37 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

std::vector<double> DDHCalTBCableAlgo::zoff
private

Definition at line 33 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().