I need to clone a tree with some cut and add some selection
I use TTreeReader
TChain *chain = new TChain("result");
chain->Add("./data/*.root");
TTreeReader reader(chain);
TTreeReaderArray<double> r1(reader, "r1");
TTreeReaderArray<double> r2(reader, "r2");
......
TFile * resultfile = new TFile("RESULT.root", "recreate");
TTree *newtree = chain->CloneTree(0);
while(reader.Next()){
*r1; // how to delete this line??
*r2;
.......
newtree->Fill();
}
before is OK!
if I delete the
*r1;
*r2;
two line;
the branch in newtree is fill with 0, (default value);
it seems the value is not read in memory?
is there a easy way to read all value in one line code?