Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:45:32

0001 #/bin/bash
0002 
0003 function USAGE ()
0004 {
0005   echo ""
0006   echo "USAGE: "
0007   echo $0 "[options] run_label"
0008   echo ""
0009   echo "ATTENTION: run from your local alignment release's src/ directory where a number of certain soft-linked scripts is expected"
0010   echo "Options:"
0011   echo "-n N          number of iteration. Default is 5."
0012   echo "-i DIR        directory to copy the input from. Default is the current dir"
0013   echo "              The results are expected to be under DIR/run_label_01/ .. DIR/run_label_0N/"
0014   echo "-0 g0.xml     location of the initial geometry xml file (only chambers relative to ideal geometry are needed)."
0015   echo "-z            if provided, no tarball would be created in the end"
0016   echo "-w nnnnnn     The corrections mask. Defailt is 110011."
0017 }
0018 
0019 
0020 function COPY_CODE
0021 {
0022   if [ -e $1 ]; then cp $1 $2/; return 0; fi
0023   for t in `echo -e "./\n$CMSSW_BASE/src/\n$CMSSW_RELEASE_BASE/src/"`
0024   do
0025     if [ -e $t/Alignment/MuonAlignmentAlgorithms/scripts/$1 ]; then cp $t/Alignment/MuonAlignmentAlgorithms/scripts/$1 $2/; return 0; fi
0026     if [ -e $t/Alignment/MuonAlignmentAlgorithms/python/$1 ]; then cp $t/Alignment/MuonAlignmentAlgorithms/python/$1 $2/; return 0; fi
0027     if [ -e $t/Alignment/MuonAlignment/python/$1 ]; then cp $t/Alignment/MuonAlignment/python/$1 $2/; return 0; fi
0028   done
0029   echo "$1 was not found in any known location"
0030   return 1
0031 }
0032 
0033 
0034 function FIND_SVG_TEMPLATES
0035 {
0036   svg_templ_dir="$PWD"
0037   for t in `echo -e "$PWD/\n./Alignment/MuonAlignment/data/\n$CMSSW_BASE/src/Alignment/MuonAlignment/data/\n$CMSSW_RELEASE_BASE/src/Alignment/MuonAlignment/data/"`
0038   do
0039     svg_templ_dir=$t
0040     if [ -e "${t}disk1_template.svg" ]; then return 0; fi
0041   done
0042   echo "Could not find location of SVG templates!"
0043   return 1
0044 }
0045 
0046 
0047 # defaults
0048 iter=5
0049 copy_from='.'
0050 xml0='initialMuonAlignment_March25_chambers.xml'
0051 tgz=1
0052 dwhich='110011'
0053 
0054 # options
0055 while getopts "n:i:0:zw:?" Option
0056 do
0057     case $Option in
0058         n    ) iter=$OPTARG;;
0059         i    ) copy_from=$OPTARG;;
0060         0    ) xml0=$OPTARG;;
0061         z    ) tgz=0;;
0062         w    ) dwhich=$OPTARG;;
0063         ?    ) USAGE
0064                exit 0;;
0065         *    ) echo ""
0066                echo "Unimplemented option chosen."
0067                USAGE   # DEFAULT
0068                exit 0
0069     esac
0070 done
0071 shift $(($OPTIND - 1))
0072 
0073 if [ "$#" != "1" ]
0074 then
0075   USAGE
0076   exit 0
0077 fi
0078 
0079 svg_templ_dir="${PWD}/Alignment/MuonAlignment/data/"
0080 FIND_SVG_TEMPLATES
0081 
0082 echo $# $iter $copy_from $xml0 $svg_templ_dir
0083 
0084 #exit 0
0085 
0086 d="$1"
0087 if [ -e $d ]; then rm -r $d; fi
0088 mkdir $d
0089 
0090 #./Alignment/MuonAlignmentAlgorithms/scripts/convertSQLiteXML.py $2 "$1/$1_00.xml"  --noLayers
0091 cp ${xml0} $d/$1_00.xml
0092 
0093 COPY_CODE diffTwoXMLs.py $d/
0094 COPY_CODE reportVsReport.py $d/
0095 COPY_CODE plotscripts.py $d/
0096 COPY_CODE geometryXMLparser.py $d/
0097 COPY_CODE mutypes.py $d/
0098 COPY_CODE signConventions.py $d/
0099 COPY_CODE geometryDiffVisualization.py $d/
0100 COPY_CODE geometryDiffVisualizer.py $d/
0101 COPY_CODE svgfig.py $d/
0102 COPY_CODE auto_gallery.php $d/
0103 
0104 #iter=3
0105 #svg_templ_dir="${PWD}/Alignment/MuonAlignment/data/"
0106 
0107 #copy_from='.'
0108 #copy_from='/afs/cern.ch/cms/CAF/CMSALCA/ALCA_MUONALIGN/SWAlignment/Reference-Target/aysen/CMSSW_4_2_3_patch3/src'
0109 #copy_from='/afs/cern.ch/cms/CAF/CMSALCA/ALCA_MUONALIGN/SWAlignment/Reference-Target/aysen/CMSSW_4_1_6/src'
0110 
0111 for n in `seq 1 $iter`
0112 do
0113   nn=`printf "%02d" $n`
0114   cp "${copy_from}/$1_${nn}/$1_${nn}.xml" $d/
0115   cp "${copy_from}/$1_${nn}/$1_${nn}_report.py" $d/
0116 done
0117 
0118 #exit 0
0119 
0120 touch $d/do
0121 
0122 for n in `seq 0 $((${iter}-1))`
0123 do
0124   n1=`printf "%02d" $n`
0125   n2=`printf "%02d" $(($n+1))`
0126   echo "doing" $n1 $n2
0127   
0128   xrep="$1_${n2}.xml $1_${n1}.xml $1_${n2}_report.py"
0129   label="$1_${n2}-${n1}"
0130 
0131   echo "./diffTwoXMLs.py ${label} DT ${xrep}" >> $d/do
0132   echo "./diffTwoXMLs.py ${label} CSC ${xrep}" >> $d/do
0133   #echo "./diffTwoXMLs.py ${label} CSCE1 ${xrep}" >> $d/do
0134   #echo "./diffTwoXMLs.py ${label} CSCE2 ${xrep}" >> $d/do
0135 
0136   echo "./diffTwoXMLs.py vsReport_${label} DT ${xrep}" >> $d/do
0137   echo "./diffTwoXMLs.py vsReport_${label} CSC ${xrep}" >> $d/do
0138   #echo "./diffTwoXMLs.py vsReport_${label} CSCE1 ${xrep}" >> $d/do
0139   #echo "./diffTwoXMLs.py vsReport_${label} CSCE2 ${xrep}" >> $d/do
0140 
0141   if [ $n -ne 0 ]; then
0142     label="$1_x${n1}-y${n2}"
0143     rep="-x 'iter ${n1} ' -y  'iter ${n2} ' $1_${n1}_report.py $1_${n2}_report.py"
0144     echo "./reportVsReport.py -l ${label} -w ${dwhich} -s DT ${rep}" >> $d/do
0145     echo "./reportVsReport.py -l ${label} -w ${dwhich} -s CSC ${rep}" >> $d/do
0146     #echo "./reportVsReport.py -l ${label} -s CSCE1 ${rep}" >> $d/do
0147     #echo "./reportVsReport.py -l ${label} -s CSCE2 ${rep}" >> $d/do
0148   fi
0149 done
0150 
0151 n2=`printf "%02d" $iter`
0152 xrep="$1_${n2}.xml $1_00.xml $1_${n2}_report.py"
0153 label="$1_${n2}-00"
0154 echo "./diffTwoXMLs.py ${label} DT ${xrep}" >> $d/do
0155 echo "./diffTwoXMLs.py ${label} CSC ${xrep}" >> $d/do
0156 #echo "./diffTwoXMLs.py ${label} CSCE1 ${xrep}" >> $d/do
0157 #echo "./diffTwoXMLs.py ${label} CSCE2 ${xrep}" >> $d/do
0158 
0159 xrep="${svg_templ_dir} $1_${n2}.xml $1_00.xml"
0160 label="$1_${n2}"
0161 echo "./geometryDiffVisualizer.py ${label} ${xrep}" >> $d/do
0162 
0163 echo "mkdir ME; mv *_CSC* ME/; mkdir MB; mv *_DT* MB/" >> $d/do
0164 echo "cp auto_gallery.php ME/csc_extras.php" >> $d/do
0165 echo "cp auto_gallery.php MB/dt_extras.php" >> $d/do
0166 
0167 cd $d/
0168 source do
0169 #cat do
0170 cd -
0171 
0172 if [ $tgz == 1 ]; then
0173  tar czvf "$1.tgz" $d/
0174 fi
0175