#PBS -N tr10830_411 #PBS -q medium #PBS -S /bin/bash #PBS -l cput=6:00:00,walltime=6:00:00 #PBS -j oe -m e -M r.stdenis@physics.gla.ac.uk # env source ~cdfsoft/cdf2.shrc setup cdfsoft2 6.1.4 setup root v5_14_00g -q GCC_3_4_3 -f Linux+2.4-2.3.2 cd /home/stdenis/hww_1fb/hwwcdf6.1.4v4_50 srt_setup -a # setup neurobayes export NEUROBAYES_EXPERT_DIR=/home/cdfsoft/products/neurobayes_expert/v2_1GCC_3_4_3ROOTv5_14_00g/Linux+2.4-2.3.2 export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${NEUROBAYES_EXPERT_DIR}/lib # # Run from the job directory to avoid stepping on other jobs # cd /data/cdf04/stdenis/batch/run10830/job411 rm -f /data/cdf04/stdenis/batch/run10830/job411/tr411.log # # If the trees are to be made, make them # # Do tree generation for training in a separate step if desired # if(((1==1)) && ((1==1))); then Computentp /data/cdf04/stdenis/batch/run10830/job411/steerComputentp.txt > Computentp165.log 2>&1 fi # # If the training is to be done, do it # if((1==1)); then if((0==1)); then # Do training.Also generate trees if not doing this in 2 steps if(((1==1)) && ((1!=1))); then TMVAAnamain 165 411 3 /data/cdf04/stdenis/batch/run10830/job411/steer.txt /data/cdf04/stdenis/batch/run10830/varset.txt TheTree:NNInput TrainingTree:/data/cdf04/stdenis/batch/run10830/job411/steerComputentp.txt:/data/cdf04/stdenis/batch/run10830/job411/trees/NNInputs_165.root > /data/cdf04/stdenis/batch/run10830/job411/tr411.log 2>&1 else TMVAAnamain 165 411 3 /data/cdf04/stdenis/batch/run10830/job411/steer.txt /data/cdf04/stdenis/batch/run10830/varset.txt TheTree:NNInput /data/cdf04/stdenis/batch/run10830/job411/trees/NNInputs_165.root > /data/cdf04/stdenis/batch/run10830/job411/tr411.log 2>&1 fi # echo "listing after running TMVAAnamain" ls echo "Done listing" # # test area to do the templates # move weights first mv weights/TMVTEST411_165_3.root_H6AONN5MEMLP.weights.txt /data/cdf04/stdenis/batch/run10830/job411/weights/ mv -f weights/TMVTEST411_165_3.root_H6AONN5MEMLP.class.C /data/cdf04/stdenis/batch/run10830/job411/weights/ mkdir -p /data/cdf04/stdenis/hww_1fb/hwwcdf6.1.4h/Hww/HwwUtil/weights/MENNWeights/v110830 echo "Moving weights" echo "In directory" /data/cdf04/stdenis/batch/run10830/job411 ls -al weights cp -f weights/* /data/cdf04/stdenis/hww_1fb/hwwcdf6.1.4h/Hww/HwwUtil/weights/MENNWeights/v110830/ cp -u /data/cdf04/stdenis/batch/run10830/job411/steer.txt /data/cdf04/stdenis/hww_1fb/hwwcdf6.1.4h/Hww/HwwUtil/weights/MENNWeights/v110830/. > /dev/null 2>&1 else /data/cdf04/stdenis/batch/train_nb.sh stdenis srv002 run10830job411 /data/cdf04/stdenis/batch/run10830/job411 /data/cdf04/stdenis/batch/run10830/job411/trees/NNInputs_165.root 165 >train_nb.log 2>&1 if [ $? -ne 0 ] then echo "NeuroBayes training failed" exit 1 fi fi fi if ((1==1)); then # now the templates # this is a stripped down process1run.sh echo "making templates from /data/cdf04/stdenis/batch/run10830/job411" mkdir -p /data/cdf04/stdenis/batch/run10830/templatesBl59_v100 inbase=/data/cdf04/stdenis/Hww/hwwucsdtuple/NTP_v18_r8-main-var1/BaseMllInv/thin3/HWW165 if [ -e ${inbase} ]; then filelist=`ls ${inbase}/*.root` else echo "Directory ${inbase} does not exist" exit 1 fi mkdir -p /data/cdf04/stdenis/batch/run10830/templatesBl59_v100/HWW165 mkdir -p /data/cdf04/stdenis/batch/run10830/templatesBl59_v101/HWW165 if [ -e /data/cdf04/stdenis/batch/run10830/templatesBl59_v100/templates_out165.log ]; then rm /data/cdf04/stdenis/batch/run10830/templatesBl59_v100/templates_out165.log fi for f in $filelist do # # Doctor the fixweight if required # g=`basename $f` FixWeight=1.0 if [ -e /data/cdf04/stdenis/batch/run10830/job411/FixWeightFilev18_r8.txt ]; then factorline=`cat /data/cdf04/stdenis/batch/run10830/job411/FixWeightFilev18_r8.txt | grep $g` if [ "$factorline" != "" ]; then FixWeight=`echo $factorline | awk '{print $2}'` fi fi echo "file = ${g} and FixWeight= ${FixWeight}" templatesteerFlat=${g}_templateFlat.txt cat /data/cdf04/stdenis/batch/run10830/job411/steerFlatReaderTMVA.txt | sed "s/FixWeight=1.0/FixWeight=${FixWeight}/g" > ${templatesteerFlat} templatesteertouse=${g}_templatesteer.txt cat /data/cdf04/stdenis/batch/run10830/job411/steerTemplate.txt | sed "s/steerFlatReaderTMVA.txt/${templatesteerFlat}/g" > ${templatesteertouse} echo "Process ${f} with template ${templatesteertouse} and fixweight = ${FixWeight}" >> /data/cdf04/stdenis/batch/run10830/templatesBl59_v100/templates_out165.log infile=`basename $f` runFlatPlotter ${templatesteertouse} $f >> /data/cdf04/stdenis/batch/run10830/templatesBl59_v100/templates_out165.log 2>&1 mv stackoutput.root /data/cdf04/stdenis/batch/run10830/templatesBl59_v100/HWW165/UCSDnt_${infile}_165_00000000_99999999_ana.root done echo "Templates Done">> /data/cdf04/stdenis/batch/run10830/templatesBl59_v100/templates_out165.log fi # # Create the histlist but only include the required Higgs signals # cp /data/cdf04/stdenis/batch/histlist/v18_nolr_tmva/./histlist-fb59-ntp-nolr-v18-165.txt localhistlist.txt if [ "WH ZH VBF " != "" ]; then for hproc in WH ZH VBF ; do cat localhistlist.txt | grep -v $hproc > localhistlist2.txt mv localhistlist2.txt localhistlist.txt done fi # # Get rid of any files that don't exist # while read line do filetotest=/data/cdf04/stdenis/batch/run10830/templatesBl59_v100/HWW165/`echo $line | awk '{print $2}'` if [ -e $filetotest ]; then echo $line >> localhistlist2.txt fi done < localhistlist.txt mv localhistlist2.txt localhistlist.txt # # define the local hist list # export localhistlist=${PWD}/localhistlist.txt # # Also create a localhist that has the channels summed on # if [ -f /data/cdf04/stdenis/batch/histlist/v18_nolr_tmva/./histlist-fb59-ntp-nolr-v18-165-allchan.txt ]; then # Check file exists and is a regular file cp /data/cdf04/stdenis/batch/histlist/v18_nolr_tmva/./histlist-fb59-ntp-nolr-v18-165-allchan.txt localhistlist_allchan.txt if [ "WH ZH VBF " != "" ]; then for hproc in WH ZH VBF ; do cat localhistlist_allchan.txt | grep -v $hproc > localhistlist2.txt mv localhistlist2.txt localhistlist_allchan.txt done fi export localhistlist_allchan=${PWD}/localhistlist_allchan.txt # # Get rid of any files that don't exist # while read line do filetotest=/data/cdf04/stdenis/batch/run10830/templatesBl59_v100/HWW165/`echo $line | awk '{print $2}'` if [ -e $filetotest ]; then echo $line >> localhistlist2.txt fi done < localhistlist_allchan.txt mv localhistlist2.txt localhist_allchan.txt else export localhistlist_allchan="None" fi # # make stacked plots if ((1==1)); then let ipass=1 while((ipass<=2)); do if((ipass==1)); then myhistlist=${localhistlist} mystackoutdir=/data/cdf04/stdenis/batch/run10830/stacked/Bl59_v100 mystacksteer=/data/cdf04/stdenis/batch/run10830/job411/stackSteer.txt else myhistlist=${localhistlist_allchan} mystackoutdir=/data/cdf04/stdenis/batch/run10830/stacked/Bl59_v101 mystacksteer=/data/cdf04/stdenis/batch/run10830/job411/stackSteerSum.txt fi if [ "${myhistlist}" == "None" ]; then echo "Skipping Stacked Plots from /data/cdf04/stdenis/batch/run10830/job411 for pass ${ipass} since myhistlist is none" else echo "Making Stacked Plots from /data/cdf04/stdenis/batch/run10830/job411 for pass ${ipass}" # mkdir -p $mystackoutdir FlatStackMain /data/cdf04/stdenis/batch/run10830/templatesBl59_v100/HWW165/ \ ${myhistlist} \ ${mystackoutdir}/Stack165-run10830_1_${ipass}.root \ ${mystacksteer} \ /data/cdf04/stdenis/batch/run10830/job411/SysSetLowMll3.txt \ 165 0.6 1.0 \ /home/stdenis/hww_1fb/hwwcdf6.1.4v4_50/Hww/HwwFit/root/RealTitles.txt None > FlatStack1_out_165_${ipass}.log 2>&1 mv FlatStack_0.eps ${mystackoutdir}/Stack165-run10830_0_1_${ipass}.eps mv Rescaled.root ${mystackoutdir}/Rescaled165-run10830_1_${ipass}.root mv ZInsert.root ${mystackoutdir}/ZInsert165-run10830_1_${ipass}.root mv RescaledZInsert.root ${mystackoutdir}/RescaledZInsert165-run10830_1_${ipass}.root mv FlatStackstack.root ${mystackoutdir}/FlatStackstack165-run10830_1_${ipass}.root # FlatStackMain /data/cdf04/stdenis/batch/run10830/templatesBl59_v100/HWW165/ \ ${myhistlist} \ ${mystackoutdir}/Stack165-run10830_2_${ipass}.root \ ${mystacksteer} \ /data/cdf04/stdenis/batch/run10830/job411/SysSetLowMll3.txt \ 165 0.8 1.0 \ /home/stdenis/hww_1fb/hwwcdf6.1.4v4_50/Hww/HwwFit/root/RealTitles.txt None > FlatStack2_out_165_${ipass}.log 2>&1 mv FlatStack_0.eps ${mystackoutdir}/Stack165-run10830_0_2_${ipass}.eps mv Rescaled.root ${mystackoutdir}/Rescaled165-run10830_2_${ipass}.root mv ZInsert.root ${mystackoutdir}/ZInsert165-run10830_2_${ipass}.root mv RescaledZInsert.root ${mystackoutdir}/RescaledZInsert165-run10830_2_${ipass}.root mv FlatStackstack.root ${mystackoutdir}/FlatStackstack165-run10830_2_${ipass}.root # # Convert histos to gif files # cd ${mystackoutdir} convert Stack165-run10830_0_1_${ipass}.eps Stack165-run10830_0_1_${ipass}.gif convert Stack165-run10830_0_2_${ipass}.eps Stack165-run10830_0_2_${ipass}.gif cd - fi let ipass=ipass+1 done fi if ((1==1)); then let ipass=1 while((ipass<=2)); do if((ipass==1)); then mystackinputoutdir=/data/cdf04/stdenis/batch/run10830/stackedinput/Bl59_v100 mytemplateoutdir=/data/cdf04/stdenis/batch/run10830/templatesBl59_v100/HWW165 sumprefix= else mystackinputoutdir=/data/cdf04/stdenis/batch/run10830/stackedinput/Bl59_v101 mytemplateoutdir=/data/cdf04/stdenis/batch/run10830/templatesBl59_v101/HWW165 sumprefix=Sum # Sum the templates and make the new template dir # mkdir -p /data/cdf04/stdenis/batch/run10830/templatesBl59_v101/HWW165 echo "ColumnParameter Channel 1 HISB=0:LOSB=1" > steersumhist.txt echo "Making SumHist" for f in `ls /data/cdf04/stdenis/batch/run10830/templatesBl59_v100/HWW165`; do SumHist steersumhist.txt /data/cdf04/stdenis/batch/run10830/templatesBl59_v100/HWW165/${f} \ /data/cdf04/stdenis/batch/run10830/templatesBl59_v101/HWW165/${f} > /data/cdf04/stdenis/batch/run10830/job411/SumHist.log done fi echo "Making Stacked Input Plots from /data/cdf04/stdenis/batch/run10830/job411 on pass ${ipass}" mkdir -p ${mystackinputoutdir} if [ -e /data/cdf04/stdenis/batch/run10830/job411/StackInputConditionList.txt ]; then # # The input stack condition is the same name as th steering file and forms the name of the output # directory # for InputStackCondition in `cat /data/cdf04/stdenis/batch/run10830/job411/StackInputConditionList.txt`; do myInputStackCondition=${sumprefix}${InputStackCondition} stackinputsteer=/data/cdf04/stdenis/batch/run10830/job411/${myInputStackCondition}.txt # outdest=${mystackinputoutdir}/StackInput/HWW165/${myInputStackCondition} mkdir -p $outdest tmvafile=/data/cdf04/stdenis/hww_1fb/hwwcdf6.1.4h/Hww/HwwUtil/weights/MENNWeights/v17324/TMVTEST400_160_3.root DisplayFlatStackedInput ${tmvafile} \ ${mytemplateoutdir}/ \ ${outdest}/InputStack165-run10830 \ ${stackinputsteer} \ /data/cdf04/stdenis/batch/run10830/job411/SysSetLowMll3.txt 165 > ${outdest}/aaastackjob165.log 2>&1 done else echo "Unable to find stack input condition file: /data/cdf04/stdenis/batch/run10830/job411/StackInputConditionList.txt. No stack input made" return 1 fi let ipass=ipass+1 done fi # now the fit if ((1==1)); then echo "Do Fit" mkdir -p /data/cdf04/stdenis/batch/run10830/templatesBl59_v100/fit/out_1 mkdir -p /data/cdf04/stdenis/batch/run10830/templatesBl59_v100/fit/input cd /data/cdf04/stdenis/batch/run10830/templatesBl59_v100/fit/out_1 rm -f LRWW_10830_165.root* rm -f out_165.log date > out_165.log cd ../input echo `pwd` ####################### # Perform Fit # Fit ${localhistlist} \ /data/cdf04/stdenis/batch/run10830/templatesBl59_v100/HWW165/ \ /data/cdf04/stdenis/batch/run10830/job411/SysSetLowMll3.txt \ /data/cdf04/stdenis/batch/run10830/job411/steerfitLRHWW.txt 165 >> ../out_1/out_165.log 2>&1 ####################### mv *root ../out_1/. mv *eps ../out_1/. date >> out_165.log fi #