9PatternLUTMaker::PatternLUTMaker(
const std::string& name,
11 : Analyzer(name, process) {}
14 input_file_ = ps.
get<std::string>(
"input_file");
15 output_file_ = ps.
get<std::string>(
"output_file");
16 lut_threshold_ = ps.
get<
double>(
"lut_threshold");
17 verbose_ = ps.
get<
int>(
"verbosity");
30 ldmx_log(info) <<
"In PatternLUTMaker: configure done!" << std::endl;
31 ldmx_log(info) <<
"Got parameters: \nInput file: " << input_file_
32 <<
"\nOutput file: " << output_file_
33 <<
"\nLUT threshold: " << lut_threshold_
34 <<
"\nVerbosity: " << verbose_;
39void PatternLUTMaker::onProcessStart() {
40 infile_.open(input_file_);
41 outfile_.open(output_file_);
43 if (total_lines_ > 0)
return;
46 while (infile_ >> ev >> p1 >> p2 >> p3) {
49 groups_[{p12, p23}].push_back({ev, p1, p2, p3});
58void PatternLUTMaker::onProcessEnd() {
59 ldmx_log(info) <<
"total_lines = " << total_lines_;
60 ldmx_log(info) <<
"groups = " << groups_.size();
65 ldmx_log(info) <<
"Total number of cluster combinations: " << total_lines_ <<
"\n"
66 <<
"Number of different propagation patterns: " << groups_.size()
67 <<
"\n" <<
"LUT Threshold: " << lut_threshold_ * 100 <<
"%\n";
70 for (
auto& g : groups_) {
71 int count = g.second.size();
72 double frac =
static_cast<double>(count) / total_lines_;
75 ldmx_log(debug) <<
"(" << g.first.first <<
"," << g.first.second <<
") appears "
76 << count <<
" times, (" << frac * 100 <<
" %)" <<
"\n";
79 if (frac > lut_threshold_) {
81 for (
auto& line : g.second) {
83 outfile_ << line.p1_ <<
" " << line.p2_ <<
" " << line.p3_ <<
"\n";
90 ldmx_log(info) <<
"\nLUT textfile written." <<
"\n" << combs
91 <<
" combinations (" << tracks <<
" tracks) written to LUT.\n";
#define DECLARE_ANALYZER(CLASS)
Macro which allows the framework to construct an analyzer given its name during configuration.
Writes LUT based on frequency of track propagation patterns for LUT-based TS tracking.
Implements an event buffer system for storing event data.
Class which represents the process under execution.
Class encapsulating parameters for configuring a processor.
const T & get(const std::string &name) const
Retrieve the parameter of the given name.