Skip to content

Commit 55a422f

Browse files
committed
Accommodate geometry-refactoring changes
1 parent afd294f commit 55a422f

142 files changed

Lines changed: 1398 additions & 1438 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.

fcl/gen/text/prodtext_standard_icarus.fcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#
2727
# services.Geometry: @erase
2828
# services.GeometryConfigurationWriter: @erase
29-
# services.ExptGeoHelperInterface: @erase
29+
# services.WireReadout: @erase
3030
#
3131
# The output file name will be `prodtext_standard_icarus_%tc-GenText.root`
3232
# (`%tc` being a timestamp assigned by art).

fcl/reco/Stage0/Run1/stage0_run1_icarus_mc.fcl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
process_name: MCstage0
99

1010
## Revert the geometry for now
11-
services.Geometry: @local::icarus_legacy_base_geometry
12-
services.ExptGeoHelperInterface: @local::icarus_legacy_base_geometry_helper
11+
services.Geometry: @local::icarus_legacy_base_geometry
12+
services.WireReadout: @local::icarus_legacy_base_wire_readout
1313

1414
## Add the MC module to the list of producers
1515
physics.producers: { @table::icarus_stage0_producers

icaruscode/Analysis/ICARUSPurityDQM_module.cc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
////////////////////////////////////////////////////////////////////////
32
//
43
// ICARUSPurityDQM class
@@ -33,7 +32,7 @@
3332
//#include "messagefacility/MessageLogger/MessageLogger.h"
3433

3534
//LArSoft includes
36-
#include "larcore/Geometry/Geometry.h"
35+
#include "larcore/Geometry/WireReadout.h"
3736
#include "nusimdata/SimulationBase/MCTruth.h"
3837
#include "nug4/ParticleNavigation/ParticleList.h"
3938
#include "nug4/ParticleNavigation/EmEveIdCalculator.h"
@@ -351,7 +350,7 @@ std::sort(usedhere->begin(),usedhere->end(), [](float &c, float &d){ return c<d;
351350

352351
// //std::cout << " Inizia Purity ICARUS Ana - upgraded by C.FARNESE, WES and OLIVIA " << std::endl;
353352
// code stolen from TrackAna_module.cc
354-
art::ServiceHandle<geo::Geometry> geom;
353+
geo::WireReadoutGeom const& wireReadoutAlg = art::ServiceHandle<geo::WireReadout const>()->Get();
355354
unsigned int fDataSize;
356355
std::vector<short> rawadc; //UNCOMPRESSED ADC VALUES.
357356
// get all hits in the event
@@ -413,7 +412,7 @@ std::sort(usedhere->begin(),usedhere->end(), [](float &c, float &d){ return c<d;
413412
{
414413
raw::ChannelID_t channel = rawDigit->Channel();
415414
////std::cout << channel << std::endl;
416-
std::vector<geo::WireID> wids = geom->ChannelToWire(channel);
415+
std::vector<geo::WireID> wids = wireReadoutAlg.ChannelToWire(channel);
417416
// for now, just take the first option returned from ChannelToWire
418417
geo::WireID wid = wids[0];
419418
// We need to know the plane to look up parameters
@@ -1200,4 +1199,3 @@ namespace icarus{
12001199
DEFINE_ART_MODULE(ICARUSPurityDQM)
12011200

12021201
}
1203-

icaruscode/Analysis/RawDigitAna_module.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,19 +206,19 @@ void RawDigitAna::analyze(const art::Event& event)
206206

207207
// Recover list of simChannels mapped by channel to make
208208
// look up easier below
209-
IRawDigitHistogramTool::SimChannelMap channelMap;
209+
IRawDigitHistogramTool::SimChannelMap wireReadout;
210210

211211
if (simChannelHandle.isValid())
212212
{
213-
for(const auto& simChannel : *simChannelHandle) channelMap[simChannel.Channel()] = &simChannel;
213+
for(const auto& simChannel : *simChannelHandle) wireReadout[simChannel.Channel()] = &simChannel;
214214
}
215215

216216
if (rawDigitHandle.isValid())
217217
{
218218
IRawDigitHistogramTool::RawDigitPtrVec allRawDigitVec;
219219
art::fill_ptr_vector(allRawDigitVec, rawDigitHandle);
220220

221-
for(auto& rawDigitHistTool : fRawDigitHistogramToolVec) rawDigitHistTool->fillHistograms(clockData, detProp, allRawDigitVec,channelMap);
221+
for(auto& rawDigitHistTool : fRawDigitHistogramToolVec) rawDigitHistTool->fillHistograms(clockData, detProp, allRawDigitVec,wireReadout);
222222
}
223223
}
224224

icaruscode/Analysis/TPCPurityMonitor_module.cc

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
#include "cetlib/cpu_timer.h"
3333

3434
// LArSoft includes
35-
#include "larcore/Geometry/Geometry.h"
36-
#include "larcore/CoreUtils/ServiceUtil.h" // lar::providerFrom()
35+
#include "larcore/Geometry/WireReadout.h"
3736
#include "larcoreobj/SimpleTypesAndConstants/geo_types.h"
3837
#include "lardata/DetectorInfoServices/LArPropertiesService.h"
3938
#include "lardata/DetectorInfoServices/DetectorClocksService.h"
@@ -247,7 +246,7 @@ class TPCPurityMonitor : public art::EDProducer
247246
int fNumEvents;
248247

249248
// Other variables that will be shared between different methods.
250-
const geo::GeometryCore* fGeometry; // pointer to Geometry service
249+
geo::WireReadoutGeom const& fChannelMap = art::ServiceHandle<geo::WireReadout>()->Get();
251250
}; // class TPCPurityMonitor
252251

253252
// This macro has to be defined for this module to be invoked from a
@@ -266,8 +265,6 @@ TPCPurityMonitor::TPCPurityMonitor(fhicl::ParameterSet const& parameterSet)
266265
fNumEvents(0)
267266

268267
{
269-
fGeometry = lar::providerFrom<geo::Geometry>();
270-
271268
// We're going to output purity objects
272269
produces<std::vector<anab::TPCPurityInfo>>("",art::Persistable::Yes);
273270

@@ -469,7 +466,7 @@ void TPCPurityMonitor::produce(art::Event& event)
469466
{
470467
geo::Point_t hitPos = track->LocationAtPoint(trkHitIndex);
471468
geo::Vector_t hitDir = track->DirectionAtPoint(trkHitIndex);
472-
const geo::WireGeo& wireGeo = fGeometry->Wire(hitMetaPair.first->WireID());
469+
const geo::WireGeo& wireGeo = fChannelMap.Wire(hitMetaPair.first->WireID());
473470
geo::Vector_t wireDir = wireGeo.Direction();
474471

475472
pointCloud.emplace_back(hitPos);

icaruscode/Analysis/ThroughgoingmuonAnalyzer_module.cc

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030

3131
#include "lardata/DetectorInfoServices/DetectorClocksService.h"
32+
#include "larcore/Geometry/WireReadout.h"
3233
#include "larcore/Geometry/Geometry.h"
3334
#include "larcore/CoreUtils/ServiceUtil.h" // lar::providerFrom()
3435
#include "larcorealg/Geometry/CryostatGeo.h"
@@ -237,6 +238,7 @@ class ThroughgoingmuonAnalyzer : public art::EDAnalyzer
237238

238239
// Useful services, keep copies for now (we can update during begin run periods)
239240
const geo::GeometryCore* fGeometry; ///< pointer to Geometry service
241+
const geo::WireReadoutGeom* fChannelMapAlg; ///< pointer to ChannelMapAlg
240242

241243
// Get geometry.
242244
// art::ServiceHandle<geo::Geometry> geom;
@@ -272,10 +274,11 @@ ThroughgoingmuonAnalyzer::ThroughgoingmuonAnalyzer(fhicl::ParameterSet const& ps
272274
// fHitProducerLabelVec = pset.get< std::vector<art::InputTag>>("HitModuleLabelVec", std::vector<art::InputTag>() = {"gauss"});
273275

274276
fGeometry = lar::providerFrom<geo::Geometry>();
277+
fChannelMapAlg = &art::ServiceHandle<geo::WireReadout const>()->Get();
275278

276279
art::TFileDirectory dir = tfs->mkdir("histos");
277-
fHitEffvselecVec.resize(fGeometry->Nplanes());
278-
for(size_t plane = 0; plane < fGeometry->Nplanes(); plane++)
280+
fHitEffvselecVec.resize(fChannelMapAlg->Nplanes());
281+
for(size_t plane = 0; plane < fChannelMapAlg->Nplanes(); plane++)
279282
{
280283
fHitEffvselecVec.at(plane) = dir.make<TProfile> (("HitEffvselec" + std::to_string(plane)).c_str(), "Hit Efficiency; Total # e-", 200, 0., 200000., 0., 1.);
281284
}
@@ -685,7 +688,7 @@ void ThroughgoingmuonAnalyzer::analyze(art::Event const& evt)
685688
// This is the "correct" way to check and remove bad channels...
686689
if( chanFilt.Status(chanToTDCToIDEMap.first) < fMinAllowedChanStatus)
687690
{
688-
std::vector<geo::WireID> wids = fGeometry->ChannelToWire(chanToTDCToIDEMap.first);
691+
std::vector<geo::WireID> wids = fChannelMapAlg->ChannelToWire(chanToTDCToIDEMap.first);
689692
std::cout << "*** skipping bad channel with status: " << chanFilt.Status(chanToTDCToIDEMap.first)
690693
<< " for channel: " << chanToTDCToIDEMap.first
691694
<< ", plane: " << wids[0].Plane
@@ -713,7 +716,7 @@ void ThroughgoingmuonAnalyzer::analyze(art::Event const& evt)
713716

714717
// The below try-catch block may no longer be necessary
715718
// Decode the channel and make sure we have a valid one
716-
std::vector<geo::WireID> wids = fGeometry->ChannelToWire(chanToTDCToIDEMap.first);
719+
std::vector<geo::WireID> wids = fChannelMapAlg->ChannelToWire(chanToTDCToIDEMap.first);
717720

718721
// Recover plane and wire in the plane
719722
unsigned int plane = wids[0].Plane;
@@ -1469,7 +1472,7 @@ void ThroughgoingmuonAnalyzer::analyze(art::Event const& evt)
14691472

14701473
std::cout << "-- final quick loop to fill summary hists" << std::endl;
14711474

1472-
for(size_t idx = 0; idx < fGeometry->Nplanes();idx++)
1475+
for(size_t idx = 0; idx < fChannelMapAlg->Nplanes();idx++)
14731476
{
14741477
if (nSimChannelHitVec[idx] > 10)
14751478
{

icaruscode/Analysis/WireAna_module.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,16 +200,16 @@ void WireAna::analyze(const art::Event& event)
200200

201201
// Recover list of simChannels mapped by channel to make
202202
// look up easier below
203-
IWireHistogramTool::SimChannelMap channelMap;
203+
IWireHistogramTool::SimChannelMap wireReadout;
204204

205205
if (simChannelHandle.isValid())
206206
{
207-
for(const auto& simChannel : *simChannelHandle) channelMap[simChannel.Channel()] = &simChannel;
207+
for(const auto& simChannel : *simChannelHandle) wireReadout[simChannel.Channel()] = &simChannel;
208208
// {
209209
// raw::ChannelID_t channel = simChannel.Channel();
210210
// const sim::SimChannel* simChannelPtr = &simChannel;
211211
//
212-
// channelMap.at(channel) = simChannelPtr;
212+
// wireReadout.at(channel) = simChannelPtr;
213213
// }
214214
}
215215

@@ -218,7 +218,7 @@ void WireAna::analyze(const art::Event& event)
218218
IWireHistogramTool::WirePtrVec wireVec;
219219
art::fill_ptr_vector(wireVec, wireHandle);
220220

221-
for(auto& wireHistTool : fWireHistogramToolVec) wireHistTool->fillHistograms(wireVec,channelMap,fNumEvents);
221+
for(auto& wireHistTool : fWireHistogramToolVec) wireHistTool->fillHistograms(wireVec,wireReadout,fNumEvents);
222222
}
223223
}
224224

icaruscode/Analysis/tools/BasicHitAnalysis_tool.cc

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
#include "art_root_io/TFileDirectory.h"
99
#include "messagefacility/MessageLogger/MessageLogger.h"
1010

11-
#include "larcore/Geometry/Geometry.h"
12-
#include "larcore/CoreUtils/ServiceUtil.h" // lar::providerFrom()
11+
#include "larcore/Geometry/WireReadout.h"
1312

1413
#include "lardataobj/RecoBase/Hit.h"
1514

@@ -126,9 +125,6 @@ class BasicHitAnalysis : virtual public IHitHistogramTool
126125
TH2D* fSPPHvsWid[3];
127126
TH2D* fSOPHvsWid[3];
128127
TH2D* fPHRatVsIdx[3];
129-
130-
// Useful services, keep copies for now (we can update during begin run periods)
131-
const geo::GeometryCore* fGeometry; ///< pointer to Geometry service
132128
};
133129

134130
//----------------------------------------------------------------------------
@@ -140,8 +136,6 @@ class BasicHitAnalysis : virtual public IHitHistogramTool
140136
///
141137
BasicHitAnalysis::BasicHitAnalysis(fhicl::ParameterSet const & pset)
142138
{
143-
fGeometry = lar::providerFrom<geo::Geometry>();
144-
145139
configure(pset);
146140

147141
// Report.
@@ -172,12 +166,13 @@ void BasicHitAnalysis::initializeHists(art::ServiceHandle<art::TFileService>& tf
172166
// Make a directory for these histograms
173167
art::TFileDirectory dir = tfs->mkdir(dirName.c_str());
174168

175-
fHitsByWire.resize(fGeometry->Nplanes());
169+
auto const& wireReadout = art::ServiceHandle<geo::WireReadout>()->Get();
170+
fHitsByWire.resize(wireReadout.Nplanes());
176171

177172
constexpr geo::TPCID tpcid{0, 0};
178-
auto const n_wires_0 = fGeometry->Nwires(geo::PlaneID{tpcid, 0});
179-
auto const n_wires_1 = fGeometry->Nwires(geo::PlaneID{tpcid, 1});
180-
auto const n_wires_2 = fGeometry->Nwires(geo::PlaneID{tpcid, 2});
173+
auto const n_wires_0 = wireReadout.Nwires(geo::PlaneID{tpcid, 0});
174+
auto const n_wires_1 = wireReadout.Nwires(geo::PlaneID{tpcid, 1});
175+
auto const n_wires_2 = wireReadout.Nwires(geo::PlaneID{tpcid, 2});
181176
fHitsByWire[0] = dir.make<TH1D>("HitsByWire0", ";Wire #", n_wires_0, 0., n_wires_0);
182177
fHitsByWire[1] = dir.make<TH1D>("HitsByWire1", ";Wire #", n_wires_1, 0., n_wires_1);
183178
fHitsByWire[2] = dir.make<TH1D>("HitsByWire2", ";Wire #", n_wires_2, 0., n_wires_2);

icaruscode/Analysis/tools/BasicRawDigitAnalysis_tool.cc

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
#include "art_root_io/TFileDirectory.h"
1010
#include "messagefacility/MessageLogger/MessageLogger.h"
1111

12-
#include "larcore/Geometry/Geometry.h"
13-
#include "larcore/CoreUtils/ServiceUtil.h" // lar::providerFrom()
12+
#include "larcore/Geometry/WireReadout.h"
1413
#include "icaruscode/TPC/Utilities/SignalShapingICARUSService_service.h"
1514
#include "lardataalg/DetectorInfo/DetectorClocks.h"
1615
#include "lardata/DetectorInfoServices/DetectorPropertiesService.h"
@@ -137,7 +136,7 @@ class BasicRawDigitAnalysis : virtual public IRawDigitHistogramTool
137136
FFTPointer fFFT; //< Object to handle thread safe FFT
138137

139138
// Useful services, keep copies for now (we can update during begin run periods)
140-
const geo::GeometryCore& fGeometry; ///< pointer to Geometry service
139+
const geo::WireReadoutGeom& fChannelMapAlg; ///< pointer to ChannelMapAlg
141140
icarusutil::SignalShapingICARUSService& fSignalServices; ///< The signal shaping service
142141
const lariov::DetPedestalProvider& fPedestalRetrievalAlg; ///< Keep track of an instance to the pedestal retrieval alg
143142
};
@@ -151,7 +150,7 @@ class BasicRawDigitAnalysis : virtual public IRawDigitHistogramTool
151150
///
152151
BasicRawDigitAnalysis::BasicRawDigitAnalysis(fhicl::ParameterSet const & pset) :
153152
fCharacterizationAlg(pset.get<fhicl::ParameterSet>("CharacterizationAlg")),
154-
fGeometry(*lar::providerFrom<geo::Geometry>()),
153+
fChannelMapAlg(art::ServiceHandle<geo::WireReadout const>()->Get()),
155154
fSignalServices(*art::ServiceHandle<icarusutil::SignalShapingICARUSService>()),
156155
fPedestalRetrievalAlg(*lar::providerFrom<lariov::DetPedestalService>())
157156
{
@@ -227,7 +226,7 @@ void BasicRawDigitAnalysis::initializeHists(detinfo::DetectorClocksData const& c
227226
fAveFFTImaginaryVec.resize(3);
228227
fAveSmoothPowerVec.resize(3);
229228

230-
for(size_t plane = 0; plane < fGeometry.Nplanes(); plane++)
229+
for(size_t plane = 0; plane < fChannelMapAlg.Nplanes(); plane++)
231230
{
232231
size_t numHists = fHiWireByPlane[plane] - fLoWireByPlane[plane];
233232

@@ -305,7 +304,7 @@ void BasicRawDigitAnalysis::initializeHists(detinfo::DetectorClocksData const& c
305304
fFullRmsHist[plane] = dir.make<TH1D>(histName.c_str(), ";ADC", 100, 0., 20.);
306305

307306
// Need a channel...
308-
raw::ChannelID_t channel = fGeometry.PlaneWireToChannel(geo::WireID(0, 0, plane, 0));
307+
raw::ChannelID_t channel = fChannelMapAlg.PlaneWireToChannel(geo::WireID(0, 0, plane, 0));
309308

310309
// Recover the filter from signal shaping services...
311310
const icarusutil::FrequencyVec& response = fSignalServices.GetResponse(channel).getConvKernel();
@@ -325,7 +324,7 @@ void BasicRawDigitAnalysis::initializeHists(detinfo::DetectorClocksData const& c
325324
void BasicRawDigitAnalysis::fillHistograms(const detinfo::DetectorClocksData& clockData,
326325
const detinfo::DetectorPropertiesData& detProp,
327326
const IRawDigitHistogramTool::RawDigitPtrVec& rawDigitPtrVec,
328-
const IRawDigitHistogramTool::SimChannelMap& channelMap) const
327+
const IRawDigitHistogramTool::SimChannelMap& wireReadout) const
329328
{
330329
// Sadly, the RawDigits come to us in an unsorted condition which is not optimal for
331330
// what we want to do here. So we make a vector of pointers to the input raw digits and sort them
@@ -381,7 +380,7 @@ void BasicRawDigitAnalysis::fillHistograms(const detinfo::DetectorClocksData& cl
381380
// Decode the channel and make sure we have a valid one
382381
std::vector<geo::WireID> wids;
383382
try {
384-
wids = fGeometry.ChannelToWire(channel);
383+
wids = fChannelMapAlg.ChannelToWire(channel);
385384
}
386385
catch(...)
387386
{
@@ -404,7 +403,7 @@ void BasicRawDigitAnalysis::fillHistograms(const detinfo::DetectorClocksData& cl
404403
}
405404

406405
// If MC, does this channel have signal?
407-
bool hasSignal = channelMap.find(channel) != channelMap.end();
406+
bool hasSignal = wireReadout.find(channel) != wireReadout.end();
408407

409408
// vector holding uncompressed adc values
410409
std::vector<short>& rawadc = rawDataWireTimeVec[0];
@@ -570,7 +569,7 @@ void BasicRawDigitAnalysis::endJob(int numEvents)
570569

571570
// A task to complete is to fit the average power displays with aim to develop a "good" filter function and
572571
// get the signal to noise ratio
573-
for(size_t planeIdx = 0; planeIdx < fGeometry.Nplanes(); planeIdx++)
572+
for(size_t planeIdx = 0; planeIdx < fChannelMapAlg.Nplanes(); planeIdx++)
574573
{
575574
TH1* avePowerHist = fAveFFTPowerVec[planeIdx];
576575

icaruscode/Analysis/tools/BasicTrackAnalysis_tool.cc

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
#include "messagefacility/MessageLogger/MessageLogger.h"
1111
#include "canvas/Persistency/Common/FindManyP.h"
1212

13-
#include "larcore/Geometry/Geometry.h"
14-
#include "larcore/CoreUtils/ServiceUtil.h" // lar::providerFrom()
13+
#include "larcore/Geometry/WireReadout.h"
1514

1615
#include "lardataobj/RecoBase/Hit.h"
1716

@@ -96,8 +95,6 @@ class BasicTrackAnalysis : virtual public ITrackHistogramTool
9695
TH2D* fPulseHVsWidth[3];
9796
TProfile* fPulseHVsHitNo[3];
9897

99-
// Useful services, keep copies for now (we can update during begin run periods)
100-
const geo::GeometryCore* fGeometry; ///< pointer to Geometry service
10198
};
10299

103100
//----------------------------------------------------------------------------
@@ -109,8 +106,6 @@ class BasicTrackAnalysis : virtual public ITrackHistogramTool
109106
///
110107
BasicTrackAnalysis::BasicTrackAnalysis(fhicl::ParameterSet const & pset)
111108
{
112-
fGeometry = lar::providerFrom<geo::Geometry>();
113-
114109
configure(pset);
115110

116111
// Report.
@@ -142,9 +137,10 @@ void BasicTrackAnalysis::initializeHists(art::ServiceHandle<art::TFileService>&
142137
// Make a directory for these histograms
143138
art::TFileDirectory dir = tfs->mkdir(dirName.c_str());
144139

145-
auto const n_wires_0 = fGeometry->Nwires(geo::PlaneID{0, 0, 0});
146-
auto const n_wires_1 = fGeometry->Nwires(geo::PlaneID{0, 0, 1});
147-
auto const n_wires_2 = fGeometry->Nwires(geo::PlaneID{0, 0, 2});
140+
auto const& wireReadout = art::ServiceHandle<geo::WireReadout>()->Get();
141+
auto const n_wires_0 = wireReadout.Nwires(geo::PlaneID{0, 0, 0});
142+
auto const n_wires_1 = wireReadout.Nwires(geo::PlaneID{0, 0, 1});
143+
auto const n_wires_2 = wireReadout.Nwires(geo::PlaneID{0, 0, 2});
148144
fHitsByWire[0] = dir.make<TH1D>("HitsByWire0", ";Wire #", n_wires_0, 0., n_wires_0);
149145
fHitsByWire[1] = dir.make<TH1D>("HitsByWire1", ";Wire #", n_wires_1, 0., n_wires_1);
150146
fHitsByWire[2] = dir.make<TH1D>("HitsByWire2", ";Wire #", n_wires_2, 0., n_wires_2);

0 commit comments

Comments
 (0)