forked from slava77/cms-reco-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
validateJR.sh
43 lines (41 loc) · 1.62 KB
/
validateJR.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
baseA=$1
baseB=$2
diffN=$3
inList=$4
cWD=`pwd`
export pidList=""
echo Start processing at `date`
grep root ${inList} | grep -v "#" | while read -r dsN fN procN comm; do
[ ! -f "${baseA}/${fN}" ] && echo Missing ${baseA}/${fN} && continue
extN=all_${diffN}_${dsN}
mkdir -p ${extN}
cd ${cWD}/${extN}
cp ~/tools/validate.C ./
echo "Will run on ${fN} in ${cWD}/${extN}"
echo "Now in `pwd`"
g++ -shared -o validate.so validate.C `root-config --cflags ` -fPIC
echo -e "gSystem->Load(\"libFWCoreFWLite.so\");\n AutoLibraryLoader::enable();\n
.x validate.C+(\"${extN}\", \"${baseA}/${fN}\", \"${baseB}/${fN}\", \"${procN}\");\n .qqqqqq" | root -l -b >& ${extN}.log &
# manually set the make flags, not needed in most cases
# gSystem->SetMakeSharedLib(\"cd \$BuildDir ;g++ -c \$Opt -pipe -m64 -Wshadow -Wall -W -Woverloaded-virtual -fPIC -std=c++11 -Wno-deprecated-declarations -DG__MAXSTRUCT=36000 -DG__MAXTYPEDEF=36000 -DG__LONGLINE=4096 -pthread \$IncludePath \$SourceFiles ; g++ \$ObjectFiles -shared -Wl,-soname,\$LibName.so -m64 -Wl,--hash-style=gnu -O2 \$LinkedLibs -o \$SharedLib\");\n
# cout<< gSystem->GetMakeSharedLib()<<endl ;\n
pidList=${pidList}" "${!}
export pidList
echo $pidList
nRunning=`ps -p $pidList | grep -c root`
while ((nRunning > 5 )); do
nRunning=`ps -p $pidList | grep -c root`
# echo $nRunning "still above 5 -> sleep 10 "
sleep 10
done
cd ${cWD}
echo $pidList > lastlist.txt
done
allPids=`cat lastlist.txt`
nRunning=1
while (( nRunning > 0 )); do
nRunning=`ps -p $allPids | grep -c root`
# echo $nRunning
sleep 10
done
echo done at `date`