/usr/include/root/RooStats/RooStatsUtils.h is in libroot-roofit-dev 5.34.00-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | // @(#)root/roostats:$Id: RooStatsUtils.h 44157 2012-05-07 16:41:44Z moneta $
// Author: Kyle Cranmer 28/07/2008
/*************************************************************************
* Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOSTATS_RooStatsUtils
#define ROOSTATS_RooStatsUtils
#ifndef ROOT_TMath
#include "TMath.h"
#endif
#ifndef ROOT_TTree
#include "TTree.h"
#endif
#ifndef ROOT_Math_DistFuncMathCore
#include"Math/DistFuncMathCore.h"
#endif
#include "RooArgSet.h"
#include "RooRealVar.h"
#include "RooAbsCollection.h"
#include "TIterator.h"
#include "RooStats/ModelConfig.h"
#include "RooProdPdf.h"
#include "RooDataSet.h"
namespace RooStats {
// returns one-sided significance corresponding to a p-value
inline Double_t PValueToSignificance(Double_t pvalue){
return ::ROOT::Math::normal_quantile_c(pvalue,1);
}
// returns p-value corresponding to a 1-sided significance
inline Double_t SignificanceToPValue(Double_t Z){
return ::ROOT::Math::normal_cdf_c(Z);
}
inline void SetParameters(const RooArgSet* desiredVals, RooArgSet* paramsToChange){
*paramsToChange=*desiredVals ;
}
inline void RemoveConstantParameters(RooArgSet* set){
RooArgSet constSet;
RooLinkedListIter it = set->iterator();
RooRealVar *myarg;
while ((myarg = (RooRealVar *)it.Next())) {
if(myarg->isConstant()) constSet.add(*myarg);
}
set->remove(constSet);
}
inline bool SetAllConstant(const RooAbsCollection &coll, bool constant = true) {
// utility function to set all variable constant in a collection
// (from G. Petrucciani)
bool changed = false;
RooLinkedListIter iter = coll.iterator();
for (RooAbsArg *a = (RooAbsArg *) iter.Next(); a != 0; a = (RooAbsArg *) iter.Next()) {
RooRealVar *v = dynamic_cast<RooRealVar *>(a);
if (v && (v->isConstant() != constant)) {
changed = true;
v->setConstant(constant);
}
}
return changed;
}
// assuming all values in set are RooRealVars, randomize their values
inline void RandomizeCollection(RooAbsCollection& set,
Bool_t randomizeConstants = kTRUE)
{
RooLinkedListIter it = set.iterator();
RooRealVar* var;
// repeat loop tpo avoid calling isConstant for nothing
if (randomizeConstants) {
while ((var = (RooRealVar*)it.Next()) != NULL)
var->randomize();
}
else {
// exclude constants variables
while ((var = (RooRealVar*)it.Next()) != NULL)
if (!var->isConstant() )
var->randomize();
}
}
void FactorizePdf(const RooArgSet &observables, RooAbsPdf &pdf, RooArgList &obsTerms, RooArgList &constraints);
void FactorizePdf(RooStats::ModelConfig &model, RooAbsPdf &pdf, RooArgList &obsTerms, RooArgList &constraints);
RooAbsPdf * MakeNuisancePdf(RooAbsPdf &pdf, const RooArgSet &observables, const char *name);
RooAbsPdf * MakeNuisancePdf(const RooStats::ModelConfig &model, const char *name);
// Create a TTree with the given name and description. All RooRealVars in the RooDataSet are represented as branches that contain values of type Double_t.
TTree* GetAsTTree(TString name, TString desc, const RooDataSet& data);
}
#endif
|