pflib v2.7.0-1-gd371ab6a
Polarfire Interaction Library
pftool_headers.h
1
2#ifndef PFTOOL_HEADERS_H
3#define PFTOOL_HEADERS_H
4
5#include "pflib/decoding/SuperPacket.h"
6#include <iostream>
7#include <vector>
9 public:
10 int n_good_bxheaders = 0;
11 int n_bad_bxheaders = 0;
12 int n_good_idles = 0;
13 int n_bad_idles = 0;
14 int link;
15 double percent_bad_headers() const;
16 double percent_bad_idles() const;
17 HeaderStatus(int ilink) : link(ilink) {}
18 void report() const {
19 std::cout << "Link: " << link << "\n";
20 std::cout << "Num bad headers: " << n_bad_bxheaders
21 << ", ratio: " << percent_bad_headers()
22 << std::endl;
23 std::cout << "Num bad idles: " << n_bad_idles
24 << ", ratio: " << percent_bad_idles()
25 << std::endl;
26 }
27 void update(const pflib::decoding::LinkPacket packet);
28};
30 int num_links;
31 int num_active_links;
33 HeaderCheckResults(int inum_links, int inum_active_links) :
34 num_links{inum_links},
35 num_active_links{inum_active_links}
36 {
37 for (int link{0}; link < num_active_links; ++link) {
38 res.push_back(link);
39 }
40 }
41 void report() const {
42 for (auto status : res) {
43 status.report();
44 }
45 }
46 void add_event(const pflib::decoding::SuperPacket event, const int nsamples);
47 bool is_acceptable (const double threshold) {
48 for (auto status : res) {
49 std::cout << "Testing link " << status.link << "... ";
50 if (status.percent_bad_headers() > threshold )
51 {
52 std::cout << "bad headers!, "
53 << status.percent_bad_headers() * 100
54 << " %" << std::endl;
55 return false;
56 } else if (status.percent_bad_idles() > threshold) {
57 std::cout << "bad idles!, "
58 << status.percent_bad_idles() * 100
59 << " %" << std::endl;
60 return false;
61 }
62 std::cout << " ok!" << std::endl;
63 }
64 return true;
65 };
66};
67
68
69
70#endif /* PFTOOL_HEADERS_H */
smallest formatted packet being readout by the HGCROC-Polarfire pipeline
Definition: LinkPacket.h:19
Decoding of entire "super packet" which holds multiple polarfire packets - one for each sample in an ...
Definition: SuperPacket.h:20
T endl(T... args)
static void status(pflib::PolarfireTarget *pft)
Main status of menu.
Definition: pftool.cc:14
T push_back(T... args)
Definition: pftool_headers.h:29
Definition: pftool_headers.h:8