source: branches/newfiller/external-alma/atnf/PKSIO/ASTEFXDataset.cc@ 2305

Last change on this file since 2305 was 1757, checked in by Kana Sugimoto, 14 years ago

New Development: Yes

JIRA Issue: Yes (CAS-2211)

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: ASAP 3.0.0 interface changes

Test Programs:

Put in Release Notes: Yes

Module(s): all the CASA sd tools and tasks are affected.

Description: Merged ATNF-ASAP 3.0.0 developments to CASA (alma) branch.

Note you also need to update casa/code/atnf.


File size: 28.8 KB
Line 
1//#---------------------------------------------------------------------------
2//# ASTEFXDataset.cc: Class for ASTE-FX dataset.
3//#---------------------------------------------------------------------------
4//# Copyright (C) 2000-2006
5//# Associated Universities, Inc. Washington DC, USA.
6//#
7//# This library is free software; you can redistribute it and/or modify it
8//# under the terms of the GNU Library General Public License as published by
9//# the Free Software Foundation; either version 2 of the License, or (at your
10//# option) any later version.
11//#
12//# This library is distributed in the hope that it will be useful, but WITHOUT
13//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
15//# License for more details.
16//#
17//# You should have received a copy of the GNU Library General Public License
18//# along with this library; if not, write to the Free Software Foundation,
19//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
20//#
21//# Correspondence concerning AIPS++ should be addressed as follows:
22//# Internet email: aips2-request@nrao.edu.
23//# Postal address: AIPS++ Project Office
24//# National Radio Astronomy Observatory
25//# 520 Edgemont Road
26//# Charlottesville, VA 22903-2475 USA
27//#
28//# $Id$
29//#---------------------------------------------------------------------------
30//# Original: 2009/02/27, Takeshi Nakazato, NAOJ
31//#---------------------------------------------------------------------------
32
33#include <atnf/PKSIO/ASTEFXDataset.h>
34
35#include <iostream>
36#include <cstring>
37
38using namespace std ;
39
40// constructor
41ASTEFXDataset::ASTEFXDataset( string name )
42 : NRODataset( name )
43{
44 LogIO os( LogOrigin( "ASTEFXDataset", "ASTEFXDataset()", WHERE ) ) ;
45
46 // check endian
47 open() ;
48 fseek( fp_, 144, SEEK_SET ) ;
49 int tmp ;
50 if( fread( &tmp, 1, sizeof(int), fp_ ) != sizeof(int) ) {
51 os << LogIO::SEVERE << "Error while checking endian of the file. " << LogIO::EXCEPTION ;
52 return ;
53 }
54 if ( ( 0 < tmp ) && ( tmp <= ASTE_ARYMAX_FX ) ) {
55 same_ = true ;
56 os << LogIO::NORMAL << "same endian " << LogIO::POST ;
57 }
58 else {
59 same_ = false ;
60 os << LogIO::NORMAL << "different endian " << LogIO::POST ;
61 }
62 fseek( fp_, 0, SEEK_SET ) ;
63
64 // memory allocation
65 initialize() ;
66}
67
68// destructor
69ASTEFXDataset::~ASTEFXDataset()
70{
71}
72
73// data initialization
74void ASTEFXDataset::initialize()
75{
76 RX.resize( ASTE_ARYMAX_FX ) ;
77 HPBW.resize( ASTE_ARYMAX_FX ) ;
78 EFFA.resize( ASTE_ARYMAX_FX ) ;
79 EFFB.resize( ASTE_ARYMAX_FX ) ;
80 EFFL.resize( ASTE_ARYMAX_FX ) ;
81 EFSS.resize( ASTE_ARYMAX_FX ) ;
82 GAIN.resize( ASTE_ARYMAX_FX ) ;
83 HORN.resize( ASTE_ARYMAX_FX ) ;
84 POLTP.resize( ASTE_ARYMAX_FX ) ;
85 POLDR.resize( ASTE_ARYMAX_FX ) ;
86 POLAN.resize( ASTE_ARYMAX_FX ) ;
87 DFRQ.resize( ASTE_ARYMAX_FX ) ;
88 SIDBD.resize( ASTE_ARYMAX_FX ) ;
89 REFN.resize( ASTE_ARYMAX_FX ) ;
90 IPINT.resize( ASTE_ARYMAX_FX ) ;
91 MULTN.resize( ASTE_ARYMAX_FX ) ;
92 MLTSCF.resize( ASTE_ARYMAX_FX ) ;
93 LAGWIND.resize( ASTE_ARYMAX_FX ) ;
94 BEBW.resize( ASTE_ARYMAX_FX ) ;
95 BERES.resize( ASTE_ARYMAX_FX ) ;
96 CHWID.resize( ASTE_ARYMAX_FX ) ;
97 ARRY.resize( ASTE_ARYMAX_FX ) ;
98 NFCAL.resize( ASTE_ARYMAX_FX ) ;
99 F0CAL.resize( ASTE_ARYMAX_FX ) ;
100 FQCAL.resize( ASTE_ARYMAX_FX ) ;
101 CHCAL.resize( ASTE_ARYMAX_FX ) ;
102 CWCAL.resize( ASTE_ARYMAX_FX ) ;
103 DSBFC.resize( ASTE_ARYMAX_FX ) ;
104
105 for ( int i = 0 ; i < ASTE_ARYMAX_FX ; i++ ) {
106 FQCAL[i].resize( 10 ) ;
107 CHCAL[i].resize( 10 ) ;
108 CWCAL[i].resize( 10 ) ;
109 }
110
111 datasize_ += sizeof( char ) * ASTE_ARYMAX_FX * 16 // RX
112 + sizeof( double ) * ASTE_ARYMAX_FX * 6 // HPBW, EFFA, EFFB, EFFL, EFSS GAIN
113 + sizeof( char ) * ASTE_ARYMAX_FX * 4 // HORN
114 + sizeof( char ) * ASTE_ARYMAX_FX * 4 // POLTP
115 + sizeof( double ) * ASTE_ARYMAX_FX * 3 // POLDR, POLAN, DFRQ
116 + sizeof( char ) * ASTE_ARYMAX_FX * 4 // SIDBID
117 + sizeof( int ) * ASTE_ARYMAX_FX * 3 // REFN, IPINT, MULTN
118 + sizeof( double ) * ASTE_ARYMAX_FX // MLTSCF
119 + sizeof( char ) * ASTE_ARYMAX_FX * 8 // LAGWIND
120 + sizeof( double ) * ASTE_ARYMAX_FX * 3 // BEBW, BERES, CHWID
121 + sizeof( int ) * ASTE_ARYMAX_FX * 2 // ARRY, NFCAL
122 + sizeof( double ) * ASTE_ARYMAX_FX // F0CAL
123 + sizeof( double ) * ASTE_ARYMAX_FX * 10 * 3 // FQCAL, CHCAL, CWCAL
124 + sizeof( char ) * 116 // CDMY1
125 + sizeof( double ) * ASTE_ARYMAX_FX ; // DSBFC
126}
127
128// fill data header
129int ASTEFXDataset::fillHeader()
130{
131 LogIO os( LogOrigin( "ASTEFXDataset", "fillHeader()", WHERE ) ) ;
132
133 // open file
134 if ( open() ) {
135 os << LogIO::SEVERE << "Error opening file " << filename_ << "." << LogIO::EXCEPTION ;
136 return -1 ;
137 }
138
139 // fill
140 int status = fillHeader( same_ ) ;
141
142 return status ;
143}
144
145int ASTEFXDataset::fillHeader( int sameEndian )
146{
147 LogIO os( LogOrigin( "ASTEFXDataset", "fillHeader()", WHERE ) ) ;
148
149 string str4( 4, ' ' ) ;
150 string str8( 8, ' ' ) ;
151 string str16( 16, ' ' ) ;
152 string str18( 18, ' ' ) ;
153 string str24( 24, ' ' ) ;
154 string str40( 40, ' ' ) ;
155 string str120( 120, ' ' ) ;
156 char c4[4] ;
157 char c8[8] ;
158 char c16[16] ;
159 char c18[18] ;
160 char c24[24] ;
161 char c40[40] ;
162 char c120[120] ;
163 // make sure file pointer points a beginning of the file
164 fseek( fp_, 0, SEEK_SET ) ;
165
166 // read data header
167 strcpy( c8, str8.c_str() ) ;
168 if ( readHeader( c8, 8 ) == -1 ) {
169 os << LogIO::WARN << "Error while reading data LOFIL." << endl ;
170 return -1 ;
171 }
172 LOFIL = string( c8 ) ;
173 // DEBUG
174 //cout << "LOFIL = " << LOFIL << endl ;
175 //
176 strcpy( c8, str8.c_str() ) ;
177 if ( readHeader( c8, 8 ) == -1 ) {
178 os << LogIO::WARN << "Error while reading data VER." << endl ;
179 return -1 ;
180 }
181 VER = string( c8 ) ;
182 // DEBUG
183 //cout << "VER = " << VER << endl ;
184 //
185 strcpy( c16, str16.c_str() ) ;
186 if ( readHeader( c16, 16 ) == -1 ) {
187 os << LogIO::WARN << "Error while reading data GROUP." << endl ;
188 return -1 ;
189 }
190 GROUP = string( c16 ) ;
191 // DEBUG
192 //cout << "GROUP = " << GROUP << endl ;
193 //
194 strcpy( c16, str16.c_str() ) ;
195 if ( readHeader( c16, 16 ) == -1 ) {
196 os << LogIO::WARN << "Error while reading data PROJ." << endl ;
197 return -1 ;
198 }
199 PROJ = string( c16 ) ;
200 // DEBUG
201 //cout << "PROJ = " << PROJ << endl ;
202 //
203 strcpy( c24, str24.c_str() ) ;
204 if ( readHeader( c24, 24 ) == -1 ) {
205 os << LogIO::WARN << "Error while reading data SCHED." << endl ;
206 return -1 ;
207 }
208 SCHED = string( c24 ) ;
209 // DEBUG
210 //cout << "SCHED = " << SCHED << endl ;
211 //
212 strcpy( c40, str40.c_str() ) ;
213 if ( readHeader( c40, 40 ) == -1 ) {
214 os << LogIO::WARN << "Error while reading data OBSVR." << endl ;
215 return -1 ;
216 }
217 OBSVR = string( c40 ) ;
218 // DEBUG
219 //cout << "OBSVR = " << OBSVR << endl ;
220 //
221 strcpy( c16, str16.c_str() ) ;
222 if ( readHeader( c16, 16 ) == -1 ) {
223 os << LogIO::WARN << "Error while reading data LOSTM." << endl ;
224 return -1 ;
225 }
226 LOSTM = string( c16 ) ;
227 // DEBUG
228 //cout << "LOSTM = " << LOSTM << endl ;
229 //
230 strcpy( c16, str16.c_str() ) ;
231 if ( readHeader( c16, 16 ) == -1 ) {
232 os << LogIO::WARN << "Error while reading data LOETM." << endl ;
233 return -1 ;
234 }
235 LOETM = string( c16 ) ;
236 // DEBUG
237 //cout << "LOETM = " << LOETM << endl ;
238 //
239 if ( readHeader( ARYNM, sameEndian ) == -1 ) {
240 os << LogIO::WARN << "Error while reading data ARYNM." << endl ;
241 return -1 ;
242 }
243 // DEBUG
244 //cout << "ARYNM = " << ARYNM << endl ;
245 //
246 if ( readHeader( NSCAN, sameEndian ) == -1 ) {
247 os << LogIO::WARN << "Error while reading data NSCAN." << endl ;
248 return -1 ;
249 }
250 // DEBUG
251 //cout << "NSCAN = " << NSCAN << endl ;
252 //
253 strcpy( c120, str120.c_str() ) ;
254 if ( readHeader( c120, 120 ) == -1 ) {
255 os << LogIO::WARN << "Error while reading data TITLE." << endl ;
256 return -1 ;
257 }
258 TITLE = string( c120 ) ;
259 // DEBUG
260 //cout << "TITLE = " << TITLE << endl ;
261 //
262 strcpy( c16, str16.c_str() ) ;
263 if ( readHeader( c16, 16 ) == -1 ) {
264 os << LogIO::WARN << "Error while reading data OBJ." << endl ;
265 return -1 ;
266 }
267 OBJ = string( c16 ) ;
268 // DEBUG
269 //cout << "OBJ = " << OBJ << endl ;
270 //
271 strcpy( c8, str8.c_str() ) ;
272 if ( readHeader( c8, 8 ) == -1 ) {
273 os << LogIO::WARN << "Error while reading data EPOCH." << endl ;
274 return -1 ;
275 }
276 EPOCH = string( c8 ) ;
277 // DEBUG
278 //cout << "EPOCH = " << EPOCH << endl ;
279 //
280 if ( readHeader( RA0, sameEndian ) == -1 ) {
281 os << LogIO::WARN << "Error while reading data RA0." << endl ;
282 return -1 ;
283 }
284 // DEBUG
285 //cout << "RA0 = " << RA0 << endl ;
286 //
287 if ( readHeader( DEC0, sameEndian ) == -1 ) {
288 os << LogIO::WARN << "Error while reading data DEC0." << endl ;
289 return -1 ;
290 }
291 // DEBUG
292 //cout << "DEC0 = " << DEC0 << endl ;
293 //
294 if ( readHeader( GLNG0, sameEndian ) == -1 ) {
295 os << LogIO::WARN << "Error while reading data GLNG0." << endl ;
296 return -1 ;
297 }
298 // DEBUG
299 //cout << "GLNG0 = " << GLNG0 << endl ;
300 //
301 if ( readHeader( GLAT0, sameEndian ) == -1 ) {
302 os << LogIO::WARN << "Error while reading data GLAT0." << endl ;
303 return -1 ;
304 }
305 // DEBUG
306 //cout << "GLAT0 = " << GLAT0 << endl ;
307 //
308 if ( readHeader( NCALB, sameEndian ) == -1 ) {
309 os << LogIO::WARN << "Error while reading data NCALB." << endl ;
310 return -1 ;
311 }
312 // DEBUG
313 //cout << "NCALB = " << NCALB << endl ;
314 //
315 if ( readHeader( SCNCD, sameEndian ) == -1 ) {
316 os << LogIO::WARN << "Error while reading data SCNCD." << endl ;
317 return -1 ;
318 }
319 // DEBUG
320 //cout << "SCNCD = " << SCNCD << endl ;
321 //
322 strcpy( c120, str120.c_str() ) ;
323 if ( readHeader( c120, 120 ) == -1 ) {
324 os << LogIO::WARN << "Error while reading data SCMOD." << endl ;
325 return -1 ;
326 }
327 SCMOD = string( c120 ) ;
328 // DEBUG
329 //cout << "SCMOD = " << SCMOD << endl ;
330 //
331 if ( readHeader( URVEL, sameEndian ) == -1 ) {
332 os << LogIO::WARN << "Error while reading data URVEL." << endl ;
333 return -1 ;
334 }
335 // DEBUG
336 //cout << "URVEL = " << URVEL << endl ;
337 //
338 strcpy( c4, str4.c_str() ) ;
339 if ( readHeader( c4, 4 ) == -1 ) {
340 os << LogIO::WARN << "Error while reading data VREF." << endl ;
341 return -1 ;
342 }
343 VREF = string( c4 ) ;
344 // DEBUG
345 //cout << "VREF = " << VREF << endl ;
346 //
347 strcpy( c4, str4.c_str() ) ;
348 if ( readHeader( c4, 4 ) == -1 ) {
349 os << LogIO::WARN << "Error while reading data VDEF." << endl ;
350 return -1 ;
351 }
352 VDEF = string( c4 ) ;
353 // DEBUG
354 //cout << "VDEF = " << VDEF << endl ;
355 //
356 strcpy( c8, str8.c_str() ) ;
357 if ( readHeader( c8, 8 ) == -1 ) {
358 os << LogIO::WARN << "Error while reading data SWMOD." << endl ;
359 return -1 ;
360 }
361 SWMOD = string( c8 ) + "::OTF" ;
362 // DEBUG
363 //cout << "SWMOD = " << SWMOD << endl ;
364 //
365 if ( readHeader( FRQSW, sameEndian ) == -1 ) {
366 os << LogIO::WARN << "Error while reading data FRQSW." << endl ;
367 return -1 ;
368 }
369 // DEBUG
370 //cout << "FRQSW = " << FRQSW << endl ;
371 //
372 if ( readHeader( DBEAM, sameEndian ) == -1 ) {
373 os << LogIO::WARN << "Error while reading data DBEAM." << endl ;
374 return -1 ;
375 }
376 // DEBUG
377 //cout << "DBEAM = " << DBEAM << endl ;
378 //
379 if ( readHeader( MLTOF, sameEndian ) == -1 ) {
380 os << LogIO::WARN << "Error while reading data MLTOF." << endl ;
381 return -1 ;
382 }
383 // DEBUG
384 //cout << "MLTOF = " << MLTOF << endl ;
385 //
386 if ( readHeader( CMTQ, sameEndian ) == -1 ) {
387 os << LogIO::WARN << "Error while reading data CMTQ." << endl ;
388 return -1 ;
389 }
390 // DEBUG
391 //cout << "CMTQ = " << CMTQ << endl ;
392 //
393 if ( readHeader( CMTE, sameEndian ) == -1 ) {
394 os << LogIO::WARN << "Error while reading data CMTE." << endl ;
395 return -1 ;
396 }
397 // DEBUG
398 //cout << "CMTE = " << CMTE << endl ;
399 //
400 if ( readHeader( CMTSOM, sameEndian ) == -1 ) {
401 os << LogIO::WARN << "Error while reading data CMTSOM." << endl ;
402 return -1 ;
403 }
404 // DEBUG
405 //cout << "CMTSOM = " << CMTSOM << endl ;
406 //
407 if ( readHeader( CMTNODE, sameEndian ) == -1 ) {
408 os << LogIO::WARN << "Error while reading data CMTNODE." << endl ;
409 return -1 ;
410 }
411 // DEBUG
412 //cout << "CMTNODE = " << CMTNODE << endl ;
413 //
414 if ( readHeader( CMTI, sameEndian ) == -1 ) {
415 os << LogIO::WARN << "Error while reading data CMTI." << endl ;
416 return -1 ;
417 }
418 // DEBUG
419 //cout << "CMTI = " << CMTI << endl ;
420 //
421 strcpy( c24, str24.c_str() ) ;
422 if ( readHeader( c24, 24 ) == -1 ) {
423 os << LogIO::WARN << "Error while reading data CMTTM." << endl ;
424 return -1 ;
425 }
426 CMTTM = string( c24 ) ;
427 // DEBUG
428 //cout << "CMTTM = " << CMTTM << endl ;
429 //
430 if ( readHeader( SBDX, sameEndian ) == -1 ) {
431 os << LogIO::WARN << "Error while reading data SBDX." << endl ;
432 return -1 ;
433 }
434 // DEBUG
435 //cout << "SBDX = " << SBDX << endl ;
436 //
437 if ( readHeader( SBDY, sameEndian ) == -1 ) {
438 os << LogIO::WARN << "Error while reading data SBDY." << endl ;
439 return -1 ;
440 }
441 // DEBUG
442 //cout << "SBDY = " << SBDY << endl ;
443 //
444 if ( readHeader( SBDZ1, sameEndian ) == -1 ) {
445 os << LogIO::WARN << "Error while reading data SBDZ1." << endl ;
446 return -1 ;
447 }
448 // DEBUG
449 //cout << "SBDZ1 = " << SBDZ1 << endl ;
450 //
451 if ( readHeader( SBDZ2, sameEndian ) == -1 ) {
452 os << LogIO::WARN << "Error while reading data SBDZ2." << endl ;
453 return -1 ;
454 }
455 // DEBUG
456 //cout << "SBDZ2 = " << SBDZ2 << endl ;
457 //
458 if ( readHeader( DAZP, sameEndian ) == -1 ) {
459 os << LogIO::WARN << "Error while reading data DAZP." << endl ;
460 return -1 ;
461 }
462 // DEBUG
463 //cout << "DAZP = " << DAZP << endl ;
464 //
465 if ( readHeader( DELP, sameEndian ) == -1 ) {
466 os << LogIO::WARN << "Error while reading data DELP." << endl ;
467 return -1 ;
468 }
469 // DEBUG
470 //cout << "DELP = " << DELP << endl ;
471 //
472 if ( readHeader( CHBIND, sameEndian ) == -1 ) {
473 os << LogIO::WARN << "Error while reading data CHBIND." << endl ;
474 return -1 ;
475 }
476 // DEBUG
477 //cout << "CHBIND = " << CHBIND << endl ;
478 //
479 if ( readHeader( NUMCH, sameEndian ) == -1 ) {
480 os << LogIO::WARN << "Error while reading data NUMCH." << endl ;
481 return -1 ;
482 }
483 // DEBUG
484 //cout << "NUMCH = " << NUMCH << endl ;
485 //
486 if ( readHeader( CHMIN, sameEndian ) == -1 ) {
487 os << LogIO::WARN << "Error while reading data CHMIN." << endl ;
488 return -1 ;
489 }
490 // DEBUG
491 //cout << "CHMIN = " << CHMIN << endl ;
492 //
493 if ( readHeader( CHMAX, sameEndian ) == -1 ) {
494 os << LogIO::WARN << "Error while reading data CHMAX." << endl ;
495 return -1 ;
496 }
497 // DEBUG
498 //cout << "CHMAX = " << CHMAX << endl ;
499 //
500 if ( readHeader( ALCTM, sameEndian ) == -1 ) {
501 os << LogIO::WARN << "Error while reading data ALCTM." << endl ;
502 return -1 ;
503 }
504 // DEBUG
505 //cout << "ALCTM = " << ALCTM << endl ;
506 //
507 if ( readHeader( IPTIM, sameEndian ) == -1 ) {
508 os << LogIO::WARN << "Error while reading data IPTIM." << endl ;
509 return -1 ;
510 }
511 // DEBUG
512 //cout << "IPTIM = " << IPTIM << endl ;
513 //
514 if ( readHeader( PA, sameEndian ) == -1 ) {
515 os << LogIO::WARN << "Error while reading data PA." << endl ;
516 return -1 ;
517 }
518 // DEBUG
519 //cout << "PA = " << PA << endl ;
520 //
521 for ( int i = 0 ; i < ASTE_ARYMAX_FX ; i++ ) {
522 strcpy( c18, str18.c_str() ) ;
523 if ( readHeader( c18, 16 ) == -1 ) {
524 os << LogIO::WARN << "Error while reading data RX[" << i << "]." << endl ;
525 return -1 ;
526 }
527 c18[16] = '\0' ;
528 RX[i] = string( c18 ) ;
529 // DEBUG
530// if ( i == 0 ) {
531// cout << "RX " ;
532// }
533// else if ( ( i % 5 ) == 0 ) {
534// cout << endl << " " ;
535// }
536// cout << RX[i] << " " ;
537 //
538 }
539 //cout << endl ;
540 for ( int i = 0 ; i < ASTE_ARYMAX_FX ; i++ ) {
541 if ( readHeader( HPBW[i], sameEndian ) == -1 ) {
542 os << LogIO::WARN << "Error while reading data HPBW[" << i << "]." << endl ;
543 return -1 ;
544 }
545// // DEBUG
546// if ( i == 0 ) {
547// cout << "HPBW " ;
548// }
549// else if ( ( i % 5 ) == 0 ) {
550// cout << endl < //cerr << "Error opening file " << filename_ << "." << endl ;< " " ;
551// }
552// cout << HPBW[i] << " " ;
553 //
554 }
555 //cout << endl ;
556 for ( int i = 0 ; i < ASTE_ARYMAX_FX ; i++ ) {
557 if ( readHeader( EFFA[i], sameEndian ) == -1 ) {
558 os << LogIO::WARN << "Error while reading data EFFA[" << i << "]." << endl ;
559 return -1 ;
560 }
561 // DEBUG
562// if ( i == 0 ) {
563// cout << "EFFA " ;
564// }
565// else if ( ( i % 5 ) == 0 ) {
566// cout << endl << " " ;
567// }
568// cout << EFFA[i] << " " ;
569 //
570 }
571 //cout << endl ;
572 for ( int i = 0 ; i < ASTE_ARYMAX_FX ; i++ ) {
573 if ( readHeader( EFFB[i], sameEndian ) == -1 ) {
574 os << LogIO::WARN << "Error while reading data EFFB[" << i << "]." << endl ;
575 return -1 ;
576 }
577 // DEBUG
578// if ( i == 0 ) {
579// cout << "EFFB " ;
580// }
581// else if ( ( i % 5 ) == 0 ) {
582// cout << endl << " " ;
583// }
584// cout << EFFB[i] << " " ;
585 //
586 }
587 //cout << endl ;
588 for ( int i = 0 ; i < ASTE_ARYMAX_FX ; i++ ) {
589 if ( readHeader( EFFL[i], sameEndian ) == -1 ) {
590 os << LogIO::WARN << "Error while reading data EFFL[" << i << "]." << endl ;
591 return -1 ;
592 }
593 // DEBUG
594// if ( i == 0 ) {
595// cout << "EFFL " ;
596// }
597// else if ( ( i % 5 ) == 0 ) {
598// cout << endl << " " ;
599// }
600// cout << EFFL[i] << " " ;
601 //
602 }
603 //cout << endl ;
604 for ( int i = 0 ; i < ASTE_ARYMAX_FX ; i++ ) {
605 if ( readHeader( EFSS[i], sameEndian ) == -1 ) {
606 os << LogIO::WARN << "Error while reading data EFSS[" << i << "]." << endl ;
607 return -1 ;
608 }
609 // DEBUG
610// if ( i == 0 ) {
611// cout << "EFSS " ;
612// }
613// else if ( ( i % 5 ) == 0 ) {
614// cout << endl << " " ;
615// }
616// cout << EFSS[i] << " " ;
617 //
618 }
619 //cout << endl ;
620 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
621 if ( readHeader( GAIN[i], sameEndian ) == -1 ) {
622 os << LogIO::WARN << "Error while reading data GAIN[" << i << "]." << endl ;
623 return -1 ;
624 }
625 // DEBUG
626// if ( i == 0 ) {
627// cout << "GAIN " ;
628// }
629// else if ( ( i % 5 ) == 0 ) {
630// cout << endl << " " ;
631// }
632// cout << GAIN[i] << " " ;
633 //
634 }
635 //cout << endl ;
636 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
637 strcpy( c4, str4.c_str() ) ;
638 if ( readHeader( c4, 4 ) == -1 ) {
639 os << LogIO::WARN << "Error while reading data HORN[" << i << "]." << endl ;
640 return -1 ;
641 }
642 HORN[i] = string( c4 ) ;
643 // DEBUG
644// if ( i == 0 ) {
645// cout << "HORN " ;
646// }
647// else if ( ( i % 5 ) == 0 ) {
648// cout << endl << " " ;
649// }
650// cout << HORN[i] << " " ;
651 //
652 }
653 //cout << endl ;
654 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
655 strcpy( c4, str4.c_str() ) ;
656 if ( readHeader( c4, 4 ) == -1 ) {
657 os << LogIO::WARN << "Error while reading data POLTP[" << i << "]." << endl ;
658 return -1 ;
659 }
660 POLTP[i] = string( c4 ) ;
661 // DEBUG
662// if ( i == 0 ) {
663// cout << "POLTP " ;
664// }
665// else if ( ( i % 5 ) == 0 ) {
666// cout << endl << " " ;
667// }
668// cout << POLTP[i] << " " ;
669 //
670 }
671 //cout << endl ;
672 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
673 if ( readHeader( POLDR[i], sameEndian ) == -1 ) {
674 os << LogIO::WARN << "Error while reading data POLDR[" << i << "]." << endl ;
675 return -1 ;
676 }
677 // DEBUG
678// if ( i == 0 ) {
679// cout << "POLDR " ;
680// }
681// else if ( ( i % 5 ) == 0 ) {
682// cout << endl << " " ;
683// }
684// cout << POLDR[i] << " " ;
685 //
686 }
687 //cout << endl ;
688 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
689 if ( readHeader( POLAN[i], sameEndian ) == -1 ) {
690 os << LogIO::WARN << "Error while reading data POLAN[" << i << "]." << endl ;
691 return -1 ;
692 }
693 // DEBUG
694// if ( i == 0 ) {
695// cout << "POLAN " ;
696// }
697// else if ( ( i % 5 ) == 0 ) {
698// cout << endl << " " ;
699// }
700// cout << POLAN[i] << " " ;
701 //
702 }
703 //cout << endl ;
704 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
705 if ( readHeader( DFRQ[i], sameEndian ) == -1 ) {
706 os << LogIO::WARN << "Error while reading data DFRQ[" << i << "]." << endl ;
707 return -1 ;
708 }
709 // DEBUG
710// if ( i == 0 ) {
711// cout << "DFRQ " ;
712// }
713// else if ( ( i % 5 ) == 0 ) {
714// cout << endl << " " ;
715// }
716// cout << DFRQ[i] << " " ;
717 //
718 }
719 //cout << endl ;
720 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
721 strcpy( c4, str4.c_str() ) ;
722 if ( readHeader( c4, 4 ) == -1 ) {
723 os << LogIO::WARN << "Error while reading data SIDBD[" << i << "]." << endl ;
724 return -1 ;
725 }
726 SIDBD[i] = string( c4 ) ;
727 // DEBUG
728// if ( i == 0 ) {
729// cout << "SIDBD " ;
730// }
731// else if ( ( i % 5 ) == 0 ) {
732// cout << endl << " " ;
733// }
734// cout << SIDBD[i] << " " ;
735 //
736 }
737 //cout << endl ;
738 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
739 if ( readHeader( REFN[i], sameEndian ) == -1 ) {
740 os << LogIO::WARN << "Error while reading data REFN[" << i << "]." << endl ;
741 return -1 ;
742 }
743 // DEBUG
744// if ( i == 0 ) {
745// cout << "REFN " ;
746// }
747// else if ( ( i % 5 ) == 0 ) {
748// cout << endl << " " ;
749// }
750// cout << REFN[i] << " " ;
751 //
752 }
753 //cout << endl ;
754 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
755 if ( readHeader( IPINT[i], sameEndian ) == -1 ) {
756 os << LogIO::WARN << "Error while reading data IPINT[" << i << "]." << endl ;
757 return -1 ;
758 }
759 // DEBUG
760// if ( i == 0 ) {
761// cout << "IPINT " ;
762// }
763// else if ( ( i % 5 ) == 0 ) {
764// cout << endl << " " ;
765// }
766// cout << IPINT[i] << " " ;
767 //
768 }
769 //cout << endl ;
770 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
771 if ( readHeader( MULTN[i], sameEndian ) == -1 ) {
772 os << LogIO::WARN << "Error while reading data MULTN[" << i << "]." << endl ;
773 return -1 ;
774 }
775 // DEBUG
776// if ( i == 0 ) {
777// cout << "MULTN " ;
778// }
779// else if ( ( i % 5 ) == 0 ) {
780// cout << endl << " " ;
781// }
782// cout << MULTN[i] << " " ;
783 //
784 }
785 //cout << endl ;
786 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
787 if ( readHeader( MLTSCF[i], sameEndian ) == -1 ) {
788 os << LogIO::WARN << "Error while reading data MLTSCF[" << i << "]." << endl ;
789 return -1 ;
790 }
791 // DEBUG
792// if ( i == 0 ) {
793// cout << "MLTSCF " ;
794// }
795// else if ( ( i % 5 ) == 0 ) {
796// cout << endl << " " ;
797// }
798// cout << MLTSCF[i] << " " ;
799 //
800 }
801 //cout << endl ;
802 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
803 strcpy( c8, str8.c_str() ) ;
804 if ( readHeader( c8, 8 ) == -1 ) {
805 os << LogIO::WARN << "Error while reading data LAGWIND[" << i << "]." << endl ;
806 return -1 ;
807 }
808 LAGWIND[i] = string( c8 ) ;
809 // DEBUG
810// if ( i == 0 ) {
811// cout << "LAGWIND " ;
812// }
813// else if ( ( i % 5 ) == 0 ) {
814// cout << endl << " " ;
815// }
816// cout << LAGWIND[i] << " " ;
817 //
818 }
819 //cout << endl ;
820 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
821 if ( readHeader( BEBW[i], sameEndian ) == -1 ) {
822 os << LogIO::WARN << "Error while reading data BEBW[" << i << "]." << endl ;
823 return -1 ;
824 }
825 // DEBUG
826// if ( i == 0 ) {
827// cout << "BEBW " ;
828// }
829// else if ( ( i % 5 ) == 0 ) {
830// cout << endl << " " ;
831// }
832// cout << BEBW[i] << " " ;
833 //
834 }
835 //cout << endl ;
836 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
837 if ( readHeader( BERES[i], sameEndian ) == -1 ) {
838 os << LogIO::WARN << "Error while reading data BERES[" << i << "]." << endl ;
839 return -1 ;
840 }
841 // DEBUG
842// if ( i == 0 ) {
843// cout << "BERES " ;
844// }
845// else if ( ( i % 5 ) == 0 ) {
846// cout << endl << " " ;
847// }
848// cout << BERES[i] << " " ;
849 //
850 }
851 //cout << endl ;
852 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
853 if ( readHeader( CHWID[i], sameEndian ) == -1 ) {
854 os << LogIO::WARN << "Error while reading data CHWID[" << i << "]." << endl ;
855 return -1 ;
856 }
857 // DEBUG
858// if ( i == 0 ) {
859// cout << "CHWID " ;
860// }
861// else if ( ( i % 5 ) == 0 ) {
862// cout << endl << " " ;
863// }
864// cout << CHWID[i] << " " ;
865 //
866 }
867 //cout << endl ;
868 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
869 if ( readHeader( ARRY[i], sameEndian ) == -1 ) {
870 os << LogIO::WARN << "Error while reading data ARRY[" << i << "]." << endl ;
871 return -1 ;
872 }
873 // DEBUG
874// if ( i == 0 ) {
875// cout << "ARRY " ;
876// }
877// else if ( ( i % 5 ) == 0 ) {
878// cout << endl << " " ;
879// }
880// cout << ARRY[i] << " " ;
881 //
882 }
883 //cout << endl ;
884 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
885 if ( readHeader( NFCAL[i], sameEndian ) == -1 ) {
886 os << LogIO::WARN << "Error while reading data NFCAL[" << i << "]." << endl ;
887 return -1 ;
888 }
889 // DEBUG
890// if ( i == 0 ) {
891// cout << "NFCAL " ;
892// }
893// else if ( ( i % 5 ) == 0 ) {
894// cout << endl << " " ;
895// }
896// cout << NFCAL[i] << " " ;
897 //
898 }
899 //cout << endl ;
900 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
901 if ( readHeader( F0CAL[i], sameEndian ) == -1 ) {
902 os << LogIO::WARN << "Error while reading data F0CAL[" << i << "]." << endl ;
903 return -1 ;
904 }
905 // DEBUG
906// if ( i == 0 ) {
907// cout << "F0CAL " ;
908// }
909// else if ( ( i % 5 ) == 0 ) {
910// cout << endl << " " ;
911// }
912// cout << F0CAL[i] << " " ;
913 //
914 }
915 //cout << endl ;
916 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
917 for ( int j = 0 ; j < 10 ; j++ ) {
918 if ( readHeader( FQCAL[i][j], sameEndian ) == -1 ) {
919 os << LogIO::WARN << "Error while reading data FQCAL[" << i << "][" << j << "]." << endl ;
920 return -1 ;
921 }
922 // DEBUG
923// if ( j == 0 ) {
924// if ( i < 10 )
925// cout << "FQCAL0" << i << " " ;
926// else
927// cout << "FQCAL" << i << " " ;
928// }
929// else if ( ( j % 5 ) == 0 ) {
930// cout << endl << " " ;
931// }
932// cout << FQCAL[i][j] << " " ;
933 //
934 }
935 //cout << endl ;
936 }
937 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
938 for ( int j = 0 ; j < 10 ; j++ ) {
939 if ( readHeader( CHCAL[i][j], sameEndian ) == -1 ) {
940 os << LogIO::WARN << "Error while reading data CHCAL[" << i << "][" << j << "]." << endl ;
941 return -1 ;
942 }
943 // DEBUG
944// if ( j == 0 ) {
945// if ( i < 10 )
946// cout << "CHCAL0" << i << " " ;
947// else
948// cout << "CHCAL" << i << " " ;
949// }
950// else if ( ( j % 5 ) == 0 ) {
951// cout << endl << " " ;
952// }
953// cout << CHCAL[i][j] << " " ;
954 //
955 }
956 //cout << endl ;
957 }
958 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
959 for ( int j = 0 ; j < 10 ; j++ ) {
960 if ( readHeader( CWCAL[i][j], sameEndian ) == -1 ) {
961 os << LogIO::WARN << "Error while reading data CWCAL[" << i << "][" << j << "]." << endl ;
962 return -1 ;
963 }
964 // DEBUG
965// if ( j == 0 ) {
966// if ( i < 10 )
967// cout << "CWCAL0" << i << " " ;
968// else
969// cout << "CWCAL" << i << " " ;
970// }
971// else if ( ( j % 5 ) == 0 ) {
972// cout << endl << " " ;
973// }
974// cout << CWCAL[i][j] << " " ;
975 //
976 }
977 //cout << endl ;
978 }
979 if ( readHeader( SCNLEN, sameEndian ) == -1 ) {
980 os << LogIO::WARN << "Error while reading data SCNLEN." << endl ;
981 return -1 ;
982 }
983 // DEBUG
984 //cout << "SCNLEN = " << SCNLEN << endl ;
985 //
986 if ( readHeader( SBIND, sameEndian ) == -1 ) {
987 os << LogIO::WARN << "Error while reading data SBIND." << endl ;
988 return -1 ;
989 }
990 // DEBUG
991 //cout << "SBIND = " << SBIND << endl ;
992 //
993 if ( readHeader( IBIT, sameEndian ) == -1 ) {
994 os << LogIO::WARN << "Error while reading data IBIT." << endl ;
995 return -1 ;
996 }
997 // DEBUG
998 //cout << "IBIT = " << IBIT << endl ;
999 //
1000 strcpy( c8, str8.c_str() ) ;
1001 if ( readHeader( c8, 8 ) == -1 ) {
1002 os << LogIO::WARN << "Error while reading data SITE." << endl ;
1003 return -1 ;
1004 }
1005 SITE = string( c8 ) ;
1006 // DEBUG
1007 //cout << "SITE = " << SITE << endl ;
1008 //
1009 strcpy( c120, str120.c_str() ) ;
1010 if ( readHeader( c120, 116 ) == -1 ) {
1011 os << LogIO::WARN << "Error while reading data CDMY1." << endl ;
1012 return -1 ;
1013 }
1014 c120[116] = '\0' ;
1015 CDMY1 = string( c120 ) ;
1016 // DEBUG
1017 //cout << "CDMY1 = " << CDMY1 << endl ;
1018 //
1019 for ( int i = 0 ; i < ASTE_ARYMAX_FX ; i++ ) {
1020 if ( readHeader( DSBFC[i], sameEndian ) == -1 ) {
1021 os << LogIO::WARN << "Error while reading data DSBFC[" << i << "]." << endl ;
1022 return -1 ;
1023 }
1024 // DEBUG
1025// if ( i == 0 ) {
1026// cout << "DSBFC " ;
1027// }
1028// else if ( ( i % 5 ) == 0 ) {
1029// cout << endl << " " ;
1030// }
1031// cout << DSBFC[i] << " " ;
1032 //
1033 }
1034 //cout << endl ;
1035
1036 scanNum_ = NSCAN + 1 ; // includes ZERO scan
1037 rowNum_ = scanNum_ * ARYNM ;
1038 scanLen_ = SCNLEN ;
1039 dataLen_ = scanLen_ - SCAN_HEADER_SIZE ;
1040 chmax_ = (int) ( dataLen_ * 8 / IBIT ) ;
1041 record_->LDATA = new char[dataLen_] ;
1042
1043 show() ;
1044
1045 return 0 ;
1046}
Note: See TracBrowser for help on using the repository browser.