|
|
Go to the documentation of this file.
10 #include <unordered_set>
46 double rMax(
double z);
86 wafer = vsArgs[
"WaferName"];
88 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo: " << wafer.size() <<
" wafers";
89 for (
unsigned int i = 0;
i < wafer.size(); ++
i)
92 materials = vsArgs[
"MaterialNames"];
93 names = vsArgs[
"VolumeNames"];
94 thick = vArgs[
"Thickness"];
95 for (
unsigned int i = 0;
i < materials.size(); ++
i) {
96 copyNumber.emplace_back(1);
99 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo: " << materials.size() <<
" types of volumes";
100 for (
unsigned int i = 0;
i <
names.size(); ++
i)
102 <<
" filled with " << materials[
i] <<
" first copy number " << copyNumber[
i];
105 layerThick = vArgs[
"LayerThick"];
108 for (
unsigned int i = 0;
i <
layers.size(); ++
i)
115 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo: " << layerType.size() <<
" layers";
116 for (
unsigned int i = 0;
i < layerType.size(); ++
i)
117 edm::LogVerbatim(
"HGCalGeom") <<
"Layer [" <<
i <<
"] with material type " << layerType[
i] <<
" sensitive class "
120 zMinBlock = nArgs[
"zMinBlock"];
121 rMaxFine = nArgs[
"rMaxFine"];
122 waferW = nArgs[
"waferW"];
123 waferGap = nArgs[
"waferGap"];
126 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo: zStart " << zMinBlock <<
" rFineCoarse " << rMaxFine
127 <<
" wafer width " << waferW <<
" gap among wafers " << waferGap <<
" sectors "
130 slopeB = vArgs[
"SlopeBottom"];
131 slopeT = vArgs[
"SlopeTop"];
132 zFront = vArgs[
"ZFront"];
133 rMaxFront = vArgs[
"RMaxFront"];
135 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo: Bottom slopes " << slopeB[0] <<
":" << slopeB[1] <<
" and "
136 << slopeT.size() <<
" slopes for top";
137 for (
unsigned int i = 0;
i < slopeT.size(); ++
i)
138 edm::LogVerbatim(
"HGCalGeom") <<
"Block [" <<
i <<
"] Zmin " << zFront[
i] <<
" Rmax " << rMaxFront[
i] <<
" Slope "
143 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo: NameSpace " << idNameSpace;
158 edm::LogVerbatim(
"HGCalGeom") << copies.size() <<
" different wafer copy numbers";
162 edm::LogVerbatim(
"HGCalGeom") <<
"<<== End of DDHGCalModuleAlgo construction";
168 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo test: \t\tInside Layers";
170 double zi(zMinBlock);
172 const double tol(0.01);
173 for (
unsigned int i = 0;
i <
layers.size();
i++) {
174 double zo = zi + layerThick[
i];
175 double routF =
rMax(zi);
176 int laymax = laymin +
layers[
i];
179 for (
int ly = laymin; ly < laymax; ++ly) {
180 int ii = layerType[ly];
181 int copy = copyNumber[
ii];
182 double rinB = (layerSense[ly] == 0) ? (zo * slopeB[0]) : (zo * slopeB[1]);
183 zz += (0.5 * thick[
ii]);
184 thickTot += thick[
ii];
188 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo test: Layer " << ly <<
":" <<
ii <<
" Front " << zi <<
", "
189 << routF <<
" Back " << zo <<
", " << rinB <<
" superlayer thickness "
195 if (layerSense[ly] == 0) {
197 double rmax = routF *
cos(
alpha) - tol;
198 std::vector<double> pgonZ, pgonRin, pgonRout;
199 pgonZ.emplace_back(-0.5 * thick[
ii]);
200 pgonZ.emplace_back(0.5 * thick[
ii]);
201 pgonRin.emplace_back(rinB);
202 pgonRin.emplace_back(rinB);
203 pgonRout.emplace_back(rmax);
204 pgonRout.emplace_back(rmax);
212 for (
unsigned int k = 0;
k < pgonZ.size(); ++
k)
213 edm::LogVerbatim(
"HGCalGeom") <<
"[" <<
k <<
"] z " << pgonZ[
k] <<
" R " << pgonRin[
k] <<
":" << pgonRout[
k];
220 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo: " << solid.
name() <<
" Tubs made of " << matName
221 <<
" of dimensions " << rinB <<
", " << routF <<
", " << 0.5 * thick[
ii]
224 positionSensitive(glog, rinB, routF, cpv);
232 <<
" positioned in " <<
module.name() <<
" at " <<
r1 <<
" with " <<
rot
235 zz += (0.5 * thick[
ii]);
239 if (fabs(thickTot - layerThick[
i]) < 0.00001) {
240 }
else if (thickTot > layerThick[
i]) {
241 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << layerThick[
i] <<
" is smaller than thickness "
242 << thickTot <<
" of all its components **** ERROR ****\n";
243 }
else if (thickTot < layerThick[
i]) {
244 edm::LogWarning(
"HGCalGeom") <<
"Thickness of the partition " << layerThick[
i] <<
" does not match with "
245 << thickTot <<
" of the components\n";
255 for (
unsigned int k = 0;
k < slopeT.size(); ++
k) {
258 r = rMaxFront[
k] + (z - zFront[
k]) * slopeT[
k];
264 edm::LogVerbatim(
"HGCalGeom") <<
"rMax : " << z <<
":" << ik <<
":" <<
r << std::endl;
270 double ww = (waferW + waferGap);
271 double dx = 0.5 * ww;
272 double dy = 3.0 *
dx *
tan(30._deg);
273 double rr = 2.0 *
dx *
tan(30._deg);
274 int ncol = (
int)(2.0 * rout / ww) + 1;
275 int nrow = (
int)(rout / (ww *
tan(30._deg))) + 1;
276 int incm(0), inrm(0), kount(0);
278 edm::LogVerbatim(
"HGCalGeom") << glog.
ddname() <<
" rout " << rout <<
" Row " << nrow <<
" Column " << ncol;
280 for (
int nr = -nrow;
nr <= nrow; ++
nr) {
281 int inr = (
nr >= 0) ?
nr : -
nr;
282 for (
int nc = -ncol; nc <= ncol; ++nc) {
283 int inc = (nc >= 0) ? nc : -nc;
284 if (inr % 2 == inc % 2) {
285 double xpos = nc *
dx;
286 double ypos =
nr *
dy;
289 double rpos =
std::sqrt(xpos * xpos + ypos * ypos);
292 int copy = inr * 100 + inc;
305 if (copies.count(
copy) == 0)
309 << glog.
ddname() <<
" at " << tran <<
" with " <<
rotation << std::endl;
316 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModuleAlgo: # of columns " << incm <<
" # of rows " << inrm <<
" and "
317 << kount <<
" wafers for " << glog.
ddname();
~DDHGCalModuleAlgo() override
std::vector< double > zFront
DDName is used to identify DDD entities uniquely.
std::vector< std::string > wafer
alpha
zGenParticlesMatch = cms.InputTag(""),
constexpr NumType convertRadToDeg(NumType radians)
std::vector< double > layerThick
static constexpr uint32_t k_CornerSize
void constructLayers(const DDLogicalPart &, DDCompactView &cpv)
U second(std::pair< T, U > const &p)
std::vector< double > thick
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< int > copyNumber
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)
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)
const std::string names[nVars_]
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Compact representation of the geometrical detector hierarchy.
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
#define DEFINE_EDM_PLUGIN(factory, type, name)
constexpr long double piRadians(M_PIl)
std::vector< std::string > materials
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
std::vector< double > rMaxFront
Tan< T >::type tan(const T &t)
std::vector< double > slopeT
std::vector< int > layerSense
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()
A DDSolid represents the shape of a part.
Represents a uniquely identifyable rotation matrix.
std::vector< int > layerType
std::vector< double > slopeB
std::unordered_set< int > copies
static AlgebraicMatrix initialize()
std::vector< int > layers
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)
std::vector< std::string > names