3 # Shell script to compare content of the OCDB entries.
6 # Usage: bash $inputFile $flag $outputFile
8 # Usage: bash $inputFile $object_name $dump_type [XML/MI] $outfile
10 # Usage: bash $inputFile1 $inputFile2 $object_name $dump_type [XML/MI] $outfile
11 # Example usage: see example functions below
15 # create a text file with the OCDB setupt descriptors#
19 # $2 flag type of the input file
22 # AliESDs.root = "ESD"
26 if [ $# -lt 3 ] ; then
27 echo "Usage: $0 \$inputFile \$flag \$outputFile"
30 export ALIROOT_FORCE_COREDUMP=1
35 if [ ! -f ${inFile} ] ; then
36 echo ${inFile} not found!
39 if [ -f ${outFile} ] ; then
44 cat > ${tmpscript} <<HEREDOC
46 AliOCDBtoolkit::DumpOCDBAsTxt("${inFile}","${inFlag}","${outFile}");
50 aliroot -l -q -b ${tmpscript}
51 sleep 60 && rm ${tmpscript} &
62 # $3 type of the dump (XML or MI recursive dump )
65 export ALIROOT_FORCE_COREDUMP=1
66 if [ $# -lt 4 ] ; then
67 echo "Usage: $0 \$inputFile \$object_name \$dump_type [XML/MI] \$outfile"
75 if [ ! -f ${inFile} ] ; then
76 echo ${inFile} not found!
79 if [ -f ${outFile} ] ; then
82 if [ ${ftype} = "XML" ] ; then
84 elif [ ${ftype} = "MI" ] ; then
87 echo "option ${ftype} not recognized! Use \"XML\" or \"MI\"!"
91 cat > ${tmpscript} <<HEREDOC
93 AliOCDBtoolkit::DumpOCDBFile("${inFile}","${outFile}",1,${isXML});
97 aliroot -l -q -b ${tmpscript}
98 sleep 60 && rm ${tmpscript} &
109 # $4 type of the dump (xml or MI recursive dump )
111 # $5 output diff file name
112 export ALIROOT_FORCE_COREDUMP=1
113 if [ $# -lt 5 ] ; then
114 echo "Usage: $0 \$inputFile1 \$inputFile2 \$object_name \$dump_type [XML/MI] \$outfile"
125 if [ ${ftype} = "XML" ] ; then
129 elif [ ${ftype} = "MI" ] ; then
132 echo "option ${ftype} not recognized! Use \"XML\" or \"MI\"!"
135 dumpObject ${inFile1} ${fobject} ${ftype} ${tmp1%.xml}
136 dumpObject ${inFile2} ${fobject} ${ftype} ${tmp2%.xml}
137 diff ${tmp1} ${tmp2} >${outFile}
138 rm ${tmp1} ${tmp2} 2>/dev/null
139 rm "${tmp1}.xml" "${tmp2}.xml" 2>/dev/null
145 # Dump differences between the OCDB tables -comparison based on the hash values of OCDB entries
150 # difference is stdout
151 export ALIROOT_FORCE_COREDUMP=1
155 cdbName=$(cut -f1 $list1)
156 for i in $cdbName ; do
157 line1="$(grep $i $list1)"
158 line2="$(grep $i $list2)"
159 if [ -z "${line2}" ] ; then
160 echo $i not found in $list2!
163 match1=$(echo $line1 | cut -d' ' -f 5)
164 match2=$(echo $line2 | cut -d' ' -f 5)
165 if [ "$match1" -ne "$match2" ] ; then
166 echo $i doesnt match:
167 echo $(echo $line1| awk '{print $2 "/" $3}') \#hash: $match1
168 echo $(echo $line2| awk '{print $2 "/" $3}') \#hash: $match2
179 # Example usage+ developer test routines.
183 ocdbMakeTable "/hera/alice/jwagner/simulations/benchmark/aliroot_tests/ppbench/rec.log" "log" "testout"
186 dumpObject "/hera/alice/jwagner/OCDB/temp/TPC/Calib/RecoParam/Run0_999999999_v0_s0.root" "object" "XML" "testout2XML"
187 dumpObject "/hera/alice/jwagner/OCDB/temp/TPC/Calib/RecoParam/Run0_999999999_v0_s0.root" "object" "MI" "testout2MI"
190 file1="/hera/alice/jwagner/OCDB/temp/TPC/Calib/RecoParam/Run0_999999999_v0_s0.root"
191 file2="$ALICE_ROOT/OCDB/TPC/Calib/RecoParam/Run0_999999999_v0_s0.root"
192 diffObject ${file1} ${file2} "object" "MI" "testdiffMI"
193 diffObject ${file1} ${file2} "object" "XML" "testdiffXML"
197 source /hera/alice/jwagner/software/aliroot/loadMyAliroot.sh TPCdev