Hi,
I stumbled across this topic as I was also looking for a way to import at the moment 9 data sets from different detectors. But for me the code given by Wim at the end doesn’t work with ROOT 6.04 and Python 2.7.6. I made a small running code example that stops with an error at the first insert call:
[code]#!/usr/bin/env python
import ROOT
x = ROOT.RooRealVar(‘x’, ‘x’, 0, 100)
data_det1 = ROOT.RooDataSet(“data_det1”, “data_det1”, ROOT.RooArgSet(x))
data_det2 = ROOT.RooDataSet(“data_det2”, “data_det2”, ROOT.RooArgSet(x))
detector = ROOT.RooCategory(“detector”, “detector”)
detector.defineType(“det1”)
detector.defineType(“det2”)
ROOT.gInterpreter.GenerateDictionary(“std::pair<std::string, RooDataSet*>”, “map;string;RooDataSet.h”)
m = ROOT.std.map(‘string, RooDataSet*’)()
keepalive = list()
keepalive.append(data_det1)
keepalive.append(data_det2)
m.insert(m.begin(), ROOT.std.pair(“string,RooDataSet*”)(“det1”, data_det1))
m.insert(m.begin(), ROOT.std.pair(“string,RooDataSet*”)(“det2”, data_det2))
data_comb = ROOT.RooDataSet(“data_comb”, “data_comb”, ROOT.RooArgSet(x), RF.Index(detector), RF.Import(m))[/code]
the error message shows problems with the arguments, but I have no idea, what to change.
[quote]TypeError: none of the 3 overloaded methods succeeded. Full details:
pair<_Rb_tree_iterator<pair<const string,RooDataSet*> >,bool> map<string,RooDataSet*>::insert(const pair<const string,RooDataSet*>& __x) =>
takes at most 1 arguments (2 given)
void map<string,RooDataSet*>::insert(initializer_list<pair<const string,RooDataSet*> > __list) =>
takes at most 1 arguments (2 given)
_Rb_tree_iterator<pair<const string,RooDataSet*> > map<string,RooDataSet*>::insert(_Rb_tree_const_iterator<pair<const string,RooDataSet*> > __position, const pair<const string,RooDataSet*>& __x) =>
could not convert argument 1[/quote]
It would be great if anyone has a solution.
Thanks!
Lukas