Skip to content
Snippets Groups Projects

RICH update

Merged Chao Peng requested to merge (removed):rich_update into master
1 file
+ 36
18
Compare changes
  • Side-by-side
  • Inline
+ 36
18
@@ -27,6 +27,10 @@ typedef ROOT::Math::XYPoint Point;
// check if a square in a ring
inline bool in_ring(const Point &pt, double side, double rmin, double rmax)
{
if (pt.r() > rmax || pt.r() < rmin) {
return false;
}
// check four corners
std::vector<Point> pts {
Point(pt.x() - side/2., pt.y() - side/2.),
@@ -35,7 +39,7 @@ inline bool in_ring(const Point &pt, double side, double rmin, double rmax)
Point(pt.x() + side/2., pt.y() + side/2.),
};
for (auto &p : pts) {
if (p.r() > (rmax) || p.r() < (rmin)) {
if (p.r() > rmax || p.r() < rmin) {
return false;
}
}
@@ -172,27 +176,41 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
auto focus = sl.attr<double>(_Unicode(focus));
auto wphi = sl.attr<double>(_Unicode(phiw));
auto rotZ = sl.attr<double>(_Unicode(rotz));
auto radius = sl.attr<double>(_Unicode(curve));
auto mRmin = sl.attr<double>(_Unicode(rmin));
auto mRmax = sl.attr<double>(_Unicode(rmax));
double mTheta1 = std::asin(mRmin/radius);
double mTheta2 = std::asin(mRmax/radius);
double rotY = -std::asin(focus/radius);
// mirror slice shape
// somehow geant4 does not support -wphi/2. to wphi/2., so additonal rotation in Z
Sphere mirShape(radius, radius + mThick, mTheta1, mTheta2, 0., wphi);
Volume mirVol(Form("mirror_v_dummy%d", imod), mirShape, mirMat);
double curve = 0.;
if (sl.hasAttr(_Unicode(curve))) {
curve = sl.attr<double>(_Unicode(curve));
}
// geometry of mirror slice
PlacedVolume mirPV;
Volume mirVol(Form("mirror_v_dummy%d", imod));
mirVol.setMaterial(mirMat);
mirVol.setVisAttributes(desc.visAttributes(mir.visStr()));
// action is in a reverse order
Transform3D tr = Translation3D(0., 0., mirZ - halfLength)
* RotationZ(rotZ)
* RotationY(rotY)
* Translation3D(0., 0., -radius)
* RotationZ(-wphi/2.);
DetElement mirDE(det, Form("Mirror_DE%d", imod), imod);
auto mirPV = envVol.placeVolume(mirVol, tr);
// spherical mirror
if (curve > 0.) {
// somehow geant4 does not support -wphi/2. to wphi/2., so additonal rotation in Z
double mTheta1 = std::asin(mRmin/curve);
double mTheta2 = std::asin(mRmax/curve);
double rotY = -std::asin(focus/curve);
mirVol.setSolid(Sphere(curve, curve + mThick, mTheta1, mTheta2, 0., wphi));
// action is in a reverse order
Transform3D tr = Translation3D(0., 0., mirZ - halfLength) // move for z position
* RotationZ(rotZ) // rotate phi angle
* RotationY(rotY) // rotate for focus point
* Translation3D(0., 0., -curve) // move spherical shell to origin
* RotationZ(-wphi/2.); // center phi angle to 0. (-wphi/2., wphi/2.)
mirPV = envVol.placeVolume(mirVol, tr);
// plane mirror
} else {
mirVol.setSolid(Tube(mRmin, mRmax, mThick/2.0, 0., wphi));
Transform3D tr = Translation3D(0., 0., mirZ - halfLength) // move for z position
* RotationZ(rotZ) // rotate phi angle
* RotationZ(-wphi/2.); // center phi angle to 0. (-wphi/2., wphi/2.)
mirPV =envVol.placeVolume(mirVol, tr);
}
mirPV.addPhysVolID("layer", ilayer).addPhysVolID("module", imod);
DetElement mirDE(det, Form("Mirror_DE%d", imod), imod);
mirDE.setPlacement(mirPV);
SkinSurface mirSurfBorder(desc, mirDE, Form("RICHmirror%d", imod), mirSurf, mirVol);
mirSurfBorder.isValid();
Loading