Go to the documentation of this file.00001 #include "CondFormats/L1TObjects/interface/L1MuCSCPtLut.h"
00002 #include <FWCore/MessageLogger/interface/MessageLogger.h>
00003 #include <sstream>
00004 #include <iostream>
00005 #include <errno.h>
00006
00007 void L1MuCSCPtLut::readFromDBS( std::string& ptLUT )
00008 {
00009
00010
00011
00012
00013
00014
00015 for(size_t pos=ptLUT.find("\\n"); pos!=std::string::npos; pos=ptLUT.find("\\n",pos)){
00016 ptLUT[pos]=' ';
00017 ptLUT[pos+1]='\n';
00018 }
00019
00020 unsigned long length = 1<<21;
00021
00022 std::stringstream file(ptLUT);
00023 if( file.fail() )
00024 throw cms::Exception("Cannot open the ptLUT")<<"L1MuCSCPtLut cannot open "
00025 <<"ptLUT from DBS (errno="
00026 <<errno<<")"<<std::endl;
00027
00028
00029 unsigned int address=0;
00030 for(address=0; !file.eof() && address<length; address++) {
00031 char buff[1024];
00032 file.getline(buff,1024);
00033 int ptOutput = atoi(buff);
00034
00035
00036
00037
00038
00039
00040 pt_lut[address] = ptOutput;
00041 }
00042
00043 if( address!=length )
00044 throw cms::Exception("Incorrect LUT size")<<"L1MuCSCPtLut read "<<address
00045 <<" words from DBS instead of expected "
00046 <<length <<std::endl;
00047 }