|
|
Go to the documentation of this file.
10 #include <unordered_set>
46 double rMax(
double z);
50 static constexpr
double tol_ = 0.00001;
85 wafer_ = vsArgs[
"WaferName"];
87 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo: " << wafer_.size() <<
" wafers";
88 for (
unsigned int i = 0;
i < wafer_.size(); ++
i)
91 materials_ = vsArgs[
"MaterialNames"];
92 names_ = vsArgs[
"VolumeNames"];
93 thick_ = vArgs[
"Thickness"];
94 copyNumber_.resize(materials_.size(), 1);
96 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo: " << materials_.size() <<
" types of volumes";
97 for (
unsigned int i = 0;
i < names_.size(); ++
i)
98 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << names_[
i] <<
" of thickness " << thick_[
i]
99 <<
" filled with " << materials_[
i] <<
" first copy number " << copyNumber_[
i];
102 layerThick_ = vArgs[
"LayerThick"];
104 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo: " << layers_.size() <<
" blocks";
105 for (
unsigned int i = 0;
i < layers_.size(); ++
i)
106 edm::LogVerbatim(
"HGCalGeom") <<
"Block [" <<
i <<
"] of thickness " << layerThick_[
i] <<
" with " << layers_[
i]
110 layerSense_ =
dbl_to_int(vArgs[
"LayerSense"]);
112 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo: " << layerType_.size() <<
" layers";
113 for (
unsigned int i = 0;
i < layerType_.size(); ++
i)
114 edm::LogVerbatim(
"HGCalGeom") <<
"Layer [" <<
i <<
"] with material type " << layerType_[
i] <<
" sensitive class "
117 zMinBlock_ = nArgs[
"zMinBlock"];
118 rMaxFine_ = nArgs[
"rMaxFine"];
119 waferW_ = nArgs[
"waferW"];
120 waferGap_ = nArgs[
"waferGap"];
121 sectors_ = (
int)(nArgs[
"Sectors"]);
123 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo: zStart " << zMinBlock_ <<
" rFineCoarse " << rMaxFine_
124 <<
" wafer width " << waferW_ <<
" gap among wafers " << waferGap_ <<
" sectors "
127 slopeB_ = vArgs[
"SlopeBottom"];
128 slopeT_ = vArgs[
"SlopeTop"];
129 zFront_ = vArgs[
"ZFront"];
130 rMaxFront_ = vArgs[
"RMaxFront"];
132 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo: Bottom slopes " << slopeB_[0] <<
":" << slopeB_[1] <<
" and "
133 << slopeT_.size() <<
" slopes for top";
134 for (
unsigned int i = 0;
i < slopeT_.size(); ++
i)
135 edm::LogVerbatim(
"HGCalGeom") <<
"Block [" <<
i <<
"] Zmin " << zFront_[
i] <<
" Rmax " << rMaxFront_[
i] <<
" Slope "
140 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo: NameSpace " << idNameSpace_;
155 edm::LogVerbatim(
"HGCalGeom") << copies_.size() <<
" different wafer copy numbers";
159 edm::LogVerbatim(
"HGCalGeom") <<
"<<== End of DDHGCalModuleAlgo construction";
165 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo test: \t\tInside Layers";
167 double zi(zMinBlock_);
169 const double tol(0.01);
170 for (
unsigned int i = 0;
i < layers_.size();
i++) {
171 double zo = zi + layerThick_[
i];
172 double routF =
rMax(zi);
173 int laymax = laymin + layers_[
i];
176 for (
int ly = laymin; ly < laymax; ++ly) {
177 int ii = layerType_[ly];
178 int copy = copyNumber_[
ii];
179 double rinB = (layerSense_[ly] == 0) ? (zo * slopeB_[0]) : (zo * slopeB_[1]);
180 zz += (0.5 * thick_[
ii]);
181 thickTot += thick_[
ii];
185 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo test: Layer " << ly <<
":" <<
ii <<
" Front " << zi <<
", "
186 << routF <<
" Back " << zo <<
", " << rinB <<
" superlayer thickness "
192 if (layerSense_[ly] == 0) {
194 double rmax = routF *
cos(
alpha) - tol;
195 std::vector<double> pgonZ, pgonRin, pgonRout;
196 pgonZ.emplace_back(-0.5 * thick_[
ii]);
197 pgonZ.emplace_back(0.5 * thick_[
ii]);
198 pgonRin.emplace_back(rinB);
199 pgonRin.emplace_back(rinB);
200 pgonRout.emplace_back(rmax);
201 pgonRout.emplace_back(rmax);
206 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo: " << solid.
name() <<
" polyhedra of " << sectors_
209 for (
unsigned int k = 0;
k < pgonZ.size(); ++
k)
210 edm::LogVerbatim(
"HGCalGeom") <<
"[" <<
k <<
"] z " << pgonZ[
k] <<
" R " << pgonRin[
k] <<
":" << pgonRout[
k];
217 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo: " << solid.
name() <<
" Tubs made of " << matName
218 <<
" of dimensions " << rinB <<
", " << routF <<
", " << 0.5 * thick_[
ii]
221 positionSensitive(glog, rinB, routF, cpv);
229 <<
" positioned in " << module.
name() <<
" at " <<
r1 <<
" with " <<
rot
232 zz += (0.5 * thick_[
ii]);
236 if (fabs(thickTot - layerThick_[
i]) > tol_) {
237 if (thickTot > layerThick_[
i]) {
238 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << layerThick_[
i] <<
" is smaller than thickness "
239 << thickTot <<
" of all its components **** ERROR ****\n";
241 edm::LogWarning(
"HGCalGeom") <<
"Thickness of the partition " << layerThick_[
i] <<
" does not match with "
242 << thickTot <<
" of the components\n";
253 for (
unsigned int k = 0;
k < slopeT_.size(); ++
k) {
256 r = rMaxFront_[
k] + (z - zFront_[
k]) * slopeT_[
k];
262 edm::LogVerbatim(
"HGCalGeom") <<
"rMax : " << z <<
":" << ik <<
":" <<
r << std::endl;
268 double ww = (waferW_ + waferGap_);
269 double dx = 0.5 * ww;
270 double dy = 3.0 *
dx *
tan(30._deg);
271 double rr = 2.0 *
dx *
tan(30._deg);
272 int ncol = (
int)(2.0 * rout / ww) + 1;
273 int nrow = (
int)(rout / (ww *
tan(30._deg))) + 1;
274 int incm(0), inrm(0), kount(0);
276 edm::LogVerbatim(
"HGCalGeom") << glog.
ddname() <<
" rout " << rout <<
" Row " << nrow <<
" Column " << ncol;
278 for (
int nr = -nrow;
nr <= nrow; ++
nr) {
279 int inr = (
nr >= 0) ?
nr : -
nr;
280 for (
int nc = -ncol; nc <= ncol; ++nc) {
281 int inc = (nc >= 0) ? nc : -nc;
282 if (inr % 2 == inc % 2) {
283 double xpos = nc *
dx;
284 double ypos =
nr *
dy;
287 double rpos =
std::sqrt(xpos * xpos + ypos * ypos);
299 if (copies_.count(
copy) == 0)
300 copies_.insert(
copy);
303 << glog.
ddname() <<
" at " << tran <<
" with " <<
rotation << std::endl;
310 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo: # of columns " << incm <<
" # of rows " << inrm <<
" and "
311 << kount <<
" wafers for " << glog.
ddname();
std::vector< int > layers_
std::vector< std::string > materials_
std::vector< std::string > wafer_
DDName is used to identify DDD entities uniquely.
alpha
zGenParticlesMatch = cms.InputTag(""),
constexpr NumType convertRadToDeg(NumType radians)
static constexpr uint32_t k_CornerSize
void constructLayers(const DDLogicalPart &, DDCompactView &cpv)
std::unordered_set< int > copies_
std::vector< int > layerType_
U second(std::pair< T, U > const &p)
std::vector< int > copyNumber_
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
std::vector< double > slopeB_
Log< level::Warning, false > LogWarning
void execute(DDCompactView &cpv) override
void positionSensitive(DDLogicalPart &glog, double rin, double rout, DDCompactView &cpv)
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
DDMaterial is used to define and access material information.
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< double > rMaxFront_
Compact representation of the geometrical detector hierarchy.
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
std::vector< double > layerThick_
#define DEFINE_EDM_PLUGIN(factory, type, name)
static int32_t packTypeUV(int type, int u, int v)
constexpr long double piRadians(M_PIl)
std::vector< int > layerSense_
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
Tan< T >::type tan(const T &t)
std::vector< double > zFront_
Log< level::Error, false > LogError
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()
A DDSolid represents the shape of a part.
Represents a uniquely identifyable rotation matrix.
static AlgebraicMatrix initialize()
std::vector< double > slopeT_
std::vector< double > thick_
std::vector< std::string > names_
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)