From bbd6c3e615c9387d43ca4ac3199d15303ecbfa61 Mon Sep 17 00:00:00 2001 From: chiarazampolli Date: Mon, 19 Nov 2018 15:44:25 +0100 Subject: [PATCH] Incorporating the check for the integrity of the ResTree in the script (#211) * Incorporating the check for the integrity of the ResTree in the script * Implementing Ruben's suggestions * This time we rename the ResidualTree file if it is corrupted --- DataProc/CPass0/checkResTree.C | 4 ++++ DataProc/CPass0/runCPass0.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/DataProc/CPass0/checkResTree.C b/DataProc/CPass0/checkResTree.C index 55c24d33..3cca3c4b 100644 --- a/DataProc/CPass0/checkResTree.C +++ b/DataProc/CPass0/checkResTree.C @@ -9,10 +9,14 @@ void checkResTree(const char* fname = "ResidualTrees.root", const char* tname = TTree* tr = (TTree*)tf.Get(tname); // we want macro to crash if the tree is not there int nev = tr->GetEntries(); int rdb = 0; + bool corrupted = kFALSE; for (int i=0;iGetEntry(i); if (rdb<=0 || rdb>10000) { printf("CORRUPTED Residuals file, ev %d got %d bytes\n",i,rdb); + exit(1); } } + printf("The residual tree file is OK\n"); + exit(0); } diff --git a/DataProc/CPass0/runCPass0.sh b/DataProc/CPass0/runCPass0.sh index a7cbb4b3..887395f2 100755 --- a/DataProc/CPass0/runCPass0.sh +++ b/DataProc/CPass0/runCPass0.sh @@ -336,6 +336,38 @@ if [ $exitcode -ne 0 ]; then exit 40 fi +echo "* Checking the integrity of the residual trees..." +if [ -f checkResTree.C ]; then + echo "Use checkResTree.C macro passed as input" +else + echo "Use checkResTree.C macro from AliDPG" + cp $ALIDPG_ROOT/DataProc/CPass0/checkResTree.C . +fi + +echo "" +echo "running the following checkResTree.C macro:" +cat checkResTree.C +echo "" +echo executing aliroot -l -b -q -x "checkResTree.C()" +echo "" >&2 +echo "checkResTree.C" >&2 +timeStart=`date +%s` +time aliroot -l -b -q -x "checkResTree.C" &>> integrity.log +exitcode=$? + +if [ $exitcode != 0 ]; then + echo "ResidualTree.root is corrupted, moving it to ResidualTreesBAD.root" + mv ResidualTrees.root ResidualTreesBAD.root +fi + +timeEnd=`date +%s` +timeUsed=$(( $timeUsed+$timeEnd-$timeStart )) +delta=$(( $timeEnd-$timeStart )) +echo "checkResTree: delta = $delta, timeUsed so far = $timeUsed" +echo "checkResTree: delta = $delta, timeUsed so far = $timeUsed" >&2 + +echo "*! Exit code of checkResTree.C: $exitcode" + echo "* Running filtering task *" filtMacro=$ALIDPG_ROOT/DataProc/Common/runFilteringTask.C if [ -f $filtMacro ]; then