Changeset 19760


Ignore:
Timestamp:
10/11/19 19:22:02 (5 years ago)
Author:
tbretz
Message:
They are added to the ListOfCleanups. This is implemented as a THashTable. According to the root documentation, it is required to rehash the table whenever the name of an object in the table changes. This is now guranteed if name change happens via SetName
Location:
trunk/Mars
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/mbase/MEvtLoop.cc

    r19359 r19760  
    7979#include <TDatime.h>        // TDatime
    8080#include <TSystem.h>        // gSystem
     81#include <THashList.h>
    8182#include <TStopwatch.h>
    8283#include <TGProgressBar.h> 
     
    123124        fParList = 0;
    124125    }
     126}
     127
     128void MEvtLoop::SetName(const char *name)
     129{
     130    MParContainer::SetName(name);
     131
     132    // From the documentation of THashList::THashList
     133    //
     134    // WARNING !!!
     135    // If the name of an object in the HashList is modified, The hashlist
     136    // must be Rehashed
     137    //
     138    auto table = dynamic_cast<THashList*>(gROOT->GetListOfCleanups());
     139    if (table)
     140        table->Rehash(THashList::kInitHashTableCapacity);
    125141}
    126142
  • trunk/Mars/mbase/MEvtLoop.h

    r14449 r19760  
    5151    virtual ~MEvtLoop();
    5252
     53    void       SetName(const char *name);
     54
    5355    void       SetParList(MParList *p);
    5456    MParList  *GetParList() const  { return fParList; }
  • trunk/Mars/mbase/MStatusArray.cc

    r14888 r19760  
    5252#include <TPaveText.h>        // For the TPaveText workaround
    5353
     54#include <THashList.h>
     55
    5456#include "MLog.h"
    5557#include "MLogManip.h"
     
    7880static void *ptr = 0;
    7981#endif
     82
     83void MStatusArray::SetName(const char *name)
     84{
     85    TObjArray::SetName(name);
     86
     87    // From the documentation of THashList::THashList
     88    //
     89    // WARNING !!!
     90    // If the name of an object in the HashList is modified, The hashlist
     91    // must be Rehashed
     92    //
     93    auto table = dynamic_cast<THashList*>(gROOT->GetListOfCleanups());
     94    if (table)
     95        table->Rehash(THashList::kInitHashTableCapacity);
     96}
    8097
    8198// --------------------------------------------------------------------------
  • trunk/Mars/mbase/MStatusArray.h

    r9580 r19760  
    3333    MStatusArray(const MStatusDisplay &d);
    3434    ~MStatusArray();
     35
     36    void SetName(const char *name);
    3537
    3638    TObject *DisplayIn(Option_t *o=0) const;         // *MENU*
  • trunk/Mars/mdata/MDataPhrase.cc

    r19345 r19760  
    115115#include <TPRegexp.h>
    116116#include <TFormula.h>
     117#include <THashList.h>
    117118#if ROOT_VERSION_CODE >= ROOT_VERSION(5,26,00)
    118119#if ROOT_VERSION_CODE < ROOT_VERSION(6,00,00)
     
    533534}
    534535
     536void MDataPhrase::SetName(const char *name)
     537{
     538    MData::SetName(name);
     539
     540    // Some code produces crashed with root 6 (6.14 and 6.18 tested)
     541    //
     542    //    MParameterCalc calc("MCorsikaEvtHeader.fZd");
     543    //    MContinue cont("MPhotonEvent.GetNumPhotons<2");
     544    //    MTaskList tasks;
     545    //    tasks.AddToList(&calc);
     546    //    tasks.AddToList(&cont);
     547    //    MEnv env("ceres.rc");
     548    //    if (!tasks.ReadEnv(env, "", kFALSE))
     549    //        return kFALSE;
     550    //
     551
     552    // From the documentation of THashList::THashList
     553    //
     554    // WARNING !!!
     555    // If the name of an object in the HashList is modified, The hashlist
     556    // must be Rehashed
     557    //
     558    auto table = dynamic_cast<THashList*>(gROOT->GetListOfCleanups());
     559    if (table)
     560        table->Rehash(THashList::kInitHashTableCapacity);
     561}
     562
     563
    535564// --------------------------------------------------------------------------
    536565//
  • trunk/Mars/mdata/MDataPhrase.h

    r19334 r19760  
    3737    void     Clear(Option_t *o="");
    3838    void     RecursiveRemove(TObject *obj);
     39    void     SetName(const char *name);
    3940
    4041    // MParContainer
  • trunk/Mars/mfileio/MWriteRootFile.cc

    r17867 r19760  
    6666#include <TTree.h>
    6767#include <TPRegexp.h>
     68#include <THashList.h>
    6869
    6970#include "MLog.h"
     
    324325{
    325326    Close();
     327}
     328
     329void MWriteRootFile::SetName(const char *name)
     330{
     331    MWriteFile::SetName(name);
     332
     333    // From the documentation of THashList::THashList
     334    //
     335    // WARNING !!!
     336    // If the name of an object in the HashList is modified, The hashlist
     337    // must be Rehashed
     338    //
     339    auto table = dynamic_cast<THashList*>(gROOT->GetListOfCleanups());
     340    if (table)
     341        table->Rehash(THashList::kInitHashTableCapacity);
    326342}
    327343
  • trunk/Mars/mfileio/MWriteRootFile.h

    r19722 r19760  
    130130    ~MWriteRootFile();
    131131
     132    void SetName(const char *name);
     133
    132134    void AddContainer(const char *cname,   const char *tname=NULL, Bool_t must=kTRUE, Long64_t max=-1);
    133135    void AddContainer(MParContainer *cont, const char *tname=NULL, Bool_t must=kTRUE, Long64_t max=-1);
Note: See TracChangeset for help on using the changeset viewer.