CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/src/HiggsAnalysis/CombinedLimit/src/SimpleCacheSentry.cc

Go to the documentation of this file.
00001 #include "../interface/SimpleCacheSentry.h"
00002 
00003 SimpleCacheSentry::SimpleCacheSentry() :  _deps("deps","deps",this)   {}
00004 
00005 SimpleCacheSentry::SimpleCacheSentry(const RooRealVar &var) :
00006     _deps("deps","deps",this)   
00007 {
00008     addVar(var);
00009 }
00010 
00011 SimpleCacheSentry::SimpleCacheSentry(const RooAbsCollection &vars) :
00012     _deps("deps","deps",this)   
00013 {
00014     addVars(vars);
00015 }
00016 
00017 
00018 SimpleCacheSentry::SimpleCacheSentry(const RooAbsArg &func, const RooArgSet *obs) :
00019     _deps("deps","deps",this)   
00020 {
00021     addFunc(func,obs);
00022 }
00023 
00024 SimpleCacheSentry::SimpleCacheSentry(const SimpleCacheSentry &other, const char *newname) :
00025     _deps("deps",this,other._deps)   
00026 {
00027 }
00028 
00029 void SimpleCacheSentry::addVars(const RooAbsCollection &vars) 
00030 {
00031     TIterator *iter = vars.createIterator();
00032     for (RooAbsArg *a = (RooAbsArg *) iter->Next(); a != 0; a = (RooAbsArg *) iter->Next()) {
00033         if (_deps.containsInstance(*a)) continue;
00034         if (a->isDerived()) addFunc(*a);
00035         else _deps.add(*a);
00036     }
00037     delete iter;
00038 }
00039 
00040 void SimpleCacheSentry::addFunc(const RooAbsArg &func, const RooArgSet *obs) 
00041 {
00042     RooArgSet *deps = func.getParameters(obs,false);
00043     addVars(*deps);
00044     delete deps;
00045 }
00046 
00047