CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
FastVerticalInterpHistPdf Class Reference

#include <VerticalInterpHistPdf.h>

Inheritance diagram for FastVerticalInterpHistPdf:
FastVerticalInterpHistPdfBase

Public Member Functions

virtual TObject * clone (const char *newname) const
 
Double_t evaluate () const
 
 FastVerticalInterpHistPdf ()
 
 FastVerticalInterpHistPdf (const char *name, const char *title, const RooRealVar &x, const RooArgList &funcList, const RooArgList &coefList, Double_t smoothRegion=1., Int_t smoothAlgo=1)
 
 FastVerticalInterpHistPdf (const FastVerticalInterpHistPdf &other, const char *name=0)
 
Bool_t hasCache () const
 
Bool_t isCacheReady () const
 
virtual ~FastVerticalInterpHistPdf ()
 
- Public Member Functions inherited from FastVerticalInterpHistPdfBase
const RooArgList & coefList () const
 
 FastVerticalInterpHistPdfBase ()
 
 FastVerticalInterpHistPdfBase (const char *name, const char *title, const RooArgSet &obs, const RooArgList &funcList, const RooArgList &coefList, Double_t smoothRegion=1., Int_t smoothAlgo=1)
 
 FastVerticalInterpHistPdfBase (const FastVerticalInterpHistPdfBase &other, const char *name=0)
 
const RooArgList & funcList () const
 
Bool_t selfNormalized () const
 
virtual ~FastVerticalInterpHistPdfBase ()
 

Protected Member Functions

void setupCaches () const
 not to be serialized More...
 
void syncComponent (int which) const
 
void syncComponents (int dimension) const
 
void syncNominal () const
 
void syncTotal () const
 
- Protected Member Functions inherited from FastVerticalInterpHistPdfBase
double smoothStepFunc (double x) const
 
void syncMorph (Morph &out, const FastTemplate &nominal, FastTemplate &lo, FastTemplate &hi) const
 not to be serialized More...
 
void syncTotal (FastTemplate &cache, const FastTemplate &cacheNominal, const FastTemplate &cacheNominalLog) const
 

Protected Attributes

FastHisto _cache
 Cache of the result. More...
 
FastHisto _cacheNominal
 Cache of nominal pdf (additive morphing) and its bin-by-bin logarithm (multiplicative) More...
 
FastHisto _cacheNominalLog
 not to be serialized More...
 
RooRealProxy _x
 
- Protected Attributes inherited from FastVerticalInterpHistPdfBase
TIterator * _coefIter
 Iterator over FUNC list. More...
 
RooListProxy _coefList
 
TIterator * _funcIter
 
RooListProxy _funcList
 
bool _init
 Iterator over coefficient list. More...
 
std::vector< RooAbsReal * > _morphParams
 not to be serialized More...
 
std::vector< Morph_morphs
 not to be serialized More...
 
SimpleCacheSentry _sentry
 not to be serialized More...
 
Int_t _smoothAlgo
 
Double_t _smoothRegion
 
RooRealProxy _x
 

Detailed Description

Definition at line 125 of file VerticalInterpHistPdf.h.

Constructor & Destructor Documentation

FastVerticalInterpHistPdf::FastVerticalInterpHistPdf ( )
inline

Definition at line 128 of file VerticalInterpHistPdf.h.

Referenced by clone().

FastVerticalInterpHistPdf::FastVerticalInterpHistPdf ( const char *  name,
const char *  title,
const RooRealVar &  x,
const RooArgList &  funcList,
const RooArgList &  coefList,
Double_t  smoothRegion = 1.,
Int_t  smoothAlgo = 1 
)
inline

Definition at line 129 of file VerticalInterpHistPdf.h.

129  :
130  FastVerticalInterpHistPdfBase(name,title,RooArgSet(x),funcList,coefList,smoothRegion,smoothAlgo),
131  _x("x","Independent variable",this,const_cast<RooRealVar&>(x)),
FastHisto _cache
Cache of the result.
FastHisto _cacheNominal
Cache of nominal pdf (additive morphing) and its bin-by-bin logarithm (multiplicative) ...
const RooArgList & funcList() const
const RooArgList & coefList() const
x
Definition: VDTMath.h:216
FastHisto _cacheNominalLog
not to be serialized
FastVerticalInterpHistPdf::FastVerticalInterpHistPdf ( const FastVerticalInterpHistPdf other,
const char *  name = 0 
)
inline

Definition at line 133 of file VerticalInterpHistPdf.h.

133  :
135  _x("x",this,other._x),
136 #ifdef FastVerticalInterpHistPdf_CopyConstructor
FastHisto _cache
Cache of the result.
FastHisto _cacheNominal
Cache of nominal pdf (additive morphing) and its bin-by-bin logarithm (multiplicative) ...
FastHisto _cacheNominalLog
not to be serialized
virtual FastVerticalInterpHistPdf::~FastVerticalInterpHistPdf ( )
inlinevirtual

Definition at line 142 of file VerticalInterpHistPdf.h.

142 {}

Member Function Documentation

virtual TObject* FastVerticalInterpHistPdf::clone ( const char *  newname) const
inlinevirtual

Implements FastVerticalInterpHistPdfBase.

Definition at line 141 of file VerticalInterpHistPdf.h.

References FastVerticalInterpHistPdf().

141 { return new FastVerticalInterpHistPdf(*this,newname) ; }
Double_t FastVerticalInterpHistPdf::evaluate ( ) const
virtual

Implements FastVerticalInterpHistPdfBase.

Definition at line 324 of file VerticalInterpHistPdf.cc.

References _cache, FastVerticalInterpHistPdfBase::_init, FastVerticalInterpHistPdfBase::_sentry, _x, FastHisto::GetAt(), SimpleCacheSentry::good(), setupCaches(), FastTemplate::size(), syncTotal(), and TRACEME.

325 {
326  TRACEME()
327  if (_cache.size() == 0) setupCaches();
328  if (!_sentry.good() || !_init) syncTotal();
329  //return std::max<double>(1e-9, _cache.GetAt(_x));
330  return _cache.GetAt(_x);
331 }
FastHisto _cache
Cache of the result.
#define TRACEME()
void setupCaches() const
not to be serialized
bool _init
Iterator over coefficient list.
SimpleCacheSentry _sentry
not to be serialized
perl if(1 lt scalar(@::datatypes))
Definition: edlooper.cc:31
tuple size
Write out results.
Bool_t FastVerticalInterpHistPdf::hasCache ( ) const
inline

Definition at line 146 of file VerticalInterpHistPdf.h.

References _cache, and FastTemplate::size().

146 { return _cache.size() > 0; }
const unsigned int size() const
Definition: FastTemplate.h:42
FastHisto _cache
Cache of the result.
Bool_t FastVerticalInterpHistPdf::isCacheReady ( ) const
inline

Definition at line 147 of file VerticalInterpHistPdf.h.

References _cache, FastVerticalInterpHistPdfBase::_init, and FastTemplate::size().

147 { return _cache.size() > 0 && _init; }
const unsigned int size() const
Definition: FastTemplate.h:42
FastHisto _cache
Cache of the result.
bool _init
Iterator over coefficient list.
void FastVerticalInterpHistPdf::setupCaches ( ) const
protected

not to be serialized

Definition at line 489 of file VerticalInterpHistPdf.cc.

References _cache, _cacheNominal, FastVerticalInterpHistPdfBase::_coefIter, FastVerticalInterpHistPdfBase::_coefList, FastVerticalInterpHistPdfBase::_morphParams, FastVerticalInterpHistPdfBase::_morphs, FastVerticalInterpHistPdfBase::_sentry, SimpleCacheSentry::addVars(), SimpleCacheSentry::empty(), i, FastTemplate::size(), syncComponents(), syncNominal(), syncTotal(), and TRACEME.

Referenced by evaluate().

489  {
490  TRACEME()
491  int ndim = _coefList.getSize();
492 
493  _morphs.resize(ndim);
494  _morphParams.resize(ndim);
495  syncNominal();
496  //printf("Nominal template has been set up: \n"); _cacheNominal.Dump();
497  _coefIter->Reset();
498  for (int i = 0; i < ndim; ++i) {
499  _morphParams[i] = dynamic_cast<RooAbsReal *>(_coefIter->Next());
500  _morphs[i].sum.Resize(_cacheNominal.size());
501  _morphs[i].diff.Resize(_cacheNominal.size());
502  syncComponents(i);
503  }
505 
507  syncTotal();
508 }
int i
Definition: DBlmapReader.cc:9
const unsigned int size() const
Definition: FastTemplate.h:42
FastHisto _cache
Cache of the result.
#define TRACEME()
FastHisto _cacheNominal
Cache of nominal pdf (additive morphing) and its bin-by-bin logarithm (multiplicative) ...
TIterator * _coefIter
Iterator over FUNC list.
std::vector< RooAbsReal * > _morphParams
not to be serialized
std::vector< Morph > _morphs
not to be serialized
void syncComponents(int dimension) const
void addVars(const RooAbsCollection &vars)
bool empty() const
SimpleCacheSentry _sentry
not to be serialized
void Reset(std::vector< TH2F > &depth)
void FastVerticalInterpHistPdf::syncComponent ( int  which) const
protected
void FastVerticalInterpHistPdf::syncComponents ( int  dimension) const
protected

Definition at line 392 of file VerticalInterpHistPdf.cc.

References _cacheNominal, FastVerticalInterpHistPdfBase::_funcList, FastVerticalInterpHistPdfBase::_morphs, _x, FastHisto::Normalize(), FastVerticalInterpHistPdfBase::syncMorph(), TRACEME, and vdt::x.

Referenced by setupCaches().

392  {
393  TRACEME()
394  RooAbsPdf *pdfHi = dynamic_cast<RooAbsPdf *>(_funcList.at(2*dim+1));
395  RooAbsPdf *pdfLo = dynamic_cast<RooAbsPdf *>(_funcList.at(2*dim+2));
396  const RooRealVar &x = dynamic_cast<const RooRealVar &>(_x.arg());
397  std::auto_ptr<TH1> histHi(pdfHi->createHistogram("",x)); histHi->SetDirectory(0);
398  std::auto_ptr<TH1> histLo(pdfLo->createHistogram("",x)); histLo->SetDirectory(0);
399 
400  FastHisto hi(*histHi), lo(*histLo);
401  //printf("Un-normalized templates for dimension %d: \n", dim); hi.Dump(); lo.Dump();
402  hi.Normalize(); lo.Normalize();
403  //printf("Normalized templates for dimension %d: \n", dim); hi.Dump(); lo.Dump();
404  syncMorph(_morphs[dim], _cacheNominal, lo, hi);
405 }
#define TRACEME()
A arg
Definition: Factorize.h:36
FastHisto _cacheNominal
Cache of nominal pdf (additive morphing) and its bin-by-bin logarithm (multiplicative) ...
std::vector< Morph > _morphs
not to be serialized
string const
Definition: compareJSON.py:14
x
Definition: VDTMath.h:216
void syncMorph(Morph &out, const FastTemplate &nominal, FastTemplate &lo, FastTemplate &hi) const
not to be serialized
list at
Definition: asciidump.py:428
void FastVerticalInterpHistPdf::syncNominal ( ) const
protected

Definition at line 346 of file VerticalInterpHistPdf.cc.

References _cacheNominal, _cacheNominalLog, FastVerticalInterpHistPdfBase::_funcList, FastVerticalInterpHistPdfBase::_smoothAlgo, _x, estimatePileup::hist, FastTemplate::Log(), FastHisto::Normalize(), TRACEME, and vdt::x.

Referenced by setupCaches().

346  {
347  TRACEME()
348  RooAbsPdf *pdf = dynamic_cast<RooAbsPdf *>(_funcList.at(0));
349  const RooRealVar &x = dynamic_cast<const RooRealVar &>(_x.arg());
350  std::auto_ptr<TH1> hist(pdf->createHistogram("",x));
351  hist->SetDirectory(0);
353  _cacheNominal.Normalize();
354  if (_smoothAlgo < 0) {
357  }
358 }
#define TRACEME()
A arg
Definition: Factorize.h:36
void Log()
*this = log(*this)
FastHisto _cacheNominal
Cache of nominal pdf (additive morphing) and its bin-by-bin logarithm (multiplicative) ...
string const
Definition: compareJSON.py:14
perl if(1 lt scalar(@::datatypes))
Definition: edlooper.cc:31
x
Definition: VDTMath.h:216
list at
Definition: asciidump.py:428
FastHisto _cacheNominalLog
not to be serialized
void FastVerticalInterpHistPdf::syncTotal ( ) const
protected

Definition at line 471 of file VerticalInterpHistPdf.cc.

References _cache, _cacheNominal, _cacheNominalLog, FastHisto::Normalize(), and FastVerticalInterpHistPdfBase::syncTotal().

Referenced by evaluate(), and setupCaches().

471  {
473 
474  // normalize the result
475  _cache.Normalize();
476  //printf("Normalized result\n"); _cache.Dump();
477 }
FastHisto _cache
Cache of the result.
void Normalize()
Definition: FastTemplate.h:92
void syncTotal(FastTemplate &cache, const FastTemplate &cacheNominal, const FastTemplate &cacheNominalLog) const
FastHisto _cacheNominal
Cache of nominal pdf (additive morphing) and its bin-by-bin logarithm (multiplicative) ...
FastHisto _cacheNominalLog
not to be serialized

Member Data Documentation

FastHisto FastVerticalInterpHistPdf::_cache
mutableprotected

Cache of the result.

Definition at line 152 of file VerticalInterpHistPdf.h.

Referenced by evaluate(), hasCache(), isCacheReady(), setupCaches(), and syncTotal().

FastHisto FastVerticalInterpHistPdf::_cacheNominal
mutableprotected

Cache of nominal pdf (additive morphing) and its bin-by-bin logarithm (multiplicative)

not to be serialized

Definition at line 154 of file VerticalInterpHistPdf.h.

Referenced by setupCaches(), syncComponents(), syncNominal(), and syncTotal().

FastHisto FastVerticalInterpHistPdf::_cacheNominalLog
mutableprotected

not to be serialized

Definition at line 155 of file VerticalInterpHistPdf.h.

Referenced by syncNominal(), and syncTotal().

RooRealProxy FastVerticalInterpHistPdf::_x
protected

Definition at line 149 of file VerticalInterpHistPdf.h.

Referenced by evaluate(), syncComponents(), and syncNominal().