19 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule info: Creating an instance";
30 wafer_ = vsArgs[
"WaferName"];
31 covers_ = vsArgs[
"CoverName"];
36 for (
auto wafer : wafer_) {
43 for (
auto cover : covers_) {
48 materials_ = vsArgs[
"MaterialNames"];
49 names_ = vsArgs[
"VolumeNames"];
50 thick_ = vArgs[
"Thickness"];
51 for (
unsigned int i = 0; i < materials_.size(); ++
i) {
52 copyNumber_.emplace_back(1);
56 <<
" types of volumes";
57 for (
unsigned int i = 0; i < names_.size(); ++
i)
59 <<
" of thickness " << thick_[
i]
60 <<
" filled with " << materials_[
i]
61 <<
" first copy number " << copyNumber_[
i];
64 layerThick_ = vArgs[
"LayerThick"];
68 for (
unsigned int i = 0; i < layers_.size(); ++
i)
70 << layerThick_[
i] <<
" with " << layers_[
i]
78 for (
unsigned int i = 0; i < layerType_.size(); ++
i)
80 << layerType_[
i] <<
" sensitive class " 83 zMinBlock_ = nArgs[
"zMinBlock"];
84 rMaxFine_ = nArgs[
"rMaxFine"];
85 waferW_ = nArgs[
"waferW"];
86 waferGap_ = nArgs[
"waferGap"];
87 absorbW_ = nArgs[
"absorberW"];
88 absorbH_ = nArgs[
"absorberH"];
89 sectors_ = (
int)(nArgs[
"Sectors"]);
92 <<
" rFineCoarse " << rMaxFine_ <<
" wafer width " 93 << waferW_ <<
" gap among wafers " 94 << waferGap_ <<
" absorber width " << absorbW_
95 <<
" absorber height " << absorbH_ <<
" sectors " 98 slopeB_ = vArgs[
"SlopeBottom"];
99 slopeT_ = vArgs[
"SlopeTop"];
100 zFront_ = vArgs[
"ZFront"];
101 rMaxFront_ = vArgs[
"RMaxFront"];
103 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule: Bottom slopes " << slopeB_[0]
104 <<
":" << slopeB_[1] <<
" and " << slopeT_.size()
105 <<
" slopes for top";
106 for (
unsigned int i = 0; i < slopeT_.size(); ++
i)
108 <<
" Rmax " << rMaxFront_[
i] <<
" Slope " 113 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule: NameSpace " << idNameSpace_;
126 constructLayers(
parent(), cpv);
128 edm::LogVerbatim(
"HGCalGeom") << copies_.size() <<
" different wafer copy numbers";
132 edm::LogVerbatim(
"HGCalGeom") <<
"<<== End of DDHGCalTBModule construction ...";
141 double zi(zMinBlock_);
143 for (
unsigned int i = 0;
i < layers_.size();
i++) {
144 double zo = zi + layerThick_[
i];
145 double routF =
rMax(zi);
146 int laymax = laymin + layers_[
i];
149 for (
int ly = laymin; ly < laymax; ++ly) {
150 int ii = layerType_[ly];
151 int copy = copyNumber_[
ii];
153 (layerSense_[ly] == 0) ? (zo * slopeB_[0]) : (zo * slopeB_[1]);
154 zz += (0.5 * thick_[
ii]);
155 thickTot += thick_[
ii];
160 << ii <<
" Front " << zi <<
", " << routF
161 <<
" Back " << zo <<
", " << rinB
162 <<
" superlayer thickness " << layerThick_[
i];
168 if (layerSense_[ly] == 0) {
170 DDName(name, idNameSpace_), absorbW_, absorbH_, 0.5 * thick_[ii]);
174 <<
" box of dimension " << absorbW_ <<
":" 175 << absorbH_ <<
":" << 0.5 * thick_[
ii];
184 <<
" Tubs made of " << matName
185 <<
" of dimensions " << rinB <<
", " 186 << routF <<
", " << 0.5 * thick_[
ii]
189 positionSensitive(glog, layerSense_[ly], rinB, routF, cpv);
193 cpv.
position(glog, module, copy, r1, rot);
197 <<
" number " << copy <<
" positioned in " 198 << module.
name() <<
" at " << r1
201 zz += (0.5 * thick_[
ii]);
205 if (fabs(thickTot - layerThick_[
i]) < 0.00001) {
206 }
else if (thickTot > layerThick_[i]) {
208 <<
"Thickness of the partition " << layerThick_[
i]
209 <<
" is smaller than thickness " << thickTot
210 <<
" of all its components **** ERROR ****\n";
211 }
else if (thickTot < layerThick_[i]) {
213 <<
"Thickness of the partition " << layerThick_[
i]
214 <<
" does not match with " << thickTot <<
" of the components\n";
224 for (
unsigned int k = 0;
k < slopeT_.size(); ++
k) {
225 if (z < zFront_[
k])
break;
226 r = rMaxFront_[
k] + (z - zFront_[
k]) * slopeT_[k];
238 double rin,
double rout,
240 double ww = (waferW_ + waferGap_);
241 double dx = 0.5 * ww;
242 double dy = 3.0 * dx *
tan(30._deg);
243 double rr = 2.0 * dx *
tan(30._deg);
244 int ncol = (
int)(2.0 * rout / ww) + 1;
245 int nrow = (
int)(rout / (ww *
tan(30._deg))) + 1;
246 int incm(0), inrm(0), kount(0);
250 << nrow <<
" Column " <<
ncol;
252 for (
int nr = -nrow; nr <= nrow; ++nr) {
253 int inr = (nr >= 0) ? nr : -nr;
254 for (
int nc = -ncol; nc <=
ncol; ++nc) {
255 int inc = (nc >= 0) ? nc : -nc;
256 if (inr % 2 == inc % 2) {
257 double xpos = nc *
dx;
258 double ypos = nr *
dy;
260 yc[0] = ypos - 0.5 *
rr;
262 yc[1] = ypos + 0.5 *
rr;
266 yc[3] = ypos + 0.5 *
rr;
268 yc[4] = ypos - 0.5 *
rr;
271 bool cornerAll(
true);
272 for (
int k = 0;
k < 6; ++
k) {
274 if (rpos < rin || rpos > rout) cornerAll =
false;
277 double rpos =
std::sqrt(xpos * xpos + ypos * ypos);
280 int copy = inr * 100 + inc;
281 if (nc < 0) copy += 10000;
282 if (nr < 0) copy += 100000;
294 if (inc > incm) incm = inc;
295 if (inr > inrm) inrm = inr;
297 if (copies_.count(copy) == 0 && type == 1) copies_.insert(copy);
300 <<
" number " << copy <<
" positioned in " 301 << glog.
ddname() <<
" at " << tran
310 <<
" # of rows " << inrm <<
" and " << kount
311 <<
" wafers for " << glog.
ddname();
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.
~DDHGCalTBModule() override
void positionSensitive(DDLogicalPart &glog, int type, double rin, double rout, DDCompactView &cpv)
DDName is used to identify DDD entities uniquely.
static std::string & ns()
Compact representation of the geometrical detector hierarchy.
constexpr long double piRadians(M_PI)
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.
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 DDSolid box(const DDName &name, double xHalf, double yHalf, double zHalf)
Creates a box with side length 2*xHalf, 2*yHalf, 2*zHalf.
void constructLayers(const DDLogicalPart &, DDCompactView &cpv)
void execute(DDCompactView &cpv) override
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 = ':'