49 class BlurredClustering;
82 produces<std::vector<recob::Cluster>>();
83 produces<art::Assns<recob::Cluster, recob::Hit>>();
92 auto clusters = std::make_unique<std::vector<recob::Cluster>>();
93 auto associations = std::make_unique<art::Assns<recob::Cluster, recob::Hit>>();
105 int const readoutWindowSize = detProp.ReadOutWindowSize();
109 std::vector<art::Ptr<recob::Hit>>
hits;
110 std::vector<art::Ptr<recob::Hit>> hitsToCluster;
117 std::vector<art::Ptr<recob::Track>> tracks;
123 std::vector<art::Ptr<recob::SpacePoint>> spacePoints;
129 std::vector<art::Ptr<recob::Vertex>> vertices;
135 std::vector<art::Ptr<recob::PFParticle>> pfParticles;
141 if (trackCollection.
isValid()) {
147 evt.
event(),
hits, tracks, spacePoints, fmht, fmth, fmspt, fmtsp);
151 hitsToCluster =
hits;
154 std::map<std::pair<int, int>, std::vector<art::Ptr<recob::Hit>>> planeToHits;
155 for (
auto const& hitToCluster : hitsToCluster) {
156 auto const& wireID = hitToCluster->WireID();
157 auto const planeNo = wireID.Plane;
159 planeToHits[std::make_pair(planeNo, tpc)].push_back(hitToCluster);
163 for (
auto const& [plane, hits] : planeToHits) {
164 std::vector<art::PtrVector<recob::Hit>> finalClusters;
174 std::vector<std::vector<int>>
177 mf::LogVerbatim(
"Blurred Clustering") <<
"Found " << numClusters <<
" clusters" << std::endl;
180 std::vector<art::PtrVector<recob::Hit>> planeClusters;
187 <<
"After merging, there are " << numMergedClusters <<
" clusters" << std::endl;
190 finalClusters = planeClusters;
194 std::stringstream name;
195 name <<
"blurred_image";
197 name <<
"_convolved";
199 auto const [planeNo, tpc] = plane;
205 blurredHist->Delete();
211 for (
auto const& clusterHits : finalClusters) {
212 if (clusterHits.empty())
continue;
215 unsigned int const startWire =
220 ClusterParamAlgo.ImportHits(gser, clusterHits);
227 clusterHits.front()->PeakTime(),
228 clusterHits.front()->SigmaPeakTime(),
231 clusterHits.back()->PeakTime(),
232 clusterHits.back()->SigmaPeakTime(),
234 clusterHits.front()->View(),
235 clusterHits.front()->WireID().planeID(),
238 clusters->emplace_back(
cluster.move());
245 evt.
put(std::move(clusters));
246 evt.
put(std::move(associations));
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
SubRunNumber_t subRun() const
bool const fCreateDebugPDF
int MergeClusters(std::vector< art::PtrVector< recob::Hit >> const &planeClusters, std::vector< art::PtrVector< recob::Hit >> &clusters) const
TH2F * MakeHistogram(std::vector< std::vector< double >> const &image, TString name) const
Converts a 2D vector in a histogram for the debug pdf.
Class managing the creation of a new recob::Cluster object.
std::string const fPFParticleModuleLabel
bool const fShowerReconOnly
Declaration of signal hit object.
EDProducer(fhicl::ParameterSet const &pset)
cluster::MergeClusterAlg fMergeClusterAlg
std::string const fHitsModuleLabel
Cluster finding and building.
int FindClusters(std::vector< std::vector< double >> const &image, std::vector< std::vector< int >> &allcluster) const
Find clusters in the histogram.
static const SentryArgument_t Sentry
An instance of the sentry object.
bool isValid() const noexcept
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
void CreateDebugPDF(int run, int subrun, int event)
Create the PDF to save debug images.
bool const fGlobalTPCRecon
#define DEFINE_ART_MODULE(klass)
BlurredClustering(fhicl::ParameterSet const &pset)
Helper functions to create a cluster.
Wrapper for ClusterParamsAlgBase objects to accept diverse input.
int GlobalWire(geo::WireID const &wireID) const
Find the global wire position.
Provides recob::Track data product.
Wrapper for ClusterParamsAlgBase objects to accept arbitrary input.
std::vector< std::vector< double > > GaussianBlur(std::vector< std::vector< double >> const &image) const
Applies Gaussian blur to image.
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
bool CreateAssn(art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
Creates a single one-to-one association.
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
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...
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Utility object to perform functions of association.
cluster::BlurredClusteringAlg fBlurredClusteringAlg
Interface to class computing cluster parameters.
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
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) const
bool const fMergeClusters
art framework interface to geometry description
unsigned int GetMinSize() const noexcept
Minimum size of cluster to save.
std::string const fVertexModuleLabel