Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions DataProducts/inc/SurfaceId.hh
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ namespace mu2e {
CRV_StrongBack=280, // CRV module Al strongback (tracker-side support plate)
DS_HatchConcrete=300, // detector-area hatch concrete block approximation
EMC_Disk_0_Outer=310, EMC_Disk_0_Inner, EMC_Disk_1_Inner, EMC_Disk_1_Outer, // calorimeter disk bounding surfaces
EMC_Disk_0_Front, EMC_Disk_1_Front, EMC_Disk_0_Back, EMC_Disk_1_Back
EMC_Disk_0_Front, EMC_Disk_1_Front, EMC_Disk_0_Back, EMC_Disk_1_Back,
EMC_Disk_0_FrontPanel=320, EMC_Disk_1_FrontPanel, // calorimeter front panel material (index 0-2 = layers, 3 = cooling pipes)
EMC_Disk_0_InnerRing=322, EMC_Disk_1_InnerRing // calorimeter case inner rings (index 0,1 = Al via case front, hole; 2,3 = CF ring via its inner radius, case front; 4 = Al via CF ring inner radius)
};
// Update this counter whenever you add/remove surface IDs from the enum above.
static constexpr std::size_t nSurfaceIds = 72;
static constexpr std::size_t nSurfaceIds = 76;
static std::string const& typeName();
static std::map<enum_type,std::string> const& names();
};
Expand Down
6 changes: 5 additions & 1 deletion DataProducts/src/SurfaceId.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ namespace mu2e {
std::make_pair(SurfaceIdEnum::EMC_Disk_0_Front, "EMC_Disk_0_Front"),
std::make_pair(SurfaceIdEnum::EMC_Disk_1_Front, "EMC_Disk_1_Front"),
std::make_pair(SurfaceIdEnum::EMC_Disk_0_Back, "EMC_Disk_0_Back"),
std::make_pair(SurfaceIdEnum::EMC_Disk_1_Back, "EMC_Disk_1_Back")
std::make_pair(SurfaceIdEnum::EMC_Disk_1_Back, "EMC_Disk_1_Back"),
std::make_pair(SurfaceIdEnum::EMC_Disk_0_FrontPanel, "EMC_Disk_0_FrontPanel"),
std::make_pair(SurfaceIdEnum::EMC_Disk_1_FrontPanel, "EMC_Disk_1_FrontPanel"),
std::make_pair(SurfaceIdEnum::EMC_Disk_0_InnerRing, "EMC_Disk_0_InnerRing"),
std::make_pair(SurfaceIdEnum::EMC_Disk_1_InnerRing, "EMC_Disk_1_InnerRing")
};

constexpr std::size_t nSurfaceIdNames = sizeof(surfaceIdNames)/sizeof(surfaceIdNames[0]);
Expand Down
2 changes: 2 additions & 0 deletions GeometryService/inc/KinKalGeomMaker.hh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <string>
namespace mu2e {
class DetectorSystem;
class CaloG4Info;
class KinKalGeomMaker {
public:
explicit KinKalGeomMaker(int debug) : debug_(debug) {}
Expand All @@ -19,6 +20,7 @@ namespace mu2e {
void makeDS();
void makeTarget();
void makeCalo();
void makeCaloPipes(CaloG4Info const& g4info, SurfaceId const& sid, KinKal::VEC3 const& center);
void makeCRV();
void makePassiveMaterials();
// append one averaged rectangular concrete passive-material plane (see .cc)
Expand Down
3 changes: 3 additions & 0 deletions GeometryService/src/DiskCalorimeterMaker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ namespace mu2e {
calo_->G4Info_.set("FPOuterRadius", config.getDouble("calorimeter.FPOuterRadius") ); //Front plate outer radius
calo_->G4Info_.set("FPFoamZLength", config.getDouble("calorimeter.FPFoamZLength") ); //Thickness of foam inside front plate
calo_->G4Info_.set("FPCarbonZLength", config.getDouble("calorimeter.FPCarbonZLength") ); //Z length of carbon fiber panel on front plate
calo_->G4Info_.set("FPFoamMaterial", config.getString("calorimeter.FPFoamMaterial") ); //Material of foam inside front plate
calo_->G4Info_.set("FPCarbonMaterial", config.getString("calorimeter.FPCarbonMaterial") ); //Material of carbon fiber panels on front plate
calo_->G4Info_.set("innerCFRingMaterial", config.getString("calorimeter.innerCFRingMaterial") ); //Material of carbon fiber ring inside disk
calo_->G4Info_.set("FPCoolPipeTorRadius", config.getDouble("calorimeter.FPCoolPipeTorRadius") ); //Tor radius of front plate outer cooling pipe
calo_->G4Info_.set("FPCoolPipeRadius", config.getDouble("calorimeter.FPCoolPipeRadius") ); //Inner radius of front plate outer cooling pipe
calo_->G4Info_.set("FPCoolPipeThickness", config.getDouble("calorimeter.FPCoolPipeThickness") ); //Thickness of front plate outer cooling pipe
Expand Down
120 changes: 120 additions & 0 deletions GeometryService/src/KinKalGeomMaker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,126 @@ namespace mu2e {
kkg_->map_.emplace(std::make_pair(SurfaceId(SurfaceIdEnum::EMC_Disk_1_Front),std::static_pointer_cast<Surface>(calo.EMC_Disk_1_FrontPtr())));
kkg_->map_.emplace(std::make_pair(SurfaceId(SurfaceIdEnum::EMC_Disk_0_Back),std::static_pointer_cast<Surface>(calo.EMC_Disk_0_BackPtr())));
kkg_->map_.emplace(std::make_pair(SurfaceId(SurfaceIdEnum::EMC_Disk_1_Back),std::static_pointer_cast<Surface>(calo.EMC_Disk_1_BackPtr())));

// Crystal case inner support (see caloBuildCase in Mu2eG4/src/constructDiskCalorimeter.cc): the case runs from the
// crystal caps to the back of the crystals, and holds solid aluminium rings at its front, middle and back, between
// the case inner radius and the carbon fiber ring that separates them from the crystals
auto const& g4info = calo_det.G4Info();
double const capthick = g4info.get<double>("crystalCapZLength");
double const caselen = g4info.get<double>("diskCaseZLength");
double const alrin = g4info.get<double>("diskInAlRingRIn");
double const alzlen = g4info.get<double>("diskInAlRingZLength");
double const cfrin = g4info.get<double>("diskInCFRingRIn");
double const cfrout = g4info.get<double>("diskInCFRingROut");
// KinKal material for the aluminium (G4_Al) rings, named per subsystem like the front panel pipes
std::array<std::string,KKGeom::CaloInnerSupport::nmaterials> const ringmats = {"CaloRingAl",g4info.get<std::string>("innerCFRingMaterial")};
static const SurfaceIdEnum::enum_type ringsid[2] = {SurfaceIdEnum::EMC_Disk_0_InnerRing, SurfaceIdEnum::EMC_Disk_1_InnerRing};
for(int idisk=0; idisk < 2; ++idisk){
using Support = KKGeom::CaloInnerSupport;
double const zfront = toDetectorZ(calo_det.disk(idisk).diskInfo().frontFaceCenter().z() - capthick);
double const zback = zfront + caselen;
double const zmid = 0.5*(zfront+zback);
auto const center = det->toDetector(calo_det.disk(idisk).diskInfo().origin());
Support support(ringsid[idisk],VEC3(center.x(),center.y(),zfront),alrin,cfrin,cfrout,zfront,zback,ringmats);
support.addRing(Support::Ring{alrin,cfrin,zfront,zfront+alzlen,Support::aluminium});
support.addRing(Support::Ring{alrin,cfrin,zmid-0.5*alzlen,zmid+0.5*alzlen,Support::aluminium});
support.addRing(Support::Ring{alrin,cfrin,zback-alzlen,zback,Support::aluminium});
support.addRing(Support::Ring{cfrin,cfrout,zfront,zback,Support::carbon});
kkg_->map_.emplace(std::make_pair(support.surfaceId(Support::alFront),std::static_pointer_cast<Surface>(support.front())));
kkg_->map_.emplace(std::make_pair(support.surfaceId(Support::alHole),std::static_pointer_cast<Surface>(support.inner())));
kkg_->map_.emplace(std::make_pair(support.surfaceId(Support::cfRing),std::static_pointer_cast<Surface>(support.cfInner())));
kkg_->map_.emplace(std::make_pair(support.surfaceId(Support::cfFront),std::static_pointer_cast<Surface>(support.front())));
kkg_->map_.emplace(std::make_pair(support.surfaceId(Support::alRing),std::static_pointer_cast<Surface>(support.cfInner())));
kkg_->caloInnerSupports_.push_back(std::move(support));
}

// Front panel passive material: a carbon fiber / foam / carbon fiber sandwich directly upstream of the
// crystal caps (see caloBuildFrontPlate in Mu2eG4/src/constructDiskCalorimeter.cc). Each layer is an
// annulus carrying its full thickness; index 0 is the upstream carbon skin, 1 the foam, 2 the downstream skin.
// The cooling pipes embedded in the foam (index 3) are described by their centerlines, see makeCaloPipes
if(!g4info.get<bool>("hasFrontPanel")) return;
double const fprin = g4info.get<double>("FPInnerRadius");
double const fprout = g4info.get<double>("FPOuterRadius");
double const carbonthick = g4info.get<double>("FPCarbonZLength");
double const foamthick = g4info.get<double>("FPFoamZLength");
std::string const carbonmat = g4info.get<std::string>("FPCarbonMaterial");
std::string const foammat = g4info.get<std::string>("FPFoamMaterial");
static const SurfaceIdEnum::enum_type fpsid[2] = {SurfaceIdEnum::EMC_Disk_0_FrontPanel, SurfaceIdEnum::EMC_Disk_1_FrontPanel};
for(int idisk=0; idisk < 2; ++idisk){
// the front panel ends where the crystal caps begin
double const fpback = calo_det.disk(idisk).diskInfo().frontFaceCenter().z() - capthick;
double const zlayer[3] = {fpback - 1.5*carbonthick - foamthick, fpback - carbonthick - 0.5*foamthick, fpback - 0.5*carbonthick};
double const thick[3] = {carbonthick, foamthick, carbonthick};
std::string const* mat[3] = {&carbonmat, &foammat, &carbonmat};
for(int ilayer=0; ilayer < 3; ++ilayer){
SurfaceId sid(fpsid[idisk],ilayer);
auto annulus = std::make_shared<Annulus>(VEC3(0.0,0.0,1.0),VEC3(1.0,0.0,0.0),VEC3(0.0,0.0,toDetectorZ(zlayer[ilayer])),fprin,fprout);
kkg_->caloMaterialPlanes_.emplace_back(sid,annulus,*mat[ilayer],thick[ilayer]);
kkg_->map_.emplace(std::make_pair(sid,std::static_pointer_cast<Surface>(annulus)));
}
// the pipe centerlines lie one pipe radius downstream of the upstream face of the foam
double const zpipe = fpback - carbonthick - foamthick + g4info.get<double>("pipeRadius");
auto const center = det->toDetector(calo_det.disk(idisk).diskInfo().origin());
makeCaloPipes(g4info,SurfaceId(fpsid[idisk],3),VEC3(center.x(),center.y(),toDetectorZ(zpipe)));
}
}

// Cooling pipes of a calorimeter front panel, reproducing caloBuildFrontPlate in Mu2eG4/src/constructDiskCalorimeter.cc:
// for each pipe a large torus arc (placed twice, rotated by pi), a small bending torus and a straight section running out
// to the manifold (each placed 4 times, mirrored in x and y), plus the outer manifold torus. G4 rotations by pi about
// z, y and x map (x,y) to (-x,-y), (-x,y) and (x,-y) respectively. Pipe interiors are foam, already in the foam layer.
void KinKalGeomMaker::makeCaloPipes(CaloG4Info const& g4info, SurfaceId const& sid, VEC3 const& center) {
using Pipes = KKGeom::CaloFrontPanelPipes;
double const deg = M_PI/180.0;
int const npipes = g4info.get<int>("nPipes");
double const prout = g4info.get<double>("pipeRadius");
double const prin = prout - g4info.get<double>("pipeThickness");
double const radSmTor = g4info.get<double>("radSmTor");
double const xsmall = g4info.get<double>("xsmall");
double const xdistance = g4info.get<double>("xdistance");
auto const torRadius = g4info.get<std::vector<double>>("pipeTorRadius");
auto const largeTorPhi = g4info.get<std::vector<double>>("largeTorPhi");
auto const smallTorPhi = g4info.get<std::vector<double>>("smallTorPhi");
auto const yposition = g4info.get<std::vector<double>>("yposition");
auto const straightEndPhi = g4info.get<std::vector<double>>("straightEndPhi");
double const coolTorRadius = g4info.get<double>("FPCoolPipeTorRadius");
double const coolrout = g4info.get<double>("FPCoolPipeRadius");
double const coolrin = coolrout - g4info.get<double>("FPCoolPipeThickness");
double const fprin = g4info.get<double>("FPInnerRadius");
double const fprout = g4info.get<double>("FPOuterRadius");
double const cx = center.X(), cy = center.Y();

auto plane = std::make_shared<Annulus>(VEC3(0.0,0.0,1.0),VEC3(1.0,0.0,0.0),center,fprin,coolTorRadius+coolrout);
// KinKal material for the aluminium (G4_Al) pipe walls, named per subsystem like the CRV strongback
Pipes pipes(sid,plane,"CaloPipeAl");
for(int ipipe=0; ipipe < npipes; ++ipipe){
double const angle = 0.5*largeTorPhi.at(ipipe)*deg;
double const sAngle = smallTorPhi.at(ipipe)*deg;
double const sx = xsmall + xdistance*ipipe;
double const sy = yposition.at(ipipe);
double const sephi = straightEndPhi.at(ipipe)*deg;
// large torus
for(double sign : {1.0,-1.0})
pipes.addArc(Pipes::Arc{cx,cy,sign,sign,torRadius.at(ipipe),-angle*0.9975,2*angle*0.9975,prout,prin});
// small bending torus
for(auto const& [xs,ys] : {std::pair(1.0,1.0),std::pair(-1.0,-1.0),std::pair(-1.0,1.0),std::pair(1.0,-1.0)})
pipes.addArc(Pipes::Arc{cx+xs*sx,cy+ys*sy,xs,ys,radSmTor,angle-sAngle+M_PI,sAngle,prout,prin});
// straight section, shortened by 2 mm at each end as in G4
double const xend = (coolTorRadius - coolrout)*std::sin(sephi);
double const yend = (coolTorRadius - coolrout)*std::cos(sephi);
double const xstart = sx - radSmTor*std::cos(sephi);
double const ystart = sy + radSmTor*std::sin(sephi);
double const slen = std::sqrt((xend-xstart)*(xend-xstart) + (yend-ystart)*(yend-ystart));
double const ux = (xend-xstart)/slen, uy = (yend-ystart)/slen;
for(auto const& [xs,ys] : {std::pair(1.0,1.0),std::pair(-1.0,1.0),std::pair(-1.0,-1.0),std::pair(1.0,-1.0)})
pipes.addLine(Pipes::Line{cx+xs*(xstart+2.0*ux),cy+ys*(ystart+2.0*uy),cx+xs*(xend-2.0*ux),cy+ys*(yend-2.0*uy),prout,prin});
}
// manifold torus around the panel, placed rotated by pi about y
double const pipeTotalSep = torRadius.back() - torRadius.front();
double const angMax = 0.5*M_PI - std::asin((g4info.get<double>("pipeInitSeparation")+pipeTotalSep)/fprout) - 0.1;
pipes.addArc(Pipes::Arc{cx,cy,-1.0,1.0,coolTorRadius,angMax,2*M_PI-2*angMax,coolrout,coolrin});
kkg_->map_.emplace(std::make_pair(sid,std::static_pointer_cast<Surface>(plane)));
kkg_->caloFrontPanelPipes_.push_back(std::move(pipes));
}

// sort by transverse distance
Expand Down
2 changes: 2 additions & 0 deletions KinKalGeom/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
cet_make_library(
SOURCE
src/Calo.cc
src/CaloFrontPanelPipes.cc
src/CaloInnerSupport.cc
src/KinKalGeom.cc
src/KKMaterial.cc
src/KKStrawMaterial.cc
Expand Down
53 changes: 53 additions & 0 deletions KinKalGeom/inc/CaloFrontPanelPipes.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//
// Cooling pipes embedded in a calorimeter disk front panel, modeled as thin-walled tubes whose centerlines lie in a
// single z plane. KinKal can't intersect tori, so the pipes are represented by their centerlines (arcs and straight
// segments) in that plane: a track crossing the plane within a tube radius of a centerline crosses the pipe walls.
// The material depth along z is the chord through the tube walls at the crossing point, which is then treated as a
// thin shell by the extrapolation.
// original author: Sophie Middleton (2026)
//
#ifndef KinKalGeom_CaloFrontPanelPipes_hh
#define KinKalGeom_CaloFrontPanelPipes_hh
#include "Offline/DataProducts/inc/SurfaceId.hh"
#include "KinKal/General/Vectors.hh"
#include "KinKal/Geometry/Annulus.hh"
#include <memory>
#include <string>
#include <vector>
namespace mu2e {
namespace KKGeom {
class CaloFrontPanelPipes {
public:
using AnnPtr = std::shared_ptr<KinKal::Annulus>;
// circular arc centerline: points center + (xsign*rtor*cos(phi), ysign*rtor*sin(phi)) for phi in [phi0,phi0+dphi].
// The signs reproduce the pi rotations used to place mirrored copies of the same torus.
struct Arc {
double cx_, cy_, xsign_, ysign_, rtor_, phi0_, dphi_;
double rout_, rin_; // tube outer and inner radius
};
// straight centerline from (x0,y0) to (x1,y1)
struct Line {
double x0_, y0_, x1_, y1_;
double rout_, rin_;
};
CaloFrontPanelPipes(SurfaceId const& sid, AnnPtr const& plane, std::string const& material) :
sid_(sid), plane_(plane), material_(material) {}
void addArc(Arc const& arc) { arcs_.push_back(arc); }
void addLine(Line const& line) { lines_.push_back(line); }
auto const& surfaceId() const { return sid_; }
auto const& plane() const { return plane_; }
auto const& material() const { return material_; }
auto const& arcs() const { return arcs_; }
auto const& lines() const { return lines_; }
// material depth along z (mm) through the pipe walls at a position in the pipe plane; 0 if no pipe is crossed
double wallDepth(KinKal::VEC3 const& pos) const;
private:
SurfaceId sid_;
AnnPtr plane_; // plane containing the pipe centerlines, bounded by the pipe extent
std::string material_; // pipe wall material
std::vector<Arc> arcs_;
std::vector<Line> lines_;
};
}
}
#endif
Loading