Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:56:38

0001 #!/bin/bash
0002 
0003 MPS_TEST_DIR=${LOCALTOP}/tmp/$(date '+%G-%m-%d_%H.%M.%S.%N')_${RANDOM}
0004 MPprod_dir=${MPS_TEST_DIR}/MPproduction
0005 
0006 check_for_success() {
0007     "${@}" && echo -e "\n ---> Passed test of '${@}'\n\n" || exit 1
0008 }
0009 
0010 check_for_failure() {
0011     "${@}" && exit 1 || echo -e "\n ---> Passed test of '${@}'\n\n"
0012 }
0013 
0014 clean_up() {
0015     cd
0016     rm -rf ${MPS_TEST_DIR}
0017 }
0018 trap clean_up EXIT
0019 
0020 
0021 echo "========================================"
0022 echo "Testing MPS workflow in '${MPS_TEST_DIR}'."
0023 echo "----------------------------------------"
0024 echo
0025 
0026 
0027 # create dummy MPproduction area
0028 rm -rf ${MPprod_dir}
0029 mkdir -p ${MPprod_dir}
0030 cd ${MPprod_dir}
0031 
0032 
0033 # create dummy input file list
0034 input_file_list=${MPprod_dir}/dummy_input_file_list.txt
0035 rm -f ${input_file_list}
0036 for i in $(seq 5)
0037 do
0038     echo "/this/is/file/number/${i}.root" >> ${input_file_list}
0039 done
0040 
0041 
0042 # create dummy (previous) campaign
0043 campaign_id=${RANDOM}
0044 mkdir mp$(printf %04d ${campaign_id})
0045 
0046 
0047 # setup of MP campaigns
0048 check_for_failure mps_setup_new_align.py
0049 check_for_failure mps_setup_new_align.py -t mc -d 'dummy campaign'
0050 check_for_failure mps_setup_new_align.py -t dat -d 'dummy campaign'
0051 check_for_failure mps_setup_new_align.py -t MC
0052 check_for_failure mps_setup_new_align.py -d 'dummy campaign'
0053 check_for_success mps_setup_new_align.py -t data -d 'dummy data campaign'
0054 campaign_id=$((${campaign_id}+1))
0055 check_for_success mps_setup_new_align.py -t MC -d 'dummy MC campaign'
0056 campaign_id=$((${campaign_id}+1))
0057 check_for_success mps_setup_new_align.py -t MC -d 'dummy MC campaign' -c mp$(printf %04d ${campaign_id})
0058 campaign_id=$((${campaign_id}+1))
0059 
0060 
0061 # proceed with last created campaign
0062 cd mp$(printf %04d ${campaign_id})
0063 
0064 
0065 # create input db file
0066 input_db_file=test_input.db
0067 check_for_success mps_prepare_input_db.py -g auto:run2_mc -r ${RANDOM} -o ${input_db_file}
0068 surface_tag=$(conddb --db ${input_db_file} listTags | awk '$3 ~ /AlignmentSurfaceDeformations/ {print $1}')
0069 
0070 
0071 # modify the templates
0072 sed -i "s|\(inputFileList\s*=\).*$|\1 ${input_file_list}|" alignment_config.ini
0073 cat <<EOF >> alignment_config.ini
0074 [dataset:Cosmics0T]
0075 collection     = ALCARECOTkAlCosmicsCTF0T
0076 inputFileList  = ${input_file_list}
0077 cosmicsDecoMode  = true
0078 cosmicsZeroTesla = true
0079 njobs            = 3
0080 
0081 [dataset:Cosmics3.8T_PEAK]
0082 collection     = ALCARECOTkAlCosmicsCTF0T
0083 inputFileList  = ${input_file_list}
0084 cosmicsDecoMode  = false
0085 cosmicsZeroTesla = false
0086 njobs            = 10
0087 
0088 [dataset:Cosmics0T_PEAK]
0089 collection     = ALCARECOTkAlCosmicsCTF0T
0090 inputFileList  = ${input_file_list}
0091 cosmicsDecoMode  = false
0092 cosmicsZeroTesla = true
0093 njobs            = 1
0094 EOF
0095 cat <<EOF >> universalConfigTemplate.py
0096 tagwriter.setCondition(process,
0097        connect = "frontier://FrontierProd/CMS_CONDITIONS",
0098        record = "TrackerAlignmentErrorExtendedRcd",
0099        tag = "TrackerIdealGeometryErrorsExtended210_mc")
0100 tagwriter.setCondition(process,
0101        connect = "sqlite_file:$(pwd)/${input_db_file}",
0102        record = "TrackerSurfaceDeformationRcd",
0103        tag = "${surface_tag}")
0104 EOF
0105 
0106 
0107 # checking the setup of the job folders of a campaign
0108 check_for_failure mps_alisetup.py
0109 sed -i "s|\(\[general\]\)\s*$|\1\ntestMode = true|" alignment_config.ini
0110 check_for_failure mps_alisetup.py alignment_config.ini
0111 sed -i "s|\(FirstRunForStartGeometry\s*=\).*$|\1 1\nmassStorageDir = /store/nothing/MSS|" alignment_config.ini
0112 check_for_success mps_alisetup.py alignment_config.ini
0113 
0114 
0115 # checking the weight assignment
0116 cat <<EOF >> alignment_config.ini
0117 weight = peak_cosmics
0118 
0119 [weights]
0120 peak_cosmics = 3.0
0121 EOF
0122 check_for_failure mps_alisetup.py -w
0123 check_for_success mps_alisetup.py -w alignment_config.ini
0124 
0125 
0126 # clean up
0127 clean_up