Hi RooFit-ers!
Simple question: is there any dedicated method for handling RooStringVars in a RooWorkspace? Have a look at the following interactive session which illustrates my problem:
root [0] RooWorkspace* w = new RooWorkspace("w")
RooFit v3.60 -- Developed by Wouter Verkerke and David Kirkby
Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University
All rights reserved, please read http://roofit.sourceforge.net/license.txt
(RooWorkspace *) 0x7fc4b4c55200
root [1] w->factory("myFavoriteThing['RooFit']")
(RooAbsArg *) 0x7fc4b5851600
root [2] w->Print()
RooWorkspace(w) w contents
variables
---------
(myFavoriteThing)
root [3] //Seems to work although I couldn't find this factory syntax documented
root [4] //Now let's try to retrieve it...
root [5] w->var("myFavoriteThing")
(RooRealVar *) nullptr
root [6] //Hmm nope
root [7] w->arg("myFavoriteThing")
(RooAbsArg *) 0x7fc4b5851600
root [8] //Ahh there it is!
root [9] ((RooStringVar*)w->arg("myFavoriteThing"))->getVal()
(const char *) nullptr
root [10] //Oh...
The workaround is straightforward but mildly inconvenient when dealing with several strings: create a RooStringVar and import it into the workspace; use RooWorkspace::obj to fetch and cast to RooStringVar.
Is there a better solution?
Cheers!
Etienne