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 }
printTrackerMap
void printTrackerMap(const std::string filename, const std::string title, const std::string outfile, const int size, const std::string logscale, std::string withpixel, const float min, const float max)
Definition: print_TrackerMap.cc:52
cmsBatch.argv
argv
Definition: cmsBatch.py:279
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
input
static const std::string input
Definition: EdmProvDump.cc:48
dir2webdir.argc
argc
Definition: dir2webdir.py:39
min
T min(T a, T b)
Definition: MathUtil.h:58
gather_cfg.cout
cout
Definition: gather_cfg.py:144
main
int main(int argc, char *argv[])
Definition: print_TrackerMap.cc:16
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
TrackerMap
Definition: TrackerMap.h:76
particleFlowDisplacedVertex_cfi.ratio
ratio
Definition: particleFlowDisplacedVertex_cfi.py:93
edm::ParameterSet
Definition: ParameterSet.h:47
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
createfilelist.int
int
Definition: createfilelist.py:10
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TrackerMap.h
heppy_batch.val
val
Definition: heppy_batch.py:351
timingPdfMaker.outfile
outfile
Definition: timingPdfMaker.py:350
ParameterSet.h
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443