32 wafers_ = vsArgs[
"WaferNames"];
35 <<
"DDHGCalHEAlgo: " << wafers_.size() <<
" wafers";
36 for (
unsigned int i = 0;
i < wafers_.size(); ++
i)
39 materials_ = vsArgs[
"MaterialNames"];
40 names_ = vsArgs[
"VolumeNames"];
41 thick_ = vArgs[
"Thickness"];
42 for (
unsigned int i = 0;
i < materials_.size(); ++
i) {
43 copyNumber_.emplace_back(1);
47 <<
"DDHGCalHEAlgo: " << materials_.size() <<
" types of volumes";
48 for (
unsigned int i = 0;
i < names_.size(); ++
i)
50 <<
"Volume [" <<
i <<
"] " << names_[
i] <<
" of thickness " << thick_[
i]
51 <<
" filled with " << materials_[
i] <<
" first copy number " 55 layerThick_ = vArgs[
"LayerThick"];
56 rMixLayer_ = vArgs[
"LayerRmix"];
58 edm::LogVerbatim(
"HGCalGeom") <<
"There are " << layers_.size() <<
" blocks";
59 for (
unsigned int i = 0;
i < layers_.size(); ++
i)
61 <<
"Block [" <<
i <<
"] of thickness " << layerThick_[
i] <<
" Rmid " 62 << rMixLayer_[
i] <<
" with " << layers_[
i] <<
" layers";
66 firstLayer_ = (
int)(nArgs[
"FirstLayer"]);
67 absorbMode_ = (
int)(nArgs[
"AbsorberMode"]);
70 <<
"Absober mode " << absorbMode_;
72 if (firstLayer_ > 0) {
73 for (
unsigned int i = 0;
i < layerType_.size(); ++
i) {
74 if (layerSense_[
i] > 0) {
75 int ii = layerType_[
i];
76 copyNumber_[
ii] = firstLayer_;
79 <<
"First copy number for layer type " <<
i <<
":" << ii <<
" with " 80 << materials_[
ii] <<
" changed to " << copyNumber_[
ii];
88 <<
"There are " << layerType_.size() <<
" layers";
89 for (
unsigned int i = 0;
i < layerType_.size(); ++
i)
91 <<
"Layer [" <<
i <<
"] with material type " << layerType_[
i]
92 <<
" sensitive class " << layerSense_[
i];
94 materialsTop_ = vsArgs[
"TopMaterialNames"];
95 namesTop_ = vsArgs[
"TopVolumeNames"];
96 layerThickTop_ = vArgs[
"TopLayerThickness"];
97 layerTypeTop_ =
dbl_to_int(vArgs[
"TopLayerType"]);
98 for (
unsigned int i = 0;
i < materialsTop_.size(); ++
i) {
99 copyNumberTop_.emplace_back(1);
103 <<
" types of volumes in the top part";
104 for (
unsigned int i = 0;
i < materialsTop_.size(); ++
i)
106 <<
"Volume [" <<
i <<
"] " << namesTop_[
i] <<
" of thickness " 107 << layerThickTop_[
i] <<
" filled with " << materialsTop_[
i]
108 <<
" first copy number " << copyNumberTop_[
i];
110 <<
"There are " << layerTypeTop_.size() <<
" layers in the top part";
111 for (
unsigned int i = 0;
i < layerTypeTop_.size(); ++
i)
113 <<
"Layer [" <<
i <<
"] with material type " << layerTypeTop_[
i];
115 materialsBot_ = vsArgs[
"BottomMaterialNames"];
116 namesBot_ = vsArgs[
"BottomVolumeNames"];
117 layerTypeBot_ =
dbl_to_int(vArgs[
"BottomLayerType"]);
118 layerSenseBot_ =
dbl_to_int(vArgs[
"BottomLayerSense"]);
119 layerThickBot_ = vArgs[
"BottomLayerThickness"];
120 for (
unsigned int i = 0;
i < materialsBot_.size(); ++
i) {
121 copyNumberBot_.emplace_back(1);
125 <<
" types of volumes in the bottom part";
126 for (
unsigned int i = 0;
i < materialsBot_.size(); ++
i)
128 <<
"Volume [" <<
i <<
"] " << namesBot_[
i] <<
" of thickness " 129 << layerThickBot_[
i] <<
" filled with " << materialsBot_[
i]
130 <<
" first copy number " << copyNumberBot_[
i];
132 <<
"There are " << layerTypeBot_.size() <<
" layers in the top part";
133 for (
unsigned int i = 0;
i < layerTypeBot_.size(); ++
i)
135 <<
"Layer [" <<
i <<
"] with material type " << layerTypeBot_[
i]
136 <<
" sensitive class " << layerSenseBot_[
i];
138 zMinBlock_ = nArgs[
"zMinBlock"];
139 rad100to200_ = vArgs[
"rad100to200"];
140 rad200to300_ = vArgs[
"rad200to300"];
141 zMinRadPar_ = nArgs[
"zMinForRadPar"];
142 choiceType_ = (
int)(nArgs[
"choiceType"]);
143 nCutRadPar_ = (
int)(nArgs[
"nCornerCut"]);
144 fracAreaMin_ = nArgs[
"fracAreaMin"];
145 waferSize_ = nArgs[
"waferSize"];
146 waferSepar_ = nArgs[
"SensorSeparation"];
147 sectors_ = (
int)(nArgs[
"Sectors"]);
148 alpha_ = (1._pi) / sectors_;
149 cosAlpha_ =
cos(alpha_);
152 <<
"DDHGCalHEAlgo: zStart " << zMinBlock_
153 <<
" radius for wafer type separation uses " << rad100to200_.size()
154 <<
" parameters; zmin " << zMinRadPar_ <<
" cutoff " << choiceType_ <<
":" 155 << nCutRadPar_ <<
":" << fracAreaMin_ <<
" wafer width " << waferSize_
156 <<
" separations " << waferSepar_ <<
" sectors " << sectors_ <<
":" 158 for (
unsigned int k = 0;
k < rad100to200_.size(); ++
k)
160 <<
" 200-300 " << rad200to300_[
k];
162 slopeB_ = vArgs[
"SlopeBottom"];
163 zFrontB_ = vArgs[
"ZFrontBottom"];
164 rMinFront_ = vArgs[
"RMinFront"];
165 slopeT_ = vArgs[
"SlopeTop"];
166 zFrontT_ = vArgs[
"ZFrontTop"];
167 rMaxFront_ = vArgs[
"RMaxFront"];
169 for (
unsigned int i = 0;
i < slopeB_.size(); ++
i)
171 <<
"Block [" <<
i <<
"] Zmin " << zFrontB_[
i] <<
" Rmin " 172 << rMinFront_[
i] <<
" Slope " << slopeB_[
i];
173 for (
unsigned int i = 0;
i < slopeT_.size(); ++
i)
175 <<
"Block [" <<
i <<
"] Zmin " << zFrontT_[
i] <<
" Rmax " 176 << rMaxFront_[
i] <<
" Slope " << slopeT_[
i];
183 waferType_ = std::make_unique<HGCalWaferType>(
184 rad100to200_, rad200to300_, (waferSize_ + waferSepar_), zMinRadPar_,
185 choiceType_, nCutRadPar_, fracAreaMin_);
197 constructLayers(
parent(), cpv);
200 <<
"DDHGCalHEAlgo: " << copies_.size() <<
" different wafer copy numbers";
202 for (std::unordered_set<int>::const_iterator itr = copies_.begin();
203 itr != copies_.end(); ++itr, ++
k) {
207 edm::LogVerbatim(
"HGCalGeom") <<
"<<== End of DDHGCalHEAlgo construction...";
216 double zi(zMinBlock_);
218 const double tol(0.01);
219 for (
unsigned int i = 0;
i < layers_.size();
i++) {
220 double zo = zi + layerThick_[
i];
222 int laymax = laymin + layers_[
i];
225 for (
int ly = laymin; ly < laymax; ++ly) {
226 int ii = layerType_[ly];
227 int copy = copyNumber_[
ii];
228 double hthick = 0.5 * thick_[
ii];
231 thickTot += thick_[
ii];
236 <<
"DDHGCalHEAlgo: Layer " << ly <<
":" << ii <<
" Front " << zi
237 <<
", " << routF <<
" Back " << zo <<
", " << rinB
238 <<
" superlayer thickness " << layerThick_[
i];
244 if (layerSense_[ly] < 1) {
245 std::vector<double> pgonZ, pgonRin, pgonRout;
246 if (layerSense_[ly] == 0 || absorbMode_ == 0) {
249 rMaxFront_, slopeT_)) *
252 pgonZ.emplace_back(-hthick);
253 pgonZ.emplace_back(hthick);
254 pgonRin.emplace_back(rinB);
255 pgonRin.emplace_back(rinB);
256 pgonRout.emplace_back(rmax);
257 pgonRout.emplace_back(rmax);
260 slopeB_, zFrontT_, rMaxFront_, slopeT_,
261 -layerSense_[ly], pgonZ, pgonRin, pgonRout);
262 for (
unsigned int isec=0; isec < pgonZ.size(); ++isec) {
264 pgonRout[isec] = pgonRout[isec]*cosAlpha_ - tol;
269 -alpha_, 2._pi, pgonZ, pgonRin, pgonRout);
273 <<
"DDHGCalHEAlgo: " << solid.
name() <<
" polyhedra of " << sectors_
277 for (
unsigned int k = 0;
k < pgonZ.size(); ++
k)
279 <<
"[" <<
k <<
"] z " << pgonZ[
k] <<
" R " << pgonRin[
k] <<
":" 284 rinB, routF, 0.0, 2._pi);
288 <<
"DDHGCalHEAlgo: " << solid.
name() <<
" Tubs made of " << matName
289 <<
" of dimensions " << rinB <<
", " << routF <<
", " << hthick
290 <<
", 0.0, 360.0 and positioned in: " << glog.
name() <<
" number " 293 positionMix(glog, name, copy, thick_[ii], matter, rinB, rMixLayer_[
i],
298 cpv.
position(glog, module, copy, r1, rot);
302 <<
"DDHGCalHEAlgo: " << glog.
name() <<
" number " << copy
303 <<
" positioned in " << module.
name() <<
" at " << r1 <<
" with " 310 if (
std::abs(thickTot - layerThick_[
i]) < 0.00001) {
311 }
else if (thickTot > layerThick_[i]) {
313 <<
"Thickness of the partition " << layerThick_[
i]
314 <<
" is smaller than " << thickTot <<
": thickness of all its " 315 <<
"components **** ERROR ****";
316 }
else if (thickTot < layerThick_[i]) {
318 <<
"Thickness of the partition " << layerThick_[
i]
319 <<
" does not match with " << thickTot <<
" of the components";
327 double rin,
double rmid,
double rout,
double zz,
332 for (
unsigned int ly = 0; ly < layerTypeTop_.size(); ++ly) {
333 int ii = layerTypeTop_[ly];
334 copyNumberTop_[
ii] = copyM;
336 for (
unsigned int ly = 0; ly < layerTypeBot_.size(); ++ly) {
337 int ii = layerTypeBot_[ly];
338 copyNumberBot_[
ii] = copyM;
340 double hthick = 0.5 * thick;
348 <<
"DDHGCalHEAlgo: " << solid.
name() <<
" Tubs made of " << matter.
name()
349 <<
" of dimensions " << rmid <<
", " << rout <<
", " << hthick
352 cpv.
position(glog1, glog, 1, tran, rot);
355 <<
"DDHGCalHEAlgo: " << glog1.
name() <<
" number 1 positioned in " 356 << glog.
name() <<
" at " << tran <<
" with " <<
rot;
358 double thickTot(0), zpos(-hthick);
359 for (
unsigned int ly = 0; ly < layerTypeTop_.size(); ++ly) {
360 int ii = layerTypeTop_[ly];
361 int copy = copyNumberTop_[
ii];
362 double hthickl = 0.5 * layerThickTop_[
ii];
363 thickTot += layerThickTop_[
ii];
364 name = namesTop_[
ii] + std::to_string(copy);
367 <<
"DDHGCalHEAlgo: Layer " << ly <<
":" << ii <<
" R " << rmid <<
":" 368 << rout <<
" Thick " << layerThickTop_[
ii];
377 double eta1 = -
log(
tan(0.5 * atan(rmid / zz)));
378 double eta2 = -
log(
tan(0.5 * atan(rout / zz)));
380 << name <<
" z|rin|rout " << zz <<
":" << rmid <<
":" << rout <<
" eta " 381 << eta1 <<
":" << eta2;
383 <<
"DDHGCalHEAlgo: " << solid.
name() <<
" Tubs made of " << matName
384 <<
" of dimensions " << rmid <<
", " << rout <<
", " << hthickl
389 cpv.
position(glog2, glog1, copy, r1, rot);
392 <<
"DDHGCalHEAlgo: Position " << glog2.
name() <<
" number " << copy
393 <<
" in " << glog1.
name() <<
" at " << r1 <<
" with " <<
rot;
395 ++copyNumberTop_[
ii];
398 if (
std::abs(thickTot - thick) < 0.00001) {
399 }
else if (thickTot > thick) {
401 <<
"Thickness of the partition " << thick <<
" is smaller than " 402 << thickTot <<
": thickness of all its components in " 403 <<
"the top part **** ERROR ****";
404 }
else if (thickTot < thick) {
406 <<
"Thickness of the partition " << thick <<
" does not match with " 407 << thickTot <<
" of the components in top part";
411 name = nameM +
"Bottom";
417 <<
"DDHGCalHEAlgo: " << solid.
name() <<
" Tubs made of " << matter.
name()
418 <<
" of dimensions " << rin <<
", " << rmid <<
", " << hthick
421 cpv.
position(glog1, glog, 1, tran, rot);
424 <<
"DDHGCalHEAlgo: " << glog1.
name() <<
" number 1 positioned in " 425 << glog.
name() <<
" at " << tran <<
" with " <<
rot;
429 for (
unsigned int ly = 0; ly < layerTypeBot_.size(); ++ly) {
430 int ii = layerTypeBot_[ly];
431 int copy = copyNumberBot_[
ii];
432 double hthickl = 0.5 * layerThickBot_[
ii];
433 thickTot += layerThickBot_[
ii];
434 name = namesBot_[
ii] + std::to_string(copy);
437 <<
"DDHGCalHEAlgo: Layer " << ly <<
":" << ii <<
" R " << rin <<
":" 438 << rmid <<
" Thick " << layerThickBot_[
ii];
447 double eta1 = -
log(
tan(0.5 * atan(rin / zz)));
448 double eta2 = -
log(
tan(0.5 * atan(rmid / zz)));
450 << name <<
" z|rin|rout " << zz <<
":" << rin <<
":" << rmid <<
" eta " 451 << eta1 <<
":" << eta2;
453 <<
"DDHGCalHEAlgo: " << solid.
name() <<
" Tubs made of " << matName
454 <<
" of dimensions " << rin <<
", " << rmid <<
", " << hthickl
459 cpv.
position(glog2, glog1, copy, r1, rot);
462 <<
"DDHGCalHEAlgo: Position " << glog2.
name() <<
" number " << copy
463 <<
" in " << glog1.
name() <<
" at " << r1 <<
" with " <<
rot;
465 if (layerSenseBot_[ly] != 0)
466 positionSensitive(glog2, rin, rmid, zz + zpos, layerSenseBot_[ly], cpv);
468 ++copyNumberBot_[
ii];
470 if (
std::abs(thickTot - thick) < 0.00001) {
471 }
else if (thickTot > thick) {
473 <<
"Thickness of the partition " << thick <<
" is smaller than " 474 << thickTot <<
": thickness of all its components in " 475 <<
"the top part **** ERROR ****";
476 }
else if (thickTot < thick) {
478 <<
"Thickness of the partition " << thick <<
" does not match with " 479 << thickTot <<
" of the components in top part";
484 double rout,
double zpos,
int layertype,
486 static const double sqrt3 =
std::sqrt(3.0);
487 double r = 0.5 * (waferSize_ + waferSepar_);
488 double R = 2.0 * r / sqrt3;
489 double dy = 0.75 *
R;
490 int N = (
int)(0.5 * rout / r) + 2;
492 int ium(0), ivm(0), iumAll(0), ivmAll(0), kount(0), ntot(0),
nin(0);
493 std::vector<int> ntype(6, 0);
495 <<
"DDHGCalHEAlgo: " << glog.
ddname() <<
" rout " << rout <<
" N " << N
496 <<
" for maximum u, v";
498 for (
int u = -N; u <=
N; ++u) {
500 for (
int v = -N;
v <=
N; ++
v) {
504 double xpos = nc *
r;
505 double ypos = nr *
dy;
506 std::pair<int, int>
corner =
511 if (corner.first > 0) {
512 int type = waferType_->getType(xpos, ypos, zpos);
513 int copy = type * 1000000 + iv * 100 + iu;
514 if (u < 0) copy += 10000;
515 if (v < 0) copy += 100000;
517 if (iu > ium) ium = iu;
518 if (iv > ivm) ivm = iv;
520 if (copies_.count(copy) == 0) copies_.insert(copy);
524 if (iu > iumAll) iumAll = iu;
525 if (iv > ivmAll) ivmAll = iv;
530 if (layertype > 1) type += 3;
537 <<
"DDHGCalHEAlgo: " << name <<
" number " << copy
538 <<
" positioned in " << glog.
ddname() <<
" at " << tran
547 <<
"DDHGCalHEAlgo: Maximum # of u " << ium <<
":" << iumAll <<
" # of v " 548 << ivm <<
":" << ivmAll <<
" and " << nin <<
":" << kount <<
":" << ntot
549 <<
" wafers (" << ntype[0] <<
":" << ntype[1] <<
":" << ntype[2] <<
":" 550 << ntype[3] <<
":" << ntype[4] <<
":" << ntype[5] <<
") for " 551 << glog.
ddname() <<
" R " << rin <<
":" << rout;
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)
DDMaterial is used to define and access material information.
void execute(DDCompactView &cpv) override
DDName is used to identify DDD entities uniquely.
constexpr NumType convertRadToDeg(NumType radians)
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
static std::string & ns()
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.
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)
static uint32_t k_CornerSize
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string ©no, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
void positionSensitive(const DDLogicalPart &glog, double rin, double rout, double zpos, int layertype, DDCompactView &cpv)
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
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)