|
|
Go to the documentation of this file.
25 #include <unordered_set>
104 wafers_ = vsArgs[
"WaferNames"];
106 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEAlgo: " << wafers_.size() <<
" wafers";
107 for (
unsigned int i = 0;
i < wafers_.size(); ++
i)
110 materials_ = vsArgs[
"MaterialNames"];
111 names_ = vsArgs[
"VolumeNames"];
112 thick_ = vArgs[
"Thickness"];
113 for (
unsigned int i = 0;
i < materials_.size(); ++
i) {
114 copyNumber_.emplace_back(1);
117 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEAlgo: " << materials_.size() <<
" types of volumes";
118 for (
unsigned int i = 0;
i < names_.size(); ++
i)
119 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << names_[
i] <<
" of thickness " << thick_[
i]
120 <<
" filled with " << materials_[
i] <<
" first copy number " << copyNumber_[
i];
123 layerThick_ = vArgs[
"LayerThick"];
125 edm::LogVerbatim(
"HGCalGeom") <<
"There are " << layers_.size() <<
" blocks";
126 for (
unsigned int i = 0;
i < layers_.size(); ++
i)
127 edm::LogVerbatim(
"HGCalGeom") <<
"Block [" <<
i <<
"] of thickness " << layerThick_[
i] <<
" with " << layers_[
i]
131 layerSense_ =
dbl_to_int(vArgs[
"LayerSense"]);
132 firstLayer_ = (
int)(nArgs[
"FirstLayer"]);
133 absorbMode_ = (
int)(nArgs[
"AbsorberMode"]);
136 <<
"Absober mode " << absorbMode_;
138 layerCenter_ =
dbl_to_int(vArgs[
"LayerCenter"]);
140 for (
unsigned int i = 0;
i < layerCenter_.size(); ++
i)
143 if (firstLayer_ > 0) {
144 for (
unsigned int i = 0;
i < layerType_.size(); ++
i) {
145 if (layerSense_[
i] > 0) {
146 int ii = layerType_[
i];
147 copyNumber_[
ii] = firstLayer_;
149 edm::LogVerbatim(
"HGCalGeom") <<
"First copy number for layer type " <<
i <<
":" <<
ii <<
" with "
150 << materials_[
ii] <<
" changed to " << copyNumber_[
ii];
157 edm::LogVerbatim(
"HGCalGeom") <<
"There are " << layerType_.size() <<
" layers";
158 for (
unsigned int i = 0;
i < layerType_.size(); ++
i)
159 edm::LogVerbatim(
"HGCalGeom") <<
"Layer [" <<
i <<
"] with material type " << layerType_[
i] <<
" sensitive class "
162 zMinBlock_ = nArgs[
"zMinBlock"];
163 rad100to200_ = vArgs[
"rad100to200"];
164 rad200to300_ = vArgs[
"rad200to300"];
165 zMinRadPar_ = nArgs[
"zMinForRadPar"];
166 choiceType_ = (
int)(nArgs[
"choiceType"]);
167 nCutRadPar_ = (
int)(nArgs[
"nCornerCut"]);
168 fracAreaMin_ = nArgs[
"fracAreaMin"];
169 waferSize_ = nArgs[
"waferSize"];
170 waferSepar_ = nArgs[
"SensorSeparation"];
171 sectors_ = (
int)(nArgs[
"Sectors"]);
172 alpha_ = (1._pi) / sectors_;
173 cosAlpha_ =
cos(alpha_);
175 edm::LogVerbatim(
"HGCalGeom") <<
"zStart " << zMinBlock_ <<
" radius for wafer type separation uses "
176 << rad100to200_.size() <<
" parameters; zmin " << zMinRadPar_ <<
" cutoff "
177 << choiceType_ <<
":" << nCutRadPar_ <<
":" << fracAreaMin_ <<
" wafer width "
178 << waferSize_ <<
" separations " << waferSepar_ <<
" sectors " << sectors_ <<
":"
180 for (
unsigned int k = 0;
k < rad100to200_.size(); ++
k)
181 edm::LogVerbatim(
"HGCalGeom") <<
"[" <<
k <<
"] 100-200 " << rad100to200_[
k] <<
" 200-300 " << rad200to300_[
k];
183 slopeB_ = vArgs[
"SlopeBottom"];
184 zFrontB_ = vArgs[
"ZFrontBottom"];
185 rMinFront_ = vArgs[
"RMinFront"];
186 slopeT_ = vArgs[
"SlopeTop"];
187 zFrontT_ = vArgs[
"ZFrontTop"];
188 rMaxFront_ = vArgs[
"RMaxFront"];
190 for (
unsigned int i = 0;
i < slopeB_.size(); ++
i)
191 edm::LogVerbatim(
"HGCalGeom") <<
"Block [" <<
i <<
"] Zmin " << zFrontB_[
i] <<
" Rmin " << rMinFront_[
i]
192 <<
" Slope " << slopeB_[
i];
193 for (
unsigned int i = 0;
i < slopeT_.size(); ++
i)
194 edm::LogVerbatim(
"HGCalGeom") <<
"Block [" <<
i <<
"] Zmin " << zFrontT_[
i] <<
" Rmax " << rMaxFront_[
i]
195 <<
" Slope " << slopeT_[
i];
202 waferType_ = std::make_unique<HGCalWaferType>(
203 rad100to200_, rad200to300_, (waferSize_ + waferSepar_), zMinRadPar_, choiceType_, nCutRadPar_, fracAreaMin_);
217 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEAlgo: " << copies_.size() <<
" different wafer copy numbers";
219 for (std::unordered_set<int>::const_iterator
itr = copies_.begin();
itr != copies_.end(); ++
itr, ++
k) {
223 edm::LogVerbatim(
"HGCalGeom") <<
"<<== End of DDHGCalEEAlgo construction...";
231 double zi(zMinBlock_);
233 const double tol(0.01);
234 for (
unsigned int i = 0;
i < layers_.size();
i++) {
235 double zo = zi + layerThick_[
i];
237 int laymax = laymin + layers_[
i];
240 for (
int ly = laymin; ly < laymax; ++ly) {
241 int ii = layerType_[ly];
242 int copy = copyNumber_[
ii];
243 double hthick = 0.5 * thick_[
ii];
246 thickTot += thick_[
ii];
250 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEAlgo: Layer " << ly <<
":" <<
ii <<
" Front " << zi <<
", " << routF
251 <<
" Back " << zo <<
", " << rinB <<
" superlayer thickness " << layerThick_[
i];
256 if (layerSense_[ly] < 1) {
257 std::vector<double> pgonZ, pgonRin, pgonRout;
258 if (layerSense_[ly] == 0 || absorbMode_ == 0) {
259 double rmax = routF * cosAlpha_ - tol;
260 pgonZ.emplace_back(-hthick);
261 pgonZ.emplace_back(hthick);
262 pgonRin.emplace_back(rinB);
263 pgonRin.emplace_back(rinB);
264 pgonRout.emplace_back(rmax);
265 pgonRout.emplace_back(rmax);
280 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEAlgo: z " << (
zz - hthick) <<
":" << (
zz + hthick) <<
" with "
281 << pgonZ.size() <<
" palnes";
282 for (
unsigned int isec = 0; isec < pgonZ.size(); ++isec)
284 <<
"[" << isec <<
"] z " << pgonZ[isec] <<
" R " << pgonRin[isec] <<
":" << pgonRout[isec];
286 for (
unsigned int isec = 0; isec < pgonZ.size(); ++isec) {
288 pgonRout[isec] = pgonRout[isec] * cosAlpha_ - tol;
295 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEAlgo: " << solid.
name() <<
" polyhedra of " << sectors_
298 <<
" sections and filled with " << matName <<
":" << &matter;
299 for (
unsigned int k = 0;
k < pgonZ.size(); ++
k)
300 edm::LogVerbatim(
"HGCalGeom") <<
"[" <<
k <<
"] z " << pgonZ[
k] <<
" R " << pgonRin[
k] <<
":" << pgonRout[
k];
306 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEAlgo: " << solid.
name() <<
" Tubs made of " << matName <<
":"
307 << &matter <<
" of dimensions " << rinB <<
", " << routF <<
", " << hthick
308 <<
", 0.0, 360.0 and position " << glog.
name() <<
" number " <<
copy <<
":"
309 << layerCenter_[
copy - 1];
311 positionSensitive(glog, rinB, routF,
zz, layerSense_[ly], layerCenter_[
copy - 1], cpv);
319 <<
module.name() <<
" at " <<
r1 <<
" with " <<
rot;
325 if (
std::abs(thickTot - layerThick_[
i]) < 0.00001) {
326 }
else if (thickTot > layerThick_[
i]) {
327 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << layerThick_[
i] <<
" is smaller than " << thickTot
328 <<
": thickness of all its "
329 <<
"components **** ERROR ****";
330 }
else if (thickTot < layerThick_[
i]) {
331 edm::LogWarning(
"HGCalGeom") <<
"Thickness of the partition " << layerThick_[
i] <<
" does not match with "
332 << thickTot <<
" of the components";
344 static const double sqrt3 =
std::sqrt(3.0);
345 double r = 0.5 * (waferSize_ + waferSepar_);
346 double R = 2.0 *
r / sqrt3;
347 double dy = 0.75 *
R;
348 int N = (
int)(0.5 * rout /
r) + 2;
349 std::pair<double, double> xyoff = geomTools_.shiftXY(layercenter, (waferSize_ + waferSepar_));
351 int ium(0), ivm(0), iumAll(0), ivmAll(0), kount(0), ntot(0),
nin(0);
352 std::vector<int> ntype(6, 0);
353 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEAlgo: " << glog.
ddname() <<
" rin:rout " << rin <<
":" << rout <<
" zpos "
354 << zpos <<
" N " <<
N <<
" for maximum u, v; r " <<
r <<
" R " <<
R <<
" dy " <<
dy
355 <<
" Shift " << xyoff.first <<
":" << xyoff.second <<
" WaferSize "
356 << (waferSize_ + waferSepar_);
358 for (
int u = -
N; u <=
N; ++u) {
360 for (
int v = -
N;
v <=
N; ++
v) {
364 double xpos = xyoff.first + nc *
r;
365 double ypos = xyoff.second +
nr *
dy;
370 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEAlgo: " << glog.
ddname() <<
" R " << rin <<
":" << rout <<
"\n Z "
371 << zpos <<
" LayerType " << layertype <<
" u " << u <<
" v " <<
v <<
" with "
372 <<
corner.first <<
" corners";
376 int type = waferType_->getType(xpos, ypos, zpos);
377 int copy =
type * 1000000 + iv * 100 + iu;
388 if (copies_.count(
copy) == 0)
389 copies_.insert(
copy);
415 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEAlgo: Maximum # of u " << ium <<
":" << iumAll <<
" # of v " << ivm <<
":"
416 << ivmAll <<
" and " <<
nin <<
":" << kount <<
":" << ntot <<
" wafers (" << ntype[0]
417 <<
":" << ntype[1] <<
":" << ntype[2] <<
":" << ntype[3] <<
":" << ntype[4] <<
":"
418 << ntype[5] <<
") for " << glog.
ddname() <<
" R " << rin <<
":" << rout;
std::vector< double > layerThick_
std::vector< double > slopeT_
std::vector< int > layerCenter_
std::vector< double > rMinFront_
DDName is used to identify DDD entities uniquely.
HGCalGeomTools geomTools_
constexpr NumType convertRadToDeg(NumType radians)
static constexpr uint32_t k_CornerSize
U second(std::pair< T, U > const &p)
std::vector< int > layerType_
void constructLayers(const DDLogicalPart &, DDCompactView &cpv)
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
void positionSensitive(const DDLogicalPart &glog, double rin, double rout, double zpos, int layertype, int layercenter, DDCompactView &cpv)
std::vector< std::string > materials_
std::unique_ptr< HGCalWaferType > waferType_
std::vector< int > layers_
DDMaterial is used to define and access material information.
std::vector< double > rad200to300_
std::vector< double > thick_
Cos< T >::type cos(const T &t)
static DDSolid polyhedra(const DDName &name, int sides, double startPhi, double deltaPhi, const std::vector< double > &z, const std::vector< double > &rmin, const std::vector< double > &rmax)
Creates a polyhedra (refere to Geant3 or Geant4 documentation)
std::vector< int > copyNumber_
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)
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
std::vector< double > rad100to200_
std::vector< double > rMaxFront_
std::vector< std::pair< float, float > >::iterator itr
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
std::vector< double > slopeB_
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)
static std::string & ns()
std::vector< double > zFrontT_
std::unordered_set< int > copies_
A DDSolid represents the shape of a part.
Represents a uniquely identifyable rotation matrix.
std::vector< std::string > wafers_
static AlgebraicMatrix initialize()
Abs< T >::type abs(const T &t)
std::vector< double > zFrontB_
~DDHGCalEEAlgo() override
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)
void execute(DDCompactView &cpv) override
std::vector< std::string > names_