482 art::Handle<std::vector<recob::Cluster>> clusterVecHandle;
485 auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(
evt);
487 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(
evt, clockData);
490 constexpr
size_t nViews = 3;
493 std::array<std::vector<size_t>, nViews> ClsIndices;
496 std::array<std::vector<int>, nViews> Cls_matches;
499 for (
size_t i = 0; i < clusterVecHandle->size(); ++i) {
502 art::Ptr<recob::Cluster> cl(clusterVecHandle, i);
505 switch (cl->View()) {
512 Cls_matches[view].push_back(0);
513 ClsIndices[view].push_back(i);
516 auto SuperClusters = std::make_unique<std::vector<recob::Cluster>>();
517 auto assn = std::make_unique<art::Assns<recob::Cluster, recob::Hit>>();
522 ClusterParamsImportWrapper<StandardClusterParamsAlg> ClusterParamAlgo;
526 for (
size_t i = 0; i < nViews; ++i) {
528 int clustersfound = 0;
531 for (
size_t c = 0; c < ClsIndices[i].size(); ++c) {
532 if (Cls_matches[i][clsnum1] == 1) {
540 recob::Cluster const& StartingCluster = clusterVecHandle->at(ClsIndices[i][c]);
541 ClusterAndHitMerger cl1(StartingCluster, fmh.at(ClsIndices[i][c]));
544 Cls_matches[i][clsnum1] = 1;
548 for (
size_t c2 = 0; c2 < ClsIndices[i].size(); ++c2) {
550 if (Cls_matches[i][clsnum2] == 1) {
555 const recob::Cluster& cl2(clusterVecHandle->at(ClsIndices[i][c2]));
578 if (sameSlope && (sameEndpoint != 0)) {
583 cl1.Add(cl2, fmh.at(ClsIndices[i][c2]), sameEndpoint == 1);
584 Cls_matches[i][clsnum2] = 1;
592 ClusterParamAlgo.ImportHits(gser, cl1.Hits());
595 SuperClusters->emplace_back(cl1.StartWire(),
596 cl1.SigmaStartWire(),
598 cl1.SigmaStartTick(),
601 cl1.StartOpeningAngle(),
608 cl1.EndOpeningAngle(),
609 ClusterParamAlgo.Integral().value(),
610 ClusterParamAlgo.IntegralStdDev().value(),
611 ClusterParamAlgo.SummedADC().value(),
612 ClusterParamAlgo.SummedADCStdDev().value(),
613 ClusterParamAlgo.NHits(),
614 ClusterParamAlgo.MultipleHitDensity(),
628 mf::LogVerbatim(
"Summary") << std::setfill(
'-') << std::setw(175) <<
"-" << std::setfill(
' ');
629 mf::LogVerbatim(
"Summary") <<
"LineMerger Summary:";
630 for (
size_t i = 0; i < SuperClusters->size(); ++i)
631 mf::LogVerbatim(
"Summary") << SuperClusters->at(i);
633 evt.put(std::move(SuperClusters));
634 evt.put(std::move(assn));
int EndpointCompatibility(float sclstartwire, float sclstarttime, float sclendwire, float sclendtime, float cl2startwire, float cl2starttime, float cl2endwire, float cl2endtime)
Planes which measure Z direction.
Set of hits with a 2D structure.
static const SentryArgument_t Sentry
An instance of the sentry object.
std::string fClusterModuleLabel
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.
ID_t ID() const
Identifier of this cluster.
bool SlopeCompatibility(double slope1, double slope2)
int ID_t
Type of cluster ID.