19 #include "CLHEP/Units/GlobalPhysicalConstants.h" 20 #include "CLHEP/Units/GlobalSystemOfUnits.h" 26 std::cout <<
"DDHGCalModuleAlgo info: Creating an instance" << std::endl;
38 wafer = vsArgs[
"WaferName"];
40 std::cout <<
"DDHGCalModuleAlgo: " <<
wafer.size() <<
" wafers" << std::endl;
41 for (
unsigned int i=0;
i<
wafer.size(); ++
i)
45 names = vsArgs[
"VolumeNames"];
46 thick = vArgs[
"Thickness"];
52 <<
" types of volumes" << std::endl;
53 for (
unsigned int i=0;
i<
names.size(); ++
i)
56 <<
" first copy number " <<
copyNumber[
i] << std::endl;
61 std::cout <<
"DDHGCalModuleAlgo: " <<
layers.size() <<
" blocks" <<std::endl;
62 for (
unsigned int i=0;
i<
layers.size(); ++
i)
64 <<
" with " <<
layers[
i] <<
" layers" << std::endl;
73 <<
" sensitive class " <<
layerSense[
i] << std::endl;
85 slopeB = vArgs[
"SlopeBottom"];
86 slopeT = vArgs[
"SlopeTop"];
91 <<
slopeB[1] <<
" and " <<
slopeT.size() <<
" slopes for top" 93 for (
unsigned int i=0;
i<
slopeT.size(); ++
i)
110 std::cout <<
"==>> Constructing DDHGCalModuleAlgo..." << std::endl;
115 std::cout <<
copies.size() <<
" different wafer copy numbers" << std::endl;
119 std::cout <<
"<<== End of DDHGCalModuleAlgo construction ..." << std::endl;
127 std::cout <<
"DDHGCalModuleAlgo test: \t\tInside Layers" << std::endl;
131 const double tol(0.01);
132 for (
unsigned int i=0;
i<
layers.size();
i++) {
134 double routF =
rMax(zi);
138 for (
int ly=laymin; ly<laymax; ++ly) {
147 std::cout <<
"DDHGCalModuleAlgo test: Layer " << ly <<
":" << ii
148 <<
" Front " << zi <<
", " << routF <<
" Back " << zo <<
", " 149 << rinB <<
" superlayer thickness " << layerThick[
i]
158 double rmax = routF*
cos(alpha) - tol;
159 std::vector<double> pgonZ, pgonRin, pgonRout;
160 pgonZ.emplace_back(-0.5*
thick[ii]); pgonZ.emplace_back(0.5*
thick[ii]);
161 pgonRin.emplace_back(rinB); pgonRin.emplace_back(rinB);
162 pgonRout.emplace_back(rmax); pgonRout.emplace_back(rmax);
165 pgonZ, pgonRin, pgonRout);
169 <<
" polyhedra of " <<
sectors <<
" sectors covering " 170 << -alpha/CLHEP::deg <<
":" 171 << (-alpha+CLHEP::twopi)/CLHEP::deg
172 <<
" with " << pgonZ.size() <<
" sections" << std::endl;
173 for (
unsigned int k=0;
k<pgonZ.size(); ++
k)
174 std::cout <<
"[" <<
k <<
"] z " << pgonZ[
k] <<
" R " << pgonRin[
k]
175 <<
":" << pgonRout[
k] << std::endl;
179 0.5*
thick[ii], rinB, routF, 0.0,
184 <<
" Tubs made of " << matName <<
" of dimensions " << rinB
185 <<
", " << routF <<
", " << 0.5*
thick[
ii] <<
", 0.0, " 186 << CLHEP::twopi/CLHEP::deg << std::endl;
192 cpv.
position(glog, module, copy, r1, rot);
195 std::cout <<
"DDHGCalModuleAlgo test: " << glog.
name() <<
" number " 196 << copy <<
" positioned in " << module.
name() <<
" at " << r1
197 <<
" with " << rot << std::endl;
203 if (fabs(thickTot-layerThick[
i]) < 0.00001) {
204 }
else if (thickTot > layerThick[i]) {
205 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << layerThick[
i]
206 <<
" is smaller than thickness " << thickTot
207 <<
" of all its components **** ERROR ****\n";
208 }
else if (thickTot < layerThick[i]) {
210 << layerThick[
i] <<
" does not match with " 211 << thickTot <<
" of the components\n";
221 for (
unsigned int k=0;
k<
slopeT.size(); ++
k) {
229 std::cout <<
"rMax : " << z <<
":" << ik <<
":" << r << std::endl;
238 double dy = 3.0*dx*
tan(30.0*CLHEP::deg);
239 double rr = 2.0*dx*
tan(30.0*CLHEP::deg);
240 int ncol = (
int)(2.0*rout/ww) + 1;
241 int nrow = (
int)(rout/(ww*
tan(30.0*CLHEP::deg))) + 1;
242 int incm(0), inrm(0), kount(0);
245 <<
" Column " << ncol << std::endl;
247 for (
int nr=-nrow; nr <= nrow; ++nr) {
248 int inr = (nr >= 0) ? nr : -nr;
249 for (
int nc=-ncol; nc <=
ncol; ++nc) {
250 int inc = (nc >= 0) ? nc : -nc;
251 if (inr%2 == inc%2) {
254 std::pair<int,int>
corner =
257 double rpos =
std::sqrt(xpos*xpos+ypos*ypos);
260 int copy = inr*100 + inc;
261 if (nc < 0) copy += 10000;
262 if (nr < 0) copy += 100000;
267 if (inc > incm) incm = inc;
268 if (inr > inrm) inrm = inr;
270 if (
copies.count(copy) == 0)
273 std::cout <<
"DDHGCalModuleAlgo: " << name <<
" number " << copy
274 <<
" positioned in " << glog.
ddname() <<
" at " << tran
275 <<
" with " << rotation << std::endl;
282 std::cout <<
"DDHGCalModuleAlgo: # of columns " << incm <<
" # of rows " 283 << 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
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
DDMaterial is used to define and access material information.
std::vector< std::string > names
DDName is used to identify DDD entities uniquely.
static std::string & ns()
~DDHGCalModuleAlgo() override
Compact representation of the geometrical detector hierarchy.
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.
void execute(DDCompactView &cpv) override
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
static uint32_t k_CornerSize
std::vector< int > layerType
std::vector< int > layers
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 > slopeT
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
std::vector< std::string > wafer
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
void constructLayers(const DDLogicalPart &, DDCompactView &cpv)
std::vector< int > layerSense