|
|
Go to the documentation of this file.
10 #include <unordered_set>
46 double rMax(
double z);
85 wafer = vsArgs[
"WaferName"];
87 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModule: " << 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 for (
unsigned int i = 0;
i < materials.size(); ++
i) {
95 copyNumber.emplace_back(1);
98 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModule: " << materials.size() <<
" types of volumes";
99 for (
unsigned int i = 0;
i <
names.size(); ++
i)
101 <<
" filled with " << materials[
i] <<
" first copy number " << copyNumber[
i];
104 layerThick = vArgs[
"LayerThick"];
107 for (
unsigned int i = 0;
i <
layers.size(); ++
i)
114 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModule: " << layerType.size() <<
" layers";
115 for (
unsigned int i = 0;
i < layerType.size(); ++
i)
116 edm::LogVerbatim(
"HGCalGeom") <<
"Layer [" <<
i <<
"] with material type " << layerType[
i] <<
" sensitive class "
119 zMinBlock = nArgs[
"zMinBlock"];
120 rMaxFine = nArgs[
"rMaxFine"];
121 waferW = nArgs[
"waferW"];
124 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModule: zStart " << zMinBlock <<
" rFineCoarse " << rMaxFine
125 <<
" wafer width " << waferW <<
" sectors " <<
sectors;
127 slopeB = vArgs[
"SlopeBottom"];
128 slopeT = vArgs[
"SlopeTop"];
129 zFront = vArgs[
"ZFront"];
130 rMaxFront = vArgs[
"RMaxFront"];
132 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModule: 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") <<
"DDHGCalModule: NameSpace " << idNameSpace;
155 edm::LogVerbatim(
"HGCalGeom") << copies.size() <<
" different wafer copy numbers";
157 for (std::unordered_set<int>::const_iterator
itr = copies.begin();
itr != copies.end(); ++
itr, ++
k)
162 edm::LogVerbatim(
"HGCalGeom") <<
"<<== End of DDHGCalModule construction ...";
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") <<
"DDHGCalModule: Layer " << ly <<
":" <<
ii <<
" Front " << zi <<
", " << routF
189 <<
" Back " << zo <<
", " << rinB <<
" superlayer thickness " << layerThick[
i];
194 if (layerSense[ly] == 0) {
196 double rmax = routF *
cos(
alpha) - tol;
197 std::vector<double> pgonZ, pgonRin, pgonRout;
198 pgonZ.emplace_back(-0.5 * thick[
ii]);
199 pgonZ.emplace_back(0.5 * thick[
ii]);
200 pgonRin.emplace_back(rinB);
201 pgonRin.emplace_back(rinB);
202 pgonRout.emplace_back(rmax);
203 pgonRout.emplace_back(rmax);
211 for (
unsigned int k = 0;
k < pgonZ.size(); ++
k)
212 edm::LogVerbatim(
"HGCalGeom") <<
"[" <<
k <<
"] z " << pgonZ[
k] <<
" R " << pgonRin[
k] <<
":" << pgonRout[
k];
219 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModule: " << solid.
name() <<
" Tubs made of " << matName
220 <<
" of dimensions " << rinB <<
", " << routF <<
", " << 0.5 * thick[
ii]
224 positionSensitive(glog, rinB, routF, cpv);
232 <<
module.name() <<
" at " <<
r1 <<
" with " <<
rot;
234 zz += (0.5 * thick[
ii]);
238 if (fabs(thickTot - layerThick[
i]) < 0.00001) {
239 }
else if (thickTot > layerThick[
i]) {
240 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << layerThick[
i] <<
" is smaller than thickness "
241 << thickTot <<
" of all its components **** ERROR ****\n";
242 }
else if (thickTot < layerThick[
i]) {
243 edm::LogWarning(
"HGCalGeom") <<
"Thickness of the partition " << layerThick[
i] <<
" does not match with "
244 << thickTot <<
" of the components\n";
254 for (
unsigned int k = 0;
k < slopeT.size(); ++
k) {
257 r = rMaxFront[
k] + (z - zFront[
k]) * slopeT[
k];
269 double dx = 0.5 * waferW;
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 / waferW) + 1;
273 int nrow = (
int)(rout / (waferW *
tan(30._deg))) + 1;
274 int incm(0), inrm(0), kount(0), ntot(0),
nin(0), nfine(0), ncoarse(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;
288 int copy = inr * 100 + inc;
298 if (copies.count(
copy) == 0)
301 double rpos =
std::sqrt(xpos * xpos + ypos * ypos);
322 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModule: # of columns " << incm <<
" # of rows " << inrm <<
" and " <<
nin
323 <<
":" << kount <<
":" << ntot <<
" wafers (" << nfine <<
":" << ncoarse <<
") for "
324 << glog.
ddname() <<
" R " << rin <<
":" << rout;
void execute(DDCompactView &cpv) override
std::vector< int > layerSense
DDName is used to identify DDD entities uniquely.
alpha
zGenParticlesMatch = cms.InputTag(""),
constexpr NumType convertRadToDeg(NumType radians)
std::vector< double > slopeB
static constexpr uint32_t k_CornerSize
U second(std::pair< T, U > const &p)
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 > zFront
std::vector< double > slopeT
std::vector< double > thick
DDMaterial is used to define and access material information.
Cos< T >::type cos(const T &t)
void constructLayers(const DDLogicalPart &, DDCompactView &cpv)
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.
std::vector< double > layerThick
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 > names
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
Tan< T >::type tan(const T &t)
std::unordered_set< int > copies
std::vector< std::string > wafer
~DDHGCalModule() override
std::vector< int > layers
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
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 > rMaxFront
A DDSolid represents the shape of a part.
Represents a uniquely identifyable rotation matrix.
std::vector< std::string > materials
static AlgebraicMatrix initialize()
void positionSensitive(DDLogicalPart &glog, double rin, double rout, DDCompactView &cpv)
std::vector< int > copyNumber
std::vector< int > layerType
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)