37 wafer = vsArgs[
"WaferName"];
41 for (
unsigned int i = 0;
i < wafer.size(); ++
i)
44 materials = vsArgs[
"MaterialNames"];
45 names = vsArgs[
"VolumeNames"];
46 thick = vArgs[
"Thickness"];
47 for (
unsigned int i = 0;
i < materials.size(); ++
i) {
48 copyNumber.emplace_back(1);
52 <<
" types of volumes";
53 for (
unsigned int i = 0;
i <
names.size(); ++
i)
55 <<
" of thickness " << thick[
i]
56 <<
" filled with " << materials[
i]
57 <<
" first copy number " << copyNumber[
i];
60 layerThick = vArgs[
"LayerThick"];
64 for (
unsigned int i = 0;
i <
layers.size(); ++
i)
66 << layerThick[
i] <<
" with " <<
layers[
i]
74 for (
unsigned int i = 0;
i < layerType.size(); ++
i)
76 << layerType[
i] <<
" sensitive class " 79 zMinBlock = nArgs[
"zMinBlock"];
80 rMaxFine = nArgs[
"rMaxFine"];
81 waferW = nArgs[
"waferW"];
82 waferGap = nArgs[
"waferGap"];
83 sectors = (
int)(nArgs[
"Sectors"]);
86 <<
" rFineCoarse " << rMaxFine <<
" wafer width " 87 << waferW <<
" gap among wafers " << waferGap
88 <<
" sectors " << sectors;
90 slopeB = vArgs[
"SlopeBottom"];
91 slopeT = vArgs[
"SlopeTop"];
92 zFront = vArgs[
"ZFront"];
93 rMaxFront = vArgs[
"RMaxFront"];
96 << slopeB[0] <<
":" << slopeB[1] <<
" and " 97 << slopeT.size() <<
" slopes for top";
98 for (
unsigned int i = 0;
i < slopeT.size(); ++
i)
100 <<
" Rmax " << rMaxFront[
i] <<
" Slope " 105 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo: NameSpace " << idNameSpace;
118 constructLayers(
parent(), cpv);
120 edm::LogVerbatim(
"HGCalGeom") << copies.size()<<
" different wafer copy numbers";
124 edm::LogVerbatim(
"HGCalGeom") <<
"<<== End of DDHGCalModuleAlgo construction";
131 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo test: \t\tInside Layers";
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 <<
":" << ii <<
" Front " << zi <<
", " 153 << routF <<
" 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 << pgonRin[
k] <<
":" << pgonRout[
k];
193 <<
" Tubs made of " << matName
194 <<
" of dimensions " << rinB <<
", " 195 << routF <<
", " << 0.5 * thick[
ii]
198 positionSensitive(glog, rinB, routF, cpv);
202 cpv.
position(glog, module, copy, r1, rot);
206 << copy <<
" positioned in " << module.
name() <<
" at " << r1
207 <<
" with " << rot << std::endl;
209 zz += (0.5 * thick[
ii]);
213 if (fabs(thickTot - layerThick[
i]) < 0.00001) {
214 }
else if (thickTot > layerThick[i]) {
216 <<
"Thickness of the partition " << layerThick[
i]
217 <<
" is smaller than thickness " << thickTot
218 <<
" of all its components **** ERROR ****\n";
219 }
else if (thickTot < layerThick[i]) {
221 <<
"Thickness of the partition " << layerThick[
i]
222 <<
" does not match with " << thickTot <<
" of the components\n";
232 for (
unsigned int k = 0;
k < slopeT.size(); ++
k) {
233 if (z < zFront[
k])
break;
234 r = rMaxFront[
k] + (z - zFront[
k]) * slopeT[k];
240 edm::LogVerbatim(
"HGCalGeom") <<
"rMax : " << z <<
":" << ik <<
":" << r << std::endl;
247 double ww = (waferW + waferGap);
248 double dx = 0.5 * ww;
249 double dy = 3.0 * dx *
tan(30._deg);
250 double rr = 2.0 * dx *
tan(30._deg);
251 int ncol = (
int)(2.0 * rout / ww) + 1;
252 int nrow = (
int)(rout / (ww *
tan(30._deg))) + 1;
253 int incm(0), inrm(0), kount(0);
256 << nrow <<
" Column " <<
ncol;
258 for (
int nr = -nrow; nr <= nrow; ++nr) {
259 int inr = (nr >= 0) ? nr : -nr;
260 for (
int nc = -ncol; nc <=
ncol; ++nc) {
261 int inc = (nc >= 0) ? nc : -nc;
262 if (inr % 2 == inc % 2) {
263 double xpos = nc *
dx;
264 double ypos = nr *
dy;
265 std::pair<int, int>
corner =
268 double rpos =
std::sqrt(xpos * xpos + ypos * ypos);
271 int copy = inr * 100 + inc;
272 if (nc < 0) copy += 10000;
273 if (nr < 0) copy += 100000;
279 if (inc > incm) incm = inc;
280 if (inr > inrm) inrm = inr;
282 if (copies.count(copy) == 0) copies.insert(copy);
284 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo: " << name <<
" number " << copy
285 <<
" positioned in " << glog.
ddname() <<
" at " << tran
286 <<
" with " << rotation << std::endl;
294 <<
" # of rows " << inrm <<
" and " << kount
295 <<
" wafers for " << glog.
ddname();
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
void positionSensitive(DDLogicalPart &glog, double rin, double rout, DDCompactView &cpv)
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) 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()
~DDHGCalModuleAlgo() override
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.
void execute(DDCompactView &cpv) override
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)
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)
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)