51 class BlurredClustering;
83 produces<std::vector<recob::Cluster>>();
84 produces<art::Assns<recob::Cluster,recob::Hit>>();
94 auto clusters = std::make_unique<std::vector<recob::Cluster>>();
95 auto associations = std::make_unique<art::Assns<recob::Cluster,recob::Hit>>();
106 std::vector<art::Ptr<recob::Hit>>
hits;
107 std::vector<art::Ptr<recob::Hit>> hitsToCluster;
115 std::vector<art::Ptr<recob::Track>> tracks;
121 std::vector<art::Ptr<recob::SpacePoint>> spacePoints;
127 std::vector<art::Ptr<recob::Vertex>> vertices;
133 std::vector<art::Ptr<recob::PFParticle>> pfParticles;
139 if (trackCollection.
isValid()) {
148 hitsToCluster =
hits;
151 std::map<std::pair<int, int>, std::vector<art::Ptr<recob::Hit>>> planeToHits;
152 for (
auto const& hitToCluster : hitsToCluster) {
153 auto const& wireID = hitToCluster->WireID();
154 auto const planeNo = wireID.Plane;
156 planeToHits[std::make_pair(planeNo, tpc)].push_back(hitToCluster);
160 for (
auto const& [plane, hits] : planeToHits) {
161 std::vector<art::PtrVector<recob::Hit>> finalClusters;
171 std::vector<std::vector<int>> allClusterBins;
173 mf::LogVerbatim(
"Blurred Clustering") <<
"Found " << numClusters <<
" clusters" << std::endl;
176 std::vector<art::PtrVector<recob::Hit>> planeClusters;
182 mf::LogVerbatim(
"Blurred Clustering") <<
"After merging, there are " << numMergedClusters <<
" clusters" << std::endl;
184 else finalClusters = planeClusters;
188 std::stringstream name;
189 name <<
"blurred_image";
191 name <<
"_convolved";
193 auto const [planeNo, tpc] = plane;
199 blurredHist->Delete();
205 for (
auto const& clusterHits : finalClusters) {
206 if (clusterHits.empty())
continue;
213 ClusterParamAlgo.ImportHits(clusterHits);
219 clusterHits.front()->PeakTime(),
220 clusterHits.front()->SigmaPeakTime(),
223 clusterHits.back()->PeakTime(),
224 clusterHits.back()->SigmaPeakTime(),
226 clusterHits.front()->View(),
227 clusterHits.front()->WireID().planeID(),
230 clusters->emplace_back(
cluster.move());
238 evt.
put(std::move(clusters));
239 evt.
put(std::move(associations));
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
SubRunNumber_t subRun() const
bool const fCreateDebugPDF
Class managing the creation of a new recob::Cluster object.
std::string const fPFParticleModuleLabel
Encapsulate the construction of a single cyostat.
bool const fShowerReconOnly
Declaration of signal hit object.
int MergeClusters(std::vector< art::PtrVector< recob::Hit > > const &planeClusters, std::vector< art::PtrVector< recob::Hit > > &clusters)
cluster::MergeClusterAlg fMergeClusterAlg
std::string const fHitsModuleLabel
std::vector< art::Ptr< recob::Hit > > SelectShowerHits(int event, const std::vector< art::Ptr< recob::Hit > > &hits, const std::vector< art::Ptr< recob::Track > > &tracks, const std::vector< art::Ptr< recob::SpacePoint > > &spacePoints, const art::FindManyP< recob::Hit > &fmht, const art::FindManyP< recob::Track > &fmth, const art::FindManyP< recob::SpacePoint > &fmspt, const art::FindManyP< recob::Track > &fmtsp)
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...
Cluster finding and building.
int FindClusters(std::vector< std::vector< double >> const &image, std::vector< std::vector< int >> &allcluster)
Find clusters in the histogram.
static const SentryArgument_t Sentry
An instance of the sentry object.
ProductID put(std::unique_ptr< PROD > &&product)
void CreateDebugPDF(int run, int subrun, int event)
Create the PDF to save debug images.
bool const fGlobalTPCRecon
#define DEFINE_ART_MODULE(klass)
Provides recob::Track data product.
BlurredClustering(fhicl::ParameterSet const &pset)
TH2F * MakeHistogram(std::vector< std::vector< double >> const &image, TString name)
Converts a 2D vector in a histogram for the debug pdf.
Helper functions to create a cluster.
Wrapper for ClusterParamsAlgBase objects to accept diverse input.
T get(std::string const &key) const
Wrapper for ClusterParamsAlgBase objects to accept arbitrary input.
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
EventNumber_t event() const
void SaveImage(TH2F *image, std::vector< art::PtrVector< recob::Hit >> const &allClusters, int pad, int tpc, int plane)
Declaration of cluster object.
void produce(art::Event &evt) override
shower::TrackShowerSeparationAlg fTrackShowerSeparationAlg
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 h...
std::string const fTrackModuleLabel
Utility object to perform functions of association.
cluster::BlurredClusteringAlg fBlurredClusteringAlg
Encapsulate the construction of a single detector plane.
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
std::vector< std::vector< double > > GaussianBlur(std::vector< std::vector< double >> const &image)
Applies Gaussian blur to image.
Interface to class computing cluster parameters.
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
bool const fMergeClusters
art framework interface to geometry description
unsigned int GetMinSize() const noexcept
Minimum size of cluster to save.
std::string const fVertexModuleLabel
Encapsulate the construction of a single detector plane.
int GlobalWire(geo::WireID const &wireID)
Find the global wire position.