00001 #include "CondFormats/SiPixelObjects/interface/SiPixelCPEGenericErrorParm.h" 00002 #include "FWCore/ParameterSet/interface/FileInPath.h" 00003 #include <fstream> 00004 00005 void SiPixelCPEGenericErrorParm::fillCPEGenericErrorParm(double version, std::string file) 00006 { 00007 //--- Open the file 00008 std::ifstream in(file.c_str(), std::ios::in); 00009 00010 //--- Currently do not need to store part of detector, but is in input file 00011 int part; 00012 set_version(version); 00013 00014 DbEntry Entry; 00015 in >> part >> Entry.bias >> Entry.pix_height >> Entry.ave_Qclus >> Entry.sigma >> Entry.rms; 00016 00017 while(!in.eof()) { 00018 errors_.push_back( Entry ); 00019 00020 in >> part >> Entry.bias >> Entry.pix_height 00021 >> Entry.ave_Qclus >> Entry.sigma >> Entry.rms; 00022 } 00023 //--- Finished parsing the file, we're done. 00024 in.close(); 00025 00026 //--- Specify the current binning sizes to use 00027 DbEntryBinSize ErrorsBinSize; 00028 //--- Part = 1 By 00029 ErrorsBinSize.partBin_size = 0; 00030 ErrorsBinSize.sizeBin_size = 40; 00031 ErrorsBinSize.alphaBin_size = 10; 00032 ErrorsBinSize.betaBin_size = 1; 00033 errorsBinSize_.push_back(ErrorsBinSize); 00034 //--- Part = 2 Bx 00035 ErrorsBinSize.partBin_size = 240; 00036 ErrorsBinSize.alphaBin_size = 1; 00037 ErrorsBinSize.betaBin_size = 10; 00038 errorsBinSize_.push_back(ErrorsBinSize); 00039 //--- Part = 3 Fy 00040 ErrorsBinSize.partBin_size = 360; 00041 ErrorsBinSize.alphaBin_size = 10; 00042 ErrorsBinSize.betaBin_size = 1; 00043 errorsBinSize_.push_back(ErrorsBinSize); 00044 //--- Part = 4 Fx 00045 ErrorsBinSize.partBin_size = 380; 00046 ErrorsBinSize.alphaBin_size = 1; 00047 ErrorsBinSize.betaBin_size = 10; 00048 errorsBinSize_.push_back(ErrorsBinSize); 00049 } 00050 00051 std::ostream& operator<<(std::ostream& s, const SiPixelCPEGenericErrorParm& genericErrors) 00052 { 00053 for (unsigned int count=0; count < genericErrors.errors_.size(); ++count) { 00054 00055 s.precision(6); 00056 00057 s << genericErrors.errors_[count].bias << " " 00058 << genericErrors.errors_[count].pix_height << " " 00059 << genericErrors.errors_[count].ave_Qclus << " " << std::fixed 00060 << genericErrors.errors_[count].sigma << " " 00061 << genericErrors.errors_[count].rms << std::endl; 00062 00063 s.unsetf ( std::ios_base::fixed ); 00064 } 00065 return s; 00066 }