For pilot2 d#859
Conversation
|
I let @wiechula review this PR. |
| if (titleh.find("IROC") != std::string::npos) | ||
| iroc = true; | ||
| if (titleh.find("OROC") != std::string::npos) | ||
| oroc = true; | ||
| if (!(iroc || oroc)) | ||
| return Quality::Null; |
There was a problem hiding this comment.
add readability braces and simplify expression (assuming it cannot be both, IROC and OROC). Also, the IROC / OROC distinction is only used to get the total number of pads.
| if (titleh.find("IROC") != std::string::npos) | |
| iroc = true; | |
| if (titleh.find("OROC") != std::string::npos) | |
| oroc = true; | |
| if (!(iroc || oroc)) | |
| return Quality::Null; | |
| int totalPads = 0; | |
| if (titleh.find("IROC") != std::string::npos) { | |
| totalPads = 5280; | |
| } else if (titleh.find("OROC") != std::string::npos) { | |
| totalPads = 9280; | |
| } else { | |
| return Quality::Null; | |
| } |
| auto padName = fmt::format("c_ROCs_Pedestal_2D_{:d}", tpads); | ||
| auto histName = fmt::format("h_Pedestals_ROC_{:02d}", tpads - 1); |
There was a problem hiding this comment.
| auto padName = fmt::format("c_ROCs_Pedestal_2D_{:d}", tpads); | |
| auto histName = fmt::format("h_Pedestals_ROC_{:02d}", tpads - 1); | |
| const auto padName = fmt::format("c_ROCs_Pedestal_2D_{:d}", tpads); | |
| const auto histName = fmt::format("h_Pedestals_ROC_{:02d}", tpads - 1); |
| Quality result = Quality::Null; | ||
| if (mo->getName() == "c_ROCs_Pedestal_2D") { | ||
| result = Quality::Good; | ||
| auto* canv = dynamic_cast<TCanvas*>(mo->getObject()); |
There was a problem hiding this comment.
dynamic cast only makes sense if you want the verify the object type. So I guess you should either change this to static_cast of c-style cast (TCanvas*) or add
if (!canv) {
return Quality::Null;
}| auto histName = fmt::format("h_Pedestals_ROC_{:02d}", tpads - 1); | ||
| TPad* pad = (TPad*)canv->GetListOfPrimitives()->FindObject(padName.data()); | ||
| TH2F* h = (TH2F*)pad->GetListOfPrimitives()->FindObject(histName.data()); | ||
| std::string titleh = h->GetTitle(); |
There was a problem hiding this comment.
| std::string titleh = h->GetTitle(); | |
| const std::string titleh = h->GetTitle(); |
| int totalPads = 0; | ||
| if (iroc) | ||
| totalPads = 5280; | ||
| if (oroc) | ||
| totalPads = 9280; |
There was a problem hiding this comment.
Not needed, see above.
| int totalPads = 0; | |
| if (iroc) | |
| totalPads = 5280; | |
| if (oroc) | |
| totalPads = 9280; |
| auto padName = fmt::format("c_ROCs_Pedestal_2D_{:d}", tpads); | ||
| auto histName = fmt::format("h_Pedestals_ROC_{:02d}", tpads - 1); |
There was a problem hiding this comment.
| auto padName = fmt::format("c_ROCs_Pedestal_2D_{:d}", tpads); | |
| auto histName = fmt::format("h_Pedestals_ROC_{:02d}", tpads - 1); | |
| const auto padName = fmt::format("c_ROCs_Pedestal_2D_{:d}", tpads); | |
| const auto histName = fmt::format("h_Pedestals_ROC_{:02d}", tpads - 1); |
| TPad* pad = (TPad*)canv->GetListOfPrimitives()->FindObject(padName.data()); | ||
| pad->cd(); | ||
| TH2F* h = (TH2F*)pad->GetListOfPrimitives()->FindObject(histName.data()); | ||
| std::string titleh = h->GetTitle(); |
There was a problem hiding this comment.
| std::string titleh = h->GetTitle(); | |
| const std::string titleh = h->GetTitle(); |
| if (it != badSectorsName.end()) { | ||
| TPaveText* msg = new TPaveText(0.1, 0.9, 0.9, 0.95, "NDC"); | ||
| msg->SetBorderSize(1); | ||
| int index = std::distance(badSectorsName.begin(), it); |
There was a problem hiding this comment.
| int index = std::distance(badSectorsName.begin(), it); | |
| const int index = std::distance(badSectorsName.begin(), it); |
| pad->cd(); | ||
| TH2F* h = (TH2F*)pad->GetListOfPrimitives()->FindObject(histName.data()); | ||
| std::string titleh = h->GetTitle(); | ||
| std::vector<std::string>::iterator it = std::find(badSectorsName.begin(), badSectorsName.end(), titleh); |
There was a problem hiding this comment.
| std::vector<std::string>::iterator it = std::find(badSectorsName.begin(), badSectorsName.end(), titleh); | |
| auto it = std::find(badSectorsName.begin(), badSectorsName.end(), titleh); |
| TH2F* h = (TH2F*)pad->GetListOfPrimitives()->FindObject(histName.data()); | ||
| std::string titleh = h->GetTitle(); | ||
| std::vector<std::string>::iterator it = std::find(badSectorsName.begin(), badSectorsName.end(), titleh); | ||
| if (it != badSectorsName.end()) { |
There was a problem hiding this comment.
Change logic to make clear that the reader does not have to continue reading the code:
| if (it != badSectorsName.end()) { | |
| if (it == badSectorsName.end()) { | |
| continue | |
| } |
e3ca053 to
9a71874
Compare
|
error unrelated, merging |
|
@Barthelemy , seem it is not merged. |
The following check takes a canvas as input, loops over all figures containing IROCs and OROCs in the canvas and checks for empty pads.
Besides storing the main quality object, it has private member to store qualities for every histogram which are later used in beautify to show specific quality for every histogram instead of the entire canvas.
@wiechula Stefan suggested the limits for medium quality 30% of pads empty and for bad 60% of pads empty. Do you think this is reasonable?