|
|
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];
213 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule: " << solid.
name() <<
" Tubs made of " << matName
214 <<
" of dimensions " << rinB <<
", " << routF <<
", " << 0.5 * thick_[
ii]
217 positionSensitive(glog, layerSense_[ly], rinB, routF, cpv);
225 <<
" positioned in " << module.
name() <<
" at " <<
r1 <<
" with " <<
rot;
227 zz += (0.5 * thick_[
ii]);
231 if (fabs(thickTot - layerThick_[
i]) < 0.00001) {
232 }
else if (thickTot > layerThick_[
i]) {
233 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << layerThick_[
i] <<
" is smaller than thickness "
234 << thickTot <<
" of all its components **** ERROR ****\n";
235 }
else if (thickTot < layerThick_[
i]) {
236 edm::LogWarning(
"HGCalGeom") <<
"Thickness of the partition " << layerThick_[
i] <<
" does not match with "
237 << thickTot <<
" of the components\n";
247 for (
unsigned int k = 0;
k < slopeT_.size(); ++
k) {
250 r = rMaxFront_[
k] + (z - zFront_[
k]) * slopeT_[
k];
262 double ww = (waferW_ + waferGap_);
263 double dx = 0.5 * ww;
264 double dy = 3.0 *
dx *
tan(30._deg);
265 double rr = 2.0 *
dx *
tan(30._deg);
266 int ncol = (
int)(2.0 * rout / ww) + 1;
267 int nrow = (
int)(rout / (ww *
tan(30._deg))) + 1;
268 int incm(0), inrm(0), kount(0);
271 edm::LogVerbatim(
"HGCalGeom") << glog.
ddname() <<
" rout " << rout <<
" Row " << nrow <<
" Column " << ncol;
273 for (
int nr = -nrow;
nr <= nrow; ++
nr) {
274 int inr = (
nr >= 0) ?
nr : -
nr;
275 for (
int nc = -ncol; nc <= ncol; ++nc) {
276 int inc = (nc >= 0) ? nc : -nc;
277 if (inr % 2 == inc % 2) {
278 double xpos = nc *
dx;
279 double ypos =
nr *
dy;
281 yc[0] = ypos - 0.5 *
rr;
283 yc[1] = ypos + 0.5 *
rr;
287 yc[3] = ypos + 0.5 *
rr;
289 yc[4] = ypos - 0.5 *
rr;
292 bool cornerAll(
true);
293 for (
int k = 0;
k < 6; ++
k) {
295 if (rpos < rin || rpos > rout)
299 double rpos =
std::sqrt(xpos * xpos + ypos * ypos);
316 if (copies_.count(
copy) == 0 &&
type == 1)
317 copies_.insert(
copy);
327 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule: # of columns " << incm <<
" # of rows " << inrm <<
" and " << kount
328 <<
" 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_
~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)
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()
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
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)