37 static constexpr
double tol1 = 0.01 * dd4hep::mm;
46 materials_ =
args.value<std::vector<std::string>>(
"MaterialNames");
52 for (
unsigned int i = 0;
i < volumeNames_.size(); ++
i)
53 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << volumeNames_[
i] <<
" of thickness "
74 <<
"Absober:Sensitive mode " << absorbMode_ <<
":" <<
sensitiveMode_;
81 if (firstLayer_ > 0) {
83 if (layerSense_[
i] > 0) {
87 edm::LogVerbatim(
"HGCalGeom") <<
"First copy number for layer type " <<
i <<
":" << ii <<
" with "
103 namesTop_ =
args.value<std::vector<std::string>>(
"TopVolumeNames");
109 <<
" types of volumes in the top part";
111 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << namesTop_[
i] <<
" of thickness "
114 edm::LogVerbatim(
"HGCalGeom") <<
"There are " << layerTypeTop_.size() <<
" layers in the top part";
115 for (
unsigned int i = 0;
i < layerTypeTop_.size(); ++
i)
116 edm::LogVerbatim(
"HGCalGeom") <<
"Layer [" <<
i <<
"] with material type " << layerTypeTop_[
i];
119 namesBot_ =
args.value<std::vector<std::string>>(
"BottomVolumeNames");
126 <<
" types of volumes in the bottom part";
128 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << namesBot_[
i] <<
" of thickness "
131 edm::LogVerbatim(
"HGCalGeom") <<
"There are " << layerTypeBot_.size() <<
" layers in the bottom part";
132 for (
unsigned int i = 0;
i < layerTypeBot_.size(); ++
i)
133 edm::LogVerbatim(
"HGCalGeom") <<
"Layer [" <<
i <<
"] with material type " << layerTypeBot_[
i]
134 <<
" sensitive class " << layerSenseBot_[
i];
140 alpha_ = (1._pi) / sectors_;
160 slopeB_ =
args.value<std::vector<double>>(
"SlopeBottom");
161 zFrontB_ =
args.value<std::vector<double>>(
"ZFrontBottom");
163 slopeT_ =
args.value<std::vector<double>>(
"SlopeTop");
164 zFrontT_ =
args.value<std::vector<double>>(
"ZFrontTop");
167 for (
unsigned int i = 0;
i <
slopeB_.size(); ++
i)
170 for (
unsigned int i = 0;
i < slopeT_.size(); ++
i)
173 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalHEFileAlgo: NameSpace " << ns.name();
181 for (
unsigned int i = 0;
i < layerNumbers_.size();
i++) {
182 double zo = zi + layerThick_[
i];
184 int laymax = laymin + layerNumbers_[
i];
187 for (
int ly = laymin; ly < laymax; ++ly) {
189 int copy = copyNumber_[
ii];
190 double hthick = 0.5 * thickness_[
ii];
193 thickTot += thickness_[
ii];
198 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalHEFileAlgo: Layer " << ly <<
":" << ii <<
" Front "
204 dd4hep::Material matter = ns.material(
materials_[ii]);
207 if (layerSense_[ly] < 1) {
208 std::vector<double> pgonZ, pgonRin, pgonRout;
223 for (
unsigned int isec = 0; isec < pgonZ.size(); ++isec) {
225 if (layerSense_[ly] == 0 || absorbMode_ == 0)
226 pgonRout[isec] = rmax;
228 pgonRout[isec] = pgonRout[isec] * cosAlpha_ - tol1;
231 dd4hep::Solid solid =
dd4hep::Polyhedra(sectors_, -alpha_, 2._pi, pgonZ, pgonRin, pgonRout);
232 ns.addSolidNS(ns.prepend(name), solid);
234 ns.addVolumeNS(glog);
236 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalHEFileAlgo: " << solid.name() <<
" polyhedra of " << sectors_
238 <<
convertRadToDeg(-alpha_ + 2._pi) <<
" with " << pgonZ.size() <<
" sections";
239 for (
unsigned int k = 0;
k < pgonZ.size(); ++
k)
248 dd4hep::Solid solid = dd4hep::Tube(rins, routs, hthick, 0.0, 2._pi);
249 ns.addSolidNS(ns.prepend(name), solid);
251 ns.addVolumeNS(glog);
254 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalHEFileAlgo: " << solid.name() <<
" Tubs made of " << matter.name()
257 <<
cms::convert2mm(hthick) <<
", 0.0, 360.0 and positioned in: " << glog.name()
258 <<
" number " <<
copy;
260 positionMix(ctxt,
e, glog, name, copy, thickness_[ii], matter, rins, rMixLayer_[
i], routs, zz);
264 mother.placeVolume(glog, copy,
r1);
267 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalHEFileAlgo: " << glog.name() <<
" number " << copy <<
" positioned in "
268 << mother.name() <<
" at (0,0," <<
cms::convert2mm(zz) <<
") with no rotation";
275 if (thickTot > layerThick_[i]) {
278 <<
": thickness of all its components **** ERROR ****";
281 <<
" does not match with " <<
cms::convert2mm(thickTot) <<
" of the components";
289 for (std::unordered_set<int>::const_iterator itr =
copies_.begin(); itr !=
copies_.end(); ++itr, ++
k) {
293 edm::LogVerbatim(
"HGCalGeom") <<
"<<== End of DDHGCalHEFileAlgo construction...";
Log< level::Info, true > LogVerbatim
std::vector< std::string > namesBot_
std::vector< int > copyNumberBot_
std::vector< std::string > materialsBot_
std::vector< double > rMinFront_
int32_t waferU(const int32_t index)
int32_t waferLayer(const int32_t index)
static constexpr double tol2_
constexpr NumType convertRadToDeg(NumType radians)
constexpr NumType convert2mm(NumType length)
std::vector< double > layerThickBot_
std::vector< int > layerTypeTop_
std::string to_string(const V &value)
std::vector< double > thickness_
Log< level::Error, false > LogError
std::vector< double > layerThickTop_
std::vector< double > slopeB_
std::vector< std::string > namesTop_
std::vector< int > copyNumber_
int32_t waferOrient(const int32_t property)
std::vector< int > copyNumberTop_
std::vector< std::string > materialsTop_
std::vector< std::string > volumeNames_
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
std::vector< double > zFrontT_
int32_t waferThick(const int32_t property)
std::unordered_set< int > copies_
std::vector< std::string > waferNames_
std::vector< int > waferProperty_
std::vector< double > slopeT_
std::vector< int > waferIndex_
std::vector< int > layerTypeBot_
std::vector< int > layerNumbers_
void positionMix(cms::DDParsingContext &ctxt, xml_h e, const dd4hep::Volume &glog, const std::string &nameM, int copyM, double thick, const dd4hep::Material &matter, double rin, double rmid, double rout, double zz)
std::vector< int > layerSense_
int32_t waferPartial(const int32_t property)
std::vector< double > rMaxFront_
std::vector< double > layerThick_
std::vector< int > layerSenseBot_
int32_t waferV(const int32_t index)
std::vector< double > zFrontB_
std::vector< int > layerCenter_
std::vector< int > layerType_
Log< level::Warning, false > LogWarning
std::vector< std::string > materials_
std::vector< double > rMixLayer_