8 #include "art/Utilities/ToolMacros.h"
9 #include "art/Utilities/make_tool.h"
10 #include "art_root_io/TFileService.h"
11 #include "messagefacility/MessageLogger/MessageLogger.h"
12 #include "cetlib_except/exception.h"
34 void configure(
const fhicl::ParameterSet& pset)
override;
55 std::cout <<
"*** In ROIFromDecoder constructor ***" << std::endl;
66 fROILabelVec = pset.get<std::vector<art::InputTag>>(
"ROILabelVec", {
""});
88 std::cout <<
"Can't happen? for planeID: " << planeID << std::endl;
92 art::InputTag roiLabel(
"");
96 if (tag.instance().find(tpcItr->second) != std::string::npos)
109 art::Handle< std::vector<recob::Wire>> wireVecHandle;
111 event.getByLabel(roiLabel, wireVecHandle);
116 std::unordered_map<raw::ChannelID_t,const recob::Wire*> channelToWireMap;
118 for(
const auto& wireData : *wireVecHandle)
122 for(
const auto& wireID : wireIDVec)
124 if (wireID.asPlaneID() != planeID)
continue;
126 if (wireID.Wire > outputROIs.size())
128 std::cout <<
"#################################### Wire out of bounds! Wire: " << wireID.Wire <<
", max: " << outputROIs.size() <<
" #################" << std::endl;
132 channelToWireMap[wireData.Channel()] = &wireData;
137 for(
size_t channelIdx = 0; channelIdx < channelVec.size(); channelIdx++)
141 std::unordered_map<raw::ChannelID_t,const recob::Wire*>::const_iterator wireItr = channelToWireMap.find(channel);
143 if (wireItr != channelToWireMap.end())
150 for(
const auto& wireID : wireIDVec)
152 if (wireID.asPlaneID() != planeID)
continue;
155 VectorBool& channelData = outputROIs[wireID.Wire];
160 for(
const auto& range : signalROIs.
get_ranges())
162 size_t startTick = range.begin_index();
163 size_t roiLen = range.data().
size();
164 size_t stopTick = startTick + roiLen;
166 if (startTick > channelData.size())
168 std::cout <<
"*** ROI decoder has start tick larger than output array, start: " << startTick <<
", array size: " << channelData.size() << std::endl;
172 if (stopTick > channelData.size())
174 std::cout <<
"*** ROI decoder has ROI length larger than output array, start: " << startTick <<
", end: " << stopTick <<
", array size: " << channelData.size() << std::endl;
178 std::fill(channelData.begin() + startTick, channelData.begin() + stopTick,
true);
186 std::cout <<
"*** Not finding ROI information for channel: " << channel << std::endl;
Utilities related to art service access.
size_type size() const
Returns the size of the vector.
The data type to uniquely identify a Plane.
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
CryostatID_t Cryostat
Index of cryostat.
const range_list_t & get_ranges() const
Returns the internal list of non-void ranges.
const RegionsOfInterest_t & SignalROI() const
Returns the list of regions of interest.
void fill(const art::PtrVector< recob::Hit > &hits, int only_plane)
PlaneID_t Plane
Index of the plane within its TPC.
Description of geometry of one entire detector.
constexpr TPCID const & asTPCID() const
Conversion to TPCID (for convenience of notation).
BEGIN_PROLOG sequence::SlidingWindowTriggerPatternsOppositeWindows END_PROLOG simSlidingORM6O6 effSlidingORW output
This provides an interface for tools which are tasked with finding ROI's in input waveforms...
Class holding the regions of interest of signal from a channel.
Declaration of basic channel signal object.
IDparameter< geo::TPCID > TPCID
Member type of validated geo::TPCID parameter.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
TPCID_t TPC
Index of the TPC within its cryostat.
art framework interface to geometry description
BEGIN_PROLOG could also be cout