source: branches/hpc34/external-alma/atnf/PKSIO/ASTEFXDataset.cc@ 3037

Last change on this file since 3037 was 2436, checked in by Takeshi Nakazato, 13 years ago

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Defined template function for debug output.


File size: 24.5 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 refFreq_.resize( ASTE_ARYMAX_FX, 0.0 ) ;
128}
129
130// fill data header
131int ASTEFXDataset::fillHeader()
132{
133 LogIO os( LogOrigin( "ASTEFXDataset", "fillHeader()", WHERE ) ) ;
134
135 // open file
136 if ( open() ) {
137 os << LogIO::SEVERE << "Error opening file " << filename_ << "." << LogIO::EXCEPTION ;
138 return -1 ;
139 }
140
141 // fill
142 int status = fillHeader( same_ ) ;
143
144 return status ;
145}
146
147int ASTEFXDataset::fillHeader( int sameEndian )
148{
149 LogIO os( LogOrigin( "ASTEFXDataset", "fillHeader()", WHERE ) ) ;
150
151 string str4( 4, ' ' ) ;
152 string str8( 8, ' ' ) ;
153 string str16( 16, ' ' ) ;
154 string str18( 18, ' ' ) ;
155 string str24( 24, ' ' ) ;
156 string str40( 40, ' ' ) ;
157 string str120( 120, ' ' ) ;
158 char c4[4] ;
159 char c8[8] ;
160 char c16[16] ;
161 char c18[18] ;
162 char c24[24] ;
163 char c40[40] ;
164 char c120[120] ;
165 // make sure file pointer points a beginning of the file
166 fseek( fp_, 0, SEEK_SET ) ;
167
168 // read data header
169 strcpy( c8, str8.c_str() ) ;
170 if ( readHeader( c8, 8 ) == -1 ) {
171 os << LogIO::WARN << "Error while reading data LOFIL." << endl ;
172 return -1 ;
173 }
174 LOFIL = string( c8 ) ;
175 // DEBUG
176 //cout << "LOFIL = " << LOFIL << endl ;
177 //
178 strcpy( c8, str8.c_str() ) ;
179 if ( readHeader( c8, 8 ) == -1 ) {
180 os << LogIO::WARN << "Error while reading data VER." << endl ;
181 return -1 ;
182 }
183 VER = string( c8 ) ;
184 // DEBUG
185 //cout << "VER = " << VER << endl ;
186 //
187 strcpy( c16, str16.c_str() ) ;
188 if ( readHeader( c16, 16 ) == -1 ) {
189 os << LogIO::WARN << "Error while reading data GROUP." << endl ;
190 return -1 ;
191 }
192 GROUP = string( c16 ) ;
193 // DEBUG
194 //cout << "GROUP = " << GROUP << endl ;
195 //
196 strcpy( c16, str16.c_str() ) ;
197 if ( readHeader( c16, 16 ) == -1 ) {
198 os << LogIO::WARN << "Error while reading data PROJ." << endl ;
199 return -1 ;
200 }
201 PROJ = string( c16 ) ;
202 // DEBUG
203 //cout << "PROJ = " << PROJ << endl ;
204 //
205 strcpy( c24, str24.c_str() ) ;
206 if ( readHeader( c24, 24 ) == -1 ) {
207 os << LogIO::WARN << "Error while reading data SCHED." << endl ;
208 return -1 ;
209 }
210 SCHED = string( c24 ) ;
211 // DEBUG
212 //cout << "SCHED = " << SCHED << endl ;
213 //
214 strcpy( c40, str40.c_str() ) ;
215 if ( readHeader( c40, 40 ) == -1 ) {
216 os << LogIO::WARN << "Error while reading data OBSVR." << endl ;
217 return -1 ;
218 }
219 OBSVR = string( c40 ) ;
220 // DEBUG
221 //cout << "OBSVR = " << OBSVR << endl ;
222 //
223 strcpy( c16, str16.c_str() ) ;
224 if ( readHeader( c16, 16 ) == -1 ) {
225 os << LogIO::WARN << "Error while reading data LOSTM." << endl ;
226 return -1 ;
227 }
228 LOSTM = string( c16 ) ;
229 // DEBUG
230 //cout << "LOSTM = " << LOSTM << endl ;
231 //
232 strcpy( c16, str16.c_str() ) ;
233 if ( readHeader( c16, 16 ) == -1 ) {
234 os << LogIO::WARN << "Error while reading data LOETM." << endl ;
235 return -1 ;
236 }
237 LOETM = string( c16 ) ;
238 // DEBUG
239 //cout << "LOETM = " << LOETM << endl ;
240 //
241 if ( readHeader( ARYNM, sameEndian ) == -1 ) {
242 os << LogIO::WARN << "Error while reading data ARYNM." << endl ;
243 return -1 ;
244 }
245 // DEBUG
246 //cout << "ARYNM = " << ARYNM << endl ;
247 //
248 if ( readHeader( NSCAN, sameEndian ) == -1 ) {
249 os << LogIO::WARN << "Error while reading data NSCAN." << endl ;
250 return -1 ;
251 }
252 // DEBUG
253 //cout << "NSCAN = " << NSCAN << endl ;
254 //
255 strcpy( c120, str120.c_str() ) ;
256 if ( readHeader( c120, 120 ) == -1 ) {
257 os << LogIO::WARN << "Error while reading data TITLE." << endl ;
258 return -1 ;
259 }
260 TITLE = string( c120 ) ;
261 // DEBUG
262 //cout << "TITLE = " << TITLE << endl ;
263 //
264 strcpy( c16, str16.c_str() ) ;
265 if ( readHeader( c16, 16 ) == -1 ) {
266 os << LogIO::WARN << "Error while reading data OBJ." << endl ;
267 return -1 ;
268 }
269 OBJ = string( c16 ) ;
270 // DEBUG
271 //cout << "OBJ = " << OBJ << endl ;
272 //
273 strcpy( c8, str8.c_str() ) ;
274 if ( readHeader( c8, 8 ) == -1 ) {
275 os << LogIO::WARN << "Error while reading data EPOCH." << endl ;
276 return -1 ;
277 }
278 EPOCH = string( c8 ) ;
279 // DEBUG
280 //cout << "EPOCH = " << EPOCH << endl ;
281 //
282 if ( readHeader( RA0, sameEndian ) == -1 ) {
283 os << LogIO::WARN << "Error while reading data RA0." << endl ;
284 return -1 ;
285 }
286 // DEBUG
287 //cout << "RA0 = " << RA0 << endl ;
288 //
289 if ( readHeader( DEC0, sameEndian ) == -1 ) {
290 os << LogIO::WARN << "Error while reading data DEC0." << endl ;
291 return -1 ;
292 }
293 // DEBUG
294 //cout << "DEC0 = " << DEC0 << endl ;
295 //
296 if ( readHeader( GLNG0, sameEndian ) == -1 ) {
297 os << LogIO::WARN << "Error while reading data GLNG0." << endl ;
298 return -1 ;
299 }
300 // DEBUG
301 //cout << "GLNG0 = " << GLNG0 << endl ;
302 //
303 if ( readHeader( GLAT0, sameEndian ) == -1 ) {
304 os << LogIO::WARN << "Error while reading data GLAT0." << endl ;
305 return -1 ;
306 }
307 // DEBUG
308 //cout << "GLAT0 = " << GLAT0 << endl ;
309 //
310 if ( readHeader( NCALB, sameEndian ) == -1 ) {
311 os << LogIO::WARN << "Error while reading data NCALB." << endl ;
312 return -1 ;
313 }
314 // DEBUG
315 //cout << "NCALB = " << NCALB << endl ;
316 //
317 if ( readHeader( SCNCD, sameEndian ) == -1 ) {
318 os << LogIO::WARN << "Error while reading data SCNCD." << endl ;
319 return -1 ;
320 }
321 // DEBUG
322 //cout << "SCNCD = " << SCNCD << endl ;
323 //
324 strcpy( c120, str120.c_str() ) ;
325 if ( readHeader( c120, 120 ) == -1 ) {
326 os << LogIO::WARN << "Error while reading data SCMOD." << endl ;
327 return -1 ;
328 }
329 SCMOD = string( c120 ) ;
330 // DEBUG
331 //cout << "SCMOD = " << SCMOD << endl ;
332 //
333 if ( readHeader( URVEL, sameEndian ) == -1 ) {
334 os << LogIO::WARN << "Error while reading data URVEL." << endl ;
335 return -1 ;
336 }
337 // DEBUG
338 //cout << "URVEL = " << URVEL << endl ;
339 //
340 strcpy( c4, str4.c_str() ) ;
341 if ( readHeader( c4, 4 ) == -1 ) {
342 os << LogIO::WARN << "Error while reading data VREF." << endl ;
343 return -1 ;
344 }
345 VREF = string( c4 ) ;
346 // DEBUG
347 //cout << "VREF = " << VREF << endl ;
348 //
349 strcpy( c4, str4.c_str() ) ;
350 if ( readHeader( c4, 4 ) == -1 ) {
351 os << LogIO::WARN << "Error while reading data VDEF." << endl ;
352 return -1 ;
353 }
354 VDEF = string( c4 ) ;
355 // DEBUG
356 //cout << "VDEF = " << VDEF << endl ;
357 //
358 strcpy( c8, str8.c_str() ) ;
359 if ( readHeader( c8, 8 ) == -1 ) {
360 os << LogIO::WARN << "Error while reading data SWMOD." << endl ;
361 return -1 ;
362 }
363 SWMOD = string( c8 ) + "::OTF" ;
364 // DEBUG
365 //cout << "SWMOD = " << SWMOD << endl ;
366 //
367 if ( readHeader( FRQSW, sameEndian ) == -1 ) {
368 os << LogIO::WARN << "Error while reading data FRQSW." << endl ;
369 return -1 ;
370 }
371 // DEBUG
372 //cout << "FRQSW = " << FRQSW << endl ;
373 //
374 if ( readHeader( DBEAM, sameEndian ) == -1 ) {
375 os << LogIO::WARN << "Error while reading data DBEAM." << endl ;
376 return -1 ;
377 }
378 // DEBUG
379 //cout << "DBEAM = " << DBEAM << endl ;
380 //
381 if ( readHeader( MLTOF, sameEndian ) == -1 ) {
382 os << LogIO::WARN << "Error while reading data MLTOF." << endl ;
383 return -1 ;
384 }
385 // DEBUG
386 //cout << "MLTOF = " << MLTOF << endl ;
387 //
388 if ( readHeader( CMTQ, sameEndian ) == -1 ) {
389 os << LogIO::WARN << "Error while reading data CMTQ." << endl ;
390 return -1 ;
391 }
392 // DEBUG
393 //cout << "CMTQ = " << CMTQ << endl ;
394 //
395 if ( readHeader( CMTE, sameEndian ) == -1 ) {
396 os << LogIO::WARN << "Error while reading data CMTE." << endl ;
397 return -1 ;
398 }
399 // DEBUG
400 //cout << "CMTE = " << CMTE << endl ;
401 //
402 if ( readHeader( CMTSOM, sameEndian ) == -1 ) {
403 os << LogIO::WARN << "Error while reading data CMTSOM." << endl ;
404 return -1 ;
405 }
406 // DEBUG
407 //cout << "CMTSOM = " << CMTSOM << endl ;
408 //
409 if ( readHeader( CMTNODE, sameEndian ) == -1 ) {
410 os << LogIO::WARN << "Error while reading data CMTNODE." << endl ;
411 return -1 ;
412 }
413 // DEBUG
414 //cout << "CMTNODE = " << CMTNODE << endl ;
415 //
416 if ( readHeader( CMTI, sameEndian ) == -1 ) {
417 os << LogIO::WARN << "Error while reading data CMTI." << endl ;
418 return -1 ;
419 }
420 // DEBUG
421 //cout << "CMTI = " << CMTI << endl ;
422 //
423 strcpy( c24, str24.c_str() ) ;
424 if ( readHeader( c24, 24 ) == -1 ) {
425 os << LogIO::WARN << "Error while reading data CMTTM." << endl ;
426 return -1 ;
427 }
428 CMTTM = string( c24 ) ;
429 // DEBUG
430 //cout << "CMTTM = " << CMTTM << endl ;
431 //
432 if ( readHeader( SBDX, sameEndian ) == -1 ) {
433 os << LogIO::WARN << "Error while reading data SBDX." << endl ;
434 return -1 ;
435 }
436 // DEBUG
437 //cout << "SBDX = " << SBDX << endl ;
438 //
439 if ( readHeader( SBDY, sameEndian ) == -1 ) {
440 os << LogIO::WARN << "Error while reading data SBDY." << endl ;
441 return -1 ;
442 }
443 // DEBUG
444 //cout << "SBDY = " << SBDY << endl ;
445 //
446 if ( readHeader( SBDZ1, sameEndian ) == -1 ) {
447 os << LogIO::WARN << "Error while reading data SBDZ1." << endl ;
448 return -1 ;
449 }
450 // DEBUG
451 //cout << "SBDZ1 = " << SBDZ1 << endl ;
452 //
453 if ( readHeader( SBDZ2, sameEndian ) == -1 ) {
454 os << LogIO::WARN << "Error while reading data SBDZ2." << endl ;
455 return -1 ;
456 }
457 // DEBUG
458 //cout << "SBDZ2 = " << SBDZ2 << endl ;
459 //
460 if ( readHeader( DAZP, sameEndian ) == -1 ) {
461 os << LogIO::WARN << "Error while reading data DAZP." << endl ;
462 return -1 ;
463 }
464 // DEBUG
465 //cout << "DAZP = " << DAZP << endl ;
466 //
467 if ( readHeader( DELP, sameEndian ) == -1 ) {
468 os << LogIO::WARN << "Error while reading data DELP." << endl ;
469 return -1 ;
470 }
471 // DEBUG
472 //cout << "DELP = " << DELP << endl ;
473 //
474 if ( readHeader( CHBIND, sameEndian ) == -1 ) {
475 os << LogIO::WARN << "Error while reading data CHBIND." << endl ;
476 return -1 ;
477 }
478 // DEBUG
479 //cout << "CHBIND = " << CHBIND << endl ;
480 //
481 if ( readHeader( NUMCH, sameEndian ) == -1 ) {
482 os << LogIO::WARN << "Error while reading data NUMCH." << endl ;
483 return -1 ;
484 }
485 // DEBUG
486 //cout << "NUMCH = " << NUMCH << endl ;
487 //
488 if ( readHeader( CHMIN, sameEndian ) == -1 ) {
489 os << LogIO::WARN << "Error while reading data CHMIN." << endl ;
490 return -1 ;
491 }
492 // DEBUG
493 //cout << "CHMIN = " << CHMIN << endl ;
494 //
495 if ( readHeader( CHMAX, sameEndian ) == -1 ) {
496 os << LogIO::WARN << "Error while reading data CHMAX." << endl ;
497 return -1 ;
498 }
499 // DEBUG
500 //cout << "CHMAX = " << CHMAX << endl ;
501 //
502 if ( readHeader( ALCTM, sameEndian ) == -1 ) {
503 os << LogIO::WARN << "Error while reading data ALCTM." << endl ;
504 return -1 ;
505 }
506 // DEBUG
507 //cout << "ALCTM = " << ALCTM << endl ;
508 //
509 if ( readHeader( IPTIM, sameEndian ) == -1 ) {
510 os << LogIO::WARN << "Error while reading data IPTIM." << endl ;
511 return -1 ;
512 }
513 // DEBUG
514 //cout << "IPTIM = " << IPTIM << endl ;
515 //
516 if ( readHeader( PA, sameEndian ) == -1 ) {
517 os << LogIO::WARN << "Error while reading data PA." << endl ;
518 return -1 ;
519 }
520 // DEBUG
521 //cout << "PA = " << PA << endl ;
522 //
523 for ( int i = 0 ; i < ASTE_ARYMAX_FX ; i++ ) {
524 strcpy( c18, str18.c_str() ) ;
525 if ( readHeader( c18, 16 ) == -1 ) {
526 os << LogIO::WARN << "Error while reading data RX[" << i << "]." << endl ;
527 return -1 ;
528 }
529 c18[16] = '\0' ;
530 RX[i] = string( c18 ) ;
531 }
532 // DEBUG
533// nro_debug_output( "RX", ASTE_ARYMAX_FX, RX ) ;
534 //
535 for ( int i = 0 ; i < ASTE_ARYMAX_FX ; i++ ) {
536 if ( readHeader( HPBW[i], sameEndian ) == -1 ) {
537 os << LogIO::WARN << "Error while reading data HPBW[" << i << "]." << endl ;
538 return -1 ;
539 }
540 }
541 // DEBUG
542// nro_debug_output( "HPBW", ASTE_ARYMAX_FX, HPBW ) ;
543 //
544 for ( int i = 0 ; i < ASTE_ARYMAX_FX ; i++ ) {
545 if ( readHeader( EFFA[i], sameEndian ) == -1 ) {
546 os << LogIO::WARN << "Error while reading data EFFA[" << i << "]." << endl ;
547 return -1 ;
548 }
549 }
550 // DEBUG
551// nro_debug_output( "EFFA", ASTE_ARYMAX_FX, EFFA ) ;
552 //
553 for ( int i = 0 ; i < ASTE_ARYMAX_FX ; i++ ) {
554 if ( readHeader( EFFB[i], sameEndian ) == -1 ) {
555 os << LogIO::WARN << "Error while reading data EFFB[" << i << "]." << endl ;
556 return -1 ;
557 }
558 }
559 // DEBUG
560// nro_debug_output( "EFFB", ASTE_ARYMAX_FX, EFFB ) ;
561 //
562 for ( int i = 0 ; i < ASTE_ARYMAX_FX ; i++ ) {
563 if ( readHeader( EFFL[i], sameEndian ) == -1 ) {
564 os << LogIO::WARN << "Error while reading data EFFL[" << i << "]." << endl ;
565 return -1 ;
566 }
567 }
568 // DEBUG
569// nro_debug_output( "EFFL", ASTE_ARYMAX_FX, EFFL ) ;
570 //
571 for ( int i = 0 ; i < ASTE_ARYMAX_FX ; i++ ) {
572 if ( readHeader( EFSS[i], sameEndian ) == -1 ) {
573 os << LogIO::WARN << "Error while reading data EFSS[" << i << "]." << endl ;
574 return -1 ;
575 }
576 }
577 // DEBUG
578// nro_debug_output( "EFSS", ASTE_ARYMAX_FX, EFSS ) ;
579 //
580 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
581 if ( readHeader( GAIN[i], sameEndian ) == -1 ) {
582 os << LogIO::WARN << "Error while reading data GAIN[" << i << "]." << endl ;
583 return -1 ;
584 }
585 }
586 // DEBUG
587// nro_debug_output( "GAIN", ASTE_ARYMAX_FX, GAIN ) ;
588 //
589 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
590 strcpy( c4, str4.c_str() ) ;
591 if ( readHeader( c4, 4 ) == -1 ) {
592 os << LogIO::WARN << "Error while reading data HORN[" << i << "]." << endl ;
593 return -1 ;
594 }
595 HORN[i] = string( c4 ) ;
596 }
597 // DEBUG
598// nro_debug_output( "HORN", ASTE_ARYMAX_FX, HORN ) ;
599 //
600 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
601 strcpy( c4, str4.c_str() ) ;
602 if ( readHeader( c4, 4 ) == -1 ) {
603 os << LogIO::WARN << "Error while reading data POLTP[" << i << "]." << endl ;
604 return -1 ;
605 }
606 POLTP[i] = string( c4 ) ;
607 }
608 // DEBUG
609// nro_debug_output( "POLTP", ASTE_ARYMAX_FX, POLTP ) ;
610 //
611 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
612 if ( readHeader( POLDR[i], sameEndian ) == -1 ) {
613 os << LogIO::WARN << "Error while reading data POLDR[" << i << "]." << endl ;
614 return -1 ;
615 }
616 }
617 // DEBUG
618// nro_debug_output( "POLDR", ASTE_ARYMAX_FX, POLDR ) ;
619 //
620 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
621 if ( readHeader( POLAN[i], sameEndian ) == -1 ) {
622 os << LogIO::WARN << "Error while reading data POLAN[" << i << "]." << endl ;
623 return -1 ;
624 }
625 }
626 // DEBUG
627// nro_debug_output( "POLAN", ASTE_ARYMAX_FX, POLAN ) ;
628 //
629 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
630 if ( readHeader( DFRQ[i], sameEndian ) == -1 ) {
631 os << LogIO::WARN << "Error while reading data DFRQ[" << i << "]." << endl ;
632 return -1 ;
633 }
634 }
635 // DEBUG
636// nro_debug_output( "DFRQ", ASTE_ARYMAX_FX, DFRQ ) ;
637 //
638 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
639 strcpy( c4, str4.c_str() ) ;
640 if ( readHeader( c4, 4 ) == -1 ) {
641 os << LogIO::WARN << "Error while reading data SIDBD[" << i << "]." << endl ;
642 return -1 ;
643 }
644 SIDBD[i] = string( c4 ) ;
645 }
646 // DEBUG
647// nro_debug_output( "SIDBD", ASTE_ARYMAX_FX, SIDBD ) ;
648 //
649 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
650 if ( readHeader( REFN[i], sameEndian ) == -1 ) {
651 os << LogIO::WARN << "Error while reading data REFN[" << i << "]." << endl ;
652 return -1 ;
653 }
654 }
655 // DEBUG
656// nro_debug_output( "REFN", ASTE_ARYMAX_FX, REFN ) ;
657 //
658 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
659 if ( readHeader( IPINT[i], sameEndian ) == -1 ) {
660 os << LogIO::WARN << "Error while reading data IPINT[" << i << "]." << endl ;
661 return -1 ;
662 }
663 }
664 // DEBUG
665// nro_debug_output( "IPINT", ASTE_ARYMAX_FX, IPINT ) ;
666 //
667 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
668 if ( readHeader( MULTN[i], sameEndian ) == -1 ) {
669 os << LogIO::WARN << "Error while reading data MULTN[" << i << "]." << endl ;
670 return -1 ;
671 }
672 }
673 // DEBUG
674// nro_debug_output( "MULTN", ASTE_ARYMAX_FX, MULTN ) ;
675 //
676 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
677 if ( readHeader( MLTSCF[i], sameEndian ) == -1 ) {
678 os << LogIO::WARN << "Error while reading data MLTSCF[" << i << "]." << endl ;
679 return -1 ;
680 }
681 }
682 // DEBUG
683// nro_debug_output( "MLTSCF", ASTE_ARYMAX_FX, MLTSCF ) ;
684 //
685 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
686 strcpy( c8, str8.c_str() ) ;
687 if ( readHeader( c8, 8 ) == -1 ) {
688 os << LogIO::WARN << "Error while reading data LAGWIND[" << i << "]." << endl ;
689 return -1 ;
690 }
691 LAGWIND[i] = string( c8 ) ;
692 }
693 // DEBUG
694// nro_debug_output( "LAGWIND", ASTE_ARYMAX_FX, LAGWIND ) ;
695 //
696 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
697 if ( readHeader( BEBW[i], sameEndian ) == -1 ) {
698 os << LogIO::WARN << "Error while reading data BEBW[" << i << "]." << endl ;
699 return -1 ;
700 }
701 }
702 // DEBUG
703// nro_debug_output( "BEBW", ASTE_ARYMAX_FX, BEBW ) ;
704 //
705 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
706 if ( readHeader( BERES[i], sameEndian ) == -1 ) {
707 os << LogIO::WARN << "Error while reading data BERES[" << i << "]." << endl ;
708 return -1 ;
709 }
710 }
711 // DEBUG
712// nro_debug_output( "BERES", ASTE_ARYMAX_FX, BERES ) ;
713 //
714 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
715 if ( readHeader( CHWID[i], sameEndian ) == -1 ) {
716 os << LogIO::WARN << "Error while reading data CHWID[" << i << "]." << endl ;
717 return -1 ;
718 }
719 }
720 // DEBUG
721// nro_debug_output( "CHWID", ASTE_ARYMAX_FX, CHWID ) ;
722 //
723 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
724 if ( readHeader( ARRY[i], sameEndian ) == -1 ) {
725 os << LogIO::WARN << "Error while reading data ARRY[" << i << "]." << endl ;
726 return -1 ;
727 }
728 }
729 // DEBUG
730// nro_debug_output( "ARRY", ASTE_ARYMAX_FX, ARRY ) ;
731 //
732 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
733 if ( readHeader( NFCAL[i], sameEndian ) == -1 ) {
734 os << LogIO::WARN << "Error while reading data NFCAL[" << i << "]." << endl ;
735 return -1 ;
736 }
737 }
738 // DEBUG
739// nro_debug_output( "NFCAL", ASTE_ARYMAX_FX, NFCAL ) ;
740 //
741 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
742 if ( readHeader( F0CAL[i], sameEndian ) == -1 ) {
743 os << LogIO::WARN << "Error while reading data F0CAL[" << i << "]." << endl ;
744 return -1 ;
745 }
746 }
747 // DEBUG
748// nro_debug_output( "F0CAL", ASTE_ARYMAX_FX, F0CAL ) ;
749 //
750 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
751 for ( int j = 0 ; j < 10 ; j++ ) {
752 if ( readHeader( FQCAL[i][j], sameEndian ) == -1 ) {
753 os << LogIO::WARN << "Error while reading data FQCAL[" << i << "][" << j << "]." << endl ;
754 return -1 ;
755 }
756 }
757 }
758 // DEBUG
759// nro_debug_output( "FQCAL", ASTE_ARYMAX_FX, 10, FQCAL ) ;
760 //
761 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
762 for ( int j = 0 ; j < 10 ; j++ ) {
763 if ( readHeader( CHCAL[i][j], sameEndian ) == -1 ) {
764 os << LogIO::WARN << "Error while reading data CHCAL[" << i << "][" << j << "]." << endl ;
765 return -1 ;
766 }
767 }
768 }
769 // DEBUG
770// nro_debug_output( "CHCAL", ASTE_ARYMAX_FX, 10, CHCAL ) ;
771 //
772 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {
773 for ( int j = 0 ; j < 10 ; j++ ) {
774 if ( readHeader( CWCAL[i][j], sameEndian ) == -1 ) {
775 os << LogIO::WARN << "Error while reading data CWCAL[" << i << "][" << j << "]." << endl ;
776 return -1 ;
777 }
778 }
779 }
780 // DEBUG
781// nro_debug_output( "CWCAL", ASTE_ARYMAX_FX, 10, CWCAL ) ;
782 //
783 if ( readHeader( SCNLEN, sameEndian ) == -1 ) {
784 os << LogIO::WARN << "Error while reading data SCNLEN." << endl ;
785 return -1 ;
786 }
787 // DEBUG
788 //cout << "SCNLEN = " << SCNLEN << endl ;
789 //
790 if ( readHeader( SBIND, sameEndian ) == -1 ) {
791 os << LogIO::WARN << "Error while reading data SBIND." << endl ;
792 return -1 ;
793 }
794 // DEBUG
795 //cout << "SBIND = " << SBIND << endl ;
796 //
797 if ( readHeader( IBIT, sameEndian ) == -1 ) {
798 os << LogIO::WARN << "Error while reading data IBIT." << endl ;
799 return -1 ;
800 }
801 // DEBUG
802 //cout << "IBIT = " << IBIT << endl ;
803 //
804 strcpy( c8, str8.c_str() ) ;
805 if ( readHeader( c8, 8 ) == -1 ) {
806 os << LogIO::WARN << "Error while reading data SITE." << endl ;
807 return -1 ;
808 }
809 SITE = string( c8 ) ;
810 // DEBUG
811 //cout << "SITE = " << SITE << endl ;
812 //
813 strcpy( c120, str120.c_str() ) ;
814 if ( readHeader( c120, 116 ) == -1 ) {
815 os << LogIO::WARN << "Error while reading data CDMY1." << endl ;
816 return -1 ;
817 }
818 c120[116] = '\0' ;
819 CDMY1 = string( c120 ) ;
820 // DEBUG
821 //cout << "CDMY1 = " << CDMY1 << endl ;
822 //
823 for ( int i = 0 ; i < ASTE_ARYMAX_FX ; i++ ) {
824 if ( readHeader( DSBFC[i], sameEndian ) == -1 ) {
825 os << LogIO::WARN << "Error while reading data DSBFC[" << i << "]." << endl ;
826 return -1 ;
827 }
828 }
829 // DEBUG
830// nro_debug_output( "DSBFC", ASTE_ARYMAX_FX, DSBFC ) ;
831 //
832
833 scanNum_ = NSCAN + 1 ; // includes ZERO scan
834 rowNum_ = scanNum_ * ARYNM ;
835 scanLen_ = SCNLEN ;
836 dataLen_ = scanLen_ - SCAN_HEADER_SIZE ;
837 chmax_ = (int) ( dataLen_ * 8 / IBIT ) ;
838 record_->LDATA = new char[dataLen_] ;
839
840 show() ;
841
842 return 0 ;
843}
Note: See TracBrowser for help on using the repository browser.