CMS 3D CMS Logo

print_TrackerMap.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <string>
3 
6 
8  const std::string title,
9  const std::string outfile,
10  const int size,
11  const std::string logscale,
12  std::string withpixel,
13  const float min,
14  const float max);
15 
16 int main(int argc, char* argv[]) {
17  if (argc >= 4) {
18  int size = 4500;
19  float min = 10.;
20  float max = -1.;
21  std::string logscale = "False";
22  std::string withpixel = "False";
23 
24  char* filename = argv[1];
25  char* title = argv[2];
26  char* outfile = argv[3];
27  std::cout << "ready to use file " << filename << " to create the map " << title << " and save it in " << outfile
28  << std::endl;
29 
30  if (argc >= 5) {
31  size = atoi(argv[4]);
32  }
33  if (argc >= 6) {
34  logscale = argv[5];
35  withpixel = argv[6];
36  }
37  if (argc >= 9) {
38  min = atof(argv[7]);
39  max = atof(argv[8]);
40  }
41 
42  printTrackerMap(filename, title, outfile, size, logscale, withpixel, min, max);
43 
44  } else {
45  std::cout << "Wrong number of arguments: " << argc << std::endl;
46  return -1;
47  }
48 
49  return 0;
50 }
51 
53  const std::string title,
54  const std::string outfile,
55  const int size,
56  const std::string logscale,
57  std::string withpixel,
58  const float min,
59  const float max) {
61 
62  if (logscale == "True")
63  pset.addUntrackedParameter<bool>("logScale", true);
64  if (logscale == "False")
65  pset.addUntrackedParameter<bool>("logScale", false);
66 
67  TrackerMap themap(pset);
68  themap.setTitle(title); // title as input parameter
69  double ratio = 2400. / 4500.;
70  if (withpixel == "True") {
71  themap.addPixel(true);
72  themap.onlyPixel(false);
73  ratio = 8. / 19.;
74  }
75  if (withpixel == "Only") {
76  themap.addPixel(false);
77  themap.onlyPixel(true);
78  ratio = 16. / 9.;
79  }
80  if (withpixel == "False") {
81  themap.addPixel(false);
82  themap.onlyPixel(false);
83  ratio = 8. / 15.;
84  }
85 
86  std::ifstream input(filename);
87 
88  unsigned int detid;
89  float val;
90 
91  while (input >> detid >> val) {
92  themap.fill_current_val(detid, val);
93  }
94 
95  std::cout << "preparing a map with size " << size << "x" << int(size * ratio) << std::endl;
96 
97  themap.save(true, min, max, outfile, size, int(size * ratio)); // name and size as input parameters
98 }
size
Write out results.
static std::string const input
Definition: EdmProvDump.cc:47