154 unsigned int cryo, tpc, view;
158 std::vector<art::Ptr<recob::Hit>> hitPtrList;
162 for (
auto const&
h : hitPtrList) {
163 view =
h->WireID().Plane;
166 cryo =
h->WireID().Cryostat;
167 tpc =
h->WireID().TPC;
169 hitMap[cryo][tpc][view].push_back(
h.key());
180 std::vector<char> hitInFA(
183 for (
auto const& pcryo : hitMap) {
185 for (
auto const& ptpc : pcryo.second) {
187 for (
auto const& pview : ptpc.second) {
194 for (
size_t idx = 0; idx < pview.second.size(); idx +=
fBatchSize) {
195 std::vector<std::pair<unsigned int, float>> points;
196 std::vector<size_t>
keys;
198 if (idx +
k >= pview.second.size()) {
break; }
200 size_t h = pview.second[idx +
k];
207 if (points.size() != batch_out.size()) {
211 for (
size_t k = 0;
k < points.size(); ++
k) {
226 auto clusters = std::make_unique<std::vector<recob::Cluster>>();
227 auto clu2hit = std::make_unique<art::Assns<recob::Cluster, recob::Hit>>();
231 std::vector<art::Ptr<recob::Cluster>> cluPtrList;
235 for (
auto const&
c : cluPtrList) {
236 view =
c->Plane().Plane;
239 cryo =
c->Plane().Cryostat;
240 tpc =
c->Plane().TPC;
242 cluMap[cryo][tpc][view].push_back(
c.key());
248 unsigned int cidx = 0;
250 std::vector<bool> hitUsed(hitPtrList.size(),
false);
251 for (
auto const& pcryo : cluMap) {
253 for (
auto const& ptpc : pcryo.second) {
255 for (
auto const& pview : ptpc.second) {
259 for (
size_t c : pview.second)
261 auto v = hitsFromClusters.at(c);
262 if (v.empty())
continue;
264 for (
auto const& hit : v) {
265 if (hitUsed[hit.key()]) {
266 mf::LogWarning(
"EmTrackClusterId2out") <<
"hit already used in another cluster";
268 hitUsed[hit.key()] =
true;
275 <<
"cluster in tpc:" << tpc <<
" view:" << view <<
" size:" << v.size()
309 for (
size_t h : hitMap[cryo][tpc][view])
311 if (hitUsed[h])
continue;
316 <<
"single hit in tpc:" << tpc <<
" view:" << view
317 <<
" wire:" << hitPtrList[
h]->WireID().Wire
318 <<
" drift:" << hitPtrList[
h]->PeakTime() <<
" p:" << vout[0];
345 hitPtrList[h]->
WireID().planeID()));
352 <<
"...produced " << cidx - pview.second.size() <<
" single-hit clusters.";
365 std::vector<std::vector<art::Ptr<recob::Hit>>> trkHitPtrList(trkListHandle->size());
366 for (
size_t t = 0;
t < trkListHandle->size(); ++
t) {
367 auto v = hitsFromTracks.at(
t);
368 size_t nh[3] = {0, 0, 0};
369 for (
auto const& hptr : v) {
372 size_t best_view = 2;
373 if ((nh[0] >= nh[1]) && (nh[0] > 2 * nh[2])) best_view = 0;
374 if ((nh[1] >= nh[0]) && (nh[1] > 2 * nh[2])) best_view = 1;
378 best_view = (best_view + 1) % 3;
381 <<
"No views selected at all?" <<
std::endl;
385 for (
auto const& hptr : v) {
386 if (hptr->View() == best_view) trkHitPtrList[
t].emplace_back(hptr);
392 for (
size_t t = 0;
t < trkHitPtrList.size(); ++
t)
396 return (
float)hitInFA[ptr.key()];
bool isInsideFiducialRegion(unsigned int wire, float drift) const
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
void setOutput(FVector_ID id, size_t key, std::array< float, N > const &values)
Set of hits with a 2D structure.
WireID_t Wire
Index of the wire within its plane.
anab::MVAWriter< 2 > fMVAWriter
FVector_ID initOutputs(std::string const &dataTag, size_t dataSize, std::vector< std::string > const &names=std::vector< std::string >(N,""))
bool isViewSelected(int view) const
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
void push_back(Ptr< U > const &p)
art::InputTag fTrackModuleLabel
art::InputTag fClusterModuleLabel
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.
art::InputTag fWireProducerLabel
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.
art::InputTag fHitModuleLabel
void addOutput(FVector_ID id, std::array< float, N > const &values)
std::unordered_map< unsigned int, tpc_view_keymap > cryo_tpc_view_keymap
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)
art::InputTag fNewClustersTag
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)
std::vector< std::vector< float > > predictIdVectors(std::vector< std::pair< unsigned int, float >> points) const
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)