12 #include "CLHEP/Units/GlobalPhysicalConstants.h" 13 #include "CLHEP/Units/GlobalSystemOfUnits.h" 39 names_ = vsArgs[
"VolumeNames"];
40 thick_ = vArgs[
"Thickness"];
46 <<
" types of volumes";
47 for (
unsigned int i=0;
i<
names_.size(); ++
i)
49 <<
" of thickness " <<
thick_[
i]
61 <<
" with " <<
layers_[
i] <<
" layers";
73 <<
i <<
":" << ii <<
" with " 98 <<
" types of volumes in the top part";
105 <<
" layers in the top part" ;
120 <<
" types of volumes in the bottom part";
127 <<
" layers in the top part" ;
145 <<
" radius for wafer type separation uses " 156 slopeB_ = vArgs[
"SlopeBottom"];
163 <<
" slopes for top" ;
193 <<
" different wafer copy numbers";
195 for (std::unordered_set<int>::const_iterator itr=
copies_.begin();
200 edm::LogVerbatim(
"HGCalGeom") <<
"<<== End of DDHGCalHEAlgo construction...";
212 const double tol(0.01);
213 for (
unsigned int i=0;
i<
layers_.size();
i++) {
215 double routF =
rMax(zi);
219 std::vector<double> pgonZ(2), pgonRin(2), pgonRout(2);
220 for (
int ly=laymin; ly<laymax; ++ly) {
232 << ii <<
" Front " << zi <<
", " << routF
233 <<
" Back " << zo <<
", " << rinB
234 <<
" superlayer thickness " 243 double rmax = routF*
cos(alpha) - tol;
244 pgonZ[0] =-hthick; pgonZ[1] = hthick;
245 pgonRin[0] = rinB; pgonRin[1] = rinB;
246 pgonRout[0] = rmax; pgonRout[1] = rmax;
249 pgonZ, pgonRin, pgonRout);
254 <<
" sectors covering " 255 << -alpha/CLHEP::deg <<
":" 256 << (-alpha+CLHEP::twopi)/CLHEP::deg
257 <<
" with " << pgonZ.size()<<
" sections";
258 for (
unsigned int k=0;
k<pgonZ.size(); ++
k)
260 <<
" R " << pgonRin[
k] <<
":" 265 hthick, rinB, routF, 0.0,
270 <<
" Tubs made of " << matName
271 <<
" of dimensions " << rinB
272 <<
", " << routF <<
", " << hthick
273 <<
", 0.0, " << CLHEP::twopi/CLHEP::deg;
275 <<
" number " <<
copy;
282 cpv.
position(glog, module, copy, r1, rot);
286 <<
" number " << copy
287 <<
" positioned in " << module.
name()
288 <<
" at " << r1 <<
" with " <<
rot;
294 if (
std::abs(thickTot-layerThick_[
i]) < 0.00001) {
295 }
else if (thickTot > layerThick_[i]) {
297 << layerThick_[
i] <<
" is smaller than " 298 << thickTot <<
": thickness of all its " 299 <<
"components **** ERROR ****";
300 }
else if (thickTot < layerThick_[i]) {
302 << layerThick_[
i] <<
" does not match with " 303 << thickTot <<
" of the components";
313 for (
unsigned int k=0;
k<
slopeT_.size(); ++
k) {
330 double rin,
double rmid,
double rout,
344 double hthick = 0.5*thick;
348 hthick, rmid, rout, 0.0,
353 <<
" Tubs made of " << matter.
name()
354 <<
" of dimensions " << rmid <<
", " << rout
355 <<
", " << hthick <<
", 0.0, " 356 << CLHEP::twopi/CLHEP::deg;
358 cpv.
position(glog1, glog, 1, tran, rot);
361 <<
" number 1 positioned in " << glog.
name()
362 <<
" at " << tran <<
" with " <<
rot;
364 double thickTot(0), zpos(-hthick);
373 <<
" R " << rmid <<
":" << rout <<
" Thick " 383 double eta1 = -
log(
tan(0.5*atan(rmid/zz)));
384 double eta2 = -
log(
tan(0.5*atan(rout/zz)));
386 << rmid <<
":" << rout <<
" eta " << eta1
389 <<
" Tubs made of " << matName
390 <<
" of dimensions " << rmid <<
", " << rout
391 <<
", " << hthickl <<
", 0.0, " 392 << CLHEP::twopi/CLHEP::deg;
396 cpv.
position(glog2, glog1, copy, r1, rot);
399 <<
" number " << copy <<
" in " 400 << glog1.
name() <<
" at " << r1
406 if (
std::abs(thickTot-thick) < 0.00001) {
407 }
else if (thickTot > thick) {
408 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << thick
409 <<
" is smaller than " << thickTot
410 <<
": thickness of all its components in " 411 <<
"the top part **** ERROR ****";
412 }
else if (thickTot < thick) {
414 <<
" does not match with " << thickTot
415 <<
" of the components in top part";
419 name = nameM+
"Bottom";
421 hthick, rin, rmid, 0.0, CLHEP::twopi);
425 <<
" Tubs made of " << matter.
name()
426 <<
" of dimensions " << rin <<
", " << rmid
427 <<
", " << hthick <<
", 0.0, " 428 << CLHEP::twopi/CLHEP::deg;
430 cpv.
position(glog1, glog, 1, tran, rot);
433 <<
" number 1 positioned in " << glog.
name()
434 <<
" at " << tran <<
" with " <<
rot;
446 <<
" R " << rin <<
":" << rmid <<
" Thick " 456 double eta1 = -
log(
tan(0.5*atan(rin/zz)));
457 double eta2 = -
log(
tan(0.5*atan(rmid/zz)));
459 << rin <<
":" << rmid <<
" eta " << eta1
462 <<
" Tubs made of " << matName
463 <<
" of dimensions " << rin <<
", " << rmid
464 <<
", " << hthickl <<
", 0.0, " 465 << CLHEP::twopi/CLHEP::deg;
469 cpv.
position(glog2, glog1, copy, r1, rot);
472 <<
" number " << copy <<
" in " 473 << glog1.
name() <<
" at " << r1
481 if (
std::abs(thickTot-thick) < 0.00001) {
482 }
else if (thickTot > thick) {
483 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << thick
484 <<
" is smaller than " << thickTot
485 <<
": thickness of all its components in " 486 <<
"the top part **** ERROR ****";
487 }
else if (thickTot < thick) {
489 <<
" does not match with " << thickTot
490 <<
" of the components in top part";
495 double rout,
double zpos,
int layertype,
497 static const double sqrt3 =
std::sqrt(3.0);
499 double R = 2.0*r/sqrt3;
501 int N = (
int)(0.5*rout/r) + 2;
504 int ium(0), ivm(0), iumAll(0), ivmAll(0), kount(0), ntot(0),
nin(0);
505 std::vector<int> ntype(6,0);
507 <<
" rout " << rout <<
" N " << N
508 <<
" for maximum u, v";
510 for (
int u = -N; u <=
N; ++u) {
512 for (
int v = -N;
v <=
N; ++
v) {
518 xc[0] = xpos+
r; yc[0] = ypos+0.5*
R;
519 xc[1] = xpos; yc[1] = ypos+
R;
520 xc[2] = xpos-
r; yc[2] = ypos+0.5*
R;
521 xc[3] = xpos-
r; yc[3] = ypos-0.5*
R;
522 xc[4] = xpos; yc[4] = ypos-
R;
523 xc[5] = xpos+
r; yc[5] = ypos-0.5*
R;
524 bool cornerOne(
false), cornerAll(
true);
525 for (
int k=0;
k<6; ++
k) {
527 if (rpos >= rin && rpos <= rout) cornerOne =
true;
528 else cornerAll =
false;
535 int copy = type*1000000 + iv*100 + iu;
536 if (u < 0) copy += 10000;
537 if (v < 0) copy += 100000;
539 if (iu > ium) ium = iu;
540 if (iv > ivm) ivm = iv;
546 if (iu > iumAll) iumAll = iu;
547 if (iv > ivmAll) ivmAll = iv;
552 if (layertype > 1) type += 3;
559 <<
" number " << copy
560 <<
" positioned in " << glog.
ddname()
570 <<
":" << iumAll <<
" # of v " << ivm <<
":" 571 << ivmAll <<
" and " << nin <<
":" << kount
572 <<
":" << ntot <<
" wafers (" << ntype[0]
573 <<
":" << ntype[1] <<
":" << ntype[2] <<
":" 574 << ntype[3] <<
":" << ntype[4] <<
":" 575 << ntype[5] <<
") for " << glog.
ddname()
576 <<
" R " << rin <<
":" << rout;
std::vector< double > rMixLayer_
std::vector< int > layerTypeTop_
std::vector< double > layerThickBot_
void positionMix(const DDLogicalPart &glog, const std::string &name, int copy, double thick, const DDMaterial &matter, double rin, double rmid, double routF, double zz, DDCompactView &cpv)
std::vector< double > slopeB_
std::vector< std::string > materials_
DDMaterial is used to define and access material information.
void execute(DDCompactView &cpv) override
DDName is used to identify DDD entities uniquely.
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
static std::string & ns()
std::vector< double > thick_
std::vector< std::string > namesTop_
Compact representation of the geometrical detector hierarchy.
~DDHGCalHEAlgo() override
A DDSolid represents the shape of a part.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Represents a uniquely identifyable rotation matrix.
U second(std::pair< T, U > const &p)
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
std::unique_ptr< HGCalWaferType > waferType_
std::vector< int > layerSense_
std::vector< int > copyNumberBot_
std::vector< std::string > materialsBot_
std::vector< double > slopeT_
void constructLayers(const DDLogicalPart &, DDCompactView &cpv)
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
std::vector< int > layers_
std::vector< double > rad100to200_
std::vector< double > layerThickTop_
std::unordered_set< int > copies_
std::vector< int > copyNumber_
std::vector< int > layerType_
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string ©no, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
std::vector< std::string > materialsTop_
std::vector< double > zFront_
std::vector< int > copyNumberTop_
void positionSensitive(const DDLogicalPart &glog, double rin, double rout, double zpos, int layertype, DDCompactView &cpv)
std::vector< int > layerSenseBot_
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
std::vector< std::string > wafers_
std::vector< std::string > namesBot_
std::vector< double > layerThick_
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)
std::vector< std::string > names_
std::vector< int > layerTypeBot_
std::vector< double > rMaxFront_
std::vector< double > rad200to300_