Index: trunk/MagicSoft/Cosy/Changelog
===================================================================
--- trunk/MagicSoft/Cosy/Changelog	(revision 910)
+++ trunk/MagicSoft/Cosy/Changelog	(revision 911)
@@ -2,4 +2,18 @@
  2001/08/15 - Thomas Bretz:
 
+   * Added:
+     - Makefile.conf.general
+     - gui/Makefile
+     - base/Makefile
+     - candrv/Makefile
+     - catalog/Makefile
+     - slalib/Makefile
+     - videodev/Makefile
+     - devdrv/Makefile
+     - base/MThread.[h,cc]
+     - base/MTimeout.[h, cc]
+     - mgui/MGSkyPosition.[h, cc]
+     - catalog/Slalib.[h,cc]
+     
    * .cosyrc:
      - changed names
Index: trunk/MagicSoft/Cosy/Makefile
===================================================================
--- trunk/MagicSoft/Cosy/Makefile	(revision 910)
+++ trunk/MagicSoft/Cosy/Makefile	(revision 911)
@@ -110,5 +110,5 @@
 	@echo "cd .."
 	@echo "cd catalog"
-	@cd videodev; make mrproper; cd ..
+	@cd catalog; make mrproper; cd ..
 	@echo "cd .."
 
Index: trunk/MagicSoft/Cosy/base/MTimeout.cc
===================================================================
--- trunk/MagicSoft/Cosy/base/MTimeout.cc	(revision 911)
+++ trunk/MagicSoft/Cosy/base/MTimeout.cc	(revision 911)
@@ -0,0 +1,1 @@
+#include "MTimeout.h"
Index: trunk/MagicSoft/Cosy/catalog/Makefile
===================================================================
--- trunk/MagicSoft/Cosy/catalog/Makefile	(revision 910)
+++ trunk/MagicSoft/Cosy/catalog/Makefile	(revision 911)
@@ -20,5 +20,5 @@
 # @endcode 
 
-INCLUDES = -I. -I..
+INCLUDES = -I. -I.. -I../base -I../slalib
 
 # @code 
Index: trunk/MagicSoft/Cosy/catalog/Slalib.cc
===================================================================
--- trunk/MagicSoft/Cosy/catalog/Slalib.cc	(revision 911)
+++ trunk/MagicSoft/Cosy/catalog/Slalib.cc	(revision 911)
@@ -0,0 +1,124 @@
+#include "Slalib.h"
+
+#include <time.h>
+#include <iostream.h>  // cout
+
+#include "slalib.h"
+
+Slalib::Slalib()
+{
+    // p = pointer to MainFrame (not owner)
+
+    //
+    // calculate observers location (goe)
+    //
+    int status;
+    slaDaf2r(51, 38, 48.0, &fPhi,   &status);
+    slaDaf2r( 9, 56, 36.0, &fElong, &status);
+
+    cout << "Latitude: 51ø38'48.0\" = " <<  360.0/D2PI*fPhi << "   ";
+    cout << "Longitude: 9ø56'36.0\" = " <<  360.0/D2PI*fElong << endl;
+}
+
+Slalib::~Slalib()
+{
+}
+
+void Slalib::Set(const AltAz &altaz)
+{
+    fAltAz = altaz * D2PI/360.0;
+    fRaDec = CalcRaDec(fAltAz);
+}
+
+void Slalib::Set(const ZdAz &zdaz)
+{
+    fAltAz = AltAz(DPI/2-zdaz.Zd(), zdaz.Az()) * D2PI/360.0;
+    fRaDec = CalcRaDec(fAltAz);
+}
+
+void Slalib::Set(const RaDec &radec)
+{
+    fRaDec = radec * D2PI/360.0;
+    fAltAz = CalcAltAz(fRaDec);
+}
+
+void Slalib::Set(const double mjd)
+{
+    fMjd   = mjd;
+    fAlpha = slaGmst(fMjd) + fElong;
+
+    //
+    // ----- calculate star independent parameters ----------
+    //
+    slaMappa(2000.0, fMjd, fAmprms);
+    slaAoppa(fMjd, 0,                // mjd, UT1-UTC
+             fElong, fPhi, 148,      // gttingen long, lat, height
+             0, 0,                   // polar motion x, y-coordinate (radians)
+             273.155, 1013.25, 0.5,  // temp, pressure, humidity
+             0.2, 0.0065,            // wavelength, tropo lapse rate
+             fAoprms);
+}
+
+RaDec Slalib::CalcRaDec(const AltAz &altaz) const
+{
+    return CalcRaDec(ZdAz(DPI/2-altaz.Alt(), altaz.Az()));
+}
+
+RaDec Slalib::CalcRaDec(const ZdAz &zdaz) const
+{
+    //
+    // -- observed to apparent --
+    //  Workaraound for slalib: discard const
+    //
+    double r=0, d=0;
+    slaOapqk ("A", zdaz.Az(), zdaz.Zd(), (double*)fAoprms, &r, &d);
+
+    //
+    // -- apparent to mean --
+    //  Workaraound for slalib: discard const
+    //
+    double ra, dec;
+    slaAmpqk(r, d, (double*)fAmprms, &ra, &dec);
+
+    return RaDec(ra, dec);
+}
+
+ZdAz Slalib::CalcZdAz(const RaDec &radec) const
+{
+    //
+    // ---- Mean to apparent ----
+    //
+
+    double r=0, d=0;
+    slaMapqkz(radec.Ra(), radec.Dec(), (double*)fAmprms, &r, &d);
+    //
+    // Doesn't work - don't know why
+    //
+    //    slaMapqk (radec.Ra(), radec.Dec(), rdpm.Ra(), rdpm.Dec(),
+    //              0, 0, (double*)fAmprms, &r, &d);
+    //
+
+    //
+    // -- apparent to observed --
+    //
+    double r1=0;  // ra
+    double d1=0;  // dec
+    double h0=0;  // ha
+
+    double zd;
+    double az;
+    slaAopqk (r, d, (double*)fAoprms,
+              &az,    // observed azimuth (radians: N=0,E=90)
+              &zd,    // observed zenith distance (radians) [-pi/2, pi/2]
+              &h0,    // observed hour angle (radians)
+              &d1,    // observed declination (radians)
+              &r1);   // observed right ascension (radians)
+
+    return ZdAz(zd, az);
+}
+AltAz Slalib::CalcAltAz(const RaDec &radec) const
+{
+    ZdAz zdaz = CalcZdAz(radec);
+    return AltAz(DPI/2-zdaz.Zd(), zdaz.Az());
+}
+
Index: trunk/MagicSoft/Cosy/catalog/Slalib.h
===================================================================
--- trunk/MagicSoft/Cosy/catalog/Slalib.h	(revision 911)
+++ trunk/MagicSoft/Cosy/catalog/Slalib.h	(revision 911)
@@ -0,0 +1,48 @@
+#ifndef SLALIB_H
+#define SLALIB_H
+
+#include "coord.h"
+
+class Slalib
+{
+private:
+    double   fPhi;      // location of observatory
+    double   fElong;
+
+    AltAz    fAltAz;    // [rad]
+    RaDec    fRaDec;    // [rad]
+
+    double   fAlpha;
+    double   fMjd;
+
+    double   fAmprms[21];
+    double   fAoprms[14];
+
+public:
+    Slalib();
+    virtual ~Slalib();
+
+    //    const AltAz GetAltAz() const { return fAltAz*360/D2PI; }
+    //    const ZdAz  GetZdAz()  const { return ZdAz(DPI/2-fAltAz.Alt(), fAltAz.Az())*360/D2PI; }
+    //    const RaDec GetRaDec() const { return fRaDec*360/D2PI; }
+
+    void   Set(const double mjd);
+
+    void   Set(const AltAz &altaz);
+    void   Set(const ZdAz  &zdaz);
+    void   Set(const RaDec &radec);
+
+    double GetAlpha() const { return fAlpha; }
+
+    double GetPhi() const   { return fPhi; }
+    double GetElong() const { return fElong; }
+
+    RaDec  CalcRaDec(const AltAz &altaz) const;
+    RaDec  CalcRaDec(const ZdAz  &altaz) const;
+
+    AltAz  CalcAltAz(const RaDec &radec) const;
+    ZdAz   CalcZdAz (const RaDec &radec) const;
+
+};
+
+#endif
Index: trunk/MagicSoft/Cosy/devdrv/Makefile
===================================================================
--- trunk/MagicSoft/Cosy/devdrv/Makefile	(revision 911)
+++ trunk/MagicSoft/Cosy/devdrv/Makefile	(revision 911)
@@ -0,0 +1,52 @@
+##################################################################
+#
+#   makefile
+# 
+#   for the MARS software
+#
+##################################################################
+# @maintitle
+
+# @code
+
+#
+#  please change all system depend values in the 
+#  config.mk.${OSTYPE} file 
+#
+#
+include ../Makefile.conf.$(OSTYPE)
+include ../Makefile.conf.general
+
+# @endcode 
+
+DEFINES	 = -DCPU=486 -DBUS_LITTLE_ENDIAN -DDEBUG=0 -DLINUX -DSHOW 
+INCLUDES = -I. -I.. -I../base -I../candrv -I../incl
+
+# @code 
+
+CINT     = Devdrv
+LIB      = devdrv.a
+
+#------------------------------------------------------------------------------
+
+.SUFFIXES: .c .cc .cxx .h .hxx .o 
+
+SRCFILES = macs.cc \
+	   shaftencoder.cc
+
+SRCS    = $(SRCFILES)
+HEADERS = $(SRCFILES:.cc=.h)
+OBJS    = $(SRCFILES:.cc=.o) 
+
+############################################################
+
+all: $(LIB)
+
+include ../Makefile.rules
+
+clean:	rmlib rmcint rmobjs rmcore
+
+mrproper:	clean rmbak
+
+# @endcode
+
Index: trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc	(revision 911)
+++ trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc	(revision 911)
@@ -0,0 +1,96 @@
+//
+// This File contains the definition of the MGCoordinates-class
+//
+//   Author: Thomas Bretz
+//   Version: V1.0 (1-8-2000)
+
+#include "MGSkyPosition.h"
+
+#include <iostream.h>  // cout
+#include <TRootEmbeddedCanvas.h>
+#include <TGWindow.h>
+#include <TArc.h>
+#include <TCanvas.h>
+#include <TH1.h>
+#include <TLine.h>
+
+#include "coord.h"
+
+MGSkyPosition::MGSkyPosition(const TGWindow* p)
+: TRootEmbeddedCanvas("SkyPosition", p, 50, 50, kSunkenFrame)//, 0) //234, 76, kFixedSize)
+{
+    fCanvas = GetCanvas();
+
+    fCanvas->Range(-100, -100, 100, 100);
+
+    fArc = new TArc;
+    fArc->SetLineColor(15);
+    fArc->DrawArc(0, 0, 90);
+    fArc->DrawArc(0, 0, 67.5);
+    fArc->DrawArc(0, 0, 45);
+    fArc->DrawArc(0, 0, 22.5);
+
+    fLin1 = new TLine;
+    fLin1->DrawLine(-95,   0, 95,  0);
+    fLin1->DrawLine(  0, -95,  0, 95);
+    fLin2 = new TLine;
+
+    //    fCanvas->Modified();
+    //    fCanvas->Update();
+
+    MapSubwindows();
+    //    MapWindow();
+
+    //    DrawPosition(66, 25);
+    //    DrawPosition(22, 278);
+}
+
+MGSkyPosition::~MGSkyPosition()
+{
+    delete fLin1;
+    delete fLin2;
+    delete fArc;
+
+    cout << "MGSkyPosition destroyed." << endl;
+}
+
+void MGSkyPosition::DrawPosition(Float_t zd, Float_t az)
+{
+    static int X=~0;
+    static int Y=~0;
+
+    const float rad = D2PI*az/360.0;
+
+    const float s = sin(rad);
+    const float c = cos(rad);
+
+    const int x = (int)(s*zd);
+    const int y = (int)(c*zd);
+
+    if (X==x && Y==y)
+        return;
+
+    const int dx = (int)(s*6);
+    const int dy = (int)(c*6);
+
+    delete fArc;
+    fArc = new TArc(x, y, 2);
+    fArc->SetFillStyle(1001);
+    fArc->SetFillColor(43);
+    fArc->Draw();
+
+    delete fLin1;
+    delete fLin2;
+    //fLin1 = new TLine(x-dx, y-dy, x+dx, y+dy);
+    fLin1 = new TLine(0, 0, s*95, c*95);
+    fLin2 = new TLine(x+dy, y-dx, x-dy, y+dx);
+    fLin1->Draw();
+    fLin2->Draw();
+
+    fCanvas->Update();
+}
+
+void MGSkyPosition::DrawPosition(ZdAz &pos)
+{
+    DrawPosition(pos.Zd(), pos.Az());
+}
Index: trunk/MagicSoft/Cosy/gui/MGSkyPosition.h
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGSkyPosition.h	(revision 911)
+++ trunk/MagicSoft/Cosy/gui/MGSkyPosition.h	(revision 911)
@@ -0,0 +1,36 @@
+#ifndef MGSKYPOSITION_H
+#define MGSKYPOSITION_H
+
+//
+// This File contains the declaration of the MGCoordinates-class
+//
+//   Author: Thomas Bretz
+//   Version: V1.0 (1-8-2000)
+
+
+#ifndef ROOT_TRootEmbeddedCanvas
+#include <TRootEmbeddedCanvas.h>
+#endif
+
+class TCanvas;
+class TArc;
+class TLine;
+class ZdAz;
+
+class MGSkyPosition : public TRootEmbeddedCanvas
+{
+    TCanvas *fCanvas;
+
+    TArc    *fArc;
+    TLine   *fLin1;
+    TLine   *fLin2;
+
+public:
+    MGSkyPosition(const TGWindow* p);
+    ~MGSkyPosition();
+
+    void DrawPosition(Float_t zd, Float_t az);
+    void DrawPosition(ZdAz &pos);
+};
+
+#endif // MGSKYPOSITION_H
Index: trunk/MagicSoft/Cosy/videodev/Makefile
===================================================================
--- trunk/MagicSoft/Cosy/videodev/Makefile	(revision 911)
+++ trunk/MagicSoft/Cosy/videodev/Makefile	(revision 911)
@@ -0,0 +1,52 @@
+##################################################################
+#
+#   makefile
+# 
+#   for the MARS software
+#
+##################################################################
+# @maintitle
+
+# @code
+
+#
+#  please change all system depend values in the 
+#  config.mk.${OSTYPE} file 
+#
+#
+include ../Makefile.conf.$(OSTYPE)
+include ../Makefile.conf.general
+
+# @endcode 
+
+INCLUDES = -I. -I.. -I../incl -I../base -I/usr/X11R6/include
+
+# @code 
+
+CINT     = Videodev
+LIB      = videodev.a
+
+#------------------------------------------------------------------------------
+
+.SUFFIXES: .c .cc .cxx .h .hxx .o 
+
+SRCFILES = Camera.cc \
+	   Filter.cc \
+           Writer.cc 
+
+SRCS    = $(SRCFILES)
+HEADERS = $(SRCFILES:.cc=.h)
+OBJS    = $(SRCFILES:.cc=.o) 
+
+############################################################
+
+all: $(LIB)
+
+include ../Makefile.rules
+
+clean:	rmlib rmcint rmobjs rmcore
+
+mrproper:	clean rmbak
+
+# @endcode
+
Index: trunk/MagicSoft/slalib/Makefile
===================================================================
--- trunk/MagicSoft/slalib/Makefile	(revision 911)
+++ trunk/MagicSoft/slalib/Makefile	(revision 911)
@@ -0,0 +1,87 @@
+##################################################################
+#
+#   makefile
+# 
+#   for the MARS software
+#
+##################################################################
+# @maintitle
+
+# @code
+
+#
+#  please change all system depend values in the 
+#  config.mk.${OSTYPE} file 
+#
+#
+include ../Makefile.conf.$(OSTYPE)
+include ../Makefile.conf.general
+
+# @endcode 
+
+INCLUDES = -I. -I..
+
+# @code 
+
+CINT     = Slalib
+LIB      = slalib.a
+
+#------------------------------------------------------------------------------
+
+.SUFFIXES: .c .cc .cxx .h .hxx .c 
+
+SRCFILES = \
+	daf2r.c  gmst.c   mappa.c aoppa.c  oapqk.c ampqk.c mapqkz.c \
+	dr2af.c  dcs2c.c  dimxv.c dvdv.c   dvn.c   dcc2s.c dranrm.c \
+        geoc.c   refco.c  eqeqx.c aoppat.c dd2tf.c epj.c   prenut.c \
+        nutc.c   dmxv.c   refro.c prec.c   nut.c   dmxm.c  evp.c \
+        drange.c deuler.c cldj.c  aopqk.c  refz.c  dh2e.c  de2h.c
+#	addet.c
+#        afin.c airmas.c altaz.c amp.c \
+#	ampqk.c aop.c aoppa.c aoppat.c aopqk.c atmdsp.c \
+#	av2m.c bear.c caf2r.c caldj.c calyd.c cc2s.c \
+#	cc62s.c cd2tf.c cldj.c clyd.c combn.c cr2af.c cr2tf.c \
+#	cs2c.c cs2c6.c ctf2d.c ctf2r.c daf2r.c dafin.c \
+#	dat.c dav2m.c dbear.c dbjin.c dc62s.c dcc2s.c \
+#	dcmpf.c dcs2c.c dd2tf.c de2h.c deuler.c dfltin.c \
+#	dh2e.c dimxv.c djcal.c djcl.c dm2av.c dmat.c \
+#	dmoon.c dmxm.c dmxv.c dpav.c dr2af.c dr2tf.c \
+#	drange.c dranrm.c ds2c6.c ds2tp.c dsep.c dt.c \
+#	dtf2d.c dtf2r.c dtp2s.c dtp2v.c dtps2c.c dtpv2c.c \
+#	dtt.c dv2tp.c dvdv.c dvn.c dvxv.c e2h.c earth.c \
+#	ecleq.c ecmat.c ecor.c eg50.c el2ue.c epb.c \
+#	epb2d.c epco.c epj.c epj2d.c eqecl.c eqeqx.c \
+#	eqgal.c etrms.c euler.c evp.c fitxy.c fk425.c \
+#	fk45z.c fk524.c fk52h.c fk54z.c fk5hz.c flotin.c \
+#	galeq.c galsup.c ge50.c geoc.c gmst.c gmsta.c \
+#	h2e.c h2fk5.c hfk5z.c imxv.c intin.c invf.c \
+#	kbj.c m2av.c map.c mappa.c mapqk.c mapqkz.c \
+#	moon.c mxm.c mxv.c nut.c nutc.c oap.c oapqk.c \
+#	obs.c pa.c pav.c pcd.c pda2h.c pdq2h.c permut.c \
+#	pertel.c pertue.c planel.c planet.c plante.c pm.c \
+#	polmo.c prebn.c prec.c precl.c preces.c prenut.c \
+#	pvobs.c pv2el.c pv2ue.c pxy.c range.c ranorm.c \
+#	rcc.c rdplan.c refco.c refcoq.c refro.c refv.c \
+#	refz.c rverot.c rvgalc.c rvlg.c rvlsrd.c rvlsrk.c \
+#	s2tp.c sep.c smat.c subet.c supgal.c \
+#	svd.c svdcov.c svdsol.c tp2s.c tp2v.c tps2c.c \
+#	tpv2c.c ue2el.c ue2pv.c unpcd.c v2tp.c vdv.c \
+#	vn.c vxv.c xy2xy.c zd.c
+
+SRCS    = $(SRCFILES)
+HEADERS = $(SRCFILES) 
+#:.c=.h)
+OBJS    = $(SRCFILES:.c=.o) 
+
+############################################################
+
+all: $(LIB)
+
+include ../Makefile.rules
+
+clean:	rmlib rmcint rmobjs rmcore
+
+mrproper:	clean rmbak
+
+# @endcode
+
