LArSoft
v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
|
#include "BlurredClusteringAlg.h"
Public Member Functions | |
BlurredClusteringAlg (fhicl::ParameterSet const &pset) | |
~BlurredClusteringAlg () | |
void | CreateDebugPDF (int run, int subrun, int event) |
Create the PDF to save debug images. More... | |
void | ConvertBinsToClusters (std::vector< std::vector< double >> const &image, std::vector< std::vector< int >> const &allClusterBins, std::vector< art::PtrVector< recob::Hit >> &clusters) const |
Takes a vector of clusters (itself a vector of hits) and turns them into clusters using the initial hit selection. More... | |
std::vector< std::vector< double > > | ConvertRecobHitsToVector (std::vector< art::Ptr< recob::Hit >> const &hits) |
Takes hit map and returns a 2D vector representing wire and tick, filled with the charge. More... | |
int | FindClusters (std::vector< std::vector< double >> const &image, std::vector< std::vector< int >> &allcluster) |
Find clusters in the histogram. More... | |
int | GlobalWire (geo::WireID const &wireID) |
Find the global wire position. More... | |
std::vector< std::vector< double > > | GaussianBlur (std::vector< std::vector< double >> const &image) |
Applies Gaussian blur to image. More... | |
unsigned int | GetMinSize () const noexcept |
Minimum size of cluster to save. More... | |
TH2F * | MakeHistogram (std::vector< std::vector< double >> const &image, TString name) |
Converts a 2D vector in a histogram for the debug pdf. More... | |
void | SaveImage (TH2F *image, std::vector< art::PtrVector< recob::Hit >> const &allClusters, int pad, int tpc, int plane) |
void | SaveImage (TH2F *image, int pad, int tpc, int plane) |
Save the images for debugging. More... | |
void | SaveImage (TH2F *image, std::vector< std::vector< int >> const &allClusterBins, int pad, int tpc, int plane) |
Private Member Functions | |
art::PtrVector< recob::Hit > | ConvertBinsToRecobHits (std::vector< std::vector< double >> const &image, std::vector< int > const &bins) const |
Converts a vector of bins into a hit selection - not all the hits in the bins vector are real hits. More... | |
art::Ptr< recob::Hit > | ConvertBinToRecobHit (std::vector< std::vector< double >> const &image, int bin) const |
Converts a bin into a recob::Hit (not all of these bins correspond to recob::Hits - some are fake hits created by the blurring) More... | |
int | ConvertWireTickToBin (std::vector< std::vector< double >> const &image, int xbin, int ybin) const |
Converts an xbin and a ybin to a global bin number. More... | |
double | ConvertBinToCharge (std::vector< std::vector< double >> const &image, int bin) const |
Returns the charge stored in the global bin value. More... | |
std::pair< int, int > | DeadWireCount (int wire_bin, int width) const |
std::array< int, 4 > | FindBlurringParameters () const |
Dynamically find the blurring radii and Gaussian sigma in each dimension. More... | |
double | GetTimeOfBin (std::vector< std::vector< double >> const &image, int bin) const |
Returns the hit time of a hit in a particular bin. More... | |
std::vector< std::vector< std::vector< double > > > | MakeKernels () const |
Makes all the kernels which could be required given the tuned parameters. More... | |
unsigned int | NumNeighbours (int nx, std::vector< bool > const &used, int bin) const |
Determines the number of clustered neighbours of a hit. More... | |
bool | PassesTimeCut (std::vector< double > const ×, double time) const |
Determine if a hit is within a time threshold of any other hits in a cluster. More... | |
Private Attributes | |
bool | fDebug |
std::string | fDetector |
int | fBlurWire |
int | fBlurTick |
double | fSigmaWire |
double | fSigmaTick |
int | fMaxTickWidthBlur |
int | fClusterWireDistance |
int | fClusterTickDistance |
unsigned int | fNeighboursThreshold |
unsigned int | fMinNeighbours |
unsigned int | fMinSize |
double | fMinSeed |
double | fTimeThreshold |
double | fChargeThreshold |
int | fKernelWidth |
int | fKernelHeight |
std::vector< std::vector< std::vector< double > > > | fAllKernels |
std::vector< std::vector< art::Ptr< recob::Hit > > > | fHitMap |
std::vector< bool > | fDeadWires |
int | fLowerTick |
int | fUpperTick |
int | fLowerWire |
int | fUpperWire |
TCanvas * | fDebugCanvas {nullptr} |
std::string | fDebugPDFName {} |
art::ServiceHandle< geo::Geometry > | fGeom |
detinfo::DetectorProperties const * | fDetProp |
lariov::ChannelStatusProvider const & | fChanStatus {art::ServiceHandle<lariov::ChannelStatusService>()->GetProvider()} |
Definition at line 70 of file BlurredClusteringAlg.h.
cluster::BlurredClusteringAlg::BlurredClusteringAlg | ( | fhicl::ParameterSet const & | pset | ) |
Definition at line 18 of file BlurredClusteringAlg.cxx.
References fAllKernels, fBlurTick, fBlurWire, fChargeThreshold, fClusterTickDistance, fClusterWireDistance, fDetector, fDetProp, fKernelHeight, fKernelWidth, fMaxTickWidthBlur, fMinNeighbours, fMinSeed, fMinSize, fNeighboursThreshold, fSigmaTick, fSigmaWire, fTimeThreshold, fhicl::ParameterSet::get(), and MakeKernels().
cluster::BlurredClusteringAlg::~BlurredClusteringAlg | ( | ) |
Definition at line 40 of file BlurredClusteringAlg.cxx.
References fDebugCanvas, and fDebugPDFName.
void cluster::BlurredClusteringAlg::ConvertBinsToClusters | ( | std::vector< std::vector< double >> const & | image, |
std::vector< std::vector< int >> const & | allClusterBins, | ||
std::vector< art::PtrVector< recob::Hit >> & | clusters | ||
) | const |
Takes a vector of clusters (itself a vector of hits) and turns them into clusters using the initial hit selection.
Definition at line 92 of file BlurredClusteringAlg.cxx.
References ConvertBinsToRecobHits(), fMinSize, and art::PtrVector< T >::size().
Referenced by cluster::BlurredClustering::produce().
|
private |
Converts a vector of bins into a hit selection - not all the hits in the bins vector are real hits.
Definition at line 594 of file BlurredClusteringAlg.cxx.
References bin, ConvertBinToRecobHit(), hits(), art::Ptr< T >::isNull(), and art::PtrVector< T >::push_back().
Referenced by ConvertBinsToClusters(), and GetMinSize().
|
private |
Returns the charge stored in the global bin value.
Definition at line 632 of file BlurredClusteringAlg.cxx.
Referenced by FindClusters(), and GetMinSize().
|
private |
Converts a bin into a recob::Hit (not all of these bins correspond to recob::Hits - some are fake hits created by the blurring)
Definition at line 615 of file BlurredClusteringAlg.cxx.
References fHitMap.
Referenced by ConvertBinsToRecobHits(), GetMinSize(), and GetTimeOfBin().
std::vector< std::vector< double > > cluster::BlurredClusteringAlg::ConvertRecobHitsToVector | ( | std::vector< art::Ptr< recob::Hit >> const & | hits | ) |
Takes hit map and returns a 2D vector representing wire and tick, filled with the charge.
Definition at line 114 of file BlurredClusteringAlg.cxx.
References fChanStatus, fDeadWires, fDetProp, fGeom, fHitMap, fLowerTick, fLowerWire, fUpperTick, fUpperWire, GlobalWire(), hits(), geo::GeometryCore::MaxWires(), geo::GeometryCore::PlaneWireToChannel(), detinfo::DetectorProperties::ReadOutWindowSize(), and lar::dump::vector().
Referenced by cluster::BlurredClustering::produce().
|
private |
Converts an xbin and a ybin to a global bin number.
Definition at line 624 of file BlurredClusteringAlg.cxx.
Referenced by FindClusters(), and GetMinSize().
void cluster::BlurredClusteringAlg::CreateDebugPDF | ( | int | run, |
int | subrun, | ||
int | event | ||
) |
Create the PDF to save debug images.
Definition at line 50 of file BlurredClusteringAlg.cxx.
References fDebugCanvas, and fDebugPDFName.
Referenced by cluster::BlurredClustering::produce().
|
private |
Count how many dead wires there are in the blurring region for a particular hit Returns a pair of counters representing how many dead wires there are below and above the hit respectively
Definition at line 641 of file BlurredClusteringAlg.cxx.
References fDeadWires, fLowerWire, fUpperWire, max, and min.
Referenced by GaussianBlur(), and GetMinSize().
|
private |
Dynamically find the blurring radii and Gaussian sigma in each dimension.
Definition at line 663 of file BlurredClusteringAlg.cxx.
References fBlurTick, fBlurWire, fHitMap, fLowerTick, fLowerWire, fSigmaTick, fSigmaWire, max, x, and y.
Referenced by GaussianBlur(), and GetMinSize().
int cluster::BlurredClusteringAlg::FindClusters | ( | std::vector< std::vector< double >> const & | image, |
std::vector< std::vector< int >> & | allcluster | ||
) |
Find clusters in the histogram.
Definition at line 163 of file BlurredClusteringAlg.cxx.
References bin, ConvertBinToCharge(), ConvertWireTickToBin(), fChargeThreshold, fClusterTickDistance, fClusterWireDistance, fMinNeighbours, fMinSeed, fMinSize, fNeighboursThreshold, GetTimeOfBin(), NumNeighbours(), PassesTimeCut(), x, and y.
Referenced by cluster::BlurredClustering::produce().
std::vector< std::vector< double > > cluster::BlurredClusteringAlg::GaussianBlur | ( | std::vector< std::vector< double >> const & | image | ) |
Applies Gaussian blur to image.
Definition at line 400 of file BlurredClusteringAlg.cxx.
References DeadWireCount(), fAllKernels, fDeadWires, fHitMap, FindBlurringParameters(), fKernelHeight, fKernelWidth, fMaxTickWidthBlur, fSigmaTick, fSigmaWire, max, min, weight, x, and y.
Referenced by cluster::BlurredClustering::produce().
|
inlinenoexcept |
Minimum size of cluster to save.
Definition at line 97 of file BlurredClusteringAlg.h.
References bin, ConvertBinsToRecobHits(), ConvertBinToCharge(), ConvertBinToRecobHit(), ConvertWireTickToBin(), DeadWireCount(), FindBlurringParameters(), fMinSize, GetTimeOfBin(), MakeHistogram(), MakeKernels(), NumNeighbours(), PassesTimeCut(), SaveImage(), and lar::dump::vector().
Referenced by cluster::BlurredClustering::produce().
|
private |
Returns the hit time of a hit in a particular bin.
Definition at line 696 of file BlurredClusteringAlg.cxx.
References ConvertBinToRecobHit().
Referenced by FindClusters(), and GetMinSize().
int cluster::BlurredClusteringAlg::GlobalWire | ( | geo::WireID const & | wireID | ) |
Find the global wire position.
Definition at line 358 of file BlurredClusteringAlg.cxx.
References geo::CryostatID::Cryostat, fDetector, fGeom, geo::WireGeo::GetCenter(), geo::kInduction, geo::GeometryCore::Nwires(), geo::PlaneID::Plane, geo::GeometryCore::SignalType(), geo::TPCID::TPC, geo::WireID::Wire, geo::GeometryCore::WireCoordinate(), and geo::GeometryCore::WireIDToWireGeo().
Referenced by ConvertRecobHitsToVector(), cluster::BlurredClustering::produce(), and SaveImage().
TH2F * cluster::BlurredClusteringAlg::MakeHistogram | ( | std::vector< std::vector< double >> const & | image, |
TString | name | ||
) |
Converts a 2D vector in a histogram for the debug pdf.
Definition at line 465 of file BlurredClusteringAlg.cxx.
References fLowerTick, fLowerWire, fUpperTick, fUpperWire, and hist.
Referenced by GetMinSize(), and cluster::BlurredClustering::produce().
|
private |
Makes all the kernels which could be required given the tuned parameters.
Definition at line 704 of file BlurredClusteringAlg.cxx.
References fBlurTick, fBlurWire, fKernelHeight, fKernelWidth, fMaxTickWidthBlur, fSigmaTick, fSigmaWire, fhicl::detail::atom::value(), and lar::dump::vector().
Referenced by BlurredClusteringAlg(), and GetMinSize().
|
private |
Determines the number of clustered neighbours of a hit.
2D hists can be considered a string of bins - the equation to convert between them is [bin = x + (nbinsx * y)]
Definition at line 740 of file BlurredClusteringAlg.cxx.
Referenced by FindClusters(), and GetMinSize().
|
private |
Determine if a hit is within a time threshold of any other hits in a cluster.
Definition at line 765 of file BlurredClusteringAlg.cxx.
References fTimeThreshold.
Referenced by FindClusters(), and GetMinSize().
void cluster::BlurredClusteringAlg::SaveImage | ( | TH2F * | image, |
std::vector< art::PtrVector< recob::Hit >> const & | allClusters, | ||
int | pad, | ||
int | tpc, | ||
int | plane | ||
) |
Save the images for debugging This version takes the final clusters and overlays on the hit map
Definition at line 487 of file BlurredClusteringAlg.cxx.
References bin, fLowerTick, fLowerWire, fMinSize, and GlobalWire().
Referenced by GetMinSize(), cluster::BlurredClustering::produce(), and SaveImage().
void cluster::BlurredClusteringAlg::SaveImage | ( | TH2F * | image, |
int | pad, | ||
int | tpc, | ||
int | plane | ||
) |
Save the images for debugging.
Definition at line 519 of file BlurredClusteringAlg.cxx.
References SaveImage().
void cluster::BlurredClusteringAlg::SaveImage | ( | TH2F * | image, |
std::vector< std::vector< int >> const & | allClusterBins, | ||
int | pad, | ||
int | tpc, | ||
int | plane | ||
) |
Save the images for debugging This version takes a vector of bins and overlays the relevant bins on the hit map
Definition at line 529 of file BlurredClusteringAlg.cxx.
References bin, fDebugCanvas, fDebugPDFName, fLowerTick, fLowerWire, and z.
|
private |
Definition at line 166 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), and GaussianBlur().
|
private |
Definition at line 151 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), FindBlurringParameters(), and MakeKernels().
|
private |
Definition at line 150 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), FindBlurringParameters(), and MakeKernels().
|
private |
Definition at line 182 of file BlurredClusteringAlg.h.
Referenced by ConvertRecobHitsToVector().
|
private |
Definition at line 162 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), and FindClusters().
|
private |
Definition at line 156 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), and FindClusters().
|
private |
Definition at line 155 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), and FindClusters().
|
private |
Definition at line 170 of file BlurredClusteringAlg.h.
Referenced by ConvertRecobHitsToVector(), DeadWireCount(), and GaussianBlur().
|
private |
Definition at line 146 of file BlurredClusteringAlg.h.
|
private |
Definition at line 176 of file BlurredClusteringAlg.h.
Referenced by CreateDebugPDF(), SaveImage(), and ~BlurredClusteringAlg().
|
private |
Definition at line 177 of file BlurredClusteringAlg.h.
Referenced by CreateDebugPDF(), SaveImage(), and ~BlurredClusteringAlg().
|
private |
Definition at line 147 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), and GlobalWire().
|
private |
Definition at line 181 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), and ConvertRecobHitsToVector().
|
private |
Definition at line 180 of file BlurredClusteringAlg.h.
Referenced by ConvertRecobHitsToVector(), and GlobalWire().
|
private |
Definition at line 169 of file BlurredClusteringAlg.h.
Referenced by ConvertBinToRecobHit(), ConvertRecobHitsToVector(), FindBlurringParameters(), and GaussianBlur().
|
private |
Definition at line 165 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), GaussianBlur(), and MakeKernels().
|
private |
Definition at line 165 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), GaussianBlur(), and MakeKernels().
|
private |
Definition at line 172 of file BlurredClusteringAlg.h.
Referenced by ConvertRecobHitsToVector(), FindBlurringParameters(), MakeHistogram(), and SaveImage().
|
private |
Definition at line 173 of file BlurredClusteringAlg.h.
Referenced by ConvertRecobHitsToVector(), DeadWireCount(), FindBlurringParameters(), MakeHistogram(), and SaveImage().
|
private |
Definition at line 154 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), GaussianBlur(), and MakeKernels().
|
private |
Definition at line 158 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), and FindClusters().
|
private |
Definition at line 160 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), and FindClusters().
|
private |
Definition at line 159 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), ConvertBinsToClusters(), FindClusters(), GetMinSize(), and SaveImage().
|
private |
Definition at line 157 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), and FindClusters().
|
private |
Definition at line 153 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), FindBlurringParameters(), GaussianBlur(), and MakeKernels().
|
private |
Definition at line 152 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), FindBlurringParameters(), GaussianBlur(), and MakeKernels().
|
private |
Definition at line 161 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), and PassesTimeCut().
|
private |
Definition at line 172 of file BlurredClusteringAlg.h.
Referenced by ConvertRecobHitsToVector(), and MakeHistogram().
|
private |
Definition at line 173 of file BlurredClusteringAlg.h.
Referenced by ConvertRecobHitsToVector(), DeadWireCount(), and MakeHistogram().