Changeset 3710


Ignore:
Timestamp:
04/13/04 10:27:53 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3709 r3710  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20 2004/04/13: Thomas Bretz
     21
     22   * mastro/MAstroCamera.cc, mastro/MAstroCatalog.[h,cc]:
     23     - enhanced comments
     24     - added some new features
     25     
     26   * mbase/MAGIC.h:
     27     - removed some empty lines
     28     
     29   * mfileio/MWriteRootFile.cc:
     30     - fixed a compiler warning
     31     
     32   * mgeom/MGeomCorsikaCT.h:
     33     - removed obsolete include of TArrayF
     34
     35   * mgeom/MGeomMirror.[h,cc]:
     36     - replaced fReflector by *fReflector
     37
     38
     39
    2040 2004/04/10: Markus Gaug
    2141 
     
    2949     - scheme of the calibration classes, used for documentation in
    3050       MJCalibration.cc
     51
    3152
    3253
  • trunk/MagicSoft/Mars/mastro/MAstroCamera.cc

    r3704 r3710  
    2626//
    2727// MAstroCamera
     28// ============
    2829//
    2930// A tools displaying stars from a catalog in the camera display.
    30 //
     31// PRELIMINARY!!
     32//
     33//
     34// Usage:
     35// ------
    3136// For a usage example see macros/starfield.C
    3237//
    33 // PRELIMINARY!!
    34 //
     38// To be able to reflect the star-light you need the geometry of the
     39// mirror and the distance of the plain screen.
     40//
     41// You can get the mirror geometry from a MC file and the distance of
     42// the screen from MGeomCam.
     43//
     44//
     45// Algorithm:
     46// ----------
    3547// The caluclation of the position of the reflection in the camera is
    3648// done by:
     
    4456//     individual mirror
    4557//
    46 // GUI: You can use the the cursor keys to change the pointing position
    47 //      and plus/minus to change the time by a quarter of an hour.
     58//
     59// GUI:
     60// ----
     61//  * You can use the the cursor keys to change the pointing position
     62//    and plus/minus to change the time by a quarter of an hour.
     63//
     64// ToDo:
     65// -----
     66//  * possibility to overwrite distance from mirror to screen
     67//  * read the mirror geometry directly from the MC input file
    4868//
    4969/////////////////////////////////////////////////////////////////////////////
    5070#include "MAstroCamera.h"
    5171
    52 #include <KeySymbols.h>
    53 
    54 #include <TH2.h>
    55 #include <TMarker.h>
    56 #include <TVirtualPad.h>
     72#include <KeySymbols.h>       // kKey_*
     73
     74#include <TH2.h>              // TH2D
     75#include <TMarker.h>          // TMarker
     76#include <TVirtualPad.h>      // gPad
    5777
    5878#include "MLog.h"
     
    6484#include "MTime.h"
    6585#include "MAstroSky2Local.h"
    66 #include "../mhist/MHCamera.h"
    6786#include "MObservatory.h"
     87
     88#include "../mhist/MHCamera.h" // FIXME: This dependancy is very bad!
     89                               // HOW TO GET RID OF IT? Move MHCamera to mgeom?
    6890
    6991ClassImp(MAstroCamera);
  • trunk/MagicSoft/Mars/mastro/MAstroCatalog.cc

    r3707 r3710  
    2525//////////////////////////////////////////////////////////////////////////////
    2626//
    27 // MAstroCatalog
    28 //
    29 // THIS IMPLEMENTATION IS PRELIMINARY AND WILL BE MERGED WITH
    30 // SOME PARTS OF THE DRIVE SOFTWARE SOON!
    31 //
    32 // To display a starfield you must have a supported catalog, then do:
     27//  MAstroCatalog
     28//  =============
     29//
     30//  THIS IMPLEMENTATION IS PRELIMINARY AND WILL BE MERGED WITH
     31//  SOME PARTS OF THE DRIVE SOFTWARE SOON!
     32//
     33//
     34//  Usage:
     35//  ------
     36//
     37//  To display a starfield you must have a supported catalog, then do:
    3338//
    3439//    MTime time;
     
    6368//  information is displayed.
    6469//
     70//
     71//  Coordinate Transformation:
     72//  -------------------------
    6573//  The conversion from sky coordinates to local coordinates is done using
    6674//  MAstroSky2Local which does a simple rotation of the coordinate system.
     
    6876//  astrometrical corrections (nutation, precission, abberation, ...)
    6977//
     78//
    7079//  GUI:
     80//  ----
    7181//    * If the gui is interactive you can use the cursor keys to change
    7282//      the position you are looking at and with plus/minus you
    7383//      can (un)zoom the FOV (Field Of View)
    74 //
    7584//    * The displayed values mean the following:
    7685//        + alpha: Right Ascension
     
    8190//                 coordinate system
    8291//        + time of display
    83 //
    8492//    * Move the mouse on top of the grid points or the stars to get
    8593//      more setailed information.
     94//    * Enable the event-info in a canvas to see the current
     95//      ObjectInfo=tooltip-text
     96//    * call SetNoToolTips to supress the tooltips
     97//    * the blue lines are the local coordinat system
     98//    * the red lines are sky coordinate system
     99//
    86100//
    87101//  ToDo:
     102//  -----
    88103//   - replace MVetcor3 by a more convinient class. Maybe use TExMap, too.
     104//   - change tooltips to multi-line tools tips as soon as root
     105//     supports them
     106//   - a derived class is missing which supports all astrometrical
     107//     correction (base on slalib and useable in Cosy)
    89108//
    90109//////////////////////////////////////////////////////////////////////////////
    91110#include "MAstroCatalog.h"
    92111
    93 #include <errno.h>
    94 #include <fstream>
    95 #include <stdlib.h>
    96 #include <limits.h> // INT_MAX (Suse 7.3/gcc 2.95)
    97 
    98 #include <KeySymbols.h>
    99 
    100 #include <TPad.h> // TPad::GetMaxPickDistance
    101 #include <TLine.h>
    102 #include <TMarker.h>
    103 #include <TCanvas.h>
    104 #include <TArrayI.h>
    105 #include <TGToolTip.h>
    106 #include <TRotation.h>
    107 #include <TPaveText.h>
     112#include <errno.h>      // strerror
     113#include <fstream>      // ifstream
     114#include <stdlib.h>     // ati, atof
     115#include <limits.h>     // INT_MAX (Suse 7.3/gcc 2.95)
     116
     117#include <KeySymbols.h> // kKey_*
     118
     119#include <TLine.h>      // TLine
     120#include <TMarker.h>    // TMarker
     121#include <TCanvas.h>    // TCanvas
     122#include <TArrayI.h>    // TArrayI
     123#include <TGToolTip.h>  // TGToolTip
     124#include <TPaveText.h>  // TPaveText
    108125
    109126#include "MLog.h"
     
    9971014// --------------------------------------------------------------------------
    9981015//
     1016// Search for an object at px, py in fMapG. Return the pointer to it
     1017// if found. Set str accordingly if a tooltip string is found.
     1018//
     1019TObject *MAstroCatalog::PickObject(Int_t px, Int_t py, TString &str) const
     1020{
     1021    Long_t key, val;
     1022    TExMapIter map(&fMapG);
     1023    while (map.Next(key, val))
     1024    {
     1025        if (!val)
     1026            continue;
     1027
     1028        TObject *o=(TObject*)key;
     1029        if (o->DistancetoPrimitive(px, py)>TPad::GetMaxPickDistance())
     1030            continue;
     1031
     1032        str = *(TString*)val;
     1033        return o;
     1034    }
     1035    return NULL;
     1036}
     1037
     1038// --------------------------------------------------------------------------
     1039//
    9991040// This function was connected to all created canvases. It is used
    10001041// to redirect GetObjectInfo into our own status bar.
    10011042//
    1002 // The 'connection' is done in AddTab
     1043// The 'connection' is done in Draw. It seems that 'connected'
     1044// functions must be public.
    10031045//
    10041046void MAstroCatalog::EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected)
     
    10121054    // Try to find a corresponding object with kCannotPick set and
    10131055    // an available TString (for a tool tip)
    1014     TString *str=0;
     1056    TString str;
    10151057    if (!selected || selected==this)
    1016     {
    1017         Long_t key, val;
    1018         TExMapIter map(&fMapG);
    1019         while (map.Next(key, val))
    1020         {
    1021             if (!val)
    1022                 continue;
    1023 
    1024             TObject *o=(TObject*)key;
    1025             if (o->DistancetoPrimitive(px, py)>TPad::GetMaxPickDistance())
    1026                 continue;
    1027 
    1028             selected = o;
    1029             str = (TString*)val;
    1030             break;
    1031         }
    1032     }
     1058        selected = PickObject(px, py, str);
    10331059
    10341060    if (!selected)
     
    10391065    {
    10401066    case kMouseMotion:
    1041         if (!fToolTip->IsMapped() && str)
    1042             ShowToolTip(px, py, *str);
     1067        if (!fToolTip->IsMapped() && !str.IsNull())
     1068            ShowToolTip(px, py, str);
    10431069        break;
    10441070
     
    11361162
    11371163// --------------------------------------------------------------------------
     1164//
     1165// Displays a tooltip
     1166//
    11381167void MAstroCatalog::ShowToolTip(Int_t px, Int_t py, const char *txt)
    11391168{
     1169    if (TestBit(kNoToolTips))
     1170        return;
     1171
    11401172    Int_t x=0;
    11411173    Int_t y=0;
     
    11511183    fToolTip->Show(x+4, y+4);
    11521184}
     1185
     1186// ------------------------------------------------------------------------
     1187//
     1188// Returns string containing info about the object at position (px,py).
     1189// Returned string will be re-used (lock in MT environment).
     1190//
     1191char *MAstroCatalog::GetObjectInfo(Int_t px, Int_t py) const
     1192{
     1193
     1194    TString str;
     1195    PickObject(px, py, str);
     1196
     1197    static char txt[129];
     1198    txt[128]=0;
     1199
     1200    return strncpy(txt, str.Data(), 128);
     1201}
     1202
    11531203
    11541204/*
  • trunk/MagicSoft/Mars/mastro/MAstroCatalog.h

    r3704 r3710  
    127127        kPlainScreen = BIT(17), // View is a plain screen view
    128128        kMirrorX     = BIT(18), // Mirror display in X
    129         kMirrorY     = BIT(19)  // Mirror display in Y
     129        kMirrorY     = BIT(19), // Mirror display in Y
     130        kNoToolTips  = BIT(20)  // suppress tooltips
    130131    };
    131132
     
    141142    void      Update(Bool_t upd=kFALSE);
    142143
    143     void ExecuteEventKbd(Int_t keycode, Int_t keysym);
    144     void ExecuteEvent(Int_t event, Int_t mp1, Int_t mp2);
     144    void      ExecuteEventKbd(Int_t keycode, Int_t keysym);
     145    void      ExecuteEvent(Int_t event, Int_t mp1, Int_t mp2);
     146    TObject  *PickObject(Int_t px, Int_t py, TString &str) const;
     147    char     *GetObjectInfo(Int_t px, Int_t py) const;
    145148
    146149    void AddMap(TObject *k, void *v=0)
     
    176179    Bool_t IsPlainScreen() const             { return TestBit(kPlainScreen); }
    177180
     181    void   SetNoToolTips(Bool_t b=kTRUE)     { b ? SetBit(kNoToolTips) : ResetBit(kNoToolTips); } // *TOGGLE* *GETTER=HasNoToolTips
     182    Bool_t HasNoToolTips() const             { return TestBit(kNoToolTips); }
     183
    178184    Double_t GetLimMag() const { return fLimMag; } // Get Limiting Magnitude
    179185    Double_t GetRadiusFOV() const { return fRadiusFOV; } // Get maximum radius of Field Of View
  • trunk/MagicSoft/Mars/mbase/MAGIC.h

    r3678 r3710  
    3131
    3232#endif
    33 
    34 
    35 
    36 
    37 
    38 
  • trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc

    r3682 r3710  
    202202
    203203    if (tname && tname[0])
    204         AddToBranchList(Form("%s.%s", AddSerialNumber(cname), tname));
     204        AddToBranchList(Form("%s.%s", (const char*)AddSerialNumber(cname), tname));
    205205}
    206206
  • trunk/MagicSoft/Mars/mgeom/MGeomCorsikaCT.h

    r3379 r3710  
    22#define MARS_MGeomCorsikaCT
    33
    4 #ifndef ROOT_TArrayF
    5 #include <TArrayF.h>
    6 #endif
    74#ifndef MARS_MParContainer
    85#include "MParContainer.h"
  • trunk/MagicSoft/Mars/mgeom/MGeomMirror.cc

    r3442 r3710  
    3030//
    3131/////////////////////////////////////////////////////////////////////////////
     32#include "MGeomMirror.h"
    3233
    33 #include "MGeomMirror.h"
     34#include <TRotation.h>
    3435
    3536#include "MLog.h"
     
    4546//
    4647MGeomMirror::MGeomMirror(Int_t mir, const char *name, const char *title)
     48    : fReflector(0)
    4749{
    4850    fName  = name  ? name  : "MGeomMirror";
     
    131133TVector3 MGeomMirror::GetReflection(const TVector3 &star, Double_t dist)
    132134{
    133     if (fReflector==TRotation())
     135    if (!fReflector)
    134136    {
    135         fReflector = TRotation(); // unit matrix
    136         fReflector.Rotate(TMath::Pi(), GetMirrorNorm());
     137        fReflector = new TRotation; // unit matrix
     138        fReflector->Rotate(TMath::Pi(), GetMirrorNorm());
    137139    }
    138140
     
    140142    // around the normal vector of the mirror center
    141143    TVector3 light(star);
    142     light *= fReflector;
     144    light *= *fReflector;
    143145
    144146    if (dist<0)
  • trunk/MagicSoft/Mars/mgeom/MGeomMirror.h

    r3387 r3710  
    1010#endif
    1111
    12 #ifndef ROOT_TRotation
    13 #include <TRotation.h>
    14 #endif
     12class TRotation;
    1513
    1614class MGeomMirror : public MParContainer
     
    3735    TArrayF fReflectivity; // Mirror reflectivity
    3836
    39     TRotation fReflector; //! Store this for acceleration
     37    TRotation *fReflector; //! Store this for acceleration
    4038
    4139public:
Note: See TracChangeset for help on using the changeset viewer.