00001 // 00002 // This class reads the LTC configuration file 00003 // 00004 // 00005 // 00006 00007 #include "CalibFormats/SiPixelObjects/interface/PixelLTCConfig.h" 00008 #include <cassert> 00009 00010 using namespace pos; 00011 using namespace std; 00012 00013 PixelLTCConfig::PixelLTCConfig(std::string filename): 00014 PixelConfigBase(" "," "," "){ 00015 00016 std::ifstream in(filename.c_str()); 00017 00018 if (!in.good()){ 00019 std::cout << "Could not open:"<<filename<<std::endl; 00020 assert(0); 00021 } 00022 else { 00023 std::cout << "Opened:"<<filename<<std::endl; 00024 } 00025 00026 //ltcConfigPath_ = filename; 00027 string line; 00028 while (!in.eof()) { 00029 getline (in,line); 00030 ltcConfigStream_ << line << endl; 00031 } 00032 00033 } 00034 00035 void PixelLTCConfig::writeASCII(std::string dir) const { 00036 00037 if (dir!="") dir+="/"; 00038 std::string filename=dir+"LTCConfiguration.txt"; 00039 std::ofstream out(filename.c_str()); 00040 00041 //std::ifstream in(ltcConfigPath_.c_str()); 00042 //assert(in.good()); 00043 00044 string configstr = ltcConfigStream_.str(); 00045 00046 out << configstr << endl; 00047 00048 out.close(); 00049 00050 } 00051 00052 00053