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
4 changes: 4 additions & 0 deletions BeamlineGeom/inc/TSdA.hh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ namespace mu2e {
class TSdA : virtual public Detector {
public:

double rIn() const { return _rIn; } // inner (hole) radius

double r4() const { return _r4; }

double halfLength4() const { return _halfLength4; }
Expand All @@ -33,6 +35,8 @@ namespace mu2e {
// Private ctr: the class should be only obtained via TSdA::TSdAMaker.
TSdA();

double _rIn;

double _r4;

double _halfLength4;
Expand Down
2 changes: 1 addition & 1 deletion BeamlineGeom/src/TSdA.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

namespace mu2e {
TSdA::TSdA()
: _r4(0.), _halfLength4(0.0)
: _rIn(0.), _r4(0.), _halfLength4(0.0)
{}
}
3 changes: 2 additions & 1 deletion DataProducts/inc/SurfaceId.hh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace mu2e {
DS_CryoInner, DS_CryoOuter, DS_ShieldInner, DS_ShieldOuter, DS_Coil,
IPA=90, IPA_Front, IPA_Back,
OPA=95, TSDA, // Absorbers in the DS
TS5_Face=97, // disk out to the DS inner radius on the downstream face of the TSDA
ST_Front=100,ST_Back, ST_Inner, ST_Outer, ST_Foils, ST_Wires, // stopping target bounding surfaces and components
TCRV=200, // CRV test plane (deprecated)
CRV_EX=201, CRV_T1, CRV_T2, // keep values 201-203 for extracted geometry compatibility
Expand All @@ -43,7 +44,7 @@ namespace mu2e {
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 = 76;
static constexpr std::size_t nSurfaceIds = 77;
static std::string const& typeName();
static std::map<enum_type,std::string> const& names();
};
Expand Down
1 change: 1 addition & 0 deletions DataProducts/src/SurfaceId.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ namespace mu2e {
std::make_pair(SurfaceIdEnum::IPA_Back, "IPA_Back"),
std::make_pair(SurfaceIdEnum::OPA, "OPA"),
std::make_pair(SurfaceIdEnum::TSDA, "TSDA"),
std::make_pair(SurfaceIdEnum::TS5_Face, "TS5_Face"),
std::make_pair(SurfaceIdEnum::ST_Front, "ST_Front"),
std::make_pair(SurfaceIdEnum::ST_Back, "ST_Back"),
std::make_pair(SurfaceIdEnum::ST_Inner, "ST_Inner"),
Expand Down
3 changes: 2 additions & 1 deletion GeometryService/inc/TSdAMaker.hh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
namespace mu2e { class SimpleConfig; }
namespace mu2e { class TSdA; }
namespace mu2e { class DetectorSolenoid; }
namespace mu2e { class Beamline; }

namespace mu2e {
class TSdAMaker {
public:
static std::unique_ptr<TSdA> make(const SimpleConfig& config, const DetectorSolenoid& ds);
static std::unique_ptr<TSdA> make(const SimpleConfig& config, const DetectorSolenoid& ds, const Beamline& beamline);
};
}

Expand Down
2 changes: 1 addition & 1 deletion GeometryService/src/GeometryService.cc
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ namespace mu2e {
}

if(_config->getBool("hasTSdA",false)){
addDetector( TSdAMaker::make(*_config,ds) );
addDetector( TSdAMaker::make(*_config,ds,beamline) );
}

if(_config->getBool("hasExternalShielding",false)) {
Expand Down
23 changes: 22 additions & 1 deletion GeometryService/src/KinKalGeomMaker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "Offline/GeometryService/inc/DetectorSystem.hh"
#include "Offline/DetectorSolenoidGeom/inc/DetectorSolenoid.hh"
#include "Offline/StoppingTargetGeom/inc/StoppingTarget.hh"
#include "Offline/BeamlineGeom/inc/TSdA.hh"
#include "CLHEP/Vector/ThreeVector.h"
#include "CLHEP/Vector/TwoVector.h"
#include "CLHEP/Vector/Rotation.h"
Expand Down Expand Up @@ -372,7 +373,26 @@ namespace mu2e {
auto ipafront= std::make_shared<KinKal::Disk>(ipa->frontDisk());
auto ipaback= std::make_shared<KinKal::Disk>(ipa->backDisk());
auto opa= std::make_shared<Frustrum>(VEC3(0.0,0.0,1.0),VEC3(0.0,0.0,-3766),454.0,728.4,2125.0); // inner surface
auto tsda= std::make_shared<Annulus>(VEC3(0.0,0.0,1.0),VEC3(1.0,0.0,0.0),VEC3(0.0,0.0,-5967),235.0,525.0); // back surface
// TS downstream absorber (TSDA), from the TSdA geometry. The KinKal TSDA plane is the absorber mid-plane.
// Geometries without a TSdA keep the nominal (TSdA_v02-like) plane, as the upstream extrapolation ends on it.
double tsdaz(-5967.0), tsdarin(235.0), tsdarout(525.0), tsdahalfl(25.4);
art::ServiceHandle<GeometryService> geomService;
if(geomService->hasElement<TSdA>()){
GeomHandle<TSdA> tsdageom;
double zmu2e = tsdageom->position().z();
// version 1 is placed at the front of DS2Vacuum, overriding its configured position (see constructTSdA)
if(tsdageom->version() <= 1) zmu2e = ds->vac_zLocDs23Split() - 2.0*ds->vac_halfLengthDs2() + tsdageom->halfLength4();
tsdaz = toDetectorZ(zmu2e);
tsdarin = tsdageom->rIn();
tsdarout = tsdageom->r4();
tsdahalfl = tsdageom->halfLength4();
}
auto tsda= std::make_shared<Annulus>(VEC3(0.0,0.0,1.0),VEC3(1.0,0.0,0.0),VEC3(0.0,0.0,tsdaz),tsdarin,tsdarout); // mid-plane
// TS5 face: a disk out to the DS inner radius on the downstream face of the TSDA. It is used as a sample surface (KKFit
// SampleSurfaces); the upstream extrapolation ends on the TSDA plane, so it covers the face. A crossing means the extrapolated
// helix reaches the TSDA inside the DS bore; for downstream fits it comes from the backwards extrapolation, so it is not
// by itself a cosmic tag.
auto ts5face= std::make_shared<KinKal::Disk>(VEC3(0.0,0.0,1.0),VEC3(1.0,0.0,0.0),VEC3(0.0,0.0,tsdaz+tsdahalfl),inner->radius());

kkg_->map_.emplace(std::make_pair(SurfaceId(SurfaceIdEnum::DS_Front),std::static_pointer_cast<Surface>(front)));
kkg_->map_.emplace(std::make_pair(SurfaceId(SurfaceIdEnum::DS_Back),std::static_pointer_cast<Surface>(back)));
Expand All @@ -383,6 +403,7 @@ namespace mu2e {
kkg_->map_.emplace(std::make_pair(SurfaceId(SurfaceIdEnum::IPA_Back),std::static_pointer_cast<Surface>(ipaback)));
kkg_->map_.emplace(std::make_pair(SurfaceId(SurfaceIdEnum::OPA),std::static_pointer_cast<Surface>(opa)));
kkg_->map_.emplace(std::make_pair(SurfaceId(SurfaceIdEnum::TSDA),std::static_pointer_cast<Surface>(tsda)));
kkg_->map_.emplace(std::make_pair(SurfaceId(SurfaceIdEnum::TS5_Face),std::static_pointer_cast<Surface>(ts5face)));

kkg_->ds_ = std::make_unique<KKGeom::DetectorSolenoid>(inner, outer, front, back, ipa, ipafront, ipaback, opa, tsda, materialCylinders);
}
Expand Down
12 changes: 11 additions & 1 deletion GeometryService/src/TSdAMaker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "Offline/ConfigTools/inc/checkForStale.hh"
#include "Offline/DetectorSolenoidGeom/inc/DetectorSolenoid.hh"
#include "Offline/BeamlineGeom/inc/TSdA.hh"
#include "Offline/BeamlineGeom/inc/Beamline.hh"
#include "Offline/BeamlineGeom/inc/StraightSection.hh"
#include "Offline/GeometryService/inc/TSdAMaker.hh"

// C++ includes
Expand All @@ -18,12 +20,20 @@

namespace mu2e {

std::unique_ptr<TSdA> TSdAMaker::make(const SimpleConfig& c, const DetectorSolenoid& ds ) {
std::unique_ptr<TSdA> TSdAMaker::make(const SimpleConfig& c, const DetectorSolenoid& ds, const Beamline& beamline ) {

checkForStale( "intneutronabs", c );

std::unique_ptr<TSdA> tsda ( new TSdA() );

// inner radius: the TS5 inner cryostat radius if not provided
tsda->_rIn = c.getDouble("tsda.rin",0.0);
if ( tsda->_rIn < 1.0e-06 ) {
StraightSection const* ts5out = beamline.getTS().getTSCryo<StraightSection>( TransportSolenoid::TSRegion::TS5,
TransportSolenoid::TSRadialPart::IN );
tsda->_rIn = ts5out->rIn();
}

tsda->_r4 = c.getDouble("tsda.r4");

tsda->_halfLength4 = c.getDouble("tsda.halfLength4");
Expand Down
10 changes: 1 addition & 9 deletions Mu2eG4/src/constructTSdA.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ namespace mu2e {
void constructTSdA(SimpleConfig const & _config){

int const verbosityLevel = _config.getInt("tsda.verbosityLevel",0);
double tmpRin = _config.getDouble("tsda.rin",0.0)*CLHEP::mm;


const auto geomOptions = art::ServiceHandle<GeometryService>()->geomOptions();
geomOptions->loadEntry( _config, "tsda", "tsda");
Expand All @@ -71,13 +69,7 @@ namespace mu2e {
GeomHandle<TSdA> atsd;

int version = atsd->version();
if ( tmpRin < 1.0e-06 ) { // just a check for zero
// TS5 outer radius
GeomHandle<Beamline> beamg;
const StraightSection * ts5out = beamg->getTS().getTSCryo<StraightSection>( TransportSolenoid::TSRegion::TS5,
TransportSolenoid::TSRadialPart::IN );
tmpRin = ts5out->rIn();
}
double const tmpRin = atsd->rIn(); // TS5 inner cryostat radius if tsda.rin is not provided
if ( verbosityLevel > 0) {
cout << __func__ << " TSdA rin : "<< tmpRin << endl;
cout << __func__ << " TSdA rout : "<< atsd->r4() << endl;
Expand Down
6 changes: 4 additions & 2 deletions Mu2eKinKal/fcl/prolog.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,9 @@ Mu2eKinKal : {
@table::Mu2eKinKal.KKFIT
MaxSeedStrawHitDt : 200.0 # ns; drop seed hits whose TOCA lands on another turn of the seed helix
AddCaloMaterial : true
SampleSurfaces : ["ST_Outer","ST_Front","ST_Back"] # these are additional surfaces; surfaces used in extrapolation are also sampled
# these are additional surfaces; surfaces used in extrapolation are also sampled. TS5_Face records where the upstream
# extrapolation reaches the TSDA inside the DS bore; for downstream fits it comes from the backwards extrapolation, so it is not by itself a cosmic tag
SampleSurfaces : ["ST_Outer","ST_Front","ST_Back","TS5_Face"]
# save trajectories in the Detector region
SaveDomains : true
SaveTrajectory : Detector
Expand Down Expand Up @@ -666,7 +668,7 @@ Mu2eKinKal : {
}
KKFitSettings: {
@table::Mu2eKinKal.KKFIT
SampleSurfaces : ["ST_Outer","ST_Inner","ST_Front","ST_Back"]
SampleSurfaces : ["ST_Outer","ST_Inner","ST_Front","ST_Back","TS5_Face"]
AddHits : false
SaveDomains : true
SaveTrajectory : Full
Expand Down
5 changes: 3 additions & 2 deletions Mu2eKinKal/inc/KKFit.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1040,10 +1040,11 @@ namespace mu2e {
ranges.push_back(ptraj.range());
}
for(auto range : ranges) {
double tbeg = range.begin();
double tend = range.end();
for(auto const& surf : tosample){
// search for intersections with each surface within the specified time range, going forwards in time
// search for intersections with each surface within the specified time range, going forwards in time.
// Start each surface from the beginning of the range, so an earlier surface's crossings don't hide this one's
double tbeg = range.begin();
bool goodinter(true);
size_t max_inter = 100; // limit the number of intersections
size_t cur_inter = 0;
Expand Down