Commit a809fd03 authored by Chao Peng's avatar Chao Peng
Browse files

use a union envelope

parent 2f6c39f4
......@@ -143,18 +143,26 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
auto mcpMat = desc.material(mcp.materialStr());
// an envelope for the detector
// use a complicated shape to avoid conflict with the other parts
// cone for radiator and the first set of mirrors
double halfLength = 0.5 * (mirZ + 5.0*cm);
double rmin = std::min(pRmin, tRmin);
double rmax = std::max(std::max(pRmax, tRmax2), tRmax1);
double rmin = tRmin;
double rmax = tRmax2;
for (xml::Collection_t sl(mir, _Unicode(slice)); sl; ++sl) {
auto mRmin = sl.attr<double>(_Unicode(rmin));
auto mRmax = sl.attr<double>(_Unicode(rmax));
if (mRmin < rmin) { rmin = mRmin; }
if (mRmax > rmax) { rmax = mRmax; }
}
Tube envShape(std::max(0., rmin - 0.1*cm), rmax + 0.1*cm, halfLength, 0., 2*M_PI);
rmin = std::max(0., rmin - 0.1*cm);
Cone env1(halfLength, rmin, tRmax1 + 0.1*cm , rmin, rmax + 0.1*cm);
// disk for detection plane
Tube env2(std::max(0., pRmin - 0.1*cm), pRmax + 0.1*cm, pThick + 0.1*cm, 0., 2.*M_PI);
UnionSolid envShape(env1, env2, Position(0., 0., pZ + pThick/2.));
Volume envVol(detName + "_envelope", envShape, desc.material("AirOptical"));
envVol.setVisAttributes(desc.visAttributes(detElem.visStr()));
// envVol.setVisAttributes(desc.visAttributes(detElem.visStr()));
// ---------------
// Gas radiator container and spherical mirrors inside it
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment