LArSoft
v09_90_00
Liquid Argon Software toolkit - https://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, int readoutWindowSize) |
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) const |
Find clusters in the histogram. More... | |
int | GlobalWire (geo::WireID const &wireID) const |
Find the global wire position. More... | |
std::vector< std::vector< double > > | GaussianBlur (std::vector< std::vector< double >> const &image) const |
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) const |
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 const > | fGeom |
lariov::ChannelStatusProvider const & | fChanStatus |
Definition at line 51 of file BlurredClusteringAlg.h.
cluster::BlurredClusteringAlg::BlurredClusteringAlg | ( | fhicl::ParameterSet const & | pset | ) |
Definition at line 37 of file BlurredClusteringAlg.cxx.
References fAllKernels, fBlurTick, fBlurWire, fChargeThreshold, fClusterTickDistance, fClusterWireDistance, fDetector, fKernelHeight, fKernelWidth, fMaxTickWidthBlur, fMinNeighbours, fMinSeed, fMinSize, fNeighboursThreshold, fSigmaTick, fSigmaWire, fTimeThreshold, fhicl::ParameterSet::get(), and MakeKernels().
cluster::BlurredClusteringAlg::~BlurredClusteringAlg | ( | ) |
Definition at line 58 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 108 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 600 of file BlurredClusteringAlg.cxx.
References bin, ConvertBinToRecobHit(), hits(), art::Ptr< T >::isNull(), and art::PtrVector< T >::push_back().
Referenced by ConvertBinsToClusters().
|
private |
Returns the charge stored in the global bin value.
Definition at line 637 of file BlurredClusteringAlg.cxx.
Referenced by FindClusters().
|
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 620 of file BlurredClusteringAlg.cxx.
References fHitMap.
Referenced by ConvertBinsToRecobHits(), and GetTimeOfBin().
std::vector< std::vector< double > > cluster::BlurredClusteringAlg::ConvertRecobHitsToVector | ( | std::vector< art::Ptr< recob::Hit >> const & | hits, |
int | readoutWindowSize | ||
) |
Takes hit map and returns a 2D vector representing wire and tick, filled with the charge.
Definition at line 133 of file BlurredClusteringAlg.cxx.
References fChanStatus, fDeadWires, fGeom, fHitMap, fLowerTick, fLowerWire, fUpperTick, fUpperWire, GlobalWire(), hits(), geo::GeometryCore::MaxWires(), geo::GeometryCore::PlaneWireToChannel(), lar::to_element, and lar::dump::vector().
Referenced by cluster::BlurredClustering::produce().
|
private |
Converts an xbin and a ybin to a global bin number.
Definition at line 629 of file BlurredClusteringAlg.cxx.
Referenced by FindClusters().
void cluster::BlurredClusteringAlg::CreateDebugPDF | ( | int | run, |
int | subrun, | ||
int | event | ||
) |
Create the PDF to save debug images.
Definition at line 68 of file BlurredClusteringAlg.cxx.
References fDebugCanvas, fDebugPDFName, and tca::Length().
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 646 of file BlurredClusteringAlg.cxx.
References fDeadWires, fLowerWire, and fUpperWire.
Referenced by GaussianBlur().
|
private |
Dynamically find the blurring radii and Gaussian sigma in each dimension.
Definition at line 669 of file BlurredClusteringAlg.cxx.
References util::abs(), fBlurTick, fBlurWire, fHitMap, fLowerTick, fLowerWire, fSigmaTick, fSigmaWire, x, and y.
Referenced by GaussianBlur().
int cluster::BlurredClusteringAlg::FindClusters | ( | std::vector< std::vector< double >> const & | image, |
std::vector< std::vector< int >> & | allcluster | ||
) | const |
Find clusters in the histogram.
Definition at line 187 of file BlurredClusteringAlg.cxx.
References bin, ConvertBinToCharge(), ConvertWireTickToBin(), fChargeThreshold, fClusterTickDistance, fClusterWireDistance, fMinNeighbours, fMinSeed, fMinSize, fNeighboursThreshold, GetTimeOfBin(), nbinsx, NumNeighbours(), PassesTimeCut(), util::values(), x, and y.
Referenced by cluster::BlurredClustering::produce().
std::vector< std::vector< double > > cluster::BlurredClusteringAlg::GaussianBlur | ( | std::vector< std::vector< double >> const & | image | ) | const |
Applies Gaussian blur to image.
Definition at line 417 of file BlurredClusteringAlg.cxx.
References DeadWireCount(), fAllKernels, fDeadWires, fHitMap, FindBlurringParameters(), fKernelHeight, fKernelWidth, fMaxTickWidthBlur, fSigmaTick, fSigmaWire, nbinsx, weight, x, and y.
Referenced by cluster::BlurredClustering::produce().
|
inlinenoexcept |
Minimum size of cluster to save.
Definition at line 81 of file BlurredClusteringAlg.h.
References bin, tca::DeadWireCount(), and lar::dump::vector().
Referenced by cluster::BlurredClustering::produce().
|
private |
Returns the hit time of a hit in a particular bin.
Definition at line 700 of file BlurredClusteringAlg.cxx.
References ConvertBinToRecobHit().
Referenced by FindClusters().
int cluster::BlurredClusteringAlg::GlobalWire | ( | geo::WireID const & | wireID | ) | const |
Find the global wire position.
Definition at line 372 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 | ||
) | const |
Converts a 2D vector in a histogram for the debug pdf.
Definition at line 482 of file BlurredClusteringAlg.cxx.
References fLowerTick, fLowerWire, fUpperTick, fUpperWire, and hist.
Referenced by cluster::BlurredClustering::produce().
|
private |
Makes all the kernels which could be required given the tuned parameters.
Definition at line 707 of file BlurredClusteringAlg.cxx.
References fBlurTick, fBlurWire, fKernelHeight, fKernelWidth, fMaxTickWidthBlur, fSigmaTick, fSigmaWire, value, and lar::dump::vector().
Referenced by BlurredClusteringAlg().
|
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 744 of file BlurredClusteringAlg.cxx.
Referenced by FindClusters().
|
private |
Determine if a hit is within a time threshold of any other hits in a cluster.
Definition at line 770 of file BlurredClusteringAlg.cxx.
References util::abs(), and fTimeThreshold.
Referenced by FindClusters().
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 508 of file BlurredClusteringAlg.cxx.
References bin, fLowerTick, fLowerWire, fMinSize, and GlobalWire().
Referenced by 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 538 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 547 of file BlurredClusteringAlg.cxx.
References bin, fDebugCanvas, fDebugPDFName, fLowerTick, fLowerWire, and z.
|
private |
Definition at line 159 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), and GaussianBlur().
|
private |
Definition at line 144 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), FindBlurringParameters(), and MakeKernels().
|
private |
Definition at line 143 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), FindBlurringParameters(), and MakeKernels().
|
private |
Definition at line 174 of file BlurredClusteringAlg.h.
Referenced by ConvertRecobHitsToVector().
|
private |
Definition at line 155 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), and FindClusters().
|
private |
Definition at line 149 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), and FindClusters().
|
private |
Definition at line 148 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), and FindClusters().
|
private |
Definition at line 163 of file BlurredClusteringAlg.h.
Referenced by ConvertRecobHitsToVector(), DeadWireCount(), and GaussianBlur().
|
private |
Definition at line 139 of file BlurredClusteringAlg.h.
|
private |
Definition at line 169 of file BlurredClusteringAlg.h.
Referenced by CreateDebugPDF(), SaveImage(), and ~BlurredClusteringAlg().
|
private |
Definition at line 170 of file BlurredClusteringAlg.h.
Referenced by CreateDebugPDF(), SaveImage(), and ~BlurredClusteringAlg().
|
private |
Definition at line 140 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), and GlobalWire().
|
private |
Definition at line 173 of file BlurredClusteringAlg.h.
Referenced by ConvertRecobHitsToVector(), and GlobalWire().
|
private |
Definition at line 162 of file BlurredClusteringAlg.h.
Referenced by ConvertBinToRecobHit(), ConvertRecobHitsToVector(), FindBlurringParameters(), and GaussianBlur().
|
private |
Definition at line 158 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), GaussianBlur(), and MakeKernels().
|
private |
Definition at line 158 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), GaussianBlur(), and MakeKernels().
|
private |
Definition at line 165 of file BlurredClusteringAlg.h.
Referenced by ConvertRecobHitsToVector(), FindBlurringParameters(), MakeHistogram(), and SaveImage().
|
private |
Definition at line 166 of file BlurredClusteringAlg.h.
Referenced by ConvertRecobHitsToVector(), DeadWireCount(), FindBlurringParameters(), MakeHistogram(), and SaveImage().
|
private |
Definition at line 147 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), GaussianBlur(), and MakeKernels().
|
private |
Definition at line 151 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), and FindClusters().
|
private |
Definition at line 153 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), and FindClusters().
|
private |
Definition at line 152 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), ConvertBinsToClusters(), FindClusters(), and SaveImage().
|
private |
Definition at line 150 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), and FindClusters().
|
private |
Definition at line 146 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), FindBlurringParameters(), GaussianBlur(), and MakeKernels().
|
private |
Definition at line 145 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), FindBlurringParameters(), GaussianBlur(), and MakeKernels().
|
private |
Definition at line 154 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), and PassesTimeCut().
|
private |
Definition at line 165 of file BlurredClusteringAlg.h.
Referenced by ConvertRecobHitsToVector(), and MakeHistogram().
|
private |
Definition at line 166 of file BlurredClusteringAlg.h.
Referenced by ConvertRecobHitsToVector(), DeadWireCount(), and MakeHistogram().