1 #include "../interface/CombDataSetFactory.h"
2 #include "../interface/utils.h"
7 vars_(vars), cat_(&cat), weight_(0)
9 if (vars_.contains(cat)) vars_.remove(cat);
20 RooDataSet *
data =
new RooDataSet(TString(set->GetName())+
"_unbin",
"", RooArgSet(*set->get(), *
weight_),
"_weight_");
21 for (
int i = 0,
n = set->numEntries();
i <
n; ++
i) {
22 const RooArgSet *
entry = set->get(
i);
23 data->add(*entry, set->weight());
35 return new RooDataHist(name,title,vars_,*
cat_,
map_);
40 using namespace RooFit;
43 #if 0 // This works most of the time, but sometimes weights end up wrong.
47 for (std::map<std::string, RooDataSet *>::iterator it =
mapUB_.begin(), ed =
mapUB_.end(); it != ed; ++it) {
48 RooDataSet *
data = it->second;
49 if (!data->isWeighted()) {
52 it->second =
new RooDataSet(data->GetName(), data->GetTitle(),
data, *data->get(), (
char*)0,
weight_->GetName());
57 RooArgSet varsPlusWeight(vars_); varsPlusWeight.add(*
weight_);
62 RooArgSet varsPlusCat(vars_); varsPlusCat.add(*
cat_);
63 RooArgSet varsPlusWeight(varsPlusCat); varsPlusWeight.add(*
weight_);
64 ret =
new RooDataSet(name,title,varsPlusWeight,WeightVar(*
weight_));
65 for (std::map<std::string, RooDataSet *>::iterator it =
mapUB_.begin(), ed =
mapUB_.end(); it != ed; ++it) {
68 cat_->setLabel(it->first.c_str());
69 RooDataSet *
data = it->second;
70 for (
unsigned int i = 0,
n = data->numEntries();
i <
n; ++
i) {
71 varsPlusCat = *data->get(
i);
72 ret->add(varsPlusCat, data->weight());
79 ret =
new RooDataSet(name,title,vars_,Index(*
cat_),Import(
mapUB_));
std::map< std::string, RooDataHist * > map_
std::map< std::string, RooDataSet * > mapUB_
void addSetBin(const char *label, RooDataHist *set)
ClassDef(CombDataSetFactory, 1) private RooCategory * cat_
std::pair< std::string, MonitorElement * > entry
RooDataSet * doneUnbinned(const char *name, const char *title)
char data[epos_bytes_allocation]
void addSetAny(const char *label, RooDataSet *set)
RooDataHist * done(const char *name, const char *title)
void set(const std::string &name, int value)
set the flag, with a run-time name