I have made a makefile using a TTree of ttbar MC samples. I now want to make another TTree in a different TFile and then make a new branch in it and fill it with a 2D vector of jet_pt of the MC data itself. (In the MC sample, in each event, there are more than one Jet and thus want a 2D vector). Thus, what I want is to have same branch contents in both the TTree as latter, if this works, I wish to put some selection cut and then fill the new branch. However, I am getting the error
Error in TFile::ReadBuffer: error reading all requested bytes from file delete.root, got 218 of 300
Error in TFile::Init: delete.root failed to read the file type data.
Could someone please check the code I wrote and see where am I going wrong.
another detail. I see that you reopen the file for every entry and for example never reset the container you are filling. Perhaps a simpler approach to create a column and re-persistify the dataset might help. Did you have a look to TDataFrame?
The file isn’t corrupted. The “delete.root” is the new root file I wish to create while tree.root was the original file. Earlier when I was using
TFile *nfile = TFile::Open(“nfile.root”,“recreate”);
TTree *tree = fChain->CloneTree(0);
instead of creating a new TTree, I was getting an error:
Error in <TBranchElement::Fill>: Failed filling branch:jet_pt, nbytes=-1
Error in <TTree::Fill>: Failed filling branch:ntree.jet_pt, nbytes=-1, entry=18063
This error is symptomatic of a Tree created as a memory-resident Tree
Instead of doing:
TTree *T = new TTree(...)
TFile *f = new TFile(...)
you should do:
TFile *f = new TFile(...)
TTree *T = new TTree(...)
Do you feel the code I wrote can make a new TBranch of 2D vector whose each row denotes new event while each column defines number of jets in each event?
`
Thank you!
While I am using v6.06/01. So it is still supported on this version.
root [1] using namespace std;
root [2] using namespace ROOT::Experimental;
ROOT_prompt_2:1:23: error: expected namespace name
using namespace ROOT::Experimental;
~~~~~~^
Also, regarding the previous file, I modified the code and now it is working apart from the factor you mention about resetting the container. Could you please explain this.
where we see the values are getting repeated inspite of initialing the column vector to zero.
I guess I making some mistake in filling the TBranch as the final 2d vector jet_pt matrix is correct (as I see in the output) but the filling of TTree is a issue…
I guess those statements got attached to the post by default. But anyways, I am using 6.06 version of ROOT. Also, could you help me figure out the error in the previous post…