99 _dataVars(
"!dataVars",
"data Vars", this),
100 _paramSet(
"!paramSet",
"bin parameters", this),
102 _dataSet( (std::string(
name)+
"_dataSet").c_str(),
"", vars)
142 _dataVars(
"!dataVars",
"data Vars", this),
143 _paramSet(
"!paramSet",
"bin parameters", this),
145 _dataSet( (std::string(
name)+
"_dataSet").c_str(),
"", vars, Hist)
164 if( vars.
getSize() == 0 )
return 0;
172 std::cout <<
"ParamHistFunc::GetNumBins" << vars.
GetName() <<
") ERROR: component "
174 <<
" in vars list is not of type RooRealVar" << std::endl ;
193 _dataVars(
"!dataVars", this, other._dataVars ),
194 _paramSet(
"!paramSet", this, other._paramSet),
195 _numBins( other._numBins ),
196 _binMap( other._binMap ),
197 _dataSet( other._dataSet )
236 Int_t gammaIndex = -1;
241 std::cout <<
"Error: ParamHistFunc internal bin index map "
242 <<
"not properly configured" << std::endl;
265 for(
int i=0; i <
numBins(); ++i) {
276 if( num_hist_bins !=
numBins() ) {
277 std::cout <<
"Error - ParamHistFunc: cannot set Shape of ParamHistFunc: " <<
GetName()
278 <<
" using histogram: " << shape->
GetName()
279 <<
". Bins don't match" << std::endl;
280 throw std::runtime_error(
"setShape");
284 Int_t TH1BinNumber = 0;
327 std::cout <<
"Warning - ParamHistFunc::createParamSet() :"
328 <<
" No Variables provided. Not making constraint terms."
333 else if( numVars == 1 ) {
338 std::stringstream VarNameStream;
339 VarNameStream <<
Prefix <<
"_bin_" << i;
340 std::string VarName = VarNameStream.str();
345 gamma.setConstant(
false );
350 paramSet.
add( *gamma_wspace );
355 else if( numVars == 2 ) {
359 std::vector< Int_t > Indices(numVars, 0);
372 std::stringstream VarNameStream;
373 VarNameStream <<
Prefix <<
"_bin_" << i <<
"_" << j;
374 std::string VarName = VarNameStream.str();
379 gamma.setConstant(
false );
384 paramSet.
add( *gamma_wspace );
390 else if( numVars == 3 ) {
394 std::vector< Int_t > Indices(numVars, 0);
409 std::stringstream VarNameStream;
410 VarNameStream <<
Prefix <<
"_bin_" << i <<
"_" << j <<
"_" << k;
411 std::string VarName = VarNameStream.str();
416 gamma.setConstant(
false );
421 paramSet.
add( *gamma_wspace );
429 std::cout <<
" Error: ParamHistFunc doesn't support dimensions > 3D " << std::endl;
462 for (
auto comp : params) {
491 if( gamma_max <= gamma_min ) {
493 std::cout <<
"Warning: gamma_min <= gamma_max: Using default values (0, 10)" << std::endl;
502 if( gamma_nominal < gamma_min ) {
503 gamma_nominal = gamma_min;
506 if( gamma_nominal > gamma_max ) {
507 gamma_nominal = gamma_max;
513 std::stringstream VarNameStream;
514 VarNameStream <<
Prefix <<
"_bin_" << i;
515 std::string VarName = VarNameStream.str();
518 gamma_nominal, gamma_min, gamma_max );
519 gamma->setConstant(
false );
546 << comp->
GetName() <<
" in variables list is not of type RooRealVar"
566 }
else if( numVars == 2 ) {
572 }
else if( numVars == 3 ) {
580 std::cout <<
"ParamHistFunc() - Only works for 1-3 variables (1d-3d)" << std::endl;
591 for(
Int_t i = 0; i < numBinsX; ++i ) {
592 for(
Int_t j = 0; j < numBinsY; ++j ) {
593 for(
Int_t k = 0; k < numBinsZ; ++k ) {
595 Int_t RooDataSetBin = k + j*numBinsZ + i*numBinsY*numBinsZ;
596 Int_t TH1HistBin = i + j*numBinsX + k*numBinsX*numBinsY;
598 _binMap[RooDataSetBin] = TH1HistBin;
621 if( numVarBins != numElements ) {
622 std::cout <<
"ParamHistFunc::addParamSet - ERROR - "
623 <<
"Supplied list of parameters " << params.
GetName()
624 <<
" has " << numElements <<
" elements but the ParamHistFunc"
625 <<
GetName() <<
" has " << numVarBins <<
" bins."
641 << comp->
GetName() <<
" in paramater list is not of type RooRealVar"
678 if (allVars.
getSize()==0)
return 0 ;
683 analVars.
add(allVars) ;
686 Int_t sterileIdx(-1) ;
718 Int_t nominalItr = 0;
729 value += paramVal*binVolumeDS;
766 std::list<Double_t>* hint =
new std::list<Double_t> ;
769 xlo = xlo - 0.01*(xhi-xlo) ;
770 xhi = xhi + 0.01*(xhi-xlo) ;
777 if (boundaries[i]>=xlo && boundaries[i]<=xhi) {
778 hint->push_back(boundaries[i]-delta) ;
779 hint->push_back(boundaries[i]+delta) ;
801 std::list<Double_t>* hint =
new std::list<Double_t> ;
806 if (boundaries[i]>=xlo && boundaries[i]<=xhi) {
807 hint->push_back(boundaries[i]) ;
A class which maps the current values of a RooRealVar (or a set of RooRealVars) to one of a number of...
void setParamConst(Int_t, Bool_t=kTRUE)
RooRealVar & getParameter() const
static Int_t GetNumBins(const RooArgSet &vars)
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 setConstant(bool constant)
Int_t getCurrentBin() const
Get the index of the gamma parameter associated with the current bin.
RooObjCacheManager _normIntMgr
Int_t addVarSet(const RooArgList &vars)
return 0 for success return 1 for failure Check that the elements are actually RooRealVar's If so,...
Int_t addParamSet(const RooArgList ¶ms)
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.
void setShape(TH1 *shape)
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...
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &analVars, const RooArgSet *normSet, const char *rangeName=0) const
Advertise that all integrals can be handled internally.
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...
Double_t evaluate() const
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
std::map< Int_t, Int_t > _binMap
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
RooAbsBinning is the abstract base class for RooRealVar binning definitions This class defines the in...
virtual Double_t * array() const =0
virtual Int_t numBoundaries() const =0
RooAbsCacheElement is the abstract base class for objects to be stored in RooAbsCache cache manager o...
RooFIter fwdIterator() const R__SUGGEST_ALTERNATIVE("begin()
One-time forward iterator.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
const char * GetName() const
Returns name of object.
Abstract base class for objects that are lvalues, i.e.
virtual const RooAbsBinning * getBinningPtr(const char *rangeName) const =0
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
virtual Int_t numBins(const char *rangeName=0) const
void setConstant(Bool_t value=kTRUE)
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
T * getObj(const RooArgSet *nset, Int_t *sterileIndex=0, const TNamed *isetRangeName=0)
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=0)
Int_t getIndex(const RooArgSet &coord, Bool_t fast=kFALSE)
virtual const RooArgSet * get() const
Double_t binVolume() const
A one-time forward iterator working on RooLinkedList or RooAbsCollection.
RooAbsArg * next()
Return next element or nullptr if at end.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Reimplementation of standard RooArgList::add()
RooRealVar represents a variable that can be changed from the outside.
void setMin(const char *name, Double_t value)
Set minimum of name range to given value.
void setMax(const char *name, Double_t value)
Set maximum of name range to given value.
virtual void setVal(Double_t value)
Set value of variable to 'value'.
The RooWorkspace is a persistable container for RooFit projects.
RooRealVar * var(const char *name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found.
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.
virtual Int_t GetNbinsY() const
virtual Int_t GetNbinsZ() const
virtual Int_t GetNbinsX() const
Bool_t IsBinUnderflow(Int_t bin, Int_t axis=0) const
Return true if the bin is underflow.
Bool_t IsBinOverflow(Int_t bin, Int_t axis=0) const
Return true if the bin is overflow.
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual const char * GetName() const
Returns name of object.
RooCmdArg RecycleConflictNodes(Bool_t flag=kTRUE)