Changeset 8642


Ignore:
Timestamp:
07/18/07 20:30:13 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r8640 r8642  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20
     21
     22 2007/07/18 Thomas Bretz
     23
     24   * mpointing/MPointingDevCalc.cc:
     25     - changed limit for starguide calibration from 87751 to 85240
     26
     27   * mbase/MContinue.cc:
     28     - changed some debug output
     29     - fixed a bug if the filter already decided to be skiped
     30
     31   * mbase/MEvtLoop.cc:
     32     - changed RecursiveRemove to use the newly implemented scheme
     33
     34   * mbase/MParContainer.[h,cc], mbase/MParList.[h,cc],
     35     mbase/MTask.[h,cc], mbase/MTaskList.[h,cc]:
     36     - improved debug output
     37     - added RecursiveRemove member function
     38     - removed screen output from Remove function
     39     - call RecursiveRemove when something is removed from the list
     40
     41   * mbase/MStatusDisplay.h:
     42     - aaded a new enum kLastElement
     43
     44   * mbase/MTask.cc:
     45     - set kMustCleanup for fFilter
     46
     47   * mbase/MTaskList.cc:
     48     - added debugg code
     49
     50   * mfileio/MWriteRootFile.cc:
     51     - always set kMustCleanup when a TFile is created
     52     - make sure RecursiveRemove is called in the correct way
     53
     54   * mmain/MEventDisplay.h:
     55     - fixed the starting index for the first gui element
     56
     57   * msignal/MExtractor.cc:
     58     - added some initializations in the constructor suggested by
     59       valgrind
     60
     61   * mcalib/MCalibrateData.cc:
     62     - improved output
     63
    2064
    2165
  • trunk/MagicSoft/Mars/mbase/MContinue.cc

    r7808 r8642  
    131131        }
    132132
    133         *fLog << err << dbginf << "Unknown fatal Error! (fFilter=NULL?!?)" << endl;
    134         return kFALSE;
     133        *fLog << inf << "My filter has vanished... skipping." << endl;
     134        return kSKIP;
    135135    }
    136136
     
    153153    if (!fTaskList->AddToListBefore(GetFilter(), this))
    154154    {
    155         *fLog << err << dbginf << "ERROR - Adding filter before MContinue... abort." << endl;
     155        *fLog << err << dbginf << "ERROR - Adding filter before MContinue failed... abort." << endl;
    156156        return kFALSE;
    157157    }
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.cc

    r8011 r8642  
    102102// default constructor
    103103//
    104 MEvtLoop::MEvtLoop(const char *name) : fParList(NULL), fProgress(NULL)
     104MEvtLoop::MEvtLoop(const char *name) : fParList(NULL), fTaskList(NULL), fProgress(NULL)
    105105{
    106106    fName = name;
     
    11081108void MEvtLoop::RecursiveRemove(TObject *obj)
    11091109{
     1110    // If the tasklist was deleted... remove it
     1111    if (obj==fTaskList)
     1112        fTaskList = NULL;
     1113
     1114    // If the parlist was deleted...invalidate par- and tasklist
    11101115    if (obj==fParList)
    11111116    {
     
    11141119    }
    11151120
     1121    // if the progress bar was deleted...remove it
    11161122    if (obj==fProgress)
    11171123        fProgress = NULL;
    11181124
    1119     if (obj==fDisplay)
    1120         SetDisplay(NULL);
    1121 
    1122     if (obj==fLog)
    1123     {
    1124         if (fParList)
    1125             fParList->SetLogStream(NULL);
    1126         SetLogStream(NULL);
    1127     }
    1128 }
     1125    // If it was something else check par- and tasklist
     1126    if (fParList)
     1127        fParList->RecursiveRemove(obj);
     1128    else
     1129        if (fTaskList) // Note that the tasklist is included in the parlist
     1130            fTaskList->RecursiveRemove(obj);
     1131
     1132    // Now check for fDisplay and fLog
     1133    MParContainer::RecursiveRemove(obj);
     1134}
  • trunk/MagicSoft/Mars/mbase/MParContainer.cc

    r8218 r8642  
    7171#include "MLogManip.h"
    7272
     73#include "MStatusDisplay.h"
     74
    7375TList *gListOfPrimitives; // forard declaration in MParContainer.h
    7476
     
    116118        return;
    117119
    118     *fLog << all << "Deleting " << GetDescriptor() << endl;
     120    *fLog << all << "Deleting " << this << " " << GetDescriptor() << endl;
    119121    if (TestBit(kMustCleanup) && gROOT && gROOT->MustClean())
    120122    {
     
    921923    return ((TEnv&)env).GetValue(prefix, dflt);
    922924}
     925
     926// --------------------------------------------------------------------------
     927//
     928// If object to remove is fDisplay set fDisplay to NULL.
     929// If object to remove is fLog     set fLog     to NULL.
     930// Call TObject::RecursiveRemove
     931//
     932void MParContainer::RecursiveRemove(TObject *obj)
     933{
     934    if (obj==fDisplay)
     935        fDisplay=NULL;
     936
     937    if (obj==fLog)
     938        fLog=NULL;
     939
     940    if (fDisplay)
     941        fDisplay->RecursiveRemove(obj);
     942
     943    if (fLog)
     944        fLog->RecursiveRemove(obj);
     945
     946    TObject::RecursiveRemove(obj);
     947}
     948
  • trunk/MagicSoft/Mars/mbase/MParContainer.h

    r7804 r8642  
    146146    MParContainer *GetNewObject(const char *name, TClass *base=MParContainer::Class()) const;
    147147
     148    void RecursiveRemove(TObject *obj);
     149
    148150    ClassDef(MParContainer, 0)  //The basis for all parameter containers
    149151};
  • trunk/MagicSoft/Mars/mbase/MParList.cc

    r8218 r8642  
    312312
    313313    TObject *obj = fContainer->Remove(cont);
    314     if (!obj)
    315     {
    316         *fLog << warn << "Object not found in list..." << endl;
    317         return;
    318     }
    319 
    320     *fLog << inf << "MParContainer '" << cont->GetName() << "' removed..." << endl;
    321 
    322     if (IsOwner() && !fAutodelete->FindObject(obj))
     314
     315    fContainer->RecursiveRemove(obj);
     316
     317    // if (!obj)
     318    // {
     319        //        *fLog << warn << "Object not found in list..." << endl;
     320    //    return;
     321    //}
     322
     323//    *fLog << inf << "MParContainer '" << cont->GetName() << "' removed..." << endl;
     324
     325    if (obj && IsOwner() && !fAutodelete->FindObject(obj))
    323326        delete obj;
     327}
     328
     329// --------------------------------------------------------------------------
     330//
     331// Call MParContainer::RecursiveRemove
     332// Call fContainer->RecursiveRemove
     333//
     334void MParList::RecursiveRemove(TObject *obj)
     335{
     336    MParContainer::RecursiveRemove(obj);
     337
     338    if (obj==fContainer)
     339        fContainer = NULL;
     340
     341    if (fContainer)
     342        fContainer->RecursiveRemove(obj);
    324343}
    325344
  • trunk/MagicSoft/Mars/mbase/MParList.h

    r7804 r8642  
    8686    }
    8787
     88    void RecursiveRemove(TObject *obj);
     89
    8890    void Reset();
    8991    void SetReadyToSave(Bool_t flag=kTRUE);
  • trunk/MagicSoft/Mars/mbase/MStatusDisplay.h

    r7827 r8642  
    6666        kPicMagic, kPicMars,
    6767        // kGui
    68         kSearch, kTabs
     68        kSearch, kTabs,
     69        // kLastElement
     70        kLastElement
    6971    } Status_t;
    7072
  • trunk/MagicSoft/Mars/mbase/MTask.cc

    r8426 r8642  
    147147{
    148148    fFilter=filter;
    149     if (filter)
    150         AddToBranchList(filter->GetDataMember());
     149    if (!filter)
     150        return;
     151
     152    fFilter->SetBit(kMustCleanup);    // Better is better ;-)
     153    AddToBranchList(filter->GetDataMember());
    151154}
    152155
     
    557560    *fLog << "%) Evts skipped: " << str << endl;
    558561}
     562
     563// --------------------------------------------------------------------------
     564//
     565// If obj==fFilter set fFilter to NULL
     566// Call MParcontainer::RecursiveRemove
     567//
     568void MTask::RecursiveRemove(TObject *obj)
     569{
     570    if (obj==fFilter)
     571        fFilter=NULL;
     572
     573    if (fFilter)
     574        fFilter->RecursiveRemove(obj);
     575
     576    MParContainer::RecursiveRemove(obj);
     577}
  • trunk/MagicSoft/Mars/mbase/MTask.h

    r7804 r8642  
    123123    void SavePrimitive(ofstream &out, Option_t *o="");
    124124
     125    // TObject
     126    void RecursiveRemove(TObject *obj);
     127
    125128    ClassDef(MTask, 2) //Abstract base class for a task
    126129};
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r8618 r8642  
    1818!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2004
     20!   Copyright: MAGIC Software Development, 2000-2007
    2121!
    2222!
     
    8080using namespace std;
    8181
     82//#define DEBUG_PROCESS
     83#undef DEBUG_PROCESS
     84
    8285const TString MTaskList::gsDefName  = "MTaskList";
    8386const TString MTaskList::gsDefTitle = "A list for tasks to be executed";
     
    8992// this name in the parameter list (by MEvtLoop::SetParList)
    9093//
    91 MTaskList::MTaskList(const char *name, const char *title) : fNumPasses(0), fNumPass(0)
     94MTaskList::MTaskList(const char *name, const char *title) : fTasks(0), fParList(0), fNumPasses(0), fNumPass(0)
    9295{
    9396    fName  = name  ? name  : gsDefName.Data();
     
    465468void MTaskList::Remove(MTask *task)
    466469{
     470    if (!task)
     471        return;
     472
     473    // First remove it from the list(s) so that a later RecursiveRemove
     474    // cannot fint the task again
    467475    TObject *obj = fTasks->Remove(task);
    468476
    469     if (TestBit(kIsOwner))
     477    // Now do a recursive remove on all other tasks.
     478    fTasks->RecursiveRemove(task);
     479
     480    if (obj && TestBit(kIsOwner))
    470481        delete obj;
     482}
     483
     484// --------------------------------------------------------------------------
     485//
     486// Call MTask::RecursiveRemove
     487// Call fTasks->RecursiveRemove
     488//
     489void MTaskList::RecursiveRemove(TObject *obj)
     490{
     491    MTask::RecursiveRemove(obj);
     492
     493    if (obj==fTasks)
     494        fTasks=NULL;
     495
     496    if (fTasks)
     497    {
     498        fTasks->RecursiveRemove(obj);
     499
     500        // In theory this call is obsolete
     501        fTasksProcess.RecursiveRemove(obj);
     502    }
    471503}
    472504
     
    620652    MTask *task=NULL;
    621653
     654#ifdef DEBUG_PROCESS
     655    *fLog << all << "ProcessTaskList - " << GetDescriptor() << " - start." << endl;
     656#endif
     657
    622658    //
    623659    // loop over all tasks for processing
     
    626662    while ( (task=(MTask*)Next()) )
    627663    {
     664#ifdef DEBUG_PROCESS
     665        *fLog << all << "Process - " << (void*)task << " " << flush;
     666        *fLog << task->GetDescriptor() << "... " << flush;
     667#endif
    628668        //
    629669        // if the task has the wrong stream id skip it.
     
    646686            // everything was OK: go on with the next task
    647687            //
     688#ifdef DEBUG_PROCESS
     689            *fLog << "true." << endl;
     690#endif
    648691            continue;
    649692
     
    668711            // something occured: skip the rest of the tasks for this event
    669712            //
     713#ifdef DEBUG_PROCESS
     714            *fLog << "continue." << endl;
     715#endif
    670716            rc = kCONTINUE;
    671717            break;
     
    677723        break;
    678724    }
     725
     726#ifdef DEBUG_PROCESS
     727    *fLog << all << "ProcessTaskList - " << GetDescriptor() << " - done." << endl;
     728#endif
    679729
    680730    return rc;
  • trunk/MagicSoft/Mars/mbase/MTaskList.h

    r8618 r8642  
    9797    Bool_t WriteEnv(TEnv &env, TString prefix, Bool_t print=kFALSE) const;
    9898
     99    void   RecursiveRemove(TObject *obj);
     100
    99101    operator TIterator*() const;
    100102
  • trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc

    r8484 r8642  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MCalibrateData.cc,v 1.69 2007-05-10 12:14:54 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MCalibrateData.cc,v 1.70 2007-07-18 19:30:12 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    668668            *fLog << warn << GetDescriptor() << ": ";
    669669            *fLog << "Conv.factor " << calibConv << " of Pixel " << pixidx << " out of range ]";
    670             *fLog << fCalibConvMinLimit << "," << fCalibConvMaxLimit << "[... set to 0. " << endl;
     670            *fLog << fCalibConvMinLimit << "," << fCalibConvMaxLimit << "[... set unsuitable. " << endl;
    671671          }
    672672
  • trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc

    r8133 r8642  
    101101    //fTrees.SetOwner();
    102102
    103     gROOT->GetListOfCleanups()->Add(this); // To remove fDisplay
    104     SetBit(kMustCleanup);
     103    gROOT->GetListOfCleanups()->Add(this); // To remove fOut if deleted
    105104}
    106105
     
    133132
    134133        file->SetOption(option); // IMPORTANT!
     134        file->SetBit(kMustCleanup);
    135135        ResetBit(kIsNotOwner);
    136136        return file;
     
    227227    {
    228228        fOut = new TFile("/dev/null", "READ", ftitle, comp);
     229        fOut->SetBit(kMustCleanup);
    229230        return;
    230231    }
     
    10711072}
    10721073
     1074// --------------------------------------------------------------------------
     1075//
     1076// If the output file is deleted set fOut to NULL.
     1077// Call MTask::RecursiveRemove
     1078//
    10731079void MWriteRootFile::RecursiveRemove(TObject *obj)
    10741080{
    10751081    if (obj==fOut)
    1076         fOut=0;
     1082        fOut=NULL;
     1083
     1084    MWriteFile::RecursiveRemove(obj);
    10771085}
    10781086
  • trunk/MagicSoft/Mars/mmain/MEventDisplay.h

    r8632 r8642  
    1919    enum
    2020    {
    21         kEvtPrev = MStatusDisplay::kSearch + 1,
     21        kEvtPrev = MStatusDisplay::kLastElement + 1,
    2222        kEvtNext,
    2323        kEvtNumber,
  • trunk/MagicSoft/Mars/msignal/MExtractor.cc

    r8585 r8642  
    136136    : fResolutionPerPheHiGain(0), fResolutionPerPheLoGain(0),
    137137    fSignals(NULL), fRawEvt(NULL), fRunHeader(NULL), fSignal(NULL),
    138     fNumHiGainSamples(0), fNumLoGainSamples(0)
     138    fLoGainLast(0), fNumHiGainSamples(0), fNumLoGainSamples(0)
    139139{
    140140    fName  = name  ? name  : "MExtractor";
Note: See TracChangeset for help on using the changeset viewer.