LArSoft
v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
|
#include "PointIdAlg.h"
Classes | |
struct | Config |
Public Types | |
enum | EDownscaleMode { kMax = 1, kMaxMean = 2, kMean = 3 } |
Public Member Functions | |
PointIdAlg (const fhicl::ParameterSet &pset) | |
PointIdAlg (const Config &config) | |
~PointIdAlg (void) override | |
std::vector< std::string > const & | outputLabels (void) const |
network output labels More... | |
float | predictIdValue (unsigned int wire, float drift, size_t outIdx=0) const |
calculate single-value prediction (2-class probability) for [wire, drift] point More... | |
std::vector< float > | predictIdVector (unsigned int wire, float drift) const |
calculate multi-class probabilities for [wire, drift] point More... | |
std::vector< std::vector< float > > | predictIdVectors (std::vector< std::pair< unsigned int, float > > points) const |
std::vector< std::vector< float > > const & | patchData2D (void) const |
std::vector< float > | patchData1D (void) const |
bool | isInsideFiducialRegion (unsigned int wire, float drift) const |
bool | isCurrentPatch (unsigned int wire, float drift) const |
bool | isSamePatch (unsigned int wire1, float drift1, unsigned int wire2, float drift2) const |
test if two wire/drift coordinates point to the same patch More... | |
bool | setWireDriftData (const std::vector< recob::Wire > &wires, unsigned int plane, unsigned int tpc, unsigned int cryo) |
std::vector< float > const & | wireData (size_t widx) const |
std::vector< std::vector< float > > | getPatch (size_t wire, float drift, size_t patchSizeW, size_t patchSizeD) const |
float | getPixelOrZero (int wire, int drift) const |
double | getAdcSum (void) const |
size_t | getAdcArea (void) const |
float | poolMax (int wire, int drift, size_t r=0) const |
Pool max value in a patch around the wire/drift pixel. More... | |
float | poolSum (int wire, int drift, size_t r=0) const |
Pool sum of pixels in a patch around the wire/drift pixel. More... | |
unsigned int | Cryo (void) const |
unsigned int | TPC (void) const |
unsigned int | Plane (void) const |
unsigned int | NWires (void) const |
unsigned int | NScaledDrifts (void) const |
unsigned int | NCachedDrifts (void) const |
unsigned int | DriftWindow (void) const |
float | ZeroLevel (void) const |
Level of zero ADC after scaling. More... | |
double | LifetimeCorrection (double tick) const |
Static Public Member Functions | |
static std::vector< float > | flattenData2D (std::vector< std::vector< float > > const &patch) |
Protected Member Functions | |
void | downscaleMax (std::vector< float > &dst, std::vector< float > const &adc, size_t tick0) const |
void | downscaleMaxMean (std::vector< float > &dst, std::vector< float > const &adc, size_t tick0) const |
void | downscaleMean (std::vector< float > &dst, std::vector< float > const &adc, size_t tick0) const |
void | downscale (std::vector< float > &dst, std::vector< float > const &adc, size_t tick0) const |
size_t | getDriftIndex (float drift) const |
bool | setWireData (std::vector< float > const &adc, size_t wireIdx) |
bool | patchFromDownsampledView (size_t wire, float drift, size_t size_w, size_t size_d, std::vector< std::vector< float > > &patch) const |
bool | patchFromOriginalView (size_t wire, float drift, size_t size_w, size_t size_d, std::vector< std::vector< float > > &patch) const |
virtual void | resizeView (size_t wires, size_t drifts) |
Protected Attributes | |
unsigned int | fCryo |
unsigned int | fTPC |
unsigned int | fPlane |
unsigned int | fNWires |
unsigned int | fNDrifts |
unsigned int | fNScaledDrifts |
unsigned int | fNCachedDrifts |
std::vector< raw::ChannelID_t > | fWireChannels |
std::vector< std::vector< float > > | fWireDriftData |
std::vector< float > | fLifetimeCorrFactors |
EDownscaleMode | fDownscaleMode |
size_t | fDriftWindow |
bool | fDownscaleFullView |
float | fDriftWindowInv |
calo::CalorimetryAlg | fCalorimetryAlg |
geo::GeometryCore const * | fGeometry |
detinfo::DetectorProperties const * | fDetProp |
Private Member Functions | |
bool | bufferPatch (size_t wire, float drift, std::vector< std::vector< float > > &patch) const |
bool | bufferPatch (size_t wire, float drift) const |
void | resizePatch (void) |
void | deleteNNet (void) |
Private Attributes | |
std::string | fNNetModelFilePath |
std::vector< std::string > | fNNetOutputs |
nnet::ModelInterface * | fNNet |
std::vector< std::vector< float > > | fWireDriftPatch |
size_t | fPatchSizeW |
size_t | fPatchSizeD |
size_t | fCurrentWireIdx |
size_t | fCurrentScaledDrift |
Definition at line 89 of file PointIdAlg.h.
|
inherited |
Enumerator | |
---|---|
kMax | |
kMaxMean | |
kMean |
Definition at line 49 of file DataProviderAlg.h.
|
inline |
Definition at line 114 of file PointIdAlg.h.
nnet::PointIdAlg::PointIdAlg | ( | const Config & | config | ) |
Definition at line 154 of file PointIdAlg.cxx.
References deleteNNet(), fNNet, fNNetModelFilePath, fNNetOutputs, nnet::PointIdAlg::Config::NNetModelFile, nnet::PointIdAlg::Config::NNetOutputs, and resizePatch().
|
override |
|
inlineprivate |
Definition at line 156 of file PointIdAlg.h.
Referenced by predictIdValue(), predictIdVector(), and predictIdVectors().
|
inlineprivate |
Definition at line 178 of file PointIdAlg.h.
References bufferPatch().
Referenced by bufferPatch().
|
inlineinherited |
|
inlineprivate |
|
inlineprotectedinherited |
Definition at line 189 of file DataProviderAlg.h.
References img::DataProviderAlg::downscaleMax(), img::DataProviderAlg::downscaleMaxMean(), img::DataProviderAlg::downscaleMean(), img::DataProviderAlg::kMax, img::DataProviderAlg::kMaxMean, and img::DataProviderAlg::kMean.
Referenced by img::DataProviderAlg::patchFromOriginalView(), and img::DataProviderAlg::setWireData().
|
protectedinherited |
Definition at line 182 of file DataProviderAlg.cxx.
References img::DataProviderAlg::fDriftWindow, img::DataProviderAlg::fLifetimeCorrFactors, and img::DataProviderAlg::scaleAdcSamples().
Referenced by img::DataProviderAlg::downscale().
|
protectedinherited |
Definition at line 202 of file DataProviderAlg.cxx.
References img::DataProviderAlg::fDriftWindow, img::DataProviderAlg::fLifetimeCorrFactors, n, and img::DataProviderAlg::scaleAdcSamples().
Referenced by img::DataProviderAlg::downscale().
|
protectedinherited |
Definition at line 227 of file DataProviderAlg.cxx.
References img::DataProviderAlg::fDriftWindow, img::DataProviderAlg::fDriftWindowInv, img::DataProviderAlg::fLifetimeCorrFactors, and img::DataProviderAlg::scaleAdcSamples().
Referenced by img::DataProviderAlg::downscale().
|
inlineinherited |
|
static |
Definition at line 303 of file PointIdAlg.cxx.
|
inlineinherited |
Definition at line 149 of file DataProviderAlg.h.
References img::DataProviderAlg::fAdcAreaOverThr, img::DataProviderAlg::poolMax(), and img::DataProviderAlg::poolSum().
|
inlineinherited |
|
inlineprotectedinherited |
Definition at line 200 of file DataProviderAlg.h.
References img::DataProviderAlg::fDriftWindowInv, img::DataProviderAlg::patchFromDownsampledView(), img::DataProviderAlg::patchFromOriginalView(), img::DataProviderAlg::resizeView(), img::DataProviderAlg::setWireData(), and lar::dump::vector().
Referenced by img::DataProviderAlg::getPixelOrZero(), img::DataProviderAlg::poolMax(), and img::DataProviderAlg::poolSum().
|
inlineinherited |
Return patch of data centered on the wire and drift, witht the size in (downscaled) pixels givent with patchSizeW and patchSizeD. Pad with the zero-level calue if patch extends beyond the event projection.
Definition at line 114 of file DataProviderAlg.h.
References img::DataProviderAlg::fDownscaleFullView, img::DataProviderAlg::patchFromDownsampledView(), and img::DataProviderAlg::patchFromOriginalView().
|
inlineinherited |
Return value from the ADC buffer, or zero if coordinates are out of the view; will scale the drift according to the downscale settings.
Definition at line 136 of file DataProviderAlg.h.
References img::DataProviderAlg::fNCachedDrifts, img::DataProviderAlg::fWireDriftData, and img::DataProviderAlg::getDriftIndex().
bool nnet::PointIdAlg::isCurrentPatch | ( | unsigned int | wire, |
float | drift | ||
) | const |
test if wire/drift coordinates point to the current patch (so maybe the cnn output does not need to be recalculated)
Definition at line 285 of file PointIdAlg.cxx.
References fCurrentScaledDrift, fCurrentWireIdx, img::DataProviderAlg::fDownscaleFullView, and img::DataProviderAlg::fDriftWindow.
bool nnet::PointIdAlg::isInsideFiducialRegion | ( | unsigned int | wire, |
float | drift | ||
) | const |
Definition at line 327 of file PointIdAlg.cxx.
References img::DataProviderAlg::fDriftWindow, img::DataProviderAlg::fNScaledDrifts, img::DataProviderAlg::fNWires, fPatchSizeD, and fPatchSizeW.
bool nnet::PointIdAlg::isSamePatch | ( | unsigned int | wire1, |
float | drift1, | ||
unsigned int | wire2, | ||
float | drift2 | ||
) | const |
test if two wire/drift coordinates point to the same patch
Definition at line 267 of file PointIdAlg.cxx.
References img::DataProviderAlg::fDownscaleFullView, and img::DataProviderAlg::fDriftWindow.
|
inlineinherited |
Definition at line 169 of file DataProviderAlg.h.
References img::DataProviderAlg::fCalorimetryAlg, and calo::CalorimetryAlg::LifetimeCorrection().
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inline |
|
inline |
Definition at line 136 of file PointIdAlg.h.
|
inline |
Definition at line 135 of file PointIdAlg.h.
|
protectedinherited |
Definition at line 400 of file DataProviderAlg.cxx.
References d, img::DataProviderAlg::fAdcZero, img::DataProviderAlg::fDriftWindow, trkf::fill(), img::DataProviderAlg::fWireDriftData, and w.
Referenced by img::DataProviderAlg::getDriftIndex(), and img::DataProviderAlg::getPatch().
|
protectedinherited |
Definition at line 442 of file DataProviderAlg.cxx.
References d, img::DataProviderAlg::downscale(), img::DataProviderAlg::fAdcZero, img::DataProviderAlg::fDriftWindow, trkf::fill(), img::DataProviderAlg::fWireDriftData, tmp, and w.
Referenced by img::DataProviderAlg::getDriftIndex(), and img::DataProviderAlg::getPatch().
|
inlineinherited |
Definition at line 159 of file DataProviderAlg.h.
References img::DataProviderAlg::fPlane.
Referenced by img::DataProviderAlg::setWireDriftData(), pma::ProjectionMatchingAlg::validate_on_adc(), and pma::ProjectionMatchingAlg::validate_on_adc_test().
|
inherited |
Pool max value in a patch around the wire/drift pixel.
Definition at line 133 of file DataProviderAlg.cxx.
References col, d, img::DataProviderAlg::fDownscaleFullView, img::DataProviderAlg::fDriftWindow, img::DataProviderAlg::fNCachedDrifts, img::DataProviderAlg::fNWires, img::DataProviderAlg::fWireDriftData, img::DataProviderAlg::getDriftIndex(), and w.
Referenced by img::DataProviderAlg::getAdcArea(), pma::ProjectionMatchingAlg::validate_on_adc(), and pma::ProjectionMatchingAlg::validate_on_adc_test().
|
inherited |
Pool sum of pixels in a patch around the wire/drift pixel.
Definition at line 159 of file DataProviderAlg.cxx.
References col, d, img::DataProviderAlg::fDownscaleFullView, img::DataProviderAlg::fDriftWindow, img::DataProviderAlg::fNCachedDrifts, img::DataProviderAlg::fNWires, img::DataProviderAlg::fWireDriftData, img::DataProviderAlg::getDriftIndex(), and w.
Referenced by img::DataProviderAlg::getAdcArea().
float nnet::PointIdAlg::predictIdValue | ( | unsigned int | wire, |
float | drift, | ||
size_t | outIdx = 0 |
||
) | const |
calculate single-value prediction (2-class probability) for [wire, drift] point
Definition at line 198 of file PointIdAlg.cxx.
References bufferPatch(), fNNet, fWireDriftPatch, and nnet::ModelInterface::Run().
std::vector< float > nnet::PointIdAlg::predictIdVector | ( | unsigned int | wire, |
float | drift | ||
) | const |
calculate multi-class probabilities for [wire, drift] point
Definition at line 222 of file PointIdAlg.cxx.
References bufferPatch(), fNNet, fWireDriftPatch, and nnet::ModelInterface::Run().
std::vector< std::vector< float > > nnet::PointIdAlg::predictIdVectors | ( | std::vector< std::pair< unsigned int, float > > | points | ) | const |
Definition at line 245 of file PointIdAlg.cxx.
References bufferPatch(), fNNet, fPatchSizeD, fPatchSizeW, and nnet::ModelInterface::Run().
|
private |
Definition at line 191 of file PointIdAlg.cxx.
References fPatchSizeD, fPatchSizeW, and fWireDriftPatch.
Referenced by PointIdAlg().
|
protectedvirtualinherited |
Reimplemented in nnet::TrainingDataAlg.
Definition at line 103 of file DataProviderAlg.cxx.
References img::DataProviderAlg::fAdcZero, img::DataProviderAlg::fCalibrateLifetime, img::DataProviderAlg::fCalorimetryAlg, img::DataProviderAlg::fDownscaleFullView, img::DataProviderAlg::fDriftWindow, trkf::fill(), img::DataProviderAlg::fLifetimeCorrFactors, img::DataProviderAlg::fNCachedDrifts, img::DataProviderAlg::fNDrifts, img::DataProviderAlg::fNScaledDrifts, img::DataProviderAlg::fNWires, img::DataProviderAlg::fWireChannels, img::DataProviderAlg::fWireDriftData, raw::InvalidChannelID, calo::CalorimetryAlg::LifetimeCorrection(), and w.
Referenced by img::DataProviderAlg::getDriftIndex(), nnet::TrainingDataAlg::resizeView(), and img::DataProviderAlg::setWireDriftData().
|
protectedinherited |
Definition at line 245 of file DataProviderAlg.cxx.
References img::DataProviderAlg::downscale(), img::DataProviderAlg::fDownscaleFullView, and img::DataProviderAlg::fWireDriftData.
Referenced by img::DataProviderAlg::getDriftIndex(), and img::DataProviderAlg::setWireDriftData().
|
inherited |
Definition at line 265 of file DataProviderAlg.cxx.
References img::DataProviderAlg::addCoherentNoise(), img::DataProviderAlg::addWhiteNoise(), img::DataProviderAlg::applyBlur(), geo::GeometryCore::ChannelToWire(), img::DataProviderAlg::fAdcAreaOverThr, img::DataProviderAlg::fAdcSumOverThr, img::DataProviderAlg::fAdcSumThr, img::DataProviderAlg::fCryo, img::DataProviderAlg::fDetProp, img::DataProviderAlg::fGeometry, img::DataProviderAlg::fPlane, img::DataProviderAlg::fTPC, img::DataProviderAlg::fWireChannels, detinfo::DetectorProperties::NumberTimeSamples(), geo::GeometryCore::Nwires(), img::DataProviderAlg::Plane(), img::DataProviderAlg::resizeView(), and img::DataProviderAlg::setWireData().
Referenced by img::DataProviderAlg::DataProviderAlg(), nnet::TrainingDataAlg::setDataEventData(), and nnet::TrainingDataAlg::setEventData().
|
inlineinherited |
|
inlineinherited |
Definition at line 109 of file DataProviderAlg.h.
References img::DataProviderAlg::fWireDriftData.
|
inlineinherited |
Level of zero ADC after scaling.
Definition at line 167 of file DataProviderAlg.h.
References img::DataProviderAlg::fAdcZero.
|
protectedinherited |
Definition at line 214 of file DataProviderAlg.h.
Referenced by img::DataProviderAlg::DataProviderAlg(), img::DataProviderAlg::LifetimeCorrection(), and img::DataProviderAlg::resizeView().
|
protectedinherited |
Definition at line 172 of file DataProviderAlg.h.
Referenced by nnet::TrainingDataAlg::collectVtxFlags(), img::DataProviderAlg::Cryo(), and img::DataProviderAlg::setWireDriftData().
|
mutableprivate |
Definition at line 155 of file PointIdAlg.h.
Referenced by isCurrentPatch().
|
mutableprivate |
Definition at line 155 of file PointIdAlg.h.
Referenced by isCurrentPatch().
|
protectedinherited |
Definition at line 218 of file DataProviderAlg.h.
Referenced by nnet::TrainingDataAlg::getProjection(), and img::DataProviderAlg::setWireDriftData().
|
protectedinherited |
Definition at line 183 of file DataProviderAlg.h.
Referenced by img::DataProviderAlg::addCoherentNoise(), img::DataProviderAlg::addWhiteNoise(), img::DataProviderAlg::DataProviderAlg(), img::DataProviderAlg::getPatch(), isCurrentPatch(), isSamePatch(), img::DataProviderAlg::poolMax(), img::DataProviderAlg::poolSum(), img::DataProviderAlg::resizeView(), img::DataProviderAlg::setWireData(), and nnet::TrainingDataAlg::setWireEdepsAndLabels().
|
protectedinherited |
Definition at line 179 of file DataProviderAlg.h.
Referenced by img::DataProviderAlg::DataProviderAlg().
|
protectedinherited |
Definition at line 182 of file DataProviderAlg.h.
Referenced by img::DataProviderAlg::addCoherentNoise(), img::DataProviderAlg::addWhiteNoise(), img::DataProviderAlg::DataProviderAlg(), img::DataProviderAlg::downscaleMax(), img::DataProviderAlg::downscaleMaxMean(), img::DataProviderAlg::downscaleMean(), img::DataProviderAlg::DriftWindow(), isCurrentPatch(), isInsideFiducialRegion(), isSamePatch(), img::DataProviderAlg::patchFromDownsampledView(), img::DataProviderAlg::patchFromOriginalView(), img::DataProviderAlg::poolMax(), img::DataProviderAlg::poolSum(), img::DataProviderAlg::resizeView(), and nnet::TrainingDataAlg::setWireEdepsAndLabels().
|
protectedinherited |
Definition at line 184 of file DataProviderAlg.h.
Referenced by img::DataProviderAlg::DataProviderAlg(), img::DataProviderAlg::downscaleMean(), and img::DataProviderAlg::getDriftIndex().
|
protectedinherited |
Definition at line 217 of file DataProviderAlg.h.
Referenced by img::DataProviderAlg::DataProviderAlg(), nnet::TrainingDataAlg::getProjection(), and img::DataProviderAlg::setWireDriftData().
|
protectedinherited |
Definition at line 177 of file DataProviderAlg.h.
Referenced by img::DataProviderAlg::downscaleMax(), img::DataProviderAlg::downscaleMaxMean(), img::DataProviderAlg::downscaleMean(), and img::DataProviderAlg::resizeView().
|
protectedinherited |
Definition at line 173 of file DataProviderAlg.h.
Referenced by img::DataProviderAlg::addCoherentNoise(), img::DataProviderAlg::addWhiteNoise(), img::DataProviderAlg::getPixelOrZero(), img::DataProviderAlg::NCachedDrifts(), img::DataProviderAlg::poolMax(), img::DataProviderAlg::poolSum(), img::DataProviderAlg::resizeView(), nnet::TrainingDataAlg::resizeView(), and nnet::TrainingDataAlg::setWireEdepsAndLabels().
|
protectedinherited |
Definition at line 173 of file DataProviderAlg.h.
Referenced by img::DataProviderAlg::resizeView(), nnet::TrainingDataAlg::setDataEventData(), and nnet::TrainingDataAlg::setEventData().
|
private |
Definition at line 150 of file PointIdAlg.h.
Referenced by PointIdAlg(), predictIdValue(), predictIdVector(), and predictIdVectors().
|
private |
Definition at line 148 of file PointIdAlg.h.
Referenced by PointIdAlg().
|
private |
Definition at line 149 of file PointIdAlg.h.
Referenced by PointIdAlg().
|
protectedinherited |
Definition at line 173 of file DataProviderAlg.h.
Referenced by isInsideFiducialRegion(), img::DataProviderAlg::NScaledDrifts(), and img::DataProviderAlg::resizeView().
|
protectedinherited |
Definition at line 173 of file DataProviderAlg.h.
Referenced by isInsideFiducialRegion(), img::DataProviderAlg::NWires(), img::DataProviderAlg::poolMax(), img::DataProviderAlg::poolSum(), img::DataProviderAlg::resizeView(), and nnet::TrainingDataAlg::setEventData().
|
private |
Definition at line 153 of file PointIdAlg.h.
Referenced by isInsideFiducialRegion(), predictIdVectors(), and resizePatch().
|
private |
Definition at line 153 of file PointIdAlg.h.
Referenced by isInsideFiducialRegion(), predictIdVectors(), and resizePatch().
|
protectedinherited |
Definition at line 172 of file DataProviderAlg.h.
Referenced by img::DataProviderAlg::Plane(), img::DataProviderAlg::scaleAdcSample(), img::DataProviderAlg::scaleAdcSamples(), and img::DataProviderAlg::setWireDriftData().
|
protectedinherited |
Definition at line 172 of file DataProviderAlg.h.
Referenced by nnet::TrainingDataAlg::collectVtxFlags(), img::DataProviderAlg::setWireDriftData(), and img::DataProviderAlg::TPC().
|
protectedinherited |
Definition at line 175 of file DataProviderAlg.h.
Referenced by img::DataProviderAlg::resizeView(), nnet::TrainingDataAlg::setEventData(), and img::DataProviderAlg::setWireDriftData().
|
protectedinherited |
Definition at line 176 of file DataProviderAlg.h.
Referenced by img::DataProviderAlg::addCoherentNoise(), img::DataProviderAlg::addWhiteNoise(), img::DataProviderAlg::applyBlur(), img::DataProviderAlg::getPixelOrZero(), img::DataProviderAlg::patchFromDownsampledView(), img::DataProviderAlg::patchFromOriginalView(), img::DataProviderAlg::poolMax(), img::DataProviderAlg::poolSum(), img::DataProviderAlg::resizeView(), img::DataProviderAlg::setWireData(), and img::DataProviderAlg::wireData().
|
mutableprivate |
Definition at line 152 of file PointIdAlg.h.
Referenced by predictIdValue(), predictIdVector(), and resizePatch().