Normally using TTree::Scan, if there are arrays as branches, then if one performs a cut on a non-array variable, Scan will output a separate row for each Instance, up to the maximum size of any shown array.
Example from the root prompt (the tree in the root file is named 't'):
- Code: Select all
phoenix% root -l ../CreeperR4/TestRun.root
root [0]
Attaching file ../CreeperR4/TestRun.root as _file0...
[root [1] t->Scan("fEventNum:fSTACId","fEventNum==314379")
***********************************************
* Row * Instance * fEventNum * fSTACId *
***********************************************
* 314379 * 0 * 314379 * 13 *
* 314379 * 1 * 314379 * 0 *
* 314379 * 2 * 314379 * 2 *
* 314379 * 3 * 314379 * 7 *
* 314379 * 4 * 314379 * 5 *
* 314379 * 5 * 314379 * 2 *
* 314379 * 6 * 314379 * 7 *
* 314379 * 7 * 314379 * 7 *
* 314379 * 8 * 314379 * 11 *
* 314379 * 9 * 314379 * 6 *
* 314379 * 10 * 314379 * 13 *
* 314379 * 11 * 314379 * 3 *
* 314379 * 12 * 314379 * 14 *
* 314379 * 13 * 314379 * 4 *
* 314379 * 14 * 314379 * 14 *
* 314379 * 15 * 314379 * 7 *
* 314379 * 16 * 314379 * 15 *
* 314379 * 17 * 314379 * 4 *
* 314379 * 18 * 314379 * 1 *
* 314379 * 19 * 314379 * 2 *
* 314379 * 20 * 314379 * 1 *
* 314379 * 21 * 314379 * 1 *
* 314379 * 22 * 314379 * 2 *
* 314379 * 23 * 314379 * 4 *
* 314379 * 24 * 314379 * 5 *
Type <CR> to continue or q to quit ==>
Now suppose I have used t->MakeClass() to create a tree reader skeleton, and defined a function within that class. Here the tree pointer is now called 'fChain.'
- Code: Select all
void makeclassobject::RootScan() {
fChain->Scan("fEventNum:fSTACId","fEventNum==314379");
}
Then suppose I create an un-named Macro.C which instantiates the makeclassobject and calls the makeclassobject::RootScan() function. When I run that macro, the output is then:
- Code: Select all
***********************************************
* Row * Instance * fEventNum * fSTACId *
***********************************************
* 314379 * 0 * 314379 * 13 *
***********************************************
==> 1 selected entry
If I want the scan to appear to the user just as if he/she had entered the Scan command from the root prompt, what parameters to I need to pass to Scan in order to make it appear as normal?
Thanks,
Joe