48 printout(dd4hep::DEBUG,
"DD4hep_Mask",
"Creating Mask" ) ;
52 const std::string name = xmlMask.nameStr();
55 Assembly envelope( name +
"_assembly" ) ;
60 bool rotationX=
false;
63 dd4hep::xml::Component xmlParameter = xmlMask.child(
_Unicode(parameter));
64 const double crossingAngle = xmlParameter.attr<
double >(
_Unicode(crossingangle))*0.5;
66 if (xmlParameter.hasAttr(
_Unicode(rotationX)))
67 rotationX = xmlParameter.attr<
bool >(
_Unicode(rotationX));
73 bool isSensitive =
false;
75 const double zStart = xmlSection.attr<
double > (
_Unicode(start));
76 const double zEnd = xmlSection.attr<
double > (
_Unicode(end));
77 const double rInnerStart = xmlSection.attr<
double > (
_Unicode(rMin1));
78 const double rInnerEnd = xmlSection.attr<
double > (
_Unicode(rMin2));
79 const double rOuterStart = xmlSection.attr<
double > (
_Unicode(rMax1));
80 const double rOuterEnd = xmlSection.attr<
double > (
_Unicode(rMax2));
81 const double thickness = rOuterStart - rInnerStart;
83 const std::string volName =
"tube_" + xmlSection.nameStr();
86 double phi2 = 360.0*units::degree;
87 if (xmlSection.hasAttr(
_U(phi1)))
88 phi1 = xmlSection.attr<
double > (
_U(phi1));
89 if (xmlSection.hasAttr(
_U(phi2)))
90 phi2 = xmlSection.attr<
double > (
_U(phi2));
92 std::string ssensitive =
"none";
93 if (xmlSection.hasAttr(
_U(sensitive))){
95 ssensitive = xmlSection.attr< std::string > (
_U(sensitive));
96 sens.
setType( xmlSection.attr< std::string > (
_U(sensitive)) );
97 printout(dd4hep::DEBUG,
"sensitive in sens ", ssensitive);
101 std::stringstream pipeInfo;
102 pipeInfo << std::setw(8) << zStart /units::mm
103 << std::setw(8) << zEnd /units::mm
104 << std::setw(8) << rInnerStart /units::mm
105 << std::setw(8) << rInnerEnd /units::mm
106 << std::setw(8) << rOuterStart /units::mm
107 << std::setw(8) << rOuterEnd /units::mm
108 << std::setw(8) << thickness /units::mm
109 << std::setw(8) << crossType
110 << std::setw(35) << volName
111 << std::setw(15) << sectionMat.
name()
112 << std::setw(8) << phi1
113 << std::setw(8) << phi2
114 << std::setw(8) << ssensitive;
116 printout(dd4hep::INFO,
"DD4hep_Mask", pipeInfo.str() );
119 const double zHalf = fabs(zEnd - zStart) * 0.5;
120 const double zPosition = fabs(zEnd + zStart) * 0.5;
124 if (not ODH::checkForSensibleGeometry(crossingAngle, crossType)){
125 throw std::runtime_error(
" Mask_o1_v01_geo.cpp : checkForSensibleGeometry() failed " ) ;
128 const double rotateAngle = getCurrentAngle(crossingAngle, crossType);
129 const double mirrorAngle =
M_PI - rotateAngle;
140 if( rotationX ==
true) {
151 ConeSegment tubeSolid( zHalf, rInnerStart, rOuterStart, rInnerEnd, rOuterEnd , phi1, phi2);
154 Volume tubeLog0( volName, tubeSolid, material ) ;
155 Volume tubeLog1( volName, tubeSolid, material ) ;
157 tubeLog0.setSensitiveDetector(sens);
158 tubeLog1.setSensitiveDetector(sens);
160 tubeLog0.setVisAttributes(description, xmlMask.visStr() );
161 tubeLog1.setVisAttributes(description, xmlMask.visStr() );
164 PlacedVolume placed0 = envelope.placeVolume( tubeLog0, transformer );
165 PlacedVolume placed1 = envelope.placeVolume( tubeLog1, transmirror );
178 const double rUpstreamPunch = rInnerStart;
179 const double rDnstreamPunch = rInnerEnd;
190 ConeSegment wholeSolid( zHalf, 0, rOuterStart, 0, rOuterEnd, phi1, phi2 );
191 Solid tmpSolid0, tmpSolid1, finalSolid0, finalSolid1;
197 if ( rUpstreamPunch > 1e-6 ) {
198 Tube upstreamPunch( 0, rUpstreamPunch, 5 * zHalf, phi1, phi2);
199 tmpSolid0 =
SubtractionSolid( wholeSolid, upstreamPunch, upstreamTransformer);
200 tmpSolid1 =
SubtractionSolid( wholeSolid, upstreamPunch, dnstreamTransformer);
202 tmpSolid0 = wholeSolid;
203 tmpSolid1 = wholeSolid;
206 if (rDnstreamPunch > 1e-6 ) {
207 Tube dnstreamPunch( 0, rDnstreamPunch, 5 * zHalf, phi1, phi2);
208 finalSolid0 =
SubtractionSolid( tmpSolid0, dnstreamPunch, dnstreamTransformer);
209 finalSolid1 =
SubtractionSolid( tmpSolid1, dnstreamPunch, upstreamTransformer);
211 finalSolid0 = tmpSolid0;
212 finalSolid1 = tmpSolid1;
216 Volume tubeLog0( volName +
"_0", finalSolid0, material );
217 Volume tubeLog1( volName +
"_1", finalSolid1, material );
219 tubeLog0.setSensitiveDetector(sens);
220 tubeLog1.setSensitiveDetector(sens);
222 tubeLog0.setVisAttributes(description, xmlMask.visStr() );
223 tubeLog1.setVisAttributes(description, xmlMask.visStr() );
226 PlacedVolume placed0 = envelope.placeVolume( tubeLog0, placementTransformer );
227 PlacedVolume placed1 = envelope.placeVolume( tubeLog1, placementTransmirror );
254 ConeSegment wholeSolid( zHalf, rCenterPunch , rOuterStart, rCenterPunch, rOuterEnd, phi1, phi2);
255 Tube punchSolid( 0, rOffsetPunch, 5 * zHalf, phi1, phi2);
264 Volume tubeLog0( volName +
"_0", finalSolid0, material );
265 Volume tubeLog1( volName +
"_1", finalSolid1, material );
267 tubeLog0.setSensitiveDetector(sens);
268 tubeLog1.setSensitiveDetector(sens);
270 tubeLog0.setVisAttributes(description, xmlMask.visStr() );
271 tubeLog1.setVisAttributes(description, xmlMask.visStr() );
274 PlacedVolume placed0 = envelope.placeVolume( tubeLog0, placementTransformer );
275 PlacedVolume placed1 = envelope.placeVolume( tubeLog1, placementTransmirror );
285 throw std::runtime_error(
" Mask_o1_v01_geo.cpp : fatal failure !! ?? " ) ;
295 pv.addPhysVolID(
"system", xmlMask.id() ) ;
297 tube.setVisAttributes( description, xmlMask.visStr(), envelope );
299 tube.setPlacement(pv);