#include <CalibTracker/SiStripCommon/src/SiStripDetInfoFileReader.cc>
Public Member Functions | |
const std::map< uint32_t, DetInfo > & | getAllData () const |
const std::vector< uint32_t > & | getAllDetIds () const |
const std::pair< unsigned short, double > | getNumberOfApvsAndStripLength (uint32_t detId) const |
const float & | getThickness (uint32_t detId) const |
SiStripDetInfoFileReader & | operator= (const SiStripDetInfoFileReader ©) |
SiStripDetInfoFileReader (const SiStripDetInfoFileReader &) | |
SiStripDetInfoFileReader (std::string filePath) | |
SiStripDetInfoFileReader () | |
~SiStripDetInfoFileReader () | |
Private Attributes | |
std::map< uint32_t, DetInfo > | detData_ |
std::vector< uint32_t > | detIds_ |
std::ifstream | inputFile_ |
Classes | |
struct | DetInfo |
Implementation: <Notes on="" implementation>="">
Definition at line 29 of file SiStripDetInfoFileReader.h.
SiStripDetInfoFileReader::SiStripDetInfoFileReader | ( | ) | [inline, explicit] |
SiStripDetInfoFileReader::SiStripDetInfoFileReader | ( | std::string | filePath | ) | [explicit] |
Definition at line 26 of file SiStripDetInfoFileReader.cc.
References detData_, detIds_, lat::endl(), inputFile_, and it.
00026 { 00027 00028 // if(filePath==std::string("")){ 00029 // filePath = edm::FileInPath(std::string("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat") ).fullPath(); 00030 // } 00031 00032 detData_.clear(); 00033 detIds_.clear(); 00034 00035 inputFile_.open(filePath.c_str()); 00036 00037 if (inputFile_.is_open()){ 00038 00039 for(;;) { 00040 00041 uint32_t detid; 00042 double stripLength; 00043 unsigned short numberOfAPVs; 00044 float thickness; 00045 00046 inputFile_ >> detid >> numberOfAPVs >> stripLength >> thickness; 00047 00048 if (!(inputFile_.eof() || inputFile_.fail())){ 00049 00050 detIds_.push_back(detid); 00051 00052 // inputFile_ >> numberOfAPVs; 00053 // inputFile_ >> stripLength; 00054 00055 // edm::LogInfo("SiStripDetInfoFileReader::SiStripDetInfoFileReader") << detid <<" " <<numberOfAPVs <<" " <<stripLength << " "<< thickness<< endl; 00056 00057 std::map<uint32_t, DetInfo >::const_iterator it = detData_.find(detid); 00058 00059 if(it==detData_.end()){ 00060 detData_[detid]=DetInfo(numberOfAPVs, stripLength,thickness); 00061 } 00062 else{ 00063 00064 edm::LogError("SiStripDetInfoFileReader::SiStripDetInfoFileReader") <<"DetId " << detid << " already found on file. Ignoring new data"<<endl; 00065 00066 detIds_.pop_back(); 00067 continue; 00068 } 00069 } 00070 else if (inputFile_.eof()){ 00071 00072 edm::LogInfo("SiStripDetInfoFileReader::SiStripDetInfoFileReader - END of file reached")<<endl; 00073 break; 00074 00075 } 00076 else if (inputFile_.fail()) { 00077 00078 edm::LogError("SiStripDetInfoFileReader::SiStripDetInfoFileReader - ERROR while reading file")<<endl; 00079 break; 00080 } 00081 } 00082 00083 inputFile_.close(); 00084 00085 } 00086 else { 00087 00088 edm::LogError("SiStripDetInfoFileReader::SiStripDetInfoFileReader - Unable to open file")<<endl; 00089 return; 00090 00091 } 00092 00093 // int i=0; 00094 // for(std::map<uint32_t, std::pair<unsigned short, double> >::iterator it =detData_.begin(); it!=detData_.end(); it++ ) { 00095 // std::cout<< it->first << " " << (it->second).first << " " << (it->second).second<<endl; 00096 // i++; 00097 // } 00098 // std::cout<<i; 00099 00100 00101 }
SiStripDetInfoFileReader::SiStripDetInfoFileReader | ( | const SiStripDetInfoFileReader & | copy | ) | [explicit] |
SiStripDetInfoFileReader::~SiStripDetInfoFileReader | ( | ) |
Definition at line 104 of file SiStripDetInfoFileReader.cc.
00104 { 00105 00106 edm::LogInfo("SiStripDetInfoFileReader::~SiStripDetInfoFileReader"); 00107 }
const std::map<uint32_t, DetInfo >& SiStripDetInfoFileReader::getAllData | ( | ) | const [inline] |
Definition at line 58 of file SiStripDetInfoFileReader.h.
References detData_.
Referenced by SiStripQuality::addNotConnectedConnectionFromCabling(), and SiStripQualityHotStripIdentifier::bookHistos().
00058 {return detData_;}
const std::vector<uint32_t>& SiStripDetInfoFileReader::getAllDetIds | ( | ) | const [inline] |
Definition at line 52 of file SiStripDetInfoFileReader.h.
References detIds_.
Referenced by SiStripQualityStatistics::analyze(), and SiStripQualityDQM::fillGrandSummaryMEs().
00052 {return detIds_;}
const std::pair< unsigned short, double > SiStripDetInfoFileReader::getNumberOfApvsAndStripLength | ( | uint32_t | detId | ) | const |
Definition at line 110 of file SiStripDetInfoFileReader.cc.
References detData_, lat::endl(), and it.
Referenced by SiStripQuality::add(), SiStripBaseCondObjDQM::bookProfileMEs(), SiStripBaseCondObjDQM::bookSummaryProfileMEs(), SiStripQuality::compact(), SiStripQuality::fillBadComponents(), SiStripThresholdDQM::fillMEsForDet(), SiStripQualityDQM::fillMEsForDet(), SiStripPedestalsDQM::fillMEsForDet(), SiStripNoisesDQM::fillMEsForDet(), SiStripApvGainsDQM::fillMEsForDet(), SiStripApvGainsDQM::fillMEsForLayer(), SiStripQualityDQM::fillMEsForLayer(), SiStripThresholdDQM::fillMEsForLayer(), SiStripNoisesDQM::fillMEsForLayer(), SiStripPedestalsDQM::fillMEsForLayer(), SiStripBadModuleByHandBuilder::getNewObject(), SiStripQuality::operator-=(), SiStripQualityStatistics::SetBadComponents(), and SiStripQualityDQM::SetBadComponents().
00110 { 00111 00112 std::map<uint32_t, DetInfo >::const_iterator it = detData_.find(detId); 00113 00114 if(it!=detData_.end()){ 00115 00116 return std::pair<unsigned short, double>(it->second.nApvs,it->second.stripLength); 00117 00118 } 00119 else{ 00120 00121 static std::pair<unsigned short, double> defaultValue(0,0); 00122 edm::LogWarning("SiStripDetInfoFileReader::getNumberOfApvsAndStripLength - Unable to find requested detid. Returning invalid data ")<<endl; 00123 return defaultValue; 00124 00125 } 00126 00127 }
const float & SiStripDetInfoFileReader::getThickness | ( | uint32_t | detId | ) | const |
Definition at line 129 of file SiStripDetInfoFileReader.cc.
References detData_, lat::endl(), and it.
00129 { 00130 00131 std::map<uint32_t, DetInfo >::const_iterator it = detData_.find(detId); 00132 00133 if(it!=detData_.end()){ 00134 00135 return it->second.thickness; 00136 00137 } 00138 else{ 00139 00140 static float defaultValue=0; 00141 edm::LogWarning("SiStripDetInfoFileReader::getThickness - Unable to find requested detid. Returning invalid data ")<<endl; 00142 return defaultValue; 00143 00144 } 00145 00146 }
SiStripDetInfoFileReader & SiStripDetInfoFileReader::operator= | ( | const SiStripDetInfoFileReader & | copy | ) |
std::map<uint32_t, DetInfo> SiStripDetInfoFileReader::detData_ [private] |
Definition at line 67 of file SiStripDetInfoFileReader.h.
Referenced by getAllData(), getNumberOfApvsAndStripLength(), getThickness(), operator=(), and SiStripDetInfoFileReader().
std::vector<uint32_t> SiStripDetInfoFileReader::detIds_ [private] |
Definition at line 70 of file SiStripDetInfoFileReader.h.
Referenced by getAllDetIds(), operator=(), and SiStripDetInfoFileReader().
std::ifstream SiStripDetInfoFileReader::inputFile_ [private] |