--- /dev/null
+#include <cstdlib>
+#include <string>
+using std::string;
+
+
+#include <iostream>
+using std::cout;
+using std::cerr;
+using std::cin;
+using std::endl;
+#include <iomanip>
+using std::hex;
+using std::dec;
+using std::oct;
+
+#include <fstream>
+using std::fstream;
+
+#include <cmath>
+
+#include <sstream>
+using std::stringstream;
+
+#include <stdio.h>
+#include <stdlib.h>
+
+
+
+int main(int argc, char* argv[])
+{
+
+
+
+ fstream infile;
+ infile.open("check_tot.dat",std::ios::in);
+
+ int good=0,bad=0,good_sum=0,bad_sum=0;
+ for (int i=0; i<30; i++)
+ {
+
+ if (i<=15 || i>=20)
+ {
+ infile>>bad;
+ infile>>good;
+
+ bad_sum+=bad;
+ good_sum+=good;
+ //cout<<bad<<" "<<good<<endl;
+ if (bad+good!=0)
+ {
+ cout<<" TDC "<<hex<<i+8192<<" bad: ";
+ if(float(bad)/(bad+good)*100>=2.0)
+ {
+
+ cout<<"\033[1;31m";
+ cout.precision(1);
+ cout.fill (' ');
+ cout.width(5);
+ cout<<dec<<std::fixed<<std::right
+ <<float(bad)/(bad+good)*100<<" % "<<endl;
+ cout<<"\033[0m";
+ }
+ else
+ {
+ cout<<"\033[1;32m";
+ cout.precision(1);
+ cout.fill (' ');
+ cout.width(5);
+ cout<<dec<<std::fixed<<std::right
+ <<float(bad)/(bad+good)*100<<" % "<<endl;
+ cout<<"\033[0m";
+ }
+ }
+ else
+ {
+ cout<<" TDC "<<hex<<i+8192<<" no edges in TDC"
+ <<endl;
+ }
+ }
+
+ }
+ cout<<endl<<endl<<endl;
+
+ if (bad_sum+good_sum!=0)
+ {
+ cout<<" ALL bad: ";
+ if (float(bad_sum)/(bad_sum+good_sum)*100>=2.0)
+ {
+ cout<<"\033[1;31m";
+ }
+ else
+ {
+ cout<<"\033[1;32m";
+ }
+
+ cout.precision(1);
+ cout.fill (' ');
+ cout.width(5);
+ cout<<std::fixed<<std::right
+ <<float(bad_sum)/(bad_sum+good_sum)*100<<" % "<<endl;
+ cout<<"\033[0m";
+ }
+ else
+ {
+ cout<<" ALL "<<" no edges in TDCs"<<endl;
+
+ }
+ infile.close();
+ exit(0);
+}