CMS 3D CMS Logo

MTSmerge.cc
Go to the documentation of this file.
1 #include <cstdlib>
2 #include <string>
3 #include <iostream>
4 #include <numeric>
5 #include <functional>
6 
7 #include "exceptions.h"
8 #include "toolbox.h"
9 #include "Options.h"
10 
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"
15 
16 #include "TString.h"
17 #include "TASImage.h"
18 
20 #include "Alignment/OfflineValidation/macros/trackSplitPlot.C"
22 
23 using namespace std;
24 using namespace AllInOneConfig;
25 
26 namespace pt = boost::property_tree;
27 
28 int merge(int argc, char* argv[]) {
29  // parse the command line
30 
32  options.helper(argc, argv);
33  options.parser(argc, argv);
34 
35  //Read in AllInOne json config
36  pt::ptree main_tree;
37  pt::read_json(options.config, main_tree);
38 
39  pt::ptree alignments = main_tree.get_child("alignments");
40  pt::ptree validation = main_tree.get_child("validation");
41  pt::ptree global_style;
42  pt::ptree merge_style;
43 
44  int iov = validation.count("IOV") ? validation.get<int>("IOV") : 1;
45  std::string rlabel = validation.count("customrighttitle") ? validation.get<std::string>("customrighttitle") : "";
46  rlabel = merge_style.count("Rlabel") ? merge_style.get<std::string>("Rlabel") : rlabel;
47  std::string cmslabel = merge_style.count("CMSlabel") ? merge_style.get<std::string>("CMSlabel") : "INTERNAL";
48  if (TkAlStyle::toStatus(cmslabel) == CUSTOM)
49  TkAlStyle::set(CUSTOM, NONE, cmslabel, rlabel);
50  else
51  TkAlStyle::set(TkAlStyle::toStatus(cmslabel), NONE, "", rlabel);
52 
53  TString filesAndLabels;
54  for (const auto& childTree : alignments) {
55  // Print node name and its attributes
56  std::cout << "Node: " << childTree.first << std::endl;
57  for (const auto& attr : childTree.second) {
58  std::cout << " Attribute: " << attr.first << " = " << attr.second.data() << std::endl;
59  }
60 
61  //std::cout << childTree.second.get<string>("file") << std::endl;
62  //std::cout << childTree.second.get<string>("title") << std::endl;
63  //std::cout << childTree.second.get<int>("color") << std::endl;
64  //std::cout << childTree.second.get<int>("style") << std::endl;
65 
66  std::string toAdd = childTree.second.get<string>("file") +
67  Form("/MTSValidation_%s_%d.root=", childTree.first.c_str(), iov) +
68  childTree.second.get<string>("title") +
69  Form("|%i|%i,", childTree.second.get<int>("color"), childTree.second.get<int>("style"));
70  filesAndLabels += toAdd;
71  }
72 
73  std::cout << "filesAndLabels: " << filesAndLabels << std::endl;
74 
77  outliercut = -1.0;
78  //fillmatrix();
79  subdetector = "PIXEL";
80  makePlots(filesAndLabels, "./");
81 
82  return EXIT_SUCCESS;
83 }
84 
85 #ifndef DOXYGEN_SHOULD_SKIP_THIS
86 int main(int argc, char* argv[]) { return exceptions<merge>(argc, argv); }
87 #endif
int merge(int argc, char *argv[])
Definition: MTSmerge.cc:28
double outliercut
TString subdetector
int main(int argc, char *argv[])
Definition: MTSmerge.cc:86
static void set(const PublicationStatus status, const Era era=NONE, const TString customTitle="", const TString customRightTitle="")
Definition: TkAlStyle.cc:275
static TString legendheader
Definition: TkAlStyle.h:101
static TString legendoptions
Definition: TkAlStyle.h:102
Definition: TkAlStyle.h:43
static PublicationStatus toStatus(std::string _status)
Definition: TkAlStyle.cc:83
void makePlots(Int_t nFiles, TString *files, TString *names, TString misalignment, Double_t *values, Double_t *phases, TString directory, Bool_t matrix[xsize][ysize])