36 static constexpr
double tol1 = 0.01 * dd4hep::mm;
37 static constexpr
double tol2 = 0.00001 * dd4hep::mm;
40 wafers_ =
args.value<std::vector<std::string>>(
"WaferNames");
43 for (
unsigned int i = 0;
i <
wafers_.size(); ++
i)
46 materials_ =
args.value<std::vector<std::string>>(
"MaterialNames");
47 names_ =
args.value<std::vector<std::string>>(
"VolumeNames");
48 thick_ =
args.value<std::vector<double>>(
"Thickness");
52 for (
unsigned int i = 0;
i < names_.size(); ++
i)
53 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << names_[
i] <<
" of thickness "
61 for (
unsigned int i = 0;
i <
layers_.size(); ++
i)
63 <<
" with " <<
layers_[
i] <<
" layers";
72 <<
"Absober:Sensitive mode " << absorbMode_ <<
":" <<
sensitiveMode_;
79 if (firstLayer_ > 0) {
81 if (layerSense_[
i] > 0) {
85 edm::LogVerbatim(
"HGCalGeom") <<
"First copy number for layer type " <<
i <<
":" << ii <<
" with "
104 alpha_ = (1._pi) / sectors_;
124 slopeB_ =
args.value<std::vector<double>>(
"SlopeBottom");
125 zFrontB_ =
args.value<std::vector<double>>(
"ZFrontBottom");
127 slopeT_ =
args.value<std::vector<double>>(
"SlopeTop");
128 zFrontT_ =
args.value<std::vector<double>>(
"ZFrontTop");
131 for (
unsigned int i = 0;
i <
slopeB_.size(); ++
i)
134 for (
unsigned int i = 0;
i < slopeT_.size(); ++
i)
137 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEFileAlgo: NameSpace " << ns.name();
147 for (
unsigned int i = 0;
i < layers_.size(); ++
i) {
148 double zo = zi + layerThick_[
i];
150 int laymax = laymin + layers_[
i];
153 for (
int ly = laymin; ly < laymax; ++ly) {
155 int copy = copyNumber_[
ii];
156 double hthick = 0.5 * thick_[
ii];
159 thickTot += thick_[
ii];
163 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEFileAlgo: Layer " << ly <<
":" << ii <<
" Front "
169 dd4hep::Material matter = ns.material(
materials_[ii]);
172 if (layerSense_[ly] < 1) {
173 std::vector<double> pgonZ, pgonRin, pgonRout;
174 double rmax = routF * cosAlpha_ - tol1;
187 for (
unsigned int isec = 0; isec < pgonZ.size(); ++isec) {
189 if (layerSense_[ly] == 0 || absorbMode_ == 0)
190 pgonRout[isec] = rmax;
192 pgonRout[isec] = pgonRout[isec] * cosAlpha_ - tol1;
194 dd4hep::Solid solid =
dd4hep::Polyhedra(sectors_, -alpha_, 2._pi, pgonZ, pgonRin, pgonRout);
195 ns.addSolidNS(ns.prepend(name), solid);
197 ns.addVolumeNS(glog);
199 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEFileAlgo: " << solid.name() <<
" polyhedra of " << sectors_
202 <<
" sections and filled with " << matter.name();
203 for (
unsigned int k = 0;
k < pgonZ.size(); ++
k)
212 dd4hep::Solid solid = dd4hep::Tube(rins, routs, hthick, 0.0, 2._pi);
213 ns.addSolidNS(ns.prepend(name), solid);
215 ns.addVolumeNS(glog);
218 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEFileAlgo: " << solid.name() <<
" Tubs made of " << matter.name()
221 <<
cms::convert2mm(hthick) <<
", 0.0, 360.0 and position " << glog.name()
222 <<
" number " << copy <<
":" << layerCenter_[copy -
firstLayer_];
224 positionSensitive(ctxt,
e, glog, rins, routs, zz, layerSense_[ly], (copy - firstLayer_));
228 mother.placeVolume(glog, copy,
r1);
231 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEFileAlgo: " << glog.name() <<
" number " << copy <<
" positioned in "
232 << mother.name() <<
" at (0,0," <<
cms::convert2mm(zz) <<
") with no rotation";
239 if (
std::abs(thickTot - layerThick_[
i]) >= tol2) {
240 if (thickTot > layerThick_[i]) {
243 <<
": thickness of all its components **** ERROR ****";
246 <<
" does not match with " <<
cms::convert2mm(thickTot) <<
" of the components";
254 for (std::unordered_set<int>::const_iterator itr =
copies_.begin(); itr !=
copies_.end(); ++itr, ++
k) {
258 edm::LogVerbatim(
"HGCalGeom") <<
"<<== End of DDHGCalEEFileAlgo construction...";
Log< level::Info, true > LogVerbatim
void positionSensitive(cms::DDParsingContext &ctxt, xml_h e, const dd4hep::Volume &glog, double rin, double rout, double zpos, int layertype, int layer)
int32_t waferU(const int32_t index)
std::vector< double > thick_
std::vector< double > layerThick_
int32_t waferLayer(const int32_t index)
constexpr NumType convertRadToDeg(NumType radians)
constexpr NumType convert2mm(NumType length)
std::vector< std::string > names_
Log< level::Error, false > LogError
std::vector< int > waferProperty_
int32_t waferOrient(const int32_t property)
std::vector< double > slopeT_
std::vector< int > layerCenter_
std::vector< int > layerSense_
std::unordered_set< int > copies_
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
int32_t waferThick(const int32_t property)
std::vector< int > copyNumber_
std::vector< double > slopeB_
int32_t waferPartial(const int32_t property)
std::vector< double > zFrontT_
std::vector< int > layerType_
std::vector< int > waferIndex_
std::vector< double > rMinFront_
int32_t waferV(const int32_t index)
std::vector< double > rMaxFront_
Log< level::Warning, false > LogWarning
std::vector< double > zFrontB_
std::vector< std::string > materials_
std::vector< int > layers_
std::vector< std::string > wafers_