Integer Equivalent of RooRealVar?


In RooFit, when I want to create a variable which will later be used to hold values to make a leaf in a TTree, I use RooRealVar, But when the values that are to be held are integer rather than double or float, this doesn’t work and I get a segfault.

What should I use to hold integer values in this case? Looking at the class inheritance structure the closest thing to RooRealVar seems to be RooCategory, but this seems to be quite a different class and not just the integer equivalent of RooRealVar.

Does anyone have any ideas?



To improve your chances to get an answer from Wouter, post Roofit questions at “Stats and math”



Hi Laurence,

Are you trying to import or export data?

RooRealVar represent a ‘double’ type, but when you make a RooDataSet from an external TTree you can import TTree branches of type Int_t,UInt_t, Float_t and Double_t and these will all be converted to the Double_t internal representaion of RooRealVar on the fly.

Or are you trying to do the reverse? In that case I need a little bit more detail on what you are trying to do.


Hi Wouter,

I want to do the reverse, to make a new TTree with some leaves, and then fill those leaves using data that’s in leaves of an existing TTree (but not just the same data, with cuts applied and values scaled and so on). Actually I’ve got it working now using some non-RooFit code, I think the way i was trying to do it before was unnecessarily complicated.