Changeset 2497 for trunk


Ignore:
Timestamp:
11/10/03 14:08:04 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2496 r2497  
    8484     - added MGMenu
    8585     - added MProgressBar
     86
     87   * mona.cc:
     88     - added ChangeContextMenus
     89     - adapted to new MRawSocketRead interface
     90     - assigned names to different tasks
     91     - swiched off progress bar (temporarily)
     92     - moved status display into thread
     93     - exit thread by Exit() (seems to be necessary)
     94     - added preliminary workaround for mssing RootPlugin
     95
     96   * mmain/MAnalysis.cc:
     97     - removed external display
     98     - added MStatusDisplay
     99     
     100   * mmain/MMonteCarlo.cc:
     101     - old workaround (MMcEvt) obsolete
    86102
    87103
  • trunk/MagicSoft/Mars/mmain/MAnalysis.cc

    r2173 r2497  
    6161    //
    6262    TGCompositeFrame *frame = CreateNewTab("Setup");
    63 
     63 /*
    6464    TGGroupFrame *grp = new TGGroupFrame(frame, "Setup Display");
    6565    fList->Add(grp);
     
    8787    grp->AddFrame(fCheckButton1, laybut);
    8888    grp->AddFrame(fCheckButton2, laybut);
    89 
     89 */
    9090    TGLayoutHints *laygrp = new TGLayoutHints(kLHintsNormal|kLHintsExpandX, 20, 20, 20);
    9191    fList->Add(laygrp);
    92 
     92 /*
    9393    frame->AddFrame(grp, laygrp);
     94  */
    9495
    9596    /*
     
    120121// ======================================================================
    121122
     123#include "MStatusDisplay.h"
    122124#include "MParList.h"
    123125#include "MTaskList.h"
     
    138140#include "MEvtLoop.h"
    139141#include "MHillas.h"
     142#include "MGeomApply.h"
    140143
    141144void MAnalysis::CalculateHillas()
     
    145148    // parameter out of a Magic root file.
    146149
    147     const Bool_t displhillas  = fCheckButton1->GetState();
    148     const Bool_t displstarmap = fCheckButton2->GetState();
     150    const Bool_t displhillas  = kTRUE;//fCheckButton1->GetState();
     151    const Bool_t displstarmap = kTRUE;//fCheckButton2->GetState();
    149152
    150153    //
     
    193196    //
    194197    MReadMarsFile read("Events", fInputFile);
    195 
     198    read.DisableAutoScheme();
     199
     200    MGeomApply         apply;
    196201    MMcPedestalCopy    pcopy;
    197202    MMcPedestalNSBAdd  pdnsb;
     
    216221
    217222    tlist.AddToList(&read);
     223    tlist.AddToList(&apply);
    218224    tlist.AddToList(&pcopy);
    219225    tlist.AddToList(&pdnsb);
     
    245251    // Add ProgressBar to window
    246252    //
    247     TGProgressBar *bar = CreateProgressBar(fTop2);
    248     evtloop.SetProgressBar(bar);
     253    TGProgressBar *bar = NULL;
     254    if (displhillas || displstarmap)
     255    {
     256        MStatusDisplay *d=new MStatusDisplay;
     257        evtloop.SetDisplay(d);
     258    }
     259    else
     260    {
     261        bar = CreateProgressBar(fTop2);
     262        evtloop.SetProgressBar(bar);
     263    }
     264
    249265
    250266    //
    251267    // Execute your analysis
    252268    //
    253     Bool_t rc = evtloop.Eventloop();
     269    /*Bool_t rc =*/ evtloop.Eventloop();
    254270
    255271    //
    256272    // Remove progressbar from window
    257273    //
    258     DestroyProgressBar(bar);
    259 
     274    if (bar)
     275        DestroyProgressBar(bar);
     276
     277 /*
    260278    if (!rc)
    261279        return;
     
    270288        plist.FindObject("MHHillasSrc")->DrawClone();
    271289        plist.FindObject("MHNewImagePar")->DrawClone();
    272         /*
    273          plist.FindObject("HistSource")->DrawClone();
    274          plist.FindObject("HistAntiSrc")->DrawClone();
    275          */
    276290    }
    277291
     
    281295    cout << endl;
    282296    cout << "Calculation of Hillas Parameters finished without error!" << endl;
     297 */
    283298}
    284299
  • trunk/MagicSoft/Mars/mmain/MMonteCarlo.cc

    r2173 r2497  
    197197#include "MMcCollectionAreaCalc.h"
    198198
     199#if ROOT_VERSION_CODE < ROOT_VERSION(3,05,05)
    199200#include "../mmc/MMcTrig.hxx" // FIXME: see FIXME below
     201#endif
    200202
    201203Int_t MMonteCarlo::GetDim() const
     
    228230    plist.AddToList(&tlist);
    229231
     232#if ROOT_VERSION_CODE < ROOT_VERSION(3,05,05)
    230233    //
    231234    // FIXME: This line is needed that root finds the MMc-classes in the
     
    235238    //
    236239    MMcTrig trig;
     240#endif
    237241
    238242    //
     
    326330    plist.AddToList(&hists);
    327331
     332#if ROOT_VERSION_CODE < ROOT_VERSION(3,05,05)
    328333    //
    329334    // FIXME: This line is needed that root finds the MMc-classes in the
     
    333338    //
    334339    MMcTrig trig;
     340#endif
    335341
    336342    //
     
    412418    plist.AddToList(&hists);
    413419
     420#if ROOT_VERSION_CODE < ROOT_VERSION(3,05,05)
    414421    //
    415422    // FIXME: This line is needed that root finds the MMc-classes in the
     
    419426    //
    420427    MMcTrig trig;
     428#endif
    421429
    422430    //
  • trunk/MagicSoft/Mars/mona.cc

    r2386 r2497  
    1 #include <TROOT.h>
    21#include <TApplication.h>
    32
    43#include <TThread.h>
     4#include <TMethod.h>          // GetMenuItems
    55
    66#include "MParList.h"
     
    1717#include "MOnlineDump2.h"
    1818#include "MHTriggerLvl0.h"
     19#include "MHCamera.h"         // ::Class()
    1920
    2021#include "MStatusDisplay.h"
     
    3940}
    4041
     42void Remove(TMethod *m, const char *name)
     43{
     44    if (TString(m->GetName()).BeginsWith(name))
     45        m->SetMenuItem(kMenuNoMenu);
     46}
     47
     48void ChangeContextMenus()
     49{
     50    TList l;
     51    MHCamera::Class()->GetMenuItems(&l);
     52    TIter Next(&l);
     53    TMethod *m=NULL;
     54    while ((m=(TMethod*)Next()))
     55    {
     56        Remove(m, "DrawClone");
     57        Remove(m, "SetName");
     58        Remove(m, "Delete");
     59        Remove(m, "DrawClass");
     60        Remove(m, "Dump");
     61        Remove(m, "Inspect");
     62        Remove(m, "Smooth");
     63        Remove(m, "Fit");
     64        Remove(m, "Divide");
     65        Remove(m, "Add");
     66        Remove(m, "Multiply");
     67        Remove(m, "Delete");
     68        Remove(m, "SetLineAttributes");
     69        Remove(m, "SetFillAttributes");
     70        Remove(m, "SetMarkerAttributes");
     71        Remove(m, "SetDrawOption");
     72    }
     73}
     74
    4175Bool_t Loop(MStatusDisplay *display)
    4276{
     
    4781    //
    4882    MRawSocketRead reader;
     83    reader.SetPort(7000);
    4984
    5085    //
     
    5792    plist.AddToList(&tasks);
    5893    tasks.AddToList(&reader);
    59 
    60     //MParList &plist = *(MParList*)ptr;
    61     //MTaskList &tasks = *(MTaskList*)plist.FindObject("MTaskList");
    6294
    6395    MGeomApply geomapl;
     
    6698    tasks.AddToList(&ncalc);
    6799
    68     MFillH fill1("MHCamEvent", "MCerPhotEvt");
    69     MFillH fill2("MHEvent",    "MCerPhotEvt");
     100    MFillH fill1("MHEvent",    "MCerPhotEvt", "MFillEvent");
     101    MFillH fill2("MHCamEvent", "MCerPhotEvt", "MFillCamEvent");
     102
     103    MFRealTimePeriod filter;
     104    fill1.SetFilter(&filter);
    70105
    71106    MHTriggerLvl0 trigmap(128, "Above 128");
    72     MFillH fill3(&trigmap, "MRawEvtData");
    73 
    74     MFRealTimePeriod filter;
    75     fill2.SetFilter(&filter);
    76 
    77     fill1.SetName("MFillCamEvent");
    78     fill2.SetName("MFillEvent");
    79     fill3.SetName("MFillTriggerLvl0");
    80 
    81     tasks.AddToList(&fill2);
     107    MFillH fill3(&trigmap, "MRawEvtData", "MFillTriggerLvl0");
     108
    82109    tasks.AddToList(&filter);
    83110    tasks.AddToList(&fill1);
     111    tasks.AddToList(&fill2);
    84112    tasks.AddToList(&fill3);
    85113
     
    91119    MHillasCalc       hcalc;
    92120    MHillasSrcCalc    scalc; // !!Preliminary!! Will be removed later!
    93     MFillH hfill3("MHHillas", "MHillas");
    94     MFillH hfill6("MHHillasSrc","MHillasSrc");
     121    MFillH hfill3("MHHillas",   "MHillas",    "MFillHillas");
     122    MFillH hfill4("MHHillasSrc","MHillasSrc", "MFillHillasSrc");
    95123    tasks.AddToList(&clean);
    96124    tasks.AddToList(&hcalc);
    97125    tasks.AddToList(&scalc);
    98126    tasks.AddToList(&hfill3);
    99     tasks.AddToList(&hfill6);
     127    tasks.AddToList(&hfill4);
    100128
    101129    MEvtLoop magic;
    102     //plist.AddToList(&magic);
    103130    magic.SetParList(&plist);
    104131
    105132    magic.SetDisplay(display);
     133    magic.SetProgressBar((TGProgressBar*)NULL);
    106134
    107135    if (!magic.Eventloop())
     
    115143}
    116144
     145//
     146// By defining the function return type 'void' instead of
     147// 'void*' we tell TThread to create a detached thread,
     148// but calling Exit() in a detached thread results in a crash
     149// when the TGApplication is terminated.
     150//
    117151void *thread(void *ptr)
    118152{
    119     // TThread::SetCancelAsynchronous();
    120     // TThread::SetCancelOn();
    121     MStatusDisplay *display=(MStatusDisplay*)ptr;
    122 //    display->Lock();
     153    MStatusDisplay d;
     154    d.Resize(740, 600);
    123155
    124156    //
     
    126158    // user requested to exit the program.
    127159    //
    128     while (display->CheckStatus()!=MStatusDisplay::kFileExit)
    129         Loop(display);
     160    while (d.CheckStatus()!=MStatusDisplay::kFileExit)
     161        Loop(&d);
    130162
    131163    gLog << dbg << "Exit System Loop... " << flush;
     
    133165    gLog << "done." << endl;
    134166
     167    TThread::Self()->Exit();
    135168    return 0;
    136169}
    137170
     171/*
     172#if ROOT_VERSION_CODE < ROOT_VERSION(3,10,02)
     173#include <TRootGuiFactory.h>
     174#include <TPluginManager.h>
     175void InitGuiFactory()
     176{
     177   if (gROOT->IsBatch())
     178       gROOT->SetBatch(kFALSE);
     179
     180    //
     181    // Must be loaded by hand, because it is not loaded by TGApplication.
     182    // We could also use TApplication instead, but TApplication doesn't
     183    // deal with the DISPLAY variable in a convient way.
     184    //
     185    TPluginHandler *h;
     186    if ((h = gROOT->GetPluginManager()->FindHandler("TGuiFactory", "root")))
     187    {
     188        if (h->LoadPlugin() == -1)
     189            return;
     190        gGuiFactory = (TGuiFactory*)h->ExecPlugin(0);
     191    }
     192}
     193#endif
     194*/
     195
    138196int main(int argc, char **argv)
    139197{
    140     TROOT simple("mona", "Magic ONline Analysis");
    141     TApplication app("MonaApp", &argc, argv);
    142 
    143198    StartUpMessage();
     199
     200    TApplication app("Mars", &argc, argv);
     201    if (gROOT->IsBatch() || !gClient)
     202    {
     203        gLog << "Bombing... maybe your DISPLAY variable is not set correctly!" << endl;
     204        return 1;
     205    }
     206    /*
     207    TGApplication app("Mona", &argc, argv);
     208
     209#if ROOT_VERSION_CODE < ROOT_VERSION(3,10,02)
     210    InitGuiFactory();
     211#endif
     212    */
     213
     214    ChangeContextMenus();
    144215
    145216    //
     
    147218    // if the thread is terminated (by return)
    148219    //
    149     MStatusDisplay d;
    150     d.Resize(740, 600);
    151 
    152220    gLog << dbg << "Starting Thread..." << endl;
    153     TThread t(thread, &d);
     221    TThread t(thread);
    154222    t.Run();
    155223
    156     gLog << dbg << "Starting System loop..." << endl;
     224    gLog << dbg << "Starting System loop... " << endl;
    157225    app.Run(kTRUE);
    158226    gLog << dbg << "System loop stopped." << endl;
Note: See TracChangeset for help on using the changeset viewer.