문제

How can I convert data from TTree into array of floats in CERN's ROOT? I need only part of data and now I can draw this part using TTree:Draw (with both 'varexp', and ' selection' options). My task is to get data which was drawed as array. I would like to get this data as C array.

도움이 되었습니까?

해결책

Take a look at TTree::GetV1().

For example

TTree *t = ... ; // assume you got your tree somewhere
int sz = t->Draw("val", "cuts");
Double_t *vars = t->GetV1();
for ( int i = 0; i < sz; ++i ) {
  cout << vars[i] << endl;
}

You can confirm that this works by comparing the output with TTree::Scan.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top