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 22 of file RPCDBSimSetUp.h.

Constructor & Destructor Documentation

◆ RPCDBSimSetUp()

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

Definition at line 18 of file RPCDBSimSetUp.cc.

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 }

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

◆ ~RPCDBSimSetUp()

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 }

Member Function Documentation

◆ getClsMap()

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

Definition at line 153 of file RPCDBSimSetUp.cc.

153 { return _clsMap; }

◆ getEff()

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

Definition at line 142 of file RPCDBSimSetUp.cc.

142  {
143  map<uint32_t, std::vector<float> >::iterator iter = _mapDetIdEff.find(id);
144  return iter->second;
145 }

Referenced by RPCDBPerformanceHandler::getNewObjects().

◆ getGeometry()

const RPCGeometry* RPCDBSimSetUp::getGeometry ( )
inline

Definition at line 34 of file RPCDBSimSetUp.h.

34 { return theGeometry; }

References theGeometry.

◆ getNoise()

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 }

◆ getTime()

float RPCDBSimSetUp::getTime ( uint32_t  id)

Definition at line 147 of file RPCDBSimSetUp.cc.

147  {
148  RPCDetId rpcid(id);
149  std::map<RPCDetId, float>::iterator iter = _bxmap.find(rpcid);
150  return iter->second;
151 }

Referenced by RPCDBPerformanceHandler::getNewObjects().

◆ setGeometry()

void RPCDBSimSetUp::setGeometry ( const RPCGeometry geom)
inline

sets geometry

Definition at line 33 of file RPCDBSimSetUp.h.

33 { theGeometry = geom; }

References relativeConstraints::geom, and theGeometry.

Member Data Documentation

◆ _bxmap

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

Definition at line 40 of file RPCDBSimSetUp.h.

◆ _clsMap

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

Definition at line 41 of file RPCDBSimSetUp.h.

Referenced by RPCDBPerformanceHandler::getNewObjects().

◆ _infile1

std::ifstream* RPCDBSimSetUp::_infile1

Definition at line 43 of file RPCDBSimSetUp.h.

◆ _infile2

std::ifstream* RPCDBSimSetUp::_infile2

Definition at line 44 of file RPCDBSimSetUp.h.

◆ _infile3

std::ifstream* RPCDBSimSetUp::_infile3

Definition at line 45 of file RPCDBSimSetUp.h.

◆ _infile4

std::ifstream* RPCDBSimSetUp::_infile4

Definition at line 46 of file RPCDBSimSetUp.h.

◆ _mapDetIdEff

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

Definition at line 39 of file RPCDBSimSetUp.h.

◆ _mapDetIdNoise

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

Definition at line 38 of file RPCDBSimSetUp.h.

Referenced by RPCDBPerformanceHandler::getNewObjects().

◆ theGeometry

const RPCGeometry* RPCDBSimSetUp::theGeometry

Definition at line 36 of file RPCDBSimSetUp.h.

Referenced by getGeometry(), and setGeometry().

RPCDBSimSetUp::_mapDetIdNoise
std::map< uint32_t, std::vector< float > > _mapDetIdNoise
Definition: RPCDBSimSetUp.h:38
counter
Definition: counter.py:1
mps_fire.i
i
Definition: mps_fire.py:428
RPCDBSimSetUp::_infile1
std::ifstream * _infile1
Definition: RPCDBSimSetUp.h:43
RPCDetId
Definition: RPCDetId.h:16
pos
Definition: PixelAliasList.h:18
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
edm::FileInPath
Definition: FileInPath.h:64
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
RPCDBSimSetUp::_infile3
std::ifstream * _infile3
Definition: RPCDBSimSetUp.h:45
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
RPCDBSimSetUp::_clsMap
std::map< int, std::vector< double > > _clsMap
Definition: RPCDBSimSetUp.h:41
RPCDBSimSetUp::_infile2
std::ifstream * _infile2
Definition: RPCDBSimSetUp.h:44
recoMuon::in
Definition: RecoMuonEnumerators.h:6
RPCDBSimSetUp::_bxmap
std::map< RPCDetId, float > _bxmap
Definition: RPCDBSimSetUp.h:40
value
Definition: value.py:1
ecalMatacq_cfi.timing
timing
Definition: ecalMatacq_cfi.py:26
RPCDBSimSetUp::theGeometry
const RPCGeometry * theGeometry
Definition: RPCDBSimSetUp.h:36
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
RPCDBSimSetUp::_infile4
std::ifstream * _infile4
Definition: RPCDBSimSetUp.h:46
RPCDBSimSetUp::_mapDetIdEff
std::map< uint32_t, std::vector< float > > _mapDetIdEff
Definition: RPCDBSimSetUp.h:39
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163