110 auto clusters = std::make_unique<std::vector<recob::Cluster>>();
111 auto clu2hit = std::make_unique<art::Assns<recob::Cluster, recob::Hit>>();
116 std::vector<art::Ptr<recob::Cluster>> cluPtrList;
120 for (
auto const&
c : cluPtrList) {
121 unsigned int view =
c->Plane().Plane;
125 unsigned int cryo =
c->Plane().Cryostat;
126 unsigned int tpc =
c->Plane().TPC;
128 cluMap[{cryo, tpc, view}].push_back(
c.key());
131 auto cluID =
fMVAWriter.template initOutputs<recob::Cluster>(
134 unsigned int cidx = 0;
135 art::FindManyP<recob::Hit> hitsFromClusters(
137 std::vector<bool> hitUsed(hitPtrList.size(),
140 for (
auto const & [
key, clusters_keys] : cluMap)
142 auto const& [cryo, tpc, view]=
key;
147 for (
size_t c : clusters_keys)
149 auto v = hitsFromClusters.at(
c);
153 for (
auto const&
hit : v) {
154 if (hitUsed[
hit.key()]) {
155 mf::LogWarning(
"EmTrack") <<
"hit already used in another cluster";
157 hitUsed[
hit.key()] =
true;
160 auto vout =
fMVAWriter.template getOutput<recob::Hit>(
162 return (
float)hitInFA[ptr.key()];
165 float pvalue = vout[0] / (vout[0] + vout[1]);
167 <<
"cluster in tpc:" << tpc <<
" view:" << view
168 <<
" size:" << v.size() <<
" p:" << pvalue;
193 v.front()->WireID().planeID()));
204 hitMap.at({cryo, tpc, view}))
209 auto vout =
fMVAWriter.template getOutput<recob::Hit>(
h);
210 float pvalue = vout[0] / (vout[0] + vout[1]);
213 <<
"single hit in tpc:" << tpc <<
" view:" << view
214 <<
" wire:" << hitPtrList[
h]->WireID().Wire
215 <<
" drift:" << hitPtrList[
h]->PeakTime() <<
" p:" << pvalue;
219 clusters->emplace_back(
243 hitPtrList[h]->
WireID().planeID()));
251 <<
"...produced " << cidx - clusters_keys.size()
252 <<
" single-hit clusters.";
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
std::unique_ptr< PointIdAlgTools::IPointIdAlg > fPointIdAlgTool
Set of hits with a 2D structure.
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
void push_back(Ptr< U > const &p)
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
std::map< key, std::vector< size_t >> cryo_tpc_view_keymap
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
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.
Detector simulation of raw signals on wires.
bool isViewSelected(int view) const
void addOutput(FVector_ID id, std::array< float, N > const &values)
const art::InputTag fNewClustersTag
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
const art::InputTag fClusterModuleLabel
std::tuple< unsigned int, unsigned int, unsigned int > key