Frage

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.

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top