Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:56:54

0001 #include <cstdlib>
0002 #include <string>
0003 #include <iostream>
0004 #include <numeric>
0005 #include <functional>
0006 
0007 #include "exceptions.h"
0008 #include "toolbox.h"
0009 #include "Options.h"
0010 
0011 #include "boost/filesystem.hpp"
0012 #include "boost/property_tree/ptree.hpp"
0013 #include "boost/property_tree/json_parser.hpp"
0014 #include "boost/optional.hpp"
0015 
0016 #include "TString.h"
0017 #include "TASImage.h"
0018 
0019 #include "Alignment/OfflineValidation/macros/trackSplitPlot.h"
0020 #include "Alignment/OfflineValidation/macros/trackSplitPlot.C"
0021 #include "Alignment/OfflineValidation/interface/TkAlStyle.h"
0022 
0023 using namespace std;
0024 using namespace AllInOneConfig;
0025 
0026 namespace pt = boost::property_tree;
0027 
0028 int merge(int argc, char* argv[]) {
0029   // parse the command line
0030 
0031   Options options;
0032   options.helper(argc, argv);
0033   options.parser(argc, argv);
0034 
0035   //Read in AllInOne json config
0036   pt::ptree main_tree;
0037   pt::read_json(options.config, main_tree);
0038 
0039   pt::ptree alignments = main_tree.get_child("alignments");
0040   pt::ptree validation = main_tree.get_child("validation");
0041   pt::ptree global_style;
0042   pt::ptree merge_style;
0043 
0044   int iov = validation.count("IOV") ? validation.get<int>("IOV") : 1;
0045   std::string rlabel = validation.count("customrighttitle") ? validation.get<std::string>("customrighttitle") : "";
0046   rlabel = merge_style.count("Rlabel") ? merge_style.get<std::string>("Rlabel") : rlabel;
0047   std::string cmslabel = merge_style.count("CMSlabel") ? merge_style.get<std::string>("CMSlabel") : "INTERNAL";
0048   if (TkAlStyle::toStatus(cmslabel) == CUSTOM)
0049     TkAlStyle::set(CUSTOM, NONE, cmslabel, rlabel);
0050   else
0051     TkAlStyle::set(TkAlStyle::toStatus(cmslabel), NONE, "", rlabel);
0052 
0053   TString filesAndLabels;
0054   for (const auto& childTree : alignments) {
0055     // Print node name and its attributes
0056     std::cout << "Node: " << childTree.first << std::endl;
0057     for (const auto& attr : childTree.second) {
0058       std::cout << "  Attribute: " << attr.first << " = " << attr.second.data() << std::endl;
0059     }
0060 
0061     //std::cout << childTree.second.get<string>("file") << std::endl;
0062     //std::cout << childTree.second.get<string>("title") << std::endl;
0063     //std::cout << childTree.second.get<int>("color") << std::endl;
0064     //std::cout << childTree.second.get<int>("style") << std::endl;
0065 
0066     std::string toAdd = childTree.second.get<string>("file") +
0067                         Form("/MTSValidation_%s_%d.root=", childTree.first.c_str(), iov) +
0068                         childTree.second.get<string>("title") +
0069                         Form("|%i|%i,", childTree.second.get<int>("color"), childTree.second.get<int>("style"));
0070     filesAndLabels += toAdd;
0071   }
0072 
0073   std::cout << "filesAndLabels: " << filesAndLabels << std::endl;
0074 
0075   TkAlStyle::legendheader = "";
0076   TkAlStyle::legendoptions = "all";
0077   outliercut = -1.0;
0078   //fillmatrix();
0079   subdetector = "PIXEL";
0080   makePlots(filesAndLabels, "./");
0081 
0082   return EXIT_SUCCESS;
0083 }
0084 
0085 #ifndef DOXYGEN_SHOULD_SKIP_THIS
0086 int main(int argc, char* argv[]) { return exceptions<merge>(argc, argv); }
0087 #endif