source: branches/hpc33/external-alma/atnf/PKSIO/NROOTFDataset.cc@ 2438

Last change on this file since 2438 was 1868, checked in by Takeshi Nakazato, 14 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): atnf

Description: Describe your changes here...

Sync with code/atnf/implement/PKSIO


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