Skip to content

Commit

Permalink
[RF] Fix typos to make the typo checker happy
Browse files Browse the repository at this point in the history
  • Loading branch information
guitargeek committed May 11, 2024
1 parent db0d33c commit 6b96b4b
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 60 deletions.
1 change: 1 addition & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[default.extend-identifiers]
BaBar = "BaBar"
YtoAbsPixel = "YtoAbsPixel"
exportJSONtoString = "exportJSONtoString" # Maybe it's worth to rename this function to consistent camelCase
fChannelObservMap = "fChannelObservMap"
fG2ndDerivative = "fG2ndDerivative"
Expand Down
6 changes: 3 additions & 3 deletions roofit/roofit/test/testRooGaussian.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ TEST(RooGaussian, AnalyticalIntegral)
constexpr double prec = 1.E-8;
constexpr double oneSig = 0.682689492137;
constexpr double twoSig = 0.954499736104;
constexpr double thrSig = 0.997300203937;
constexpr double thresholdSig = 0.997300203937;

RooRealVar x("x", "x", 0.);
RooRealVar mean("mean", "mean", 0.);
Expand Down Expand Up @@ -44,13 +44,13 @@ TEST(RooGaussian, AnalyticalIntegral)
//Test central quantiles
runTest(-1., 1., oneSig);
runTest(-2., 2., twoSig);
runTest(-3., 3., thrSig);
runTest(-3., 3., thresholdSig);

//Positive & negative, but one close to zero:
runTest(0., 1., oneSig/2.);
runTest(-0., 1., oneSig/2.);
runTest(-2., 1.E-8, twoSig/2.);
runTest(-1.E-9, 3., thrSig/2.);
runTest(-1.E-9, 3., thresholdSig/2.);

//Far from zero
runTest(5., 11., 2.8665157E-7);
Expand Down
12 changes: 6 additions & 6 deletions roofit/roofitZMQ/src/ZeroMQPoller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,10 @@ size_t ZeroMQPoller::unregister_socket(zmq::socket_t &socket)
m_sockets.erase(it);

// Remove from m_items
auto iit = std::find_if(begin(m_items), end(m_items),
auto found = std::find_if(begin(m_items), end(m_items),
[&it_first](const zmq::pollitem_t &item) { return it_first == item.socket; });
assert(iit != end(m_items));
m_items.erase(iit);
assert(found != end(m_items));
m_items.erase(found);

return index;
}
Expand All @@ -235,10 +235,10 @@ size_t ZeroMQPoller::unregister_socket(int fd)
m_fds.erase(it);

// Remove from m_items
auto iit = std::find_if(begin(m_items), end(m_items),
auto found = std::find_if(begin(m_items), end(m_items),
[&it_first](const zmq::pollitem_t &item) { return it_first == item.fd; });
assert(iit != end(m_items));
m_items.erase(iit);
assert(found != end(m_items));
m_items.erase(found);

return index;
}
34 changes: 17 additions & 17 deletions roofit/roofitcore/src/RooAbsData.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1012,40 +1012,40 @@ RooFit::OwningPtr<TMatrixDSym> RooAbsData::corrcovMatrix(const RooArgList& vars,
if (select && select->eval()==0) continue ;
if (cutRange && dvars->allInRange(cutRange)) continue ;

for(std::size_t ix = 0; ix < varList.size(); ++ix) {
auto varx = static_cast<RooRealVar const&>(varList[ix]);
xsum[ix] += weight() * varx.getVal() ;
for(std::size_t iX = 0; iX < varList.size(); ++iX) {
auto varx = static_cast<RooRealVar const&>(varList[iX]);
xsum[iX] += weight() * varx.getVal() ;
if (corr) {
x2sum[ix] += weight() * varx.getVal() * varx.getVal();
x2sum[iX] += weight() * varx.getVal() * varx.getVal();
}

for(std::size_t iy = ix; iy < varList.size(); ++iy) {
auto vary = static_cast<RooRealVar const&>(varList[iy]);
xysum(ix,iy) += weight() * varx.getVal() * vary.getVal();
xysum(iy,ix) = xysum(ix,iy) ;
for(std::size_t iY = iX; iY < varList.size(); ++iY) {
auto vary = static_cast<RooRealVar const&>(varList[iY]);
xysum(iX,iY) += weight() * varx.getVal() * vary.getVal();
xysum(iY,iX) = xysum(iX,iY) ;
}
}

}

// Normalize sums
for (std::size_t ix=0 ; ix<varList.size() ; ix++) {
xsum[ix] /= sumEntries(cutSpec, cutRange) ;
for (std::size_t iX=0 ; iX<varList.size() ; iX++) {
xsum[iX] /= sumEntries(cutSpec, cutRange) ;
if (corr) {
x2sum[ix] /= sumEntries(cutSpec, cutRange) ;
x2sum[iX] /= sumEntries(cutSpec, cutRange) ;
}
for (std::size_t iy=0 ; iy<varList.size() ; iy++) {
xysum(ix,iy) /= sumEntries(cutSpec, cutRange) ;
for (std::size_t iY=0 ; iY<varList.size() ; iY++) {
xysum(iX,iY) /= sumEntries(cutSpec, cutRange) ;
}
}

// Calculate covariance matrix
auto C = std::make_unique<TMatrixDSym>(varList.size()) ;
for (std::size_t ix=0 ; ix<varList.size() ; ix++) {
for (std::size_t iy=0 ; iy<varList.size() ; iy++) {
(*C)(ix,iy) = xysum(ix,iy)-xsum[ix]*xsum[iy] ;
for (std::size_t iX=0 ; iX<varList.size() ; iX++) {
for (std::size_t iY=0 ; iY<varList.size() ; iY++) {
(*C)(iX,iY) = xysum(iX,iY)-xsum[iX]*xsum[iY] ;
if (corr) {
(*C)(ix,iy) /= std::sqrt((x2sum[ix]-(xsum[ix]*xsum[ix]))*(x2sum[iy]-(xsum[iy]*xsum[iy]))) ;
(*C)(iX,iY) /= std::sqrt((x2sum[iX]-(xsum[iX]*xsum[iX]))*(x2sum[iY]-(xsum[iY]*xsum[iY]))) ;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion roofit/roofitcore/src/RooAddPdf.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ std::unique_ptr<RooAbsReal> RooAddPdf::createExpectedEventsFunc(const RooArgSet
if (!_allExtendable) {
// If the _refCoefNorm is empty or it's equal to normSet anyway, this is not
// a conditional pdf and we don't need to do any transformation. See also
// RooAddPdf::compleForNormSet() for more explanations on a similar logic.
// RooAddPdf::compileForNormSet() for more explanations on a similar logic.
if (!_refCoefNorm.empty() && !nset->equals(_refCoefNorm)) {
prodList.addOwned(std::unique_ptr<RooAbsReal>{createIntegral(*nset, _refCoefNorm)});
}
Expand Down
36 changes: 18 additions & 18 deletions roofit/roofitcore/src/RooDataHist.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -401,28 +401,28 @@ void RooDataHist::importTH1(const RooArgList& vars, const TH1& histo, double wgt
zmin = offset[2] ;
}

Int_t ix(0);
Int_t iy(0);
Int_t iX(0);
Int_t iY(0);
Int_t iz(0);
for (ix=0 ; ix < xvar->getBins() ; ix++) {
xvar->setBin(ix) ;
for (iX=0 ; iX < xvar->getBins() ; iX++) {
xvar->setBin(iX) ;
if (yvar) {
for (iy=0 ; iy < yvar->getBins() ; iy++) {
yvar->setBin(iy) ;
for (iY=0 ; iY < yvar->getBins() ; iY++) {
yvar->setBin(iY) ;
if (zvar) {
for (iz=0 ; iz < zvar->getBins() ; iz++) {
zvar->setBin(iz) ;
double bv = doDensityCorrection ? binVolume(vset) : 1;
add(vset,bv*histo.GetBinContent(ix+1+xmin,iy+1+ymin,iz+1+zmin)*wgt,bv*TMath::Power(histo.GetBinError(ix+1+xmin,iy+1+ymin,iz+1+zmin)*wgt,2)) ;
add(vset,bv*histo.GetBinContent(iX+1+xmin,iY+1+ymin,iz+1+zmin)*wgt,bv*TMath::Power(histo.GetBinError(iX+1+xmin,iY+1+ymin,iz+1+zmin)*wgt,2)) ;
}
} else {
double bv = doDensityCorrection ? binVolume(vset) : 1;
add(vset,bv*histo.GetBinContent(ix+1+xmin,iy+1+ymin)*wgt,bv*TMath::Power(histo.GetBinError(ix+1+xmin,iy+1+ymin)*wgt,2)) ;
add(vset,bv*histo.GetBinContent(iX+1+xmin,iY+1+ymin)*wgt,bv*TMath::Power(histo.GetBinError(iX+1+xmin,iY+1+ymin)*wgt,2)) ;
}
}
} else {
double bv = doDensityCorrection ? binVolume(vset) : 1 ;
add(vset,bv*histo.GetBinContent(ix+1+xmin)*wgt,bv*TMath::Power(histo.GetBinError(ix+1+xmin)*wgt,2)) ;
add(vset,bv*histo.GetBinContent(iX+1+xmin)*wgt,bv*TMath::Power(histo.GetBinError(iX+1+xmin)*wgt,2)) ;
}
}

Expand Down Expand Up @@ -564,31 +564,31 @@ void RooDataHist::importTH1Set(const RooArgList& vars, RooCategory& indexCat, st
double avgBV = volume / numEntries() ;

Int_t ic(0);
Int_t ix(0);
Int_t iy(0);
Int_t iX(0);
Int_t iY(0);
Int_t iz(0);
for (ic=0 ; ic < icat->numBins(nullptr) ; ic++) {
icat->setBin(ic) ;
histo = hmap[icat->getCurrentLabel()] ;
for (ix=0 ; ix < xvar->getBins() ; ix++) {
xvar->setBin(ix) ;
for (iX=0 ; iX < xvar->getBins() ; iX++) {
xvar->setBin(iX) ;
if (yvar) {
for (iy=0 ; iy < yvar->getBins() ; iy++) {
yvar->setBin(iy) ;
for (iY=0 ; iY < yvar->getBins() ; iY++) {
yvar->setBin(iY) ;
if (zvar) {
for (iz=0 ; iz < zvar->getBins() ; iz++) {
zvar->setBin(iz) ;
double bv = doDensityCorrection ? binVolume(vset)/avgBV : 1;
add(vset,bv*histo->GetBinContent(ix+1+xmin,iy+1+ymin,iz+1+zmin)*wgt,bv*TMath::Power(histo->GetBinError(ix+1+xmin,iy+1+ymin,iz+1+zmin)*wgt,2)) ;
add(vset,bv*histo->GetBinContent(iX+1+xmin,iY+1+ymin,iz+1+zmin)*wgt,bv*TMath::Power(histo->GetBinError(iX+1+xmin,iY+1+ymin,iz+1+zmin)*wgt,2)) ;
}
} else {
double bv = doDensityCorrection ? binVolume(vset)/avgBV : 1;
add(vset,bv*histo->GetBinContent(ix+1+xmin,iy+1+ymin)*wgt,bv*TMath::Power(histo->GetBinError(ix+1+xmin,iy+1+ymin)*wgt,2)) ;
add(vset,bv*histo->GetBinContent(iX+1+xmin,iY+1+ymin)*wgt,bv*TMath::Power(histo->GetBinError(iX+1+xmin,iY+1+ymin)*wgt,2)) ;
}
}
} else {
double bv = doDensityCorrection ? binVolume(vset)/avgBV : 1;
add(vset,bv*histo->GetBinContent(ix+1+xmin)*wgt,bv*TMath::Power(histo->GetBinError(ix+1+xmin)*wgt,2)) ;
add(vset,bv*histo->GetBinContent(iX+1+xmin)*wgt,bv*TMath::Power(histo->GetBinError(iX+1+xmin)*wgt,2)) ;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion roofit/roofitcore/test/stressRooFit_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -2708,7 +2708,7 @@ class TestBasic405 : public RooUnitTest {
// Define range "alt" as including bins 1,3,5,7,9
xb->setRange("alt", "x_coarse_bin1,x_coarse_bin3,x_coarse_bin5,x_coarse_bin7,x_coarse_bin9");

// Construct subset of data matching range "alt" but only for the first 5000 events and plot it on the fram
// Construct subset of data matching range "alt" but only for the first 5000 events and plot it on the frame
std::unique_ptr<RooAbsData> dataSel{data->reduce(CutRange("alt"), EventRange(0, 5000))};
// dataSel->plotOn(xframe,MarkerColor(kGreen),LineColor(kGreen),Name("data_sel")) ;

Expand Down
8 changes: 4 additions & 4 deletions roofit/roofitcore/test/testRooSimultaneous.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ TEST(RooSimultaneous, CategoriesWithNoPdf)

RooRealVar x("x", "", 0, 1);
RooRealVar rnd("rnd", "", 0, 1);
RooThresholdCategory catThr("cat", "", rnd, "v2", 2);
catThr.addThreshold(1. / 3, "v0", 0);
catThr.addThreshold(2. / 3, "v1", 1);
RooThresholdCategory catThreshold("cat", "", rnd, "v2", 2);
catThreshold.addThreshold(1. / 3, "v0", 0);
catThreshold.addThreshold(2. / 3, "v1", 1);

RooRealVar m0("m0", "", 0.5, 0, 1);
RooRealVar m1("m1", "", 0.5, 0, 1);
Expand All @@ -79,7 +79,7 @@ TEST(RooSimultaneous, CategoriesWithNoPdf)
RooProdPdf pdf("pdf", "", RooArgSet(g0, rndPdf));

std::unique_ptr<RooDataSet> ds{pdf.generate(RooArgSet(x, rnd), RooFit::Name("ds"), RooFit::NumEvents(100))};
auto cat = dynamic_cast<RooCategory *>(ds->addColumn(catThr));
auto cat = dynamic_cast<RooCategory *>(ds->addColumn(catThreshold));

RooSimultaneous sim("sim", "", *cat);
sim.addPdf(g0, "v0");
Expand Down
16 changes: 8 additions & 8 deletions roofit/roostats/src/LikelihoodInterval.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ bool LikelihoodInterval::FindLimits(const RooRealVar & param, double &lower, dou
std::unique_ptr<RooArgSet> partmp{fLikelihoodRatio->getVariables()};
RemoveConstantParameters(&*partmp);
RooArgList params(*partmp);
int ix = params.index(&param);
if (ix < 0 ) {
int iX = params.index(&param);
if (iX < 0 ) {
ccoutE(InputArguments) << "Error - invalid parameter " << param.GetName() << " specified for finding the interval limits " << std::endl;
return false;
}
Expand All @@ -332,7 +332,7 @@ bool LikelihoodInterval::FindLimits(const RooRealVar & param, double &lower, dou
err_level = err_level/2; // since we are using -log LR
fMinimizer->SetErrorDef(err_level);

unsigned int ivarX = ix;
unsigned int ivarX = iX;

double elow = 0;
double eup = 0;
Expand Down Expand Up @@ -371,9 +371,9 @@ Int_t LikelihoodInterval::GetContourPoints(const RooRealVar & paramX, const RooR
std::unique_ptr<RooArgSet> partmp{fLikelihoodRatio->getVariables()};
RemoveConstantParameters(&*partmp);
RooArgList params(*partmp);
int ix = params.index(&paramX);
int iy = params.index(&paramY);
if (ix < 0 || iy < 0) {
int iX = params.index(&paramX);
int iY = params.index(&paramY);
if (iX < 0 || iY < 0) {
coutE(InputArguments) << "LikelihoodInterval - Error - invalid parameters specified for finding the contours; parX = " << paramX.GetName()
<< " parY = " << paramY.GetName() << std::endl;
return 0;
Expand All @@ -394,8 +394,8 @@ Int_t LikelihoodInterval::GetContourPoints(const RooRealVar & paramX, const RooR
fMinimizer->SetErrorDef(cont_level);

unsigned int ncp = npoints;
unsigned int ivarX = ix;
unsigned int ivarY = iy;
unsigned int ivarX = iX;
unsigned int ivarY = iY;
coutI(Minimization) << "LikelihoodInterval - Finding the contour of " << paramX.GetName() << " ( " << ivarX << " ) and " << paramY.GetName() << " ( " << ivarY << " ) " << std::endl;
ret = fMinimizer->Contour(ivarX, ivarY, ncp, x, y );
if (!ret) {
Expand Down
4 changes: 2 additions & 2 deletions roofit/xroofit/src/xRooNode.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2092,7 +2092,7 @@ xRooNode xRooNode::Add(const xRooNode &child, Option_t *opt)
child.convertForAcquisition(*this);
if (child.get()) {
if (auto _d = child.get<RooAbsData>()) {
// don't use acquire method to import, because that adds datasets as Embeddded
// don't use acquire method to import, because that adds datasets as Embedded
if (!w->import(*_d)) {
return xRooNode(child.GetName(), *w->data(child.GetName()), *this);
} else {
Expand Down Expand Up @@ -10330,7 +10330,7 @@ void xRooNode::Draw(Option_t *opt)
}
hh->SetTitle(TString(hh->GetTitle())
.ReplaceAll(TString(chan->get()->GetName()) + "_",
"")); // remove occurance of channelname_ in title (usually prefix)
"")); // remove occurrence of channelname_ in title (usually prefix)
titleMatchName &= (TString(samp->GetName()) == hh->GetTitle() ||
TString(hh->GetTitle()).BeginsWith(TString(samp->GetName()) + "_"));
hh->SetBinContent(hh->GetXaxis()->FindFixBin(chanName), samp->GetContent());
Expand Down

0 comments on commit 6b96b4b

Please sign in to comment.