Skip to content

Commit 7e522ba

Browse files
authored
Merge pull request #498 from SBNSoftware/feature/usher_fixcluster3dsegfault
Fix of segfault in cluster3d
2 parents 694ada1 + b9c462b commit 7e522ba

1 file changed

Lines changed: 20 additions & 17 deletions

File tree

sbncode/Cluster3D/SnippetHit3DBuilderSBN_tool.cc

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
// LArSoft includes
2626
#include "larcore/Geometry/Geometry.h"
2727
#include "larcore/Geometry/WireReadout.h"
28+
#include "larcorealg/Geometry/WireReadoutGeom.h"
2829
#include "lardata/ArtDataHelper/HitCreator.h"
2930
#include "lardata/DetectorInfoServices/DetectorClocksService.h"
3031
#include "lardata/DetectorInfoServices/DetectorPropertiesService.h"
@@ -369,6 +370,7 @@ void SnippetHit3DBuilderSBN::configure(fhicl::ParameterSet const &pset)
369370
m_outputHistograms = pset.get<bool >("OutputHistograms", false);
370371
m_makeAssociations = pset.get<bool >("MakeAssociations", false);
371372

373+
m_geometry = art::ServiceHandle<geo::Geometry const>{}.get();
372374
m_wireReadout = &art::ServiceHandle<geo::WireReadout const>{}->Get();
373375

374376
// Returns the wire pitch per plane assuming they will be the same for all TPCs
@@ -1822,27 +1824,28 @@ void SnippetHit3DBuilderSBN::CollectArtHits(const art::Event& evt) const
18221824
std::map<geo::PlaneID,double> planeIDToPositionMap;
18231825

18241826
// Initialize the plane to hit vector map
1825-
for(auto const& tpcID : m_geometry->Iterate<geo::TPCID>())
1827+
for(auto const& tpcGeo : m_geometry->Iterate<geo::TPCGeo>())
18261828
{
1827-
m_planeToSnippetHitMap[geo::PlaneID(tpcID,0)] = SnippetHitMap();
1828-
m_planeToSnippetHitMap[geo::PlaneID(tpcID,1)] = SnippetHitMap();
1829-
m_planeToSnippetHitMap[geo::PlaneID(tpcID,2)] = SnippetHitMap();
1829+
m_planeToSnippetHitMap[geo::PlaneID(tpcGeo.ID(),0)] = SnippetHitMap();
1830+
m_planeToSnippetHitMap[geo::PlaneID(tpcGeo.ID(),1)] = SnippetHitMap();
1831+
m_planeToSnippetHitMap[geo::PlaneID(tpcGeo.ID(),2)] = SnippetHitMap();
18301832

1831-
// Should we provide output?
1832-
if (!m_weHaveAllBeenHereBefore)
1833-
{
1834-
std::ostringstream outputString;
1833+
// Should we provide output?
1834+
if (!m_weHaveAllBeenHereBefore)
1835+
{
1836+
std::ostringstream outputString;
18351837

1836-
outputString << "***> plane 0 offset: " << m_PlaneToT0OffsetMap.find(geo::PlaneID(tpcID,0))->second
1837-
<< ", plane 1: " << m_PlaneToT0OffsetMap.find(geo::PlaneID(tpcID,1))->second
1838-
<< ", plane 2: " << m_PlaneToT0OffsetMap.find(geo::PlaneID(tpcID,2))->second << "\n";
1839-
outputString << " Det prop plane 0: " << det_prop.GetXTicksOffset(geo::PlaneID(tpcID,0)) << ", plane 1: " << det_prop.GetXTicksOffset(geo::PlaneID(tpcID,1)) << ", plane 2: " << det_prop.GetXTicksOffset(geo::PlaneID(tpcID,2)) << ", Trig: " << trigger_offset(clock_data) << "\n";
1840-
debugMessage += outputString.str() + "\n";
1841-
}
1838+
outputString << "***> plane 0 offset: " << m_PlaneToT0OffsetMap.find(geo::PlaneID(tpcGeo.ID(),0))->second
1839+
<< ", plane 1: " << m_PlaneToT0OffsetMap.find(geo::PlaneID(tpcGeo.ID(),1))->second
1840+
<< ", plane 2: " << m_PlaneToT0OffsetMap.find(geo::PlaneID(tpcGeo.ID(),2))->second << "\n";
1841+
outputString << " Det prop plane 0: " << det_prop.GetXTicksOffset(geo::PlaneID(tpcGeo.ID(),0)) << ", plane 1: " << det_prop.GetXTicksOffset(geo::PlaneID(tpcGeo.ID(),1)) << ", plane 2: " << det_prop.GetXTicksOffset(geo::PlaneID(tpcGeo.ID(),2)) << ", Trig: " << trigger_offset(clock_data) << "\n";
1842+
1843+
debugMessage += outputString.str() + "\n";
1844+
}
18421845

1843-
geo::PlaneID const planeID2{tpcID, 2};
1844-
double xPosition(det_prop.ConvertTicksToX(0., planeID2));
1845-
planeIDToPositionMap[planeID2] = xPosition;
1846+
geo::PlaneID const planeID2{tpcGeo.ID(), 2};
1847+
double xPosition(det_prop.ConvertTicksToX(0., planeID2));
1848+
planeIDToPositionMap[planeID2] = xPosition;
18461849
}
18471850

18481851
if (!m_weHaveAllBeenHereBefore)

0 commit comments

Comments
 (0)