Problem with splitting a ROOT class

I have a TObject defined below

class Muon_Track : public TObject {
    Int_t n = 0;
    Double_t *X;      //[n]
    TFitResult fit[3];

    Double_t chi2[3]; 
    TVector3 v;        
    TVector3 r0;       
    TVector3 vError; 
    TVector3 r0Error; 
    void Fit(); // sets fit, chi2, v,r0,vError,r0Error

    Color_t markerColour = kBlue+2; //!
    Color_t lineColour = kBlue+2;   //!
    Style_t markerStyle = 20;       //!

And I’m trying to write to it using the following

// File and Tree for output
TFile fOut(output.c_str(), "recreate");
TTree tOut("t", "Muon Track Tree");

Muon_Track* M = new Muon_Track();
M->X = new Double_t[MAXN];


std::vector<Double_t> X_vec;
M->X =;

When I try to run the executable I get the following output

Warning in <TTree::Bronch>: Muon_Track cannot be split, resetting splitlevel to 0

It works just fine with the root interpreter though

Makefile.txt (1.1 KB)

Did you use

#pragma link C++ class  Muon_Track+;

(note the trailing +) in the LinkDef.h file?

No, LinkDef.h looks like:

#ifdef __CINT__
#pragma link C++ class Muon_Track;

This is the problem. Without the +, this request the old style I/O for that class and that does not support splitting.
Add the + and regenerate the dictionary and it should work as expected.


That worked, thankyou!

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