TTree::Scan to fill a float or an array

Hi,

Is there anyway to fill a float or array (or vector) with the values of one (or more) variable(s) from a TTree for all events that pass a cut. TTree::Scan will print the values to the screen in this manner, but I need to access these value late in my code.

Thanks

Dan

The easiest way without looping manually that I am aware of:

tree->SetEstimate(tree->GetEntries("cutexpression")) // required to make arrays big enough to store elements tree->Draw("expression1:expression2", "cutexpression") Double_t *expr1 = tree->GetV1() Double_t *expr2 = tree->GetV2()

Hope this helps.