#PBS -N tr22936_416 #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_26_00 -q GCC_3_4_6 -f Linux+2.6 cd /home/stdenis/hww_1fb/hwwcdf6.1.6.mv5_18v1_16 srt_setup -a # setup neurobayes setup neurobayes_expert # # Switches determining what portions to run # GenerateTrainingTrees=1 Use2StepsInTreeGenerationAndTraining=1 ComputeTMVA=0 DoTraining=0 Dotemplates=1 Dostackedplots=1 Dostackedinput=0 Dofit=0 separateHiggsSignals=0 # # Run from the job directory to avoid stepping on other jobs # cd /data/cdf04/stdenis/batch/run22936/job416 rm -f /data/cdf04/stdenis/batch/run22936/job416/tr416.log # # If we are to train with NB, Determine if the server is up # if((${DoTraining}==1)); then if((${ComputeTMVA}!=1)); then ping -c 1 ppepc39.physics.gla.ac.uk; let x=0; if ((x!=0)); then echo ppepc39.physics.gla.ac.uk bad; exit 1 else echo ppepc39.physics.gla.ac.uk ok at start of job; fi fi fi # # 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/run22936/job416/steerComputentp.txt > Computentp190.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 NNAnaMain 190 416 -1 /data/cdf04/stdenis/batch/run22936/job416/steer.txt /data/cdf04/stdenis/batch/run22936/varset.txt TheTree:NNInput TrainingTree:/data/cdf04/stdenis/batch/run22936/job416/steerComputentp.txt:/data/cdf04/stdenis/batch/run22936/job416/trees/NNInputs_190.root > /data/cdf04/stdenis/batch/run22936/job416/tr416.log 2>&1 else NNAnaMain 190 416 -1 /data/cdf04/stdenis/batch/run22936/job416/steer.txt /data/cdf04/stdenis/batch/run22936/varset.txt TheTree:NNInput /data/cdf04/stdenis/batch/run22936/job416/trees/NNInputs_190.root > /data/cdf04/stdenis/batch/run22936/job416/tr416.log 2>&1 fi # echo "listing after running NNAnaMain" ls echo "Done listing" # # Make the plots # echo "Make plots" /home/stdenis/hww_1fb/hwwcdf6.1.6.mv5_18v1_16/GlaNtp/NNAna/scripts/plotTMVAResults.sh 190 22936 416 Run22936Job416 TMVA416_190_-1.root echo "Plots Done" # # test area to do the templates # move weights first mv weights/TMVTEST416_190_-1.root_H6AONN5MEMLP.weights.txt /data/cdf04/stdenis/batch/run22936/job416/weights/ mv -f weights/TMVTEST416_190_-1.root_H6AONN5MEMLP.class.C /data/cdf04/stdenis/batch/run22936/job416/weights/ mkdir -p /data/cdf04/stdenis/hww_1fb/hwwcdf6.1.6.mh/Hww/HwwUtil/weights/MENNWeights/v122936 echo "Moving weights" echo "In directory" /data/cdf04/stdenis/batch/run22936/job416 ls -al weights cp -f weights/* /data/cdf04/stdenis/hww_1fb/hwwcdf6.1.6.mh/Hww/HwwUtil/weights/MENNWeights/v122936/ cp -u /data/cdf04/stdenis/batch/run22936/job416/steer.txt /data/cdf04/stdenis/hww_1fb/hwwcdf6.1.6.mh/Hww/HwwUtil/weights/MENNWeights/v122936/. > /dev/null 2>&1 else /data/cdf04/stdenis/batch/train_nb.sh stdenis srv007 run22936job416 /data/cdf04/stdenis/batch/run22936/job416 /data/cdf04/stdenis/batch/run22936/job416/trees/NNInputs_190.root 190 >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/run22936/job416" mkdir -p /data/cdf04/stdenis/batch/run22936/templatesBl97_v100 inbase=/data/cdf04/stdenis/Hww/hwwucsdtuple/NTP_v21_r23-main-var1/BaseMllInvLowMetSpec/thin3/HWW190 if [ -e ${inbase} ]; then filelist=`ls ${inbase}/*.root` else echo "Directory ${inbase} does not exist" exit 1 fi mkdir -p /data/cdf04/stdenis/batch/run22936/templatesBl97_v100/HWW190 mkdir -p /data/cdf04/stdenis/batch/run22936/templatesBl97_v101/HWW190 if [ -e /data/cdf04/stdenis/batch/run22936/templatesBl97_v100/templates_out190.log ]; then rm /data/cdf04/stdenis/batch/run22936/templatesBl97_v100/templates_out190.log fi for f in $filelist do # # Doctor the fixweight if required # g=`basename $f` FixWeight=1.0 if [ -e None ]; then factorline=`cat None | 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/run22936/job416/steerFlatReaderTMVA.txt | sed "s/FixWeight=1.0/FixWeight=${FixWeight}/g" > ${templatesteerFlat} templatesteertouse=${g}_templatesteer.txt cat /data/cdf04/stdenis/batch/run22936/job416/steerTemplate.txt | sed "s/steerFlatReaderTMVA.txt/${templatesteerFlat}/g" > ${templatesteertouse} echo "Process ${f} with template ${templatesteertouse} and fixweight = ${FixWeight}" >> /data/cdf04/stdenis/batch/run22936/templatesBl97_v100/templates_out190.log infile=`basename $f` runFlatPlotter ${templatesteertouse} $f >> /data/cdf04/stdenis/batch/run22936/templatesBl97_v100/templates_out190.log 2>&1 mv stackoutput.root /data/cdf04/stdenis/batch/run22936/templatesBl97_v100/HWW190/UCSDnt_${infile}_190_00000000_99999999_ana.root done echo "Templates Done">> /data/cdf04/stdenis/batch/run22936/templatesBl97_v100/templates_out190.log fi # # Create the histlist # # If we are to separate the Higgs signals, then we should do that here # if((${separateHiggsSignals}==1)); then cat /data/cdf04/stdenis/batch/histlist/v21_nolr_tmva/./histlist-fb59-ntp-nolr-v18-190.txt | sed "s/7 UCSDnt_ntp_ZH/ UCSDnt_ntp_ZH/g" | sed "s/7 UCSDnt_ntp_WH/ UCSDnt_ntp_WH/g" | sed "s/7 UCSDnt_ntp_VBF/ UCSDnt_ntp_VBF/g" > localhistlist.txt else cp /data/cdf04/stdenis/batch/histlist/v21_nolr_tmva/./histlist-fb59-ntp-nolr-v18-190.txt localhistlist.txt fi # but only include the required Higgs signals if [ "" != "" ]; then for hproc in ; 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/run22936/templatesBl97_v100/HWW190/`echo $line | awk '{print $2}'` if [ -e $filetotest ]; then echo $line >> localhistlist2.txt else echo $line >> localhistlistExcludedLines.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/v21_nolr_tmva/./histlist-fb59-ntp-nolr-v18-190-allchan.txt ]; then # Check file exists and is a regular file if((${separateHiggsSignals}==1)); then cat /data/cdf04/stdenis/batch/histlist/v21_nolr_tmva/./histlist-fb59-ntp-nolr-v18-190-allchan.txt | sed "s/7 UCSDnt_ntp_ZH/ UCSDnt_ntp_ZH/g" | sed "s/7 UCSDnt_ntp_WH/ UCSDnt_ntp_WH/g" | sed "s/7 UCSDnt_ntp_VBF/ UCSDnt_ntp_VBF/g" > localhistlist_allchan.txt else cp /data/cdf04/stdenis/batch/histlist/v21_nolr_tmva/./histlist-fb59-ntp-nolr-v18-190-allchan.txt localhistlist_allchan.txt fi if [ "" != "" ]; then for hproc in ; 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/run22936/templatesBl97_v100/HWW190/`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/run22936/stacked/Bl97_v100 mystacksteer=/data/cdf04/stdenis/batch/run22936/job416/stackSteer.txt else myhistlist=${localhistlist_allchan} mystackoutdir=/data/cdf04/stdenis/batch/run22936/stacked/Bl97_v101 mystacksteer=/data/cdf04/stdenis/batch/run22936/job416/stackSteerSum.txt fi if [ "${myhistlist}" == "None" ]; then echo "Skipping Stacked Plots from /data/cdf04/stdenis/batch/run22936/job416 for pass ${ipass} since myhistlist is none" else echo "Making Stacked Plots from /data/cdf04/stdenis/batch/run22936/job416 for pass ${ipass}" # mkdir -p $mystackoutdir FlatStackMain /data/cdf04/stdenis/batch/run22936/templatesBl97_v100/HWW190/ \ ${myhistlist} \ ${mystackoutdir}/Stack190-run22936_1_${ipass}.root \ ${mystacksteer} \ /data/cdf04/stdenis/batch/run22936/job416/SysSetLowMll3.txt \ 190 0.6 1.0 \ /home/stdenis/hww_1fb/hwwcdf6.1.6.mv5_18v1_16/Hww/HwwFit/root/RealTitles.txt None > FlatStack1_out_190_${ipass}.log 2>&1 mv FlatStack_0.eps ${mystackoutdir}/Stack190-run22936_0_1_${ipass}.eps mv Rescaled.root ${mystackoutdir}/Rescaled190-run22936_1_${ipass}.root mv ZInsert.root ${mystackoutdir}/ZInsert190-run22936_1_${ipass}.root mv RescaledZInsert.root ${mystackoutdir}/RescaledZInsert190-run22936_1_${ipass}.root mv FlatStackstack.root ${mystackoutdir}/FlatStackstack190-run22936_1_${ipass}.root # FlatStackMain /data/cdf04/stdenis/batch/run22936/templatesBl97_v100/HWW190/ \ ${myhistlist} \ ${mystackoutdir}/Stack190-run22936_2_${ipass}.root \ ${mystacksteer} \ /data/cdf04/stdenis/batch/run22936/job416/SysSetLowMll3.txt \ 190 0.8 1.0 \ /home/stdenis/hww_1fb/hwwcdf6.1.6.mv5_18v1_16/Hww/HwwFit/root/RealTitles.txt None > FlatStack2_out_190_${ipass}.log 2>&1 mv FlatStack_0.eps ${mystackoutdir}/Stack190-run22936_0_2_${ipass}.eps mv Rescaled.root ${mystackoutdir}/Rescaled190-run22936_2_${ipass}.root mv ZInsert.root ${mystackoutdir}/ZInsert190-run22936_2_${ipass}.root mv RescaledZInsert.root ${mystackoutdir}/RescaledZInsert190-run22936_2_${ipass}.root mv FlatStackstack.root ${mystackoutdir}/FlatStackstack190-run22936_2_${ipass}.root # # Convert histos to gif files # cd ${mystackoutdir} convert Stack190-run22936_0_1_${ipass}.eps Stack190-run22936_0_1_${ipass}.gif convert Stack190-run22936_0_2_${ipass}.eps Stack190-run22936_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/run22936/stackedinput/Bl97_v100 mytemplateoutdir=/data/cdf04/stdenis/batch/run22936/templatesBl97_v100/HWW190 sumprefix= else mystackinputoutdir=/data/cdf04/stdenis/batch/run22936/stackedinput/Bl97_v101 mytemplateoutdir=/data/cdf04/stdenis/batch/run22936/templatesBl97_v101/HWW190 sumprefix=Sum # Sum the templates and make the new template dir # mkdir -p /data/cdf04/stdenis/batch/run22936/templatesBl97_v101/HWW190 echo "ColumnParameter Channel 1 HISB=0:LOSB=1" > steersumhist.txt echo "Making SumHist" for f in `ls /data/cdf04/stdenis/batch/run22936/templatesBl97_v100/HWW190`; do SumHist steersumhist.txt /data/cdf04/stdenis/batch/run22936/templatesBl97_v100/HWW190/${f} \ /data/cdf04/stdenis/batch/run22936/templatesBl97_v101/HWW190/${f} > /data/cdf04/stdenis/batch/run22936/job416/SumHist.log done fi echo "Making Stacked Input Plots from /data/cdf04/stdenis/batch/run22936/job416 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/run22936/job416/${myInputStackCondition}.txt # outdest=${mystackinputoutdir}/StackInput/HWW190/${myInputStackCondition} mkdir -p $outdest tmvafile=/data/cdf04/stdenis/hww_1fb/hwwcdf6.1.6.mh/Hww/HwwUtil/weights/MENNWeights/v17324/TMVTEST400_160_-1.root DisplayFlatStackedInput ${tmvafile} \ ${mytemplateoutdir}/ \ ${outdest}/InputStack190-run22936 \ ${stackinputsteer} \ /data/cdf04/stdenis/batch/run22936/job416/SysSetLowMll3.txt 190 > ${outdest}/aaastackjob190.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" fitdest=/data/cdf04/stdenis/batch/run22936/templatesBl97_v100/fit/out_1 fitwdir=/data/cdf04/stdenis/batch/run22936/templatesBl97_v100/fit/input_1/HWW190 fitlog=out_190.log mkdir -p ${fitdest} mkdir -p ${fitwdir} cd ${fitdest} rm -f LRWW_22936_190.root* rm -f ${fitlog} cd ${fitwdir} date > ${fitlog} echo `pwd` > ${fitlog} ####################### #Determine if shapes are to be used. If so, copy files in # # let ns1=`cat /data/cdf04/stdenis/batch/run22936/job416/steerfitLRHWW.txt | grep UseShape=1| wc -l` let ns2=`cat /data/cdf04/stdenis/batch/run22936/job416/steerfitLRHWW.txt | grep UseShapeMean=1| wc -l` let ns=ns1+ns2 echo "ns= ${ns} ns1= ${ns1} ns2= ${ns2}" >> ${fitlog} hlistsuffix=`basename ${fithistlist}` if((ns>0)); then # Want shapes echo "Want Shapes" >> ${fitlog} export hlist=histlist-fb59-ntp-nolr-v18-190.txt if ((FitST==1)); then export hlist=histlist-fb59-ntp-nolr-v18-190-allchan.txt ; fi # Get the list of systematics sysnamefile=/data/cdf04/stdenis/batch/run22936/job416/SysNamesLowMll3.txt cat ${sysnamefile} | while read sysline do sysname=`echo ${sysline} | awk '{print $4}' | awk -F: '{print $2}'` echo "Check sysname= ${sysname}">> ${fitlog} fpos=/data/cdf04/stdenis/batch/histlist/v21_nolr_tmva/./ShapePos_${sysname}_${hlist} echo "Check for fpos=${fpos}">> ${fitlog} if [ -f ${fpos} ]; then fposlocal=ShapePos_${sysname}_${hlistsuffix} echo "Got file. Copy ${fpos} ${fposlocal}">>${fitlog} cp ${fpos} ${fposlocal} fi fneg=/data/cdf04/stdenis/batch/histlist/v21_nolr_tmva/./ShapeNeg_${sysname}_${hlist} echo "Check for fneg=${fneg}">> ${fitlog} if [ -f ${fneg} ]; then fneglocal=ShapeNeg_${sysname}_${hlistsuffix} echo "Got file. Copy ${fneg} ${fneglocal}">>${fitlog} cp ${fneg} ${fneglocal} fi done fi cp ${fithistlist} . ####################### # Perform Fit # Fit ${hlistsuffix} \ /data/cdf04/stdenis/batch/run22936/templatesBl97_v100/HWW190/ \ /data/cdf04/stdenis/batch/run22936/job416/SysSetLowMll3.txt \ /data/cdf04/stdenis/batch/run22936/job416/steerfitLRHWW.txt 190 >> ${fitlog} 2>&1 ####################### date >> ${fitlog} mv * ${fitdest} fi #