33 wafers_ = vsArgs[
"WaferNames"];
36 <<
"DDHGCalEEAlgo: " << wafers_.size() <<
" wafers";
37 for (
unsigned int i = 0;
i < wafers_.size(); ++
i)
40 materials_ = vsArgs[
"MaterialNames"];
41 names_ = vsArgs[
"VolumeNames"];
42 thick_ = vArgs[
"Thickness"];
43 for (
unsigned int i = 0;
i < materials_.size(); ++
i) {
44 copyNumber_.emplace_back(1);
48 <<
"DDHGCalEEAlgo: " << materials_.size() <<
" types of volumes";
49 for (
unsigned int i = 0;
i < names_.size(); ++
i)
51 <<
"Volume [" <<
i <<
"] " << names_[
i] <<
" of thickness " << thick_[
i]
52 <<
" filled with " << materials_[
i] <<
" first copy number " 56 layerThick_ = vArgs[
"LayerThick"];
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] <<
" with " 62 << 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 zMinBlock_ = nArgs[
"zMinBlock"];
95 rad100to200_ = vArgs[
"rad100to200"];
96 rad200to300_ = vArgs[
"rad200to300"];
97 zMinRadPar_ = nArgs[
"zMinForRadPar"];
98 choiceType_ = (
int)(nArgs[
"choiceType"]);
99 nCutRadPar_ = (
int)(nArgs[
"nCornerCut"]);
100 fracAreaMin_ = nArgs[
"fracAreaMin"];
101 waferSize_ = nArgs[
"waferSize"];
102 waferSepar_ = nArgs[
"SensorSeparation"];
103 sectors_ = (
int)(nArgs[
"Sectors"]);
104 alpha_ = (1._pi) / sectors_;
105 cosAlpha_ =
cos(alpha_);
108 <<
"zStart " << zMinBlock_ <<
" radius for wafer type separation uses " 109 << rad100to200_.size() <<
" parameters; zmin " << zMinRadPar_
110 <<
" cutoff " << choiceType_ <<
":" << nCutRadPar_ <<
":" << fracAreaMin_
111 <<
" wafer width " << waferSize_ <<
" separations " << waferSepar_
114 for (
unsigned int k = 0;
k < rad100to200_.size(); ++
k)
116 <<
" 200-300 " << rad200to300_[
k];
118 slopeB_ = vArgs[
"SlopeBottom"];
119 zFrontB_ = vArgs[
"ZFrontBottom"];
120 rMinFront_ = vArgs[
"RMinFront"];
121 slopeT_ = vArgs[
"SlopeTop"];
122 zFrontT_ = vArgs[
"ZFrontTop"];
123 rMaxFront_ = vArgs[
"RMaxFront"];
125 for (
unsigned int i = 0;
i < slopeB_.size(); ++
i)
127 <<
"Block [" <<
i <<
"] Zmin " << zFrontB_[
i] <<
" Rmin " 128 << rMinFront_[
i] <<
" Slope " << slopeB_[
i];
129 for (
unsigned int i = 0;
i < slopeT_.size(); ++
i)
131 <<
"Block [" <<
i <<
"] Zmin " << zFrontT_[
i] <<
" Rmax " 132 << rMaxFront_[
i] <<
" Slope " << slopeT_[
i];
139 waferType_ = std::make_unique<HGCalWaferType>(
140 rad100to200_, rad200to300_, (waferSize_ + waferSepar_), zMinRadPar_,
141 choiceType_, nCutRadPar_, fracAreaMin_);
153 constructLayers(
parent(), cpv);
156 <<
"DDHGCalEEAlgo: " << copies_.size() <<
" different wafer copy numbers";
158 for (std::unordered_set<int>::const_iterator itr = copies_.begin();
159 itr != copies_.end(); ++itr, ++
k) {
163 edm::LogVerbatim(
"HGCalGeom") <<
"<<== End of DDHGCalEEAlgo construction...";
172 double zi(zMinBlock_);
174 const double tol(0.01);
175 for (
unsigned int i = 0;
i < layers_.size();
i++) {
176 double zo = zi + layerThick_[
i];
178 int laymax = laymin + layers_[
i];
181 for (
int ly = laymin; ly < laymax; ++ly) {
182 int ii = layerType_[ly];
183 int copy = copyNumber_[
ii];
184 double hthick = 0.5 * thick_[
ii];
187 thickTot += thick_[
ii];
192 <<
"DDHGCalEEAlgo: Layer " << ly <<
":" << ii <<
" Front " << zi
193 <<
", " << routF <<
" Back " << zo <<
", " << rinB
194 <<
" superlayer thickness " << layerThick_[
i];
200 if (layerSense_[ly] < 1) {
201 std::vector<double> pgonZ, pgonRin, pgonRout;
202 if (layerSense_[ly] == 0 || absorbMode_ == 0) {
203 double rmax = routF * cosAlpha_ - tol;
204 pgonZ.emplace_back(-hthick);
205 pgonZ.emplace_back(hthick);
206 pgonRin.emplace_back(rinB);
207 pgonRin.emplace_back(rinB);
208 pgonRout.emplace_back(rmax);
209 pgonRout.emplace_back(rmax);
212 slopeB_, zFrontT_, rMaxFront_, slopeT_,
213 -layerSense_[ly], pgonZ, pgonRin, pgonRout);
214 for (
unsigned int isec=0; isec < pgonZ.size(); ++isec) {
216 pgonRout[isec] = pgonRout[isec]*cosAlpha_ - tol;
221 -alpha_, 2._pi, pgonZ, pgonRin, pgonRout);
225 <<
"DDHGCalEEAlgo: " << solid.
name() <<
" polyhedra of " << sectors_
228 <<
" sections and filled with " << matName <<
":" << &matter;
229 for (
unsigned int k = 0;
k < pgonZ.size(); ++
k)
231 <<
"[" <<
k <<
"] z " << pgonZ[
k] <<
" R " << pgonRin[
k] <<
":" 236 rinB, routF, 0.0, 2._pi);
240 <<
"DDHGCalEEAlgo: " << solid.
name() <<
" Tubs made of " << matName
241 <<
":" << &matter <<
" of dimensions " << rinB <<
", " << routF
242 <<
", " << hthick <<
", 0.0, 360.0 and position " << glog.
name()
243 <<
" number " <<
copy;
245 positionSensitive(glog, rinB, routF, zz, layerSense_[ly], cpv);
249 cpv.
position(glog, module, copy, r1, rot);
253 <<
"DDHGCalEEAlgo: " << glog.
name() <<
" number " << copy
254 <<
" positioned in " << module.
name() <<
" at " << r1 <<
" with " 261 if (
std::abs(thickTot - layerThick_[
i]) < 0.00001) {
262 }
else if (thickTot > layerThick_[i]) {
264 <<
"Thickness of the partition " << layerThick_[
i]
265 <<
" is smaller than " << thickTot <<
": thickness of all its " 266 <<
"components **** ERROR ****";
267 }
else if (thickTot < layerThick_[i]) {
269 <<
"Thickness of the partition " << layerThick_[
i]
270 <<
" does not match with " << thickTot <<
" of the components";
276 double rout,
double zpos,
int layertype,
278 static const double sqrt3 =
std::sqrt(3.0);
279 double r = 0.5 * (waferSize_ + waferSepar_);
280 double R = 2.0 * r / sqrt3;
281 double dy = 0.75 *
R;
282 int N = (
int)(0.5 * rout / r) + 2;
284 int ium(0), ivm(0), iumAll(0), ivmAll(0), kount(0), ntot(0),
nin(0);
285 std::vector<int> ntype(6, 0);
287 <<
"DDHGCalEEAlgo: " << glog.
ddname() <<
" rout " << rout <<
" N " << N
288 <<
" for maximum u, v; r " << r <<
" R " << R <<
" dy " <<
dy;
290 for (
int u = -N; u <=
N; ++u) {
292 for (
int v = -N;
v <=
N; ++
v) {
296 double xpos = nc *
r;
297 double ypos = nr *
dy;
298 std::pair<int, int>
corner =
305 <<
"DDHGCalEEAlgo: " << glog.
ddname() <<
" R " << rin <<
":" << rout
306 <<
"\n Z " << zpos <<
" LayerType " << layertype <<
" u " << u
307 <<
" v " << v <<
" with " << corner.first <<
" corners";
310 if (corner.first > 0) {
311 int type = waferType_->getType(xpos, ypos, zpos);
312 int copy = type * 1000000 + iv * 100 + iu;
313 if (u < 0) copy += 10000;
314 if (v < 0) copy += 100000;
316 if (iu > ium) ium = iu;
317 if (iv > ivm) ivm = iv;
319 if (copies_.count(copy) == 0) copies_.insert(copy);
323 if (iu > iumAll) iumAll = iu;
324 if (iv > ivmAll) ivmAll = iv;
329 if (layertype > 1) type += 3;
336 <<
" DDHGCalEEAlgo: " << name <<
" number " << copy
337 <<
" positioned in " << glog.
ddname() <<
" at " << tran
346 <<
"DDHGCalEEAlgo: Maximum # of u " << ium <<
":" << iumAll <<
" # of v " 347 << ivm <<
":" << ivmAll <<
" and " << nin <<
":" << kount <<
":" << ntot
348 <<
" wafers (" << ntype[0] <<
":" << ntype[1] <<
":" << ntype[2] <<
":" 349 << ntype[3] <<
":" << ntype[4] <<
":" << ntype[5] <<
") for " 350 << glog.
ddname() <<
" R " << rin <<
":" << rout;
void execute(DDCompactView &cpv) override
~DDHGCalEEAlgo() override
DDMaterial is used to define and access material information.
DDName is used to identify DDD entities uniquely.
constexpr NumType convertRadToDeg(NumType radians)
static std::string & ns()
Compact representation of the geometrical detector hierarchy.
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.
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)
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)
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
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)
void constructLayers(const DDLogicalPart &, DDCompactView &cpv)