100 _dataVars(
"!dataVars",
"data Vars", this),
101 _paramSet(
"!paramSet",
"bin parameters", this),
103 _dataSet( (
std::string(name)+
"_dataSet").c_str(),
"", vars)
145 _dataVars(
"!dataVars",
"data Vars", this),
146 _paramSet(
"!paramSet",
"bin parameters", this),
148 _dataSet( (
std::string(name)+
"_dataSet").c_str(),
"", vars, Hist)
179 if( vars.
getSize() == 0 )
return 0;
186 if (!dynamic_cast<RooRealVar*>(comp)) {
187 std::cout <<
"ParamHistFunc::GetNumBins" << vars.
GetName() <<
") ERROR: component " 189 <<
" in vars list is not of type RooRealVar" << std::endl ;
196 numBins *= varNumBins;
255 Int_t gammaIndex = -1;
260 std::cout <<
"Error: ParamHistFunc internal bin index map " 261 <<
"not properly configured" << std::endl;
284 for(
int i=0; i <
numBins(); ++i) {
295 if( num_hist_bins !=
numBins() ) {
296 std::cout <<
"Error - ParamHistFunc: cannot set Shape of ParamHistFunc: " <<
GetName()
297 <<
" using histogram: " << shape->
GetName()
298 <<
". Bins don't match" << std::endl;
299 throw std::runtime_error(
"setShape");
303 Int_t TH1BinNumber = 0;
346 std::cout <<
"Warning - ParamHistFunc::createParamSet() :" 347 <<
" No Variables provided. Not making constraint terms." 352 else if( numVars == 1 ) {
357 std::stringstream VarNameStream;
358 VarNameStream << Prefix <<
"_bin_" << i;
359 std::string VarName = VarNameStream.str();
364 gamma.setConstant(
false );
369 paramSet.
add( *gamma_wspace );
374 else if( numVars == 2 ) {
378 std::vector< Int_t > Indices(numVars, 0);
391 std::stringstream VarNameStream;
392 VarNameStream << Prefix <<
"_bin_" << i <<
"_" << j;
393 std::string VarName = VarNameStream.str();
398 gamma.setConstant(
false );
403 paramSet.
add( *gamma_wspace );
409 else if( numVars == 3 ) {
413 std::vector< Int_t > Indices(numVars, 0);
428 std::stringstream VarNameStream;
429 VarNameStream << Prefix <<
"_bin_" << i <<
"_" << j <<
"_" << k;
430 std::string VarName = VarNameStream.str();
435 gamma.setConstant(
false );
440 paramSet.
add( *gamma_wspace );
448 std::cout <<
" Error: ParamHistFunc doesn't support dimensions > 3D " << std::endl;
512 if( gamma_max <= gamma_min ) {
514 std::cout <<
"Warming: gamma_min <= gamma_max: Using default values (0, 10)" << std::endl;
523 if( gamma_nominal < gamma_min ) {
524 gamma_nominal = gamma_min;
527 if( gamma_nominal > gamma_max ) {
528 gamma_nominal = gamma_max;
534 std::stringstream VarNameStream;
535 VarNameStream << Prefix <<
"_bin_" << i;
536 std::string VarName = VarNameStream.str();
539 gamma_nominal, gamma_min, gamma_max );
541 paramSet.
add( *gamma );
566 if (!dynamic_cast<RooRealVar*>(comp)) {
568 << comp->
GetName() <<
" in variables list is not of type RooRealVar" 588 }
else if( numVars == 2 ) {
594 }
else if( numVars == 3 ) {
602 std::cout <<
"ParamHistFunc() - Only works for 1-3 variables (1d-3d)" << std::endl;
613 for(
Int_t i = 0; i < numBinsX; ++i ) {
614 for(
Int_t j = 0; j < numBinsY; ++j ) {
615 for(
Int_t k = 0; k < numBinsZ; ++k ) {
617 Int_t RooDataSetBin = k + j*numBinsZ + i*numBinsY*numBinsZ;
618 Int_t TH1HistBin = i + j*numBinsX + k*numBinsX*numBinsY;
620 _binMap[RooDataSetBin] = TH1HistBin;
643 if( numVarBins != numElements ) {
644 std::cout <<
"ParamHistFunc::addParamSet - ERROR - " 645 <<
"Supplied list of parameters " << params.
GetName()
646 <<
" has " << numElements <<
" elements but the ParamHistFunc" 647 <<
GetName() <<
" has " << numVarBins <<
" bins." 661 if (!dynamic_cast<RooRealVar*>(comp)) {
663 << comp->
GetName() <<
" in paramater list is not of type RooRealVar" 700 if (allVars.
getSize()==0)
return 0 ;
705 analVars.
add(allVars) ;
708 Int_t sterileIdx(-1) ;
740 Int_t nominalItr = 0;
744 Double_t paramVal = (*param).getVal();
751 value += paramVal*binVolumeDS;
Int_t addVarSet(const RooArgList &vars)
virtual const char * GetName() const
Returns name of object.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
Bool_t IsBinUnderflow(Int_t bin, Int_t axis=0) const
Return true if the bin is underflow.
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...
virtual const RooArgSet * get() const
static Int_t GetNumBins(const RooArgSet &vars)
Bool_t IsBinOverflow(Int_t bin, Int_t axis=0) const
Return true if the bin is overflow.
virtual Int_t numBins(const char *rangeName=0) const
Double_t getVal(const RooArgSet *set=0) const
Double_t evaluate() const
Int_t getIndex(const RooArgSet &coord, Bool_t fast=kFALSE)
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual Int_t GetNbinsZ() const
void setShape(TH1 *shape)
RooCmdArg RecycleConflictNodes(Bool_t flag=kTRUE)
void setConstant(bool constant)
void setMax(const char *name, Double_t value)
Set maximum of name range to given value.
Int_t addParamSet(const RooArgList ¶ms)
void setParamConst(Int_t, Bool_t=kTRUE)
T * getObj(const RooArgSet *nset, Int_t *sterileIndex=0, const TNamed *isetRangeName=0)
Double_t binVolume() const
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...
static RooArgList createParamSet(RooWorkspace &w, const std::string &, const RooArgList &Vars)
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Reimplementation of standard RooArgList::add()
RooRealVar represents a fundamental (non-derived) real valued object.
virtual void setVal(Double_t value)
Set value of variable to 'value'.
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...
RooAbsArg * at(Int_t idx) const
Int_t getCurrentBin() const
void setConstant(Bool_t value=kTRUE)
void setMin(const char *name, Double_t value)
Set minimum of name range to given value.
RooAbsCacheElement is the abstract base class for objects to be stored in RooAbsCache cache manager o...
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...
std::map< Int_t, Int_t > _binMap
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
RooFIter fwdIterator() const
RooObjCacheManager _normIntMgr
RooRealVar * var(const char *name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found...
const char * GetName() const
Returns name of object.
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
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 getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &analVars, const RooArgSet *normSet, const char *rangeName=0) const
Advertise that all integrals can be handled internally.
RooRealVar & getParameter() const
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=0)
virtual Int_t GetNbinsX() const
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
The RooWorkspace is a persistable container for RooFit projects.
virtual Int_t GetNbinsY() const