Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:32:19

0001 #!/bin/bash
0002 # start the Validation of FEDCabling
0003 eval `scramv1 runtime -sh`
0004 
0005 ### check if everything needed to connect to DB is there
0006 if [ "$CONFDB" == ""  ];
0007 then echo "\$CONFDB not set, please set it before You continue"; exit 0;
0008 else echo "\$CONFDB="$CONFDB;
0009 fi 
0010 
0011 if [ "$TNS_ADMIN" == ""  ];
0012 then echo "\$TNS_ADMIN not set, please set it before You continue"; exit 0;
0013 else echo "\$TNS_ADMIN="$TNS_ADMIN;
0014 fi 
0015 
0016 if [ `ps aux |grep 10121|wc -l` -lt 2 ];
0017 then echo "No Tunnel to cmsusr active, please activate before starting!"; exit 0;
0018 fi
0019 
0020 #describe what this script does
0021 echo -e "\n-------------------------------------------------------------------------------------"
0022 echo "#This scripts validates the SiStripFedCabling O2O";
0023 echo "#It awaits a sqlite.db file and assumes that only one Tag is there for the FedCabling";
0024 echo "#If this is not the case please change inline the sqlite_partition variable!";
0025 echo -e "-------------------------------------------------------------------------------------\n"
0026 
0027 
0028 #needed infos to run script
0029 if [ $# -lt 3 ];
0030 then echo "Usage: "
0031      echo "./Cabling_Validation.sh \"dbfile\" runnr \"tag_orcoff\""
0032      exit 0;
0033      
0034 fi
0035 
0036 #set input variables to script variables
0037 dbfile_name=$1;
0038 runnr=$2
0039 tag_orcoff=$3;
0040 
0041 echo -e "Sqlite Tag for run "$runnr" is retrieved from "$dbfile_name" !\n";
0042 sqlite_tag=`cmscond_list_iov -c sqlite_file:$dbfile_name | grep FedCabling`;
0043 
0044 
0045 # create .py files
0046 cat template_Validate_FEDCabling_O2O_cfg.py | sed -e "s@template_runnr@$runnr@g" | sed -e "s@template_database@sqlite_file:$dbfile_name@g" | sed -e "s@template_tag@$sqlite_tag@g">> validate_sqlite_cfg.py
0047 cat template_Validate_FEDCabling_O2O_cfg.py | sed -e "s@template_runnr@$runnr@g" | sed -e "s@template_database@oracle://cms_orcoff_prod/CMS_COND_21X_STRIP@g" | sed -e "s@template_tag@$tag_orcoff@g">> validate_orcoff_cfg.py
0048 
0049 #cmsRun
0050 cmsRun validate_sqlite_cfg.py > "Reader_"$runnr"_sqlite.txt"
0051 cmsRun validate_orcoff_cfg.py > "Reader_"$runnr"_orcoff.txt"
0052 
0053 #check if cmsRun was ok
0054 if [ `cat Reader_"$runnr"_sqlite.txt | grep "\[SiStripFedCablingReader::beginRun\] VERBOSE DEBUG" | wc -l` -lt 1 ]
0055 then echo "There is a problem with cmsRun for the sqlite file: validate_sqlite_cfg.py! Please check the file";
0056      exit 0;
0057 fi
0058 
0059 if [ `cat Reader_"$runnr"_orcoff.txt | grep "\[SiStripFedCablingReader::beginRun\] VERBOSE DEBUG" | wc -l` -lt 1 ]
0060 then echo "There is a problem with cmsRun for the orcoff file: validate_orcoff_cfg.py! Please check the file ";
0061      exit 0;
0062 fi
0063 
0064 #Validation procedure
0065 if [ `diff "Reader_"$runnr"_sqlite.txt" "Reader_"$runnr"_orcoff.txt" | grep ">  DcuId"| sort -u | wc -l` -lt 1 ]; 
0066      then if [ `diff "Reader_"$runnr"_sqlite.txt" "Reader_"$runnr"_orcoff.txt" | grep "<  DcuId"| sort -u |wc -l` -lt 1 ]; 
0067           then echo -e '\033[1;32m'"No Difference between OrcOff FEDCabling and sqlite FEDCabling, O2O was successful!!!"`tput sgr0`;
0068      fi;
0069 else echo -n -e '\033[1;31m'"File Reader_"$runnr"_orcoff.txt contains ";
0070      echo -n `diff Reader_"$runnr"_orcoff.txt Reader_"$runnr"_sqlite.txt | grep ">  DcuId"| sort -u | wc -l`;
0071      echo " differing lines! Check Your O2O !!!"`tput sgr0`;
0072      echo -n -e '\033[1;31m'"File Reader_"$runnr"_sqlite.txt contains ";
0073      echo -n `diff Reader_"$runnr"_sqlite.txt Reader_"$runnr"_orcoff.txt | grep "<  DcuId"| sort -u | wc -l`;
0074      echo " differing lines! Check Your O2O !!!"`tput sgr0`;
0075      echo "Attaching diff to File: dcudetid_diff_"$runnr".txt!!!" ;
0076      touch dcudetid_diff_$runnr.txt;
0077      for i in  `diff Reader_"$runnr"_orcoff.txt Reader_"$runnr"_sqlite.txt | grep DcuId| sort -u`;
0078        do echo $i >> dcudetid_diff_$runnr.txt;
0079      done;
0080 fi;
0081 
0082 #clean up 
0083 rm "Reader_"$runnr"_sqlite.txt";
0084 rm "Reader_"$runnr"_orcoff.txt";
0085 rm validate_sqlite_cfg.py;
0086 rm validate_orcoff_cfg.py;
0087