72 moduleMaterial_ = sArgs[
"ModuleMaterial"];
73 moduleThick_ = nArgs[
"ModuleThick"];
74 sectors_ =
static_cast<int>(nArgs[
"Sectors"]);
75 position_ =
static_cast<int>(nArgs[
"Position"]);
77 dphi_ = (2._pi) / sectors_;
79 tagpos_.emplace_back(
"PN");
80 xsignpos_.emplace_back(-1);
82 tagpos_.emplace_back(
"PP");
83 xsignpos_.emplace_back(1);
85 for (
int k = 0;
k < sectors_; ++
k)
88 std::ostringstream st0, st1;
89 for (
unsigned int k = 0;
k < tagsector_.size(); ++
k)
90 st0 <<
": " << tagsector_[
k];
91 for (
unsigned int k = 0;
k < tagpos_.size(); ++
k)
92 st1 <<
" " << tagpos_[
k] <<
":" << xsignpos_[
k];
93 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalPassive: " << tagpos_.size() <<
" Modules with base name " <<
parent().name()
94 <<
" made of " << moduleMaterial_ <<
" T " << moduleThick_ <<
" having " << sectors_
95 <<
" sectors" << st0.str() <<
" phi0 " <<
convertRadToDeg(phi0_) <<
" dphi " 99 layerNames_ = vsArgs[
"LayerNames"];
100 layerMaterial_ = vsArgs[
"LayerMaterials"];
101 layerThick_ = vArgs[
"LayerThickness"];
104 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalPassive: " << layerNames_.size() <<
" types of volumes";
105 for (
unsigned int i = 0;
i < layerNames_.size(); ++
i)
106 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << layerNames_[
i] <<
" of thickness " << layerThick_[
i]
107 <<
" filled with " << layerMaterial_[
i];
108 std::ostringstream st2;
109 for (
unsigned int i = 0;
i < layerType_.size(); ++
i)
110 st2 <<
" [" <<
i <<
"] " << layerType_[
i];
111 edm::LogVerbatim(
"HGCalGeom") <<
"There are " << layerType_.size() <<
" blocks" << st2.str();
114 absNames_ = vsArgs[
"AbsorberName"];
116 absX_ = vArgs[
"AbsorberX"];
117 absY_ = vArgs[
"AbsorberY"];
119 edm::LogVerbatim(
"HGCalGeom") <<
"There are " << absNames_.size() <<
" basic absorber shapes:";
121 for (
unsigned int k = 0;
k < absNames_.size(); ++
k) {
122 std::ostringstream st3;
123 st3 << absNames_[
k] <<
" with " << absN_[
k] <<
" points:";
124 for (
int i = 0;
i < absN_[
k]; ++
i)
125 st3 <<
" (" << absX_[
j +
i] <<
", " << absY_[
j +
i] <<
")";
139 for (
unsigned int i1 = 0;
i1 < tagpos_.size(); ++
i1) {
141 for (
int i2 = 0;
i2 < sectors_; ++
i2) {
142 double phi = phi0_ +
i2 * dphi_;
147 for (
unsigned i3 = 0;
i3 < absNames_.size(); ++
i3) {
150 std::vector<double>
zw = {-0.5 * moduleThick_, 0.5 * moduleThick_};
151 std::vector<double> zx(2, 0), zy(2, 0),
scale(2, 1.0);
152 std::vector<double> xM(absN_[
i3], 0), yM(absN_[
i3], 0);
153 for (
int k = 0;
k < absN_[
i3]; ++
k) {
154 xM[
k] = xsignpos_[
i1] * (cphi * absX_[
j +
k] + sphi * absY_[
j +
k]);
155 yM[
k] = -sphi * absX_[
j +
k] + cphi * absY_[
j +
k];
163 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalPassive: " << solid.
name() <<
" extruded polygon made of " << matName
164 <<
" z|x|y|s (0) " <<
zw[0] <<
":" << zx[0] <<
":" << zy[0] <<
":" <<
scale[0]
165 <<
" z|x|y|s (1) " <<
zw[1] <<
":" << zx[1] <<
":" << zy[1] <<
":" <<
scale[1]
166 <<
" and " << xM.size() <<
" edges";
167 for (
unsigned int kk = 0;
kk < xM.size(); ++
kk)
171 std::vector<DDLogicalPart> glogs(layerMaterial_.size());
172 std::vector<int> copyNumber(layerMaterial_.size(), 1);
173 double zi(-0.5 * moduleThick_), thickTot(0.0);
174 for (
unsigned int l = 0;
l < layerType_.size();
l++) {
175 unsigned int i = layerType_[
l];
176 if (copyNumber[
i] == 1) {
177 zw[0] = -0.5 * layerThick_[
i];
178 zw[1] = 0.5 * layerThick_[
i];
186 <<
"DDHGCalPassive: Layer " <<
i <<
":" <<
l <<
":" << solid.
name() <<
" extruded polygon made of " 187 << matN <<
" z|x|y|s (0) " <<
zw[0] <<
":" << zx[0] <<
":" << zy[0] <<
":" <<
scale[0]
188 <<
" z|x|y|s (1) " <<
zw[1] <<
":" << zx[1] <<
":" << zy[1] <<
":" <<
scale[1] <<
" and " << xM.size()
190 for (
unsigned int kk = 0;
kk < xM.size(); ++
kk)
198 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalPassive: " << glogs[
i].name() <<
" number " << copyNumber[
i]
199 <<
" positioned in " << glogM.
name() <<
" at " << tran0 <<
" with no rotation";
202 zi += layerThick_[
i];
203 thickTot += layerThick_[
i];
205 if ((
std::abs(thickTot - moduleThick_) >= tol) && (!layerType_.empty())) {
206 if (thickTot > moduleThick_) {
207 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << moduleThick_ <<
" is smaller than " 208 << thickTot <<
": thickness of all its components **** ERROR ****";
210 edm::LogWarning(
"HGCalGeom") <<
"Thickness of the partition " << moduleThick_ <<
" does not match with " 211 << thickTot <<
" of the components";
Log< level::Info, true > LogVerbatim
std::vector< double > absX_
static AlgebraicMatrix initialize()
constexpr double convertDegToRad(NumType degrees)
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string ©no, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
DDMaterial is used to define and access material information.
constexpr NumType convertRadToDeg(NumType radians)
Sin< T >::type sin(const T &t)
std::vector< std::string > layerNames_
DDName is used to identify DDD entities uniquely.
Log< level::Error, false > LogError
Compact representation of the geometrical detector hierarchy.
std::vector< std::string > layerMaterial_
A DDSolid represents the shape of a part.
static std::string to_string(const XMLCh *ch)
Represents a uniquely identifyable rotation matrix.
U second(std::pair< T, U > const &p)
std::vector< int > xsignpos_
std::vector< std::string > absNames_
Cos< T >::type cos(const T &t)
std::string moduleMaterial_
Abs< T >::type abs(const T &t)
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
std::vector< double > absY_
std::vector< double > layerThick_
std::vector< int > layerType_
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
static DDSolid extrudedpolygon(const DDName &name, const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &z, const std::vector< double > &zx, const std::vector< double > &zy, const std::vector< double > &zscale)
std::vector< std::string > tagsector_
std::vector< std::string > tagpos_
auto zw(V v) -> Vec2< typename std::remove_reference< decltype(v[0])>::type >
#define DEFINE_EDM_PLUGIN(factory, type, name)
Log< level::Warning, false > LogWarning
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
void execute(DDCompactView &cpv) override