17 #include "CLHEP/Units/PhysicalConstants.h"
18 #include "CLHEP/Units/SystemOfUnits.h"
24 LogDebug(
"PixelGeom") <<
"DDPixBarTPGStackLayerAlgo info: Creating an instance";
45 number = int(nArgs[
"Ladders"]);
52 coolZ = nArgs[
"CoolZ"];
56 coolMat = sArgs[
"CoolMaterial"];
57 tubeMat = sArgs[
"CoolTubeMaterial"];
63 layout = int(nArgs[
"LayoutType"]);
68 LogDebug(
"PixelGeom") <<
"DDPixBarTPGStackLayerAlgo debug: Parent " << parentName
70 <<
"\tLadders " <<
number <<
"\tGeneral Material "
72 <<
sensorEdge <<
"\tSpecification of Cooling Pieces:\n"
74 <<
" Side " <<
coolSide <<
" Thickness of Shell "
78 LogDebug(
"PixelGeom") <<
"DDPixBarTPGStackLayerAlgo debug: Ladder "
89 std::cout <<
"\nAsking for an invalid layout ... Adjusting the number of ladders to compensate.\n";
92 double phi_coverage = 0.0;
94 double dphi = CLHEP::twopi/
number;
96 double radius_offset = 0.0;
97 double deltaX, deltaY;
98 double deltaX2, deltaY2;
99 double r_vol_inner = 0.0;
100 double r_vol_outer = 0.0;
101 double phi_coverage_pinn =0.0;
102 double phi_left = 0.0;
103 double phi_right = 0.0;
111 double r_right =
sqrt( d3*d3 + d4*d4 + 2*d3*d4*
sin(phi_offset)) ;
112 phi_right=acos( (r_right*r_right + d3*d3 - d4*d4)/
115 double d5 =
sqrt(d1*d1+d2*d2);
117 double r_left =
sqrt ( d4*d4 + d6*d6 - 2*d4*d6*
sin(phi_offset) ) ;
118 phi_left=acos( (r_left*r_left + d6*d6 - d4*d4)/
121 if (r_right> r_left ) {r_vol_outer=r_right;r_vol_inner=r_left;}
122 if (r_left > r_right) {r_vol_outer=r_left;r_vol_inner=r_right;}
124 phi_coverage_pinn=phi_left+phi_right;
129 phi_coverage_pinn = 0.0;
134 radius_offset = (r1-
r2)/2.0;
142 if(r_vol_inner>r_vol_outer) {
143 r_vol_innerT=r_vol_inner;
144 r_vol_inner=r_vol_outer-30;
145 r_vol_outer=r_vol_innerT+30;
150 int component_copy_no=1;
151 double phi0 = 90*CLHEP::deg;
152 double phi =0*CLHEP::deg;
153 double phix=0*CLHEP::deg;
154 double phiy=0*CLHEP::deg;
176 LogDebug(
"PixelGeom") <<
"DDPixBarTPGStackLayerAlgo test: "
179 <<
" with Rin " << r_vol_inner <<
" Rout " << r_vol_outer
185 name = idName +
"CoolTube";
186 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);
191 LogDebug(
"PixelGeom") <<
"DDPixBarTPGStackLayerAlgo test: " <<solid.
name()
192 <<
" Trap made of " <<
tubeMat <<
" of dimensions "
201 name = idName +
"Coolant";
203 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);
207 LogDebug(
"PixelGeom") <<
"DDPixBarTPGStackLayerAlgo test: " <<solid.
name()
208 <<
" Trap made of " <<
tubeMat <<
" of dimensions "
219 LogDebug(
"PixelGeom") <<
"DDPixBarTPGStackLayerAlgo test: " << cool.name()
220 <<
" number 1 positioned in " << coolTube.name()
221 <<
" at (0,0,0) with no rotation";
236 double phi_coverage_i=0.0;
239 phix = phi + (90*CLHEP::deg) - phi_offset ;
240 phiy = phix + (90*CLHEP::deg) ;
254 cpv.
position (ladderFullDown, layer, component_copy_no, tran, rot);
256 LogDebug(
"PixelGeom") <<
"DDPixBarTPGStackLayerAlgo test: " << ladderFullDown
257 <<
" number " << component_copy_no
258 <<
" positioned in " << layer.
name()
269 cpv.
position (ladderFullUp, layer, component_copy_no, tran, rot);
271 LogDebug(
"PixelGeom") <<
"DDPixBarTPGStackLayerAlgo test: " << ladderFullUp
272 <<
" number " << component_copy_no
273 <<
" positioned in " << layer.
name()
278 phi_coverage_i=phi_coverage_pinn;
283 phi_coverage += phi_coverage_i;
285 if (phi_coverage>CLHEP::twopi&&covered==0) {
293 if (phi_coverage<CLHEP::twopi) {
throw cms::Exception(
"DDPixBarTPGStackLayerAlgo")
294 <<
"\nAsking for a Geometry with gaps in phi.\n";}
304 phix = phi + (90*CLHEP::deg) - phi_offset;
305 phiy = phix + (90*CLHEP::deg) ;
307 deltaX= coolOffset*
cos(90*CLHEP::deg-phi+phi_offset);
308 deltaY= coolOffset*
sin(90*CLHEP::deg-phi+phi_offset);
309 deltaX2= coolOffset2*
cos(90*CLHEP::deg-phi+phi_offset);
310 deltaY2= coolOffset2*
sin(90*CLHEP::deg-phi+phi_offset);
322 cpv.
position (coolTube, layer,
i*2+1, tran, rot);
323 LogDebug(
"PixelGeom") <<
"DDPixBarTPGStackLayerAlgo test: " << coolTube.name()
324 <<
" number " <<
i*2+1 <<
" positioned in "
325 << layer.name() <<
" at " << tran <<
" with "<<
rot;
326 cpv.
position (coolTube, layer,
i*2+2, tran2, rot);
327 LogDebug(
"PixelGeom") <<
"DDPixBarTPGStackLayerAlgo test: " << coolTube.name()
328 <<
" number " <<
i*2+2 <<
" positioned in "
329 << layer.name() <<
" at " << tran2 <<
" with "<<
rot;
338 cpv.
position (coolTube, layer, number*2+
i*2+1, tran, rot);
339 LogDebug(
"PixelGeom") <<
"DDPixBarTPGStackLayerAlgo test: " << coolTube.name()
340 <<
" number " << number*2+
i*2+1 <<
" positioned in "
341 << layer.name() <<
" at " << tran <<
" with "<<
rot;
342 cpv.
position (coolTube, layer, number*2+
i*2+2, tran2, rot);
343 LogDebug(
"PixelGeom") <<
"DDPixBarTPGStackLayerAlgo test: " << coolTube.name()
344 <<
" number " << number*2+
i*2+2 <<
" positioned in "
345 << layer.name() <<
" at " << tran2 <<
" with "<<
rot;
DDPixBarTPGStackLayerAlgo()
DDMaterial is used to define and access material information.
std::string ladderNameDown
Sin< T >::type sin(const T &t)
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
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()
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)
virtual ~DDPixBarTPGStackLayerAlgo()
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::string VolumeMaterial
void execute(DDCompactView &cpv)
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
const std::string & name() const
Returns the name.