35 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalSiliconModule: Creating an instance";
37 static constexpr
double tol1 = 0.01 * dd4hep::mm;
38 static constexpr
double tol2 = 0.00001 * dd4hep::mm;
54 <<
"Absober:Sensitive mode " << absorbMode_ <<
":" <<
sensitiveMode_;
60 alpha_ = (1._pi) / sectors_;
67 <<
" rotation matrix " <<
rotstr_;
69 waferFull_ =
args.value<std::vector<std::string>>(
"WaferNamesFull");
70 waferPart_ =
args.value<std::vector<std::string>>(
"WaferNamesPartial");
73 <<
" partial modules\nDDHGCalSiliconModule:Full Modules:";
74 unsigned int i1max =
static_cast<unsigned int>(
waferFull_.size());
75 for (
unsigned int i1 = 0; i1 < i1max; i1 += 2) {
76 std::ostringstream st1;
77 unsigned int i2 =
std::min((i1 + 2), i1max);
78 for (
unsigned int i = i1;
i < i2; ++
i)
83 i1max =
static_cast<unsigned int>(waferPart_.size());
84 for (
unsigned int i1 = 0; i1 < i1max; i1 += 2) {
85 std::ostringstream st1;
86 unsigned int i2 =
std::min((i1 + 2), i1max);
87 for (
unsigned int i = i1;
i < i2; ++
i)
88 st1 <<
" [" <<
i <<
"] " << waferPart_[
i];
92 materials_ =
args.value<std::vector<std::string>>(
"MaterialNames");
93 names_ =
args.value<std::vector<std::string>>(
"VolumeNames");
94 thick_ =
args.value<std::vector<double>>(
"Thickness");
98 for (
unsigned int i = 0;
i < names_.size(); ++
i)
99 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << names_[
i] <<
" of thickness "
107 for (
unsigned int i = 0;
i <
layers_.size(); ++
i)
109 <<
" with " <<
layers_[
i] <<
" layers";
115 for (
unsigned int i = 0;
i < layerTypes_.size(); ++
i)
120 if (layerSense_[
i] > 0) {
124 edm::LogVerbatim(
"HGCalGeom") <<
"First copy number for layer type " <<
i <<
":" << ii <<
" with "
138 slopeB_ =
args.value<std::vector<double>>(
"SlopeBottom");
139 zFrontB_ =
args.value<std::vector<double>>(
"ZFrontBottom");
141 slopeT_ =
args.value<std::vector<double>>(
"SlopeTop");
142 zFrontT_ =
args.value<std::vector<double>>(
"ZFrontTop");
145 for (
unsigned int i = 0;
i <
slopeB_.size(); ++
i)
148 for (
unsigned int i = 0;
i < slopeT_.size(); ++
i)
157 << waferLayerStart_.size() <<
" layers";
158 for (
unsigned int k = 0;
k < waferLayerStart_.size(); ++
k)
168 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalSiliconModule: NameSpace " << ns.name();
172 edm::LogVerbatim(
"HGCalGeom") <<
"==>> Constructing DDHGCalSiliconModule...";
178 for (
unsigned int i = 0;
i < layers_.size(); ++
i) {
179 double zo = zi + layerThick_[
i];
181 int laymax = laymin + layers_[
i];
184 for (
int ly = laymin; ly < laymax; ++ly) {
186 int copy = copyNumber_[
ii];
187 double hthick = 0.5 * thick_[
ii];
190 thickTot += thick_[
ii];
194 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalSiliconModule: Layer " << ly <<
":" << ii <<
" Front "
200 dd4hep::Material matter = ns.material(
materials_[ii]);
203 if (layerSense_[ly] < 1) {
204 std::vector<double> pgonZ, pgonRin, pgonRout;
218 for (
unsigned int isec = 0; isec < pgonZ.size(); ++isec) {
220 if (layerSense_[ly] == 0 || absorbMode_ == 0)
221 pgonRout[isec] = rmax;
223 pgonRout[isec] = pgonRout[isec] *
cosAlpha_ - tol1;
225 dd4hep::Solid solid =
dd4hep::Polyhedra(sectors_, -alpha_, 2._pi, pgonZ, pgonRin, pgonRout);
226 ns.addSolidNS(ns.prepend(name), solid);
228 ns.addVolumeNS(glog);
230 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalSiliconModule: " << solid.name() <<
" polyhedra of " << sectors_
233 <<
" sections and filled with " << matter.name();
234 for (
unsigned int k = 0;
k < pgonZ.size(); ++
k)
243 dd4hep::Solid solid = dd4hep::Tube(rins, routs, hthick, 0.0, 2._pi);
244 ns.addSolidNS(ns.prepend(name), solid);
246 ns.addVolumeNS(glog);
249 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalSiliconModule: " << solid.name() <<
" Tubs made of " << matter.name()
252 <<
cms::convert2mm(hthick) <<
", 0.0, 360.0 and position " << glog.name()
253 <<
" number " << copy <<
":" << layerTypes_[copy -
firstLayer_];
259 dd4hep::Rotation3D
rot;
264 rot = ns.rotation(rotstr_);
269 mother.placeVolume(glog, copy, dd4hep::Transform3D(rot,
r1));
270 int inc = ((layerSense_[ly] > 0) && (facingTypes_ > 1)) ? 2 : 1;
271 copyNumber_[
ii] = copy + inc;
273 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalSiliconModule: " << glog.name() <<
" number " << copy
274 <<
" positioned in " << mother.name() <<
" at (0,0," <<
cms::convert2mm(zz)
275 <<
") with " <<
rotName <<
" rotation";
282 if (
std::abs(thickTot - layerThick_[
i]) >= tol2) {
283 if (thickTot > layerThick_[i]) {
286 <<
": thickness of all its components **** ERROR ****";
289 <<
" does not match with " <<
cms::convert2mm(thickTot) <<
" of the components";
295 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalSiliconModule: " <<
copies_.size() <<
" different wafer copy numbers";
297 for (std::unordered_set<int>::const_iterator itr =
copies_.begin(); itr !=
copies_.end(); ++itr, ++
k) {
301 edm::LogVerbatim(
"HGCalGeom") <<
"<<== End of DDHGCalSiliconModule construction...";
Log< level::Info, true > LogVerbatim
std::unordered_set< int > copies_
std::vector< double > slopeT_
std::vector< double > slopeB_
int32_t waferU(const int32_t index)
int32_t waferLayer(const int32_t index)
std::vector< int > copyNumber_
constexpr NumType convertRadToDeg(NumType radians)
constexpr NumType convert2mm(NumType length)
std::vector< int > layerSense_
Log< level::Error, false > LogError
int32_t waferOrient(const int32_t property)
std::vector< double > zFrontT_
static const std::string & rotName(const T &rot, const cms::DDParsingContext &context)
std::vector< int > layerTypes_
std::vector< double > zFrontB_
std::vector< double > thick_
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
std::vector< std::string > names_
int32_t waferThick(const int32_t property)
std::vector< int > waferProperty_
std::vector< std::string > waferPart_
std::vector< double > rMaxFront_
std::vector< int > waferLayerStart_
std::vector< std::string > materials_
std::vector< int > layerType_
void positionSensitive(cms::DDParsingContext &ctxt, xml_h e, const dd4hep::Volume &glog, int layer)
int32_t waferPartial(const int32_t property)
int32_t waferV(const int32_t index)
std::vector< int > layers_
Log< level::Warning, false > LogWarning
std::vector< std::string > waferFull_
std::vector< double > rMinFront_
std::vector< int > waferIndex_
std::vector< double > layerThick_