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.

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 }

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

◆ 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.

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 }

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

Referenced by main().

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
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
TrackerMap
Definition: TrackerMap.h:76
particleFlowDisplacedVertex_cfi.ratio
ratio
Definition: particleFlowDisplacedVertex_cfi.py:93
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
createfilelist.int
int
Definition: createfilelist.py:10
heppy_batch.val
val
Definition: heppy_batch.py:351
timingPdfMaker.outfile
outfile
Definition: timingPdfMaker.py:351
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443