Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions roofit/roofitcore/inc/RooAbsReal.h
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,9 @@ class RooAbsReal : public RooAbsArg {

virtual RooPlot *plotAsymOn(RooPlot *frame, const RooAbsCategoryLValue& asymCat, PlotOpt o) const;

virtual std::unique_ptr<RooAbsReal>
createAsymmetryComponent(const RooAbsCategoryLValue &asymCat, const RooAbsCategoryLValue &asymCatState) const;

bool matchArgsByName(const RooArgSet &allArgs, RooArgSet &matchedArgs, const TList &nameList) const;

bool redirectServersHook(const RooAbsCollection & newServerList, bool mustReplaceAll,
Expand Down
3 changes: 3 additions & 0 deletions roofit/roofitcore/inc/RooSimultaneous.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ class RooSimultaneous : public RooAbsPdf {
void selectNormalization(const RooArgSet* depSet=nullptr, bool force=false) override ;
void selectNormalizationRange(const char* rangeName=nullptr, bool force=false) override ;

std::unique_ptr<RooAbsReal>
createAsymmetryComponent(const RooAbsCategoryLValue &asymCat, const RooAbsCategoryLValue &asymCatState) const override;

RooArgSet const& flattenedCatList() const;

mutable RooSetProxy _plotCoefNormSet ;
Expand Down
12 changes: 0 additions & 12 deletions roofit/roofitcore/src/RooAbsOptTestStatistic.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ void RooAbsOptTestStatistic::initSlave(RooAbsReal& real, RooAbsData& indata, con
// Copy data and strip entries lost by adjusted fit range, _dataClone ranges will be copied from realDepSet ranges
if (rangeName && strlen(rangeName)) {
_dataClone = std::unique_ptr<RooAbsData>{indata.reduce(RooFit::SelectVars(*_funcObsSet),RooFit::CutRange(rangeName))}.release();
// std::cout << "RooAbsOptTestStatistic: reducing dataset to fit in range named " << rangeName << " resulting dataset has " << _dataClone->sumEntries() << " events" << std::endl ;
} else {
_dataClone = static_cast<RooAbsData*>(indata.Clone()) ;
}
Expand Down Expand Up @@ -432,9 +431,6 @@ void RooAbsOptTestStatistic::constOptimizeTestStatistic(ConstOpCode opcode, bool
hasWarned = true;
}

// std::cout << "ROATS::constOpt(" << GetName() << ") funcClone structure dump BEFORE const-opt" << std::endl ;
// _funcClone->Print("t") ;

RooAbsTestStatistic::constOptimizeTestStatistic(opcode,doAlsoTrackingOpt);
if (operMode()!=Slave) return ;

Expand Down Expand Up @@ -489,8 +485,6 @@ void RooAbsOptTestStatistic::constOptimizeTestStatistic(ConstOpCode opcode, bool
break ;
}

// std::cout << "ROATS::constOpt(" << GetName() << ") funcClone structure dump AFTER const-opt" << std::endl ;
// _funcClone->Print("t") ;
}


Expand All @@ -506,8 +500,6 @@ void RooAbsOptTestStatistic::constOptimizeTestStatistic(ConstOpCode opcode, bool

void RooAbsOptTestStatistic::optimizeCaching()
{
// std::cout << "RooAbsOptTestStatistic::optimizeCaching(" << GetName() << "," << this << ")" << std::endl ;

// Trigger create of all object caches now in nodes that have deferred object creation
// so that cache contents can be processed immediately
_funcClone->getVal(_normSet) ;
Expand Down Expand Up @@ -657,13 +649,9 @@ bool RooAbsOptTestStatistic::setDataSlave(RooAbsData& indata, bool cloneData, bo
{

if (operMode()==SimMaster) {
//cout << "ROATS::setDataSlave() ERROR this is SimMaster _funcClone = " << _funcClone << std::endl ;
return false ;
}

//cout << "ROATS::setDataSlave() new dataset size = " << indata.numEntries() << std::endl ;
//indata.Print("v") ;


// If the current dataset is owned, transfer the ownership to unique pointer
// that will get out of scope at the end of this function. We can't delete it
Expand Down
44 changes: 33 additions & 11 deletions roofit/roofitcore/src/RooAbsReal.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2203,6 +2203,12 @@ RooPlot* RooAbsReal::plotAsymOn(RooPlot *frame, const RooAbsCategoryLValue& asym
}
}

// The asymmetry category itself defines the two sides of the asymmetry, so it
// must not be treated as a variable to be averaged over the projection data.
if (RooAbsArg *asymCatInProjData = projDataVars.find(asymCat.GetName())) {
projDataVars.remove(*asymCatInProjData) ;
}

// Must depend on asymCat
if (!dependsOn(asymCat)) {
coutE(Plotting) << "RooAbsReal::plotAsymOn(" << GetName()
Expand Down Expand Up @@ -2273,28 +2279,29 @@ RooPlot* RooAbsReal::plotAsymOn(RooPlot *frame, const RooAbsCategoryLValue& asym
}


// Customize two copies of projection with fixed negative and positive asymmetry
// Build two copies of the function with the asymmetry category fixed to its
// negative and positive state. By default these are copies with the category
// pinned via a RooCustomizer, but subclasses (RooSimultaneous) can provide a
// more suitable construction.
std::unique_ptr<RooAbsCategoryLValue> asymPos{static_cast<RooAbsCategoryLValue*>(asymCat.Clone("asym_pos"))};
std::unique_ptr<RooAbsCategoryLValue> asymNeg{static_cast<RooAbsCategoryLValue*>(asymCat.Clone("asym_neg"))};
asymPos->setIndex(1) ;
asymNeg->setIndex(-1) ;
RooCustomizer custPos{*this,"pos"};
RooCustomizer custNeg{*this,"neg"};
//custPos->setOwning(true) ;
//custNeg->setOwning(true) ;
custPos.replaceArg(asymCat,*asymPos) ;
custNeg.replaceArg(asymCat,*asymNeg) ;
std::unique_ptr<RooAbsReal> funcPos{static_cast<RooAbsReal*>(custPos.build())};
std::unique_ptr<RooAbsReal> funcNeg{static_cast<RooAbsReal*>(custNeg.build())};
std::unique_ptr<RooAbsReal> funcPos = createAsymmetryComponent(asymCat, *asymPos);
std::unique_ptr<RooAbsReal> funcNeg = createAsymmetryComponent(asymCat, *asymNeg);

// Create projection integral
RooArgSet *posProjCompList;
RooArgSet *negProjCompList;

// Add projDataVars to normalized dependents of projection
// This is needed only for asymmetries (why?)
RooArgSet depPos(*plotVar,*asymPos) ;
RooArgSet depNeg(*plotVar,*asymNeg) ;
RooArgSet depPos(*plotVar) ;
RooArgSet depNeg(*plotVar) ;
// Keep the fixed asymmetry category in the normalization set only if the
// component function actually depends on it (i.e. it was pinned in place).
if (funcPos->dependsOn(*asymPos)) depPos.add(*asymPos) ;
if (funcNeg->dependsOn(*asymNeg)) depNeg.add(*asymNeg) ;
depPos.add(projDataVars) ;
depNeg.add(projDataVars) ;

Expand Down Expand Up @@ -2413,6 +2420,21 @@ RooPlot* RooAbsReal::plotAsymOn(RooPlot *frame, const RooAbsCategoryLValue& asym
}


////////////////////////////////////////////////////////////////////////////////
/// Build the component function of an asymmetry plot (see plotAsymOn()) that
/// corresponds to a fixed state of the asymmetry category. The default
/// implementation returns a copy of this function with the asymmetry category
/// pinned to the requested state via a RooCustomizer.

std::unique_ptr<RooAbsReal>
RooAbsReal::createAsymmetryComponent(const RooAbsCategoryLValue &asymCat, const RooAbsCategoryLValue &asymCatState) const
{
RooCustomizer cust{*this, asymCatState.GetName()};
cust.replaceArg(asymCat, asymCatState);
return std::unique_ptr<RooAbsReal>{static_cast<RooAbsReal *>(cust.build())};
}



////////////////////////////////////////////////////////////////////////////////
/// \brief Propagates parameter uncertainties to an uncertainty estimate for this RooAbsReal.
Expand Down
7 changes: 0 additions & 7 deletions roofit/roofitcore/src/RooChangeTracker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,9 @@ bool RooChangeTracker::hasChanged(bool clearState)

if (clearState) {
// Clear dirty flag by calling getVal()
//cout << "RooChangeTracker(" << GetName() << ") clearing isValueDirty" << std::endl ;
clearValueDirty() ;
}

//cout << "RooChangeTracker(" << GetName() << ") isValueDirty = true, returning true" << std::endl ;

return true ;
}

Expand All @@ -131,7 +128,6 @@ bool RooChangeTracker::hasChanged(bool clearState)
for (unsigned int i=0; i < _realSet.size(); ++i) {
auto real = static_cast<const RooAbsReal*>(_realSet.at(i));
if (real->getVal() != _realRef[i]) {
// std::cout << "RooChangeTracker(" << this << "," << GetName() << ") value of " << real->GetName() << " has changed from " << _realRef[i] << " to " << real->getVal() << " clearState = " << (clearState?"T":"F") << std::endl ;
valuesChanged = true ;
_realRef[i] = real->getVal() ;
}
Expand All @@ -140,7 +136,6 @@ bool RooChangeTracker::hasChanged(bool clearState)
for (unsigned int i=0; i < _catSet.size(); ++i) {
auto cat = static_cast<const RooAbsCategory*>(_catSet.at(i));
if (cat->getCurrentIndex() != _catRef[i]) {
// std::cout << "RooChangeTracker(" << this << "," << GetName() << ") value of " << cat->GetName() << " has changed from " << _catRef[i-1] << " to " << cat->getIndex() << std::endl ;
valuesChanged = true ;
_catRef[i] = cat->getCurrentIndex() ;
}
Expand All @@ -154,8 +149,6 @@ bool RooChangeTracker::hasChanged(bool clearState)
_init = true ;
}

// std::cout << "RooChangeTracker(" << GetName() << ") returning " << (valuesChanged?"T":"F") << std::endl ;

return valuesChanged ;

} else {
Expand Down
8 changes: 0 additions & 8 deletions roofit/roofitcore/src/RooConvIntegrandBinding.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ void RooConvIntegrandBinding::loadValues(const double xvector[], bool clipInvali
if (clipInvalid && !_vars[index]->isValidReal(xvector[index])) {
_xvecValid = false ;
} else {
//cout << "RooConvBasBinding::loadValues[" << index << "] loading value " << xvector[index] << std::endl ;
_vars[index]->setVal(xvector[index]);
}
}
Expand All @@ -131,7 +130,6 @@ double RooConvIntegrandBinding::operator()(const double xvector[]) const
// First evaluate function at x'
loadValues(xvector);
if (!_xvecValid) return 0 ;
//cout << "RooConvIntegrandBinding::operator(): evaluating f(x') at x' = " << xvector[0] << std::endl ;
double f_xp = _func->getVal(_nset) ;

// Next evaluate model at x-x'
Expand All @@ -140,12 +138,6 @@ double RooConvIntegrandBinding::operator()(const double xvector[]) const
if (!_xvecValid) return 0 ;
double g_xmxp = _model->getVal(_nset) ;

//cout << "RooConvIntegrandBinding::operator(): evaluating g(x-x') at x-x' = " << _vars[0]->getVal() << " = " << g_xmxp << std::endl ;
//cout << "RooConvIntegrandBinding::operator(): return value = " << f_xp << " * " << g_xmxp << " = " << f_xp*g_xmxp << std::endl ;

//cout << "_vars[0] = " << _vars[0]->getVal() << " _vars[1] = " << _vars[1]->getVal() << std::endl ;
//cout << "_xvec[0] = " << xvector[0] << " _xvec[1] = " << xvector[1] << std::endl ;

return f_xp*g_xmxp ;
}

Expand Down
7 changes: 0 additions & 7 deletions roofit/roofitcore/src/RooHistFunc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,6 @@ std::list<double>* RooHistFunc::binBoundaries(RooAbsRealLValue& obs, double xlo,
}
}

// std::cout << "RooHistFunc::bb(" << GetName() << ") histObs = " << _histObsList << std::endl ;
// std::cout << "RooHistFunc::bb(" << GetName() << ") pdfObs = " << _depList << std::endl ;

RooAbsRealLValue* transform = nullptr;
if (!hobs) {

Expand All @@ -377,9 +374,6 @@ std::list<double>* RooHistFunc::binBoundaries(RooAbsRealLValue& obs, double xlo,
}


// std::cout << "hobs = " << hobs->GetName() << std::endl ;
// std::cout << "transform = " << (transform?transform->GetName():"<none>") << std::endl ;

// Check that observable is in dataset, if not no hint is generated
RooAbsArg* xtmp = _dataHist->get()->find(hobs->GetName()) ;
if (!xtmp) {
Expand Down Expand Up @@ -409,7 +403,6 @@ std::list<double>* RooHistFunc::binBoundaries(RooAbsRealLValue& obs, double xlo,
double boundary = boundaries[i] ;
if (transform) {
transform->setVal(boundary) ;
//cout << "transform bound " << boundary << " using " << transform->GetName() << " result " << obs.getVal() << std::endl ;
hint->push_back(obs.getVal()) ;
} else {
hint->push_back(boundary) ;
Expand Down
6 changes: 0 additions & 6 deletions roofit/roofitcore/src/RooLinkedList.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ namespace RooLinkedListImplDetails {
_sz(sz), _free(capacity()),
_chunk(new RooLinkedListElem[_free]), _freelist(_chunk)
{
//cout << "RLLID::Chunk ctor(" << this << ") of size " << _free << " list elements" << std::endl ;
// initialise free list
for (Int_t i = 0; i < _free; ++i)
_chunk[i]._next = (i + 1 < _free) ? &_chunk[i + 1] : nullptr;
Expand Down Expand Up @@ -285,7 +284,6 @@ RooLinkedList::RooLinkedList(const RooLinkedList& other) :
}

////////////////////////////////////////////////////////////////////////////////
/// std::cout << "RooLinkedList::createElem(" << this << ") obj = " << obj << " elem = " << elem << std::endl ;

RooLinkedListElem* RooLinkedList::createElement(TObject* obj, RooLinkedListElem* elem)
{
Expand Down Expand Up @@ -426,7 +424,6 @@ void RooLinkedList::Add(TObject* arg, Int_t refCount)
}

if (_htableName){
//cout << "storing link " << _last << " with hash arg " << arg << std::endl ;
_htableName->insert({arg->GetName(), arg});
_htableLink->insert({arg, reinterpret_cast<TObject *>(_last)});
}
Expand Down Expand Up @@ -609,7 +606,6 @@ TObject* RooLinkedList::find(const char* name) const
if (_useNptr) {
// See if it might have been renamed
const TNamed* nptr= RooNameReg::known(name);
//cout << "RooLinkedList::find: possibly renamed '" << name << "', kRenamedArg=" << (nptr&&nptr->TestBit(RooNameReg::kRenamedArg)) << std::endl;
if (nptr && nptr->TestBit(RooNameReg::kRenamedArg)) {
RooLinkedListElem* ptr = _first ;
while(ptr) {
Expand All @@ -622,7 +618,6 @@ TObject* RooLinkedList::find(const char* name) const
}
return nullptr ;
}
//cout << "RooLinkedList::find: possibly renamed '" << name << "'" << std::endl;
}

RooLinkedListElem* ptr = _first ;
Expand Down Expand Up @@ -661,7 +656,6 @@ RooAbsArg* RooLinkedList::findArg(const RooAbsArg* arg) const
if (_htableName) {
RooAbsArg* a = const_cast<RooAbsArg *>(static_cast<RooAbsArg const*>((*_htableName)[arg->GetName()]));
if (a) return a;
//cout << "RooLinkedList::findArg: possibly renamed '" << arg->GetName() << "', kRenamedArg=" << arg->namePtr()->TestBit(RooNameReg::kRenamedArg) << std::endl;
// See if it might have been renamed
if (!arg->namePtr()->TestBit(RooNameReg::kRenamedArg)) return nullptr;
}
Expand Down
8 changes: 0 additions & 8 deletions roofit/roofitcore/src/RooParamBinning.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -73,28 +73,23 @@ RooParamBinning::~RooParamBinning()

////////////////////////////////////////////////////////////////////////////////
/// Copy constructor
/// std::cout << "RooParamBinning::cctor(" << this << ") orig = " << &other << std::endl ;

RooParamBinning::RooParamBinning(const RooParamBinning &other, const char *name) : RooAbsBinning(name)
{

if (other._lp) {
// std::cout << "RooParamBinning::cctor(this = " << this << ") taking addresses from orig ListProxy" << std::endl ;
_xlo = static_cast<RooAbsReal*>(other._lp->at(0)) ;
_xhi = static_cast<RooAbsReal*>(other._lp->at(1)) ;

} else {

// std::cout << "RooParamBinning::cctor(this = " << this << ") taking addresses from orig pointers " << other._xlo << " " << other._xhi << std::endl ;

_xlo = other._xlo ;
_xhi = other._xhi ;
}

_nbins = other._nbins ;
_lp = nullptr ;

//cout << "RooParamBinning::cctor(this = " << this << " xlo = " << &_xlo << " xhi = " << &_xhi << " _lp = " << _lp << " owner = " << _owner << ")" << std::endl ;
}


Expand All @@ -110,14 +105,11 @@ void RooParamBinning::insertHook(RooAbsRealLValue& owner) const
_owner = &owner ;

// If list proxy already exists update pointers from proxy
// std::cout << "RooParamBinning::insertHook(" << this << "," << GetName() << ") _lp at beginning = " << _lp << std::endl ;
if (_lp) {
// std::cout << "updating raw pointers from list proxy contents" << std::endl ;
_xlo = xlo() ;
_xhi = xhi() ;
delete _lp ;
}
// std::cout << "_xlo = " << _xlo << " _xhi = " << _xhi << std::endl ;

// If list proxy does not exist, create it now
_lp = new RooListProxy(Form("range::%s",GetName()),"lp",&owner,false,true) ;
Expand Down
Loading
Loading