17 #include "CLHEP/Units/GlobalPhysicalConstants.h"
18 #include "CLHEP/Units/GlobalSystemOfUnits.h"
24 std::cout <<
"DDHGCalModuleAlgo info: Creating an instance" << std::endl;
36 wafer = vsArgs[
"WaferName"];
38 std::cout <<
"DDHGCalModuleAlgo: " <<
wafer.size() <<
" wafers" << std::endl;
39 for (
unsigned int i=0;
i<
wafer.size(); ++
i)
43 names = vsArgs[
"VolumeNames"];
44 thick = vArgs[
"Thickness"];
50 <<
" types of volumes" << std::endl;
51 for (
unsigned int i=0;
i<
names.size(); ++
i)
54 <<
" first copy number " <<
copyNumber[
i] << std::endl;
59 std::cout <<
"DDHGCalModuleAlgo: " <<
layers.size() <<
" blocks" <<std::endl;
60 for (
unsigned int i=0;
i<
layers.size(); ++
i)
62 <<
" with " <<
layers[
i] <<
" layers" << std::endl;
71 <<
" sensitive class " <<
layerSense[
i] << std::endl;
76 sectors = (int)(nArgs[
"Sectors"]);
82 slopeB = vArgs[
"SlopeBottom"];
83 slopeT = vArgs[
"SlopeTop"];
88 <<
slopeB[1] <<
" and " <<
slopeT.size() <<
" slopes for top"
90 for (
unsigned int i=0;
i<
slopeT.size(); ++
i)
107 std::cout <<
"==>> Constructing DDHGCalModuleAlgo..." << std::endl;
112 std::cout <<
copies.size() <<
" different wafer copy numbers" << std::endl;
116 std::cout <<
"<<== End of DDHGCalModuleAlgo construction ..." << std::endl;
124 std::cout <<
"DDHGCalModuleAlgo test: \t\tInside Layers" << std::endl;
128 const double tol(0.01);
129 for (
unsigned int i=0;
i<
layers.size();
i++) {
131 double routF =
rMax(zi);
135 for (
int ly=laymin; ly<laymax; ++ly) {
144 std::cout <<
"DDHGCalModuleAlgo test: Layer " << ly <<
":" << ii
145 <<
" Front " << zi <<
", " << routF <<
" Back " << zo <<
", "
146 << rinB <<
" superlayer thickness " << layerThick[
i]
155 double rmax = routF*
cos(alpha) - tol;
156 std::vector<double> pgonZ, pgonRin, pgonRout;
157 pgonZ.push_back(-0.5*
thick[ii]); pgonZ.push_back(0.5*
thick[ii]);
158 pgonRin.push_back(rinB); pgonRin.push_back(rinB);
159 pgonRout.push_back(rmax); pgonRout.push_back(rmax);
162 pgonZ, pgonRin, pgonRout);
166 <<
" polyhedra of " <<
sectors <<
" sectors covering "
167 << -alpha/CLHEP::deg <<
":"
168 << (-alpha+CLHEP::twopi)/CLHEP::deg
169 <<
" with " << pgonZ.size() <<
" sections" << std::endl;
170 for (
unsigned int k=0;
k<pgonZ.size(); ++
k)
171 std::cout <<
"[" <<
k <<
"] z " << pgonZ[
k] <<
" R " << pgonRin[
k]
172 <<
":" << pgonRout[
k] << std::endl;
176 0.5*
thick[ii], rinB, routF, 0.0,
181 <<
" Tubs made of " << matName <<
" of dimensions " << rinB
182 <<
", " << routF <<
", " << 0.5*
thick[
ii] <<
", 0.0, "
183 << CLHEP::twopi/CLHEP::deg << std::endl;
189 cpv.
position(glog, module, copy, r1, rot);
192 std::cout <<
"DDHGCalModuleAlgo test: " << glog.
name() <<
" number "
193 << copy <<
" positioned in " << module.
name() <<
" at " << r1
194 <<
" with " << rot << std::endl;
200 if (fabs(thickTot-layerThick[
i]) < 0.00001) {
201 }
else if (thickTot > layerThick[i]) {
202 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << layerThick[
i]
203 <<
" is smaller than thickness " << thickTot
204 <<
" of all its components **** ERROR ****\n";
205 }
else if (thickTot < layerThick[i]) {
207 << layerThick[
i] <<
" does not match with "
208 << thickTot <<
" of the components\n";
218 for (
unsigned int k=0;
k<
slopeT.size(); ++
k) {
226 std::cout <<
"rMax : " << z <<
":" << ik <<
":" << r << std::endl;
234 double dy = 3.0*dx*
tan(30.0*CLHEP::deg);
235 double rr = 2.0*dx*
tan(30.0*CLHEP::deg);
236 int ncol = (int)(2.0*rout/
waferW) + 1;
237 int nrow = (int)(rout/(
waferW*
tan(30.0*CLHEP::deg))) + 1;
238 int incm(0), inrm(0), kount(0);
242 <<
" Column " << ncol << std::endl;
244 for (
int nr=-nrow; nr <= nrow; ++nr) {
245 int inr = (nr >= 0) ? nr : -nr;
246 for (
int nc=-ncol; nc <= ncol; ++nc) {
247 int inc = (nc >= 0) ? nc : -nc;
248 if (inr%2 == inc%2) {
251 xc[0] = xpos+dx; yc[0] = ypos-0.5*
rr;
252 xc[1] = xpos+dx; yc[1] = ypos+0.5*
rr;
253 xc[2] = xpos; yc[2] = ypos+
rr;
254 xc[3] = xpos-dx; yc[3] = ypos+0.5*
rr;
255 xc[4] = xpos+dx; yc[4] = ypos-0.5*
rr;
256 xc[5] = xpos; yc[5] = ypos-
rr;
257 bool cornerAll(
true);
258 for (
int k=0;
k<6; ++
k) {
260 if (rpos < rin || rpos > rout) cornerAll =
false;
263 double rpos =
std::sqrt(xpos*xpos+ypos*ypos);
266 int copy = inr*100 + inc;
267 if (nc < 0) copy += 10000;
268 if (nr < 0) copy += 100000;
273 if (inc > incm) incm = inc;
274 if (inr > inrm) inrm = inr;
276 if (
copies.count(copy) == 0)
279 std::cout <<
"DDHGCalModuleAlgo: " << name <<
" number " << copy
280 <<
" positioned in " << glog.
ddname() <<
" at " << tran
281 <<
" with " << rotation << std::endl;
288 std::cout <<
"DDHGCalModuleAlgo: # of columns " << incm <<
" # of rows "
289 << inrm <<
" and " << kount <<
" 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()
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