CMS 3D CMS Logo

Functions
print_TrackerMap.cc File Reference
#include <iostream>
#include <string>
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "CommonTools/TrackerMap/interface/TrackerMap.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 
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)
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 16 of file print_TrackerMap.cc.

References dir2webdir::argc, cmsBatch::argv, gather_cfg::cout, corrVsCorr::filename, SiStripPI::max, SiStripPI::min, timingPdfMaker::outfile, printTrackerMap(), findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, and runGCPTkAlMap::title.

16  {
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 }
size
Write out results.

◆ 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 at line 52 of file print_TrackerMap.cc.

References gather_cfg::cout, corrVsCorr::filename, input, createfilelist::int, SiStripPI::max, SiStripPI::min, timingPdfMaker::outfile, muonDTDigis_cfi::pset, particleFlowDisplacedVertex_cfi::ratio, findQualityFiles::size, runGCPTkAlMap::title, and heppy_batch::val.

Referenced by main().

59  {
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