LArSoft
v09_90_00
Liquid Argon Software toolkit - https://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 () override | |
std::vector< std::string > const & | outputLabels () 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 () const |
std::vector< float > | patchData1D () 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 detinfo::DetectorClocksData &clock_data, const detinfo::DetectorPropertiesData &det_prop, 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 () const |
size_t | getAdcArea () const |
float | poolMax (int wire, int drift, size_t r=0) const |
Pool max value in a patch around the wire/drift pixel. More... | |
unsigned int | Cryo () const |
Pool sum of pixels in a patch around the wire/drift pixel. More... | |
unsigned int | TPC () const |
unsigned int | Plane () const |
unsigned int | NWires () const |
unsigned int | NScaledDrifts () const |
unsigned int | NCachedDrifts () const |
unsigned int | DriftWindow () const |
float | ZeroLevel () const |
Level of zero ADC after scaling. More... | |
double | LifetimeCorrection (detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, double tick) const |
Static Public Member Functions | |
static std::vector< float > | flattenData2D (std::vector< std::vector< float >> const &patch) |
Protected Member Functions | |
std::vector< float > | downscaleMax (std::size_t dst_size, std::vector< float > const &adc, size_t tick0) const |
std::vector< float > | downscaleMaxMean (std::size_t dst_size, std::vector< float > const &adc, size_t tick0) const |
std::vector< float > | downscaleMean (std::size_t dst_size, std::vector< float > const &adc, size_t tick0) const |
std::vector< float > | downscale (std::size_t dst_size, std::vector< float > const &adc, size_t tick0) const |
size_t | getDriftIndex (float drift) const |
std::optional< std::vector< float > > | setWireData (std::vector< float > const &adc, size_t wireIdx) const |
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 DataProviderAlgView | resizeView (detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, size_t wires, size_t drifts) |
Protected Attributes | |
DataProviderAlgView | fAlgView |
EDownscaleMode | fDownscaleMode |
size_t | fDriftWindow |
bool | fDownscaleFullView |
float | fDriftWindowInv |
calo::CalorimetryAlg | fCalorimetryAlg |
geo::GeometryCore const * | fGeometry |
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 | deleteNNet () |
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 98 of file PointIdAlg.h.
|
inherited |
Enumerator | |
---|---|
kMax | |
kMaxMean | |
kMean |
Definition at line 64 of file DataProviderAlg.h.
|
inline |
Definition at line 114 of file PointIdAlg.h.
nnet::PointIdAlg::PointIdAlg | ( | const Config & | config | ) |
Definition at line 173 of file PointIdAlg.cxx.
References deleteNNet(), fNNet, fNNetModelFilePath, fNNetOutputs, nnet::PointIdAlg::Config::NNetModelFile, nnet::PointIdAlg::Config::NNetOutputs, and resizePatch().
|
override |
|
inlineprivate |
Definition at line 158 of file PointIdAlg.h.
Referenced by predictIdValue(), predictIdVector(), and predictIdVectors().
|
inlineprivate |
Definition at line 180 of file PointIdAlg.h.
|
inlineinherited |
Pool sum of pixels in a patch around the wire/drift pixel.
Definition at line 161 of file DataProviderAlg.h.
Referenced by nnet::TrainingDataAlg::collectVtxFlags().
|
inlineprivate |
|
inlineprotectedinherited |
Definition at line 198 of file DataProviderAlg.h.
References img::DataProviderAlg::kMax, img::DataProviderAlg::kMaxMean, and img::DataProviderAlg::kMean.
Referenced by img::DataProviderAlg::patchFromOriginalView(), and img::DataProviderAlg::setWireData().
|
protectedinherited |
Definition at line 196 of file DataProviderAlg.cxx.
References img::DataProviderAlg::fAlgView, img::DataProviderAlg::fDriftWindow, img::DataProviderAlgView::fLifetimeCorrFactors, and img::DataProviderAlg::scaleAdcSamples().
|
protectedinherited |
Definition at line 217 of file DataProviderAlg.cxx.
References img::DataProviderAlg::fAlgView, img::DataProviderAlg::fDriftWindow, img::DataProviderAlgView::fLifetimeCorrFactors, n, and img::DataProviderAlg::scaleAdcSamples().
|
protectedinherited |
Definition at line 252 of file DataProviderAlg.cxx.
References img::DataProviderAlg::fAlgView, img::DataProviderAlg::fDriftWindow, img::DataProviderAlg::fDriftWindowInv, img::DataProviderAlgView::fLifetimeCorrFactors, and img::DataProviderAlg::scaleAdcSamples().
|
inlineinherited |
Definition at line 168 of file DataProviderAlg.h.
|
static |
Definition at line 309 of file PointIdAlg.cxx.
|
inlineinherited |
|
inlineinherited |
Definition at line 152 of file DataProviderAlg.h.
|
inlineprotectedinherited |
Definition at line 210 of file DataProviderAlg.h.
References lar::dump::vector().
Referenced by img::DataProviderAlg::poolMax().
|
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 122 of file DataProviderAlg.h.
|
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 142 of file DataProviderAlg.h.
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 293 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 330 of file PointIdAlg.cxx.
References img::DataProviderAlg::fAlgView, img::DataProviderAlg::fDriftWindow, img::DataProviderAlgView::fNScaledDrifts, img::DataProviderAlgView::fNWires, fPatchSizeD, and fPatchSizeW.
Referenced by nnet::EmTrackClusterId2out::produce(), nnet::EmTrackClusterId::produce(), and nnet::EmTrackMichelId::produce().
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 276 of file PointIdAlg.cxx.
References img::DataProviderAlg::fDownscaleFullView, and img::DataProviderAlg::fDriftWindow.
|
inlineinherited |
Definition at line 173 of file DataProviderAlg.h.
|
inlineinherited |
Definition at line 167 of file DataProviderAlg.h.
|
inlineinherited |
Definition at line 166 of file DataProviderAlg.h.
Referenced by nnet::PointIdTrainingData::analyze().
|
inlineinherited |
Definition at line 165 of file DataProviderAlg.h.
Referenced by nnet::PointIdTrainingData::analyze().
|
inline |
network output labels
Definition at line 121 of file PointIdAlg.h.
References lar::dump::vector().
Referenced by nnet::EmTrackClusterId2out::produce(), nnet::EmTrackClusterId::produce(), and nnet::EmTrackMichelId::produce().
|
inline |
Definition at line 135 of file PointIdAlg.h.
|
inline |
Definition at line 134 of file PointIdAlg.h.
|
protectedinherited |
Definition at line 439 of file DataProviderAlg.cxx.
References d, img::DataProviderAlg::fAdcZero, img::DataProviderAlg::fAlgView, img::DataProviderAlg::fDriftWindow, trkf::fill(), img::DataProviderAlgView::fWireDriftData, and w.
|
protectedinherited |
Definition at line 476 of file DataProviderAlg.cxx.
References d, img::DataProviderAlg::downscale(), img::DataProviderAlg::fAdcZero, img::DataProviderAlg::fAlgView, img::DataProviderAlg::fDriftWindow, trkf::fill(), img::DataProviderAlgView::fWireDriftData, util::size(), tmp, and w.
|
inlineinherited |
Definition at line 163 of file DataProviderAlg.h.
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 145 of file DataProviderAlg.cxx.
References col, d, img::DataProviderAlg::fAlgView, img::DataProviderAlg::fDownscaleFullView, img::DataProviderAlg::fDriftWindow, img::DataProviderAlgView::fNCachedDrifts, img::DataProviderAlgView::fNWires, img::DataProviderAlgView::fWireDriftData, img::DataProviderAlg::getDriftIndex(), r, and w.
Referenced by pma::ProjectionMatchingAlg::validate_on_adc(), and pma::ProjectionMatchingAlg::validate_on_adc_test().
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 218 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 239 of file PointIdAlg.cxx.
References bufferPatch(), fNNet, fWireDriftPatch, and nnet::ModelInterface::Run().
Referenced by nnet::ParticleDecayId::DetectDecay().
std::vector< std::vector< float > > nnet::PointIdAlg::predictIdVectors | ( | std::vector< std::pair< unsigned int, float >> | points | ) | const |
Definition at line 257 of file PointIdAlg.cxx.
References bufferPatch(), fNNet, fPatchSizeD, fPatchSizeW, and nnet::ModelInterface::Run().
Referenced by nnet::EmTrackClusterId2out::produce(), nnet::EmTrackClusterId::produce(), and nnet::EmTrackMichelId::produce().
|
private |
Definition at line 210 of file PointIdAlg.cxx.
References fPatchSizeD, fPatchSizeW, fWireDriftPatch, and r.
Referenced by PointIdAlg().
|
protectedvirtualinherited |
Reimplemented in nnet::TrainingDataAlg.
Definition at line 114 of file DataProviderAlg.cxx.
References img::DataProviderAlg::fAdcZero, img::DataProviderAlg::fCalibrateLifetime, img::DataProviderAlg::fCalorimetryAlg, img::DataProviderAlg::fDownscaleFullView, img::DataProviderAlg::fDriftWindow, img::DataProviderAlgView::fLifetimeCorrFactors, img::DataProviderAlgView::fNCachedDrifts, img::DataProviderAlgView::fNDrifts, img::DataProviderAlgView::fNScaledDrifts, img::DataProviderAlgView::fNWires, img::DataProviderAlgView::fWireChannels, img::DataProviderAlgView::fWireDriftData, raw::InvalidChannelID, and calo::CalorimetryAlg::LifetimeCorrection().
Referenced by nnet::TrainingDataAlg::resizeView(), and img::DataProviderAlg::setWireDriftData().
|
protectedinherited |
Definition at line 273 of file DataProviderAlg.cxx.
References img::DataProviderAlg::downscale(), img::DataProviderAlg::fAlgView, img::DataProviderAlg::fDownscaleFullView, and img::DataProviderAlgView::fWireDriftData.
Referenced by img::DataProviderAlg::setWireDriftData().
|
inherited |
Definition at line 289 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::fAlgView, img::DataProviderAlg::fCryo, img::DataProviderAlg::fGeometry, img::DataProviderAlg::fPlane, img::DataProviderAlg::fTPC, img::DataProviderAlgView::fWireChannels, img::DataProviderAlgView::fWireDriftData, detinfo::DetectorPropertiesData::NumberTimeSamples(), geo::GeometryCore::Nwires(), img::DataProviderAlg::Plane(), img::DataProviderAlg::resizeView(), and img::DataProviderAlg::setWireData().
Referenced by nnet::ParticleDecayId::DetectDecay(), nnet::EmTrackClusterId2out::produce(), nnet::EmTrackClusterId::produce(), nnet::EmTrackMichelId::produce(), nnet::TrainingDataAlg::setDataEventData(), and nnet::TrainingDataAlg::setEventData().
|
inlineinherited |
Definition at line 162 of file DataProviderAlg.h.
Referenced by nnet::TrainingDataAlg::collectVtxFlags().
|
inlineinherited |
Definition at line 117 of file DataProviderAlg.h.
Referenced by nnet::PointIdTrainingData::analyze().
|
inlineinherited |
|
protectedinherited |
Definition at line 181 of file DataProviderAlg.h.
Referenced by img::DataProviderAlg::addCoherentNoise(), img::DataProviderAlg::addWhiteNoise(), img::DataProviderAlg::applyBlur(), img::DataProviderAlg::downscaleMax(), img::DataProviderAlg::downscaleMaxMean(), img::DataProviderAlg::downscaleMean(), isInsideFiducialRegion(), img::DataProviderAlg::patchFromDownsampledView(), img::DataProviderAlg::patchFromOriginalView(), img::DataProviderAlg::poolMax(), nnet::TrainingDataAlg::setDataEventData(), nnet::TrainingDataAlg::setEventData(), img::DataProviderAlg::setWireData(), img::DataProviderAlg::setWireDriftData(), and nnet::TrainingDataAlg::setWireEdepsAndLabels().
|
protectedinherited |
Definition at line 238 of file DataProviderAlg.h.
Referenced by img::DataProviderAlg::DataProviderAlg(), and img::DataProviderAlg::resizeView().
|
mutableprivate |
Definition at line 157 of file PointIdAlg.h.
Referenced by isCurrentPatch().
|
mutableprivate |
Definition at line 157 of file PointIdAlg.h.
Referenced by isCurrentPatch().
|
protectedinherited |
Definition at line 186 of file DataProviderAlg.h.
Referenced by img::DataProviderAlg::addCoherentNoise(), img::DataProviderAlg::addWhiteNoise(), img::DataProviderAlg::DataProviderAlg(), isCurrentPatch(), isSamePatch(), img::DataProviderAlg::poolMax(), img::DataProviderAlg::resizeView(), img::DataProviderAlg::setWireData(), and nnet::TrainingDataAlg::setWireEdepsAndLabels().
|
protectedinherited |
Definition at line 182 of file DataProviderAlg.h.
Referenced by img::DataProviderAlg::DataProviderAlg().
|
protectedinherited |
Definition at line 185 of file DataProviderAlg.h.
Referenced by img::DataProviderAlg::addCoherentNoise(), img::DataProviderAlg::addWhiteNoise(), img::DataProviderAlg::DataProviderAlg(), img::DataProviderAlg::downscaleMax(), img::DataProviderAlg::downscaleMaxMean(), img::DataProviderAlg::downscaleMean(), isCurrentPatch(), isInsideFiducialRegion(), isSamePatch(), img::DataProviderAlg::patchFromDownsampledView(), img::DataProviderAlg::patchFromOriginalView(), img::DataProviderAlg::poolMax(), img::DataProviderAlg::resizeView(), and nnet::TrainingDataAlg::setWireEdepsAndLabels().
|
protectedinherited |
Definition at line 187 of file DataProviderAlg.h.
Referenced by img::DataProviderAlg::DataProviderAlg(), and img::DataProviderAlg::downscaleMean().
|
protectedinherited |
Definition at line 241 of file DataProviderAlg.h.
Referenced by img::DataProviderAlg::DataProviderAlg(), nnet::TrainingDataAlg::getProjection(), and img::DataProviderAlg::setWireDriftData().
|
private |
Definition at line 152 of file PointIdAlg.h.
Referenced by PointIdAlg(), predictIdValue(), predictIdVector(), and predictIdVectors().
|
private |
Definition at line 150 of file PointIdAlg.h.
Referenced by PointIdAlg().
|
private |
Definition at line 151 of file PointIdAlg.h.
Referenced by PointIdAlg().
|
private |
Definition at line 155 of file PointIdAlg.h.
Referenced by isInsideFiducialRegion(), predictIdVectors(), and resizePatch().
|
private |
Definition at line 155 of file PointIdAlg.h.
Referenced by isInsideFiducialRegion(), predictIdVectors(), and resizePatch().
|
mutableprivate |
Definition at line 154 of file PointIdAlg.h.
Referenced by predictIdValue(), predictIdVector(), and resizePatch().