#include <CombDataSetFactory.h>
Public Member Functions | |
void | addSetAny (const char *label, RooDataSet *set) |
void | addSetAny (const char *label, RooDataHist *set) |
void | addSetBin (const char *label, RooDataHist *set) |
CombDataSetFactory (const RooArgSet &vars, RooCategory &cat) | |
CombDataSetFactory () | |
RooDataHist * | done (const char *name, const char *title) |
RooDataSet * | doneUnbinned (const char *name, const char *title) |
~CombDataSetFactory () | |
Public Attributes | |
ClassDef(CombDataSetFactory, 1) private RooCategory * | cat_ |
std::map< std::string, RooDataHist * > | map_ |
std::map< std::string, RooDataSet * > | mapUB_ |
RooRealVar * | weight_ |
Definition at line 20 of file CombDataSetFactory.h.
CombDataSetFactory::CombDataSetFactory | ( | ) | [inline] |
Definition at line 23 of file CombDataSetFactory.h.
{}
CombDataSetFactory::CombDataSetFactory | ( | const RooArgSet & | vars, |
RooCategory & | cat | ||
) |
CombDataSetFactory::~CombDataSetFactory | ( | ) |
Definition at line 12 of file CombDataSetFactory.cc.
{}
void CombDataSetFactory::addSetAny | ( | const char * | label, |
RooDataSet * | set | ||
) |
void CombDataSetFactory::addSetAny | ( | const char * | label, |
RooDataHist * | set | ||
) |
Definition at line 18 of file CombDataSetFactory.cc.
References AlCaHLTBitMon_QueryRunRegistry::data, i, label, mapUB_, n, runtimedef::set(), and weight_.
{ if (weight_ == 0) weight_ = new RooRealVar("_weight_","",1); RooDataSet *data = new RooDataSet(TString(set->GetName())+"_unbin", "", RooArgSet(*set->get(), *weight_), "_weight_"); for (int i = 0, n = set->numEntries(); i < n; ++i) { const RooArgSet *entry = set->get(i); data->add(*entry, set->weight()); } mapUB_[label] = data; }
void CombDataSetFactory::addSetBin | ( | const char * | label, |
RooDataHist * | set | ||
) |
RooDataHist * CombDataSetFactory::done | ( | const char * | name, |
const char * | title | ||
) |
RooDataSet * CombDataSetFactory::doneUnbinned | ( | const char * | name, |
const char * | title | ||
) |
Definition at line 39 of file CombDataSetFactory.cc.
References cat_, AlCaHLTBitMon_QueryRunRegistry::data, i, mapUB_, n, run_regression::ret, and weight_.
{ using namespace RooFit; RooDataSet *ret = 0; if (weight_) { #if 0 // This works most of the time, but sometimes weights end up wrong. // I don't knopw why the @$^#&^# this happens, but it nevertheless // means that I can't use the constructor with the map directly // for (std::map<std::string, RooDataSet *>::iterator it = mapUB_.begin(), ed = mapUB_.end(); it != ed; ++it) { RooDataSet *data = it->second; if (!data->isWeighted()) { weight_->setVal(1.0); data->addColumn(*weight_); it->second = new RooDataSet(data->GetName(), data->GetTitle(), data, *data->get(), /*cut=*/(char*)0, weight_->GetName()); } //std::cout << "\n\n\n========== DATASET " << it->first << " =============" << std::endl; //utils::printRDH(it->second); } RooArgSet varsPlusWeight(vars_); varsPlusWeight.add(*weight_); ret = new RooDataSet(name,title,varsPlusWeight,Index(*cat_),Import(mapUB_),WeightVar(*weight_)); //std::cout << "\n\n\n========== COMBINED DATASET =============" << std::endl; //utils::printRDH(ret); #else RooArgSet varsPlusCat(vars_); varsPlusCat.add(*cat_); RooArgSet varsPlusWeight(varsPlusCat); varsPlusWeight.add(*weight_); ret = new RooDataSet(name,title,varsPlusWeight,WeightVar(*weight_)); for (std::map<std::string, RooDataSet *>::iterator it = mapUB_.begin(), ed = mapUB_.end(); it != ed; ++it) { //std::cout << "\n\n\n========== DATASET " << it->first << " =============" << std::endl; //utils::printRDH(it->second); cat_->setLabel(it->first.c_str()); RooDataSet *data = it->second; for (unsigned int i = 0, n = data->numEntries(); i < n; ++i) { varsPlusCat = *data->get(i); ret->add(varsPlusCat, data->weight()); } } //std::cout << "\n\n\n========== COMBINED DATASET =============" << std::endl; //utils::printRDH(ret); #endif } else { ret = new RooDataSet(name,title,vars_,Index(*cat_),Import(mapUB_)); } mapUB_.clear(); return ret; }
ClassDef (CombDataSetFactory,1) private RooCategory* CombDataSetFactory::cat_ |
Definition at line 34 of file CombDataSetFactory.h.
Referenced by done(), and doneUnbinned().
std::map<std::string, RooDataHist *> CombDataSetFactory::map_ |
Definition at line 40 of file CombDataSetFactory.h.
Referenced by addSetBin(), and done().
std::map<std::string, RooDataSet *> CombDataSetFactory::mapUB_ |
Definition at line 41 of file CombDataSetFactory.h.
Referenced by addSetAny(), and doneUnbinned().
RooRealVar* CombDataSetFactory::weight_ |
Definition at line 39 of file CombDataSetFactory.h.
Referenced by addSetAny(), and doneUnbinned().