Changeset 1325 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
04/30/02 12:00:44 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r1324 r1325  
    77   * macros/tar.C:
    88     - implemented some sanity checks (existing files)
     9
     10   * mgui/MCamDisplay.[h,cc]:
     11     - changed to use DeepSea palette in root versions newer than 3.01/05
     12     - fixed a bug which caused the destructor to do strange thing
     13       (the uncloned fGeomCam was deleted)
     14     - implemented a more accurate deletion of the objects in the
     15       TClonesArrays by using TClonesArray::Delete
     16     - Implemented deletion of automatically created TCanvas
     17     - Implemented a sanity check in Draw and DrawPhotNum
     18
     19   * macros/readCT1.C, macros/readMagic.C:
     20     - changed to Handling of the gui and keyboard input
     21     - implemented the filename as function argument
     22
     23   * manalysis/MCT1ReadAscii.cc:
     24     - Expanded filename to support filnames containing '~'
    925
    1026
  • trunk/MagicSoft/Mars/NEWS

    r1317 r1325  
    7575     by unfolding
    7676
     77   - changed the color palette in the camera display to DeapSea.
    7778
    7879
  • trunk/MagicSoft/Mars/macros/readCT1.C

    r1282 r1325  
    2323\* ======================================================================== */
    2424
     25Bool_t HandleInput()
     26{
     27    TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
     28    while (1)
     29    {
     30        //
     31        // While reading the input process gui events asynchronously
     32        //
     33        timer.TurnOn();
     34        TString input = Getline("Type 'q' to exit, <return> to go on: ");
     35        timer.TurnOff();
    2536
    26 void readCT1()
     37        if (input=="q\n")
     38            return kFALSE;
     39
     40        if (input=="\n")
     41            return kTRUE;
     42    };
     43
     44    return kFALSE;
     45}
     46
     47void readCT1(const char *fname="~/data/CT1_97_on1.dat")
    2748{
    2849    MParList plist;
     
    3657    plist.AddToList(&tlist);
    3758
    38     MCT1ReadAscii read("/home/tbretz/data/CT1_97_on1.dat");
     59    MCT1ReadAscii read(fname);
    3960    MClone        clone("MCerPhotEvt");
    4061    MImgCleanStd  clean;
     
    6687
    6788        display.DrawPhotNum(evt);
    68         gClient->HandleInput();
    69         if (getchar()=='q')
     89
     90        if (!HandleInput())
    7091            break;
    7192
     
    7495        display.DrawPhotNum((MCerPhotEvt*)plist.FindObject("MCerPhotEvt"));
    7596
    76         gClient->HandleInput();
    77         if (getchar()=='q')
     97        if (!HandleInput())
    7898            break;
    7999    }
  • trunk/MagicSoft/Mars/macros/readMagic.C

    r1206 r1325  
    2424
    2525
    26 void readMagic()
     26Bool_t HandleInput()
     27{
     28    TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
     29    while (1)
     30    {
     31        //
     32        // While reading the input process gui events asynchronously
     33        //
     34        timer.TurnOn();
     35        TString input = Getline("Type 'q' to exit, <return> to go on: ");
     36        timer.TurnOff();
     37
     38        if (input=="q\n")
     39            return kFALSE;
     40
     41        if (input=="\n")
     42            return kTRUE;
     43    };
     44
     45    return kFALSE;
     46}
     47
     48void readMagic(const char *fname="~/data/camera.root")
    2749{
    2850    MParList plist;
     
    3658    plist.AddToList(&tlist);
    3759
    38     MReadMarsFile     read("Events", "~/data/camera.root");
     60    MReadMarsFile     read("Events", fname);
    3961
    4062    MMcPedestalCopy   pcopy;
     
    7193        display.DrawPhotNum((MCerPhotEvt*)clone.GetClone());
    7294
    73         gClient->HandleInput();
    74         if(getchar()=='q')
     95        if (!HandleInput())
    7596            break;
    7697
     
    80101        display.DrawPhotNum((MCerPhotEvt*)plist.FindObject("MCerPhotEvt"));
    81102
    82         gClient->HandleInput();
    83         if(getchar()=='q')
    84         break;
     103        if (!HandleInput())
     104            break;
    85105    }
    86106
    87107    evtloop.PostProcess();
    88 
    89108}
    90109
    91 
    92 
    93 
  • trunk/MagicSoft/Mars/manalysis/MCT1ReadAscii.cc

    r1081 r1325  
    4444
    4545#include <TList.h>
     46#include <TSystem.h>
    4647
    4748#include "MLog.h"
     
    124125    const char *name = file->GetName();
    125126
    126     fIn = new ifstream(name);
     127    fIn = new ifstream(gSystem->ExpandPathName(name));
    127128
    128129    const Bool_t noexist = !(*fIn);
  • trunk/MagicSoft/Mars/mgui/MCamDisplay.cc

    r1268 r1325  
    2727//
    2828MCamDisplay::MCamDisplay(MGeomCam *geom)
    29     : fAutoScale(kTRUE), fMinPhe(-2), fMaxPhe(50), fW(0), fH(0), fDrawingPad(NULL)
    30 {
    31     fGeomCam = geom; // FIXME: Clone doesn't work! (MGeomCam*)geom->Clone();
     29    : fAutoScale(kTRUE), fMinPhe(-2), fMaxPhe(50), fW(0), fH(0), fDrawingPad(NULL), fIsAllocated(kFALSE)
     30{
     31    fGeomCam = (MGeomCam*)geom; // FIXME: Clone doesn't work! (MGeomCam*)geom->Clone();
    3232
    3333    //
     
    5353    // set the color palette for the TBox elements
    5454    //
     55#if ROOT_VERSION_CODE < ROOT_VERSION(3,01,06)
    5556    gStyle->SetPalette(1, 0);
     57#else
     58    gStyle->SetPalette(51, 0);
     59#endif
    5660
    5761    //
     
    8185MCamDisplay::~MCamDisplay()
    8286{
     87    fPixels->Delete();
     88    fLegend->Delete();
     89    fLegText->Delete();
     90
    8391    delete fPixels;
    8492    delete fLegend;
    8593    delete fLegText;
    8694
    87     delete fGeomCam;
     95    // delete fGeomCam;
     96
     97    if (fIsAllocated)
     98        delete fDrawingPad;
    8899}
    89100
     
    157168    // gPad->SetFixedAspectRatio()
    158169
     170    if (fDrawingPad)
     171        return;
     172
    159173    //
    160174    // if no canvas is yet existing to draw into, create a new one
    161175    //
    162176    if (!gPad)
     177    {
    163178        fDrawingPad = new TCanvas("CamDisplay", "Magic Camera Display", 0, 0, 750, 600);
     179        fIsAllocated = kTRUE;
     180    }
    164181    else
     182    {
    165183        fDrawingPad = gPad;
     184        fIsAllocated = kFALSE;
     185    }
    166186
    167187    fDrawingPad->SetBorderMode(0);
     
    176196    // Setup the correct environment
    177197    //
     198#if ROOT_VERSION_CODE < ROOT_VERSION(3,01,06)
    178199    gStyle->SetPalette(1, 0);
     200#else
     201    gStyle->SetPalette(51, 0);
     202#endif
    179203
    180204    gPad->SetFillColor(22);
     
    220244void MCamDisplay::DrawPhotNum(const MCerPhotEvt *event)
    221245{
     246    if (!event)
     247        return;
     248
    222249    if (!fDrawingPad)
    223250        Draw();
  • trunk/MagicSoft/Mars/mgui/MCamDisplay.h

    r1203 r1325  
    3838    UInt_t         fH;           // Height of canvas
    3939    TVirtualPad   *fDrawingPad;  // pad in which we are drawing
     40    Bool_t         fIsAllocated;
    4041
    4142    TBox  *GetBox(Int_t i)  { return (TBox*) fLegend->At(i); }
Note: See TracChangeset for help on using the changeset viewer.