16 #include "CLHEP/Units/PhysicalConstants.h"
17 #include "CLHEP/Units/SystemOfUnits.h"
23 LogDebug(
"PixelGeom") <<
"DDPixBarStackLayerAlgo info: Creating an instance";
44 number = int(nArgs[
"Ladders"]);
52 coolMat = sArgs[
"CoolMaterial"];
53 tubeMat = sArgs[
"CoolTubeMaterial"];
59 layout = int(nArgs[
"LayoutType"]);
64 LogDebug(
"PixelGeom") <<
"DDPixBarStackLayerAlgo debug: Parent " << parentName
66 <<
"\tLadders " <<
number <<
"\tGeneral Material "
68 <<
sensorEdge <<
"\tSpecification of Cooling Pieces:\n"
70 <<
" Side " <<
coolSide <<
" Thickness of Shell "
74 LogDebug(
"PixelGeom") <<
"DDPixBarStackLayerAlgo debug: Ladder "
85 std::cout <<
"\nAsking for an invalid layout ... Adjusting the number of ladders to compensate.\n";
88 double phi_coverage = 0.0;
90 double dphi = CLHEP::twopi/
number;
92 double radius_offset = 0.0;
93 double deltaX, deltaY;
94 double r_vol_inner = 0.0;
95 double r_vol_outer = 0.0;
96 double phi_coverage_pinn =0.0;
97 double phi_left = 0.0;
98 double phi_right = 0.0;
106 double r_right =
sqrt( d3*d3 + d4*d4 + 2*d3*d4*
sin(phi_offset)) ;
107 phi_right=acos( (r_right*r_right + d3*d3 - d4*d4)/
110 double d5 =
sqrt(d1*d1+d2*d2);
112 double r_left =
sqrt ( d4*d4 + d6*d6 - 2*d4*d6*
sin(phi_offset) ) ;
113 phi_left=acos( (r_left*r_left + d6*d6 - d4*d4)/
116 if (r_right> r_left ) {r_vol_outer=r_right;r_vol_inner=r_left;}
117 if (r_left > r_right) {r_vol_outer=r_left;r_vol_inner=r_right;}
119 phi_coverage_pinn=phi_left+phi_right;
124 phi_coverage_pinn = 0.0;
129 radius_offset = (r1-
r2)/2.0;
137 if(r_vol_inner>r_vol_outer) {
138 r_vol_innerT=r_vol_inner;
139 r_vol_inner=r_vol_outer-30;
140 r_vol_outer=r_vol_innerT+30;
145 int component_copy_no=1;
146 double phi0 = 90*CLHEP::deg;
147 double phi =0*CLHEP::deg;
148 double phix=0*CLHEP::deg;
149 double phiy=0*CLHEP::deg;
171 LogDebug(
"PixelGeom") <<
"DDPixBarStackLayerAlgo test: "
174 <<
" with Rin " << r_vol_inner <<
" Rout " << r_vol_outer
180 name = idName +
"CoolTube";
181 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);
186 LogDebug(
"PixelGeom") <<
"DDPixBarStackLayerAlgo test: " <<solid.
name()
187 <<
" Trap made of " <<
tubeMat <<
" of dimensions "
196 name = idName +
"Coolant";
198 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);
202 LogDebug(
"PixelGeom") <<
"DDPixBarStackLayerAlgo test: " <<solid.
name()
203 <<
" Trap made of " <<
tubeMat <<
" of dimensions "
214 LogDebug(
"PixelGeom") <<
"DDPixBarStackLayerAlgo test: " << cool.name()
215 <<
" number 1 positioned in " << coolTube.name()
216 <<
" at (0,0,0) with no rotation";
231 double phi_coverage_i=0.0;
234 phix = phi + (90*CLHEP::deg) - phi_offset ;
235 phiy = phix + (90*CLHEP::deg) ;
246 name = idName + std::to_string(component_copy_no);
249 cpv.
position (ladderFullDown, layer, component_copy_no, tran, rot);
251 LogDebug(
"PixelGeom") <<
"DDPixBarStackLayerAlgo test: " << ladderFullDown
252 <<
" number " << component_copy_no
253 <<
" positioned in " << layer.
name()
261 name = idName + std::to_string(component_copy_no);
264 cpv.
position (ladderFullUp, layer, component_copy_no, tran, rot);
266 LogDebug(
"PixelGeom") <<
"DDPixBarStackLayerAlgo test: " << ladderFullUp
267 <<
" number " << component_copy_no
268 <<
" positioned in " << layer.
name()
273 phi_coverage_i=phi_coverage_pinn;
278 phi_coverage += phi_coverage_i;
280 if (phi_coverage>CLHEP::twopi&&covered==0) {
288 if (phi_coverage<CLHEP::twopi) {
throw cms::Exception(
"DDPixBarStackLayerAlgo")
289 <<
"\nAsking for a Geometry with gaps in phi.\n";}
297 phix = phi + (90*CLHEP::deg) - phi_offset;
298 phiy = phix + (90*CLHEP::deg) ;
300 deltaX= coolOffset*
cos(90*CLHEP::deg-phi+phi_offset);
301 deltaY= coolOffset*
sin(90*CLHEP::deg-phi+phi_offset);
309 name = idName +
"xxx" + std::to_string(
i+10000);
312 cpv.
position (coolTube, layer,
i+1, tran, rot);
313 LogDebug(
"PixelGeom") <<
"DDPixBarStackLayerAlgo test: " << coolTube.name()
314 <<
" number " <<
i+1 <<
" positioned in "
315 << 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()
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.