Auxiliary program to plot firmware versions.
34{
37
41
42 try {
43
44 JParser<> zap(
"Auxiliary program to plot firmware versions.");
45
49
50 zap(argc, argv);
51 }
52 catch(const exception &error) {
53 FATAL(error.what() << endl);
54 }
55
56
57 const char SEPARATOR = '.';
58
59 inputFile = getFilenames(inputFile);
60
61
62
63
64 struct :
66 {
67 int operator()(const string& firmware)
68 {
70
71 iterator p = find(this->begin(), this->end(), firmware);
72
73 if (p == this->end()) {
74
75 this->push_back(firmware);
76
77 p = this->rbegin().base();
78 }
79
81 }
82 } version;
83
84
86 int run;
87 int version;
88 };
89
90
92
94
95
96 for (const string& i : inputFile) {
97
99
100 int run;
101
102 {
103 string::size_type pos = i.find(SEPARATOR);
104
105 if (pos != string::npos)
106 istringstream(i.substr(0,pos)) >> run;
107 else
108 continue;
109 }
110
112
113 ifstream in(i);
114
115 string buffer;
116 string location;
117 string upi;
118 string firmware;
119
120 while (in >> buffer >> location >> upi &&
getline(in, firmware)) {
121
122 string::size_type pos = location.find(SEPARATOR);
123
124 if (pos != string::npos) {
125
126 const int index = version(firmware);
127
128 int string, floor;
129
130 istringstream(location.substr(0,pos)) >> string;
131 istringstream(location.substr(pos+1)) >> floor;
132
133 DEBUG(
FILL(4,
'0') <<
string <<
'.' <<
FILL(2,
'0') << floor <<
' ' << firmware << endl);
134
136
137 } else
138 continue;
139 }
140
141 in.close();
142 }
144
145
146 for (size_t i = 0; i != version.size(); ++i) {
147 cout << setw(2) << i << ' ' << version[i] << endl;
148 }
149
150
151 TH2D h2("H2", NULL,
153 data .size() , 0 ,
data. size() + 0.0);
154 {
155 int iy = 1;
156
157 for (const auto& i : data) {
158
159
160
161 if (i.first.getFloor() == 0) {
162 h2.GetYaxis()->SetBinLabel(iy,
MAKE_CSTRING(i.first.getString()));
163 }
164
165 for (const auto& fs : i.second) {
166
168 const double z = fs.version;
169
170 h2.SetBinContent(ix, iy, z);
171 }
172
173 iy += 1;
174 }
175 }
176
177
179
180 for (const auto& i : data) {
181
182 const auto X = make_array(i.second.begin(), i.second.end(), &pair_type::run);
183 const auto Y = make_array(i.second.begin(), i.second.end(), &pair_type::version);
184
185 TGraph
g1(i.second.size(), X.data(), Y.data());
186
188
190 }
191
192 out << h2;
193
194 out.Write();
195 out.Close();
196}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define MAKE_CSTRING(A)
Make C-string.
Double_t g1(const Double_t x)
Function.
Logical location of module.
Utility class to parse command line options.
std::string getLabel(const JLocation &location)
Get module label for monitoring and other applications.
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for sequence of same character.