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

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

Definition at line 9 of file print_TrackerMap.cc.

References gather_cfg::cout, corrVsCorr::filename, SiStripPI::max, min(), lumiCalc2::outfile, printTrackerMap(), findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, and fftjetcommon_cfi::title.

9  {
10 
11  if(argc>=4) {
12 
13  int size=4500;
14  float min = 10.;
15  float max = -1.;
16  std::string logscale = "False";
17  std::string withpixel = "False";
18 
19  char* filename =argv[1];
20  char* title = argv[2];
21  char* outfile = argv[3];
22  std::cout << "ready to use file " << filename << " to create the map " << title << " and save it in " <<outfile << std::endl;
23 
24  if(argc>=5) {
25  size = atoi(argv[4]);
26  }
27  if(argc>=6) {
28  logscale = argv[5];
29  withpixel = argv[6];
30  }
31  if(argc>=9) {
32  min = atof(argv[7]);
33  max = atof(argv[8]);
34  }
35 
36  printTrackerMap(filename,title,outfile,size,logscale,withpixel,min,max);
37 
38  }
39  else { std::cout << "Wrong number of arguments: " << argc << std::endl; return -1; }
40 
41  return 0;
42 }
size
Write out results.
T min(T a, T b)
Definition: MathUtil.h:58
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 44 of file print_TrackerMap.cc.

References edm::ParameterSet::addUntrackedParameter(), gather_cfg::cout, input, createfilelist::int, muonDTDigis_cfi::pset, particleFlowDisplacedVertex_cfi::ratio, and heppy_batch::val.

Referenced by main().

45  {
46 
47 
49 
50  if(logscale=="True") pset.addUntrackedParameter<bool>("logScale",true);
51  if(logscale=="False") pset.addUntrackedParameter<bool>("logScale",false);
52 
53  TrackerMap themap(pset);
54  themap.setTitle(title); // title as input parameter
55  double ratio=2400./4500.;
56  if(withpixel=="True") {themap.addPixel(true); themap.onlyPixel(false); ratio=8./19.;}
57  if(withpixel=="Only") {themap.addPixel(false); themap.onlyPixel(true); ratio=16./9.;}
58  if(withpixel=="False") {themap.addPixel(false); themap.onlyPixel(false); ratio=8./15.;}
59 
60  std::ifstream input(filename);
61 
62  unsigned int detid;
63  float val;
64 
65  while( input >> detid >> val) {
66  themap.fill_current_val(detid,val);
67  }
68 
69  std::cout << "preparing a map with size " << size << "x" << int(size*ratio) << std::endl;
70 
71  themap.save(true,min,max,outfile,size,int(size*ratio)); // name and size as input parameters
72 
73 
74 
75 }
size
Write out results.
static std::string const input
Definition: EdmProvDump.cc:44
T min(T a, T b)
Definition: MathUtil.h:58
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:208