Changeset 4433 for trunk


Ignore:
Timestamp:
07/30/04 12:19:16 (20 years ago)
Author:
rwagner
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4430 r4433  
    1919
    2020                                                 -*-*- END OF LINE -*-*-
     21
     22 2004/07/30: Robert Wagner
     23
     24   * mastro/MAstroCamera.[h,cc]
     25     - Added method FillStarList() which fills a TList with objects
     26       of type MStarLocalPos for all stars found from the catalog
     27       matching specified criteria (FOV, magnitude limit, position)
     28
     29   * mtemp/MStarLocalPos.[h,cc]
     30     - Added handling of the minuit error matrix elements to
     31       MStarLocalPos::MSetFitValues
     32     - Added member variables to hold error matrix elements
     33     - Added getters for error matrix elements
     34     - Expected star position is painted by Paint, too.
     35     - Error matrix elements are printed by Print, too.
     36
    2137
    2238 2004/07/28: Javi Lopez
  • trunk/MagicSoft/Mars/mastro/MAstroCamera.cc

    r4058 r4433  
    1111! * provided that the above copyright notice appear in all copies and
    1212! * that both that copyright notice and this permission notice appear
    13 ! * in supporting documentation. It is provided "as is" without express
     13! * in supporting documentation. It is provided "as is" without expressed
    1414! * or implied warranty.
    1515! *
     
    4545// Algorithm:
    4646// ----------
    47 // The caluclation of the position of the reflection in the camera is
     47// The calculation of the position of the reflection in the camera is
    4848// done by:
    4949//   - Rotation of the star-field such that the camera is looking into
     
    9292                      // HOW TO GET RID OF IT? Move MHCamera to mgeom?
    9393
    94 //#include "MStarLocalPos.h"
     94#include "MStarLocalPos.h"
    9595
    9696ClassImp(MAstroCamera);
     
    133133    if (arr.GetClass()!=MGeomMirror::Class())
    134134    {
    135         cout << "ERROR - TClonesArray doesn't contain objects of type MGeomMirror... ignored." << endl;
    136         return;
     135      cout << "ERROR - TClonesArray doesn't contain objects of type MGeomMirror... ignored." << endl;
     136      return;
    137137    }
    138138
     
    148148
    149149}
     150
    150151
    151152// --------------------------------------------------------------------------
     
    301302    if (!fTime || !fObservatory || !fMirrors)
    302303    {
    303         cout << "Missing data..." << endl;
     304      cout << "Missing data..." << endl;
    304305        return;
    305306    }
     
    405406        mean *= 1./num;
    406407        DrawStar(mean(0), mean(1), *radec, hasmean?kBlack:-1, Form("x=%.1fmm y=%.1fmm", mean(0), mean(1)), resize);
    407 
    408408        if (hasnull)
    409409        {
     
    418418}
    419419
    420 // --------------------------------------------------------------------------
    421 //
    422 // Options:
    423 //
    424 //  '*' Draw the mean of the reflections on all mirrors
    425 //  '.' Draw a dot for the reflection on each individual mirror
    426 //  'h' To create a TH2D of the star-light which is displayed
    427 //  'c' Use the underlaying MHCamera as histogram
    428 //  '0' Draw the reflection on a virtual perfect mirror
    429 //
    430 // If the Pad contains an object MHCamera of type MHCamera it is used.
    431 // Otherwise a new object is created.
    432 //
    433 /*void MAstroCamera::FillStarList(TList *list)
    434 {
    435     list->SetOwner();
    436     list->Delete();
    437 
    438     if (!fTime || !fObservatory || !fMirrors || !list)
    439     {
    440         cout << "Missing data..." << endl;
    441         return;
    442     }
    443 
    444     const MAstroSky2Local s2l(*fTime, *fObservatory);
    445     const TRotation trans(AlignCoordinates(rot*fRaDec));
    446 
    447     // Return the correct rotation matrix
    448     const TRotation rot = trans*s2l;
    449 
     420
     421// --------------------------------------------------------------------------
     422//
     423// Fills a TList with all stars found under current presets
     424// (Coordinates, Time, FOV). The list is emptied before the filling is done.
     425// Currently, the mean spot when averaging over all mirrors is used.
     426//
     427void MAstroCamera::FillStarList(TList* list)
     428{
     429    if (!fTime || !fObservatory || !fMirrors) {
     430      cout << "Missing data..." << endl;
     431      return;
     432    }
     433
     434    if (!list) {
     435      cout << "Missing storage list for stars found..." << endl;
     436      return;
     437    }
     438
     439    list->Delete(); // dump old list... (otherwise the same stars would pile up)
     440   
     441    const TRotation rot(GetGrid(kTRUE));
    450442    MVector3 *radec;
    451443    TIter Next(&fList);
    452444
    453     while ((radec=(MVector3*)Next()))
    454     {
    455         const Double_t mag = radec->Magnitude();
    456 
    457         TVector3 mean;
    458         TVector3 star(*radec);
    459         star *= rot;
    460         const TVector3 spot = fMirror0->GetReflection(star, fGeom->GetCameraDist())*1000;
    461 
    462         MStarLocalPos *starpos = new MStarLocalPos;
    463         starpos->SetExpValues(mag,mean(0),mean(1));
    464         list->Add(starpos);
    465     }
    466     // For MAGIC the distance of the mean of the light distribution
    467     // to the Mirror0 reflection of the star (Abberation) can be
    468     // expressed as:  dr = (0.0713 +/- 0.0002) * r = r/14.03
    469     // with r = hypot(mean(0), mean(1))
    470 }
    471 */
     445    while ((radec=(MVector3*)Next())) {
     446      const Double_t mag = radec->Magnitude();
     447      if (mag>GetLimMag())
     448        continue;
     449      TVector3 star(*radec);
     450      // Rotate Star into telescope system
     451      star *= rot;
     452      TVector3 mean;
     453      Int_t num = 0;
     454      MGeomMirror *mirror = 0;
     455      TIter NextM(fMirrors);
     456      while ((mirror=(MGeomMirror*)NextM())) {
     457        const TVector3 spot = mirror->GetReflection(star, fGeom->GetCameraDist())*1000;
     458        mean += spot;
     459        num++;
     460      }
     461      mean *= 1./num;
     462      MStarLocalPos *starpos = new MStarLocalPos;
     463      starpos->SetExpValues(mag,mean(0),mean(1));
     464     
     465      TString name = radec->GetName();
     466      if (name.Length()==0) {
     467        starpos->SetName("unknown");
     468      } else {
     469        starpos->SetName(radec->GetName());
     470      } 
     471      list->Add(starpos);   
     472    }
     473}
    472474
    473475// ------------------------------------------------------------------------
  • trunk/MagicSoft/Mars/mastro/MAstroCamera.h

    r4214 r4433  
    3535    void SetGeom(const MGeomCam &cam);
    3636
     37    void FillStarList(TList *list);
     38
    3739    void GetDiffZdAz(Double_t x, Double_t y, Double_t &dzd, Double_t &daz);
    3840
  • trunk/MagicSoft/Mars/mtemp/MStarLocalPos.cc

    r4294 r4433  
    1111! * provided that the above copyright notice appear in all copies and
    1212! * that both that copyright notice and this permission notice appear
    13 ! * in supporting documentation. It is provided "as is" without express
     13! * in supporting documentation. It is provided "as is" without expressed
    1414! * or implied warranty.
    1515! *
     
    1717!
    1818!   Author(s): Javier López , 4/2004 <mailto:jlopez@ifae.es>
     19!   Author(s): Robert Wagner, 7/2004 <mailto:rwagner@mppmu.mpg.de>
    1920!
    2021!   Copyright: MAGIC Software Development, 2000-2004
     
    2526
    2627#include <TEllipse.h>
     28#include <TMarker.h>
    2729
    2830#include "MLog.h"
     
    101103}
    102104
     105void MStarLocalPos::SetFitValues(Float_t mag, Float_t max, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis, Float_t chiSquare, Int_t ndof, Float_t xx, Float_t xy, Float_t yy)
     106{
     107  SetFitValues(mag, max, x, y, sigmaMinorAxis, sigmaMajorAxis, chiSquare, ndof);
     108  fXXErr = xx;
     109  fYYErr = yy;
     110  fXYErr = xy;
     111}
     112
     113
    103114// --------------------------------------------------------------------------
    104115//
     
    108119{
    109120  //Print a cross in the expected position
     121 
     122  TMarker mexp(fXExp, fYExp, 29);
     123  mexp.SetMarkerSize(3);
     124  mexp.SetMarkerColor(94);
     125  mexp.Paint();
    110126
    111127  if (fSigmaMinorAxisCalc>0. && fSigmaMajorAxisCalc>0.)
    112128    {
    113129      TEllipse ecalc(fMeanXCalc, fMeanYCalc, fSigmaMinorAxisCalc, fSigmaMajorAxisCalc, 0, 360, 0);
    114       ecalc.SetLineWidth(2);
     130      ecalc.SetLineWidth(3);
    115131      ecalc.SetLineColor(kRed);
    116132      ecalc.Paint();
     
    120136    {
    121137      TEllipse efit(fMeanXFit, fMeanYFit, fSigmaMinorAxisFit, fSigmaMajorAxisFit, 0, 360, 0);
    122       efit.SetLineWidth(2);
     138      efit.SetLineWidth(3);
    123139      efit.SetLineColor(kBlack);
    124140      efit.Paint();
     
    129145{
    130146  TString o = opt;
     147
     148  if (o.Contains("name", TString::kIgnoreCase) || opt == NULL)
     149    {
     150      *fLog << inf << "Star Name: \"" << this->GetName() << "\"" << endl;
     151    }
     152   
    131153 
    132154  if (o.Contains("mag", TString::kIgnoreCase) || opt == NULL)
    133155    {
     156 
    134157      *fLog << inf << "Star maginitude:" << endl;
    135158      *fLog << inf << " Expected \t" << setw(4) << fMagExp << endl;
     
    165188      *fLog << inf << " ChiSquare/Ndof \t " << setw(3) << fChiSquare << "/" << fNdof << endl;
    166189    }
     190
     191  if (o.Contains("err", TString::kIgnoreCase) || opt == NULL)
     192    {
     193      *fLog << inf << "Minuit Error Matrix:" << endl;
     194      *fLog << inf << " xx,xy,yy \t " << setw(3) << fXXErr << ", " << fXYErr << ", " << fYYErr << endl;
     195    }
     196
     197
    167198}
  • trunk/MagicSoft/Mars/mtemp/MStarLocalPos.h

    r4294 r4433  
    3434    Float_t fSigmaMajorAxisFit;  //[mm]
    3535    Float_t fChiSquare;
     36    Float_t fXXErr;              //minuit error matrix elements
     37    Float_t fXYErr;
     38    Float_t fYYErr;
    3639    Int_t   fNdof;
    3740
     
    6669    Float_t GetSigmaMinorAxis() {return fSigmaMinorAxisFit!=0?fSigmaMinorAxisFit:fSigmaMinorAxisCalc;}
    6770    Float_t GetSigmaMajorAxis() {return fSigmaMajorAxisFit!=0?fSigmaMajorAxisFit:fSigmaMajorAxisCalc;}
     71   
     72    Float_t GetXXErr() {return fXXErr;}
     73    Float_t GetXYErr() {return fXYErr;}
     74    Float_t GetYYErr() {return fYYErr;}
    6875
    6976    void Reset();
     
    7279    void SetCalcValues(Float_t mag, Float_t max, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis);
    7380    void SetFitValues(Float_t mag, Float_t max, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis, Float_t chi, Int_t ndof);
     81    void SetFitValues(Float_t mag, Float_t max, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis, Float_t chi, Int_t ndof, Float_t xx, Float_t xy, Float_t yy);
    7482
    7583    void Paint(Option_t *opt=NULL);
Note: See TracChangeset for help on using the changeset viewer.