Changeset 2225 for trunk/external-alma/asdm2ASAP/ASDMFiller.cc
- Timestamp:
- 07/14/11 15:02:29 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/external-alma/asdm2ASAP/ASDMFiller.cc
r2220 r2225 7 7 #include <measures/Measures/MDirection.h> 8 8 #include <measures/Measures/MCDirection.h> 9 #include <measures/Measures/MFrequency.h> 10 #include <measures/Measures/MCFrequency.h> 9 11 #include <measures/Measures/MeasFrame.h> 10 12 #include <measures/Measures/MeasConvert.h> … … 51 53 antennaName_ = reader_->getAntennaName() ; 52 54 53 //logsink ->postLocally( LogMessage("antennaId_ = "+String::toString(antennaId_),LogOrigin(className_,funcName,WHERE)) ) ;54 //logsink ->postLocally( LogMessage("antennaName_ = "+antennaName_,LogOrigin(className_,funcName,WHERE)) ) ;55 //logsink_->postLocally( LogMessage("antennaId_ = "+String::toString(antennaId_),LogOrigin(className_,funcName,WHERE)) ) ; 56 //logsink_->postLocally( LogMessage("antennaName_ = "+antennaName_,LogOrigin(className_,funcName,WHERE)) ) ; 55 57 56 58 return status ; … … 82 84 uInt numConfigDescId = configDescIdList.size() ; 83 85 84 //logsink ->postLocally( LogMessage("configDescIdList = "+String::toString(configDescIdList),LogOrigin(className_,funcName,WHERE)) ) ;86 //logsink_->postLocally( LogMessage("configDescIdList = "+String::toString(configDescIdList),LogOrigin(className_,funcName,WHERE)) ) ; 85 87 86 88 // get field list … … 88 90 uInt numFieldId = fieldIdList.size() ; 89 91 90 //logsink ->postLocally( LogMessage("fieldIdList = "+String::toString(fieldIdList),LogOrigin(className_,funcName,WHERE)) ) ;92 //logsink_->postLocally( LogMessage("fieldIdList = "+String::toString(fieldIdList),LogOrigin(className_,funcName,WHERE)) ) ; 91 93 92 94 // BEAMNO is always 0 since ALMA antenna is single beam … … 187 189 string fieldname = reader_->getFieldName( idata ) ; 188 190 int srctype = reader_->getSrcType( scanno, subscanno ) ; 189 vector<double> srcDirection = reader_->getSourceDirection( idata ) ; 191 //vector<double> srcDirection = reader_->getSourceDirection( idata ) ; 192 vector<double> srcDirection ; 193 string srcDirRef ; 194 reader_->getSourceDirection( idata, srcDirection, srcDirRef ) ; 190 195 vector<double> srcProperMotion = reader_->getSourceProperMotion( idata ) ; 191 196 double sysVel = reader_->getSysVel( idata ) ; … … 343 348 hdr.poltype ) ; 344 349 350 if ( hdr.freqref != "LSRK" ) { 351 // String freqref ; 352 // if (hdr.freqref == "TOPOCENT") { 353 // freqref = "TOPO"; 354 // } else if (hdr.freqref == "GEOCENTR") { 355 // freqref = "GEO"; 356 // } else if (hdr.freqref == "BARYCENT") { 357 // freqref = "BARY"; 358 // } else if (hdr.freqref == "GALACTOC") { 359 // freqref = "GALACTO"; 360 // } else if (hdr.freqref == "LOCALGRP") { 361 // freqref = "LGROUP"; 362 // } else if (hdr.freqref == "CMBDIPOL") { 363 // freqref = "CMB"; 364 // } else if (hdr.freqref == "SOURCE") { 365 // freqref = "REST"; 366 // } 367 vector<double> sdir ; 368 string ref ; 369 reader_->getSourceDirection( sdir, ref ) ; 370 Vector<casa::Double> sourceDir( sdir ) ; 371 hdr.reffreq = toLSRK( hdr.reffreq, hdr.freqref, hdr.utc, hdr.antennaposition, sdir, String(ref) ) ; 372 hdr.freqref = "LSRK" ; 373 } 374 345 375 setHeader( hdr ) ; 346 376 } … … 498 528 azel[0] = az ; 499 529 azel[1] = el ; 500 MEpoch me( Quantity( mjd, "d" ), MEpoch::UTC ) ; 501 Vector<Quantity> qantpos( 3 ) ; 502 qantpos[0] = Quantity( antpos[0], "m" ) ; 503 qantpos[1] = Quantity( antpos[1], "m" ) ; 504 qantpos[2] = Quantity( antpos[2], "m" ) ; 505 MPosition mp( MVPosition( qantpos ), 506 MPosition::ITRF ) ; 507 // mp.print( os_.output() ) ; 508 MeasFrame mf( me, mp ) ; 509 MDirection::Convert toj2000( MDirection::AZELGEO, 510 MDirection::Ref( MDirection::J2000, mf ) ) ; 511 dir = toj2000( azel ).getAngle( "rad" ).getValue() ; 512 //logsink->postLocally( LogMessage("dir = "+String::toString(dir),LogOrigin(className_,funcName,WHERE)) ) ; 530 // MEpoch me( Quantity( mjd, "d" ), MEpoch::UTC ) ; 531 // Vector<Quantity> qantpos( 3 ) ; 532 // qantpos[0] = Quantity( antpos[0], "m" ) ; 533 // qantpos[1] = Quantity( antpos[1], "m" ) ; 534 // qantpos[2] = Quantity( antpos[2], "m" ) ; 535 // MPosition mp( MVPosition( qantpos ), 536 // MPosition::ITRF ) ; 537 // // mp.print( os_.output() ) ; 538 // MeasFrame mf( me, mp ) ; 539 // MDirection::Convert toj2000( MDirection::AZELGEO, 540 // MDirection::Ref( MDirection::J2000, mf ) ) ; 541 // dir = toj2000( azel ).getAngle( "rad" ).getValue() ; 542 dir = toJ2000( azel, "AZELGEO", mjd, antpos ) ; 543 //logsink_->postLocally( LogMessage("dir = "+String::toString(dir),LogOrigin(className_,funcName,WHERE)) ) ; 544 } 545 546 Vector<casa::Double> ASDMFiller::toJ2000( Vector<casa::Double> dir, 547 String dirref, 548 casa::Double mjd, 549 Vector<casa::Double> antpos ) 550 { 551 Vector<casa::Double> newd( dir ) ; 552 if ( dirref != "J2000" ) { 553 MEpoch me( Quantity( mjd, "d" ), MEpoch::UTC ) ; 554 Vector<Quantity> qantpos( 3 ) ; 555 qantpos[0] = Quantity( antpos[0], "m" ) ; 556 qantpos[1] = Quantity( antpos[1], "m" ) ; 557 qantpos[2] = Quantity( antpos[2], "m" ) ; 558 MPosition mp( MVPosition( qantpos ), 559 MPosition::ITRF ) ; 560 // mp.print( os_.output() ) ; 561 MeasFrame mf( me, mp ) ; 562 MDirection::Types dirtype ; 563 Bool b = MDirection::getType( dirtype, dirref ) ; 564 if ( b ) { 565 MDirection::Convert toj2000( dirtype, 566 MDirection::Ref( MDirection::J2000, mf ) ) ; 567 newd = toj2000( dir ).getAngle( "rad" ).getValue() ; 568 } 569 } 570 return newd ; 513 571 } 514 572 … … 525 583 return ftype ; 526 584 } 585 586 casa::Double ASDMFiller::toLSRK( casa::Double freq, 587 String freqref, 588 casa::Double utc, 589 Vector<casa::Double> antpos, 590 Vector<casa::Double> dir, 591 String dirref ) 592 { 593 String funcName = "toLSRK" ; 594 595 //logsink_->postLocally( LogMessage("freqref = "+freqref,LogOrigin(className_,funcName,WHERE)) ) ; 596 casa::Double newf = freq ; 597 if ( freqref != "LSRK" ) { 598 MEpoch me( Quantum<casa::Double>( utc, Unit("d") ), MEpoch::UTC ) ; 599 Vector< Quantum<casa::Double> > antposQ( 3 ) ; 600 for ( int i = 0 ; i < 3 ; i++ ) 601 antposQ[i] = Quantum<casa::Double>( antpos[i], Unit("m") ) ; 602 MPosition mp( antposQ, MPosition::ITRF ) ; 603 MDirection::Types dirtype ; 604 Bool b = MDirection::getType( dirtype, dirref ) ; 605 if ( !b ) 606 dirtype = MDirection::J2000 ; 607 MDirection md( Quantum<casa::Double>( dir[0], Unit("rad") ), 608 Quantum<casa::Double>( dir[1], Unit("rad") ), 609 dirtype ) ; 610 MeasFrame mf( me, mp, md ) ; 611 MFrequency::Types freqtype ; 612 b = MFrequency::getType( freqtype, freqref ) ; 613 if ( !b ) 614 freqtype = MFrequency::TOPO ; 615 MFrequency::Convert tolsr( freqtype, 616 MFrequency::Ref( MFrequency::LSRK, mf ) ) ; 617 newf = tolsr( Quantum<casa::Double>( freq, Unit("Hz") ) ).get( "Hz" ).getValue() ; 618 //logsink_->postLocally( LogMessage("freq = "+String::toString(freq)+", newf = "+String::toString(newf),LogOrigin(className_,funcName,WHERE)) ) ; 619 } 620 return newf ; 621 }
Note: See TracChangeset
for help on using the changeset viewer.