37 wafer = vsArgs[
"WaferName"];
39 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModule: " << wafer.size() <<
" wafers";
40 for (
unsigned int i = 0;
i < wafer.size(); ++
i)
43 materials = vsArgs[
"MaterialNames"];
44 names = vsArgs[
"VolumeNames"];
45 thick = vArgs[
"Thickness"];
46 for (
unsigned int i = 0;
i < materials.size(); ++
i) {
47 copyNumber.emplace_back(1);
51 <<
" types of volumes";
52 for (
unsigned int i = 0;
i <
names.size(); ++
i)
54 <<
" of thickness " << thick[
i]
55 <<
" filled with " << materials[
i]
56 <<
" first copy number " << copyNumber[
i];
59 layerThick = vArgs[
"LayerThick"];
62 for (
unsigned int i = 0;
i <
layers.size(); ++
i)
64 << layerThick[
i] <<
" with " <<
layers[
i]
72 for (
unsigned int i = 0;
i < layerType.size(); ++
i)
74 << layerType[
i] <<
" sensitive class " 77 zMinBlock = nArgs[
"zMinBlock"];
78 rMaxFine = nArgs[
"rMaxFine"];
79 waferW = nArgs[
"waferW"];
80 sectors = (
int)(nArgs[
"Sectors"]);
83 <<
" rFineCoarse " << rMaxFine <<
" wafer width " 84 << waferW <<
" sectors " << sectors;
86 slopeB = vArgs[
"SlopeBottom"];
87 slopeT = vArgs[
"SlopeTop"];
88 zFront = vArgs[
"ZFront"];
89 rMaxFront = vArgs[
"RMaxFront"];
91 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModule: Bottom slopes " << slopeB[0]
92 <<
":" << slopeB[1] <<
" and " << slopeT.size()
94 for (
unsigned int i = 0;
i < slopeT.size(); ++
i)
96 <<
" Rmax " << rMaxFront[
i] <<
" Slope " 101 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModule: NameSpace " << idNameSpace;
114 constructLayers(
parent(), cpv);
116 edm::LogVerbatim(
"HGCalGeom") << copies.size() <<
" different wafer copy numbers";
118 for (std::unordered_set<int>::const_iterator itr = copies.begin();
119 itr != copies.end(); ++itr, ++
k)
124 edm::LogVerbatim(
"HGCalGeom") <<
"<<== End of DDHGCalModule construction ...";
133 double zi(zMinBlock);
135 const double tol(0.01);
136 for (
unsigned int i = 0;
i <
layers.size();
i++) {
137 double zo = zi + layerThick[
i];
138 double routF =
rMax(zi);
139 int laymax = laymin +
layers[
i];
142 for (
int ly = laymin; ly < laymax; ++ly) {
143 int ii = layerType[ly];
144 int copy = copyNumber[
ii];
145 double rinB = (layerSense[ly] == 0) ? (zo * slopeB[0]) : (zo * slopeB[1]);
146 zz += (0.5 * thick[
ii]);
147 thickTot += thick[
ii];
152 <<
" Front " << zi <<
", " << routF
153 <<
" Back " << zo <<
", " << rinB
154 <<
" superlayer thickness " << layerThick[
i];
160 if (layerSense[ly] == 0) {
162 double rmax = routF *
cos(alpha) - tol;
163 std::vector<double> pgonZ, pgonRin, pgonRout;
164 pgonZ.emplace_back(-0.5 * thick[ii]);
165 pgonZ.emplace_back(0.5 * thick[ii]);
166 pgonRin.emplace_back(rinB);
167 pgonRin.emplace_back(rinB);
168 pgonRout.emplace_back(rmax);
169 pgonRout.emplace_back(rmax);
173 pgonZ, pgonRin, pgonRout);
177 <<
" polyhedra of " << sectors
178 <<
" sectors covering " 181 <<
" with " << pgonZ.size() <<
" sections";
182 for (
unsigned int k = 0;
k < pgonZ.size(); ++
k)
184 <<
" R " << pgonRin[
k]
185 <<
":" << pgonRout[
k];
194 <<
" Tubs made of " << matName
195 <<
" of dimensions " << rinB <<
", " 196 << routF <<
", " << 0.5 * thick[
ii]
199 << glog.
name() <<
" number " <<
copy;
201 positionSensitive(glog, rinB, routF, cpv);
205 cpv.
position(glog, module, copy, r1, rot);
209 <<
" number " << copy <<
" positioned in " 210 << module.
name() <<
" at " << r1
213 zz += (0.5 * thick[
ii]);
217 if (fabs(thickTot - layerThick[
i]) < 0.00001) {
218 }
else if (thickTot > layerThick[i]) {
220 <<
"Thickness of the partition " << layerThick[
i]
221 <<
" is smaller than thickness " << thickTot
222 <<
" of all its components **** ERROR ****\n";
223 }
else if (thickTot < layerThick[i]) {
225 <<
"Thickness of the partition " << layerThick[
i]
226 <<
" does not match with " << thickTot <<
" of the components\n";
236 for (
unsigned int k = 0;
k < slopeT.size(); ++
k) {
237 if (z < zFront[
k])
break;
238 r = rMaxFront[
k] + (z - zFront[
k]) * slopeT[k];
251 double dx = 0.5 * waferW;
252 double dy = 3.0 * dx *
tan(30._deg);
253 double rr = 2.0 * dx *
tan(30._deg);
254 int ncol = (
int)(2.0 * rout / waferW) + 1;
255 int nrow = (
int)(rout / (waferW *
tan(30._deg))) + 1;
256 int incm(0), inrm(0), kount(0), ntot(0),
nin(0), nfine(0), ncoarse(0);
259 << nrow <<
" Column " <<
ncol;
261 for (
int nr = -nrow; nr <= nrow; ++nr) {
262 int inr = (nr >= 0) ? nr : -nr;
263 for (
int nc = -ncol; nc <=
ncol; ++nc) {
264 int inc = (nc >= 0) ? nc : -nc;
265 if (inr % 2 == inc % 2) {
266 double xpos = nc *
dx;
267 double ypos = nr *
dy;
268 std::pair<int, int>
corner =
271 if (corner.first > 0) {
272 int copy = inr * 100 + inc;
273 if (nc < 0) copy += 10000;
274 if (nr < 0) copy += 100000;
275 if (inc > incm) incm = inc;
276 if (inr > inrm) inrm = inr;
278 if (copies.count(copy) == 0) copies.insert(copy);
280 double rpos =
std::sqrt(xpos * xpos + ypos * ypos);
295 <<
" number " << copy
296 <<
" positioned in " << glog.
ddname()
297 <<
" at " << tran <<
" with " 307 <<
" # of rows " << inrm <<
" and " <<
nin <<
":" 308 << kount <<
":" << ntot <<
" wafers (" 309 << nfine <<
":" << ncoarse <<
") for " 310 << glog.
ddname() <<
" R " << rin <<
":" << rout;
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
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.
constexpr long double piRadians(M_PI)
const std::string names[nVars_]
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)
Tan< T >::type tan(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)
void execute(DDCompactView &cpv) override
static uint32_t k_CornerSize
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string ©no, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
void positionSensitive(DDLogicalPart &glog, double rin, double rout, DDCompactView &cpv)
~DDHGCalModule() override
void constructLayers(const DDLogicalPart &, 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)