Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将 TTree 中的数据转换为CERN ROOT中的浮点数组?我只需要部分数据,现在我可以使用TTree:Draw绘制这部分(同时使用“varexp”和“selection”选项)。我的任务是获取绘制为数组的数据。我想将这些数据作为 C 数组。
看看 TTree::GetV1()。
例如
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; }
您可以通过将输出与 TTree::Scan 进行比较来确认这是否有效。