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

Classes

class  multiThreadDeconvolutionProcessing
 

Public Member Functions

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

Private Types

using PlaneIDToDataPair = std::pair< std::vector< raw::ChannelID_t >, PlaneWireData >
 
using PlaneIDToDataPairMap = std::map< geo::PlaneID, PlaneIDToDataPair >
 
using PlaneIDVec = std::vector< geo::PlaneID >
 

Private Member Functions

void processPlane (size_t, art::Event &, const PlaneIDVec &, const PlaneIDToDataPairMap &, std::vector< recob::Wire > &, std::vector< recob::Wire > &, std::vector< recob::ChannelROI > &) const
 
float getMedian (const icarus_signal_processing::VectorFloat, const unsigned int) const
 

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 fCorrectROIBaseline
 Correct the ROI baseline. More...
 
size_t fMinSizeForCorrection
 Minimum ROI length to do correction. More...
 
size_t fMaxSizeForCorrection
 Maximum ROI length for baseline correction. More...
 
bool fOutputMorphed
 Output the morphed waveforms. More...
 
bool fDiagnosticOutput
 secret diagnostics flag More...
 
bool fOutputHistograms
 Output tuples/histograms? More...
 
size_t fEventCount
 count of event processed More...
 
std::map< size_t,
std::unique_ptr
< icarus_tool::IROILocator > > 
fROIToolMap
 
const geo::GeometryCorefGeometry = lar::providerFrom<geo::Geometry>()
 

Detailed Description

Definition at line 96 of file ROIFinder_module.cc.

Member Typedef Documentation

using caldata::ROIFinder::PlaneIDToDataPair = std::pair<std::vector<raw::ChannelID_t>,PlaneWireData>
private

Definition at line 108 of file ROIFinder_module.cc.

Definition at line 109 of file ROIFinder_module.cc.

using caldata::ROIFinder::PlaneIDVec = std::vector<geo::PlaneID>
private

Definition at line 110 of file ROIFinder_module.cc.

Constructor & Destructor Documentation

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

Definition at line 177 of file ROIFinder_module.cc.

177  : EDProducer{pset}
178 {
179  this->reconfigure(pset);
180 
181  for(const auto& wireLabel : fOutInstanceLabelVec)
182  {
183  produces< std::vector<recob::Wire>>(wireLabel);
184  produces< std::vector<recob::ChannelROI>>(wireLabel);
185 
186  if (fOutputMorphed) produces<std::vector<recob::Wire>>(wireLabel+ "M");
187  }
188 }
std::vector< std::string > fOutInstanceLabelVec
The output instance labels to apply.
bool fOutputMorphed
Output the morphed waveforms.
void reconfigure(fhicl::ParameterSet const &p)
caldata::ROIFinder::~ROIFinder ( )
virtual

Definition at line 191 of file ROIFinder_module.cc.

192 {
193 }

Member Function Documentation

void caldata::ROIFinder::beginJob ( )

Definition at line 238 of file ROIFinder_module.cc.

239 {
240  fEventCount = 0;
241 } // beginJob
size_t fEventCount
count of event processed
void caldata::ROIFinder::endJob ( )

Definition at line 244 of file ROIFinder_module.cc.

245 {
246 }
float caldata::ROIFinder::getMedian ( const icarus_signal_processing::VectorFloat  vals,
const unsigned int  nVals 
) const
private

Definition at line 624 of file ROIFinder_module.cc.

625 {
626  float median(0.);
627 
628  if (nVals > 2)
629  {
630  if (nVals % 2 == 0)
631  {
632  const auto m1 = vals.begin() + nVals / 2 - 1;
633  const auto m2 = vals.begin() + nVals / 2;
634  std::nth_element(vals.begin(), m1, vals.begin() + nVals);
635  const auto e1 = *m1;
636  std::nth_element(vals.begin(), m2, vals.begin() + nVals);
637  const auto e2 = *m2;
638  median = (e1 + e2) / 2.0;
639  }
640  else
641  {
642  const auto m = vals.begin() + nVals / 2;
643  std::nth_element(vals.begin(), m, vals.begin() + nVals);
644  median = *m;
645  }
646  }
647 
648  return median;
649 }
tuple m
now if test mode generate materials, CRT shell, world, gdml header else just generate CRT shell for u...
physics pm2 e1
void caldata::ROIFinder::processPlane ( size_t  idx,
art::Event &  event,
const PlaneIDVec planeIDVec,
const PlaneIDToDataPairMap planeIDToDataPairMap,
std::vector< recob::Wire > &  wireColVec,
std::vector< recob::Wire > &  morphedVec,
std::vector< recob::ChannelROI > &  channelROIVec 
) const
private

Definition at line 379 of file ROIFinder_module.cc.

386 {
387  // Recover the planeID for this thread
388  const geo::PlaneID& planeID = planeIDVec[idx];
389 
390  // And the data array
391  PlaneIDToDataPairMap::const_iterator mapItr = planeIDToDataPairMap.find(planeID);
392 
393  if (mapItr == planeIDToDataPairMap.end())
394  {
395  std::cout << "We know this cannot happen" << std::endl;
396  return;
397  }
398 
399  const PlaneIDToDataPair& planeIDToDataPair = mapItr->second;
400 
401  const icarus_signal_processing::ArrayFloat& dataArray = planeIDToDataPair.second();
402  const std::vector<raw::ChannelID_t>& channelVec = planeIDToDataPair.first;
403 
404  // Keep track of our selected values
405  icarus_signal_processing::ArrayFloat outputArray(dataArray.size(),icarus_signal_processing::VectorFloat(dataArray[0].size(),0.));
406  icarus_signal_processing::ArrayBool selectedVals(dataArray.size(),icarus_signal_processing::VectorBool(dataArray[0].size(),false));
407 
408  fROIToolMap.at(planeID.Plane)->FindROIs(event, dataArray, channelVec, mapItr->first, outputArray, selectedVals);
409 
410 // icarus_signal_processing::ArrayFloat morphedWaveforms(dataArray.size());
411 
412  // Copy the "morphed" array
413  if (fOutputMorphed)
414  {
415  for(size_t waveIdx = 0; waveIdx < outputArray.size(); waveIdx++)
416  {
417  // skip if a bad channbel
418  if (channelVec[idx] >= 100000) continue;
419 
420  // First get a lock to make sure we don't conflict
421  tbb::spin_mutex::scoped_lock lock(roifinderSpinMutex);
422 
424 
425  ROIVec.add_range(0, std::move(outputArray[waveIdx]));
426 
427  raw::ChannelID_t channel = channelVec[waveIdx];
428  geo::View_t view = fGeometry->View(channel);
429 
430  std::vector<geo::WireID> chanIDVec = fGeometry->ChannelToWire(channel);
431 
432  morphedVec.push_back(recob::WireCreator(std::move(ROIVec),channel,view).move());
433  }
434  }
435 
436  // Ok, now go through the refined selected values array and find ROIs
437  // Define the ROI and its container
438  using CandidateROI = std::pair<size_t, size_t>;
439  using CandidateROIVec = std::vector<CandidateROI>;
440 
441  size_t leadTrail(0);
442 
443  for(size_t waveIdx = 0; waveIdx < selectedVals.size(); waveIdx++)
444  {
445  // Skip if a bad channel
446  if (channelVec[waveIdx] >= 100000)
447  {
448  std::cout << "==> found an unexpected channel number: " << channelVec[waveIdx] << std::endl;
449  continue;
450  }
451 
452  // Set up an object...
453  CandidateROIVec candidateROIVec;
454 
455  // Search for ROIs in current waveform
456  const icarus_signal_processing::VectorBool& selVals = selectedVals[waveIdx];
457 
458  size_t idx(2);
459 
460  while(idx < selVals.size())
461  {
462  if (selVals[idx])
463  {
464  Size_t startTick = idx >= leadTrail ? idx - leadTrail : 0;
465 
466  while(idx < selVals.size() && selVals[idx]) idx++;
467 
468  size_t stopTick = idx < selVals.size() - leadTrail ? idx + leadTrail : selVals.size();
469 
470  candidateROIVec.emplace_back(startTick, stopTick);
471  }
472 
473  idx++;
474  }
475 
476  // merge overlapping (or touching) ROI's
477  if(candidateROIVec.size() > 1)
478  {
479  // temporary vector for merged ROIs
480  CandidateROIVec tempRoiVec;
481 
482  // Loop through candidate roi's
483  size_t startRoi = candidateROIVec.front().first;
484  size_t stopRoi = candidateROIVec.front().second; //startRoi;
485 
486  for(auto& roi : candidateROIVec)
487  {
488  // Should we merge roi's?
489  if (roi.first <= stopRoi)
490  {
491  // Make sure the merge gets the right start/end times
492  startRoi = std::min(startRoi,roi.first);
493  stopRoi = std::max(stopRoi,roi.second);
494  }
495  else
496  {
497  tempRoiVec.emplace_back(startRoi,stopRoi);
498 
499  startRoi = roi.first;
500  stopRoi = roi.second;
501  }
502  }
503 
504  // Make sure to get the last one
505  tempRoiVec.emplace_back(startRoi,stopRoi);
506 
507  candidateROIVec = tempRoiVec;
508  }
509 
510  // If no candidates no need for further effort
511  if (!candidateROIVec.empty())
512  {
513  // vector that will be moved into the Wire object
516 
517  // Check if we have possible overlap wires where we need to merge the previous results with new results
518  if (planeID.Plane > 0)
519  {
520  raw::ChannelID_t channel = channelVec[waveIdx];
521 
522  std::vector<geo::WireID> wireIDVec = fGeometry->ChannelToWire(channel);
523 
524  if (wireIDVec.size() > 1)
525  {
526  std::vector<recob::Wire>::iterator wireItr = std::find_if(wireColVec.begin(),wireColVec.end(),[channel](const auto& wire){return wire.Channel() == channel;});
527 
528  if (wireItr != wireColVec.end())
529  {
530  ROIVec = wireItr->SignalROI();
531 
532  // Avoid duplicate entries by erasing the previous instance
533  wireColVec.erase(wireItr);
534  }
535 
536  std::vector<recob::ChannelROI>::iterator channelItr = std::find_if(channelROIVec.begin(),channelROIVec.end(),[channel](const auto& channelROI){return channelROI.Channel() == channel;});
537 
538  if (channelItr != channelROIVec.end())
539  {
540  intROIVec = channelItr->SignalROI();
541 
542  // Avoid duplicate entries by erasing the previous instance
543  channelROIVec.erase(channelItr);
544  }
545  }
546  }
547 
548  if (ROIVec.size() != intROIVec.size())
549  throw art::Exception(art::errors::LogicError) << "===> ROIVec mismatch to intROIVec, ROIVec size: " << ROIVec.size() << ", intROIVec size: " << intROIVec.size() << "\n";
550 
551  const icarus_signal_processing::VectorFloat& waveform = dataArray[waveIdx];
552 
553  // We need to copy the deconvolved (and corrected) waveform ROI's
554  for(const auto& candROI : candidateROIVec)
555  {
556  // First up: copy out the relevent ADC bins into the ROI holder
557  size_t roiLen = candROI.second - candROI.first;
558  size_t firstBin = candROI.first;
559 
560  icarus_signal_processing::VectorFloat holder(roiLen);
561 
562  std::copy(waveform.begin()+candROI.first, waveform.begin()+candROI.second, holder.begin());
563 
564  // Now we do the baseline determination and correct the ROI
565  // For now we are going to reset to the minimum element
566  // Get slope/offset from first to last ticks
567  if (fCorrectROIBaseline && holder.size() > fMinSizeForCorrection && holder.size() < fMaxSizeForCorrection)
568  {
569  // Try to find the minimum value in the leading and trailing bins
570  size_t nBins = holder.size()/3;
571  icarus_signal_processing::VectorFloat::iterator firstItr = std::min_element(holder.begin(),holder.begin()+nBins);
572  icarus_signal_processing::VectorFloat::iterator lastItr = std::min_element(holder.end()-nBins,holder.end());
573 
574  size_t newSize = std::distance(firstItr,lastItr) + 1;
575  float dADC = (*lastItr - *firstItr) / float(newSize);
576  float offset = *firstItr;
577 
578  for(size_t binIdx = 0; binIdx < newSize; binIdx++)
579  {
580  holder[binIdx] = *(firstItr + binIdx) - offset;
581  offset += dADC;
582  }
583 
584  firstBin += std::distance(holder.begin(),firstItr);
585 
586  holder.resize(newSize);
587  }
588 
589  // Now make the short int version
590  icarus_signal_processing::VectorShort intHolder(holder.size());
591 
592  for(size_t binIdx = 0; binIdx < holder.size(); binIdx++) intHolder[binIdx] = std::round(holder[binIdx]);
593 
594  // add the range into ROIVec
595  ROIVec.add_range(firstBin, std::move(holder));
596  intROIVec.add_range(firstBin, std::move(intHolder));
597  }
598 
599  // Check for emptiness
600  if (!ROIVec.empty())
601  {
602  // First get a lock to make sure we don't conflict
603  tbb::spin_mutex::scoped_lock lock(roifinderSpinMutex);
604 
605  raw::ChannelID_t channel = channelVec[waveIdx];
606  geo::View_t view = fGeometry->View(channel);
607 
608  // Since we process logical TPC images we need to watch for duplicating entries
609  // We can do that by checking to see if a channel has already been added...
610  std::vector<geo::WireID> wireIDVec = fGeometry->ChannelToWire(channel);
611 
612  if (channelROIVec.size() != wireColVec.size())
613  throw art::Exception(art::errors::LogicError) << "===> ROI output mismatch, channelROIVec, size: " << channelROIVec.size() << ", wireColVec, size: " << wireColVec.size() << "\n";
614 
615  channelROIVec.push_back(recob::ChannelROICreator(std::move(intROIVec),channel).move());
616  wireColVec.push_back(recob::WireCreator(std::move(ROIVec),channel,view).move());
617  }
618  }
619  }
620 
621  return;
622 }
BEGIN_PROLOG TPC Trig offset(g4 rise time) ProjectToHeight
Definition: CORSIKAGen.fcl:7
size_type size() const
Returns the size of the vector.
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
const datarange_t & add_range(size_type offset, ITER first, ITER last)
Adds a sequence of elements as a range with specified offset.
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
Class managing the creation of a new recob::Wire object.
Definition: WireCreator.h:53
std::map< size_t, std::unique_ptr< icarus_tool::IROILocator > > fROIToolMap
size_t fMinSizeForCorrection
Minimum ROI length to do correction.
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
const geo::GeometryCore * fGeometry
bool fCorrectROIBaseline
Correct the ROI baseline.
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:493
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
size_t fMaxSizeForCorrection
Maximum ROI length for baseline correction.
bool fOutputMorphed
Output the morphed waveforms.
tbb::spin_mutex roifinderSpinMutex
bool empty() const
Returns whether the vector is empty.
Class managing the creation of a new recob::Wire object.
T copy(T const &v)
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
BEGIN_PROLOG could also be cout
std::pair< std::vector< raw::ChannelID_t >, PlaneWireData > PlaneIDToDataPair
void caldata::ROIFinder::produce ( art::Event &  evt)

Definition at line 249 of file ROIFinder_module.cc.

250 {
251  // We need to loop through the list of Wire data we have been given
252  for(size_t labelIdx = 0; labelIdx < fWireModuleLabelVec.size(); labelIdx++)
253  {
254  const art::InputTag& wireLabel = fWireModuleLabelVec[labelIdx];
255 
256  // make a collection of Wires
257  std::unique_ptr<std::vector<recob::Wire>> wireCol(new std::vector<recob::Wire>);
258 
259  std::unique_ptr<std::vector<recob::Wire>> morphedCol(new std::vector<recob::Wire>);
260 
261  // make a collection of ChannelROI objects
262  std::unique_ptr<std::vector<recob::ChannelROI>> channelROICol(new std::vector<recob::ChannelROI>);
263 
264  mf::LogInfo("ROIFinder") << "ROIFinder, looking for decon1droi data at " << wireLabel << std::endl;
265 
266  // Read in the collection of full length deconvolved waveforms
267  // Note we assume this list is sorted in increasing channel number!
268  art::Handle< std::vector<recob::Wire>> wireVecHandle;
269 
270  evt.getByLabel(wireLabel, wireVecHandle);
271 
272  mf::LogInfo("ROIFinder") << "--> Recovered wire data, size: " << wireVecHandle->size() << std::endl;
273 
274  if (!wireVecHandle->size())
275  {
276  evt.put(std::move(wireCol), wireLabel.instance());
277  fEventCount++;
278 
279  return;
280  }
281 
282  // The first step is to break up into groups by logical TPC/plane in order to do the parallel loop
283  PlaneIDToDataPairMap planeIDToDataPairMap;
284  PlaneIDVec planeIDVec;
285  size_t numChannels(0);
286 
287  for(const auto& wire : *wireVecHandle)
288  {
289  raw::ChannelID_t channel = wire.Channel();
290 
291  std::vector<geo::WireID> wireIDVec = fGeometry->ChannelToWire(channel);
292 
293  if (wireIDVec.empty()) continue;
294 
295  for(const auto& wireID : wireIDVec)
296  {
297  const geo::PlaneID& planeID = wireID.planeID();
298 
299  PlaneIDToDataPairMap::iterator mapItr = planeIDToDataPairMap.find(planeID);
300 
301  // Make sure the array is initialized
302  if (mapItr == planeIDToDataPairMap.end())
303  {
304  unsigned int nWires = fGeometry->Nwires(planeID);
305 
306  std::pair<PlaneIDToDataPairMap::iterator,bool> mapInsert = planeIDToDataPairMap.insert({planeID,PlaneIDToDataPair()});
307 
308  if (!mapInsert.second) std::cout << "Failed to insert, is this possible?" << std::endl;
309 
310  mapItr = mapInsert.first;
311 
312  mapItr->second.first.resize(nWires);
313  mapItr->second.second.resize(nWires);
314 
315  planeIDVec.emplace_back(planeID);
316  }
317 
318  // Add waveform to the 2D array
319  mapItr->second.first[wireID.Wire] = channel;
320  mapItr->second.second.addWire(wireID.Wire, wire);
321  numChannels++;
322  }
323  }
324 
325  // We might need this... it allows a temporary wire object to prevent crashes when some data is missing
326  std::vector<recob::Wire> tempWireVec(numChannels/4);
327 
328  // Check integrity of map
329  for(auto& mapInfo : planeIDToDataPairMap)
330  {
331  const std::vector<raw::ChannelID_t>& channelVec = mapInfo.second.first;
332  const icarus_signal_processing::ArrayFloat& dataArray = mapInfo.second.second();
333 
334  for(size_t idx = 0; idx < channelVec.size(); idx++)
335  {
336  if (dataArray[idx].size() < 100)
337  {
338  mf::LogInfo("ROIFinder") << " **> Found truncated wire, size: " << dataArray[idx].size() << ", channel: " << channelVec[idx] << std::endl;
339 
340  std::vector<float> zeroVec(4096,0.);
342 
343  ROIVec.add_range(0, std::move(zeroVec));
344 
345  std::vector<geo::WireID> wireIDVec = fGeometry->ChannelToWire(channelVec[idx]);
346 
347  // Given channel a large number so we know to not save
348  mapInfo.second.first[idx] = 100000 + idx;
349 
350  tempWireVec.emplace_back(recob::WireCreator(std::move(ROIVec),idx,fGeometry->View(wireIDVec[0].planeID())).move());
351 
352  mapInfo.second.second.addWire(idx,tempWireVec.back());
353  }
354  }
355  }
356 
357  // Reserve the room for the output
358  wireCol->reserve(wireVecHandle->size());
359 
360  // ... Launch multiple threads with TBB to do the deconvolution and find ROIs in parallel
361  multiThreadDeconvolutionProcessing deconvolutionProcessing(*this, evt, planeIDVec, planeIDToDataPairMap, *wireCol, *morphedCol, *channelROICol);
362 
363  tbb::parallel_for(tbb::blocked_range<size_t>(0, planeIDVec.size()), deconvolutionProcessing);
364 
365  // Time to stroe everything
366  if(wireCol->size() == 0) mf::LogWarning("ROIFinder") << "No wires made for this event.";
367 
368  evt.put(std::move(wireCol), fOutInstanceLabelVec[labelIdx]);
369  evt.put(std::move(channelROICol), fOutInstanceLabelVec[labelIdx]);
370 
371  if (fOutputMorphed) evt.put(std::move(morphedCol), fOutInstanceLabelVec[labelIdx]+"M");
372  }
373 
374  fEventCount++;
375 
376  return;
377 } // produce
std::vector< geo::PlaneID > PlaneIDVec
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
const datarange_t & add_range(size_type offset, ITER first, ITER last)
Adds a sequence of elements as a range with specified offset.
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
Wire && move()
Prepares the constructed wire to be moved away.
Definition: WireCreator.h:133
Class managing the creation of a new recob::Wire object.
Definition: WireCreator.h:53
unsigned int Nwires(unsigned int p, unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wires in the specified plane.
std::vector< std::string > fOutInstanceLabelVec
The output instance labels to apply.
const geo::GeometryCore * fGeometry
std::map< geo::PlaneID, PlaneIDToDataPair > PlaneIDToDataPairMap
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
bool fOutputMorphed
Output the morphed waveforms.
TCEvent evt
Definition: DataStructs.cxx:8
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
size_t fEventCount
count of event processed
BEGIN_PROLOG could also be cout
std::pair< std::vector< raw::ChannelID_t >, PlaneWireData > PlaneIDToDataPair
std::vector< art::InputTag > fWireModuleLabelVec
vector of modules that made digits
void caldata::ROIFinder::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 196 of file ROIFinder_module.cc.

197 {
198  // Recover the parameters
199  fWireModuleLabelVec = pset.get<std::vector<art::InputTag>>("WireModuleLabelVec", std::vector<art::InputTag>()={"decon1droi"});
200  fOutInstanceLabelVec = pset.get<std::vector<std::string>> ("OutInstanceLabelVec", {"PHYSCRATEDATA"});
201  fCorrectROIBaseline = pset.get<bool >("CorrectROIBaseline", false);
202  fMinSizeForCorrection = pset.get<size_t >("MinSizeForCorrection", 12);
203  fMaxSizeForCorrection = pset.get<size_t >("MaxSizeForCorrection", 512);
204  fOutputMorphed = pset.get< bool >("OutputMorphed", true);
205  fDiagnosticOutput = pset.get< bool >("DaignosticOutput", false);
206  fOutputHistograms = pset.get< bool >("OutputHistograms", false);
207 
208  // Access ART's TFileService, which will handle creating and writing
209  // histograms and n-tuples for us.
210  art::ServiceHandle<art::TFileService> tfs;
211 
212  // Recover the list of ROI finding tools
213  const fhicl::ParameterSet& roiFinderTools = pset.get<fhicl::ParameterSet>("ROIFinderToolVec");
214 
215  // Make a mapping between plane id and a plane's ROI finder
216  // This allows different ROI finders per plane but, more important, different parameters
217  for(const std::string& roiFinderTool : roiFinderTools.get_pset_names())
218  {
219  const fhicl::ParameterSet& roiFinderToolParamSet = roiFinderTools.get<fhicl::ParameterSet>(roiFinderTool);
220  size_t planeIdx = roiFinderToolParamSet.get<size_t>("Plane");
221 
222  fROIToolMap[planeIdx] = art::make_tool<icarus_tool::IROILocator> (roiFinderToolParamSet);
223 
224  if (fOutputHistograms)
225  {
226  std::string dirName = "ROIFinder_" + std::to_string(planeIdx);
227 
228  art::TFileDirectory dir = tfs->mkdir(dirName);
229 
230  fROIToolMap[planeIdx]->initializeHistograms(dir);
231  }
232  }
233 
234  return;
235 }
std::map< size_t, std::unique_ptr< icarus_tool::IROILocator > > fROIToolMap
size_t fMinSizeForCorrection
Minimum ROI length to do correction.
std::vector< std::string > fOutInstanceLabelVec
The output instance labels to apply.
bool fCorrectROIBaseline
Correct the ROI baseline.
bool fOutputHistograms
Output tuples/histograms?
size_t fMaxSizeForCorrection
Maximum ROI length for baseline correction.
tuple dir
Definition: dropbox.py:28
bool fOutputMorphed
Output the morphed waveforms.
std::string to_string(WindowPattern const &pattern)
art::ServiceHandle< art::TFileService > tfs
bool fDiagnosticOutput
secret diagnostics flag
std::vector< art::InputTag > fWireModuleLabelVec
vector of modules that made digits

Member Data Documentation

bool caldata::ROIFinder::fCorrectROIBaseline
private

Correct the ROI baseline.

Definition at line 160 of file ROIFinder_module.cc.

bool caldata::ROIFinder::fDiagnosticOutput
private

secret diagnostics flag

Definition at line 164 of file ROIFinder_module.cc.

size_t caldata::ROIFinder::fEventCount
private

count of event processed

Definition at line 166 of file ROIFinder_module.cc.

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

Definition at line 170 of file ROIFinder_module.cc.

size_t caldata::ROIFinder::fMaxSizeForCorrection
private

Maximum ROI length for baseline correction.

Definition at line 162 of file ROIFinder_module.cc.

size_t caldata::ROIFinder::fMinSizeForCorrection
private

Minimum ROI length to do correction.

Definition at line 161 of file ROIFinder_module.cc.

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

The output instance labels to apply.

Definition at line 159 of file ROIFinder_module.cc.

bool caldata::ROIFinder::fOutputHistograms
private

Output tuples/histograms?

Definition at line 165 of file ROIFinder_module.cc.

bool caldata::ROIFinder::fOutputMorphed
private

Output the morphed waveforms.

Definition at line 163 of file ROIFinder_module.cc.

std::map<size_t,std::unique_ptr<icarus_tool::IROILocator> > caldata::ROIFinder::fROIToolMap
private

Definition at line 168 of file ROIFinder_module.cc.

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

vector of modules that made digits

Definition at line 158 of file ROIFinder_module.cc.


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