Skip to content

Commit

Permalink
macro to check the integrity of residual tree
Browse files Browse the repository at this point in the history
In case of corruption will write to stdout CORRUPTED Residuals file, ev ...
  • Loading branch information
shahor02 authored and fprino committed Nov 18, 2018
1 parent 0e9a15f commit bb20d7a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions DataProc/CPass0/checkResTree.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#if !(defined(__CLING__) || defined(__CINT__)) || defined(__ROOTCLING__) || defined(__ROOTCINT__)
#include <TTree.h>
#include <TFile.h>
#endif

void checkResTree(const char* fname = "ResidualTrees.root", const char* tname = "delta")
{
TFile tf(fname);
TTree* tr = (TTree*)tf.Get(tname); // we want macro to crash if the tree is not there
int nev = tr->GetEntries();
int rdb = 0;
for (int i=0;i<nev;i++) {
rdb = tr->GetEntry(i);
if (rdb<=0 || rdb>10000) {
printf("CORRUPTED Residuals file, ev %d got %d bytes\n",i,rdb);
}
}
}

0 comments on commit bb20d7a

Please sign in to comment.