20 AlCaRecoTriggerBits_Display() :
cond::payloadInspector::PlotImage<
AlCaRecoTriggerBits>(
"Table of AlCaRecoTriggerBits" ){
24 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
25 auto iov = iovs.front();
28 std::string IOVsince = std::to_string(std::get<0>(iov));
31 typedef std::map<std::string, std::string> TriggerMap;
32 const TriggerMap &triggerMap = payload->m_alcarecoToTrig;
34 unsigned int mapsize = triggerMap.size();
35 float pitch = 1./(mapsize*1.1);
38 std::vector<float> y_x1,y_x2,y_line;
39 std::vector<std::string> s_x1,s_x2,s_x3;
43 y = 1.0; x1 = 0.02; x2 = x1+0.30;
47 s_x1.push_back(
"#scale[1.2]{Key}");
49 s_x2.push_back(
"#scale[1.2]{in IOV: "+IOVsince+
"}");
54 for(
const auto &element : triggerMap){
58 s_x1.push_back(element.first);
60 std::vector<std::string>
output;
62 const std::vector<std::string> paths = payload->decompose(element.second);
63 for (
unsigned int iPath = 0; iPath < paths.size(); ++iPath) {
65 if((toAppend+paths[iPath]).length()<60){
66 toAppend+=paths[iPath]+
";";
69 output.push_back(toAppend);
71 toAppend+=paths[iPath]+
";";
74 if(iPath==paths.size()-1) output.push_back(toAppend);
77 for (
unsigned int br=0;
br<output.size();
br++){
79 s_x2.push_back(
"#color[2]{"+output[
br]+
"}");
80 if(
br!=output.size()-1) y-=pitch;
83 y_line.push_back(y-(pitch/2.));
87 TCanvas
canvas(
"AlCaRecoTriggerBits",
"AlCaRecoTriggerBits",2000,
std::max(y_x1.size(),y_x2.size())*40);
92 float newpitch = 1/(
std::max(y_x1.size(),y_x2.size())*1.1);
93 float factor = newpitch/pitch;
94 l.SetTextSize(newpitch-0.002);
96 for(
unsigned int i=0;
i<y_x1.size();
i++){
97 l.DrawLatexNDC(x1,1-(1-y_x1[
i])*factor,s_x1[i].c_str());
100 for(
unsigned int i=0;i<y_x2.size();i++){
101 l.DrawLatexNDC(x2,1-(1-y_x2[i])*factor,s_x2[i].c_str());
107 TLine
lines[y_line.size()];
109 for (
const auto &
line : y_line){
110 lines[iL] = TLine(gPad->GetUxmin(),1-(1-
line)*factor,gPad->GetUxmax(),1-(1-
line)*factor);
111 lines[iL].SetLineWidth(1);
112 lines[iL].SetLineStyle(9);
113 lines[iL].SetLineColor(2);
114 lines[iL].Draw(
"same");
129 AlCaRecoTriggerBits_Compare() :
cond::payloadInspector::PlotImage<
AlCaRecoTriggerBits>(
"Table of AlCaRecoTriggerBits comparison" ){
130 setSingleIov(
false );
133 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
135 std::vector<std::tuple<cond::Time_t,cond::Hash> > sorted_iovs = iovs;
138 std::sort(
begin(sorted_iovs),
end(sorted_iovs), [](
auto const &t1,
auto const &t2) {
139 return std::get<0>(t1) < std::get<0>(t2);
142 auto firstiov = sorted_iovs.front();
143 auto lastiov = sorted_iovs.back();
145 std::shared_ptr<AlCaRecoTriggerBits> last_payload = fetchPayload( std::get<1>(lastiov) );
146 std::shared_ptr<AlCaRecoTriggerBits> first_payload = fetchPayload( std::get<1>(firstiov) );
148 std::string lastIOVsince = std::to_string(std::get<0>(lastiov));
149 std::string firstIOVsince = std::to_string(std::get<0>(firstiov));
152 typedef std::map<std::string, std::string> TriggerMap;
153 const TriggerMap &first_triggerMap = first_payload->m_alcarecoToTrig;
154 const TriggerMap &last_triggerMap = last_payload->m_alcarecoToTrig;
156 std::vector<std::string> first_keys, not_in_first_keys;
157 std::vector<std::string> last_keys, not_in_last_keys;
160 for (
const auto& element : first_triggerMap){
161 first_keys.push_back(element.first);
165 for (
const auto& element : last_triggerMap){
166 last_keys.push_back(element.first);
170 std::set_difference(first_keys.begin(),first_keys.end(),last_keys.begin(),last_keys.end(),
171 std::inserter(not_in_last_keys, not_in_last_keys.begin()));
173 std::set_difference(last_keys.begin(),last_keys.end(),first_keys.begin(),first_keys.end(),
174 std::inserter(not_in_first_keys, not_in_first_keys.begin()));
179 std::vector<float> y_x1,y_x2,y_x3,y_line;
180 std::vector<std::string> s_x1,s_x2,s_x3;
189 s_x1.push_back(
"#scale[1.2]{Key}");
191 s_x2.push_back(
"#scale[1.2]{in IOV: "+firstIOVsince+
"}");
193 s_x3.push_back(
"#scale[1.2]{in IOV: "+lastIOVsince+
"}");
197 for(
const auto&
key : not_in_last_keys ) {
202 const std::vector<std::string> missing_in_last_paths = first_payload->decompose(first_triggerMap.at(
key));
204 std::vector<std::string>
output;
206 for (
unsigned int iPath = 0; iPath < missing_in_last_paths.size(); ++iPath) {
208 if((toAppend+missing_in_last_paths[iPath]).length()<60){
209 toAppend+=missing_in_last_paths[iPath]+
";";
212 output.push_back(toAppend);
214 toAppend+=missing_in_last_paths[iPath]+
";";
217 if(iPath==missing_in_last_paths.size()-1) output.push_back(toAppend);
220 for (
unsigned int br=0;
br<output.size();
br++){
222 s_x2.push_back(
"#color[2]{"+output[
br]+
"}");
223 if(
br!=output.size()-1) y -=pitch;
225 y_line.push_back(y-0.008);
230 for(
const auto&
key : not_in_first_keys ) {
234 const std::vector<std::string> missing_in_first_paths = last_payload->decompose(last_triggerMap.at(
key));
236 std::vector<std::string>
output;
238 for (
unsigned int iPath = 0; iPath < missing_in_first_paths.size(); ++iPath) {
240 if((toAppend+missing_in_first_paths[iPath]).length()<60){
241 toAppend+=missing_in_first_paths[iPath]+
";";
244 output.push_back(toAppend);
246 toAppend+=missing_in_first_paths[iPath]+
";";
249 if(iPath==missing_in_first_paths.size()-1) output.push_back(toAppend);
252 for (
unsigned int br=0;
br<output.size();
br++){
254 s_x3.push_back(
"#color[4]{"+output[
br]+
"}");
255 if(
br!=output.size()-1) y -= pitch;
257 y_line.push_back(y-0.008);
261 for(
const auto &element : first_triggerMap){
263 if(last_triggerMap.find(element.first)!=last_triggerMap.end()){
265 auto lastElement = last_triggerMap.find(element.first);
268 const std::vector<std::string> first_paths = first_payload->decompose(element.second);
269 const std::vector<std::string> last_paths = last_payload->decompose(lastElement->second);
271 std::vector<std::string> not_in_first;
272 std::vector<std::string> not_in_last;
274 std::set_difference(first_paths.begin(),first_paths.end(),last_paths.begin(),last_paths.end(),
275 std::inserter(not_in_last, not_in_last.begin()));
277 std::set_difference(last_paths.begin(),last_paths.end(),first_paths.begin(),first_paths.end(),
278 std::inserter(not_in_first, not_in_first.begin()));
280 if(!not_in_last.empty() || !not_in_first.empty()) {
284 s_x1.push_back(element.first);
286 std::vector<std::string>
output;
288 for (
unsigned int iPath = 0; iPath < not_in_last.size(); ++iPath) {
290 if((toAppend+not_in_last[iPath]).length()<60){
291 toAppend+=not_in_last[iPath]+
";";
294 output.push_back(toAppend);
296 toAppend+=not_in_last[iPath]+
";";
299 if(toAppend.length()>0 && iPath==not_in_last.size()-1) output.push_back(toAppend);
302 unsigned int count = output.size();
305 y_x2.push_back(y-(
br*pitch));
306 s_x2.push_back(
"#color[6]{"+output[
br]+
"}");
312 for (
unsigned int jPath = 0; jPath < not_in_first.size(); ++jPath) {
314 if((toAppend+not_in_first[jPath]).length()<60){
315 toAppend+=not_in_first[jPath]+
";";
318 output.push_back(toAppend);
320 toAppend+=not_in_first[jPath]+
";";
323 if(toAppend.length()>0 && jPath==not_in_first.size()-1) output.push_back(toAppend);
326 unsigned int count1 = output.size();
328 for (
unsigned int br=0;
br<count1;
br++){
329 y_x3.push_back(y-(
br*pitch));
330 s_x3.push_back(
"#color[8]{"+output[
br]+
"}");
334 y-=(
std::max(count,count1)-1)*pitch;
336 y_line.push_back(y-0.008);
342 TCanvas
canvas(
"AlCaRecoTriggerBits",
"AlCaRecoTriggerBits",2500.,
std::max(y_x1.size(),y_x2.size())*40);
349 float newpitch = 1/(
std::max(y_x1.size(),y_x2.size())*1.65);
350 float factor = newpitch/pitch;
351 l.SetTextSize(newpitch-0.002);
353 for(
unsigned int i=0;i<y_x1.size();i++){
354 l.DrawLatexNDC(x1,1-(1-y_x1[i])*factor,s_x1[i].c_str());
357 for(
unsigned int i=0;i<y_x2.size();i++){
358 l.DrawLatexNDC(x2,1-(1-y_x2[i])*factor,s_x2[i].c_str());
361 for(
unsigned int i=0;i<y_x3.size();i++){
362 l.DrawLatexNDC(x3,1-(1-y_x3[i])*factor,s_x3[i].c_str());
368 TLine lines[y_line.size()];
370 for (
const auto &
line : y_line){
371 lines[iL] = TLine(gPad->GetUxmin(),1-(1-
line)*factor,gPad->GetUxmax(),1-(1-
line)*factor);
372 lines[iL].SetLineWidth(1);
373 lines[iL].SetLineStyle(9);
374 lines[iL].SetLineColor(2);
375 lines[iL].Draw(
"same");
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
virtual bool fill(const std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs)=0
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
void setSingleIov(bool flag)