41 edm::LogInfo(
"SiStripDetInfoFileReader") <<
"filePath " << filePath << std::endl;
47 inputFile_.open(filePath.c_str());
49 if (inputFile_.is_open()){
55 unsigned short numberOfAPVs;
58 inputFile_ >> detid >> numberOfAPVs >> stripLength >> thickness;
60 if (!(inputFile_.eof() || inputFile_.fail())){
62 detIds_.push_back(detid);
69 std::map<uint32_t, DetInfo >::const_iterator it = detData_.find(detid);
71 if(it==detData_.end()){
72 detData_[detid]=
DetInfo(numberOfAPVs, stripLength,thickness);
76 edm::LogError(
"SiStripDetInfoFileReader::SiStripDetInfoFileReader") <<
"DetId " << detid <<
" already found on file. Ignoring new data"<<endl;
82 else if (inputFile_.eof()){
84 edm::LogInfo(
"SiStripDetInfoFileReader::SiStripDetInfoFileReader - END of file reached")<<endl;
88 else if (inputFile_.fail()) {
90 edm::LogError(
"SiStripDetInfoFileReader::SiStripDetInfoFileReader - ERROR while reading file")<<endl;
100 edm::LogError(
"SiStripDetInfoFileReader::SiStripDetInfoFileReader - Unable to open file")<<endl;
122 std::map<uint32_t, DetInfo >::const_iterator it = detData_.find(detId);
124 if(it!=detData_.end()){
126 return std::pair<unsigned short, double>(it->second.nApvs,it->second.stripLength);
131 std::pair<unsigned short, double> defaultValue(0,0.);
132 edm::LogWarning(
"SiStripDetInfoFileReader::getNumberOfApvsAndStripLength - Unable to find requested detid. Returning invalid data ")<<endl;
141 std::map<uint32_t, DetInfo >::const_iterator it = detData_.find(detId);
143 if(it!=detData_.end()){
145 return it->second.thickness;
150 static const float defaultValue=0;
151 edm::LogWarning(
"SiStripDetInfoFileReader::getThickness - Unable to find requested detid. Returning invalid data ")<<endl;
T getUntrackedParameter(std::string const &, T const &) const
const float & getThickness(uint32_t detId) const
std::map< uint32_t, DetInfo > detData_
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
SiStripDetInfoFileReader & operator=(const SiStripDetInfoFileReader ©)
~SiStripDetInfoFileReader()
std::vector< uint32_t > detIds_
std::string fullPath() const
void reader(std::string filePath)
SiStripDetInfoFileReader()