#include <CalibTracker/SiPixelCommon/src/SiPixelDetInfoFileReader.cc>
Public Member Functions | |
const std::vector< uint32_t > & | getAllDetIds () const |
const std::pair< int, int > & | getDetUnitDimensions (uint32_t detId) const |
SiPixelDetInfoFileReader (std::string filePath) | |
~SiPixelDetInfoFileReader () | |
Private Attributes | |
std::map< uint32_t, std::pair < int, int > > | detData_ |
std::vector< uint32_t > | detIds_ |
std::ifstream | inputFile_ |
Description: <one line="" class="" summary>="">
Implementation: <Notes on="" implementation>="">
Definition at line 29 of file SiPixelDetInfoFileReader.h.
SiPixelDetInfoFileReader::SiPixelDetInfoFileReader | ( | std::string | filePath | ) | [explicit] |
Definition at line 17 of file SiPixelDetInfoFileReader.cc.
References cond::rpcobgas::detid.
{ // if(filePath==std::string("")){ // filePath = edm::FileInPath(std::string("CalibTracker/SiPixelCommon/data/SiPixelDetInfo.dat") ).fullPath(); // } detData_.clear(); detIds_.clear(); inputFile_.open(filePath.c_str()); if (inputFile_.is_open()){ for(;;) { uint32_t detid; int ncols; int nrows; inputFile_ >> detid >> ncols >> nrows ; if (!(inputFile_.eof() || inputFile_.fail())){ detIds_.push_back(detid); //inputFile_ >> numberOfAPVs; //inputFile_ >> stripLength; // edm::LogInfo("SiPixelDetInfoFileReader::SiPixelDetInfoFileReader") << detid <<" " <<numberOfAPVs <<" " <<stripLength << " "<< thickness<< endl; std::map<uint32_t, std::pair<int, int> >::const_iterator it = detData_.find(detid); if( it==detData_.end() ){ detData_[detid]=pair<int, int>(ncols,nrows); } else{ edm::LogError("SiPixelDetInfoFileReader::SiPixelDetInfoFileReader") <<"DetId " << detid << " already found on file. Ignoring new data"<<endl; detIds_.pop_back(); continue; } } else if (inputFile_.eof()){ edm::LogInfo("SiPixelDetInfoFileReader::SiPixelDetInfoFileReader - END of file reached")<<endl; break; } else if (inputFile_.fail()) { edm::LogError("SiPixelDetInfoFileReader::SiPixelDetInfoFileReader - ERROR while reading file")<<endl; break; } } inputFile_.close(); } else { edm::LogError("SiPixelDetInfoFileReader::SiPixelDetInfoFileReader - Unable to open file")<<endl; return; } // int i=0; // for(std::map<uint32_t, std::pair<unsigned short, double> >::iterator it =detData_.begin(); it!=detData_.end(); it++ ) { // std::cout<< it->first << " " << (it->second).first << " " << (it->second).second<<endl; // i++; // } // std::cout<<i; }
SiPixelDetInfoFileReader::~SiPixelDetInfoFileReader | ( | ) |
Definition at line 96 of file SiPixelDetInfoFileReader.cc.
{ edm::LogInfo("SiPixelDetInfoFileReader::~SiPixelDetInfoFileReader"); }
const std::vector< uint32_t > & SiPixelDetInfoFileReader::getAllDetIds | ( | ) | const |
Definition at line 103 of file SiPixelDetInfoFileReader.cc.
Referenced by SiPixelFakeLorentzAngleESSource::produce(), SiPixelFakeGainForHLTESSource::produce(), SiPixelFakeGainESSource::produce(), and SiPixelFakeGainOfflineESSource::produce().
{ return detIds_; }
const std::pair< int, int > & SiPixelDetInfoFileReader::getDetUnitDimensions | ( | uint32_t | detId | ) | const |
Definition at line 111 of file SiPixelDetInfoFileReader.cc.
{ std::map<uint32_t, std::pair<int, int> >::const_iterator it = detData_.find(detId); if(it!=detData_.end()){ return (*it).second; } else{ static std::pair< int, int> defaultValue(0,0); edm::LogWarning("SiPixelDetInfoFileReader::getDetUnitDimensions - Unable to find requested detid. Returning invalid data ")<<endl; return defaultValue; } }
std::map<uint32_t, std::pair<int, int> > SiPixelDetInfoFileReader::detData_ [private] |
Definition at line 44 of file SiPixelDetInfoFileReader.h.
std::vector<uint32_t> SiPixelDetInfoFileReader::detIds_ [private] |
Definition at line 45 of file SiPixelDetInfoFileReader.h.
std::ifstream SiPixelDetInfoFileReader::inputFile_ [private] |
Definition at line 41 of file SiPixelDetInfoFileReader.h.