Skip to content
Open
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
558 changes: 279 additions & 279 deletions CalPatRec/src/CalHelixFinder_module.cc

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions GeometryService/inc/GeometryService.hh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "fhiclcpp/types/Table.h"
#include "cetlib_except/exception.h"

#include "Offline/KinKalGeom/inc/KKMaterial.hh"
#include "Offline/ConfigTools/inc/SimpleConfig.hh"
#include "Offline/Mu2eInterfaces/inc/Detector.hh"
#include "boost/shared_ptr.hpp"
Expand Down Expand Up @@ -48,6 +49,7 @@ public:
fhicl::Atom<std::string> tool_type{Name("tool_type"),"Mu2e"};
};

using KKMaterialConfig = KKMaterial::Config;
struct Config {
using Name=fhicl::Name;
using Comment=fhicl::Comment;
Expand All @@ -60,6 +62,7 @@ public:
fhicl::Atom<bool> printConfig{Name("printConfig"),false};
fhicl::Atom<bool> printConfigTopLevel{Name("printConfigTopLevel"),false};
fhicl::Table<SimulatedDetector> simulatedDetector{Name("simulatedDetector")};
fhicl::Table<KKMaterialConfig> matSettings{Name("KinKalMaterial")};
};

using Parameters= art::ServiceTable<Config>;
Expand Down Expand Up @@ -129,6 +132,7 @@ private:
std::unique_ptr<SimpleConfig> _bfConfig;

const fhicl::ParameterSet _simulatedDetector;
const KKMaterialConfig _kkMat;

// Load G4 geometry options
std::unique_ptr<G4GeometryOptions> _g4GeomOptions;
Expand Down
1 change: 1 addition & 0 deletions GeometryService/inc/KinKalGeomMaker.hh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Original author: Dave Brown (LBNL) 4/2026
//
#include "Offline/KinKalGeom/inc/KinKalGeom.hh"
#include "Offline/KinKalGeom/inc/KKMaterial.hh"
namespace mu2e {
class KinKalGeomMaker {
public:
Expand Down
368 changes: 184 additions & 184 deletions GeometryService/src/GeometryService.cc

Large diffs are not rendered by default.

36 changes: 33 additions & 3 deletions GeometryService/src/KinKalGeomMaker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,41 @@ namespace mu2e {
}

void KinKalGeomMaker::makeDS() {
// currently use hard-coded geometry
auto inner= std::make_shared<Cylinder>(VEC3(0.0,0.0,1.0),VEC3(0.0,0.0,-1482),950,5450);
auto outer= std::make_shared<Cylinder>(VEC3(0.0,0.0,1.0),VEC3(0.0,0.0,-1482),1328,5450); // bounding surfaces
GeomHandle<DetectorSystem> det;
GeomHandle<DetectorSolenoid> ds;
std::cout << "DS Cryo or " << ds->rOut1() << "," << ds->rOut2() << " ir " << ds->rIn1()<<","<< ds->rIn2() << " halfl " << ds->halfLength()
<< " zpos " << ds->position().z() << " material " << ds->material() << std::endl;
std::cout << "DS shield or " << ds->shield_rOut1() << "," << ds->shield_rOut2() << " ir " << ds->shield_rIn1()<<","<< ds->shield_rIn2() << " halfl " << ds->shield_halfLength() << " material " << ds->shield_material() << std::endl;
std::cout << "DS ncoils " << ds->nCoils() << std::endl;
for(size_t icoil = 0; icoil < static_cast<size_t>(ds->nCoils()); icoil++){
std::cout << "DS coil ir " << ds->coil_rIn() << " or " << ds->coil_rOut()[icoil] << " length " << ds->coil_zLength()[icoil] << " zpos " << ds->coil_zPosition()[icoil]
<< " material " << ds->coil_materials()[icoil] << std::endl;
}
//DS Cryo or 1303,1328 ir 950,969.05 halfl 5450 zpos 8689 material StainlessSteel
//DS shield or 1237.3,1250 ir 1010,1022.7 halfl 5287.7 material G4_Al
//DS ncoils 11
//DS coil ir 1050 or 1091 length 419.75 zpos 3539 material DS1CoilMix
//DS coil ir 1050 or 1091 length 419.75 zpos 3964 material DS1CoilMix
//DS coil ir 1050 or 1091 length 419.75 zpos 4389 material DS1CoilMix
//DS coil ir 1050 or 1091 length 419.75 zpos 5042 material DS1CoilMix
//DS coil ir 1050 or 1091 length 362.25 zpos 5699 material DS1CoilMix
//DS coil ir 1050 or 1091 length 362.25 zpos 6369 material DS1CoilMix
//DS coil ir 1050 or 1091 length 362.25 zpos 7176 material DS1CoilMix
//DS coil ir 1050 or 1070.5 length 1777.5 zpos 7949 material DS2CoilMix
//DS coil ir 1050 or 1070.5 length 1777.5 zpos 9761 material DS2CoilMix
//DS coil ir 1050 or 1070.5 length 1777.5 zpos 11544 material DS2CoilMix
//DS coil ir 1050 or 1091 length 362.25 zpos 13326 material DS1CoilMix
//
//
//
//
auto inner= std::make_shared<Cylinder>(VEC3(0.0,0.0,1.0),VEC3(0.0,0.0,-1482),ds->rIn1(),ds->halfLength());
auto outer= std::make_shared<Cylinder>(VEC3(0.0,0.0,1.0),VEC3(0.0,0.0,-1482),ds->rOut2(),ds->halfLength()); // bounding surfaces
auto front= std::make_shared<Disk>(outer->frontDisk());
auto back= std::make_shared<Disk>(outer->backDisk());


// hard-coded for now
auto ipa= std::make_shared<Cylinder>(VEC3(0.0,0.0,1.0),VEC3(0.0,0.0,-2770),300.0,500.0);
auto ipafront= std::make_shared<Disk>(ipa->frontDisk());
auto ipaback= std::make_shared<Disk>(ipa->backDisk());
Expand Down
510 changes: 255 additions & 255 deletions GeometryService/src/ProductionTargetMaker.cc

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions KinKalGeom/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ cet_make_library(
SOURCE
src/CRV.cc
src/KinKalGeom.cc
src/KKMaterial.cc
src/KKStrawMaterial.cc
LIBRARIES PUBLIC
Offline::ConfigTools
KinKal::MatEnv
KinKal::Geometry
KinKal::Trajectory
KinKal::General
Expand Down
4 changes: 2 additions & 2 deletions KinKalGeom/inc/DetectorSolenoid.hh
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ namespace mu2e {
auto const& outerProtonAbsorberPtr() const { return opa_; }
auto const& upstreamAbsorberPtr() const { return tsda_; }
private:
CylPtr inner_; // inner cryostat cylinder
CylPtr outer_; // outer cryostat cylinder
CylPtr inner_; // inner cryostat cylinder boundary
CylPtr outer_; // outer cryostat cylinder boundary
DiskPtr front_; // front (upstream) and back (downstream) of DS
DiskPtr back_;
CylPtr ipa_; // inner proton absorber
Expand Down
30 changes: 23 additions & 7 deletions Mu2eKinKal/inc/KKMaterial.hh → KinKalGeom/inc/KKMaterial.hh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef Mu2eKinKal_KKMaterial_hh
#define Mu2eKinKal_KKMaterial_hh
#ifndef KinKalGeom_KKMaterial_hh
#define KinKalGeom_KKMaterial_hh
//
// build KinKal DetMaterial objects from art parameter configuration
//
Expand All @@ -8,14 +8,19 @@
#include "fhiclcpp/types/Tuple.h"
// KinKal
#include "KinKal/MatEnv/MatDBInfo.hh"
#include "Offline/Mu2eKinKal/inc/KKStrawMaterial.hh"
#include "Offline/Mu2eKinKal/inc/KKFileFinder.hh"
#include "KinKal/MatEnv/FileFinderInterface.hh"
// KKGeom
#include "Offline/KinKalGeom/inc/KKStrawMaterial.hh"
// mu2e
#include "Offline/ConfigTools/inc/ConfigFileLookupPolicy.hh"
#include "Offline/Mu2eInterfaces/inc/Detector.hh"
#include "Offline/Mu2eInterfaces/inc/ProditionsEntity.hh"

#include <memory>
#include <string>

namespace mu2e {
class KKMaterial {
class KKMaterial : public MatEnv::FileFinderInterface, public Detector, public ProditionsEntity {
public:
using Name = fhicl::Name;
using Comment = fhicl::Comment;
Expand All @@ -40,11 +45,22 @@ namespace mu2e {
KKStrawMaterial const& strawMaterial() const;
auto IPAMaterial() const { return matdbinfo_->findDetMaterial(ipamatname_); }
auto STMaterial() const { return matdbinfo_->findDetMaterial(stmatname_); }

// FileFinder interface
std::string matElmDictionaryFileName() const override;
std::string matIsoDictionaryFileName() const override;
std::string matMtrDictionaryFileName() const override;
std::string findFile( std::string const& path ) const override;
private:
KKFileFinder filefinder_; // used to find material info
// material description files base names (not path)
std::string elementsBaseName_;
std::string isotopesBaseName_;
std::string materialsBaseName_;
mutable ConfigFileLookupPolicy policy_;
// specific material names
std::string wallmatname_, gasmatname_, wirematname_,ipamatname_, stmatname_;
mutable std::unique_ptr<MatDBInfo> matdbinfo_; // material database
mutable std::unique_ptr<KKStrawMaterial> smat_; // straw material
mutable std::unique_ptr<KKStrawMaterial> smat_; // straw material; move to KinKalGeom
};
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
#include "KinKal/Trajectory/ClosestApproachData.hh"
#include "Offline/TrackerGeom/inc/StrawProperties.hh"
#include "Offline/Mu2eKinKal/inc/StrawXingUpdater.hh"
#include <memory>

namespace MatEnv {
class MatDBInfo;
Expand All @@ -31,14 +31,14 @@ namespace mu2e {
const std::shared_ptr<DetMaterial> wiremat_);
// construct using materials by name
KKStrawMaterial(MatDBInfo const& matdbinfo,StrawProperties const& sprops,
const std::string& wallmat="straw-wall", const std::string& gasmat="straw-gas", const std::string& wiremat="straw-wire");
const std::string& wallmat, const std::string& gasmat, const std::string& wiremat);
// pathlength through straw components, given closest approach. Return the method used to compute the paths
PathCalc pathLengths(ClosestApproachData const& cadata,StrawXingUpdater const& caconfig, double& wallpath, double& gaspath, double& wirepath) const;
PathCalc pathLengths(ClosestApproachData const& cadata,double nsig, double& wallpath, double& gaspath, double& wirepath,int diag=0) const;
PathCalc averagePathLengths(double& wallpath, double& gaspath, double& wirepath) const;
// transit length given closest approach
double transitLength(ClosestApproachData const& cadata) const;
// find the material crossings given doca and error on doca. Should allow for straw and wire to have different axes TODO
PathCalc findXings(ClosestApproachData const& cadata,StrawXingUpdater const& caconfig, std::vector<MaterialXing>& mxings) const;
// find the material crossings given doca and error on doca. The CA object should be WRT the straw axis, not the wire axis
PathCalc findXings(ClosestApproachData const& cadata, double nsig, std::vector<MaterialXing>& mxings, int diag=0) const;
DetMaterial const& wallMaterial() const { return *wallmat_; }
DetMaterial const& gasMaterial() const { return *gasmat_; }
DetMaterial const& wireMaterial() const { return *wiremat_; }
Expand Down
2 changes: 1 addition & 1 deletion KinKalGeom/inc/KinKalGeom.hh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace mu2e {
using SurfacePairCollection = std::vector<SurfacePair>;
using SurfacePairIter = std::multimap<SurfaceId,SurfacePtr>::const_iterator;
using KKGMap = std::multimap<SurfaceId,SurfacePtr>;
// default constructor, now using GeometryService
// default constructor, now using GeometryService to create content
KinKalGeom();
// accessor to the raw map
auto const& map() const { return map_; }
Expand Down
21 changes: 21 additions & 0 deletions KinKalGeom/inc/ShellMaterial.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// Class modeling a thin material as a surface, material, and thickness. Can be used to create a ShellXing in KKTrack
// Original author: David Brown (LBNL) 5/26
//
#ifndef KinKalGeom_ShellMaterial_hh
#define KinKalGeom_ShellMaterial_hh
#include "Offline/DataProducts/inc/SurfaceId.hh"
#include "KinKal/Geometry/Surface.hh"
#include "KinKal/MatEnv/DetMaterial.hh"

namespace mu2e {
class ShellMaterial {
using SurfacePtr = std::shared_ptr<KinKal::Surface>;
public:
private:

SurfacePtr surf_; // surface for this materia


};
}
17 changes: 12 additions & 5 deletions Mu2eKinKal/src/KKMaterial.cc → KinKalGeom/src/KKMaterial.cc
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#include "Offline/Mu2eKinKal/inc/KKMaterial.hh"
#include "Offline/KinKalGeom/inc/KKMaterial.hh"
#include "Offline/GeometryService/inc/GeomHandle.hh"
#include "Offline/TrackerGeom/inc/Tracker.hh"
#include "KinKal/MatEnv/DetMaterial.hh"
#include "Offline/GeometryService/inc/GeometryService.hh"

namespace mu2e {
using MatDBInfo = MatEnv::MatDBInfo;
using MatEnv::DetMaterial;

KKMaterial::KKMaterial(KKMaterial::Config const& matconfig) :
filefinder_(matconfig.elements(),matconfig.isotopes(),matconfig.materials()),
KKMaterial::KKMaterial(KKMaterial::Config const& matconfig) : ProditionsEntity("KKMaterial"),
elementsBaseName_(matconfig.elements()),
isotopesBaseName_(matconfig.isotopes()),
materialsBaseName_(matconfig.materials()),
wallmatname_(matconfig.strawWallMaterialName()),
gasmatname_(matconfig.strawGasMaterialName()),
wirematname_(matconfig.strawWireMaterialName()),
Expand All @@ -20,7 +21,7 @@ namespace mu2e {
dmconf.scatterfrac_solid_ = matconfig.solidScatter();
dmconf.scatterfrac_gas_ = matconfig.gasScatter();
dmconf.ebrehmsfrac_ = matconfig.eBrehms();
matdbinfo_ = std::make_unique<MatDBInfo>(filefinder_,dmconf);
matdbinfo_ = std::make_unique<MatDBInfo>(*this,dmconf);
}

KKStrawMaterial const& KKMaterial::strawMaterial() const {
Expand All @@ -36,4 +37,10 @@ namespace mu2e {
}
return *smat_;
}

std::string KKMaterial::findFile( std::string const& basename ) const { return policy_( basename ); }
std::string KKMaterial::matElmDictionaryFileName() const { return findFile(elementsBaseName_); }
std::string KKMaterial::matIsoDictionaryFileName() const { return findFile(isotopesBaseName_); }
std::string KKMaterial::matMtrDictionaryFileName() const { return findFile(materialsBaseName_); }

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "Offline/Mu2eKinKal/inc/KKStrawMaterial.hh"
#include "Offline/Mu2eKinKal/inc/StrawXingUpdater.hh"
#include "Offline/KinKalGeom/inc/KKStrawMaterial.hh"
#include "KinKal/MatEnv/DetMaterial.hh"
#include "KinKal/MatEnv/MatDBInfo.hh"
#include "KinKal/Detector/MaterialXing.hh"
Expand Down Expand Up @@ -35,11 +34,11 @@ namespace mu2e {
return KKStrawMaterial::average;
}

KKStrawMaterial::PathCalc KKStrawMaterial::pathLengths(ClosestApproachData const& cadata,StrawXingUpdater const& caconfig,
double& wallpath, double& gaspath, double& wirepath) const {
KKStrawMaterial::PathCalc KKStrawMaterial::pathLengths(ClosestApproachData const& cadata,double nsig,
double& wallpath, double& gaspath, double& wirepath,int diag) const {
wallpath = gaspath = wirepath = 0.0;
PathCalc retval = KKStrawMaterial::unknown;
double docarange = caconfig.nsig_*sqrt(std::max(0.0,cadata.docaVar()));
double docarange = nsig*sqrt(std::max(0.0,cadata.docaVar()));
// if the doca range covers the straw, use the average
double adoca = fabs(cadata.doca());
double mindoca = std::max(0.0,std::min(adoca,irad_)-docarange);
Expand All @@ -58,10 +57,9 @@ namespace mu2e {
if(awall>0.0)wallpath = awall/(omaxdoca-mindoca);
retval = range;
}
if(caconfig.diag_>0){
if(diag>0){
std::cout << "KKStrawMaterial: DOCA " << fabs(cadata.doca()) << " DOCA Var " << cadata.docaVar() << " range [" << mindoca << "," << imaxdoca << "] wall path (mm)" << wallpath << " gas path " << gaspath << " retval " << retval << std::endl;
}

// Model the wire as a diffuse gas, density constrained by DOCA TODO
// 3D pathlength includes projection along straw
double afac = angleFactor(cadata.dirDot());
Expand All @@ -79,15 +77,14 @@ namespace mu2e {
return tlen;
}

KKStrawMaterial::PathCalc KKStrawMaterial::findXings(ClosestApproachData const& cadata,StrawXingUpdater const& caconfig,
std::vector<MaterialXing>& mxings) const {
KKStrawMaterial::PathCalc KKStrawMaterial::findXings(ClosestApproachData const& cadata, double nsig, std::vector<MaterialXing>& mxings, int diag) const {
mxings.clear();
double wallpath, gaspath, wirepath;
auto retval = pathLengths(cadata,caconfig,wallpath, gaspath, wirepath);
auto retval = pathLengths(cadata,nsig,wallpath, gaspath, wirepath,diag);
if(wallpath > 0.0) mxings.push_back(MaterialXing(*wallmat_,wallpath));
if(gaspath > 0.0) mxings.push_back(MaterialXing(*gasmat_,gaspath));
if(wirepath > 0.0) mxings.push_back(MaterialXing(*wiremat_,wirepath));
if(caconfig.diag_ > 1){
if(diag > 1){
std::cout << "Ce wall dE/dx " << wallmat_->energyLoss(105,1.0,0.511) << std::endl;
std::cout << "Ce gas dE/dx " << gasmat_->energyLoss(105,1.0,0.511) << std::endl;
}
Expand Down
3 changes: 3 additions & 0 deletions KinKalGeom/src/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ rootlibs = env['ROOTLIBS']
helper = mu2e_helper(env)

mainlib = helper.make_mainlib([
'mu2e_ConfigTools',
'KinKal_MatEnv',
'KinKal_Geometry',
'KinKal_Trajectory',
'KinKal_General',
Expand All @@ -22,6 +24,7 @@ mainlib = helper.make_mainlib([
'art_Framework_Services_Registry',
'art_Utilities',
'canvas',
'cetlib',
'cetlib_except',
'CLHEP',
'Core',
Expand Down
Loading