CMS 3D CMS Logo

Public Member Functions | Private Attributes

cacheutils::ArgSetChecker Class Reference

#include <CachingNLL.h>

List of all members.

Public Member Functions

 ArgSetChecker ()
 ArgSetChecker (const RooAbsCollection &set)
bool changed (bool updateIfChanged=false)

Private Attributes

std::vector< double > vals_
std::vector< RooRealVar * > vars_

Detailed Description

Definition at line 19 of file CachingNLL.h.


Constructor & Destructor Documentation

cacheutils::ArgSetChecker::ArgSetChecker ( ) [inline]

Definition at line 21 of file CachingNLL.h.

{}
cacheutils::ArgSetChecker::ArgSetChecker ( const RooAbsCollection &  set)

Definition at line 62 of file CachingNLL.cc.

References a, vals_, and vars_.

{
    std::auto_ptr<TIterator> iter(set.createIterator());
    for (RooAbsArg *a  = dynamic_cast<RooAbsArg *>(iter->Next()); 
                    a != 0; 
                    a  = dynamic_cast<RooAbsArg *>(iter->Next())) {
        RooRealVar *rrv = dynamic_cast<RooRealVar *>(a);
        if (rrv) { // && !rrv->isConstant()) { 
            vars_.push_back(rrv);
            vals_.push_back(rrv->getVal());
        }
    }
}

Member Function Documentation

bool cacheutils::ArgSetChecker::changed ( bool  updateIfChanged = false)

Definition at line 77 of file CachingNLL.cc.

{
    std::vector<RooRealVar *>::const_iterator it = vars_.begin(), ed = vars_.end();
    std::vector<double>::iterator itv = vals_.begin();
    bool changed = false;
    for ( ; it != ed; ++it, ++itv) {
        double val = (*it)->getVal();
        if (val != *itv) { 
            //std::cerr << "var::CachingPdfable " << (*it)->GetName() << " changed: " << *itv << " -> " << val << std::endl;
            changed = true; 
            if (updateIfChanged) { *itv = val; }
            else break;
        }
    }
    return changed;
}

Member Data Documentation

std::vector<double> cacheutils::ArgSetChecker::vals_ [private]

Definition at line 26 of file CachingNLL.h.

Referenced by ArgSetChecker().

std::vector<RooRealVar *> cacheutils::ArgSetChecker::vars_ [private]

Definition at line 25 of file CachingNLL.h.

Referenced by ArgSetChecker().