#include <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 22 of file RPCDBSimSetUp.h.
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.
{ _mapDetIdNoise.clear(); _mapDetIdEff.clear(); _bxmap.clear(); //------------------------ Noise Reading ---------------------------- edm::FileInPath fp1 = ps.getParameter<edm::FileInPath>("noisemapfile"); std::ifstream _infile1(fp1.fullPath().c_str(), std::ios::in); std::vector<float> vnoise; int rpcdetid = 0; std::string buff; std::vector< std::string > words; int count = 0; while( getline(_infile1, buff, '\n') ){ words.clear(); vnoise.clear(); stringstream ss; std::string chname; ss<<buff; ss>>chname>>rpcdetid; std::string::size_type pos = 0, prev_pos = 0; while ( (pos = buff.find(" ",pos)) != string::npos){ words.push_back(buff.substr(prev_pos, pos - prev_pos)); prev_pos = ++pos; } words.push_back(buff.substr(prev_pos, pos - prev_pos)); for(unsigned int i = 2; i < words.size(); ++i){ float value = atof( ((words)[i]).c_str() ); vnoise.push_back(value); } _mapDetIdNoise.insert(make_pair(static_cast<uint32_t>(rpcdetid),vnoise)); count++; } _infile1.close(); //------------------------ Eff Reading ---------------------------- edm::FileInPath fp2 = ps.getParameter<edm::FileInPath>("effmapfile"); _infile2 = new ifstream(fp2.fullPath().c_str(), std::ios::in); std::vector<float> veff ; rpcdetid = 0; while( getline(*_infile2, buff, '\n') ){ words.clear(); veff.clear(); stringstream ss; std::string chname; ss<<buff; ss>>chname>>rpcdetid; std::string::size_type pos = 0, prev_pos = 0; while ( (pos = buff.find(" ",pos)) != string::npos){ words.push_back(buff.substr(prev_pos, pos - prev_pos)); prev_pos = ++pos; } words.push_back(buff.substr(prev_pos, pos - prev_pos)); for(unsigned int i = 2; i < words.size(); ++i){ float value = atof(((words)[i]).c_str()); veff.push_back(value); } _mapDetIdEff.insert(make_pair(static_cast<uint32_t>(rpcdetid),veff)); } _infile2->close(); //---------------------- Timing reading ------------------------------------ edm::FileInPath fp3 = ps.getParameter<edm::FileInPath>("timingMap"); _infile3 = new ifstream(fp3.fullPath().c_str(), std::ios::in); uint32_t detUnit = 0; float timing = 0.; while(!_infile3->eof()){ *_infile3>>detUnit>>timing; _bxmap[RPCDetId(detUnit)] = timing; } _infile3->close(); //---------------------- Cluster size -------------------------------------- edm::FileInPath fp4 = ps.getParameter<edm::FileInPath>("clsmapfile"); _infile4 = new ifstream(fp4.fullPath().c_str(), ios::in); string buffer; double sum = 0; unsigned int counter = 1; unsigned int row = 1; std::vector<double> sum_clsize; while ( *_infile4 >> buffer ) { const char *buffer1 = buffer.c_str(); double dato = atof(buffer1); sum += dato; sum_clsize.push_back(sum); if(counter == row*20) { _clsMap[row] = sum_clsize; row++; sum = 0; sum_clsize.clear(); } counter++; } _infile4->close(); }
RPCDBSimSetUp::~RPCDBSimSetUp | ( | ) | [virtual] |
std::map< int, std::vector< double > > RPCDBSimSetUp::getClsMap | ( | ) |
Definition at line 162 of file RPCDBSimSetUp.cc.
{ return _clsMap; }
std::vector< float > RPCDBSimSetUp::getEff | ( | uint32_t | id | ) |
Definition at line 149 of file RPCDBSimSetUp.cc.
Referenced by RPCDBPerformanceHandler::getNewObjects().
{ map<uint32_t,std::vector<float> >::iterator iter = _mapDetIdEff.find(id); return iter->second; }
const RPCGeometry* RPCDBSimSetUp::getGeometry | ( | ) | [inline] |
std::vector< float > RPCDBSimSetUp::getNoise | ( | uint32_t | id | ) |
Definition at line 143 of file RPCDBSimSetUp.cc.
{ map<uint32_t,std::vector<float> >::iterator iter = _mapDetIdNoise.find(id); return (iter->second); }
float RPCDBSimSetUp::getTime | ( | uint32_t | id | ) |
Definition at line 155 of file RPCDBSimSetUp.cc.
Referenced by RPCDBPerformanceHandler::getNewObjects().
void RPCDBSimSetUp::setGeometry | ( | const RPCGeometry * | geom | ) | [inline] |
sets geometry
Definition at line 35 of file RPCDBSimSetUp.h.
References relativeConstraints::geom, and theGeometry.
{theGeometry = geom;}
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().
Definition at line 38 of file RPCDBSimSetUp.h.
Referenced by getGeometry(), and setGeometry().