17 max_cell_gap_cut_ (p.
get<
int>(
"max_cell_gap_cut")),
18 max_plane_gap_cut_ (p.
get<
int>(
"max_plane_gap_cut")),
19 sparsification_factor_ (p.
get<unsigned>(
"sparsification_factor")),
20 track_max_beta_ (p.
get<double>(
"track_max_beta")),
21 track_min_beta_ (p.
get<double>(
"track_min_beta")),
22 trigger_time_buffer_ (p.
get<unsigned>(
"trigger_time_buffer")),
23 trigger_timeout_ (p.
get<double>(
"trigger_timeout")),
24 trigger_use_timeout_ (p.
get<bool>(
"trigger_use_timeout")),
25 trigger_write_all_timeout_data_(p.
get<bool>(
"trigger_write_all_timeout_data"))
31 std::vector<novaddt::TriggerDecision>
43 std::bitset<Extra_Info::BITSET_SIZE> extra_info;
50 std::map<std::string, novaddt::HitList> hitmap;
58 hitmap[
"x_contained"];
65 unsigned n_good_track = 0;
66 for (
auto entry_hit = hitmap[
"x_surface"].cbegin();
67 entry_hit != hitmap[
"x_surface"].cend() && !
result;
71 novaddt::HitList::const_reverse_iterator until(entry_hit + 1);
73 auto contained_first =
find(hitmap[
"x_contained"], entry_hit->TDC());
79 find(contained_first, hitmap[
"x_contained"].cend(), exit_hit.
TDC());
93 auto time_spent = duration_cast<milliseconds>
100 trigger_entry_hit = *entry_hit;
103 trigger_exit_hit = hitmap[
"x_surface"].back();
105 trigger_exit_hit = *entry_hit;
112 std::set<int> plane_set = {entry_hit->
Plane().
val};
113 std::set<int> cell_set = {entry_hit->Cell().val};
115 uint64_t t_max_plane_gap = track.
start().
TDC().
val;
122 uint64_t t_max_gap =
std::min(t_max_plane_gap, t_max_cell_gap);
125 bool contains_gap_exceeding_cut = std::any_of
126 (contained_first, contained_last,
129 if (hit.
TDC().
val > t_max_gap)
131 int64_t time_difference =
132 static_cast<int64_t
>(hit.
TDC().
val) -
135 if (hit.
TDC().
val > t_max_cell_gap)
137 double expected_cell =
146 if (hit.
TDC().
val > t_max_plane_gap)
148 double expected_plane =
161 cell_set.insert(hit.
Cell().
val);
168 if (contains_gap_exceeding_cut)
171 plane_set.insert(exit_hit.
Plane().
val);
178 cell_set.insert(exit_hit.
Cell().
val);
183 trigger_entry_hit = *entry_hit;
184 trigger_exit_hit = exit_hit;
196 emplace_back(t_begin, t_end - t_begin,
198 extra_info.to_ulong());
209 auto bound = std::stable_partition
210 (hits.begin(), hits.end(),
215 std::move(hits.begin(), bound, hitmap[
"x"].begin());
218 std::move(bound, hits.end(), hitmap[
"y"].begin());
224 (std::map<std::string, novaddt::HitList> & hitmap)
const 226 for (
auto const& x_hit : hitmap[
"x"])
237 if (y_match != y_last)
240 hitmap[
"x_contained"].push_back(x_hit);
245 hitmap[
"x_surface"].push_back(x_hit);
261 if (surface_y_match != y_last)
262 hitmap[
"x_surface"].push_back(x_hit);
273 int plane_difference =
335 (
static_cast<double>(hit.
Plane().
val) -
362 int64_t relative_hit_time =
363 static_cast<int64_t
>(hit.
TDC().
val) -
367 (
static_cast<double>(hit.
Plane().
val) -
382 (std::set<int> collection,
int const&
object,
int const& max_gap_cut)
const 386 collection.insert(
object);
399 (std::set<int>
const& collection)
const 404 (collection.begin(), collection.end(), [&](
int object,
int next_object)
406 int gap = next_object - object;
440 (novaddt::HitList::const_iterator begin,
452 return find(hits.cbegin(), hits.cend(), tdc);
T max(const caf::Proxy< T > &a, T b)
const unsigned ROAD_HALF_WIDTH
double slope_cell_plane() const
bool hit_is_in_time_with_road(novaddt::DAQHit const &hit, Track const &track) const
unsigned sparsification_factor_
bool hit_is_on_road(novaddt::DAQHit const &hit, Track const &track) const
novaddt::Plane const & Plane() const
bool hits_are_view_matched(novaddt::DAQHit const &x_hit, novaddt::DAQHit const &y_hit) const
bool good_track(Track const &track) const
novaddt::TDC const & TDC() const
std::vector< DAQHit > HitList
novaddt::DAQHit start() const
unsigned min_cell() const
bool hit_is_between_track_end_points(novaddt::DAQHit const &hit, Track const &track) const
const unsigned SURFACE_MAX_CELL
bool slope_cell_is_valid() const
unsigned distance(const T &t1, const T &t2)
std::vector< novaddt::TriggerDecision > trigger_decisions_
double slope_time_plane() const
const unsigned SURFACE_MAX_PLANE
const double ROAD_TIME_VARIATION
int find_max_gap(std::set< int > const &collection) const
unsigned max_plane() const
bool slope_plane_is_valid() const
void find_view_matched_hits(std::map< std::string, novaddt::HitList > &hitmap) const
bool hit_is_on_surface(novaddt::DAQHit const &hit) const
Identifier for the X measuring view of the detector (top)
const unsigned TRACK_MIN_UNIQUE_PLANES
void split_by_view(novaddt::HitList hits, std::map< std::string, novaddt::HitList > &hitmap) const
const unsigned VIEW_MATCH_PLANE_CUT
double slope_plane_time() const
std::vector< novaddt::TriggerDecision > trigger_decisions() const
bool run_algorithm(art::Handle< novaddt::HitList > const &hits)
const unsigned SURFACE_MIN_PLANE
const double TRACK_MIN_DISTANCE
bool trigger_write_all_timeout_data_
double slope_cell_time() const
bool slope_time_is_valid() const
bool gap_exceeds_cut(std::set< int > collection, int const &object, int const &max_gap_cut) const
bool trigger_use_timeout_
unsigned min_plane() const
int plane_difference() const
double slope_time_cell() const
novaddt::Cell const & Cell() const
novaddt::HitList::const_iterator find(novaddt::HitList::const_iterator begin, novaddt::HitList::const_iterator end, novaddt::TDC tdc) const
T min(const caf::Proxy< T > &a, T b)
const unsigned SURFACE_MIN_CELL
const unsigned VIEW_MATCH_TDC_CUT
unsigned trigger_time_buffer_
unsigned max_cell() const
const unsigned TRACK_MIN_HITS