Skip to content
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

Using TGraph object as Parameter #472

Open
jedori0228 opened this issue Apr 9, 2024 · 5 comments
Open

Using TGraph object as Parameter #472

jedori0228 opened this issue Apr 9, 2024 · 5 comments
Labels
bug ❌ Something isn't working

Comments

@jedori0228
Copy link

Hi! In our input MC rootfile, we are saving TGraph objects into the TTree;

*............................................................................*
*Br  138 :ZExpA1CCQE : TGraph                                                *
*Entries :     1632 : Total  Size=     405032 bytes  File Size  =      35914 *
*Baskets :       13 : Basket Size=      32000 bytes  Compression=  11.26     *
*............................................................................*

This object is an event-by-event reweights (i.e., a TGraph where x:sigmas, y:reweights) and we use this dial with a Parameter definition as follows:

- parameterName: "ZExpA1CCQE"
  isEnabled: true
  dialSetDefinitions:
    - dialType: Graph
      minimumGraphResponse: 0
      dialLeafName: "ZExpA1CCQE"

When I run gundamFitter, we saw an error message:

libc++abi: terminating due to uncaught exception of type std::runtime_error: GenericToolbox::BranchBuffer::buildBuffer(): empty buffer size for branch: ZExpA1CCQE

After tracking down the source of the error, I found that in cpp-generic-toolbox/include/GenericToolbox.Root.h#L1531, the Leaf of this Branch has l->GetNdata() = 1 and l->GetLenType() = 0, thus got bufferSize = 0. In our on-going analysis, we put this TGraph into a TClonesArray, and there I saw the Leaf got l->GetNdata() = 0 and l->GetLenType() = 4, then had no issue. We can keep using TClonesArray, but wonder if using TGraph (or TSpline3) directly without TClonesArray can be also supported, or our configuration needs to be updated.

  • GUNDAM tag: 1.9.0
  • ROOT version: 6.30/06
  • OS: osX 14.4
@nadrino
Copy link
Collaborator

nadrino commented Apr 9, 2024

Hello Jaesung! (Nice to meet you!)

What is the type of TObject you put in the TTree for ZExpA1CCQE?

@jedori0228
Copy link
Author

Below is what we are basically doing:

    TGraph *gr = nullptr;
    theTree.Branch( "ZExpA1CCQE", &gr );

@nadrino
Copy link
Collaborator

nadrino commented Apr 9, 2024

Ok I see 🤔

We are actually using l->GetNdata() to figure out whether or not we should use an extended buffer for non-primitive objects. TClonesArray or TSpline3 typically return 0 here.

You could try to use TClonesArray in the meantime

@nadrino nadrino added the bug ❌ Something isn't working label Apr 9, 2024
@jedori0228
Copy link
Author

I also tested saving TSpline instead, but getting same error. TTree print out is:

*............................................................................*
*Br  138 :ZExpA1CCQE : TSpline3                                              *
*Entries :     1627 : Total  Size=     974351 bytes  File Size  =     155105 *
*Baskets :       31 : Basket Size=      32000 bytes  Compression=   6.28     *
*............................................................................*

, and also seeing

[JSKIMDEBUG][BranchBuffer::buildBuffer] _branchPtr_->GetName() = ZExpA1CCQE
[JSKIMDEBUG][BranchBuffer::buildBuffer] - nLeaves = 1
[JSKIMDEBUG][BranchBuffer::buildBuffer]   - iLeaf = 0
[JSKIMDEBUG][BranchBuffer::buildBuffer]     - l->GetNdata() = 1
[JSKIMDEBUG][BranchBuffer::buildBuffer]     - l->GetLenType() = 0

@nadrino
Copy link
Collaborator

nadrino commented Apr 9, 2024

Thank you very much @jedori0228

It seems like we need a new way to find out if a leaf is a TObject. TClonesArray should still work fine (we are actively using it for event-by-event dials).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ❌ Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants