Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:33:38

0001 #!/bin/csh
0002 
0003 # This script is used to store generated histograms
0004 # in their archives, currently in the web space.
0005 
0006 #============= Configuration =================
0007 # This script behavior is tuned by few unix variables and command-line
0008 # arguments. You can use Oval as execution manager, whose configuration is
0009 # within OvalFile. Oval will set the relevant variables for you.
0010 # If you prefer to set the variables and run this script directly,
0011 # here they are :
0012 #
0013 #   $1 : when present, its value is duplicated into STORE_FILE.
0014 #   $... : when present, other arguments are duplicated into STORE_LOGS.
0015 #
0016 # Mandatory variables :
0017 #
0018 #   STORE_WEB : base directory where all the files are stored.
0019 #   STORE_RELEASE : chosen name for the new release to validate ; used
0020 #     in web pages and used to build the path where the web pages will be stored.
0021 #
0022 # Optional variables, eventually overloaded by command-line arguments :
0023 #
0024 #   STORE_FILE : path of the ROOT file containing the histograms.
0025 #   STORE_LOGS : path of the associated log files (expected to end with .olog),
0026 #     which will also be compressed.
0027 # 
0028 #=========================================================================================
0029 
0030 
0031 #============== Comand-line arguments ==================
0032 
0033 if ( "$1" == "-f" ) then
0034   setenv STORE_FORCE "yes"
0035   shift
0036 else
0037   setenv STORE_FORCE "no"
0038 endif
0039 
0040 if ( "$1" != "" ) then
0041   setenv STORE_FILE "$1"
0042   shift
0043 endif
0044 
0045 if ( "$*" != "" ) then
0046   setenv STORE_LOGS "$*"
0047 endif
0048 
0049 #============== Prepare output directory ==================
0050 
0051 if ( "${STORE_WEB}" == "" ) then
0052   echo "STORE_WEB must be defined"
0053   exit 1
0054 else
0055   echo "STORE_WEB = ${STORE_WEB}"
0056 endif
0057 
0058 if ( "${STORE_RELEASE}" == "" ) then
0059   echo "STORE_RELEASE must be defined"
0060   exit 2
0061 else
0062   echo "STORE_RELEASE = ${STORE_RELEASE}"
0063 endif
0064 
0065 setenv OUTPUT_DIR "$STORE_WEB/$STORE_RELEASE/Electrons/data"
0066 
0067 if (! -d $OUTPUT_DIR) then
0068   mkdir -p $OUTPUT_DIR
0069 endif
0070 
0071 #============== Find data files ==================
0072 
0073 if ( ${?STORE_FILE} == "0" ) setenv STORE_FILE ""
0074 if ( ${?STORE_LOGS} == "0" ) setenv STORE_LOGS ""
0075 
0076 if ( ${STORE_FILE} == "" ) then
0077   echo "Do not know which file to copy !"
0078   exit 3
0079 endif
0080 
0081 if ( -r "${STORE_FILE}" ) then
0082   echo "STORE_FILE = ${STORE_FILE}"
0083 else
0084   echo "${STORE_FILE} is unreadable !"
0085   exit 4
0086 endif
0087   
0088 if ( "${STORE_LOGS}" != "" ) then
0089   echo "STORE_LOGS = ${STORE_LOGS}"
0090 endif
0091   
0092 #============== Check not already done ==================
0093 
0094 if ( ${STORE_FORCE} == "no" && -f "${OUTPUT_DIR}/${STORE_FILE}" ) then
0095   echo "ERROR: ${STORE_FILE} ALREADY STORED IN ${OUTPUT_DIR} !"
0096   exit 5
0097 endif
0098 
0099   
0100 #============== Copy ==================
0101 
0102 echo cp $STORE_FILE $OUTPUT_DIR
0103 cp -f $STORE_FILE $OUTPUT_DIR
0104   
0105 if ( "${STORE_LOGS}" != "" ) then
0106   echo cp ${STORE_LOGS} $OUTPUT_DIR
0107   cp -f ${STORE_LOGS} $OUTPUT_DIR
0108   echo "cd $OUTPUT_DIR && gzip -f *.olog"
0109   cd $OUTPUT_DIR && gzip -f *.olog
0110 endif
0111