TTree、Branch、array

Now,I have a tree. The tree contains five Branch. One of the Branch have four leaf, and the data type of the leaf is array. Now I want to get the data in the array, but I don`t know how to do it. Better tell me the code. Thank you very much!

Can you give me a example? Now a tree have four Branch. One of the Branch named Samples have four levaes, and the type of one leaf named point is array. Now I want to read the data in the leaf named point. Please tell me how to get it. Give me the code. Thank you very much! :stuck_out_tongue:

See files generated by: root -b -q your_file.root -e 'your_tree->MakeClass();'

//This is my code
#include “TSelector.h”
#include “TFile.h”
#include “TH1F.h”
#include “TTreeReader.h”
#include “TTreeReaderValue.h”
#include “math.h”
void plot()
{
auto myFile = TFile::Open(“DataF_CH0@DT5751_1353_run_29_V5.root”);
if (!myFile || myFile->IsZombie()) {
return;
}
TTreeReader myReader(“Data_F”, myFile);
TTreeReaderArray<Float_t> array(myReader,“Samples”);
while (myReader.Next())
{
for(int i=0; i < 24000; i++)
{
cout << array[0] << endl;
}
}
}

//This is mistake
Error in TTreeReaderArrayBase::CreateContentProxy(): Cannot determine the type contained in the collection of branch Samples. That’s weird - please report!

//The leaf named “fArray” with the size of 24000 is in the Branch named “Samples”. Now
I want to get the data in it.

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