|
|
Go to the documentation of this file.
5 #include <unordered_set>
40 double rMax(
double z);
72 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule info: Creating an instance";
83 wafer_ = vsArgs[
"WaferName"];
84 covers_ = vsArgs[
"CoverName"];
86 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule: " << wafer_.size() <<
" wafers";
88 for (
auto wafer : wafer_) {
92 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule: " << covers_.size() <<
" covers";
94 for (
auto cover : covers_) {
99 materials_ = vsArgs[
"MaterialNames"];
100 names_ = vsArgs[
"VolumeNames"];
101 thick_ = vArgs[
"Thickness"];
102 for (
unsigned int i = 0;
i < materials_.size(); ++
i) {
103 copyNumber_.emplace_back(1);
106 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule: " << materials_.size() <<
" types of volumes";
107 for (
unsigned int i = 0;
i < names_.size(); ++
i)
108 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << names_[
i] <<
" of thickness " << thick_[
i]
109 <<
" filled with " << materials_[
i] <<
" first copy number " << copyNumber_[
i];
112 layerThick_ = vArgs[
"LayerThick"];
114 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule: " << layers_.size() <<
" blocks";
115 for (
unsigned int i = 0;
i < layers_.size(); ++
i)
116 edm::LogVerbatim(
"HGCalGeom") <<
"Block [" <<
i <<
"] of thickness " << layerThick_[
i] <<
" with " << layers_[
i]
120 layerSense_ =
dbl_to_int(vArgs[
"LayerSense"]);
122 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule: " << layerType_.size() <<
" layers";
123 for (
unsigned int i = 0;
i < layerType_.size(); ++
i)
124 edm::LogVerbatim(
"HGCalGeom") <<
"Layer [" <<
i <<
"] with material type " << layerType_[
i] <<
" sensitive class "
127 zMinBlock_ = nArgs[
"zMinBlock"];
128 rMaxFine_ = nArgs[
"rMaxFine"];
129 waferW_ = nArgs[
"waferW"];
130 waferGap_ = nArgs[
"waferGap"];
131 absorbW_ = nArgs[
"absorberW"];
132 absorbH_ = nArgs[
"absorberH"];
133 sectors_ = (
int)(nArgs[
"Sectors"]);
135 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule: zStart " << zMinBlock_ <<
" rFineCoarse " << rMaxFine_
136 <<
" wafer width " << waferW_ <<
" gap among wafers " << waferGap_ <<
" absorber width "
137 << absorbW_ <<
" absorber height " << absorbH_ <<
" sectors " << sectors_;
139 slopeB_ = vArgs[
"SlopeBottom"];
140 slopeT_ = vArgs[
"SlopeTop"];
141 zFront_ = vArgs[
"ZFront"];
142 rMaxFront_ = vArgs[
"RMaxFront"];
144 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule: Bottom slopes " << slopeB_[0] <<
":" << slopeB_[1] <<
" and "
145 << slopeT_.size() <<
" slopes for top";
146 for (
unsigned int i = 0;
i < slopeT_.size(); ++
i)
147 edm::LogVerbatim(
"HGCalGeom") <<
"Block [" <<
i <<
"] Zmin " << zFront_[
i] <<
" Rmax " << rMaxFront_[
i] <<
" Slope "
152 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule: NameSpace " << idNameSpace_;
167 edm::LogVerbatim(
"HGCalGeom") << copies_.size() <<
" different wafer copy numbers";
171 edm::LogVerbatim(
"HGCalGeom") <<
"<<== End of DDHGCalTBModule construction ...";
179 double zi(zMinBlock_);
181 for (
unsigned int i = 0;
i < layers_.size();
i++) {
182 double zo = zi + layerThick_[
i];
183 double routF =
rMax(zi);
184 int laymax = laymin + layers_[
i];
187 for (
int ly = laymin; ly < laymax; ++ly) {
188 int ii = layerType_[ly];
189 int copy = copyNumber_[
ii];
190 double rinB = (layerSense_[ly] == 0) ? (zo * slopeB_[0]) : (zo * slopeB_[1]);
191 zz += (0.5 * thick_[
ii]);
192 thickTot += thick_[
ii];
196 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule: Layer " << ly <<
":" <<
ii <<
" Front " << zi <<
", " << routF
197 <<
" Back " << zo <<
", " << rinB <<
" superlayer thickness " << layerThick_[
i];
202 if (layerSense_[ly] == 0) {
206 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule test: " << solid.
name() <<
" box of dimension " << absorbW_
207 <<
":" << absorbH_ <<
":" << 0.5 * thick_[
ii];
214 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule: " << solid.
name() <<
" Tubs made of " << matName
215 <<
" of dimensions " << rinB <<
", " << routF <<
", " << 0.5 * thick_[
ii]
218 positionSensitive(glog, layerSense_[ly], rinB, routF, cpv);
226 <<
" positioned in " << module.
name() <<
" at " <<
r1 <<
" with " <<
rot;
228 zz += (0.5 * thick_[
ii]);
232 if (fabs(thickTot - layerThick_[
i]) < 0.00001) {
233 }
else if (thickTot > layerThick_[
i]) {
234 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << layerThick_[
i] <<
" is smaller than thickness "
235 << thickTot <<
" of all its components **** ERROR ****\n";
236 }
else if (thickTot < layerThick_[
i]) {
237 edm::LogWarning(
"HGCalGeom") <<
"Thickness of the partition " << layerThick_[
i] <<
" does not match with "
238 << thickTot <<
" of the components\n";
248 for (
unsigned int k = 0;
k < slopeT_.size(); ++
k) {
251 r = rMaxFront_[
k] + (z - zFront_[
k]) * slopeT_[
k];
263 double ww = (waferW_ + waferGap_);
264 double dx = 0.5 * ww;
265 double dy = 3.0 *
dx *
tan(30._deg);
266 double rr = 2.0 *
dx *
tan(30._deg);
267 int ncol = (
int)(2.0 * rout / ww) + 1;
268 int nrow = (
int)(rout / (ww *
tan(30._deg))) + 1;
269 int incm(0), inrm(0), kount(0);
272 edm::LogVerbatim(
"HGCalGeom") << glog.
ddname() <<
" rout " << rout <<
" Row " << nrow <<
" Column " << ncol;
274 for (
int nr = -nrow;
nr <= nrow; ++
nr) {
275 int inr = (
nr >= 0) ?
nr : -
nr;
276 for (
int nc = -ncol; nc <= ncol; ++nc) {
277 int inc = (nc >= 0) ? nc : -nc;
278 if (inr % 2 == inc % 2) {
279 double xpos = nc *
dx;
280 double ypos =
nr *
dy;
282 yc[0] = ypos - 0.5 *
rr;
284 yc[1] = ypos + 0.5 *
rr;
288 yc[3] = ypos + 0.5 *
rr;
290 yc[4] = ypos - 0.5 *
rr;
293 bool cornerAll(
true);
294 for (
int k = 0;
k < 6; ++
k) {
296 if (rpos < rin || rpos > rout)
300 double rpos =
std::sqrt(xpos * xpos + ypos * ypos);
317 if (copies_.count(
copy) == 0 &&
type == 1)
318 copies_.insert(
copy);
328 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule: # of columns " << incm <<
" # of rows " << inrm <<
" and " << kount
329 <<
" wafers for " << glog.
ddname();
std::unordered_set< int > copies_
void constructLayers(const DDLogicalPart &, DDCompactView &cpv)
void positionSensitive(DDLogicalPart &glog, int type, double rin, double rout, DDCompactView &cpv)
DDName is used to identify DDD entities uniquely.
std::vector< std::string > wafer_
std::vector< std::string > materials_
std::vector< int > layers_
U second(std::pair< T, U > const &p)
std::vector< double > layerThick_
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
~DDHGCalTBModule() override
Log< level::Warning, false > LogWarning
DDMaterial is used to define and access material information.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Compact representation of the geometrical detector hierarchy.
std::vector< int > layerSense_
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::vector< double > slopeT_
static int32_t packTypeUV(int type, int u, int v)
constexpr long double piRadians(M_PIl)
std::vector< double > slopeB_
std::vector< double > thick_
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
Tan< T >::type tan(const T &t)
std::vector< double > rMaxFront_
std::vector< int > copyNumber_
Log< level::Error, false > LogError
std::vector< std::string > names_
void constructLayers(const cms::DDNamespace &ns, const std::vector< std::string > &wafers, const std::vector< std::string > &covers, const std::vector< int > &layerType, const std::vector< int > &layerSense, const std::vector< int > &maxModule, const std::vector< std::string > &names, const std::vector< std::string > &materials, std::vector< int > ©Number, const std::vector< double > &layerThick, const double &absorbW, const double &absorbH, const double &waferTot, const double &rMax, const double &rMaxFine, std::unordered_set< int > &copies, int firstLayer, int lastLayer, double zFront, double totalWidth, bool ignoreCenter, dd4hep::Volume &module)
Log< level::Info, true > LogVerbatim
static std::string & ns()
void execute(DDCompactView &cpv) override
std::vector< std::string > covers_
std::vector< int > layerType_
A DDSolid represents the shape of a part.
Represents a uniquely identifyable rotation matrix.
static AlgebraicMatrix initialize()
static DDSolid box(const DDName &name, double xHalf, double yHalf, double zHalf)
Creates a box with side length 2*xHalf, 2*yHalf, 2*zHalf.
std::vector< double > zFront_
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string ©no, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)