|
|
Go to the documentation of this file.
28 #include <unordered_set>
47 void positionSensitive(
53 static constexpr
double tol1_ = 0.01;
54 static constexpr
double tol2_ = 0.00001;
103 wafers_ = vsArgs[
"WaferNames"];
105 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEFileAlgo: " << wafers_.size() <<
" wafers";
106 for (
unsigned int i = 0;
i < wafers_.size(); ++
i)
109 materials_ = vsArgs[
"MaterialNames"];
110 names_ = vsArgs[
"VolumeNames"];
111 thick_ = vArgs[
"Thickness"];
112 copyNumber_.resize(materials_.size(), 1);
114 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEFileAlgo: " << materials_.size() <<
" types of volumes";
115 for (
unsigned int i = 0;
i < names_.size(); ++
i)
116 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << names_[
i] <<
" of thickness " << thick_[
i]
117 <<
" filled with " << materials_[
i] <<
" first copy number " << copyNumber_[
i];
120 layerThick_ = vArgs[
"LayerThick"];
122 edm::LogVerbatim(
"HGCalGeom") <<
"There are " << layers_.size() <<
" blocks";
123 for (
unsigned int i = 0;
i < layers_.size(); ++
i)
124 edm::LogVerbatim(
"HGCalGeom") <<
"Block [" <<
i <<
"] of thickness " << layerThick_[
i] <<
" with " << layers_[
i]
128 layerSense_ =
dbl_to_int(vArgs[
"LayerSense"]);
129 firstLayer_ = (
int)(nArgs[
"FirstLayer"]);
130 absorbMode_ = (
int)(nArgs[
"AbsorberMode"]);
131 sensitiveMode_ = (
int)(nArgs[
"SensitiveMode"]);
134 <<
"Absober:Sensitive mode " << absorbMode_ <<
":" << sensitiveMode_;
136 layerCenter_ =
dbl_to_int(vArgs[
"LayerCenter"]);
138 for (
unsigned int i = 0;
i < layerCenter_.size(); ++
i)
141 if (firstLayer_ > 0) {
142 for (
unsigned int i = 0;
i < layerType_.size(); ++
i) {
143 if (layerSense_[
i] > 0) {
144 int ii = layerType_[
i];
145 copyNumber_[
ii] = firstLayer_;
147 edm::LogVerbatim(
"HGCalGeom") <<
"First copy number for layer type " <<
i <<
":" <<
ii <<
" with "
148 << 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 waferIndex_ =
dbl_to_int(vArgs[
"WaferIndex"]);
184 waferTypes_ =
dbl_to_int(vArgs[
"WaferTypes"]);
186 edm::LogVerbatim(
"HGCalGeom") <<
"waferTypes with " << waferTypes_.size() <<
" entries";
187 for (
unsigned int k = 0;
k < waferTypes_.size(); ++
k)
193 slopeB_ = vArgs[
"SlopeBottom"];
194 zFrontB_ = vArgs[
"ZFrontBottom"];
195 rMinFront_ = vArgs[
"RMinFront"];
196 slopeT_ = vArgs[
"SlopeTop"];
197 zFrontT_ = vArgs[
"ZFrontTop"];
198 rMaxFront_ = vArgs[
"RMaxFront"];
200 for (
unsigned int i = 0;
i < slopeB_.size(); ++
i)
201 edm::LogVerbatim(
"HGCalGeom") <<
"Bottom Block [" <<
i <<
"] Zmin " << zFrontB_[
i] <<
" Rmin " << rMinFront_[
i]
202 <<
" Slope " << slopeB_[
i];
203 for (
unsigned int i = 0;
i < slopeT_.size(); ++
i)
204 edm::LogVerbatim(
"HGCalGeom") <<
"Top Block [" <<
i <<
"] Zmin " << zFrontT_[
i] <<
" Rmax " << rMaxFront_[
i]
205 <<
" Slope " << slopeT_[
i];
209 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEFileAlgo: NameSpace " << nameSpace_;
224 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEFileAlgo: " << copies_.size() <<
" different wafer copy numbers";
226 for (std::unordered_set<int>::const_iterator
itr = copies_.begin();
itr != copies_.end(); ++
itr, ++
k) {
230 edm::LogVerbatim(
"HGCalGeom") <<
"<<== End of DDHGCalEEFileAlgo construction...";
238 double zi(zMinBlock_);
240 for (
unsigned int i = 0;
i < layers_.size();
i++) {
241 double zo = zi + layerThick_[
i];
243 int laymax = laymin + layers_[
i];
246 for (
int ly = laymin; ly < laymax; ++ly) {
247 int ii = layerType_[ly];
248 int copy = copyNumber_[
ii];
249 double hthick = 0.5 * thick_[
ii];
252 thickTot += thick_[
ii];
256 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEFileAlgo: Layer " << ly <<
":" <<
ii <<
" Front " << zi <<
", "
257 << routF <<
" Back " << zo <<
", " << rinB <<
" superlayer thickness "
263 if (layerSense_[ly] < 1) {
264 std::vector<double> pgonZ, pgonRin, pgonRout;
265 if (layerSense_[ly] == 0 || absorbMode_ == 0) {
266 double rmax = routF * cosAlpha_ - tol1_;
267 pgonZ.emplace_back(-hthick);
268 pgonZ.emplace_back(hthick);
269 pgonRin.emplace_back(rinB);
270 pgonRin.emplace_back(rinB);
271 pgonRout.emplace_back(rmax);
272 pgonRout.emplace_back(rmax);
287 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEFileAlgo: z " << (
zz - hthick) <<
":" << (
zz + hthick) <<
" with "
288 << pgonZ.size() <<
" palnes";
289 for (
unsigned int isec = 0; isec < pgonZ.size(); ++isec)
291 <<
"[" << isec <<
"] z " << pgonZ[isec] <<
" R " << pgonRin[isec] <<
":" << pgonRout[isec];
293 for (
unsigned int isec = 0; isec < pgonZ.size(); ++isec) {
295 pgonRout[isec] = pgonRout[isec] * cosAlpha_ - tol1_;
302 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEFileAlgo: " << solid.
name() <<
" polyhedra of " << sectors_
305 <<
" sections and filled with " << matName <<
":" << &matter;
306 for (
unsigned int k = 0;
k < pgonZ.size(); ++
k)
307 edm::LogVerbatim(
"HGCalGeom") <<
"[" <<
k <<
"] z " << pgonZ[
k] <<
" R " << pgonRin[
k] <<
":" << pgonRout[
k];
317 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEFileAlgo: " << solid.
name() <<
" Tubs made of " << matName <<
":"
318 << &matter <<
" of dimensions " << rinB <<
":" << rins <<
", " << routF <<
":"
319 << routs <<
", " << hthick <<
", 0.0, 360.0 and position " << glog.
name()
320 <<
" number " <<
copy <<
":" << layerCenter_[
copy - firstLayer_];
322 positionSensitive(glog, rins, routs,
zz, layerSense_[ly], (
copy - firstLayer_), cpv);
330 << module.
name() <<
" at " <<
r1 <<
" with " <<
rot;
337 if (
std::abs(thickTot - layerThick_[
i]) >= tol2_) {
338 if (thickTot > layerThick_[
i]) {
339 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << layerThick_[
i] <<
" is smaller than " << thickTot
340 <<
": thickness of all its components **** ERROR ****";
342 edm::LogWarning(
"HGCalGeom") <<
"Thickness of the partition " << layerThick_[
i] <<
" does not match with "
343 << thickTot <<
" of the components";
351 static const double sqrt3 =
std::sqrt(3.0);
352 int layercenter = layerCenter_[layer];
353 double r = 0.5 * (waferSize_ + waferSepar_);
354 double R = 2.0 *
r / sqrt3;
355 double dy = 0.75 *
R;
356 int N = (
int)(0.5 * rout /
r) + 2;
357 const auto& xyoff = geomTools_.shiftXY(layercenter, (waferSize_ + waferSepar_));
359 int ium(0), ivm(0), iumAll(0), ivmAll(0), kount(0), ntot(0),
nin(0);
360 std::vector<int> ntype(6, 0);
361 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEFileAlgo: " << glog.
ddname() <<
" rin:rout " << rin <<
":" << rout
362 <<
" zpos " << zpos <<
" N " <<
N <<
" for maximum u, v; r " <<
r <<
" R " <<
R
363 <<
" dy " <<
dy <<
" Shift " << xyoff.first <<
":" << xyoff.second <<
" WaferSize "
364 << (waferSize_ + waferSepar_);
366 for (
int u = -
N; u <=
N; ++u) {
367 for (
int v = -
N;
v <=
N; ++
v) {
374 double xpos = xyoff.first + nc *
r;
375 double ypos = xyoff.second +
nr *
dy;
381 <<
"\n Z " << zpos <<
" LayerType " << layertype <<
" u " << u <<
" v " <<
v
382 <<
" with " <<
corner.first <<
" corners";
391 <<
type <<
" layer:u:v:indx " << (layer + firstLayer_) <<
":" << u <<
":" <<
v
398 if (copies_.count(
copy) == 0)
399 copies_.insert(
copy);
418 <<
":" <<
type <<
" positioned in " << glog.
ddname() <<
" at " << tran
426 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalEEFileAlgo: Maximum # of u " << ium <<
":" << iumAll <<
" # of v " << ivm
427 <<
":" << ivmAll <<
" and " <<
nin <<
":" << kount <<
":" << ntot <<
" wafers ("
428 << ntype[0] <<
":" << ntype[1] <<
":" << ntype[2] <<
":" << ntype[3] <<
":" << ntype[4]
429 <<
":" << ntype[5] <<
") for " << glog.
ddname() <<
" R " << rin <<
":" << rout;
std::vector< double > zFrontT_
static int32_t waferV(const int32_t index)
std::vector< int > layerType_
DDName is used to identify DDD entities uniquely.
std::vector< std::string > wafers_
constexpr NumType convertRadToDeg(NumType radians)
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
void constructLayers(const DDLogicalPart &, DDCompactView &cpv)
static constexpr uint32_t k_CornerSize
std::vector< double > zFrontB_
U second(std::pair< T, U > const &p)
std::vector< int > layerSense_
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
std::unordered_set< int > copies_
Log< level::Warning, false > LogWarning
std::vector< int > waferIndex_
void execute(DDCompactView &cpv) override
std::vector< double > rad100to200_
std::vector< std::string > materials_
DDMaterial is used to define and access material information.
std::vector< int > copyNumber_
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)
Compact representation of the geometrical detector hierarchy.
HGCalGeomTools geomTools_
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
std::vector< int > layerCenter_
int getType(double xpos, double ypos, double zpos)
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::vector< double > slopeT_
static int32_t waferU(const int32_t index)
static int32_t packTypeUV(int type, int u, int v)
std::vector< int > waferTypes_
std::vector< double > rad200to300_
std::vector< double > rMinFront_
void positionSensitive(const DDLogicalPart &glog, double rin, double rout, double zpos, int layertype, int layer, DDCompactView &cpv)
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
std::vector< std::string > names_
std::vector< double > thick_
Log< level::Error, false > LogError
std::vector< std::pair< float, float > >::iterator itr
std::vector< double > rMaxFront_
std::vector< int > layers_
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()
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
A DDSolid represents the shape of a part.
Represents a uniquely identifyable rotation matrix.
std::vector< double > layerThick_
static AlgebraicMatrix initialize()
Abs< T >::type abs(const T &t)
static int32_t waferLayer(const int32_t index)
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)