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
488 changes: 183 additions & 305 deletions GeometryService/src/KinKalGeomMaker.cc

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions KinKalGeom/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,22 @@ cet_make_library(
src/KKStrawMaterial.cc
LIBRARIES PUBLIC
Offline::ConfigTools
Offline::DataProducts
KinKal::MatEnv
KinKal::Geometry
KinKal::Trajectory
KinKal::General
Offline::GeneralUtilities
)

cet_build_plugin(KinKalGeomCheck art::module
REG_SOURCE src/KinKalGeomCheck_module.cc
LIBRARIES REG
Offline::KinKalGeom
Offline::GeometryService
ROOT::Geom
)

install_source(SUBDIRS src)
install_headers(USE_PROJECT_NAME SUBDIRS inc)
install_fhicl(SUBDIRS fcl SUBDIRNAME Offline/KinKalGeom/fcl)
20 changes: 20 additions & 0 deletions KinKalGeom/fcl/kinkalGeomCheck.fcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Consistency check of the KinKalGeom passive material (module KinKalGeomCheck) for the default geometry. The job fails
# on overlapping elements or coplanar same-material planes. kinkalGeomCheckG4.fcl adds the comparison with G4.
#include "Offline/fcl/standardServices.fcl"

process_name : KinKalGeomCheck

source : {
module_type : EmptyEvent
maxEvents : 1
}

services : @local::Services.Core

physics : {
analyzers : {
KinKalGeomCheck : { module_type : KinKalGeomCheck }
}
checkPath : [ KinKalGeomCheck ]
end_paths : [ checkPath ]
}
4 changes: 4 additions & 0 deletions KinKalGeom/fcl/kinkalGeomCheckG4.fcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# KinKalGeomCheck including the comparison with the G4 geometry, read from the GDML file that
# "mu2e -c Offline/Mu2eG4/fcl/gdmldump.fcl" writes for the same geometry (mu2e_common.gdml in the current directory).
#include "Offline/KinKalGeom/fcl/kinkalGeomCheck.fcl"
physics.analyzers.KinKalGeomCheck.gdmlFile : "mu2e_common.gdml"
3 changes: 3 additions & 0 deletions KinKalGeom/fcl/kinkalGeomCheck_run2.fcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# KinKalGeomCheck for the Run 2 geometry
#include "Offline/KinKalGeom/fcl/kinkalGeomCheck.fcl"
services.GeometryService.inputFile : "Offline/Mu2eG4/geom/geom_run2.txt"
28 changes: 27 additions & 1 deletion KinKalGeom/inc/CRV.hh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,42 @@
#ifndef KinKalGeom_CRV_hh
#define KinKalGeom_CRV_hh
#include "KinKal/Geometry/Rectangle.hh"
#include "KinKal/General/Vectors.hh"
#include <cmath>
#include <string>
#include <utility>
#include <vector>
#include <memory>
namespace mu2e {
namespace KKGeom {
using RecPtr = std::shared_ptr<KinKal::Rectangle>;
// one scintillator layer of a sector: its offset from the sector midplane and the spans its bars cover across the bars
struct KKCRVLayer {
double w_ = 0.0; // layer center along the sector normal, relative to the sector midplane (mm)
std::vector<std::pair<double,double>> v_; // [low,high] along the sector vDirection, relative to the sector center (mm), one per module
};
struct KKCRVSector {
std::string sname_;
RecPtr sector_;
RecPtr sector_; // midplane, spanning every layer: adjacent sectors overlap where their staggered layers interleave
double whw_;
std::vector<KKCRVLayer> layers_;
// fraction of the layers that a straight line through pos (on the midplane) along dir crosses; 1 if no layers are given
double layerFraction(KinKal::VEC3 const& pos, KinKal::VEC3 const& dir) const;
};
inline double KKCRVSector::layerFraction(KinKal::VEC3 const& pos, KinKal::VEC3 const& dir) const {
if(layers_.empty()) return 1.0;
double const dw = dir.Dot(sector_->normal());
double const slope = std::fabs(dw) > 1.0e-6 ? dir.Dot(sector_->vDirection())/dw : 0.0; // dv/dw along the line
double const v0 = (pos - sector_->center()).Dot(sector_->vDirection());
unsigned ncross = 0;
for(auto const& layer : layers_){
double const v = v0 + slope*layer.w_;
for(auto const& span : layer.v_){
if(v >= span.first && v <= span.second){ ++ncross; break; }
}
}
return ncross/double(layers_.size());
}
class CRV {
public:
// construct with rectangles representing the midplane of CRV sectors (shields)
Expand Down
Loading