Changeset 8852 for trunk


Ignore:
Timestamp:
02/02/08 13:06:37 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/Changelog

    r8848 r8852  
    11                                                                  -*-*- END -*-*-
     2
     3 2008/02/02 Thomas Bretz
     4
     5   * main/MCosy.cc, candrv/vmodican.cc, gui/MGCoordinates.cc,
     6     gui/MGSkyPosition.cc:
     7     - added stream modifiers
     8
     9
    210
    311 2008/01/31 Thomas Bretz
  • trunk/MagicSoft/Cosy/candrv/vmodican.cc

    r8831 r8852  
    4141
    4242#include "MLog.h"
     43#include "MLogManip.h"
    4344
    4445ClassImp(VmodIcan);
     
    8182    while (!Send(&msg));
    8283
    83     gLog << "- CAN Bus Termination set to " << (state?"on":"off") << endl;
     84    gLog << inf2 << "- CAN Bus Termination set to " << (state?"on":"off") << endl;
    8485}
    8586
     
    9596        return 0;
    9697
    97     gLog << "- Starting Receiver Loop." << endl;
     98    gLog << inf2 << "- Starting Receiver Loop." << endl;
    9899
    99100    while (1)
     
    313314    while (!Send(&msg));      /* transmitt to module */
    314315
    315     gLog << "- Baudrate set to " << rate << "kbps" << endl;
     316    gLog << inf2 << "- Baudrate set to " << rate << "kbps" << endl;
    316317}
    317318
     
    342343    while (!Send(&msg));
    343344
    344     gLog << "- Controller connected to bus" << endl;
     345    gLog << inf2 << "- Controller connected to bus" << endl;
    345346}
    346347
     
    387388        return -1;
    388389
    389     gLog << "- Fast Host Interface Enabled" << endl;
     390    gLog << inf2 << "- Fast Host Interface Enabled" << endl;
    390391
    391392    return 0;
     
    415416void VmodIcan::DisableCanBusConnection()
    416417{
    417     gLog << "- Disconnect VmodIcan module from Bus!" << endl;
     418    gLog << inf2 << "- Disconnect VmodIcan module from Bus!" << endl;
    418419
    419420    Message msg;                  /* buffer for module messages */
     
    424425    while (!Send(&msg));
    425426
    426     gLog << "- VmodIcan disconnected." << endl;
     427    gLog << inf2 << "- VmodIcan disconnected." << endl;
    427428}
    428429
     
    451452void VmodIcan::Close()
    452453{
    453     gLog << "- Closing device VmodIcan #" << (int)fd << endl;
     454    gLog << inf2 << "- Closing device VmodIcan #" << (int)fd << endl;
    454455
    455456    Message msg; /* disconnect message */
     
    462463    close(fd);
    463464
    464     gLog << "- Device closed." << endl;
     465    gLog << inf2 << "- Device closed." << endl;
    465466}
    466467
     
    479480    while (!Send(&msg));
    480481
    481     gLog << "- Fifo enabled" << endl;
     482    gLog << inf2 << "- Fifo enabled" << endl;
    482483
    483484    return TRUE;
     
    492493    const int rc = Ioctl(DPM_RESET, 0);
    493494
    494     gLog << "- Reset done." << endl;
     495    gLog << inf2 << "- Reset done." << endl;
    495496
    496497    return rc;
     
    516517    if (fd < 0)
    517518    {
    518         gLog << "Error: Opening device '" << devname << "' (rc=" << fd << ")" << endl;
     519        gLog << err << "Error: Opening device '" << devname << "' (rc=" << fd << ")" << endl;
    519520        gLog << strerror(errno) << endl;
    520521        return FALSE;
    521522    }
    522523
    523     gLog << "- Device " << devname << " #" << fd << " open." << endl;
     524    gLog << inf << "- Device " << devname << " #" << fd << " open." << endl;
    524525
    525526    return TRUE;
     
    582583    Ioctl(DPM_INIT_NEW_HOSTIF_PRIO, &hdp);
    583584
    584     gLog << "- New style host interface enabled" << endl;
     585    gLog << inf2 << "- New style host interface enabled" << endl;
    585586
    586587    return 0;
     
    757758    while (!Send(&msg));
    758759
    759     gLog << "- All CobIds disabled." << endl;
     760    gLog << inf2 << "- All CobIds disabled." << endl;
    760761}
    761762
     
    868869     */
    869870
    870     gLog << "- VmodIcan initialized." << endl;
     871    gLog << inf << "- VmodIcan initialized." << endl;
    871872
    872873}
     
    879880VmodIcan::~VmodIcan()
    880881{
    881     gLog << "- Stopping VmodIcan module." << endl;
     882    gLog << inf2 << "- Stopping VmodIcan module." << endl;
    882883    CancelThread();
    883884    DisableCanBusConnection();
    884885    Close();
    885     gLog << "- VmodIcan stopped." << endl;
    886 }
     886    gLog << inf << "- VmodIcan stopped." << endl;
     887}
  • trunk/MagicSoft/Cosy/gui/MGCoordinates.cc

    r8847 r8852  
    77#include "MGCoordinates.h"
    88
    9 #include <iostream>  // cout
     9#include "MGCoordinate.h"
    1010
    11 #include "MGCoordinate.h"
     11#include "MLog.h"
     12#include "MLogManip.h"
    1213
    1314ClassImp(MGCoordinates);
     
    4142    delete fX;
    4243
    43     cout << "MGCoordinates destroyed." << endl;
     44    gLog << inf2 << "MGCoordinates destroyed." << endl;
    4445}
    4546
  • trunk/MagicSoft/Cosy/gui/MGImage.cc

    r7787 r8852  
    2020#include "MGImage.h"
    2121
    22 #include <iostream>
    23 
    2422#include <TGX11.h>
    2523#include <TMutex.h>
     24
     25#include "MLog.h"
     26#include "MLogManip.h"
    2627
    2728ClassImp(MGImage);
     
    4950    fImage  = (XImage*)gVirtualX->CreateImage(fWidth, fHeight);
    5051
    51     cout << "Detected Color Depth: " << gVirtualX->GetDepth() << endl;
     52    gLog << all << "Detected Color Depth: " << gVirtualX->GetDepth() << endl;
    5253}
    5354
     
    5758        cout << "MGImage::~MGImage - mutex is already locked by this thread" << endl;
    5859
    59     cout << "Deleting MGImage..." << endl;
     60    gLog << inf2 << "Deleting MGImage..." << endl;
    6061
    6162    gVirtualX->DeleteGC(fDefGC);
    6263    gVirtualX->DeleteImage((Drawable_t)fImage);
    6364
     65    //cout << fMuxPixmap->UnLock() << endl;
     66
    6467    delete fMuxPixmap;
    6568
    66     cout << "MGImage destroyed." << endl;
     69    gLog << inf2 << "MGImage destroyed." << endl;
    6770}
    6871
     
    8790    if (TestBit(kSyncMode))
    8891        if (fMuxPixmap->UnLock()==13)
    89             cout << "MGImage::DoRedraw - tried to unlock mutex locked by other thread." << endl;
     92            gLog << warn << "MGImage::DoRedraw - tried to unlock mutex locked by other thread." << endl;
    9093}
    9194
  • trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc

    r8847 r8852  
    77#include "MGSkyPosition.h"
    88
    9 #include <iostream>  // cout
    10 
    119#include <TArc.h>
    1210#include <TLine.h>
     
    1412#include <TList.h>
    1513#include <TCanvas.h>
     14
     15#include "MLog.h"
     16#include "MLogManip.h"
    1617
    1718#include "MAstro.h"
     
    249250    delete fSlaStar;
    250251
    251     cout << "MGSkyPosition destroyed." << endl;
     252    gLog << inf2 << "MGSkyPosition destroyed." << endl;
    252253}
    253254
  • trunk/MagicSoft/Cosy/main/MCosy.cc

    r8839 r8852  
    214214
    215215    MTime t(-1);
    216     gLog << t << " - MCosy::WaitForEndMovement aborted...";
     216    gLog << inf << t << " - MCosy::WaitForEndMovement aborted...";
    217217    if (Break())
    218218        gLog << " Break signal...";
     
    279279    if (d.Zd()<fMin.Zd())
    280280    {
    281         gLog << "ERROR: Requested Zenith Angle below negative endswitch." << endl;
     281        gLog << err << "ERROR: Requested Zenith Angle below negative endswitch." << endl;
    282282        return kFALSE;
    283283    }
     
    285285    if (d.Zd()>fMax.Zd())
    286286    {
    287         gLog << "ERROR: Requested Zenith Angle behind positive endswitch." << endl;
     287        gLog << err << "ERROR: Requested Zenith Angle behind positive endswitch." << endl;
    288288        return kFALSE;
    289289    }
     
    291291    if (d.Az()<fMin.Az())
    292292    {
    293         gLog << "ERROR: Requested Azimuth Angle below negative endswitch." << endl;
     293        gLog << err << "ERROR: Requested Azimuth Angle below negative endswitch." << endl;
    294294        return kFALSE;
    295295    }
     
    297297    if (d.Az()>fMax.Az())
    298298    {
    299         gLog << "ERROR: Requested Azimuth Angle behind positive endswitch." << endl;
     299        gLog << err << "ERROR: Requested Azimuth Angle behind positive endswitch." << endl;
    300300        return kFALSE;
    301301    }
     
    497497    // set deceleration to 50%
    498498    //
    499     cout << "Stopping movement (dec=30%)..." << endl;
     499    gLog << inf2 << "Stopping movement (dec=30%)..." << endl;
    500500    if (fMac1 && fMac2)
    501501    {
     
    575575    {
    576576    case WM_WAIT:
    577         cout << "Wait for execution of Proc(WM_*, ): done." << endl;
     577        gLog << inf2 << "Wait for execution of Proc(WM_*, ): done." << endl;
    578578        return 0;
    579579
     
    913913        if (!CheckNetwork())
    914914        {
    915             gLog << "ERROR: Cannot shutdown CANbus network." << endl;
     915            gLog << err << "ERROR: Cannot shutdown CANbus network." << endl;
    916916            return 0xebb0;
    917917        }
     
    932932void MCosy::ReadConfig()
    933933{
    934     cout << "Reading configuration file..." << flush;
     934    gLog << inf2 << "Reading configuration file..." << flush;
    935935    TEnv env(".cosyrc");
    936     cout << "done." << endl;
    937 
    938     cout << "Reading telescope range..." << flush;
     936    gLog << "done." << endl;
     937
     938    gLog << inf2 << "Reading telescope range..." << flush;
    939939    const Double_t amin = env.GetValue("Az_Min[deg]", -95.0);
    940940    const Double_t zmin = env.GetValue("Zd_Min[deg]", -75.0);
     
    944944    const Double_t zmax = env.GetValue("Zd_Max[deg]", 98.25);
    945945    fMax.Set(zmax, amax);
    946     cout << "done." << endl;
    947 
    948     cout << " * Min:  " << zmin << "deg  " << amin << "deg" << endl;
    949     cout << " * Max:  " << zmax << "deg  " << amax << "deg" << endl;
     946    gLog << "done." << endl;
     947
     948    gLog << all << " * Min:  " << zmin << "deg  " << amin << "deg" << endl;
     949    gLog << all << " * Max:  " << zmax << "deg  " << amax << "deg" << endl;
    950950
    951951    fMin = fBending.AddOffsets(fMin/TMath::RadToDeg());
    952952    fMax = fBending.AddOffsets(fMax/TMath::RadToDeg());
    953953
    954     cout << " * Min': " << fMin.Zd()*TMath::RadToDeg() << "deg  " << fMin.Az()*TMath::RadToDeg() << "deg" << endl;
    955     cout << " * Max': " << fMax.Zd()*TMath::RadToDeg() << "deg  " << fMax.Az()*TMath::RadToDeg() << "deg" << endl;
    956 
    957     cout << "Reading gear ratios..." << flush;
     954    gLog << all << " * Min': " << fMin.Zd()*TMath::RadToDeg() << "deg  " << fMin.Az()*TMath::RadToDeg() << "deg" << endl;
     955    gLog << all << " * Max': " << fMax.Zd()*TMath::RadToDeg() << "deg  " << fMax.Az()*TMath::RadToDeg() << "deg" << endl;
     956
     957    gLog << inf2 << "Reading gear ratios..." << flush;
    958958//    kGear.X(env.GetValue("Zd_GearRatio[U_mot/U_tel]", 1000.0));
    959959//    kGear.Y(env.GetValue("Az_GearRatio[U_mot/U_tel]", 1000.0));
     
    10191019//    kGearTot = kResRE*kGear;
    10201020
    1021     cout << "done." << endl;
    1022 
    1023     cout << " * Setting Gear Ratios:" << endl;
    1024     cout << "   --------------------" << endl;
    1025     cout << " *  X: " << kGear.X() << "*" << kResRE.X()/4 << "/" << kResSE.X() << "=4*" << kGearTot.X() << "/" << kResSE.X() << endl;
    1026     cout << " *  Y: " << kGear.Y() << "*" << kResRE.Y()/4 << "/" << kResSE.Y() << "=4*" << kGearTot.Y() << "/" << kResSE.Y() << endl;
     1021    gLog << "done." << endl;
     1022
     1023    gLog << all;
     1024    gLog << " * Setting Gear Ratios:" << endl;
     1025    gLog << "   --------------------" << endl;
     1026    gLog << " *  X: " << kGear.X() << "*" << kResRE.X()/4 << "/" << kResSE.X() << "=4*" << kGearTot.X() << "/" << kResSE.X() << endl;
     1027    gLog << " *  Y: " << kGear.Y() << "*" << kResRE.Y()/4 << "/" << kResSE.Y() << "=4*" << kGearTot.Y() << "/" << kResSE.Y() << endl;
    10271028}
    10281029/*
     
    10501051    if (fHist)
    10511052    {
    1052         gLog << "You are much too fast... try again." << endl;
     1053        gLog << err << "You are much too fast... try again." << endl;
    10531054        return;
    10541055    }
     
    10631064    int cnt = 0;
    10641065
    1065     gLog << "Starting Shaftencoder Test..." << endl;
     1066    gLog << inf2 << "Starting Shaftencoder Test..." << endl;
    10661067
    10671068    while (fBackground==kBgdSeTest)
     
    11021103    }
    11031104
    1104     gLog << "Shaftencoder Test Stopped... displaying Histogram." << endl;
     1105    gLog << inf2 << "Shaftencoder Test Stopped... displaying Histogram." << endl;
    11051106
    11061107    fBackground=kBgdSeTestDispl;
     
    11141115    if (fHist)
    11151116    {
    1116         gLog << "You are much too fast... try again." << endl;
     1117        gLog << err << "You are much too fast... try again." << endl;
    11171118        return;
    11181119    }
     
    11271128    fHist->SetZTitle("Re/Se");
    11281129
    1129     gLog << "Starting Gear determination..." << endl;
     1130    gLog << inf2 << "Starting Gear determination..." << endl;
    11301131
    11311132    ZdAz se0 = GetSePos();
     
    11731174        }
    11741175    }
    1175     gLog << "Gear Test Stopped... displaying Histogram." << endl;
     1176    gLog << inf2 << "Gear Test Stopped... displaying Histogram." << endl;
    11761177
    11771178    fBackground=kBgdGearDispl;
     
    12491250    const Int_t rc = fMutexGui.TryLock();
    12501251    if (rc==13)
    1251         cout << "MCosy::HandleTimer - mutex is already locked by this thread" << endl;
     1252        gLog << warn << "MCosy::HandleTimer - mutex is already locked by this thread" << endl;
    12521253
    12531254    if (rc)
    12541255    {
    1255         gLog << "* GUI update skipped due to locked mutex." << endl;
     1256        gLog << warn << "* GUI update skipped due to locked mutex." << endl;
    12561257        return kTRUE;
    12571258    }
     
    13031304
    13041305    if (fMutexGui.UnLock()==13)
    1305         cout << "MCosy::HandleTimer - tried to unlock mutex locked by other thread." << endl;
     1306        gLog << warn << "MCosy::HandleTimer - tried to unlock mutex locked by other thread." << endl;
    13061307
    13071308    return kTRUE;
     
    13101311void MCosy::DisplayHistTestSe(Bool_t del)
    13111312{
    1312     gLog << "Displaying histogram..." << endl;
     1313    gLog << inf2 << "Displaying histogram..." << endl;
    13131314
    13141315    TH2F &hist = *(TH2F*)fHist;
     
    13481349void MCosy::DisplayHistGear(Bool_t del)
    13491350{
    1350     gLog << "Displaying histogram..." << endl;
     1351    gLog << inf2 << "Displaying histogram..." << endl;
    13511352
    13521353    TH3F &hist = *(TH3F*)fHist;
     
    14421443    ReadConfig();
    14431444
    1444     gLog << "- Starting TX Thread." << endl;
     1445    gLog << inf << "- Starting TX Thread." << endl;
    14451446    fTTalk = new MTTalk(this);
    14461447
    1447     gLog << "- Starting GUI update." << endl;
     1448    gLog << inf << "- Starting GUI update." << endl;
    14481449    fUpdateGui->TurnOn();
    14491450}
     
    14861487    // Create Nodes
    14871488    //
    1488     gLog << "- Setting up network." << endl;
     1489    gLog << inf << "- Setting up network." << endl;
    14891490
    14901491    fMac1=new Macs(id1, "Mac/Az");
     
    15051506    fZd2->SetMotor(fMac2);
    15061507 
    1507     gLog << "- Connecting devices to network." << endl;
     1508    gLog << inf << "- Connecting devices to network." << endl;
    15081509
    15091510    //
     
    15211522    // Create Gui Event timer and Gui
    15221523    //
    1523     gLog << "- Initializing GUI Timer." << endl;
     1524    gLog << inf << "- Initializing GUI Timer." << endl;
    15241525    fUpdateGui = new TTimer(this, 100); // 100ms
    15251526
    1526     gLog << "- Starting GUI." << endl;
     1527    gLog << all << "- Starting GUI." << endl;
    15271528    fWin=new MGCosy(fObservatory, this, gClient->GetRoot(), 1, 1);
    15281529}
     
    16241625
    16251626    TString name = GetFileName("rep", "cosy", "rep");
    1626     cout << "Open Repfile: " << name << endl;
     1627    gLog << inf << "Open Repfile: " << name << endl;
    16271628    fOutRep = new MLog(name, kTRUE);
    16281629    *fOutRep << "[Drive Report File]" << endl;
     
    16621663void MCosy::TerminateApp()
    16631664{
    1664     cout << "MCosy::TerminateApp()" << endl;
     1665    gLog << inf2 << "MCosy::TerminateApp()" << endl;
    16651666/*
    16661667    Int_t rc;
     
    16821683MCosy::~MCosy()
    16831684{
    1684     cout << "Deleting GUI timer." << endl;
     1685    gLog << inf2 << "Deleting GUI timer." << endl;
    16851686    // FIXME: Wait until last Update was finished!!!
    16861687    delete fUpdateGui;
     
    16891690
    16901691    // Now the files can safely be closed
    1691     cout << "Closing output files." << endl;
     1692    gLog << inf2 << "Closing output files." << endl;
    16921693    if (fOutTp)
    16931694    {
     
    16971698    delete fOutRep;
    16981699
    1699     cout << "Deleting CC communication." << endl;
     1700    gLog << inf2 << "Deleting CC communication." << endl;
    17001701    delete fCom;
    17011702
    1702     cout << "Deleting Nodes." << endl;
     1703    gLog << inf2 << "Deleting Nodes." << endl;
    17031704    fZd1->SetReport(0);
    17041705    fZd2->SetReport(0);
     
    17131714        delete fMac3;
    17141715
    1715     cout << "Deleting MGCosy." << endl;
     1716    gLog << inf2 << "Deleting MGCosy." << endl;
    17161717
    17171718    gLog.DisableOutputDevice(MLog::eGui);
     
    17191720    delete fWin;
    17201721
    1721     cout << "MGCosy destructed." << endl;
    1722 }
     1722    gLog << inf2 << "MGCosy destructed." << endl;
     1723}
Note: See TracChangeset for help on using the changeset viewer.