From bb20d7af65cd884c5f21ce309b0572daf2666b76 Mon Sep 17 00:00:00 2001 From: shahoian Date: Sun, 18 Nov 2018 15:59:56 +0100 Subject: [PATCH] macro to check the integrity of residual tree In case of corruption will write to stdout CORRUPTED Residuals file, ev ... --- DataProc/CPass0/checkResTree.C | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 DataProc/CPass0/checkResTree.C diff --git a/DataProc/CPass0/checkResTree.C b/DataProc/CPass0/checkResTree.C new file mode 100644 index 00000000..55c24d33 --- /dev/null +++ b/DataProc/CPass0/checkResTree.C @@ -0,0 +1,18 @@ +#if !(defined(__CLING__) || defined(__CINT__)) || defined(__ROOTCLING__) || defined(__ROOTCINT__) +#include +#include +#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;iGetEntry(i); + if (rdb<=0 || rdb>10000) { + printf("CORRUPTED Residuals file, ev %d got %d bytes\n",i,rdb); + } + } +}