17 #include "CLHEP/Units/GlobalPhysicalConstants.h" 18 #include "CLHEP/Units/GlobalSystemOfUnits.h" 24 std::cout <<
"DDHGCalModule info: Creating an instance" << std::endl;
36 wafer = vsArgs[
"WaferName"];
38 std::cout <<
"DDHGCalModule: " <<
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 <<
"DDHGCalModule: " <<
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;
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 DDHGCalModule..." << std::endl;
112 std::cout <<
copies.size() <<
" different wafer copy numbers" << std::endl;
114 for (std::unordered_set<int>::const_iterator itr=
copies.begin();
115 itr !=
copies.end(); ++itr,++
k) {
116 std::cout <<
"[" << k <<
"] : " << (*itr) <<
" ";
118 if (nk == 8) {
std::cout << std::endl; nk = 0;}
124 std::cout <<
"<<== End of DDHGCalModule construction ..." << std::endl;
132 std::cout <<
"DDHGCalModule test: \t\tInside Layers" << std::endl;
136 const double tol(0.01);
137 for (
unsigned int i=0;
i<
layers.size();
i++) {
139 double routF =
rMax(zi);
143 for (
int ly=laymin; ly<laymax; ++ly) {
152 std::cout <<
"DDHGCalModule test: Layer " << ly <<
":" << ii
153 <<
" Front " << zi <<
", " << routF <<
" Back " << zo <<
", " 154 << rinB <<
" superlayer thickness " << layerThick[
i]
163 double rmax = routF*
cos(alpha) - tol;
164 std::vector<double> pgonZ, pgonRin, pgonRout;
165 pgonZ.emplace_back(-0.5*
thick[ii]); pgonZ.emplace_back(0.5*
thick[ii]);
166 pgonRin.emplace_back(rinB); pgonRin.emplace_back(rinB);
167 pgonRout.emplace_back(rmax); pgonRout.emplace_back(rmax);
170 pgonZ, pgonRin, pgonRout);
174 <<
" polyhedra of " <<
sectors <<
" sectors covering " 175 << -alpha/CLHEP::deg <<
":" 176 << (-alpha+CLHEP::twopi)/CLHEP::deg
177 <<
" with " << pgonZ.size() <<
" sections" << std::endl;
178 for (
unsigned int k=0;
k<pgonZ.size(); ++
k)
179 std::cout <<
"[" <<
k <<
"] z " << pgonZ[
k] <<
" R " << pgonRin[
k]
180 <<
":" << pgonRout[
k] << std::endl;
184 0.5*
thick[ii], rinB, routF, 0.0,
189 <<
" Tubs made of " << matName <<
" of dimensions " << rinB
190 <<
", " << routF <<
", " << 0.5*
thick[
ii] <<
", 0.0, " 191 << CLHEP::twopi/CLHEP::deg << std::endl;
192 std::cout <<
"DDHGCalModule test position in: " << glog.
name()
193 <<
" number " << copy << std::endl;
199 cpv.
position(glog, module, copy, r1, rot);
202 std::cout <<
"DDHGCalModule test: " << glog.
name() <<
" number " 203 << copy <<
" positioned in " << module.
name() <<
" at " << r1
204 <<
" with " << rot << std::endl;
210 if (fabs(thickTot-layerThick[
i]) < 0.00001) {
211 }
else if (thickTot > layerThick[i]) {
212 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << layerThick[
i]
213 <<
" is smaller than thickness " << thickTot
214 <<
" of all its components **** ERROR ****\n";
215 }
else if (thickTot < layerThick[i]) {
217 << layerThick[
i] <<
" does not match with " 218 << thickTot <<
" of the components\n";
228 for (
unsigned int k=0;
k<
slopeT.size(); ++
k) {
236 std::cout <<
"rMax : " << z <<
":" << ik <<
":" << r << std::endl;
244 double dy = 3.0*dx*
tan(30.0*CLHEP::deg);
245 double rr = 2.0*dx*
tan(30.0*CLHEP::deg);
247 int nrow = (
int)(rout/(
waferW*
tan(30.0*CLHEP::deg))) + 1;
248 int incm(0), inrm(0), kount(0), ntot(0),
nin(0), nfine(0), ncoarse(0);
252 <<
" Column " << ncol << std::endl;
254 for (
int nr=-nrow; nr <= nrow; ++nr) {
255 int inr = (nr >= 0) ? nr : -nr;
256 for (
int nc=-ncol; nc <=
ncol; ++nc) {
257 int inc = (nc >= 0) ? nc : -nc;
258 if (inr%2 == inc%2) {
261 xc[0] = xpos+
dx; yc[0] = ypos-0.5*
rr;
262 xc[1] = xpos+
dx; yc[1] = ypos+0.5*
rr;
263 xc[2] = xpos; yc[2] = ypos+
rr;
264 xc[3] = xpos-
dx; yc[3] = ypos+0.5*
rr;
265 xc[4] = xpos+
dx; yc[4] = ypos-0.5*
rr;
266 xc[5] = xpos; yc[5] = ypos-
rr;
267 bool cornerOne(
false), cornerAll(
true);
268 for (
int k=0;
k<6; ++
k) {
270 if (rpos >= rin && rpos <= rout) cornerOne =
true;
271 else cornerAll =
false;
275 int copy = inr*100 + inc;
276 if (nc < 0) copy += 10000;
277 if (nr < 0) copy += 100000;
278 if (inc > incm) incm = inc;
279 if (inr > inrm) inrm = inr;
283 double rpos =
std::sqrt(xpos*xpos+ypos*ypos);
294 std::cout <<
"DDHGCalModule: " << name <<
" number " << copy
295 <<
" positioned in " << glog.
ddname() <<
" at " << tran
296 <<
" with " << rotation << std::endl;
304 std::cout <<
"DDHGCalModule: # of columns " << incm <<
" # of rows " 305 << inrm <<
" and " <<
nin <<
":" << kount <<
":" << ntot
306 <<
" wafers (" << nfine <<
":" << ncoarse <<
") for " 307 << glog.
ddname() <<
" R " << rin <<
":" << rout << std::endl;
DDMaterial is used to define and access material information.
std::vector< int > copyNumber
DDName is used to identify DDD entities uniquely.
static std::string & ns()
std::vector< std::string > wafer
std::vector< int > layerSense
Compact representation of the geometrical detector hierarchy.
A DDSolid represents the shape of a part.
std::vector< int > layers
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Represents a uniquely identifyable rotation matrix.
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 > slopeB
std::vector< double > slopeT
std::vector< std::string > names
std::vector< std::string > materials
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)
void execute(DDCompactView &cpv) override
std::vector< double > rMaxFront
std::unordered_set< int > copies
std::vector< int > layerType
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string ©no, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
std::vector< double > thick
std::vector< double > layerThick
void positionSensitive(DDLogicalPart &glog, double rin, double rout, DDCompactView &cpv)
~DDHGCalModule() override
std::vector< double > zFront
void constructLayers(const DDLogicalPart &, DDCompactView &cpv)
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
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)