Ignore:
Timestamp:
02/25/04 07:27:46 (21 years ago)
Author:
wittek
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/manalysis/MSourcePosfromStarPos.cc

    r3274 r3296  
    7979    fRuns  = 0;
    8080    fSize  = 100;
    81     fStars = 1;
     81    fStars = 0;
    8282
    8383    fRunNr.Set(fSize);
     
    8888    fdPhiTel.Set(fSize);
    8989
    90     fDecStar.Set(fStars);
    91     fRaStar.Set(fStars);
    92     fxStar.ResizeTo(fStars,fSize);
    93     fyStar.ResizeTo(fStars,fSize);
    94     fdxStar.ResizeTo(fStars,fSize);
    95     fdyStar.ResizeTo(fStars,fSize);
     90    fDecStar.Set(1);
     91    fRaStar.Set(1);
     92    fxStar.ResizeTo(1,fSize);
     93    fyStar.ResizeTo(1,fSize);
     94    fdxStar.ResizeTo(1,fSize);
     95    fdyStar.ResizeTo(1,fSize);
     96
    9697}
    9798
     
    137138               * 360.0 / (24.0 * kRad2Deg);
    138139
     140  fStars += 1;
    139141  fDecStar.Set(fStars);
    140142  fDecStar[fStars-1] = (decStarDeg + decStarMin/60.0 + decStarSec/3600.0)
     
    167169
    168170  // convert into radians
    169   Int_t fStars = fDecStar.GetSize() + 1;
     171  fStars = fDecStar.GetSize() + 1;
    170172  fDecStar.Set(fStars);
    171173  fDecStar[fStars-1] = (decStarDeg + decStarMin/60.0 + decStarSec/3600.0)
     
    223225    //
    224226
     227    *fLog << all << "---------------------------------" << endl;
    225228    while(1)
    226229    {
     
    249252    *fLog << "all data were read" << endl;
    250253    FixSize();
     254
     255    if (fDecSource == 0.0  ||  fRaSource == 0.0  ||  fStars == 0)
     256    {
     257      *fLog << err << "MSourcePosfromStarPos::PreProcess; there are no sky coordinates defined for the source or from stars"
     258            << endl;
     259    }
     260    *fLog << all << "---------------------------------" << endl;
     261
    251262    //-------------------------------------------------------------
    252263
     
    287298                    Double_t &dxSource,    Double_t &dySource)
    288299{
     300  /*
    289301  *fLog << "MSourcePosfromStarPos::SourcefromStar :  printout in degrees" << endl;
    290302  *fLog << "       decStar, raStar = " << decStar[0]*kRad2Deg << ",  "
     
    306318  *fLog << "       xStar, yStar = " << xStar[0] << ",  "
    307319        << yStar[0] << endl;
    308 
     320  */
    309321
    310322  // the units are assumed to be radians for theta, phi, dec and ra
     
    324336  Double_t sinal =    a1 * sin(phiTel) * denom;
    325337
    326   *fLog << "thetaTel, phiTel, cosal, sinal = " << thetaTel << ",  "
    327         << phiTel << ",  " << cosal << ",  " << sinal << endl;
     338  //*fLog << "thetaTel, phiTel, cosal, sinal = " << thetaTel << ",  "
     339  //      << phiTel << ",  " << cosal << ",  " << sinal << endl;
    328340
    329341
    330342  // calculate coordinates of source in system B (see TDAS 00-11, eqs. (2))
    331   Double_t xB0 =  cos(decSource) * cos(raSource);
    332   Double_t yB0 =  cos(decSource) * sin(raSource);
     343  // note that right ascension and hour angle go into opposite directions
     344  Double_t xB0 =  cos(decSource) * cos(-raSource);
     345  Double_t yB0 =  cos(decSource) * sin(-raSource);
    333346  Double_t zB0 = -sin(decSource);
    334347
    335   *fLog << "xB0, yB0, zB0 = " << xB0 << ",  " << yB0 << ",  "
    336         << zB0 << endl;
     348  //*fLog << "xB0, yB0, zB0 = " << xB0 << ",  " << yB0 << ",  "
     349  //      << zB0 << endl;
    337350
    338351  //-----------------------------------------------------
     
    351364    sumwy += weighty;
    352365
    353   *fLog << "weightx, weighty = " << weightx << ",  " << weighty << endl;
     366    //*fLog << "weightx, weighty = " << weightx << ",  " << weighty << endl;
    354367
    355368    // calculate coordinates of star in system B (see TDAS 00-11, eqs. (2))
    356     Double_t xB  =  cos(decStar[i]) * cos(raStar[i]);
    357     Double_t yB  =  cos(decStar[i]) * sin(raStar[i]);
     369    // note that right ascension and hour angle go into opposite directions
     370    Double_t xB  =  cos(decStar[i]) * cos(-raStar[i]);
     371    Double_t yB  =  cos(decStar[i]) * sin(-raStar[i]);
    358372    Double_t zB  = -sin(decStar[i]);
    359373
    360374
    361   *fLog << "xB, yB, zB = " << xB << ",  " << yB << ",  "
    362         << zB << endl;
     375    //*fLog << "xB, yB, zB = " << xB << ",  " << yB << ",  "
     376    //    << zB << endl;
    363377
    364378 
     
    375389    Double_t z = -(xB*xB0 + yB*yB0 + zB*zB0);
    376390
    377   *fLog << "x, y, z = " << x << ",  " << y << ",  "
    378         << z << endl;
     391    //*fLog << "x, y, z = " << x << ",  " << y << ",  "
     392    //    << z << endl;
    379393
    380394
     
    383397    Double_t ytilde = -f/z * (sinal*x + cosal*y);
    384398
    385   *fLog << "xtilde, ytile = " << xtilde << ",  " << ytilde << endl;
     399    //*fLog << "xtilde, ytile = " << xtilde << ",  " << ytilde << endl;
    386400
    387401
     
    399413  dySource = 1.0 / sqrt(sumwy);
    400414   
    401   *fLog << all << "MSourcePosfromStarPos::SourcefromStar; xSource, ySource = "
     415  /*
     416  Int_t run = fRun->GetRunNumber();
     417  *fLog << all << "MSourcePosfromStarPos::SourcefromStar; run, xSource, ySource = "
     418        << run << " : "
    402419        << xSource << " +- " << dxSource << ",   "
    403420        << ySource << " +- " << dySource << endl;
     421   */
    404422}
    405423
     
    411429Bool_t MSourcePosfromStarPos::ReInit(MParList *pList)
    412430{
    413   //if (fDecSource == 0.0  ||  fRaSource == 0.0  ||  fStars == 0)
    414   //{
    415   //  *fLog << err << "MSourcePosfromStarPos::ReInit; sky coordinates of star and source are not defined ... aborting"
    416   //        << endl;
    417     //return kFALSE;
    418   //}
    419431
    420432  Int_t run = fRun->GetRunNumber();
    421 
    422   *fLog << "MSourcePosfromStarPos::ReInit; run = " << run << endl;
     433  *fLog << all << "MSourcePosfromStarPos::ReInit; run = " << run << endl;
    423434
    424435  //-------------------------------------------------------------------
     
    437448      fMcEvt->SetReadyToSave();
    438449
    439       *fLog << "theta, phi = " << thetarad*kRad2Deg << ",  "
     450      *fLog << all << "theta, phi = " << thetarad*kRad2Deg << ",  "
    440451            << phirad*kRad2Deg << endl;
    441452       
     
    443454      // Get source position and put it into MSrcPosCam
    444455
    445       /*
     456     
    446457      if (fStars > 0)
    447458      {
     
    469480
    470481        *fLog << all << "MSourcePosfromStarPos::ReInit; fRunNr, fxSource, fySource = "
    471               << fRunNr[i] << ",  " << fxSource << ",  " << fySource
    472               << endl;
     482              << fRunNr[i] << ",  " << fxSource << " +- " << fdxSource
     483              << ",  " << fySource  << " +- "  << fdySource << endl;
    473484       
    474485        fSrcPos->SetReadyToSave();       
    475486      }
    476       */
     487     
    477488
    478489      return kTRUE;
     
    483494          << run << endl;
    484495
    485     Double_t thetadeg = 90.0;
     496    Double_t thetadeg = 25.0;
    486497    Double_t thetarad = thetadeg / kRad2Deg;
    487498    fMcEvt->SetTelescopeTheta(thetarad);
     
    500511Int_t MSourcePosfromStarPos::Process()
    501512{
    502   Int_t run = fRun->GetRunNumber();
    503 
     513  //Int_t run = fRun->GetRunNumber();
    504514  //*fLog << "MSourcePosfromStarPos::Process; run = " << run << endl;
    505515   
     
    524534{
    525535  *fLog << "MSourcePosfromStarPos::FixSize; fix size of arrays : fRuns = "
    526         << fRuns << endl;
     536        << fRuns << ",  fStars = " << fStars << endl;
    527537
    528538    fSize = fRuns;
     
    535545    fdPhiTel.Set(fSize);
    536546
    537     fStars = fxStar.GetNrows();
    538     fxStar.ResizeTo(fStars, fSize);
    539     fyStar.ResizeTo(fStars, fSize);
    540     fdxStar.ResizeTo(fStars, fSize);
    541     fdyStar.ResizeTo(fStars, fSize);
     547    Int_t fRows = fxStar.GetNrows();
     548    fxStar.ResizeTo(fRows, fSize);
     549    fyStar.ResizeTo(fRows, fSize);
     550    fdxStar.ResizeTo(fRows, fSize);
     551    fdyStar.ResizeTo(fRows, fSize);
    542552}
    543553
     
    593603  *fIn >> ival;
    594604 
    595   *fLog << fRuns <<"th run : " << ival << endl; 
     605  //*fLog << fRuns <<"th run : " << ival << endl; 
    596606
    597607  fRunNr.AddAt(ival, fRuns-1);
    598608
    599   *fLog << "check : fRuns, fRunNr[fRuns-1], fRunNr[fRuns] = " << fRuns << ",  "
    600         << fRunNr[fRuns-1] << ",  " << fRunNr[fRuns] << endl;
     609  //*fLog << "check : fRuns, fRunNr[fRuns-1], fRunNr[fRuns] = " << fRuns << ",  "
     610  //      << fRunNr[fRuns-1] << ",  " << fRunNr[fRuns] << endl;
    601611
    602612  // read mjdS, hmsS, mjdE, hmsE
     
    614624  *fIn >> val;
    615625  fThetaTel.AddAt(val/kRad2Deg, fRuns-1);
    616   *fLog << "val, fThetaTel[fRuns-1] = " << val << ",  "
    617         << fThetaTel[fRuns-1] << endl;
     626  //*fLog << "val, fThetaTel[fRuns-1] = " << val << ",  "
     627  //    << fThetaTel[fRuns-1] << endl;
    618628
    619629
    620630  *fIn >> val;
    621631  fPhiTel.AddAt(val/kRad2Deg, fRuns-1);
    622   *fLog << "val, fPhiTel[fRuns-1] = " << val << ",  "
    623         << fPhiTel[fRuns-1] << endl;
     632  //*fLog << "val, fPhiTel[fRuns-1] = " << val << ",  "
     633  //      << fPhiTel[fRuns-1] << endl;
    624634
    625635
     
    635645    *fIn >> val;
    636646    fxStar(i, fRuns-1) = val / fMm2Deg;;
    637     *fLog << "val, fxStar(i, fRuns-1) = " << val << ",  "
    638           << fxStar(i, fRuns-1) << endl;
     647    //*fLog << "val, fxStar(i, fRuns-1) = " << val << ",  "
     648    //      << fxStar(i, fRuns-1) << endl;
    639649
    640650    *fIn >> val;
    641651    fyStar(i, fRuns-1) = val / fMm2Deg;
    642     *fLog << "val, fyStar(i, fRuns-1) = " << val << ",  "
    643           << fyStar(i, fRuns-1) << endl;
     652    //*fLog << "val, fyStar(i, fRuns-1) = " << val << ",  "
     653    //      << fyStar(i, fRuns-1) << endl;
    644654
    645655
     
    701711
    702712    const Bool_t noexist = !(*fIn);
     713
    703714
    704715    if (noexist)
Note: See TracChangeset for help on using the changeset viewer.