You need to load the dictionary for vector. Add (literally):gROOT->ProcessLine("#include <vector>"); to your code before attempting to create the branches.
Aha, that worked, thanks Philippe! My problems, however, are continuing. Now I am loading the resulting .root file and am trying to set the addresses for the branches, and here’s the error that I get (I also include the tree description):
[quote]ptree->SetBranchAddress(“wave_model”,&(&wave_model));
seems to work…[/quote]Unfortunately it only appears to work. This call pass the address of a transient pointer (i.e. it last only as long as the statement)) but the function keep a copy of this value … resulting in the TTree essentially using random memory (because this address will be reused).
You need:std::vector<float> * wave_model = 0;
ptree->SetBranchAddress("wave_model",&wave_model);
Hi
I am having oroblem while reading vector objects from branches in tree . My branch contains data of type TObjArray. I am able to read only the events. I wish to read other branches and calculate the invariant mass. How can i do that.
I am having Error : TTree::SetBranchAddress: The pointer type given (TLorentzVector) does not correspond to the class needed (TObjArray) by the branch: reco_6gvect while running the code . How to sort it out?