Skip to content

Commit

Permalink
only print Scan if test fails
Browse files Browse the repository at this point in the history
apply pcanals suggestion

only print event entries if error

align indentation of values for easier reading
  • Loading branch information
ferdymercury committed Nov 28, 2024
1 parent 1ca9966 commit cb3bbfd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 34 deletions.
30 changes: 0 additions & 30 deletions root/tree/index/index64.ref
Original file line number Diff line number Diff line change
@@ -1,36 +1,6 @@

Processing runindex64.C...
******************************************************************************
* Row * run * event *
******************************************************************************
* 0 * 8 * 0 *
* 1 * 5 * 1 *
* 2 * 5 * 3 *
* 3 * 5 * 2 *
* 4 * 5 * 1.15292150460684698e+18 *
* 5 * 5 * 1.84467440737095516e+19 *
* 6 * 0 * 5 *
* 7 * 4 * 1.15292150460684698e+18 *
* 8 * 6 * 3 *
* 9 * 1.84467440737095516e+19 * 1.15292150460684698e+18 *
* 10 * 1.15292150460684698e+18 * 1.84467440737095516e+19 *
* 11 * 1.15292150460684698e+18 * 1.15292150460684698e+18 *
* 12 * 1.84467440737095516e+19 * 1.84467440737095516e+19 *
******************************************************************************
Tree BuildIndex returns 13
0: Run 8, Event 0 found at entry number: 0
1: Run 5, Event 1 found at entry number: 1
2: Run 5, Event 3 found at entry number: 2
3: Run 5, Event 2 found at entry number: 3
4: Run 5, Event 1152921504606846975 found at entry number: 4
5: Run 5, Event 18446744073709551600 found at entry number: -1
6: Run 0, Event 5 found at entry number: 6
7: Run 4, Event 1152921504606846975 found at entry number: 7
8: Run 6, Event 3 found at entry number: 8
9: Run 18446744073709551600, Event 1152921504606846975 found at entry number: -1
10: Run 1152921504606846975, Event 18446744073709551600 found at entry number: -1
11: Run 1152921504606846975, Event 1152921504606846975 found at entry number: 11
12: Run 18446744073709551600, Event 18446744073709551600 found at entry number: -1
Entries in chain: 13
BuildIndex returns 13
Try to find the position of run=0, event=500 in the chain, as it does not exist, this should return a -1:
Expand Down
16 changes: 12 additions & 4 deletions root/tree/index/runindex64.C
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const char* fname = "index64.root";
// There would be a warning if you'd try.
// More info: https://github.com/root-project/roottest/commit/f3c97809c9064feccaed3844007de9e7c6a5980d and https://github.com/root-project/roottest/commit/9e3843d4bf50bc34e6e15dfe7c027f029417d6c0
static constexpr bool shortlongdouble = sizeof(long double) < 16; // was true for __APPLE__ and __arm64__
const Long64_t bigval = shortlongdouble ? 0xFFFFFFFFFFFF : 0xFFFFFFFFFFFFFFF; // still positive number
const Long64_t bigval = shortlongdouble ? 0x0FFFFFFFFFFFF : 0x0FFFFFFFFFFFFFFF; // still positive number
const ULong64_t biguval = shortlongdouble ? 0xFFFFFFFFFFFF0 : 0xFFFFFFFFFFFFFFF0; // "negative" number

int runindex64(){
Expand All @@ -34,13 +34,21 @@ int runindex64(){
tree->Fill();
}
tree->Write();
tree->Scan("run:event","","colsize=30");


bool pass = true;
cout<<"Tree BuildIndex returns "<<tree->BuildIndex("run", "event")<<endl;
for (size_t i=0; i<sizeof(events)/sizeof(*events); i++) {
run = runs[i];
event = events[i];
cout << i << ": Run " << run << ", Event " << event << " found at entry number: " << tree->GetEntryNumberWithIndex(run, event) << endl;
pass &= (tree->GetEntryNumberWithIndex(run, event) == i);
}
if (!pass) {
tree->Scan("run:event","","colsize=30");
for (size_t i=0; i<sizeof(events)/sizeof(*events); i++) {
run = runs[i];
event = events[i];
cout << i << ": Run " << run << ", Event " << event << " found at entry number: " << tree->GetEntryNumberWithIndex(run, event) << endl;
}
}

test(tree);
Expand Down

0 comments on commit cb3bbfd

Please sign in to comment.