Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-10 22:50:03

0001 #!/bin/csh
0002 
0003 # This script can be used to generate a web page to compare histograms from 
0004 # two input root files produced using the EDAnalyzers
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 : eventual first command-line argument, immediatly duplicated into VAL_OUTPUT_FILE,
0014 #   is the default base name of the files containing the histograms ; it is
0015 #   also used to build some default value for other variables.
0016 # $2 : eventual second command-line argument, immediatly duplicated into VAL_WEB_SUB_DIR,
0017 #   is the name of the web subdirectory. Default is close to ${DD_SAMPLE}_{DD_COND}.
0018 #
0019 # VAL_COMMENT : a comment to insert at the beginning of the web page, which generally
0020 #   explains the specificity of the new release if this is not straightforward.
0021 # VAL_NEW_RELEASE : chosen name for the new release to validate ; used in web pages
0022 #   and used to build the path where the web pages will be stored.
0023 # VAL_REF_RELEASE : chosen name of the old release to compare with ; used in web pages,
0024 #   for default reference file path, and used to build the path where the web pages will
0025 #   be stored.
0026 #
0027 # VAL_NEW_FILE : complete path of the file containing the new histograms.
0028 #   If not set, a default value is deduced from 1st command line argument and VAL_NEW_RELEASE.
0029 # VAL_REF_FILE : complete path of the file containing the old histograms to compare with.
0030 #   If not set, a default value is deduced from 1st command line argument and VAL_REF_RELEASE.
0031 # 
0032 # VAL_HISTOS : name of the file describing the histograms to extract and generate.
0033 # VAL_ANALYZER : name of the analyzer used.
0034 # VAL_CONFIGURATION : name of the cmsRun python3 configuration used.
0035 #
0036 # DD_SAMPLE : short chosen name for the current dataset ; used in web pages
0037 #   and used to build the subdirectory where the web pages will be
0038 #   stored ($VAL_WEB_SUB_DIR) unless it was given as the 3rd command line argument.
0039 # DD_COND : expression for the current conditions tag ; used to build the subdirectory
0040 #   where the web pages will be stored ($VAL_WEB_SUB_DIR) unless it was given as the
0041 #   3rd command line argument.
0042 #
0043 #=========================================================================================
0044 
0045 
0046 #============== Core config ==================
0047 
0048 setenv VAL_OUTPUT_FILE $1
0049 setenv VAL_WEB_SUB_DIR $2
0050 setenv VAL_ORIGINAL_DIR $cwd
0051 
0052 # those must have a value
0053 #setenv VAL_WEB ...
0054 #setenv VAL_URL ...
0055 #setenv VAL_NEW_RELEASE ...
0056 #setenv VAL_REF_RELEASE ...
0057 # those either have a value, or will receive a default below
0058 #setenv VAL_NEW_FILE ...
0059 #setenv VAL_REF_FILE ...
0060 
0061 #============== Find and prepare main output directory ==================
0062 
0063 echo "VAL_WEB = ${VAL_WEB}"
0064 
0065 if (! -d $VAL_WEB/$VAL_NEW_RELEASE) then
0066   mkdir $VAL_WEB/$VAL_NEW_RELEASE
0067 endif
0068 
0069 if (! -d $VAL_WEB/$VAL_NEW_RELEASE/Electrons) then
0070   mkdir $VAL_WEB/$VAL_NEW_RELEASE/Electrons
0071 endif
0072 
0073 if (! -d $VAL_WEB/$VAL_NEW_RELEASE/Electrons/vs${VAL_REF_RELEASE}) then
0074   mkdir $VAL_WEB/$VAL_NEW_RELEASE/Electrons/vs${VAL_REF_RELEASE}
0075 endif
0076 
0077 #============== Find and archive new log and data files ==================
0078 
0079 echo "VAL_NEW_RELEASE = ${VAL_NEW_RELEASE}"
0080 
0081 if ( ${?VAL_NEW_FILE} == "0" ) setenv VAL_NEW_FILE ""
0082 
0083 if ( ${VAL_NEW_FILE} == "" ) then
0084   if ( -r "${VAL_WEB}/${VAL_NEW_RELEASE}/Electrons/data/${VAL_OUTPUT_FILE}" ) then
0085     setenv VAL_NEW_FILE "${VAL_WEB}/${VAL_NEW_RELEASE}/Electrons/data/${VAL_OUTPUT_FILE}"
0086   endif
0087 endif
0088 
0089 if ( -r "${VAL_NEW_FILE}" ) then
0090   echo "VAL_NEW_FILE = ${VAL_NEW_FILE}"
0091   test "${VAL_ORIGINAL_DIR}/${VAL_OUTPUT_FILE}" -nt "${VAL_NEW_FILE}" && echo "WARNING: did you forget to store ${VAL_ORIGINAL_DIR}/${VAL_OUTPUT_FILE} ?"
0092 else
0093   if ( ${VAL_NEW_FILE} != "" ) then
0094     echo "${VAL_NEW_FILE} is unreadable !"
0095   else
0096     echo "New histograms file not found !"
0097   endif
0098   if ( -r "${VAL_ORIGINAL_DIR}/${VAL_OUTPUT_FILE}" ) then
0099     echo "Did you forget to store ${VAL_ORIGINAL_DIR}/${VAL_OUTPUT_FILE} ?"
0100   endif
0101   setenv VAL_NEW_FILE ""
0102 endif
0103   
0104 #============== Find reference data file (eventually the freshly copied new data) ==================
0105 
0106 echo "VAL_REF_RELEASE = ${VAL_REF_RELEASE}"
0107 
0108 if ( ${?VAL_REF_FILE} == "0" ) setenv VAL_REF_FILE ""
0109 
0110 if ( ${VAL_REF_FILE} == "" ) then
0111   if ( -r "${VAL_WEB}/${VAL_REF_RELEASE}/Electrons/data/${VAL_NEW_FILE:t}" ) then
0112     setenv VAL_REF_FILE ${VAL_WEB}/${VAL_REF_RELEASE}/Electrons/data/${VAL_NEW_FILE:t}
0113   endif
0114 endif
0115 
0116 if ( ${VAL_REF_FILE} == "" ) then
0117   if ( -r "${VAL_WEB}/${VAL_REF_RELEASE}/Electrons/data/${VAL_OUTPUT_FILE}" ) then
0118     setenv VAL_REF_FILE ${VAL_WEB}/${VAL_REF_RELEASE}/Electrons/data/${VAL_OUTPUT_FILE}
0119   endif
0120 endif
0121 
0122 if ( ${VAL_REF_FILE} == "" ) then
0123   if ( -r "${VAL_WEB}/${VAL_REF_RELEASE}/data/${VAL_OUTPUT_FILE}" ) then
0124     setenv VAL_REF_FILE ${VAL_WEB}/${VAL_REF_RELEASE}/data/${VAL_OUTPUT_FILE}
0125   endif
0126 endif
0127 
0128 echo "VAL_REF_FILE = ${VAL_REF_FILE}"
0129  
0130 #============== Prepare sample/cond subdirectory ==================
0131 
0132 if ( ${VAL_WEB_SUB_DIR} == "" ) then
0133   if ( "${DD_COND}" =~ *MC* ) then
0134     setenv VAL_WEB_SUB_DIR ${DD_SAMPLE}_Mc
0135   else if ( "${DD_COND}" =~ *IDEAL* ) then
0136     setenv VAL_WEB_SUB_DIR ${DD_SAMPLE}_Ideal
0137   else if ( "${DD_COND}" =~ *START* ) then
0138     setenv VAL_WEB_SUB_DIR ${DD_SAMPLE}_Startup
0139   else
0140     setenv VAL_WEB_SUB_DIR ${DD_SAMPLE}
0141   endif
0142 endif
0143 
0144 if ( "${DD_COND}" =~ *FastSim* ) then
0145       setenv VAL_WEB_SUB_DIR FastSim_${VAL_WEB_SUB_DIR}
0146 endif
0147 
0148 echo "VAL_WEB_SUB_DIR = ${VAL_WEB_SUB_DIR}"
0149 
0150 if (! -d $VAL_WEB/$VAL_NEW_RELEASE/Electrons/vs${VAL_REF_RELEASE}/${VAL_WEB_SUB_DIR}) then
0151   mkdir $VAL_WEB/$VAL_NEW_RELEASE/Electrons/vs${VAL_REF_RELEASE}/${VAL_WEB_SUB_DIR}
0152 endif
0153 
0154 if (! -d $VAL_WEB/$VAL_NEW_RELEASE/Electrons/vs${VAL_REF_RELEASE}/${VAL_WEB_SUB_DIR}/gifs) then
0155   mkdir $VAL_WEB/$VAL_NEW_RELEASE/Electrons/vs${VAL_REF_RELEASE}/${VAL_WEB_SUB_DIR}/gifs
0156 endif
0157 
0158 cp -f ${VAL_ORIGINAL_DIR}/electronValidation.C $VAL_WEB/$VAL_NEW_RELEASE/Electrons/vs${VAL_REF_RELEASE}/${VAL_WEB_SUB_DIR}
0159 
0160 #============== Prepare the list of histograms ==================
0161 # The second argument is 1 if the histogram is scaled, 0 otherwise
0162 # The third argument is 1 if the histogram is in log scale, 0 otherwise
0163 # The fourth argument is 1 if the histogram is drawn with errors, 0 otherwise
0164 
0165 cp $VAL_HISTOS $VAL_WEB/$VAL_NEW_RELEASE/Electrons/vs${VAL_REF_RELEASE}/${VAL_WEB_SUB_DIR}/histos.txt
0166 
0167 #================= Generate the gifs and index.html =====================
0168 
0169 root -b -l -q electronValidation.C
0170 echo "You can access the files here:"
0171 echo "${VAL_WEB}/${VAL_NEW_RELEASE}/Electrons/vs${VAL_REF_RELEASE}/${VAL_WEB_SUB_DIR}/"
0172 echo "You can browse your validation plots here:"
0173 echo "${VAL_URL}/${VAL_NEW_RELEASE}/Electrons/vs${VAL_REF_RELEASE}/${VAL_WEB_SUB_DIR}/"