All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
caldata::ROIConvert Class Reference
Inheritance diagram for caldata::ROIConvert:

Public Member Functions

 ROIConvert (fhicl::ParameterSet const &pset)
 
void produce (art::Event &evt)
 
void beginJob ()
 
void endJob ()
 
void reconfigure (fhicl::ParameterSet const &p)
 

Private Attributes

std::vector< art::InputTag > fWireModuleLabelVec
 vector of modules that made digits More...
 
std::vector< std::string > fOutInstanceLabelVec
 The output instance labels to apply. More...
 
bool fDiagnosticOutput
 secret diagnostics flag More...
 
size_t fEventCount
 count of event processed More...
 
const geo::GeometryCorefGeometry = lar::providerFrom<geo::Geometry>()
 

Detailed Description

Definition at line 39 of file ROIConverter_module.cc.

Constructor & Destructor Documentation

caldata::ROIConvert::ROIConvert ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 63 of file ROIConverter_module.cc.

63  : EDProducer{pset}
64 {
65  this->reconfigure(pset);
66 
67  for(const auto& wireLabel : fOutInstanceLabelVec)
68  {
69  produces<std::vector<recob::Wire>>(wireLabel);
70  }
71 }
std::vector< std::string > fOutInstanceLabelVec
The output instance labels to apply.
void reconfigure(fhicl::ParameterSet const &p)

Member Function Documentation

void caldata::ROIConvert::beginJob ( )

Definition at line 92 of file ROIConverter_module.cc.

93 {
94  fEventCount = 0;
95 } // beginJob
size_t fEventCount
count of event processed
void caldata::ROIConvert::endJob ( )

Definition at line 98 of file ROIConverter_module.cc.

99 {
100 }
void caldata::ROIConvert::produce ( art::Event &  evt)

Definition at line 103 of file ROIConverter_module.cc.

104 {
105  // We need to loop through the list of Wire data we have been given
106  // This construct from Gianluca Petrillo who invented it and should be given all credit for it!
107  for(auto const& [channelLabel, instanceName] : util::zip(fWireModuleLabelVec, fOutInstanceLabelVec))
108  {
109  // make a collection of Wires
110  std::unique_ptr<std::vector<recob::Wire>> wireCol = std::make_unique<std::vector<recob::Wire>>();
111 
112  mf::LogInfo("ROIConvert") << "ROIConvert, looking for ChannelROI data at " << channelLabel.encode();
113 
114  // Read in the collection of full length deconvolved waveforms
115  const std::vector<recob::ChannelROI>& channelVec = evt.getProduct<std::vector<recob::ChannelROI>>(channelLabel);
116 
117  mf::LogInfo("ROIConvert") << "--> Recovered ChannelROI data, size: " << channelVec.size();
118 
119  if (!channelVec.empty())
120  {
121  // Reserve the room for the output
122  wireCol->reserve(channelVec.size());
123 
124  // Loop through the input ChannelROI collection
125  for(const auto& channelROI : channelVec)
126  {
127  // Recover the channel and the view
128  raw::ChannelID_t channel = channelROI.Channel();
129  geo::View_t view = fGeometry->View(channel);
130 
131  // Create an ROI vector for output
133 
134  // Loop through the ROIs for this channel
135  const recob::ChannelROI::RegionsOfInterest_t& channelROIs = channelROI.SignalROI();
136 
137  for(const auto& range : channelROIs.get_ranges())
138  {
139  size_t startTick = range.begin_index();
140 
141  std::vector<float> dataVec(range.data().size());
142 
143  for(size_t binIdx = 0; binIdx < range.data().size(); binIdx++) dataVec[binIdx] = range.data()[binIdx];
144 
145  ROIVec.add_range(startTick, std::move(dataVec));
146  }
147 
148  wireCol->push_back(recob::WireCreator(std::move(ROIVec),channel,view).move());
149  }
150 
151  // Time to stroe everything
152  if(wireCol->empty()) mf::LogWarning("ROIConvert") << "No wires made for this event.";
153  }
154 
155  evt.put(std::move(wireCol), instanceName);
156  }
157 
158  fEventCount++;
159 
160  return;
161 } // produce
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
const geo::GeometryCore * fGeometry
const datarange_t & add_range(size_type offset, ITER first, ITER last)
Adds a sequence of elements as a range with specified offset.
const range_list_t & get_ranges() const
Returns the internal list of non-void ranges.
Class managing the creation of a new recob::Wire object.
Definition: WireCreator.h:53
std::vector< std::string > fOutInstanceLabelVec
The output instance labels to apply.
std::vector< art::InputTag > fWireModuleLabelVec
vector of modules that made digits
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
size_t fEventCount
count of event processed
auto zip(Iterables &&...iterables)
Range-for loop helper iterating across many collections at the same time.
Definition: zip.h:295
TCEvent evt
Definition: DataStructs.cxx:8
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
void caldata::ROIConvert::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 74 of file ROIConverter_module.cc.

75 {
76  // Recover the parameters
77  fWireModuleLabelVec = pset.get<std::vector<art::InputTag>>("WireModuleLabelVec", std::vector<art::InputTag>()={"decon1droi"});
78  fOutInstanceLabelVec = pset.get<std::vector<std::string>> ("OutInstanceLabelVec", {"PHYSCRATEDATA"});
79  fDiagnosticOutput = pset.get< bool >("DaignosticOutput", false);
80 
81  if (fWireModuleLabelVec.size() != fWireModuleLabelVec.size())
82  {
83  throw art::Exception(art::errors::Configuration) << " Configured " << fOutInstanceLabelVec.size()
84  << " instance names (`OutInstanceLabelVec`) for " << fWireModuleLabelVec.size()
85  << " input products (`WireModuleLabelVec`)\n";
86  }
87 
88  return;
89 }
std::vector< std::string > fOutInstanceLabelVec
The output instance labels to apply.
std::vector< art::InputTag > fWireModuleLabelVec
vector of modules that made digits
bool fDiagnosticOutput
secret diagnostics flag

Member Data Documentation

bool caldata::ROIConvert::fDiagnosticOutput
private

secret diagnostics flag

Definition at line 53 of file ROIConverter_module.cc.

size_t caldata::ROIConvert::fEventCount
private

count of event processed

Definition at line 54 of file ROIConverter_module.cc.

const geo::GeometryCore* caldata::ROIConvert::fGeometry = lar::providerFrom<geo::Geometry>()
private

Definition at line 56 of file ROIConverter_module.cc.

std::vector<std::string> caldata::ROIConvert::fOutInstanceLabelVec
private

The output instance labels to apply.

Definition at line 52 of file ROIConverter_module.cc.

std::vector<art::InputTag> caldata::ROIConvert::fWireModuleLabelVec
private

vector of modules that made digits

Definition at line 51 of file ROIConverter_module.cc.


The documentation for this class was generated from the following file: