FACT++  1.0
Bool_t MPointing::Load ( const char *  name)

Definition at line 178 of file MPointing.cc.

References fError, Tools::Form(), i, and str.

Referenced by TPointGui::ProcessMessage(), and TPointGui::TPointGui().

179 {
180  /*
181  ! MMT 1987 July 8
182  ! T 36 7.3622 41.448 -0.0481
183  ! IA -37.5465 20.80602
184  ! IE -13.9180 1.25217
185  ! NPAE +7.0751 26.44763
186  ! CA -6.9149 32.05358
187  ! AN +0.5053 1.40956
188  ! AW -2.2016 1.37480
189  ! END
190  */
191 
192  ifstream fin(name);
193  if (!fin)
194  {
195  *fLog << err << "ERROR - Cannot open file '" << name << "'" << endl;
196  return kFALSE;
197  }
198 
199  char c;
200  while (fin && fin.get()!='\n');
201  fin >> c;
202 
203  if (c!='S' && c!='s')
204  {
205  *fLog << err << "Error: This in not a model correcting the star position (" << c << ")" << endl;
206  return kFALSE;
207  }
208 
209  Clear();
210 
211  cout << endl;
212 
213  Double_t val;
214  fin >> val;
215  *fLog << inf;
216  //*fLog << "Number of observed stars: " << val << endl;
217  fin >> val;
218  //*fLog << "Sky RMS: " << val << "\"" << endl;
219  fin >> val;
220  //*fLog << "Refraction Constant A: " << val << "\"" << endl;
221  fin >> val;
222  //*fLog << "Refraction Constant B: " << val << "\"" << endl;
223 
224  *fLog << endl;
225 
226  *fLog << " & = Name Value Sigma " << endl;
227  *fLog << "--------------------------------------------------" << endl;
228 
229  while (fin)
230  {
231  TString str;
232  fin >> str;
233  if (!fin)
234  {
235  *fLog << err << "ERROR - Reading file " << name << endl;
236  return kFALSE;
237  }
238 
239  str = str.Strip(TString::kBoth);
240 
241  if (str=="END")
242  break;
243 
244  TString sout;
245 
246  if (str[0]=='#')
247  continue;
248 
249  if (str[0]=='&')
250  {
251  sout += " & ";
252  str.Remove(0);
253  }
254  else
255  sout += " ";
256 
257  if (str[1]=='=')
258  {
259  sout += "= ";
260  str.Remove(0);
261  }
262  else
263  sout += " ";
264 
265  fin >> val;
266 
267  sout += str;
268  sout += '\t';
269  sout += Form("%11f", val);
270  sout += UTF8::kDeg;
271  sout += " \t";
272  val *= TMath::DegToRad();
273 
274  // Find parameter
275  Int_t n = -1;
276  for (int i=0; i<kNumPar; i++)
277  if (str==fNames[i])
278  {
279  n = i;
280  *fCoeff[i] = val;
281  break;
282  }
283 
284  fin >> val;
285  sout += Form("%9f%s", val, UTF8::kDeg);
286 
287  if (*fCoeff[n]!=0 || val>0)
288  *fLog << sout << endl;
289 
290  if (!fin)
291  {
292  *fLog << err << "ERROR - Reading line " << str << endl;
293  return kFALSE;
294  }
295 
296  if (n<0)
297  {
298  *fLog << warn << "WARNING - Parameter " << str << " unknown." << endl;
299  continue;
300  }
301 
302  // corresponding error
303  fError[n] = val*TMath::DegToRad();
304  }
305  *fLog << endl;
306 
307  fName = name;
308 
309  return kTRUE;
310 }
int i
Definition: db_dim_client.c:21
char str[80]
Definition: test_client.c:7
TArrayD fError
Definition: MPointing.h:187
void Clear(Option_t *o="")
Definition: MPointing.h:191
TString * fNames
Definition: MPointing.h:184
Double_t ** fCoeff
Definition: MPointing.h:183
std::string Form(const char *fmt,...)
Definition: tools.cc:45

+ Here is the call graph for this function:

+ Here is the caller graph for this function: