57 throw std::runtime_error(
"No instrument in the Workspace. Cannot modify detector dot dat file");
61 in.open(inputFilename.c_str());
66 out.open(outputFilename.c_str());
75 out << str <<
" and modified by MANTID algorithm ModifyDetectorDotDatFile \n";
80 std::istringstream header2(str);
89 if (
detectorCount < 1 || numColumns < 5 || numColumns > 1000) {
92 throw Exception::FileError(
"Incompatible file format found when reading line 2 in the input file", inputFilename);
107 const auto &detectorInfo = ws->detectorInfo();
111 while (getline(in, str)) {
113 std::istringstream istr(str);
120 if (str.empty() || str[0] ==
'#') {
127 istr >> detID >> offset >> dump >> code >> dump;
134 V3D pos = detectorInfo.position(detectorInfo.indexOf(detID));
139 std::streampos width = istr.tellg();
141 std::ostringstream oss;
142 oss << std::fixed << std::right;
143 oss.precision(pOffset);
144 oss << std::setw(wDet) << detID << std::setw(wOff) << offset;
145 oss.precision(pOther);
146 oss << std::setw(wRad) <<
l2 << std::setw(wCode) << code << std::setw(wAng) << theta << std::setw(wAng);
149 std::string prefix = oss.str();
150 std::string suffix = str.substr(width, std::string::npos);
151 out << prefix << suffix <<
"\n";
152 }
catch (std::out_of_range &) {