28 typedef std::map<unsigned int, std::vector<tss::Hit2D>>
view_hitmap;
65 produces<std::vector<recob::Cluster>>();
66 produces<art::Assns<recob::Cluster, recob::Hit>>();
77 std::vector<art::Ptr<recob::Hit>> hitlist;
81 unsigned int cryo, tpc, view;
82 for (
auto const& h : hitlist) {
83 cryo = h->WireID().Cryostat;
84 tpc = h->WireID().TPC;
85 view = h->WireID().Plane;
87 fHitMap[cryo][tpc][view].emplace_back(detProp, h);
97 std::unique_ptr<std::vector<recob::Cluster>> clusters(
new std::vector<recob::Cluster>);
98 std::unique_ptr<art::Assns<recob::Cluster, recob::Hit>> clu2hit(
102 unsigned int cidx = 0;
103 const unsigned int emTag = 0x10000;
106 for (
const auto& v :
fHitMap[tpcid.Cryostat][tpcid.TPC]) {
112 int c = 0, clsSize = cls.size();
113 while (c < clsSize) {
119 std::vector<const tss::Hit2D*> trks,
ems;
121 cls.erase(cls.begin() + c);
126 cls.back().tagEM(
true);
131 mf::LogVerbatim(
"TrackShowerHits") <<
"Find EM showers by density of vtxs.";
133 int c = 0, clsSize = cls.size();
134 while (c < clsSize) {
135 if (cls[c].isEM() || (cls[c].
hits().
size() < 2)) {
142 for (
const auto& s : segs)
145 cls.erase(cls.begin() + c);
150 for (
auto& c : cls) {
151 if (!c.hits().size())
continue;
153 if (!c.isEM())
continue;
155 clusters->emplace_back(
179 c.hits().front()->Hit2DPtr()->WireID().planeID()));
181 std::vector<art::Ptr<recob::Hit>> hits2d;
182 hits2d.reserve(c.hits().size());
184 for (
auto h2d : c.hits())
185 hits2d.push_back(h2d->Hit2DPtr());
195 mf::LogWarning(
"TrackShowerHits") <<
"Hits not found in the event.";
197 evt.
put(std::move(clusters));
198 evt.
put(std::move(clu2hit));
details::range_type< T > Iterate() const
Initializes the specified ID with the ID of the first cryostat.
cryo_tpc_view_hitmap fHitMap
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
TrackShowerHits & operator=(TrackShowerHits const &)=delete
tss::SimpleClustering fSimpleClustering
art::ServiceHandle< geo::Geometry const > fGeom
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Declaration of signal hit object.
EDProducer(fhicl::ParameterSet const &pset)
tss::Segmentation2D fSegmentation2D
void splitHitsNaive(const tss::Cluster2D &inp, std::vector< const tss::Hit2D * > &trackHits, std::vector< const tss::Hit2D * > &emHits) const
Set of hits with a 2D structure.
Split into linear clusters.
TrackShowerHits(fhicl::ParameterSet const &p)
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
#define DEFINE_ART_MODULE(klass)
std::vector< tss::Cluster2D > run(const std::vector< tss::Hit2D > &inp) const
void produce(art::Event &e) override
std::map< unsigned int, view_hitmap > tpc_view_hitmap
std::vector< tss::Cluster2D > run(tss::Cluster2D &inp) const
The data type to uniquely identify a TPC.
Declaration of cluster object.
std::map< unsigned int, tpc_view_hitmap > cryo_tpc_view_hitmap
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.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Utility object to perform functions of association.
std::map< unsigned int, std::vector< tss::Hit2D > > view_hitmap
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
bool sortHits(const art::Event &evt)
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
std::string fHitModuleLabel
art framework interface to geometry description