Skip to content

Commit 8640519

Browse files
committed
[RF] Remove all RooDirItem::appendToDir calls.
In view of ROOT 7, I studied the effects of RooDirItem-derived classes. Since at least 5 years, RooDataHist, RooDataSet and RooFitResult were calling RooDirItem::appendToDir(this, true). This has no effect, since forceMemoryResident==true. Here, all these calls that don't have any effect are removed to make more obvious that no automatic registration is happening.
1 parent dfff5f9 commit 8640519

File tree

3 files changed

+9
-30
lines changed

3 files changed

+9
-30
lines changed

roofit/roofitcore/src/RooDataHist.cxx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ RooDataHist::RooDataHist(RooStringView name, RooStringView title, const RooArgSe
124124

125125
registerWeightArraysToDataStore();
126126

127-
appendToDir(this,true) ;
128127
TRACE_CREATE;
129128
}
130129

@@ -354,9 +353,7 @@ RooDataHist::RooDataHist(RooStringView name, RooStringView title, const RooArgLi
354353
} else {
355354

356355
// Initialize empty
357-
initialize() ;
358-
appendToDir(this,true) ;
359-
356+
initialize();
360357
}
361358

362359
registerWeightArraysToDataStore();
@@ -377,8 +374,7 @@ void RooDataHist::importTH1(const RooArgList& vars, const TH1& histo, double wgt
377374
adjustBinning(vars, histo, offset) ;
378375

379376
// Initialize internal data structure
380-
initialize() ;
381-
appendToDir(this,true) ;
377+
initialize();
382378

383379
// Define x,y,z as 1st, 2nd and 3rd observable
384380
RooRealVar* xvar = static_cast<RooRealVar*>(_vars.find(vars.at(0)->GetName())) ;
@@ -533,9 +529,8 @@ void RooDataHist::importTH1Set(const RooArgList& vars, RooCategory& indexCat, st
533529

534530
// Initialize internal data structure
535531
if (!init) {
536-
initialize() ;
537-
appendToDir(this,true) ;
538-
init = true ;
532+
initialize();
533+
init = true;
539534
}
540535

541536
// Define x,y,z as 1st, 2nd and 3rd observable
@@ -644,7 +639,6 @@ void RooDataHist::importDHistSet(const RooArgList & /*vars*/, RooCategory &index
644639
}
645640

646641
initialize();
647-
appendToDir(this, true);
648642

649643
for (const auto &diter : dmap) {
650644
std::string const &label = diter.first;
@@ -904,8 +898,6 @@ RooDataHist::RooDataHist(const RooDataHist& other, const char* newname) :
904898
}
905899

906900
registerWeightArraysToDataStore();
907-
908-
appendToDir(this,true) ;
909901
}
910902

911903

roofit/roofitcore/src/RooDataSet.cxx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,6 @@ RooDataSet::RooDataSet(RooStringView name, RooStringView title, const RooArgSet&
374374
}
375375
}
376376

377-
appendToDir(this,true) ;
378-
379377
// Initialize RooDataSet with optional weight variable
380378
initialize(nullptr) ;
381379

@@ -450,8 +448,6 @@ RooDataSet::RooDataSet(RooStringView name, RooStringView title, const RooArgSet&
450448
}
451449
}
452450

453-
appendToDir(this,true) ;
454-
455451
// Initialize RooDataSet with optional weight variable
456452
initialize(wgtVarName);
457453

@@ -523,12 +519,10 @@ RooDataSet::RooDataSet(RooStringView name, RooStringView title, const RooArgSet&
523519
RooDataSet::RooDataSet(RooDataSet const & other, const char* newname) :
524520
RooAbsData(other,newname), RooDirItem()
525521
{
526-
appendToDir(this,true) ;
527-
initialize(other._wgtVar?other._wgtVar->GetName():nullptr);
528-
TRACE_CREATE;
522+
initialize(other._wgtVar ? other._wgtVar->GetName() : nullptr);
523+
TRACE_CREATE;
529524
}
530525

531-
532526
////////////////////////////////////////////////////////////////////////////////
533527
/// Return an empty clone of this dataset. If vars is not null, only the variables in vars
534528
/// are added to the definition of the empty clone

roofit/roofitcore/src/RooFitResult.cxx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,7 @@ using std::ostream, std::string, std::pair, std::vector, std::setw;
6161
////////////////////////////////////////////////////////////////////////////////
6262
/// Constructor with name and title
6363

64-
RooFitResult::RooFitResult(const char *name, const char *title) : TNamed(name, title)
65-
{
66-
if (name)
67-
appendToDir(this, true);
68-
}
69-
64+
RooFitResult::RooFitResult(const char *name, const char *title) : TNamed(name, title) {}
7065

7166
////////////////////////////////////////////////////////////////////////////////
7267
/// Copy constructor
@@ -99,10 +94,8 @@ RooFitResult::RooFitResult(const RooFitResult &other)
9994
_Lt = std::make_unique<TMatrix>(*other._Lt);
10095
if (other._VM) _VM = new TMatrixDSym(*other._VM) ;
10196
if (other._CM) _CM = new TMatrixDSym(*other._CM) ;
102-
if (other._GC) _GC = new TVectorD(*other._GC) ;
103-
104-
if (GetName())
105-
appendToDir(this, true);
97+
if (other._GC)
98+
_GC = new TVectorD(*other._GC);
10699
}
107100

108101

0 commit comments

Comments
 (0)