11 #include "boost/filesystem.hpp" 12 #include "boost/property_tree/ptree.hpp" 13 #include "boost/property_tree/json_parser.hpp" 14 #include "boost/optional.hpp" 25 namespace pt = boost::property_tree;
30 for (
const auto& childTree :
tree.get_child(
name)) {
34 return s.substr(0,
s.size() -
token.size());
45 pt::read_json(
options.config, main_tree);
47 pt::ptree
alignments = main_tree.get_child(
"alignments");
48 pt::ptree
validation = main_tree.get_child(
"validation");
49 pt::ptree global_style;
50 pt::ptree merge_style;
51 global_style = main_tree.count(
"style") ? main_tree.get_child(
"style") : global_style;
52 merge_style = global_style.count(
"DMR") && global_style.get_child(
"DMR").count(
"merge")
53 ? global_style.get_child(
"DMR").get_child(
"merge")
61 float maxBadLumiPixel =
validation.count(
"maxBadLumiPixel") ?
validation.get<
float>(
"maxBadLumiPixel") : 0.5;
62 float maxBadLumiStrip =
validation.count(
"maxBadLumiStrip") ?
validation.get<
float>(
"maxBadLumiStrip") : 7.0;
64 rlabel = merge_style.count(
"Rlabel") ? merge_style.get<
std::string>(
"Rlabel") : rlabel;
65 std::string cmslabel = merge_style.count(
"CMSlabel") ? merge_style.get<
std::string>(
"CMSlabel") :
"INTERNAL";
80 std::vector<int> moduleids;
82 for (
const auto& childTree :
validation.get_child(
"moduleid")) {
83 moduleids.push_back(childTree.second.get_value<
int>());
88 TString filesAndLabels;
89 std::vector<std::pair<std::string, pt::ptree>> alignmentsOrdered;
91 alignmentsOrdered.push_back(childTree);
94 alignmentsOrdered.end(),
95 [](
const std::pair<std::string, pt::ptree>& left,
const std::pair<std::string, pt::ptree>& right) {
96 return left.second.get<
int>(
"index") < right.second.get<
int>(
"index");
98 for (
const auto& childTree : alignmentsOrdered) {
100 childTree.second.get<
std::string>(
"file") +
"/DMR.root=" + childTree.second.get<
std::string>(
"title") +
"|" +
103 filesAndLabels.Remove(filesAndLabels.Length() - 3);
113 gStyle->SetTitleH(0.07);
114 gStyle->SetTitleW(1.00);
115 gStyle->SetTitleFont(132);
119 for (
const auto& childTree : alignmentsOrdered) {
120 plotter.loadFileList((childTree.second.get<
std::string>(
"file") +
"/DMR.root").c_str(),
122 childTree.second.get<
int>(
"color"),
123 childTree.second.get<
int>(
"style"));
128 plotter.setTreeBaseDir(
"TrackHitFilter");
129 plotter.plotDMR(methods, minimum, curves, moduleFilterFile, maxBadLumiPixel, maxBadLumiStrip);
130 plotter.plotSurfaceShapes(
"coarse");
131 plotter.plotChi2((main_tree.get<
std::string>(
"output") +
"/" +
"result.root").c_str());
133 for (
const int& moduleid : moduleids) {
134 plotter.residual_by_moduleID(moduleid);
140 #ifndef DOXYGEN_SHOULD_SKIP_THIS
int main(int argc, char *argv[])
static void set(const PublicationStatus status, const Era era=NONE, const TString customTitle="", const TString customRightTitle="")
static TString legendheader
int merge(int argc, char *argv[])
static TString legendoptions
Class PlotAlignmentValidation Class used as the last step for Offline Track Validation tool...
std::string getVecTokenized(pt::ptree &tree, const std::string &name, const std::string &token)
void doComparison(TString namesandlabels, TString legendheader="", TString lefttitle="", TString righttitle="", PublicationStatus status=INTERNAL, bool bigtext=false)
static PublicationStatus toStatus(std::string _status)