Skip to content
Merged
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
9 changes: 3 additions & 6 deletions roofit/histfactory/src/HistFactoryModelUtils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -251,18 +251,16 @@ namespace HistFactory{

// loop over channels
RooCategory* channelCat = (RooCategory*) (&simPdf->indexCat());
TIterator* iter = channelCat->typeIterator() ;
RooCatType* tt = NULL;
while((tt=(RooCatType*) iter->Next())) {
for (const auto& nameIdx : *channelCat) {

// Get pdf associated with state from simpdf
RooAbsPdf* pdftmp = simPdf->getPdf(tt->GetName()) ;
RooAbsPdf* pdftmp = simPdf->getPdf(nameIdx.first.c_str());

std::string ChannelName = pdftmp->GetName(); //tt->GetName();
if(verbose) std::cout << "Getting data for channel: " << ChannelName << std::endl;
ChannelBinDataMap[ ChannelName ] = std::vector<double>();

RooAbsData* dataForChan = (RooAbsData*) dataByCategory->FindObject(tt->GetName());
RooAbsData* dataForChan = (RooAbsData*) dataByCategory->FindObject(nameIdx.first.c_str());
if(verbose) dataForChan->Print();

// Generate observables defined by the pdf associated with this state
Expand Down Expand Up @@ -292,7 +290,6 @@ namespace HistFactory{

} // End Loop Over Categories

delete iter;
return;

}
Expand Down
6 changes: 2 additions & 4 deletions roofit/histfactory/src/HistFactoryNavigation.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -787,10 +787,8 @@ namespace RooStats {

// Iterate over the categories and get the
// pdf and observables for each category
TIterator* iter = channelCat->typeIterator() ;
RooCatType* tt = NULL;
while((tt=(RooCatType*) iter->Next())) {
std::string ChannelName = tt->GetName();
for (const auto& nameIdx : *channelCat) {
const std::string& ChannelName = nameIdx.first;
fChannelNameVec.push_back( ChannelName );
RooAbsPdf* pdftmp = simPdf->getPdf(ChannelName.c_str()) ;
RooArgSet* obstmp = pdftmp->getObservables(*observables) ;
Expand Down
17 changes: 2 additions & 15 deletions roofit/histfactory/src/RooBarlowBeestonLL.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -194,24 +194,11 @@ void RooStats::HistFactory::RooBarlowBeestonLL::initializeBarlowCache() {
// Loop over the channels
RooSimultaneous* simPdf = (RooSimultaneous*) _pdf;
RooCategory* channelCat = (RooCategory*) (&simPdf->indexCat());
TIterator* iter = channelCat->typeIterator() ;
RooCatType* tt = NULL;
while((tt=(RooCatType*) iter->Next())) {
/*
std::string ChannelName = tt->GetName();

HHChannel_hh_edit

TIterator* iter_channels = channelsWithConstraints->createIterator();
RooAbsPdf* channelPdf=NULL;
while(( channelPdf=(RooAbsPdf*)iter_channels->Next() )) {

std::string channel_name = RooStats::channelNameFromPdf( channelPdf );
*/
for (const auto& nameIdx : *channelCat) {

// Warning: channel cat name is not necesarily the same name
// as the pdf's (for example, if someone does edits)
RooAbsPdf* channelPdf = simPdf->getPdf(tt->GetName());
RooAbsPdf* channelPdf = simPdf->getPdf(nameIdx.first.c_str());
std::string channel_name = channelPdf->GetName();

// First, we check if this channel uses Stat Uncertainties:
Expand Down
4 changes: 0 additions & 4 deletions roofit/roofitcore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ ROOT_STANDARD_LIBRARY_PACKAGE(RooFitCore
RooLinTransBinning.h
RooList.h
RooListProxy.h
RooMapCatEntry.h
RooMappedCategory.h
RooMath.h
RooMCIntegrator.h
Expand Down Expand Up @@ -199,7 +198,6 @@ ROOT_STANDARD_LIBRARY_PACKAGE(RooFitCore
RooSetPair.h
RooSetProxy.h
RooSharedProperties.h
RooSharedPropertiesList.h
RooSimGenContext.h
RooSimPdfBuilder.h
RooSimSplitGenContext.h
Expand Down Expand Up @@ -350,7 +348,6 @@ ROOT_STANDARD_LIBRARY_PACKAGE(RooFitCore
src/RooLinTransBinning.cxx
src/RooList.cxx
src/RooListProxy.cxx
src/RooMapCatEntry.cxx
src/RooMappedCategory.cxx
src/RooMath.cxx
src/RooMCIntegrator.cxx
Expand Down Expand Up @@ -416,7 +413,6 @@ ROOT_STANDARD_LIBRARY_PACKAGE(RooFitCore
src/RooSetPair.cxx
src/RooSetProxy.cxx
src/RooSharedProperties.cxx
src/RooSharedPropertiesList.cxx
src/RooSimGenContext.cxx
src/RooSimPdfBuilder.cxx
src/RooSimSplitGenContext.cxx
Expand Down
2 changes: 0 additions & 2 deletions roofit/roofitcore/inc/LinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@
#pragma link C++ class RooLinTransBinning+ ;
#pragma link C++ class RooList+ ;
#pragma link C++ class RooListProxy+ ;
#pragma link C++ class RooMapCatEntry+ ;
#pragma link C++ class RooMappedCategory+ ;
#pragma read sourceClass="RooMappedCategory" targetClass="RooMappedCategory" version="[1]" include="RooFitLegacy/RooCatTypeLegacy.h" source="RooCatType* _defCat" target="_defCat" code="{ _defCat = onfile._defCat->getVal(); }"
#pragma link C++ class RooMappedCategory::Entry+;
Expand Down Expand Up @@ -202,7 +201,6 @@
#pragma link C++ class RooSetPair+ ;
#pragma link C++ class RooSetProxy+ ;
#pragma link C++ class RooSharedProperties+ ;
#pragma link C++ class RooSharedPropertiesList+ ;
#pragma link C++ class RooSimGenContext+ ;
#pragma link C++ class RooSimSplitGenContext+ ;
#pragma link C++ class RooStreamParser+ ;
Expand Down
12 changes: 9 additions & 3 deletions roofit/roofitcore/inc/RooAbsArg.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,13 @@ class RooAbsArg : public TNamed, public RooPrintable {
Bool_t hasClients() const { return !_clientList.empty(); }

////////////////////////////////////////////////////////////////////////////
// Legacy iterators
/// \name Deprecated functions
/// Don't use these iterators, since they are inefficient. References to the
/// underlying containers can be obtained using `clients()` instead of `clientIterator()`,
/// `valueClients()` instead of `valueClientIterator()` etc.
/// These containers allow for range-based for loops and index access. This makes the
/// iterators in this section unnecessary.
/// @{
inline TIterator* clientIterator() const
R__SUGGEST_ALTERNATIVE("Use clients() and begin(), end() or range-based loops.") {
// Return iterator over all client RooAbsArgs
Expand Down Expand Up @@ -138,10 +144,10 @@ class RooAbsArg : public TNamed, public RooPrintable {
return RooFIter(std::unique_ptr<RefCountListLegacyIterator_t>(makeLegacyIterator(_clientListShape)));
}
inline RooFIter serverMIterator() const
R__SUGGEST_ALTERNATIVE("Use shapeClients() and begin(), end() or range-based loops.") {
R__SUGGEST_ALTERNATIVE("Use servers() and begin(), end() or range-based loops.") {
return RooFIter(std::unique_ptr<RefCountListLegacyIterator_t>(makeLegacyIterator(_serverList)));
}

/// @}
////////////////////////////////////////////////////////////////////////////

/// List of all clients of this object.
Expand Down
32 changes: 31 additions & 1 deletion roofit/roofitcore/inc/RooAbsCategoryLValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,43 @@ class RooAbsCategoryLValue : public RooAbsCategory, public RooAbsLValue {

// Value modifiers
////////////////////////////////////////////////////////////////////////////////
/// Set value by specifying the index code of the desired state.
/// Change category state by specifying the index code of the desired state.
/// If printError is set, a message will be printed if
/// the specified index does not represent a valid state.
/// \return bool to signal an error.
virtual bool setIndex(value_type index, bool printError = true) = 0;
////////////////////////////////////////////////////////////////////////////////
/// Change category state to state specified by another category state.
/// If printError is set, a message will be printed if
/// the specified index does not represent a valid state.
/// \note The state name of the other category is ignored.
/// \return bool to signal an error.
bool setIndex(const std::pair<std::string,value_type>& nameIdxPair, bool printError = true) {
return setIndex(nameIdxPair.second, printError);
}
bool setOrdinal(unsigned int index);

////////////////////////////////////////////////////////////////////////////////
/// Change category state by specifying a state name.
/// If printError is set, a message will be printed if
/// the specified state name does not represent a valid state.
/// \return bool to signal an error.
virtual bool setLabel(const char* label, Bool_t printError=kTRUE) = 0;
/// \copydoc setLabel(const char*, Bool_t)
bool setLabel(const std::string& label, bool printError = true) {
return setLabel(label.c_str(), printError);
}
////////////////////////////////////////////////////////////////////////////////
/// Change category state to the state name of another category.
/// If printError is set, a message will be printed if
/// the specified state name does not represent a valid state.
/// \note The state index of the other category is ignored.
/// \return bool to signal an error.
bool setLabel(const std::pair<std::string,value_type>& nameIdxPair, bool printError = true) {
return setLabel(nameIdxPair.first.c_str(), printError);
}


RooAbsArg& operator=(int index) ;
RooAbsArg& operator=(const char* label) ;
RooAbsArg& operator=(const RooAbsCategory& other) ;
Expand Down
11 changes: 8 additions & 3 deletions roofit/roofitcore/inc/RooAbsCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ class RooAbsCollection : public TObject, public RooPrintable {
return _list.end();
}

Storage_t::const_reverse_iterator rbegin() const {
return _list.rbegin();
}

Storage_t::const_reverse_iterator rend() const {
return _list.rend();
}

Storage_t::size_type size() const {
return _list.size();
}
Expand Down Expand Up @@ -238,9 +246,6 @@ class RooAbsCollection : public TObject, public RooPrintable {
virtual void RecursiveRemove(TObject *obj);

protected:

friend class RooMultiCatIter ;

Storage_t _list; // Actual object storage
using LegacyIterator_t = TIteratorToSTLInterface<Storage_t>;

Expand Down
2 changes: 2 additions & 0 deletions roofit/roofitcore/inc/RooCategory.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ class RooCategory final : public RooAbsCategoryLValue {
}

virtual Bool_t setIndex(Int_t index, bool printError = true) override;
using RooAbsCategoryLValue::setIndex;
virtual Bool_t setLabel(const char* label, bool printError = true) override;
using RooAbsCategoryLValue::setLabel;

// I/O streaming interface (machine readable)
virtual Bool_t readFromStream(std::istream& is, Bool_t compact, Bool_t verbose=kFALSE) override;
Expand Down
50 changes: 0 additions & 50 deletions roofit/roofitcore/inc/RooMapCatEntry.h

This file was deleted.

1 change: 0 additions & 1 deletion roofit/roofitcore/inc/RooRealIntegral.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ class RooRealIntegral : public RooAbsReal {
RooNumIntConfig* _iconfig ;

mutable RooListProxy _sumCat ; //! do not persist
TIterator* _sumCatIter ; //!

Int_t _mode ;
IntOperMode _intOperMode ; // integration operation mode
Expand Down
42 changes: 0 additions & 42 deletions roofit/roofitcore/inc/RooSharedPropertiesList.h

This file was deleted.

2 changes: 2 additions & 0 deletions roofit/roofitcore/inc/RooSuperCategory.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ class RooSuperCategory : public RooAbsCategoryLValue {
virtual ~RooSuperCategory() { };

virtual bool setIndex(value_type index, bool printError = true) override ;
using RooAbsCategoryLValue::setIndex;
virtual Bool_t setLabel(const char* label, Bool_t printError=kTRUE) override;
using RooAbsCategoryLValue::setLabel;

// Printing interface (human readable)
virtual void printMultiline(std::ostream& os, Int_t content, Bool_t verbose=kFALSE, TString indent="") const override;
Expand Down
12 changes: 8 additions & 4 deletions roofit/roofitcore/src/Roo1DTable.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,20 @@ Roo1DTable implements a one-dimensional table. A table is the category
equivalent of a plot. To create a table use the RooDataSet::table method.
**/

#include "RooFit.h"
#include "Roo1DTable.h"

#include "RooFit.h"
#include "Riostream.h"
#include <iomanip>
#include "RooMsgService.h"
#include "RooFitLegacy/RooCatTypeLegacy.h"

#include "TString.h"
#include "TMath.h"
#include "Roo1DTable.h"
#include "RooMsgService.h"
#include "TClass.h"

#include <iomanip>


using namespace std ;

ClassImp(Roo1DTable);
Expand Down
15 changes: 8 additions & 7 deletions roofit/roofitcore/src/RooAbsArg.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -996,20 +996,21 @@ Bool_t RooAbsArg::redirectServers(const RooAbsCollection& newSetOrig, Bool_t mus
setShapeDirty() ;

// Process the proxies
Bool_t allReplaced=kTRUE ;
for (int i=0 ; i<numProxies() ; i++) {
RooAbsProxy* p = getProxy(i) ;
if (!p) continue ;
Bool_t ret2 = p->changePointer(*newSet,nameChange,kFALSE) ;
allReplaced &= ret2 ;
}

if (mustReplaceAll && !allReplaced) {
coutE(LinkStateMgmt) << "RooAbsArg::redirectServers(" << GetName()
<< "): ERROR, some proxies could not be adjusted" << endl ;
ret = kTRUE ;
if (mustReplaceAll && !ret2) {
auto ap = dynamic_cast<const RooArgProxy*>(p);
coutE(LinkStateMgmt) << "RooAbsArg::redirectServers(" << GetName()
<< "): ERROR, proxy '" << p->name()
<< "' with arg '" << (ap ? ap->absArg()->GetName() : "<could not cast>") << "' could not be adjusted" << endl;
ret = kTRUE ;
}
}


// Optional subclass post-processing
for (Int_t i=0 ;i<numCaches() ; i++) {
ret |= getCache(i)->redirectServersHook(*newSet,mustReplaceAll,nameChange,isRecursionStep) ;
Expand Down
Loading