27 typedef std::map<unsigned int, std::vector<tss::Hit2D>>
view_hitmap;
64 produces<std::vector<recob::Cluster>>();
65 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);
99 std::unique_ptr<std::vector<recob::Cluster>> clusters(
new std::vector<recob::Cluster>);
100 std::unique_ptr<art::Assns<recob::Cluster, recob::Hit>> clu2hit(
104 unsigned int cidx = 0;
105 const unsigned int emTag = 0x10000;
108 for (
const auto& v :
fHitMap[tpc_iter->Cryostat][tpc_iter->TPC]) {
114 int c = 0, clsSize = cls.size();
115 while (c < clsSize) {
116 if (cls[c].hits().
size() < 2) {
121 std::vector<const tss::Hit2D*> trks,
ems;
123 cls.erase(cls.begin() +
c);
128 cls.back().tagEM(
true);
133 mf::LogVerbatim(
"TrackShowerHits") <<
"Find EM showers by density of vtxs.";
135 int c = 0, clsSize = cls.size();
136 while (c < clsSize) {
137 if (cls[c].isEM() || (cls[c].hits().
size() < 2)) {
144 for (
const auto&
s : segs)
147 cls.erase(cls.begin() +
c);
152 for (
auto&
c : cls) {
153 if (!
c.hits().size())
continue;
155 if (!
c.isEM())
continue;
157 clusters->emplace_back(
181 c.hits().front()->Hit2DPtr()->WireID().planeID()));
183 std::vector<art::Ptr<recob::Hit>> hits2d;
184 hits2d.reserve(
c.hits().size());
186 for (
auto h2d :
c.hits())
187 hits2d.push_back(h2d->Hit2DPtr());
189 if (hits2d.size())
util::CreateAssn(*
this, evt, *clusters, hits2d, *clu2hit);
197 mf::LogWarning(
"TrackShowerHits") <<
"Hits not found in the event.";
cryo_tpc_view_hitmap fHitMap
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
TrackShowerHits & operator=(TrackShowerHits const &)=delete
tss::SimpleClustering fSimpleClustering
TPC_id_iterator begin_TPC_id() const
Returns an iterator pointing to the first TPC ID in the detector.
art::ServiceHandle< geo::Geometry const > fGeom
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
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)
art framework interface to geometry description
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
#define DEFINE_ART_MODULE(klass)
std::vector< tss::Cluster2D > run(const std::vector< tss::Hit2D > &inp) const
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
void produce(art::Event &e) override
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.
std::map< unsigned int, view_hitmap > tpc_view_hitmap
std::vector< tss::Cluster2D > run(tss::Cluster2D &inp) const
TPC_id_iterator end_TPC_id() const
Returns an iterator pointing after the last TPC ID in the detector.
std::map< unsigned int, tpc_view_hitmap > cryo_tpc_view_hitmap
Declaration of signal hit object.
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