Skip to content

Commit 6fa7cda

Browse files
Merge pull request #631 from SBNSoftware/feature/geom_salvage
Geometry v10
2 parents 1c6655c + 638137d commit 6fa7cda

85 files changed

Lines changed: 912 additions & 1379 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

sbndcode/AnalysisTree/AnalysisTree_module.cc

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3677,17 +3677,15 @@ bool sbnd::AnalysisTree::TrackIdToMCTruth( Int_t const trkID, art::Ptr<simb::MCT
36773677
double sbnd::AnalysisTree::bdist(const recob::Track::Point_t& pos)
36783678
{
36793679
// Get geometry.
3680-
art::ServiceHandle<geo::Geometry> geom;
3681-
3680+
geo::TPCGeo const& tpc = art::ServiceHandle<geo::Geometry>()->TPC({0, 0});
36823681
double d1 = pos.X(); // Distance to right side (wires).
3683-
double d2 = 2.*geom->DetHalfWidth() - pos.X(); // Distance to left side (cathode).
3684-
double d3 = pos.Y() + geom->DetHalfHeight(); // Distance to bottom.
3685-
double d4 = geom->DetHalfHeight() - pos.Y(); // Distance to top.
3682+
double d2 = 2.*tpc.HalfWidth() - pos.X(); // Distance to left side (cathode).
3683+
double d3 = pos.Y() + tpc.HalfHeight(); // Distance to bottom.
3684+
double d4 = tpc.HalfHeight() - pos.Y(); // Distance to top.
36863685
double d5 = pos.Z(); // Distance to front.
3687-
double d6 = geom->DetLength() - pos.Z(); // Distance to back.
3686+
double d6 = tpc.Length() - pos.Z(); // Distance to back.
36883687

3689-
double result = std::min(std::min(std::min(std::min(std::min(d1, d2), d3), d4), d5), d6);
3690-
return result;
3688+
return std::min({d1, d2, d3, d4, d5, d6});
36913689
}
36923690

36933691

@@ -3701,16 +3699,14 @@ double sbnd::AnalysisTree::length(const recob::Track& track)
37013699
// Length of MC particle, trajectory by trajectory.
37023700
double sbnd::AnalysisTree::length(const simb::MCParticle& part, TVector3& start, TVector3& end)
37033701
{
3704-
// Get geometry.
3705-
art::ServiceHandle<geo::Geometry> geom;
3706-
37073702
// Get active volume boundary.
3708-
double xmin = -2.0 * geom->DetHalfWidth() - 1e-8;
3709-
double xmax = 2.0 * geom->DetHalfWidth() + 1e-8;
3710-
double ymin = -geom->DetHalfHeight() -1e-8;
3711-
double ymax = geom->DetHalfHeight() + 1e-8;
3703+
geo::TPCGeo const& tpc = art::ServiceHandle<geo::Geometry>()->TPC({0, 0});
3704+
double xmin = -2.0 * tpc.HalfWidth() - 1e-8;
3705+
double xmax = 2.0 * tpc.HalfWidth() + 1e-8;
3706+
double ymin = -tpc.HalfHeight() -1e-8;
3707+
double ymax = tpc.HalfHeight() + 1e-8;
37123708
double zmin = 0. -1e-8;
3713-
double zmax = geom->DetLength() + 1e-8;
3709+
double zmax = tpc.Length() + 1e-8;
37143710

37153711
// Get number traj points
37163712
int n = part.NumberTrajectoryPoints();

sbndcode/AnalysisTree/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ set( MODULE_LIBRARIES larcorealg::Geometry
1313
lardata::RecoObjects
1414
larpandora::LArPandoraInterface
1515
sbndcode_CRTUtils
16-
sbndcode_CRT
1716
sbnobj::Common_CRT
1817
nusimdata::SimulationBase
1918
art::Framework_Core

sbndcode/CRT/CMakeLists.txt

Lines changed: 31 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,37 @@ add_subdirectory(CRTSimulation)
66
add_subdirectory(CRTTPCMatching)
77
add_subdirectory(CRTUtils)
88

9-
art_make(
10-
EXCLUDE
11-
CRTChannelMapAlg.cxx
12-
CRTGeometryHelper_service.cc
13-
LIBRARY_NAME
14-
sbndcode_CRTData
15-
LIB_LIBRARIES
16-
larcorealg::Geometry
17-
larcore::Geometry_Geometry_service
18-
lardataobj::RecoBase
19-
art::Framework_Core
20-
art::Framework_IO_Sources
21-
art::Framework_Principal
22-
canvas::canvas
23-
art::Framework_Services_Registry
24-
messagefacility::MF_MessageLogger
25-
26-
fhiclcpp::fhiclcpp
27-
ROOT::Core
28-
ROOT::Geom
29-
cetlib::cetlib
30-
)
31-
329
art_make_library(
33-
SOURCE CRTChannelMapAlg.cxx
34-
LIBRARIES
35-
larcorealg::Geometry
36-
sbndcode_CRTData
37-
cetlib_except::cetlib_except
38-
messagefacility::MF_MessageLogger
39-
fhiclcpp::fhiclcpp
40-
ROOT::Core
41-
ROOT::Geom
42-
cetlib::cetlib
10+
SOURCE
11+
CRTGeoObjectSorter.cxx
12+
LIBRARY_NAME
13+
sbndcode_CRTData
14+
LIBRARIES
15+
larcorealg::Geometry
16+
larcore::Geometry_Geometry_service
17+
lardataobj::RecoBase
18+
art::Framework_Core
19+
art::Framework_IO_Sources
20+
art::Framework_Principal
21+
canvas::canvas
22+
art::Framework_Services_Registry
23+
messagefacility::MF_MessageLogger
24+
fhiclcpp::fhiclcpp
25+
ROOT::Core
26+
ROOT::Geom
27+
cetlib::cetlib
4328
)
44-
simple_plugin(
45-
CRTGeometryHelper service
46-
sbndcode_CRT
47-
art::Framework_Core
48-
art::Framework_IO_Sources
49-
art::Framework_Principal
50-
canvas::canvas
51-
art::Framework_Services_Registry
52-
messagefacility::MF_MessageLogger
29+
30+
cet_build_plugin( CRTAuxDetInitializer art::tool
31+
LIBRARIES REG
32+
larcorealg::Geometry
33+
sbndcode_CRTData
34+
cetlib_except::cetlib_except
35+
messagefacility::MF_MessageLogger
36+
fhiclcpp::fhiclcpp
37+
cetlib::cetlib
5338
)
39+
40+
install_headers()
41+
install_fhicl()
42+
install_source()
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#include "larcorealg/Geometry/AuxDetGeo.h"
2+
#include "larcorealg/Geometry/AuxDetSensitiveGeo.h"
3+
#include "larcorealg/Geometry/AuxDetGeometryCore.h"
4+
5+
#include "art/Utilities/ToolMacros.h"
6+
7+
namespace {
8+
class CRTAuxDetInitializer : public geo::AuxDetInitializer {
9+
public:
10+
explicit CRTAuxDetInitializer(fhicl::ParameterSet const&) {}
11+
12+
private:
13+
geo::AuxDetReadoutInitializers
14+
initialize(std::vector<geo::AuxDetGeo> const& adgeo) const override
15+
{
16+
geo::AuxDetReadoutInitializers result;
17+
// Map the AuxDetGeo names to their position in the sorted vector
18+
//
19+
// Each tagger is composed of scintillator modules, composed of 16 strips.
20+
// In the geometry, CRTStripArrays are AuxDets and CRTStrips are the
21+
// AuxDetSensitives. Each strip has two SiPM channels, one per optical
22+
// fiber (not in the geometry).
23+
//
24+
25+
for (size_t a=0; a<adgeo.size(); a++){
26+
std::string volName(adgeo[a].TotalVolume()->GetName());
27+
28+
long unsigned int number_scintillating_strips = 0;
29+
30+
if (strncmp(((adgeo[a].TotalVolume())->GetShape())->GetName(), "CRTstripMINOSArray", 18) == 0) {
31+
number_scintillating_strips = 20; //To account for the MINOS modules.
32+
}
33+
else {number_scintillating_strips = 16;}
34+
35+
size_t nsv = adgeo[a].NSensitiveVolume();
36+
if (nsv != number_scintillating_strips) {
37+
throw cet::exception("CRTChannelMap")
38+
<< "Wrong number of sensitive volumes for CRT volume "
39+
<< volName << " (got " << nsv << ", expected 16)" << std::endl;
40+
}
41+
42+
result.ADGeoToName[a] = volName;
43+
result.NameToADGeo[volName] = a;
44+
45+
if (volName.find("CRTStripArray") != std::string::npos) {
46+
for (size_t svID=0; svID<number_scintillating_strips; svID++) {
47+
for (size_t ich=0; ich<2; ich++) {
48+
size_t chID = 2 * svID + ich;
49+
result.ADGeoToChannelAndSV[a].push_back(std::make_pair(chID, svID));
50+
}
51+
}
52+
}
53+
}
54+
return result;
55+
}
56+
};
57+
}
58+
59+
DEFINE_ART_CLASS_TOOL(CRTAuxDetInitializer)

sbndcode/CRT/CRTBackTracker/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ art_make_library(
22
SOURCE CRTBackTrackerAlg.cc
33
LIBRARIES
44
sbnobj::SBND_CRT
5-
sbndcode_GeoWrappers
5+
sbndcode::GeoWrappers
66
larsim::MCCheater_ParticleInventoryService_service
77
)
88

sbndcode/CRT/CRTChannelMapAlg.cxx

Lines changed: 0 additions & 168 deletions
This file was deleted.

0 commit comments

Comments
 (0)