|
ROOT
Reference Guide |
|
Go to the documentation of this file.
94 _dataVars(
"!dataVars",
"data Vars", this),
95 _paramSet(
"!paramSet",
"bin parameters", this),
97 _dataSet( (std::string(
name)+
"_dataSet").c_str(),
"", vars)
139 _dataVars(
"!dataVars",
"data Vars", this),
140 _paramSet(
"!paramSet",
"bin parameters", this),
142 _dataSet( (std::string(
name)+
"_dataSet").c_str(),
"", vars, Hist)
161 if( vars.
getSize() == 0 )
return 0;
169 std::cout <<
"ParamHistFunc::GetNumBins" << vars.
GetName() <<
") ERROR: component "
171 <<
" in vars list is not of type RooRealVar" << std::endl ;
190 _dataVars(
"!dataVars", this, other._dataVars ),
191 _paramSet(
"!paramSet", this, other._paramSet),
192 _numBins( other._numBins ),
193 _binMap( other._binMap ),
194 _dataSet( other._dataSet )
233 Int_t gammaIndex = -1;
238 std::cout <<
"Error: ParamHistFunc internal bin index map "
239 <<
"not properly configured" << std::endl;
262 for(
int i=0; i <
numBins(); ++i) {
273 if( num_hist_bins !=
numBins() ) {
274 std::cout <<
"Error - ParamHistFunc: cannot set Shape of ParamHistFunc: " <<
GetName()
275 <<
" using histogram: " << shape->
GetName()
276 <<
". Bins don't match" << std::endl;
277 throw std::runtime_error(
"setShape");
281 Int_t TH1BinNumber = 0;
324 std::cout <<
"Warning - ParamHistFunc::createParamSet() :"
325 <<
" No Variables provided. Not making constraint terms."
330 else if( numVars == 1 ) {
335 std::stringstream VarNameStream;
336 VarNameStream <<
Prefix <<
"_bin_" << i;
337 std::string VarName = VarNameStream.str();
342 gamma.setConstant(
false );
347 paramSet.
add( *gamma_wspace );
352 else if( numVars == 2 ) {
356 std::vector< Int_t > Indices(numVars, 0);
369 std::stringstream VarNameStream;
370 VarNameStream <<
Prefix <<
"_bin_" << i <<
"_" << j;
371 std::string VarName = VarNameStream.str();
376 gamma.setConstant(
false );
381 paramSet.
add( *gamma_wspace );
387 else if( numVars == 3 ) {
391 std::vector< Int_t > Indices(numVars, 0);
406 std::stringstream VarNameStream;
407 VarNameStream <<
Prefix <<
"_bin_" << i <<
"_" << j <<
"_" << k;
408 std::string VarName = VarNameStream.str();
413 gamma.setConstant(
false );
418 paramSet.
add( *gamma_wspace );
426 std::cout <<
" Error: ParamHistFunc doesn't support dimensions > 3D " << std::endl;
458 for (
auto comp : params) {
462 var->setMax( gamma_max );
486 if( gamma_max <= gamma_min ) {
488 std::cout <<
"Warning: gamma_min <= gamma_max: Using default values (0, 10)" << std::endl;
497 if( gamma_nominal < gamma_min ) {
498 gamma_nominal = gamma_min;
501 if( gamma_nominal > gamma_max ) {
502 gamma_nominal = gamma_max;
508 std::stringstream VarNameStream;
509 VarNameStream <<
Prefix <<
"_bin_" << i;
510 std::string VarName = VarNameStream.str();
513 gamma_nominal, gamma_min, gamma_max );
514 gamma->setConstant(
false );
541 << comp->
GetName() <<
" in variables list is not of type RooRealVar"
561 }
else if( numVars == 2 ) {
567 }
else if( numVars == 3 ) {
575 std::cout <<
"ParamHistFunc() - Only works for 1-3 variables (1d-3d)" << std::endl;
586 for(
Int_t i = 0; i < numBinsX; ++i ) {
587 for(
Int_t j = 0; j < numBinsY; ++j ) {
588 for(
Int_t k = 0; k < numBinsZ; ++k ) {
590 Int_t RooDataSetBin = k + j*numBinsZ + i*numBinsY*numBinsZ;
591 Int_t TH1HistBin = i + j*numBinsX + k*numBinsX*numBinsY;
593 _binMap[RooDataSetBin] = TH1HistBin;
616 if( numVarBins != numElements ) {
617 std::cout <<
"ParamHistFunc::addParamSet - ERROR - "
618 <<
"Supplied list of parameters " << params.
GetName()
619 <<
" has " << numElements <<
" elements but the ParamHistFunc"
620 <<
GetName() <<
" has " << numVarBins <<
" bins."
636 << comp->
GetName() <<
" in paramater list is not of type RooRealVar"
673 if (allVars.
getSize()==0)
return 0 ;
678 analVars.
add(allVars) ;
681 Int_t sterileIdx(-1) ;
713 Int_t nominalItr = 0;
717 Double_t paramVal = (*param).getVal();
724 value += paramVal*binVolumeDS;
761 std::list<Double_t>* hint =
new std::list<Double_t> ;
764 xlo = xlo - 0.01*(xhi-xlo) ;
765 xhi = xhi + 0.01*(xhi-xlo) ;
772 if (boundaries[i]>=xlo && boundaries[i]<=xhi) {
773 hint->push_back(boundaries[i]-delta) ;
774 hint->push_back(boundaries[i]+delta) ;
796 std::list<Double_t>* hint =
new std::list<Double_t> ;
801 if (boundaries[i]>=xlo && boundaries[i]<=xhi) {
802 hint->push_back(boundaries[i]) ;
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=0)
virtual void setVal(Double_t value)
Set value of variable to 'value'.
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const
Return sampling hint for making curves of (projections) of this function as the recursive division st...
void setMin(const char *name, Double_t value)
Set minimum of name range to given value.
T * getObj(const RooArgSet *nset, Int_t *sterileIndex=0, const TNamed *isetRangeName=0)
virtual Int_t GetNbinsZ() const
Int_t addVarSet(const RooArgList &vars)
return 0 for success return 1 for failure Check that the elements are actually RooRealVar's If so,...
std::map< Int_t, Int_t > _binMap
RooFIter fwdIterator() const
One-time forward iterator.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooRealVar & getParameter() const
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
virtual const RooAbsBinning * getBinningPtr(const char *rangeName) const =0
Double_t evaluate() const
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
RooAbsCacheElement is the abstract base class for objects to be stored in RooAbsCache cache manager o...
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &analVars, const RooArgSet *normSet, const char *rangeName=0) const
Advertise that all integrals can be handled internally.
const char * GetName() const
Returns name of object.
virtual Double_t * array() const =0
void setConstant(bool constant)
RooCmdArg RecycleConflictNodes(Bool_t flag=kTRUE)
Bool_t import(const RooAbsArg &arg, const RooCmdArg &arg1=RooCmdArg(), const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg())
Import a RooAbsArg object, e.g.
Int_t getCurrentBin() const
Get the index of the gamma parameter associated with the current bin.
Double_t analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=0) const
Implement analytical integrations by doing appropriate weighting from component integrals functions t...
const RooArgSet * get() const override
Get bin centre of current bin.
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual Int_t numBins(const char *rangeName=0) const
Int_t getIndex(const RooArgSet &coord, Bool_t fast=false) const
Calculate bin number of the given coordinates.
A one-time forward iterator working on RooLinkedList or RooAbsCollection.
Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
Add element to non-owning set.
RooAbsBinning is the abstract base class for RooRealVar binning definitions.
RooAbsArg * next()
Return next element or nullptr if at end.
Bool_t IsBinOverflow(Int_t bin, Int_t axis=0) const
Return true if the bin is overflow.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
static Int_t GetNumBins(const RooArgSet &vars)
Bool_t IsBinUnderflow(Int_t bin, Int_t axis=0) const
Return true if the bin is underflow.
double binVolume(std::size_t i) const
Return bin volume of i-th bin.
RooObjCacheManager _normIntMgr
void setShape(TH1 *shape)
The RooWorkspace is a persistable container for RooFit projects.
TH1 is the base class of all histogram classes in ROOT.
virtual Int_t numBoundaries() const =0
void setConstant(Bool_t value=kTRUE)
A class which maps the current values of a RooRealVar (or a set of RooRealVars) to one of a number of...
RooRealVar * var(const char *name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found.
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
virtual Int_t GetNbinsY() const
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
Reimplementation of standard RooArgList::add()
Abstract base class for objects that are lvalues, i.e.
virtual const char * GetName() const
Returns name of object.
RooRealVar represents a variable that can be changed from the outside.
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
static RooArgList createParamSet(RooWorkspace &w, const std::string &, const RooArgList &Vars)
Create the list of RooRealVar parameters which represent the height of the histogram bins.
virtual std::list< Double_t > * binBoundaries(RooAbsRealLValue &, Double_t, Double_t) const
Return sampling hint for making curves of (projections) of this function as the recursive division st...
RooArgSet is a container object that can hold multiple RooAbsArg objects.
virtual Int_t GetNbinsX() const
Int_t addParamSet(const RooArgList ¶ms)
void setParamConst(Int_t, Bool_t=kTRUE)