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" ;
147 slopeB_ = vArgs[
"SlopeBottom"];
154 <<
" slopes for top" ;
179 <<
" different wafer copy numbers";
181 for (std::unordered_set<int>::const_iterator itr=
copies_.begin();
186 edm::LogVerbatim(
"HGCalGeom") <<
"<<== End of DDHGCalHEAlgo construction...";
198 const double tol(0.01);
199 for (
unsigned int i=0;
i<
layers_.size();
i++) {
201 double routF =
rMax(zi);
205 std::vector<double> pgonZ(2), pgonRin(2), pgonRout(2);
206 for (
int ly=laymin; ly<laymax; ++ly) {
218 << ii <<
" Front " << zi <<
", " << routF
219 <<
" Back " << zo <<
", " << rinB
220 <<
" superlayer thickness " 229 double rmax = routF*
cos(alpha) - tol;
230 pgonZ[0] =-hthick; pgonZ[1] = hthick;
231 pgonRin[0] = rinB; pgonRin[1] = rinB;
232 pgonRout[0] = rmax; pgonRout[1] = rmax;
235 pgonZ, pgonRin, pgonRout);
240 <<
" sectors covering " 241 << -alpha/CLHEP::deg <<
":" 242 << (-alpha+CLHEP::twopi)/CLHEP::deg
243 <<
" with " << pgonZ.size()<<
" sections";
244 for (
unsigned int k=0;
k<pgonZ.size(); ++
k)
246 <<
" R " << pgonRin[
k] <<
":" 251 hthick, rinB, routF, 0.0,
256 <<
" Tubs made of " << matName
257 <<
" of dimensions " << rinB
258 <<
", " << routF <<
", " << hthick
259 <<
", 0.0, " << CLHEP::twopi/CLHEP::deg;
261 <<
" number " <<
copy;
268 cpv.
position(glog, module, copy, r1, rot);
272 <<
" number " << copy
273 <<
" positioned in " << module.
name()
274 <<
" at " << r1 <<
" with " <<
rot;
280 if (fabs(thickTot-layerThick_[
i]) < 0.00001) {
281 }
else if (thickTot > layerThick_[i]) {
283 << layerThick_[
i] <<
" is smaller than " 284 << thickTot <<
": thickness of all its " 285 <<
"components **** ERROR ****";
286 }
else if (thickTot < layerThick_[i]) {
288 << layerThick_[
i] <<
" does not match with " 289 << thickTot <<
" of the components";
299 for (
unsigned int k=0;
k<
slopeT_.size(); ++
k) {
316 double rin,
double rmid,
double rout,
330 double hthick = 0.5*thick;
334 hthick, rmid, rout, 0.0,
339 <<
" Tubs made of " << matter.
name()
340 <<
" of dimensions " << rmid <<
", " << rout
341 <<
", " << hthick <<
", 0.0, " 342 << CLHEP::twopi/CLHEP::deg;
344 cpv.
position(glog1, glog, 1, tran, rot);
347 <<
" number 1 positioned in " << glog.
name()
348 <<
" at " << tran <<
" with " <<
rot;
350 double thickTot(0), zpos(-hthick);
359 <<
" R " << rmid <<
":" << rout <<
" Thick " 370 <<
" Tubs made of " << matName
371 <<
" of dimensions " << rmid <<
", " << rout
372 <<
", " << hthickl <<
", 0.0, " 373 << CLHEP::twopi/CLHEP::deg;
377 cpv.
position(glog2, glog1, copy, r1, rot);
380 <<
" number " << copy <<
" in " 381 << glog1.
name() <<
" at " << r1
387 if (fabs(thickTot-thick) < 0.00001) {
388 }
else if (thickTot > thick) {
389 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << thick
390 <<
" is smaller than " << thickTot
391 <<
": thickness of all its components in " 392 <<
"the top part **** ERROR ****";
393 }
else if (thickTot < thick) {
395 <<
" does not match with " << thickTot
396 <<
" of the components in top part";
400 name = nameM+
"Bottom";
402 hthick, rin, rmid, 0.0, CLHEP::twopi);
406 <<
" Tubs made of " << matter.
name()
407 <<
" of dimensions " << rin <<
", " << rmid
408 <<
", " << hthick <<
", 0.0, " 409 << CLHEP::twopi/CLHEP::deg;
411 cpv.
position(glog1, glog, 1, tran, rot);
414 <<
" number 1 positioned in " << glog.
name()
415 <<
" at " << tran <<
" with " <<
rot;
427 <<
" R " << rin <<
":" << rmid <<
" Thick " 438 <<
" Tubs made of " << matName
439 <<
" of dimensions " << rin <<
", " << rmid
440 <<
", " << hthickl <<
", 0.0, " 441 << CLHEP::twopi/CLHEP::deg;
445 cpv.
position(glog2, glog1, copy, r1, rot);
448 <<
" number " << copy <<
" in " 449 << glog1.
name() <<
" at " << r1
457 if (fabs(thickTot-thick) < 0.00001) {
458 }
else if (thickTot > thick) {
459 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << thick
460 <<
" is smaller than " << thickTot
461 <<
": thickness of all its components in " 462 <<
"the top part **** ERROR ****";
463 }
else if (thickTot < thick) {
465 <<
" does not match with " << thickTot
466 <<
" of the components in top part";
471 double rout,
int layertype,
473 static const double sqrt3 =
std::sqrt(3.0);
475 double R = 2.0*r/sqrt3;
477 int N = (
int)(0.5*rout/r) + 2;
480 int ium(0), ivm(0), iumAll(0), ivmAll(0), kount(0), ntot(0),
nin(0);
481 std::vector<int> ntype(6,0);
483 <<
" rout " << rout <<
" N " << N
484 <<
" for maximum u, v";
486 for (
int u = -N; u <=
N; ++u) {
488 for (
int v = -N;
v <=
N; ++
v) {
494 xc[0] = xpos+
r; yc[0] = ypos+0.5*
R;
495 xc[1] = xpos; yc[1] = ypos+
R;
496 xc[2] = xpos-
r; yc[2] = ypos+0.5*
R;
497 xc[3] = xpos-
r; yc[3] = ypos-0.5*
R;
498 xc[4] = xpos; yc[4] = ypos-
R;
499 xc[5] = xpos+
r; yc[5] = ypos-0.5*
R;
500 bool cornerOne(
false), cornerAll(
true);
501 for (
int k=0;
k<6; ++
k) {
503 if (rpos >= rin && rpos <= rout) cornerOne =
true;
504 else cornerAll =
false;
510 int copy = iv*100 + iu;
511 if (u < 0) copy += 10000;
512 if (v < 0) copy += 100000;
514 if (iu > ium) ium = iu;
515 if (iv > ivm) ivm = iv;
521 if (iu > iumAll) iumAll = iu;
522 if (iv > ivmAll) ivmAll = iv;
525 double rpos =
std::sqrt(xpos*xpos+ypos*ypos);
529 if (layertype > 1) type += 3;
536 <<
" number " << copy
537 <<
" positioned in " << glog.
ddname()
547 <<
":" << iumAll <<
" # of v " << ivm <<
":" 548 << ivmAll <<
" and " << nin <<
":" << kount
549 <<
":" << ntot <<
" wafers (" << ntype[0]
550 <<
":" << ntype[1] <<
":" << ntype[2] <<
":" 551 << ntype[3] <<
":" << ntype[4] <<
":" 552 << ntype[5] <<
") for " << glog.
ddname()
553 <<
" R " << rin <<
":" << rout;
std::vector< double > rMixLayer_
std::vector< int > layerTypeTop_
std::vector< double > layerThickBot_
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_
type of data representation of DDCompactView
~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::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)
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_
void positionMix(const DDLogicalPart &glog, const std::string &name, int copy, double thick, const DDMaterial &matter, double rin, double rmid, double routF, DDCompactView &cpv)
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, 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_