-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RooInt removed from ROOT, data can't be read any more #16380
Comments
Hi, thanks for the question! The standard way of do this in ROOT is to use TParameter or an For example: void write() {
TParameter<int> x1{"x1", 5};
std::vector<int> x2{4};
std::unique_ptr<TFile> file{TFile::Open("myfile.root", "RECREATE")};
file->WriteObject(&x1, "x1");
file->WriteObject(&x2, "x2");
} Therefore, having this functionality is redundant as therefore it was removed. If you still need to use
Are these possible ways forward? I would be very reluctant to bring this class back, because RooFit is for statistical analysis. Using its classes to store metadata in a ROOT file is really not the idea. |
If your framework is in Python and not in C++, you can also declare the class to the interpreter when you need it: ROOT.gInterpreter.Declare("""
class RooInt : public TNamed {
public:
RooInt() = default;
RooInt(Int_t value) : _value(value) {}
RooInt(const RooInt& other) : TNamed(other), _value(other._value) {}
// double cast operator
inline operator Int_t() const { return _value ; }
RooInt& operator=(Int_t value) { _value = value ; return *this ; }
protected:
Int_t _value = 0; ///< Payload
ClassDefOverride(RooInt,1) // Container class for Int_t
};
""") You can change the interface as you like, as long as you don't change the data members. |
Thank you for the answer: I wish I had noticed |
Hi @PetrilloAtWork , could you verify that using TParameter works for you? |
Check duplicate issues.
Description
Reporting on behalf of Fermilab SBN collaboration and SciSoft group.
We have some ROOT data files containing
RooInt
objects (we used then for storing "metadata").That class was removed from ROOT (ca29ccf) and we can't read that data any more.
This is not exactly a bug, since ROOT works as intended — but that intention breaks our data.
Twofold question:
TNamed
comes to mind, but it needs explicit conversions, and that is whyRooInt
was preferred.For people with Fermilab access, there is a related Redmine ticket #28974.
Reproducer
RooInt
object in a newTFile
with ROOT 6.28TFile
with the latest ROOTROOT version
v6-32-00
Installation method
Build from source
Operating system
Linux
Additional context
No response
The text was updated successfully, but these errors were encountered: