Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-10-17 22:58:27

0001 #!/bin/bash -e
0002 
0003 display_usage() { 
0004     echo "This script must be run giving the following arguments." 
0005     echo -e "./testCompare.sh <name of tag> <first IOV> <last IOV> <sqlite file> \n\n"
0006     echo -e "example: \n ./testCompare.sh SiStripApvGain_FromParticles_GR10_v1_express 300577 302322 toCompare.db \n" 
0007 } 
0008 
0009 # if less than two arguments supplied, display usage 
0010 if [  $# -le 3 ]; then
0011     display_usage
0012     exit 1
0013 fi
0014  
0015 # check whether user had supplied -h or --help . If yes display usage 
0016 if [[ ( "$1" == "--help" ) ||  "$1" == "-h" ]]; then
0017     display_usage
0018     exit 0
0019 fi
0020 
0021 # Save current working dir so img can be outputted there later
0022 W_DIR=$(pwd)
0023 
0024 STARTIOV=$2
0025 ENDIOV=$3
0026 
0027 # Check if ENDIOV is greater than or equal to STARTIOV
0028 if (( $ENDIOV < $STARTIOV )); then
0029     echo "Error: ENDIOV ($ENDIOV) is less than STARTIOV ($STARTIOV). Skipping comparisons"
0030     exit 0
0031 fi
0032 
0033 source /cvmfs/cms.cern.ch/cmsset_default.sh
0034 eval "$(scram run -sh)"
0035 
0036 # Go back to original working directory
0037 cd "$W_DIR"
0038 
0039 plotTypes=(
0040     SiStripApvGainsComparatorSingleTag
0041     SiStripApvGainsValuesComparatorSingleTag
0042     SiStripApvGainsComparatorByRegionSingleTag
0043     SiStripApvGainsRatioComparatorByRegionSingleTag
0044     SiStripApvGainByPartition
0045 )
0046 
0047 mkdir -p "$W_DIR/results_$2-$3"
0048 
0049 # Remove any existing PNG files
0050 if ls *.png 1> /dev/null 2>&1; then
0051     rm *.png
0052 fi
0053 
0054 for i in "${plotTypes[@]}"; do
0055     echo "Making plot ${i}"
0056 
0057     # Run get payload data script
0058     getPayloadData.py \
0059         --plugin pluginSiStripApvGain_PayloadInspector \
0060         --plot plot_${i} \
0061         --tag "$1" \
0062         --time_type Run \
0063         --iovs '{"start_iov": "'$STARTIOV'", "end_iov": "'$ENDIOV'"}' \
0064         --db sqlite_file:"$4" \
0065         --test
0066 
0067     # Check if the command failed
0068     if [ $? -ne 0 ]; then
0069         echo "Error in getPayloadData for plot ${i}, exiting..."
0070         exit 1
0071     fi
0072 
0073     mv *.png "$W_DIR/results_$2-$3/${i}_$1_$2-$3.png"
0074 done
0075 
0076 plotTypes2=(
0077     SiStripApvGainCompareByPartitionTwoTags
0078     SiStripApvGainDiffByPartitionTwoTags
0079 )
0080 
0081 for i in "${plotTypes2[@]}"; do
0082     echo "Making plot ${i}"
0083 
0084     # Run get payload data script
0085     getPayloadData.py \
0086         --plugin pluginSiStripApvGain_PayloadInspector \
0087         --plot plot_${i} \
0088         --tag "$1" \
0089         --tagtwo "$1" \
0090         --time_type Run \
0091         --iovs '{"start_iov": "'$STARTIOV'", "end_iov": "'$STARTIOV'"}' \
0092         --iovstwo '{"start_iov": "'$ENDIOV'", "end_iov": "'$ENDIOV'"}' \
0093         --db sqlite_file:"$4" \
0094         --test
0095 
0096     # Check if the command failed
0097     if [ $? -ne 0 ]; then
0098         echo "Error in getPayloadData for plot ${i}, exiting..."
0099         exit 1
0100     fi
0101 
0102     mv *.png "$W_DIR/results_$2-$3/${i}_$1_$2-$3.png"
0103 done
0104 
0105 plotTypes3=(
0106     SiStripApvGainsAvgDeviationRatioWithPreviousIOVTrackerMap
0107     SiStripApvGainsMaxDeviationRatioWithPreviousIOVTrackerMap
0108 )
0109 
0110 for i in "${plotTypes3[@]}"
0111 do
0112     for j in 1 2 3
0113     do
0114         echo "Making plot ${i} with ${j} sigmas"
0115         # Run get payload data script
0116         getPayloadData.py \
0117             --plugin pluginSiStripApvGain_PayloadInspector \
0118             --plot plot_${i} \
0119             --tag $1 \
0120             --time_type Run \
0121             --iovs  '{"start_iov": "'$STARTIOV'", "end_iov": "'$ENDIOV'"}' \
0122             --input_params '{"nsigma":"'${j}'"}' \
0123             --db sqlite_file:$4 \
0124             --test
0125 
0126         # Check if the command failed
0127         if [ $? -ne 0 ]; then
0128             echo "Error in getPayloadData for plot ${i}, exiting..."
0129             exit 1
0130         fi
0131 
0132         mv *.png "$W_DIR/results_$2-$3/${i}_${j}sigmas_$1_$2-$3.png"
0133     done
0134 done