Changeset 19760 for trunk/Mars/mdata


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/mdata
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.