157 unsigned int cryo, tpc, view;
161 std::vector<art::Ptr<recob::Hit>> hitPtrList;
165 for (
auto const&
h : hitPtrList) {
166 view =
h->WireID().Plane;
169 cryo =
h->WireID().Cryostat;
170 tpc =
h->WireID().TPC;
172 hitMap[cryo][tpc][view].push_back(
h.key());
183 std::vector<char> hitInFA(
186 for (
auto const& pcryo : hitMap) {
188 for (
auto const& ptpc : pcryo.second) {
190 for (
auto const& pview : ptpc.second) {
197 for (
size_t idx = 0; idx < pview.second.size(); idx +=
fBatchSize) {
198 std::vector<std::pair<unsigned int, float>> points;
199 std::vector<size_t>
keys;
201 if (idx +
k >= pview.second.size()) {
break; }
203 size_t h = pview.second[idx +
k];
210 if (points.size() != batch_out.size()) {
214 for (
size_t k = 0;
k < points.size(); ++
k) {
229 auto clusters = std::make_unique<std::vector<recob::Cluster>>();
230 auto clu2hit = std::make_unique<art::Assns<recob::Cluster, recob::Hit>>();
234 std::vector<art::Ptr<recob::Cluster>> cluPtrList;
238 for (
auto const&
c : cluPtrList) {
239 view =
c->Plane().Plane;
242 cryo =
c->Plane().Cryostat;
243 tpc =
c->Plane().TPC;
245 cluMap[cryo][tpc][view].push_back(
c.key());
251 unsigned int cidx = 0;
253 std::vector<bool> hitUsed(hitPtrList.size(),
false);
254 for (
auto const& pcryo : cluMap) {
256 for (
auto const& ptpc : pcryo.second) {
258 for (
auto const& pview : ptpc.second) {
262 for (
size_t c : pview.second)
264 auto v = hitsFromClusters.at(c);
265 if (v.empty())
continue;
267 for (
auto const& hit : v) {
268 if (hitUsed[hit.key()]) {
269 mf::LogWarning(
"EmTrackMichelId") <<
"hit already used in another cluster";
271 hitUsed[hit.key()] =
true;
277 float pvalue = vout[0] / (vout[0] + vout[1]);
278 mf::LogVerbatim(
"EmTrackMichelId") <<
"cluster in tpc:" << tpc <<
" view:" << view
279 <<
" size:" << v.size() <<
" p:" << pvalue;
312 for (
size_t h : hitMap[cryo][tpc][view])
314 if (hitUsed[h])
continue;
317 float pvalue = vout[0] / (vout[0] + vout[1]);
320 <<
"single hit in tpc:" << tpc <<
" view:" << view
321 <<
" wire:" << hitPtrList[
h]->WireID().Wire
322 <<
" drift:" << hitPtrList[
h]->PeakTime() <<
" p:" << pvalue;
349 hitPtrList[h]->
WireID().planeID()));
356 <<
"...produced " << cidx - pview.second.size() <<
" single-hit clusters.";
369 std::vector<std::vector<art::Ptr<recob::Hit>>> trkHitPtrList(trkListHandle->size());
370 for (
size_t t = 0;
t < trkListHandle->size(); ++
t) {
371 auto v = hitsFromTracks.at(
t);
372 size_t nh[3] = {0, 0, 0};
373 for (
auto const& hptr : v) {
376 size_t best_view = 2;
377 if ((nh[0] >= nh[1]) && (nh[0] > 2 * nh[2])) best_view = 0;
378 if ((nh[1] >= nh[0]) && (nh[1] > 2 * nh[2])) best_view = 1;
382 best_view = (best_view + 1) % 3;
388 for (
auto const& hptr : v) {
389 if (hptr->View() == best_view) trkHitPtrList[
t].emplace_back(hptr);
395 for (
size_t t = 0;
t < trkHitPtrList.size(); ++
t)
399 return (
float)hitInFA[ptr.key()];
bool isInsideFiducialRegion(unsigned int wire, float drift) const
art::InputTag fNewClustersTag
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
std::vector< std::string > const & outputLabels() const
network output labels
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
geo::WireID WireID() const
art::InputTag fHitModuleLabel
void setOutput(FVector_ID id, size_t key, std::array< float, N > const &values)
art::InputTag fClusterModuleLabel
Set of hits with a 2D structure.
WireID_t Wire
Index of the wire within its plane.
bool isViewSelected(int view) const
FVector_ID initOutputs(std::string const &dataTag, size_t dataSize, std::vector< std::string > const &names=std::vector< std::string >(N,""))
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
void push_back(Ptr< U > const &p)
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::array< float, N > getOutput(std::vector< art::Ptr< T > > const &items) const
void saveOutputs(art::Event &evt)
Check consistency and save all the results in the event.
Detector simulation of raw signals on wires.
void addOutput(FVector_ID id, std::array< float, N > const &values)
anab::MVAWriter< 4 > fMVAWriter
float PeakTime() const
Time of the signal peak, in tick units.
bool setWireDriftData(const detinfo::DetectorClocksData &clock_data, const detinfo::DetectorPropertiesData &det_prop, const std::vector< recob::Wire > &wires, unsigned int plane, unsigned int tpc, unsigned int cryo)
std::unordered_map< unsigned int, tpc_view_keymap > cryo_tpc_view_keymap
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
2D representation of charge deposited in the TDC/wire plane
constexpr PlaneID const & planeID() const
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
art::InputTag fTrackModuleLabel
std::vector< std::vector< float > > predictIdVectors(std::vector< std::pair< unsigned int, float >> points) const
art::InputTag fWireProducerLabel
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)