17 #include "CLHEP/Units/PhysicalConstants.h"
18 #include "CLHEP/Units/SystemOfUnits.h"
24 LogDebug(
"PixelGeom") <<
"DDPixBarStackLayerAlgo info: Creating an instance";
45 number = int(nArgs[
"Ladders"]);
53 coolMat = sArgs[
"CoolMaterial"];
54 tubeMat = sArgs[
"CoolTubeMaterial"];
60 layout = int(nArgs[
"LayoutType"]);
65 LogDebug(
"PixelGeom") <<
"DDPixBarStackLayerAlgo debug: Parent " << parentName
67 <<
"\tLadders " <<
number <<
"\tGeneral Material "
69 <<
sensorEdge <<
"\tSpecification of Cooling Pieces:\n"
71 <<
" Side " <<
coolSide <<
" Thickness of Shell "
75 LogDebug(
"PixelGeom") <<
"DDPixBarStackLayerAlgo debug: Ladder "
86 std::cout <<
"\nAsking for an invalid layout ... Adjusting the number of ladders to compensate.\n";
89 double phi_coverage = 0.0;
91 double dphi = CLHEP::twopi/
number;
93 double radius_offset = 0.0;
94 double deltaX, deltaY;
95 double r_vol_inner = 0.0;
96 double r_vol_outer = 0.0;
97 double phi_coverage_pinn =0.0;
98 double phi_left = 0.0;
99 double phi_right = 0.0;
107 double r_right =
sqrt( d3*d3 + d4*d4 + 2*d3*d4*
sin(phi_offset)) ;
108 phi_right=acos( (r_right*r_right + d3*d3 - d4*d4)/
111 double d5 =
sqrt(d1*d1+d2*d2);
113 double r_left =
sqrt ( d4*d4 + d6*d6 - 2*d4*d6*
sin(phi_offset) ) ;
114 phi_left=acos( (r_left*r_left + d6*d6 - d4*d4)/
117 if (r_right> r_left ) {r_vol_outer=r_right;r_vol_inner=r_left;}
118 if (r_left > r_right) {r_vol_outer=r_left;r_vol_inner=r_right;}
120 phi_coverage_pinn=phi_left+phi_right;
125 phi_coverage_pinn = 0.0;
130 radius_offset = (r1-
r2)/2.0;
138 if(r_vol_inner>r_vol_outer) {
139 r_vol_innerT=r_vol_inner;
140 r_vol_inner=r_vol_outer-30;
141 r_vol_outer=r_vol_innerT+30;
146 int component_copy_no=1;
147 double phi0 = 90*CLHEP::deg;
148 double phi =0*CLHEP::deg;
149 double phix=0*CLHEP::deg;
150 double phiy=0*CLHEP::deg;
172 LogDebug(
"PixelGeom") <<
"DDPixBarStackLayerAlgo test: "
175 <<
" with Rin " << r_vol_inner <<
" Rout " << r_vol_outer
181 name = idName +
"CoolTube";
182 solid =
DDSolidFactory::trap(
DDName(name,
idNameSpace), 0.5*
coolDz, 0, 0,
coolWidth/2,
coolSide/2,
coolSide/2, 0,
coolWidth/2,
coolSide/2,
coolSide/2, 0);
187 LogDebug(
"PixelGeom") <<
"DDPixBarStackLayerAlgo test: " <<solid.
name()
188 <<
" Trap made of " <<
tubeMat <<
" of dimensions "
197 name = idName +
"Coolant";
199 solid =
DDSolidFactory::trap(
DDName(name,
idNameSpace), 0.5*
coolDz, 0, 0,
coolWidth/2-
coolThick,
coolSide/2-
coolThick,
coolSide/2-
coolThick, 0,
coolWidth/2-
coolThick,
coolSide/2-
coolThick,
coolSide/2-
coolThick, 0);
203 LogDebug(
"PixelGeom") <<
"DDPixBarStackLayerAlgo test: " <<solid.
name()
204 <<
" Trap made of " <<
tubeMat <<
" of dimensions "
215 LogDebug(
"PixelGeom") <<
"DDPixBarStackLayerAlgo test: " << cool.name()
216 <<
" number 1 positioned in " << coolTube.name()
217 <<
" at (0,0,0) with no rotation";
232 double phi_coverage_i=0.0;
235 phix = phi + (90*CLHEP::deg) - phi_offset ;
236 phiy = phix + (90*CLHEP::deg) ;
250 cpv.
position (ladderFullDown, layer, component_copy_no, tran, rot);
252 LogDebug(
"PixelGeom") <<
"DDPixBarStackLayerAlgo test: " << ladderFullDown
253 <<
" number " << component_copy_no
254 <<
" positioned in " << layer.
name()
265 cpv.
position (ladderFullUp, layer, component_copy_no, tran, rot);
267 LogDebug(
"PixelGeom") <<
"DDPixBarStackLayerAlgo test: " << ladderFullUp
268 <<
" number " << component_copy_no
269 <<
" positioned in " << layer.
name()
274 phi_coverage_i=phi_coverage_pinn;
279 phi_coverage += phi_coverage_i;
281 if (phi_coverage>CLHEP::twopi&&covered==0) {
289 if (phi_coverage<CLHEP::twopi) {
throw cms::Exception(
"DDPixBarStackLayerAlgo")
290 <<
"\nAsking for a Geometry with gaps in phi.\n";}
298 phix = phi + (90*CLHEP::deg) - phi_offset;
299 phiy = phix + (90*CLHEP::deg) ;
301 deltaX= coolOffset*
cos(90*CLHEP::deg-phi+phi_offset);
302 deltaY= coolOffset*
sin(90*CLHEP::deg-phi+phi_offset);
313 cpv.
position (coolTube, layer,
i+1, tran, rot);
314 LogDebug(
"PixelGeom") <<
"DDPixBarStackLayerAlgo test: " << coolTube.name()
315 <<
" number " <<
i+1 <<
" positioned in "
316 << layer.name() <<
" at " << tran <<
" with "<<
rot;
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
void execute(DDCompactView &cpv)
std::string VolumeMaterial
DDMaterial is used to define and access material information.
Sin< T >::type sin(const T &t)
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.
virtual ~DDPixBarStackLayerAlgo()
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.
U second(std::pair< T, U > const &p)
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)
static DDSolid trap(const DDName &name, double pDz, double pTheta, double pPhi, double pDy1, double pDx1, double pDx2, double pAlp1, double pDy2, double pDx3, double pDx4, double pAlp2)
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
std::string ladderNameDown
const std::string & name() const
Returns the name.