Problem Importing TChain into RooDataSet

Hi All

I am running root in my EOS space using

LbLogin -c x86_64-slc6-gcc49-opt
lb-run DaVinci/v38r1p7 python call_compare_variables_TList.py

to run the code.

I get the following error when I try to import a TChain into RooDataSet

Traceback (most recent call last):
File “call_compare_variables_TList.py”, line 52, in
storeSWeights(JPsiUpPlus, “Plus”,“Up”, LMJ, HMJ)
File “/eos/lhcb/user/j/jward/LHCb2016Data/compare_variables_TList.py”, line 20, in storeSWeights
data = r.RooDataSet(“data”,“fit input dataset”,r.RooArgSet(Jpsi_M), r.Import(list1))
File “/cvmfs/lhcb.cern.ch/lib/lcg/releases/LCG_79/ROOT/6.04.02/x86_64-slc6-gcc49-opt/lib/ROOT.py”, line 447, in __getattr2
raise AttributeError( name )
AttributeError: Import

The snippet of code used is found below:

from ROOT import TChain, TFile, TTree, TBranch, TTreeReader, TH1F, TCanvas, TMath, TStyle, TH2F, TH3F, TGraph2D, TLegend, RooFormulaVar, RooDataSet, RooDataHist, RooCategory, RooKeysPdf, TLorentzVector, TList, gROOT, gDirectory, TAxis, RooPlot, RooHist, RooPlotable, RooCurve,TGLHistPainter, TPad, TGraph
import ROOT as r

import numpy as np
import os

def storeSWeights(input1, direction,polarity, low_mass, high_mass):

import math

r.gROOT.SetBatch(True)
r.gROOT.ProcessLine(".x lhcbStyle.C")
r.gROOT.ForceStyle()

chain1 = input1;

Jpsi_M = r.RooRealVar("J_psi_1S_M","J_psi_1S_M",low_mass,high_mass,"#it MeV/{c}^{2}")
data = r.RooDataSet("data","fit input dataset",r.RooArgSet(Jpsi_M),  r.Import(chain1))

Any help on this issue would be greatly appreciated.
James

Hi,

I guess it’s a name space problem:
Does ROOT.RooFit.Import(...) work?

Thank you so much Stephan :).

This worked.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.