# Cannot open a RooWorkspace once it is saved - Allocating an object of class type error

**URL:** <https://root-forum.cern.ch/t/cannot-open-a-rooworkspace-once-it-is-saved-allocating-an-object-of-class-type-error/63954>\
**Category:** Roofit and RooStats\
**Created:** [July 30, 2025, 2:38pm UTC](https://root-forum.cern.ch/t/cannot-open-a-rooworkspace-once-it-is-saved-allocating-an-object-of-class-type-error/63954 "2025-07-30T14:38:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmaroun0](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mmaroun0/32/36520_2.png) [@mmaroun0](https://root-forum.cern.ch/u/mmaroun0)\
**Post date:** [July 30, 2025, 2:38pm UTC](https://root-forum.cern.ch/t/cannot-open-a-rooworkspace-once-it-is-saved-allocating-an-object-of-class-type-error/63954/1 "2025-07-30T14:38:58Z")

</div>

Hello,  
I have recently created a RooWorkspace and saved it to a file, but I receive an error when I try to open the file and retrieve the workspace. The error is lengthy, but it starts as follows:

```auto
input_line_48:5:21: error: allocating an object of abstract class type 'RooAbsPdf'
         *ret = new RooAbsPdf;
                    ^
/cvmfs/atlas.cern.ch/repo/sw/software/0.5/StatAnalysis/0.5.2/InstallArea/x86_64-el9-gcc13-opt/include/RooAbsArg.h:90:20: note: unimplemented pure virtual method 'clone' in 'RooAbsPdf'
  virtual TObject* clone(const char* newname=nullptr) const = 0 ;
                   ^
/cvmfs/atlas.cern.ch/repo/sw/software/0.5/StatAnalysis/0.5.2/InstallArea/x86_64-el9-gcc13-opt/include/RooAbsReal.h:453:18: note: unimplemented pure virtual method 'evaluate' in 'RooAbsPdf'
  virtual double evaluate() const = 0;
                 ^
input_line_48:8:21: error: allocating an object of abstract class type 'RooAbsPdf'
         *ret = new RooAbsPdf[nary];
                    ^
input_line_48:13:29: error: allocating an object of abstract class type 'RooAbsPdf'
         *ret = new (arena) RooAbsPdf;
                            ^
input_line_48:16:29: error: allocating an object of abstract class type 'RooAbsPdf'
         *ret = new (arena) RooAbsPdf[nary];
                            ^
Error in <TClingCallFunc::make_ctor_wrapper>: Failed to compile
  ==== SOURCE BEGIN ==== 

```

It should be noted that this workspace uses **only** native RooFit methods. **No** custom classes were built for this workspace, based on `RooAbsPdf` or otherwise.

This error occurs if I try to open the file via a script (using a command such as `RooWorkspace* ws = (RooWorkspace*)wsFile->Get(wsName);` where `wsFile` is the name of the file (a `const char*`) and `wsName` is the name of the workspace (also a `const char*`)) or via an interactive Root session (using a command such as `wsName->Print()` where `wsName` is the name of the workspace).

Furthermore, this error occurs across multiple versions of Root. I have tried to open the workspace in v6.32 and v6.34, and I receive the same error. The workspace is created using Root v6.32.02.

Any help would be greatly appreciated. Thank you

EDIT: The workspace can be found here on `/eos`: [CERNBox](https://cernbox.cern.ch/s/UO46A1wF5dvmWto)

---

<div class="post-metadata">

**Author:** ![mczurylo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mczurylo/32/33269_2.png) [@mczurylo](https://root-forum.cern.ch/u/mczurylo)\
**Post date:** [July 30, 2025, 2:58pm UTC](https://root-forum.cern.ch/t/cannot-open-a-rooworkspace-once-it-is-saved-allocating-an-object-of-class-type-error/63954/2 "2025-07-30T14:58:31Z")

</div>

Hi @mmaroun0,

let me tag @jonas for further help.

Cheers,  
Marta

---

<div class="post-metadata">

**Author:** ![jonas](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jonas/32/24756_2.png) [@jonas](https://root-forum.cern.ch/u/jonas)\
**Post date:** [July 31, 2025, 2:51pm UTC](https://root-forum.cern.ch/t/cannot-open-a-rooworkspace-once-it-is-saved-allocating-an-object-of-class-type-error/63954/3 "2025-07-31T14:51:52Z")

</div>

I have opened a PR with a hotfix that can also be backported to the releases that you mentioned:

> <https://github.com/root-project/root/pull/19490>
>
> In some cases, it might happen that a CallFunc wrapper for the \`RooAbsReal\` or \`…RooAbsPdf\` classes is created, which gives compile errors because these classes are virtual.
> 
> It is however not a big deal to make these classes non-virtual and avoid these errors. The \`RooAbsArg::clone()\` method should have been overridden anyway since \`RooAbsReal\` and \`RooAbsPdf\` already have copy constructors. The only other method that needs to be implemented is \`RooAbsReal::evaluate()\`, which is done as well. The implementation throws an exception, because \`evaluate()\` should always be called from derived classes.
> 
> This is a bit of a hotfix and one can argue that it would be nicer to first understand why these CallFunc wrappers are even created, but this issue needs to be resolved quickly and with minimal changes: the fix also needs to be backported to older ROOT versions and is crucial for the ATLAS Run 2 Higgs combination analysis.
> 
> Issue reported on the ROOT forum:
> https://root-forum.cern.ch/t/cannot-open-a-rooworkspace-once-it-is-saved-allocating-an-object-of-class-type-error/63954

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [August 14, 2025, 2:51pm UTC](https://root-forum.cern.ch/t/cannot-open-a-rooworkspace-once-it-is-saved-allocating-an-object-of-class-type-error/63954/4 "2025-08-14T14:51:56Z")

</div>

Closed on August 14, 2025, 2:51pm UTC

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