Skip to content

Commit

Permalink
Follow-up on last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
guitargeek committed Dec 3, 2023
1 parent 19e023d commit 8670f9d
Show file tree
Hide file tree
Showing 27 changed files with 59 additions and 167 deletions.
1 change: 0 additions & 1 deletion interface/AsymQuad.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "RooFit.h"
#include "Riostream.h"
#include "TIterator.h"
#include "TList.h"
#include <RooAbsReal.h>
#include "RooRealVar.h"
Expand Down
5 changes: 1 addition & 4 deletions interface/FastTemplateFunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,12 @@ template <typename T> class FastTemplateFunc_t : public RooAbsReal{
virtual inline ~FastTemplateFunc_t(){}

void setProxyList(RooListProxy& proxyList, RooArgList& varList){
TIterator* varIter = varList.createIterator();
RooAbsArg* var;
while ((var = (RooAbsArg*)varIter->Next())) {
for (RooAbsArg *var : varList) {
if (!dynamic_cast<RooAbsReal*>(var)) {
assert(0);
}
proxyList.add(*var);
}
delete varIter;
}

virtual TObject* clone(const char* newname) const = 0;
Expand Down
1 change: 0 additions & 1 deletion interface/ProcessNormalization.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#ifndef HiggsAnalysis_CombinedLimit_ProcessNormalization_h
#define HiggsAnalysis_CombinedLimit_ProcessNormalization_h

#include <TIterator.h>
#include <RooAbsReal.h>
#include "RooListProxy.h"

Expand Down
1 change: 0 additions & 1 deletion interface/RooMultiPdf.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "RooConstVar.h"


#include "TIterator.h"
#include "RooListProxy.h"

#include <iostream>
Expand Down
2 changes: 0 additions & 2 deletions interface/RooRealFlooredSumPdf.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ class RooRealFlooredSumPdf : public RooAbsPdf {

RooListProxy _funcList; // List of component FUNCs
RooListProxy _coefList; // List of coefficients
TIterator* _funcIter; //! Iterator over FUNC list
TIterator* _coefIter; //! Iterator over coefficient list
Bool_t _extended; // Allow use as extended p.d.f.
Bool_t _doFloor;
Double_t _floorVal;
Expand Down
1 change: 0 additions & 1 deletion interface/SimpleCacheSentry.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "RooRealVar.h"
#include "RooSetProxy.h"
#include "TIterator.h"

class SimpleCacheSentry : public RooAbsArg {
public:
Expand Down
13 changes: 5 additions & 8 deletions src/AsimovUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <memory>
#include <stdexcept>
#include <TIterator.h>
#include <RooAbsData.h>
#include <RooArgSet.h>
#include <RooProdPdf.h>
Expand Down Expand Up @@ -89,8 +88,7 @@ RooAbsData *asimovutils::asimovDatasetWithFit(RooStats::ModelConfig *mc, RooAbsD
std::unique_ptr<RooAbsPdf> nuispdf(utils::makeNuisancePdf(*mc));
RooProdPdf *prod = dynamic_cast<RooProdPdf *>(nuispdf.get());
if (prod == 0) throw std::runtime_error("AsimovUtils: the nuisance pdf is not a RooProdPdf!");
std::unique_ptr<TIterator> iter(prod->pdfList().createIterator());
for (RooAbsArg *a = (RooAbsArg *) iter->Next(); a != 0; a = (RooAbsArg *) iter->Next()) {
for (RooAbsArg *a : prod->pdfList()) {
RooAbsPdf *cterm = dynamic_cast<RooAbsPdf *>(a);
if (!cterm) throw std::logic_error("AsimovUtils: a factor of the nuisance pdf is not a Pdf!");
if (!cterm->dependsOn(nuis)) continue; // dummy constraints
Expand All @@ -106,8 +104,7 @@ RooAbsData *asimovutils::asimovDatasetWithFit(RooStats::ModelConfig *mc, RooAbsD
if (cpars->getSize() == 1) {
match = dynamic_cast<RooAbsReal *>(cpars->first());
} else {
std::unique_ptr<TIterator> iter2(cpars->createIterator());
for (RooAbsArg *a2 = (RooAbsArg *) iter2->Next(); a2 != 0; a2 = (RooAbsArg *) iter2->Next()) {
for (RooAbsArg *a2 : *cpars) {
RooRealVar *rrv2 = dynamic_cast<RooRealVar *>(a2);
if (rrv2 != 0 && !rrv2->isConstant()) {
if (match != 0) throw std::runtime_error(Form("AsimovUtils: constraint term %s has multiple floating params", cterm->GetName()));
Expand Down Expand Up @@ -135,10 +132,10 @@ RooAbsData *asimovutils::asimovDatasetWithFit(RooStats::ModelConfig *mc, RooAbsD
// we want to set the global obs to a value for which the current value
// of the nuisance is the best fit one.
// best fit x = (k-1)*theta ----> k = x/theta + 1
RooArgList leaves; cterm->leafNodeServerList(&leaves);
std::unique_ptr<TIterator> iter2(leaves.createIterator());
RooArgList leaves;
cterm->leafNodeServerList(&leaves);
RooAbsReal *match2 = 0;
for (RooAbsArg *a2 = (RooAbsArg *) iter2->Next(); a2 != 0; a2 = (RooAbsArg *) iter2->Next()) {
for (RooAbsArg *a2 : leaves) {
RooAbsReal *rar = dynamic_cast<RooAbsReal *>(a2);
if (rar == 0 || rar == match || rar == &rrv) continue;
if (!rar->isConstant()) throw std::runtime_error(Form("AsimovUtils: extra floating parameter %s of RooGamma %s.", rar->GetName(), cterm->GetName()));
Expand Down
3 changes: 1 addition & 2 deletions src/AsymptoticLimits.cc
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ bool AsymptoticLimits::runLimit(RooWorkspace *w, RooStats::ModelConfig *mc_s, Ro
if (params_.get() == 0) params_.reset(mc_s->GetPdf()->getParameters(data));

hasFloatParams_ = false;
std::unique_ptr<TIterator> itparam(params_->createIterator());
for (RooAbsArg *a = (RooAbsArg *) itparam->Next(); a != 0; a = (RooAbsArg *) itparam->Next()) {
for (RooAbsArg *a : *params_) {
RooRealVar *rrv = dynamic_cast<RooRealVar *>(a);
if ( rrv != 0 && rrv != r && rrv->isConstant() == false ) { hasFloatParams_ = true; break; }
}
Expand Down
5 changes: 2 additions & 3 deletions src/CachingNLL.cc
Original file line number Diff line number Diff line change
Expand Up @@ -580,9 +580,8 @@ cacheutils::CachingAddNLL::setup_()
throw std::invalid_argument(errmsg);
}

std::unique_ptr<RooArgSet> params(pdf_->getParameters(*data_));
std::unique_ptr<TIterator> iter(params->createIterator());
for (RooAbsArg *a = (RooAbsArg *) iter->Next(); a != 0; a = (RooAbsArg *) iter->Next()) {
;
for (RooAbsArg *a : *std::unique_ptr<RooArgSet>{pdf_->getParameters(*data_)}) {
if (dynamic_cast<RooRealVar *>(a)) params_.add(*a);
else if (dynamic_cast<RooCategory *>(a)) catParams_.add(*a);
}
Expand Down
7 changes: 2 additions & 5 deletions src/Combine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <TFile.h>
#include <TFileCacheRead.h>
#include <TGraphErrors.h>
#include <TIterator.h>
#include <TLine.h>
#include <TMath.h>
#include <TString.h>
Expand Down Expand Up @@ -974,8 +973,7 @@ void Combine::run(TString hlfFile, const std::string &dataset, double &limit, do
// print the values of the parameters used to generate the toy
if (verbose > 2) {
Logger::instance().log(std::string(Form("Combine.cc: %d -- Generate Asimov toy from parameter values ... ",__LINE__)),Logger::kLogLevelInfo,__func__);
std::unique_ptr<TIterator> iter(genPdf->getParameters((const RooArgSet*)0)->createIterator());
for (RooAbsArg *a = (RooAbsArg *) iter->Next(); a != 0; a = (RooAbsArg *) iter->Next()) {
for (RooAbsArg *a : *std::unique_ptr<RooArgSet>{genPdf->getParameters((const RooArgSet*)0)}) {
TString varstring = utils::printRooArgAsString(a);
Logger::instance().log(std::string(Form("Combine.cc: %d -- %s",__LINE__,varstring.Data())),Logger::kLogLevelInfo,__func__);
}
Expand Down Expand Up @@ -1073,8 +1071,7 @@ void Combine::run(TString hlfFile, const std::string &dataset, double &limit, do
std::cout << "Generate toy " << iToy << "/" << nToys << std::endl;
if (verbose > 2) {
Logger::instance().log(std::string(Form("Combine.cc: %d -- Generating toy %d/%d, from parameter values ... ",__LINE__,iToy,nToys)),Logger::kLogLevelInfo,__func__);
std::unique_ptr<TIterator> iter(genPdf->getParameters((const RooArgSet*)0)->createIterator());
for (RooAbsArg *a = (RooAbsArg *) iter->Next(); a != 0; a = (RooAbsArg *) iter->Next()) {
for (RooAbsArg *a : *std::unique_ptr<RooArgSet>{genPdf->getParameters((const RooArgSet*)0)}) {
TString varstring = utils::printRooArgAsString(a);
Logger::instance().log(std::string(Form("Combine.cc: %d -- %s",__LINE__,varstring.Data())),Logger::kLogLevelInfo,__func__);
}
Expand Down
1 change: 0 additions & 1 deletion src/HWWLVJRooPdfs.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "TString.h"
#include "TRandom3.h"
#include "TCanvas.h"
#include "TIterator.h"
#include "RooHist.h"
#include "RooRealVar.h"
#include "RooFitResult.h"
Expand Down
1 change: 0 additions & 1 deletion src/HZZ4L_RooSpinZeroPdf_phase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ ClassImp(HZZ4L_RooSpinZeroPdf_phase)
Integral_T2 = other.Integral_T2;
Integral_T4 = other.Integral_T4;
Integral_T5 = other.Integral_T5;
// _coefIter = _coefList.createIterator() ;
}


Expand Down
6 changes: 2 additions & 4 deletions src/HybridNew.cc
Original file line number Diff line number Diff line change
Expand Up @@ -807,8 +807,7 @@ std::unique_ptr<RooStats::HybridCalculator> HybridNew::create(RooWorkspace *w, R
// print the values of the parameters used to generate the toy
if (verbose > 2) {
Logger::instance().log(std::string(Form("HybridNew.cc: %d -- Using the following (post-fit) parameters for No signal hypothesis ",__LINE__)),Logger::kLogLevelInfo,__func__);
std::unique_ptr<TIterator> iter(paramsToFit->createIterator());
for (RooAbsArg *a = (RooAbsArg *) iter->Next(); a != 0; a = (RooAbsArg *) iter->Next()) {
for (RooAbsArg *a : *paramsToFit) {
TString varstring = utils::printRooArgAsString(a);
Logger::instance().log(std::string(Form("HybridNew.cc: %d -- %s",__LINE__,varstring.Data())),Logger::kLogLevelInfo,__func__);
}
Expand All @@ -835,8 +834,7 @@ std::unique_ptr<RooStats::HybridCalculator> HybridNew::create(RooWorkspace *w, R
Logger::instance().log(std::string(Form("HybridNew.cc: %d -- Using the following (post-fit) parameters for S+B hypothesis ",__LINE__)),Logger::kLogLevelInfo,__func__);
RooArgSet reportParams;
reportParams.add(*paramsToFit); reportParams.add(poi);
std::unique_ptr<TIterator> iter(reportParams.createIterator());
for (RooAbsArg *a = (RooAbsArg *) iter->Next(); a != 0; a = (RooAbsArg *) iter->Next()) {
for (RooAbsArg *a : reportParams) {
TString varstring = utils::printRooArgAsString(a);
Logger::instance().log(std::string(Form("HybridNew.cc: %d -- %s",__LINE__,varstring.Data())),Logger::kLogLevelInfo,__func__);
}
Expand Down
6 changes: 1 addition & 5 deletions src/RooMorphingPdf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@ RooMorphingPdf::RooMorphingPdf(const char* name, const char* title,
mh_lo_(0.),
mh_hi_(0.) {
SetAxisInfo();
TIterator* pdf_iter = pdfs.createIterator();
RooAbsArg* pdf;
while ((pdf = reinterpret_cast<RooAbsArg*>(pdf_iter->Next())))
pdfs_.add(*pdf);
delete pdf_iter;
pdfs_.add(pdfs);
}

RooMorphingPdf::RooMorphingPdf(const RooMorphingPdf& other, const char* name)
Expand Down
1 change: 0 additions & 1 deletion src/RooNCSplineCore.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "../interface/RooNCSplineCore.h"
#include <cmath>
#include "TMath.h"
#include "TIterator.h"
#include "Riostream.h"

using namespace TMath;
Expand Down
10 changes: 2 additions & 8 deletions src/RooParametricHist.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
#include "RooFit.h"

#include "TFile.h"
#include "TIterator.h"

//using namespace RooFit ;

ClassImp(RooParametricHist)

Expand Down Expand Up @@ -96,11 +93,8 @@ RooArgList & RooParametricHist::getAllBinVars() const {

double RooParametricHist::getFullSum() const {
double sum=0;
TIterator *varIter=pars.createIterator();
RooAbsReal *fVar;
int i=0;
while ( (fVar = (RooAbsReal*) varIter->Next()) ){
double thisVal = fVar->getVal();
for (int i = 0; i < pars.getSize(); ++i) {
double thisVal = static_cast<RooAbsReal&>(pars[i]).getVal();
if (_hasMorphs) thisVal*=evaluateMorphFunction(i);
sum+=thisVal;
i++;
Expand Down
6 changes: 1 addition & 5 deletions src/RooPiecewisePolynomial.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <cmath>
#include "TVectorD.h"
#include "TMatrixD.h"
#include "TIterator.h"


using namespace std;
Expand Down Expand Up @@ -43,16 +42,13 @@ RooPiecewisePolynomial::RooPiecewisePolynomial(const char* name, const char* tit
{
assert((nfcn>2 && polyndof>=2) || (nfcn==2 && polyndof>=1) || (nfcn==1 && polyndof>=0));

TIterator* coefIter = parList_.createIterator();
RooAbsArg* func;
while ((func = (RooAbsArg*) coefIter->Next())) {
for (RooAbsArg *func : parList_) {
if (!dynamic_cast<RooAbsReal*>(func)) {
cerr << "RooPiecewisePolynomial::RooPiecewisePolynomial(" << GetName() << ") funcficient " << func->GetName() << " is not of type RooAbsReal" << endl;
assert(0);
}
parList.add(*func);
}
delete coefIter;
}
RooPiecewisePolynomial::RooPiecewisePolynomial(RooPiecewisePolynomial const& other, const char* name) :
RooAbsReal(other, name),
Expand Down
Loading

0 comments on commit 8670f9d

Please sign in to comment.