LArSoft
v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
|
#include "BlurredClusteringAlg.h"
Public Member Functions | |
BlurredClusteringAlg (fhicl::ParameterSet const &pset) | |
virtual | ~BlurredClusteringAlg () |
void | reconfigure (fhicl::ParameterSet const &p) |
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) |
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 () |
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) |
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) |
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) |
Converts an xbin and a ybin to a global bin number. More... | |
double | ConvertBinToCharge (std::vector< std::vector< double > > const &image, int bin) |
Returns the charge stored in the global bin value. More... | |
std::pair< int, int > | DeadWireCount (int wire_bin, int width) |
void | FindBlurringParameters (int &blurwire, int &blurtick, int &sigmawire, int &sigmatick) |
Dynamically find the blurring radii and Gaussian sigma in each dimension. More... | |
double | GetTimeOfBin (std::vector< std::vector< double > > const &image, int bin) |
Returns the hit time of a hit in a particular bin. More... | |
void | MakeKernels () |
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) |
Determines the number of clustered neighbours of a hit. More... | |
bool | PassesTimeCut (std::vector< double > const ×, double time) |
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 |
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 |
std::string | fDebugPDFName |
art::ServiceHandle< geo::Geometry > | fGeom |
detinfo::DetectorProperties const * | fDetProp |
lariov::ChannelStatusProvider const & | fChanStatus = art::ServiceHandle<lariov::ChannelStatusService>()->GetProvider() |
Definition at line 69 of file BlurredClusteringAlg.h.
cluster::BlurredClusteringAlg::BlurredClusteringAlg | ( | fhicl::ParameterSet const & | pset | ) |
Definition at line 14 of file BlurredClusteringAlg.cxx.
References fDebugCanvas, fDebugPDFName, MakeKernels(), and reconfigure().
|
virtual |
Definition at line 25 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 | ||
) |
Takes a vector of clusters (itself a vector of hits) and turns them into clusters using the initial hit selection.
Definition at line 127 of file BlurredClusteringAlg.cxx.
References ConvertBinsToRecobHits(), fMinSize, art::PtrVector< T >::size(), and lar::dump::vector().
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 98 of file BlurredClusteringAlg.cxx.
References 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 212 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 118 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 154 of file BlurredClusteringAlg.cxx.
References geo::CryostatID::Cryostat, fChanStatus, fDeadWires, fDetProp, fGeom, fHitMap, fLowerTick, fLowerWire, fUpperTick, fUpperWire, GlobalWire(), hits(), geo::GeometryCore::MaxWires(), geo::PlaneID::Plane, geo::GeometryCore::PlaneWireToChannel(), detinfo::DetectorProperties::ReadOutWindowSize(), geo::TPCID::TPC, and lar::dump::vector().
Referenced by cluster::BlurredClustering::produce().
|
private |
Converts an xbin and a ybin to a global bin number.
Definition at line 206 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 57 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 221 of file BlurredClusteringAlg.cxx.
References fDeadWires, fLowerWire, and fUpperWire.
Referenced by GaussianBlur(), and GetMinSize().
|
private |
Dynamically find the blurring radii and Gaussian sigma in each dimension.
Definition at line 241 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 282 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 521 of file BlurredClusteringAlg.cxx.
References DeadWireCount(), fAllKernels, fDeadWires, fHitMap, FindBlurringParameters(), fKernelHeight, fKernelWidth, fMaxTickWidthBlur, fSigmaTick, fSigmaWire, weight, x, and y.
Referenced by cluster::BlurredClustering::produce().
|
inline |
Minimum size of cluster to save.
Definition at line 98 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 605 of file BlurredClusteringAlg.cxx.
References ConvertBinToRecobHit(), art::Ptr< T >::isNull(), and recob::Hit::PeakTime().
Referenced by FindClusters(), and GetMinSize().
int cluster::BlurredClusteringAlg::GlobalWire | ( | geo::WireID const & | wireID | ) |
Find the global wire position.
Definition at line 480 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 655 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 617 of file BlurredClusteringAlg.cxx.
References fAllKernels, 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 675 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 697 of file BlurredClusteringAlg.cxx.
References fTimeThreshold.
Referenced by FindClusters(), and GetMinSize().
void cluster::BlurredClusteringAlg::reconfigure | ( | fhicl::ParameterSet const & | p | ) |
Definition at line 34 of file BlurredClusteringAlg.cxx.
References fBlurTick, fBlurWire, fChargeThreshold, fClusterTickDistance, fClusterWireDistance, fDebug, fDetector, fDetProp, fKernelHeight, fKernelWidth, fMaxTickWidthBlur, fMinNeighbours, fMinSeed, fMinSize, fNeighboursThreshold, fSigmaTick, fSigmaWire, fTimeThreshold, and fhicl::ParameterSet::get().
Referenced by BlurredClusteringAlg(), and cluster::BlurredClustering::reconfigure().
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 706 of file BlurredClusteringAlg.cxx.
References art::PtrVector< T >::begin(), bin, art::PtrVector< T >::end(), fLowerTick, fLowerWire, fMinSize, GlobalWire(), recob::Hit::PeakTime(), art::PtrVector< T >::size(), lar::dump::vector(), and recob::Hit::WireID().
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 736 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 741 of file BlurredClusteringAlg.cxx.
References bin, fDebugCanvas, fDebugPDFName, fLowerTick, fLowerWire, lar::dump::vector(), and z.
|
private |
Definition at line 168 of file BlurredClusteringAlg.h.
Referenced by GaussianBlur(), and MakeKernels().
|
private |
Definition at line 152 of file BlurredClusteringAlg.h.
Referenced by FindBlurringParameters(), MakeKernels(), and reconfigure().
|
private |
Definition at line 151 of file BlurredClusteringAlg.h.
Referenced by FindBlurringParameters(), MakeKernels(), and reconfigure().
|
private |
Definition at line 184 of file BlurredClusteringAlg.h.
Referenced by ConvertRecobHitsToVector().
|
private |
Definition at line 164 of file BlurredClusteringAlg.h.
Referenced by FindClusters(), and reconfigure().
|
private |
Definition at line 157 of file BlurredClusteringAlg.h.
Referenced by FindClusters(), and reconfigure().
|
private |
Definition at line 156 of file BlurredClusteringAlg.h.
Referenced by FindClusters(), and reconfigure().
|
private |
Definition at line 172 of file BlurredClusteringAlg.h.
Referenced by ConvertRecobHitsToVector(), DeadWireCount(), and GaussianBlur().
|
private |
Definition at line 147 of file BlurredClusteringAlg.h.
Referenced by reconfigure().
|
private |
Definition at line 178 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), CreateDebugPDF(), SaveImage(), and ~BlurredClusteringAlg().
|
private |
Definition at line 179 of file BlurredClusteringAlg.h.
Referenced by BlurredClusteringAlg(), CreateDebugPDF(), SaveImage(), and ~BlurredClusteringAlg().
|
private |
Definition at line 148 of file BlurredClusteringAlg.h.
Referenced by GlobalWire(), and reconfigure().
|
private |
Definition at line 183 of file BlurredClusteringAlg.h.
Referenced by ConvertRecobHitsToVector(), and reconfigure().
|
private |
Definition at line 182 of file BlurredClusteringAlg.h.
Referenced by ConvertRecobHitsToVector(), and GlobalWire().
|
private |
Definition at line 171 of file BlurredClusteringAlg.h.
Referenced by ConvertBinToRecobHit(), ConvertRecobHitsToVector(), FindBlurringParameters(), and GaussianBlur().
|
private |
Definition at line 167 of file BlurredClusteringAlg.h.
Referenced by GaussianBlur(), MakeKernels(), and reconfigure().
|
private |
Definition at line 167 of file BlurredClusteringAlg.h.
Referenced by GaussianBlur(), MakeKernels(), and reconfigure().
|
private |
Definition at line 174 of file BlurredClusteringAlg.h.
Referenced by ConvertRecobHitsToVector(), FindBlurringParameters(), MakeHistogram(), and SaveImage().
|
private |
Definition at line 175 of file BlurredClusteringAlg.h.
Referenced by ConvertRecobHitsToVector(), DeadWireCount(), FindBlurringParameters(), MakeHistogram(), and SaveImage().
|
private |
Definition at line 155 of file BlurredClusteringAlg.h.
Referenced by GaussianBlur(), MakeKernels(), and reconfigure().
|
private |
Definition at line 160 of file BlurredClusteringAlg.h.
Referenced by FindClusters(), and reconfigure().
|
private |
Definition at line 162 of file BlurredClusteringAlg.h.
Referenced by FindClusters(), and reconfigure().
|
private |
Definition at line 161 of file BlurredClusteringAlg.h.
Referenced by ConvertBinsToClusters(), FindClusters(), GetMinSize(), reconfigure(), and SaveImage().
|
private |
Definition at line 159 of file BlurredClusteringAlg.h.
Referenced by FindClusters(), and reconfigure().
|
private |
Definition at line 154 of file BlurredClusteringAlg.h.
Referenced by FindBlurringParameters(), GaussianBlur(), MakeKernels(), and reconfigure().
|
private |
Definition at line 153 of file BlurredClusteringAlg.h.
Referenced by FindBlurringParameters(), GaussianBlur(), MakeKernels(), and reconfigure().
|
private |
Definition at line 163 of file BlurredClusteringAlg.h.
Referenced by PassesTimeCut(), and reconfigure().
|
private |
Definition at line 174 of file BlurredClusteringAlg.h.
Referenced by ConvertRecobHitsToVector(), and MakeHistogram().
|
private |
Definition at line 175 of file BlurredClusteringAlg.h.
Referenced by ConvertRecobHitsToVector(), DeadWireCount(), and MakeHistogram().