13 #include "CLHEP/Units/GlobalPhysicalConstants.h" 14 #include "CLHEP/Units/GlobalSystemOfUnits.h" 40 names_ = vsArgs[
"VolumeNames"];
41 thick_ = vArgs[
"Thickness"];
47 <<
" types of volumes";
48 for (
unsigned int i=0;
i<
names_.size(); ++
i)
50 <<
" of thickness " <<
thick_[
i]
62 <<
" with " <<
layers_[
i] <<
" layers";
74 <<
i <<
":" << ii <<
" with " 99 <<
" types of volumes in the top part";
106 <<
" layers in the top part" ;
121 <<
" types of volumes in the bottom part";
128 <<
" layers in the top part" ;
146 <<
" radius for wafer type separation uses " 157 slopeB_ = vArgs[
"SlopeBottom"];
197 <<
" different wafer copy numbers";
199 for (std::unordered_set<int>::const_iterator itr=
copies_.begin();
204 edm::LogVerbatim(
"HGCalGeom") <<
"<<== End of DDHGCalHEAlgo construction...";
216 const double tol(0.01);
217 for (
unsigned int i=0;
i<
layers_.size();
i++) {
223 std::vector<double> pgonZ(2), pgonRin(2), pgonRout(2);
224 for (
int ly=laymin; ly<laymax; ++ly) {
235 << ii <<
" Front " << zi <<
", " << routF
236 <<
" Back " << zo <<
", " << rinB
237 <<
" superlayer thickness " 246 double rmax = routF*
cos(alpha) - tol;
247 pgonZ[0] =-hthick; pgonZ[1] = hthick;
248 pgonRin[0] = rinB; pgonRin[1] = rinB;
249 pgonRout[0] = rmax; pgonRout[1] = rmax;
252 pgonZ, pgonRin, pgonRout);
257 <<
" sectors covering " 258 << -alpha/CLHEP::deg <<
":" 259 << (-alpha+CLHEP::twopi)/CLHEP::deg
260 <<
" with " << pgonZ.size()<<
" sections";
261 for (
unsigned int k=0;
k<pgonZ.size(); ++
k)
263 <<
" R " << pgonRin[
k] <<
":" 268 hthick, rinB, routF, 0.0,
273 <<
" Tubs made of " << matName
274 <<
" of dimensions " << rinB
275 <<
", " << routF <<
", " << hthick
276 <<
", 0.0, " << CLHEP::twopi/CLHEP::deg;
278 <<
" number " <<
copy;
285 cpv.
position(glog, module, copy, r1, rot);
289 <<
" number " << copy
290 <<
" positioned in " << module.
name()
291 <<
" at " << r1 <<
" with " <<
rot;
297 if (
std::abs(thickTot-layerThick_[
i]) < 0.00001) {
298 }
else if (thickTot > layerThick_[i]) {
300 << layerThick_[
i] <<
" is smaller than " 301 << thickTot <<
": thickness of all its " 302 <<
"components **** ERROR ****";
303 }
else if (thickTot < layerThick_[i]) {
305 << layerThick_[
i] <<
" does not match with " 306 << thickTot <<
" of the components";
314 double rin,
double rmid,
double rout,
328 double hthick = 0.5*thick;
332 hthick, rmid, rout, 0.0,
337 <<
" Tubs made of " << matter.
name()
338 <<
" of dimensions " << rmid <<
", " << rout
339 <<
", " << hthick <<
", 0.0, " 340 << CLHEP::twopi/CLHEP::deg;
342 cpv.
position(glog1, glog, 1, tran, rot);
345 <<
" number 1 positioned in " << glog.
name()
346 <<
" at " << tran <<
" with " <<
rot;
348 double thickTot(0), zpos(-hthick);
357 <<
" R " << rmid <<
":" << rout <<
" Thick " 367 double eta1 = -
log(
tan(0.5*atan(rmid/zz)));
368 double eta2 = -
log(
tan(0.5*atan(rout/zz)));
370 << rmid <<
":" << rout <<
" eta " << eta1
373 <<
" Tubs made of " << matName
374 <<
" of dimensions " << rmid <<
", " << rout
375 <<
", " << hthickl <<
", 0.0, " 376 << CLHEP::twopi/CLHEP::deg;
380 cpv.
position(glog2, glog1, copy, r1, rot);
383 <<
" number " << copy <<
" in " 384 << glog1.
name() <<
" at " << r1
390 if (
std::abs(thickTot-thick) < 0.00001) {
391 }
else if (thickTot > thick) {
392 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << thick
393 <<
" is smaller than " << thickTot
394 <<
": thickness of all its components in " 395 <<
"the top part **** ERROR ****";
396 }
else if (thickTot < thick) {
398 <<
" does not match with " << thickTot
399 <<
" of the components in top part";
403 name = nameM+
"Bottom";
405 hthick, rin, rmid, 0.0, CLHEP::twopi);
409 <<
" Tubs made of " << matter.
name()
410 <<
" of dimensions " << rin <<
", " << rmid
411 <<
", " << hthick <<
", 0.0, " 412 << CLHEP::twopi/CLHEP::deg;
414 cpv.
position(glog1, glog, 1, tran, rot);
417 <<
" number 1 positioned in " << glog.
name()
418 <<
" at " << tran <<
" with " <<
rot;
430 <<
" R " << rin <<
":" << rmid <<
" Thick " 440 double eta1 = -
log(
tan(0.5*atan(rin/zz)));
441 double eta2 = -
log(
tan(0.5*atan(rmid/zz)));
443 << rin <<
":" << rmid <<
" eta " << eta1
446 <<
" Tubs made of " << matName
447 <<
" of dimensions " << rin <<
", " << rmid
448 <<
", " << hthickl <<
", 0.0, " 449 << CLHEP::twopi/CLHEP::deg;
453 cpv.
position(glog2, glog1, copy, r1, rot);
456 <<
" number " << copy <<
" in " 457 << glog1.
name() <<
" at " << r1
465 if (
std::abs(thickTot-thick) < 0.00001) {
466 }
else if (thickTot > thick) {
467 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << thick
468 <<
" is smaller than " << thickTot
469 <<
": thickness of all its components in " 470 <<
"the top part **** ERROR ****";
471 }
else if (thickTot < thick) {
473 <<
" does not match with " << thickTot
474 <<
" of the components in top part";
479 double rout,
double zpos,
int layertype,
481 static const double sqrt3 =
std::sqrt(3.0);
483 double R = 2.0*r/sqrt3;
485 int N = (
int)(0.5*rout/r) + 2;
488 int ium(0), ivm(0), iumAll(0), ivmAll(0), kount(0), ntot(0),
nin(0);
489 std::vector<int> ntype(6,0);
491 <<
" rout " << rout <<
" N " << N
492 <<
" for maximum u, v";
494 for (
int u = -N; u <=
N; ++u) {
496 for (
int v = -N;
v <=
N; ++
v) {
502 xc[0] = xpos+
r; yc[0] = ypos+0.5*
R;
503 xc[1] = xpos; yc[1] = ypos+
R;
504 xc[2] = xpos-
r; yc[2] = ypos+0.5*
R;
505 xc[3] = xpos-
r; yc[3] = ypos-0.5*
R;
506 xc[4] = xpos; yc[4] = ypos-
R;
507 xc[5] = xpos+
r; yc[5] = ypos-0.5*
R;
508 bool cornerOne(
false), cornerAll(
true);
509 for (
int k=0;
k<6; ++
k) {
511 if (rpos >= rin && rpos <= rout) cornerOne =
true;
512 else cornerAll =
false;
519 int copy = type*1000000 + iv*100 + iu;
520 if (u < 0) copy += 10000;
521 if (v < 0) copy += 100000;
523 if (iu > ium) ium = iu;
524 if (iv > ivm) ivm = iv;
530 if (iu > iumAll) iumAll = iu;
531 if (iv > ivmAll) ivmAll = iv;
536 if (layertype > 1) type += 3;
543 <<
" number " << copy
544 <<
" positioned in " << glog.
ddname()
554 <<
":" << iumAll <<
" # of v " << ivm <<
":" 555 << ivmAll <<
" and " << nin <<
":" << kount
556 <<
":" << ntot <<
" wafers (" << ntype[0]
557 <<
":" << ntype[1] <<
":" << ntype[2] <<
":" 558 << ntype[3] <<
":" << ntype[4] <<
":" 559 << ntype[5] <<
") for " << glog.
ddname()
560 <<
" 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.
std::vector< double > zFrontB_
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 > rMinFront_
std::vector< double > rad100to200_
std::vector< double > zFrontT_
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< 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_