#PBS -N tr11672_403 #PBS -q medium5 #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.6.m setup root v5_22_00 -q GCC_3_4_3 -f Linux+2.6 cd /home/stdenis/hww_1fb/hwwcdf6.1.6.mv4_52 srt_setup -a # setup neurobayes setup neurobayes_expert # # Switches determining what portions to run # DoTraining=1 ComputeTMVA=1 GenerateTrainingTrees=1 Use2StepsInTreeGenerationAndTraining=1 Dotemplates=1 Dostackedplots=1 Dostackedinput=0 Dofit=1 # # Run from the job directory to avoid stepping on other jobs # cd /data/cdf04/stdenis/batch/run11672/job403 rm -f /data/cdf04/stdenis/batch/run11672/job403/tr403.log # # If the trees are to be made, make them # # Do tree generation for training in a separate step if desired # if(((${Use2StepsInTreeGenerationAndTraining}==1)) && ((${GenerateTrainingTrees}==1))); then Computentp /data/cdf04/stdenis/batch/run11672/job403/steerComputentp.txt > Computentp125.log 2>&1 fi # # If the training is to be done, do it # if((${DoTraining}==1)); then if((${ComputeTMVA}==1)); then # Do training.Also generate trees if not doing this in 2 steps if(((${GenerateTrainingTrees}==1)) && ((${Use2StepsInTreeGenerationAndTraining}!=1))); then TMVAAnamain 125 403 3 /data/cdf04/stdenis/batch/run11672/job403/steer.txt /data/cdf04/stdenis/batch/run11672/varset.txt TheTree:NNInput TrainingTree:/data/cdf04/stdenis/batch/run11672/job403/steerComputentp.txt:/data/cdf04/stdenis/batch/run11672/job403/trees/NNInputs_125.root > /data/cdf04/stdenis/batch/run11672/job403/tr403.log 2>&1 else TMVAAnamain 125 403 3 /data/cdf04/stdenis/batch/run11672/job403/steer.txt /data/cdf04/stdenis/batch/run11672/varset.txt TheTree:NNInput /data/cdf04/stdenis/batch/run11672/job403/trees/NNInputs_125.root > /data/cdf04/stdenis/batch/run11672/job403/tr403.log 2>&1 fi # echo "listing after running TMVAAnamain" ls echo "Done listing" # # test area to do the templates # move weights first mv weights/TMVTEST403_125_3.root_H6AONN5MEMLP.weights.txt /data/cdf04/stdenis/batch/run11672/job403/weights/ mv -f weights/TMVTEST403_125_3.root_H6AONN5MEMLP.class.C /data/cdf04/stdenis/batch/run11672/job403/weights/ mkdir -p /data/cdf04/stdenis/hww_1fb/hwwcdf6.1.6.mh/Hww/HwwUtil/weights/MENNWeights/v111672 echo "Moving weights" echo "In directory" /data/cdf04/stdenis/batch/run11672/job403 ls -al weights cp -f weights/* /data/cdf04/stdenis/hww_1fb/hwwcdf6.1.6.mh/Hww/HwwUtil/weights/MENNWeights/v111672/ cp -u /data/cdf04/stdenis/batch/run11672/job403/steer.txt /data/cdf04/stdenis/hww_1fb/hwwcdf6.1.6.mh/Hww/HwwUtil/weights/MENNWeights/v111672/. > /dev/null 2>&1 else /data/cdf04/stdenis/batch/train_nb.sh /data/cdf04/stdenis/batch/run11672/job403 /data/cdf04/stdenis/batch/run11672/job403/trees/NNInputs_125.root 125 >train_nb.log 2>&1 if [ $? -ne 0 ] then echo "NeuroBayes training failed" exit 1 fi fi fi if ((${Dotemplates==1})); then # now the templates # this is a stripped down process1run.sh echo "making templates from /data/cdf04/stdenis/batch/run11672/job403" mkdir -p /data/cdf04/stdenis/batch/run11672/templatesBl59_v100 inbase=/data/cdf04/stdenis/Hww/hwwucsdtuple/NTP_v18_r15-main-var1/BaseMllInv/thin3/HWW125 if [ -e ${inbase} ]; then filelist=`ls ${inbase}/*.root` else echo "Directory ${inbase} does not exist" exit 1 fi mkdir -p /data/cdf04/stdenis/batch/run11672/templatesBl59_v100/HWW125 mkdir -p /data/cdf04/stdenis/batch/run11672/templatesBl59_v101/HWW125 if [ -e /data/cdf04/stdenis/batch/run11672/templatesBl59_v100/templates_out125.log ]; then rm /data/cdf04/stdenis/batch/run11672/templatesBl59_v100/templates_out125.log fi for f in $filelist do # # Doctor the fixweight if required # g=`basename $f` FixWeight=1.0 if [ -e /data/cdf04/stdenis/batch/run11672/job403/FixWeightFilev18_r8.txt ]; then factorline=`cat /data/cdf04/stdenis/batch/run11672/job403/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/run11672/job403/steerFlatReaderTMVA.txt | sed "s/FixWeight=1.0/FixWeight=${FixWeight}/g" > ${templatesteerFlat} templatesteertouse=${g}_templatesteer.txt cat /data/cdf04/stdenis/batch/run11672/job403/steerTemplate.txt | sed "s/steerFlatReaderTMVA.txt/${templatesteerFlat}/g" > ${templatesteertouse} echo "Process ${f} with template ${templatesteertouse} and fixweight = ${FixWeight}" >> /data/cdf04/stdenis/batch/run11672/templatesBl59_v100/templates_out125.log infile=`basename $f` runFlatPlotter ${templatesteertouse} $f >> /data/cdf04/stdenis/batch/run11672/templatesBl59_v100/templates_out125.log 2>&1 mv stackoutput.root /data/cdf04/stdenis/batch/run11672/templatesBl59_v100/HWW125/UCSDnt_${infile}_125_00000000_99999999_ana.root done echo "Templates Done">> /data/cdf04/stdenis/batch/run11672/templatesBl59_v100/templates_out125.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-125.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/run11672/templatesBl59_v100/HWW125/`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-125-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-125-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/run11672/templatesBl59_v100/HWW125/`echo $line | awk '{print $2}'` if [ -e $filetotest ]; then echo $line >> localhistlist2.txt fi done < localhistlist_allchan.txt mv localhistlist2.txt localhistlist_allchan.txt else export localhistlist_allchan="None" fi # # make stacked plots if ((${Dostackedplots}==1)); then let ipass=1 while((ipass<=2)); do if((ipass==1)); then myhistlist=${localhistlist} mystackoutdir=/data/cdf04/stdenis/batch/run11672/stacked/Bl59_v100 mystacksteer=/data/cdf04/stdenis/batch/run11672/job403/stackSteer.txt else myhistlist=${localhistlist_allchan} mystackoutdir=/data/cdf04/stdenis/batch/run11672/stacked/Bl59_v101 mystacksteer=/data/cdf04/stdenis/batch/run11672/job403/stackSteerSum.txt fi if [ "${myhistlist}" == "None" ]; then echo "Skipping Stacked Plots from /data/cdf04/stdenis/batch/run11672/job403 for pass ${ipass} since myhistlist is none" else echo "Making Stacked Plots from /data/cdf04/stdenis/batch/run11672/job403 for pass ${ipass}" # mkdir -p $mystackoutdir FlatStackMain /data/cdf04/stdenis/batch/run11672/templatesBl59_v100/HWW125/ \ ${myhistlist} \ ${mystackoutdir}/Stack125-run11672_1_${ipass}.root \ ${mystacksteer} \ /data/cdf04/stdenis/batch/run11672/job403/SysSetLowMll3.txt \ 125 0.89 1.2 \ /home/stdenis/hww_1fb/hwwcdf6.1.6.mv4_52/Hww/HwwFit/root/RealTitles.txt None > FlatStack1_out_125_${ipass}.log 2>&1 mv FlatStack_0.eps ${mystackoutdir}/Stack125-run11672_0_1_${ipass}.eps mv Rescaled.root ${mystackoutdir}/Rescaled125-run11672_1_${ipass}.root mv ZInsert.root ${mystackoutdir}/ZInsert125-run11672_1_${ipass}.root mv RescaledZInsert.root ${mystackoutdir}/RescaledZInsert125-run11672_1_${ipass}.root mv FlatStackstack.root ${mystackoutdir}/FlatStackstack125-run11672_1_${ipass}.root # FlatStackMain /data/cdf04/stdenis/batch/run11672/templatesBl59_v100/HWW125/ \ ${myhistlist} \ ${mystackoutdir}/Stack125-run11672_2_${ipass}.root \ ${mystacksteer} \ /data/cdf04/stdenis/batch/run11672/job403/SysSetLowMll3.txt \ 125 1.05 1.22 \ /home/stdenis/hww_1fb/hwwcdf6.1.6.mv4_52/Hww/HwwFit/root/RealTitles.txt None > FlatStack2_out_125_${ipass}.log 2>&1 mv FlatStack_0.eps ${mystackoutdir}/Stack125-run11672_0_2_${ipass}.eps mv Rescaled.root ${mystackoutdir}/Rescaled125-run11672_2_${ipass}.root mv ZInsert.root ${mystackoutdir}/ZInsert125-run11672_2_${ipass}.root mv RescaledZInsert.root ${mystackoutdir}/RescaledZInsert125-run11672_2_${ipass}.root mv FlatStackstack.root ${mystackoutdir}/FlatStackstack125-run11672_2_${ipass}.root # # Convert histos to gif files # cd ${mystackoutdir} convert Stack125-run11672_0_1_${ipass}.eps Stack125-run11672_0_1_${ipass}.gif convert Stack125-run11672_0_2_${ipass}.eps Stack125-run11672_0_2_${ipass}.gif cd - fi let ipass=ipass+1 done fi if ((${Dostackedinput==1})); then let ipass=1 while((ipass<=2)); do if((ipass==1)); then mystackinputoutdir=/data/cdf04/stdenis/batch/run11672/stackedinput/Bl59_v100 mytemplateoutdir=/data/cdf04/stdenis/batch/run11672/templatesBl59_v100/HWW125 sumprefix= else mystackinputoutdir=/data/cdf04/stdenis/batch/run11672/stackedinput/Bl59_v101 mytemplateoutdir=/data/cdf04/stdenis/batch/run11672/templatesBl59_v101/HWW125 sumprefix=Sum # Sum the templates and make the new template dir # mkdir -p /data/cdf04/stdenis/batch/run11672/templatesBl59_v101/HWW125 echo "ColumnParameter Channel 1 HISB=0:LOSB=1" > steersumhist.txt echo "Making SumHist" for f in `ls /data/cdf04/stdenis/batch/run11672/templatesBl59_v100/HWW125`; do SumHist steersumhist.txt /data/cdf04/stdenis/batch/run11672/templatesBl59_v100/HWW125/${f} \ /data/cdf04/stdenis/batch/run11672/templatesBl59_v101/HWW125/${f} > /data/cdf04/stdenis/batch/run11672/job403/SumHist.log done fi echo "Making Stacked Input Plots from /data/cdf04/stdenis/batch/run11672/job403 on pass ${ipass}" mkdir -p ${mystackinputoutdir} if [ -e ]; 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 `; do myInputStackCondition=${sumprefix}${InputStackCondition} stackinputsteer=/data/cdf04/stdenis/batch/run11672/job403/${myInputStackCondition}.txt # outdest=${mystackinputoutdir}/StackInput/HWW125/${myInputStackCondition} mkdir -p $outdest tmvafile=/data/cdf04/stdenis/hww_1fb/hwwcdf6.1.6.mh/Hww/HwwUtil/weights/MENNWeights/v17324/TMVTEST400_160_3.root DisplayFlatStackedInput ${tmvafile} \ ${mytemplateoutdir}/ \ ${outdest}/InputStack125-run11672 \ ${stackinputsteer} \ /data/cdf04/stdenis/batch/run11672/job403/SysSetLowMll3.txt 125 > ${outdest}/aaastackjob125.log 2>&1 done else echo "Unable to find stack input condition file: . No stack input made" return 1 fi let ipass=ipass+1 done fi # now the fit // if ((${Dofit}==1)); then # # Determine if the summed or unsummed templates are to be used. # let FitST=0 export fithistlist=${localhistlist} if ((FitST==1)); then export fithistlist=${localhistlist_allchan}; fi # echo "Do Fit" mkdir -p /data/cdf04/stdenis/batch/run11672/templatesBl59_v100/fit/out_1 mkdir -p /data/cdf04/stdenis/batch/run11672/templatesBl59_v100/fit/input_1 cd /data/cdf04/stdenis/batch/run11672/templatesBl59_v100/fit/out_1 rm -f LRWW_11672_125.root* rm -f out_125.log date > out_125.log cd ../input echo `pwd` ####################### # Perform Fit # Fit ${fithistlist} \ /data/cdf04/stdenis/batch/run11672/templatesBl59_v100/HWW125/ \ /data/cdf04/stdenis/batch/run11672/job403/SysSetLowMll3.txt \ /data/cdf04/stdenis/batch/run11672/job403/steerfitLRHWW.txt 125 >> ../out_1/out_125.log 2>&1 ####################### mv *root ../out_1/. mv *eps ../out_1/. date >> out_125.log fi #