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;
83 slopeB = vArgs[
"SlopeBottom"];
84 slopeT = vArgs[
"SlopeTop"];
89 <<
slopeB[1] <<
" and " <<
slopeT.size() <<
" slopes for top" 91 for (
unsigned int i=0;
i<
slopeT.size(); ++
i)
108 std::cout <<
"==>> Constructing DDHGCalModuleAlgo..." << std::endl;
113 std::cout <<
copies.size() <<
" different wafer copy numbers" << std::endl;
117 std::cout <<
"<<== End of DDHGCalModuleAlgo construction ..." << std::endl;
125 std::cout <<
"DDHGCalModuleAlgo test: \t\tInside Layers" << std::endl;
129 const double tol(0.01);
130 for (
unsigned int i=0;
i<
layers.size();
i++) {
132 double routF =
rMax(zi);
136 for (
int ly=laymin; ly<laymax; ++ly) {
145 std::cout <<
"DDHGCalModuleAlgo test: Layer " << ly <<
":" << ii
146 <<
" Front " << zi <<
", " << routF <<
" Back " << zo <<
", " 147 << rinB <<
" superlayer thickness " << layerThick[
i]
156 double rmax = routF*
cos(alpha) - tol;
157 std::vector<double> pgonZ, pgonRin, pgonRout;
158 pgonZ.push_back(-0.5*
thick[ii]); pgonZ.push_back(0.5*
thick[ii]);
159 pgonRin.push_back(rinB); pgonRin.push_back(rinB);
160 pgonRout.push_back(rmax); pgonRout.push_back(rmax);
163 pgonZ, pgonRin, pgonRout);
167 <<
" polyhedra of " <<
sectors <<
" sectors covering " 168 << -alpha/CLHEP::deg <<
":" 169 << (-alpha+CLHEP::twopi)/CLHEP::deg
170 <<
" with " << pgonZ.size() <<
" sections" << std::endl;
171 for (
unsigned int k=0;
k<pgonZ.size(); ++
k)
172 std::cout <<
"[" <<
k <<
"] z " << pgonZ[
k] <<
" R " << pgonRin[
k]
173 <<
":" << pgonRout[
k] << std::endl;
177 0.5*
thick[ii], rinB, routF, 0.0,
182 <<
" Tubs made of " << matName <<
" of dimensions " << rinB
183 <<
", " << routF <<
", " << 0.5*
thick[
ii] <<
", 0.0, " 184 << CLHEP::twopi/CLHEP::deg << std::endl;
190 cpv.
position(glog, module, copy, r1, rot);
193 std::cout <<
"DDHGCalModuleAlgo test: " << glog.
name() <<
" number " 194 << copy <<
" positioned in " << module.
name() <<
" at " << r1
195 <<
" with " << rot << std::endl;
201 if (fabs(thickTot-layerThick[
i]) < 0.00001) {
202 }
else if (thickTot > layerThick[i]) {
203 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << layerThick[
i]
204 <<
" is smaller than thickness " << thickTot
205 <<
" of all its components **** ERROR ****\n";
206 }
else if (thickTot < layerThick[i]) {
208 << layerThick[
i] <<
" does not match with " 209 << thickTot <<
" of the components\n";
219 for (
unsigned int k=0;
k<
slopeT.size(); ++
k) {
227 std::cout <<
"rMax : " << z <<
":" << ik <<
":" << r << std::endl;
236 double dy = 3.0*dx*
tan(30.0*CLHEP::deg);
237 double rr = 2.0*dx*
tan(30.0*CLHEP::deg);
238 int ncol = (
int)(2.0*rout/ww) + 1;
239 int nrow = (
int)(rout/(ww*
tan(30.0*CLHEP::deg))) + 1;
240 int incm(0), inrm(0), kount(0);
244 <<
" Column " << ncol << std::endl;
246 for (
int nr=-nrow; nr <= nrow; ++nr) {
247 int inr = (nr >= 0) ? nr : -nr;
248 for (
int nc=-ncol; nc <=
ncol; ++nc) {
249 int inc = (nc >= 0) ? nc : -nc;
250 if (inr%2 == inc%2) {
253 xc[0] = xpos+
dx; yc[0] = ypos-0.5*
rr;
254 xc[1] = xpos+
dx; yc[1] = ypos+0.5*
rr;
255 xc[2] = xpos; yc[2] = ypos+
rr;
256 xc[3] = xpos-
dx; yc[3] = ypos+0.5*
rr;
257 xc[4] = xpos+
dx; yc[4] = ypos-0.5*
rr;
258 xc[5] = xpos; yc[5] = ypos-
rr;
259 bool cornerAll(
true);
260 for (
int k=0;
k<6; ++
k) {
262 if (rpos < rin || rpos > rout) cornerAll =
false;
265 double rpos =
std::sqrt(xpos*xpos+ypos*ypos);
268 int copy = inr*100 + inc;
269 if (nc < 0) copy += 10000;
270 if (nr < 0) copy += 100000;
275 if (inc > incm) incm = inc;
276 if (inr > inrm) inrm = inr;
278 if (
copies.count(copy) == 0)
281 std::cout <<
"DDHGCalModuleAlgo: " << name <<
" number " << copy
282 <<
" positioned in " << glog.
ddname() <<
" at " << tran
283 <<
" with " << rotation << std::endl;
290 std::cout <<
"DDHGCalModuleAlgo: # of columns " << incm <<
" # of rows " 291 << 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