17 #include "CLHEP/Units/GlobalPhysicalConstants.h"
18 #include "CLHEP/Units/GlobalSystemOfUnits.h"
24 edm::LogInfo(
"HGCalGeom") <<
"DDHGCalModuleAlgo info: Creating an instance";
36 wafer = vsArgs[
"WaferName"];
40 for (
unsigned int i=0;
i<
wafer.size(); ++
i)
44 names = vsArgs[
"VolumeNames"];
45 thick = vArgs[
"Thickness"];
51 <<
" types of volumes";
52 for (
unsigned int i=0;
i<
names.size(); ++
i)
54 <<
" of thickness " <<
thick[
i]
63 for (
unsigned int i=0;
i<
layers.size(); ++
i)
64 edm::LogInfo(
"HGCalGeom") <<
"Block [" <<
i <<
"] of thickness "
74 edm::LogInfo(
"HGCalGeom") <<
"Layer [" <<
i <<
"] with material type "
81 sectors = (int)(nArgs[
"Sectors"]);
84 <<
" rFineCoarse " <<
rMaxFine <<
" wafer width "
87 slopeB = vArgs[
"SlopeBottom"];
88 slopeT = vArgs[
"SlopeTop"];
95 for (
unsigned int i=0;
i<
slopeT.size(); ++
i)
113 edm::LogInfo(
"HGCalGeom") <<
"==>> Constructing DDHGCalModuleAlgo...";
120 edm::LogInfo(
"HGCalGeom") <<
"<<== End of DDHGCalModuleAlgo construction ...";
128 edm::LogInfo(
"HGCalGeom") <<
"DDHGCalModuleAlgo test: \t\tInside Layers";
132 const double tol(0.01);
133 for (
unsigned int i=0;
i<
layers.size();
i++) {
135 double routF =
rMax(zi);
138 for (
int ly=laymin; ly<laymax; ++ly) {
146 edm::LogInfo(
"HGCalGeom") <<
"DDHGCalModuleAlgo test: Layer " << ly <<
":"
147 << ii <<
" Front " << zi <<
", " << routF
148 <<
" Back " << zo <<
", " << rinB
149 <<
" superlayer thickness " << layerThick[
i];
157 double rmax = routF*
cos(alpha) - tol;
158 std::vector<double> pgonZ, pgonRin, pgonRout;
159 pgonZ.push_back(-0.5*
thick[ii]); pgonZ.push_back(0.5*
thick[ii]);
160 pgonRin.push_back(rinB); pgonRin.push_back(rinB);
161 pgonRout.push_back(rmax); pgonRout.push_back(rmax);
164 pgonZ, pgonRin, pgonRout);
169 <<
" sectors covering " << -alpha/CLHEP::deg
170 <<
":" << (-alpha+CLHEP::twopi)/CLHEP::deg
171 <<
" with " << pgonZ.size() <<
" sections";
172 for (
unsigned int k=0;
k<pgonZ.size(); ++
k)
173 edm::LogInfo(
"HGCalGeom") <<
"[" <<
k <<
"] z " << pgonZ[
k] <<
" R "
174 << pgonRin[
k] <<
":" << pgonRout[
k];
178 0.5*
thick[ii], rinB, routF, 0.0,
183 << solid.
name() <<
" Tubs made of " << matName
184 <<
" of dimensions " << rinB <<
", " << routF
185 <<
", " << 0.5*
thick[
ii] <<
", 0.0, "
186 << CLHEP::twopi/CLHEP::deg;
192 cpv.
position(glog, module, copy, r1, rot);
196 <<
" number " << copy <<
" positioned in "
197 << module.
name() <<
" at " << r1 <<
" with "
212 for (
unsigned int k=0;
k<
slopeT.size(); ++
k) {
220 edm::LogInfo(
"HGCalGeom") <<
"rMax : " << z <<
":" << ik <<
":" <<
r ;
228 double dy = 3.0*dx*
tan(30.0*CLHEP::deg);
229 double rr = 2.0*dx*
tan(30.0*CLHEP::deg);
230 int ncol = (int)(2.0*rout/
waferW) + 1;
231 int nrow = (int)(rout/(
waferW*
tan(30.0*CLHEP::deg))) + 1;
232 int incm(0), inrm(0), kount(0);
235 << nrow <<
" Column " << ncol;
237 for (
int nr=-nrow; nr <= nrow; ++nr) {
238 int inr = (nr >= 0) ? nr : -nr;
239 for (
int nc=-ncol; nc <= ncol; ++nc) {
240 int inc = (nc >= 0) ? nc : -nc;
241 if (inr%2 == inc%2) {
244 double rpos =
std::sqrt(xpos*xpos+ypos*ypos);
245 if (rpos-rr >= rin && rpos+rr <= rout) {
248 int copy = inr*100 + inc;
249 if (nc < 0) copy += 10000;
250 if (nr < 0) copy += 100000;
255 if (inc > incm) incm = inc;
256 if (inr > inrm) inrm = inr;
258 if (
copies.count(copy) == 0 )
262 << name <<
" number " << copy
263 <<
" positioned in " << glog.
ddname()
264 <<
" at " << tran <<
" with " <<
rotation;
270 edm::LogInfo(
"HGCalGeom") <<
"DDHGCalModuleAlgo: # of columns " << incm
271 <<
" # of rows " << inrm <<
" and " << kount
272 <<
" wafers for " <<glog.
ddname();
std::vector< int > copyNumber
std::vector< double > thick
void positionSensitive(DDLogicalPart &glog, double rin, double rout, DDCompactView &cpv)
std::unordered_set< int > copies
DDMaterial is used to define and access material information.
void constructLayers(DDLogicalPart, DDCompactView &cpv)
std::vector< std::string > names
void position(const DDLogicalPart &self, const DDLogicalPart &parent, std::string copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=NULL)
DDName is used to identify DDD entities uniquely.
static std::string & ns()
std::string dbl_to_string(const double &in)
Converts only the integer part of a double to a string.
type of data representation of DDCompactView
A DDSolid represents the shape of a part.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Represents a uniquely identifyable rotation matrix.
std::vector< std::string > materials
std::vector< double > rMaxFront
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.
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
std::vector< double > slopeB
std::vector< int > layerType
std::vector< int > layers
virtual ~DDHGCalModuleAlgo()
void execute(DDCompactView &cpv)
std::vector< double > slopeT
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
std::vector< std::string > wafer
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
std::vector< double > zFront
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 > layerThick
std::vector< int > layerSense