CMS 3D CMS Logo

DiMuonVmerge.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 
19 #include "Alignment/OfflineValidation/macros/loopAndPlot.C"
21 
22 using namespace std;
23 using namespace AllInOneConfig;
24 
25 namespace pt = boost::property_tree;
26 
27 int merge(int argc, char* argv[]) {
28  // parse the command line
29 
31  options.helper(argc, argv);
32  options.parser(argc, argv);
33 
34  //Read in AllInOne json config
35  pt::ptree main_tree;
36  pt::read_json(options.config, main_tree);
37 
38  pt::ptree alignments = main_tree.get_child("alignments");
39  pt::ptree validation = main_tree.get_child("validation");
40 
41  TString filesAndLabels;
42  for (const auto& childTree : alignments) {
43  // Print node name and its attributes
44  // std::cout << "Node: " << childTree.first << std::endl;
45  // for (const auto& attr : childTree.second) {
46  // std::cout << " Attribute: " << attr.first << " = " << attr.second.data() << std::endl;
47  // }
48 
49  std::cout << childTree.second.get<string>("file") << std::endl;
50  std::cout << childTree.second.get<string>("title") << std::endl;
51  std::string toAdd = childTree.second.get<string>("file") +
52  "/DiMuonVertexValidation.root=" + childTree.second.get<string>("title") + ",";
53  filesAndLabels += toAdd;
54  }
55 
56  if (filesAndLabels.Length() > 0) {
57  filesAndLabels.Remove(filesAndLabels.Length() - 1); // Remove the last character
58  }
59 
60  std::cout << "filesAndLabels: " << filesAndLabels << std::endl;
61 
62  loopAndPlot(filesAndLabels);
63 
64  return EXIT_SUCCESS;
65 }
66 
67 #ifndef DOXYGEN_SHOULD_SKIP_THIS
68 int main(int argc, char* argv[]) { return exceptions<merge>(argc, argv); }
69 #endif
int merge(int argc, char *argv[])
Definition: DiMuonVmerge.cc:27
int main(int argc, char *argv[])
Definition: DiMuonVmerge.cc:68