CMS 3D CMS Logo

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::RPCDBSimSetUp ( const edm::ParameterSet ps)
explicit

Definition at line 18 of file RPCDBSimSetUp.cc.

References edmScanValgrind::buffer, edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), mps_fire::i, recoMuon::in, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, and ecalMatacq_cfi::timing.

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

◆ ~RPCDBSimSetUp()

RPCDBSimSetUp::~RPCDBSimSetUp ( )
virtual

Definition at line 152 of file RPCDBSimSetUp.cc.

152  {
153  delete _infile1;
154  delete _infile2;
155  delete _infile3;
156  delete _infile4;
157 }
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

◆ getClsMap()

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

Definition at line 150 of file RPCDBSimSetUp.cc.

150 { return _clsMap; }
std::map< int, std::vector< double > > _clsMap
Definition: RPCDBSimSetUp.h:40

◆ getEff()

std::vector< float > RPCDBSimSetUp::getEff ( uint32_t  id)

Definition at line 139 of file RPCDBSimSetUp.cc.

Referenced by RPCDBPerformanceHandler::getNewObjects().

139  {
140  map<uint32_t, std::vector<float> >::iterator iter = _mapDetIdEff.find(id);
141  return iter->second;
142 }
std::map< uint32_t, std::vector< float > > _mapDetIdEff
Definition: RPCDBSimSetUp.h:38

◆ getGeometry()

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

◆ getNoise()

std::vector< float > RPCDBSimSetUp::getNoise ( uint32_t  id)

Definition at line 134 of file RPCDBSimSetUp.cc.

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

◆ getTime()

float RPCDBSimSetUp::getTime ( uint32_t  id)

Definition at line 144 of file RPCDBSimSetUp.cc.

Referenced by RPCDBPerformanceHandler::getNewObjects().

144  {
145  RPCDetId rpcid(id);
146  std::map<RPCDetId, float>::iterator iter = _bxmap.find(rpcid);
147  return iter->second;
148 }
std::map< RPCDetId, float > _bxmap
Definition: RPCDBSimSetUp.h:39

◆ setGeometry()

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

◆ _bxmap

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

Definition at line 39 of file RPCDBSimSetUp.h.

◆ _clsMap

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

Definition at line 40 of file RPCDBSimSetUp.h.

Referenced by RPCDBPerformanceHandler::getNewObjects().

◆ _infile1

std::ifstream* RPCDBSimSetUp::_infile1

Definition at line 42 of file RPCDBSimSetUp.h.

◆ _infile2

std::ifstream* RPCDBSimSetUp::_infile2

Definition at line 43 of file RPCDBSimSetUp.h.

◆ _infile3

std::ifstream* RPCDBSimSetUp::_infile3

Definition at line 44 of file RPCDBSimSetUp.h.

◆ _infile4

std::ifstream* RPCDBSimSetUp::_infile4

Definition at line 45 of file RPCDBSimSetUp.h.

◆ _mapDetIdEff

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

Definition at line 38 of file RPCDBSimSetUp.h.

◆ _mapDetIdNoise

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

Definition at line 37 of file RPCDBSimSetUp.h.

Referenced by RPCDBPerformanceHandler::getNewObjects().

◆ theGeometry

const RPCGeometry* RPCDBSimSetUp::theGeometry

Definition at line 35 of file RPCDBSimSetUp.h.

Referenced by getGeometry(), and setGeometry().