7 #ifndef CLUSTERMERGEHELPER_CXX 8 #define CLUSTERMERGEHELPER_CXX 23 std::vector<std::vector<util::PxHit> > px_clusters(clusters.size(),std::vector<util::PxHit>());
25 fInputClusters.resize(clusters.size(),std::vector<art::Ptr<recob::Hit> >());
27 for(
size_t cluster_index=0; cluster_index < clusters.size(); ++cluster_index) {
29 px_clusters.at(cluster_index).resize(clusters.at(cluster_index).size(),
util::PxHit());
31 fInputClusters.at(cluster_index).resize(clusters.at(cluster_index).size());
33 for(
size_t hit_index=0; hit_index < clusters.at(cluster_index).size(); ++hit_index) {
35 px_clusters.at(cluster_index).at(hit_index).plane = clusters.at(cluster_index).at(hit_index)->WireID().Plane;
36 px_clusters.at(cluster_index).at(hit_index).w = clusters.at(cluster_index).at(hit_index)->WireID().Wire *
fGeoU.
WireToCm();
37 px_clusters.at(cluster_index).at(hit_index).t = clusters.at(cluster_index).at(hit_index)->PeakTime() *
fGeoU.
TimeToCm();
38 px_clusters.at(cluster_index).at(hit_index).charge = clusters.at(cluster_index).at(hit_index)->Integral();
40 fInputClusters.at(cluster_index).at(hit_index) = clusters.at(cluster_index).at(hit_index);
56 evt.
getByLabel(cluster_module_label, clusters_h);
62 <<
" Failed to retrieve recob::Cluster with label: " 63 << cluster_module_label.c_str()
67 std::vector<std::vector<art::Ptr<recob::Hit> > > cluster_hits_v;
69 cluster_hits_v.reserve(clusters_h->size());
73 for(
size_t i=0; i<clusters_h->size(); ++i)
75 cluster_hits_v.push_back(hit_m.at(i));
88 <<
"Merged cluster set not empty... Called Process() twice?" 98 std::vector<std::vector<unsigned short> > out_clusters = res.
GetResult();
104 for(
auto const &cluster_index_v : out_clusters) {
106 std::vector<art::Ptr<recob::Hit> > out_cluster;
108 for(
auto const& cluster_index : cluster_index_v) {
110 out_cluster.reserve(out_cluster.size() +
fInputClusters.at(cluster_index).size());
114 out_cluster.push_back(hit_ptr);
132 <<
"You must call Process() before calling " << __FUNCTION__ <<
" to retrieve result." 147 <<
"You must call Process() before calling " << __FUNCTION__ <<
" to retrieve result." 156 std::vector<recob::Cluster> &out_clusters,
164 <<
"You must call Process() before calling " << __FUNCTION__ <<
" to retrieve result." 172 for(
size_t out_index=0; out_index <
GetMergedCPAN().size(); ++out_index) {
180 std::vector<art::Ptr<recob::Hit>>
const&
hits 186 if (!hits.empty()) plane = hits.front()->WireID().planeID();
192 out_clusters.emplace_back(
Algorithm class inheriting pre-computed results.
Algorithm class inheriting cluster parameters.
std::vector< std::vector< art::Ptr< recob::Hit > > > fInputClusters
Input clusters in terms of a vector of art::Ptr<recob::Hit> collection.
PlaneGeo const & Plane(unsigned int const p, unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified wire.
virtual Measure_t EndAngle() override
Computes the angle of the cluster.
virtual size_t NHits() override
Returns the number of hits in the cluster.
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
The data type to uniquely identify a Plane.
Double_t TimeToCm() const
Double_t WireToCm() const
virtual Measure_t SummedADC() override
Computes the total charge of the cluster from Hit::SummedADC()
virtual Measure_t StartCharge() override
Computes the charge on the first and last wire of the track.
Cluster finding and building.
static const SentryArgument_t Sentry
An instance of the sentry object.
const std::vector< std::vector< art::Ptr< recob::Hit > > > & GetMergedClusterHits() const
Utility method to retrieve merged clusters in terms of a vector of art::Ptr<recob::Hit> ...
virtual Measure_t EndOpeningAngle() override
Computes the opening angle at the start or end of the cluster.
virtual Measure_t Integral() override
Computes the total charge of the cluster from Hit::Integral()
void AppendResult(art::EDProducer &ed, art::Event &ev, std::vector< recob::Cluster > &out_clusters, art::Assns< recob::Cluster, recob::Hit > &assns) const
Utility method to append result set to user's data product storage.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
View_t View() const
Which coordinate does this plane measure.
virtual Measure_t EndCharge() override
Computes the charge on the first and last wire of the track.
void Process()
Function to execute CMergeManager::Process()
virtual Measure_t SummedADCStdDev() override
Computes the standard deviation on the charge of the cluster hits.
std::vector< std::vector< art::Ptr< recob::Hit > > > fOutputClusters
Output clusters in terms of a vector of art::Ptr<recob::Hit> collection.
virtual float MultipleHitDensity() override
Fraction of wires in the cluster with more than one hit.
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.
util::PxPoint start_point
start point
::util::GeometryUtilities fGeoU
GeometryUtilities.
virtual Measure_t IntegralStdDev() override
Computes the standard deviation on the charge of the cluster hits.
virtual float Width() override
Computes the width of the cluster.
util::PxPoint end_point
end point
virtual Measure_t StartOpeningAngle() override
Computes the opening angle at the start or end of the cluster.
virtual Measure_t StartAngle() override
Computes the angle of the cluster.
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
const std::vector< cluster::ClusterParamsAlg > & GetMergedCPAN() const
Utility method to retrieve merged clusters in terms of a vector of CPAN.
void SetClusters(const std::vector< std::vector< art::Ptr< recob::Hit > > > &clusters)
Utility method to set cluster input information to CMergeManager from LArSoft data product (vector of...
::cmtool::CMergeManager fMgr
CMergeManager instance.
Namespace collecting geometry-related classes utilities.
cet::coded_exception< error, detail::translate > exception