CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DDHCalTBCableAlgo Class Reference
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 27 of file DDHCalTBCableAlgo.cc.

Constructor & Destructor Documentation

◆ DDHCalTBCableAlgo()

DDHCalTBCableAlgo::DDHCalTBCableAlgo ( )

Definition at line 61 of file DDHCalTBCableAlgo.cc.

61  : theta(0), rmax(0), zoff(0) {
62 #ifdef EDM_ML_DEBUG
63  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: Creating an instance";
64 #endif
65 }
std::vector< double > theta
Log< level::Info, true > LogVerbatim
std::vector< double > rmax
std::vector< double > zoff

◆ ~DDHCalTBCableAlgo()

DDHCalTBCableAlgo::~DDHCalTBCableAlgo ( )
override

Definition at line 67 of file DDHCalTBCableAlgo.cc.

67 {}

Member Function Documentation

◆ execute()

void DDHCalTBCableAlgo::execute ( DDCompactView cpv)
override

Definition at line 108 of file DDHCalTBCableAlgo.cc.

References absMat, alpha, DDSolidFactory::box(), angle_units::operators::convertRadToDeg(), funct::cos(), DDBase< N, C >::ddname(), DDrot(), DDSplit(), PVValHelper::dy, PVValHelper::dz, dqmdumpme::first, formatAsDegreesInInteger(), gap2, genMat, mps_fire::i, idName, idNameSpace, cuy::ii, length1, length2, Skims_PA_cff::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.

108  {
109 #ifdef EDM_ML_DEBUG
110  edm::LogVerbatim("HCalGeom") << "==>> Constructing DDHCalTBCableAlgo...";
111 #endif
112 
113  double alpha = 1._pi / nsectors;
114  double dphi = nsectortot * 2._pi / nsectors;
115 
116  double zstep0 = zoff[1] + rmax[1] * tan(theta[1]) + (rin - rmax[1]) * tan(theta[2]);
117  double zstep1 = zstep0 + thick / cos(theta[2]);
118  double zstep2 = zoff[3];
119 
120  double rstep0 = rin + (zstep2 - zstep1) / tan(theta[2]);
121  double rstep1 = rin + (zstep1 - zstep0) / tan(theta[2]);
122 
123  std::vector<double> pgonZ = {zstep0, zstep1, zstep2, zstep2 + thick / cos(theta[2])};
124 
125  std::vector<double> pgonRmin = {rin, rin, rstep0, rmax[2]};
126  std::vector<double> pgonRmax = {rin, rstep1, rmax[2], rmax[2]};
127 
128  std::string name("Null");
129  DDSolid solid;
130  solid = DDSolidFactory::polyhedra(DDName(idName, idNameSpace), nsectortot, -alpha, dphi, pgonZ, pgonRmin, pgonRmax);
131 #ifdef EDM_ML_DEBUG
132  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: " << DDName(idName, idNameSpace) << " Polyhedra made of "
133  << genMat << " with " << nsectortot << " sectors from " << convertRadToDeg(-alpha)
134  << " to " << convertRadToDeg(-alpha + dphi) << " and with " << pgonZ.size()
135  << " sections";
136  for (unsigned int i = 0; i < pgonZ.size(); i++)
137  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << pgonZ[i] << "\tRmin = " << pgonRmin[i] << "\tRmax = " << pgonRmax[i];
138 #endif
140  DDMaterial matter(matname);
141  DDLogicalPart genlogic(solid.ddname(), matter, solid);
142 
143  DDName parentName = parent().name();
144  DDTranslation r0(0.0, 0.0, 0.0);
145  DDRotation rot;
146  cpv.position(DDName(idName, idNameSpace), parentName, 1, r0, rot);
147 #ifdef EDM_ML_DEBUG
148  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: " << DDName(idName, idNameSpace) << " number 1 positioned in "
149  << parentName << " at " << r0 << " with " << rot;
150 #endif
151  if (nhalf != 1) {
152  rot = DDRotation(DDName("180D", rotns));
153  cpv.position(DDName(idName, idNameSpace), parentName, 2, r0, rot);
154 #ifdef EDM_ML_DEBUG
155  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: " << DDName(idName, idNameSpace) << " number 2 positioned in "
156  << parentName << " at " << r0 << " with " << rot;
157 #endif
158  }
159 
160  //Construct sector (from -alpha to +alpha)
161  name = idName + "Module";
162 #ifdef EDM_ML_DEBUG
163  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: " << DDName(name, idNameSpace) << " Polyhedra made of " << genMat
164  << " with 1 sector from " << convertRadToDeg(-alpha) << " to " << convertRadToDeg(alpha)
165  << " and with " << pgonZ.size() << " sections";
166  for (unsigned int i = 0; i < pgonZ.size(); i++)
167  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << pgonZ[i] << "\tRmin = " << pgonRmin[i] << "\tRmax = " << pgonRmax[i];
168 #endif
169  solid = DDSolidFactory::polyhedra(DDName(name, idNameSpace), 1, -alpha, 2 * alpha, pgonZ, pgonRmin, pgonRmax);
170  DDLogicalPart seclogic(solid.ddname(), matter, solid);
171 
172  for (int ii = 0; ii < nsectortot; ii++) {
173  double phi = ii * 2 * alpha;
175  std::string rotstr("NULL");
176  if (phi != 0) {
177  rotstr = "R" + formatAsDegreesInInteger(phi);
178  rotation = DDRotation(DDName(rotstr, rotns));
179  if (!rotation) {
180 #ifdef EDM_ML_DEBUG
181  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: Creating a new "
182  << "rotation " << rotstr << "\t90," << convertRadToDeg(phi) << ",90,"
183  << (90 + convertRadToDeg(phi)) << ", 0, 0";
184 #endif
185  rotation = DDrot(DDName(rotstr, idNameSpace), 90._deg, phi, 90._deg, (90._deg + phi), 0, 0);
186  }
187  }
188 
189  cpv.position(seclogic, genlogic, ii + 1, DDTranslation(0.0, 0.0, 0.0), rotation);
190 #ifdef EDM_ML_DEBUG
191  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: " << seclogic.name() << " number " << ii + 1
192  << " positioned in " << genlogic.name() << " at (0,0,0) with " << rotation;
193 #endif
194  }
195 
196  //Now a trapezoid of air
197  double rinl = pgonRmin[0] + thick * sin(theta[2]);
198  double routl = pgonRmax[2] - thick * sin(theta[2]);
199  double dx1 = rinl * tan(alpha);
200  double dx2 = 0.90 * routl * tan(alpha);
201  double dy = 0.50 * thick;
202  double dz = 0.50 * (routl - rinl);
203  name = idName + "Trap";
204  solid = DDSolidFactory::trap(DDName(name, idNameSpace), dz, 0, 0, dy, dx1, dx1, 0, dy, dx2, dx2, 0);
205 #ifdef EDM_ML_DEBUG
206  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: " << solid.name() << " Trap made of " << genMat
207  << " of dimensions " << dz << ", 0, 0, " << dy << ", " << dx1 << ", " << dx1 << ", 0, "
208  << dy << ", " << dx2 << ", " << dx2 << ", 0";
209 #endif
210  DDLogicalPart glog(solid.ddname(), matter, solid);
211 
212  std::string rotstr = name;
213 #ifdef EDM_ML_DEBUG
214  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: Creating a rotation: " << rotstr << "\t90, 270, "
215  << (180 - convertRadToDeg(theta[2])) << ", 0, " << (90 - convertRadToDeg(theta[2]))
216  << ", 0";
217 #endif
218  rot = DDrot(DDName(rotstr, idNameSpace), 90._deg, 270._deg, (180._deg - theta[2]), 0, (90._deg - theta[2]), 0);
219  DDTranslation r1(0.5 * (rinl + routl), 0, 0.5 * (pgonZ[1] + pgonZ[2]));
220  cpv.position(glog, seclogic, 1, r1, rot);
221 #ifdef EDM_ML_DEBUG
222  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: " << glog.name() << " number 1 positioned in " << seclogic.name()
223  << " at " << r1 << " with " << rot;
224 #endif
225  //Now the cable of type 1
226  name = idName + "Cable1";
227  double phi = atan((dx2 - dx1) / (2 * dz));
228  double xmid = 0.5 * (dx1 + dx2) - 1.0;
229  solid = DDSolidFactory::box(DDName(name, idNameSpace), 0.5 * width1, 0.5 * thick, 0.5 * length1);
230 #ifdef EDM_ML_DEBUG
231  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: " << solid.name() << " Box made of " << absMat << " of dimension "
232  << 0.5 * width1 << ", " << 0.5 * thick << ", " << 0.5 * length1;
233 #endif
235  DDMaterial absmatter(absname);
236  DDLogicalPart cablog1(solid.ddname(), absmatter, solid);
237 
238  rotstr = idName + "Left";
239 #ifdef EDM_ML_DEBUG
240  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: Creating a rotation " << rotstr << "\t"
241  << (90 + convertRadToDeg(phi)) << ", 0, 90, 90, " << convertRadToDeg(phi) << ", 0";
242 #endif
243  DDRotation rot2 = DDrot(DDName(rotstr, idNameSpace), (90._deg + phi), 0.0, 90._deg, 90._deg, phi, 0.0);
244  DDTranslation r2((xmid - 0.5 * width1 * cos(phi)), 0, 0);
245  cpv.position(cablog1, glog, 1, r2, rot2);
246 #ifdef EDM_ML_DEBUG
247  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: " << cablog1.name() << " number 1 positioned in " << glog.name()
248  << " at " << r2 << " with " << rot2;
249 #endif
250  rotstr = idName + "Right";
251 #ifdef EDM_ML_DEBUG
252  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: Creating a rotation " << rotstr << "\t"
253  << (90 - convertRadToDeg(phi)) << ", 0, 90, 90, " << convertRadToDeg(-phi) << ", 0";
254 #endif
255  DDRotation rot3 = DDrot(DDName(rotstr, idNameSpace), (90._deg - phi), 0, 90._deg, 90._deg, -phi, 0);
256  DDTranslation r3(-(xmid - 0.5 * width1 * cos(phi)), 0, 0);
257  cpv.position(cablog1, glog, 2, r3, rot3);
258 #ifdef EDM_ML_DEBUG
259  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: " << cablog1.name() << " number 2 positioned in " << glog.name()
260  << " at " << r3 << " with " << rot3;
261 #endif
262  //Now the cable of type 2
263  name = idName + "Cable2";
264  solid = DDSolidFactory::box(DDName(name, idNameSpace), 0.5 * width2, 0.5 * thick, 0.5 * length2);
265 #ifdef EDM_ML_DEBUG
266  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: " << solid.name() << " Box made of " << absMat << " of dimension "
267  << 0.5 * width2 << ", " << 0.5 * thick << ", " << 0.5 * length2;
268 #endif
269  DDLogicalPart cablog2(solid.ddname(), absmatter, solid);
270 
271  double xpos = 0.5 * (width2 + gap2);
272  cpv.position(cablog2, glog, 1, DDTranslation(xpos, 0.0, 0.0), DDRotation());
273 #ifdef EDM_ML_DEBUG
274  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: " << cablog2.name() << " number 1 positioned in " << glog.name()
275  << " at (" << xpos << ", 0, 0) with no "
276  << "rotation";
277 #endif
278  cpv.position(cablog2, glog, 2, DDTranslation(-xpos, 0.0, 0.0), DDRotation());
279 #ifdef EDM_ML_DEBUG
280  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: " << cablog2.name() << " number 2 positioned in " << glog.name()
281  << " at (" << -xpos << ", 0, 0) with no "
282  << "rotation";
283 
284  edm::LogVerbatim("HCalGeom") << "<<== End of DDHCalTBCableAlgo construction";
285 #endif
286 }
std::vector< double > theta
Log< level::Info, true > LogVerbatim
float alpha
Definition: AMPTWrapper.h:105
std::vector< double > rmax
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
std::string formatAsDegreesInInteger(double radianVal)
Definition: DDTypes.cc:79
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
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:67
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:609
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:547
ii
Definition: cuy.py:589
const N & name() const
Definition: DDBase.h:59
const N & ddname() const
Definition: DDBase.h:61
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
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
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:565

◆ initialize()

void DDHCalTBCableAlgo::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)
override

Definition at line 69 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.

73  {
74  genMat = sArgs["MaterialName"];
75  nsectors = int(nArgs["NSector"]);
76  nsectortot = int(nArgs["NSectorTot"]);
77  nhalf = int(nArgs["NHalf"]);
78  rin = nArgs["RIn"];
79  theta = vArgs["Theta"];
80  rmax = vArgs["RMax"];
81  zoff = vArgs["ZOff"];
82 
83  absMat = sArgs["AbsMatName"];
84  thick = nArgs["Thickness"];
85  width1 = nArgs["Width1"];
86  length1 = nArgs["Length1"];
87  width2 = nArgs["Width2"];
88  length2 = nArgs["Length2"];
89  gap2 = nArgs["Gap2"];
90 
91 #ifdef EDM_ML_DEBUG
92  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: General material " << genMat << "\tSectors " << nsectors << ", "
93  << nsectortot << "\tHalves " << nhalf << "\tRin " << rin;
94  for (unsigned int i = 0; i < theta.size(); i++)
95  edm::LogVerbatim("HCalGeom") << "\t" << i << " Theta " << theta[i] << " rmax " << rmax[i] << " zoff " << zoff[i];
96  edm::LogVerbatim("HCalGeom") << "\tCable mockup made of " << absMat << "\tThick " << thick << "\tLength and width "
97  << length1 << ", " << width1 << " and " << length2 << ", " << width2 << " Gap " << gap2;
98 #endif
99  idName = sArgs["MotherName"];
101  rotns = sArgs["RotNameSpace"];
102 #ifdef EDM_ML_DEBUG
103  edm::LogVerbatim("HCalGeom") << "DDHCalTBCableAlgo: Parent " << parent().name() << " idName " << idName
104  << " NameSpace " << idNameSpace << " for solids etc. and " << rotns << " for rotations";
105 #endif
106 }
std::vector< double > theta
Log< level::Info, true > LogVerbatim
std::vector< double > rmax
static std::string & ns()
std::vector< double > zoff

Member Data Documentation

◆ absMat

std::string DDHCalTBCableAlgo::absMat
private

Definition at line 50 of file DDHCalTBCableAlgo.cc.

Referenced by execute(), and initialize().

◆ gap2

double DDHCalTBCableAlgo::gap2
private

Definition at line 54 of file DDHCalTBCableAlgo.cc.

Referenced by execute(), and initialize().

◆ genMat

std::string DDHCalTBCableAlgo::genMat
private

Definition at line 42 of file DDHCalTBCableAlgo.cc.

Referenced by execute(), and initialize().

◆ idName

std::string DDHCalTBCableAlgo::idName
private

Definition at line 56 of file DDHCalTBCableAlgo.cc.

Referenced by execute(), and initialize().

◆ idNameSpace

std::string DDHCalTBCableAlgo::idNameSpace
private

Definition at line 57 of file DDHCalTBCableAlgo.cc.

Referenced by execute(), and initialize().

◆ length1

double DDHCalTBCableAlgo::length1
private

Definition at line 52 of file DDHCalTBCableAlgo.cc.

Referenced by execute(), and initialize().

◆ length2

double DDHCalTBCableAlgo::length2
private

Definition at line 53 of file DDHCalTBCableAlgo.cc.

Referenced by execute(), and initialize().

◆ nhalf

int DDHCalTBCableAlgo::nhalf
private

Definition at line 45 of file DDHCalTBCableAlgo.cc.

Referenced by execute(), and initialize().

◆ nsectors

int DDHCalTBCableAlgo::nsectors
private

Definition at line 43 of file DDHCalTBCableAlgo.cc.

Referenced by execute(), and initialize().

◆ nsectortot

int DDHCalTBCableAlgo::nsectortot
private

Definition at line 44 of file DDHCalTBCableAlgo.cc.

Referenced by execute(), and initialize().

◆ rin

double DDHCalTBCableAlgo::rin
private

Definition at line 46 of file DDHCalTBCableAlgo.cc.

Referenced by execute(), and initialize().

◆ rmax

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

Definition at line 48 of file DDHCalTBCableAlgo.cc.

Referenced by execute(), and initialize().

◆ rotns

std::string DDHCalTBCableAlgo::rotns
private

Definition at line 58 of file DDHCalTBCableAlgo.cc.

Referenced by execute(), and initialize().

◆ theta

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

Definition at line 47 of file DDHCalTBCableAlgo.cc.

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

◆ thick

double DDHCalTBCableAlgo::thick
private

Definition at line 51 of file DDHCalTBCableAlgo.cc.

Referenced by execute(), and initialize().

◆ width1

double DDHCalTBCableAlgo::width1
private

Definition at line 52 of file DDHCalTBCableAlgo.cc.

Referenced by execute(), and initialize().

◆ width2

double DDHCalTBCableAlgo::width2
private

Definition at line 53 of file DDHCalTBCableAlgo.cc.

Referenced by execute(), and initialize().

◆ zoff

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

Definition at line 49 of file DDHCalTBCableAlgo.cc.

Referenced by execute(), and initialize().