Skip to content

Commit 54ca6ab

Browse files
committed
[RF] Apply git clang-format to RooFitResult
1 parent 9db0110 commit 54ca6ab

File tree

2 files changed

+49
-47
lines changed

2 files changed

+49
-47
lines changed

roofit/roofitcore/inc/RooFitResult.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
class RooArgSet ;
3434
class RooAbsPdf ;
3535
class RooPlot;
36-
class TH2 ;
36+
class TH2;
3737

3838
class RooFitResult : public TNamed, public RooPrintable, public RooDirItem {
3939
public:
@@ -183,11 +183,12 @@ class RooFitResult : public TNamed, public RooPrintable, public RooDirItem {
183183
RooArgList* _initPars = nullptr; ///< List of floating parameters with initial values
184184
RooArgList* _finalPars = nullptr; ///< List of floating parameters with final values
185185

186-
mutable std::unique_ptr<RooArgList> _globalCorr; ///<! List of global correlation coefficients
186+
mutable std::unique_ptr<RooArgList> _globalCorr; ///<! List of global correlation coefficients
187187
mutable TList _corrMatrix ; ///<! Correlation matrix (list of RooArgLists)
188188

189-
mutable std::unique_ptr<RooArgList> _randomPars; ///<! List of floating parameters with most recent random perturbation applied
190-
mutable std::unique_ptr<TMatrixF> _Lt; ///<! triangular matrix used for generate random perturbations
189+
mutable std::unique_ptr<RooArgList>
190+
_randomPars; ///<! List of floating parameters with most recent random perturbation applied
191+
mutable std::unique_ptr<TMatrixF> _Lt; ///<! triangular matrix used for generate random perturbations
191192

192193
TMatrixDSym* _CM = nullptr; ///< Correlation matrix
193194
TMatrixDSym* _VM = nullptr; ///< Covariance matrix

roofit/roofitcore/src/RooFitResult.cxx

Lines changed: 44 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,11 @@ RooFitResult::RooFitResult(const RooFitResult &other)
9292

9393
other._finalPars->snapshot(*_finalPars);
9494
if (other._randomPars) {
95-
_randomPars = std::make_unique<RooArgList>();
96-
other._randomPars->snapshot(*_randomPars);
95+
_randomPars = std::make_unique<RooArgList>();
96+
other._randomPars->snapshot(*_randomPars);
9797
}
98-
if (other._Lt) _Lt = std::make_unique<TMatrix>(*other._Lt);
98+
if (other._Lt)
99+
_Lt = std::make_unique<TMatrix>(*other._Lt);
99100
if (other._VM) _VM = new TMatrixDSym(*other._VM) ;
100101
if (other._CM) _CM = new TMatrixDSym(*other._CM) ;
101102
if (other._GC) _GC = new TVectorD(*other._GC) ;
@@ -113,7 +114,8 @@ RooFitResult::~RooFitResult()
113114
{
114115
if (_constPars) delete _constPars ;
115116
if (_initPars) delete _initPars ;
116-
if (_finalPars) delete _finalPars ;
117+
if (_finalPars)
118+
delete _finalPars;
117119
if (_CM) delete _CM ;
118120
if (_VM) delete _VM ;
119121
if (_GC) delete _GC ;
@@ -331,37 +333,36 @@ RooPlot *RooFitResult::plotOn(RooPlot *frame, const char *parName1, const char *
331333
const RooArgList& RooFitResult::randomizePars() const
332334
{
333335
Int_t nPar= _finalPars->size();
334-
if(!_randomPars) { // first-time initialization
335-
assert(nullptr != _finalPars);
336-
// create the list of random values to fill
337-
_randomPars = std::make_unique<RooArgList>();
338-
_finalPars->snapshot(*_randomPars);
339-
// calculate the elements of the upper-triangular matrix L that gives Lt*L = C
340-
// where Lt is the transpose of L (the "square-root method")
341-
TMatrix L(nPar,nPar);
342-
for(Int_t iPar= 0; iPar < nPar; iPar++) {
343-
// calculate the diagonal term first
344-
L(iPar,iPar)= covariance(iPar,iPar);
345-
for(Int_t k= 0; k < iPar; k++) {
346-
double tmp= L(k,iPar);
347-
L(iPar,iPar)-= tmp*tmp;
348-
}
349-
L(iPar,iPar)= sqrt(L(iPar,iPar));
350-
// then the off-diagonal terms
351-
for(Int_t jPar= iPar+1; jPar < nPar; jPar++) {
352-
L(iPar,jPar)= covariance(iPar,jPar);
353-
for(Int_t k= 0; k < iPar; k++) {
354-
L(iPar,jPar)-= L(k,iPar)*L(k,jPar);
355-
}
356-
L(iPar,jPar)/= L(iPar,iPar);
357-
}
358-
}
359-
// remember Lt
360-
_Lt= std::make_unique<TMatrix>(TMatrix::kTransposed,L);
361-
}
362-
else {
363-
// reset to the final fit values
364-
_randomPars->assign(*_finalPars);
336+
if (!_randomPars) { // first-time initialization
337+
assert(nullptr != _finalPars);
338+
// create the list of random values to fill
339+
_randomPars = std::make_unique<RooArgList>();
340+
_finalPars->snapshot(*_randomPars);
341+
// calculate the elements of the upper-triangular matrix L that gives Lt*L = C
342+
// where Lt is the transpose of L (the "square-root method")
343+
TMatrix L(nPar, nPar);
344+
for (Int_t iPar = 0; iPar < nPar; iPar++) {
345+
// calculate the diagonal term first
346+
L(iPar, iPar) = covariance(iPar, iPar);
347+
for (Int_t k = 0; k < iPar; k++) {
348+
double tmp = L(k, iPar);
349+
L(iPar, iPar) -= tmp * tmp;
350+
}
351+
L(iPar, iPar) = sqrt(L(iPar, iPar));
352+
// then the off-diagonal terms
353+
for (Int_t jPar = iPar + 1; jPar < nPar; jPar++) {
354+
L(iPar, jPar) = covariance(iPar, jPar);
355+
for (Int_t k = 0; k < iPar; k++) {
356+
L(iPar, jPar) -= L(k, iPar) * L(k, jPar);
357+
}
358+
L(iPar, jPar) /= L(iPar, iPar);
359+
}
360+
}
361+
// remember Lt
362+
_Lt = std::make_unique<TMatrix>(TMatrix::kTransposed, L);
363+
} else {
364+
// reset to the final fit values
365+
_randomPars->assign(*_finalPars);
365366
}
366367

367368
// create a vector of unit Gaussian variables
@@ -622,25 +623,25 @@ void RooFitResult::fillLegacyCorrMatrix() const
622623
_corrMatrix.Delete();
623624

624625
// Build holding arrays for correlation coefficients
625-
_globalCorr = std::make_unique<RooArgList>("globalCorrelations") ;
626+
_globalCorr = std::make_unique<RooArgList>("globalCorrelations");
626627

627628
for(RooAbsArg* arg : *_initPars) {
628629
// Create global correlation value holder
629630
std::string argName = arg->GetName();
630631
std::string argTitle = arg->GetTitle();
631632
std::string gcName = "GC[" + argName + "]";
632633
std::string gcTitle = argTitle + " Global Correlation";
633-
_globalCorr->addOwned(std::make_unique<RooRealVar>(gcName.c_str(),gcTitle.c_str(),0.));
634+
_globalCorr->addOwned(std::make_unique<RooRealVar>(gcName.c_str(), gcTitle.c_str(), 0.));
634635

635636
// Create array with correlation holders for this parameter
636-
RooArgList* corrMatrixRow = new RooArgList(("C[" + argName + ",*]").c_str()) ;
637+
RooArgList *corrMatrixRow = new RooArgList(("C[" + argName + ",*]").c_str());
637638
_corrMatrix.Add(corrMatrixRow) ;
638639
for(RooAbsArg* arg2 : *_initPars) {
639640

640-
std::string arg2Name = arg2->GetName();
641-
std::string cName = "C[" + argName + "," + arg2Name + "]";
642-
std::string cTitle = "Correlation between " + argName + " and " + arg2Name;
643-
corrMatrixRow->addOwned(std::make_unique<RooRealVar>(cName.c_str(),cTitle.c_str(),0.));
641+
std::string arg2Name = arg2->GetName();
642+
std::string cName = "C[" + argName + "," + arg2Name + "]";
643+
std::string cTitle = "Correlation between " + argName + " and " + arg2Name;
644+
corrMatrixRow->addOwned(std::make_unique<RooRealVar>(cName.c_str(), cTitle.c_str(), 0.));
644645
}
645646
}
646647

@@ -1301,7 +1302,7 @@ void RooFitResult::Streamer(TBuffer &R__b)
13011302
R__b >> _constPars;
13021303
R__b >> _initPars;
13031304
R__b >> _finalPars;
1304-
RooArgList* globalCorr;
1305+
RooArgList *globalCorr;
13051306
R__b >> globalCorr;
13061307
_globalCorr.reset(globalCorr);
13071308
_corrMatrix.Streamer(R__b);

0 commit comments

Comments
 (0)