CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 22 of file RPCDBSimSetUp.h.

Constructor & Destructor Documentation

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

Definition at line 18 of file RPCDBSimSetUp.cc.

References prof2calltree::count, edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), i, recoMuon::in, pos, RPCDetId, AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

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

Definition at line 167 of file RPCDBSimSetUp.cc.

167  {
168  delete _infile1;
169  delete _infile2;
170  delete _infile3;
171  delete _infile4;
172 }
std::ifstream * _infile1
Definition: RPCDBSimSetUp.h:45
std::ifstream * _infile2
Definition: RPCDBSimSetUp.h:46
std::ifstream * _infile3
Definition: RPCDBSimSetUp.h:47
std::ifstream * _infile4
Definition: RPCDBSimSetUp.h:48

Member Function Documentation

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

Definition at line 162 of file RPCDBSimSetUp.cc.

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

Definition at line 149 of file RPCDBSimSetUp.cc.

Referenced by RPCDBPerformanceHandler::getNewObjects().

150 {
151  map<uint32_t,std::vector<float> >::iterator iter = _mapDetIdEff.find(id);
152  return iter->second;
153 }
std::map< uint32_t, std::vector< float > > _mapDetIdEff
Definition: RPCDBSimSetUp.h:41
const RPCGeometry* RPCDBSimSetUp::getGeometry ( )
inline

Definition at line 36 of file RPCDBSimSetUp.h.

References theGeometry.

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

Definition at line 143 of file RPCDBSimSetUp.cc.

144 {
145  map<uint32_t,std::vector<float> >::iterator iter = _mapDetIdNoise.find(id);
146  return (iter->second);
147 }
std::map< uint32_t, std::vector< float > > _mapDetIdNoise
Definition: RPCDBSimSetUp.h:40
float RPCDBSimSetUp::getTime ( uint32_t  id)

Definition at line 155 of file RPCDBSimSetUp.cc.

Referenced by RPCDBPerformanceHandler::getNewObjects().

156 {
157  RPCDetId rpcid(id);
158  std::map<RPCDetId, float>::iterator iter = _bxmap.find(rpcid);
159  return iter->second;
160 }
std::map< RPCDetId, float > _bxmap
Definition: RPCDBSimSetUp.h:42
void RPCDBSimSetUp::setGeometry ( const RPCGeometry geom)
inline

sets geometry

Definition at line 35 of file RPCDBSimSetUp.h.

References relativeConstraints::geom, and theGeometry.

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

Member Data Documentation

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

Definition at line 42 of file RPCDBSimSetUp.h.

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

Definition at line 43 of file RPCDBSimSetUp.h.

Referenced by RPCDBPerformanceHandler::getNewObjects().

std::ifstream* RPCDBSimSetUp::_infile1

Definition at line 45 of file RPCDBSimSetUp.h.

std::ifstream* RPCDBSimSetUp::_infile2

Definition at line 46 of file RPCDBSimSetUp.h.

std::ifstream* RPCDBSimSetUp::_infile3

Definition at line 47 of file RPCDBSimSetUp.h.

std::ifstream* RPCDBSimSetUp::_infile4

Definition at line 48 of file RPCDBSimSetUp.h.

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

Definition at line 41 of file RPCDBSimSetUp.h.

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

Definition at line 40 of file RPCDBSimSetUp.h.

Referenced by RPCDBPerformanceHandler::getNewObjects().

const RPCGeometry* RPCDBSimSetUp::theGeometry

Definition at line 38 of file RPCDBSimSetUp.h.

Referenced by getGeometry(), and setGeometry().