#include <CondTools/RPC/interface/RPCDBSimSetUp.h>
Public Member Functions | |
std::map< int, std::vector < double > > | getClsMap () |
std::vector< float > | getEff (uint32_t id) |
const RPCGeometry * | getGeometry () |
std::vector< float > | getNoise (uint32_t id) |
float | getTime (uint32_t id) |
RPCDBSimSetUp (const edm::ParameterSet &ps) | |
void | setGeometry (const RPCGeometry *geom) |
sets geometry | |
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 RPCGeometry * | theGeometry |
Definition at line 23 of file RPCDBSimSetUp.h.
RPCDBSimSetUp::RPCDBSimSetUp | ( | const edm::ParameterSet & | ps | ) | [explicit] |
Definition at line 37 of file RPCDBSimSetUp.cc.
References _bxmap, _clsMap, _infile1, _infile2, _infile3, _infile4, _mapDetIdEff, _mapDetIdNoise, count, counter(), edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), i, in, row, ss, sum(), and value.
00037 { 00038 00039 _mapDetIdNoise.clear(); 00040 _mapDetIdEff.clear(); 00041 _bxmap.clear(); 00042 00043 //------------------------ Noise Reading ---------------------------- 00044 00045 edm::FileInPath fp1 = ps.getParameter<edm::FileInPath>("noisemapfile"); 00046 std::ifstream _infile1(fp1.fullPath().c_str(), std::ios::in); 00047 00048 std::vector<float> vnoise; 00049 00050 int rpcdetid = 0; 00051 std::string buff; 00052 00053 std::vector< std::string > words; 00054 00055 int count = 0; 00056 while( getline(_infile1, buff, '\n') ){ 00057 00058 words.clear(); 00059 vnoise.clear(); 00060 00061 stringstream ss; 00062 std::string chname; 00063 ss<<buff; 00064 ss>>chname>>rpcdetid; 00065 00066 std::string::size_type pos = 0, prev_pos = 0; 00067 00068 while ( (pos = buff.find(" ",pos)) != string::npos){ 00069 00070 words.push_back(buff.substr(prev_pos, pos - prev_pos)); 00071 prev_pos = ++pos; 00072 } 00073 words.push_back(buff.substr(prev_pos, pos - prev_pos)); 00074 00075 for(unsigned int i = 2; i < words.size(); ++i){ 00076 float value = atof( ((words)[i]).c_str() ); 00077 vnoise.push_back(value); 00078 } 00079 00080 _mapDetIdNoise.insert(make_pair(static_cast<uint32_t>(rpcdetid),vnoise)); 00081 00082 count++; 00083 } 00084 _infile1.close(); 00085 00086 00087 //------------------------ Eff Reading ---------------------------- 00088 00089 edm::FileInPath fp2 = ps.getParameter<edm::FileInPath>("effmapfile"); 00090 _infile2 = new ifstream(fp2.fullPath().c_str(), std::ios::in); 00091 00092 std::vector<float> veff ; 00093 rpcdetid = 0; 00094 00095 while( getline(*_infile2, buff, '\n') ){ 00096 00097 words.clear(); 00098 veff.clear(); 00099 00100 stringstream ss; 00101 std::string chname; 00102 ss<<buff; 00103 ss>>chname>>rpcdetid; 00104 00105 std::string::size_type pos = 0, prev_pos = 0; 00106 while ( (pos = buff.find(" ",pos)) != string::npos){ 00107 00108 words.push_back(buff.substr(prev_pos, pos - prev_pos)); 00109 prev_pos = ++pos; 00110 } 00111 words.push_back(buff.substr(prev_pos, pos - prev_pos)); 00112 00113 for(unsigned int i = 2; i < words.size(); ++i){ 00114 float value = atof(((words)[i]).c_str()); 00115 veff.push_back(value); 00116 } 00117 _mapDetIdEff.insert(make_pair(static_cast<uint32_t>(rpcdetid),veff)); 00118 } 00119 _infile2->close(); 00120 00121 //---------------------- Timing reading ------------------------------------ 00122 00123 edm::FileInPath fp3 = ps.getParameter<edm::FileInPath>("timingMap"); 00124 _infile3 = new ifstream(fp3.fullPath().c_str(), std::ios::in); 00125 00126 uint32_t detUnit = 0; 00127 float timing = 0.; 00128 while(!_infile3->eof()){ 00129 *_infile3>>detUnit>>timing; 00130 _bxmap[RPCDetId(detUnit)] = timing; 00131 } 00132 _infile3->close(); 00133 00134 //---------------------- Cluster size -------------------------------------- 00135 00136 edm::FileInPath fp4 = ps.getParameter<edm::FileInPath>("clsmapfile"); 00137 _infile4 = new ifstream(fp4.fullPath().c_str(), ios::in); 00138 00139 string buffer; 00140 double sum = 0; 00141 unsigned int counter = 1; 00142 unsigned int row = 1; 00143 std::vector<double> sum_clsize; 00144 00145 while ( *_infile4 >> buffer ) { 00146 const char *buffer1 = buffer.c_str(); 00147 double dato = atof(buffer1); 00148 sum += dato; 00149 sum_clsize.push_back(sum); 00150 00151 if(counter == row*20) { 00152 _clsMap[row] = sum_clsize; 00153 row++; 00154 sum = 0; 00155 sum_clsize.clear(); 00156 } 00157 counter++; 00158 } 00159 _infile4->close(); 00160 }
RPCDBSimSetUp::~RPCDBSimSetUp | ( | ) | [virtual] |
std::map< int, std::vector< double > > RPCDBSimSetUp::getClsMap | ( | ) |
Definition at line 181 of file RPCDBSimSetUp.cc.
References _clsMap.
00182 { 00183 return _clsMap; 00184 }
std::vector< float > RPCDBSimSetUp::getEff | ( | uint32_t | id | ) |
Definition at line 168 of file RPCDBSimSetUp.cc.
References _mapDetIdEff, and iter.
Referenced by RPCDBPerformanceHandler::getNewObjects().
00169 { 00170 map<uint32_t,std::vector<float> >::iterator iter = _mapDetIdEff.find(id); 00171 return iter->second; 00172 }
const RPCGeometry* RPCDBSimSetUp::getGeometry | ( | ) | [inline] |
Definition at line 37 of file RPCDBSimSetUp.h.
References theGeometry.
00037 { return theGeometry; }
std::vector< float > RPCDBSimSetUp::getNoise | ( | uint32_t | id | ) |
Definition at line 162 of file RPCDBSimSetUp.cc.
References _mapDetIdNoise, and iter.
00163 { 00164 map<uint32_t,std::vector<float> >::iterator iter = _mapDetIdNoise.find(id); 00165 return (iter->second); 00166 }
float RPCDBSimSetUp::getTime | ( | uint32_t | id | ) |
Definition at line 174 of file RPCDBSimSetUp.cc.
Referenced by RPCDBPerformanceHandler::getNewObjects().
00175 { 00176 RPCDetId rpcid(id); 00177 std::map<RPCDetId, float>::iterator iter = _bxmap.find(rpcid); 00178 return iter->second; 00179 }
void RPCDBSimSetUp::setGeometry | ( | const RPCGeometry * | geom | ) | [inline] |
sets geometry
Definition at line 36 of file RPCDBSimSetUp.h.
References theGeometry.
00036 {theGeometry = geom;}
std::map<RPCDetId, float> RPCDBSimSetUp::_bxmap |
std::map< int, std::vector<double> > RPCDBSimSetUp::_clsMap |
Definition at line 44 of file RPCDBSimSetUp.h.
Referenced by getClsMap(), RPCDBPerformanceHandler::getNewObjects(), and RPCDBSimSetUp().
std::ifstream* RPCDBSimSetUp::_infile1 |
std::ifstream* RPCDBSimSetUp::_infile2 |
std::ifstream* RPCDBSimSetUp::_infile3 |
std::ifstream* RPCDBSimSetUp::_infile4 |
std::map<uint32_t, std::vector<float> > RPCDBSimSetUp::_mapDetIdEff |
std::map<uint32_t, std::vector<float> > RPCDBSimSetUp::_mapDetIdNoise |
Definition at line 41 of file RPCDBSimSetUp.h.
Referenced by RPCDBPerformanceHandler::getNewObjects(), getNoise(), and RPCDBSimSetUp().