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’):
314379 * 24 * 314379 * 5 *
Type to continue or q to quit ==> [/code]
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.’
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:
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?
[quote]When I run that macro, the output is then … :[/quote]A priori the result should have been the same in both case. Can you send a complete running example showing the problem?
Root version: 5.29/01
treeshort.root - truncated version of my root file, containing tree ‘t’
ScanIssue.C/.h: result of t->MakeClass(“ScanIssue”) with one function added, ScanIssue::UserScan()
StartScanIssue.C: un-named macro code.
Usage: do root StartScanIssue.C
My results (pasted below): I get ‘1 selected entry’ when executing the UserScan function from a root prompt, and the regular, functioning Scan when doing 't->Scan("…","…") from the root prompt. Let me know if you need anything else.
Thanks!
Joe
[code]battlezone% root -l StartScanIssue.C
root [0]
Processing StartScanIssue.C…
Executing script in ‘StartScanIssue.C’
Warning in TClass::TClass: no dictionary for class UC_FreezeCycle is available
Constructed si with tree from file located at ./treeshort.root.
(entries = 1000)
root [1] si.UserScan()
Row * Instance * fEventNum * fSTACId *
358 * 0 * 358 * 8 *
==> 1 selected entry
root [2] .q
battlezone% root -l treeshort.root
root [0]
Attaching file treeshort.root as _file0…
Warning in TClass::TClass: no dictionary for class UC_FreezeCycle is available
root [1] t->Scan(“fEventNum:fSTACId”,“fEventNum==358”)
Row * Instance * fEventNum * fSTACId *
358 * 0 * 358 * 8 *
358 * 1 * 358 * 8 *
358 * 2 * 358 * 8 *
358 * 3 * 358 * 8 *
358 * 4 * 358 * 8 *
358 * 5 * 358 * 8 *
358 * 6 * 358 * 8 *
358 * 7 * 358 * 8 *
358 * 8 * 358 * 8 *
358 * 9 * 358 * 8 *
358 * 10 * 358 * 8 *
358 * 11 * 358 * 8 *
358 * 12 * 358 * 8 *
358 * 13 * 358 * 8 *
358 * 14 * 358 * 8 *
358 * 15 * 358 * 8 *
358 * 16 * 358 * 8 *
358 * 17 * 358 * 8 *
358 * 18 * 358 * 8 *
358 * 19 * 358 * 8 *
358 * 20 * 358 * 8 *
358 * 21 * 358 * 8 *
358 * 22 * 358 * 8 *
358 * 23 * 358 * 8 *
358 * 24 * 358 * 8 *
Type to continue or q to quit ==> [/code] ScanIssue.zip (115 KB)