Skip to content

Commit

Permalink
Incorporating the check for the integrity of the ResTree in the script (
Browse files Browse the repository at this point in the history
#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
  • Loading branch information
chiarazampolli authored Nov 19, 2018
1 parent 0f047ca commit bbd6c3e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions DataProc/CPass0/checkResTree.C
Original file line number Diff line number Diff line change
Expand Up @@ -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;i<nev;i++) {
rdb = tr->GetEntry(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);
}
32 changes: 32 additions & 0 deletions DataProc/CPass0/runCPass0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bbd6c3e

Please sign in to comment.