|
|
Go to the documentation of this file.
26 #include <unordered_set>
59 static constexpr
double tol1_ = 0.01;
60 static constexpr
double tol2_ = 0.00001;
109 wafers_ = vsArgs[
"WaferNames"];
111 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEAlgo: " << wafers_.size() <<
" wafers";
112 for (
unsigned int i = 0;
i < wafers_.size(); ++
i)
115 materials_ = vsArgs[
"MaterialNames"];
116 names_ = vsArgs[
"VolumeNames"];
117 thick_ = vArgs[
"Thickness"];
118 copyNumber_.resize(materials_.size(), 1);
120 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEAlgo: " << materials_.size() <<
" types of volumes";
121 for (
unsigned int i = 0;
i < names_.size(); ++
i)
122 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << names_[
i] <<
" of thickness " << thick_[
i]
123 <<
" filled with " << materials_[
i] <<
" first copy number " << copyNumber_[
i];
126 layerThick_ = vArgs[
"LayerThick"];
128 edm::LogVerbatim(
"HGCalGeom") <<
"There are " << layers_.size() <<
" blocks";
129 for (
unsigned int i = 0;
i < layers_.size(); ++
i)
130 edm::LogVerbatim(
"HGCalGeom") <<
"Block [" <<
i <<
"] of thickness " << layerThick_[
i] <<
" with " << layers_[
i]
134 layerSense_ =
dbl_to_int(vArgs[
"LayerSense"]);
135 firstLayer_ = (
int)(nArgs[
"FirstLayer"]);
136 absorbMode_ = (
int)(nArgs[
"AbsorberMode"]);
137 sensitiveMode_ = (
int)(nArgs[
"SensitiveMode"]);
140 <<
"Absober:Sensitive mode " << absorbMode_ <<
":" << sensitiveMode_;
142 layerCenter_ =
dbl_to_int(vArgs[
"LayerCenter"]);
144 for (
unsigned int i = 0;
i < layerCenter_.size(); ++
i)
147 if (firstLayer_ > 0) {
148 for (
unsigned int i = 0;
i < layerType_.size(); ++
i) {
149 if (layerSense_[
i] > 0) {
150 int ii = layerType_[
i];
151 copyNumber_[
ii] = firstLayer_;
153 edm::LogVerbatim(
"HGCalGeom") <<
"First copy number for layer type " <<
i <<
":" <<
ii <<
" with "
154 << materials_[
ii] <<
" changed to " << copyNumber_[
ii];
163 edm::LogVerbatim(
"HGCalGeom") <<
"There are " << layerType_.size() <<
" layers";
164 for (
unsigned int i = 0;
i < layerType_.size(); ++
i)
165 edm::LogVerbatim(
"HGCalGeom") <<
"Layer [" <<
i <<
"] with material type " << layerType_[
i] <<
" sensitive class "
168 zMinBlock_ = nArgs[
"zMinBlock"];
169 rad100to200_ = vArgs[
"rad100to200"];
170 rad200to300_ = vArgs[
"rad200to300"];
171 zMinRadPar_ = nArgs[
"zMinForRadPar"];
172 choiceType_ = (
int)(nArgs[
"choiceType"]);
173 nCutRadPar_ = (
int)(nArgs[
"nCornerCut"]);
174 fracAreaMin_ = nArgs[
"fracAreaMin"];
175 waferSize_ = nArgs[
"waferSize"];
176 waferSepar_ = nArgs[
"SensorSeparation"];
177 sectors_ = (
int)(nArgs[
"Sectors"]);
178 alpha_ = (1._pi) / sectors_;
179 cosAlpha_ =
cos(alpha_);
181 edm::LogVerbatim(
"HGCalGeom") <<
"zStart " << zMinBlock_ <<
" radius for wafer type separation uses "
182 << rad100to200_.size() <<
" parameters; zmin " << zMinRadPar_ <<
" cutoff "
183 << choiceType_ <<
":" << nCutRadPar_ <<
":" << fracAreaMin_ <<
" wafer width "
184 << waferSize_ <<
" separations " << waferSepar_ <<
" sectors " << sectors_ <<
":"
186 for (
unsigned int k = 0;
k < rad100to200_.size(); ++
k)
187 edm::LogVerbatim(
"HGCalGeom") <<
"[" <<
k <<
"] 100-200 " << rad100to200_[
k] <<
" 200-300 " << rad200to300_[
k];
189 slopeB_ = vArgs[
"SlopeBottom"];
190 zFrontB_ = vArgs[
"ZFrontBottom"];
191 rMinFront_ = vArgs[
"RMinFront"];
192 slopeT_ = vArgs[
"SlopeTop"];
193 zFrontT_ = vArgs[
"ZFrontTop"];
194 rMaxFront_ = vArgs[
"RMaxFront"];
196 for (
unsigned int i = 0;
i < slopeB_.size(); ++
i)
197 edm::LogVerbatim(
"HGCalGeom") <<
"Block [" <<
i <<
"] Zmin " << zFrontB_[
i] <<
" Rmin " << rMinFront_[
i]
198 <<
" Slope " << slopeB_[
i];
199 for (
unsigned int i = 0;
i < slopeT_.size(); ++
i)
200 edm::LogVerbatim(
"HGCalGeom") <<
"Block [" <<
i <<
"] Zmin " << zFrontT_[
i] <<
" Rmax " << rMaxFront_[
i]
201 <<
" Slope " << slopeT_[
i];
208 waferType_ = std::make_unique<HGCalWaferType>(
209 rad100to200_, rad200to300_, (waferSize_ + waferSepar_), zMinRadPar_, choiceType_, nCutRadPar_, fracAreaMin_);
223 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEAlgo: " << copies_.size() <<
" different wafer copy numbers";
225 for (std::unordered_set<int>::const_iterator
itr = copies_.begin();
itr != copies_.end(); ++
itr, ++
k) {
229 edm::LogVerbatim(
"HGCalGeom") <<
"<<== End of DDHGCalEEAlgo construction...";
237 double zi(zMinBlock_);
239 for (
unsigned int i = 0;
i < layers_.size();
i++) {
240 double zo = zi + layerThick_[
i];
242 int laymax = laymin + layers_[
i];
245 for (
int ly = laymin; ly < laymax; ++ly) {
246 int ii = layerType_[ly];
247 int copy = copyNumber_[
ii];
248 double hthick = 0.5 * thick_[
ii];
251 thickTot += thick_[
ii];
255 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEAlgo: Layer " << ly <<
":" <<
ii <<
" Front " << zi <<
", " << routF
256 <<
" Back " << zo <<
", " << rinB <<
" superlayer thickness " << layerThick_[
i];
261 if (layerSense_[ly] < 1) {
262 std::vector<double> pgonZ, pgonRin, pgonRout;
263 if (layerSense_[ly] == 0 || absorbMode_ == 0) {
264 double rmax = routF * cosAlpha_ - tol1_;
265 pgonZ.emplace_back(-hthick);
266 pgonZ.emplace_back(hthick);
267 pgonRin.emplace_back(rinB);
268 pgonRin.emplace_back(rinB);
269 pgonRout.emplace_back(rmax);
270 pgonRout.emplace_back(rmax);
285 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEAlgo: z " << (
zz - hthick) <<
":" << (
zz + hthick) <<
" with "
286 << pgonZ.size() <<
" palnes";
287 for (
unsigned int isec = 0; isec < pgonZ.size(); ++isec)
289 <<
"[" << isec <<
"] z " << pgonZ[isec] <<
" R " << pgonRin[isec] <<
":" << pgonRout[isec];
291 for (
unsigned int isec = 0; isec < pgonZ.size(); ++isec) {
293 pgonRout[isec] = pgonRout[isec] * cosAlpha_ - tol1_;
300 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEAlgo: " << solid.
name() <<
" polyhedra of " << sectors_
303 <<
" sections and filled with " << matName <<
":" << &matter;
304 for (
unsigned int k = 0;
k < pgonZ.size(); ++
k)
305 edm::LogVerbatim(
"HGCalGeom") <<
"[" <<
k <<
"] z " << pgonZ[
k] <<
" R " << pgonRin[
k] <<
":" << pgonRout[
k];
315 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEFileAlgo: " << solid.
name() <<
" Tubs made of " << matName <<
":"
316 << &matter <<
" of dimensions " << rinB <<
":" << rins <<
", " << routF <<
":"
317 << routs <<
", " << hthick <<
", 0.0, 360.0 and position " << glog.
name()
318 <<
" number " <<
copy <<
":" << layerCenter_[
copy - firstLayer_];
320 positionSensitive(glog, rins, routs,
zz, layerSense_[ly], layerCenter_[
copy - firstLayer_], cpv);
328 << module.
name() <<
" at " <<
r1 <<
" with " <<
rot;
334 if (
std::abs(thickTot - layerThick_[
i]) >= tol2_) {
335 if (thickTot > layerThick_[
i]) {
336 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << layerThick_[
i] <<
" is smaller than " << thickTot
337 <<
": thickness of all its components **** ERROR ****";
339 edm::LogWarning(
"HGCalGeom") <<
"Thickness of the partition " << layerThick_[
i] <<
" does not match with "
340 << thickTot <<
" of the components";
353 static const double sqrt3 =
std::sqrt(3.0);
354 double r = 0.5 * (waferSize_ + waferSepar_);
355 double R = 2.0 *
r / sqrt3;
356 double dy = 0.75 *
R;
357 int N = (
int)(0.5 * rout /
r) + 2;
358 const auto& xyoff = geomTools_.shiftXY(layercenter, (waferSize_ + waferSepar_));
360 int ium(0), ivm(0), iumAll(0), ivmAll(0), kount(0), ntot(0),
nin(0);
361 std::vector<int> ntype(6, 0);
362 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEAlgo: " << glog.
ddname() <<
" rin:rout " << rin <<
":" << rout <<
" zpos "
363 << zpos <<
" N " <<
N <<
" for maximum u, v; r " <<
r <<
" R " <<
R <<
" dy " <<
dy
364 <<
" Shift " << xyoff.first <<
":" << xyoff.second <<
" WaferSize "
365 << (waferSize_ + waferSepar_);
367 for (
int u = -
N; u <=
N; ++u) {
368 for (
int v = -
N;
v <=
N; ++
v) {
371 double xpos = xyoff.first + nc *
r;
372 double ypos = xyoff.second +
nr *
dy;
379 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEAlgo: " << glog.
ddname() <<
" R " << rin <<
":" << rout <<
"\n Z "
380 << zpos <<
" LayerType " << layertype <<
" u " << u <<
" v " <<
v <<
" with "
381 <<
corner.first <<
" corners";
385 int type = waferType_->getType(xpos, ypos, zpos);
393 if (copies_.count(
copy) == 0)
394 copies_.insert(
copy);
420 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEAlgo: Maximum # of u " << ium <<
":" << iumAll <<
" # of v " << ivm <<
":"
421 << ivmAll <<
" and " <<
nin <<
":" << kount <<
":" << ntot <<
" wafers (" << ntype[0]
422 <<
":" << ntype[1] <<
":" << ntype[2] <<
":" << ntype[3] <<
":" << ntype[4] <<
":"
423 << 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.
Log< level::Warning, false > LogWarning
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)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
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_
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)
static int32_t packTypeUV(int type, int u, int v)
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
std::vector< double > rad100to200_
std::vector< double > rMaxFront_
Log< level::Error, false > LogError
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)
Log< level::Info, true > LogVerbatim
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_