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
3 changes: 3 additions & 0 deletions fcl/caf/cafmakerjob_icarus_cosmic_detsim2d.fcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "cafmakerjob_icarus_detsim2d.fcl"

physics.producers.cafmaker.SaveGENIEEventRecord: false
2 changes: 1 addition & 1 deletion fcl/gen/text/prodtext_standard_icarus.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#
# services.Geometry: @erase
# services.GeometryConfigurationWriter: @erase
# services.ExptGeoHelperInterface: @erase
# services.WireReadout: @erase
#
# The output file name will be `prodtext_standard_icarus_%tc-GenText.root`
# (`%tc` being a timestamp assigned by art).
Expand Down
4 changes: 2 additions & 2 deletions fcl/reco/Stage0/Run1/stage0_run1_icarus_mc.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
process_name: MCstage0

## Revert the geometry for now
services.Geometry: @local::icarus_legacy_base_geometry
services.ExptGeoHelperInterface: @local::icarus_legacy_base_geometry_helper
services.Geometry: @local::icarus_legacy_base_geometry
services.WireReadout: @local::icarus_legacy_base_wire_readout

## Add the MC module to the list of producers
physics.producers: { @table::icarus_stage0_producers
Expand Down
8 changes: 3 additions & 5 deletions icaruscode/Analysis/ICARUSPurityDQM_module.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

////////////////////////////////////////////////////////////////////////
//
// ICARUSPurityDQM class
Expand Down Expand Up @@ -33,7 +32,7 @@
//#include "messagefacility/MessageLogger/MessageLogger.h"

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

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

}

9 changes: 3 additions & 6 deletions icaruscode/Analysis/TPCPurityMonitor_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
#include "cetlib/cpu_timer.h"

// LArSoft includes
#include "larcore/Geometry/Geometry.h"
#include "larcore/CoreUtils/ServiceUtil.h" // lar::providerFrom()
#include "larcore/Geometry/WireReadout.h"
#include "larcoreobj/SimpleTypesAndConstants/geo_types.h"
#include "lardata/DetectorInfoServices/LArPropertiesService.h"
#include "lardata/DetectorInfoServices/DetectorClocksService.h"
Expand Down Expand Up @@ -247,7 +246,7 @@ class TPCPurityMonitor : public art::EDProducer
int fNumEvents;

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

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

{
fGeometry = lar::providerFrom<geo::Geometry>();

// We're going to output purity objects
produces<std::vector<anab::TPCPurityInfo>>("",art::Persistable::Yes);

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

pointCloud.emplace_back(hitPos);
Expand Down
15 changes: 8 additions & 7 deletions icaruscode/Analysis/ThroughgoingmuonAnalyzer_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@


#include "lardata/DetectorInfoServices/DetectorClocksService.h"
#include "larcore/Geometry/WireReadout.h"
#include "larcore/Geometry/Geometry.h"
#include "larcore/CoreUtils/ServiceUtil.h" // lar::providerFrom()
#include "larcorealg/Geometry/CryostatGeo.h"
Expand Down Expand Up @@ -237,9 +238,8 @@ class ThroughgoingmuonAnalyzer : public art::EDAnalyzer

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

// Get geometry.
// art::ServiceHandle<geo::Geometry> geom;
};


Expand Down Expand Up @@ -272,10 +272,11 @@ ThroughgoingmuonAnalyzer::ThroughgoingmuonAnalyzer(fhicl::ParameterSet const& ps
// fHitProducerLabelVec = pset.get< std::vector<art::InputTag>>("HitModuleLabelVec", std::vector<art::InputTag>() = {"gauss"});

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

art::TFileDirectory dir = tfs->mkdir("histos");
fHitEffvselecVec.resize(fGeometry->Nplanes());
for(size_t plane = 0; plane < fGeometry->Nplanes(); plane++)
fHitEffvselecVec.resize(fChannelMapAlg->Nplanes());
for(size_t plane = 0; plane < fChannelMapAlg->Nplanes(); plane++)
{
fHitEffvselecVec.at(plane) = dir.make<TProfile> (("HitEffvselec" + std::to_string(plane)).c_str(), "Hit Efficiency; Total # e-", 200, 0., 200000., 0., 1.);
}
Expand Down Expand Up @@ -685,7 +686,7 @@ void ThroughgoingmuonAnalyzer::analyze(art::Event const& evt)
// This is the "correct" way to check and remove bad channels...
if( chanFilt.Status(chanToTDCToIDEMap.first) < fMinAllowedChanStatus)
{
std::vector<geo::WireID> wids = fGeometry->ChannelToWire(chanToTDCToIDEMap.first);
std::vector<geo::WireID> wids = fChannelMapAlg->ChannelToWire(chanToTDCToIDEMap.first);
std::cout << "*** skipping bad channel with status: " << chanFilt.Status(chanToTDCToIDEMap.first)
<< " for channel: " << chanToTDCToIDEMap.first
<< ", plane: " << wids[0].Plane
Expand Down Expand Up @@ -713,7 +714,7 @@ void ThroughgoingmuonAnalyzer::analyze(art::Event const& evt)

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

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

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

for(size_t idx = 0; idx < fGeometry->Nplanes();idx++)
for(size_t idx = 0; idx < fChannelMapAlg->Nplanes();idx++)
{
if (nSimChannelHitVec[idx] > 10)
{
Expand Down
8 changes: 4 additions & 4 deletions icaruscode/Analysis/WireAna_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,16 @@ void WireAna::analyze(const art::Event& event)

// Recover list of simChannels mapped by channel to make
// look up easier below
IWireHistogramTool::SimChannelMap channelMap;
IWireHistogramTool::SimChannelMap wireReadout;

if (simChannelHandle.isValid())
{
for(const auto& simChannel : *simChannelHandle) channelMap[simChannel.Channel()] = &simChannel;
for(const auto& simChannel : *simChannelHandle) wireReadout[simChannel.Channel()] = &simChannel;
// {
// raw::ChannelID_t channel = simChannel.Channel();
// const sim::SimChannel* simChannelPtr = &simChannel;
//
// channelMap.at(channel) = simChannelPtr;
// wireReadout.at(channel) = simChannelPtr;
// }
}

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

for(auto& wireHistTool : fWireHistogramToolVec) wireHistTool->fillHistograms(wireVec,channelMap,fNumEvents);
for(auto& wireHistTool : fWireHistogramToolVec) wireHistTool->fillHistograms(wireVec,wireReadout,fNumEvents);
}
}

Expand Down
17 changes: 6 additions & 11 deletions icaruscode/Analysis/tools/BasicHitAnalysis_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
#include "art_root_io/TFileDirectory.h"
#include "messagefacility/MessageLogger/MessageLogger.h"

#include "larcore/Geometry/Geometry.h"
#include "larcore/CoreUtils/ServiceUtil.h" // lar::providerFrom()
#include "larcore/Geometry/WireReadout.h"

#include "lardataobj/RecoBase/Hit.h"

Expand Down Expand Up @@ -126,9 +125,6 @@ class BasicHitAnalysis : virtual public IHitHistogramTool
TH2D* fSPPHvsWid[3];
TH2D* fSOPHvsWid[3];
TH2D* fPHRatVsIdx[3];

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

//----------------------------------------------------------------------------
Expand All @@ -140,8 +136,6 @@ class BasicHitAnalysis : virtual public IHitHistogramTool
///
BasicHitAnalysis::BasicHitAnalysis(fhicl::ParameterSet const & pset)
{
fGeometry = lar::providerFrom<geo::Geometry>();

configure(pset);

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

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

constexpr geo::TPCID tpcid{0, 0};
auto const n_wires_0 = fGeometry->Nwires(geo::PlaneID{tpcid, 0});
auto const n_wires_1 = fGeometry->Nwires(geo::PlaneID{tpcid, 1});
auto const n_wires_2 = fGeometry->Nwires(geo::PlaneID{tpcid, 2});
auto const n_wires_0 = wireReadout.Nwires(geo::PlaneID{tpcid, 0});
auto const n_wires_1 = wireReadout.Nwires(geo::PlaneID{tpcid, 1});
auto const n_wires_2 = wireReadout.Nwires(geo::PlaneID{tpcid, 2});
fHitsByWire[0] = dir.make<TH1D>("HitsByWire0", ";Wire #", n_wires_0, 0., n_wires_0);
fHitsByWire[1] = dir.make<TH1D>("HitsByWire1", ";Wire #", n_wires_1, 0., n_wires_1);
fHitsByWire[2] = dir.make<TH1D>("HitsByWire2", ";Wire #", n_wires_2, 0., n_wires_2);
Expand Down
15 changes: 7 additions & 8 deletions icaruscode/Analysis/tools/BasicRawDigitAnalysis_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#include "art_root_io/TFileDirectory.h"
#include "messagefacility/MessageLogger/MessageLogger.h"

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

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

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

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

// Need a channel...
raw::ChannelID_t channel = fGeometry.PlaneWireToChannel(geo::WireID(0, 0, plane, 0));
raw::ChannelID_t channel = fChannelMapAlg.PlaneWireToChannel(geo::WireID(0, 0, plane, 0));

// Recover the filter from signal shaping services...
const icarusutil::FrequencyVec& response = fSignalServices.GetResponse(channel).getConvKernel();
Expand Down Expand Up @@ -381,7 +380,7 @@ void BasicRawDigitAnalysis::fillHistograms(const detinfo::DetectorClocksData& cl
// Decode the channel and make sure we have a valid one
std::vector<geo::WireID> wids;
try {
wids = fGeometry.ChannelToWire(channel);
wids = fChannelMapAlg.ChannelToWire(channel);
}
catch(...)
{
Expand Down Expand Up @@ -570,7 +569,7 @@ void BasicRawDigitAnalysis::endJob(int numEvents)

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

Expand Down
14 changes: 5 additions & 9 deletions icaruscode/Analysis/tools/BasicTrackAnalysis_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#include "messagefacility/MessageLogger/MessageLogger.h"
#include "canvas/Persistency/Common/FindManyP.h"

#include "larcore/Geometry/Geometry.h"
#include "larcore/CoreUtils/ServiceUtil.h" // lar::providerFrom()
#include "larcore/Geometry/WireReadout.h"

#include "lardataobj/RecoBase/Hit.h"

Expand Down Expand Up @@ -96,8 +95,6 @@ class BasicTrackAnalysis : virtual public ITrackHistogramTool
TH2D* fPulseHVsWidth[3];
TProfile* fPulseHVsHitNo[3];

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

//----------------------------------------------------------------------------
Expand All @@ -109,8 +106,6 @@ class BasicTrackAnalysis : virtual public ITrackHistogramTool
///
BasicTrackAnalysis::BasicTrackAnalysis(fhicl::ParameterSet const & pset)
{
fGeometry = lar::providerFrom<geo::Geometry>();

configure(pset);

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

auto const n_wires_0 = fGeometry->Nwires(geo::PlaneID{0, 0, 0});
auto const n_wires_1 = fGeometry->Nwires(geo::PlaneID{0, 0, 1});
auto const n_wires_2 = fGeometry->Nwires(geo::PlaneID{0, 0, 2});
auto const& wireReadout = art::ServiceHandle<geo::WireReadout>()->Get();
auto const n_wires_0 = wireReadout.Nwires(geo::PlaneID{0, 0, 0});
auto const n_wires_1 = wireReadout.Nwires(geo::PlaneID{0, 0, 1});
auto const n_wires_2 = wireReadout.Nwires(geo::PlaneID{0, 0, 2});
fHitsByWire[0] = dir.make<TH1D>("HitsByWire0", ";Wire #", n_wires_0, 0., n_wires_0);
fHitsByWire[1] = dir.make<TH1D>("HitsByWire1", ";Wire #", n_wires_1, 0., n_wires_1);
fHitsByWire[2] = dir.make<TH1D>("HitsByWire2", ";Wire #", n_wires_2, 0., n_wires_2);
Expand Down
11 changes: 5 additions & 6 deletions icaruscode/Analysis/tools/BasicWireAnalysis_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#include "art_root_io/TFileDirectory.h"
#include "messagefacility/MessageLogger/MessageLogger.h"

#include "larcore/Geometry/Geometry.h"
#include "larcore/CoreUtils/ServiceUtil.h" // lar::providerFrom()
#include "larcore/Geometry/WireReadout.h"
#include "larevt/CalibrationDBI/Interface/DetPedestalService.h"
#include "larevt/CalibrationDBI/Interface/DetPedestalProvider.h"
#include "larreco/HitFinder/HitFinderTools/IWaveformTool.h"
Expand Down Expand Up @@ -150,7 +149,7 @@ class BasicWireAnalysis : virtual public IWireHistogramTool
art::TFileDirectory* fHistDirectory;

// Useful services, keep copies for now (we can update during begin run periods)
const geo::GeometryCore& fGeometry; ///< pointer to Geometry service
const geo::WireReadoutGeom& fChannelMapAlg;
icarusutil::SignalShapingICARUSService& fSignalServices; ///< The signal shaping service
const lariov::DetPedestalProvider& fPedestalRetrievalAlg; ///< Keep track of an instance to the pedestal retrieval alg
};
Expand All @@ -163,7 +162,7 @@ class BasicWireAnalysis : virtual public IWireHistogramTool
/// pset - Fcl parameters.
///
BasicWireAnalysis::BasicWireAnalysis(fhicl::ParameterSet const & pset) :
fGeometry(*lar::providerFrom<geo::Geometry>()),
fChannelMapAlg(art::ServiceHandle<geo::WireReadout const>()->Get()),
fSignalServices(*art::ServiceHandle<icarusutil::SignalShapingICARUSService>()),
fPedestalRetrievalAlg(*lar::providerFrom<lariov::DetPedestalService>())
{
Expand Down Expand Up @@ -222,7 +221,7 @@ void BasicWireAnalysis::initializeHists(art::ServiceHandle<art::TFileService>& t
fDeltaTicksHist.resize(3);
fRangeHist.resize(3);

for(size_t plane = 0; plane < fGeometry.Nplanes(); plane++)
for(size_t plane = 0; plane < fChannelMapAlg.Nplanes(); plane++)
{
std::string histName = "TruncMean_" + std::to_string(plane);

Expand Down Expand Up @@ -272,7 +271,7 @@ void BasicWireAnalysis::fillHistograms(const IWireHistogramTool::WirePtrVec&
raw::ChannelID_t channel = wire->Channel();

// Try to limit to the wire number (since we are already segregated by plane)
std::vector<geo::WireID> wids = fGeometry.ChannelToWire(channel);
std::vector<geo::WireID> wids = fChannelMapAlg.ChannelToWire(channel);
size_t cryo = wids[0].Cryostat;
size_t tpc = wids[0].TPC;
size_t plane = wids[0].Plane;
Expand Down
Loading