Changeset 3517


Ignore:
Timestamp:
03/16/04 08:31:12 (21 years ago)
Author:
wittek
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/manalysis
Files:
2 edited

Legend:

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

    r3488 r3517  
    9898    fDecSource = 0.0;
    9999    fRaSource  = 0.0;
     100
     101    fxSourceold  =  25.0;
     102    fySourceold  = -40.0;
     103    fThetaradold =  25.0/kRad2Deg;
     104    fPhiradold   = 180.0/kRad2Deg;
    100105}
    101106
     
    130135{
    131136  *fLog << "MSourcePosfromStarPos::SetSourceAndStarPosition :" << endl;
    132   *fLog << "       Source : "  << nameSource << "   " << decSourceDeg << ":"
     137  *fLog << "       Source (dec) : "  << nameSource << "   " << decSourceDeg << ":"
    133138        << decSourceMin << ":" << decSourceSec << endl;
    134   *fLog << "       Star   : "  << nameStar   << "   " << decStarDeg << ":"
     139  *fLog << "       Source (ra)  : "  << nameSource  << "   " << raSourceHour << ":"
     140        << raSourceMin  << ":" << raSourceSec << endl;
     141
     142  *fLog << "       Star  (dec) : "  << nameStar   << "   " << decStarDeg << ":"
    135143        << decStarMin << ":"   << decStarSec << endl;
     144  *fLog << "       Star  (ra)  : "  << nameStar   << "   " << raStarHour << ":"
     145        << raStarMin << ":"    << raStarSec  << endl;
    136146
    137147  // convert into radians
     
    143153  fStars += 1;
    144154  fDecStar.Set(fStars);
     155  fRaStar.Set(fStars);
     156  fxStar.ResizeTo(fStars,fSize);
     157  fyStar.ResizeTo(fStars,fSize);
     158  fdxStar.ResizeTo(fStars,fSize);
     159  fdyStar.ResizeTo(fStars,fSize);
     160
    145161  fDecStar[fStars-1] = (decStarDeg + decStarMin/60.0 + decStarSec/3600.0)
    146162                       / kRad2Deg;
     
    148164                       * 360.0 / (24.0 * kRad2Deg);
    149165
    150   *fLog << all << "MSourcePosfromStarPos::SetSourceAndStarPosition; fDecSource, fRaSource, fDecStar, fRaStar were set to : [radians]  "
     166  *fLog << all << "MSourcePosfromStarPos::SetSourceAndStarPosition; fStars = "
     167        << fStars << endl;
     168  *fLog << all << "       fDecSource, fRaSource, fDecStar, fRaStar were set to : [radians]  "
    151169        << fDecSource << ",  " << fRaSource << ",  "
    152170        << fDecStar[fStars-1] << ",  " << fRaStar[fStars-1] << endl;
     
    168186{
    169187  *fLog << "MSourcePosfromStarPos::AddStar :" << endl;
    170   *fLog << "       Star   : "  << nameStar   << "   " << decStarDeg << ":"
     188  *fLog << "       Star (dec)  : "  << nameStar   << "   " << decStarDeg << ":"
    171189        << decStarMin << ":"   << decStarSec << endl;
     190  *fLog << "       Star (ra)   : "  << nameStar   << "   " << raStarHour << ":"
     191        << raStarMin << ":"    << raStarSec  << endl;
    172192
    173193  // convert into radians
    174194  fStars = fDecStar.GetSize() + 1;
    175195  fDecStar.Set(fStars);
     196  fRaStar.Set(fStars);
     197  fxStar.ResizeTo(fStars,fSize);
     198  fyStar.ResizeTo(fStars,fSize);
     199  fdxStar.ResizeTo(fStars,fSize);
     200  fdyStar.ResizeTo(fStars,fSize);
     201
    176202  fDecStar[fStars-1] = (decStarDeg + decStarMin/60.0 + decStarSec/3600.0)
    177203                       / kRad2Deg;
     
    179205                       * 360.0 / (24.0 * kRad2Deg);
    180206
    181   *fLog << all << "MSourcePosfromStarPos::AddStar; fDecStar, fRaStar were set to : [radians]  "
     207  *fLog << all << "MSourcePosfromStarPos::AddStar; fStars = " << fStars
     208        << endl;
     209  *fLog << all << "       fDecStar, fRaStar were set to : [radians]  "
    182210        << fDecStar[fStars-1] << ",  " << fRaStar[fStars-1] << endl;
    183211}
     
    345373  Double_t sinal =    a1 * sin(phiTel) * denom;
    346374
     375  *fLog << "old thetaTel, phiTel, cosal, sinal = " << thetaTel << ",  "
     376        << phiTel << ",  " << cosal << ",  " << sinal << endl;
     377
     378
    347379  fObservatory->RotationAngle(thetaTel, phiTel, sinal, cosal);
    348380
    349   //*fLog << "thetaTel, phiTel, cosal, sinal = " << thetaTel << ",  "
    350   //      << phiTel << ",  " << cosal << ",  " << sinal << endl;
     381  *fLog << "new thetaTel, phiTel, cosal, sinal = " << thetaTel << ",  "
     382        << phiTel << ",  " << cosal << ",  " << sinal << endl;
    351383
    352384
     
    408440    Double_t ytilde = -f/z * (sinal*x + cosal*y);
    409441
    410     //*fLog << "xtilde, ytile = " << xtilde << ",  " << ytilde << endl;
     442    //*fLog << "i, xtilde, ytile = " << i << " : " << xtilde << ",  "
     443    //      << ytilde << endl;
    411444
    412445
     
    414447    // note : in real camera signs are inverted (therefore s = -1.0)
    415448    Double_t s = -1.0;
    416     sumx += s * (s*xStar[i] - xtilde) * weightx;
    417     sumy += s * (s*yStar[i] - ytilde) * weighty;
     449
     450    Double_t xs = xStar[i] - s * xtilde;
     451    Double_t ys = yStar[i] - s * ytilde;
     452
     453    *fLog << "i, xs, ys = " << i << " : " << xs << ",  "
     454          << ys << endl;
     455
     456    sumx += xs * weightx;
     457    sumy += ys * weighty;
    418458  }
    419459  //-----------------------------------------------------
     
    444484  *fLog << all << "MSourcePosfromStarPos::ReInit; run = " << run << endl;
    445485
    446   // define default values for source position and (theta, phi)
    447   Double_t xSource_def =  51.0;
    448   Double_t ySource_def = -59.0;
    449   Double_t theta_def = 25.0;
    450   Double_t phi_def   = 90.0;
    451486
    452487  //-------------------------------------------------------------------
     
    461496      Double_t thetarad = fThetaTel[i];
    462497      Double_t phirad   = fPhiTel[i];
     498
     499      if (fabs(thetarad*kRad2Deg+1.0) < 0.001)
     500        thetarad = fThetaradold;
     501      else
     502        fThetaradold = thetarad;
     503      if (fabs(phirad*kRad2Deg+1.0) < 0.001)
     504        phirad = fPhiradold;
     505      else
     506        fPhiradold = phirad;
     507
    463508      fMcEvt->SetTelescopeTheta(thetarad);
    464509      fMcEvt->SetTelescopePhi(phirad);
     
    496541        fSrcPos->SetXY(fxSource, fySource);
    497542
     543        fxSourceold = fxSource;
     544        fySourceold = fySource;
     545
    498546        *fLog << all << "MSourcePosfromStarPos::ReInit; fRunNr, fxSource, fySource = "
    499547              << fRunNr[i] << ",  " << fxSource << " +- " << fdxSource
     
    505553      {
    506554        // set default values
    507         fxSource = xSource_def;
    508         fySource = ySource_def;
     555        fxSource = fxSourceold;
     556        fySource = fySourceold;
    509557        fSrcPos->SetXY(fxSource, fySource);
    510558        fSrcPos->SetReadyToSave();       
     559
    511560
    512561        *fLog << warn << "MSourcePosfromStarPos::ReInit;  no information on source position for run number = "
     
    523572
    524573    // set default values
    525     fxSource = xSource_def;
    526     fySource = ySource_def;
     574    fxSource = fxSourceold;
     575    fySource = fySourceold;
    527576    fSrcPos->SetXY(fxSource, fySource);
    528577    fSrcPos->SetReadyToSave();       
    529578
    530     Double_t thetadeg = theta_def;
    531     Double_t thetarad = thetadeg / kRad2Deg;
     579    Double_t thetarad = fThetaradold;
    532580    fMcEvt->SetTelescopeTheta(thetarad);
    533581
    534     Double_t phideg = phi_def;
    535     Double_t phirad = phideg / kRad2Deg;
     582    Double_t phirad = fPhiradold;
    536583    fMcEvt->SetTelescopePhi(phirad);
    537584    fMcEvt->SetReadyToSave();
     
    541588    *fLog << warn << "       set xSource, ySource = " << fxSource << ",  "
    542589          << fySource << " mm" << endl;
    543     *fLog << warn << "       set theta, phi = " << thetadeg << ",  "
    544           << phideg << " deg" << endl;
     590    *fLog << warn << "       set theta, phi = " << thetarad*kRad2Deg << ",  "
     591          << phirad*kRad2Deg << " deg" << endl;
    545592
    546593
     
    577624  *fLog << "MSourcePosfromStarPos::FixSize; fix size of arrays : fRuns = "
    578625        << fRuns << ",  fStars = " << fStars << endl;
     626  *fLog << "       first run : " << fRunNr[0] << ",  last run : "
     627        << fRunNr[fRuns-1] << endl;
    579628
    580629    fSize = fRuns;
     
    644693
    645694  *fIn >> ival;
     695
     696
    646697 
    647698  //*fLog << fRuns <<"th run : " << ival << endl; 
     
    655706  // read mjdS, hmsS, mjdE, hmsE
    656707  // these data are present only for ON data (fStars > 0)
     708  /*
    657709  if (fStars > 0)
    658710  {
     
    667719    *fIn >> val;
    668720  }
     721  */
    669722
    670723  *fIn >> val;
     
    691744  {
    692745    *fIn >> val;
    693     fxStar(i, fRuns-1) = val / fMm2Deg;;
     746    //fxStar(i, fRuns-1) = val / fMm2Deg;
     747    fxStar(i, fRuns-1) = val;
    694748    //*fLog << "val, fxStar(i, fRuns-1) = " << val << ",  "
    695749    //      << fxStar(i, fRuns-1) << endl;
    696750
    697751    *fIn >> val;
    698     fyStar(i, fRuns-1) = val / fMm2Deg;
     752    //fyStar(i, fRuns-1) = val / fMm2Deg;
     753    fyStar(i, fRuns-1) = val;
    699754    //*fLog << "val, fyStar(i, fRuns-1) = " << val << ",  "
    700755    //      << fyStar(i, fRuns-1) << endl;
    701756
    702757
    703     *fIn >> val;
     758    //*fIn >> val;
    704759    //*fLog << "y=dxStar = " << val << endl;
    705760
    706     fdxStar(i, fRuns-1) = val / fMm2Deg;
    707     *fIn >> val;
     761    //fdxStar(i, fRuns-1) = val / fMm2Deg;
     762    //fdxStar(i, fRuns-1) = val;
     763    fdxStar(i, fRuns-1) = 1.0;
     764    //*fIn >> val;
    708765    //*fLog << "y=dyStar = " << val << endl;
    709766
    710     fdyStar(i, fRuns-1) = val / fMm2Deg;
     767    //fdyStar(i, fRuns-1) = val / fMm2Deg;
     768    //fdyStar(i, fRuns-1) = val;
     769    fdyStar(i, fRuns-1) = 1.0;
    711770  }
    712771
     
    785844
    786845
     846
     847
     848
  • trunk/MagicSoft/Mars/manalysis/MSourcePosfromStarPos.h

    r3488 r3517  
    7575    TMatrixD fdyStar;
    7676
     77    Double_t fxSourceold;
     78    Double_t fySourceold;
     79    Double_t fThetaradold;
     80    Double_t fPhiradold;
    7781
    7882    Bool_t OpenNextFile();
Note: See TracChangeset for help on using the changeset viewer.