CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes
RPCDBSimSetUp Class Reference

#include <RPCDBSimSetUp.h>

Public Member Functions

std::map< int, std::vector
< double > > 
getClsMap ()
 
std::vector< float > getEff (uint32_t id)
 
const RPCGeometrygetGeometry ()
 
std::vector< float > getNoise (uint32_t id)
 
float getTime (uint32_t id)
 
 RPCDBSimSetUp (const edm::ParameterSet &ps)
 
void setGeometry (const RPCGeometry *geom)
 sets geometry More...
 
virtual ~RPCDBSimSetUp ()
 

Public Attributes

std::map< RPCDetId, float > _bxmap
 
std::map< int, std::vector
< double > > 
_clsMap
 
std::ifstream * _infile1
 
std::ifstream * _infile2
 
std::ifstream * _infile3
 
std::ifstream * _infile4
 
std::map< uint32_t,
std::vector< float > > 
_mapDetIdEff
 
std::map< uint32_t,
std::vector< float > > 
_mapDetIdNoise
 
const RPCGeometrytheGeometry
 

Detailed Description

Definition at line 21 of file RPCDBSimSetUp.h.

Constructor & Destructor Documentation

RPCDBSimSetUp::RPCDBSimSetUp ( const edm::ParameterSet ps)
explicit

Definition at line 18 of file RPCDBSimSetUp.cc.

References edmScanValgrind::buffer, submitPVResolutionJobs::count, counter, edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), mps_fire::i, recoMuon::in, RPCDetId, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

18  {
19  _mapDetIdNoise.clear();
20  _mapDetIdEff.clear();
21  _bxmap.clear();
22 
23  //------------------------ Noise Reading ----------------------------
24 
25  edm::FileInPath fp1 = ps.getParameter<edm::FileInPath>("noisemapfile");
26  std::ifstream _infile1(fp1.fullPath().c_str(), std::ios::in);
27 
28  std::vector<float> vnoise;
29 
30  int rpcdetid = 0;
31  std::string buff;
32 
33  std::vector<std::string> words;
34 
35  int count = 0;
36  while (getline(_infile1, buff, '\n')) {
37  words.clear();
38  vnoise.clear();
39 
40  stringstream ss;
41  std::string chname;
42  ss << buff;
43  ss >> chname >> rpcdetid;
44 
45  std::string::size_type pos = 0, prev_pos = 0;
46 
47  while ((pos = buff.find(" ", pos)) != string::npos) {
48  words.push_back(buff.substr(prev_pos, pos - prev_pos));
49  prev_pos = ++pos;
50  }
51  words.push_back(buff.substr(prev_pos, pos - prev_pos));
52 
53  for (unsigned int i = 2; i < words.size(); ++i) {
54  float value = atof(((words)[i]).c_str());
55  vnoise.push_back(value);
56  }
57 
58  _mapDetIdNoise.insert(make_pair(static_cast<uint32_t>(rpcdetid), vnoise));
59 
60  count++;
61  }
62  _infile1.close();
63 
64  //------------------------ Eff Reading ----------------------------
65 
66  edm::FileInPath fp2 = ps.getParameter<edm::FileInPath>("effmapfile");
67  _infile2 = new ifstream(fp2.fullPath().c_str(), std::ios::in);
68 
69  std::vector<float> veff;
70  rpcdetid = 0;
71 
72  while (getline(*_infile2, buff, '\n')) {
73  words.clear();
74  veff.clear();
75 
76  stringstream ss;
77  std::string chname;
78  ss << buff;
79  ss >> chname >> rpcdetid;
80 
81  std::string::size_type pos = 0, prev_pos = 0;
82  while ((pos = buff.find(" ", pos)) != string::npos) {
83  words.push_back(buff.substr(prev_pos, pos - prev_pos));
84  prev_pos = ++pos;
85  }
86  words.push_back(buff.substr(prev_pos, pos - prev_pos));
87 
88  for (unsigned int i = 2; i < words.size(); ++i) {
89  float value = atof(((words)[i]).c_str());
90  veff.push_back(value);
91  }
92  _mapDetIdEff.insert(make_pair(static_cast<uint32_t>(rpcdetid), veff));
93  }
94  _infile2->close();
95 
96  //---------------------- Timing reading ------------------------------------
97 
98  edm::FileInPath fp3 = ps.getParameter<edm::FileInPath>("timingMap");
99  _infile3 = new ifstream(fp3.fullPath().c_str(), std::ios::in);
100 
101  uint32_t detUnit = 0;
102  float timing = 0.;
103  while (!_infile3->eof()) {
104  *_infile3 >> detUnit >> timing;
105  _bxmap[RPCDetId(detUnit)] = timing;
106  }
107  _infile3->close();
108 
109  //---------------------- Cluster size --------------------------------------
110 
111  edm::FileInPath fp4 = ps.getParameter<edm::FileInPath>("clsmapfile");
112  _infile4 = new ifstream(fp4.fullPath().c_str(), ios::in);
113 
114  string buffer;
115  double sum = 0;
116  unsigned int counter = 1;
117  unsigned int row = 1;
118  std::vector<double> sum_clsize;
119 
120  while (*_infile4 >> buffer) {
121  const char* buffer1 = buffer.c_str();
122  double dato = atof(buffer1);
123  sum += dato;
124  sum_clsize.push_back(sum);
125 
126  if (counter == row * 20) {
127  _clsMap[row] = sum_clsize;
128  row++;
129  sum = 0;
130  sum_clsize.clear();
131  }
132  counter++;
133  }
134  _infile4->close();
135 }
std::ifstream * _infile1
Definition: RPCDBSimSetUp.h:42
std::map< int, std::vector< double > > _clsMap
Definition: RPCDBSimSetUp.h:40
std::map< uint32_t, std::vector< float > > _mapDetIdEff
Definition: RPCDBSimSetUp.h:38
uint16_t size_type
std::ifstream * _infile2
Definition: RPCDBSimSetUp.h:43
std::map< uint32_t, std::vector< float > > _mapDetIdNoise
Definition: RPCDBSimSetUp.h:37
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::ifstream * _infile3
Definition: RPCDBSimSetUp.h:44
static std::atomic< unsigned int > counter
std::string fullPath() const
Definition: FileInPath.cc:161
std::map< RPCDetId, float > _bxmap
Definition: RPCDBSimSetUp.h:39
std::ifstream * _infile4
Definition: RPCDBSimSetUp.h:45
RPCDBSimSetUp::~RPCDBSimSetUp ( )
virtual

Definition at line 155 of file RPCDBSimSetUp.cc.

155  {
156  delete _infile1;
157  delete _infile2;
158  delete _infile3;
159  delete _infile4;
160 }
std::ifstream * _infile1
Definition: RPCDBSimSetUp.h:42
std::ifstream * _infile2
Definition: RPCDBSimSetUp.h:43
std::ifstream * _infile3
Definition: RPCDBSimSetUp.h:44
std::ifstream * _infile4
Definition: RPCDBSimSetUp.h:45

Member Function Documentation

std::map< int, std::vector< double > > RPCDBSimSetUp::getClsMap ( )

Definition at line 153 of file RPCDBSimSetUp.cc.

153 { return _clsMap; }
std::map< int, std::vector< double > > _clsMap
Definition: RPCDBSimSetUp.h:40
std::vector< float > RPCDBSimSetUp::getEff ( uint32_t  id)

Definition at line 142 of file RPCDBSimSetUp.cc.

Referenced by RPCDBPerformanceHandler::getNewObjects().

142  {
143  map<uint32_t, std::vector<float> >::iterator iter = _mapDetIdEff.find(id);
144  return iter->second;
145 }
std::map< uint32_t, std::vector< float > > _mapDetIdEff
Definition: RPCDBSimSetUp.h:38
const RPCGeometry* RPCDBSimSetUp::getGeometry ( )
inline

Definition at line 33 of file RPCDBSimSetUp.h.

References theGeometry.

33 { return theGeometry; }
const RPCGeometry * theGeometry
Definition: RPCDBSimSetUp.h:35
std::vector< float > RPCDBSimSetUp::getNoise ( uint32_t  id)

Definition at line 137 of file RPCDBSimSetUp.cc.

137  {
138  map<uint32_t, std::vector<float> >::iterator iter = _mapDetIdNoise.find(id);
139  return (iter->second);
140 }
std::map< uint32_t, std::vector< float > > _mapDetIdNoise
Definition: RPCDBSimSetUp.h:37
float RPCDBSimSetUp::getTime ( uint32_t  id)

Definition at line 147 of file RPCDBSimSetUp.cc.

Referenced by RPCDBPerformanceHandler::getNewObjects().

147  {
148  RPCDetId rpcid(id);
149  std::map<RPCDetId, float>::iterator iter = _bxmap.find(rpcid);
150  return iter->second;
151 }
std::map< RPCDetId, float > _bxmap
Definition: RPCDBSimSetUp.h:39
void RPCDBSimSetUp::setGeometry ( const RPCGeometry geom)
inline

sets geometry

Definition at line 32 of file RPCDBSimSetUp.h.

References relativeConstraints::geom, and theGeometry.

32 { theGeometry = geom; }
const RPCGeometry * theGeometry
Definition: RPCDBSimSetUp.h:35

Member Data Documentation

std::map<RPCDetId, float> RPCDBSimSetUp::_bxmap

Definition at line 39 of file RPCDBSimSetUp.h.

std::map<int, std::vector<double> > RPCDBSimSetUp::_clsMap

Definition at line 40 of file RPCDBSimSetUp.h.

Referenced by RPCDBPerformanceHandler::getNewObjects().

std::ifstream* RPCDBSimSetUp::_infile1

Definition at line 42 of file RPCDBSimSetUp.h.

std::ifstream* RPCDBSimSetUp::_infile2

Definition at line 43 of file RPCDBSimSetUp.h.

std::ifstream* RPCDBSimSetUp::_infile3

Definition at line 44 of file RPCDBSimSetUp.h.

std::ifstream* RPCDBSimSetUp::_infile4

Definition at line 45 of file RPCDBSimSetUp.h.

std::map<uint32_t, std::vector<float> > RPCDBSimSetUp::_mapDetIdEff

Definition at line 38 of file RPCDBSimSetUp.h.

std::map<uint32_t, std::vector<float> > RPCDBSimSetUp::_mapDetIdNoise

Definition at line 37 of file RPCDBSimSetUp.h.

Referenced by RPCDBPerformanceHandler::getNewObjects().

const RPCGeometry* RPCDBSimSetUp::theGeometry

Definition at line 35 of file RPCDBSimSetUp.h.

Referenced by getGeometry(), and setGeometry().