16 : factor_(0.5 *
sqrt(2.0)), tan30deg_(
tan(30._deg)) {
19 <<
"DDHGCalTBModuleX info: Creating instance";
30 wafer_ = vsArgs[
"WaferName"];
32 genMat_ = sArgs[
"GeneralMaterial"];
35 <<
"DDHGCalTBModuleX: Material " <<
genMat_ <<
" with " <<
wafer_.size()
38 for (
auto wafer :
wafer_) {
43 <<
"DDHGCalTBModuleX: " <<
covers_.size() <<
" covers";
51 names_ = vsArgs[
"VolumeNames"];
57 <<
"DDHGCalTBModuleX: " <<
materials_.size() <<
" types of volumes";
58 for (
unsigned int i = 0; i <
names_.size(); ++
i)
60 <<
"Volume [" << i <<
"] " <<
names_[
i] <<
" of thickness " 74 <<
"DDHGCalTBModuleX: " <<
blockThick_.size() <<
" blocks with in/out " 94 <<
"DDHGCalTBModuleX: " <<
layerType_.size() <<
" layers";
95 for (
unsigned int i = 0; i <
layerType_.size(); ++
i)
97 <<
"Layer [" << i <<
"] with material type " <<
layerType_[
i]
99 <<
" maximum row/columns";
107 rMax_ = nArgs[
"rMax"];
111 <<
"DDHGCalTBModuleX: zStart " <<
zMinBlock_ <<
" rFineCoarse " 119 <<
"DDHGCalTBModuleX: NameSpace " <<
idNameSpace_ <<
" Parent Name " 120 <<
parent().name().name();
136 <<
copies_.size() <<
" different wafer copy numbers";
140 edm::LogVerbatim(
"HGCalGeom") <<
"<<== End of DDHGCalTBModuleX construction";
155 <<
"DDHGCalTBModuleX: Block " <<
i <<
":" << name <<
" z " << zi <<
":" 156 << zo <<
" R " <<
rMaxB_ <<
" T " << blockThick_[
i];
164 double zz = zi + 0.5 * blockThick_[
i];
167 cpv.
position(glog, parent, i, r1, rot);
170 <<
"DDHGCalTBModuleX: " << glog.
name() <<
" number " << i
171 <<
" positioned in " << parent.
name() <<
" at " << r1 <<
" with " 175 blockThick_[i],
false, glog, cpv);
178 -0.5 * blockThick_[i], blockThick_[i],
true, glog, cpv);
183 <<
"DDHGCalTBModuleX: All blocks are " <<
"placed in " <<
zMinBlock_ 189 int lastLayer,
double zFront,
190 double totalWidth,
bool ignoreCenter,
195 <<
"DDHGCalTBModuleX: \t\tInside Block " << block <<
" Layers " 196 << firstLayer <<
":" << lastLayer <<
" zFront " << zFront
197 <<
" thickness " << totalWidth <<
" ignore Center " << ignoreCenter;
199 double zi(zFront), thickTot(0);
200 for (
int ly = firstLayer; ly <= lastLayer; ++ly) {
205 thickTot += layerThick_[
ii];
210 <<
"DDHGCalTBModuleX: " << name <<
" Layer " << ly <<
":" << ii
211 <<
" Z " << zi <<
":" << zo <<
" Thick " << layerThick_[
ii]
218 if (layerSense_[ly] == 0) {
224 <<
"DDHGCalTBModuleX: " << solid.
name() <<
" box of dimension " 229 cpv.
position(glog, module, copy, r1, rot);
232 <<
"DDHGCalTBModuleX: " << glog.
name() <<
" number " << copy
233 <<
" positioned in " << module.
name() <<
" at " << r1 <<
" with " 236 }
else if (layerSense_[ly] > 0) {
238 ignoreCenter, name, matter, module, cpv);
244 if (fabs(thickTot - totalWidth) <
tolerance_) {
245 }
else if (thickTot > totalWidth) {
247 <<
"Thickness of the partition " << totalWidth <<
" is smaller than " 248 << thickTot <<
": total thickness of all its components in " 249 << module.
name() <<
" Layers " << firstLayer <<
":" << lastLayer <<
":" 250 << ignoreCenter <<
"**** ERROR ****";
251 }
else if (thickTot < totalWidth) {
253 <<
"Thickness of the partition " << totalWidth <<
" does not match with " 254 << thickTot <<
" of the components in " << module.
name() <<
" Layers " 255 << firstLayer <<
":" << lastLayer <<
":" << ignoreCenter;
260 double zpos,
int copyIn,
int type,
double rout,
int ncrMax,
264 double dx = 0.5 * ww;
267 int ncol = (
int)(2.0 * rout / ww) + 1;
268 int nrow = (
int)(rout / (ww * tan30deg_)) + 1;
270 int incm(0), inrm(0);
272 << glog.
ddname() <<
" Copy " << copyIn <<
" Type " << type <<
" rout " 273 << rout <<
" Row " << nrow <<
" column " << ncol <<
" ncrMax " << ncrMax
274 <<
" Z " << zpos <<
" Center " << ignoreCenter <<
" name " << nameIn
275 <<
" matter " << matter.
name();
282 for (
int nr = -nrow; nr <= nrow; ++nr) {
284 for (
int nc = -ncol; nc <=
ncol; ++nc) {
286 if ((inr % 2 == inc % 2) && (!ignoreCenter || nc != 0 || nr != 0)) {
287 double xpos = nc *
dx;
288 double ypos = nr *
dy;
291 yc[0] = ypos - 0.5 *
rr;
293 yc[1] = ypos + 0.5 *
rr;
297 yc[3] = ypos + 0.5 *
rr;
299 yc[4] = ypos - 0.5 *
rr;
302 bool cornerAll(
true);
303 for (
int k = 0;
k < 6; ++
k) {
305 if (rpos > rout) cornerAll =
false;
308 double rpos =
std::sqrt(xpos * xpos + ypos * ypos);
311 int copy = inr * 100 + inc;
312 if (nc < 0) copy += 10000;
313 if (nr < 0) copy += 100000;
318 std::string name0 = nameIn +
"M" + std::to_string(copy);
324 <<
"DDHGCalTBModuleX: " << glog1.
ddname() <<
" number " 325 << copyIn <<
" positioned in " << glog.
ddname() <<
" at " 336 <<
"DDHGCalTBModuleX: " << name <<
" number " << copy
337 <<
" positioned in " << glog1.
ddname() <<
" at " << tran1
344 copy += copyIn * 1000000;
348 <<
"DDHGCalTBModuleX: " << name <<
" number " << copy
349 <<
" positioned in " << glog.
ddname() <<
" at " << tran
354 if (inc > incm) incm = inc;
355 if (inr > inrm) inrm = inr;
364 <<
"DDHGCalTBModuleX: # of columns " << incm <<
" # of rows " << inrm
365 <<
" and " << kount <<
" wafers for " << glog.
ddname();
std::vector< std::string > wafer_
std::vector< int > layerFrontOut_
DDMaterial is used to define and access material information.
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
std::vector< std::string > names_
std::vector< std::string > materials_
DDName is used to identify DDD entities uniquely.
std::vector< int > layerFrontIn_
static std::string & ns()
std::unordered_set< int > copies_
std::vector< int > layerBackIn_
void constructLayers(int block, int layerFront, int layerBack, double zFront, double thick, bool ignore, const DDLogicalPart &, DDCompactView &)
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)
void constructBlocks(const DDLogicalPart &, DDCompactView &cpv)
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
std::vector< double > blockThick_
std::vector< int > layerType_
std::vector< std::string > covers_
std::vector< int > layerSense_
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)
std::vector< int > copyNumber_
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 execute(DDCompactView &cpv) override
std::vector< int > layerBackOut_
~DDHGCalTBModuleX() override
void positionSensitive(double zpos, int copyIn, int type, double rmax, int ncrMax, bool ignoreCenter, const std::string &, const DDMaterial &, const DDLogicalPart &, DDCompactView &cpv)
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string ©no, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
std::vector< int > maxModule_
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
const std::string & name() const
Returns the name.
std::vector< double > layerThick_