Index: trunk/HiggsSignals-2/example_programs/HBandHSwithFH.F =================================================================== --- trunk/HiggsSignals-2/example_programs/HBandHSwithFH.F (revision 568) +++ trunk/HiggsSignals-2/example_programs/HBandHSwithFH.F (revision 569) @@ -1,785 +1,788 @@ !-------------------------------------------------------------------- program HBandHSwithFH !-------------------------------------------------------------------- ! This example program is part of HiggsSignals (TS 06/03/2013). ! ! The program runs FeynHiggs (FH version > 2.9.4 required) to evaluate ! the partonic input of HiggsBounds/HiggsSignals for a example MSSM point. ! Then, we run HiggsBounds and HiggsSignals. ! ! Note: You have to set the correct FeynHiggs path in the configure file. ! Then, this example program can be compiled by running ! ! make HBandHSwithFH ! ! in the HiggsSignals main directory. !-------------------------------------------------------------------- use usefulbits_hs, only : HSres + use STXS, only : print_STXS implicit none integer error c used by FHHiggsCorr double precision MHiggs(4) double complex SAeff, DeltaSAeff, UHiggs(3,3), ZHiggs(3,3) c used by FHSelectUZ: integer uzint, uzext, mfeff c used by FHCouplings: #include "FHCouplings.h" double complex couplings(ncouplings), couplingsms(ncouplingsms) double precision gammas(ngammas), gammasms(ngammasms) integer fast c used by FHHiggsProd: double precision sqrts, prodxs(nprodxs) c used by FHGetPara: integer nmfv c This is for FH 2.14.x double precision MSf(2,5,3), MASf(6,5), MCha(2), MNeu(4) double complex USf(2,2,5,3), UASf(6,6,5) double complex UCha(2,2), VCha(2,2), ZNeu(4,4) double complex DeltaMB double precision MGl, MHp double precision MHtree(4), SAtree double precision AlfasMT Cdouble precision MHiggs(4) Cdouble complex SAeff, DeltaSAeff, UHiggs(3,3), ZHiggs(3,3) c used by FHRetrieveSMPara: double precision invAlfa0,invAlfaMZ, AlfasMZ, GF double precision ME, MU, MD, MM, MC, MS, ML, MB double precision MW, MZ, GammaW, GammaZ double precision CKMlambda, CKMA, CKMrhobar, CKMetabar double precision RMUE, RAt, RM2 c used by initialize_HiggsBounds integer nHiggsneut,nHiggsplus parameter (nHiggsneut = 3) parameter (nHiggsplus = 1) character(LEN=5) whichanalyses c used by HiggsBounds_neutral_input_part double precision Mh(3),GammaTotal_hj(3) integer CP_value(3) double precision CS_hj_ratio(4,3), & CS_gg_hj_ratio(4,3),CS_bb_hj_ratio(4,3), & CS_hjW_ratio(4,3),CS_hjZ_ratio(4,3), & CS_vbf_ratio(4,3),CS_tthj_ratio(4,3), & CS_thj_tchan_ratio(4,3),CS_thj_schan_ratio(4,3), & CS_hjhi(4,3,3) double precision CS_ee_hjZ_ratio(3),CS_ee_bbhj_ratio(3), & CS_ee_tautauhj_ratio(3),CS_ee_hjhi_ratio(3,3) double precision BR_hjss(3),BR_hjcc(3), & BR_hjbb(3),BR_hjmumu(3),BR_hjtautau(3), & BR_hjWW(3),BR_hjZZ(3),BR_hjZga(3), & BR_hjgaga(3),BR_hjgg(3),BR_hjtt(3), & BR_hjinvisible(3),BR_hkhjhi(3,3,3),BR_hjhiZ(3,3), & BR_hjemu(3),BR_hjetau(3),BR_hjmutau(3),BR_hjHpiW(3,1) c used by HiggsBounds_charged_input double precision Mhplus(1),GammaTotal_Hpj(1), & CS_ee_HpjHmj_ratio(1), & BR_tWpb(1),BR_tHpjb(1), & BR_Hpjcs(1),BR_Hpjcb(1),BR_Hpjtaunu(1), & BR_Hpjtb(1),BR_HpjWZ(1),BR_HpjhiW(1,3),CS_Hpjtb(4) c used in HiggsBounds double precision dmhneut_hb(nHiggsneut) double precision dmhch_hb(nHiggsplus) c used in HiggsSignals (can be different) double precision dmhneut_hs(nHiggsneut) double precision obsratio_tmp,predratio_tmp integer HBresult_tmp,chan_tmp,ncombined_tmp c return values of run_HiggsBounds integer HBresult,chan,ncombined double precision obsratio c used by set_rate_uncertainties in HiggsSignals double precision dCS(5),dBR(5) double precision dggh, dbbh c return values of run_HiggsSignals double precision Chisq_mu, Chisq_mh, Chisq, Pvalue integer nobs c run options in HiggsSignals integer pdf, output_level, mass_centered_method,runmode double precision :: dmhneut(3) double precision :: dmhch(1) c HiggsSignals output double precision Chisq_LHCRun1_mu,Chisq_LHCRun1_mh double precision Chisq_LHCRun1, Pvalue_LHCRun1 integer nobs_LHCRun1 double precision Chisq_STXS_rates, Chisq_STXS_mh double precision Chisq_STXS, Pvalue_STXS integer nobs_STXS integer ntotal, npeakmu, npeakmh, nmpred, nanalyses c misc: integer i,j,k,as,t, collider double precision norm,CW2,Pi double precision & g2hjbb(3),g2hjWW(3),g2hjZZ(3), & g2hjgg(3),g2hjhiZ_nHbynH(3,3) double precision g2hjbb_s(3),g2hjbb_p(3) double precision g2hjtautau_s(3),g2hjtautau_p(3) integer sneutrino_lspcandidate_number logical invisible_lsp double precision lspcandidate_mass Pi = 3.1415926535897932384626433832795029D0 !--------------------------------------- Run Options ------------------------------------! c The string 'whichanalyses' determines which subset of experimental c results are used. In this example, we've used the option 'LandH', c which instructs HiggsBounds to use tables of results c from LEP, Tevatron and LHC (i.e. the full set of c results supplied with HiggsBounds). whichanalyses='LandH' c Choose a Higgs mass parametrization for HiggsSignals c (1: box, 2:gaussian, 3:box+gaussian) pdf = 2 c Choose the output level of HiggsSignals c (0: silent, 1: screen output, 2: even more output,...) output_level = 0 c Set the HiggsSignals runmode (1: peak-centered, 2: mass-centered, 3: both) Chi^2 method(s) runmode = 1 dmhneut = (/3.0D0, 0.0D0, 0.0D0/) dmhch = (/0.D0/) !---------------------------- HiggsBounds and HiggsSignals ------------------------------! c c If you would like to perform scans over variables, the subroutines c initialize_HiggsBounds, initialize_HiggsSignals (and finish_HiggsBounds, c finish HiggsSignals) should be called outside the do-loops in order to save time. c !---- Initialize HiggsBounds and specify the dataset it should use ----! call initialize_HiggsBounds(nHiggsneut,nHiggsplus,whichanalyses) !---- Initialize HiggsSignals and pass the name of the experimental analysis folder ----! call initialize_HiggsSignals(nHiggsneut,nHiggsplus,"LHC13") call HiggsBounds_set_mass_uncertainties(dmhneut,dmhch) call HiggsSignals_neutral_input_MassUncertainty(dmhneut) !------------------------------ HiggsSignals options ------------------------------------! !---- Set the output level ----! call setup_output_level(output_level) !---- Set the Higgs mass parametrization ----! call setup_pdf(pdf) call setup_assignmentrange_massobservables(3.0D0) !---------------------------------- Run FeynHiggs ---------------------------------------! c the subroutines setFlags, setPara, setSLHA c are also contained in this file call setFlags * either use setPara to set the parameters directly * or use setSLHA to read them from an SLHA file call setPara c call setSLHA("tmp.slha") call FHGetPara(error, nmfv, MSf, USf,MASf, UASf, & MCha, UCha, VCha, MNeu, ZNeu, DeltaMB, MGl, & MHtree, SAtree, AlfasMT) if( error .ne. 0 ) stop call FHHiggsCorr(error, MHiggs, SAeff, UHiggs, ZHiggs) if( error .ne. 0 ) stop c NOTE: we are setting uzint=uzext - mfeff=1 - uzint=2 - uzext=2 - call FHSelectUZ(error, uzint, uzext, mfeff) - if( error .ne. 0 ) stop +C mfeff=1 +C uzint=2 +C uzext=2 +C call FHSelectUZ(error, uzint, uzext, mfeff) +C if( error .ne. 0 ) stop fast=1 call FHCouplings(error, & couplings, couplingsms, gammas, gammasms, fast) if( error .ne. 0 ) stop call FHRetrieveSMPara(error, & invAlfa0, invAlfaMZ, AlfasMZ, GF, & ME, MU, MD, MM, MC, MS, ML, MB, & MW, MZ, GammaW, GammaZ, & CKMlambda, CKMA, CKMrhobar, CKMetabar) !--------------- Turn FeynHiggs results into HiggsBounds/Signals input ------------------! c Set variables needed by HiggsBounds (using results from FeynHiggs). c See HiggsBounds documentation for definition of variables used c as arguments to HiggsBounds_neutral_input_part and run_HiggsBounds c and FeynHiggs documentation for all other variables. c Note: It is slightly more accurate to use the subroutine HiggsBounds_neutral_input_part c rather than the subroutine HiggsBounds_neutral_input_effC because the SM branching ratios c used internally in HiggsBounds (from HDecay) are not identical to the SM branching c ratios used in FeynHiggs do i=1,3 Mh(i)=MHiggs(i) GammaTotal_hj(i) = GammaTot(i) BR_hjss(i) = BR(H0FF(i,4,2,2)) BR_hjcc(i) = BR(H0FF(i,3,2,2)) BR_hjbb(i) = BR(H0FF(i,4,3,3)) BR_hjmumu(i) = BR(H0FF(i,2,2,2)) BR_hjtautau(i) = BR(H0FF(i,2,3,3)) BR_hjtt(i) = BR(H0FF(i,3,3,3)) BR_hjWW(i) = BR(H0VV(i,4)) BR_hjgaga(i) = BR(H0VV(i,1)) BR_hjZga(i) = BR(H0VV(i,2)) BR_hjZZ(i) = BR(H0VV(i,3)) BR_hjgg(i) = BR(H0VV(i,5)) BR_hjHpiW(i,1) = 0.0D0 BR_hjemu(i) = BR(H0FF(i,2,1,2)) BR_hjetau(i) = BR(H0FF(i,2,1,3)) BR_hjmutau(i) = BR(H0FF(i,2,2,3)) if(GammaSM(H0FF(i,4,3,3)).le.0.0D0)then g2hjbb(i)=0.0D0 else g2hjbb(i)=Gamma(H0FF(i,4,3,3)) & /GammaSM(H0FF(i,4,3,3)) endif g2hjbb_s(i)=(abs(RCoupling(H0FF(i,4,3,3)) & /RCouplingSM(H0FF(i,4,3,3))+ & LCoupling(H0FF(i,4,3,3)) & /LCouplingSM(H0FF(i,4,3,3)))/2.0D0)**2.0D0 g2hjbb_p(i)=(abs(RCoupling(H0FF(i,4,3,3)) & /RCouplingSM(H0FF(i,4,3,3))- & LCoupling(H0FF(i,4,3,3)) & /LCouplingSM(H0FF(i,4,3,3)))/2.0D0)**2.0D0 g2hjtautau_s(i)=(abs(RCoupling(H0FF(i,2,3,3)) & /RCouplingSM(H0FF(i,2,3,3))+ & LCoupling(H0FF(i,2,3,3)) & /LCouplingSM(H0FF(i,2,3,3)))/2.0D0)**2.0D0 g2hjtautau_p(i)=(abs(RCoupling(H0FF(i,2,3,3)) & /RCouplingSM(H0FF(i,2,3,3))- & LCoupling(H0FF(i,2,3,3)) & /LCouplingSM(H0FF(i,2,3,3)))/2.0D0)**2.0D0 if( g2hjbb_p(i).lt.1.0D-10)then CP_value(i) = 1 elseif( g2hjbb_s(i).lt.1.0D-10)then CP_value(i) = -1 else CP_value(i) = 0 endif CS_ee_bbhj_ratio(i) = g2hjbb_s(i)+g2hjbb_p(i) CS_ee_tautauhj_ratio(i) = g2hjtautau_s(i)+g2hjtautau_p(i) g2hjWW(i)= dble( Coupling(H0VV(i,4)) & / CouplingSM(H0VV(i,4)) )**2.0D0 & + dimag( Coupling(H0VV(i,4)) & / CouplingSM(H0VV(i,4)) )**2.0D0 g2hjZZ(i)= dble( Coupling(H0VV(i,3)) & / CouplingSM(H0VV(i,3)) )**2.0D0 & + dimag( Coupling(H0VV(i,3)) & / CouplingSM(H0VV(i,3)) )**2.0D0 CS_ee_hjZ_ratio(i) = g2hjZZ(i) enddo norm=GF*sqrt(2.0D0)*MZ**2.0D0 do j=1,3 do i=1,3 g2hjhiZ_nHbynH(j,i)= ( & dble( Coupling(H0HV(j,i)) )**2.0D0 & + dimag( Coupling(H0HV(j,i)) )**2.0D0 & ) & /norm CS_ee_hjhi_ratio(j,i) = g2hjhiZ_nHbynH(j,i) BR_hjhiZ(j,i) = BR(H0HV(j,i)) do k=1,3 BR_hkhjhi(k,j,i) = BR(H0HH(k,j,i)) enddo enddo enddo c higgs->neutralino1 neutralino1 contributes the invisible Higgs decay width c when neutralino1 or sneutrino is the LSP do i=1,3 sneutrino_lspcandidate_number=0 invisible_lsp=.True. c first determine whether lightest sneutrino is lighter than the lightest neutralino c c sneutrino_lspcandidate_number=0 indicates that lightest neutralino is c lighter than all the sneutrinos lspcandidate_mass=MNeu(1) do as=1,3 if( MASf(as,1) .lt. lspcandidate_mass )then lspcandidate_mass=MASf(as,1) sneutrino_lspcandidate_number=as endif enddo if( MCha(1) .lt. lspcandidate_mass )then invisible_lsp=.False. elseif( MGl .lt. lspcandidate_mass )then invisible_lsp=.False. else do as=1,6 do t=2,4 if( MASf(as,t) .lt. lspcandidate_mass )then invisible_lsp=.False. endif enddo enddo endif if(invisible_lsp)then if(sneutrino_lspcandidate_number.eq.0)then BR_hjinvisible(i) = BR(H0NeuNeu(i,1,1)) else BR_hjinvisible(i) = BR(H0SfSf(i,1,1,1,as)) endif else BR_hjinvisible(i) = 0.0D0 endif enddo do j=1,4 select case(j) case(1) collider = 2 sqrts = 2.0D0 case(2) collider = 7 sqrts = 7.0D0 case(3) collider = 8 sqrts = 8.0D0 case(4) collider = 13 sqrts = 13.0D0 end select call FHHiggsProd(error, sqrts, prodxs) if( error .ne. 0 ) stop do i=1,3 CS_gg_hj_ratio(j,i) = ggh(i)/gghSM(i) CS_bb_hj_ratio(j,i) = bbh(i)/bbhSM(i) CS_hj_ratio(j,i) = (ggh(i)+bbh(i))/ & (gghSM(i)+bbhSM(i)) CS_vbf_ratio(j,i) = qqh(i)/qqhSM(i) CS_hjW_ratio(j,i) = Wh(i)/WhSM(i) CS_hjZ_ratio(j,i) = Zh(i)/ZhSM(i) CS_tthj_ratio(j,i) = tth(i)/tthSM(i) CS_thj_tchan_ratio(j,i) = tth(i)/tthSM(i) ! Use tth cross section here CS_thj_schan_ratio(j,i) = tth(i)/tthSM(i) ! Use tth cross section here enddo CS_Hpjtb(j) = tHm enddo * * * * * * * * * * * * * * * * * * * * * c Charged Higgs input Mhplus(1) = MHiggs(4) GammaTotal_Hpj(1) = GammaTot(4) CS_ee_HpjHmj_ratio(1) = 1.0D0 BR_tWpb(1) = BR( tBF(1) ) BR_tHpjb(1) = BR( tBF(2) ) BR_Hpjcs(1) = BR( HpFF(2,2,2) ) BR_Hpjcb(1) = BR( HpFF(2,2,3) ) BR_Hpjtaunu(1) = BR( HpFF(1,3,3) ) BR_Hpjtb(1) = BR( HpFF(2,3,3) ) BR_HpjWZ(1) = 0.0D0 do i=1,3 BR_HpjhiW(1,i) = BR( HpHV(i) ) enddo print*,' ' print*,'The Higgs boson masses are (h, H, A, H+):' print*,Mh,Mhplus !--------------------------------- Run HiggsBounds --------------------------------------! call HiggsBounds_neutral_input_properties(Mh, & GammaTotal_hj,CP_value) call HiggsBounds_neutral_input_SMBR(BR_hjss,BR_hjcc, & BR_hjbb,BR_hjtt,BR_hjmumu,BR_hjtautau,BR_hjWW, & BR_hjZZ,BR_hjZga,BR_hjgaga,BR_hjgg) call HiggsBounds_neutral_input_nonSMBR(BR_hjinvisible, & BR_hkhjhi,BR_hjhiZ, BR_hjemu,BR_hjetau,BR_hjmutau,BR_hjHpiW) call HiggsBounds_neutral_input_LEP(CS_ee_hjZ_ratio, & CS_ee_bbhj_ratio, CS_ee_tautauhj_ratio,CS_ee_hjhi_ratio) do i=1,4 select case(i) case(1) collider = 2 case(2) collider = 7 case(3) collider = 8 case(4) collider = 13 end select call HiggsBounds_neutral_input_hadr(collider,CS_hj_ratio(i,:), & CS_gg_hj_ratio(i,:),CS_bb_hj_ratio(i,:),CS_hjW_ratio(i,:), & CS_hjZ_ratio(i,:),CS_vbf_ratio(i,:),CS_tthj_ratio(i,:), & CS_thj_tchan_ratio(i,:),CS_thj_schan_ratio(i,:),CS_hjhi(i,:,:)) ! Only H+tb production can be calculated by FeynHiggs at the moment, set ! the other cross sections to zero (no experimental limits anyways, except on ! VBF->H+, which is zero in the MSSM.) call HiggsBounds_charged_input_hadr(collider, CS_Hpjtb(i), 0.0D0, & 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0) enddo call HiggsBounds_charged_input(Mhplus,GammaTotal_Hpj, & CS_ee_HpjHmj_ratio, BR_tWpb,BR_tHpjb,BR_Hpjcs,BR_Hpjcb, & BR_Hpjtaunu,BR_Hpjtb,BR_HpjWZ,BR_HpjhiW) * * * * * * * * * * * * * * * * * * * * * c call to run_HiggsBounds call run_HiggsBounds( HBresult,chan,obsratio,ncombined) write(*,*) ' ' write(*,*) '************* HiggsBounds Results **************' write(*,*) ' ' write(*,*) 'Is this parameter point excluded by LEP, Tevatron' write(*,*) 'or LHC data?' write(*,*) HBresult, ', where' write(*,*) ' 0 = yes, it is excluded' write(*,*) ' 1 = no, it has not been excluded' write(*,*) ' -1 = invalid parameter set' write(*,*) ' ' write(*,*) 'The process with the highest statistical sensitivity' write(*,*) 'is' write(*,*) chan,'(see Key.dat)' write(*,*) 'This process has a theoretical rate vs. limit of' write(*,*) obsratio write(*,*) ' ' write(*,*) 'The number of Higgs which have contributed to the' write(*,*) 'theoretical rate of this process was' write(*,*) ncombined write(*,*) ' ' call HiggsBounds_get_most_sensitive_channels_per_Higgs(1, & 1,HBresult_tmp,chan_tmp,obsratio_tmp,predratio_tmp, & ncombined_tmp) write(*,*) 'Detailed information about the most sensitive ', &'channels (per Higgs):' write(*,*) ' ' write(*,*) ' Higgs boson HBresult channel obsratio ', & ' predratio ncombined' write(*,'(A10,2I10,2F15.5,1I5)') ' h ',HBresult_tmp,chan_tmp, & obsratio_tmp,predratio_tmp, ncombined_tmp call HiggsBounds_get_most_sensitive_channels_per_Higgs(2, & 1,HBresult_tmp,chan_tmp,obsratio_tmp,predratio_tmp, & ncombined_tmp) - write(*,*) ' H ',HBresult_tmp,chan_tmp,obsratio_tmp, - & predratio_tmp, ncombined_tmp + write(*,'(A10,2I10,2F15.5,1I5)') ' H ',HBresult_tmp,chan_tmp, + & obsratio_tmp, predratio_tmp, ncombined_tmp call HiggsBounds_get_most_sensitive_channels_per_Higgs(3, & 1,HBresult_tmp,chan_tmp,obsratio_tmp,predratio_tmp, & ncombined_tmp) - write(*,*) ' A ',HBresult_tmp,chan_tmp,obsratio_tmp, - & predratio_tmp, ncombined_tmp + write(*,'(A10,2I10,2F15.5,1I5)') ' A ',HBresult_tmp,chan_tmp, + & obsratio_tmp, predratio_tmp, ncombined_tmp write(*,*) 'See HiggsBounds documentation for more information.' write(*,*) '****************************************************' write(*,*) ' ' !--------------------------------- Run HiggsSignals -------------------------------------! c Set the theory mass uncertainties. This will affect the Chi^2 contribution c from the mass measurements as well as the Higgs-to-peaks assignment in c HiggsSignals . C dmhneut_hs = (/2.D0, 0.D0, 0.D0/) C call HiggsSignals_neutral_input_MassUncertainty(dmhneut_hs) c Set the MSSM rate uncertainties: !---dCS and dBR hold the model's rate uncertainties. Can be changed by user !---with subroutine setup_rate_uncertainties. First, set to SM values. C dCS = (/ 0.147D0, 0.028D0, 0.037D0, 0.051D0, 0.12D0 /) C dBR = (/ 0.054D0, 0.048D0, 0.048D0, 0.061D0, 0.028D0 /) c Now, we set relative uncertainties for the processes gg->H and bb->H c and interpolate from the effective couplings/CS-ratios (of the lightest Higgs) c the uncertainty of single Higgs production, dCS(1). C dggh = 0.147D0 C dbbh = 0.200D0 C call get_singleH_uncertainty(dCS(1),dggh,dbbh,CS_gg_hj_ratio(1), C & g2hjbb_s(1)+g2hjbb_p(1),Mh(1)) C print*,"Interpolated singleH uncertainty (in %): ",dCS(1) C call setup_rate_uncertainties(dCS, dBR) !---- Run HiggsSignals ----! call run_HiggsSignals(runmode,Chisq_mu,Chisq_mh, & Chisq,nobs,Pvalue) call run_HiggsSignals_LHC_Run1_combination(Chisq_LHCRun1_mu, & Chisq_LHCRun1_mh, Chisq_LHCRun1, nobs_LHCRun1, Pvalue_LHCRun1) call run_HiggsSignals_STXS(Chisq_STXS_rates, Chisq_STXS_mh, & Chisq_STXS, nobs_STXS, Pvalue_STXS) call complete_HS_results() +C call print_STXS() + write(*,*) ' ' write(*,*) '************* HiggsSignals Results **************' write(*,*) ' ' write(*,'(A40,1F10.5,A, 1I4)') & "Chi^2 (signal strength obs.)/nobs = ", & Chisq_mu, " / ", HSres(1)%nobs_peak_mu write(*,'(A40,1F10.5,A, 1I4)') & "Chi^2 (STXS obs.)/nobs = ", & Chisq_STXS, " / ", HSres(1)%nobs_STXS_rates write(*,'(A40,1F10.5,A, 1I4)') & "Chi^2 (LHC-Run1 rate obs.)/nobs = ", & Chisq_LHCRun1_mu, " / ", HSres(1)%nobs_LHCRun1_mu write(*,'(A40,1F10.5,A, 1I4)') & "Chi^2 (mass obs.)/nobs = ", & Chisq_mh + Chisq_LHCRun1_mh + Chisq_STXS_mh, " / ", & HSres(1)%nobs_mh write(*,*) ' ' write(*,*) 'The total chi^2 is ', HSres(1)%Chisq write(*,*) 'The number of observables is ',HSres(1)%nobs C write(*,*) ' ' C write(*,*) 'In the case that the number of observables is equal' C write(*,*) 'to the number of degrees of freedom, this corresponds' C write(*,*) 'to a probability of' C write(*,*) Pvalue write(*,*) ' ' write(*,*) 'See HiggsSignals documentation for more information.' write(*,*) '****************************************************' write(*,*) ' ' !---------------------- Finish HiggsBounds and HiggsSignals -----------------------------! c deallocates arrays used by HiggsBounds: call finish_HiggsBounds call finish_HiggsSignals end ************************************************************************ subroutine setFlags implicit none integer mssmpart, fieldren, tanbren, higgsmix, p2approx integer looplevel, loglevel, runningMT, botResum, tlCplxApprox c Using default (recommended) values of all FH flags parameter (mssmpart = 4) parameter (fieldren = 0) parameter (tanbren = 0) parameter (higgsmix = 2) parameter (p2approx = 4) parameter (looplevel = 2) parameter (loglevel = 3) parameter (runningMT = 1) parameter (botResum = 1) parameter (tlCplxApprox = 0) integer error call FHSetFlags(error, mssmpart, higgsmix, p2approx, looplevel, & loglevel, runningMT, botResum, tlCplxApprox) if( error .ne. 0 ) stop end ************************************************************************ subroutine setPara implicit none double precision invAlfa0, invAlfaMZ, AlfasMZ, GF double precision ME, MU, MD, MM, MC, MS, ML, MB, MZ, MW double precision GammaW, GammaZ double precision CKMlambda, CKMA, CKMrhobar, CKMetabar parameter (invAlfa0 = -1) parameter (invAlfaMZ = -1) parameter (AlfasMZ = -1) parameter (GammaW = -1) parameter (GammaZ = -1) parameter (GF = -1) parameter (ME = -1) parameter (MU = -1) parameter (MD = -1) parameter (MM = -1) parameter (MC = -1) parameter (MS = -1) parameter (ML = -1) parameter (MB = -1) parameter (MW = -1) parameter (MZ = -1) parameter (CKMlambda = -1) parameter (CKMA = -1) parameter (CKMrhobar = -1) parameter (CKMetabar = -1) double precision MT, TB, MA0, MHp parameter (MT = 173.2) parameter (TB = 10.) parameter (MA0 = 500) parameter (MHp = -1) double precision MSusy double precision M3SL, M2SL, M1SL double precision M3SE, M2SE, M1SE double precision M3SQ, M2SQ, M1SQ double precision M3SU, M2SU, M1SU double precision M3SD, M2SD, M1SD parameter (MSusy = 2000) parameter (M3SL = MSusy) parameter (M2SL = M3SL) parameter (M1SL = M2SL) parameter (M3SE = MSusy) parameter (M2SE = M3SE) parameter (M1SE = M2SE) parameter (M3SQ = MSusy) parameter (M2SQ = M3SQ) parameter (M1SQ = M2SQ) parameter (M3SU = MSusy) parameter (M2SU = M3SU) parameter (M1SU = M2SU) parameter (M3SD = MSusy) parameter (M2SD = M3SD) parameter (M1SD = M2SD) double complex Atau, At, Ab double complex Amu, Ac, As double complex Ae, Au, Ad parameter (At = 2500) parameter (Ab = At) parameter (Atau = At) parameter (Ac = At) parameter (As = Ab) parameter (Amu = Atau) parameter (Au = Ac) parameter (Ad = As) parameter (Ae = Amu) double complex MUE, M_1, M_2, M_3 parameter (MUE = 200) parameter (M_1 = 100) parameter (M_2 = 200) parameter (M_3 = 800) double precision Qtau, Qt, Qb parameter (Qtau = 0) parameter (Qt = 0) parameter (Qb = 0) double precision scalefactor parameter (scalefactor = 1) integer error call FHSetSMPara(error, & invAlfa0, invAlfaMZ, AlfasMZ, GF, & ME, MU, MD, MM, MC, MS, ML, MB, & MW, MZ, GammaW, GammaZ, & CKMlambda, CKMA, CKMrhobar, CKMetabar) if( error .ne. 0 ) stop call FHSetPara(error, scalefactor, & MT, TB, MA0, MHp, & M3SL, M3SE, M3SQ, M3SU, M3SD, & M2SL, M2SE, M2SQ, M2SU, M2SD, & M1SL, M1SE, M1SQ, M1SU, M1SD, & MUE, & Atau, At, Ab, & Amu, Ac, As, & Ae, Au, Ad, & M_1, M_2, M_3, & Qtau, Qt, Qb) if( error .ne. 0 ) stop end ************************************************************************ subroutine setSLHA(filename) implicit none character*(*) filename #include "SLHA.h" integer error double complex slhadata(nslhadata) call SLHARead(error, slhadata, filename, 1) if( error .ne. 0 ) stop call FHSetSLHA(error, slhadata) if( error .ne. 0 ) stop end !************************************************************** subroutine get_singleH_uncertainty(dCS,dggh,dbbh,g2hgg,g2hbb,mh) use theory_colliderSfunctions implicit none double precision dCS double precision dggh, dbbh, g2hgg, g2hbb, mh double precision vsmall vsmall=1.0D-10 if(g2hgg.le.vsmall.and.g2hbb.le.vsmall) then dCS = 0.0D0 else dCS=(g2hgg*LHC8_rH_gg(mh)*dggh+ & g2hbb*LHC8_rH_bb(mh)*dbbh)/ & (g2hgg*LHC8_rH_gg(mh)+g2hbb*LHC8_rH_bb(mh)) endif end !************************************************************** Index: trunk/HiggsSignals-2/example_programs/HSwithToys.f90 =================================================================== --- trunk/HiggsSignals-2/example_programs/HSwithToys.f90 (revision 568) +++ trunk/HiggsSignals-2/example_programs/HSwithToys.f90 (revision 569) @@ -1,176 +1,184 @@ !-------------------------------------------------------------------------------------- program HSwithToys ! ! This example program is part of HiggsSignals (TS 25/01/2013). !-------------------------------------------------------------------------------------- ! This example program shows how HiggsSignals (HS) can be run on toy experiments. We ! first run HS with SM input with a Higgs mass of 126 GeV. From the result of this ! run we can obtain the predicted signal strength modifiers for each peak observable ! directly from HiggsSignals. As a demonstration, these are then set as observed (toy) ! signal rates of the various observables. We then re-run HiggsSignals on the new ! observables on the same model, i.e. observed and predicted signal rates are equal, ! thus the resulting chi^2 should be zero. !-------------------------------------------------------------------------------------- use theory_colliderSfunctions use usefulbits, only : vsmall use usefulbits_hs,only : analyses use pc_chisq, only : print_peaks_to_LaTeX,print_cov_mu_to_file use io, only : get_peakinfo_from_HSresults, get_number_of_observables,& & get_ID_of_peakobservable, HiggsSignals_create_SLHA_output,& & HiggsSignals_create_SLHA_output_default implicit none integer :: nH,nHplus,ndf, ii, jj, kk double precision :: Chisq, Chisq_mu, Chisq_mh, Pvalue ! double precision, allocatable :: dMh(:) ! double precision :: dCS(5),dBR(5),dggh, dbbh double precision :: SMGamma_h, dMh double precision :: Mh,GammaTotal,ghjss_s,ghjss_p,ghjcc_s,ghjcc_p, & & ghjbb_s,ghjbb_p,ghjtt_s,ghjtt_p, & & ghjmumu_s,ghjmumu_p,ghjtautau_s,ghjtautau_p, & & ghjWW,ghjZZ,ghjZga,ghjgaga,ghjgg, & & ghjhiZ double precision :: mupred integer :: domH, nHcomb integer :: ntotal, npeakmu, npeakmh, nmpred, nanalyses, ID integer :: i,npoints character(len=8) :: istring character(len=300) :: inputfilename,outputfilename character(len=300) :: stem character(LEN=300) :: temp integer :: number_args, stat double precision :: SMCS_lhc13_gg_H,SMCS_lhc13_bb_H,SMCS_lhc13_vbf_H,& & SMCS_lhc13_HW, SMCS_lhc13_HZ, SMCS_lhc13_ttH,SMBR_Hbb,SMBR_Hmumu,SMBR_Htautau,& & SMBR_HWW,SMBR_HZZ + double precision :: Chisq_STXS_rates, Chisq_STXS_mh, Chisq_STXS, Pvalue_STXS + integer :: nobs_STXS + nH=1 nHplus=0 Mh = 124.09D0 dMh = 0.0D0 !-------------------------- HiggsSignals ------------------------------! !---- Initialize HiggsSignals and pass the name of the experimental analysis folder ----! call initialize_HiggsSignals(nH,nHplus,"LHC13") ! call initialize_HiggsSignals(nH,nHplus,"latestresults-1.4.0-LHCinclusive") ! call setup_thu_observables(1) !---- Set the Higgs mass parametrization (1: box, 2:gaussian, 3:box+gaussian) ----! call setup_pdf(2) !---- Set the output level (0: silent, 1: screen output, 2: even more output,...) ----! call setup_output_level(1) !---- Pass the Higgs mass uncertainty to HiggsSignals ----! call HiggsSignals_neutral_input_MassUncertainty(dMh) !---- Use symmetric rate errors? (0: original(default), 1: averaged-symmetrical) ----! ! call setup_symmetricerrors(0) !---- Allow anti-correlated signal strength measurements? (0: no, 1: yes(default) ) ----! ! call setup_anticorrelations_in_mu(1) !---- Setup a wider assignment range ----! call setup_assignmentrange_massobservables(4.0D0) call setup_assignmentrange_LHCRun1(10.0D0) write(*,*) 'gg->H = ', SMCS_lhc13_gg_H(Mh) write(*,*) 'bb->H = ', SMCS_lhc13_bb_H(Mh) write(*,*) 'pp->H = ', SMCS_lhc13_gg_H(Mh)+SMCS_lhc13_bb_H(Mh) write(*,*) 'pp->Hqq = ', SMCS_lhc13_vbf_H(Mh) write(*,*) 'pp->HW = ', SMCS_lhc13_HW(Mh) write(*,*) 'pp->HZ = ', SMCS_lhc13_HZ(Mh) write(*,*) 'pp->Htt = ', SMCS_lhc13_ttH(Mh) write(*,*) 'BR(H->bb) = ', SMBR_Hbb(Mh) write(*,*) 'BR(H->mumu) = ', SMBR_Hmumu(Mh) write(*,*) 'BR(H->tautau) = ', SMBR_Htautau(Mh) write(*,*) 'BR(H->WW) = ', SMBR_HWW(Mh) write(*,*) 'BR(H->ZZ) = ', SMBR_HZZ(Mh) !----HiggsBounds/Signals effective couplings input. ! These have to be inserted for the model which we want to test, i.e. we would have ! to write an interface to set via arguments in the executables call, or reading ! in a text file, etc. !----For now, we set them by hand to the SM values (for demonstration): ghjss_s=1d0 ghjss_p=0d0 ghjcc_s=1d0 ghjcc_p=0d0 ghjbb_s=1d0 ghjbb_p=0d0 ghjtt_s=1d0 ghjtt_p=0d0 ghjmumu_s=1d0 ghjmumu_p=0d0 ghjtautau_s=1d0 ghjtautau_p=0d0 ghjWW=1d0 ghjZZ=1d0 ghjZga=1d0 ghjgaga=1d0 ghjgg=1d0 ghjhiZ=0d0 GammaTotal=SMGamma_h(Mh) call HiggsBounds_neutral_input_properties(Mh,GammaTotal) call HiggsBounds_neutral_input_effC( & & ghjss_s,ghjss_p,ghjcc_s,ghjcc_p, & & ghjbb_s,ghjbb_p,ghjtt_s,ghjtt_p, & & ghjmumu_s,ghjmumu_p, & & ghjtautau_s,ghjtautau_p, & & ghjWW,ghjZZ,ghjZga, & & ghjgaga,ghjgg,ghjhiZ) !-Run HS on the original experimental data in order to evaluate the model predictions call run_HiggsSignals(1, Chisq_mu, Chisq_mh, Chisq, ndf, Pvalue) call run_HiggsSignals_LHC_Run1_combination(Chisq_mu, Chisq_mh, Chisq, ndf, Pvalue) + + call run_HiggsSignals_STXS(Chisq_STXS_rates, Chisq_STXS_mh, Chisq_STXS,& +& nobs_STXS, Pvalue_STXS) + + write(*,*) Chisq_STXS_rates, Chisq_STXS_mh, Chisq_STXS, nobs_STXS, Pvalue_STXS !-Print out the observables to a LaTeX table ! call print_peaks_to_LaTeX ! call print_cov_mu_to_file !-Get the number of the peak-observables (Don't care about ntotal, npeakmh, nmpred, nanalyses) call get_number_of_observables(ntotal, npeakmu, npeakmh, nmpred, nanalyses) !-We now want to set the measurements to those values predicted by the model. !-The mass measurement for each peak observable will be set to Mh here. !-Loop over the number of peak observables do kk=1,npeakmu !--Get for each peak observable its unique ID: call get_ID_of_peakobservable(kk, ID) !--Get the predicted signal strength modifier (mupred) for this peak observable: call get_peakinfo_from_HSresults(ID, mupred, domH, nHcomb) !--Assign this value as (toy) measurement for this peak observable: call assign_toyvalues_to_peak(ID, mupred, Mh) enddo call setup_output_level(0) !-Do a print-out to the screen !-Set the HiggsSignals input (again!) call HiggsBounds_neutral_input_effC( & & ghjss_s,ghjss_p,ghjcc_s,ghjcc_p, & & ghjbb_s,ghjbb_p,ghjtt_s,ghjtt_p, & & ghjmumu_s,ghjmumu_p, & & ghjtautau_s,ghjtautau_p, & & ghjWW,ghjZZ,ghjZga, & & ghjgaga,ghjgg,ghjhiZ) !-Now, we run on the toy observables with the same input, i.e. model predictions and !-measurements are equal and thus the chi^2 should be zero. call run_HiggsSignals(1, Chisq_mu, Chisq_mh, Chisq, ndf, Pvalue) !-Create a new SLHA file with the HiggsSignals output blocks. !-The second argument controls how much is written ! (0: only the BLOCK 'HiggsSignalsResults', 1: full HiggsSignals SLHA output) !-The new file must not exist: ! (note: this system call does not work with ifort) call system('rm -f results/HSwithToys.slha',status=stat) call HiggsSignals_create_SLHA_output("results/HSwithToys.slha",0) !-Alternatively, we could use ! call HiggsSignals_create_SLHA_output_default(0) !-where the filename is set to "HS-output.slha". call finish_HiggsSignals end program HSwithToys !-------------------------------------------------------------------------------------- Index: trunk/HiggsSignals-2/example_programs/HSeffC.f90 =================================================================== --- trunk/HiggsSignals-2/example_programs/HSeffC.f90 (revision 568) +++ trunk/HiggsSignals-2/example_programs/HSeffC.f90 (revision 569) @@ -1,153 +1,154 @@ !-------------------------------------------------------------------------------------- ! This example program is part of HiggsSignals-2 (TS 29/03/2017). !-------------------------------------------------------------------------------------- !-------------------------------------------------------------------------------------- program HSeffC !-------------------------------------------------------------------------------------- ! In this example we scan over two kappa scale factors, kappaF and kappaV, of the ! 125 GeV Higgs boson, using the effective couplings input. The kappa ! factor for the H to gamma-gamma partial width is derived from the two kappa factors. ! ! The output is written into /results/HSeffC.dat, which can be plotted with the ! python script plot_HSeffC.py in the results folder. !-------------------------------------------------------------------------------------- use theory_colliderSfunctions use usefulbits, only : vsmall implicit none integer :: nHzero, nHplus, ndf, i, j, k, ii, jj double precision :: obsratio, mass, Pvalue, Chisq, mu, Chisq_mu, Chisq_mh double precision :: SMGammaTotal double precision :: kappaF, kappaV double precision :: Mh,GammaTotal,ghjss_s,ghjss_p,ghjcc_s,ghjcc_p, & & ghjbb_s,ghjbb_p,ghjtt_s,ghjtt_p, & & ghjmumu_s,ghjmumu_p,ghjtautau_s,ghjtautau_p, & & ghjWW,ghjZZ,ghjZga,ghjgaga,ghjgg, & & ghjhiZ character(len=100)::filename double precision :: dm integer :: pdf !-HiggsBounds internal functions to obtain SM branching ratios double precision :: SMBR_Htoptop,SMBR_Hss, SMBR_Hcc, SMBR_Hbb, SMBR_Hmumu, SMBR_Htautau,& & SMBR_HWW, SMBR_HZZ, SMBR_HZgam, SMBR_Hgamgam, SMBR_Hgg,SMGamma_h double precision :: Htogaga_rate, HtoVV_rate, HtoFF_rate nHzero=1 nHplus=0 !--Setting up the output filename='results/HSeffC.dat' open(21,file=filename) write(21,*) '# mh kappaF kappaV Chisq_mu Chisq ndf Htogaga_rate HtoVV_rate HtoFF_rate' write(21,*) '#--------------------------------------------------------------------#' !--Enter the Higgs mass and its theory uncertainty here: Mh = 125.09D0 dm = 0.0D0 !---- Initialize HiggsSignals and pass the name of the experimental analysis folder ----! - call initialize_HiggsSignals(nHzero,nHplus,"LHC13_CMS_H-gaga") +! call initialize_HiggsSignals(nHzero,nHplus,"LHC13_CMS_H-gaga") + call initialize_HiggsSignals(nHzero,nHplus,"test") !---- Set the output level (0: silent, 1: screen output, 2: even more output,...) ----! call setup_output_level(0) !---- Set the assignment range for the peak-centered method (optional) ----! call setup_assignmentrange_massobservables(4.0D0) !---- Set the Higgs mass parametrization (1: box, 2:gaussian, 3:box+gaussian) ----! pdf = 2 call setup_pdf(pdf) !---- Pass the Higgs mass uncertainty to HiggsSignals (if relevant) ----! ! call HiggsSignals_neutral_input_MassUncertainty(dm) !---- Set number of free model parameters ----! call setup_Nparam(2) do i=1,81!81 do j=1,81!81 kappaF = -1.0D0+(i-1)*0.05D0 kappaV = 0.0D0+(j-1)*0.025D0 SMGammaTotal=SMGamma_h(Mh) if(.not. (SMGammaTotal .lt. 0)) then ghjss_s=kappaF ghjss_p=0.0d0 ghjcc_s=kappaF ghjcc_p=0.0d0 ghjbb_s=kappaF ghjbb_p=0.0d0 ghjtt_s=kappaF ghjtt_p=0.0d0 ghjmumu_s=kappaF ghjmumu_p=0.0d0 ghjtautau_s=kappaF ghjtautau_p=0.0d0 ghjWW=kappaV ghjZZ=kappaV ghjZga=kappaV ghjgg=kappaF ghjhiZ=0d0 ghjgaga=sqrt(get_g2hgaga(kappaF,kappaF,kappaF,kappaV,kappaV)) !----Calculate the new total decay width: GammaTotal = SMGammaTotal*(1 + & & (ghjWW**2.0 - 1)*SMBR_HWW(Mh)+(ghjZZ**2.0 - 1)*SMBR_HZZ(Mh) + & & (ghjgg**2.0 - 1)*SMBR_Hgg(Mh)+(ghjtt_s**2.0 - 1)*SMBR_Htoptop(Mh)+ & & (ghjbb_s**2.0 - 1)*SMBR_Hbb(Mh)+(ghjtautau_s**2.0 - 1)*SMBR_Htautau(Mh)+ & & (ghjss_s**2.0 - 1)*SMBR_Hss(Mh)+(ghjcc_s**2.0 - 1)*SMBR_Hcc(Mh)+ & & (ghjZga**2.0 - 1)*SMBR_HZgam(Mh)+(ghjmumu_s**2.0 - 1)*SMBR_Hmumu(Mh)+ & & (ghjgaga**2.0 - 1)*SMBR_Hgamgam(Mh) ) call HiggsBounds_neutral_input_properties(Mh,GammaTotal) call HiggsBounds_neutral_input_effC( & & ghjss_s,ghjss_p,ghjcc_s,ghjcc_p, & & ghjbb_s,ghjbb_p,ghjtt_s,ghjtt_p, & & ghjmumu_s,ghjmumu_p, & & ghjtautau_s,ghjtautau_p, & & ghjWW,ghjZZ,ghjZga, & & ghjgaga,ghjgg,ghjhiZ) call run_HiggsSignals( 1, Chisq_mu, Chisq_mh, Chisq, ndf, Pvalue) ! This will get the SM normalized rates for inclusive Higgs production, ! with H-> gamma gamma, VV and FF decays: call get_rates(1,4,5,(/11,21,31,41,51/),Htogaga_rate) call get_rates(1,4,5,(/12,22,32,42,52/),HtoVV_rate) call get_rates(1,4,5,(/14,24,34,44,54/),HtoFF_rate) ! write(*,*) "Htogaga_rate, Chi2 = ", Htogaga_rate, Chisq_mu ! Try new interface: ! call HiggsBounds_neutral_input_hadr_channelrates_single(13,1,1,1,2.0d0*SMBR_Hgamgam(Mh)) ! call run_HiggsSignals( 1, Chisq_mu, Chisq_mh, Chisq, ndf, Pvalue) ! call get_rates(1,4,5,(/11,21,31,41,51/),Htogaga_rate) ! write(*,*) "Htogaga_rate (mod), Chi2 = ", Htogaga_rate, Chisq_mu ! This will collect the main HiggsSignals results together into one file write(21,*) mh,kappaF,kappaV,Chisq_mu,Chisq,ndf,Htogaga_rate,HtoVV_rate,HtoFF_rate endif enddo enddo close(21) write(*,*) "Finishing HiggsSignals..." call finish_HiggsSignals contains !************************************************************** function get_g2hgaga(ghbb,ghtt,ghtautau,ghWW,ghZZ) ! Evaluates g2hgaga from other effective couplings, using partial widths informations ! at a Higgs mass of 126 GeV (calculated with HDECAY and taken from ! http://people.web.psi.ch/spira/higgscoup/ ). !************************************************************** double precision, intent(in) :: ghbb,ghtt,ghtautau,ghWW,ghZZ double precision :: get_g2hgaga get_g2hgaga = (ghtt**2)*0.70904D-01 + (ghbb**2)*0.18760D-04 + (ghWW**2)*1.5863 + & & ghtt*ghbb*(-0.17319D-02) + ghtt*ghWW*(-0.67074) + & & ghbb*ghWW*0.82093D-02 + (ghtautau**2)*0.22663E-04 + & & ghtt*ghtautau*(-0.18696E-02) + ghbb*ghtautau*0.41239E-04 +& & ghtautau*ghWW*0.88634E-02 end function get_g2hgaga !************************************************************** end program HSeffC Index: trunk/HiggsSignals-2/example_programs/HS_efficiencies.f90 =================================================================== --- trunk/HiggsSignals-2/example_programs/HS_efficiencies.f90 (revision 568) +++ trunk/HiggsSignals-2/example_programs/HS_efficiencies.f90 (revision 569) @@ -1,193 +1,193 @@ !-------------------------------------------------------------------------------------- program HS_efficiencies ! ! This example program is part of HiggsSignals (TS 27/08/2013). !-------------------------------------------------------------------------------------- ! This example program demonstrates how models with different channel efficiencies ! of the Higgs searches can be treated in HiggsSignals (HS). !-------------------------------------------------------------------------------------- ! use theory_colliderSfunctions ! use usefulbits, only : vsmall ! use usefulbits_hs,only : analyses ! use pc_chisq, only : print_peaks_to_LaTeX use io, only : get_peakinfo_from_HSresults, get_number_of_observables,& & get_ID_of_peakobservable, get_peak_channels implicit none integer :: nH,nHplus,ndf, jj, kk, ll, mm double precision :: Chisq, Chisq_mu, Chisq_mh, Pvalue double precision, allocatable :: dMh(:) double precision :: dCS(5),dBR(5),dggh, dbbh double precision :: SMGamma_h double precision :: Mh,GammaTotal,g2hjss_s,g2hjss_p,g2hjcc_s,g2hjcc_p,& & g2hjbb_s,g2hjbb_p,g2hjtt_s,g2hjtt_p,& & g2hjmumu_s,g2hjmumu_p,g2hjtautau_s,g2hjtautau_p,& & g2hjWW,g2hjZZ,g2hjZga,g2hjgaga,g2hjgg,g2hjggZ,& & g2hjhiZ,BR_hjhihi,BR_hjinvisible double precision :: mupred, etaZ, sf, mu_average integer :: domH, nHcomb integer :: ntotal, npeakmu, npeakmh, nmpred, nanalyses, ID, pID integer :: i,npoints character(len=8) :: istring character(len=300) :: inputfilename,outputfilename character(len=300) :: stem character(LEN=300) :: temp integer :: number_args, stat integer :: Nc - integer, allocatable :: channel_IDs(:) + integer, allocatable :: channel_p_IDs(:),channel_d_IDs(:) double precision, allocatable :: efficiencies(:),eff_ratio(:) !---Note here: We only run HiggsSignals on the lightest Higgs boson. This can be easily !---extended to all 3 MSSM neutral Higgs bosons. In that case, the effective couplings !---and mass uncertainties have to be given as arrays of size=nH (Cf. the Higgsbounds !---manual for HB-3.x.x for how to call HiggsBounds_neutral_input_effC correctly!) nH=1 nHplus=0 allocate(dMh(nH)) !--n.b. have to set theoretical uncertainties on Higgs mass dMh (in GeV): dMh = (/ 0.0D0 /) !-------------------------- HiggsSignals ------------------------------! !---- Initialize HiggsSignals and pass the name of the experimental analysis folder ----! call initialize_HiggsSignals(nH,nHplus,"latestresults") !---- Set the Higgs mass parametrization (1: box, 2:gaussian, 3:box+gaussian) ----! call setup_pdf(2) !---- Set the output level (0: silent, 1: screen output, 2: even more output,...) ----! call setup_output_level(0) !---- Pass the Higgs mass uncertainty to HiggsSignals ----! call HiggsSignals_neutral_input_MassUncertainty(dMh) !---- Use symmetric rate errors? (0: original(default), 1: averaged-symmetrical) ----! call setup_symmetricerrors(0) !---- Allow anti-correlated signal strength measurements? (0: no, 1: yes(default) ) ----! call setup_anticorrelations_in_mu(0) !---- Setup a wider assignment range ----! call setup_assignmentrange(10.0D0) !----HiggsBounds/Signals effective couplings input. ! These have to be inserted for the model which we want to test, i.e. we would have ! to write an interface to set via arguments in the executables call, or reading ! in a text file, etc. !----For now, we set them by hand to the SM values except for the vector boson couplings, ! where we set them to a scale factor sf (for demonstration): do mm=1,4 select case(mm) case(1) outputfilename="results/HS_efficiencies_kv0p5.dat" case(2) outputfilename="results/HS_efficiencies_kv1p0.dat" case(3) outputfilename="results/HS_efficiencies_kv1p5.dat" case(4) outputfilename="results/HS_efficiencies_kv2p0.dat" case default end select open(21,file=outputfilename) sf = 0.0D0+(mm)*0.5D0 g2hjss_s=1d0 g2hjss_p=0d0 g2hjcc_s=1d0 g2hjcc_p=0d0 g2hjbb_s=1d0 g2hjbb_p=0d0 g2hjtt_s=1d0 g2hjtt_p=0d0 g2hjmumu_s=1d0 g2hjmumu_p=0d0 g2hjtautau_s=1d0 g2hjtautau_p=0d0 g2hjWW=sf g2hjZZ=sf g2hjZga=sf g2hjgaga=1d0 g2hjgg=1d0 g2hjggZ=sf g2hjhiZ=0d0 BR_hjhihi=0d0 BR_hjinvisible=0d0 Mh=dble(125.8) GammaTotal=SMGamma_h(Mh) !-Set the HiggsSignals input call HiggsBounds_neutral_input_effC(Mh,GammaTotal,& & g2hjss_s,g2hjss_p,g2hjcc_s,g2hjcc_p,g2hjbb_s,g2hjbb_p,& & g2hjtt_s,g2hjtt_p,& & g2hjmumu_s,g2hjmumu_p,g2hjtautau_s,g2hjtautau_p,& & g2hjWW,g2hjZZ,g2hjZga,g2hjgaga,g2hjgg,g2hjggZ,& & g2hjhiZ, BR_hjinvisible,BR_hjhihi) !-Run HS on the original experimental data in order to evaluate the model predictions call run_HiggsSignals(1, Chisq_mu, Chisq_mh, Chisq, ndf, Pvalue) !-Get the number of the peak-observables (Don't care about ntotal, npeakmh, nmpred, nanalyses) call get_number_of_observables(ntotal, npeakmu, npeakmh, nmpred, nanalyses) ! We now want to set different efficiencies as evaluated e.g. from a MC analysis. ! Note that these are given as relative changes with respect to the SM efficiencies, i.e. ! in the MC you should both test your model and the SM with the analysis cuts and ! estimate the ratio eta = efficiency(model)/efficiency(SM) for each Higgs channel. ! ! As an example, we want to give all VBF,WH,ZH channels a factor of etaZ in all implemented ! searches where these channels are present. do ll=1,51 etaZ = 0.0D0 + (ll-1)*0.05D0 !-Loop over the number of peak observables do kk=1,npeakmu !--Get for each peak observable its unique ID: call get_ID_of_peakobservable(kk, ID) !--Get the predicted signal strength modifier (mupred) for this peak observable: ! call get_peakinfo_from_HSresults(ID, mupred, domH, nHcomb) !--Get channel information - call get_peak_channels(ID, Nc, channel_IDs, efficiencies) + call get_peak_channels(ID, Nc, channel_p_IDs, channel_d_IDs, efficiencies) ! write(*,*) ID, Nc ! write(*,*) channel_IDs ! write(*,*) efficiencies allocate(eff_ratio(Nc)) eff_ratio = 1.0D0 - do jj=lbound(channel_IDs,dim=1),ubound(channel_IDs,dim=1) + do jj=lbound(channel_p_IDs,dim=1),ubound(channel_p_IDs,dim=1) !---Get the ID for the production mode (2:VBF, 3:WH, 4:ZH): - pID = int((channel_IDs(jj)-modulo(channel_IDs(jj),10))/dble(10)) + pID = channel_p_IDs(i) if(pID.eq.2.or.pID.eq.3.or.pID.eq.4) then eff_ratio(jj)=etaZ endif enddo !---Hand over the efficiency ratios: call assign_modelefficiencies_to_peak(ID, Nc, eff_ratio) deallocate(channel_IDs,efficiencies,eff_ratio) enddo !-Set the HiggsSignals input (again!) call HiggsBounds_neutral_input_effC(Mh,GammaTotal,& & g2hjss_s,g2hjss_p,g2hjcc_s,g2hjcc_p,g2hjbb_s,g2hjbb_p,& & g2hjtt_s,g2hjtt_p,& & g2hjmumu_s,g2hjmumu_p,g2hjtautau_s,g2hjtautau_p,& & g2hjWW,g2hjZZ,g2hjZga,g2hjgaga,g2hjgg,g2hjggZ,& & g2hjhiZ, BR_hjinvisible,BR_hjhihi) call run_HiggsSignals(1, Chisq_mu, Chisq_mh, Chisq, ndf, Pvalue) mu_average = 0.0D0 do kk=1,npeakmu !--Get for each peak observable its unique ID: call get_ID_of_peakobservable(kk, ID) !--Get the predicted signal strength modifier (mupred) for this peak observable: call get_peakinfo_from_HSresults(ID, mupred, domH, nHcomb) mu_average = mu_average + mupred enddo mu_average = mu_average / npeakmu write(21,*) g2hjWW, etaZ, Chisq_mu, mu_average enddo close(21) enddo call finish_HiggsSignals !-------------------------------------------------------------------------------------- end program HS_efficiencies !-------------------------------------------------------------------------------------- Index: trunk/HiggsSignals-2/XScov.in =================================================================== --- trunk/HiggsSignals-2/XScov.in (revision 568) +++ trunk/HiggsSignals-2/XScov.in (revision 569) @@ -1,5 +1,11 @@ - 0.0108439 -7.79584e-07 1.03062e-06 3.93199e-06 0.00568358 - -7.79584e-07 0.00140217 0.000663897 0.000690515 9.67211e-07 - 1.03062e-06 0.000663897 0.000725263 0.000980556 -2.73918e-07 - 3.93199e-06 0.000690515 0.000980556 0.00176649 1.24526e-06 - 0.00568358 9.67211e-07 -2.73918e-07 1.24526e-06 0.0108589 \ No newline at end of file +0.00426836 -4.18557e-06 -2.78296e-06 2.02292e-06 0.00133693 0.00426836 7.23432e-05 -3.15738e-05 -5.24472e-07 -2.58784e-06 3.89752e-05 + -4.18557e-06 0.000488115 0.000438405 0.000375288 3.27102e-08 -4.18557e-06 -1.80772e-05 7.28111e-06 -4.34536e-07 0.000416516 2.0853e-05 + -2.78296e-06 0.000438405 0.000455628 0.000540676 -8.6844e-07 -2.78296e-06 -2.35892e-05 7.33761e-06 1.28218e-06 0.000435707 0.00167956 + 2.02292e-06 0.000375288 0.000540676 0.000998767 -6.57181e-07 2.02292e-06 -4.03392e-05 8.51316e-06 5.23876e-06 0.000523616 0.00592164 + 0.00133693 3.27102e-08 -8.6844e-07 -6.57181e-07 0.00630999 0.00133693 -5.92249e-05 -9.39262e-06 -7.1304e-07 -8.34653e-07 6.87939e-07 + 0.00426836 -4.18557e-06 -2.78296e-06 2.02292e-06 0.00133693 0.00426836 7.23432e-05 -3.15738e-05 -5.24472e-07 -2.58784e-06 3.89752e-05 + 7.23432e-05 -1.80772e-05 -2.35892e-05 -4.03392e-05 -5.92249e-05 7.23432e-05 0.0462583 -6.47164e-05 4.55291e-05 -2.27993e-05 -0.000220425 + -3.15738e-05 7.28111e-06 7.33761e-06 8.51316e-06 -9.39262e-06 -3.15738e-05 -6.47164e-05 0.0171104 -1.6889e-05 7.02426e-06 5.81127e-05 + -5.24472e-07 -4.34536e-07 1.28218e-06 5.23876e-06 -7.1304e-07 -5.24472e-07 4.55291e-05 -1.6889e-05 0.00146159 1.29654e-06 4.08258e-05 + -2.58784e-06 0.000416516 0.000435707 0.000523616 -8.34653e-07 -2.58784e-06 -2.27993e-05 7.02426e-06 1.29654e-06 0.00041678 0.00167858 + 3.89752e-05 2.0853e-05 0.00167956 0.00592164 6.87939e-07 3.89752e-05 -0.000220425 5.81127e-05 4.08258e-05 0.00167858 0.0505366 \ No newline at end of file Index: trunk/HiggsSignals-2/XScovSM.in =================================================================== --- trunk/HiggsSignals-2/XScovSM.in (revision 568) +++ trunk/HiggsSignals-2/XScovSM.in (revision 569) @@ -1,5 +1,11 @@ - 0.0108439 -7.79584e-07 1.03062e-06 3.93199e-06 0.00568358 - -7.79584e-07 0.00140217 0.000663897 0.000690515 9.67211e-07 - 1.03062e-06 0.000663897 0.000725263 0.000980556 -2.73918e-07 - 3.93199e-06 0.000690515 0.000980556 0.00176649 1.24526e-06 - 0.00568358 9.67211e-07 -2.73918e-07 1.24526e-06 0.0108589 \ No newline at end of file +0.00426836 -4.18557e-06 -2.78296e-06 2.02292e-06 0.00133693 0.00426836 7.23432e-05 -3.15738e-05 -5.24472e-07 -2.58784e-06 3.89752e-05 + -4.18557e-06 0.000488115 0.000438405 0.000375288 3.27102e-08 -4.18557e-06 -1.80772e-05 7.28111e-06 -4.34536e-07 0.000416516 2.0853e-05 + -2.78296e-06 0.000438405 0.000455628 0.000540676 -8.6844e-07 -2.78296e-06 -2.35892e-05 7.33761e-06 1.28218e-06 0.000435707 0.00167956 + 2.02292e-06 0.000375288 0.000540676 0.000998767 -6.57181e-07 2.02292e-06 -4.03392e-05 8.51316e-06 5.23876e-06 0.000523616 0.00592164 + 0.00133693 3.27102e-08 -8.6844e-07 -6.57181e-07 0.00630999 0.00133693 -5.92249e-05 -9.39262e-06 -7.1304e-07 -8.34653e-07 6.87939e-07 + 0.00426836 -4.18557e-06 -2.78296e-06 2.02292e-06 0.00133693 0.00426836 7.23432e-05 -3.15738e-05 -5.24472e-07 -2.58784e-06 3.89752e-05 + 7.23432e-05 -1.80772e-05 -2.35892e-05 -4.03392e-05 -5.92249e-05 7.23432e-05 0.0462583 -6.47164e-05 4.55291e-05 -2.27993e-05 -0.000220425 + -3.15738e-05 7.28111e-06 7.33761e-06 8.51316e-06 -9.39262e-06 -3.15738e-05 -6.47164e-05 0.0171104 -1.6889e-05 7.02426e-06 5.81127e-05 + -5.24472e-07 -4.34536e-07 1.28218e-06 5.23876e-06 -7.1304e-07 -5.24472e-07 4.55291e-05 -1.6889e-05 0.00146159 1.29654e-06 4.08258e-05 + -2.58784e-06 0.000416516 0.000435707 0.000523616 -8.34653e-07 -2.58784e-06 -2.27993e-05 7.02426e-06 1.29654e-06 0.00041678 0.00167858 + 3.89752e-05 2.0853e-05 0.00167956 0.00592164 6.87939e-07 3.89752e-05 -0.000220425 5.81127e-05 4.08258e-05 0.00167858 0.0505366 \ No newline at end of file Index: trunk/HiggsSignals-2/Expt_tables/LHC3000_update2018/ATL_H-ZZ_ggF-like.txt =================================================================== --- trunk/HiggsSignals-2/Expt_tables/LHC3000_update2018/ATL_H-ZZ_ggF-like.txt (revision 568) +++ trunk/HiggsSignals-2/Expt_tables/LHC3000_update2018/ATL_H-ZZ_ggF-like.txt (revision 569) @@ -1,14 +1,14 @@ # Projection to LHC 3000fb-1. # Measurement w/o theory uncertainty. 300011044 30001044 1 ATL-PHYS-PUB-2014-016 LHC, ATL, ATL (pp)->h->ZZ (ggF-like) 13 3000 0.03 1 0 2.0 125.0 125.0 1.0 5 125.0 13 23 33 43 53 1.0 1.0 0.65 0.8 1.2 -125.8 0.95 1.000 1.05 +125.0 0.95 1.000 1.05 Index: trunk/HiggsSignals-2/Expt_tables/LHC3000_update2018/ATL_H-gaga_ttH.txt =================================================================== --- trunk/HiggsSignals-2/Expt_tables/LHC3000_update2018/ATL_H-gaga_ttH.txt (revision 568) +++ trunk/HiggsSignals-2/Expt_tables/LHC3000_update2018/ATL_H-gaga_ttH.txt (revision 569) @@ -1,14 +1,14 @@ # Projection to LHC 3000fb-1. # Measurement w/o theory uncertainty. 30001108 3000108 1 ATL-PHYS-PUB-2014-016 LHC, ATL, ATL (pp)->tth->gamma gamma 13 3000 0.03 1 0 1.0 125.0 125.0 0.1 1 -1 51 -125.8 0.88 1.000 1.12 +125.0 0.88 1.000 1.12 Index: trunk/HiggsSignals-2/usefulbits_HS.f90 =================================================================== --- trunk/HiggsSignals-2/usefulbits_HS.f90 (revision 568) +++ trunk/HiggsSignals-2/usefulbits_HS.f90 (revision 569) @@ -1,536 +1,553 @@ !-------------------------------------------------------------------- ! This file is part of HiggsSignals (TS 03/03/2013) !-------------------------------------------------------------------- module usefulbits_HS !-------------------------------------------------------------------- implicit none character(LEN=9),parameter :: HSvers='2.2.0beta' integer,parameter :: f_dmh=94 character(LEN=4) :: runmode character(LEN=100) :: Exptdir !-------------------------------------------------------------------- -!--IN TESTING PHASE: (do not change this in official version) - logical :: withcorrexpsyst = .True. !(correlated experimental systematics) - logical :: additional_output = .False. -!--END -!------------------------Control parameters ------------------------- -! Values can be changes with specific user subroutines. - logical :: usetoys = .False. +!------------------ User Control parameters ------------------- +!-------------------------------------------------------------------- +! Note: values can be changed with specific user subroutines. + logical :: usescalefactor = .False. - logical :: useSMweights = .False. - logical :: correlations_mu = .True. - logical :: correlations_mh = .True. - logical :: minimalchisq = .False. - logical :: maximalchisq = .False. - logical :: useSMtest = .False. - logical :: SLHAdetailed = .True. - logical :: newSLHAfile = .False. logical :: symmetricerrors = .False. - logical :: anticorrmu = .True. - logical :: anticorrmh = .True. - logical :: absolute_errors = .False. - logical :: THU_included = .True. logical :: useaveragemass = .True. + logical :: correlations_mu = .True. + logical :: correlations_mh = .True. logical :: normalize_rates_to_reference_position = .False. - logical :: use_SMrate_at_reference_position_for_STXS = .False. + logical :: normalize_rates_to_reference_position_outside_dmtheo = .True. logical :: LHC_combination_run1_SMXS_from_paper = .False. - double precision :: eps + double precision :: assignmentrange = 1.0D0 ! This gives the mass range ! (in standard deviations), in which ! the Higgs is forced to be assigned to ! a peak observable. double precision :: assignmentrange_massobs = 5.0D0 ! This gives the mass range ! (in standard deviations), in which ! the Higgs is forced to be assigned to ! peak observables, which have a mass ! measurement. double precision :: assignmentrange_LHCrun1 = 2.5D0 ! This gives the mass range ! (in standard deviations), in which ! the Higgs is forced to be assigned to ! peak observables, which have a mass ! measurement. double precision :: assignmentrange_STXS = 1.0D0 double precision :: mu_cutoff_for_assignment = 1.0D-03 integer :: output_level = 0 integer :: iterations = 0 ! default value: 0 ! 1 -> try to assign as many Higgs bosons as possible to ! the observable, Higgs-to-peak assignment is based on ! Higg mass covariance matrices with maximal ! correlations. ! >1 -> use the covariance matrix of previous iteration. integer :: pdf = 2 ! default value: 2 ! will automatically be set to 2 if not changed by the user ! via using subroutine set_pdf before. ! (1,2,3) = (box, gaussian, theory-box + exp-gaussian) integer :: Nparam = 0 ! Number of free model parameters (entering the Pvalue) ! Can be specified directly here or via the subroutine - ! setup_nparam + ! setup_nparam + +!------------------- For internal debugging/testing ----------------- + logical :: withcorrexpsyst = .True. !(correlated experimental systematics) + logical :: anticorrmu = .True. + logical :: anticorrmh = .True. + + +!-- sleeping features -- + logical :: useSMweights = .False. + logical :: minimalchisq = .False. + logical :: maximalchisq = .False. + logical :: additional_output = .False. !(outdated, to be removed!) + logical :: useSMtest = .False. + double precision :: eps +! logical :: use_SMrate_at_reference_position_for_STXS = .False. + +!-------------------- Internal Control parameters -------------------- + + logical :: usetoys = .False. !(outdated, to be removed!) + logical :: absolute_errors = .False. ! Errors treated to original mu value, or toy-value + logical :: SLHAdetailed = .True. + logical :: newSLHAfile = .False. + logical :: THU_included = .True. + + !-------------------------------------------------------------------- integer :: nanalys !Total number of relevant analyses double precision, parameter :: vlarge=1000000000000.0D0 !--------------------- Default rate uncertainties ------------------- type rate_uncertainties !- dCS_SM and dBR_SM for the SM !- (from LHC HXSWG Yellow Report 3, arXiv:1307.1347) !- dCS and dBR hold the model's rate uncertainties. Can be changed by user !- with subroutine setup_rate_uncertainties. Default values are those of the SM. double precision :: dCS_SM(5) = (/ 0.147D0, 0.028D0, 0.037D0, 0.060D0, 0.12D0 /) double precision :: dCS(5) = (/ 0.147D0, 0.028D0, 0.037D0, 0.060D0, 0.12D0 /) ! double precision :: dBR_SM(5) = (/ 0.054D0, 0.048D0, 0.048D0, 0.061D0, 0.028D0 /) ! double precision :: dBR(5) = (/ 0.054D0, 0.048D0, 0.048D0, 0.061D0, 0.028D0 /) !- EDIT (TS 21/06/2013): Add new decay modes: !- Channels: gammagamma, WW, ZZ, tautau, bb, Zgamma, cc, mumu, gg double precision :: dBR_SM(9) = (/ 0.054D0, 0.048D0, 0.048D0, 0.061D0, 0.028D0,& & 0.090D0, 0.122D0, 0.060D0, 0.100D0 /) double precision :: dBR(9) = (/ 0.054D0, 0.048D0, 0.048D0, 0.061D0, 0.028D0,& & 0.090D0, 0.122D0, 0.060D0, 0.100D0 /) !--- IMPORTANT NOTE: !- !- The arrays dCS_SM, dCS, dBR_SM, dBR have been introduced in HiggsSignals-1.0.0 !- to hold the estimated theoretical uncertainties. These do not include correlations !- via parametric uncertainties (e.g. scale, PDFs,...) or correlations in the BRs introduced !- by the uncertainty of the total widths. !- !- Since HiggsSignals-1.1.0 the theoretical uncertainties for the cross sections and !- branching ratios are evaluated with toy MC scripts including the correlations of !- parametric error sources. The resulting covariance matrices are included per default !- if the files "BRcov.in" and "XScov.in" are present in the main HiggsSignals directory. !- If not, HiggsSignals will give a warning and use the old method. !- The covariance matrices can also be re-evaluated by the user with the scripts !- "smearErrorsBR.cpp" and "smearErrorsXS.cpp", which can be found in the directory !- /supplements/ !- !--- logical :: BRcov_ok=.False. logical :: CScov_ok=.False. logical :: usecov =.True. double precision, dimension(9,9) :: BRcovSM = 0.0D0 double precision, dimension(9,9) :: BRcov = 0.0D0 double precision, dimension(5,5) :: CScovSM = 0.0D0 double precision, dimension(5,5) :: CScov = 0.0D0 double precision, dimension(5,5) :: CS13covSM = 0.0D0 double precision, dimension(5,5) :: CS13cov = 0.0D0 !--- ILC cross section uncertainties (under development) !--- (none, none, WBF, ZH, ttH) double precision :: dCS_ILC_SM(5) = (/ 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0 /) double precision :: dCS_ILC(5) = (/ 0.0D0, 0.0D0, 0.01D0, 0.005D0, 0.01D0 /) end type type(rate_uncertainties), save :: delta_rate type LHCrun1 ! rate measurements integer :: channel_id double precision :: r, r_low, dr_low, r_up, dr_up double precision :: r_pred, dr, dr0 end type type(LHCrun1), dimension(20) :: LHCrun1_rates double precision, dimension(20,20) :: LHCrun1_correlationmatrix = 0.0D0 type correlation_info integer :: obsID1, obsID2 double precision :: corr end type type(correlation_info), allocatable :: corrlist(:) !-------------- Type definitions of internal structures -------------- type neutHiggs double precision :: m, dm, mu integer :: mp_test ! This variable is set to 1 (0) if the Higgs is (not) being tested in the m-pred chi^2 method. integer :: id end type !-Will contain info about all neutral Higgs for every considered observable, i.e. !-neutHiggses has dimensions (number(observables),nH) type(neutHiggs), allocatable :: neutHiggses(:,:) type mutable integer :: id,nx,particle_x !see usefulbits.f90 for key to particle codes n.b. they're NOT pdg character(LEN=100) :: label character(LEN=100) :: desc character(LEN=3) :: expt character(LEN=10) :: collider character(LEN=10) :: collaboration double precision :: lumi,dlumi,energy ! dlumi in % !--TESTING correlated experimental systematics: ! double precision, dimension(4) :: correxpsyst !--END double precision :: xmax,xmin,sep,deltax double precision :: deltam character(LEN=100) :: assignmentgroup integer :: mhchisq double precision, allocatable :: mass(:) double precision, allocatable :: mu(:,:) ! in mu(a,b), a=row, b=1,2,3 for low,obs,up integer :: Nc ! Number of channels - integer, allocatable :: channel_id(:) ! Considered channels array, dim(Nc) + character(LEN=5), allocatable :: channel_id_str(:) ! Channels array as string, dim(Nc) +! integer, allocatable :: channel_id(:) ! Channels array, dim(Nc) + integer, allocatable :: channel_p_id(:) ! Production channels array, dim(Nc) + integer, allocatable :: channel_d_id(:) ! Decay channels array, dim(Nc) character(LEN=10),allocatable :: channel_description(:,:) double precision, allocatable :: channel_eff(:) ! Channel efficiencies, dim(Nc) double precision, allocatable :: channel_eff_ratios(:) ! Channel efficiency ratios (model vs. SM), dim(Nc) double precision, allocatable :: channel_w(:,:) ! Channel weights, dim(Nc, NHiggs) double precision, allocatable :: channel_w_corrected_eff(:,:) ! Channel weights, dim(Nc, NHiggs) double precision, allocatable :: channel_systSM(:,:) ! Channel systematics of SM, dim(Nc, NHiggs) double precision, allocatable :: channel_syst(:,:) ! Channel systematics, dim(Nc, NHiggs) double precision, allocatable :: channel_mu(:,:) ! SM normalized channel rates, dim(Nc, NHiggs) double precision :: eff_ref_mass ! Reference Higgs mass for quoted efficiency integer :: npeaks double precision, allocatable :: Toys_mhobs(:) double precision, allocatable :: Toys_muobs(:) double precision :: scale_mu end type type mupeak integer :: id integer :: ilow,iup,ipeak double precision :: mpeak double precision :: dm double precision :: mu double precision :: mu_original double precision :: scale_mu!, scale_mh double precision :: dmuup,dmulow ! Upper and lower cyan band double precision :: dmuup0sq, dmulow0sq ! Cyan band squared subtracted by correlated uncertainties !-Peak object should contain everything needed for constructing the covariance matrices integer :: Nc ! Number of channels - integer, allocatable :: channel_id(:) ! Considered channels array, dim(Nc) + integer, allocatable :: channel_id(:) ! Channels array, dim(Nc) + integer, allocatable :: channel_p_id(:) ! Production channels array, dim(Nc) + integer, allocatable :: channel_d_id(:) ! Decay channels array, dim(Nc) double precision, allocatable :: channel_eff(:) ! Channel efficiencies, dim(Nc) integer, allocatable :: Higgs_comb(:) ! Assigned Higgs combination, dim(NHiggs) character(LEN=100) :: assignmentgroup type(neutHiggs), allocatable :: Higgses(:) integer :: domH ! index of dominantly contributing Higgs integer :: NHiggs_comb ! Number of combined Higgses integer :: Higgs_assignment_forced integer :: undo_assignment !--These arrays contain only the information about all Higgs bosons !--(need to have this for every peak separately because it can depend on the efficiencies !-- which are given for each peak separately) double precision, allocatable :: channel_w_allH(:,:) ! Channel weights, dim(Nc, NHiggs) double precision, allocatable :: channel_w_corrected_eff_allH(:,:) ! Channel weights with corrected efficiencies, dim(Nc, NHiggs) double precision, allocatable :: channel_systSM_allH(:,:) ! Channel systematics of SM, dim(Nc, NHiggs) double precision, allocatable :: channel_syst_allH(:,:) ! Channel systematics, dim(Nc, NHiggs) double precision, allocatable :: channel_mu_allH(:,:) ! SM normalized channel rates, dim(Nc, NHiggs) !--These arrays contain only the information about the chosen Higgs combination: double precision, allocatable :: channel_w(:) ! Channel weights, dim(Nc) double precision, allocatable :: channel_w_corrected_eff(:) ! Channel weights with corrected efficencies, dim(Nc) double precision, allocatable :: channel_systSM(:) ! Channel systematics, dim(Nc) double precision, allocatable :: channel_syst(:) ! Channel systematics, dim(Nc) double precision, allocatable :: channel_mu(:) ! SM normalized channel rates, dim(Nc) double precision, allocatable :: channel_w_model(:) double precision :: total_mu double precision :: dlumi !-- Chisq values (mu and mh parts, total) after taking into account correlations with !-- other peaks: double precision :: chisq_mu double precision :: chisq_mh double precision :: chisq_tot double precision :: chisq_max integer :: internalnumber end type type mp_neutHiggs !-This object is a Higgs or Higgscluster which are separately !-tested with the predicted mass chi^2 method. type(neutHiggs), allocatable :: Higgses(:) double precision :: m, dm, mu integer :: mp_test double precision :: mu_obs, dmu_low_obs, dmu_up_obs, dmu_low0_obs, dmu_up0_obs, m_obs double precision, allocatable :: channel_w_model(:) double precision, allocatable :: channel_mu(:) double precision :: total_mu integer :: Higgscomb integer :: domH double precision :: chisq !-n.b. these are the smeared observed signal strengths for this Higgs boson end type type mpred type(mp_neutHiggs), allocatable :: mp_Higgses(:) double precision :: mupred end type type observable integer :: id integer :: obstype type(mupeak) :: peak type(mutable) :: table type(neutHiggs), allocatable :: Higgses(:) end type type(observable), allocatable :: obs(:) type tablelist integer :: Npeaks integer :: id type(mutable) :: table type(mupeak), allocatable :: peaks(:) type(mpred) :: mpred type(neutHiggs), allocatable :: Higgses(:) ! This object holds primarily the Higgs boson predictions ! corresponding to tablelist%table. It corresponds to the full ! muplot if it is implemented (to enable the mpred-method). end type type(tablelist), allocatable :: analyses(:) type HSresults double precision :: Pvalue = -1.0D0 double precision :: Pvalue_peak = -1.0D0 double precision :: Pvalue_LHCRun1 = -1.0D0 double precision :: Pvalue_STXS = -1.0D0 double precision :: Chisq, Chisq_mu,Chisq_mh double precision :: Chisq_peak, Chisq_mpred, Chisq_peak_mu, Chisq_peak_mh double precision :: Chisq_LHCRun1, Chisq_LHCRun1_mu, Chisq_LHCRun1_mh double precision :: Chisq_STXS, Chisq_STXS_rates, Chisq_STXS_mh double precision, allocatable :: mupred(:) integer, allocatable :: domH(:) integer, allocatable :: nH(:) integer, allocatable :: obsID(:) integer :: nobs, nobs_mu, nobs_mh integer :: nobs_peak, nobs_mpred, nobs_peak_mu, nobs_peak_mh, nanalysis integer :: nobs_LHCRun1, nobs_LHCRun1_mu, nobs_LHCRun1_mh integer :: nobs_STXS, nobs_STXS_rates, nobs_STXS_mh end type type(HSresults), allocatable :: HSres(:) !----------------------- Covariance matrices ---------------------- double precision, allocatable :: cov(:,:) double precision, allocatable :: cov_mhneut(:,:,:) double precision, allocatable :: cov_mhneut_max(:,:,:) double precision, allocatable :: cov_mh_av(:,:) double precision, allocatable :: cov_mh_av_max(:,:) double precision, allocatable :: cov_mp(:,:) double precision, allocatable :: cov_mu_tot(:,:) double precision, allocatable :: mu_vector(:) !-------------------------------------------------------------------- contains !-------------------------------------------------------------------- subroutine HiggsSignals_info !-------------------------------------------------------------------- implicit none write(*,*) write(*,*)"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" write(*,*)"~ ~" write(*,*)"~ HiggsSignals "//adjustl(HSvers)//" ~" write(*,*)"~ ~" write(*,*)"~ Philip Bechtle, Daniel Dercks, Sven Heinemeyer, ~" write(*,*)"~ Tobias Klingl, Tim Stefaniak, Georg Weiglein ~" write(*,*)"~ ~" write(*,*)"~ arXiv:1305.1933 (Manual) ~" write(*,*)"~ arXiv:1403.1582 (application + more details) ~" write(*,*)"~ ~" write(*,*)"~ It is based on the HiggsBounds-5 Fortran library. ~" write(*,*)"~ Please consult and cite also the following references ~" write(*,*)"~ for the HiggsBounds program ~" write(*,*)"~ ~" write(*,*)"~ arXiv:0811.4169, arXiv:1102.1898, arXiv:1311.0055 ~" write(*,*)"~ ~" write(*,*)"~ For updates, additional material, release notes, see: ~" write(*,*)"~ http://higgsbounds.hepforge.org ~" write(*,*)"~ ~" write(*,*)"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" write(*,*) write(*,*)" HiggsSignals collects together results from " write(*,*) write(*,*)" * the ATLAS and CMS Collaborations" write(*,*)" * the CDF and D0 Collaborations" write(*,*)" * the program HDECAY (arXiv:hep-ph/9704448)" write(*,*)" * LHC Higgs Cross Section Working Group" write(*,*)" (arXiv:1101.0593, arXiv:1201.3084, arXiv:1307.1347," write(*,*)" arXiv:1610.07922 and ref. therein)" write(*,*) end subroutine HiggsSignals_info !-------------------------------------------------------------------- subroutine print_dble_matrix(mat, title) !-------------------------------------------------------------------- implicit none double precision, dimension(:,:), intent(in) :: mat(:,:) character(LEN=50), intent(in), optional :: title integer :: i if(present(title)) then write(*,*)"#*************************************************************************#" write(*,*)"# ",trim(title) endif write(*,*) "#*************************************************************************#" do i=lbound(mat,dim=1),ubound(mat,dim=1) write(*,*) mat(i,:) enddo write(*,*) "#*************************************************************************#" end subroutine print_dble_matrix !-------------------------------------------------------------------- subroutine deallocate_usefulbits_HS !-------------------------------------------------------------------- implicit none integer :: i ! deallocate(neutHiggses) if(allocated(HSres)) then do i=lbound(HSres, dim=1), ubound(HSres, dim=1) if(allocated(HSres(i)%mupred)) deallocate(HSres(i)%mupred) if(allocated(HSres(i)%domH)) deallocate(HSres(i)%domH) if(allocated(HSres(i)%nH)) deallocate(HSres(i)%nH) enddo deallocate(HSres) endif if(allocated(corrlist)) deallocate(corrlist) call deallocate_covariance_matrices end subroutine deallocate_usefulbits_HS !-------------------------------------------------------------------- subroutine deallocate_covariance_matrices !-------------------------------------------------------------------- implicit none if(allocated(cov)) deallocate(cov) if(allocated(cov_mhneut)) deallocate(cov_mhneut) if(allocated(cov_mhneut_max)) deallocate(cov_mhneut_max) if(allocated(cov_mh_av)) deallocate(cov_mh_av) if(allocated(cov_mh_av_max)) deallocate(cov_mh_av_max) if(allocated(cov_mp)) deallocate(cov_mp) if(allocated(cov_mu_tot)) deallocate(cov_mu_tot) if(allocated(mu_vector)) deallocate(mu_vector) end subroutine deallocate_covariance_matrices !-------------------------------------------------------------------- function int_in_array(number, array) integer, intent(in) :: number integer, dimension(:), intent(in) :: array logical :: int_in_array integer :: i int_in_array = .False. do i=lbound(array,dim=1),ubound(array,dim=1) if(number.eq.array(i)) int_in_array = .True. enddo end function int_in_array !------------------------------------------------------------------------------------ !-------------------------------------------------------------------- !:sdoc+: ! ! NAME: ! StrCompress ! ! PURPOSE: ! Subroutine to return a copy of an input string with all whitespace ! (spaces and tabs) removed. ! ! CALLING SEQUENCE: ! Result = StrCompress( String, & ! Input ! n = n ) ! Optional Output ! ! INPUT ARGUMENTS: ! String: Character string to be compressed. ! UNITS: N/A ! TYPE: CHARACTER(*) ! DIMENSION: Scalar ! ATTRIBUTES: INTENT(IN) ! ! OPTIONAL OUTPUT ARGUMENTS: ! n: Number of useful characters in output string ! after compression. From character n+1 -> LEN(Input_String) ! the output is padded with blanks. ! UNITS: N/A ! TYPE: INTEGER ! DIMENSION: Scalar ! ATTRIBUTES: INTENT(OUT), OPTIONAL ! ! FUNCTION RESULT: ! Result: Input string with all whitespace removed before the ! first non-whitespace character, and from in-between ! non-whitespace characters. ! UNITS: N/A ! TYPE: CHARACTER(LEN(String)) ! DIMENSION: Scalar ! ! EXAMPLE: ! Input_String = ' This is a string with spaces in it.' ! Output_String = StrCompress( Input_String, n=n ) ! WRITE( *, '( a )' ) '>',Output_String( 1:n ),'<' ! >Thisisastringwithspacesinit.< ! ! or ! ! WRITE( *, '( a )' ) '>',TRIM( Output_String ),'<' ! >Thisisastringwithspacesinit.< ! ! PROCEDURE: ! Definitions of a space and a tab character are made for the ! ASCII collating sequence. Each single character of the input ! string is checked against these definitions using the IACHAR() ! intrinsic. If the input string character DOES NOT correspond ! to a space or tab, it is not copied to the output string. ! ! Note that for input that ONLY has spaces or tabs BEFORE the first ! useful character, the output of this function is the same as the ! ADJUSTL() instrinsic. ! ! CREATION HISTORY: ! Written by: Paul van Delst, CIMSS/SSEC 18-Oct-1999 ! paul.vandelst@ssec.wisc.edu ! !:sdoc-: !-------------------------------------------------------------------- FUNCTION StrCompress( Input_String, n ) RESULT( Output_String ) ! Arguments CHARACTER(*), INTENT(IN) :: Input_String INTEGER, OPTIONAL, INTENT(OUT) :: n ! Function result CHARACTER(LEN(Input_String)) :: Output_String ! Local parameters INTEGER, PARAMETER :: IACHAR_SPACE = 32 INTEGER, PARAMETER :: IACHAR_TAB = 9 ! Local variables INTEGER :: i, j INTEGER :: IACHAR_Character ! Setup ! ----- ! Initialise output string Output_String = ' ' ! Initialise output string "useful" length counter j = 0 ! Loop over string contents character by character ! ------------------------------------------------ DO i = 1, LEN(Input_String) ! Convert the current character to its position ! in the ASCII collating sequence IACHAR_Character = IACHAR(Input_String(i:i)) ! If the character is NOT a space ' ' or a tab '->|' ! copy it to the output string. IF ( IACHAR_Character /= IACHAR_SPACE .AND. & IACHAR_Character /= IACHAR_TAB ) THEN j = j + 1 Output_String(j:j) = Input_String(i:i) END IF END DO ! Save the non-whitespace count ! ----------------------------- IF ( PRESENT(n) ) n = j END FUNCTION StrCompress !-------------------------------------------------------------------- end module usefulbits_HS !-------------------------------------------------------------------- \ No newline at end of file Index: trunk/HiggsSignals-2/supplements/smearErrorsXS_LHC13.cpp =================================================================== --- trunk/HiggsSignals-2/supplements/smearErrorsXS_LHC13.cpp (revision 568) +++ trunk/HiggsSignals-2/supplements/smearErrorsXS_LHC13.cpp (revision 569) @@ -1,229 +1,300 @@ #include #include #include "TRandom3.h" #include "TMath.h" //#include void smearErrorsXS_LHC13 () { cout << "#----------------------------------------------------#" << endl; cout << "# #" << endl; cout << "# Covariance matrix calculator for the #" << endl; cout << "# Higgs boson cross section uncertainties #" << endl; cout << "# for LHC 13 TeV, following the YR4. #" << endl; cout << "# #" << endl; cout << "# This ROOT macro is part of the #" << endl; cout << "# HiggsSignals package. #" << endl; cout << "# #" << endl; - cout << "# (latest change on 29/03/2017, PB & TS) #" << endl; + cout << "# (latest change on 29/06/2018, PB & TS) #" << endl; cout << "#----------------------------------------------------#" << endl; cout << endl; const int shape = 0; // 0: gauss, 1: box const double errorScaleFactor = 1.; const bool error100percCorr = false; const bool errorScaleZW100percCorr = true; const bool errorPdf100percCorr = false; const bool errorPdfOnlyProc100percCorr = true; const int nErrors = 3; - const int nXS = 5; + const int nXS = 11; const int nRandomNumbers = nXS*nErrors; - const int nToys = 1000000; + const int nToys = 2000000; double upperRelError[nXS][nErrors]; double lowerRelError[nXS][nErrors]; double centralValueXS[nXS]; vector< vector > toyXSset; double covarianceMatrixXS[nXS][nXS]; //Scale factors for various types of uncertainties: const double pdfsf=1.0; const double qcdsf=1.0; const double thsf = 1.0; TRandom3 random; cout << "Filling input relative parameteric and theoretical uncertainties..." << endl; // Values for mH = 125.09 GeV - centralValueXS[0] = 48510.0; // ggF + // https://twiki.cern.ch/twiki/bin/view/LHCPhysics/CERNYellowReportPageAt13TeV + centralValueXS[0] = 49006.0; // ggF (N3LO) + bbH (use uncertainties of ggF below) centralValueXS[1] = 3779.0; // VBF - centralValueXS[2] = 1373.0; // WH + centralValueXS[2] = 1369.0; // WH centralValueXS[3] = 882.1; // ZH centralValueXS[4] = 506.5; // ttH - + centralValueXS[5] = 48520.0; // ggF (N3LO) + centralValueXS[6] = 486.3; // bbH + centralValueXS[7] = 74.26; // tH (t-channel) + centralValueXS[8] = 2.875; // tH (s-channel) + centralValueXS[9] = 761.2; // qq-ZH + centralValueXS[10] = 122.7; // gg-ZH // ggF 13 TeV // xs QCDscale PDF+alphas // 48510 3.9 3.2 // VBF 13 TeV // xs deltaEW PDF QCD scale // 3779 −5.3 2.1 0.5 // WH 13 TeV // xs QCD scale PDF // 1373.0 ±0.9 ±1.7 // ZH 13 TeV 126 // xs QCD scale PDF // 882.10 ±0.9 ±1.3 // ttH 13 TeV 126 // xs QCD scale PDF+alphas // 506.5 +5.8 −9.2 ±3.6 lowerRelError[0][0] = pdfsf*3.2; // ggF PDF(+alphas) lowerRelError[0][1] = qcdsf*3.9; // ggF QCD scale lowerRelError[0][2] = thsf*0.0; // ggF EW lowerRelError[1][0] = pdfsf*2.1; // VBF PDF(+alphas) - lowerRelError[1][1] = qcdsf*0.5; // VBF QCD scale + lowerRelError[1][1] = qcdsf*0.3; // VBF QCD scale lowerRelError[1][2] = thsf*5.3; // VBF EW - lowerRelError[2][0] = pdfsf*1.7; // WH PDF(+alphas) - lowerRelError[2][1] = qcdsf*0.9; // WH QCD scale + lowerRelError[2][0] = pdfsf*1.9; // WH PDF(+alphas) + lowerRelError[2][1] = qcdsf*0.7; // WH QCD scale lowerRelError[2][2] = thsf*0.0; // WH EW - lowerRelError[3][0] = pdfsf*1.3; // ZH PDF(+alphas) - lowerRelError[3][1] = qcdsf*0.9; // ZH QCD scale + lowerRelError[3][0] = pdfsf*1.6; // ZH PDF(+alphas) + lowerRelError[3][1] = qcdsf*3.0; // ZH QCD scale lowerRelError[3][2] = thsf*0.0; // ZH EW lowerRelError[4][0] = pdfsf*3.6; // ttH PDF(+alphas) lowerRelError[4][1] = qcdsf*9.2; // ttH QCD scale lowerRelError[4][2] = thsf*0.0; // ttH EW + lowerRelError[5][0] = pdfsf*3.2; // ggF PDF(+alphas) + lowerRelError[5][1] = qcdsf*3.9; // ggF QCD scale + lowerRelError[5][2] = thsf*0.0; // ggF EW + lowerRelError[6][0] = pdfsf*0.0; // bbH not given separately + lowerRelError[6][1] = qcdsf*23.9; // bbH QCD scale (and PDF+alphas) + lowerRelError[6][2] = thsf*0.0; // ggF EW + lowerRelError[7][0] = pdfsf*3.7; // tH t-channel PDF(+alphas) + lowerRelError[7][1] = qcdsf*14.7; // tH t-channel QCD scale + lowerRelError[7][2] = thsf*0.0; // tH t-channel EW + lowerRelError[8][0] = pdfsf*2.2; // tH s-channel PDF(+alphas) + lowerRelError[8][1] = qcdsf*1.8; // tH s-channel QCD scale + lowerRelError[8][2] = thsf*0.0; // tH s-channel EW + lowerRelError[9][0] = pdfsf*1.9; // qq-ZH PDF(+alphas) + lowerRelError[9][1] = qcdsf*0.6; // qq-ZH QCD scale + lowerRelError[9][2] = thsf*0.0; // qq-ZH EW + lowerRelError[10][0] = pdfsf*2.4; // gg-ZH PDF(+alphas) + lowerRelError[10][1] = qcdsf*18.9; // gg-ZH QCD scale + lowerRelError[10][2] = thsf*0.0; // gg-ZH EW + upperRelError[0][0] = pdfsf*3.2; // ggF PDF(+alphas) upperRelError[0][1] = qcdsf*3.9; // ggF QCD scale upperRelError[0][2] = thsf*0.0; // ggF EW upperRelError[1][0] = pdfsf*2.1; // VBF PDF(+alphas) - upperRelError[1][1] = qcdsf*0.5; // VBF QCD scale + upperRelError[1][1] = qcdsf*0.4; // VBF QCD scale upperRelError[1][2] = thsf*0.0; // VBF EW - upperRelError[2][0] = pdfsf*1.7; // WH PDF(+alphas) - upperRelError[2][1] = qcdsf*0.9; // WH QCD scale + upperRelError[2][0] = pdfsf*1.9; // WH PDF(+alphas) + upperRelError[2][1] = qcdsf*0.5; // WH QCD scale upperRelError[2][2] = thsf*0.0; // WH EW - upperRelError[3][0] = pdfsf*1.3; // ZH PDF(+alphas) - upperRelError[3][1] = qcdsf*0.9; // ZH QCD scale + upperRelError[3][0] = pdfsf*1.6; // ZH PDF(+alphas) + upperRelError[3][1] = qcdsf*3.8; // ZH QCD scale upperRelError[3][2] = thsf*0.0; // ZH EW upperRelError[4][0] = pdfsf*3.6; // ttH PDF(+alphas) upperRelError[4][1] = qcdsf*5.8; // ttH QCD scale upperRelError[4][2] = thsf*0.0; // ttH EW + upperRelError[5][0] = pdfsf*3.2; // ggF PDF(+alphas) + upperRelError[5][1] = qcdsf*3.9; // ggF QCD scale + upperRelError[5][2] = thsf*0.0; // ggF EW + upperRelError[6][0] = pdfsf*0.0; // bbH not given separately + upperRelError[6][1] = qcdsf*20.1; // bbH QCD scale (and PDF+alphas) + upperRelError[6][2] = thsf*0.0; // ggF EW + upperRelError[7][0] = pdfsf*3.7; // tH t-channel PDF(+alphas) + upperRelError[7][1] = qcdsf*6.5; // tH t-channel QCD scale + upperRelError[7][2] = thsf*0.0; // tH t-channel EW + upperRelError[8][0] = pdfsf*2.2; // tH s-channel PDF(+alphas) + upperRelError[8][1] = qcdsf*2.4; // tH s-channel QCD scale + upperRelError[8][2] = thsf*0.0; // tH s-channel EW + upperRelError[9][0] = pdfsf*1.9; // qq-ZH PDF(+alphas) + upperRelError[9][1] = qcdsf*0.5; // qq-ZH QCD scale + upperRelError[9][2] = thsf*0.0; // qq-ZH EW + upperRelError[10][0] = pdfsf*2.4; // gg-ZH PDF(+alphas) + upperRelError[10][1] = qcdsf*25.1; // gg-ZH QCD scale + upperRelError[10][2] = thsf*0.0; // gg-ZH EW + // convert to percent for (int iXS = 0; iXS < nXS; iXS++) { for (int iError = 0; iError < nErrors; iError++) { lowerRelError[iXS][iError] = lowerRelError[iXS][iError]*0.01; upperRelError[iXS][iError] = upperRelError[iXS][iError]*0.01; } } cout << "Start generating toys..." << endl; for (int iToy = 0; iToy < nToys; iToy++) { double thisErrorSmearing[nRandomNumbers]; for (int iError = 0; iError < nRandomNumbers; iError++) { if (shape == 0) { thisErrorSmearing[iError] = random.Gaus(0,errorScaleFactor); } else if (shape == 1) { thisErrorSmearing[iError] = random.Uniform(-errorScaleFactor,errorScaleFactor); } else { cout << " not implemented " << endl; return; } } vector thisXSset; for (int iXS = 0; iXS < nXS; iXS++) { thisXSset.push_back(centralValueXS[iXS]); for (int iError = 0; iError < nErrors; iError++) { // first enter correlations into error smearings if (errorScaleZW100percCorr && iXS == 3 && iError == 1) { thisErrorSmearing[nErrors*iXS+iError] = thisErrorSmearing[nErrors*(iXS-1)+iError]; } if (errorPdfOnlyProc100percCorr) { + // 100% correlated PDF uncertainty between singleH and ttH if (iXS == 4 && iError == 0) { thisErrorSmearing[nErrors*iXS+iError] = thisErrorSmearing[nErrors*0+iError]; } if ((iXS == 2 || iXS == 3)&& iError == 0) { - thisErrorSmearing[nErrors*iXS+iError] = thisErrorSmearing[nErrors*(iXS-1)+iError]; + // 100% correlated PDF uncertainty between VBF, WH, ZH + thisErrorSmearing[nErrors*iXS+iError] = thisErrorSmearing[nErrors*1+iError]; } } else if (errorPdf100percCorr) { if (iXS > 0 && iError == 0) { thisErrorSmearing[nErrors*iXS+iError] = thisErrorSmearing[nErrors*(iXS-1)+iError]; } } - // then apply error smearings +// implement 100% correlation of all uncertainties between singleH [0] and ggH [5], +// as well as between ZH [3] and qq-ZH [9] + if (iXS == 5){ + thisErrorSmearing[nErrors*iXS+iError] = thisErrorSmearing[nErrors*0+iError]; + } + if (iXS == 9){ + thisErrorSmearing[nErrors*iXS+iError] = thisErrorSmearing[nErrors*3+iError]; + } + if (iXS == 10 && iError == 1){ + // treat QCD scale uncertainty of inclusive ZH and gg->ZH as 100% correlated + thisErrorSmearing[nErrors*iXS+iError] = thisErrorSmearing[nErrors*3+iError]; + } + + // then apply error smearings if (error100percCorr) { thisXSset[iXS] += upperRelError[iXS][iError]*thisXSset[iXS]*thisErrorSmearing[0]; } else { if (thisErrorSmearing[nErrors*iXS+iError] > 0.) { thisXSset[iXS] += upperRelError[iXS][iError]*thisXSset[iXS]*thisErrorSmearing[nErrors*iXS+iError]; } else { thisXSset[iXS] += lowerRelError[iXS][iError]*thisXSset[iXS]*thisErrorSmearing[nErrors*iXS+iError]; } } - } + } } toyXSset.push_back(thisXSset); } cout << "Calculated the toys, now calculate the covariance matrix..." << endl; for (int iXS = 0; iXS < nXS; iXS++) { // calculate E[iXS] double meanXSI = 0; for (int iToy = 0; iToy < nToys; iToy++) { meanXSI += toyXSset[iToy][iXS]; } meanXSI = meanXSI/(double)nToys; for (int jXS = 0; jXS < nXS; jXS++) { double meanXSJ = 0; double meanXSIJ = 0; for (int iToy = 0; iToy < nToys; iToy++) { meanXSJ += toyXSset[iToy][jXS]; meanXSIJ += toyXSset[iToy][jXS]*toyXSset[iToy][iXS]; } meanXSJ = meanXSJ/(double)nToys; meanXSIJ = meanXSIJ/(double)nToys; covarianceMatrixXS[iXS][jXS] = meanXSIJ - meanXSI*meanXSJ; } } cout << "#---------------------------------------------------------------"<< endl; cout << "Covariance matrix for the XS:\n" << endl; for (int iXS = 0; iXS < nXS; iXS++) { for (int jXS = 0; jXS < nXS; jXS++) { cout << " " << covarianceMatrixXS[iXS][jXS]; } cout << endl; } cout << "#---------------------------------------------------------------"<< endl; cout << "Covariance matrix for the XS with relative errors:" << endl; cout << "(to be used in HiggsSignals under the name XScov.in or XScovSM.in)\n" << endl; for (int iXS = 0; iXS < nXS; iXS++) { for (int jXS = 0; jXS < nXS; jXS++) { cout << " " << covarianceMatrixXS[iXS][jXS]/(centralValueXS[iXS]*centralValueXS[jXS]); } cout << endl; } cout << "\nCorrelation matrix for the XS:\n" << endl; for (int iXS = 0; iXS < nXS; iXS++) { for (int jXS = 0; jXS < nXS; jXS++) { cout << " " << covarianceMatrixXS[iXS][jXS]/ TMath::Sqrt(covarianceMatrixXS[iXS][iXS]*covarianceMatrixXS[jXS][jXS]); } cout << endl; } cout << "#---------------------------------------------------------------"<< endl; cout << "comparison quantities:" << endl; - cout << "relative error on sigma(ggH)/fb = " << + cout << "relative error on sigma(singleH)/fb = " << TMath::Sqrt(covarianceMatrixXS[0][0]/(centralValueXS[0]*centralValueXS[0])) << endl; cout << "relative error on sigma(VBF)/fb = " << TMath::Sqrt(covarianceMatrixXS[1][1]/(centralValueXS[1]*centralValueXS[1])) << endl; cout << "relative error on sigma(WH)/fb = " << TMath::Sqrt(covarianceMatrixXS[2][2]/(centralValueXS[2]*centralValueXS[2])) << endl; cout << "relative error on sigma(ZH)/fb = " << TMath::Sqrt(covarianceMatrixXS[3][3]/(centralValueXS[3]*centralValueXS[3])) << endl; cout << "relative error on sigma(ttH)/fb = " << TMath::Sqrt(covarianceMatrixXS[4][4]/(centralValueXS[4]*centralValueXS[4])) << endl; + cout << "relative error on sigma(ggH)/fb = " << + TMath::Sqrt(covarianceMatrixXS[5][5]/(centralValueXS[5]*centralValueXS[5])) << endl; + cout << "relative error on sigma(bbH)/fb = " << + TMath::Sqrt(covarianceMatrixXS[6][6]/(centralValueXS[6]*centralValueXS[6])) << endl; + cout << "relative error on sigma(tH tchan)/fb = " << + TMath::Sqrt(covarianceMatrixXS[7][7]/(centralValueXS[7]*centralValueXS[7])) << endl; + cout << "relative error on sigma(tH schan)/fb = " << + TMath::Sqrt(covarianceMatrixXS[8][8]/(centralValueXS[8]*centralValueXS[8])) << endl; + cout << "relative error on sigma(qqZH)/fb = " << + TMath::Sqrt(covarianceMatrixXS[9][9]/(centralValueXS[9]*centralValueXS[9])) << endl; + cout << "relative error on sigma(ggZH)/fb = " << + TMath::Sqrt(covarianceMatrixXS[10][10]/(centralValueXS[10]*centralValueXS[10])) << endl; return; } Index: trunk/HiggsSignals-2/supplements/smearErrorsXS.cpp =================================================================== --- trunk/HiggsSignals-2/supplements/smearErrorsXS.cpp (revision 568) +++ trunk/HiggsSignals-2/supplements/smearErrorsXS.cpp (revision 569) @@ -1,227 +1,296 @@ #include #include #include "TRandom3.h" #include "TMath.h" //#include void smearErrorsXS () { cout << "#----------------------------------------------------#" << endl; cout << "# #" << endl; cout << "# Covariance matrix calculator for the #" << endl; cout << "# Higgs boson cross section uncertainties #" << endl; cout << "# #" << endl; cout << "# This ROOT macro is part of the #" << endl; cout << "# HiggsSignals package. #" << endl; cout << "# #" << endl; cout << "# (latest change on 25/09/2013, PB & TS) #" << endl; cout << "#----------------------------------------------------#" << endl; cout << endl; const int shape = 0; // 0: gauss, 1: box const double errorScaleFactor = 1.; const bool error100percCorr = false; const bool errorScaleZW100percCorr = true; const bool errorPdf100percCorr = false; const bool errorPdfOnlyProc100percCorr = true; const int nErrors = 3; - const int nXS = 5; + const int nXS = 11; const int nRandomNumbers = nXS*nErrors; const int nToys = 100000; double upperRelError[nXS][nErrors]; double lowerRelError[nXS][nErrors]; double centralValueXS[nXS]; vector< vector > toyXSset; double covarianceMatrixXS[nXS][nXS]; //Scale factors for various types of uncertainties: const double pdfsf=1.0; const double qcdsf=1.0; const double thsf = 1.0; TRandom3 random; cout << "Filling input relative parameteric and theoretical uncertainties..." << endl; +//https://twiki.cern.ch/twiki/bin/view/LHCPhysics/CERNYellowReportPageAt8TeV + centralValueXS[0] = 21591.5; // singleH + centralValueXS[1] = 1600.0; // VBF + centralValueXS[2] = 700.9; // WH + centralValueXS[3] = 420.8; // ZH + centralValueXS[4] = 132.6; // ttH + centralValueXS[5] = 21390.0; // ggF (N3LO) + centralValueXS[6] = 201.5; // bbH + centralValueXS[7] = 18.66; // tH (t-channel) + centralValueXS[8] = 1.211; // tH (s-channel) + centralValueXS[9] = 381.4; // qq-ZH + centralValueXS[10] = 39.42; // gg-ZH - centralValueXS[0] = 18970.; // ggF - centralValueXS[1] = 1568.0; // VBF - centralValueXS[2] = 686.1; // WH - centralValueXS[3] = 405.1; // ZH - centralValueXS[4] = 126.2; // ttH // ggF 8 TeV 126 // xs QCD scale PDF+alphas // 18970 +7.2 −7.8 +7.5 −6.9 // VBF 8 TeV 126 // xs deltaEW PDF QCD scale // 1568 −4.5 +2.6 −2.8 +0.3 −0.1 // WH 8 TeV 126 // xs QCD scale PDF // 686.1 ±1.0 ±2.5 // ZH 8 TeV 126 // xs QCD scale PDF // 405.1 ±3.3 ±2.6 // ttH 8 TeV 126 // xs QCD scale PDF+alphas // 126.2 +3.8 −9.3 ±8.1 - lowerRelError[0][0] = pdfsf*6.9; // ggF PDF(+alphas) - lowerRelError[0][1] = qcdsf*7.8; // ggF QCD scale - lowerRelError[0][2] = thsf*0.0; // ggF EW - lowerRelError[1][0] = pdfsf*2.8; // VBF PDF(+alphas) - lowerRelError[1][1] = qcdsf*0.1; // VBF QCD scale - lowerRelError[1][2] = thsf*4.5; // VBF EW - lowerRelError[2][0] = pdfsf*2.5; // WH PDF(+alphas) - lowerRelError[2][1] = qcdsf*1.0; // WH QCD scale + lowerRelError[0][0] = pdfsf*3.2; // singleH PDF(+alphas) + lowerRelError[0][1] = qcdsf*6.9; // singleH QCD scale + lowerRelError[0][2] = thsf*0.0; // singleH EW + lowerRelError[1][0] = pdfsf*2.2; // VBF PDF(+alphas) + lowerRelError[1][1] = qcdsf*0.2; // VBF QCD scale + lowerRelError[1][2] = thsf*0.0; // VBF EW + lowerRelError[2][0] = pdfsf*2.0; // WH PDF(+alphas) + lowerRelError[2][1] = qcdsf*0.8; // WH QCD scale lowerRelError[2][2] = thsf*0.0; // WH EW - lowerRelError[3][0] = pdfsf*2.6; // ZH PDF(+alphas) - lowerRelError[3][1] = qcdsf*3.3; // ZH QCD scale + lowerRelError[3][0] = pdfsf*1.7; // ZH PDF(+alphas) + lowerRelError[3][1] = qcdsf*2.4; // ZH QCD scale lowerRelError[3][2] = thsf*0.0; // ZH EW - lowerRelError[4][0] = pdfsf*8.1; // ttH PDF(+alphas) - lowerRelError[4][1] = qcdsf*9.3; // ttH QCD scale + lowerRelError[4][0] = pdfsf*4.3; // ttH PDF(+alphas) + lowerRelError[4][1] = qcdsf*9.2; // ttH QCD scale lowerRelError[4][2] = thsf*0.0; // ttH EW + lowerRelError[5][0] = pdfsf*3.2; // ggF PDF(+alphas) + lowerRelError[5][1] = qcdsf*6.9; // ggF QCD scale + lowerRelError[5][2] = thsf*0.0; // ggF EW + lowerRelError[6][0] = pdfsf*0.0; // bbH PDF(+alphas) + lowerRelError[6][1] = qcdsf*22.4; // bbH QCD scale + lowerRelError[6][2] = thsf*0.0; // bbH EW + lowerRelError[7][0] = pdfsf*4.6; // tH tchan PDF(+alphas) + lowerRelError[7][1] = qcdsf*16.6; // tH tchan QCD scale + lowerRelError[7][2] = thsf*0.0; // tH tchan EW + lowerRelError[8][0] = pdfsf*2.8; // tH schan PDF(+alphas) + lowerRelError[8][1] = qcdsf*2.4; // tH schan QCD scale + lowerRelError[8][2] = thsf*0.0; // tH schan EW + lowerRelError[9][0] = pdfsf*1.9; // qqZH PDF(+alphas) + lowerRelError[9][1] = qcdsf*0.8; // qqZH QCD scale + lowerRelError[9][2] = thsf*0.0; // qqZH EW + lowerRelError[10][0] = pdfsf*3.2; // ggZH PDF(+alphas) + lowerRelError[10][1] = qcdsf*19.1; // ggZH QCD scale + lowerRelError[10][2] = thsf*0.0; // ggZH EW - upperRelError[0][0] = pdfsf*7.5; // ggF PDF(+alphas) - upperRelError[0][1] = qcdsf*7.2; // ggF QCD scale - upperRelError[0][2] = thsf*0.0; // ggF EW - upperRelError[1][0] = pdfsf*2.6; // VBF PDF(+alphas) + + + upperRelError[0][0] = pdfsf*3.2; // singleH PDF(+alphas) + upperRelError[0][1] = qcdsf*4.4; // singleH QCD scale + upperRelError[0][2] = thsf*0.0; // singleH EW + upperRelError[1][0] = pdfsf*2.2; // VBF PDF(+alphas) upperRelError[1][1] = qcdsf*0.3; // VBF QCD scale upperRelError[1][2] = thsf*0.0; // VBF EW - upperRelError[2][0] = pdfsf*2.5; // WH PDF(+alphas) - upperRelError[2][1] = qcdsf*1.0; // WH QCD scale + upperRelError[2][0] = pdfsf*2.0; // WH PDF(+alphas) + upperRelError[2][1] = qcdsf*0.7; // WH QCD scale upperRelError[2][2] = thsf*0.0; // WH EW - upperRelError[3][0] = pdfsf*2.6; // ZH PDF(+alphas) - upperRelError[3][1] = qcdsf*3.3; // ZH QCD scale + upperRelError[3][0] = pdfsf*1.7; // ZH PDF(+alphas) + upperRelError[3][1] = qcdsf*2.9; // ZH QCD scale upperRelError[3][2] = thsf*0.0; // ZH EW - upperRelError[4][0] = pdfsf*8.1; // ttH PDF(+alphas) - upperRelError[4][1] = qcdsf*3.8; // ttH QCD scale + upperRelError[4][0] = pdfsf*4.3; // ttH PDF(+alphas) + upperRelError[4][1] = qcdsf*4.0; // ttH QCD scale upperRelError[4][2] = thsf*0.0; // ttH EW + upperRelError[5][0] = pdfsf*3.2; // ggF PDF(+alphas) + upperRelError[5][1] = qcdsf*4.4; // ggF QCD scale + upperRelError[5][2] = thsf*0.0; // ggF EW + upperRelError[6][0] = pdfsf*0.0; // bbH PDF(+alphas) + upperRelError[6][1] = qcdsf*20.6; // bbH QCD scale + upperRelError[6][2] = thsf*0.0; // bbH EW + upperRelError[7][0] = pdfsf*4.6; // tH tchan PDF(+alphas) + upperRelError[7][1] = qcdsf*7.3; // tH tchan QCD scale + upperRelError[7][2] = thsf*0.0; // tH tchan EW + upperRelError[8][0] = pdfsf*2.8; // tH schan PDF(+alphas) + upperRelError[8][1] = qcdsf*2.8; // tH schan QCD scale + upperRelError[8][2] = thsf*0.0; // tH schan EW + upperRelError[9][0] = pdfsf*1.9; // qqZH PDF(+alphas) + upperRelError[9][1] = qcdsf*0.7; // qqZH QCD scale + upperRelError[9][2] = thsf*0.0; // qqZH EW + upperRelError[10][0] = pdfsf*3.2; // ggZH PDF(+alphas) + upperRelError[10][1] = qcdsf*25.2; // ggZH QCD scale + upperRelError[10][2] = thsf*0.0; // ggZH EW // convert to percent for (int iXS = 0; iXS < nXS; iXS++) { for (int iError = 0; iError < nErrors; iError++) { lowerRelError[iXS][iError] = lowerRelError[iXS][iError]*0.01; upperRelError[iXS][iError] = upperRelError[iXS][iError]*0.01; } } cout << "Start generating toys..." << endl; for (int iToy = 0; iToy < nToys; iToy++) { double thisErrorSmearing[nRandomNumbers]; for (int iError = 0; iError < nRandomNumbers; iError++) { if (shape == 0) { thisErrorSmearing[iError] = random.Gaus(0,errorScaleFactor); } else if (shape == 1) { thisErrorSmearing[iError] = random.Uniform(-errorScaleFactor,errorScaleFactor); } else { cout << " not implemented " << endl; return; } } vector thisXSset; for (int iXS = 0; iXS < nXS; iXS++) { thisXSset.push_back(centralValueXS[iXS]); for (int iError = 0; iError < nErrors; iError++) { // first enter correlations into error smearings if (errorScaleZW100percCorr && iXS == 3 && iError == 1) { thisErrorSmearing[nErrors*iXS+iError] = thisErrorSmearing[nErrors*(iXS-1)+iError]; } if (errorPdfOnlyProc100percCorr) { if (iXS == 4 && iError == 0) { thisErrorSmearing[nErrors*iXS+iError] = thisErrorSmearing[nErrors*0+iError]; } if ((iXS == 2 || iXS == 3)&& iError == 0) { thisErrorSmearing[nErrors*iXS+iError] = thisErrorSmearing[nErrors*(iXS-1)+iError]; } } else if (errorPdf100percCorr) { if (iXS > 0 && iError == 0) { thisErrorSmearing[nErrors*iXS+iError] = thisErrorSmearing[nErrors*(iXS-1)+iError]; } } +// implement 100% correlation of all uncertainties between singleH [0] and ggH [5], +// as well as between ZH [3] and qq-ZH [9] + if (iXS == 5){ + thisErrorSmearing[nErrors*iXS+iError] = thisErrorSmearing[nErrors*0+iError]; + } + if (iXS == 9){ + thisErrorSmearing[nErrors*iXS+iError] = thisErrorSmearing[nErrors*3+iError]; + } + if (iXS == 10 && iError == 1){ + // treat QCD scale uncertainty of inclusive ZH and gg->ZH as 100% correlated + thisErrorSmearing[nErrors*iXS+iError] = thisErrorSmearing[nErrors*3+iError]; + } + // then apply error smearings if (error100percCorr) { thisXSset[iXS] += upperRelError[iXS][iError]*thisXSset[iXS]*thisErrorSmearing[0]; } else { if (thisErrorSmearing[nErrors*iXS+iError] > 0.) { thisXSset[iXS] += upperRelError[iXS][iError]*thisXSset[iXS]*thisErrorSmearing[nErrors*iXS+iError]; } else { thisXSset[iXS] += lowerRelError[iXS][iError]*thisXSset[iXS]*thisErrorSmearing[nErrors*iXS+iError]; } } } } toyXSset.push_back(thisXSset); } cout << "Calculated the toys, now calculate the covariance matrix..." << endl; for (int iXS = 0; iXS < nXS; iXS++) { // calculate E[iXS] double meanXSI = 0; for (int iToy = 0; iToy < nToys; iToy++) { meanXSI += toyXSset[iToy][iXS]; } meanXSI = meanXSI/(double)nToys; for (int jXS = 0; jXS < nXS; jXS++) { double meanXSJ = 0; double meanXSIJ = 0; for (int iToy = 0; iToy < nToys; iToy++) { meanXSJ += toyXSset[iToy][jXS]; meanXSIJ += toyXSset[iToy][jXS]*toyXSset[iToy][iXS]; } meanXSJ = meanXSJ/(double)nToys; meanXSIJ = meanXSIJ/(double)nToys; covarianceMatrixXS[iXS][jXS] = meanXSIJ - meanXSI*meanXSJ; } } cout << "#---------------------------------------------------------------"<< endl; cout << "Covariance matrix for the XS:\n" << endl; for (int iXS = 0; iXS < nXS; iXS++) { for (int jXS = 0; jXS < nXS; jXS++) { cout << " " << covarianceMatrixXS[iXS][jXS]; } cout << endl; } cout << "#---------------------------------------------------------------"<< endl; cout << "Covariance matrix for the XS with relative errors:" << endl; cout << "(to be used in HiggsSignals under the name XScov.in or XScovSM.in)\n" << endl; for (int iXS = 0; iXS < nXS; iXS++) { for (int jXS = 0; jXS < nXS; jXS++) { cout << " " << covarianceMatrixXS[iXS][jXS]/(centralValueXS[iXS]*centralValueXS[jXS]); } cout << endl; } cout << "\nCorrelation matrix for the XS:\n" << endl; for (int iXS = 0; iXS < nXS; iXS++) { for (int jXS = 0; jXS < nXS; jXS++) { cout << " " << covarianceMatrixXS[iXS][jXS]/ TMath::Sqrt(covarianceMatrixXS[iXS][iXS]*covarianceMatrixXS[jXS][jXS]); } cout << endl; } cout << "#---------------------------------------------------------------"<< endl; cout << "comparison quantities:" << endl; - cout << "relative error on sigma(ggH)/fb = " << + cout << "relative error on sigma(singleH)/fb = " << TMath::Sqrt(covarianceMatrixXS[0][0]/(centralValueXS[0]*centralValueXS[0])) << endl; cout << "relative error on sigma(VBF)/fb = " << TMath::Sqrt(covarianceMatrixXS[1][1]/(centralValueXS[1]*centralValueXS[1])) << endl; cout << "relative error on sigma(WH)/fb = " << TMath::Sqrt(covarianceMatrixXS[2][2]/(centralValueXS[2]*centralValueXS[2])) << endl; cout << "relative error on sigma(ZH)/fb = " << TMath::Sqrt(covarianceMatrixXS[3][3]/(centralValueXS[3]*centralValueXS[3])) << endl; cout << "relative error on sigma(ttH)/fb = " << TMath::Sqrt(covarianceMatrixXS[4][4]/(centralValueXS[4]*centralValueXS[4])) << endl; - + cout << "relative error on sigma(ggH)/fb = " << + TMath::Sqrt(covarianceMatrixXS[5][5]/(centralValueXS[5]*centralValueXS[5])) << endl; + cout << "relative error on sigma(bbH)/fb = " << + TMath::Sqrt(covarianceMatrixXS[6][6]/(centralValueXS[6]*centralValueXS[6])) << endl; + cout << "relative error on sigma(tH tchan)/fb = " << + TMath::Sqrt(covarianceMatrixXS[7][7]/(centralValueXS[7]*centralValueXS[7])) << endl; + cout << "relative error on sigma(tH schan)/fb = " << + TMath::Sqrt(covarianceMatrixXS[8][8]/(centralValueXS[8]*centralValueXS[8])) << endl; + cout << "relative error on sigma(qqZH)/fb = " << + TMath::Sqrt(covarianceMatrixXS[9][9]/(centralValueXS[9]*centralValueXS[9])) << endl; + cout << "relative error on sigma(ggZH)/fb = " << + TMath::Sqrt(covarianceMatrixXS[10][10]/(centralValueXS[10]*centralValueXS[10])) << endl; return; } Index: trunk/HiggsSignals-2/HiggsSignals_subroutines.F90 =================================================================== --- trunk/HiggsSignals-2/HiggsSignals_subroutines.F90 (revision 568) +++ trunk/HiggsSignals-2/HiggsSignals_subroutines.F90 (revision 569) @@ -1,2248 +1,2409 @@ !------------------------------------------------------------ ! This file is part of HiggsSignals (TS 03/03/2013). !------------------------------------------------------------ subroutine initialize_HiggsSignals_latestresults(nHiggsneut,nHiggsplus) !------------------------------------------------------------ ! Wrapper subroutine to intitialize HiggsSignals with the experimental ! dataset "latestresults", avoiding to specify this via a string argument. !------------------------------------------------------------ implicit none !--------------------------------------input integer,intent(in) :: nHiggsneut integer,intent(in) :: nHiggsplus character(LEN=13) :: Expt_string Expt_string = "latestresults" call initialize_HiggsSignals(nHiggsneut,nHiggsplus,Expt_string) end subroutine initialize_HiggsSignals_latestresults !------------------------------------------------------------ subroutine initialize_HiggsSignals_LHC13(nHiggsneut,nHiggsplus) !------------------------------------------------------------ ! Wrapper subroutine to intitialize HiggsSignals with the experimental ! dataset "latestresults", avoiding to specify this via a string argument. !------------------------------------------------------------ implicit none !--------------------------------------input integer,intent(in) :: nHiggsneut integer,intent(in) :: nHiggsplus character(LEN=13) :: Expt_string Expt_string = "LHC13" call initialize_HiggsSignals(nHiggsneut,nHiggsplus,Expt_string) end subroutine initialize_HiggsSignals_LHC13 !------------------------------------------------------------ subroutine initialize_HiggsSignals_empty(nHiggsneut,nHiggsplus) !------------------------------------------------------------ ! Wrapper subroutine to intitialize HiggsSignals without dataset. !------------------------------------------------------------ implicit none !--------------------------------------input integer,intent(in) :: nHiggsneut integer,intent(in) :: nHiggsplus character(LEN=13) :: Expt_string Expt_string = "none" call initialize_HiggsSignals(nHiggsneut,nHiggsplus,Expt_string) end subroutine initialize_HiggsSignals_empty !------------------------------------------------------------ subroutine initialize_HiggsSignals(nHiggsneut,nHiggsplus,Expt_string) !------------------------------------------------------------ ! This the first HiggsSignals subroutine that should be called ! by the user. ! It calls subroutines to read in the tables of Standard Model ! decay and production rates from HiggsBounds, sets up the ! experimental data from Tevatron and LHC, allocate arrays, etc. ! Arguments (input): ! * nHiggs = number of neutral Higgs in the model ! * nHiggsplus = number of singly, positively charged Higgs in the model ! * Expt_string = name of experimental dataset to be used !------------------------------------------------------------ use usefulbits, only : np,Hneut,Hplus,Chineut,Chiplus,debug,inputmethod,& & theo,whichanalyses,just_after_run,& & file_id_debug1,file_id_debug2,allocate_if_stats_required use usefulbits_HS, only : HiggsSignals_info, nanalys, eps, Exptdir, obs use datatables, only: setup_observables, setup_LHC_Run1_combination use STXS, only : load_STXS use input, only : check_number_of_particles,check_whichanalyses use io, only : setup_input_for_hs, setup_output_for_hs use theory_BRfunctions, only : setup_BRSM, BRSM use theory_XS_SM_functions, only : setup_XSSM, XSSM #if defined(NAGf90Fortran) use F90_UNIX_IO, only : flush #endif implicit none !--------------------------------------input integer,intent(in) :: nHiggsneut integer,intent(in) :: nHiggsplus character(LEN=*), intent(in) :: Expt_string !-----------------------------------internal integer :: i logical :: exptdirpresent = .False. !----------------------------------parameter eps=5.0D0 np(Hneut)=nHiggsneut np(Hplus)=nHiggsplus if(Expt_string.ne.'none') then Exptdir = Expt_string exptdirpresent = .True. endif np(Chineut)=0! not considering bounds on neutralinos here np(Chiplus)=0! not considering bounds on charginos here debug=.False. select case(whichanalyses) case('onlyL') whichanalyses='LandH' case('onlyH','onlyP','list ','LandH') case default whichanalyses='onlyH' end select call HiggsSignals_info if(inputmethod=='subrout') then if(allocated(theo))then if(debug) write(*,*) "HiggsBounds/HiggsSignals internal structure already initialized!" else if(debug)write(*,*)'doing other preliminary tasks...' ; call flush(6) call setup_input_for_hs ! allocate(inputsub( 2 )) !(1)np(Hneut)>0 (2)np(Hplus)>0 ! inputsub(1)%desc='HiggsBounds_neutral_input_*' ; inputsub(1)%req=req( 0, 1) ! inputsub(2)%desc='HiggsBounds_charged_input' ; inputsub(2)%req=req( 1, 0) ! ! do i=1,ubound(inputsub,dim=1) ! inputsub(i)%stat=0 ! enddo endif endif if(debug)write(*,*)'reading in Standard Model tables...' ; call flush(6) if(.not.allocated(BRSM)) call setup_BRSM if(.not.allocated(XSSM)) call setup_XSSM call setup_uncertainties if(debug)write(*,*)'reading in experimental data...' ; call flush(6) if(exptdirpresent) call setup_observables if(exptdirpresent) call load_STXS(Expt_string) call setup_LHC_Run1_combination if(debug)write(*,*)'sorting out processes to be checked...'; call flush(6) nanalys = size(obs) if(debug)write(*,*)'preparing output arrays...' ; call flush(6) call setup_output_for_hs if(debug)write(*,*)'HiggsSignals has been initialized...' ; call flush(6) just_after_run=.False. contains ! | np ! |Hneu Hcha ! | ==0 ==0 ! function req(Hneu,Hcha) ! integer, intent(in) ::Hneu,Hcha ! integer :: req ! ! req=1 ! if(np(Hneut)==0) req= Hneu * req ! if(np(Hplus)==0) req= Hcha * req ! ! end function req end subroutine initialize_HiggsSignals !------------------------------------------------------------ subroutine HiggsSignals_neutral_input_MassUncertainty(dMh) ! Sets the theoretical mass uncertainty of the Higgs bosons. !------------------------------------------------------------ use usefulbits, only: theo,np,Hneut implicit none double precision,intent(in) :: dMh(np(Hneut)) if(.not.allocated(theo))then stop 'subroutine HiggsSignals_initialize must be called first' endif if(np(Hneut).eq.0)then write(*,*)'subroutine HiggsSignal_neutral_input_MassUncertainty should' write(*,*)'only be called if np(Hneut)>0' stop 'error in subroutine HiggsSignal_neutral_input_MassUncertainty' endif theo(1)%particle(Hneut)%dM = dMh end subroutine HiggsSignals_neutral_input_MassUncertainty !------------------------------------------------------------ subroutine setup_uncertainties !------------------------------------------------------------ use usefulbits, only : file_id_common3 use store_pathname_hs, only : pathname_HS use usefulbits_hs, only : delta_rate use io, only : read_matrix_from_file logical :: BRmodel, BRSM, XSmodel, XSSM call read_matrix_from_file(9,pathname_HS//"BRcov.in",delta_rate%BRcov, BRmodel) call read_matrix_from_file(9,pathname_HS//"BRcovSM.in",delta_rate%BRcovSM, BRSM) call read_matrix_from_file(5,pathname_HS//"XScov.in",delta_rate%CScov, XSmodel) call read_matrix_from_file(5,pathname_HS//"XScovSM.in",delta_rate%CScovSM, XSSM) call read_matrix_from_file(5,pathname_HS//"XScov_13TeV.in",delta_rate%CS13cov, XSmodel) call read_matrix_from_file(5,pathname_HS//"XScovSM_13TeV.in",delta_rate%CS13covSM, XSSM) if(BRmodel.and.BRSM) then delta_rate%BRcov_ok=.True. write(*,*) "Covariance matrix for relative branching ratio uncertainties read in successfully." else write(*,*) "Covariance matrix for relative branching ratio uncertainties not provided. Using default values." endif if(XSmodel.and.XSSM) then delta_rate%CScov_ok=.True. write(*,*) "Covariance matrix for relative cross section uncertainties read in successfully." else write(*,*) "Covariance matrix for relative cross section uncertainties not provided. Using default values." endif end subroutine setup_uncertainties !------------------------------------------------------------ subroutine setup_model_rate_uncertainties(filename_XS, filename_XS13, filename_BR) !------------------------------------------------------------ use usefulbits, only : file_id_common3 use store_pathname_hs, only : pathname_HS use usefulbits_hs, only : delta_rate use io, only : read_matrix_from_file character(LEN=*),intent(in) :: filename_XS, filename_XS13, filename_BR logical :: BRmodel, XSmodel call read_matrix_from_file(9,filename_BR,delta_rate%BRcov, BRmodel) call read_matrix_from_file(5,filename_XS,delta_rate%CScov, XSmodel) call read_matrix_from_file(5,filename_XS13,delta_rate%CS13cov, XSmodel) if(BRmodel.and.XSmodel) then delta_rate%BRcov_ok=.True. delta_rate%CScov_ok=.True. write(*,*) "Covariance matrices for rate uncertainties read in successfully." else write(*,*) "Covariance matrix for rate uncertainties not provided. Using default values." endif end subroutine setup_model_rate_uncertainties !------------------------------------------------------------ subroutine setup_rate_uncertainties( dCS, dBR ) !------------------------------------------------------------ ! Sets (relative) systematic uncertainties of the model for: ! dCS(1) - singleH dBR(1) - gamma gamma ! dCS(2) - VBF dBR(2) - W W ! dCS(3) - HW dBR(3) - Z Z ! dCS(4) - HZ dBR(4) - tau tau ! dCS(5) - ttH dBR(5) - b bbar !------------------------------------------------------------ use usefulbits_hs, only : delta_rate implicit none double precision, intent(in) :: dCS(5) double precision, intent(in) :: dBR(5) integer :: i delta_rate%dCS = dCS do i=lbound(dBR,dim=1),ubound(dBR,dim=1) call setup_dbr(i,dBR(i)) enddo end subroutine setup_rate_uncertainties !------------------------------------------------------------ subroutine setup_dbr(BRid, value) !------------------------------------------------------------ use usefulbits_hs, only : delta_rate integer,intent(in) :: BRid double precision, intent(in) :: value if(BRid.gt.0.and.BRid.lt.10) then delta_rate%dBR(BRid) = value else write(*,*) "Warning in setup_dbr: Unknown decay mode." endif end subroutine setup_dbr !------------------------------------------------------------ subroutine setup_correlations(corr_mu, corr_mh) !------------------------------------------------------------ ! With this subroutine the user may switch off/on correlations ! (default=on) by setting corr = 0/1. !------------------------------------------------------------ use usefulbits_hs, only : correlations_mu, correlations_mh implicit none integer, intent(in) :: corr_mu, corr_mh if(corr_mu.eq.0) then correlations_mu = .False. write(*,*) 'Correlations in signal strength observables are switched off.' elseif(corr_mu.eq.1) then correlations_mu = .True. else stop 'Error: Correlations must be switched on/off by an integer value of 0 or 1.' endif if(corr_mh.eq.0) then correlations_mh = .False. write(*,*) 'Correlations in Higgs mass observables are switched off.' elseif(corr_mh.eq.1) then correlations_mh = .True. else stop 'Error: Correlations must be switched on/off by an integer value of 0 or 1.' endif end subroutine setup_correlations !------------------------------------------------------------ subroutine setup_symmetricerrors(symm) ! Sets the measured rate uncertainties to either a symmetrical average ! of the upper and lower cyan band widths (symm==1) or else uses the ! original (asymmetrical) errors. !------------------------------------------------------------ use usefulbits_hs, only : symmetricerrors implicit none integer, intent(in) :: symm if(symm.eq.1) then write(*,*) "Using averaged (symmetrical) experimental rate uncertainties." symmetricerrors = .True. else write(*,*) "Using original (asymmetrical) experimental rate uncertainties." symmetricerrors = .False. endif end subroutine setup_symmetricerrors !------------------------------------------------------------ subroutine setup_absolute_errors(absol) ! Treats the measured rate uncertainties as either absolute ! uncertainties (1) or relative (0). By default, they are ! treated as relative uncertainties. !------------------------------------------------------------ use usefulbits_hs, only : absolute_errors implicit none integer, intent(in) :: absol if(absol.eq.1) then write(*,*) "Using absolute experimental rate uncertainties." absolute_errors = .True. else write(*,*) "Using relative experimental rate uncertainties." absolute_errors = .False. endif end subroutine setup_absolute_errors !------------------------------------------------------------ subroutine setup_correlated_rate_uncertainties(corr) !------------------------------------------------------------ use usefulbits_hs, only : delta_rate integer, intent(in) :: corr if(corr.eq.0) then delta_rate%usecov = .False. write(*,*) "Deactivated correlated CS and BR uncertainties. Using approximated maximum error." elseif(corr.eq.1) then delta_rate%usecov = .True. write(*,*) "Activated correlated CS and BR uncertainties. Using them if covariance matrices are present." else write(*,*) "Warning in subroutine setup_correlated_rate_uncertainties: Argument ",corr," is not equal to 0 or 1." endif end subroutine setup_correlated_rate_uncertainties !------------------------------------------------------------ subroutine setup_SMweights(useweight) ! If set to 1 (true), HiggsSignals assumes the same signal decomposition ! (weights) as in the SM for the given model. This will enter the determination ! of the theoretical rate uncertainty. !------------------------------------------------------------ use usefulbits_hs, only : useSMweights implicit none integer, intent(in) :: useweight if(useweight.eq.1) then write(*,*) "Using SM weights for theoretical rate uncertainties of the model." useSMweights = .True. else write(*,*) "Using true model weights for theoretical rate uncertainties of the model." useSMweights = .False. endif end subroutine setup_SMweights !------------------------------------------------------------ subroutine setup_anticorrelations_in_mu(acorr) ! Allows for anti-correlations in the signal strength covariance ! matrix if there is a relative sign difference in two mu measurements ! (acorr==1) or else uses only correlations irrespective of the relative ! (acorr==0). !------------------------------------------------------------ use usefulbits_hs, only : anticorrmu implicit none integer, intent(in) :: acorr if(acorr.eq.1) then write(*,*) "Allow anti-correlated signal strength measurements." anticorrmu = .True. else write(*,*) "Prohibit anti-correlated signal strength measurements." anticorrmu = .False. endif end subroutine setup_anticorrelations_in_mu !------------------------------------------------------------ subroutine setup_anticorrelations_in_mh(acorr) ! Allows for anti-correlations in the mass covariance ! matrix if there is a relative sign difference in two mu measurements ! (acorr==1) or else uses only correlations irrespective of the relative ! (acorr==0). !------------------------------------------------------------ use usefulbits_hs, only : anticorrmh implicit none integer, intent(in) :: acorr if(acorr.eq.1) then write(*,*) "Allow anti-correlated mass measurements." anticorrmh = .True. else write(*,*) "Prohibit anti-correlated mass measurements." anticorrmh = .False. endif end subroutine setup_anticorrelations_in_mh !------------------------------------------------------------ subroutine setup_assignmentrange(range) !------------------------------------------------------------ ! This sets up the mass range (in standard deviations) in which ! the Higgs is forced to be assigned to the peak observables. !------------------------------------------------------------ use usefulbits_hs, only : assignmentrange,assignmentrange_massobs, pdf implicit none double precision, intent(in) :: range if(range.le.0.0D0) then write(*,*) "Error: Bad assignment range ",range write(*,*) "Keeping the value ",assignmentrange else assignmentrange = range assignmentrange_massobs = range endif if(assignmentrange.ne.1.0D0.and.pdf.eq.1) then write(*,*) "Note: For a box pdf, only 1s mass range is used to force the Higgs-to-peak assignment." endif end subroutine setup_assignmentrange !------------------------------------------------------------ subroutine setup_assignmentrange_LHCrun1(range) !------------------------------------------------------------ ! This sets up the mass range (in standard deviations) in which ! the Higgs is forced to be assigned to the peak observables. !------------------------------------------------------------ use usefulbits_hs, only : assignmentrange_LHCrun1, pdf implicit none double precision, intent(in) :: range if(range.le.0.0D0) then write(*,*) "Error: Bad assignment range ",range write(*,*) "Keeping the value ",assignmentrange_LHCrun1 else assignmentrange_LHCrun1 = range endif ! if(assignmentrange_LHCrun1.ne.1.0D0.and.pdf.eq.1) then ! write(*,*) "Note: For a box pdf, only 1s mass range is used to force the Higgs-to-peak assignment." ! endif end subroutine setup_assignmentrange_LHCrun1 !------------------------------------------------------------ subroutine setup_assignmentrange_massobservables(range) !------------------------------------------------------------ ! This sets up the mass range (in standard deviations) in which ! the Higgs is forced to be assigned to the peak observables. !------------------------------------------------------------ use usefulbits_hs, only : assignmentrange_massobs, pdf implicit none double precision, intent(in) :: range if(range.le.0.0D0) then write(*,*) "Error: Bad assignment range ",range write(*,*) "Keeping the value ",assignmentrange_massobs else assignmentrange_massobs = range endif if(assignmentrange_massobs.ne.1.0D0.and.pdf.eq.1) then write(*,*) "Note: For a box pdf, only 1s mass range is used to force the Higgs-to-peak assignment." endif end subroutine setup_assignmentrange_massobservables !------------------------------------------------------------ subroutine setup_nparam(Np) !------------------------------------------------------------ use usefulbits_hs, only : Nparam implicit none integer, intent(in) :: Np Nparam = Np end subroutine setup_nparam !------------------------------------------------------------ subroutine setup_Higgs_to_peaks_assignment_iterations(iter) ! Sets the number of iterations for the Higgs-to-peak-assignment. !------------------------------------------------------------ use usefulbits_hs, only : iterations implicit none integer, intent(in) :: iter iterations = iter end subroutine setup_Higgs_to_peaks_assignment_iterations !------------------------------------------------------------ subroutine setup_mcmethod_dm_theory(mode) use mc_chisq, only : mc_mode implicit none integer, intent(in) :: mode character(LEN=14) :: mode_desc(2) = (/'mass variation','convolution '/) if(mode.eq.1.or.mode.eq.2) then mc_mode = mode write(*,'(1X,A,A)') 'The mass-centered chi^2 method will treat the Higgs',& & ' boson mass theory uncertainty by '//trim(mode_desc(mode))//'.' else stop 'Error in subroutine setup_mcmethod_dm_theory: Unknown mode (1 or 2 possible)!' endif end subroutine setup_mcmethod_dm_theory !------------------------------------------------------------ subroutine setup_sm_test(int_SMtest,epsilon) ! With this subroutine the user may switch off the SM likeness test ! (default=on) or change the maximal deviation epsilon (default=5.0D-2) !------------------------------------------------------------ use usefulbits_hs, only : useSMtest, eps implicit none integer, intent(in) :: int_SMtest double precision, intent(in) :: epsilon if(int_SMtest.eq.0) then useSMtest = .False. write(*,*) 'SM likeness test has been switched off.' elseif(int_SMtest.eq.1) then useSMtest = .True. write(*,*) 'SM likeness test has been switched on.' else stop 'Error: SM test must be switched on/off by an integer value of 0 or 1.' endif eps = epsilon end subroutine setup_sm_test !------------------------------------------------------------ subroutine setup_thu_observables(thuobs) use usefulbits_hs, only : THU_included integer, intent(in) :: thuobs if(thuobs.eq.0) then THU_included = .False. write(*,*) 'Observables are assumed to NOT include theory errors.' else THU_included = .True. write(*,*) 'Observables are assumed to include theory errors.' endif end subroutine setup_thu_observables !------------------------------------------------------------ subroutine setup_output_level(level) ! Controls the level of information output: ! 0 : silent mode ! 1 : screen output for each analysis with its peak/mass-centered observables and ! their respective values predicted by the model ! 2 : screen output of detailed information on each analysis with its ! peak/mass-centered observables ! 3 : creates the files peak_information.txt and peak_massesandrates.txt !------------------------------------------------------------ use usefulbits_hs, only : output_level, additional_output implicit none integer, intent(in) :: level if(level.eq.0.or.level.eq.1.or.level.eq.2.or.level.eq.3) then output_level = level else stop 'Error in subroutine setup_output_level: level not equal to 0,1,2 or 3.' endif if(level.eq.3) additional_output = .True. end subroutine setup_output_level !------------------------------------------------------------ subroutine setup_pdf(pdf_in) ! Sets the probability density function for the Higgs mass uncertainty parametrization: ! 1 : box-shaped pdf ! 2 : Gaussian pdf ! 3 : box-shaped theory error + Gaussian experimental pdf !------------------------------------------------------------ use usefulbits_hs, only : pdf, assignmentrange implicit none integer, intent(in) :: pdf_in character(LEN=13) :: pdf_desc(3) = (/'box ','Gaussian ','box+Gaussian'/) pdf=pdf_in if((pdf.eq.1).or.(pdf.eq.2).or.(pdf.eq.3)) then write(*,'(1X,A,A,1I1,A)') 'Use a '//trim(pdf_desc(pdf))//' probability density function ',& & 'for the Higgs mass(es) (pdf=',pdf,')' endif if(assignmentrange.ne.1.0D0.and.pdf.eq.1) then write(*,*) "Note: For a box pdf, only 1s mass range is used to force the Higgs-to-peak assignment." endif end subroutine setup_pdf !------------------------------------------------------------ !subroutine assign_toyvalues_to_observables(ii, peakindex, npeaks, mu_obs, mh_obs) !! Assigns toy values to the peak's mass and mu value for analysis ii. !! ii :: analysis number (entry in mutables) !! peakindex :: index of the peak of analysis ii !! npeaks :: number of peaks found in analysis ii !! mu_obs :: toy value for mu to be given to the peak with peakindex !! mh_obs :: toy value for mh to be given to the peak with peakindex !------------------------------------------------------------ ! use usefulbits_hs, only: obs, usetoys ! ! integer, intent(in) :: ii, peakindex, npeaks ! double precision, intent(in) :: mh_obs, mu_obs ! ! if(peakindex.gt.npeaks) then ! stop 'Error in subroutine assign_toyvalues_to_observables: Observable does not exist!' ! endif ! ! obs(ii)%table%npeaks = npeaks ! if(.not.allocated(obs(ii)%table%Toys_muobs)) allocate(obs(ii)%table%Toys_muobs(npeaks)) ! if(.not.allocated(obs(ii)%table%Toys_mhobs)) allocate(obs(ii)%table%Toys_mhobs(npeaks)) ! ! obs(ii)%table%Toys_muobs(peakindex) = mu_obs ! obs(ii)%table%Toys_mhobs(peakindex) = mh_obs ! ! usetoys = .True. ! !end subroutine assign_toyvalues_to_observables !------------------------------------------------------------ subroutine assign_toyvalues_to_peak(ID, mu_obs, mh_obs) ! Assigns toy values to the peak's mass and mu value to a peak observable. ! ID :: observable ID ! mu_obs :: toy value for mu to be given to the peak ! mh_obs :: toy value for mh to be given to the peak ! ! n.B.: Do we also want to set mu uncertainties here? !------------------------------------------------------------ use usefulbits_hs, only: obs, usetoys implicit none integer, intent(in) :: ID double precision, intent(in) :: mh_obs, mu_obs integer :: pos, ii pos = -1 do ii=lbound(obs,dim=1),ubound(obs,dim=1) if(obs(ii)%id.eq.ID) then pos = ii exit endif enddo if(pos.ne.-1) then obs(pos)%peak%mpeak = mh_obs obs(pos)%peak%mu = mu_obs usetoys = .True. else write(*,*) "WARNING in assign_toyvalues_to_peak: ID unknown." endif end subroutine assign_toyvalues_to_peak !------------------------------------------------------------ subroutine assign_modelefficiencies_to_peak(ID, Nc, eff_ratios) ! Assigns to each channel of the observable the efficiency in the model ! w.r.t the SM efficiency (as a ratio!) ! ! ID :: observable ID ! Nc :: number of channels ! eff_ratios :: array of length (Number of channels) giving the efficiency ratios ! ! Note: You can first employ the subroutine get_peak_channels (io module) to obtain ! the relevant channel information of the observable. !------------------------------------------------------------ use usefulbits_hs, only: obs implicit none integer, intent(in) :: ID, Nc double precision, dimension(Nc), intent(in) :: eff_ratios integer :: pos, ii pos = -1 do ii=lbound(obs,dim=1),ubound(obs,dim=1) if(obs(ii)%id.eq.ID) then pos = ii exit endif enddo if(pos.ne.-1) then if(size(eff_ratios,dim=1).ne.obs(pos)%table%Nc) then write(*,*) "WARNING in assign modelefficiencies_to_peak: Number of channels (",& & size(eff_ratios,dim=1),"!=",obs(pos)%table%Nc,"does not match for observable ID = ",ID else obs(pos)%table%channel_eff_ratios = eff_ratios endif else write(*,*) "WARNING in assign_modelefficiencies_to_peak: ID unknown." endif end subroutine assign_modelefficiencies_to_peak !------------------------------------------------------------ subroutine assign_rate_uncertainty_scalefactor_to_peak(ID, scale_mu) ! Assigns a rate uncertainty scalefactor to the peak specified by ID. ! This scalefactor will only scale the experimental rate uncertainties. ! The theory rate uncertainties must be given manually via setup_rate_uncertainties. ! ! ID :: observable ID of the peak observable ! scale_mu :: scale_mu by which the mu uncertainty is scaled !------------------------------------------------------------ use usefulbits_hs, only: obs, usescalefactor implicit none integer, intent(in) :: ID double precision, intent(in) :: scale_mu integer :: pos, ii pos = -1 do ii=lbound(obs,dim=1),ubound(obs,dim=1) if(obs(ii)%id.eq.ID) then pos = ii exit endif enddo if(pos.ne.-1) then obs(pos)%peak%scale_mu = scale_mu else write(*,*) "WARNING in assign_uncertainty_scalefactors_to_peak: ID unknown." endif usescalefactor = .True. end subroutine assign_rate_uncertainty_scalefactor_to_peak !------------------------------------------------------------ subroutine run_HiggsSignals_LHC_Run1_combination(Chisq_mu, Chisq_mh, Chisq, nobs, Pvalue) use usefulbits, only : theo,just_after_run, ndat use theo_manip, only : HB5_complete_theo use usefulbits_HS, only : HSres, output_level, Nparam implicit none !----------------------------------------output integer,intent(out) :: nobs double precision,intent(out) :: Pvalue, Chisq, Chisq_mu, Chisq_mh !-------------------------------------internal integer :: n,i, nobs_mu, nobs_mh logical :: debug=.False. !--------------------------------------------- if(.not.allocated(theo))then stop 'subroutine HiggsSignals_initialize must be called first' endif call HB5_complete_theo do n=1,ndat call evaluate_LHC_Run1_combination(theo(n),n) Pvalue = HSres(n)%Pvalue_LHCRun1 Chisq = HSres(n)%Chisq_LHCRun1 Chisq_mu = HSres(n)%Chisq_LHCRun1_mu Chisq_mh = HSres(n)%Chisq_LHCRun1_mh nobs_mu = HSres(n)%nobs_LHCRun1_mu nobs_mh = HSres(n)%nobs_LHCRun1_mh nobs = nobs_mu+nobs_mh if(output_level.ne.0) then write(*,*) write(*,*) '#*************************************************************************#' write(*,*) '# HIGGSSIGNALS RESULTS (LHC ATLAS + CMS Run1 combination) #' write(*,*) '#*************************************************************************#' write(*,'(A55,F21.8)') 'chi^2 from signal rate observables = ',Chisq_mu write(*,'(A55,F21.8)') 'chi^2 from Higgs mass observables = ',Chisq_mh write(*,'(A55,F21.8)') 'chi^2 (total) = ',Chisq write(*,'(A55,I21)') 'Number of rate observables = ', nobs_mu write(*,'(A55,I21)') 'Number of mass observables = ', nobs_mh write(*,'(A55,I21)') 'Number of observables (total) = ', nobs write(*,'(A48,I3,A4,F21.8)') 'Probability (ndf =',nobs-Nparam,') = ', Pvalue write(*,*) '#*************************************************************************#' write(*,*) endif enddo just_after_run=.True. end subroutine run_HiggsSignals_LHC_Run1_combination !------------------------------------------------------------ subroutine setup_LHC_combination_run1_SMXS_from_paper(useSMXS_from_paper) !------------------------------------------------------------ use usefulbits_hs, only : LHC_combination_run1_SMXS_from_paper implicit none logical, intent(in) :: useSMXS_from_paper if(useSMXS_from_paper) then write(*,*) "Using SM cross sections from Tab.1 of arXiv:1606.02266 for LHC Run 1 combination chi^2 test." else write(*,*) "Using internal SM cross sections for LHC Run 1 combination chi^2 test." endif LHC_combination_run1_SMXS_from_paper = useSMXS_from_paper end subroutine setup_LHC_combination_run1_SMXS_from_paper !------------------------------------------------------------ subroutine evaluate_LHC_Run1_combination( t , n ) !------------------------------------------------------------ ! !------------------------------------------------------------ use usefulbits, only : np,Hneut,Hplus,dataset,results, vsmall use usefulbits_hs, only : HSresults, output_level, Nparam, & & LHCrun1_rates, LHCrun1_correlationmatrix, useaveragemass, & -& assignmentrange_LHCrun1, HSres, normalize_rates_to_reference_position +& assignmentrange_LHCrun1, HSres, normalize_rates_to_reference_position, & +& normalize_rates_to_reference_position_outside_dmtheo use pc_chisq, only : csq_mh use numerics, only : invmatrix, matmult, gammp implicit none !--------------------------------------input type(dataset), intent(in) :: t integer, intent(in) :: n !--------------------------------------output ! type(HSresults), intent(inout) :: r !--------------------------------------internal integer :: p, d, id, i, j, k, ncomb double precision, allocatable :: covmat(:,:), invcovmat(:,:) double precision, allocatable :: covmatzero(:,:), invcovmatzero(:,:) double precision, dimension(20) :: v, v2, csq_mu, vzero, vzero2, csq_mu_max double precision, dimension(20,1) :: vmat, vzeromat double precision :: mobs = 125.09D0 double precision :: dmobs = 0.237D0 double precision :: Higgs_signal_k double precision :: num1, num2, dnum1, dnum2, denom1, denom2, mav, dmav allocate(covmat(20,20),invcovmat(20,20)) allocate(covmatzero(20,20),invcovmatzero(20,20)) mav =0.0D0 dmav = 0.0D0 denom1 = 0.0D0 denom2 = 0.0D0 num1 = 0.0D0 num2 = 0.0D0 dnum1 = 0.0D0 dnum2 = 0.0D0 do i=lbound(LHCrun1_rates,dim=1),ubound(LHCrun1_rates,dim=1) id = LHCrun1_rates(i)%channel_id p = int((id-modulo(id,10))/dble(10)) d = modulo(id,10) LHCrun1_rates(i)%r_pred = 0.0D0 ncomb = 0 do k=1,np(Hneut) if(abs(t%particle(Hneut)%M(k)-mobs).le.& & abs(assignmentrange_LHCrun1*dmobs + t%particle(Hneut)%dM(k)) ) then - Higgs_signal_k = signalrate(k,p,d) + Higgs_signal_k = signalrate(k,p,d,mobs,t%particle(Hneut)%M(k),t%particle(Hneut)%dM(k)) LHCrun1_rates(i)%r_pred = LHCrun1_rates(i)%r_pred + Higgs_signal_k if(id.eq.11) then ! gg -> h_k -> gaga weighted mass average num1 = num1 + Higgs_signal_k * t%particle(Hneut)%M(k) dnum1 = dnum1 + Higgs_signal_k * t%particle(Hneut)%dM(k) else if(id.eq.13) then ! gg -> h_k -> ZZ -> 4l weighted mass average num2 = num2 + Higgs_signal_k * t%particle(Hneut)%M(k) dnum2 = dnum2 + Higgs_signal_k * t%particle(Hneut)%dM(k) endif ncomb = ncomb+1 endif enddo if(id.eq.11) then denom1 = LHCrun1_rates(i)%r_pred else if(id.eq.13) then denom2 = LHCrun1_rates(i)%r_pred endif if(LHCrun1_rates(i)%r_pred.gt.LHCrun1_rates(i)%r) then LHCrun1_rates(i)%dr = LHCrun1_rates(i)%dr_up else LHCrun1_rates(i)%dr = LHCrun1_rates(i)%dr_low endif if(LHCrun1_rates(i)%r.lt.0.0D0) then LHCrun1_rates(i)%dr0 = LHCrun1_rates(i)%dr_up else LHCrun1_rates(i)%dr0 = LHCrun1_rates(i)%dr_low endif v(i) = LHCrun1_rates(i)%r_pred - LHCrun1_rates(i)%r vmat(i,1) = v(i) vzero(i) = LHCrun1_rates(i)%r vzeromat(i,1) = vzero(i) ! write(*,'(2I3,3F10.5)') p, d, LHCrun1_rates(i)%r_pred, LHCrun1_rates(i)%r, LHCrun1_rates(i)%r/LHCrun1_rates(i)%r_pred enddo if(denom1.gt.vsmall.and.denom2.gt.vsmall) then mav = 0.5D0 * (num1/denom1 + num2/denom2) dmav = 0.5D0 * (dnum1/denom1 + dnum2/denom2) ! write(*,*) "Averaged mass is ",mav, " +- ",dmav ! else ! write(*,*) "denom1 and denom2 are ",denom1, denom2 endif do i=lbound(LHCrun1_rates,dim=1),ubound(LHCrun1_rates,dim=1) do j=lbound(LHCrun1_rates,dim=1),ubound(LHCrun1_rates,dim=1) covmat(i,j) = LHCrun1_correlationmatrix(i,j) * & & LHCrun1_rates(i)%dr * LHCrun1_rates(j)%dr covmatzero(i,j) = LHCrun1_correlationmatrix(i,j) * & & LHCrun1_rates(i)%dr0 * LHCrun1_rates(j)%dr0 enddo enddo call invmatrix(covmat, invcovmat) call matmult(invcovmat,vmat,v2,20,1) call invmatrix(covmatzero, invcovmatzero) call matmult(invcovmatzero,vzeromat,vzero2,20,1) do i=1, 20 csq_mu(i) = v(i)*v2(i) enddo do i=1, 20 csq_mu_max(i) = vzero(i)*vzero2(i) enddo if(mav.lt.vsmall) then HSres(n)%Chisq_LHCRun1_mh=0.0D0 else HSres(n)%Chisq_LHCRun1_mh=csq_mh(mav,mobs,dmav,dmobs) endif if((HSres(n)%Chisq_LHCRun1_mh+sum(csq_mu)).gt.sum(csq_mu_max)) then HSres(n)%Chisq_LHCRun1_mu=sum(csq_mu_max) HSres(n)%Chisq_LHCRun1_mh=0.0D0 else HSres(n)%Chisq_LHCRun1_mu=sum(csq_mu) endif HSres(n)%Chisq_LHCRun1= HSres(n)%Chisq_LHCRun1_mu + HSres(n)%Chisq_LHCRun1_mh HSres(n)%nobs_LHCRun1_mu=20 HSres(n)%nobs_LHCRun1_mh=1 if(HSres(n)%Chisq_LHCRun1.gt.vsmall.and.(HSres(n)%nobs_LHCRun1_mu+HSres(n)%nobs_LHCRun1_mh-Nparam).gt.0) then HSres(n)%Pvalue_LHCRun1=1 - gammp(dble(HSres(n)%nobs_LHCRun1_mu + HSres(n)%nobs_LHCRun1_mh-Nparam)/2,HSres(n)%Chisq_LHCRun1/2) endif deallocate(covmat,invcovmat) deallocate(covmatzero,invcovmatzero) contains !------------------------------------------------------------ - function signalrate(k,p,d) + function signalrate(k,p,d,mobs,m,dmtheo) !------------------------------------------------------------ use usefulbits_hs, only : LHC_combination_run1_SMXS_from_paper !--------------------------------------external functions double precision :: SMCS_lhc8_gg_H,SMCS_lhc8_bb_H,SMCS_lhc8_vbf_H, & & SMCS_lhc8_HW, SMCS_lhc8_HZ, SMCS_lhc8_ttH, SMBR_Hgamgam,SMBR_HWW, & & SMBR_HZZ, SMBR_Htautau, SMBR_Hbb, SMBR_HZgam, SMBR_Hcc, SMBR_Hmumu, & & SMBR_Hgg + double precision, intent(in) :: mobs, m, dmtheo integer, intent(in) :: k,p,d double precision :: signalrate, production_rate, decay_rate, mass double precision :: production_rate_scalefactor, decay_rate_scalefactor mass = t%particle(Hneut)%M(k) if(p.eq.1) then if(LHC_combination_run1_SMXS_from_paper) then production_rate= t%lhc8%XS_gg_hj_ratio(k) * 19.2D0 & & + t%lhc8%XS_bb_hj_ratio(k) * 0.203D0 else production_rate= t%lhc8%XS_gg_hj_ratio(k) * SMCS_lhc8_gg_H(mass) & & + t%lhc8%XS_bb_hj_ratio(k) * SMCS_lhc8_bb_H(mass) endif ! NOTE: Here we make a small error in the scalefactor. Correct would be to rescale ! the gg and bb contributions separately. production_rate_scalefactor = (SMCS_lhc8_gg_H(mobs)+SMCS_lhc8_bb_H(mobs))/& & (SMCS_lhc8_gg_H(mass)+SMCS_lhc8_bb_H(mass)) else if(p.eq.2) then if(LHC_combination_run1_SMXS_from_paper) then production_rate= t%lhc8%XS_vbf_ratio(k) * 1.58D0 else production_rate= t%lhc8%XS_vbf_ratio(k) * SMCS_lhc8_vbf_H(mass) endif production_rate_scalefactor = SMCS_lhc8_vbf_H(mobs)/SMCS_lhc8_vbf_H(mass) else if(p.eq.3) then if(LHC_combination_run1_SMXS_from_paper) then production_rate= t%lhc8%XS_hjW_ratio(k) * 0.703D0 else production_rate= t%lhc8%XS_hjW_ratio(k) * SMCS_lhc8_HW(mass) endif production_rate_scalefactor = SMCS_lhc8_HW(mobs)/SMCS_lhc8_HW(mass) else if(p.eq.4) then if(LHC_combination_run1_SMXS_from_paper) then production_rate= t%lhc8%XS_hjZ_ratio(k) * 0.446D0 else production_rate= t%lhc8%XS_hjZ_ratio(k) * SMCS_lhc8_HZ(mass) endif production_rate_scalefactor = SMCS_lhc8_HZ(mobs)/SMCS_lhc8_HZ(mass) else if(p.eq.5) then if(LHC_combination_run1_SMXS_from_paper) then production_rate= t%lhc8%XS_tthj_ratio(k) * 0.129D0 else production_rate= t%lhc8%XS_tthj_ratio(k) * SMCS_lhc8_ttH(mass) endif production_rate_scalefactor = SMCS_lhc8_ttH(mobs)/SMCS_lhc8_ttH(mass) endif if(d.eq.1) then decay_rate = t%BR_hjgaga(k) decay_rate_scalefactor = SMBR_Hgamgam(mobs)/SMBR_Hgamgam(mass) else if(d.eq.2) then decay_rate = t%BR_hjWW(k) decay_rate_scalefactor = SMBR_HWW(mobs)/SMBR_HWW(mass) else if(d.eq.3) then decay_rate = t%BR_hjZZ(k) decay_rate_scalefactor = SMBR_HZZ(mobs)/SMBR_HZZ(mass) else if(d.eq.4) then decay_rate = t%BR_hjtautau(k) decay_rate_scalefactor = SMBR_Htautau(mobs)/SMBR_Htautau(mass) else if(d.eq.5) then decay_rate = t%BR_hjbb(k) decay_rate_scalefactor = SMBR_Hbb(mobs)/SMBR_Hbb(mass) endif if(normalize_rates_to_reference_position) then signalrate = production_rate * decay_rate else signalrate = production_rate * production_rate_scalefactor * & & decay_rate * decay_rate_scalefactor endif + + if(normalize_rates_to_reference_position_outside_dmtheo) then + if(abs(mobs-m).ge.dmtheo) then + signalrate = production_rate * decay_rate + endif + endif + end function signalrate !------------------------------------------------------------ end subroutine evaluate_LHC_Run1_combination !------------------------------------------------------------ subroutine run_HiggsSignals_STXS(Chisq_STXS_rates, Chisq_STXS_mh, Chisq_STXS, nobs_STXS, Pvalue_STXS) !------------------------------------------------------------ use STXS, only : evaluate_model_for_STXS, get_chisq_from_STXS, & & get_number_of_STXS_observables, STXSlist use usefulbits, only : theo,just_after_run, ndat, vsmall use usefulbits_hs, only : HSres use theo_manip, only : HB5_complete_theo use numerics, only : gammp double precision, intent(out) :: Chisq_STXS_rates, Chisq_STXS_mh, Chisq_STXS, Pvalue_STXS integer, intent(out) :: nobs_STXS double precision :: Pvalue integer :: nobs_STXS_rates, nobs_STXS_mh, i, n call HB5_complete_theo Chisq_STXS_mh = 0.0D0 do n=1, ndat do i=lbound(STXSlist,dim=1), ubound(STXSlist,dim=1) call evaluate_model_for_STXS(STXSlist(i),theo(n)) enddo call get_chisq_from_STXS(Chisq_STXS_rates, Pvalue_STXS) call get_number_of_STXS_observables(nobs_STXS_rates, nobs_STXS_mh) nobs_STXS = nobs_STXS_rates + nobs_STXS_mh ! Add routine for possible mh-observable in STXS here! Chisq_STXS = Chisq_STXS_rates + Chisq_STXS_mh HSres(n)%Chisq_STXS_rates = Chisq_STXS_rates HSres(n)%Chisq_STXS_mh = Chisq_STXS_mh HSres(n)%Chisq_STXS = Chisq_STXS HSres(n)%nobs_STXS_rates = nobs_STXS_rates HSres(n)%nobs_STXS_mh = nobs_STXS_mh HSres(n)%nobs_STXS = nobs_STXS Pvalue = 1.0D0 if(Chisq_STXS.gt.vsmall.and.(nobs_STXS-Nparam).gt.0) then Pvalue = 1 - gammp(dble(nobs_STXS-Nparam)/2,Chisq_STXS/2) endif HSres(n)%Pvalue_STXS = Pvalue enddo end subroutine run_HiggsSignals_STXS !------------------------------------------------------------------------------------ subroutine run_HiggsSignals(mode, Chisq_mu, Chisq_mh, Chisq, nobs, Pvalue) !------------------------------------------------------------ ! This subroutine can be called by the user after HiggsSignals_initialize has been called. ! The input routines, where required, should be called before calling run_HiggsSignals. ! It takes theoretical predictions for a particular parameter point ! in the model and calls subroutines which compare these predictions ! to the experimental results. ! Arguments (output): ! * mode = 1,2 or 3 for peak-centered, mass-centered chi^2 method or both, respectively. ! * Chisq_mu = total chi^2 contribution from signal strength measurements ! * Chisq_mh = total chi^2 contribution from Higgs mass measurements ! * Chisq = total chi^2 value for the combination of the considered Higgs signals ! * nobs = total number of observables ! * Pvalue = total chi^2 probability for the agreement between model and data, ! assuming number of observables == number of degrees of freedom ! (see manual for more precise definitions)) !------------------------------------------------------------ use usefulbits, only : theo,just_after_run, inputmethod, ndat!inputsub, use usefulbits_HS, only : HSres, runmode, output_level, usescalefactor, Nparam,Exptdir use channels, only : check_channels use theo_manip, only : HB5_complete_theo!, HB5_recalculate_theo_for_datapoint #if defined(NAGf90Fortran) use F90_UNIX_IO, only : flush #endif implicit none integer,intent(in) :: mode !----------------------------------------output integer,intent(out) :: nobs double precision,intent(out) :: Pvalue, Chisq, Chisq_mu, Chisq_mh !-------------------------------------internal integer :: n,i logical :: debug=.False. !--------------------------------------------- if(mode.eq.1) then runmode="peak" else if(mode.eq.2) then ! runmode="mass" write(*,*) "Warning: The 'mass' method (runmode = 2) is no longer maintained." write(*,*) " The peak-centered chi^2 method will be used instead." runmode="peak" else if(mode.eq.3) then ! runmode="both" write(*,*) "Warning: The 'both' method (runmode = 3) is no longer maintained." write(*,*) " The peak-centered chi^2 method will be used instead." runmode="peak" else stop'Error in subroutine run_HiggsSignals: mode unknown' endif if(.not.allocated(theo))then stop 'subroutine HiggsSignals_initialize must be called first' endif ! if(inputmethod.eq.'subrout') then ! do i=1,ubound(inputsub,dim=1) ! if( inputsub(i)%req .ne. inputsub(i)%stat )then ! write(*,*) inputsub(i)%req, inputsub(i)%stat ! write(*,*)'subroutine '//trim(adjustl(inputsub(i)%desc)) ! write(*,*)'should be called once and only once before each call to' ! write(*,*)'subroutine run_HiggsSignals.' ! stop'error in subroutine run_HiggsSignals' ! endif ! TS: Have to work on this bit to make it run simultaneously with HiggsBounds. Now, ! commented out the =0 statement. HS thus has to be run before HB. ! inputsub(i)%stat=0!now we have used this input, set back to zero ! enddo ! endif if(debug)write(*,*)'manipulating input...' ; call flush(6) call HB5_complete_theo if(debug)write(*,*)'compare each model to the experimental data...' ; call flush(6) do n=1,ndat ! call recalculate_theo_for_datapoint(n) call evaluate_model(theo(n),n) Pvalue = HSres(n)%Pvalue_peak Chisq = HSres(n)%Chisq_peak Chisq_mu = HSres(n)%Chisq_peak_mu Chisq_mh = HSres(n)%Chisq_peak_mh nobs = HSres(n)%nobs_peak if(output_level.ne.0) then write(*,*) write(*,*) '#*************************************************************************#' write(*,*) '# HIGGSSIGNALS RESULTS (',trim(adjustl(Exptdir)),') #' write(*,*) '#*************************************************************************#' write(*,'(A55,F21.8)') 'chi^2 from signal strength peak observables = ',& & HSres(n)%Chisq_peak_mu write(*,'(A55,F21.8)') 'chi^2 from Higgs mass peak observables = ',HSres(n)%Chisq_mh ! write(*,'(A55,F21.8)') 'chi^2 from mass-centered observables = ',HSres(n)%Chisq_mpred write(*,'(A55,F21.8)') 'chi^2 from signal strength (total) = ',HSres(n)%Chisq_mu write(*,'(A55,F21.8)') 'chi^2 (total) = ',HSres(n)%Chisq write(*,'(A55,I21)') 'Number of signal strength peak observables = ',& & HSres(n)%nobs_peak_mu write(*,'(A55,I21)') 'Number of Higgs mass peak observables = ',HSres(n)%nobs_peak_mh ! write(*,'(A55,I21)') 'Number of mass-centered observables = ',HSres(n)%nobs_mpred write(*,'(A55,I21)') 'Number of observables (total) = ',HSres(n)%nobs write(*,'(A48,I3,A4,F21.8)') 'Probability (ndf =',HSres(n)%nobs-Nparam,') = ',HSres(n)%Pvalue write(*,*) '#*************************************************************************#' write(*,*) endif enddo just_after_run=.True. usescalefactor=.False. end subroutine run_HiggsSignals !------------------------------------------------------------ subroutine evaluate_model( t , n ) !------------------------------------------------------------ ! This subroutine evaluates the signal strength modifier for every Higgs boson and ! considered analysis. It fills a matrix neutHiggs(:,:) of type neutHiggs with dimensions ! (number(considered analyses),nH). !------------------------------------------------------------ use usefulbits, only : np,Hneut,Hplus,dataset,results, vsmall use usefulbits_hs, only : neutHiggses, nanalys, runmode, HSresults, cov, obs, analyses,& & cov_mhneut, iterations, deallocate_covariance_matrices, & & output_level, Nparam, nanalys use datatables, only : setup_tablelist, check_available_Higgses use pc_chisq use mc_chisq use all_chisq use numerics implicit none !--------------------------------------input type(dataset), intent(in) :: t integer, intent(in) :: n !-------------------------------------output ! type(HSresults), intent(out) :: r integer :: ii, jj, iii, jjj double precision :: totchisq, muchisq, mhchisq, mpchisq, mpredchisq integer :: nobs, Nmu, Nmh, Nmpred character(LEN=100), allocatable :: assignmentgroups(:) integer, allocatable :: assignmentgroups_domH(:) integer, allocatable :: assignmentgroups_Higgs_comb(:,:) allocate(assignmentgroups(nanalys),assignmentgroups_domH(nanalys)) allocate(assignmentgroups_Higgs_comb(nanalys,np(Hneut))) assignmentgroups = '' !---Initialize assignmentgroups arrays with default values do ii=lbound(assignmentgroups_domH,dim=1),ubound(assignmentgroups_domH,dim=1) assignmentgroups_domH(ii) = 0 assignmentgroups_Higgs_comb(ii,:) = 0 enddo !---First, evaluate the model predictions allocate(neutHiggses(nanalys,np(Hneut))) !-Loop over considered analyses do ii=lbound(neutHiggses,dim=1),ubound(neutHiggses,dim=1) !-Loop over the neutral Higgs bosons of the model do jj=lbound(neutHiggses,dim=2),ubound(neutHiggses,dim=2) !! write(*,*) "hello evaluate model:", ii, jj call calc_mupred(jj, t, obs(ii)%table, neutHiggses(ii,jj)) enddo if(.not.allocated(obs(ii)%Higgses)) allocate(obs(ii)%Higgses(np(Hneut))) obs(ii)%Higgses(:) = neutHiggses(ii,:) enddo !-Pass the observables and their predicted Higgs properties (obs%Higgses) !-to the tablelist "analyses" call setup_tablelist ! select case(runmode) ! ! case('peak') !-Peak-centered chisq method jjj=0 do ii=lbound(analyses,dim=1),ubound(analyses,dim=1) call deallocate_covariance_matrices call assign_Higgs_to_peaks(analyses(ii)%table, analyses(ii)%peaks,0) do iii=lbound(analyses(ii)%peaks,dim=1),ubound(analyses(ii)%peaks,dim=1) if(analyses(ii)%table%mhchisq.eq.1.and.& & len(trim(adjustl(analyses(ii)%peaks(iii)%assignmentgroup))).ne.0) then jjj=jjj+1 assignmentgroups(jjj)=analyses(ii)%peaks(iii)%assignmentgroup assignmentgroups_Higgs_comb(jjj,:)=analyses(ii)%peaks(iii)%Higgs_comb assignmentgroups_domH(jjj)=analyses(ii)%peaks(iii)%domH !! write(*,*) "Found leader of group ",assignmentgroups(jjj) !! write(*,*) "ID ",analyses(ii)%peaks(iii)%id !! write(*,*) "with Higgs combination ",assignmentgroups_Higgs_comb(jjj,:) !! write(*,*) "and dominant Higgs boson ",assignmentgroups_domH(jjj) endif enddo enddo do ii=lbound(analyses,dim=1),ubound(analyses,dim=1) do iii=lbound(analyses(ii)%peaks,dim=1),ubound(analyses(ii)%peaks,dim=1) if(analyses(ii)%table%mhchisq.eq.0.and.& & len(trim(adjustl(analyses(ii)%peaks(iii)%assignmentgroup))).ne.0) then !SELECT ASSIGNMENT GROUP FOLLOWERS do jjj=lbound(assignmentgroups,dim=1),ubound(assignmentgroups,dim=1) if(analyses(ii)%peaks(iii)%assignmentgroup.eq.assignmentgroups(jjj)) then !TAKE OVER THE HIGGS ASSIGNMENT OF THE LEADING PEAK analyses(ii)%peaks(iii)%Higgs_comb=assignmentgroups_Higgs_comb(jjj,:) analyses(ii)%peaks(iii)%domH=assignmentgroups_domH(jjj) if(assignmentgroups_domH(jjj).ne.0) then analyses(ii)%peaks(iii)%Higgs_assignment_forced=1 endif call evaluate_peak(analyses(ii)%peaks(iii),analyses(ii)%table) endif enddo endif enddo enddo ! Do the iterative Higgs-to-peak-assignment here: call assign_Higgs_to_peaks_with_correlations(iterations) call calculate_total_pc_chisq(totchisq, muchisq, mhchisq, nobs, Nmu, Nmh) if(output_level.eq.1) call print_peakinformation if(output_level.eq.2) call print_peakinformation_essentials if(output_level.eq.3) then call print_peaks_to_file call print_peaks_signal_rates_to_file endif call add_peaks_to_HSresults(HSres(n)) HSres(n)%Chisq_peak=totchisq HSres(n)%Chisq_peak_mu = muchisq HSres(n)%Chisq_mpred = 0.0D0 HSres(n)%Chisq_peak_mu=muchisq HSres(n)%Chisq_peak_mh=mhchisq HSres(n)%nobs_mpred=0 HSres(n)%nobs_peak_mu=Nmu HSres(n)%nobs_peak_mh=Nmh HSres(n)%nanalysis=size(analyses) HSres(n)%nobs_peak=nobs if(HSres(n)%Chisq.gt.vsmall.and.(HSres(n)%nobs-Nparam).gt.0) then HSres(n)%Pvalue_peak = 1 - gammp(dble(HSres(n)%nobs-Nparam)/2,HSres(n)%Chisq/2) endif ! case('mass') ! do ii=lbound(analyses,dim=1),ubound(analyses,dim=1) ! call fill_mp_obs(ii) ! enddo ! if(mc_mode.eq.1) call mass_variation_by_theory_uncertainty ! call create_covariance_matrix_mp ! call calculate_mpred_chisq(mpchisq, nobs) ! ! if(output_level.eq.1) call print_mc_observables ! if(output_level.eq.2) call print_mc_observables_essentials ! if(output_level.eq.3) then ! call print_mc_tables_to_file ! call print_mc_observables_to_file ! endif ! ! HSres(n)%Chisq=mpchisq ! HSres(n)%Chisq_peak_mu = 0.0D0 ! HSres(n)%Chisq_mpred = mpchisq ! HSres(n)%Chisq_mu=mpchisq ! HSres(n)%Chisq_mh=0.0D0 ! HSres(n)%nobs_mpred=nobs ! HSres(n)%nobs_peak_mu=0 ! HSres(n)%nobs_peak_mh=0 ! HSres(n)%nanalysis=size(analyses) ! HSres(n)%nobs=nobs ! if(HSres(n)%Chisq.gt.vsmall.and.(HSres(n)%nobs-Nparam).gt.0) then ! HSres(n)%Pvalue=1 - gammp(dble(HSres(n)%nobs-Nparam)/2,HSres(n)%Chisq/2) ! endif ! ! case('both') ! jjj=0 ! do ii=lbound(analyses,dim=1),ubound(analyses,dim=1) ! call deallocate_covariance_matrices ! call assign_Higgs_to_peaks(analyses(ii)%table, analyses(ii)%peaks,0) ! do iii=lbound(analyses(ii)%peaks,dim=1),ubound(analyses(ii)%peaks,dim=1) ! if(analyses(ii)%table%mhchisq.eq.1.and.& ! & len(trim(analyses(ii)%peaks(iii)%assignmentgroup)).ne.0) then ! jjj=jjj+1 ! assignmentgroups(jjj)=analyses(ii)%peaks(iii)%assignmentgroup ! assignmentgroups_Higgs_comb(jjj,:)=analyses(ii)%peaks(iii)%Higgs_comb ! assignmentgroups_domH(jjj)=analyses(ii)%peaks(iii)%domH ! endif ! enddo ! enddo ! do ii=lbound(analyses,dim=1),ubound(analyses,dim=1) ! do iii=lbound(analyses(ii)%peaks,dim=1),ubound(analyses(ii)%peaks,dim=1) ! if(analyses(ii)%table%mhchisq.eq.0.and.& ! & len(trim(analyses(ii)%peaks(iii)%assignmentgroup)).ne.0) then ! do jjj=lbound(assignmentgroups,dim=1),ubound(assignmentgroups,dim=1) ! if(analyses(ii)%peaks(iii)%assignmentgroup.eq.assignmentgroups(jjj)) then ! !TAKE OVER THE HIGGS ASSIGNMENT OF THE LEADING PEAK ! analyses(ii)%peaks(iii)%Higgs_comb=assignmentgroups_Higgs_comb(jjj,:) ! analyses(ii)%peaks(iii)%domH=assignmentgroups_domH(jjj) ! if(assignmentgroups_domH(jjj).ne.0) then ! analyses(ii)%peaks(iii)%Higgs_assignment_forced=1 ! endif ! ! TODO: Need to evaluate everything else here! ! call evaluate_peak(analyses(ii)%peaks(iii),analyses(ii)%table) ! endif ! enddo ! endif ! enddo ! enddo ! ! call assign_Higgs_to_peaks_with_correlations(iterations) ! ! do ii=lbound(analyses,dim=1),ubound(analyses,dim=1) ! call check_available_Higgses(ii) ! call fill_mp_obs(ii) ! enddo ! if(mc_mode.eq.1) call mass_variation_by_theory_uncertainty ! ! call calculate_total_chisq(totchisq, muchisq, mhchisq, mpredchisq, nobs, Nmu, Nmh, Nmpred) ! ! !Have to write a new print method ! if(output_level.eq.1) call print_all_observables ! if(output_level.eq.2) call print_peakinformation_essentials ! if(output_level.eq.3) then ! call print_peaks_to_file ! call print_peaks_signal_rates_to_file ! endif ! ! call add_peaks_to_HSresults(r) ! ! HSres(n)%Chisq=totchisq ! HSres(n)%Chisq_peak_mu = muchisq ! HSres(n)%Chisq_mpred = mpredchisq ! HSres(n)%Chisq_mu=muchisq + mpredchisq ! HSres(n)%Chisq_mh=mhchisq ! HSres(n)%nobs_mpred=Nmpred ! HSres(n)%nobs_peak_mu=Nmu ! HSres(n)%nobs_peak_mh=Nmh ! HSres(n)%nanalysis=size(analyses) ! HSres(n)%nobs=nobs ! if(HSres(n)%Chisq.gt.vsmall.and.(HSres(n)%nobs-Nparam).gt.0) then ! HSres(n)%Pvalue=1 - gammp(dble(HSres(n)%nobs-Nparam)/2,HSres(n)%Chisq/2) ! endif ! ! case default ! stop "Error in subroutine evaluate_model: Please specify runmode!" ! ! end select deallocate(neutHiggses) deallocate(assignmentgroups, assignmentgroups_domH, assignmentgroups_Higgs_comb) end subroutine evaluate_model !------------------------------------------------------------ subroutine calc_mupred( j, t, mutab, Higgs ) ! Calculates the model-predicted signal strength modifier !------------------------------------------------------------ use usefulbits, only : dataset, div, vsmall use usefulbits_HS, only : neutHiggs, mutable, useSMtest, eps implicit none integer, intent(in) :: j ! Higgs index type(dataset), intent(in) :: t type(mutable), intent(inout) :: mutab type(neutHiggs), intent(inout) :: Higgs integer :: i double precision :: c, dcbyc integer :: testSMratios logical :: correct_properties Higgs%m = t%particle(mutab%particle_x)%M(j) Higgs%dm = t%particle(mutab%particle_x)%dM(j) Higgs%id = j call get_channelrates( j, t, mutab ) correct_properties=.True. !--Evaluate the predicted signal strength modifier c of the model c=0. do i=1,mutab%Nc !----use a weighted average of the channel rate ratios c=c+mutab%channel_w(i,j)*mutab%channel_mu(i,j) enddo !--Evaluate the deviation of each channel rate ratio to the signal !--strength modifier c and test SM likeness criterium, if this is !--activated. testSMratios= 1 !passes the SM-like ratios test do i=1,mutab%Nc dcbyc=div((mutab%channel_mu(i,j)-c),c,0.0D0,1.0D9) if(dcbyc*mutab%channel_w(i,j).gt.eps.and.useSMtest) then testSMratios= -1 !fails the SM-like ratios test endif enddo if(testSMratios.lt.0) correct_properties=.False. if(correct_properties) then Higgs%mu=c else Higgs%mu=0.0D0 endif end subroutine calc_mupred !------------------------------------------------------------ subroutine get_channelrates( j, t, mutab ) ! This subroutine assignes the rates, weights and systematic rate uncertainty of ! the Higgs boson (j) for the channels considered by the analysis (mutab). ! ! WARNING: if normalize_rates_to_reference_position is true ! The rates are normalized w.r.t. a reference rate at the (peak) mass position. ! This does not work with the mass-centered chi^2 method. ! Also, theoretical mass uncertainties are problematic! !------------------------------------------------------------ use usefulbits, only : dataset, div, small - use usefulbits_HS, only : neutHiggs, mutable, delta_rate, normalize_rates_to_reference_position + use usefulbits_HS, only : neutHiggs, mutable, delta_rate, normalize_rates_to_reference_position,& + & normalize_rates_to_reference_position_outside_dmtheo use theory_XS_SM_functions use theory_BRfunctions integer, intent(in) :: j type(dataset), intent(in) :: t type(mutable), intent(inout) :: mutab - integer :: i, id, p, d - integer :: ii, id1, id2, p1, p2, d1, d2 + integer :: i, p, d ! id + integer :: ii, p1, p2, d1, d2 !id1, id2 double precision :: rate, SMrate, modelrate, drsq_SM, drsq, dBR, dBRSM,drcov,drcovSM !!NEW: double precision :: rate_SMref,refmass,BR_SMref!,BR_SMref_mpeak if(size(mutab%mass,dim=1).eq.1) then refmass = mutab%mass(1) else ! write(*,*) "mutab%id", mutab%id, "Mass measurements: ",size(mutab%mass,dim=1) ! write(*,*) "mutab%particle_x = ", mutab%particle_x, " j= ", j refmass = t%particle(mutab%particle_x)%M(j) endif !write(*,*) 'DEBUG HS: id = ', mutab%id !write(*,*) 'DEBUG HS, m = ', t%particle(mutab%particle_x)%M(j) do i=1,mutab%Nc - id = mutab%channel_id(i) - p = int((id-modulo(id,10))/dble(10)) - d = modulo(id,10) - +! id = mutab%channel_id(i) +! p = int((id-modulo(id,10))/dble(10)) +! d = modulo(id,10) + p = mutab%channel_p_id(i) + d = mutab%channel_d_id(i) !--Do the production rate for the relevant experiment and cms-energy if(mutab%collider.eq.'LHC') then if(abs(mutab%energy-7.0D0).le.small) then if(p.eq.1) then rate=t%lhc7%XS_hj_ratio(j) SMrate=t%lhc7%XS_H_SM(j) rate_SMref=XS_lhc7_gg_H_SM(refmass) mutab%channel_description(i,1)='singleH' else if(p.eq.2) then rate=t%lhc7%XS_vbf_ratio(j) SMrate=t%lhc7%XS_vbf_SM(j) rate_SMref=XS_lhc7_vbf_SM(refmass) mutab%channel_description(i,1)='VBF' else if(p.eq.3) then rate=t%lhc7%XS_hjW_ratio(j) SMrate=t%lhc7%XS_HW_SM(j) rate_SMref=XS_lhc7_HW_SM(refmass) mutab%channel_description(i,1)='HW' else if(p.eq.4) then rate=t%lhc7%XS_hjZ_ratio(j) SMrate=t%lhc7%XS_HZ_SM(j) rate_SMref=XS_lhc7_HZ_SM(refmass) mutab%channel_description(i,1)='HZ' else if(p.eq.5) then rate=t%lhc7%XS_tthj_ratio(j) SMrate=t%lhc7%XS_ttH_SM(j) rate_SMref=XS_lhc7_ttH_SM(refmass) mutab%channel_description(i,1)='ttH' + else if(p.eq.6) then + rate=t%lhc7%XS_gg_hj_ratio(j) + SMrate=t%lhc7%XS_gg_H_SM(j) + rate_SMref=XS_lhc7_gg_H_SM(refmass) + mutab%channel_description(i,1)='ggH' + else if(p.eq.7) then + rate=t%lhc7%XS_bb_hj_ratio(j) + SMrate=t%lhc7%XS_bb_H_SM(j) + rate_SMref=XS_lhc7_bb_H_SM(refmass) + mutab%channel_description(i,1)='bbH' + else if(p.eq.8) then + rate=t%lhc7%XS_thj_tchan_ratio(j) + SMrate=t%lhc7%XS_tH_tchan_SM(j) + rate_SMref=XS_lhc7_tH_tchan_SM(refmass) + mutab%channel_description(i,1)='tH (t-channel)' + else if(p.eq.9) then + rate=t%lhc7%XS_thj_schan_ratio(j) + SMrate=t%lhc7%XS_tH_schan_SM(j) + rate_SMref=XS_lhc7_tH_schan_SM(refmass) + mutab%channel_description(i,1)='tH (s-channel)' + else if(p.eq.10) then + rate=t%lhc7%XS_qq_hjZ_ratio(j) + SMrate=t%lhc7%XS_qq_HZ_SM(j) + rate_SMref=XS_lhc7_HZ_SM(refmass) ! WARNING: This is still the inclusive rate!!! +! rate_SMref=XS_lhc7_qq_HZ_SM(refmass) !Need to create this function yet! + mutab%channel_description(i,1)='qq-HZ' + else if(p.eq.11) then + rate=t%lhc7%XS_gg_hjZ_ratio(j) + SMrate=t%lhc7%XS_gg_HZ_SM(j) + rate_SMref=XS_lhc7_HZ_SM(refmass) ! WARNING: This is still the inclusive rate!!! +! rate_SMref=XS_lhc7_gg_HZ_SM(refmass) !Need to create this function yet! + mutab%channel_description(i,1)='gg-HZ' else if(p.eq.0) then rate=1.0D0 SMrate=1.0D0 rate_SMref=1.0D0 mutab%channel_description(i,1)='none' endif else if(abs(mutab%energy-8.0D0).le.small) then if(p.eq.1) then rate=t%lhc8%XS_hj_ratio(j) SMrate=t%lhc8%XS_H_SM(j) rate_SMref=XS_lhc8_gg_H_SM(refmass) mutab%channel_description(i,1)='singleH' else if(p.eq.2) then rate=t%lhc8%XS_vbf_ratio(j) SMrate=t%lhc8%XS_vbf_SM(j) rate_SMref=XS_lhc8_vbf_SM(refmass) mutab%channel_description(i,1)='VBF' else if(p.eq.3) then rate=t%lhc8%XS_hjW_ratio(j) SMrate=t%lhc8%XS_HW_SM(j) rate_SMref=XS_lhc8_HW_SM(refmass) mutab%channel_description(i,1)='HW' else if(p.eq.4) then rate=t%lhc8%XS_hjZ_ratio(j) SMrate=t%lhc8%XS_HZ_SM(j) rate_SMref=XS_lhc8_HZ_SM(refmass) mutab%channel_description(i,1)='HZ' else if(p.eq.5) then rate=t%lhc8%XS_tthj_ratio(j) SMrate=t%lhc8%XS_ttH_SM(j) rate_SMref=XS_lhc8_ttH_SM(refmass) mutab%channel_description(i,1)='ttH' else if(p.eq.0) then rate=1.0D0 SMrate=1.0D0 rate_SMref=1.0D0 mutab%channel_description(i,1)='none' endif else if(abs(mutab%energy-13.0D0).le.small) then if(p.eq.1) then rate=t%lhc13%XS_hj_ratio(j) SMrate=t%lhc13%XS_H_SM(j) rate_SMref=XS_lhc13_gg_H_SM(refmass) mutab%channel_description(i,1)='singleH' else if(p.eq.2) then rate=t%lhc13%XS_vbf_ratio(j) SMrate=t%lhc13%XS_vbf_SM(j) rate_SMref=XS_lhc13_vbf_SM(refmass) mutab%channel_description(i,1)='VBF' else if(p.eq.3) then rate=t%lhc13%XS_hjW_ratio(j) SMrate=t%lhc13%XS_HW_SM(j) rate_SMref=XS_lhc13_HW_SM(refmass) mutab%channel_description(i,1)='HW' else if(p.eq.4) then rate=t%lhc13%XS_hjZ_ratio(j) SMrate=t%lhc13%XS_HZ_SM(j) rate_SMref=XS_lhc13_HZ_SM(refmass) mutab%channel_description(i,1)='HZ' else if(p.eq.5) then rate=t%lhc13%XS_tthj_ratio(j) SMrate=t%lhc13%XS_ttH_SM(j) rate_SMref=XS_lhc13_ttH_SM(refmass) mutab%channel_description(i,1)='ttH' else if(p.eq.0) then rate=1.0D0 SMrate=1.0D0 rate_SMref=1.0D0 mutab%channel_description(i,1)='none' endif endif else if(mutab%collider.eq.'TEV') then if(p.eq.1) then rate=t%tev%XS_hj_ratio(j) SMrate=t%tev%XS_H_SM(j) rate_SMref=XS_tev_gg_H_SM(refmass) mutab%channel_description(i,1)='singleH' else if(p.eq.2) then rate=t%tev%XS_vbf_ratio(j) SMrate=t%tev%XS_vbf_SM(j) rate_SMref=XS_tev_vbf_SM(refmass) mutab%channel_description(i,1)='VBF' else if(p.eq.3) then rate=t%tev%XS_hjW_ratio(j) SMrate=t%tev%XS_HW_SM(j) rate_SMref=XS_tev_HW_SM(refmass) mutab%channel_description(i,1)='HW' else if(p.eq.4) then rate=t%tev%XS_hjZ_ratio(j) SMrate=t%tev%XS_HZ_SM(j) rate_SMref=XS_tev_HZ_SM(refmass) mutab%channel_description(i,1)='HZ' else if(p.eq.5) then rate=t%tev%XS_tthj_ratio(j) SMrate=t%tev%XS_ttH_SM(j) rate_SMref=XS_tev_ttH_SM(refmass) mutab%channel_description(i,1)='ttH' else if(p.eq.0) then rate=1.0D0 SMrate=1.0D0 rate_SMref=1.0D0 mutab%channel_description(i,1)='none' endif else if(mutab%collider.eq.'ILC') then !--n.B.: As a first attempt, we use the LHC8 normalized cross sections for ZH, VBF, ttH. ! In order to do this properly, a separate input for the ILC cross sections ! has to be provided! It works only for single production mode observables (no ! correct weighting of channels included!)Then, at least in the effective coupling ! approximation, there is no difference to a full implementation. ! The theoretical uncertainty of the ILC production modes will are defined in ! usefulbits_HS.f90. if(p.eq.1.or.p.eq.2) then write(*,*) 'Warning: Unknown ILC production mode (',p,') in table ',mutab%id rate=0.0D0 SMrate=1.0D0 rate_SMref=1.0D0 mutab%channel_description(i,1)='unknown' else if(p.eq.3) then rate=t%lhc8%XS_hjW_ratio(j) SMrate=t%lhc8%XS_HW_SM(j) rate_SMref=XS_lhc8_HW_SM(refmass) mutab%channel_description(i,1)='WBF' else if(p.eq.4) then rate=t%lhc8%XS_hjZ_ratio(j) SMrate=t%lhc8%XS_HZ_SM(j) rate_SMref=XS_lhc8_HZ_SM(refmass) mutab%channel_description(i,1)='HZ' else if(p.eq.5) then rate=t%lhc8%XS_tthj_ratio(j) SMrate=t%lhc8%XS_ttH_SM(j) rate_SMref=XS_lhc8_ttH_SM(refmass) mutab%channel_description(i,1)='ttH' else if(p.eq.0) then rate=1.0D0 SMrate=1.0D0 rate_SMref=1.0D0 mutab%channel_description(i,1)='none' endif endif !--Multiply now by the decay rate if(d.eq.1) then rate=rate*div(t%BR_hjgaga(j),t%BR_Hgaga_SM(j),0.0D0,1.0D0) SMrate=SMrate*t%BR_Hgaga_SM(j) rate_SMref = rate_SMref*BRSM_Hgaga(refmass) mutab%channel_description(i,2)='gammagamma' else if(d.eq.2) then rate=rate*div(t%BR_hjWW(j),t%BR_HWW_SM(j),0.0D0,1.0D0) SMrate=SMrate*t%BR_HWW_SM(j) rate_SMref = rate_SMref*BRSM_HWW(refmass) mutab%channel_description(i,2)='WW' else if(d.eq.3) then rate=rate*div(t%BR_hjZZ(j),t%BR_HZZ_SM(j),0.0D0,1.0D0) SMrate=SMrate*t%BR_HZZ_SM(j) rate_SMref = rate_SMref*BRSM_HZZ(refmass) mutab%channel_description(i,2)='ZZ' else if(d.eq.4) then rate=rate*div(t%BR_hjtautau(j),t%BR_Htautau_SM(j),0.0D0,1.0D0) SMrate=SMrate*t%BR_Htautau_SM(j) rate_SMref = rate_SMref*BRSM_Htautau(refmass) mutab%channel_description(i,2)='tautau' else if(d.eq.5) then rate=rate*div(t%BR_hjbb(j),t%BR_Hbb_SM(j),0.0D0,1.0D0) SMrate=SMrate*t%BR_Hbb_SM(j) rate_SMref = rate_SMref*BRSM_Hbb(refmass) mutab%channel_description(i,2)='bb' else if(d.eq.6) then rate=rate*div(t%BR_hjZga(j),t%BR_HZga_SM(j),0.0D0,1.0D0) SMrate=SMrate*t%BR_HZga_SM(j) rate_SMref = rate_SMref*BRSM_HZga(refmass) mutab%channel_description(i,2)='Zgamma' else if(d.eq.7) then rate=rate*div(t%BR_hjcc(j),t%BR_Hcc_SM(j),0.0D0,1.0D0) SMrate=SMrate*t%BR_Hcc_SM(j) rate_SMref = rate_SMref*BRSM_Hcc(refmass) mutab%channel_description(i,2)='cc' else if(d.eq.8) then rate=rate*div(t%BR_hjmumu(j),t%BR_Hmumu_SM(j),0.0D0,1.0D0) SMrate=SMrate*t%BR_Hmumu_SM(j) rate_SMref = rate_SMref*BRSM_Hmumu(refmass) mutab%channel_description(i,2)='mumu' else if(d.eq.9) then rate=rate*div(t%BR_hjgg(j),t%BR_Hgg_SM(j),0.0D0,1.0D0) SMrate=SMrate*t%BR_Hgg_SM(j) rate_SMref = rate_SMref*BRSM_Hgg(refmass) mutab%channel_description(i,2)='gg' + else if(d.eq.10) then + rate=rate*div(t%BR_hjss(j),t%BR_Hss_SM(j),0.0D0,1.0D0) + SMrate=SMrate*t%BR_Hss_SM(j) + rate_SMref = rate_SMref*BRSM_Hss(refmass) + mutab%channel_description(i,2)='ss' + else if(d.eq.11) then + rate=rate*div(t%BR_hjtt(j),t%BR_Htt_SM(j),0.0D0,1.0D0) + SMrate=SMrate*t%BR_Htt_SM(j) + rate_SMref = rate_SMref*BRSM_Htoptop(refmass) + mutab%channel_description(i,2)='tt' else if(d.eq.0) then rate=rate*1.0D0 SMrate=SMrate*1.0D0 rate_SMref = rate_SMref*1.0D0 mutab%channel_description(i,2)='none' endif !------------------------- ! NEW FEATURE (since HB-5.2): Enable to set channelrates directly. if(p.ne.0.and.d.ne.0) then select case(d) case(1) BR_SMref = t%BR_Hgaga_SM(j) ! BR_SMref_mpeak = BRSM_Hgaga(refmass) case(2) BR_SMref = t%BR_HWW_SM(j) ! BR_SMref_mpeak = BRSM_HWW(refmass) case(3) BR_SMref = t%BR_HZZ_SM(j) ! BR_SMref_mpeak = BRSM_HZZ(refmass) case(4) BR_SMref = t%BR_Htautau_SM(j) ! BR_SMref_mpeak = BRSM_Htautau(refmass) case(5) BR_SMref = t%BR_Hbb_SM(j) ! BR_SMref_mpeak = BRSM_Hbb(refmass) case(6) BR_SMref = t%BR_HZga_SM(j) ! BR_SMref_mpeak = BRSM_HZga(refmass) case(7) BR_SMref = t%BR_Hcc_SM(j) ! BR_SMref_mpeak = BRSM_Hcc(refmass) case(8) BR_SMref = t%BR_Hmumu_SM(j) ! BR_SMref_mpeak = BRSM_Hmumu(refmass) case(9) BR_SMref = t%BR_Hgg_SM(j) ! BR_SMref_mpeak = BRSM_Hgg(refmass) + case(10) + BR_SMref = t%BR_Hss_SM(j) + case(11) + BR_SMref = t%BR_Htt_SM(j) end select if(mutab%collider.eq.'LHC') then if(abs(mutab%energy-7.0D0).le.small) then if(t%lhc7%channelrates(j,p,d).ge.0.0d0) then rate=div(t%lhc7%channelrates(j,p,d),BR_SMref,0.0D0,1.0D0) endif else if(abs(mutab%energy-8.0D0).le.small) then if(t%lhc8%channelrates(j,p,d).ge.0.0d0) then rate=div(t%lhc8%channelrates(j,p,d),BR_SMref,0.0D0,1.0D0) endif else if(abs(mutab%energy-13.0D0).le.small) then if(t%lhc13%channelrates(j,p,d).ge.0.0d0) then rate=div(t%lhc13%channelrates(j,p,d),BR_SMref,0.0D0,1.0D0) endif endif else if(mutab%collider.eq.'TEV') then if(t%tev%channelrates(j,p,d).ge.0.0d0) then rate=div(t%tev%channelrates(j,p,d),BR_SMref,0.0D0,1.0D0) endif endif endif !------------------------- ! write(*,*) 'DEBUG HS: SM BRs = ', t%BR_HWW_SM(j), t%BR_HZZ_SM(j), t%BR_Hgaga_SM(j) ! write(*,*) 'DEBUG HS: rate, SMrate(i) = ', rate, SMrate ! write(*,*) 'DEBUG HS: eff(i) = ', mutab%channel_eff(i) if(normalize_rates_to_reference_position) then !! THIS IS STILL IN TESTING PHASE !! mutab%channel_mu(i,j)=rate*SMrate/(rate_SMref) else mutab%channel_mu(i,j)=rate !! OLD WAY endif + + + if(normalize_rates_to_reference_position_outside_dmtheo) then + if(abs(refmass-t%particle(mutab%particle_x)%M(j)).ge.t%particle(mutab%particle_x)%dM(j)) then + mutab%channel_mu(i,j)=rate*SMrate/(rate_SMref) + endif + endif + mutab%channel_w(i,j)=mutab%channel_eff(i)*SMrate ! mutab%channel_w_corrected_eff(i,j)=mutab%channel_eff_ratios(i)*mutab%channel_eff(i)*SMrate enddo ! write(*,*) 'DEBUG HS: BRs = ', t%BR_hjWW, t%BR_hjZZ, t%BR_hjgaga ! write(*,*) 'DEBUG HS: LHC8 = ', t%lhc8%XS_hj_ratio, t%lhc8%XS_vbf_ratio, t%lhc8%XS_hjW_ratio,& ! t%lhc8%XS_hjZ_ratio, t%lhc8%XS_tthj_ratio SMrate=sum(mutab%channel_w(:,j)) ! write(*,*) 'DEBUG HS: SMrate = ', SMrate ! modelrate=sum(mutab%channel_w_corrected_eff(:,j)) do i=1,mutab%Nc mutab%channel_w(i,j)=div(mutab%channel_w(i,j),SMrate,0.0D0,1.0D9) ! mutab%channel_w_corrected_eff(i,j)=div(mutab%channel_w_corrected_eff(i,j),modelrate,0.0D0,1.0D9) enddo ! (TS 30/10/2013): ! write(*,*) "get_channelrates (mu, w, weff):" ! write(*,*) mutab%channel_mu ! write(*,*) mutab%channel_w ! write(*,*) mutab%channel_eff_ratios do i=1,mutab%Nc mutab%channel_w_corrected_eff(i,j)=mutab%channel_eff_ratios(i)*mutab%channel_w(i,j) ! n.b.: model weights are not normalized to 1! enddo ! write(*,*) j,mutab%id, "SM = ", mutab%channel_w(:,j) ! write(*,*) j,mutab%id, "SM effcorr = ",mutab%channel_w_corrected_eff(:,j) do i=1,mutab%Nc drsq_SM = 0.0D0 drsq = 0.0D0 - id1 = mutab%channel_id(i) - p1 = int((id1-modulo(id1,10))/dble(10)) - d1 = modulo(id1,10) +! id1 = mutab%channel_id(i) +! p1 = int((id1-modulo(id1,10))/dble(10)) +! d1 = modulo(id1,10) + p1 = mutab%channel_p_id(i) + d1 = mutab%channel_d_id(i) if(mutab%collider.ne.'ILC') then do ii=1,mutab%Nc - id2 = mutab%channel_id(ii) - p2 = int((id2-modulo(id2,10))/dble(10)) - d2 = modulo(id2,10) + p2 = mutab%channel_p_id(ii) + d2 = mutab%channel_d_id(ii) +! id2 = mutab%channel_id(ii) +! p2 = int((id2-modulo(id2,10))/dble(10)) +! d2 = modulo(id2,10) if(p1.eq.p2.and.p1.ne.0) then if(delta_rate%CScov_ok.and.delta_rate%usecov) then !-- TS 29/03/2017: Add 13 TeV XS covariance matrix here if(abs(mutab%energy-13.0D0).le.small) then drcov=delta_rate%CS13cov(p1,p1) drcovSM=delta_rate%CS13covSM(p1,p1) else drcov=delta_rate%CScov(p1,p1) drcovSM=delta_rate%CScovSM(p1,p1) endif drsq=drsq+drcov*mutab%channel_w_corrected_eff(i,j)*mutab%channel_w_corrected_eff(ii,j) drsq_SM=drsq_SM+drcovSM*mutab%channel_w(i,j)*mutab%channel_w(ii,j) else drsq=drsq+delta_rate%dCS(p1)**2*mutab%channel_w_corrected_eff(i,j)*mutab%channel_w_corrected_eff(ii,j) drsq_SM=drsq_SM+delta_rate%dCS_SM(p1)**2*mutab%channel_w(i,j)*mutab%channel_w(ii,j) endif endif if(d1.eq.d2.and.d1.ne.0) then if(delta_rate%BRcov_ok.and.delta_rate%usecov) then dBRSM = delta_rate%BRcovSM(d1,d1) dBR = delta_rate%BRcov(d1,d1) else dBRSM = delta_rate%dBR_SM(d1)**2 dBR = delta_rate%dBR(d1)**2 endif drsq=drsq+dBR*mutab%channel_w_corrected_eff(i,j)*mutab%channel_w_corrected_eff(ii,j) drsq_SM=drsq_SM+dBRSM*mutab%channel_w(i,j)*mutab%channel_w(ii,j) endif enddo endif mutab%channel_syst(i,j)=sqrt(drsq) mutab%channel_systSM(i,j)=sqrt(drsq_SM) enddo !write(*,*) 'DEBUG HS: mu = ', mutab%channel_mu !write(*,*) 'DEBUG HS: w = ', mutab%channel_w !write(*,*) 'DEBUG HS: eff = ', mutab%channel_eff end subroutine get_channelrates !------------------------------------------------------------ subroutine get_Rvalues(ii,collider,R_H_WW, R_H_ZZ, R_H_gaga, R_H_tautau, R_H_bb, R_VH_bb) ! Returns SM normalized signal rates of some relevant channels (w/o efficiencies) ! for Higgs boson "ii" for a specific collider (see subroutine get_rates). !------------------------------------------------------------ ! use usefulbits, only : theo, np,Hneut ! use usefulbits_HS, only : mutable integer, intent(in) :: ii, collider double precision, intent(out) :: R_H_WW, R_H_ZZ, R_H_gaga, R_H_tautau, R_H_bb, R_VH_bb ! type(mutable) :: dummytable ! integer :: i call get_rates(ii,collider,5,(/ 12, 22, 32, 42, 52 /),R_H_WW) call get_rates(ii,collider,5,(/ 13, 23, 33, 43, 53 /),R_H_ZZ) call get_rates(ii,collider,5,(/ 11, 21, 31, 41, 51 /),R_H_gaga) call get_rates(ii,collider,5,(/ 14, 24, 34, 44, 54 /),R_H_tautau) call get_rates(ii,collider,5,(/ 15, 25, 35, 45, 55 /),R_H_bb) call get_rates(ii,collider,2,(/ 35, 45 /),R_VH_bb) end subroutine get_Rvalues !************************************************************ subroutine get_rates(ii,collider,Nchannels,IDchannels,rate) ! Returns SM normalized signal rates (w/o efficiencies) for Higgs boson "ii" and collider ! experiment "collider"(=1,2,3 for TEV, LHC7, LHC8). "Nchannels" gives the total number ! and IDchannels the two-digit ID of the subchannels, which should be included in the rates. ! IDchannels is an array of size(Nchannels). !------------------------------------------------------------ use usefulbits, only : theo, np,Hneut use usefulbits_HS, only : mutable integer, intent(in) :: ii, collider, Nchannels integer, dimension(Nchannels), intent(in) :: IDchannels double precision, intent(out) :: rate !-Internal type(mutable) :: dummytable integer :: i !-Initialize a dummy mutable in order to run get_channelrates for the channels we want. if(collider.eq.1) then dummytable%collider = 'TEV' else if(collider.eq.2) then dummytable%collider = 'LHC' dummytable%energy = 7.0D0 else if(collider.eq.3) then dummytable%collider = 'LHC' dummytable%energy = 8.0D0 else if(collider.eq.4) then dummytable%collider = 'LHC' dummytable%energy = 13.0D0 else write(*,*) 'WARNING: collider experiment for get_rates unknown.' continue endif dummytable%id = 999999 dummytable%particle_x = 1 dummytable%Nc=Nchannels allocate(dummytable%mass(10)) - allocate(dummytable%channel_id(Nchannels)) +! allocate(dummytable%channel_id(Nchannels)) + allocate(dummytable%channel_p_id(Nchannels)) + allocate(dummytable%channel_d_id(Nchannels)) allocate(dummytable%channel_eff(Nchannels)) allocate(dummytable%channel_eff_ratios(Nchannels)) !-Set all efficiencies equal: dummytable%channel_eff = 1.0D0 dummytable%channel_eff_ratios = 1.0D0 allocate(dummytable%channel_description(Nchannels,2)) allocate(dummytable%channel_w(Nchannels,np(Hneut))) allocate(dummytable%channel_w_corrected_eff(Nchannels,np(Hneut))) allocate(dummytable%channel_systSM(Nchannels,np(Hneut))) allocate(dummytable%channel_syst(Nchannels,np(Hneut))) allocate(dummytable%channel_mu(Nchannels,np(Hneut))) - dummytable%channel_id = IDchannels - + + do i=1,Nchannels + if(IDchannels(i).le.99) then + dummytable%channel_p_id(i) = int((IDchannels(i)-modulo(id,10))/dble(10)) + dummytable%channel_d_id(i) = modulo(IDchannels(i),10) + else + write(*,*) "Error in get_rates: channel-ID not supported. Use get_rates_str instead!" + endif + enddo + call get_channelrates(ii, theo(1), dummytable) rate=0.0D0 do i=lbound(dummytable%channel_mu,dim=1),ubound(dummytable%channel_mu,dim=1) rate = rate + dummytable%channel_mu(i,ii)*dummytable%channel_w(i,ii) enddo - deallocate(dummytable%channel_id,dummytable%channel_eff,dummytable%channel_description,& + deallocate(dummytable%channel_p_id,dummytable%channel_d_id,dummytable%channel_eff,& & dummytable%channel_w,dummytable%channel_systSM,dummytable%channel_syst, & -& dummytable%channel_mu,dummytable%channel_eff_ratios, & +& dummytable%channel_mu,dummytable%channel_eff_ratios,dummytable%channel_description, & & dummytable%channel_w_corrected_eff,dummytable%mass) end subroutine get_rates +!************************************************************ +subroutine get_rates_str(ii,collider,Nchannels,IDchannels_str,rate) +! Returns SM normalized signal rates (w/o efficiencies) for Higgs boson "ii" and collider +! experiment "collider"(=1,2,3 for TEV, LHC7, LHC8). "Nchannels" gives the total number +! and IDchannels_str the channel ID string of the subchannels, which should be included in the rates. +! IDchannels_str is an array of size(Nchannels). +!------------------------------------------------------------ + use usefulbits, only : theo, np,Hneut + use usefulbits_HS, only : mutable + + integer, intent(in) :: ii, collider, Nchannels + character(LEN=5), dimension(Nchannels), intent(in) :: IDchannels_str + double precision, intent(out) :: rate +!-Internal + type(mutable) :: dummytable + integer :: i,id,posperiod + +!-Initialize a dummy mutable in order to run get_channelrates for the channels we want. + if(collider.eq.1) then + dummytable%collider = 'TEV' + else if(collider.eq.2) then + dummytable%collider = 'LHC' + dummytable%energy = 7.0D0 + else if(collider.eq.3) then + dummytable%collider = 'LHC' + dummytable%energy = 8.0D0 + else if(collider.eq.4) then + dummytable%collider = 'LHC' + dummytable%energy = 13.0D0 + else + write(*,*) 'WARNING: collider experiment for get_rates unknown.' + continue + endif + + dummytable%id = 999999 + dummytable%particle_x = 1 + dummytable%Nc=Nchannels + allocate(dummytable%mass(10)) +! allocate(dummytable%channel_id(Nchannels)) + allocate(dummytable%channel_p_id(Nchannels)) + allocate(dummytable%channel_d_id(Nchannels)) + allocate(dummytable%channel_eff(Nchannels)) + allocate(dummytable%channel_eff_ratios(Nchannels)) +!-Set all efficiencies equal: + dummytable%channel_eff = 1.0D0 + dummytable%channel_eff_ratios = 1.0D0 + allocate(dummytable%channel_description(Nchannels,2)) + allocate(dummytable%channel_w(Nchannels,np(Hneut))) + allocate(dummytable%channel_w_corrected_eff(Nchannels,np(Hneut))) + allocate(dummytable%channel_systSM(Nchannels,np(Hneut))) + allocate(dummytable%channel_syst(Nchannels,np(Hneut))) + allocate(dummytable%channel_mu(Nchannels,np(Hneut))) + + + do i=1,Nchannels + posperiod = index(IDchannels_str(i),'.') + if(posperiod.eq.0) then + if(len(trim(adjustl(IDchannels_str(i)))).eq.2) then + read(IDchannels_str(i),*) id + dummytable%channel_p_id(i) = int((id-modulo(id,10))/dble(10)) + dummytable%channel_d_id(i) = modulo(id,10) + else + stop " Error in get_rates_str: Cannot handle channel IDs!" + endif + else + read(IDchannels_str(i)(:posperiod-1),*) dummytable%channel_p_id(i) + read(IDchannels_str(i)(posperiod+1:),*) dummytable%channel_d_id(i) + endif + enddo + + call get_channelrates(ii, theo(1), dummytable) + rate=0.0D0 + do i=lbound(dummytable%channel_mu,dim=1),ubound(dummytable%channel_mu,dim=1) + rate = rate + dummytable%channel_mu(i,ii)*dummytable%channel_w(i,ii) + enddo + + deallocate(dummytable%channel_p_id,dummytable%channel_d_id,dummytable%channel_eff,& +& dummytable%channel_w,dummytable%channel_systSM,dummytable%channel_syst, & +& dummytable%channel_mu,dummytable%channel_eff_ratios,dummytable%channel_description, & +& dummytable%channel_w_corrected_eff,dummytable%mass) + +end subroutine get_rates_str !------------------------------------------------------------ subroutine get_Pvalue(nparam, Pvalue) ! Calculates the Chi^2 probability for the total Chi^2 value ! and the number of degrees of freedom given by the ! number of observables - nparam !------------------------------------------------------------ use usefulbits, only : vsmall use usefulbits_hs, only: HSres use numerics implicit none integer, intent(in) :: nparam double precision, intent(out) :: Pvalue if(allocated(HSres)) then if(HSres(1)%Chisq.gt.vsmall.and.(HSres(1)%nobs-nparam).gt.0) then HSres(1)%Pvalue = 1 - gammp(dble(HSres(1)%nobs-nparam)/2,HSres(1)%Chisq/2) endif else write(*,*) "Warning: subroutine get_Pvalue should be called after run_HiggsSignals." endif Pvalue = HSres(1)%Pvalue end subroutine get_Pvalue !------------------------------------------------------------ subroutine get_neutral_Higgs_masses(Mh, dMh) ! Sets the theoretical mass uncertainty of the Higgs bosons. !------------------------------------------------------------ use usefulbits, only: theo,np,Hneut implicit none double precision,intent(out) :: Mh(np(Hneut)), dMh(np(Hneut)) if(.not.allocated(theo))then stop 'No model information given!' endif if(np(Hneut).eq.0)then write(*,*)'Cannot access the neutral Higgs boson masses' write(*,*)'because np(Hneut) == 0.' stop 'error in subroutine get_neutral_Higgs_masses' endif Mh = theo(1)%particle(Hneut)%M dMh = theo(1)%particle(Hneut)%dM end subroutine get_neutral_Higgs_masses !------------------------------------------------------------ subroutine complete_HS_results() !------------------------------------------------------------ use usefulbits, only : just_after_run, ndat use usefulbits_HS, only : HSres, Nparam use numerics, only : gammp integer :: n if(just_after_run) then do n=1,ndat HSres(n)%Chisq_mu = HSres(n)%Chisq_peak_mu + & !HSres(n)%Chisq_mpred + & & HSres(n)%Chisq_STXS_rates + HSres(n)%Chisq_LHCRun1_mu HSres(n)%Chisq_mh = HSres(n)%Chisq_peak_mh + HSres(n)%Chisq_LHCRun1_mh + & & HSres(n)%Chisq_STXS_mh HSres(n)%Chisq_STXS = HSres(n)%Chisq_STXS_rates + HSres(n)%Chisq_STXS_mh HSres(n)%Chisq_peak = HSres(n)%Chisq_peak_mu + HSres(n)%Chisq_peak_mh HSres(n)%Chisq_LHCRun1 = HSres(n)%Chisq_LHCRun1_mu + HSres(n)%Chisq_LHCRun1_mh HSres(n)%Chisq = HSres(n)%Chisq_mu + HSres(n)%Chisq_mh HSres(n)%nobs_mu = HSres(n)%nobs_peak_mu + &!HSres(n)%nobs_mpred + & & HSres(n)%nobs_LHCRun1_mu + HSres(n)%nobs_STXS_rates HSres(n)%nobs_mh = HSres(n)%nobs_peak_mh + HSres(n)%nobs_LHCRun1_mh + & & HSres(n)%nobs_STXS_mh HSres(n)%nobs_peak = HSres(n)%nobs_peak_mu + HSres(n)%nobs_peak_mh HSres(n)%nobs_STXS = HSres(n)%nobs_STXS_rates + HSres(n)%nobs_STXS_mh HSres(n)%nobs_LHCRun1 = HSres(n)%nobs_LHCRun1_mu + HSres(n)%nobs_LHCRun1_mh HSres(n)%nobs = HSres(n)%nobs_mu + HSres(n)%nobs_mh if(HSres(n)%Chisq.gt.vsmall.and.(HSres(n)%nobs-Nparam).gt.0) then HSres(n)%Pvalue=1 - gammp(dble(HSres(n)%nobs-Nparam)/2.0D0,HSres(n)%Chisq/2.0D0) endif if(HSres(n)%Chisq_peak.gt.vsmall.and.(HSres(n)%nobs_peak-Nparam).gt.0) then HSres(n)%Pvalue_peak=1 - gammp(dble(HSres(n)%nobs_peak-Nparam)/2.0D0,HSres(n)%Chisq_peak/2.0D0) endif if(HSres(n)%Chisq_LHCRun1.gt.vsmall.and.(HSres(n)%nobs_LHCRun1-Nparam).gt.0) then HSres(n)%Pvalue_LHCRun1=1 - gammp(dble(HSres(n)%nobs_LHCRun1-Nparam)/2.0D0,HSres(n)%Chisq_LHCRun1/2.0D0) endif if(HSres(n)%Chisq_STXS.gt.vsmall.and.(HSres(n)%nobs_STXS-Nparam).gt.0) then HSres(n)%Pvalue_STXS=1 - gammp(dble(HSres(n)%nobs_STXS-Nparam)/2.0D0,HSres(n)%Chisq_STXS/2.0D0) endif enddo else write(*,*) "Warning: complete_HS_results was called but just_after_run is", just_after_run endif !------------------------------------------------------------ end subroutine complete_HS_results !------------------------------------------------------------ subroutine finish_HiggsSignals ! This subroutine needs to be called right at the end, to close files ! and deallocate arrays !------------------------------------------------------------ use usefulbits, only : deallocate_usefulbits,debug,theo,debug, &!,inputsub & file_id_debug1,file_id_debug2 use S95tables, only : deallocate_Exptranges use theory_BRfunctions, only : deallocate_BRSM use datatables, only : deallocate_observables use usefulbits_HS, only : deallocate_usefulbits_HS, analyses use mc_chisq, only : deallocate_mc_observables use store_pathname_HS !#if defined(NAGf90Fortran) ! use F90_UNIX_IO, only : flush !#endif if(debug)then close(file_id_debug2) close(file_id_debug1) endif if(debug) write(*,*)'finishing off...' ; call flush(6) if(.not.allocated(theo))then ! stop 'HiggsBounds_initialize should be called first' if(debug) write(*,*) "HiggsBounds/HiggsSignals internal structure already deallocated!" else call deallocate_BRSM call deallocate_Exptranges call deallocate_usefulbits ! if (allocated(inputsub)) deallocate(inputsub) endif ! write(*,*) "before deallocate mc observables." call deallocate_mc_observables ! write(*,*) "after deallocate mc observables." call deallocate_observables if(allocated(analyses)) deallocate(analyses) call deallocate_usefulbits_HS ! call system('rm -f '//trim(adjustl(pathname_HS))//'Expt_tables/analyses.txt') call system('rm -f HS_analyses.txt') if(debug) write(*,*)'finished' ; call flush(6) end subroutine finish_HiggsSignals !------------------------------------------------------------ subroutine finish_HiggsSignals_only !------------------------------------------------------------ use datatables, only : deallocate_observables use usefulbits_HS, only : deallocate_usefulbits_HS, analyses use mc_chisq, only : deallocate_mc_observables use store_pathname_HS call deallocate_mc_observables call deallocate_observables if(allocated(analyses)) deallocate(analyses) call deallocate_usefulbits_HS call system('rm -f HS_analyses.txt') end subroutine finish_HiggsSignals_only !------------------------------------------------------------ ! SOME HANDY WRAPPER SUBROUTINES !------------------------------------------------------------ subroutine initialize_HiggsSignals_for_Fittino(nHiggsneut,nHiggsplus) !------------------------------------------------------------ ! Wrapper subroutine to intitialize HiggsSignals with the experimental ! dataset "latestresults", avoiding to specify this via a string argument. !------------------------------------------------------------ implicit none !--------------------------------------input integer,intent(in) :: nHiggsneut integer,intent(in) :: nHiggsplus ! character(LEN=19) :: Expt_string character(LEN=33) :: Expt_string ! Expt_string = "Moriond2013_Fittino" Expt_string = "latestresults_April2013_inclusive" call initialize_HiggsSignals(nHiggsneut,nHiggsplus,Expt_string) end subroutine initialize_HiggsSignals_for_Fittino !------------------------------------------------------------ subroutine get_number_of_observables_wrapper(ntotal, npeakmu, npeakmh, nmpred, nanalyses) !------------------------------------------------------------ use io, only : get_number_of_observables implicit none integer, intent(out) :: ntotal, npeakmu, npeakmh, nmpred, nanalyses call get_number_of_observables(ntotal, npeakmu, npeakmh, nmpred, nanalyses) end subroutine get_number_of_observables_wrapper !------------------------------------------------------------ subroutine get_ID_of_peakobservable_wrapper(ii, ID) !------------------------------------------------------------ use io, only : get_ID_of_peakobservable implicit none integer, intent(in) :: ii integer, intent(out) :: ID call get_ID_of_peakobservable(ii, ID) end subroutine get_ID_of_peakobservable_wrapper !------------------------------------------------------------ subroutine get_peakinfo_from_HSresults_wrapper(obsID, mupred, domH, nHcomb) !-------------------------------------------------------------------- use io, only : get_peakinfo_from_HSresults implicit none integer, intent(in) :: obsID double precision, intent(out) :: mupred integer, intent(out) :: domH, nHcomb call get_peakinfo_from_HSresults(obsID, mupred, domH, nHcomb) end subroutine get_peakinfo_from_HSresults_wrapper !------------------------------------------------------------ subroutine print_cov_mh_to_file_wrapper(Hindex) !------------------------------------------------------------ use pc_chisq, only : print_cov_mh_to_file implicit none integer, intent(in) :: Hindex call print_cov_mh_to_file(Hindex) end subroutine print_cov_mh_to_file_wrapper !------------------------------------------------------------ subroutine print_cov_mu_to_file_wrapper !------------------------------------------------------------ use pc_chisq, only : print_cov_mu_to_file implicit none call print_cov_mu_to_file end subroutine print_cov_mu_to_file_wrapper !------------------------------------------------------------ subroutine print_corr_mu_to_file_wrapper !------------------------------------------------------------ use pc_chisq, only : print_corr_mu_to_file implicit none call print_corr_mu_to_file end subroutine print_corr_mu_to_file_wrapper !------------------------------------------------------------ Index: trunk/HiggsSignals-2/create_package.bat =================================================================== --- trunk/HiggsSignals-2/create_package.bat (revision 568) +++ trunk/HiggsSignals-2/create_package.bat (revision 569) @@ -1,234 +1,237 @@ #!/bin/bash vers=$1 echo '*************************************' echo 'Creating package HiggsSignals-'$vers startdir="$PWD" namedir=`basename $PWD` echo '*************************************' echo ' ' echo './configure, then run example :' echo ' ' ./configure >temp.txt make HSwithSLHA > temp.txt cd example_programs ./HSwithSLHA 1 ../example_data/SLHA/SLHA_FHexample.fh 2> temp_error.txt 1> temp_output.txt echo 'Is there anything between here...' grep 'hello' temp_output.txt grep 'WARNING' temp_output.txt grep 'Interrupt' temp_error.txt grep 'Error' temp_error.txt grep 'stop' temp_error.txt rm temp_output.txt rm temp_error.txt echo '... and here?' cd .. echo '*************************************' echo ' ' echo 'make hyperclean :' echo ' ' make hyperclean > temp.txt echo 'remove the makefile:' echo ' ' rm makefile echo ' ' echo '*************************************' echo ' ' echo 'CHECK THE HIGGSSIGNALS SETTINGS' echo ' ' grep 'logical :: withcorrexpsyst' usefulbits_HS.f90 grep 'logical :: additional_output' usefulbits_HS.f90 grep 'logical :: usetoys' usefulbits_HS.f90 grep 'logical :: usescalefactor' usefulbits_HS.f90 grep 'logical :: useSMweights' usefulbits_HS.f90 grep 'logical :: correlations_mu' usefulbits_HS.f90 grep 'logical :: correlations_mh' usefulbits_HS.f90 grep 'logical :: minimalchisq' usefulbits_HS.f90 grep 'logical :: maximalchisq' usefulbits_HS.f90 grep 'logical :: useSMtest' usefulbits_HS.f90 grep 'logical :: SLHAdetailed' usefulbits_HS.f90 grep 'logical :: newSLHAfile' usefulbits_HS.f90 grep 'logical :: symmetricerrors' usefulbits_HS.f90 grep 'logical :: anticorrmu' usefulbits_HS.f90 grep 'logical :: anticorrmh' usefulbits_HS.f90 grep 'logical :: absolute_errors' usefulbits_HS.f90 grep 'logical :: THU_included' usefulbits_HS.f90 grep 'logical :: normalize_rates_to_reference_position' usefulbits_HS.f90 grep 'double precision :: eps' usefulbits_HS.f90 grep 'double precision :: assignmentrange' usefulbits_HS.f90 grep 'integer :: output_level' usefulbits_HS.f90 grep 'integer :: iterations' usefulbits_HS.f90 grep 'integer :: pdf' usefulbits_HS.f90 grep 'integer :: Nparam' usefulbits_HS.f90 echo ' ' echo '*************************************' copyfiles=`ls COPYING\ README\ *.f90\ *.F90\ *.F\ *.f\ *.bat\ *.in\ example_data/SLHA/SLHA_heavyH.fh.*\ example_data/SLHA/SLHA_FHexample.fh.*\ example_data/random/*.dat\ example_data/mhmax/*.dat\ example_programs/*.f90\ example_programs/*.F\ example_programs/results/*.py\ supplements/*\ Expt_tables/LHC13/*.txt\ Expt_tables/LHC13/*.stxs\ Expt_tables/LHC13/*.stxscorr\ Expt_tables/LHC_combination_Run1/*.exp\ Expt_tables/LHC_combination_Run1/*.corr\ Expt_tables/LHC7+8/*.txt\ + Expt_tables/LHC13_CMS_H-ZZ_36.1fb01_Higgs-pT/*.stxs\ + Expt_tables/LHC13_CMS_H-ZZ_36.1fb01_Higgs-pT/*.stxscorr\ Expt_tables/README` # Expt_tables/latestresults-1.4.0/*.txt\ # Expt_tables/latestresults-1.4.0-LHCinclusive/*.txt\ # Expt_tables/latestresults/*.txt\ # Expt_tables/LHC13_ATL_H-WW/*.txt\ # Expt_tables/LHC13_ATL_H-ZZ/*.txt\ # Expt_tables/LHC13_ATL_H-gaga/*.txt\ # Expt_tables/LHC13_ATL_H-bb/*.txt\ # Expt_tables/LHC13_ATL_ttH/*.txt\ # Expt_tables/LHC13_CMS_H-ZZ/*.txt\ # Expt_tables/LHC13_CMS_H-WW/*.txt\ # Expt_tables/LHC13_CMS_H-tautau/*.txt\ # Expt_tables/LHC13_CMS_ttH-multilepton/*.txt\ # Expt_tables/LHC13_CMS_H-gaga/*.txt\ # Expt_tables/latestresults/*.txt\ # Expt_tables/latestresults-1.0.0/*.txt\ # Expt_tables/latestresults-1.0.0_inclusive/*.txt\ # Expt_tables/latestresults-1.1.0/*.txt\ # Expt_tables/latestresults-1.2.0/*.txt\ # Expt_tables/latestresults-1.3.0/*.txt\ # Expt_tables/latestresults-1.4.0/*.txt\ # Expt_tables/latestresults-1.2.0-CMSgaga125p7/*.txt\ # Expt_tables/latestresults-1.2.0-LHCinclusive/*.txt\ # Expt_tables/latestresults-1.3.0-LHCinclusive/*.txt\ # Expt_tables/latestresults-1.4.0-LHCinclusive/*.txt\ # Expt_tables/legacy/latestresults-1.0.0-old/*.txt\ # Expt_tables/CMS-13-005-gaga-125p7/*.txt\ # Expt_tables/LHC13_2016/*\ # Expt_tables/CMS-13-005-125p7/*.txt\ # Expt_tables/LHC300/*.txt\ # Expt_tables/LHC3000/*.txt\ # Expt_tables/ILC250/*.txt\ # Expt_tables/ILC500/*.txt\ # Expt_tables/ILC1000/*.txt\ # echo $copyfiles tempdir="HiggsSignals-$vers" #echo 'tempdir=' $tempdir cd .. mkdir "$tempdir" listdir="example_data\ example_data/SLHA\ example_data/random\ example_data/mhmax\ example_programs\ example_programs/results\ example_programs/results/tmp\ supplements\ Expt_tables\ Expt_tables/LHC13\ Expt_tables/LHC_combination_Run1\ - Expt_tables/LHC7+8" + Expt_tables/LHC7+8\ + Expt_tables/LHC13_CMS_H-ZZ_36.1fb01_Higgs-pT" # Expt_tables/LHC13_ATL_H-WW\ # Expt_tables/LHC13_ATL_H-ZZ\ # Expt_tables/LHC13_ATL_H-gaga\ # Expt_tables/LHC13_ATL_H-bb\ # Expt_tables/LHC13_ATL_ttH\ # Expt_tables/LHC13_CMS_H-ZZ\ # Expt_tables/LHC13_CMS_H-WW\ # Expt_tables/LHC13_CMS_H-tautau\ # Expt_tables/LHC13_CMS_ttH-multilepton\ # Expt_tables/LHC13_CMS_H-gaga\ # Expt_tables/latestresults # Expt_tables/latestresults-1.4.0\ # Expt_tables/latestresults-1.4.0-LHCinclusive\ # Expt_tables/latestresults-1.2.0-CMSgaga125p7\ # Expt_tables/latestresults-1.2.0-LHCinclusive\ # Expt_tables/latestresults-1.3.0-LHCinclusive\ # Expt_tables/CMS-13-005-gaga-125p7\ # Expt_tables/legacy\ # Expt_tables/legacy/latestresults-1.0.0-old\ # Expt_tables/latestresults-1.0.0_inclusive\ # Expt_tables/latestresults-1.0.0\ # Expt_tables/latestresults-1.1.0\ # Expt_tables/latestresults-1.2.0\ # Expt_tables/latestresults-1.3.0\ # Expt_tables/LHC13_2016\ # Expt_tables/CMS-13-005-125p7\ # Expt_tables/LHC300\ # Expt_tables/LHC3000\ # Expt_tables/ILC250\ # Expt_tables/ILC500\ # Expt_tables/ILC1000\ for direcname in $listdir ; do mkdir "$tempdir"/"$direcname" done cp "$namedir"/pubconfigure "$tempdir"/configure for filename in $copyfiles ; do cp "$namedir"/"$filename" "$tempdir"/"$filename" done echo 'removing some of the files not needed in the package' removefiles="create_package.bat\ example_data/random/*_peakobservables.dat\ example_data/random/*_HiggsSignals_results.dat\ example_data/mhmax/*_peakobservables.dat\ example_data/mhmax/*_HiggsSignals_results.dat\ supplements/smearErrorsXS_cpp.so\ supplements/smearErrorsXS_cpp.d\ supplements/smearErrorsBR_cpp.so\ supplements/smearErrorsBR_cpp.d" for filename in $removefiles ; do rm "$tempdir"/"$filename" done echo 'create ../'$tempdir'.tar.gz :' rm "$tempdir".tar.gz tar czf "$tempdir".tar.gz "$tempdir" rm -r "$tempdir" cd $namedir echo '*************************************' echo ' ' echo 'Is this the correct version number? ' grep 'HSvers=' usefulbits_HS.f90 echo ' ' echo '*************************************' echo ' ' echo 'finished' echo ' ' echo '*************************************' Index: trunk/HiggsSignals-2/mc_chisq.f90 =================================================================== --- trunk/HiggsSignals-2/mc_chisq.f90 (revision 568) +++ trunk/HiggsSignals-2/mc_chisq.f90 (revision 569) @@ -1,1079 +1,1084 @@ !-------------------------------------------------------------------- ! This file is part of HiggsSignals (TS 03/03/2013) !-------------------------------------------------------------------- module mc_chisq use numerics use combinatorics use usefulbits_hs implicit none integer :: mc_mode = 1 ! mc_mode = 1 -> (default) Mass scan for theoretical mass uncertainty ! mc_mode = 2 -> mu-plot smearing for theoretical mass uncertainty contains !-------------------------------------------------------------------- subroutine print_mc_observables !-------------------------------------------------------------------- implicit none integer :: i, j, k do i=lbound(analyses,dim=1),ubound(analyses,dim=1) write(*,*) write(*,*) '#*************************************************************************#' write(*,'(A,I3,A,I3,A)') ' # Analysis ',i,' #' write(*,*) '#*************************************************************************#' write(*,'(A25,1I10)') 'ID =', analyses(i)%table%id write(*,'(A25,4X,A3)') 'Collaboration =', analyses(i)%table%collaboration write(*,'(A25,4X,F6.2)') 'cms energy =', analyses(i)%table%energy write(*,'(A25,4X,A100)') 'Reference =', analyses(i)%table%label write(*,'(A25,4X,A100)') 'Description =', analyses(i)%table%desc do j=lbound(analyses(i)%mpred%mp_Higgses,dim=1),& & ubound(analyses(i)%mpred%mp_Higgses,dim=1) write(*,*)'#--------------------- pred. mass centered observable --------------------#' write(*,'(A25,4X,F10.2)') 'Higgs mass =', analyses(i)%mpred%mp_Higgses(j)%m write(*,'(A25,4X,F10.2)') 'Higgs mass uncertainty =',analyses(i)%mpred%mp_Higgses(j)%dm write(*,'(A25,4X,F10.6)') 'Pred. signal strength =',analyses(i)%mpred%mp_Higgses(j)%mu write(*,'(A25,4X,I10)') 'Combined Higgses =',& & size(analyses(i)%mpred%mp_Higgses(j)%Higgses,dim=1) do k=lbound(analyses(i)%mpred%mp_Higgses(j)%Higgses,dim=1),& & ubound(analyses(i)%mpred%mp_Higgses(j)%Higgses,dim=1) write(*,'(A5,I2,A18,4X,3F10.4)') 'Higgs ',k,' (m, dm, mu) =', & & analyses(i)%mpred%mp_Higgses(j)%Higgses(k)%m,& & analyses(i)%mpred%mp_Higgses(j)%Higgses(k)%dm,& & analyses(i)%mpred%mp_Higgses(j)%Higgses(k)%mu enddo write(*,'(A25,4X,F10.6)') 'obs. mass value =', analyses(i)%mpred%mp_Higgses(j)%m_obs write(*,'(A25,4X,F10.6)') 'obs. signal strength =',& & analyses(i)%mpred%mp_Higgses(j)%mu_obs write(*,'(A25,4X,2F10.6)') 'cyan band(low,high) =',& & analyses(i)%mpred%mp_Higgses(j)%dmu_low_obs,analyses(i)%mpred%mp_Higgses(j)%dmu_up_obs write(*,'(A25,4X,2F10.6)') 'dmu0 (low,high) =',& & analyses(i)%mpred%mp_Higgses(j)%dmu_low0_obs,& & analyses(i)%mpred%mp_Higgses(j)%dmu_up0_obs write(*,'(A25,4X,F10.6)') 'Chisq =', analyses(i)%mpred%mp_Higgses(j)%chisq enddo enddo end subroutine print_mc_observables !-------------------------------------------------------------------- subroutine print_mc_observables_essentials !-------------------------------------------------------------------- implicit none integer :: i, j, k do i=lbound(obs,dim=1),ubound(obs,dim=1) if(obs(i)%obstype.eq.2) then write(*,*) write(*,*) '#*************************************************************************#' write(*,'(A,I3,A,I3,A)') ' # Mass-centered Observable ',i,& &' #' write(*,*) '#*************************************************************************#' write(*,'(A25,1I10)') 'ID =', obs(i)%id write(*,'(A25,4X,A3)') 'Collaboration =', obs(i)%table%collaboration write(*,'(A25,4X,F6.2)') 'cms energy =', obs(i)%table%energy write(*,'(A25,4X,A100)') 'Reference =', obs(i)%table%label write(*,'(A25,4X,A100)') 'Description =', obs(i)%table%desc write(*,'(A25,4X,1F5.2,A3,1F5.2)') 'luminosity, lum. error =',& & obs(i)%table%lumi,', ',obs(i)%table%dlumi write(*,'(A25,1X,A2,1F7.2,A1,1F7.2,A4,1F5.2)') 'mass range, separation =','[ ',& & obs(i)%table%xmin,',',obs(i)%table%xmax,' ], ',obs(i)%table%sep write(*,'(A25,1F10.2)') 'mass resolution =',obs(i)%table%deltam write(*,*)'#------------------------ Channel information ----------------------------#' - write(*,*)' ID prod. decay efficiency' + write(*,*)' p,d-ID prod. decay efficiency' write(*,*)'#-------------------------------------------------------------------------#' do k=1, obs(i)%table%Nc - write(*,'(1I5,5X,2A,1F15.6)') obs(i)%table%channel_id(k), & + write(*,'(1I5,5X,2A,1F15.6)') obs(i)%table%channel_p_id(k),obs(i)%table%channel_d_id(k), & & obs(i)%table%channel_description(k,:),obs(i)%table%channel_eff(k) enddo write(*,*)'#-------------------------------------------------------------------------#' endif enddo end subroutine print_mc_observables_essentials !-------------------------------------------------------------------- subroutine print_mc_tables_to_file !-------------------------------------------------------------------- use usefulbits, only : file_id_common3 use usefulbits_hs, only : StrCompress implicit none character(LEN=100) :: formatspec integer :: i,kk formatspec='(I3,7X,I10,1X,4F7.2,1X,A3,1X,F6.2,1X,F6.2,1X,A,5X,A)' open(file_id_common3,file="mctables_information.txt") write(file_id_common3,*) "#HiggsSignals-"//trim(adjustl(HSvers))// & & " with experimental dataset '"//trim(adjustl(Exptdir))//"'" write(file_id_common3,*) "#Number Analysis-ID mh_min mh_max mh_sep",& & " dmh_exp collaboration energy luminosity description reference" write(file_id_common3,*) "#" kk=0 do i=lbound(obs,dim=1),ubound(obs,dim=1) if(obs(i)%obstype.eq.2) then kk=kk+1 write(file_id_common3,formatspec)kk,obs(i)%id,obs(i)%table%xmin, & & obs(i)%table%xmax,obs(i)%table%sep,obs(i)%table%deltam,obs(i)%table%collaboration,& & obs(i)%table%energy,obs(i)%table%lumi,trim(strcompress(obs(i)%table%desc)),& & obs(i)%table%label endif enddo close(file_id_common3) end subroutine print_mc_tables_to_file !------------------------------------------------------------------------------------ subroutine print_mc_observables_to_file !------------------------------------------------------------------------------------ use usefulbits, only : file_id_common3 use usefulbits_hs, only : HSres implicit none character(LEN=100) :: formatspec !,formatspec2 integer :: i,j,kk double precision :: mu_pull, dmu kk=0 formatspec='(I3,7X,I10,1X,3F8.2,1X,I3,1X4F8.2)' ! formatspec2='(I3,7X,I10,1X,2F8.2,1X,A7,1X,A7,1X,A7,1X,5F10.4)' open(file_id_common3,file="mcobservables_information.txt") write(file_id_common3,*) "#HiggsSignals-"//trim(adjustl(HSvers))// & & " with experimental dataset '"//trim(adjustl(Exptdir))//"'" write(file_id_common3,*) "#pull = (predicted - observed)/(gaussian uncertainty)" write(file_id_common3,*) "#Number Analysis-ID m(pred) dm(pred) mu(pred) ncomb m(obs)",& & " mu(obs) dmu mu_pull" write(file_id_common3,*) "#" do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do j=lbound(analyses(i)%mpred%mp_Higgses,dim=1),& & ubound(analyses(i)%mpred%mp_Higgses,dim=1) kk=kk+1 if(analyses(i)%mpred%mp_Higgses(j)%mu.ge.analyses(i)%mpred%mp_Higgses(j)%mu_obs) then dmu = analyses(i)%mpred%mp_Higgses(j)%dmu_up_obs else dmu = analyses(i)%mpred%mp_Higgses(j)%dmu_low_obs endif mu_pull = (analyses(i)%mpred%mp_Higgses(j)%mu - & & analyses(i)%mpred%mp_Higgses(j)%mu_obs)/dmu write(file_id_common3,formatspec)kk,analyses(i)%id, & & analyses(i)%mpred%mp_Higgses(j)%m, & & analyses(i)%mpred%mp_Higgses(j)%dm, & & analyses(i)%mpred%mp_Higgses(j)%mu, & & size(analyses(i)%mpred%mp_Higgses(j)%Higgses,dim=1), & ! combination code here! & analyses(i)%mpred%mp_Higgses(j)%m_obs, & & analyses(i)%mpred%mp_Higgses(j)%mu_obs, & & dmu, & & mu_pull enddo enddo close(file_id_common3) end subroutine print_mc_observables_to_file !-------------------------------------------------------------------- subroutine fill_mp_obs(ii) !-------------------------------------------------------------------- implicit none integer, intent(in) :: ii type(mp_neutHiggs), allocatable :: mp_H(:), mp_H_tmp(:) integer :: i,j,finished_combination,N !-Check if the Higgs is in the relevant mass region of the table ! and then tag it to be tested. N=0 ! = number of relevant Higgs bosons do i=lbound(analyses(ii)%Higgses,dim=1),ubound(analyses(ii)%Higgses,dim=1) if(analyses(ii)%Higgses(i)%m.ge.analyses(ii)%table%xmin.and.& & analyses(ii)%Higgses(i)%m.le.analyses(ii)%table%xmax) then if(analyses(ii)%Higgses(i)%mp_test.eq.1) then analyses(ii)%Higgses(i)%mp_test=1 N=N+1 endif else analyses(ii)%Higgses(i)%mp_test=0 endif enddo !! write(*,*) "Analysis ID = ", analyses(ii)%table%id !! write(*,*) "Higgs masses = ", analyses(ii)%Higgses(:)%m !! write(*,*) "Higgs mass uncertainties = ", analyses(ii)%Higgses(:)%dm !! write(*,*) "Tested with mp method = ", analyses(ii)%Higgses(:)%mp_test !! if(N.eq.0) allocate(analyses(ii)%mpred%mp_Higgses(0)) !-First, throw all relevant single Higgses into mp_H. allocate(mp_H(N)) j=0 do i=lbound(analyses(ii)%Higgses,dim=1),ubound(analyses(ii)%Higgses,dim=1) if(analyses(ii)%Higgses(i)%mp_test.eq.1) then j=j+1 allocate(mp_H(j)%Higgses(1)) mp_H(j)%Higgses(1)=analyses(ii)%Higgses(i) mp_H(j)%m=analyses(ii)%Higgses(i)%m mp_H(j)%dm=analyses(ii)%Higgses(i)%dm mp_H(j)%mu=analyses(ii)%Higgses(i)%mu mp_H(j)%mp_test=analyses(ii)%Higgses(i)%mp_test endif enddo !-Do the Stockholm Clustering finished_combination=-1 do while(finished_combination.ne.1) !-For debugging ! write(*,*) " " ! write(*,*) " NEW LOOP " ! write(*,*) " " ! do j=lbound(mp_H,dim=1),ubound(mp_H,dim=1) ! write(*,*) "#----------- mp_H(",j,") ------------" ! write(*,*) "number of combined Higgses = ", size(mp_H(j)%Higgses,dim=1) ! write(*,*) "mp_H(j)%m = ", mp_H(j)%m ! write(*,*) "mp_H(j)%dm = ", mp_H(j)%dm ! write(*,*) "mp_H(j)%mu = ", mp_H(j)%mu ! write(*,*) "mp_H(j)%mp_test = ", mp_H(j)%mp_test ! enddo !-END for debugging call combine_Higgses(mp_H, mp_H_tmp, analyses(ii)%table, finished_combination) if(finished_combination.ne.1) then do i=lbound(mp_H,dim=1),ubound(mp_H,dim=1) deallocate(mp_H(i)%Higgses) enddo deallocate(mp_H) allocate(mp_H(size(mp_H_tmp,dim=1))) do i=lbound(mp_H_tmp,dim=1),ubound(mp_H_tmp,dim=1) allocate(mp_H(i)%Higgses(size(mp_H_tmp(i)%Higgses,dim=1))) mp_H(i)%Higgses = mp_H_tmp(i)%Higgses mp_H(i)%m = mp_H_tmp(i)%m mp_H(i)%dm = mp_H_tmp(i)%dm mp_H(i)%mu = mp_H_tmp(i)%mu mp_H(i)%mp_test = mp_H_tmp(i)%mp_test deallocate(mp_H_tmp(i)%Higgses) enddo deallocate(mp_H_tmp) endif enddo !-Two possible choices to parametrize the theoretical uncertainty: ! (i) select the mu-obs value yielding lowest chi^2 (within box or including a chi^2 ! penalty from mass (gaussian)): ! call scan_mutable(analyses(ii)%table, mp_H) ! (ii) convolve (smear) the observed mu values with Higgs mass pdf: if(mc_mode.eq.2) call smear_mutable(analyses(ii)%table, mp_H) ! Fill mp_obs allocate(analyses(ii)%mpred%mp_Higgses(size(mp_H))) do i=lbound(mp_H,dim=1),ubound(mp_H,dim=1) allocate(analyses(ii)%mpred%mp_Higgses(i)%Higgses(size(mp_H(i)%Higgses,dim=1))) analyses(ii)%mpred%mp_Higgses(i)%Higgses = mp_H(i)%Higgses analyses(ii)%mpred%mp_Higgses(i) = mp_H(i) analyses(ii)%mpred%mp_Higgses(i)%Higgscomb = Higgscomb_key(mp_H(i)%Higgses) enddo end subroutine fill_mp_obs !---------------------------------------------------------------------- subroutine scan_mutable(table, mp_H) !---------------------------------------------------------------------- use datatables, only : interpolate_mutable use usefulbits, only : vsmall, small implicit none type(mutable), intent(in) :: table type(mp_neutHiggs), dimension(:), intent(inout) :: mp_H integer :: i,j,imin,imax,col,step double precision :: mh, val(3), norm, boxstart, boxend, chisq, minchisq, mu_selected(3),& & mh_selected, dm, dmu step = 10 call check_pdf imin = lbound(table%mu,dim=1) imax = ubound(table%mu,dim=1) do j=lbound(mp_H,dim=1),ubound(mp_H,dim=1) boxstart = mp_H(j)%m - mp_H(j)%dm boxend = mp_H(j)%m + mp_H(j)%dm if(boxstart.eq.boxend) then !--this is the case for no theory uncertainty. Increase box bounding by one step's separation. boxstart = boxstart - table%sep/step boxend = boxend + table%sep/step endif minchisq =vlarge do i= imin, step*imax mh = table%xmin+(i-1)*table%sep/step call interpolate_mutable(val, mh, table, step) select case(pdf) case(1,3) !---box theory uncertainty if(mh.ge.boxstart.and.mh.le.boxend) then call get_lower_or_upper_value_difference(dmu,mp_H(j)%mu,val) chisq = (mp_H(j)%mu - val(2))**2/dmu**2 if(chisq.le.minchisq) then minchisq = chisq mh_selected = mh mu_selected = val endif else chisq=vlarge endif case(2) !---gaussian theory uncertainty call get_lower_or_upper_value_difference(dmu,mp_H(j)%mu,val) dm = mp_H(j)%dm if(dm.le.small) dm = small ! Set dm to 1.0D-6 in case of no theory uncertainty. chisq = (mp_H(j)%mu - val(2))**2/dmu**2 + (mp_H(j)%m - mh)**2/dm**2 end select if(chisq.le.minchisq) then minchisq = chisq mh_selected = mh mu_selected = val endif enddo ! if(norm.ne.0.) val=val/norm !! write(*,*) j, val, norm mp_H(j)%dmu_low_obs = abs(mu_selected(2)-mu_selected(1)) mp_H(j)%mu_obs = mu_selected(2) mp_H(j)%dmu_up_obs = abs(mu_selected(3)-mu_selected(2)) mp_H(j)%m_obs = mh_selected !! write(*,*) "mass-centered observable at mh = ",mh_selected,"mu = ",mu_selected enddo end subroutine scan_mutable !---------------------------------------------------------------------- subroutine mass_variation_by_theory_uncertainty !---------------------------------------------------------------------- use datatables, only : interpolate_mutable use usefulbits, only : vsmall, small, np, Hneut implicit none integer :: i, ii, iii, j, jj, jjj, k, xmin, xmax, step, best_Hindex logical, allocatable :: testHiggs(:,:) logical, allocatable :: Higgstested(:) character(LEN=100) :: filename character(LEN=1) :: pdfstring double precision :: mh, val(3), norm, dm, dmu, sep, minchisq2,lowestmass, highestmass double precision, allocatable ::boxstart_max(:), boxend_min(:) double precision, allocatable ::boxstart(:),boxend(:),chisq(:),minchisq(:),mh_selected(:) allocate(Higgstested(np(Hneut)),chisq(np(Hneut)),boxstart(np(Hneut)),boxend(np(Hneut)), & & minchisq(np(Hneut)),mh_selected(np(Hneut))) step = 10 ! Unphysical starting values. xmin=1000000.0D0 xmax=0.0D0 sep=1000000.0D0 jjj=0 do j=lbound(analyses,dim=1),ubound(analyses,dim=1) do jj=lbound(analyses(j)%mpred%mp_Higgses,dim=1),& & ubound(analyses(j)%mpred%mp_Higgses,dim=1) jjj=jjj+1 if(analyses(j)%table%xmin.le.xmin) xmin=analyses(j)%table%xmin if(analyses(j)%table%xmax.ge.xmax) xmax=analyses(j)%table%xmax if(analyses(j)%table%sep.le.sep) sep=analyses(j)%table%sep enddo enddo allocate(testHiggs(jjj,np(Hneut)),boxstart_max(jjj),boxend_min(jjj)) ! For debugging if(additional_output) then write(pdfstring,'(I1)') pdf filename=trim(adjustl("dmth_variation_pdf_"//pdfstring//".dat")) open(147,file=filename) write(147,*) "# Mass parameter, chi^2 at this position for each neutral Higgs boson" write(147,*) "#-----------------------------------------------------------------------" endif jjj=0 do j=lbound(analyses,dim=1),ubound(analyses,dim=1) do jj=lbound(analyses(j)%mpred%mp_Higgses,dim=1),& & ubound(analyses(j)%mpred%mp_Higgses,dim=1) jjj=jjj+1 do k=1, np(Hneut) testHiggs(jjj,k)=.False. lowestmass=vlarge highestmass=0.0D0 do ii=lbound(analyses(j)%mpred%mp_Higgses(jj)%Higgses,dim=1),& & ubound(analyses(j)%mpred%mp_Higgses(jj)%Higgses, dim=1) if(k.eq.analyses(j)%mpred%mp_Higgses(jj)%Higgses(ii)%id) testHiggs(jjj,k)=.True. !-----In the case of combined Higgses, where there is no box overlap of the combined Higgs with !-----the individual Higgses, we have to extend the box of the combined Higgs. if(analyses(j)%mpred%mp_Higgses(jj)%Higgses(ii)%m.le.lowestmass) then lowestmass = analyses(j)%mpred%mp_Higgses(jj)%Higgses(ii)%m boxstart_max(jjj) = analyses(j)%mpred%mp_Higgses(jj)%Higgses(ii)%m + & & analyses(j)%mpred%mp_Higgses(jj)%Higgses(ii)%dm - vsmall endif if(analyses(j)%mpred%mp_Higgses(jj)%Higgses(ii)%m.ge.highestmass) then highestmass = analyses(j)%mpred%mp_Higgses(jj)%Higgses(ii)%m boxend_min(jjj) = analyses(j)%mpred%mp_Higgses(jj)%Higgses(ii)%m - & & analyses(j)%mpred%mp_Higgses(jj)%Higgses(ii)%dm + vsmall endif enddo enddo enddo enddo !!write(*,*) "boxstart_max = ", boxstart_max !!write(*,*) "boxend_min = ", boxend_min !!write(*,*) "testHiggs = ", testHiggs Higgstested=.False. minchisq=vlarge-1000.0D0 ! Vary mass globally for all analyses, minimize chisq. do i= 0, int((xmax-xmin)/(sep)*step) mh = xmin+i*sep/step chisq = 0.0D0 jjj=0 do j=lbound(analyses,dim=1),ubound(analyses,dim=1) do jj=lbound(analyses(j)%mpred%mp_Higgses,dim=1), & & ubound(analyses(j)%mpred%mp_Higgses,dim=1) jjj=jjj+1 call interpolate_mutable(val, mh, analyses(j)%table, step) !---Do the variation for every neutral Higgs boson and test the relevant mpred analyses do k=1, np(Hneut) if(testHiggs(jjj,k)) then Higgstested(k)=.True. !-----n.b.: This is again based on the (possibly) combined Higgses (this is an approximation!) !-----To do it correctly, Higgs bosons should be combined for every possible variation boxstart(k) = analyses(j)%mpred%mp_Higgses(jj)%m - & & analyses(j)%mpred%mp_Higgses(jj)%dm boxend(k) = analyses(j)%mpred%mp_Higgses(jj)%m + & & analyses(j)%mpred%mp_Higgses(jj)%dm if(boxstart(k).gt.boxstart_max(jjj)) boxstart(k)=boxstart_max(jjj) if(boxend(k).lt.boxend_min(jjj)) boxend(k)=boxend_min(jjj) !-----Extend box by one step size (new, has to be tested, TS 8/4/2013) ! boxstart(k)=boxstart(k)-sep/(2*step) ! boxend(k)=boxend(k)+sep/(2*step) select case(pdf) case(1,3) !------box theory uncertainty if(mh.ge.boxstart(k).and.mh.le.boxend(k)) then call get_lower_or_upper_value_difference(dmu,& & analyses(j)%mpred%mp_Higgses(jj)%mu,val) chisq(k) = chisq(k) + (analyses(j)%mpred%mp_Higgses(jj)%mu - val(2))**2/dmu**2 else chisq(k)=chisq(k) + vlarge endif case(2) !------gaussian theory uncertainty call get_lower_or_upper_value_difference(dmu,& & analyses(j)%mpred%mp_Higgses(jj)%mu,val) dm = analyses(j)%mpred%mp_Higgses(jj)%dm if(dm.le.small) dm = small ! Set dm to 1.0D-6 in case of no theory uncertainty. chisq(k) = chisq(k) + (analyses(j)%mpred%mp_Higgses(jj)%mu - val(2))**2/dmu**2 + & & (analyses(j)%mpred%mp_Higgses(jj)%m - mh)**2/dm**2 end select endif enddo enddo enddo do k=1, np(Hneut) if(Higgstested(k)) then if(chisq(k).le.minchisq(k)) then minchisq(k) = chisq(k) mh_selected(k) = mh !! write(*,*) "hello, ",k, mh, chisq(k) endif else chisq(k)=vlarge endif enddo !!-----For debugging only: if(additional_output) write(147,*) mh,chisq enddo if(additional_output) close(147) !-Now that the optimal mass parameters are determined, get the observed mu values again ! and set them in the mpred observables. jjj=0 do j=lbound(analyses,dim=1),ubound(analyses,dim=1) do jj=lbound(analyses(j)%mpred%mp_Higgses,dim=1),& & ubound(analyses(j)%mpred%mp_Higgses,dim=1) jjj=jjj+1 minchisq2=vlarge do k=1, np(Hneut) testHiggs=.False. do ii=lbound(analyses(j)%mpred%mp_Higgses(jj)%Higgses,dim=1), & & ubound(analyses(j)%mpred%mp_Higgses(jj)%Higgses, dim=1) if(k.eq.analyses(j)%mpred%mp_Higgses(jj)%Higgses(ii)%id) testHiggs=.True. !-Find the Higgs boson in a combination, where the chisq of the variation is lowest. !-if no Higgs bosons are combined, we should have best_Hindex = k if(minchisq(analyses(j)%mpred%mp_Higgses(jj)%Higgses(ii)%id).lt.minchisq2) then minchisq2 = minchisq(analyses(j)%mpred%mp_Higgses(jj)%Higgses(ii)%id) best_Hindex = analyses(j)%mpred%mp_Higgses(jj)%Higgses(ii)%id endif enddo if(testHiggs(jjj,k)) then !-One final chisq test for combined Higgses call interpolate_mutable(val, mh_selected(best_Hindex), analyses(j)%table, step) analyses(j)%mpred%mp_Higgses(jj)%dmu_low_obs = abs(val(2)-val(1)) analyses(j)%mpred%mp_Higgses(jj)%mu_obs = val(2) analyses(j)%mpred%mp_Higgses(jj)%dmu_up_obs = abs(val(3)-val(2)) analyses(j)%mpred%mp_Higgses(jj)%m_obs = mh_selected(best_Hindex) !! write(*,*) "hello: ", val, best_Hindex, mh_selected(best_Hindex) !n.b.: For combined Higgses, the best values obtained for the last Higgs are taken. endif enddo enddo enddo deallocate(Higgstested,chisq,boxstart,boxend,minchisq,mh_selected) deallocate(testHiggs,boxstart_max,boxend_min) end subroutine mass_variation_by_theory_uncertainty !---------------------------------------------------------------------- subroutine smear_mutable(table, mp_H) !---------------------------------------------------------------------- implicit none type(mutable), intent(in) :: table type(mp_neutHiggs), dimension(:), intent(inout) :: mp_H integer :: i,j,imin,imax,col double precision :: mh, val(3), norm call check_pdf imin = lbound(table%mu,dim=1) imax = ubound(table%mu,dim=1) do j=lbound(mp_H,dim=1),ubound(mp_H,dim=1) val = 0.0D0 norm = 0.0D0 do i= imin, imax mh =table%xmin+(i-1)*table%sep do col=1,3 val(col) = val(col) + table%mu(i,col)*masspdf(mh, mp_H(j)%Higgses, table%sep) enddo norm = norm + masspdf(mh, mp_H(j)%Higgses, table%sep) enddo if(norm.ne.0.) val=val/norm mp_H(j)%dmu_low_obs = abs(val(2)-val(1)) mp_H(j)%mu_obs = val(2) mp_H(j)%dmu_up_obs = abs(val(3)-val(2)) mp_H(j)%m_obs = mp_H(j)%m enddo end subroutine smear_mutable !---------------------------------------------------------------------- function masspdf(mh, Higgses, sep) ! This function returns the value of the mass pdf at a given mass mh. ! In the case of combined Higgses, it is returning the sum of the ! individual mass pdfs. If the mass uncertainty is zero (delta-function) ! it returns the pdf values obtained for a mass uncertainty equal to ! the tables separation. !---------------------------------------------------------------------- use usefulbits, only : small implicit none ! double precision, intent(in) :: mh, sep type(neutHiggs), dimension(:), intent(in) :: Higgses double precision :: masspdf integer :: i masspdf=0.0D0 do i=lbound(Higgses,dim=1),ubound(Higgses,dim=1) !! write(*,*) "Mass uncertainty = ",Higgses(i)%dm if(Higgses(i)%dm.le.small) then !! masspdf =masspdf + box(mh, Higgses(i)%m, sep, sep) masspdf =masspdf + box(mh, Higgses(i)%m, Higgses(i)%dm, sep) else select case (pdf) case(1,3) !-box, boxgaussian (==box in mp centered chi^2 method) masspdf = masspdf + box(mh, Higgses(i)%m, Higgses(i)%dm, sep) case(2) !-gaussian masspdf = masspdf + gaussian(mh, Higgses(i)%m, Higgses(i)%dm, sep) end select endif enddo !! write(*,*) "masspdf = ",masspdf end function masspdf !---------------------------------------------------------------------- function box(x,x0,dx,sep) !---------------------------------------------------------------------- use usefulbits, only : small implicit none double precision, intent(in) :: x, x0, dx, sep double precision :: box, norm norm = dx/sep if(norm.le.small) norm=1 ! For the case of dx = 0 (delta-function) if((x.lt.(x0-dx-sep/2.)).or.(x.gt.(x0+dx+sep/2.))) then box = 0.0D0 else box = 1.0D0/norm endif !! write(*,*) "Norm / box = ",norm,box end function box !---------------------------------------------------------------------- function gaussian(x,x0,dx,sep) !---------------------------------------------------------------------- use usefulbits, only : pi implicit none double precision, intent(in) :: x, x0, dx, sep double precision :: gaussian gaussian=exp(-(x-x0)**2/(2*dx**2))*sep/(sqrt(2*pi)*dx) end function !---------------------------------------------------------------------- subroutine combine_Higgses(mp_H, mp_H_tmp, table, finished_combination) !---------------------------------------------------------------------- implicit none type(mp_neutHiggs), dimension(:), intent(inout) :: mp_H type(mp_neutHiggs), allocatable, intent(out) :: mp_H_tmp(:) type(mutable), intent(in) :: table integer, intent(out) :: finished_combination double precision :: massdiff, massdiff_tmp, m_tmp, dm_tmp, mu_tmp integer :: i,j, index_i, index_j !-Determine the nearest neighboring Higgs bosons massdiff=100000.0D0 do i=lbound(mp_H,dim=1),ubound(mp_H,dim=1) do j=lbound(mp_H,dim=1),ubound(mp_H,dim=1) if(i.ne.j) then massdiff_tmp = abs(mp_H(i)%m - mp_H(j)%m) if(massdiff_tmp.le.massdiff) then massdiff = massdiff_tmp index_i = i index_j = j endif endif enddo enddo if(massdiff.le.table%deltam) then finished_combination=-1 !-Do a gaussian average of the two Higgs bosons to determine uncertainty and mass position, !-and add the signal strength modifiers. Untag the combined Higgs bosons. if(mp_H(index_i)%dm.eq.0.0D0.and.mp_H(index_j)%dm.eq.0.0D0) then dm_tmp = 0.0D0 else dm_tmp = mp_H(index_i)%dm*mp_H(index_j)%dm/ & & sqrt(mp_H(index_i)%dm**2+mp_H(index_j)%dm**2) endif if(dm_tmp.ne.0.0D0) then m_tmp = dm_tmp**2*( mp_H(index_i)%m/mp_H(index_i)%dm**2 + & mp_H(index_j)%m/mp_H(index_j)%dm**2 ) else if(mp_H(index_i)%dm.eq.0.0D0.and.mp_H(index_j)%dm.ne.0.0D0) then m_tmp = mp_H(index_i)%m else if(mp_H(index_i)%dm.ne.0.0D0.and.mp_H(index_j)%dm.eq.0.0D0) then m_tmp = mp_H(index_j)%m else m_tmp = (mp_H(index_i)%m + mp_H(index_j)%m )/2.0D0 endif endif !! write(*,*) "m_tmp = ", m_tmp mu_tmp = mp_H(index_i)%mu + mp_H(index_j)%mu mp_H(index_i)%mp_test=0 mp_H(index_j)%mp_test=0 !--Fill the temporary mp_neutHiggs object first with the combination, then with the !--remaining Higgses allocate(mp_H_tmp(size(mp_H,dim=1)-1)) mp_H_tmp(1)%m = m_tmp mp_H_tmp(1)%dm = dm_tmp mp_H_tmp(1)%mu = mu_tmp mp_H_tmp(1)%mp_test = 1 allocate(mp_H_tmp(1)%Higgses(size(mp_H(index_i)%Higgses)+size(mp_H(index_j)%Higgses))) j=0 do i=lbound(mp_H(index_i)%Higgses,dim=1),ubound(mp_H(index_i)%Higgses,dim=1) j=j+1 mp_H_tmp(1)%Higgses(j)=mp_H(index_i)%Higgses(i) enddo do i=lbound(mp_H(index_j)%Higgses,dim=1),ubound(mp_H(index_j)%Higgses,dim=1) j=j+1 mp_H_tmp(1)%Higgses(j)=mp_H(index_j)%Higgses(i) enddo !-Now, fill with remaining, not combined Higgses j=1 do i=lbound(mp_H,dim=1),ubound(mp_H,dim=1) if(mp_H(i)%mp_test.eq.1) then j=j+1 allocate(mp_H_tmp(j)%Higgses(size(mp_H(i)%Higgses,dim=1))) mp_H_tmp(j)%Higgses = mp_H(i)%Higgses mp_H_tmp(j)%m = mp_H(i)%m mp_H_tmp(j)%dm = mp_H(i)%dm mp_H_tmp(j)%mu = mp_H(i)%mu mp_H_tmp(j)%mp_test = mp_H(i)%mp_test endif enddo else finished_combination=1 endif end subroutine combine_Higgses !---------------------------------------------------------------------------- subroutine calculate_mpred_chisq(csq, N) !---------------------------------------------------------------------------- implicit none double precision, intent(out) :: csq integer, intent(out) :: N double precision, allocatable :: v(:), vmat(:,:), invcov(:,:), v2(:) double precision, allocatable :: csq_mu(:) integer :: i,ii,iii N=size(cov_mp,dim=1) allocate(v(N), vmat(N,1),invcov(N,N), v2(N), csq_mu(N)) !-First construct the vector (mupred - muobs)_iii iii=0 do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do ii=lbound(analyses(i)%mpred%mp_Higgses,dim=1),& & ubound(analyses(i)%mpred%mp_Higgses,dim=1) iii=iii+1 v(iii) = analyses(i)%mpred%mp_Higgses(ii)%mu-analyses(i)%mpred%mp_Higgses(ii)%mu_obs vmat(iii,1) = v(iii) enddo enddo call invmatrix(cov_mp,invcov) call matmult(invcov,vmat,v2,N,1) iii=0 do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do ii=lbound(analyses(i)%mpred%mp_Higgses,dim=1),& & ubound(analyses(i)%mpred%mp_Higgses,dim=1) iii=iii+1 csq_mu(iii) = v(iii)*v2(iii) analyses(i)%mpred%mp_Higgses(ii)%chisq = csq_mu(iii) enddo enddo csq=sum(csq_mu) deallocate(v,vmat,invcov,v2,csq_mu) end subroutine calculate_mpred_chisq !---------------------------------------------------------------------------- subroutine create_covariance_matrix_mp !---------------------------------------------------------------------------- implicit none integer :: N, i, ii, iii, j, jj, jjj double precision :: mumax, dmu0sq, dratesq character(LEN=50) :: title if(.not.allocated(analyses)) then stop'Error in subroutine create_covariance_matrix_mp: analyses not allocated.' endif if(allocated(cov_mp)) deallocate(cov_mp) !! write(*,*) "Creating covariance matrix for mpred-method." iii=0 do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do ii=lbound(analyses(i)%mpred%mp_Higgses,dim=1),& & ubound(analyses(i)%mpred%mp_Higgses,dim=1) !--Find out dimension (iii) of covariance matrix. iii=iii+1 mumax=-1.0D10 !--Determine the dominating Higgs for every mpred-observable. do j=lbound(analyses(i)%mpred%mp_Higgses(ii)%Higgses,dim=1),& & ubound(analyses(i)%mpred%mp_Higgses(ii)%Higgses,dim=1) if(analyses(i)%mpred%mp_Higgses(ii)%Higgses(j)%mu.gt.mumax) then mumax=analyses(i)%mpred%mp_Higgses(ii)%Higgses(j)%mu analyses(i)%mpred%mp_Higgses(ii)%domH=analyses(i)%mpred%mp_Higgses(ii)%Higgses(j)%id endif enddo !--Subtract the correlated syst. uncertainties from (smeared) cyan band call correct_mu_uncertainty(analyses(i)%mpred%mp_Higgses(ii),analyses(i)%table) !--(TS 08/05/2013) Calculate the channel weights in the model: call calculate_model_weights(analyses(i)%table, analyses(i)%mpred%mp_Higgses(ii)) !! write(*,*) analyses(i)%mpred%mp_Higgses(ii)%channel_w_model !! write(*,*) analyses(i)%table%channel_w(:,analyses(i)%mpred%mp_Higgses(ii)%domH) enddo enddo allocate(cov_mp(iii,iii)) iii=0 do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do ii=lbound(analyses(i)%mpred%mp_Higgses,dim=1),& & ubound(analyses(i)%mpred%mp_Higgses,dim=1) iii=iii+1 jjj=0 do j=lbound(analyses,dim=1),ubound(analyses,dim=1) do jj=lbound(analyses(j)%mpred%mp_Higgses,dim=1),& & ubound(analyses(j)%mpred%mp_Higgses,dim=1) jjj=jjj+1 cov_mp(iii,jjj)=0.0D0 if(correlations_mu.or.(.not.correlations_mu.and.iii.eq.jjj)) then call get_rate_uncertainties_sq_mpred(dratesq, analyses(i)%table, & & analyses(i)%mpred%mp_Higgses(ii),analyses(j)%table,analyses(j)%mpred%mp_Higgses(jj)) !-----Treat luminosity uncertainty as correlated systematic error if same collaboration: if(analyses(i)%table%collaboration.eq.analyses(i)%table%collaboration) then if(anticorrmu) then cov_mp(iii,jjj)=cov_mp(iii,jjj)+(analyses(i)%table%dlumi*analyses(j)%table%dlumi)& & * (analyses(i)%mpred%mp_Higgses(ii)%mu*analyses(j)%mpred%mp_Higgses(jj)%mu) else cov_mp(iii,jjj)=cov_mp(iii,jjj)+(analyses(i)%table%dlumi*analyses(j)%table%dlumi)& & * abs(analyses(i)%mpred%mp_Higgses(ii)%mu*analyses(j)%mpred%mp_Higgses(jj)%mu) endif endif if(anticorrmu) then ! (TS 28/10/2013: Change scaling of theo. err from observed to predicted mu:) cov_mp(iii,jjj)=cov_mp(iii,jjj)+(dratesq) * & & (analyses(i)%mpred%mp_Higgses(ii)%total_mu*analyses(j)%mpred%mp_Higgses(jj)%total_mu) else cov_mp(iii,jjj)=cov_mp(iii,jjj)+(dratesq) * & & abs(analyses(i)%mpred%mp_Higgses(ii)%total_mu*analyses(j)%mpred%mp_Higgses(jj)%total_mu) endif endif !----Add the intrinsic (uncorrelated) uncertainty of this peak to the diagonal elements: if(iii.eq.jjj) then call get_dmu0sq(dmu0sq,analyses(i)%mpred%mp_Higgses(ii)) cov_mp(iii,jjj) = cov_mp(iii,jjj) + dmu0sq endif enddo enddo enddo enddo end subroutine create_covariance_matrix_mp !------------------------------------------------------------------------------------ subroutine get_rate_uncertainties_sq_mpred(dratesq, table1, mp_H1, table2, mp_H2) !------------------------------------------------------------------------------------ use usefulbits_HS, only : delta_rate type(mp_neutHiggs), intent(in) :: mp_H1, mp_H2 type(mutable), intent(in) :: table1, table2 double precision, intent(out) :: dratesq - integer :: i,j,id1,p1,d1,id2,p2,d2 + integer :: i,j,p1,d1,p2,d2 !id1,id2, double precision :: res res=0.0D0 !! write(*,*) 'table Nc = ',table1%Nc,table2%Nc do i=1,table1%Nc do j=1,table2%Nc - id1 = table1%channel_id(i) - p1 = int((id1-modulo(id1,10))/dble(10)) - d1 = modulo(id1,10) - id2 = table2%channel_id(j) - p2 = int((id2-modulo(id2,10))/dble(10)) - d2 = modulo(id2,10) + p1 = table1%channel_p_id(i) + d1 = table1%channel_d_id(i) + p2 = table2%channel_p_id(j) + d2 = table2%channel_d_id(j) +! +! id1 = table1%channel_id(i) +! p1 = int((id1-modulo(id1,10))/dble(10)) +! d1 = modulo(id1,10) +! id2 = table2%channel_id(j) +! p2 = int((id2-modulo(id2,10))/dble(10)) +! d2 = modulo(id2,10) if(p1.eq.p2) then res=res+delta_rate%dCS(p1)**2* & & mp_H1%channel_w_model(i)*mp_H2%channel_w_model(j) endif if(d1.eq.d2) then res=res+delta_rate%dBR(d1)**2* & & mp_H1%channel_w_model(i)*mp_H2%channel_w_model(j) endif ! if(p1.eq.p2) then ! res=res+delta_rate%dCS(p1)**2* & !& table1%channel_w(i,mp_H1%domH)*table2%channel_w(j,mp_H2%domH) ! endif ! if(d1.eq.d2) then ! res=res+delta_rate%dBR(d1)**2* & !& table1%channel_w(i,mp_H1%domH)*table2%channel_w(j,mp_H2%domH) ! endif enddo enddo dratesq=res end subroutine get_rate_uncertainties_sq_mpred !------------------------------------------------------------------------------------ subroutine calculate_model_weights(table, mp_H) use usefulbits, only : small, div implicit none type(mp_neutHiggs), intent(inout) :: mp_H type(mutable), intent(in) :: table integer :: k,l,Nc double precision :: normalization !--In the (unphysical) case of negative channel rates, we have to take care that the ! model channel weights are still positive and between 0 and 1: normalization = 0.0D0 if(allocated(mp_H%channel_w_model)) deallocate(mp_H%channel_w_model) allocate(mp_H%channel_w_model(table%Nc)) if(allocated(mp_H%channel_mu)) deallocate(mp_H%channel_mu) allocate(mp_H%channel_mu(table%Nc)) mp_H%total_mu=0.0D0 do k=lbound(mp_H%channel_w_model,dim=1),ubound(mp_H%channel_w_model,dim=1) mp_H%channel_mu(k)=0.0D0 do l=lbound(mp_H%Higgses,dim=1),ubound(mp_H%Higgses,dim=1) mp_H%channel_mu(k)=mp_H%channel_mu(k) + & & table%channel_mu(k,mp_H%Higgses(l)%id)*table%channel_w(k,mp_H%Higgses(l)%id) mp_H%total_mu = mp_H%total_mu + & & table%channel_mu(k,mp_H%Higgses(l)%id)*table%channel_w(k,mp_H%Higgses(l)%id) enddo enddo normalization = 0.0D0 do k=lbound(mp_H%channel_w_model,dim=1),ubound(mp_H%channel_w_model,dim=1) mp_H%channel_w_model(k)=div(mp_H%channel_mu(k),mp_H%total_mu,0.0D0,1.0D9) normalization = normalization + abs(mp_H%channel_w_model(k)) enddo if(abs(normalization).gt.small) then do k=lbound(mp_H%channel_w_model,dim=1),ubound(mp_H%channel_w_model,dim=1) mp_H%channel_w_model(k) = div(abs(mp_H%channel_w_model(k)),& & normalization,1.0D0/table%Nc,1.0D0) enddo else !--If the predicted signal strength is zero, use SM weights do k=lbound(mp_H%channel_w_model,dim=1),ubound(mp_H%channel_w_model,dim=1) mp_H%channel_w_model(k) = table%channel_w(k,mp_H%domH) enddo endif if(abs(sum(mp_H%channel_w_model)-1.0D0).gt.small) then write(*,*) "WARNING: Channel weights of the model are not correctly normalized:" write(*,*) mp_H%channel_w_model endif end subroutine calculate_model_weights subroutine correct_mu_uncertainty(mp_H, table) ! The mu uncertainty as given in the mutable contains also systematic uncertainties for ! the luminosity and signal rate. These uncertainties are highly correlated to other ! analyses. Therefore, we subtract them here to obtain the intrinsic mu uncertainty of ! this peak. The correlated uncertainties enter later via the covariance matrix. !------------------------------------------------------------------------------------ implicit none type(mp_neutHiggs), intent(inout) :: mp_H type(mutable), intent(in) :: table integer :: i double precision :: dcsq, dmuupsq, dmulowsq dcsq = 0 do i=1, table%Nc dcsq = dcsq + table%channel_systSM(i,mp_H%domH)**2 enddo dmuupsq = (mp_H%dmu_up_obs)**2-(table%dlumi*mp_H%mu_obs)**2-dcsq*mp_H%mu_obs**2 dmulowsq = (mp_H%dmu_low_obs)**2-(table%dlumi*mp_H%mu_obs)**2-dcsq*mp_H%mu_obs**2 mp_H%dmu_low0_obs = sqrt(abs((mp_H%dmu_low_obs)**2- & & (table%dlumi*mp_H%mu_obs)**2-dcsq*mp_H%mu_obs**2)) if(dmulowsq.lt.0.0D0) mp_H%dmu_low0_obs = - mp_H%dmu_low0_obs mp_H%dmu_up0_obs = sqrt(abs((mp_H%dmu_up_obs)**2- & & (table%dlumi*mp_H%mu_obs)**2-dcsq*mp_H%mu_obs**2)) if(dmuupsq.lt.0.0D0) mp_H%dmu_up0_obs = - mp_H%dmu_up0_obs end subroutine correct_mu_uncertainty !------------------------------------------------------------------------------------ subroutine get_dmu0sq(dmu0sq,mp_H) !------------------------------------------------------------------------------------ use usefulbits_hs, only : symmetricerrors implicit none double precision, intent(out) :: dmu0sq double precision :: pred_mu type(mp_neutHiggs), intent(in) :: mp_H pred_mu = mp_H%mu if(.not.symmetricerrors) then if(pred_mu.le.mp_H%mu_obs) then dmu0sq = mp_H%dmu_low0_obs**2 else if(pred_mu.gt.mp_H%mu_obs) then dmu0sq = mp_H%dmu_up0_obs**2 endif else dmu0sq = (sqrt(mp_H%dmu_low0_obs**2)+sqrt(mp_H%dmu_up0_obs**2))**2/4. endif end subroutine get_dmu0sq !------------------------------------------------------------------------------------ subroutine get_lower_or_upper_value_difference(val,pred,dataval) !------------------------------------------------------------------------------------ implicit none double precision, intent(out) :: val double precision, intent(in) :: pred double precision, dimension(3) :: dataval if(pred.le.dataval(2)) then val = abs(dataval(2)-dataval(1)) else if(pred.gt.dataval(2)) then val = abs(dataval(3)-dataval(2)) endif end subroutine get_lower_or_upper_value_difference !------------------------------------------------------------------------------------ subroutine check_pdf !------------------------------------------------------------------------------------ implicit none if(.not.((pdf.eq.1).or.(pdf.eq.2).or.(pdf.eq.3))) then write(*,*) 'WARNING: pdf not properly specified. Will be set to pdf=2 (gaussian-shape)' pdf=2 endif end subroutine check_pdf !------------------------------------------------------------------------------------ function Higgscomb_key(Higgses) implicit none type(neutHiggs), dimension(:), intent(in) :: Higgses integer :: Higgscomb_key integer :: i,keytmp,power keytmp=0 power =0 do i=lbound(Higgses,dim=1),ubound(Higgses,dim=1) keytmp = keytmp + Higgses(i)%id * 10**power power = power+1 enddo Higgscomb_key = keytmp end function Higgscomb_key !------------------------------------------------------------------------------------ subroutine deallocate_mc_observables implicit none integer :: i,j if(allocated(analyses)) then do i=lbound(analyses,dim=1),ubound(analyses,dim=1) if(allocated(analyses(i)%mpred%mp_Higgses)) then do j=lbound(analyses(i)%mpred%mp_Higgses,dim=1),& & ubound(analyses(i)%mpred%mp_Higgses,dim=1) if(allocated(analyses(i)%mpred%mp_Higgses(j)%Higgses)) then deallocate(analyses(i)%mpred%mp_Higgses(j)%Higgses) endif if(allocated(analyses(i)%mpred%mp_Higgses(j)%channel_w_model)) then deallocate(analyses(i)%mpred%mp_Higgses(j)%channel_w_model) endif if(allocated(analyses(i)%mpred%mp_Higgses(j)%channel_mu)) then deallocate(analyses(i)%mpred%mp_Higgses(j)%channel_mu) endif enddo deallocate(analyses(i)%mpred%mp_Higgses) endif enddo endif end subroutine deallocate_mc_observables !------------------------------------------------------------------------------------ end module mc_chisq \ No newline at end of file Index: trunk/HiggsSignals-2/example_data/SLHA/SLHA_FHexample.fh.1 =================================================================== --- trunk/HiggsSignals-2/example_data/SLHA/SLHA_FHexample.fh.1 (revision 568) +++ trunk/HiggsSignals-2/example_data/SLHA/SLHA_FHexample.fh.1 (revision 569) @@ -1,381 +1,381 @@ BLOCK SPINFO 1 FeynHiggs 2 2.8.6 2 built on Feb 23, 2012 BLOCK MODSEL 1 1 # Model 3 0 # Content 4 0 # RPV 5 2 # CPV 6 0 # FV BLOCK SMINPUTS 1 1.28936827E+02 # invAlfaMZ 2 1.16639000E-05 # GF 3 1.18000000E-01 # AlfasMZ 4 9.11870000E+01 # MZ 5 4.25000000E+00 # Mb 6 1.75000000E+02 # Mt 7 1.77703000E+00 # Mtau 11 5.10998902E-04 # Me 13 1.05658357E-01 # Mmu 21 6.00000000E-03 # Md 22 3.00000000E-03 # Mu 23 9.50000000E-02 # Ms 24 1.28600000E+00 # Mc BLOCK MINPAR 1 0.00000000E+00 # M0 2 0.00000000E+00 # M12 3 1.00000000E+01 # TB 4 1.00000000E+00 # signMUE 5 -0.00000000E+00 # A BLOCK EXTPAR 0 4.84786694E+02 # Q 1 3.00000000E+02 # M1 2 6.00000000E+02 # M2 3 1.00000000E+03 # M3 11 1.00000000E+03 # At 12 3.00000000E+02 # Ab 13 2.00000000E+02 # Atau 23 1.00000000E+02 # MUE 24 1.40000000E+05 # MA02 25 1.00000000E+01 # TB 26 3.74165739E+02 # MA0 27 3.82704682E+02 # MHp 31 2.06630723E+02 # MSL(1) 32 2.06645846E+02 # MSL(2) 33 1.34514453E+02 # MSL(3) 34 1.43872558E+02 # MSE(1) 35 1.43838140E+02 # MSE(2) 36 2.10401949E+02 # MSE(3) 41 5.64892619E+02 # MSQ(1) 42 5.64902784E+02 # MSQ(2) 43 4.58749215E+02 # MSQ(3) 44 5.47790210E+02 # MSU(1) 45 5.47775859E+02 # MSU(2) 46 5.89079372E+02 # MSU(3) 47 5.47601268E+02 # MSD(1) 48 5.47594947E+02 # MSD(2) 49 5.47471349E+02 # MSD(3) BLOCK MASS 1000012 1.96522387E+02 # MSf(1,1,1) 2000012 1.00000000+123 # MSf(2,1,1) 1000011 1.50049429E+02 # MSf(1,2,1) 2000011 2.12028169E+02 # MSf(2,2,1) 1000002 5.46684341E+02 # MSf(1,3,1) 2000002 5.62350503E+02 # MSf(2,3,1) 1000001 5.48153556E+02 # MSf(1,4,1) 2000001 5.67955726E+02 # MSf(2,4,1) 1000014 1.96538288E+02 # MSf(1,1,2) 2000014 1.00000000+123 # MSf(2,1,2) 1000013 1.50015405E+02 # MSf(1,2,2) 2000013 2.12043684E+02 # MSf(2,2,2) 1000004 5.46585835E+02 # MSf(1,3,2) 2000004 5.62283026E+02 # MSf(2,3,2) 1000003 5.48147074E+02 # MSf(1,4,2) 2000003 5.67966013E+02 # MSf(2,4,2) 1000016 1.18401567E+02 # MSf(1,1,3) 2000016 1.00000000+123 # MSf(2,1,3) 1000015 1.42403224E+02 # MSf(1,2,3) 2000015 2.14862660E+02 # MSf(2,2,3) 1000006 3.29129281E+02 # MSf(1,3,3) 2000006 6.76789745E+02 # MSf(2,3,3) 1000005 4.50942677E+02 # MSf(1,4,3) 2000005 5.51183125E+02 # MSf(2,4,3) 25 1.22651152E+02 # Mh0 35 3.74749649E+02 # MHH 36 3.74165739E+02 # MA0 37 3.82764933E+02 # MHp 1000022 8.77717849E+01 # MNeu(1) 1000023 1.05731705E+02 # MNeu(2) 1000025 3.06628639E+02 # MNeu(3) 1000035 6.11331282E+02 # MNeu(4) 1000024 9.60565070E+01 # MCha(1) 1000037 6.11309165E+02 # MCha(2) 1000021 1.00000000E+03 # MGl BLOCK DMASS 0 1.75000000E+02 # Q 25 9.72174332E-01 # Delta Mh0 35 1.06946442E-02 # Delta MHH 36 0.00000000E+00 # Delta MA0 37 8.06715487E-02 # Delta MHp BLOCK NMIX 1 1 1.47271688E-01 # ZNeu(1,1) 1 2 -1.13979916E-01 # ZNeu(1,2) 1 3 7.30717872E-01 # ZNeu(1,3) 1 4 -6.56788414E-01 # ZNeu(1,4) 2 1 -0.00000000E+00 # ZNeu(2,1) 2 2 0.00000000E+00 # ZNeu(2,2) 2 3 0.00000000E+00 # ZNeu(2,3) 2 4 0.00000000E+00 # ZNeu(2,4) 3 1 9.86458640E-01 # ZNeu(3,1) 3 2 4.16346543E-02 # ZNeu(3,2) 3 3 -6.05146385E-02 # ZNeu(3,3) 3 4 1.46642030E-01 # ZNeu(3,4) 4 1 -1.92855611E-02 # ZNeu(4,1) 4 2 9.89795429E-01 # ZNeu(4,2) 4 3 3.54417152E-02 # ZNeu(4,3) 4 4 -1.36663681E-01 # ZNeu(4,4) BLOCK IMNMIX 1 1 0.00000000E+00 # ZNeu(1,1) 1 2 0.00000000E+00 # ZNeu(1,2) 1 3 0.00000000E+00 # ZNeu(1,3) 1 4 0.00000000E+00 # ZNeu(1,4) 2 1 -6.95590979E-02 # ZNeu(2,1) 2 2 7.47003613E-02 # ZNeu(2,2) 2 3 6.79067931E-01 # ZNeu(2,3) 2 4 7.26944381E-01 # ZNeu(2,4) 3 1 0.00000000E+00 # ZNeu(3,1) 3 2 0.00000000E+00 # ZNeu(3,2) 3 3 0.00000000E+00 # ZNeu(3,3) 3 4 0.00000000E+00 # ZNeu(3,4) 4 1 0.00000000E+00 # ZNeu(4,1) 4 2 0.00000000E+00 # ZNeu(4,2) 4 3 0.00000000E+00 # ZNeu(4,3) 4 4 0.00000000E+00 # ZNeu(4,4) BLOCK UMIX 1 1 -4.97233578E-02 # UCha(1,1) 1 2 9.98763029E-01 # UCha(1,2) 2 1 9.98763029E-01 # UCha(2,1) 2 2 4.97233578E-02 # UCha(2,2) BLOCK VMIX 1 1 -1.92962310E-01 # VCha(1,1) 1 2 9.81206170E-01 # VCha(1,2) 2 1 9.81206170E-01 # VCha(2,1) 2 2 1.92962310E-01 # VCha(2,2) BLOCK STAUMIX 1 1 9.98486400E-01 # USf(1,1) 1 2 5.49991646E-02 # USf(1,2) 2 1 -5.49991646E-02 # USf(2,1) 2 2 9.98486400E-01 # USf(2,2) BLOCK STOPMIX 1 1 8.23605275E-01 # USf(1,1) 1 2 -5.67163425E-01 # USf(1,2) 2 1 5.67163425E-01 # USf(2,1) 2 2 8.23605275E-01 # USf(2,2) BLOCK SBOTMIX 1 1 9.99954439E-01 # USf(1,1) 1 2 9.54568581E-03 # USf(1,2) 2 1 -9.54568581E-03 # USf(2,1) 2 2 9.99954439E-01 # USf(2,2) BLOCK ALPHA -1.17451823E-01 # Alpha BLOCK DALPHA 1.46801249E-03 # Delta Alpha BLOCK VCKMIN 1 2.25300000E-01 # lambda 2 8.08000000E-01 # A 3 1.32000000E-01 # rhobar 4 3.41000000E-01 # etabar BLOCK MSL2IN 1 1 4.26962557E+04 # MSL2(1,1) 2 2 4.27025057E+04 # MSL2(2,2) 3 3 1.80941381E+04 # MSL2(3,3) BLOCK MSE2IN 1 1 2.06993129E+04 # MSE2(1,1) 2 2 2.06894105E+04 # MSE2(2,2) 3 3 4.42689801E+04 # MSE2(3,3) BLOCK MSQ2IN 1 1 3.19103671E+05 # MSQ2(1,1) 2 2 3.19115155E+05 # MSQ2(2,2) 3 3 1.99881446E+05 # MSQ2(3,3) BLOCK MSU2IN 1 1 3.00074114E+05 # MSU2(1,1) 2 2 3.00058392E+05 # MSU2(2,2) 3 3 3.16134306E+05 # MSU2(3,3) BLOCK MSD2IN 1 1 2.99867149E+05 # MSD2(1,1) 2 2 2.99860226E+05 # MSD2(2,2) 3 3 3.03181540E+05 # MSD2(3,3) BLOCK TEIN 1 1 5.89936191E-04 # Tf(1,1) 2 2 1.21980083E-01 # Tf(2,2) 3 3 2.05153926E+00 # Tf(3,3) BLOCK TUIN 1 1 1.73171465E-01 # Tf(1,1) 2 2 7.42328349E+01 # Tf(2,2) 3 3 9.53077892E+03 # Tf(3,3) BLOCK TDIN 1 1 1.03902879E-02 # Tf(1,1) 2 2 1.64512892E-01 # Tf(2,2) 3 3 1.56232003E+01 # Tf(3,3) BLOCK CVHMIX 1 1 9.99984377E-01 # UH(1,1) 1 2 5.58985436E-03 # UH(1,2) 1 3 0.00000000E+00 # UH(1,3) 2 1 -5.58985436E-03 # UH(2,1) 2 2 9.99984377E-01 # UH(2,2) 2 3 0.00000000E+00 # UH(2,3) 3 1 0.00000000E+00 # UH(3,1) 3 2 0.00000000E+00 # UH(3,2) 3 3 1.00000000E+00 # UH(3,3) BLOCK PRECOBS 1 4.58620642E-04 # DeltaRho 2 8.03985711E+01 # MWMSSM 3 8.03727370E+01 # MWSM 4 2.31309273E-01 # SW2effMSSM 5 2.31452470E-01 # SW2effSM 11 1.47612393E-09 # gminus2mu 21 0.00000000E+00 # EDMeTh 22 0.00000000E+00 # EDMn 23 0.00000000E+00 # EDMHg 31 7.83340682E-04 # bsgammaMSSM 32 3.84151628E-04 # bsgammaSM 33 2.29365346E+01 # DeltaMsMSSM 34 2.19915791E+01 # DeltaMsSM DECAY 25 4.66729789E-03 # Gamma(h0) 1.67729727E-03 2 22 22 # BR(h0 -> photon photon) 1.72630719E-02 2 23 23 # BR(h0 -> Z Z) 1.49508769E-01 2 -24 24 # BR(h0 -> W W) 4.98888879E-02 2 21 21 # BR(h0 -> gluon gluon) 5.91016012E-09 2 -11 11 # BR(h0 -> Electron electron) 2.62892978E-04 2 -13 13 # BR(h0 -> Muon muon) 7.57524936E-02 2 -15 15 # BR(h0 -> Tau tau) 1.71225452E-07 2 -2 2 # BR(h0 -> Up up) 2.39510771E-02 2 -4 4 # BR(h0 -> Charm charm) 9.86900853E-07 2 -1 1 # BR(h0 -> Down down) 2.47844298E-04 2 -3 3 # BR(h0 -> Strange strange) 6.81446502E-01 2 -5 5 # BR(h0 -> Bottom bottom) DECAY 35 7.83706554E-01 # Gamma(HH) 3.06707834E-06 2 22 22 # BR(HH -> photon photon) 1.74379832E-03 2 23 23 # BR(HH -> Z Z) 3.80819738E-03 2 -24 24 # BR(HH -> W W) 6.56064077E-04 2 21 21 # BR(HH -> gluon gluon) 7.54257349E-09 2 -11 11 # BR(HH -> Electron electron) 3.35617824E-04 2 -13 13 # BR(HH -> Muon muon) 9.73136619E-02 2 -15 15 # BR(HH -> Tau tau) 3.26751691E-11 2 -2 2 # BR(HH -> Up up) 4.57357974E-06 2 -4 4 # BR(HH -> Charm charm) 2.51100369E-02 2 -6 6 # BR(HH -> Top top) 1.00572923E-06 2 -1 1 # BR(HH -> Down down) 2.52571792E-04 2 -3 3 # BR(HH -> Strange strange) 6.71514561E-01 2 -5 5 # BR(HH -> Bottom bottom) 8.67236607E-02 2 -1000024 1000024 # BR(HH -> Chargino1 chargino1) 4.30707320E-02 2 1000022 1000022 # BR(HH -> neutralino1 neutralino1) 9.07746163E-03 2 1000022 1000023 # BR(HH -> neutralino1 neutralino2) 1.60515467E-02 2 1000023 1000023 # BR(HH -> neutralino2 neutralino2) 3.42640993E-02 2 25 25 # BR(HH -> h0 h0) 4.05662328E-04 2 -1000011 1000011 # BR(HH -> Selectron1 selectron1) 3.21302032E-10 2 -1000011 2000011 # BR(HH -> Selectron1 selectron2) 3.21302032E-10 2 -2000011 1000011 # BR(HH -> Selectron2 selectron1) 4.03871097E-04 2 -1000013 1000013 # BR(HH -> Smuon1 smuon1) 1.37454954E-05 2 -1000013 2000013 # BR(HH -> Smuon1 smuon2) 1.37454954E-05 2 -2000013 1000013 # BR(HH -> Smuon2 smuon1) 1.80571224E-04 2 -1000015 1000015 # BR(HH -> Stau1 stau1) 4.52587015E-03 2 -1000015 2000015 # BR(HH -> Stau1 stau2) 4.52587015E-03 2 -2000015 1000015 # BR(HH -> Stau2 stau1) DECAY 36 8.89538917E-01 # Gamma(A0) 6.11274373E-06 2 22 22 # BR(A0 -> photon photon) 6.30977419E-04 2 21 21 # BR(A0 -> gluon gluon) 6.58260322E-09 2 -11 11 # BR(A0 -> Electron electron) 2.92902511E-04 2 -13 13 # BR(A0 -> Muon muon) 8.49304516E-02 2 -15 15 # BR(A0 -> Tau tau) 1.88836298E-11 2 -2 2 # BR(A0 -> Up up) 2.64328808E-06 2 -4 4 # BR(A0 -> Charm charm) 1.16717546E-01 2 -6 6 # BR(A0 -> Top top) 8.77995484E-07 2 -1 1 # BR(A0 -> Down down) 2.20493704E-04 2 -3 3 # BR(A0 -> Strange strange) 5.86468722E-01 2 -5 5 # BR(A0 -> Bottom bottom) 1.14286977E-01 2 -1000024 1000024 # BR(A0 -> Chargino1 chargino1) 7.10303312E-02 2 1000022 1000022 # BR(A0 -> neutralino1 neutralino1) 8.23874194E-04 2 1000022 1000023 # BR(A0 -> neutralino1 neutralino2) 1.29641313E-02 2 1000023 1000023 # BR(A0 -> neutralino2 neutralino2) 3.87218821E-03 2 23 25 # BR(A0 -> Z h0) 6.41227277E-35 2 25 25 # BR(A0 -> h0 h0) 2.72541936E-10 2 -1000011 2000011 # BR(A0 -> Selectron1 selectron2) 2.72541936E-10 2 -2000011 1000011 # BR(A0 -> Selectron2 selectron1) 1.16605248E-05 2 -1000013 2000013 # BR(A0 -> Smuon1 smuon2) 1.16605248E-05 2 -2000013 1000013 # BR(A0 -> Smuon2 smuon1) 3.86422166E-03 2 -1000015 2000015 # BR(A0 -> Stau1 stau2) 3.86422166E-03 2 -2000015 1000015 # BR(A0 -> Stau2 stau1) DECAY 37 5.77103523E-01 # Gamma(Hp) 1.09735497E-08 2 -11 12 # BR(Hp -> Electron nu_e) 4.69153370E-04 2 -13 14 # BR(Hp -> Muon nu_mu) 1.32702162E-01 2 -15 16 # BR(Hp -> Tau nu_tau) 1.30918860E-06 2 -1 2 # BR(Hp -> Down up) 3.32233240E-04 2 -3 4 # BR(Hp -> Strange charm) 8.18940930E-01 2 -5 6 # BR(Hp -> Bottom top) 1.11828834E-03 2 1000022 1000024 # BR(Hp -> neutralino1 chargino1) 1.56473147E-02 2 1000023 1000024 # BR(Hp -> neutralino2 chargino1) 6.98960586E-03 2 -25 24 # BR(Hp -> H0 W) 7.69953813E-08 2 -35 24 # BR(Hp -> HH W) 1.07948719E-07 2 -36 24 # BR(Hp -> A0 W) 1.33187463E-09 2 -1000011 1000012 # BR(Hp -> Selectron1 snu_e1) 5.69556904E-05 2 -1000013 1000014 # BR(Hp -> Smuon1 snu_mu1) 2.27100515E-03 2 -1000015 1000016 # BR(Hp -> Stau1 snu_tau1) 1.96608875E-02 2 -2000015 1000016 # BR(Hp -> Stau2 snu_tau1) DECAY 6 1.42276225E+00 # Gamma(top) 1.00000000E+00 2 5 24 # BR(top -> bottom W) # Block HiggsBoundsInputHiggsCouplingsBosons # For exact definitions of NormEffCoupSq see HiggsBounds manual 1.01380 3 25 24 24 # higgs-W-W effective coupling^2, normalised to SM 0.224092E-03 3 35 24 24 # higgs-W-W effective coupling^2, normalised to SM 0.00000 3 36 24 24 # higgs-W-W effective coupling^2, normalised to SM 1.01380 3 25 23 23 # higgs-Z-Z effective coupling^2, normalised to SM 0.224092E-03 3 35 23 23 # higgs-Z-Z effective coupling^2, normalised to SM 0.00000 3 36 23 23 # higgs-Z-Z effective coupling^2, normalised to SM 0.842307 3 25 21 21 # higgs-gluon-gluon effective coupling^2, normalised to SM 0.303613E-01 3 35 21 21 # higgs-gluon-gluon effective coupling^2, normalised to SM 0.415637E-01 3 36 21 21 # higgs-gluon-gluon effective coupling^2, normalised to SM 0.00000 3 25 25 23 # higgs-higgs-Z effective coupling^2, normalised 0.00000 3 35 25 23 # higgs-higgs-Z effective coupling^2, normalised 0.00000 3 35 35 23 # higgs-higgs-Z effective coupling^2, normalised 0.344859E-03 3 36 25 23 # higgs-higgs-Z effective coupling^2, normalised 0.952528 3 36 35 23 # higgs-higgs-Z effective coupling^2, normalised 0.00000 3 36 36 23 # higgs-higgs-Z effective coupling^2, normalised 0.00000 4 25 21 21 23 # higgs-gluon-gluon-Z effective coupling^2, normalised to SM 0.00000 4 35 21 21 23 # higgs-gluon-gluon-Z effective coupling^2, normalised to SM 0.00000 4 36 21 21 23 # higgs-gluon-gluon-Z effective coupling^2, normalised to SM # Block HiggsBoundsInputHiggsCouplingsFermions # For exact definitions of NormEffCoupSq see HiggsBounds manual # ScalarNormEffCoupSq PseudoSNormEffCoupSq NP IP1 IP2 IP3 # Scalar, Pseudoscalar Normalised Effective Coupling Squared 1.4201311968339043 0.0000000000000000 3 25 5 5 # higgs-b-b eff. coupling^2, normalised to SM 94.055378696286240 0.0000000000000000 3 35 5 5 # higgs-b-b eff. coupling^2, normalised to SM 2.11691722613467644E-042 93.199701998261276 3 36 5 5 # higgs-b-b eff. coupling^2, normalised to SM 1.0099456255672334 0.0000000000000000 3 25 6 6 # higgs-top-top eff. coupling^2, normalised to SM 1.33592532043404228E-002 0.0000000000000000 3 35 6 6 # higgs-top-top eff. coupling^2, normalised to SM 0.0000000000000000 1.00000000000000019E-002 3 36 6 6 # higgs-top-top eff. coupling^2, normalised to SM 1.4359623579970071 0.0000000000000000 3 25 15 15 # higgs-tau-tau eff. coupling^2, normalised to SM 100.92889030196287 0.0000000000000000 3 35 15 15 # higgs-tau-tau eff. coupling^2, normalised to SM 0.0000000000000000 100.00000000000000 3 36 15 15 # higgs-tau-tau eff. coupling^2, normalised to SM Block HiggsBoundsResults # results from HiggsBounds http://projects.hepforge.org/higgsbounds # HBresult : scenario allowed flag (1: allowed, 0: excluded, -1: unphysical) # chan id number: most sensitive channel (see below). chan=0 if no channel applies # obsratio : ratio [sig x BR]_model/[sig x BR]_limit (<1: allowed, >1: excluded) # ncomb : number of Higgs bosons combined in most sensitive channel # Note that the HB channel id number varies depending on the HB version and setting "whichanalyses" # 0 4.3.1 ||LandH|| # version of HB used to produce these results,the HB setting "whichanalyses" # #CHANNELTYPE 1: channel with the highest statistical sensitivity 1 1 554 # channel id number 1 2 1 # HBresult 1 3 0.44814004376367617 # obsratio 1 4 2 # ncombined 1 5 ||(pp)->h3->tautau, using -2ln(L) reconstruction (CMS-HIG-PAS 14-029)|| # text description of channel # BLOCK HiggsSignalsResults 0 ||2.2.0beta|| # HiggsSignals version 1 ||latestresults|| # experimental data set 2 1 # Chi-squared method ("peak"(1) or "mass"(2)-centered or "both"(3)) 3 2 # Parametrization of Higgs mass uncertainty (1:box, 2:gaussian, 3:box+gaussian) 4 0 # Number of signal strength peak observables - 5 1639987488 # Number of simplified template cross section (STXS) signal rate observables - 6 32690 # Number of LHC Run-1 signal rate observables - 7 1641037874 # Number of Higgs mass observables + 5 -1169154096 # Number of simplified template cross section (STXS) signal rate observables + 6 32728 # Number of LHC Run-1 signal rate observables + 7 -1168097192 # Number of Higgs mass observables 8 -1 # Number of observables (total) 9 0.00000000 # chi^2 from signal strength peak observables 10 0.00000000 # chi^2 from STXS signal rate observables 11 0.00000000 # chi^2 from LHC Run-1 signal rate observables 12 0.00000000 # chi^2 from Higgs mass peak observables 13 0.00000000 # chi^2 from STXS mass observables 14 0.00000000 # chi^2 from LHC Run-1 mass observables 15 0.00000000 # chi^2 from signal strength (total) 16 0.00000000 # chi^2 (total) 17 -1.00000000 # Probability for peak observables 18 -1.00000000 # Probability for LHC-Run1 observables 19 -1.00000000 # Probability for STXS observables 20 -1.00000000 # Probability (total chi^2, total number observables) BLOCK HiggsSignalsPeakObservables # OBS FLAG VALUE # DESCRIPTION Index: trunk/HiggsSignals-2/pc_chisq.f90 =================================================================== --- trunk/HiggsSignals-2/pc_chisq.f90 (revision 568) +++ trunk/HiggsSignals-2/pc_chisq.f90 (revision 569) @@ -1,2538 +1,2556 @@ !-------------------------------------------------------------------- ! This file is part of HiggsSignals (TS 03/03/2013) !-------------------------------------------------------------------- module pc_chisq use numerics use combinatorics use usefulbits_hs implicit none integer :: i,j,k double precision,parameter :: pi=3.14159265358979323846264338328D0 integer, allocatable :: peakindices_best(:,:) contains !------------------------------------------------------------------------------------ subroutine set_toyvalues(ii, peaks) ! This subroutine sets the mass and mu measurements of the peak observable(s) of analyses ii ! to those values which are given by the user using assign_toyvalues_to_observables. !------------------------------------------------------------------------------------ use usefulbits_hs, only: obs, mupeak integer, intent(in) :: ii type(mupeak),dimension(:), intent(inout) :: peaks integer :: i if(obs(ii)%table%npeaks.ne.size(peaks)) then stop 'Error in subroutine set_toyvalues: Number of peaks does not match!' endif do i=lbound(peaks,dim=1),ubound(peaks,dim=1) peaks(i)%mpeak = obs(ii)%table%Toys_mhobs(i) peaks(i)%mu = obs(ii)%table%Toys_muobs(i) enddo end subroutine set_toyvalues !------------------------------------------------------------------------------------ !subroutine scale_uncertainties(ii, peaks) !! Scales the uncertainty of the signal strength and mass measurement of the peak !! observables of analysis ii by the scalefactors which have been set via the subroutine !! assign_uncertainty_scalefactors_to_observables. !!------------------------------------------------------------------------------------ ! use usefulbits_hs, only : obs, mupeak ! ! integer, intent(in) :: ii ! type(mupeak),dimension(:), intent(inout) :: peaks ! integer :: i ! ! if(obs(ii)%table%npeaks.ne.size(peaks)) then ! stop 'Error in subroutine scale_uncertainties: Number of peaks does not match!' ! endif ! ! do i=lbound(peaks,dim=1),ubound(peaks,dim=1) ! peaks(i)%dmuup = obs(ii)%table%scale_mu(i)*peaks(i)%dmuup ! peaks(i)%dmulow = obs(ii)%table%scale_mu(i)*peaks(i)%dmulow ! peaks(i)%dm = obs(ii)%table%scale_mh(i)*peaks(i)%dm ! enddo ! !end subroutine scale_uncertainties !------------------------------------------------------------------------------------ !subroutine restore_uncertainties(ii, peaks) !! Restores the uncertainty of the signal strength and mass measurement of the peak !! observables of analysis ii after scaling. !!------------------------------------------------------------------------------------ ! use usefulbits, only : vsmall ! use usefulbits_hs, only : obs, mupeak ! ! integer, intent(in) :: ii ! type(mupeak),dimension(:), intent(inout) :: peaks ! integer :: i ! ! if(obs(ii)%table%npeaks.ne.size(peaks)) then ! stop 'Error in subroutine restore_uncertainties: Number of peaks does not match!' ! endif ! ! do i=lbound(peaks,dim=1),ubound(peaks,dim=1) ! if(obs(ii)%table%scale_mu(i).ge.vsmall) then ! peaks(i)%dmuup = peaks(i)%dmuup/obs(ii)%table%scale_mu(i) ! peaks(i)%dmulow = peaks(i)%dmulow/obs(ii)%table%scale_mu(i) ! else ! write(*,*) 'WARNING: scale_mu is (too close to) zero!' ! endif ! if(obs(ii)%table%scale_mh(i).ge.vsmall) then ! peaks(i)%dm = peaks(i)%dm/obs(ii)%table%scale_mh(i) ! else ! write(*,*) 'WARNING: scale_mh is (too close to) zero!' ! endif ! enddo ! !end subroutine restore_uncertainties !!------------------------------------------------------------------------------------ subroutine assign_Higgs_to_peaks_with_correlations(iter) ! Do this only for pdf = 2 ! ! NOTE: This is possibly still buggy. Only use it with iter=0. ! TODO: Have to extend this here for assignment-groups. !------------------------------------------------------------------------------------ use usefulbits_HS, only : neutHiggses, nanalys use usefulbits, only : np, Hneut implicit none integer, intent(in) :: iter integer :: i, ii, iii, n, jjj character(LEN=100), allocatable :: assignmentgroups(:) integer, allocatable :: assignmentgroups_Higgs_comb(:,:) !! allocate(assignmentgroups(nanalys)) !! allocate(assignmentgroups_Higgs_comb(nanalys,np(Hneut))) !! write(*,*) "Running assign_Higgs_to_peaks_with_correlations." if(iter.gt.0) write(*,*) "WARNING: Iterations in the Higgs-to-peaks assignment are ",& & "still under development." jjj = 1 do n=1, iter call create_covariance_matrices() iii=0 do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do ii=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) iii=iii+1 analyses(i)%peaks(ii)%internalnumber = iii enddo call assign_Higgs_to_peaks(analyses(i)%table, analyses(i)%peaks, n) enddo enddo end subroutine assign_Higgs_to_peaks_with_correlations !------------------------------------------------------------------------------------ subroutine assign_Higgs_to_peaks(table, peaks, iterstep) ! This subroutine assigns the best combination of Higgs bosons to each peak observable ! found in ONE mutable/analysis. ! It calculates for every possible assignment of the Higgs bosons to the peaks a ! chi-squared value. It takes care that each Higgs boson is used for at most one peak. ! The combination with the minimal chi-squared value is selected. The relevant information ! about the assigned Higgs bosons is then saved in each peak object. !------------------------------------------------------------------------------------ use usefulbits, only : div, np, Hneut implicit none type(mutable), intent(in) :: table type(mupeak), dimension(:), intent(inout) :: peaks(:) integer, intent(in) :: iterstep integer, allocatable :: peakindices_best(:,:), domH(:), domH_tmp(:) integer, allocatable :: Higgs_to_be_assigned(:),Higgs_fulfills_req_assignment(:) integer :: Npeaks, nH, a, i, j, ii,jj, Hindex, NHiggs integer :: Higgs_assignment_forced,Higgs_assignment_forced_tmp double precision :: pccsq, pccsq_tmp, chisq_fp !! integer, allocatable :: indices_best(:) double precision :: force_in_range chisq_fp = 10000000.0D0 nH=np(Hneut) Npeaks=size(peaks) ! write(*,*) 'DEBUG: Calling assign_Higgs_to_peaks for' ! write(*,*) 'table ID = ',table%id ! write(*,*) 'table expt, desc = ',table%expt, table%desc if(Npeaks.le.0) then if(iterstep.eq.0) then write(*,'(A,1X,A,1X,A,1X,A,F4.2,A,I12,A)') ' No peaks defined for ', & & trim(adjustl(table%collaboration)),trim(adjustl(table%desc)),'(',table%energy, & & " TeV) search (analysis ID = ",table%id,")." endif else !-Create indices matrix from combinatorics module containing all possible !-peak-Higgs combinations: call create_peakindices(Npeaks,nH) allocate(peakindices_best(Npeaks,nH)) allocate(domH(Npeaks),domH_tmp(Npeaks)) allocate(Higgs_to_be_assigned(nH),Higgs_fulfills_req_assignment(nH)) ! (TS 11/01/2013: Give some default values) Higgs_assignment_forced = 1 call copy_matrices(peakindices(1,:,:),peakindices_best(:,:)) do k=lbound(domH_tmp,dim=1),ubound(domH_tmp,dim=1) domH_tmp(k) = 0 enddo ! write(*,*) 'DEBUG: print peakindices before start...' ! do a=lbound(peakindices,dim=1),ubound(peakindices,dim=1) ! write(*,*) ' a = ',a ! write(*,*) peakindices(a,:,:) ! enddo if(table%mhchisq.eq.1) then force_in_range = assignmentrange_massobs else force_in_range = assignmentrange endif if(pdf.eq.1) force_in_range = 1.0D0 ! (TS 09/09/2012: Add the criterium that if the Higgs bosons masses are close enough to ! the peaks they have to be assigned. ) !-First, find out which Higgs bosons have to be assigned. For this, we loop over all peaks !-and check which Higgses lie close enough (i.e. the mass difference is less than the !-total (gaussian) mass uncertainty). In that case, we tag this Higgs to be assigned. do i=lbound(Higgs_to_be_assigned,dim=1), ubound(Higgs_to_be_assigned,dim=1) Higgs_to_be_assigned(i)=0 enddo do i=lbound(peaks,dim=1),ubound(peaks,dim=1) do j=lbound(Higgs_to_be_assigned,dim=1), ubound(Higgs_to_be_assigned,dim=1) if(abs(peaks(i)%Higgses(j)%m-peaks(i)%mpeak).le. & & force_in_range*sqrt(peaks(i)%Higgses(j)%dm**2 + table%deltam**2)) then if(useaveragemass.and.abs(peaks(i)%Higgses(j)%mu).le.mu_cutoff_for_assignment) then ! if(useaveragemass) then Higgs_to_be_assigned(j)=0 else Higgs_to_be_assigned(j)=1 endif else !-If the chisq contribution from the Higgs masses is not used, we do NOT want ! to assign Higgs bosons which are far away from peak. if(table%mhchisq.ne.1) Higgs_to_be_assigned(j)=-1 ! if(table%mhchisq.ne.1.or.useaveragemass) Higgs_to_be_assigned(j)=-1 endif enddo enddo ! write(*,*) 'Higgs_to_be_assigned = ',Higgs_to_be_assigned !-Loop over all possible combinations, calculate the chisq and find the best combination. do a=lbound(peakindices,dim=1),ubound(peakindices,dim=1) pccsq_tmp = 0 !--Loop over all peaks, i.e. rows of the combination matrices: do i=lbound(peakindices,dim=2),ubound(peakindices,dim=2) !---Calculate the chi squared value for this combination assigned to peak i: call calc_pc_chisq(pccsq, peaks(i), table%mhchisq, peaks(i)%Higgses, domH(i), & & peakindices(a,i,:),iterstep) pccsq = pccsq + csq_mass_separation_weighted(peakindices(a,i,:), peaks(i)) !---Add the calculated value to the total chi-squared value for all peaks: pccsq_tmp = pccsq_tmp + pccsq enddo ! write(*,*) 'a = ',a,' temporary chisq contribution = ', pccsq_tmp !--Determine the best Higgs-to-peaks assignment: if(pccsq_tmp.lt.chisq_fp) then ! write(*,*) 'pccsq_tmp is below chisq_fp = ', chisq_fp do i=lbound(Higgs_fulfills_req_assignment,dim=1), & & ubound(Higgs_fulfills_req_assignment,dim=1) Higgs_fulfills_req_assignment(i)=0 enddo Higgs_assignment_forced_tmp = 0 do j=lbound(Higgs_to_be_assigned,dim=1),ubound(Higgs_to_be_assigned,dim=1) if(Higgs_to_be_assigned(j).eq.1) then do ii=lbound(peakindices,dim=2),ubound(peakindices,dim=2) do jj=lbound(peakindices,dim=3),ubound(peakindices,dim=3) if(peakindices(a,ii,jj).eq.j) then Higgs_fulfills_req_assignment(j)=1 Higgs_assignment_forced_tmp = 1 endif enddo enddo else if(Higgs_to_be_assigned(j).eq.-1) then Higgs_fulfills_req_assignment(j)=1 do ii=lbound(peakindices,dim=2),ubound(peakindices,dim=2) do jj=lbound(peakindices,dim=3),ubound(peakindices,dim=3) if(peakindices(a,ii,jj).eq.j) then Higgs_fulfills_req_assignment(j)=0 endif enddo enddo else Higgs_fulfills_req_assignment(j)=1 endif enddo ! write(*,*) 'Higgs_fulfills_req_assignment = ', Higgs_fulfills_req_assignment if(sum(Higgs_fulfills_req_assignment).eq.nH) then chisq_fp = pccsq_tmp Higgs_assignment_forced = Higgs_assignment_forced_tmp call copy_matrices(peakindices(a,:,:),peakindices_best(:,:)) if(a.eq.1) then do k=lbound(domH_tmp,dim=1),ubound(domH_tmp,dim=1) domH_tmp(k) = 0 enddo else domH_tmp(:) = domH(:) endif ! write(*,*) 'Assignment taken over: ', peakindices_best endif endif enddo !--Save information in peak object do i=lbound(peakindices_best,dim=1),ubound(peakindices_best,dim=1) !--Best Higgs Combination: peaks(i)%Higgs_comb(:) = peakindices_best(i,:) ! write(*,*) "hello: Higgs assignment of ID = ",peaks(i)%id, ": ", peaks(i)%Higgs_comb,& ! & "Higgs_assignment_forced: ",Higgs_assignment_forced peaks(i)%domH = domH_tmp(i) peaks(i)%Higgs_assignment_forced = Higgs_assignment_forced call evaluate_peak(peaks(i),table) enddo deallocate(peakindices, peakindices_best, domH, domH_tmp) deallocate(Higgs_to_be_assigned,Higgs_fulfills_req_assignment) endif end subroutine assign_Higgs_to_peaks !------------------------------------------------------------------------------------ subroutine evaluate_peak(peak, table) ! Evaluates the peak information for a given Higgs boson combination and dominant Higgs ! (both have to be assigned to the peak before calling this subroutine!) !------------------------------------------------------------------------------------ use usefulbits, only : div, np, Hneut, small, vsmall implicit none type(mupeak) :: peak type(mutable) :: table integer :: j,k integer :: NHiggs,Hindex double precision :: normalization NHiggs=0 do j=lbound(peak%Higgs_comb,dim=1),ubound(peak%Higgs_comb,dim=1) if(peak%Higgs_comb(j).ne.0) NHiggs=NHiggs+1 enddo peak%NHiggs_comb = NHiggs !--Chose dominant Higgs in the best Higgs combination for weights and systematics !-------------- ! In rare cases there appears a segmentation fault, ! because peak%domH seems not to be initialized. ! HERE: Check that it is in a reasonable range. if(peak%domH.ne.0.and.peak%domH.le.np(Hneut)) then peak%channel_w(:) = peak%channel_w_allH(:,peak%domH) peak%channel_w_corrected_eff(:) = peak%channel_w_corrected_eff_allH(:,peak%domH) peak%channel_syst(:) = peak%channel_syst_allH(:,peak%domH) peak%channel_systSM(:) = peak%channel_systSM_allH(:,peak%domH) else !-Part of fix: peak%domH=0 !-------------- call get_weights_at_peak(peak, table) !! If no Higgs is assigned we don't correct the efficiencies... peak%channel_w_corrected_eff(:) = peak%channel_w(:) !! peak%channel_w(:) = peak%channel_w_allH(:,1) peak%channel_syst(:) = peak%channel_syst_allH(:,1) peak%channel_systSM(:) = peak%channel_systSM_allH(:,1) endif !--Subtract the correlated uncertainties from mu uncertainty: call correct_mu_uncertainty_of_peak(peak, table) !--Add the channel contributions of the Higgses and adjust them to the "averaged weights": peak%total_mu=0 !--n.b.: Have to set channel_mu to zero in case this subroutine is called several times. do k=lbound(peak%channel_mu,dim=1),ubound(peak%channel_mu,dim=1) peak%channel_mu(k)=0.0D0 peak%channel_w_model(k)=0.0D0 enddo !--Loop over Higgses in best combination do j=lbound(peak%Higgs_comb,dim=1),ubound(peak%Higgs_comb,dim=1) if(peak%Higgs_comb(j).ne.0) then Hindex=peak%Higgs_comb(j) !----Loop over the channels and add rates do k=lbound(peak%channel_mu,dim=1),ubound(peak%channel_mu,dim=1) peak%channel_mu(k)=peak%channel_mu(k)+ & & peak%channel_mu_allH(k,Hindex)*peak%channel_w_corrected_eff_allH(k,Hindex) peak%total_mu = peak%total_mu + & & peak%channel_mu_allH(k,Hindex)*peak%channel_w_corrected_eff_allH(k,Hindex) enddo endif enddo do k=lbound(peak%channel_mu,dim=1),ubound(peak%channel_mu,dim=1) !---Calculate channel weights of the model, using the possibly combined rates. ! (TS 20/04/2013) peak%channel_w_model(k)=div(peak%channel_mu(k),peak%total_mu,0.0D0,1.0D9) !--Reweight the rates to obtain the channel_mu peak%channel_mu(k)=div(peak%channel_mu(k),peak%channel_w_corrected_eff(k),0.0D0,1.0D9) enddo !--If no Higgs boson has been assigned, use the SM weight at the peak position for ! the channel weight of the model (TS26/04/2013): if(peak%domH.eq.0) then peak%channel_w_model = peak%channel_w endif !--In the (unphysical) case of negative channel rates, we have to take care that the ! model channel weights are still positive and between 0 and 1: normalization = 0.0D0 do k=lbound(peak%channel_w_model,dim=1),ubound(peak%channel_w_model,dim=1) normalization = normalization + abs(peak%channel_w_model(k)) enddo if(abs(normalization).gt.small) then do k=lbound(peak%channel_w_model,dim=1),ubound(peak%channel_w_model,dim=1) peak%channel_w_model(k) = div(abs(peak%channel_w_model(k)),& & normalization,1.0D0/peak%Nc,1.0D0) enddo else !--If the predicted signal strength is zero, use SM weights peak%channel_w_model = peak%channel_w endif if(abs(sum(peak%channel_w_model)-1.0D0).gt.small) then write(*,*) "WARNING: Channel weights of the model are not correctly normalized:" write(*,*) peak%channel_w_model endif end subroutine evaluate_peak !------------------------------------------------------------------------------------ subroutine calculate_total_pc_chisq(csq_tot, csq_mu, csq_mh, N, Nmu, Nmh) ! Calculates the total chi^2 value with the peak-centered chi^2 method. This ! subroutine is called from evaluate_model in the HiggsSignals run. !------------------------------------------------------------------------------------ implicit none double precision, allocatable :: csq_mu_in(:), csq_mh_in(:,:), csq0(:), csq0_nocorr(:) double precision, intent(out) :: csq_tot, csq_mu, csq_mh integer, intent(out) :: N, Nmu, Nmh integer :: i, ii, iii, j,jj, iter, Niterations logical :: iterate ! Need to do iterations of the following procedure. Due to modifications in the ! Higgs-to-peak assignments necessary for so-called assignment groups (i.e. a set of ! observables which should take over the assignment our their leading observable, ! which should be the one with a mass measurement), the covariance matrices of the Higgs ! mass part change, and therefore also the chi^2 contribution from the Higgs mass. ! Since a cutoff chi^2(tot) < chi^2(max) applies in specific cases, this cutoff has to be ! re-evaluated a few times to converge to the correct total chi^2 evaluation. iterate=.True. Niterations=0 do while(iterate) call calculate_mu_chisq(csq0, Nmu, 2) !--Debugging ! call calculate_mu_chisq(csq0_nocorr, Nmu, 2) ! csq0 without correlations !-- call calculate_mu_chisq(csq_mu_in, Nmu, 0) call calculate_mh_chisq(csq_mh_in, Nmh) !--Debugging ! write(*,*) "chi2 values (i, max with corr, max without corr, csq_mu, csq_mh)" ! do i=1,size(csq0) ! ! write(*,*) i, csq0(i), csq0_nocorr(i), csq_mu_in(i), csq_mh_in(1,i) ! write(*,*) i, csq0(i), csq_mu_in(i), csq_mh_in(1,i) ! enddo iii=0 do i=1, size(analyses) do ii=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) iii=iii+1 ! write(*,*) "analyses(",i,")%peaks(",ii,")%Higgs_assignment_forced = ",analyses(i)%peaks(ii)%Higgs_assignment_forced if(analyses(i)%peaks(ii)%Higgs_assignment_forced.eq.0.and.(.not.maximalchisq).or.& & analyses(i)%peaks(ii)%Higgs_assignment_forced.eq.1.and.(.not.maximalchisq).and.pdf.eq.1) then if((csq_mu_in(iii)+sum(csq_mh_in(:,iii))).gt.csq0(iii).and.& & analyses(i)%peaks(ii)%NHiggs_comb.gt.0.and.analyses(i)%table%mhchisq.eq.1) then analyses(i)%peaks(ii)%undo_assignment=1 !---Now, undo Higgs-to-peak-assignment for the whole group (if existent) if(len(trim(analyses(i)%peaks(ii)%assignmentgroup)).ne.0) then do j=1, size(analyses) do jj=lbound(analyses(j)%peaks,dim=1),ubound(analyses(j)%peaks,dim=1) if(analyses(i)%peaks(ii)%assignmentgroup.eq.& & analyses(j)%peaks(jj)%assignmentgroup) then analyses(j)%peaks(jj)%undo_assignment=1 endif ! write(*,*) 'hello, undo assignment, j, jj = ', j, jj, ", undo assignment = ",analyses(j)%peaks(jj)%undo_assignment enddo enddo endif endif endif enddo enddo call correcting_Higgs_to_peak_assignment(iterate) if(iterate) Niterations = Niterations + 1 deallocate(csq_mu_in, csq_mh_in) enddo !! if(Niterations.gt.0) write(*,*) "Ran ",Niterations," iterations to determine Higgs to peak assignment." ! After these iterations, the code should know the correct assignments. call calculate_mh_chisq(csq_mh_in, Nmh) ! This will undo the assignments, if necessary ! call calculate_mu_chisq(csq0, Nmu, 1) ! call calculate_mu_chisq(csq0_nocorr, Nmu, 2) ! csq0 without correlations call calculate_mu_chisq(csq_mu_in, Nmu, 0) ! Need to evaluate this again with new assignments !Calculate total ndf: N = Nmu + Nmh csq_mu = 0.0D0 csq_mh = 0.0D0 csq_tot = 0.0D0 iii=0 do i=1, size(analyses) do ii=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) iii=iii+1 !--Only allow positive chisq contributions if wanted if(minimalchisq) then if(csq_mu_in(iii).lt.0.0D0) csq_mu_in(iii) = 0.0D0 do j=lbound(csq_mh_in, dim=1), ubound(csq_mh_in, dim=1) if(csq_mh_in(j,iii).lt.0.0D0) csq_mh_in(j,iii) = 0.0D0 enddo endif !--Assign chisq_mu and chisq_mh such that the total chisq does not exceed the maximum !--chisq csq0 if(maximalchisq) then analyses(i)%peaks(ii)%chisq_mu = min(csq_mu_in(iii),csq0(iii)) analyses(i)%peaks(ii)%chisq_mh = min(csq0(iii)-analyses(i)%peaks(ii)%chisq_mu, & & sum(csq_mh_in(:,iii))) !TESTING: comment out this --> ! elseif(analyses(i)%peaks(ii)%Higgs_assignment_forced.eq.0) then ! analyses(i)%peaks(ii)%chisq_mu = min(csq_mu_in(iii),csq0(iii)) ! analyses(i)%peaks(ii)%chisq_mh = min(csq0(iii)-analyses(i)%peaks(ii)%chisq_mu, & !& sum(csq_mh_in(:,iii))) !! write(*,*) csq0(iii),csq_mu_in(iii),sum(csq_mh_in(:,iii)) ! NEW FOR CORRECTED ASSIGNMENTS: ! elseif(analyses(i)%peaks(ii)%Higgs_assignment_forced.eq.1.and.& !& analyses(i)%peaks(ii)%domH.eq.0) then elseif(analyses(i)%peaks(ii)%domH.eq.0) then analyses(i)%peaks(ii)%chisq_mu = csq0(iii) analyses(i)%peaks(ii)%chisq_mh = 0.0D0 else !! write(*,*) "HtP assignment is forced for analysis: ",iii analyses(i)%peaks(ii)%chisq_mu = csq_mu_in(iii) analyses(i)%peaks(ii)%chisq_mh = sum(csq_mh_in(:,iii)) !! write(*,*) csq0(iii),csq_mu_in(iii),sum(csq_mh_in(:,iii)) endif analyses(i)%peaks(ii)%chisq_tot = analyses(i)%peaks(ii)%chisq_mu + & & analyses(i)%peaks(ii)%chisq_mh analyses(i)%peaks(ii)%chisq_max = csq0(iii) csq_mu = csq_mu + analyses(i)%peaks(ii)%chisq_mu csq_mh = csq_mh + analyses(i)%peaks(ii)%chisq_mh csq_tot = csq_tot + analyses(i)%peaks(ii)%chisq_tot enddo enddo deallocate(csq_mu_in, csq_mh_in) ! write(*,*) "End of subroutine calculate_total_pc_chisq." end subroutine calculate_total_pc_chisq !----------------------------------------------------------------------------------- subroutine correcting_Higgs_to_peak_assignment(iterate) !----------------------------------------------------------------------------------- use usefulbits, only : np, Hneut implicit none integer :: i, ii, k logical, intent(inout) :: iterate iterate=.False. do i=1, size(analyses) do ii=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) if(analyses(i)%peaks(ii)%undo_assignment.eq.1.and.analyses(i)%peaks(ii)%domH.ne.0)then !! write(*,*) "Correcting HtP." iterate=.True. do k=1,np(Hneut) analyses(i)%peaks(ii)%Higgs_comb(k)=0 enddo analyses(i)%peaks(ii)%domH=0 call evaluate_peak(analyses(i)%peaks(ii),analyses(i)%table) !! analyses(i)%peaks(ii)%undo_assignment=0 endif enddo enddo end subroutine correcting_Higgs_to_peak_assignment !------------------------------------------------------------------------------------ subroutine create_covariance_matrices() !------------------------------------------------------------------------------------ if(.not.allocated(analyses)) then stop 'Error in subroutine create_covariance_matrices: analyses is not allocated.' endif write(*,*) "hello: Called subroutine create_covariance_matrices..." if(allocated(cov)) deallocate(cov) call create_covariance_matrix_mu(0) if(pdf.eq.2) then ! if(useaveragemass) then if(allocated(cov_mh_av)) deallocate(cov_mh_av) call create_covariance_matrix_mh_av(0) if(allocated(cov_mh_av_max)) deallocate(cov_mh_av_max) call create_covariance_matrix_mh_av(1) ! else if(allocated(cov_mhneut)) deallocate(cov_mhneut) call create_covariance_matrix_mhneut(0) if(allocated(cov_mhneut_max)) deallocate(cov_mhneut_max) call create_covariance_matrix_mhneut(1) ! endif endif end subroutine create_covariance_matrices !------------------------------------------------------------------------------------ subroutine calculate_mu_chisq(csq_mu, N, domax) !------------------------------------------------------------------------------------ ! use usefulbits_hs, only : peaklist, cov use numerics, only : invmatrix, matmult integer :: i, ii, iii double precision, allocatable :: v(:), vmat(:,:), invcov(:,:), v2(:) double precision, allocatable, intent(out) :: csq_mu(:) character(LEN=50) :: title = "covariance matrix for signal strength mu" integer, intent(out) :: N integer, intent(in) :: domax ! if 1, then calculate maximal chisq if(allocated(cov)) deallocate(cov) call create_covariance_matrix_mu(domax) if(allocated(mu_vector)) deallocate(mu_vector) N = size(cov,dim=1) allocate(v(N), vmat(N,1),invcov(N,N), v2(N), csq_mu(N)) allocate(mu_vector(N)) !! write(*,*) ' domax = ',domax !-First construct the vector (mupred - muobs)_iii iii=0 do i=1, size(analyses, dim=1) do ii=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) iii=iii+1 if(domax.ge.1) then v(iii) = analyses(i)%peaks(ii)%mu else v(iii) = analyses(i)%peaks(ii)%mu - analyses(i)%peaks(ii)%total_mu endif vmat(iii,1) = v(iii) !! write(*,*) 'v(',iii,') = ',v(iii) enddo enddo ! Copy vector into global module vector (for later access) mu_vector = v call invmatrix(cov,invcov) call matmult(invcov,vmat,v2,N,1) !! write(*,*) "Calculating mu chi^2. domax = ", domax do i=1, N csq_mu(i) = v(i)*v2(i) !! write(*,*) i, analyses(i)%peaks(1)%total_mu,csq_mu(i) enddo !! write(*,*) "sum = ", sum(csq_mu(:)) deallocate(v,vmat,invcov,v2) end subroutine calculate_mu_chisq !------------------------------------------------------------------------------------ subroutine calculate_mh_chisq(csq_mh_out, ndf) !------------------------------------------------------------------------------------ ! use usefulbits_hs, only : peaklist use usefulbits, only : np, Hneut, vsmall use numerics, only : invmatrix, matmult integer, intent(out) :: ndf integer :: i, ii, iii, k, nH, N, Hindex double precision, allocatable :: v(:,:), invcov(:,:), v2(:), vmat(:,:) double precision, allocatable, intent(out) :: csq_mh_out(:,:) double precision :: m_av_iii, dm_av_iii if((pdf.eq.1).or.(pdf.eq.3)) then !-First, determine number of peaks: N = 0 do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do j=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) N = N + 1 enddo enddo nH = np(Hneut) if(useaveragemass) then allocate(csq_mh_out(1,N)) else allocate(csq_mh_out(nH,N)) endif !-First, fill the chisq vector with zeros: csq_mh_out(:,:) = 0.0D0 iii=0 do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do ii=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) iii=iii+1 if(useaveragemass) then call get_average_mass_for_peak(analyses(i)%peaks(ii)%Higgs_comb, & & analyses(i)%peaks(ii), m_av_iii, dm_av_iii) if(m_av_iii.gt.vsmall.and.analyses(i)%table%mhchisq.eq.1) then !!! BUG FIX (TS 03/02/2015) csq_mh_out(1,iii) = csq_mh(m_av_iii, analyses(i)%peaks(ii)%mpeak, dm_av_iii, & & analyses(i)%peaks(ii)%dm) endif else do k=1,nH Hindex = analyses(i)%peaks(ii)%Higgs_comb(k) if(Hindex.ne.0.and.analyses(i)%table%mhchisq.eq.1) then csq_mh_out(Hindex,iii) = csq_mh(analyses(i)%peaks(ii)%Higgses(Hindex)%m, & & analyses(i)%peaks(ii)%mpeak,analyses(i)%peaks(ii)%Higgses(Hindex)%dm, & & analyses(i)%peaks(ii)%dm) endif enddo endif enddo enddo else if(pdf.eq.2) then if(useaveragemass) then if(allocated(cov_mh_av)) deallocate(cov_mh_av) call create_covariance_matrix_mh_av(0) N = size(cov_mh_av,dim=1) allocate(v(1,N), v2(N), csq_mh_out(1,N), vmat(N,1)) do i=1,N v(1,i) = 0.0D0 enddo iii=0 do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do ii=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) iii=iii+1 call get_average_mass_for_peak(analyses(i)%peaks(ii)%Higgs_comb, & & analyses(i)%peaks(ii), m_av_iii, dm_av_iii) if(m_av_iii.gt.0) then v(1,iii) = m_av_iii - analyses(i)%peaks(ii)%mpeak endif enddo enddo call invmatrix(cov_mh_av(:,:),invcov) vmat(:,1)=v(1,:) call matmult(invcov,vmat,v2,N,1) do i=1, N csq_mh_out(1,i) = v(1,i)*v2(i) enddo else if(allocated(cov_mhneut)) deallocate(cov_mhneut) call create_covariance_matrix_mhneut(0) nH = size(cov_mhneut,dim=1) N = size(cov_mhneut,dim=2) allocate(v(nH,N), v2(N), csq_mh_out(nH,N), vmat(N,1)) !-Construct the vector (mhpred - mhobs)_iii. Do this for every Higgs boson !-of the model. If the Higgs boson (Hindex) is not assigned to the peak, we set !-the entry of the vector to zero. !-First, fill the vectors with zeros: do k=1,nH do i=1,N v(k,i) = 0.0D0 enddo enddo do k=1,nH iii=0 do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do ii=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) iii=iii+1 Hindex = analyses(i)%peaks(ii)%Higgs_comb(k) if(Hindex.ne.0) then v(Hindex,iii) = analyses(i)%peaks(ii)%Higgses(Hindex)%m - & & analyses(i)%peaks(ii)%mpeak endif enddo enddo enddo do k=1,nH !-n.b.: this loops now over Hindex call invmatrix(cov_mhneut(k,:,:),invcov) vmat(:,1)=v(k,:) ! call matmult(invcov,v(k,:),v2,N,1) call matmult(invcov,vmat,v2,N,1) do i=1, N csq_mh_out(k,i) = v(k,i)*v2(i) if(csq_mh_out(k,i).ge.0.00001D0) then !! write(*,*) "hello: ",k,i,v(k,i),sign(1.0D0,v(k,i)), csq_mh_out(k,i) endif enddo enddo endif deallocate(v,v2,vmat,invcov) endif if(useaveragemass) then !--Calculate additional chi^2 contribution from the mass separation iii=0 do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do ii=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) iii=iii+1 if(analyses(i)%table%mhchisq.eq.1) then csq_mh_out(1,iii) = csq_mh_out(1,iii) + csq_mass_separation_weighted( & & analyses(i)%peaks(ii)%Higgs_comb, analyses(i)%peaks(ii)) endif enddo enddo endif ! write(*,*) "before deallocate csq_mh_out" ! deallocate(csq_mh_out) ! write(*,*) "after deallocate csq_mh_out" !--Determine number of observables ndf. This checks for each peak whether the mass !--resolution is less than a huge number and thus the chisq evaluation from the mass !--measurement is enabled. ndf=0 if(pdf.eq.2.or.pdf.eq.3) then do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do ii=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) if(analyses(i)%table%mhchisq.eq.1) ndf=ndf+1 enddo enddo endif ! write(*,*) "End of subroutine calculate_mh_chisq." end subroutine calculate_mh_chisq !------------------------------------------------------------------------------------ subroutine create_covariance_matrix_mhneut(domax) !------------------------------------------------------------------------------------ use usefulbits, only : np, Hneut implicit none double precision :: dratesq, dmu0sq, dmtemp character(LEN=50) :: title integer, intent(in) :: domax ! = 0 or 1. If set to 1, then fill all off-diagonal elements ! with squared theoretical mass uncertainty, corresponding to ! a complete Higgs-to-peaks assignment integer :: Npeaks,i,ii,iii,j,jj,jjj,k,Hindex_i, Hindex_j !! write(*,*) "Create Higgs mass covariance matrix" Npeaks = 0 do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do j=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) Npeaks = Npeaks + 1 enddo enddo if(domax.eq.0) then allocate(cov_mhneut(np(Hneut),Npeaks,Npeaks)) elseif(domax.eq.1) then allocate(cov_mhneut_max(np(Hneut),Npeaks,Npeaks)) else stop'ERROR in subroutine create_covariance_matrix_mhneut. Specify domax correctly!' endif !-First, fill all elements of the covariance matrices with zero except the diagonal !-elements which contain the experimental mass resolution squared do k=1,np(Hneut) iii=0 do i=1, size(analyses) do ii=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) iii=iii+1 jjj=0 do j=1, size(analyses) do jj=lbound(analyses(j)%peaks,dim=1),ubound(analyses(j)%peaks,dim=1) jjj=jjj+1 if(domax.eq.0) cov_mhneut(k,iii,jjj) = 0.0D0 if(domax.eq.1) cov_mhneut_max(k,iii,jjj) = 0.0D0 if(iii.eq.jjj) then !-----Deactivate mh chisq contributions for those analysis which are tagged mhchisq==0 !-----by setting the uncertainty to a very large value. if(analyses(i)%table%mhchisq.eq.1) then if(domax.eq.0) cov_mhneut(k,iii,jjj) = analyses(i)%peaks(ii)%dm**2 if(domax.eq.1) cov_mhneut_max(k,iii,jjj) = analyses(i)%peaks(ii)%dm**2 else if(domax.eq.0) cov_mhneut(k,iii,jjj) = vlarge**2 if(domax.eq.1) cov_mhneut_max(k,iii,jjj) = vlarge**2 endif endif enddo enddo enddo enddo enddo !-Now, look for Higgs bosons shared by 2 peaks and fill the corresponding cov. matrix !-element with the theoretical uncertainty squared of this Higgs boson. do k=1,np(Hneut) iii=0 do i=1, size(analyses) do ii=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) iii=iii+1 jjj=0 do j=1, size(analyses) do jj=lbound(analyses(j)%peaks,dim=1),ubound(analyses(j)%peaks,dim=1) jjj=jjj+1 ! Hindex_i = analyses(i)%peaks(ii)%Higgs_comb(k) ! Hindex_j = analyses(j)%peaks(jj)%Higgs_comb(k) ! if((Hindex_i.eq.Hindex_j).and.(Hindex_i.ne.0).and.domax.eq.0) then if(int_in_array(k,analyses(i)%peaks(ii)%Higgs_comb).and.int_in_array(k, & & analyses(j)%peaks(jj)%Higgs_comb).and.domax.eq.0) then ! write(*,*) 'debug: k = ',k,', jjj = ',jjj,' comb1 =, ', & ! & analyses(i)%peaks(ii)%Higgs_comb,' comb2 = ',analyses(j)%peaks(jj)%Higgs_comb if(correlations_mh.or.(.not.correlations_mh.and.iii.eq.jjj)) then ! if(anticorrmh) then ! cov_mhneut(k,iii,jjj)=cov_mhneut(k,iii,jjj) + & !& sign(1.0D0,(analyses(i)%peaks(ii)%Higgses(k)%m-analyses(i)%peaks(ii)%mpeak))* & !& sign(1.0D0,(analyses(j)%peaks(jj)%Higgses(k)%m-analyses(j)%peaks(jj)%mpeak))* & !& analyses(i)%peaks(ii)%Higgses(k)%dm**2 ! else cov_mhneut(k,iii,jjj)=cov_mhneut(k,iii,jjj) + & & analyses(i)%peaks(ii)%Higgses(k)%dm**2 ! endif endif elseif(domax.eq.1) then if(correlations_mh.or.(.not.correlations_mh.and.iii.eq.jjj)) then ! !NEW TEST (sign dependence): ! if(anticorrmh) then ! cov_mhneut_max(k,iii,jjj)= cov_mhneut_max(k,iii,jjj) + & !& sign(1.0D0,(analyses(i)%peaks(ii)%Higgses(k)%m-analyses(i)%peaks(ii)%mpeak))* & !& sign(1.0D0,(analyses(j)%peaks(jj)%Higgses(k)%m-analyses(j)%peaks(jj)%mpeak))* & !& analyses(i)%peaks(ii)%Higgses(k)%dm**2 ! else cov_mhneut_max(k,iii,jjj)= cov_mhneut_max(k,iii,jjj) + & & analyses(i)%peaks(ii)%Higgses(k)%dm**2 ! endif endif endif enddo enddo enddo enddo enddo !! title = "mass covariance matrix for maximal assignment, first Higgs boson" !! if(domax.eq.1) call print_dble_matrix(cov_mhneut_max(1,:,:), title) ! title = "covariance matrix for mh1" ! call print_dble_matrix(cov_mhneut(1,:,:), title) ! title = "covariance matrix for mh2" ! call print_dble_matrix(cov_mhneut(2,:,:), title) !! title = "covariance matrix for signal strength mh3" !! call print_dble_matrix(cov_mhneut(3,:,:), title) end subroutine create_covariance_matrix_mhneut !------------------------------------------------------------------------------------ subroutine create_covariance_matrix_mh_av(domax) !------------------------------------------------------------------------------------ use usefulbits, only : np, Hneut implicit none double precision :: dratesq, dmu0sq, dmtemp character(LEN=50) :: title integer, intent(in) :: domax ! = 0 or 1. If set to 1, then fill all off-diagonal elements ! with squared theoretical mass uncertainty, corresponding to ! a complete Higgs-to-peaks assignment integer :: Npeaks,i,ii,iii,j,jj,jjj,k,Hindex_i, Hindex_j integer, dimension(np(Hneut)) :: ones double precision :: m_av_iii, m_av_jjj double precision :: dm_av_iii, dm_av_jjj ! write(*,*) "Create Higgs mass covariance matrix" ones = 1 Npeaks = 0 do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do j=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) Npeaks = Npeaks + 1 enddo enddo if(domax.eq.0) then allocate(cov_mh_av(Npeaks,Npeaks)) elseif(domax.eq.1) then allocate(cov_mh_av_max(Npeaks,Npeaks)) else stop'ERROR in subroutine create_covariance_matrix_mh_av. Specify domax correctly!' endif !-First, fill all elements of the covariance matrices with zero except the diagonal !-elements which contain the experimental mass resolution squared ! do k=1,np(Hneut) iii=0 do i=1, size(analyses) do ii=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) iii=iii+1 jjj=0 do j=1, size(analyses) do jj=lbound(analyses(j)%peaks,dim=1),ubound(analyses(j)%peaks,dim=1) jjj=jjj+1 if(domax.eq.0) cov_mh_av(iii,jjj) = 0.0D0 if(domax.eq.1) cov_mh_av_max(iii,jjj) = 0.0D0 if(iii.eq.jjj) then if(analyses(i)%table%mhchisq.eq.1) then if(domax.eq.0) cov_mh_av(iii,jjj) = analyses(i)%peaks(ii)%dm**2 if(domax.eq.1) cov_mh_av_max(iii,jjj) = analyses(i)%peaks(ii)%dm**2 else if(domax.eq.0) cov_mh_av(iii,jjj) = vlarge**2 if(domax.eq.1) cov_mh_av_max(iii,jjj) = vlarge**2 endif endif enddo enddo enddo enddo !enddo !-Now, look for Higgs bosons shared by 2 peaks and fill the corresponding cov. matrix !-element with the theoretical uncertainty squared of this Higgs boson. do k=1,np(Hneut) iii=0 do i=1, size(analyses) do ii=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) iii=iii+1 call get_average_mass_for_peak(analyses(i)%peaks(ii)%Higgs_comb, & & analyses(i)%peaks(ii), m_av_iii, dm_av_iii) ! write(*,*) "Higgs comb = ",analyses(i)%peaks(ii)%Higgs_comb," average mass = ",m_av_iii, dm_av_iii jjj=0 do j=1, size(analyses) do jj=lbound(analyses(j)%peaks,dim=1),ubound(analyses(j)%peaks,dim=1) jjj=jjj+1 call get_average_mass_for_peak(analyses(j)%peaks(jj)%Higgs_comb, & & analyses(j)%peaks(jj), m_av_jjj, dm_av_jjj) if(int_in_array(k,analyses(i)%peaks(ii)%Higgs_comb).and.int_in_array(k, & & analyses(j)%peaks(jj)%Higgs_comb).and.domax.eq.0) then if(correlations_mh.or.(.not.correlations_mh.and.iii.eq.jjj)) then ! if(anticorrmh) then ! cov_mh_av(iii,jjj)=cov_mh_av(iii,jjj) + & !& sign(1.0D0,(m_av_iii-analyses(i)%peaks(ii)%mpeak)) * & !& sign(1.0D0,(m_av_jjj-analyses(j)%peaks(jj)%mpeak)) * & !& analyses(i)%peaks(ii)%Higgses(k)%mu/analyses(i)%peaks(ii)%total_mu * & !& analyses(j)%peaks(jj)%Higgses(k)%mu/analyses(j)%peaks(jj)%total_mu * & !& dm_av_iii * dm_av_jjj ! else cov_mh_av(iii,jjj)=cov_mh_av(iii,jjj) + & & analyses(i)%peaks(ii)%Higgses(k)%mu/analyses(i)%peaks(ii)%total_mu * & & analyses(j)%peaks(jj)%Higgses(k)%mu/analyses(j)%peaks(jj)%total_mu * & & dm_av_iii * dm_av_jjj ! endif endif elseif (domax.eq.1) then if(correlations_mh.or.(.not.correlations_mh.and.iii.eq.jjj)) then call get_average_mass_for_peak(ones, analyses(i)%peaks(ii), m_av_iii, dm_av_iii) call get_average_mass_for_peak(ones, analyses(j)%peaks(jj), m_av_jjj, dm_av_jjj) ! if(anticorrmh) then ! cov_mh_av_max(iii,jjj)=cov_mh_av_max(iii,jjj) + & !& sign(1.0D0,(m_av_iii-analyses(i)%peaks(ii)%mpeak)) * & !& sign(1.0D0,(m_av_jjj-analyses(j)%peaks(jj)%mpeak)) * & !& analyses(i)%peaks(ii)%Higgses(k)%mu/analyses(i)%peaks(ii)%total_mu * & !& analyses(j)%peaks(jj)%Higgses(k)%mu/analyses(j)%peaks(jj)%total_mu * & !& dm_av_iii * dm_av_jjj ! else cov_mh_av_max(iii,jjj)=cov_mh_av_max(iii,jjj) + & & analyses(i)%peaks(ii)%Higgses(k)%mu/analyses(i)%peaks(ii)%total_mu * & & analyses(j)%peaks(jj)%Higgses(k)%mu/analyses(j)%peaks(jj)%total_mu * & & dm_av_iii * dm_av_jjj ! endif endif endif enddo enddo enddo enddo enddo ! title = "mass averaged covariance matrix" !! if(domax.eq.1) call print_dble_matrix(cov_mh_av_max(1,:,:), title) !! title = "covariance matrix for signal strength mh2" ! call print_dble_matrix(cov_mh_av(:,:), title) !! title = "covariance matrix for signal strength mh3" !! call print_dble_matrix(cov_mh_av(3,:,:), title) end subroutine create_covariance_matrix_mh_av !------------------------------------------------------------------------------------ subroutine correct_mu_uncertainty_of_peak(peak, table) ! The mu uncertainty as given in the mutable contains also systematic uncertainties for ! the luminosity and signal rate. These uncertainties are highly correlated to other ! analyses. Therefore, we subtract them here to obtain the intrinsic mu uncertainty of ! this peak. The correlated uncertainties enter later via the covariance matrix. !------------------------------------------------------------------------------------ use usefulbits_hs, only : usescalefactor, output_level,symmetricerrors,& & absolute_errors, THU_included!, withcorrexpsyst implicit none type(mupeak), intent(inout) :: peak type(mutable), intent(in) :: table ! double precision, intent(in) :: dlumi ! Uncertainty of Luminosity (relative) integer :: j double precision :: dcsq, dmulow0sq, dmuup0sq, allsystsq, dmuaverage, dmuaverage0sq, mu dcsq = 0 do j=1, peak%Nc dcsq = dcsq + peak%channel_systSM(j)**2 enddo if(absolute_errors) then mu=peak%mu_original else mu=peak%mu endif ! if(.not.symmetricerrors) then if(THU_included) then ! if(withcorrexpsyst) then ! allsystsq = 0.0D0 ! do j=lbound(table%correxpsyst,dim=1),ubound(table%correxpsyst,dim=1) ! allsystsq = allsystsq + table%correxpsyst(j)**2 ! enddo ! dmulow0sq = (peak%dmulow)**2-(allsystsq + dcsq)*mu**2 ! dmuup0sq = (peak%dmuup)**2-(allsystsq + dcsq)*mu**2 ! else dmulow0sq = (peak%dmulow)**2-(table%dlumi*mu)**2-dcsq*mu**2 dmuup0sq = (peak%dmuup)**2-(table%dlumi*mu)**2-dcsq*mu**2 ! endif else !- In the case of future projections we usually use measurements !- without theoretical uncertainty included: dmulow0sq = (peak%dmulow)**2 dmuup0sq = (peak%dmuup)**2 endif if(usescalefactor) then dmulow0sq = peak%scale_mu**2*dmulow0sq dmuup0sq = peak%scale_mu**2*dmuup0sq endif if(.not.symmetricerrors) then peak%dmulow0sq = dmulow0sq peak%dmuup0sq = dmuup0sq else if(peak%dmulow0sq.lt.0.0d0.or.peak%dmuup0sq.lt.0.0d0) then write(*,*) "WARNING: squared intrinsic mu uncertainty is negative!" endif peak%dmulow0sq = (sqrt(abs(dmulow0sq))+sqrt(abs(dmuup0sq)))**2/4.0d0 peak%dmuup0sq = (sqrt(abs(dmulow0sq))+sqrt(abs(dmuup0sq)))**2/4.0d0 endif ! else ! dmuaverage = (peak%dmulow+peak%dmuup)/2. ! if(withcorrexpsyst) then ! allsystsq = 0.0D0 ! do j=lbound(table%correxpsyst,dim=1),ubound(table%correxpsyst,dim=1) ! allsystsq = allsystsq + table%correxpsyst(j)**2 ! enddo ! dmuaverage0sq = (dmuaverage)**2-(allsystsq + dcsq)*peak%mu**2 ! else ! dmuaverage0sq = (dmuaverage)**2-(table%dlumi*peak%mu)**2-dcsq*peak%mu**2 ! endif ! if(usescalefactor) then ! dmuaverage0sq = peak%scale_mu**2*dmuaverage0sq ! endif ! peak%dmulow0sq = dmuaverage0sq ! peak%dmuup0sq = dmuaverage0sq ! endif ! if(output_level.ne.0) then if(peak%dmulow0sq.lt.0.0D0) then write(*,*) "WARNING: Negative intrinsic (lower) error squared for observable ID = ",& peak%ID,", with value ",peak%dmulow0sq endif if(peak%dmuup0sq.lt.0.0D0) then write(*,*) "WARNING: Negative intrinsic (upper) error squared for observable ID = ",& peak%ID,", with value ",peak%dmuup0sq endif ! endif !! write(*,*) "Original / Corrected uncertainties (low): ",peak%dmulow, sqrt(dmulow0sq) !! write(*,*) "Original / Corrected uncertainties (up): ",peak%dmuup, sqrt(dmuup0sq) end subroutine correct_mu_uncertainty_of_peak !------------------------------------------------------------------------------------ subroutine create_covariance_matrix_mu(domax) !------------------------------------------------------------------------------------ use usefulbits_hs, only : withcorrexpsyst, absolute_errors, corrlist use expt_syst, only : get_expt_syst_corr_for_peaks implicit none integer, intent(in) :: domax ! if 1, then use predicted mu == 0 double precision :: dratesq, dmu0sq, s1, s2, mu_iii, mu_jjj, corrsyst, corrsystSM double precision :: obs1dmu0sq,obs2dmu0sq integer :: Npeaks integer :: i,ii,iii,j,jj,jjj,k character(LEN=50) :: title logical :: corr integer csqmax !---TRY TO EVALUATE THE MAX CHISQ WITHOUT CORRELATIONS---! if(domax.eq.1) then csqmax = 1 corr=correlations_mu elseif(domax.eq.2) then csqmax = 1 corr=.False. else csqmax = 0 corr=correlations_mu endif !--------------------------------------------------------! Npeaks = 0 do i=lbound(analyses,dim=1),ubound(analyses,dim=1) Npeaks = Npeaks + analyses(i)%Npeaks enddo allocate(cov(Npeaks,Npeaks)) iii=0 !--Loop twice over all peaks to construct matrix do i=1, size(analyses) do ii=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) iii=iii+1 if(absolute_errors) then mu_iii=analyses(i)%peaks(ii)%mu_original else mu_iii=analyses(i)%peaks(ii)%mu endif jjj=0 do j=1, size(analyses) do jj=lbound(analyses(j)%peaks,dim=1),ubound(analyses(j)%peaks,dim=1) jjj=jjj+1 if(absolute_errors) then mu_jjj=analyses(j)%peaks(jj)%mu_original else mu_jjj=analyses(j)%peaks(jj)%mu endif if(usescalefactor) then s1 = analyses(i)%peaks(ii)%scale_mu s2 = analyses(j)%peaks(jj)%scale_mu else s1 = 1.0D0 s2 = 1.0D0 endif cov(iii,jjj)=0.0D0 if(corr.or.(.not.corr.and.iii.eq.jjj)) then call get_rate_uncertainties_sq_peaks(dratesq,analyses(i)%peaks(ii),& & analyses(j)%peaks(jj),analyses(i)%table%collider, analyses(i)%table%energy,& & analyses(j)%table%collider, analyses(j)%table%energy) if(anticorrmu) then !-----Treat luminosity uncertainty as correlated systematic error if same collaboration: if(analyses(i)%table%collaboration.eq.analyses(j)%table%collaboration) then cov(iii,jjj)=cov(iii,jjj)+(s1*analyses(i)%table%dlumi*s2*analyses(j)%table%dlumi)& & *(mu_iii*mu_jjj) endif corrsyst=0.0D0 !------Include correlated experimental systematic uncertainties (TS 2013-11-21) if(withcorrexpsyst) then if(iii.eq.jjj) then call get_expt_syst_corr_for_peaks(corrsystSM, analyses(i)%peaks(ii),& & mu_iii, analyses(j)%peaks(jj),mu_jjj, 0) cov(iii,jjj)=cov(iii,jjj) - corrsystSM endif call get_expt_syst_corr_for_peaks(corrsyst, analyses(i)%peaks(ii),& & mu_iii, analyses(j)%peaks(jj),mu_jjj, 1) cov(iii,jjj)=cov(iii,jjj) + corrsyst endif !------ if(useSMweights) then cov(iii,jjj)=cov(iii,jjj)+ & & (dratesq)*(analyses(i)%peaks(ii)%mu*analyses(j)%peaks(jj)%mu) else cov(iii,jjj)=cov(iii,jjj)+ & & (dratesq)*(analyses(i)%peaks(ii)%total_mu*analyses(j)%peaks(jj)%total_mu) endif else ! anticorrmu=.False. !-----Treat luminosity uncertainty as correlated systematic error if same collaboration: if(analyses(i)%table%collaboration.eq.analyses(j)%table%collaboration) then cov(iii,jjj)=cov(iii,jjj)+(s1*analyses(i)%table%dlumi*s2*analyses(j)%table%dlumi)& & *abs(mu_iii*mu_jjj) endif if(useSMweights) then cov(iii,jjj)=cov(iii,jjj)+ & & (dratesq)*(analyses(i)%peaks(ii)%mu*analyses(j)%peaks(jj)%mu) else cov(iii,jjj)=cov(iii,jjj)+ & & (dratesq)*(analyses(i)%peaks(ii)%total_mu*analyses(j)%peaks(jj)%total_mu) endif endif endif !----Add the intrinsic (uncorrelated) uncertainty of this peak to the diagonal elements: if(iii.eq.jjj) then call get_dmu0sq_peak(dmu0sq,analyses(i)%peaks(ii),csqmax) cov(iii,jjj) = cov(iii,jjj) + dmu0sq endif !----NEW: Replace covariance matrix elements by official numbers if provided! do k= lbound(corrlist,dim=1),ubound(corrlist,dim=1) if((corrlist(k)%obsID1==analyses(i)%peaks(ii)%id.and.& & corrlist(k)%obsID2==analyses(j)%peaks(jj)%id).or.& & (corrlist(k)%obsID2==analyses(i)%peaks(ii)%id.and.& & corrlist(k)%obsID1==analyses(j)%peaks(jj)%id)) then call get_dmu0sq_peak(obs1dmu0sq,analyses(i)%peaks(ii),csqmax) call get_dmu0sq_peak(obs2dmu0sq,analyses(j)%peaks(jj),csqmax) cov(iii,jjj) = corrlist(k)%corr*sqrt(obs1dmu0sq)*sqrt(obs2dmu0sq) endif enddo ! write(*,*) iii,jjj, cov(iii,jjj) enddo enddo enddo enddo !! write(*,*) "signal strength covariance matrix:" !! do iii=lbound(cov,dim=1),ubound(cov,dim=1) !! write(*,*) "(",iii,",",iii,") = ",cov(iii,iii) !! enddo end subroutine create_covariance_matrix_mu !------------------------------------------------------------------------------------ subroutine get_rate_uncertainties_sq_peaks_old(dratesq, peak1, peak2) ! Returns the sum of the squared theoretical uncertainties of the common ! production and decay rates of the two peak observables. !------------------------------------------------------------------------------------ use usefulbits_HS, only : mupeak, delta_rate, useSMweights type(mupeak), intent(in) :: peak1, peak2 double precision, intent(out) :: dratesq - integer :: i,j,id1,p1,d1,id2,p2,d2 + integer :: i,j,p1,d1,p2,d2 !id1,id2 double precision :: res res=0.0D0 do i=1,peak1%Nc do j=1,peak2%Nc - id1 = peak1%channel_id(i) - p1 = int((id1-modulo(id1,10))/dble(10)) - d1 = modulo(id1,10) - id2 = peak2%channel_id(j) - p2 = int((id2-modulo(id2,10))/dble(10)) - d2 = modulo(id2,10) + p1 = peak1%channel_p_id(i) + d1 = peak1%channel_d_id(i) + p2 = peak2%channel_p_id(j) + d2 = peak2%channel_d_id(j) +! id1 = peak1%channel_id(i) +! p1 = int((id1-modulo(id1,10))/dble(10)) +! d1 = modulo(id1,10) +! id2 = peak2%channel_id(j) +! p2 = int((id2-modulo(id2,10))/dble(10)) +! d2 = modulo(id2,10) ! if(p1.eq.p2) res=res+delta_rate%dCS(p1)**2*peak1%channel_w(i)*peak2%channel_w(j) ! if(d1.eq.d2) res=res+delta_rate%dBR(d1)**2*peak1%channel_w(i)*peak2%channel_w(j) if(p1.eq.p2) then if(useSMweights) then res=res+delta_rate%dCS(p1)**2*peak1%channel_w(i)*peak2%channel_w(j) else res=res+delta_rate%dCS(p1)**2*peak1%channel_w_model(i)*peak2%channel_w_model(j) endif endif if(d1.eq.d2) then if(useSMweights) then res=res+delta_rate%dBR(d1)**2*peak1%channel_w(i)*peak2%channel_w(j) else res=res+delta_rate%dBR(d1)**2*peak1%channel_w_model(i)*peak2%channel_w_model(j) endif endif enddo enddo dratesq=res end subroutine get_rate_uncertainties_sq_peaks_old !------------------------------------------------------------------------------------ subroutine get_rate_uncertainties_sq_peaks(dratesq, peak1, peak2, collider1, & energy1, collider2, energy2) ! Returns the sum of the squared theoretical uncertainties of the common ! production and decay rates of the two peak observables. !------------------------------------------------------------------------------------ use usefulbits_HS, only : mupeak, delta_rate, useSMweights use usefulbits, only : small type(mupeak), intent(in) :: peak1, peak2 character(LEN=*), intent(in) :: collider1, collider2 double precision, intent(in) :: energy1, energy2 double precision, intent(out) :: dratesq integer :: i,j,id1,p1,d1,id2,p2,d2 double precision :: res,drcov1,drcov2,drsign !, delta res=0.0D0 ! delta=0.0D0 do i=1,peak1%Nc do j=1,peak2%Nc - id1 = peak1%channel_id(i) - p1 = int((id1-modulo(id1,10))/dble(10)) - d1 = modulo(id1,10) - id2 = peak2%channel_id(j) - p2 = int((id2-modulo(id2,10))/dble(10)) - d2 = modulo(id2,10) + p1 = peak1%channel_p_id(i) + d1 = peak1%channel_d_id(i) + p2 = peak2%channel_p_id(j) + d2 = peak2%channel_d_id(j) +! id1 = peak1%channel_id(i) +! p1 = int((id1-modulo(id1,10))/dble(10)) +! d1 = modulo(id1,10) +! id2 = peak2%channel_id(j) +! p2 = int((id2-modulo(id2,10))/dble(10)) +! d2 = modulo(id2,10) ! if(p1.eq.p2) res=res+delta_rate%dCS(p1)**2*peak1%channel_w(i)*peak2%channel_w(j) ! if(d1.eq.d2) res=res+delta_rate%dBR(d1)**2*peak1%channel_w(i)*peak2%channel_w(j) if((p1.gt.0).and.(p2.gt.0)) then if(collider1.ne.'ILC'.and.collider2.ne.'ILC') then if(delta_rate%CScov_ok.and.delta_rate%usecov) then !-- (TS 29/03/2017) Select the correct covariance matrix for the XS: if(abs(energy1-13.0d0).lt.small) then drcov1=delta_rate%CS13cov(p1,p2) else drcov1=delta_rate%CScov(p1,p2) endif drsign = sign(1.0d0,drcov1) if(abs(energy2-13.0d0).lt.small) then drcov2=delta_rate%CS13cov(p1,p2) drsign = sign(1.0d0,drcov2) ! Only overwrite sign when second peak is 13 TeV observable else drcov2=delta_rate%CScov(p1,p2) endif !-- if(useSMweights) then ! res=res+delta_rate%CScov(p1,p2)*peak1%channel_w(i)*peak2%channel_w(j) res=res+drsign*sqrt(abs(drcov1*drcov2))*peak1%channel_w(i)*peak2%channel_w(j) else ! res=res+delta_rate%CScov(p1,p2)*peak1%channel_w_model(i)*peak2%channel_w_model(j) res=res+drsign*sqrt(abs(drcov1*drcov2))*peak1%channel_w_model(i)*peak2%channel_w_model(j) endif else if(p1.eq.p2) then if(useSMweights) then res=res+delta_rate%dCS(p1)**2*peak1%channel_w(i)*peak2%channel_w(j) else res=res+delta_rate%dCS(p1)**2*peak1%channel_w_model(i)*peak2%channel_w_model(j) endif endif endif else if(collider1.eq.'ILC'.and.collider2.eq.'ILC') then if(p1.eq.p2) then if(useSMweights) then res=res+delta_rate%dCS_ILC(p1)**2*peak1%channel_w(i)*peak2%channel_w(j) else res=res+delta_rate%dCS_ILC(p1)**2*peak1%channel_w_model(i)*peak2%channel_w_model(j) endif endif endif endif ! if(collider1.ne.'ILC'.and.collider2.ne.'ILC') then ! delta=delta_rate%dCS(p1) ! else !---Set the theoretical uncertainty of production mode to zero if collider==ILC ! delta=0.0D0 ! endif ! if(useSMweights) then ! res=res+delta**2*peak1%channel_w(i)*peak2%channel_w(j) ! else ! res=res+delta**2*peak1%channel_w_model(i)*peak2%channel_w_model(j) ! endif ! endif if((d1.gt.0).and.(d2.gt.0)) then if(delta_rate%BRcov_ok.and.delta_rate%usecov) then if(useSMweights) then res=res+delta_rate%BRcov(d1,d2)*peak1%channel_w(i)*peak2%channel_w(j) else res=res+delta_rate%BRcov(d1,d2)*peak1%channel_w_model(i)*peak2%channel_w_model(j) endif else if(d1.eq.d2) then if(useSMweights) then res=res+delta_rate%dBR(d1)**2*peak1%channel_w(i)*peak2%channel_w(j) else res=res+delta_rate%dBR(d1)**2*peak1%channel_w_model(i)*peak2%channel_w_model(j) endif endif endif endif enddo enddo dratesq=res end subroutine get_rate_uncertainties_sq_peaks !------------------------------------------------------------------------------------ subroutine get_cov_mu(matrix) !------------------------------------------------------------------------------------ implicit none double precision, dimension(:,:), intent(out) :: matrix if(allocated(cov)) then if(size(cov,dim=1).eq.size(matrix,dim=1).and.size(cov,dim=2).eq.size(matrix,dim=2)) then ! allocate(matrix(size(cov,dim=1),size(cov,dim=2))) matrix = cov else write(*,*) "WARNING in subroutine get_cov_mu: different dimensions." endif else write(*,*) "WARNING in subroutine get_cov_mu: cov not allocated." endif end subroutine get_cov_mu !------------------------------------------------------------------------------------ subroutine get_cov_mh(Hindex,matrix) !------------------------------------------------------------------------------------ implicit none double precision, dimension(:,:), intent(out) :: matrix integer, intent(in) :: Hindex if(allocated(cov_mhneut)) then if(size(cov_mhneut,dim=2).eq.size(matrix,dim=1)& & .and.size(cov_mhneut,dim=3).eq.size(matrix,dim=2)) then if(Hindex.ge.lbound(cov_mhneut,dim=1).and.Hindex.le.ubound(cov_mhneut,dim=1)) then matrix = cov_mhneut(Hindex,:,:) else write(*,*) "WARNING in subroutine get_cov_mh: Hindex not in range." endif else write(*,*) "WARNING in subroutine get_cov_mh: different dimensions." endif else write(*,*) "WARNING in subroutine get_cov_mh: cov not allocated." endif end subroutine get_cov_mh !------------------------------------------------------------------------------------ subroutine print_cov_mu_to_file use usefulbits, only : file_id_common3 implicit none character(LEN=20):: formatstring open(file_id_common3, file='cov_mu.txt', form='formatted') write(formatstring,'(A1,I2,A7)') '(',size(cov,dim=2),'F20.10)' do i=lbound(cov,dim=1),ubound(cov,dim=1) write(file_id_common3, formatstring) cov(i,:) enddo close(file_id_common3) end subroutine print_cov_mu_to_file !------------------------------------------------------------------------------------ subroutine print_corr_mu_to_file use usefulbits, only : file_id_common3 implicit none character(LEN=20):: formatstring open(file_id_common3, file='corr_mu.txt', form='formatted') write(formatstring,'(A1,I2,A7)') '(',size(cov,dim=2),'F20.10)' do i=lbound(cov,dim=1),ubound(cov,dim=1) ! TS fix 14/08/2013: Took square root of this! write(file_id_common3, formatstring) (cov(i,j)/sqrt(cov(i,i)*cov(j,j)), & & j=lbound(cov,dim=2),ubound(cov,dim=2)) enddo close(file_id_common3) end subroutine print_corr_mu_to_file !------------------------------------------------------------------------------------ subroutine print_inverse_cov_mu_to_file use usefulbits, only : file_id_common3 implicit none character(LEN=20):: formatstring double precision, allocatable :: invcov(:,:) allocate(invcov(size(cov,dim=1),size(cov,dim=2))) call invmatrix(cov,invcov) open(file_id_common3, file='inverse_cov_mu.txt', form='formatted') write(formatstring,'(A1,I2,A7)') '(',size(invcov,dim=2),'F20.10)' do i=lbound(invcov,dim=1),ubound(invcov,dim=1) write(file_id_common3, formatstring) invcov(i,:) enddo close(file_id_common3) open(file_id_common3, file='mu_vector.txt', form='formatted') do i=lbound(mu_vector,dim=1),ubound(mu_vector,dim=1) write(file_id_common3, '(1F20.10)') mu_vector(i) enddo close(file_id_common3) end subroutine print_inverse_cov_mu_to_file !------------------------------------------------------------------------------------ subroutine print_inverse_cov_mh_to_file(Hindex) use usefulbits, only : file_id_common3 implicit none character(LEN=20):: formatstring, filename integer, intent(in) :: Hindex double precision, allocatable :: invcov(:,:) allocate(invcov(size(cov_mhneut,dim=2),size(cov_mhneut,dim=3))) if(useaveragemass) then call invmatrix(cov_mh_av(:,:),invcov) open(file_id_common3, file='inverse_cov_mh_average.txt', form='formatted') write(formatstring,'(A1,I2,A7)') '(',size(invcov,dim=2),'F20.10)' do i=lbound(invcov,dim=1),ubound(invcov,dim=1) write(file_id_common3, formatstring) invcov(i,:) enddo close(file_id_common3) else call invmatrix(cov_mhneut(Hindex,:,:),invcov) write(filename,'(A14,I1,A4)') 'inverse_cov_mh',Hindex,'.txt' open(file_id_common3, file=trim(adjustl(filename)), form='formatted') write(formatstring,'(A1,I2,A7)') '(',size(invcov,dim=2),'F20.10)' do i=lbound(invcov,dim=1),ubound(invcov,dim=1) write(file_id_common3, formatstring) invcov(i,:) enddo close(file_id_common3) endif end subroutine print_inverse_cov_mh_to_file !------------------------------------------------------------------------------------ subroutine print_cov_mh_to_file(Hindex) use usefulbits, only : file_id_common3 implicit none character(LEN=20):: formatstring, filename integer, intent(in) :: Hindex if(useaveragemass) then write(filename,'(A10)') 'cov_mh.txt' open(file_id_common3, file=trim(adjustl(filename)), form='formatted') write(formatstring,'(A1,I2,A7)') '(',size(cov_mh_av,dim=2),'F20.10)' do i=lbound(cov_mh_av,dim=1),ubound(cov_mh_av,dim=1) write(file_id_common3, formatstring) cov_mh_av(i,:) enddo close(file_id_common3) else write(filename,'(A6,I1,A4)') 'cov_mh',Hindex,'.txt' open(file_id_common3, file=trim(adjustl(filename)), form='formatted') write(formatstring,'(A1,I2,A7)') '(',size(cov_mhneut,dim=3),'F20.10)' do i=lbound(cov_mhneut,dim=2),ubound(cov_mhneut,dim=2) write(file_id_common3, formatstring) cov_mhneut(Hindex,i,:) enddo close(file_id_common3) endif end subroutine print_cov_mh_to_file !------------------------------------------------------------------------------------ subroutine print_peakinformation !------------------------------------------------------------------------------------ ! use usefulbits_HS, only : peaklist implicit none do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do j=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) write(*,*) write(*,*)'#*************************************************************************#' write(*,'(A,I3,A,I3,A)') ' # Analysis ',i, & & ' Peak ',j,' #' write(*,*)'#*************************************************************************#' write(*,'(A25,1I10)') 'ID =', analyses(i)%id write(*,'(A25,4X,A3)') 'Collaboration =', analyses(i)%table%collaboration write(*,'(A25,1F10.2)') 'Energy =', analyses(i)%table%energy write(*,'(A25,4X,A100)') 'Reference =', analyses(i)%table%label write(*,'(A25,4X,A100)') 'Description =', analyses(i)%table%desc write(*,'(A25,1F10.3)') 'mass resolution =',analyses(i)%table%deltam write(*,'(A25,1F10.3)') 'peak mass =',analyses(i)%peaks(j)%mpeak write(*,'(A25,1F10.4)') 'peak mu =',analyses(i)%peaks(j)%mu write(*,'(A25,2F10.4)') 'cyan band(low,high) =',analyses(i)%peaks(j)%dmulow, & & analyses(i)%peaks(j)%dmuup ! write(*,'(A25,2F10.4)') 'dmu0 (low,high) =',analyses(i)%peaks(j)%dmulow0, & !& analyses(i)%peaks(j)%dmuup0 write(*,'(A25,4X,$)') 'Higgs combination =' do k=lbound(analyses(i)%peaks(j)%Higgs_comb,dim=1), & & ubound(analyses(i)%peaks(j)%Higgs_comb,dim=1) write(*,'(1I3,$)') analyses(i)%peaks(j)%Higgs_comb(k) enddo write(*,*) write(*,'(A25,7X,1I3)') 'Dominant Higgs =',analyses(i)%peaks(j)%domH write(*,'(A25,1F10.4)'), 'Total pred. mu =',analyses(i)%peaks(j)%total_mu write(*,'(A25,1F15.9)'), 'Chisq for mu =',analyses(i)%peaks(j)%chisq_mu write(*,'(A25,1F15.9)'), 'Chisq for mh =',analyses(i)%peaks(j)%chisq_mh write(*,'(A25,1F15.9)'), 'Chisq (total) =',analyses(i)%peaks(j)%chisq_tot write(*,'(A25,1F15.9)'), 'Chisq (max) =',analyses(i)%peaks(j)%chisq_max write(*,*)'#------------------------ Channel information ----------------------------#' - write(*,*) ' ID prod. decay mu weight syst.err. ' + write(*,*) ' p,d-ID prod. decay mu weight syst.err. ' write(*,*)'#-------------------------------------------------------------------------#' do k=1, analyses(i)%peaks(j)%Nc - write(*,'(1I5,5X,2A,3F15.6)') analyses(i)%peaks(j)%channel_id(k),& + write(*,'(2I5,5X,2A,3F15.6)') analyses(i)%peaks(j)%channel_p_id(k),& + & analyses(i)%peaks(j)%channel_d_id(k),& & analyses(i)%table%channel_description(k,:),& & analyses(i)%peaks(j)%channel_mu(k),analyses(i)%peaks(j)%channel_w_model(k),& & analyses(i)%peaks(j)%channel_syst(k) enddo write(*,*)'#-------------------------------------------------------------------------#' enddo enddo end subroutine print_peakinformation !------------------------------------------------------------------------------------ subroutine print_peakinformation_essentials !------------------------------------------------------------------------------------ !x use usefulbits_HS, only : peaklist implicit none do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do j=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) write(*,*) write(*,*)'#*************************************************************************#' write(*,'(A,I3,A,I3,A)') ' # Analysis ',i, & & ' Peak ',j,' #' write(*,*)'#*************************************************************************#' write(*,'(A25,1I10)') 'ID =', analyses(i)%id write(*,'(A25,7X,A3)') 'Collaboration =', analyses(i)%table%collaboration write(*,'(A25,4X,F6.2)') 'cms energy =', analyses(i)%table%energy write(*,'(A25,4X,A100)') 'Reference =', analyses(i)%table%label write(*,'(A25,4X,A100)') 'Description =', analyses(i)%table%desc write(*,'(A25,1F10.2)') 'mass resolution =',analyses(i)%table%deltam write(*,'(A25,1F10.2)') 'peak mass =',analyses(i)%peaks(j)%mpeak write(*,'(A25,1F10.4)') 'peak mu =',analyses(i)%peaks(j)%mu write(*,'(A25,2F10.4)') 'cyan band(low,high) =',analyses(i)%peaks(j)%dmulow, & & analyses(i)%peaks(j)%dmuup write(*,*)'#------------------------ Channel information ----------------------------#' - write(*,*)' ID prod. decay efficiency' + write(*,*)' p,d-ID prod. decay efficiency' write(*,*)'#-------------------------------------------------------------------------#' do k=1, analyses(i)%peaks(j)%Nc - write(*,'(1I5,5X,2A,1F15.6)') analyses(i)%peaks(j)%channel_id(k), & + write(*,'(2I5,5X,2A,1F15.6)') analyses(i)%peaks(j)%channel_p_id(k), & +& analyses(i)%peaks(j)%channel_d_id(k),& & analyses(i)%table%channel_description(k,:),analyses(i)%table%channel_eff(k) enddo write(*,*)'#-------------------------------------------------------------------------#' enddo enddo end subroutine print_peakinformation_essentials !------------------------------------------------------------------------------------ subroutine print_peaks_to_file !------------------------------------------------------------------------------------ use usefulbits, only : file_id_common3 use usefulbits_hs, only : StrCompress implicit none character(LEN=100) :: formatspec integer :: kk kk=0 formatspec='(I3,7X,I10,1X,F6.2,1X,4F8.4,1X,A3,1X,F6.2,1X,F6.2,1X,I3,1X,A,5X,A)' open(file_id_common3,file="peak_information.txt") write(file_id_common3,*) "#HiggsSignals-"//trim(adjustl(HSvers))// & & " with experimental dataset '"//trim(adjustl(Exptdir))//"'" write(file_id_common3,*) "#Number Analysis-ID mh_obs mu_obs dmu_low dmu_high ", & & "dmh_exp collaboration energy luminosity description reference" write(file_id_common3,*) "#" do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do j=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) kk=kk+1 write(file_id_common3,formatspec)kk,analyses(i)%id,analyses(i)%peaks(j)%mpeak, & & analyses(i)%peaks(j)%mu, analyses(i)%peaks(j)%dmulow,analyses(i)%peaks(j)%dmuup, & & analyses(i)%table%deltam,analyses(i)%table%collaboration, analyses(i)%table%energy, & & analyses(i)%table%lumi, analyses(i)%table%mhchisq, & & trim(strcompress(analyses(i)%table%desc)), analyses(i)%table%label enddo enddo close(file_id_common3) end subroutine print_peaks_to_file !------------------------------------------------------------------------------------ subroutine print_peaks_to_LaTeX !------------------------------------------------------------------------------------ use usefulbits, only : file_id_common3 use usefulbits_hs, only : StrCompress implicit none character(LEN=100) :: formatspec integer :: kk, N, ii, id, p double precision :: weights(5) = (/ 0.0D0, 0.0D0,0.0D0,0.0D0,0.0D0 /) kk=0 open(file_id_common3,file="peak_information.tex") write(file_id_common3,*) "\begin{tabular}{lcrrrrr}" write(file_id_common3,*) "\hline" write(file_id_common3,*) "Analysis & Signal strength & \multicolumn{5}{c}{Signal contamination [in \%]} \\" write(file_id_common3,*) "& & ggH & VBF & WH & ZH & $t\bar{t}H$ \\" write(file_id_common3,*) "\hline" do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do j=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) kk=kk+1 N = analyses(i)%peaks(j)%Nc weights = (/ 0.0D0, 0.0D0,0.0D0,0.0D0,0.0D0 /) do ii=1,N - id = analyses(i)%peaks(j)%channel_id(ii) - p = int((id-modulo(id,10))/dble(10)) - weights(p) = analyses(i)%peaks(j)%channel_w_model(ii) +! id = analyses(i)%peaks(j)%channel_id(ii) +! p = int((id-modulo(id,10))/dble(10)) + p = analyses(i)%peaks(j)%channel_p_id(ii) + if(p.le.5) then + weights(p) = analyses(i)%peaks(j)%channel_w_model(ii) + else + write(*,*) "Warning: print_peaks_to_LaTeX only outputs information for the five main production channels!" + endif enddo - write(formatspec,"(A,I1,A,I1,A)") '(A3,1X,A,A,A,A,A,F6.2,A,F6.2,A,F6.2,A,F6.1,A,F6.1,A,F6.1,A,F6.1,A,F6.1,A,',N,'I3)' +! write(formatspec,"(A,I1,A,I1,A)") '(A3,1X,A,A,A,A,A,F6.2,A,F6.2,A,F6.2,A,F6.1,A,F6.1,A,F6.1,A,F6.1,A,F6.1,A,',N,'I3)' + write(formatspec,"(A,I1,A,I1,A)") '(A3,1X,A,A,A,A,A,F6.2,A,F6.2,A,F6.2,A,F6.1,A,F6.1,A,F6.1,A,F6.1,A,F6.1,A)' write(file_id_common3,formatspec) analyses(i)%table%collaboration, & & "$",trim(strcompress(analyses(i)%table%desc)), "$~\cite{", & & trim(strcompress(analyses(i)%table%label)),"} & $", & & analyses(i)%peaks(j)%mu, "\substack{+",analyses(i)%peaks(j)%dmuup,"\\ -",& & abs(analyses(i)%peaks(j)%dmulow),"}$ & $",100*weights(1),"$ & $",100*weights(2),& - & "$ & $",100*weights(3),"$ & $",100*weights(4),"$ & $",100*weights(5),"$\\ %", & - & analyses(i)%peaks(j)%channel_id + & "$ & $",100*weights(3),"$ & $",100*weights(4),"$ & $",100*weights(5),"$\\" enddo enddo write(file_id_common3,*) "\hline" write(file_id_common3,*) "\end{tabular}" end subroutine print_peaks_to_LaTeX !------------------------------------------------------------------------------------ subroutine print_peaks_signal_rates_to_file !------------------------------------------------------------------------------------ use usefulbits, only : file_id_common3 use usefulbits_hs, only : HSres implicit none character(LEN=100) :: formatspec,formatspec2 integer :: kk double precision :: mh_pull, mu_pull, dmu kk=0 formatspec='(I3,7X,I10,1X,4F8.2,1X,6F10.4)' formatspec2='(I3,7X,I10,1X,2F8.2,1X,A7,1X,A7,1X,A7,1X,5F10.4)' open(file_id_common3,file="peak_massesandrates.txt") write(file_id_common3,*) "#HiggsSignals-"//trim(adjustl(HSvers))// & & " with experimental dataset '"//trim(adjustl(Exptdir))//"'" write(file_id_common3,*) "#pull = (predicted - observed)/(gaussian uncertainty)" write(file_id_common3,*) "#Number Analysis-ID mh_obs dmh_exp mh_pred dmh_theo mh_pull",& & " mu_obs dmu_low dmu_high mu_pred mu_pull" write(file_id_common3,*) "#" do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do j=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) kk=kk+1 if(analyses(i)%peaks(j)%domH.ne.0) then mh_pull = (analyses(i)%peaks(j)%Higgses(analyses(i)%peaks(j)%domH)%m - & & analyses(i)%peaks(j)%mpeak)/ & & sqrt(analyses(i)%table%deltam**2+ & & analyses(i)%peaks(j)%Higgses(analyses(i)%peaks(j)%domH)%dm**2) endif call get_dmu_peak(dmu,analyses(i)%peaks(j)) mu_pull = (analyses(i)%peaks(j)%total_mu - analyses(i)%peaks(j)%mu)/dmu if(analyses(i)%peaks(j)%domH.ne.0) then write(file_id_common3,formatspec)kk,analyses(i)%id,analyses(i)%peaks(j)%mpeak, & & analyses(i)%table%deltam, analyses(i)%peaks(j)%Higgses(analyses(i)%peaks(j)%domH)%m, & & analyses(i)%peaks(j)%Higgses(analyses(i)%peaks(j)%domH)%dm, mh_pull, & & analyses(i)%peaks(j)%mu, analyses(i)%peaks(j)%dmulow,analyses(i)%peaks(j)%dmuup, & & analyses(i)%peaks(j)%total_mu, mu_pull else write(file_id_common3,formatspec2)kk,analyses(i)%id,analyses(i)%peaks(j)%mpeak, & & analyses(i)%table%deltam, 'NAN','NAN','NAN', & & analyses(i)%peaks(j)%mu, analyses(i)%peaks(j)%dmulow,analyses(i)%peaks(j)%dmuup, & & analyses(i)%peaks(j)%total_mu, mu_pull endif enddo enddo close(file_id_common3) end subroutine print_peaks_signal_rates_to_file !-------------------------------------------------------------------- subroutine get_peakchi2(obsID, csqmu, csqmh, csqmax, csqtot) !-------------------------------------------------------------------- implicit none integer, intent(in) :: obsID double precision, intent(out) :: csqmu, csqmh, csqmax, csqtot integer :: i, j do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do j=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) if(obsID.eq.analyses(i)%peaks(j)%id) then csqmu = analyses(i)%peaks(j)%chisq_mu csqmh = analyses(i)%peaks(j)%chisq_mh csqmax = analyses(i)%peaks(j)%chisq_max csqtot = analyses(i)%peaks(j)%chisq_tot endif enddo enddo end subroutine get_peakchi2 !------------------------------------------------------------------------------------ subroutine get_masschi2_from_separation(csq) !------------------------------------------------------------------------------------ implicit none double precision, intent(out) :: csq integer :: i, ii, iii ! write(*,*) "Calling get_masschi2_from_separation." csq =0.0D0 iii=0 do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do ii=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) iii=iii+1 if(analyses(i)%table%mhchisq.eq.1) then csq = csq + csq_mass_separation_weighted( & & analyses(i)%peaks(ii)%Higgs_comb, analyses(i)%peaks(ii)) ! write(*,*) 'analyses(',i,')%peaks(',ii,')%Higgs_comb = ',analyses(i)%peaks(ii)%Higgs_comb endif enddo enddo ! write(*,*) 'csq_sep =', csq end subroutine get_masschi2_from_separation !------------------------------------------------------------------------------------ subroutine add_peaks_to_HSresults(r) !------------------------------------------------------------------------------------ ! use usefulbits_hs, only : HSresults, peaklist implicit none type(HSresults), intent(out) :: r integer :: i,j, iii if(allocated(r%obsID)) deallocate(r%obsID) if(allocated(r%mupred)) deallocate(r%mupred) if(allocated(r%domH)) deallocate(r%domH) if(allocated(r%nH)) deallocate(r%nH) !-The number of peaks should maybe be saved in a global usefulbits_HS variable in order ! to avoid multiple loops over the peaklist. iii=0 do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do j=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) iii=iii+1 enddo enddo allocate(r%mupred(iii), r%domH(iii), r%nH(iii), r%obsID(iii)) iii=0 do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do j=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) iii=iii+1 r%mupred(iii)=analyses(i)%peaks(j)%total_mu r%domH(iii)=analyses(i)%peaks(j)%domH r%nH(iii)=analyses(i)%peaks(j)%NHiggs_comb r%obsID(iii)=analyses(i)%peaks(j)%id enddo enddo ! write(*,*) "End of subroutine add_peaks_to_HSresults." end subroutine add_peaks_to_HSresults !------------------------------------------------------------------------------------ subroutine get_dmu0sq_peak(dmu0sq,peak,domax) !------------------------------------------------------------------------------------ use usefulbits_HS, only : mupeak, symmetricerrors, absolute_errors implicit none integer, intent(in) :: domax ! if 1, then use predicted mu == 0 double precision, intent(out) :: dmu0sq double precision :: pred_mu, mu type(mupeak), intent(in) :: peak ! TESTING: ! if(absolute_errors) then ! mu=peak%mu_original ! else mu=peak%mu ! endif if(domax.eq.1) then pred_mu = 0.0D0 else pred_mu = peak%total_mu endif if(.not.symmetricerrors) then if(pred_mu.le.mu) then dmu0sq = peak%dmulow0sq else if(pred_mu.gt.mu) then dmu0sq = peak%dmuup0sq endif else if(peak%dmulow0sq.lt.0.0d0.or.peak%dmuup0sq.lt.0.0d0) then write(*,*) "WARNING: squared intrinsic mu uncertainty is negative!" dmu0sq= (sqrt(abs(peak%dmulow0sq))+sqrt(abs(peak%dmuup0sq)))**2/4. else dmu0sq = (sqrt(peak%dmulow0sq)+sqrt(peak%dmuup0sq))**2/4. endif endif !! write(*,*) 'DEBUG: ',peak%dmulow0sq, peak%dmuup0sq, (sqrt(peak%dmulow0sq)+sqrt(peak%dmuup0sq))**2/4. end subroutine get_dmu0sq_peak !------------------------------------------------------------------------------------ subroutine get_dmu_peak(dmu,peak) !------------------------------------------------------------------------------------ use usefulbits_HS, only : mupeak implicit none double precision, intent(out) :: dmu double precision :: pred_mu type(mupeak), intent(in) :: peak pred_mu = peak%total_mu if(pred_mu.le.peak%mu) then dmu = peak%dmulow else if(pred_mu.gt.peak%mu) then dmu = peak%dmuup endif end subroutine get_dmu_peak !------------------------------------------------------------------------------------ subroutine calc_pc_chisq(pc_chisq,peak,mhchisqflag,Higgses,Higgs_dom,indices_in,iterstep) ! This subroutine calculates the chisq value for a given Higgs combination assigned ! to one peak. ! Parameters: ! ! pc_chisq: Return value (double precision) ! peak: Peak observable the Higgs bosons are assigned to (type mupeak) ! Higgses: neutral Higgs bosons considered for the assignment (type neutHiggs(:)) ! Hdom: dominantly contribution Higgs boson (int) ! indices_in: Higgs boson combination the chi squared value is evaluated for (int(:)) ! iterstep: Iteration-step of Higgs-to-peak assignment !------------------------------------------------------------------------------------ implicit none type(mupeak), intent(in) :: peak type(neutHiggs), dimension(:), intent(in) :: Higgses(:) ! integer, allocatable, intent(out) :: indices_best(:) ! integer, intent(in), optional :: Nindices_in integer, dimension(:), intent(in) :: indices_in(:) integer, intent(in) :: mhchisqflag, iterstep integer, intent(out) :: Higgs_dom double precision, intent(out) :: pc_chisq !--Internal parameters: double precision :: mutot,dmu,csq0,csq_mh_tot,csq_tot,csq_tot_tmp,csq_mh_tmp,mumax double precision :: deltam integer :: nH double precision :: m, dm call check_pdf(pdf) nH=size(Higgses) !--Calculate the maximal chisq value for this peak csq0 = csq_mu(0.0D0,peak%mu,peak%dmuup,peak%dmulow) mumax = -1.0D6 mutot = 0.0D0 csq_mh_tot=0.0D0 Higgs_dom=0 ! Calculate mutot and find dominant Higgs do i=lbound(indices_in,dim=1),ubound(indices_in,dim=1) if(indices_in(i).ne.0) then mutot = mutot + Higgses(indices_in(i))%mu if(Higgses(indices_in(i))%mu.gt.mumax) then mumax = Higgses(indices_in(i))%mu Higgs_dom = indices_in(i) endif endif enddo if(allocated(cov_mhneut_max).and.iterstep.eq.1) then !-In the first iterated step, use a Higgs mass covariance matrix, where all Higgs bosons !-are assumed to be assigned. ! write(*,*) "Warning!! called csq_mh_with_max_corr!" csq_mh_tot = csq_mh_with_max_corr(indices_in, peak%internalnumber) elseif(allocated(cov_mhneut).and.iterstep.gt.1) then !-In the second (and succeeding) iterated steps, use a the Higgs mass covariance matrix !-based on the the previous Higgs-to-peaks assignment. ! write(*,*) "Warning!! called csq_mh_with_corr!" csq_mh_tot = csq_mh_with_corr(indices_in, peak%internalnumber) else if(useaveragemass) then call get_average_mass_for_peak(indices_in, peak, m, dm) if(mhchisqflag.eq.1) then deltam = peak%dm csq_mh_tot = csq_mh(m, peak%mpeak, dm, peak%dm) else csq_mh_tot = 0.0D0 endif else do i=lbound(indices_in,dim=1),ubound(indices_in,dim=1) if(indices_in(i).ne.0) then if(mhchisqflag.eq.1) then deltam = peak%dm csq_mh_tmp = csq_mh(Higgses(indices_in(i))%m, peak%mpeak, & & Higgses(indices_in(i))%dm,deltam) else csq_mh_tmp = 0.0D0 endif csq_mh_tot = csq_mh_tot + csq_mh_tmp endif enddo endif endif if(allocated(cov)) then csq_tot = csq_mh_tot + csq_mu_with_corr(mutot, peak%internalnumber) else csq_tot = csq_mh_tot + csq_mu(mutot, peak%mu, peak%dmuup, peak%dmulow) endif pc_chisq = csq_tot end subroutine calc_pc_chisq !--------------------------------------------------------------------------- function csq_mh_with_max_corr(indices_in, peaknumber) !--------------------------------------------------------------------------- integer, dimension(:), intent(in) :: indices_in(:) integer, intent(in) :: peaknumber double precision :: csq_mh_with_max_corr double precision, allocatable :: csq_mh_per_Higgs(:) integer :: i, ii, iii, k, nH, N, Hindex double precision, allocatable :: v(:,:), invcov(:,:), v2(:) nH = size(cov_mhneut,dim=1) N = size(cov_mhneut,dim=2) allocate(v(nH,N), v2(N), csq_mh_per_Higgs(nH)) do k=1,nH iii=0 do i=1, size(analyses) do ii=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) iii=iii+1 v(k,iii) = analyses(i)%peaks(ii)%Higgses(k)%m - analyses(i)%peaks(ii)%mpeak if(iii.eq.peaknumber) v(k,iii) = 0.0D0 ! Will be filled later... enddo enddo enddo do k=1,nH iii=0 do i=1, size(analyses) do ii=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) iii=iii+1 if(iii.eq.peaknumber) then Hindex=indices_in(k) if(Hindex.ne.0) then v(Hindex,iii) = analyses(i)%peaks(ii)%Higgses(k)%m - analyses(i)%peaks(ii)%mpeak endif endif enddo enddo enddo do k=1,nH !-n.b.: this loops now over Hindex call invmatrix(cov_mhneut_max(k,:,:),invcov) call matmult(invcov,v(k,:),v2,N,1) csq_mh_per_Higgs(k) = v(k,peaknumber)*v2(peaknumber) enddo csq_mh_with_max_corr = sum(csq_mh_per_Higgs) deallocate(v,v2,csq_mh_per_Higgs) end function csq_mh_with_max_corr !--------------------------------------------------------------------------- function csq_mh_with_corr(indices_in, peaknumber) !--------------------------------------------------------------------------- integer, dimension(:), intent(in) :: indices_in(:) integer, intent(in) :: peaknumber double precision :: csq_mh_with_corr double precision, allocatable :: csq_mh_per_Higgs(:) integer :: i, ii, iii, k, nH, N, Hindex double precision, allocatable :: v(:,:), invcov(:,:), v2(:) nH = size(cov_mhneut,dim=1) N = size(cov_mhneut,dim=2) allocate(v(nH,N), v2(N), csq_mh_per_Higgs(nH)) !-First, fill the vectors with zeros: do k=1,nH do i=1,N v(k,i) = 0.0D0 enddo enddo do k=1,nH iii=0 do i=1, size(analyses) do ii=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) iii=iii+1 Hindex = analyses(i)%peaks(ii)%Higgs_comb(k) if(iii.eq.peaknumber) Hindex=indices_in(k) if(Hindex.ne.0) then v(Hindex,iii) = analyses(i)%peaks(ii)%Higgses(Hindex)%m - & & analyses(i)%peaks(ii)%mpeak endif enddo enddo enddo do k=1,nH !-n.b.: this loops now over Hindex call invmatrix(cov_mhneut(k,:,:),invcov) call matmult(invcov,v(k,:),v2,N,1) csq_mh_per_Higgs(k) = v(k,peaknumber)*v2(peaknumber) enddo csq_mh_with_corr = sum(csq_mh_per_Higgs) deallocate(v,v2,csq_mh_per_Higgs) end function csq_mh_with_corr !------------------------------------------------------------------------------------ function csq_mu_with_corr(mu, peaknumber) !------------------------------------------------------------------------------------ ! use usefulbits_hs, only : peaklist, cov use numerics, only : invmatrix, matmult integer, intent(in) :: peaknumber double precision, intent(in) :: mu integer :: i, ii, iii, N double precision, allocatable :: v(:), vmat(:,:), invcov(:,:), v2(:) double precision :: csq_mu_with_corr if(allocated(cov)) deallocate(cov) call create_covariance_matrix_mu(0) N = size(cov,dim=1) allocate(v(N), vmat(N,1),invcov(N,N), v2(N)) !-First construct the vector (mupred - muobs)_iii iii=0 do i=1, size(analyses) do ii=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) iii=iii+1 v(iii) = analyses(i)%peaks(ii)%total_mu - analyses(i)%peaks(ii)%mu if(iii.eq.peaknumber) v(iii) = mu - analyses(i)%peaks(ii)%mu vmat(iii,1) = v(iii) enddo enddo call invmatrix(cov,invcov) call matmult(invcov,vmat,v2,N,1) csq_mu_with_corr = v(peaknumber)*v2(peaknumber) deallocate(v,vmat,invcov,v2) end function csq_mu_with_corr !------------------------------------------------------------------------------------ subroutine check_pdf(pdf) !------------------------------------------------------------------------------------ implicit none integer, intent(inout) :: pdf if(.not.((pdf.eq.1).or.(pdf.eq.2).or.(pdf.eq.3))) then write(*,*) 'WARNING: pdf not properly specified. Will be set to pdf=2 (gaussian-shape)' pdf=2 endif end subroutine check_pdf !------------------------------------------------------------------------------------ function csq_mu(x, x0, dx_up, dx_low) !- x: model predicted value !- x0: observed value !- dx_up: difference between observed and upper 1sigma band (always positive) !- dx_low: difference between observed and lower 1sigma band (always positive) !------------------------------------------------------------------------------------ use usefulbits_hs, only : symmetricerrors implicit none double precision, intent(in) :: x, x0, dx_up, dx_low double precision :: csq_mu, dx if(.not.symmetricerrors) then if(x.ge.x0) then dx = dx_up else dx = dx_low endif else dx = (abs(dx_up)+abs(dx_low))/2. endif csq_mu=chisq(x, x0, dx) end function csq_mu !------------------------------------------------------------------------------------ function csq_mh(x,x0,dx1,dx2) !------------------------------------------------------------------------------------ implicit none double precision, intent(in) :: x, x0, dx1, dx2 double precision :: csq_mh, dx if(pdf.eq.1) then ! box pdf dx = dx1 + dx2 ! Add exp. and th. uncertainties linearly if(x.ge.(x0-dx).and.x.le.(x0+dx)) then csq_mh = 0.0D0 else csq_mh = 100000.0D0 !Large number endif else if(pdf.eq.2) then ! gaussian pdf dx = sqrt(dx1**2+dx2**2) ! Add uncertainties in quadrature csq_mh = chisq(x,x0,dx) !---------------------------- Have to verify boxgaussian... else if(pdf.eq.3) then ! box+gaussian pdf if(x.ge.(x0-dx1).and.x.le.(x0+dx1)) then csq_mh = 0.0D0 else if(x.ge.(x0+dx1)) then csq_mh = chisq(x,x0+dx1,dx2) else if(x.le.(x0-dx1)) then csq_mh = chisq(x,x0-dx1,dx2) endif endif end function csq_mh !------------------------------------------------------------------------------------ function csq_mass_separation_weighted(indices_in, peak) !--------------------------------------------------------------------------- use usefulbits, only : vsmall implicit none integer, dimension(:), intent(in) :: indices_in(:) type(mupeak), intent(in) :: peak double precision :: csq_mass_separation_weighted double precision :: mutotal,csq,csq_mh_tmp, m, dm integer :: i,k,NHiggs !------------------------------------------------------------------------------------ NHiggs = 0 mutotal = 0.0D0 do k=lbound(indices_in,dim=1),ubound(indices_in,dim=1) i = indices_in(k) if(i.ne.0) then mutotal = mutotal + peak%Higgses(i)%mu NHiggs=NHiggs+1 endif enddo call get_average_mass_for_peak(indices_in, peak, m, dm) csq = 0.0D0 if(abs(mutotal).gt.vsmall.and.NHiggs.gt.1) then do k=lbound(indices_in,dim=1),ubound(indices_in,dim=1) i = indices_in(k) csq_mh_tmp = 0.0D0 if(i.ne.0) then if(pdf.eq.1) then ! box pdf if(peak%Higgses(i)%m.ge.(m-peak%Higgses(i)%dm-peak%dm).and. & & peak%Higgses(i)%m.le.(m+peak%Higgses(i)%dm+peak%dm)) then csq_mh_tmp = 0.0D0 else csq_mh_tmp = 100000.0D0 !Large number endif else if(pdf.eq.2) then csq_mh_tmp = chisq(peak%Higgses(i)%m,m,sqrt(peak%dm**2+peak%Higgses(i)%dm**2)) ! write(*,*) "m, m_av, dm = ",peak%Higgses(i)%m,m,sqrt(peak%dm**2+peak%Higgses(i)%dm**2) ! write(*,*) "i, csq_mh_tmp = ", i , csq_mh_tmp else if(pdf.eq.3) then if(peak%Higgses(i)%m.ge.(m-peak%Higgses(i)%dm).and. & & peak%Higgses(i)%m.le.(m+peak%Higgses(i)%dm)) then csq_mh_tmp = 0.0D0 else if(peak%Higgses(i)%m.gt.m+peak%Higgses(i)%dm) then csq_mh_tmp = chisq(peak%Higgses(i)%m,m+peak%Higgses(i)%dm,peak%dm) else if(peak%Higgses(i)%m.lt.m-peak%Higgses(i)%dm) then csq_mh_tmp = chisq(peak%Higgses(i)%m,m-peak%Higgses(i)%dm,peak%dm) endif else stop "Error: Unknown pdf!" endif csq = csq + abs(peak%Higgses(i)%mu/mutotal)*csq_mh_tmp endif enddo endif csq_mass_separation_weighted = csq end function csq_mass_separation_weighted !------------------------------------------------------------------------------------ function chisq(x,x0,dx) !------------------------------------------------------------------------------------ implicit none double precision, intent(in) :: x,x0,dx double precision :: chisq if(dx.ne.0) then chisq=(x-x0)**2/dx**2 else write(*,*) 'WARNING, dx = 0' chisq=100000. endif end function chisq !------------------------------------------------------------------------------------ subroutine get_ncomb(ncomb, indices_truncated, indices_best) !------------------------------------------------------------------------------------ implicit none integer, dimension(:), intent(in) :: indices_best(:) integer, allocatable, intent(out) :: indices_truncated(:) integer, intent(out) :: ncomb integer :: i,j ncomb=0 do i=lbound(indices_best,dim=1),ubound(indices_best,dim=1) if(indices_best(i).ne.0) ncomb=ncomb+1 enddo allocate(indices_truncated(ncomb)) j=1 do i=lbound(indices_best,dim=1),ubound(indices_best,dim=1) if(indices_best(i).ne.0) then indices_truncated(j)=indices_best(i) j=j+1 endif enddo end subroutine get_ncomb !------------------------------------------------------------------------------------ subroutine get_weights_at_peak( peak, mutab ) ! This subroutines fills the channels weights array of the peak object with the ! Standard Model weights obtained at the peaks position. !------------------------------------------------------------------------------------ use usefulbits, only : div, small ! use theory_XS_SM_functions use usefulbits_HS, only : mutable type(mupeak), intent(inout) :: peak type(mutable), intent(in) :: mutab integer :: i, id, p, d double precision :: SMrate, mass double precision :: SMCS_lhc7_gg_H,SMCS_lhc7_bb_H,SMCS_lhc7_vbf_H,SMCS_lhc7_HW, & & SMCS_lhc7_HZ, SMCS_lhc7_ttH, SMCS_lhc8_gg_H,SMCS_lhc8_bb_H,SMCS_lhc8_vbf_H, & & SMCS_lhc8_HW, SMCS_lhc8_HZ, SMCS_lhc8_ttH, SMCS_lhc13_gg_H,SMCS_lhc13_bb_H, & & SMCS_lhc13_vbf_H, SMCS_lhc13_HW, SMCS_lhc13_HZ, SMCS_lhc13_ttH, SMCS_tev_gg_H, & & SMCS_tev_bb_H, SMCS_tev_vbf_H, SMCS_tev_HW, SMCS_tev_HZ, SMCS_tev_ttH, & & SMBR_Hgamgam,SMBR_HWW,SMBR_HZZ, SMBR_Htautau, SMBR_Hbb,SMBR_HZgam,SMBR_Hcc, & & SMBR_Hmumu,SMBR_Hgg ! Check experiment and energy flag to choose the relevant dataset mass = peak%mpeak do i=1,mutab%Nc - id = mutab%channel_id(i) - p = int((id-modulo(id,10))/dble(10)) - d = modulo(id,10) + p = mutab%channel_p_id(i) + d = mutab%channel_d_id(i) +! +! id = mutab%channel_id(i) +! p = int((id-modulo(id,10))/dble(10)) +! d = modulo(id,10) !--Do the production rate for the relevant experiment and cms-energy if(mutab%collider.eq.'LHC') then if(abs(mutab%energy-7.0D0).le.small) then if(p.eq.1) then SMrate=SMCS_lhc7_gg_H(mass)+SMCS_lhc7_bb_H(mass) else if(p.eq.2) then SMrate=SMCS_lhc7_vbf_H(mass) else if(p.eq.3) then SMrate=SMCS_lhc7_HW(mass) else if(p.eq.4) then SMrate=SMCS_lhc7_HZ(mass) else if(p.eq.5) then SMrate=SMCS_lhc7_ttH(mass) endif else if(abs(mutab%energy-8.0D0).le.small) then if(p.eq.1) then SMrate=SMCS_lhc8_gg_H(mass)+SMCS_lhc8_bb_H(mass) else if(p.eq.2) then SMrate=SMCS_lhc8_vbf_H(mass) else if(p.eq.3) then SMrate=SMCS_lhc8_HW(mass) else if(p.eq.4) then SMrate=SMCS_lhc8_HZ(mass) else if(p.eq.5) then SMrate=SMCS_lhc8_ttH(mass) endif else if(abs(mutab%energy-13.0D0).le.small) then if(p.eq.1) then SMrate=SMCS_lhc13_gg_H(mass)+SMCS_lhc13_bb_H(mass) else if(p.eq.2) then SMrate=SMCS_lhc13_vbf_H(mass) else if(p.eq.3) then SMrate=SMCS_lhc13_HW(mass) else if(p.eq.4) then SMrate=SMCS_lhc13_HZ(mass) else if(p.eq.5) then SMrate=SMCS_lhc13_ttH(mass) endif endif else if(mutab%collider.eq.'TEV') then if(p.eq.1) then SMrate=SMCS_tev_gg_H(mass)+SMCS_tev_bb_H(mass) else if(p.eq.2) then SMrate=SMCS_tev_vbf_H(mass) else if(p.eq.3) then SMrate=SMCS_tev_HW(mass) else if(p.eq.4) then SMrate=SMCS_tev_HZ(mass) else if(p.eq.5) then SMrate=SMCS_tev_ttH(mass) endif endif !--Multiply now by the decay rate if(d.eq.1) then SMrate=SMrate*SMBR_Hgamgam(mass) else if(d.eq.2) then SMrate=SMrate*SMBR_HWW(mass) else if(d.eq.3) then SMrate=SMrate*SMBR_HZZ(mass) else if(d.eq.4) then SMrate=SMrate*SMBR_Htautau(mass) else if(d.eq.5) then SMrate=SMrate*SMBR_Hbb(mass) else if(d.eq.6) then SMrate=SMrate*SMBR_HZgam(mass) else if(d.eq.7) then SMrate=SMrate*SMBR_Hcc(mass) else if(d.eq.8) then SMrate=SMrate*SMBR_Hmumu(mass) else if(d.eq.9) then SMrate=SMrate*SMBR_Hgg(mass) endif peak%channel_w(i)=peak%channel_eff(i)*SMrate enddo SMrate=sum(peak%channel_w(:)) do i=1,mutab%Nc peak%channel_w(i)=div(peak%channel_w(i),SMrate,0.0D0,1.0D9) enddo end subroutine get_weights_at_peak !--------------------------------------------------------------------------- subroutine get_average_mass(indices_in, peaknumber, m, dm) !--------------------------------------------------------------------------- integer, dimension(:), intent(in) :: indices_in(:) integer, intent(in) :: peaknumber double precision, intent(out) :: m, dm integer :: i, ii, iii, k, nH, N, Hindex double precision :: num1, num2, denom nH = size(indices_in,dim=1) num1 = 0.0D0 num2 = 0.0D0 denom = 0.0D0 iii=0 do i=1, size(analyses) do ii=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) iii=iii+1 if(iii.eq.peaknumber) then call get_average_mass_for_peak(indices_in, analyses(i)%peaks(ii), m, dm) endif enddo enddo if(denom.ne.0.0D0) then m = num1 / denom dm = num2 / denom else m = 0.0D0 dm = 0.0D0 endif end subroutine get_average_mass !--------------------------------------------------------------------------- subroutine get_average_mass_for_peak(indices_in, peak, m, dm) !--------------------------------------------------------------------------- integer, dimension(:), intent(in) :: indices_in(:) type(mupeak), intent(in) :: peak double precision, intent(out) :: m, dm integer :: i, ii, iii, k, nH, N, Hindex double precision :: num1, num2, denom nH = size(indices_in,dim=1) num1 = 0.0D0 num2 = 0.0D0 denom = 0.0D0 do k=1,nH Hindex=indices_in(k) if(Hindex.ne.0) then num1 = num1 + peak%Higgses(Hindex)%mu * & & peak%Higgses(Hindex)%m num2 = num2 + peak%Higgses(Hindex)%mu * & & peak%Higgses(Hindex)%dm denom = denom + peak%Higgses(Hindex)%mu endif enddo if(denom.ne.0.0D0) then m = num1 / denom dm = num2 / denom else m = 0.0D0 dm = 0.0D0 endif end subroutine get_average_mass_for_peak !------------------------------------------------------------------------------------ end module pc_chisq !------------------------------------------------------------------------------------ \ No newline at end of file Index: trunk/HiggsSignals-2/all_chisq.f90 =================================================================== --- trunk/HiggsSignals-2/all_chisq.f90 (revision 568) +++ trunk/HiggsSignals-2/all_chisq.f90 (revision 569) @@ -1,526 +1,531 @@ !-------------------------------------------------------------------- ! This file is part of HiggsSignals (TS 03/03/2013) !-------------------------------------------------------------------- module all_chisq use numerics use combinatorics use usefulbits_hs implicit none contains !-------------------------------------------------------------------- subroutine print_all_observables !-------------------------------------------------------------------- implicit none integer :: i, j, k do i=lbound(analyses,dim=1),ubound(analyses,dim=1) write(*,*) write(*,*) '#*************************************************************************#' write(*,'(A,I3,A,I3,A)') ' # Analysis ',i,' #' write(*,*) '#*************************************************************************#' write(*,'(A25,1I10)') 'ID =', analyses(i)%table%id write(*,'(A25,4X,A3)') 'Collaboration =', analyses(i)%table%collaboration write(*,'(A25,4X,F6.2)') 'cms energy =', analyses(i)%table%energy write(*,'(A25,4X,A100)') 'Reference =', analyses(i)%table%label write(*,'(A25,4X,A100)') 'Description =', analyses(i)%table%desc do j=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) write(*,'(A,1I3,A)') '#------------------------- peak observable ',j,& & ' ----------------------------#' write(*,'(A25,1F10.2)') 'peak_mass =',analyses(i)%peaks(j)%mpeak write(*,'(A25,1F10.4)') 'peak mu =',analyses(i)%peaks(j)%mu write(*,'(A25,2F10.4)') 'cyan band(low,high) =',analyses(i)%peaks(j)%dmulow,& & analyses(i)%peaks(j)%dmuup write(*,'(A25,4X,$)') 'Higgs combination =' do k=lbound(analyses(i)%peaks(j)%Higgs_comb,dim=1),& & ubound(analyses(i)%peaks(j)%Higgs_comb,dim=1) write(*,'(1I3,$)') analyses(i)%peaks(j)%Higgs_comb(k) enddo write(*,*) write(*,'(A25,7X,1I3)') 'Dominant Higgs =',analyses(i)%peaks(j)%domH write(*,'(A25,1F10.4)'), 'Total pred. mu =',analyses(i)%peaks(j)%total_mu write(*,'(A25,1F15.9)'), 'Chisq for mu =',analyses(i)%peaks(j)%chisq_mu write(*,'(A25,1F15.9)'), 'Chisq for mh =',analyses(i)%peaks(j)%chisq_mh write(*,'(A25,1F15.9)'), 'Chisq (total) =',analyses(i)%peaks(j)%chisq_tot write(*,'(A25,1F15.9)'), 'Chisq (max) =',analyses(i)%peaks(j)%chisq_max write(*,*)'#------------------------ Channel information ----------------------------#' write(*,*)' ID prod. decay mu weight syst.err. ' write(*,*)'#-------------------------------------------------------------------------#' do k=1, analyses(i)%peaks(j)%Nc write(*,'(1I5,5X,2A,3F15.6)') analyses(i)%peaks(j)%channel_id(k),& & analyses(i)%table%channel_description(k,:),& & analyses(i)%peaks(j)%channel_mu(k),analyses(i)%peaks(j)%channel_w(k),& & analyses(i)%peaks(j)%channel_syst(k) enddo enddo do j=lbound(analyses(i)%mpred%mp_Higgses,dim=1),& & ubound(analyses(i)%mpred%mp_Higgses,dim=1) write(*,*)'#--------------------- pred. mass centered observable --------------------#' write(*,'(A25,4X,F10.2)') 'Higgs mass =', analyses(i)%mpred%mp_Higgses(j)%m write(*,'(A25,4X,F10.2)') 'Higgs mass uncertainty =',analyses(i)%mpred%mp_Higgses(j)%dm write(*,'(A25,4X,F10.6)') 'Pred. signal strength =',analyses(i)%mpred%mp_Higgses(j)%mu write(*,'(A25,4X,I10)') 'Combined Higgses =', & & size(analyses(i)%mpred%mp_Higgses(j)%Higgses,dim=1) do k=lbound(analyses(i)%mpred%mp_Higgses(j)%Higgses,dim=1),& & ubound(analyses(i)%mpred%mp_Higgses(j)%Higgses,dim=1) write(*,'(A5,I2,A18,4X,3F10.4)') 'Higgs ',k,' (m, dm, mu) =', & & analyses(i)%mpred%mp_Higgses(j)%Higgses(k)%m, & & analyses(i)%mpred%mp_Higgses(j)%Higgses(k)%dm, & & analyses(i)%mpred%mp_Higgses(j)%Higgses(k)%mu enddo write(*,'(A25,4X,F10.2)') 'obs. mass parameter =', & & analyses(i)%mpred%mp_Higgses(j)%m_obs write(*,'(A25,4X,F10.6)') 'obs. signal strength =', & & analyses(i)%mpred%mp_Higgses(j)%mu_obs write(*,'(A25,4X,2F10.6)') 'cyan band(low,high) =', & & analyses(i)%mpred%mp_Higgses(j)%dmu_low_obs, & & analyses(i)%mpred%mp_Higgses(j)%dmu_up_obs write(*,'(A25,4X,2F10.6)') 'dmu0 (low,high) =', & & analyses(i)%mpred%mp_Higgses(j)%dmu_low0_obs, & & analyses(i)%mpred%mp_Higgses(j)%dmu_up0_obs write(*,'(A25,4X,F10.6)') 'Chisq =', analyses(i)%mpred%mp_Higgses(j)%chisq enddo enddo write(*,*) '#-------------------------------------------------------------------------#' end subroutine print_all_observables !------------------------------------------------------------------------------------ subroutine calculate_total_chisq(csq_tot, csq_mu, csq_mh, csq_mpred, N, Nmu, Nmh, Nmpred) ! Still need to include assignment ranges here! !------------------------------------------------------------------------------------ use pc_chisq, only : calculate_mh_chisq implicit none double precision, allocatable :: csq_mu_in(:),csq_mh_in(:,:),csq0(:),csq_mh_in_trunc(:,:) double precision, intent(out) :: csq_tot, csq_mu, csq_mh, csq_mpred integer, intent(out) :: N, Nmu, Nmh, Nmpred integer :: i, ii, iii, j, jjj, mpred_i call calculate_total_mu_chisq(csq0, Nmu, 1) call calculate_total_mu_chisq(csq_mu_in, Nmu, 0) call calculate_mh_chisq(csq_mh_in, Nmh) allocate(csq_mh_in_trunc(size(csq_mh_in,dim=1),size(csq_mu_in,dim=1))) iii=0 jjj=0 do i=1,size(analyses) do ii=1,size(analyses(i)%peaks,dim=1)+size(analyses(i)%mpred%mp_Higgses,dim=1) if(ii.le.size(analyses(i)%peaks,dim=1)) then if(analyses(i)%peaks(ii)%NHiggs_comb.eq.0.and.& & size(analyses(i)%mpred%mp_Higgses).ne.0) then cycle endif endif jjj=jjj+1 if(ii.le.size(analyses(i)%peaks,dim=1)) then iii=iii+1 if(analyses(i)%peaks(ii)%NHiggs_comb.eq.0.and.& & size(analyses(i)%mpred%mp_Higgses).ne.0) then N = N-1 cycle endif csq_mh_in_trunc(:,jjj) = csq_mh_in(:,iii) else csq_mh_in_trunc(:,jjj) = 0.0D0 endif enddo enddo !-For debugging: !! write(*,*) "csq_mh_in_trunc = " do i=lbound(csq_mh_in_trunc,dim=2),ubound(csq_mh_in_trunc,dim=2) !! write(*,*) csq_mh_in_trunc(:,i) enddo csq_mu = 0.0D0 csq_mh = 0.0D0 csq_tot = 0.0D0 csq_mpred = 0.0D0 Nmpred = 0 iii=0 do i=1,size(analyses) do ii=1,size(analyses(i)%peaks,dim=1)+size(analyses(i)%mpred%mp_Higgses,dim=1) if(ii.le.size(analyses(i)%peaks,dim=1)) then if(analyses(i)%peaks(ii)%NHiggs_comb.eq.0.and.& & size(analyses(i)%mpred%mp_Higgses).ne.0) cycle endif iii=iii+1 !--Only allow positive chisq contributions if wanted if(minimalchisq) then if(csq_mu_in(iii).lt.0.0D0) csq_mu_in(iii) = 0.0D0 do j=lbound(csq_mh_in_trunc, dim=1), ubound(csq_mh_in_trunc, dim=1) if(csq_mh_in_trunc(j,iii).lt.0.0D0) csq_mh_in_trunc(j,iii) = 0.0D0 enddo endif !--Assign chisq_mu and chisq_mh such that the total chisq does not exceed the maximum !--chisq csq0 if(ii.le.size(analyses(i)%peaks,dim=1)) then if(maximalchisq) then analyses(i)%peaks(ii)%chisq_mu = min(csq_mu_in(iii),csq0(iii)) analyses(i)%peaks(ii)%chisq_mh = min(csq0(iii)-analyses(i)%peaks(ii)%chisq_mu, & & sum(csq_mh_in_trunc(:,iii))) elseif(analyses(i)%peaks(ii)%Higgs_assignment_forced.eq.0) then analyses(i)%peaks(ii)%chisq_mu = min(csq_mu_in(iii),csq0(iii)) analyses(i)%peaks(ii)%chisq_mh = min(csq0(iii)-analyses(i)%peaks(ii)%chisq_mu, & & sum(csq_mh_in_trunc(:,iii))) else analyses(i)%peaks(ii)%chisq_mu = csq_mu_in(iii) analyses(i)%peaks(ii)%chisq_mh = sum(csq_mh_in_trunc(:,iii)) endif analyses(i)%peaks(ii)%chisq_tot = analyses(i)%peaks(ii)%chisq_mu + & & analyses(i)%peaks(ii)%chisq_mh analyses(i)%peaks(ii)%chisq_max = csq0(iii) csq_mu = csq_mu + analyses(i)%peaks(ii)%chisq_mu csq_mh = csq_mh + analyses(i)%peaks(ii)%chisq_mh csq_tot = csq_tot + analyses(i)%peaks(ii)%chisq_tot else mpred_i = ii - size(analyses(i)%peaks,dim=1) analyses(i)%mpred%mp_Higgses(mpred_i)%chisq = csq_mu_in(iii) csq_mpred = csq_mpred + analyses(i)%mpred%mp_Higgses(mpred_i)%chisq csq_tot = csq_tot + analyses(i)%mpred%mp_Higgses(mpred_i)%chisq Nmpred = Nmpred + 1 endif enddo enddo !Nmu is now only the number of signal strength peak observables: Nmu = Nmu - Nmpred !Calculate total ndf: N = Nmu + Nmh + Nmpred deallocate(csq_mu_in, csq_mh_in, csq_mh_in_trunc) end subroutine calculate_total_chisq !---------------------------------------------------------------------------- subroutine calculate_total_mu_chisq(csq_mu, N, domax) !---------------------------------------------------------------------------- implicit none double precision, allocatable, intent(out) :: csq_mu(:) double precision :: csq integer, intent(out) :: N double precision, allocatable :: v(:), vmat(:,:), invcov(:,:), v2(:) integer :: i,ii,iii,mpred_i integer, intent(in) :: domax ! if 1, then calculate maximal chisq if(allocated(cov_mu_tot)) deallocate(cov_mu_tot) call create_total_mu_covariance_matrix(domax) N=size(cov_mu_tot,dim=1) allocate(v(N), vmat(N,1),invcov(N,N), v2(N), csq_mu(N)) !-First construct the vector (mupred - muobs)_iii iii=0 do i=1,size(analyses) do ii=1,size(analyses(i)%peaks,dim=1)+size(analyses(i)%mpred%mp_Higgses,dim=1) if(ii.le.size(analyses(i)%peaks,dim=1)) then if(analyses(i)%peaks(ii)%NHiggs_comb.eq.0.and.& & size(analyses(i)%mpred%mp_Higgses).ne.0) cycle endif iii=iii+1 if(ii.le.size(analyses(i)%peaks,dim=1)) then if(domax.ge.1) then v(iii) = analyses(i)%peaks(ii)%mu else v(iii) = analyses(i)%peaks(ii)%total_mu - analyses(i)%peaks(ii)%mu endif else mpred_i = ii - size(analyses(i)%peaks,dim=1) v(iii) = analyses(i)%mpred%mp_Higgses(mpred_i)%mu - & & analyses(i)%mpred%mp_Higgses(mpred_i)%mu_obs endif vmat(iii,1) = v(iii) enddo enddo call invmatrix(cov_mu_tot,invcov) call matmult(invcov,vmat,v2,N,1) do i=1, N csq_mu(i) = v(i)*v2(i) enddo iii=0 do i=1,size(analyses) do ii=1,size(analyses(i)%peaks,dim=1)+size(analyses(i)%mpred%mp_Higgses,dim=1) if(ii.le.size(analyses(i)%peaks,dim=1)) then if(analyses(i)%peaks(ii)%NHiggs_comb.eq.0.and.& & size(analyses(i)%mpred%mp_Higgses).ne.0) cycle endif iii=iii+1 if(ii.le.size(analyses(i)%peaks,dim=1)) then if(domax.ge.1) then analyses(i)%peaks(ii)%chisq_max = csq_mu(iii) else analyses(i)%peaks(ii)%chisq_mu = csq_mu(iii) endif else mpred_i = ii - size(analyses(i)%peaks,dim=1) if(domax.eq.0) analyses(i)%mpred%mp_Higgses(mpred_i)%chisq = csq_mu(iii) endif enddo enddo csq=sum(csq_mu) deallocate(v,vmat,invcov,v2) end subroutine calculate_total_mu_chisq !---------------------------------------------------------------------------- subroutine create_total_mu_covariance_matrix(domax) !------------------------------------------------------------------------------------ use pc_chisq, only : get_dmu0sq_peak, get_rate_uncertainties_sq_peaks use mc_chisq, only : correct_mu_uncertainty, get_dmu0sq, get_rate_uncertainties_sq_mpred,& & calculate_model_weights implicit none integer, intent(in) :: domax ! if 1, then use predicted mu == 0 integer :: N, i, j, ii, jj, iii, jjj, mpred_i, mpred_j double precision :: mumax, dmu0sq, dratesq character(LEN=50) :: title logical :: corr integer csqmax !---TRY TO EVALUATE THE MAX CHISQ WITHOUT CORRELATIONS---! if(domax.eq.1) then csqmax = 1 corr=correlations_mu elseif(domax.eq.2) then csqmax = 1 corr=.False. else csqmax = 0 corr=correlations_mu endif !--------------------------------------------------------! !-First, find the dominant Higgs boson for each mpred observable and correct the signal strength ! uncertainty (i.e. subtract uncertainties which are added later as fully correlated uncertainties). iii=0 do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do ii=lbound(analyses(i)%mpred%mp_Higgses,dim=1),& & ubound(analyses(i)%mpred%mp_Higgses,dim=1) iii=iii+1 mumax=-1.0D10 !--Determine the dominating Higgs for every mpred-observable. do j=lbound(analyses(i)%mpred%mp_Higgses(ii)%Higgses,dim=1),& & ubound(analyses(i)%mpred%mp_Higgses(ii)%Higgses,dim=1) if(analyses(i)%mpred%mp_Higgses(ii)%Higgses(j)%mu.gt.mumax) then mumax=analyses(i)%mpred%mp_Higgses(ii)%Higgses(j)%mu analyses(i)%mpred%mp_Higgses(ii)%domH=analyses(i)%mpred%mp_Higgses(ii)%Higgses(j)%id endif enddo !--Subtract the correlated syst. uncertainties from (smeared) cyan band call correct_mu_uncertainty(analyses(i)%mpred%mp_Higgses(ii),analyses(i)%table) !--(TS 08/05/2013) Calculate the channel weights in the model: call calculate_model_weights(analyses(i)%table, analyses(i)%mpred%mp_Higgses(ii)) enddo enddo !-Secondly, find the total number of (peak and mpred) observables, which have to be considered. N=0 do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do j=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) if(analyses(i)%peaks(j)%NHiggs_comb.eq.0.and.& & size(analyses(i)%mpred%mp_Higgses).eq.0)then !---In this case, the observable cannot neither be covered by the peak nor the mpred method !---, thus we want to take into account the penalty from the (peak) observable. N=N+1 else if(analyses(i)%peaks(j)%NHiggs_comb.ne.0) then !---Successfully assigned peak observable N=N+1 endif enddo !-Now, add also the number of mpred-observables for this analysis. N=N+size(analyses(i)%mpred%mp_Higgses) enddo allocate(cov_mu_tot(N,N)) iii=0 do i=1,size(analyses) do ii=1,size(analyses(i)%peaks,dim=1)+size(analyses(i)%mpred%mp_Higgses,dim=1) if(ii.le.size(analyses(i)%peaks,dim=1)) then if(analyses(i)%peaks(ii)%NHiggs_comb.eq.0.and.& & size(analyses(i)%mpred%mp_Higgses).ne.0) cycle endif iii=iii+1 jjj=0 do j=1, size(analyses) do jj=1,size(analyses(j)%peaks,dim=1)+size(analyses(j)%mpred%mp_Higgses,dim=1) if(jj.le.size(analyses(j)%peaks,dim=1)) then if(analyses(j)%peaks(jj)%NHiggs_comb.eq.0.and.& & size(analyses(j)%mpred%mp_Higgses).ne.0) cycle endif jjj=jjj+1 cov_mu_tot(iii,jjj)=0.0D0 !----Treat the following cases: (1) peak x peak, (2) peak x mpred, (3) mpred x peak, (4) mpred x mpred !-(1)------------------------------------------------------------------------------------ if(ii.le.size(analyses(i)%peaks,dim=1).and.jj.le.size(analyses(j)%peaks,dim=1)) then if(corr.or.(.not.corr.and.iii.eq.jjj)) then call get_rate_uncertainties_sq_peaks(dratesq,analyses(i)%peaks(ii),& & analyses(j)%peaks(jj),analyses(i)%table%collider, & & analyses(i)%table%energy, analyses(j)%table%collider,analyses(j)%table%energy) ! call get_rate_uncertainties_sq_peaks(dratesq,analyses(i)%peaks(ii),& !& analyses(j)%peaks(jj)) if(anticorrmu) then if(analyses(i)%table%collaboration.eq.analyses(j)%table%collaboration) then cov_mu_tot(iii,jjj)=cov_mu_tot(iii,jjj)+ & & (analyses(i)%table%dlumi*analyses(j)%table%dlumi)* & & (analyses(i)%peaks(ii)%mu*analyses(j)%peaks(jj)%mu) endif cov_mu_tot(iii,jjj)=cov_mu_tot(iii,jjj)+(dratesq)* & & (analyses(i)%peaks(ii)%total_mu*analyses(j)%peaks(jj)%total_mu) else if(analyses(i)%table%collaboration.eq.analyses(j)%table%collaboration) then cov_mu_tot(iii,jjj)=cov_mu_tot(iii,jjj)+ & & (analyses(i)%table%dlumi*analyses(j)%table%dlumi)* & & abs(analyses(i)%peaks(ii)%mu*analyses(j)%peaks(jj)%mu) endif cov_mu_tot(iii,jjj)=cov_mu_tot(iii,jjj)+(dratesq)* & & abs(analyses(i)%peaks(ii)%total_mu*analyses(j)%peaks(jj)%total_mu) endif endif !----Add the intrinsic (uncorrelated) uncertainty of this peak to the diagonal elements: if(iii.eq.jjj) then call get_dmu0sq_peak(dmu0sq,analyses(i)%peaks(ii),domax) cov_mu_tot(iii,jjj) = cov_mu_tot(iii,jjj) + dmu0sq endif !-(2)------------------------------------------------------------------------------------ elseif(ii.le.size(analyses(i)%peaks,dim=1).and.& & jj.gt.size(analyses(j)%peaks,dim=1)) then mpred_j = jj - size(analyses(j)%peaks,dim=1) if(corr) then call get_rate_uncertainties_sq_peak_mpred(dratesq, analyses(j)%table, & & analyses(j)%mpred%mp_Higgses(mpred_j), analyses(i)%peaks(ii)) if(anticorrmu) then if(analyses(i)%table%collaboration.eq.analyses(j)%table%collaboration) then cov_mu_tot(iii,jjj)=cov_mu_tot(iii,jjj)+ & & (analyses(i)%table%dlumi*analyses(j)%table%dlumi)* & & (analyses(i)%peaks(ii)%mu*analyses(j)%mpred%mp_Higgses(mpred_j)%mu) endif cov_mu_tot(iii,jjj)=cov_mu_tot(iii,jjj)+(dratesq)*(analyses(i)%peaks(ii)%total_mu* & & analyses(j)%mpred%mp_Higgses(mpred_j)%total_mu) else if(analyses(i)%table%collaboration.eq.analyses(j)%table%collaboration) then cov_mu_tot(iii,jjj)=cov_mu_tot(iii,jjj)+ & & (analyses(i)%table%dlumi*analyses(j)%table%dlumi)* & & abs(analyses(i)%peaks(ii)%mu*analyses(j)%mpred%mp_Higgses(mpred_j)%mu) endif cov_mu_tot(iii,jjj)=cov_mu_tot(iii,jjj)+(dratesq)*abs(analyses(i)%peaks(ii)%total_mu* & & analyses(j)%mpred%mp_Higgses(mpred_j)%total_mu) endif endif !-(3)------------------------------------------------------------------------------------ elseif(ii.gt.size(analyses(i)%peaks,dim=1).and.& & jj.le.size(analyses(j)%peaks,dim=1)) then mpred_i = ii - size(analyses(i)%peaks,dim=1) if(corr) then call get_rate_uncertainties_sq_peak_mpred(dratesq, analyses(i)%table, & & analyses(i)%mpred%mp_Higgses(mpred_i), analyses(j)%peaks(jj)) if(anticorrmu) then if(analyses(i)%table%collaboration.eq.analyses(j)%table%collaboration) then cov_mu_tot(iii,jjj)=cov_mu_tot(iii,jjj)+ & & (analyses(i)%table%dlumi*analyses(j)%table%dlumi)* & & (analyses(j)%peaks(jj)%mu*analyses(i)%mpred%mp_Higgses(mpred_i)%mu) endif cov_mu_tot(iii,jjj)=cov_mu_tot(iii,jjj)+ & & (dratesq)*(analyses(j)%peaks(jj)%total_mu*analyses(i)%mpred%mp_Higgses(mpred_i)%total_mu) else if(analyses(i)%table%collaboration.eq.analyses(j)%table%collaboration) then cov_mu_tot(iii,jjj)=cov_mu_tot(iii,jjj)+ & & (analyses(i)%table%dlumi*analyses(j)%table%dlumi)* & & abs(analyses(j)%peaks(jj)%mu*analyses(i)%mpred%mp_Higgses(mpred_i)%mu) endif cov_mu_tot(iii,jjj)=cov_mu_tot(iii,jjj)+ & & (dratesq)*abs(analyses(j)%peaks(jj)%total_mu*analyses(i)%mpred%mp_Higgses(mpred_i)%total_mu) endif endif !-(4)------------------------------------------------------------------------------------ elseif(ii.gt.size(analyses(i)%peaks,dim=1).and.& & jj.gt.size(analyses(j)%peaks,dim=1)) then mpred_i = ii - size(analyses(i)%peaks,dim=1) mpred_j = jj - size(analyses(j)%peaks,dim=1) if(corr.or.(.not.corr.and.iii.eq.jjj)) then call get_rate_uncertainties_sq_mpred(dratesq, analyses(i)%table, & & analyses(i)%mpred%mp_Higgses(mpred_i),analyses(j)%table, & & analyses(j)%mpred%mp_Higgses(mpred_j)) if(anticorrmu) then !-----Treat luminosity uncertainty as correlated systematic error if same collaboration: if(analyses(i)%table%collaboration.eq.analyses(i)%table%collaboration) then cov_mu_tot(iii,jjj)=cov_mu_tot(iii,jjj)+ & & (analyses(i)%table%dlumi*analyses(j)%table%dlumi) * & & (analyses(i)%mpred%mp_Higgses(mpred_i)%mu * & & analyses(j)%mpred%mp_Higgses(mpred_j)%mu) endif cov_mu_tot(iii,jjj)=cov_mu_tot(iii,jjj)+(dratesq)* & & (analyses(i)%mpred%mp_Higgses(mpred_i)%total_mu*analyses(j)%mpred%mp_Higgses(mpred_j)%total_mu) else !-----Treat luminosity uncertainty as correlated systematic error if same collaboration: if(analyses(i)%table%collaboration.eq.analyses(i)%table%collaboration) then cov_mu_tot(iii,jjj)=cov_mu_tot(iii,jjj)+ & & (analyses(i)%table%dlumi*analyses(j)%table%dlumi) * & & abs(analyses(i)%mpred%mp_Higgses(mpred_i)%mu * & & analyses(j)%mpred%mp_Higgses(mpred_j)%mu) endif cov_mu_tot(iii,jjj)=cov_mu_tot(iii,jjj)+(dratesq)* & & abs(analyses(i)%mpred%mp_Higgses(mpred_i)%total_mu*analyses(j)%mpred%mp_Higgses(mpred_j)%total_mu) endif endif !----Add the intrinsic (uncorrelated) uncertainty of this peak to the diagonal elements: if(iii.eq.jjj) then call get_dmu0sq(dmu0sq,analyses(i)%mpred%mp_Higgses(mpred_i)) cov_mu_tot(iii,jjj) = cov_mu_tot(iii,jjj) + dmu0sq endif endif enddo enddo enddo enddo !! title = "total (peak+mpred) covariance matrix for the signal strength" !! call print_dble_matrix(cov_mu_tot,title) end subroutine create_total_mu_covariance_matrix !------------------------------------------------------------------------------------ subroutine get_rate_uncertainties_sq_peak_mpred(dratesq, table, mp_H, peak) !------------------------------------------------------------------------------------ implicit none type(mp_neutHiggs), intent(in) :: mp_H type(mutable), intent(in) :: table type(mupeak), intent(in) :: peak double precision, intent(out) :: dratesq - integer :: i,j,id1,p1,d1,id2,p2,d2 + integer :: i,j,p1,d1,p2,d2 !,id1,id2 double precision :: res res=0.0D0 do i=1,table%Nc do j=1,peak%Nc - id1 = table%channel_id(i) - p1 = int((id1-modulo(id1,10))/dble(10)) - d1 = modulo(id1,10) - id2 = peak%channel_id(j) - p2 = int((id2-modulo(id2,10))/dble(10)) - d2 = modulo(id2,10) + p1 = table%channel_p_id(i) + d1 = table%channel_d_id(i) + p2 = peak%channel_p_id(j) + d2 = peak%channel_d_id(j) +! +! id1 = table%channel_id(i) +! p1 = int((id1-modulo(id1,10))/dble(10)) +! d1 = modulo(id1,10) +! id2 = peak%channel_id(j) +! p2 = int((id2-modulo(id2,10))/dble(10)) +! d2 = modulo(id2,10) if(p1.eq.p2) then res=res+delta_rate%dCS(p1)**2* & & mp_H%channel_w_model(i)**peak%channel_w_model(j) endif if(d1.eq.d2) then res=res+delta_rate%dBR(d1)**2* & & mp_H%channel_w_model(i)**peak%channel_w_model(j) endif ! if(p1.eq.p2) res=res + & !& delta_rate%dCS(p1)**2*table%channel_w(i,mp_H%domH)*peak%channel_w(j) ! if(d1.eq.d2) res=res + & !& delta_rate%dBR(d1)**2*table%channel_w(i,mp_H%domH)*peak%channel_w(j) enddo enddo dratesq=res end subroutine get_rate_uncertainties_sq_peak_mpred !------------------------------------------------------------------------------------ end module all_chisq !------------------------------------------------------------------------------------ \ No newline at end of file Index: trunk/HiggsSignals-2/STXS.f90 =================================================================== --- trunk/HiggsSignals-2/STXS.f90 (revision 568) +++ trunk/HiggsSignals-2/STXS.f90 (revision 569) @@ -1,764 +1,944 @@ module STXS ! Still to do: ! 1: Read in correlation matrix ! 2: Write chi^2 test ! use numerics ! use combinatorics use usefulbits_hs implicit none ! integer :: i,j,k ! double precision,parameter :: pi=3.14159265358979323846264338328D0 ! integer, allocatable :: peakindices_best(:,:) type STXS_observable integer :: id character(LEN=100) :: label ! Reference character(LEN=100) :: desc ! Description character(LEN=3) :: expt ! Experiment character(LEN=10) :: collider character(LEN=10) :: collaboration double precision :: lumi,dlumi,energy character(LEN=100) :: assignmentgroup integer :: rate_SM_normalized integer :: mhchisq double precision :: massobs, dmassobs ! This one enters the chi^2 for the mass! double precision :: mass, dmass ! This one is the mass position for the measurement and the "experimentally allowed assignment range" double precision :: eff_ref_mass ! This is the mass for which the signal efficiencies are given. double precision, allocatable :: model_rate_per_Higgs(:,:) - double precision, allocatable :: inclusive_SM_rate(:,:) + double precision, allocatable :: inclusive_SM_rate(:) integer :: Nc double precision :: model_total_rate double precision :: rate, rate_up, rate_low, drate_up, drate_low double precision :: SMrate, SMrate_up, SMrate_low, dSMrate_up, dSMrate_low ! SM rate used/quoted by the experiment ! At the moment, interpret STXS observables as "pure" channels (production, or decay rate) - integer, allocatable :: channel_id(:) + character(LEN=5), allocatable :: channel_id_str(:) ! Channels array as string, dim(Nc) +! integer, allocatable :: channel_id(:) + integer, allocatable :: channel_p_id(:) ! Production channels array, dim(Nc) + integer, allocatable :: channel_d_id(:) ! Decay channels array, dim(Nc) double precision, allocatable :: channel_efficiency(:) ! SM signal efficiency of inclusive rates (analysis-specific) double precision, allocatable :: relative_efficiency(:,:) ! Model signal efficiency relative to SM per Higgs double precision :: chisq ! character(LEN=10),allocatable :: channel_description(:,:) ! TODO: How do we deal with ratio of BRs? end type type(STXS_observable), allocatable :: STXSlist(:) type(correlation_info), allocatable :: STXScorrlist(:) contains !------------------------------------------------------------------------------------ subroutine load_STXS(dataset) !------------------------------------------------------------------------------------ use store_pathname_HS use usefulbits, only: file_id_common2, file_id_common3, np, Hneut use datatables, only : read_in_mass_resolution_and_assignment_group - implicit none +! implicit none character(LEN=*), intent(in) :: dataset character(LEN=100) :: datafile(500) character(LEN=pathname_length+150) :: fullfilename integer, allocatable :: skip(:) integer :: i, n, n_datafiles,n_correlations, n_correlations_tmp, ios, k, m, int1, int2 double precision :: db1 character(LEN=200) :: comment character(LEN=1) :: firstchar character(LEN=100) :: line + integer :: id, posperiod call system('basename -a `ls -1 -p '//trim(adjustl(pathname_HS))// & & 'Expt_tables/'//trim(adjustl(dataset))//'/*.stxs 2>/dev/null` > STXS_analyses.txt 2>/dev/null') open(file_id_common3, file="STXS_analyses.txt",form='formatted') print *, "Reading in STXS measurements from analysis-set "//& trim(adjustl(dataset))//":" n = 0 n_datafiles = 0 do n = n+1 read(file_id_common3,'(A)', iostat=ios) datafile(n) if(ios.ne.0) exit write(*,'(I4,2X,A)') n, datafile(n) enddo n_datafiles = n - 1 close(file_id_common3) allocate(STXSlist(n_datafiles),skip(n_datafiles)) do n=1,n_datafiles skip(n)=11 open(file_id_common3, file=trim(adjustl(pathname_HS)) //'Expt_tables/'// & & trim(adjustl(dataset))//'/' // datafile(n)) do read(file_id_common3,'(A)') comment comment = trim(adjustl(comment)) write(firstchar,'(A1)') comment if(firstchar.ne.'#') then exit else skip(n)=skip(n)+1 endif enddo backspace(file_id_common3) read(file_id_common3,*) STXSlist(n)%id read(file_id_common3,'(A)') STXSlist(n)%label read(file_id_common3,*) STXSlist(n)%collider,STXSlist(n)%collaboration, & & STXSlist(n)%expt read(file_id_common3,'(A)') STXSlist(n)%desc read(file_id_common3,*) STXSlist(n)%energy, STXSlist(n)%lumi, STXSlist(n)%dlumi read(file_id_common3,*) STXSlist(n)%mhchisq, STXSlist(n)%rate_SM_normalized if(STXSlist(n)%mhchisq == 1) then read(file_id_common3,*) STXSlist(n)%massobs, STXSlist(n)%dmassobs else read(file_id_common3,*) STXSlist(n)%massobs = 0.0D0 STXSlist(n)%dmassobs = 0.0D0 endif !--CHECK FOR ASSIGNMENT GROUP AS SECOND COLUMN: read(file_id_common3,*) STXSlist(n)%mass read(file_id_common3,'(A)') line call read_in_mass_resolution_and_assignment_group(line, STXSlist(n)%dmass,& & STXSlist(n)%assignmentgroup) read(file_id_common3,*) STXSlist(n)%Nc, STXSlist(n)%eff_ref_mass - allocate(STXSlist(n)%channel_id(STXSlist(n)%Nc)) - read(file_id_common3,*) (STXSlist(n)%channel_id(i),i=1,STXSlist(n)%Nc) + read(file_id_common3,*) (STXSlist(n)%channel_id_str(i),i=1,STXSlist(n)%Nc) + do i=1,STXSlist(n)%Nc + posperiod = index(STXSlist(n)%channel_id_str(i),'.') + if(posperiod.eq.0) then + if(len(trim(adjustl(STXSlist(n)%channel_id_str(i)))).eq.2) then + read(STXSlist(n)%channel_id_str(i),*) id + STXSlist(n)%channel_p_id(i) = int((id-modulo(id,10))/dble(10)) + STXSlist(n)%channel_d_id(i) = modulo(id,10) + else + write(*,*) " For observable ID = ",STXSlist(n)%id + stop " Error: Cannot handle channel IDs!" + endif + else + read(STXSlist(n)%channel_id_str(i)(:posperiod-1),*) STXSlist(n)%channel_p_id(i) + read(STXSlist(n)%channel_id_str(i)(posperiod+1:),*) STXSlist(n)%channel_d_id(i) + endif + enddo + write(*,*) "Production channels = ",STXSlist(n)%channel_p_id + write(*,*) "Decay channels = ",STXSlist(n)%channel_d_id +! allocate(STXSlist(n)%channel_id(STXSlist(n)%Nc)) +! read(file_id_common3,*) (STXSlist(n)%channel_id(i),i=1,STXSlist(n)%Nc) allocate(STXSlist(n)%channel_efficiency(STXSlist(n)%Nc)) if(STXSlist(n)%eff_ref_mass.ge.0D0) then read(file_id_common3,*) (STXSlist(n)%channel_efficiency(i),i=1,STXSlist(n)%Nc) else do i=1,STXSlist(n)%Nc STXSlist(n)%channel_efficiency(i)=1.0D0 enddo read(file_id_common3,*) endif ! read(file_id_common3,*) STXSlist(n)%channel_id ! read(file_id_common3,*) STXSlist(n)%relative_efficiency read(file_id_common3,*) STXSlist(n)%rate_low, STXSlist(n)%rate, STXSlist(n)%rate_up if(STXSlist(n)%rate_SM_normalized.eq.1) then read(file_id_common3,*) comment STXSlist(n)%SMrate_low = 0.0D0 STXSlist(n)%SMrate = 0.0D0 STXSlist(n)%SMrate_up = 0.0D0 else read(file_id_common3,*) STXSlist(n)%SMrate_low, STXSlist(n)%SMrate, STXSlist(n)%SMrate_up endif STXSlist(n)%drate_low = STXSlist(n)%rate - STXSlist(n)%rate_low STXSlist(n)%drate_up = STXSlist(n)%rate_up - STXSlist(n)%rate STXSlist(n)%dSMrate_low = STXSlist(n)%SMrate - STXSlist(n)%SMrate_low STXSlist(n)%dSMrate_up = STXSlist(n)%SMrate_up - STXSlist(n)%SMrate close(file_id_common3) allocate(STXSlist(n)%relative_efficiency(np(Hneut),STXSlist(n)%Nc)) do k=1, np(Hneut) STXSlist(n)%relative_efficiency(k,:)=1.0D0 enddo enddo close(file_id_common3) !NEW: call system('basename -a `ls -1 -p '//trim(adjustl(pathname_HS))// & & 'Expt_tables/'//trim(adjustl(dataset))//'/*.stxscorr 2>/dev/null` > STXS_correlations.txt 2>/dev/null') call system('rm -rf STXS_ncorrelations.txt') open(file_id_common3, file="STXS_correlations.txt",form='formatted') print *, "Reading in correlations from the following datafiles in analysis-set "// & trim(adjustl(Exptdir))//":" n = 0 n_datafiles = 0 n_correlations = 0 do n = n+1 read(file_id_common3,'(A)', iostat=ios) datafile(n) if(ios.ne.0) exit fullfilename=trim(adjustl(pathname_HS))//'Expt_tables/'//trim(adjustl(dataset))//'/'& & //trim(datafile(n)) call system('cat '//trim(adjustl(fullfilename))//' | wc -l > STXS_ncorrelations.txt') open(file_id_common2,file="STXS_ncorrelations.txt",form='formatted') read(file_id_common2,'(I10)') n_correlations_tmp close(file_id_common2) write(*,'(2I4,2X,A)') n, n_correlations_tmp, datafile(n) n_correlations = n_correlations + n_correlations_tmp enddo n_datafiles = n - 1 close(file_id_common3) allocate(STXScorrlist(n_correlations)) m=0 do n=1,n_datafiles fullfilename=trim(adjustl(pathname_HS))//'Expt_tables/'//trim(adjustl(dataset))//'/'& & //trim(datafile(n)) open(file_id_common3,file=fullfilename) do m= m+1 read(file_id_common3,*,iostat=ios) int1, int2, db1 ! write(*,*) m, int1, int2, db1, ios if(ios.ne.0) exit STXScorrlist(m)%obsID1 = int1 STXScorrlist(m)%obsID2 = int2 STXScorrlist(m)%corr = db1 enddo m=m-1 close(file_id_common3) enddo end subroutine load_STXS !------------------------------------------------------------------------------------ subroutine assign_modelefficiencies_to_STXS(obsID, Nc, relative_efficiency) !------------------------------------------------------------------------------------ use usefulbits, only : np, Hneut implicit none integer, intent(in) :: obsID integer, intent(in) :: Nc double precision, dimension(np(Hneut),Nc), intent(in) :: relative_efficiency integer :: i logical :: foundid = .False. do i=lbound(STXSlist, dim=1),ubound(STXSlist, dim=1) if(STXSlist(i)%id.eq.obsID) then if(Nc.ne.STXSlist(i)%Nc) then stop 'Error: Number of channels does not match!' else STXSlist(i)%relative_efficiency = relative_efficiency foundid = .True. endif endif enddo if(.not.foundid) write(*,*) "WARNING in assign_modelefficiencies_to_STXS: ",& & "observable ID ",obsID," not known!" end subroutine assign_modelefficiencies_to_STXS !------------------------------------------------------------------------------------ subroutine get_chisq_from_STXS(chisq_tot, pval) !------------------------------------------------------------------------------------ use usefulbits, only : vsmall use usefulbits_hs, only : Nparam use numerics, only : invmatrix, matmult, gammp implicit none double precision, intent(out) :: chisq_tot, pval integer :: i,j,m,N double precision :: cov logical :: correlationfound, somecorrelationsmissing double precision, allocatable :: covmat(:,:),vmat(:,:),invcovmat(:,:) double precision, allocatable :: v(:), v2(:) N=size(STXSlist) allocate(covmat(N,N),invcovmat(N,N)) allocate(v(N),v2(N)) allocate(vmat(N,1)) somecorrelationsmissing = .False. do i=1,N do j=1,N correlationfound=.False. do m=lbound(STXScorrlist,dim=1), ubound(STXScorrlist,dim=1) if((STXScorrlist(m)%obsID1.eq.STXSlist(i)%id.and.STXScorrlist(m)%obsID2.eq.STXSlist(j)%id)& &.or.(STXScorrlist(m)%obsID2.eq.STXSlist(i)%id.and.STXScorrlist(m)%obsID1.eq.STXSlist(j)%id)) then covmat(i,j) = STXScorrlist(m)%corr*get_drate(i)*get_drate(j) correlationfound=.True. endif enddo if(.not.correlationfound) then ! Use a unit-matrix for the correlations here. ! if(.not.somecorrelationsmissing) then ! write(*,*) "Warning: Correlation matrix element not found for observable ids: ",STXSlist(i)%id, STXSlist(j)%id ! write(*,*) " Suppressing future warnings about missing correlation matrix elements..." ! endif covmat(i,j) = 0.0D0 somecorrelationsmissing = .True. if(STXSlist(i)%id.eq.STXSlist(j)%id) then covmat(i,j) = get_drate(i)*get_drate(j) endif endif enddo v(i) = STXSlist(i)%rate - STXSlist(i)%model_total_rate vmat(i,1) = v(i) enddo ! if(somecorrelationsmissing) then ! write(*,*) "Warning: Some correlation matrix elements were not found." ! endif call invmatrix(covmat,invcovmat) call matmult(invcovmat,vmat,v2,N,1) chisq_tot= 0.0D0 do i=1,N STXSlist(i)%chisq = v(i)*v2(i) chisq_tot = chisq_tot + STXSlist(i)%chisq enddo pval = 1.0D0 if(chisq_tot.gt.vsmall.and.(N-Nparam).gt.0) then pval = 1 - gammp(dble(N-Nparam)/2,chisq_tot/2) endif deallocate(covmat,invcovmat,v,v2,vmat) end subroutine get_chisq_from_STXS !------------------------------------------------------------------------------------ subroutine get_number_of_STXS_observables(Nobs_rates, Nobs_mh) integer, intent(out) :: Nobs_rates, Nobs_mh Nobs_rates=size(STXSlist) Nobs_mh = 0 end subroutine get_number_of_STXS_observables !------------------------------------------------------------------------------------ function get_drate(i) !------------------------------------------------------------------------------------ implicit none integer :: i double precision get_drate if(STXSlist(i)%model_total_rate.le.STXSlist(i)%rate) then get_drate = STXSlist(i)%drate_low else get_drate = STXSlist(i)%drate_up endif end function get_drate !------------------------------------------------------------------------------------ subroutine calculate_model_predictions_for_STXS() !------------------------------------------------------------------------------------ use usefulbits, only : theo use theo_manip, only : HB5_complete_theo integer :: i call HB5_complete_theo do i=lbound(STXSlist,dim=1), ubound(STXSlist,dim=1) call evaluate_model_for_STXS(STXSlist(i),theo(1)) enddo end subroutine calculate_model_predictions_for_STXS !------------------------------------------------------------------------------------ subroutine evaluate_model_for_STXS(STXSobs, t) !------------------------------------------------------------------------------------ - use usefulbits, only : theo, div, small, np, Hneut,dataset - use usefulbits_HS, only : normalize_rates_to_reference_position,& - & use_SMrate_at_reference_position_for_STXS, assignmentrange_STXS + use usefulbits, only : theo, div, small, np, Hneut, dataset, vsmall + use usefulbits_HS, only : normalize_rates_to_reference_position, & +& normalize_rates_to_reference_position_outside_dmtheo, & +& assignmentrange_STXS +! use_SMrate_at_reference_position_for_STXS, use theory_XS_SM_functions use theory_BRfunctions use theo_manip, only : HB5_complete_theo implicit none type(STXS_observable), intent(inout) :: STXSobs type(dataset), intent(in) :: t double precision :: norm_rate, SMrate, SMrate_refmass, refmass, BR_SMref integer :: i, j, id, p, d STXSobs%model_total_rate = 0.0D0 if(.not.allocated(theo))then stop 'subroutine HiggsSignals_initialize must be called first' endif if(.not.allocated(STXSobs%model_rate_per_Higgs)) then allocate(STXSobs%model_rate_per_Higgs(np(Hneut),STXSobs%Nc)) endif if(.not.allocated(STXSobs%inclusive_SM_rate)) then - allocate(STXSobs%inclusive_SM_rate(np(Hneut),STXSobs%Nc)) +! allocate(STXSobs%inclusive_SM_rate(np(Hneut),STXSobs%Nc)) + allocate(STXSobs%inclusive_SM_rate(STXSobs%Nc)) endif ! write(*,*) 'DEBUG HS: id = ', STXSobs%id ! write(*,*) 'DEBUG HS, channel = ',STXSobs%channel_id refmass = STXSobs%mass do i=1,STXSobs%Nc - id = STXSobs%channel_id(i) - p = int((id-modulo(id,10))/dble(10)) - d = modulo(id,10) - +! id = STXSobs%channel_id(i) +! p = int((id-modulo(id,10))/dble(10)) +! d = modulo(id,10) + p = STXSobs%channel_p_id(i) + d = STXSobs%channel_d_id(i) + do j=1, np(Hneut) ! write(*,*) 'DEBUG HS, m = ', t%particle(Hneut)%M(j) !--Do the production rate for the relevant experiment and cms-energy if(STXSobs%collider.eq.'LHC') then if(abs(STXSobs%energy-7.0D0).le.small) then if(p.eq.1) then norm_rate=t%lhc7%XS_hj_ratio(j) SMrate=t%lhc7%XS_H_SM(j) SMrate_refmass=XS_lhc7_gg_H_SM(refmass)+XS_lhc7_bb_H_SM(refmass) ! STXSobs%channel_description(i,1)='singleH' else if(p.eq.2) then norm_rate=t%lhc7%XS_vbf_ratio(j) SMrate=t%lhc7%XS_vbf_SM(j) SMrate_refmass=XS_lhc7_vbf_SM(refmass) ! STXSobs%channel_description(i,1)='VBF' else if(p.eq.3) then norm_rate=t%lhc7%XS_hjW_ratio(j) SMrate=t%lhc7%XS_HW_SM(j) SMrate_refmass=XS_lhc7_HW_SM(refmass) ! STXSobs%channel_description(i,1)='HW' else if(p.eq.4) then norm_rate=t%lhc7%XS_hjZ_ratio(j) SMrate=t%lhc7%XS_HZ_SM(j) SMrate_refmass=XS_lhc7_HZ_SM(refmass) ! STXSobs%channel_description(i,1)='HZ' else if(p.eq.5) then norm_rate=t%lhc7%XS_tthj_ratio(j) SMrate=t%lhc7%XS_ttH_SM(j) SMrate_refmass=XS_lhc7_ttH_SM(refmass) -! STXSobs%channel_description(i,1)='ttH' +! STXSobs%channel_description(i,1)='ttH' + else if(p.eq.6) then + norm_rate=t%lhc7%XS_gg_hj_ratio(j) + SMrate=t%lhc7%XS_gg_H_SM(j) + SMrate_refmass=XS_lhc7_gg_H_SM(refmass) +! mutab%channel_description(i,1)='ggH' + else if(p.eq.7) then + norm_rate=t%lhc7%XS_bb_hj_ratio(j) + SMrate=t%lhc7%XS_bb_H_SM(j) + SMrate_refmass=XS_lhc7_bb_H_SM(refmass) +! mutab%channel_description(i,1)='bbH' + else if(p.eq.8) then + norm_rate=t%lhc7%XS_thj_tchan_ratio(j) + SMrate=t%lhc7%XS_tH_tchan_SM(j) + SMrate_refmass=XS_lhc7_tH_tchan_SM(refmass) +! mutab%channel_description(i,1)='tH (t-channel)' + else if(p.eq.9) then + norm_rate=t%lhc7%XS_thj_schan_ratio(j) + SMrate=t%lhc7%XS_tH_schan_SM(j) + SMrate_refmass=XS_lhc7_tH_schan_SM(refmass) +! mutab%channel_description(i,1)='tH (s-channel)' + else if(p.eq.10) then + norm_rate=t%lhc7%XS_qq_hjZ_ratio(j) + SMrate=t%lhc7%XS_qq_HZ_SM(j) + SMrate_refmass=XS_lhc7_HZ_SM(refmass) ! WARNING: This is still the inclusive rate!!! +! rate_SMref=XS_lhc7_qq_HZ_SM(refmass) !Need to create this function yet! +! mutab%channel_description(i,1)='qq-HZ' + else if(p.eq.11) then + norm_rate=t%lhc7%XS_gg_hjZ_ratio(j) + SMrate=t%lhc7%XS_gg_HZ_SM(j) + SMrate_refmass=XS_lhc7_HZ_SM(refmass) ! WARNING: This is still the inclusive rate!!! +! rate_SMref=XS_lhc7_gg_HZ_SM(refmass) !Need to create this function yet! +! mutab%channel_description(i,1)='gg-HZ' else if(p.eq.0) then norm_rate=1.0D0 SMrate=1.0D0 SMrate_refmass=1.0D0 ! STXSobs%channel_description(i,1)='none' endif else if(abs(STXSobs%energy-8.0D0).le.small) then if(p.eq.1) then norm_rate=t%lhc8%XS_hj_ratio(j) SMrate=t%lhc8%XS_H_SM(j) SMrate_refmass=XS_lhc8_gg_H_SM(refmass)+XS_lhc8_bb_H_SM(refmass) ! STXSobs%channel_description(i,1)='singleH' else if(p.eq.2) then norm_rate=t%lhc8%XS_vbf_ratio(j) SMrate=t%lhc8%XS_vbf_SM(j) SMrate_refmass=XS_lhc8_vbf_SM(refmass) ! STXSobs%channel_description(i,1)='VBF' else if(p.eq.3) then norm_rate=t%lhc8%XS_hjW_ratio(j) SMrate=t%lhc8%XS_HW_SM(j) SMrate_refmass=XS_lhc8_HW_SM(refmass) ! STXSobs%channel_description(i,1)='HW' else if(p.eq.4) then norm_rate=t%lhc8%XS_hjZ_ratio(j) SMrate=t%lhc8%XS_HZ_SM(j) SMrate_refmass=XS_lhc8_HZ_SM(refmass) ! STXSobs%channel_description(i,1)='HZ' else if(p.eq.5) then norm_rate=t%lhc8%XS_tthj_ratio(j) SMrate=t%lhc8%XS_ttH_SM(j) SMrate_refmass=XS_lhc8_ttH_SM(refmass) -! STXSobs%channel_description(i,1)='ttH' +! STXSobs%channel_description(i,1)='ttH' + else if(p.eq.6) then + norm_rate=t%lhc8%XS_gg_hj_ratio(j) + SMrate=t%lhc8%XS_gg_H_SM(j) + SMrate_refmass=XS_lhc8_gg_H_SM(refmass) +! mutab%channel_description(i,1)='ggH' + else if(p.eq.7) then + norm_rate=t%lhc8%XS_bb_hj_ratio(j) + SMrate=t%lhc8%XS_bb_H_SM(j) + SMrate_refmass=XS_lhc8_bb_H_SM(refmass) +! mutab%channel_description(i,1)='bbH' + else if(p.eq.8) then + norm_rate=t%lhc8%XS_thj_tchan_ratio(j) + SMrate=t%lhc8%XS_tH_tchan_SM(j) + SMrate_refmass=XS_lhc8_tH_tchan_SM(refmass) +! mutab%channel_description(i,1)='tH (t-channel)' + else if(p.eq.9) then + norm_rate=t%lhc8%XS_thj_schan_ratio(j) + SMrate=t%lhc8%XS_tH_schan_SM(j) + SMrate_refmass=XS_lhc8_tH_schan_SM(refmass) +! mutab%channel_description(i,1)='tH (s-channel)' + else if(p.eq.10) then + norm_rate=t%lhc8%XS_qq_hjZ_ratio(j) + SMrate=t%lhc8%XS_qq_HZ_SM(j) + SMrate_refmass=XS_lhc8_HZ_SM(refmass) ! WARNING: This is still the inclusive rate!!! +! rate_SMref=XS_lhc8_qq_HZ_SM(refmass) !Need to create this function yet! +! mutab%channel_description(i,1)='qq-HZ' + else if(p.eq.11) then + norm_rate=t%lhc8%XS_gg_hjZ_ratio(j) + SMrate=t%lhc8%XS_gg_HZ_SM(j) + SMrate_refmass=XS_lhc8_HZ_SM(refmass) ! WARNING: This is still the inclusive rate!!! +! rate_SMref=XS_lhc8_gg_HZ_SM(refmass) !Need to create this function yet! + else if(p.eq.0) then norm_rate=1.0D0 SMrate=1.0D0 SMrate_refmass=1.0D0 ! STXSobs%channel_description(i,1)='none' endif else if(abs(STXSobs%energy-13.0D0).le.small) then if(p.eq.1) then norm_rate=t%lhc13%XS_hj_ratio(j) SMrate=t%lhc13%XS_H_SM(j) SMrate_refmass=XS_lhc13_gg_H_SM(refmass)+XS_lhc13_bb_H_SM(refmass) ! STXSobs%channel_description(i,1)='singleH' else if(p.eq.2) then norm_rate=t%lhc13%XS_vbf_ratio(j) SMrate=t%lhc13%XS_vbf_SM(j) SMrate_refmass=XS_lhc13_vbf_SM(refmass) ! STXSobs%channel_description(i,1)='VBF' else if(p.eq.3) then norm_rate=t%lhc13%XS_hjW_ratio(j) SMrate=t%lhc13%XS_HW_SM(j) SMrate_refmass=XS_lhc13_HW_SM(refmass) ! STXSobs%channel_description(i,1)='HW' else if(p.eq.4) then norm_rate=t%lhc13%XS_hjZ_ratio(j) SMrate=t%lhc13%XS_HZ_SM(j) SMrate_refmass=XS_lhc13_HZ_SM(refmass) ! STXSobs%channel_description(i,1)='HZ' else if(p.eq.5) then norm_rate=t%lhc13%XS_tthj_ratio(j) SMrate=t%lhc13%XS_ttH_SM(j) SMrate_refmass=XS_lhc13_ttH_SM(refmass) ! STXSobs%channel_description(i,1)='ttH' + else if(p.eq.6) then + norm_rate=t%lhc13%XS_gg_hj_ratio(j) + SMrate=t%lhc13%XS_gg_H_SM(j) + SMrate_refmass=XS_lhc13_gg_H_SM(refmass) +! mutab%channel_description(i,1)='ggH' + else if(p.eq.7) then + norm_rate=t%lhc13%XS_bb_hj_ratio(j) + SMrate=t%lhc13%XS_bb_H_SM(j) + SMrate_refmass=XS_lhc13_bb_H_SM(refmass) +! mutab%channel_description(i,1)='bbH' + else if(p.eq.8) then + norm_rate=t%lhc13%XS_thj_tchan_ratio(j) + SMrate=t%lhc13%XS_tH_tchan_SM(j) + SMrate_refmass=XS_lhc13_tH_tchan_SM(refmass) +! mutab%channel_description(i,1)='tH (t-channel)' + else if(p.eq.9) then + norm_rate=t%lhc13%XS_thj_schan_ratio(j) + SMrate=t%lhc13%XS_tH_schan_SM(j) + SMrate_refmass=XS_lhc13_tH_schan_SM(refmass) +! mutab%channel_description(i,1)='tH (s-channel)' + else if(p.eq.10) then + norm_rate=t%lhc13%XS_qq_hjZ_ratio(j) + SMrate=t%lhc13%XS_qq_HZ_SM(j) + SMrate_refmass=XS_lhc13_HZ_SM(refmass) ! WARNING: This is still the inclusive rate!!! +! rate_SMref=XS_lhc13_qq_HZ_SM(refmass) !Need to create this function yet! +! mutab%channel_description(i,1)='qq-HZ' + else if(p.eq.11) then + norm_rate=t%lhc13%XS_gg_hjZ_ratio(j) + SMrate=t%lhc13%XS_gg_HZ_SM(j) + SMrate_refmass=XS_lhc13_HZ_SM(refmass) ! WARNING: This is still the inclusive rate!!! +! rate_SMref=XS_lhc13_gg_HZ_SM(refmass) !Need to create this function yet! else if(p.eq.0) then norm_rate=1.0D0 SMrate=1.0D0 SMrate_refmass=1.0D0 ! STXSobs%channel_description(i,1)='none' endif endif else if(STXSobs%collider.eq.'TEV') then if(p.eq.1) then norm_rate=t%tev%XS_hj_ratio(j) SMrate=t%tev%XS_H_SM(j) SMrate_refmass=XS_tev_gg_H_SM(refmass)+XS_tev_bb_H_SM(refmass) ! STXSobs%channel_description(i,1)='singleH' else if(p.eq.2) then norm_rate=t%tev%XS_vbf_ratio(j) SMrate=t%tev%XS_vbf_SM(j) SMrate_refmass=XS_tev_vbf_SM(refmass) ! STXSobs%channel_description(i,1)='VBF' else if(p.eq.3) then norm_rate=t%tev%XS_hjW_ratio(j) SMrate=t%tev%XS_HW_SM(j) SMrate_refmass=XS_tev_HW_SM(refmass) ! STXSobs%channel_description(i,1)='HW' else if(p.eq.4) then norm_rate=t%tev%XS_hjZ_ratio(j) SMrate=t%tev%XS_HZ_SM(j) SMrate_refmass=XS_tev_HZ_SM(refmass) ! STXSobs%channel_description(i,1)='HZ' else if(p.eq.5) then norm_rate=t%tev%XS_tthj_ratio(j) SMrate=t%tev%XS_ttH_SM(j) SMrate_refmass=XS_tev_ttH_SM(refmass) ! STXSobs%channel_description(i,1)='ttH' else if(p.eq.0) then norm_rate=1.0D0 SMrate=1.0D0 SMrate_refmass=1.0D0 ! STXSobs%channel_description(i,1)='none' endif else if(STXSobs%collider.eq.'ILC') then !--n.B.: As a first attempt, we use the LHC8 normalized cross sections for ZH, VBF, ttH. ! In order to do this properly, a separate input for the ILC cross sections ! has to be provided! It works only for single production mode observables (no ! correct weighting of channels included!)Then, at least in the effective coupling ! approximation, there is no difference to a full implementation. ! The theoretical uncertainty of the ILC production modes will are defined in ! usefulbits_HS.f90. if(p.eq.1.or.p.eq.2) then write(*,*) 'Warning: Unknown ILC production mode (',p,') in table ',STXSobs%id norm_rate=0.0D0 SMrate=1.0D0 SMrate_refmass=1.0D0 ! STXSobs%channel_description(i,1)='unknown' else if(p.eq.3) then norm_rate=t%lhc8%XS_hjW_ratio(j) SMrate=t%lhc8%XS_HW_SM(j) SMrate_refmass=XS_lhc8_HW_SM(refmass) ! STXSobs%channel_description(i,1)='WBF' else if(p.eq.4) then norm_rate=t%lhc8%XS_hjZ_ratio(j) SMrate=t%lhc8%XS_HZ_SM(j) SMrate_refmass=XS_lhc8_HZ_SM(refmass) ! STXSobs%channel_description(i,1)='HZ' else if(p.eq.5) then norm_rate=t%lhc8%XS_tthj_ratio(j) SMrate=t%lhc8%XS_ttH_SM(j) SMrate_refmass=XS_lhc8_ttH_SM(refmass) ! STXSobs%channel_description(i,1)='ttH' else if(p.eq.0) then norm_rate=1.0D0 SMrate=1.0D0 SMrate_refmass=1.0D0 ! STXSobs%channel_description(i,1)='none' endif endif !--Multiply now by the decay rate if(d.eq.1) then norm_rate=norm_rate*div(t%BR_hjgaga(j),t%BR_Hgaga_SM(j),0.0D0,1.0D0) SMrate=SMrate*t%BR_Hgaga_SM(j) SMrate_refmass = SMrate_refmass*BRSM_Hgaga(refmass) ! STXSobs%channel_description(i,2)='gammagamma' else if(d.eq.2) then norm_rate=norm_rate*div(t%BR_hjWW(j),t%BR_HWW_SM(j),0.0D0,1.0D0) SMrate=SMrate*t%BR_HWW_SM(j) SMrate_refmass = SMrate_refmass*BRSM_HWW(refmass) ! STXSobs%channel_description(i,2)='WW' else if(d.eq.3) then norm_rate=norm_rate*div(t%BR_hjZZ(j),t%BR_HZZ_SM(j),0.0D0,1.0D0) SMrate=SMrate*t%BR_HZZ_SM(j) SMrate_refmass = SMrate_refmass*BRSM_HZZ(refmass) ! STXSobs%channel_description(i,2)='ZZ' else if(d.eq.4) then norm_rate=norm_rate*div(t%BR_hjtautau(j),t%BR_Htautau_SM(j),0.0D0,1.0D0) SMrate=SMrate*t%BR_Htautau_SM(j) SMrate_refmass = SMrate_refmass*BRSM_Htautau(refmass) ! STXSobs%channel_description(i,2)='tautau' else if(d.eq.5) then norm_rate=norm_rate*div(t%BR_hjbb(j),t%BR_Hbb_SM(j),0.0D0,1.0D0) SMrate=SMrate*t%BR_Hbb_SM(j) SMrate_refmass = SMrate_refmass*BRSM_Hbb(refmass) ! STXSobs%channel_description(i,2)='bb' else if(d.eq.6) then norm_rate=norm_rate*div(t%BR_hjZga(j),t%BR_HZga_SM(j),0.0D0,1.0D0) SMrate=SMrate*t%BR_HZga_SM(j) SMrate_refmass = SMrate_refmass*BRSM_HZga(refmass) ! STXSobs%channel_description(i,2)='Zgamma' else if(d.eq.7) then norm_rate=norm_rate*div(t%BR_hjcc(j),t%BR_Hcc_SM(j),0.0D0,1.0D0) SMrate=SMrate*t%BR_Hcc_SM(j) SMrate_refmass = SMrate_refmass*BRSM_Hcc(refmass) ! STXSobs%channel_description(i,2)='cc' else if(d.eq.8) then norm_rate=norm_rate*div(t%BR_hjmumu(j),t%BR_Hmumu_SM(j),0.0D0,1.0D0) SMrate=SMrate*t%BR_Hmumu_SM(j) SMrate_refmass = SMrate_refmass*BRSM_Hmumu(refmass) ! STXSobs%channel_description(i,2)='mumu' else if(d.eq.9) then norm_rate=norm_rate*div(t%BR_hjgg(j),t%BR_Hgg_SM(j),0.0D0,1.0D0) SMrate=SMrate*t%BR_Hgg_SM(j) SMrate_refmass = SMrate_refmass*BRSM_Hgg(refmass) ! STXSobs%channel_description(i,2)='gg' + else if(d.eq.10) then + norm_rate=norm_rate*div(t%BR_hjss(j),t%BR_Hss_SM(j),0.0D0,1.0D0) + SMrate=SMrate*t%BR_Hss_SM(j) + SMrate_refmass = SMrate_refmass*BRSM_Hss(refmass) +! mutab%channel_description(i,2)='ss' + else if(d.eq.11) then + norm_rate=norm_rate*div(t%BR_hjtt(j),t%BR_Htt_SM(j),0.0D0,1.0D0) + SMrate=SMrate*t%BR_Htt_SM(j) + SMrate_refmass = SMrate_refmass*BRSM_Htoptop(refmass) +! mutab%channel_description(i,2)='tt' else if(d.eq.0) then norm_rate=norm_rate*1.0D0 SMrate=SMrate*1.0D0 SMrate_refmass = SMrate_refmass*1.0D0 ! STXSobs%channel_description(i,2)='none' endif !------------------------- ! NEW FEATURE (since HB-5.2): Enable to set channelrates directly. if(p.ne.0.and.d.ne.0) then select case(d) case(1) BR_SMref = t%BR_Hgaga_SM(j) ! BR_SMref_mpeak = BRSM_Hgaga(refmass) case(2) BR_SMref = t%BR_HWW_SM(j) ! BR_SMref_mpeak = BRSM_HWW(refmass) case(3) BR_SMref = t%BR_HZZ_SM(j) ! BR_SMref_mpeak = BRSM_HZZ(refmass) case(4) BR_SMref = t%BR_Htautau_SM(j) ! BR_SMref_mpeak = BRSM_Htautau(refmass) case(5) BR_SMref = t%BR_Hbb_SM(j) ! BR_SMref_mpeak = BRSM_Hbb(refmass) case(6) BR_SMref = t%BR_HZga_SM(j) ! BR_SMref_mpeak = BRSM_HZga(refmass) case(7) BR_SMref = t%BR_Hcc_SM(j) ! BR_SMref_mpeak = BRSM_Hcc(refmass) case(8) BR_SMref = t%BR_Hmumu_SM(j) ! BR_SMref_mpeak = BRSM_Hmumu(refmass) case(9) BR_SMref = t%BR_Hgg_SM(j) ! BR_SMref_mpeak = BRSM_Hgg(refmass) + case(10) + BR_SMref = t%BR_Hss_SM(j) +! BR_SMref_mpeak = BRSM_Hgg(refmass) + case(11) + BR_SMref = t%BR_Htt_SM(j) +! BR_SMref_mpeak = BRSM_Htoptop(refmass) + end select if(STXSobs%collider.eq.'LHC') then if(abs(STXSobs%energy-7.0D0).le.small) then if(t%lhc7%channelrates(j,p,d).ge.0.0d0) then norm_rate=div(t%lhc7%channelrates(j,p,d),BR_SMref,0.0D0,1.0D0) endif else if(abs(STXSobs%energy-8.0D0).le.small) then if(t%lhc8%channelrates(j,p,d).ge.0.0d0) then norm_rate=div(t%lhc8%channelrates(j,p,d),BR_SMref,0.0D0,1.0D0) endif else if(abs(STXSobs%energy-13.0D0).le.small) then if(t%lhc13%channelrates(j,p,d).ge.0.0d0) then norm_rate=div(t%lhc13%channelrates(j,p,d),BR_SMref,0.0D0,1.0D0) endif endif else if(STXSobs%collider.eq.'TEV') then if(t%tev%channelrates(j,p,d).ge.0.0d0) then norm_rate=div(t%tev%channelrates(j,p,d),BR_SMref,0.0D0,1.0D0) endif endif endif !------------------------- if(abs(t%particle(Hneut)%M(j) - STXSobs%mass).le.(assignmentrange_STXS * & sqrt(t%particle(Hneut)%dM(j)**2.0D0+STXSobs%dmass**2.0D0))) then ! if(STXSobs%rate_SM_normalized.eq.1) then if(normalize_rates_to_reference_position) then STXSobs%model_rate_per_Higgs(j,i)=norm_rate*SMrate/(SMrate_refmass) + else - STXSobs%model_rate_per_Higgs(j,i)=norm_rate !! OLD WAY + STXSobs%model_rate_per_Higgs(j,i)=norm_rate !! OLD WAY endif + + if(normalize_rates_to_reference_position_outside_dmtheo) then + if(abs(STXSobs%mass-t%particle(Hneut)%M(j)).ge.t%particle(Hneut)%dM(j)) then + STXSobs%model_rate_per_Higgs(j,i)=norm_rate*SMrate/(SMrate_refmass) + endif + endif + ! else ! if(use_SMrate_at_reference_position_for_STXS) then !--- ! n.B.: Need to use officially quoted SM prediction here, because HB/HS do not contain ! SM predictions for exclusive STXS bins (but only inclusive SM rates). !--- ! STXSobs%model_rate_per_Higgs(j,i)=norm_rate*STXSobs%SMrate ! else ! STXSobs%model_rate=norm_rate*SMrate ! endif ! endif else STXSobs%model_rate_per_Higgs(j,i) = 0.0D0 +! STXSobs%inclusive_SM_rate(j,i) = 0.0D0 endif +! Inclusive SM rate must always be evaluated at the mass position of the measurement! + STXSobs%inclusive_SM_rate(i) = SMrate_refmass * STXSobs%channel_efficiency(i) + + ! write(*,*) "j, i, STXSobs%model_rate_per_Higgs(j,i) = ",j,i, STXSobs%model_rate_per_Higgs(j,i) ! Turn normalized rate into absolute rate (per Higgs per channel) STXSobs%model_rate_per_Higgs(j,i) = STXSobs%model_rate_per_Higgs(j,i) * & & STXSobs%relative_efficiency(j,i) * & - & SMrate * STXSobs%channel_efficiency(i) + & STXSobs%inclusive_SM_rate(i) + !& SMrate * STXSobs%channel_efficiency(i) -! SM predicted absolute XS (per channel) - -! Hier liegt der Fehler: Darf nur für das relevante Higgs berechnet werden!! - STXSobs%inclusive_SM_rate(j,i) = SMrate * STXSobs%channel_efficiency(i) - ! write(*,*) "j, i, absolute STXSobs%model_rate_per_Higgs(j,i), STXSobs%inclusive_SM_rate(i) = ",& ! & j, i, STXSobs%model_rate_per_Higgs(j,i), STXSobs%inclusive_SM_rate(j,i) !--- ! Take into account model-dependent signal efficiency (relative to SM). ! These have to be given by the user for each observable using the subroutine ! assign_modelefficiencies_to_STXS: !--- enddo enddo - STXSobs%model_total_rate = sum(STXSobs%model_rate_per_Higgs)/sum(STXSobs%inclusive_SM_rate) - -! write(*,*) "STXSobs%model_total_rate = ", STXSobs%model_total_rate +! write(*,*) "STXSobs%id = " , STXSobs%id +! write(*,*) " model_rate_per_Higgs = ",STXSobs%model_rate_per_Higgs +! write(*,*) " inclusive SM rate = ",STXSobs%inclusive_SM_rate + +if(sum(STXSobs%inclusive_SM_rate).ge.vsmall) then + STXSobs%model_total_rate = sum(STXSobs%model_rate_per_Higgs)/sum(STXSobs%inclusive_SM_rate) ! Mistake: Don't divide by the sum over SM!! +else + STXSobs%model_total_rate = 0.0D0 +endif + +! write(*,*) "STXSobs%model_total_rate (SM norm)= ", STXSobs%model_total_rate if(STXSobs%rate_SM_normalized.eq.0) then STXSobs%model_total_rate = STXSobs%model_total_rate * STXSobs%SMrate +! write(*,*) "STXSobs%model_total_rate (absolute)= ", STXSobs%model_total_rate endif ! write(*,*) "#--------------- ", STXSobs%id, " ---------------#" ! do i=1,STXSobs%Nc ! write(*,*) "channel id = ", STXSobs%channel_id(i), " rate = ", & ! & sum(STXSobs%model_rate_per_Higgs(:,i))/sum(STXSobs%inclusive_SM_rate)*STXSobs%SMrate ! enddo ! STXSobs%model_total_rate + STXSobs%relative_efficiency(j) * STXSobs%model_rate_per_Higgs(j) ! write(*,*) "Total rate: ", STXSobs%model_total_rate end subroutine evaluate_model_for_STXS !------------------------------------------------------------------------------------ subroutine print_STXS() !------------------------------------------------------------------------------------ implicit none integer :: i + character(LEN=100) :: formatter do i=lbound(STXSlist,dim=1), ubound(STXSlist,dim=1) - write(*,*) "#--- STXS observable ",i," ---#" - write(*,*) " Label = ", STXSlist(i)%label - write(*,*) " Description = ", STXSlist(i)%desc - write(*,*) " Experiment = ", STXSlist(i)%expt - write(*,*) " Energy, Luminosity = ", STXSlist(i)%energy, STXSlist(i)%lumi - write(*,*) " Obs Signal rate [pb] = ", STXSlist(i)%rate, " + ", STXSlist(i)%drate_up, " - ", STXSlist(i)%drate_low - write(*,*) " Pred. Signal rate [pb] = ", STXSlist(i)%model_total_rate - write(*,*) " SM Signal rate [pb] = ", STXSlist(i)%SMrate, " + ", STXSlist(i)%dSMrate_up, " - ", STXSlist(i)%dSMrate_low - write(*,*) " Channels = ", STXSlist(i)%channel_id - write(*,*) " Channel efficiency = ", STXSlist(i)%channel_efficiency + write(*,*) "#--------------------------------------------------#" + write(*,*) "#- STXS observable ",i," -#" + write(*,*) "#--------------------------------------------------#" + write(*,'(A,I10)') " ID = ", STXSlist(i)%id + write(*,'(A,A)') " Label = ", STXSlist(i)%label + write(*,'(A,A)') " Description = ", STXSlist(i)%desc + write(*,'(A,A)') " Experiment = ", STXSlist(i)%expt + write(*,'(A,2F6.2)') " Energy, Luminosity = ", STXSlist(i)%energy, STXSlist(i)%lumi + write(*,'(A,F10.5,A,F10.5,A,F10.5)') " Obs Signal rate [pb] = ",& + & STXSlist(i)%rate, " + ", STXSlist(i)%drate_up, " - ", STXSlist(i)%drate_low + write(*,'(A,F10.5,A,F10.5,A,F10.5)') " SM Signal rate [pb] = ",& + & STXSlist(i)%SMrate, " + ", STXSlist(i)%dSMrate_up, " - ", STXSlist(i)%dSMrate_low + write(*,'(A,F10.5)') " Pred. Signal rate [pb] = ", STXSlist(i)%model_total_rate + write(formatter,*) "(A,",STXSlist(i)%Nc,"I10)" + formatter = trim(adjustl(formatter)) + write(*,'(A)') " Channels = ", STXSlist(i)%channel_id_str + write(formatter,*) "(A,",STXSlist(i)%Nc,"F10.5)" + formatter = trim(adjustl(formatter)) + write(*,formatter) " Channel efficiency = ", STXSlist(i)%channel_efficiency enddo -write(*,*) "#-------------------------------#" +write(*,*) "#--------------------------------------------------#" end subroutine print_STXS !------------------------------------------------------------------------------------ subroutine clear_STXS() !------------------------------------------------------------------------------------ implicit none - + integer :: i + + do i=lbound(STXSlist,dim=1), ubound(STXSlist,dim=1) + deallocate(STXSlist(i)%model_rate_per_Higgs) + deallocate(STXSlist(i)%inclusive_SM_rate) + deallocate(STXSlist(i)%channel_id_str) + deallocate(STXSlist(i)%channel_p_id) + deallocate(STXSlist(i)%channel_d_id) + deallocate(STXSlist(i)%channel_efficiency) + deallocate(STXSlist(i)%relative_efficiency) + enddo deallocate(STXSlist) + if(allocated(STXScorrlist)) deallocate(STXScorrlist) + end subroutine clear_STXS !------------------------------------------------------------------------------------ end module STXS !------------------------------------------------------------------------------------ \ No newline at end of file Index: trunk/HiggsSignals-2/datatables.f90 =================================================================== --- trunk/HiggsSignals-2/datatables.f90 (revision 568) +++ trunk/HiggsSignals-2/datatables.f90 (revision 569) @@ -1,696 +1,733 @@ !-------------------------------------------------------------------- ! This file is part of HiggsSignals (OS and TS 04/03/2013) !-------------------------------------------------------------------- module datatables !-------------------------------------------------------------------- use usefulbits_HS, only : mutable, mupeak, Exptdir, obs, analyses,corrlist !, withcorrexpsyst !x mutables, peaks use usefulbits, only : np implicit none integer :: ntable1,ntable2 contains !-------------------------------------------------------------------- subroutine initializemutable_blank(table) !-------------------------------------------------------------------- type(mutable) :: table table%id = -1 table%nx = -1 table%particle_x = -1 table%label = '' table%desc = '' table%expt = '' table%lumi = -1.0D0 table%dlumi = -1.0D0 table%energy = -1.0D0 table%Nc = -1 table%xmax = -1.0D0 table%xmin = -1.0D0 table%sep = -1.0D0 table%deltam = -1.0D0 table%deltax = -1.0D0 table%mhchisq = 0 end subroutine initializemutable_blank !-------------------------------------------------------------------- subroutine initialize_observables !-------------------------------------------------------------------- use store_pathname_HS use usefulbits, only: np,Hneut,Hplus,file_id_common3,file_id_common2 - implicit none +! implicit none character(LEN=150) :: filename character(LEN=100) :: datafile(500) integer n_datafiles, n_correlations, n_correlations_tmp !--------------------------------------input ! type(mutable),allocatable :: tables(:) !-----------------------------------internal logical :: newtables integer :: x, n, xbeg, xend, i, m, int1, int2 double precision :: db1 character(LEN=pathname_length+150) :: fullfilename character(LEN=200) :: comment character(LEN=1) :: firstchar character(LEN=100) :: line integer :: col integer :: ios integer, allocatable :: skip(:) + integer :: id, posperiod !------------------------------------------- ! open(file_id_common3, file=trim(adjustl(pathname_HS))// & ! & "Expt_tables/analyses.txt", form='formatted') ! read(file_id_common3,'(A)',iostat=ios) datafile(1) ! if(ios.ne.0)then ! close(file_id_common3) !! call system('ls -1 -p '//trim(adjustl(pathname_HS))// & !!& 'Expt_tables/'//trim(adjustl(Exptdir))//' > '//trim(adjustl(pathname_HS))// & !!& 'Expt_tables/analyses.txt') call system('basename -a `ls -1 -p '//trim(adjustl(pathname_HS))// & & 'Expt_tables/'//trim(adjustl(Exptdir))//'/*.txt` > HS_analyses.txt') !! open(file_id_common3, file=trim(adjustl(pathname_HS))//"Expt_tables/analyses.txt",& !!& form='formatted') open(file_id_common3, file="HS_analyses.txt",form='formatted') ! else ! rewind(file_id_common3) ! endif print *, "Reading in measurements from the following datafiles from analysis-set "// & trim(adjustl(Exptdir))//":" n = 0 n_datafiles = 0 do n = n+1 read(file_id_common3,'(A)', iostat=ios) datafile(n) if(ios.ne.0) exit write(*,'(I4,2X,A)') n, datafile(n) enddo n_datafiles = n - 1 close(file_id_common3) allocate(obs(n_datafiles),skip(n_datafiles)) do i=lbound(obs,dim=1), ubound(obs,dim=1) call initializemutable_blank(obs(i)%table) enddo do n=1,n_datafiles skip(n)=11 !! if(withcorrexpsyst) skip(n)=12 open(file_id_common3, file=trim(adjustl(pathname_HS)) //'Expt_tables/'// & & trim(adjustl(Exptdir))//'/' // datafile(n)) do read(file_id_common3,'(A)') comment comment = trim(adjustl(comment)) write(firstchar,'(A1)') comment if(firstchar.ne.'#') then exit else skip(n)=skip(n)+1 endif enddo backspace(file_id_common3) read(file_id_common3,*) obs(n)%id, obs(n)%table%id, obs(n)%obstype read(file_id_common3,'(A)') obs(n)%table%label read(file_id_common3,*) obs(n)%table%collider,obs(n)%table%collaboration, & & obs(n)%table%expt read(file_id_common3,'(A)') obs(n)%table%desc read(file_id_common3,*) obs(n)%table%energy, obs(n)%table%lumi, obs(n)%table%dlumi !--TESTING correlated experimental systematics: !! if(withcorrexpsyst) read(file_id_common3,*) (obs(n)%table%correxpsyst(i),i=1,4) !! write(*,*) "Systematics: ",obs(n)%table%correxpsyst !--END read(file_id_common3,*) obs(n)%table%particle_x, obs(n)%table%mhchisq !--CHECK FOR ASSIGNMENT GROUP AS SECOND COLUMN: read(file_id_common3,'(A)') line call read_in_mass_resolution_and_assignment_group(line, obs(n)%table%deltam,& & obs(n)%table%assignmentgroup) ! write(*,*) "dm, group = ",obs(n)%table%deltam, obs(n)%table%assignmentgroup ! read(file_id_common3,*) obs(n)%table%deltam read(file_id_common3,*) obs(n)%table%xmin, obs(n)%table%xmax, obs(n)%table%sep read(file_id_common3,*) obs(n)%table%Nc, obs(n)%table%eff_ref_mass - allocate(obs(n)%table%channel_id(obs(n)%table%Nc)) - read(file_id_common3,*) (obs(n)%table%channel_id(i),i=1,obs(n)%table%Nc) + allocate(obs(n)%table%channel_id_str(obs(n)%table%Nc)) +! allocate(obs(n)%table%channel_id(obs(n)%table%Nc)) + allocate(obs(n)%table%channel_p_id(obs(n)%table%Nc)) + allocate(obs(n)%table%channel_d_id(obs(n)%table%Nc)) +! read(file_id_common3,*) (obs(n)%table%channel_id(i),i=1,obs(n)%table%Nc) + read(file_id_common3,*) (obs(n)%table%channel_id_str(i),i=1,obs(n)%table%Nc) + do i=1,obs(n)%table%Nc + posperiod = index(obs(n)%table%channel_id_str(i),'.') + if(posperiod.eq.0) then + if(len(trim(adjustl(obs(n)%table%channel_id_str(i)))).eq.2) then + read(obs(n)%table%channel_id_str(i),*) id + obs(n)%table%channel_p_id(i) = int((id-modulo(id,10))/dble(10)) + obs(n)%table%channel_d_id(i) = modulo(id,10) + else + write(*,*) " For observable ID = ",obs(n)%id + stop " Error: Cannot handle channel IDs!" + endif + else + read(obs(n)%table%channel_id_str(i)(:posperiod-1),*) obs(n)%table%channel_p_id(i) + read(obs(n)%table%channel_id_str(i)(posperiod+1:),*) obs(n)%table%channel_d_id(i) + endif + enddo +! write(*,*) "Production channels = ",obs(n)%table%channel_p_id +! write(*,*) "Decay channels = ",obs(n)%table%channel_d_id +! write(*,*) obs(n)%table%channel_id_str allocate(obs(n)%table%channel_eff(obs(n)%table%Nc)) allocate(obs(n)%table%channel_eff_ratios(obs(n)%table%Nc)) if(obs(n)%table%eff_ref_mass.ge.0D0) then read(file_id_common3,*) (obs(n)%table%channel_eff(i),i=1,obs(n)%table%Nc) else do i=1,obs(n)%table%Nc obs(n)%table%channel_eff(i)=1.0D0 enddo read(file_id_common3,*) endif obs(n)%table%channel_eff_ratios=1.0D0 allocate(obs(n)%table%channel_description(obs(n)%table%Nc,2)) close(file_id_common3) enddo col = 3 do x=1,n_datafiles if(obs(x)%table%deltam.le.obs(x)%table%sep) then write(*,*) "Warning: Mass resolution for " ,trim(obs(x)%table%label), & & "observable number ",x," with ID = ",obs(x)%id, & & " very small - may lead to unreliable results" write(*,*) "Mass resolution = ",obs(x)%table%deltam write(*,*) "Separation = ",obs(x)%table%sep endif obs(x)%table%nx=nint((obs(x)%table%xmax-obs(x)%table%xmin)/obs(x)%table%sep)+1 allocate(obs(x)%table%mu(obs(x)%table%nx,col)) allocate(obs(x)%table%mass(obs(x)%table%nx)) allocate(obs(x)%table%channel_mu(obs(x)%table%Nc,np(obs(x)%table%particle_x))) allocate(obs(x)%table%channel_systSM(obs(x)%table%Nc,np(obs(x)%table%particle_x))) allocate(obs(x)%table%channel_syst(obs(x)%table%Nc,np(obs(x)%table%particle_x))) allocate(obs(x)%table%channel_w(obs(x)%table%Nc,np(obs(x)%table%particle_x))) allocate(obs(x)%table%channel_w_corrected_eff(obs(x)%table%Nc,np(obs(x)%table%particle_x))) enddo do x=1, n_datafiles fullfilename=trim(adjustl(pathname_HS))//'Expt_tables/'//trim(adjustl(Exptdir))//'/'& & //trim(datafile(x)) call read_mutable(obs(x)%table,skip(x),col,fullfilename) enddo deallocate(skip) !NEW: call system('basename -a `ls -1 -p '//trim(adjustl(pathname_HS))// & & 'Expt_tables/'//trim(adjustl(Exptdir))//'/*.corr 2>/dev/null` > HS_correlations.txt 2>/dev/null') call system('rm -rf HS_ncorrelations.txt') open(file_id_common3, file="HS_correlations.txt",form='formatted') print *, "Reading in correlations from the following datafiles in analysis-set "// & trim(adjustl(Exptdir))//":" n = 0 n_datafiles = 0 n_correlations = 0 do n = n+1 read(file_id_common3,'(A)', iostat=ios) datafile(n) if(ios.ne.0) exit fullfilename=trim(adjustl(pathname_HS))//'Expt_tables/'//trim(adjustl(Exptdir))//'/'& & //trim(datafile(n)) call system('cat '//trim(adjustl(fullfilename))//' | wc -l > HS_ncorrelations.txt') open(file_id_common2,file="HS_ncorrelations.txt",form='formatted') read(file_id_common2,'(I10)') n_correlations_tmp close(file_id_common2) write(*,'(2I4,2X,A)') n, n_correlations_tmp, datafile(n) n_correlations = n_correlations + n_correlations_tmp enddo n_datafiles = n - 1 close(file_id_common3) allocate(corrlist(n_correlations)) m=0 do n=1,n_datafiles fullfilename=trim(adjustl(pathname_HS))//'Expt_tables/'//trim(adjustl(Exptdir))//'/'& & //trim(datafile(n)) open(file_id_common3,file=fullfilename) do m= m+1 read(file_id_common3,*,iostat=ios) int1, int2, db1 ! write(*,*) m, int1, int2, db1, ios if(ios.ne.0) exit corrlist(m)%obsID1 = int1 corrlist(m)%obsID2 = int2 corrlist(m)%corr = db1 enddo m=m-1 close(file_id_common3) enddo ! allocate(obs(n_datafiles),skip(n_datafiles)) ! do i=lbound(obs,dim=1), ubound(obs,dim=1) ! call initializemutable_blank(obs(i)%table) ! enddo ! ! do n=1,n_datafiles ! skip(n)=11 ! !! if(withcorrexpsyst) skip(n)=12 ! open(file_id_common3, file=trim(adjustl(pathname_HS)) //'Expt_tables/'// & ! & trim(adjustl(Exptdir))//'/' // datafile(n)) ! do ! read(file_id_common3,'(A)') comment ! comment = trim(adjustl(comment)) ! write(firstchar,'(A1)') comment ! if(firstchar.ne.'#') then ! exit ! else ! skip(n)=skip(n)+1 ! endif ! enddo ! backspace(file_id_common3) ! read(file_id_common3,*) obs(n)%id, obs(n)%table%id, obs(n)%obstype ! read(file_id_common3,'(A)') obs(n)%table%label end subroutine initialize_observables !-------------------------------------------------------------------- subroutine read_in_mass_resolution_and_assignment_group(line, dm, group) !-------------------------------------------------------------------- character(LEN=100), intent(in) :: line character(LEN=100), intent(out) :: group double precision, intent(out) :: dm integer :: i, indx, prev, beginning integer :: j, indxstr, prevstr, beginningstr prev = 0 beginning = 1 prevstr = 0 beginningstr = 1 group = "" do i=1,len(line) indx = index('0123456789.', line(i:i)) if (indx.eq.0 .and. prev.gt.0) then read(line(beginning:i-1), *) dm else if (indx.gt.0 .and. prev.eq.0) then beginning = i end if prev = indx indxstr = index('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_', line(i:i)) if (indxstr.eq.0 .and. prevstr.gt.0) then read(line(beginningstr:i-1), *) group else if (indxstr.gt.0 .and. prevstr.eq.0) then beginningstr = i end if prevstr = indxstr end do ! group=trim(adjustl(group_tmp)) end subroutine read_in_mass_resolution_and_assignment_group !-------------------------------------------------------------------- subroutine setup_peak_observables !-------------------------------------------------------------------- implicit none integer :: i,j do i=lbound(obs,dim=1),ubound(obs,dim=1) if(obs(i)%obstype.eq.1) then obs(i)%peak%id = obs(i)%id obs(i)%peak%mpeak = obs(i)%table%mass(1) obs(i)%peak%dm = obs(i)%table%deltam obs(i)%peak%mu = obs(i)%table%mu(1,2) obs(i)%peak%mu_original = obs(i)%table%mu(1,2) obs(i)%peak%dmuup = obs(i)%table%mu(1,3) - obs(i)%table%mu(1,2) obs(i)%peak%dmulow = obs(i)%table%mu(1,2) - obs(i)%table%mu(1,1) obs(i)%peak%dlumi = obs(i)%table%dlumi obs(i)%peak%scale_mu = 1.0D0 obs(i)%peak%undo_assignment = 0 obs(i)%peak%assignmentgroup = obs(i)%table%assignmentgroup ! obs(i)%peak%scale_mh = 1.0D0 if(.not.allocated(obs(i)%peak%Higgs_comb)) then allocate(obs(i)%peak%Higgs_comb(np(obs(i)%table%particle_x))) endif if(.not.allocated(obs(i)%peak%Higgses)) then allocate(obs(i)%peak%Higgses(np(obs(i)%table%particle_x))) endif obs(i)%peak%Nc = obs(i)%table%Nc ! have to allocate channel info and set them initially to zero! - if(.not.allocated(obs(i)%peak%channel_id)) then - allocate(obs(i)%peak%channel_id(obs(i)%peak%Nc)) +! if(.not.allocated(obs(i)%peak%channel_id)) then +! allocate(obs(i)%peak%channel_id(obs(i)%peak%Nc)) +! endif +! obs(i)%peak%channel_id(:) = obs(i)%table%channel_id(:) + if(.not.allocated(obs(i)%peak%channel_p_id)) then + allocate(obs(i)%peak%channel_p_id(obs(i)%peak%Nc)) + endif + obs(i)%peak%channel_p_id(:) = obs(i)%table%channel_p_id(:) + if(.not.allocated(obs(i)%peak%channel_d_id)) then + allocate(obs(i)%peak%channel_d_id(obs(i)%peak%Nc)) endif - obs(i)%peak%channel_id(:) = obs(i)%table%channel_id(:) + obs(i)%peak%channel_d_id(:) = obs(i)%table%channel_d_id(:) if(.not.allocated(obs(i)%peak%channel_eff)) then allocate(obs(i)%peak%channel_eff(obs(i)%peak%Nc)) endif obs(i)%peak%channel_eff(:) = obs(i)%table%channel_eff(:) if(.not.allocated(obs(i)%peak%channel_mu)) then allocate(obs(i)%peak%channel_mu(obs(i)%peak%Nc)) endif if(.not.allocated(obs(i)%peak%channel_w_model)) then allocate(obs(i)%peak%channel_w_model(obs(i)%peak%Nc)) endif if(.not.allocated(obs(i)%peak%channel_w)) then allocate(obs(i)%peak%channel_w(obs(i)%peak%Nc)) endif if(.not.allocated(obs(i)%peak%channel_w_corrected_eff)) then allocate(obs(i)%peak%channel_w_corrected_eff(obs(i)%peak%Nc)) endif if(.not.allocated(obs(i)%peak%channel_systSM)) then allocate(obs(i)%peak%channel_systSM(obs(i)%peak%Nc)) endif if(.not.allocated(obs(i)%peak%channel_syst)) then allocate(obs(i)%peak%channel_syst(obs(i)%peak%Nc)) endif do j=1,obs(i)%peak%Nc obs(i)%peak%channel_mu(j)=0.0D0 obs(i)%peak%channel_w(j)=0.0D0 obs(i)%peak%channel_w_corrected_eff(j)=0.0D0 obs(i)%peak%channel_w_model(j)=0.0D0 obs(i)%peak%channel_systSM(j)=0.0D0 obs(i)%peak%channel_syst(j)=0.0D0 enddo endif enddo end subroutine setup_peak_observables !-------------------------------------------------------------------- subroutine read_mutable(t1,skip,col,fullfilename) !-------------------------------------------------------------------- !--------------------------------------input type(mutable) :: t1 integer :: skip,col character(LEN=*) :: fullfilename !-----------------------------------internal integer :: i,n , file_id_1 double precision :: xdummy,xdummy_store !------------------------------------------- file_id_1 = 666 t1%mu=-1.0D0 open(file_id_1, file=(trim(fullfilename))) do i=1,skip read(file_id_1,*) !skip lines enddo xdummy_store = t1%xmin-t1%sep do i=1,t1%nx read(file_id_1,*)xdummy,(t1%mu(i,n),n=1,3) ! checks that x are evenly spaced as expected if((abs(xdummy-xdummy_store-t1%sep).gt.1.0D-7) & & .or.(abs(xdummy-(t1%xmin+dble(i-1)*t1%sep)).gt.1.0D-7))then !! write(*,*)i,t1%id,xdummy,t1%xmin+dble(i-1)*t1%sep write(*,*) "Problem with observable ",t1%id stop 'error in read_mutable (a1)' endif t1%mass(i) = xdummy !! write(*,*) xdummy xdummy_store=xdummy enddo if(abs(xdummy-t1%xmax).gt.1.0D-7)stop 'error in read_mutable (a2)' close(file_id_1) end subroutine read_mutable !-------------------------------------------------------------------- subroutine setup_tablelist !-------------------------------------------------------------------- implicit none integer,allocatable :: tableid(:) integer :: i,j,k,n, ntab, firstpeak_index logical :: tabused, tab_taken_from_mpredobs allocate(tableid(size(obs,dim=1))) do i=lbound(tableid,dim=1),ubound(tableid,dim=1) tableid(i)=-1 enddo ntab=0 do i=lbound(obs,dim=1),ubound(obs,dim=1) tabused=.False. do k=lbound(tableid,dim=1),ubound(tableid,dim=1) if(obs(i)%table%id.eq.tableid(k)) tabused=.True. enddo if(.not.tabused) then ntab=ntab+1 !--Fill first element which is -1 with the table id do k=lbound(tableid,dim=1),ubound(tableid,dim=1) if(tableid(k).eq.-1) then tableid(k)=obs(i)%table%id exit endif enddo endif enddo if(allocated(analyses)) deallocate(analyses) allocate(analyses(ntab)) do i=lbound(analyses,dim=1),ubound(analyses,dim=1) analyses(i)%id = tableid(i) !--Find observables based on this table n=0 do j=lbound(obs,dim=1),ubound(obs,dim=1) if(analyses(i)%id.eq.obs(j)%table%id) then !----Check if it is a peak observable if(obs(j)%obstype.eq.1) then n=n+1 endif endif enddo allocate(analyses(i)%peaks(n)) analyses(i)%Npeaks=n n=0 firstpeak_index=0 tab_taken_from_mpredobs=.False. do j=lbound(obs,dim=1),ubound(obs,dim=1) if(analyses(i)%id.eq.obs(j)%table%id) then !----Check if it is a peak observable if(obs(j)%obstype.eq.1) then n=n+1 analyses(i)%peaks(n) = obs(j)%peak analyses(i)%peaks(n)%Higgses = obs(j)%Higgses allocate(analyses(i)%peaks(n)%channel_w_allH( & & size(obs(j)%table%channel_w,dim=1),size(obs(j)%table%channel_w,dim=2))) allocate(analyses(i)%peaks(n)%channel_w_corrected_eff_allH( & & size(obs(j)%table%channel_w_corrected_eff,dim=1), & & size(obs(j)%table%channel_w_corrected_eff,dim=2))) allocate(analyses(i)%peaks(n)%channel_systSM_allH( & & size(obs(j)%table%channel_systSM,dim=1),size(obs(j)%table%channel_systSM,dim=2))) allocate(analyses(i)%peaks(n)%channel_syst_allH( & & size(obs(j)%table%channel_syst,dim=1),size(obs(j)%table%channel_syst,dim=2))) allocate(analyses(i)%peaks(n)%channel_mu_allH( & & size(obs(j)%table%channel_mu,dim=1),size(obs(j)%table%channel_mu,dim=2))) analyses(i)%peaks(n)%channel_w_allH = obs(j)%table%channel_w analyses(i)%peaks(n)%channel_w_corrected_eff_allH = obs(j)%table%channel_w_corrected_eff analyses(i)%peaks(n)%channel_systSM_allH = obs(j)%table%channel_systSM analyses(i)%peaks(n)%channel_syst_allH = obs(j)%table%channel_syst analyses(i)%peaks(n)%channel_mu_allH = obs(j)%table%channel_mu if(n.eq.1) firstpeak_index=j elseif(obs(j)%obstype.eq.2) then analyses(i)%table = obs(j)%table if(.not.allocated(analyses(i)%Higgses)) then allocate(analyses(i)%Higgses(size(obs(j)%Higgses,dim=1))) endif analyses(i)%Higgses = obs(j)%Higgses do k=lbound(analyses(i)%Higgses,dim=1),ubound(analyses(i)%Higgses,dim=1) analyses(i)%Higgses(k)%mp_test=1 enddo tab_taken_from_mpredobs = .True. endif endif enddo !-If we did not find a mpred observable, take the table from the first peak observable if(.not.tab_taken_from_mpredobs) then if(firstpeak_index.gt.0) then analyses(i)%table=obs(firstpeak_index)%table if(.not.allocated(analyses(i)%Higgses)) then allocate(analyses(i)%Higgses(size(obs(firstpeak_index)%Higgses,dim=1))) endif analyses(i)%Higgses=obs(firstpeak_index)%Higgses endif endif enddo deallocate(tableid) end subroutine setup_tablelist !-------------------------------------------------------------------- subroutine setup_observables !-------------------------------------------------------------------- use usefulbits, only : debug,np,not_a_particle implicit none !-----------------------------------internal integer :: i,c, nobs call initialize_observables call setup_peak_observables !n.b.: setup of mpred observables will be done during the run. do i=lbound(obs,dim=1),ubound(obs,dim=1) if( count(obs%id.eq.obs(i)%id).ne.1)then write(*,*)'the observable id',obs(i)%id,'is repeated' stop 'error in setup_observables (c1)' endif enddo !check to make sure that obs(i)%mutable%particle_x are all particles do i=lbound(obs,dim=1),ubound(obs,dim=1) if(obs(i)%table%particle_x.eq.not_a_particle)then write(*,*)obs(i)%id,'particle_x=not_a_particle.' stop 'error in setup_observables (d1)' endif enddo end subroutine setup_observables !-------------------------------------------------------------------- subroutine setup_LHC_Run1_combination !-------------------------------------------------------------------- use usefulbits, only : file_id_common3 use usefulbits_HS, only : LHCrun1_rates, LHCrun1_correlationmatrix use store_pathname_HS integer :: ios, n, skip, i,j, id double precision :: r, r_low, r_up, dble_tmp character(LEN=100) :: string_tmp skip =3 open(file_id_common3, file=trim(adjustl(pathname_HS))//'Expt_tables/'// & & 'LHC_combination_Run1/LHC_comb_Run1.exp') n=0 do n = n+1 if(n.le.skip) then read(file_id_common3,*, iostat=ios) else read(file_id_common3,*, iostat=ios) id, r_low, r, r_up if(ios.ne.0) exit LHCrun1_rates(n-skip)%channel_id = id LHCrun1_rates(n-skip)%r_low = r_low LHCrun1_rates(n-skip)%r = r LHCrun1_rates(n-skip)%r_up = r_up LHCrun1_rates(n-skip)%dr_low = LHCrun1_rates(n-skip)%r - LHCrun1_rates(n-skip)%r_low LHCrun1_rates(n-skip)%dr_up = LHCrun1_rates(n-skip)%r_up - LHCrun1_rates(n-skip)%r endif enddo close(file_id_common3) skip =0 n = 0 open(file_id_common3, file=trim(adjustl(pathname_HS))//'Expt_tables/'// & & 'LHC_combination_Run1/LHC_comb_Run1.corr') do n = n+1 if(n.le.skip) then read(file_id_common3,*, iostat=ios) else read(file_id_common3,*, iostat=ios) i, j, dble_tmp if(ios.ne.0) exit LHCrun1_correlationmatrix(i,j) = dble_tmp endif enddo do i=1,20 do j=1,20 if(LHCrun1_correlationmatrix(i,j).ne.LHCrun1_correlationmatrix(j,i)) then write(*,*) i, j, LHCrun1_correlationmatrix(i,j),LHCrun1_correlationmatrix(j,i) endif enddo enddo end subroutine setup_LHC_Run1_combination !-------------------------------------------------------------------- subroutine check_available_Higgses(ii) !-------------------------------------------------------------------- implicit none integer, intent(in) :: ii integer :: i,j if(.not.allocated(analyses)) then stop "Error in subroutine check_available_Higgses: analyses not allocated." endif do i=lbound(analyses(ii)%peaks,dim=1),ubound(analyses(ii)%peaks,dim=1) do j=lbound(analyses(ii)%peaks(i)%Higgs_comb,dim=1), & & ubound(analyses(ii)%peaks(i)%Higgs_comb,dim=1) if(analyses(ii)%peaks(i)%Higgs_comb(j).ne.0) then analyses(ii)%Higgses(analyses(ii)%peaks(i)%Higgs_comb(j))%mp_test=0 endif enddo enddo end subroutine check_available_Higgses !-------------------------------------------------------------------- subroutine interpolate_mutable(value, mh_in, mutab, steps) ! Returns interpolated values for the signal strength (lower, central, upper value) ! for the given mass mh_in of mutable mutab. "steps" defines the number of interpolation ! steps. !-------------------------------------------------------------------- implicit none double precision, dimension(3), intent(out) :: value double precision, intent(in) :: mh_in type(mutable), intent(in) :: mutab integer, intent(in) :: steps integer :: i,j, imin, imax double precision :: subsep, mh, closestdistance, mh_closest double precision, dimension(3) :: mu if(mh_in.ge.mutab%xmax) then value(:) = mutab%mu(ubound(mutab%mu,dim=1),:) else if(mh_in.le.mutab%xmin) then value(:) = mutab%mu(lbound(mutab%mu,dim=1),:) else imin = int((mh_in-mutab%xmin)/mutab%sep)+1 subsep = mutab%sep/steps closestdistance = 1000000.0D0 mh = mutab%mass(imin) do j=1, steps mh = mh + subsep mu(:) = mutab%mu(imin,:) + (mutab%mu(imin+1,:)-mutab%mu(imin,:))*j/steps if(abs(mh-mh_in).le.closestdistance) then closestdistance = abs(mh-mh_in) mh_closest = mh value = mu endif enddo endif end subroutine interpolate_mutable !-------------------------------------------------------------------- subroutine deallocate_observables !-------------------------------------------------------------------- implicit none integer :: x if(allocated(obs)) then do x=lbound(obs,dim=1),ubound(obs,dim=1) deallocate(obs(x)%table%mu) deallocate(obs(x)%table%mass) deallocate(obs(x)%table%channel_mu) - deallocate(obs(x)%table%channel_id) + deallocate(obs(x)%table%channel_id_str) +! deallocate(obs(x)%table%channel_id) + deallocate(obs(x)%table%channel_p_id) + deallocate(obs(x)%table%channel_d_id) deallocate(obs(x)%table%channel_systSM) deallocate(obs(x)%table%channel_syst) deallocate(obs(x)%table%channel_w) deallocate(obs(x)%table%channel_w_corrected_eff) deallocate(obs(x)%table%channel_eff) deallocate(obs(x)%table%channel_eff_ratios) deallocate(obs(x)%table%channel_description) if(allocated(obs(x)%table%Toys_mhobs)) deallocate(obs(x)%table%Toys_mhobs) if(allocated(obs(x)%table%Toys_muobs)) deallocate(obs(x)%table%Toys_muobs) if(allocated(obs(x)%peak%Higgs_comb)) then deallocate(obs(x)%peak%Higgs_comb) deallocate(obs(x)%peak%Higgses) - deallocate(obs(x)%peak%channel_id) +! deallocate(obs(x)%peak%channel_id) + deallocate(obs(x)%peak%channel_p_id) + deallocate(obs(x)%peak%channel_d_id) deallocate(obs(x)%peak%channel_eff) deallocate(obs(x)%peak%channel_mu) deallocate(obs(x)%peak%channel_w_model) deallocate(obs(x)%peak%channel_w) deallocate(obs(x)%peak%channel_w_corrected_eff) deallocate(obs(x)%peak%channel_systSM) deallocate(obs(x)%peak%channel_syst) endif if(allocated(obs(x)%Higgses)) deallocate(obs(x)%Higgses) enddo deallocate(obs) endif end subroutine deallocate_observables !-------------------------------------------------------------------- end module datatables !-------------------------------------------------------------------- \ No newline at end of file Index: trunk/HiggsSignals-2/io.f90 =================================================================== --- trunk/HiggsSignals-2/io.f90 (revision 568) +++ trunk/HiggsSignals-2/io.f90 (revision 569) @@ -1,1113 +1,1114 @@ !-------------------------------------------------------------------- ! This file is part of HiggsSignals (TS 03/03/2013) !-------------------------------------------------------------------- module io !-------------------------------------------------------------------- use usefulbits, only : Hneut,Hplus,Chineut,Chiplus use input, only : count_columns, getfilelength, stem_array, required, f_orig implicit none contains !-------------------------------------------------------------------- subroutine setup_input_for_hs !-------------------------------------------------------------------- ! * if inputmethod='datfile' finds np,Exptdata ! * if inputmethod='datfile', finds infile1 (prefix for input/output filenames) ! * sets ndat (number of parameter points considered) ! * sets n_additional (number of additional data values for each parameter point) ! * allocates theo, g2, partR !-------------------------------------------------------------------- use usefulbits, only : np,ndat,n_additional,theo,effC,g2,partR, & & inputmethod,whichinput, & & debug,infile1,infile2, & & allocate_hadroncolliderextras_parts,allocate_dataset_parts, & & allocate_couplratio_parts,allocate_sqcouplratio_parts,fill_pdesc use input, only : getshortcommandline,check_number_of_particles, fill_stem_array, & & file_name_msg use theory_BRfunctions implicit none !-----------------------------------internal integer :: f,ios,cc,g character(LEN=50) :: stem !------------------------------------------- call fill_pdesc select case(inputmethod) case('datfile') call getbasiccommandline_for_hs!get whichanalyses,whichinput,numbers of particles call getshortcommandline(infile1,infile2)! get infile1 case('subrout') !np(Hneut),np(Hplus) are already set call check_number_of_particles ! call check_whichanalyses !haven't yet set whichanalyses,whichinput infile1='' case default stop'incorrect value for inputmethod' end select !getting ndat and n_additional... select case(inputmethod) case('datfile') f=f_orig n_additional=0 select case(whichinput) case('part','effC','hadr') call fill_stem_array g=1 stem=stem_array(g) f=f_orig+g open(f,file=trim(infile1)//trim(stem)//'.dat',status='old',action='read',iostat=ios) if(ios.ne.0)then call file_name_msg(f) write(*,*)'Check that was specified correctly' write(*,*)'and that file exists.' call flush(6) stop'Problem opening file: see standard output for more info' endif ndat=getfilelength(f) ! number of data sets (i.e. lines) in input if((ndat.le.0))stop 'error getting ndat' close(f) g=ubound(stem_array,dim=1) stem=stem_array(g) f=f_orig+g !the last element in stem_array should be 'additional' if(trim(stem_array(g)).ne.'additional')stop'Error in subroutine setup_input (a)' required(g)=.False. open(f,file=trim(infile1)//trim(stem)//'.dat',status='old',action='read',iostat=ios) if(ios.eq.0)then cc=count_columns(f) if(cc.gt.1)then if(getfilelength(f).eq.ndat)then n_additional=cc-1 required(g)=.True. endif endif endif close(f) case('SLHA') ndat=1 ; n_additional=0 case default stop'error in subroutine do_input (1a)' end select case('website','subrout') ndat=1 ; n_additional=0 case default stop'error in subroutine do_input (1b)' end select !...finished getting ndat and n_additional if(debug)then write(*,*)'np(Hneut)=',np(Hneut) write(*,*)'ndat=',ndat write(*,*)'n_additional=',n_additional endif allocate(theo(ndat)) call allocate_dataset_parts(theo,n_additional) ! - Outdated: allocate(g2(ndat)) call allocate_sqcouplratio_parts(g2) ! - allocate(effC(ndat)) call allocate_couplratio_parts(effC) allocate(partR(ndat)) call allocate_hadroncolliderextras_parts(partR) end subroutine setup_input_for_hs !-------------------------------------------------------------------- subroutine getbasiccommandline_for_hs !-------------------------------------------------------------------- ! finds whichanalyses,whichinput,np from command line !-------------------------------------------------------------------- !nb iargc and getarg are non-standard use usefulbits, only : np,pdesc,whichinput,inputmethod use usefulbits_hs, only : Exptdir, runmode, pdf use input, only : check_number_of_particles, check_whichinput, nargs_datfile implicit none !-----------------------------------internal character(LEN=100) :: temp character(LEN=5) :: nHtemp, pdftemp integer :: i,x integer :: number_args logical :: wrong_args !------------------------------------------- number_args = IARGC() !Exptdir, runmode, pdf, whichinput, np(Hneut), np(Hplus) , prefix nargs_datfile = 4+ 2 +1 np(Chineut)=0 np(Chiplus)=0 wrong_args= (number_args .ne. nargs_datfile) if( wrong_args )then write(*,*) "Incorrect number of parameters given on command line" call command_line_how2_for_hs stop "Error: command line entered incorrectly (see standard output for more info)" endif ! Read arguments into text strings. i=1 temp="" call GETARG(i,temp) Exptdir = "" Exptdir = trim(temp) i=i+1 temp="" call GETARG(i,temp) runmode = "" runmode = trim(temp) i=i+1 temp="" call GETARG(i,temp) pdftemp = "" pdftemp = trim(temp) i=i+1 if(verify(pdftemp," 1234567890").gt.0)then ! checks that the string nHtemp just contains the characters " 1234567890" ! the function verify is standard in fortran 95 write(*,*)'Incorrect pdf: not a number.' write(*,*)'(you entered pdf="'//trim(adjustl(pdftemp))//'")' call command_line_how2_for_hs stop "Error: command line entered incorrectly (see standard output for more info)" endif read(pdftemp,*) pdf temp="" call GETARG(i,temp) whichinput = "" whichinput = trim(temp) i=i+1 do x=1,2 temp="" call GETARG(i,temp) nHtemp = "" nHtemp = trim(temp) i=i+1 if(verify(nHtemp," 1234567890").gt.0)then ! checks that the string nHtemp just contains the characters " 1234567890" ! the function verify is standard in fortran 95 write(*,*)'Incorrect n'//trim(adjustl(pdesc(x)%short))//': not a number.' write(*,*)'(you entered n'//trim(adjustl(pdesc(x)%short))//& & '="'//trim(adjustl(nHtemp))//'")' write(*,*)'n'//trim(adjustl(pdesc(x)%short))//' is the number of '//& & trim(adjustl(pdesc(x)%long))//'s' call command_line_how2_for_hs stop "Error: command line entered incorrectly (see standard output for more info)" endif read(nHtemp,*) np(x) enddo call check_number_of_particles call check_whichinput end subroutine getbasiccommandline_for_hs !-------------------------------------------------------------------- subroutine command_line_how2_for_hs !-------------------------------------------------------------------- use usefulbits, only : np,inputmethod write(*,*)'The correct syntax for the command line is:' write(*,*)' ./HiggsSignals ',& & ' ' write(*,*)'e.g.' write(*,*)' ./HiggsSignals latestresults peak 2 part 3 1 example_data/random/HB_randomtest50points_' write(*,*)'See HiggsSignals manual for more details.' call flush(6) end subroutine command_line_how2_for_hs !-------------------------------------------------------------------- subroutine do_output_for_hs ! Writes output to file or screen, depending on whether ! inputmethod='datfile' or inputmethod='website' !-------------------------------------------------------------------- use usefulbits, only : theo,ndat,inputmethod,np,fullHBres, & & n_additional, file_id_common, file_id_common2, & !input & whichanalyses,whichinput,pr,listprocesses,infile1 use usefulbits_hs, only : analyses, StrCompress, pdf, runmode, HSres, HSvers, Exptdir,& & Nparam ! use extra_bits_for_web ! use S95tables ! use extra_bits_for_SLHA implicit none !-----------------------------------internal integer :: i,j,ii,jj,x,n,n_sum,kk character(LEN=1) :: nHchar character(LEN=3) :: addchar,tempchar character(LEN=8) :: createdate character(LEN=10) :: createtime character(LEN=19) :: createdateandtime character(LEN=100) :: format43 character(LEN=500) :: columndescription type(listprocesses) :: proc character(LEN=200):: descrip double precision, allocatable :: Mhall(:,:) character(LEN=100) :: formatspec character(LEN=13) :: pdf_desc(3) = (/'box ','gaussian ','box+gaussian'/) !------------------------------------------- select case(inputmethod) case('datfile') select case(whichinput) case('SLHA') call HiggsSignals_outputSLHAdata(infile1) case('effC','part','hadr') if((np(Hneut)>0).or.(np(Hplus)>0))then allocate(Mhall(ndat,np(Hneut)+np(Hplus))) do jj=1,ndat ii=0 if(np(Hneut)>0)then do i=1,np(Hneut) Mhall(jj,i)=theo(jj)%particle(Hneut)%M(i) enddo ii=np(Hneut) endif if(np(Hplus)>0)then do i=1,np(Hplus) Mhall(jj,ii+i)=theo(jj)%particle(Hplus)%M(i) enddo endif enddo else stop'error in subroutine do_output(1)' endif format43='(1I14,' write(nHchar,'(I1)')np(Hneut) if(np(Hneut)>0)format43=trim(adjustl(format43))//nHchar//'G16.6,' write(nHchar,'(I1)')np(Hplus) if(np(Hplus)>0)format43=trim(adjustl(format43))//nHchar//'G16.6,' format43=trim(adjustl(format43))//'3G16.6,3I6,1G16.6' write(addchar,'(I3)')n_additional if(n_additional>0)format43=trim(adjustl(format43))//','//trim(adjustl(addchar))//'G16.6' format43=trim(adjustl(format43))//')' open(file_id_common,file=trim(infile1)//"HiggsSignals_results.dat") if(runmode.eq.'peak'.or.runmode.eq.'both') then open(file_id_common2,file=trim(infile1)//"peakobservables.dat") endif call date_and_time(createdate,createtime) createdateandtime=createdate(7:8)//'.' & & //createdate(5:6)//'.' & & //createdate(1:4)//' at '& & //createtime(1:2)//':' & & //createtime(3:4) write(file_id_common,*)'# generated with HiggsSignals version '//& & trim(adjustl(HSvers))//' on '//createdateandtime write(file_id_common,*)'# settings: '//adjustl(trim(Exptdir))//', '//whichinput//', '& & //runmode//', '//adjustl(trim(pdf_desc(pdf))) write(file_id_common,*)'#' write(file_id_common,*)'# column abbreviations' write(file_id_common,*)'# n : line id of input' if(np(Hneut)>0)write(file_id_common,*)'# Mh(i) : ',& & 'Neutral Higgs boson masses in GeV' if(np(Hplus)>0)write(file_id_common,*)'# Mhplus(i) : ',& & 'Charged Higgs boson masses in GeV' write(file_id_common,*)'# csq(mu) : Chi^2 from the signal strengths observables' write(file_id_common,*)'# csq(mh) : Chi^2 from the Higgs mass observables' write(file_id_common,*)'# csq(tot) : total Chi^2' write(file_id_common,*)'# nobs(mu) : number of signal strength observables' write(file_id_common,*)'# nobs(mh) : number of Higgs mass observables' write(file_id_common,*)'# nobs(tot) : total number of observables' write(file_id_common,"(A,I3)")'# Pvalue : Probability, given csq(tot) and ndf=nobs(tot)-',Nparam if(n_additional>0)then write(file_id_common,*)'# additional : ',& & 'optional additional data stored in additional.dat (e.g. tan beta)' endif write(file_id_common,*)'#' if(runmode.eq.'peak'.or.runmode.eq.'both') then formatspec='(I3,8X,I10,3X,F6.2,1X,4F9.4,7X,A3,6X,F6.2,5X,F6.2,3X,I3,3X,A40,5X,A)' write(file_id_common2,*) "# List of peak observables used from " & & //trim(adjustl(Exptdir))//":" write(file_id_common2,*)'#' write(file_id_common2,*)'# Number : HS internal numbering of analysis' write(file_id_common2,*)'# Analysis-ID : identity number of analysis' write(file_id_common2,*)'# mh_obs : Mass position of peak observable',& & ' (hypothetical Higgs mass where signal strength was measured)' write(file_id_common2,*)'# mu_obs : Observed (best-fit) signal strength value' write(file_id_common2,*)'# dmu_low : Lower 1s (cyan band) signal strength value' write(file_id_common2,*)'# dmu_high : Upper 1s (cyan band) signal strength value' write(file_id_common2,*)'# dmh_exp : Experimental mass uncertainty of analysis' write(file_id_common2,*)'# collaboration : ',& & 'Exp. collaboration which published the data' write(file_id_common2,*)'# energy : ',& & 'center-of-mass energy of the experiment (TeV)' write(file_id_common2,*)'# luminosity : ',& & 'integrated luminosity used for the measurement (fb-1)' write(file_id_common2,*)'# mass-chi2 : ',& & 'Mass measurement entering the Chi^2 (1/0=yes/no)' write(file_id_common2,*)'# description : Higgs process of analysis' write(file_id_common2,*)'# reference : ',& & 'Experimental publication of the data/analysis' write(file_id_common2,*)'#' write(file_id_common2,*)'# Number Analysis-ID mh_obs mu_obs dmu_low dmu_high ',& & " dmh_exp collaboration energy luminosity mass-chi2 ", & & " description reference" write(file_id_common2,*) "#" kk=0 do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do j=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) kk=kk+1 write(file_id_common2,formatspec)kk,analyses(i)%id,analyses(i)%peaks(j)%mpeak,& & analyses(i)%peaks(j)%mu, analyses(i)%peaks(j)%dmulow,analyses(i)%peaks(j)%dmuup, & & analyses(i)%table%deltam,analyses(i)%table%collaboration, analyses(i)%table%energy,& & analyses(i)%table%lumi, analyses(i)%table%mhchisq, & & trim(strcompress(analyses(i)%table%desc)), analyses(i)%table%label enddo enddo close(file_id_common2) endif columndescription='#cols: n' if(np(Hneut)>0)then do i=1,np(Hneut) write(tempchar,'(I3)')i columndescription=trim(columndescription)//' Mh('//& & trim(adjustl(tempchar))//') ' enddo endif if(np(Hplus)>0)then do i=1,np(Hplus) write(tempchar,'(I3)')i columndescription=trim(columndescription)//' Mhplus('// & & trim(adjustl(tempchar))//') ' enddo endif columndescription=trim(columndescription)//' csq(mu) csq(mh) '//& & ' csq(tot) nobs(mu) nobs(mh) nobs(tot) Pvalue' if(n_additional>0)then do i=1,n_additional write(tempchar,'(I3)')i columndescription=trim(columndescription)//' additional('// & & trim(adjustl(tempchar))//') ' enddo endif write(file_id_common,*)trim(columndescription) write(file_id_common,*)'#' if(n_additional>0)then do jj=1,ndat write(file_id_common,fmt=trim(format43))jj,(Mhall(jj,i),i=1,np(Hneut)+np(Hplus)), & & HSres(jj)%Chisq_mu,HSres(jj)%Chisq_mh,HSres(jj)%Chisq, & & HSres(jj)%nobs_mpred+HSres(jj)%nobs_peak_mu,HSres(jj)%nobs_peak_mh, & & HSres(jj)%nobs,HSres(jj)%Pvalue,(theo(jj)%additional(i),i=1,n_additional) enddo else do jj=1,ndat write(file_id_common,fmt=trim(format43))jj,(Mhall(jj,i),i=1,np(Hneut)+np(Hplus)), & & HSres(jj)%Chisq_mu,HSres(jj)%Chisq_mh,HSres(jj)%Chisq, & & HSres(jj)%nobs_mpred+HSres(jj)%nobs_peak_mu,HSres(jj)%nobs_peak_mh, & & HSres(jj)%nobs,HSres(jj)%Pvalue enddo endif close(file_id_common) deallocate(Mhall) case default stop'error in subroutine do_output (*2)' end select ! case('website') ! do jj=1,ndat !-----NOTE: Need to change weboutput in extra_bits_for_web for the new all-Higgses mode!!! ! call weboutput(res(jj)) ! enddo case('subrout') select case(whichinput) case('SLHA') call HiggsSignals_outputSLHAdata(infile1) case default stop'error in subroutine do_output(c)' end select case default stop'error in subroutine do_output (*1)' end select end subroutine do_output_for_hs !-------------------------------------------------------------------- subroutine setup_output_for_hs !-Allocates the HBresults array. !-------------------------------------------------------------------- use usefulbits, only : ndat !input use usefulbits_hs, only : HSres !input implicit none allocate(HSres(ndat)) end subroutine setup_output_for_hs !-------------------------------------------------------------------- subroutine get_ID_of_peakobservable(ii, ID) use usefulbits_hs, only : HSres implicit none integer, intent(in) :: ii integer, intent(out) :: ID if(ii.gt.size(HSres(1)%obsID,dim=1).or.ii.le.0) then write(*,*) 'WARNING in get_peakinfo_from_HSresults: Peak observable ', & & ii,' unkwown! Returning zero.' ID = 0 else ID = HSres(1)%obsID(ii) endif end subroutine get_ID_of_peakobservable !-------------------------------------------------------------------- subroutine get_peakinfo(obsID, muobs, dmuup, dmulow, mpeak, dm) !-------------------------------------------------------------------- use usefulbits_hs, only : obs implicit none integer, intent(in) :: obsID double precision, intent(out) :: muobs, dmuup, dmulow, mpeak, dm integer :: pos, ii pos = -1 do ii=lbound(obs,dim=1),ubound(obs,dim=1) if(obs(ii)%id.eq.obsID) then pos = ii exit endif enddo if(pos.ne.-1) then mpeak = obs(pos)%peak%mpeak dm = obs(pos)%peak%dm muobs = obs(pos)%peak%mu dmuup = obs(pos)%peak%dmuup dmulow = obs(pos)%peak%dmulow else write(*,*) "WARNING in get_peakinfo: ID unknown." endif end subroutine get_peakinfo !-------------------------------------------------------------------- subroutine get_more_peakinfo(obsID, mhchisq) !-------------------------------------------------------------------- use usefulbits_hs, only : obs implicit none integer, intent(in) :: obsID integer, intent(out) :: mhchisq integer :: pos, ii pos = -1 do ii=lbound(obs,dim=1),ubound(obs,dim=1) if(obs(ii)%id.eq.obsID) then pos = ii exit endif enddo if(pos.ne.-1) then mhchisq = obs(pos)%table%mhchisq else write(*,*) "WARNING in get_peakinfo: ID unknown." endif end subroutine get_more_peakinfo !-------------------------------------------------------------------- -subroutine get_peak_channels(obsID, Nc, IDs, efficiencies) +subroutine get_peak_channels(obsID, Nc, pIDs, dIDs, efficiencies) !-------------------------------------------------------------------- use usefulbits_hs, only : obs implicit none integer, intent(in) :: obsID integer, intent(out) :: Nc - integer, allocatable, intent(out) :: IDs(:) + integer, allocatable, intent(out) :: pIDs(:), dIDs(:) double precision, allocatable, intent(out) :: efficiencies(:) integer :: pos, ii pos = -1 do ii=lbound(obs,dim=1),ubound(obs,dim=1) if(obs(ii)%id.eq.obsID) then pos = ii exit endif enddo if(pos.ne.-1) then Nc = obs(pos)%table%Nc - allocate(IDs(Nc),efficiencies(Nc)) - IDs = obs(pos)%table%channel_id + allocate(pIDs(Nc),dIDs(Nc),efficiencies(Nc)) + pIDs = obs(pos)%table%channel_p_id + dIDs = obs(pos)%table%channel_d_id efficiencies = obs(pos)%table%channel_eff else write(*,*) "WARNING in get_peakinfo: ID unknown." endif end subroutine get_peak_channels !-------------------------------------------------------------------- subroutine get_peakinfo_from_HSresults(obsID, mupred, domH, nHcomb) !-------------------------------------------------------------------- use usefulbits_hs, only : HSres implicit none integer, intent(in) :: obsID double precision, intent(out) :: mupred integer, intent(out) :: domH, nHcomb integer :: pos, ii pos = -1 do ii=lbound(HSres(1)%nH,dim=1),ubound(HSres(1)%nH,dim=1) if(obsID.eq.HSres(1)%obsID(ii)) then pos = ii exit endif enddo if(pos.ne.-1) then mupred = HSres(1)%mupred(ii) domH = HSres(1)%domH(ii) nHcomb = HSres(1)%nH(ii) else write(*,*) 'WARNING in get_peakinfo_from_HSresults: Peak observable ', & & obsID,' unkwown! Returning zeros.' mupred = 0.0D0 domH = 0 nHcomb = 0 endif end subroutine get_peakinfo_from_HSresults !-------------------------------------------------------------------- subroutine get_number_of_observables(ntotal, npeakmu, npeakmh, nmpred, nanalyses) !-------------------------------------------------------------------- use usefulbits_hs, only : HSres implicit none integer, intent(out) :: ntotal, npeakmu, npeakmh, nmpred, nanalyses ntotal = HSres(1)%nobs npeakmu = HSres(1)%nobs_peak_mu npeakmh = HSres(1)%nobs_peak_mh nmpred = HSres(1)%nobs_mpred nanalyses = HSres(1)%nanalysis end subroutine get_number_of_observables !-------------------------------------------------------------------- subroutine HiggsSignals_SLHA_output(detailed) !-------------------------------------------------------------------- use usefulbits, only : whichinput,just_after_run use usefulbits_hs, only : SLHAdetailed integer, intent(in) :: detailed if(detailed.eq.0) SLHAdetailed = .False. !use output, only : do_output !!!integer, intent(in) :: i if(.not.just_after_run)then stop'subroutine run_HiggsSignals should be called'//& ' before subroutine HiggsSignals_SLHA_output' endif select case(whichinput) case('SLHA') call do_HiggsSignals_output case default stop'The subroutine HiggsSignals_SLHA_output should'//& ' only be used if an input SLHA file is given.' end select end subroutine HiggsSignals_SLHA_output !-------------------------------------------------------------------- subroutine do_HiggsSignals_output !-------------------------------------------------------------------- use usefulbits, only : inputmethod,whichanalyses,whichinput,infile1 implicit none select case(inputmethod) case('datfile') select case(whichinput) case('SLHA') call HiggsSignals_outputSLHAdata(infile1) case default stop'error in subroutine do_output (*2)' end select case('subrout') select case(whichinput) case('SLHA') call HiggsSignals_outputSLHAdata(infile1) case default stop'error in subroutine do_output(c)' end select case default stop'error in subroutine do_output (*1)' end select end subroutine do_HiggsSignals_output !-------------------------------------------------------------------- subroutine HiggsSignals_create_SLHA_output_default(detailed) ! Wrapper subroutine of HiggsSignals_create_SLHA_output with a fixed ! name of output file ("HS-output.slha"). !-------------------------------------------------------------------- implicit none integer, intent(in) :: detailed call HiggsSignals_create_SLHA_output("HS-output.slha", detailed) end subroutine HiggsSignals_create_SLHA_output_default !-------------------------------------------------------------------- subroutine HiggsSignals_create_SLHA_output(infile, detailed) !-------------------------------------------------------------------- use usefulbits, only : just_after_run, file_id_common use usefulbits_hs, only : SLHAdetailed, newSLHAfile implicit none character(len=*),intent(in) :: infile integer, intent(in) :: detailed integer :: ios character(len=80) :: infile_80 if(detailed.eq.0) SLHAdetailed = .False. write(infile_80,*) infile if(trim(adjustl(infile_80)).ne.trim(adjustl(infile))) then write(*,*) "WARNING: SLHA output file name is too long (> 80 elements)!" endif if(.not.just_after_run)then stop'subroutine run_HiggsSignals should be called'//& ' before subroutine HiggsSignals_SLHA_output' endif open(unit=file_id_common,file=trim(adjustl(infile_80)),status='new',iostat=ios) if(ios.ne.0) then write(*,*) 'Problem creating the SLHA file: $'//trim(adjustl(infile))//'$' write(*,*) 'This file may already exist. SLHA output writing is skipped.' else close(file_id_common) newSLHAfile=.True. call HiggsSignals_outputSLHAdata(infile_80) newSLHAfile=.False. endif end subroutine HiggsSignals_create_SLHA_output !************************************************************ subroutine HiggsSignals_outputSLHAdata(infile) !************************************************************ use usefulbits, only : whichanalyses,file_id_common use extra_bits_for_SLHA, only : h use usefulbits_hs, only : HSvers, HSres, runmode, pdf, analyses, Exptdir, SLHAdetailed,& & newSLHAfile use SLHA_manip ! n.b.: needed for readSLHAfile, writeSLHAfile_except, finishwithSLHA implicit none !--------------------------------------input character(len=80),intent(in) :: infile !-----------------------------------internal integer :: i,j,ios,a integer :: k_out, Nh character(LEN=200):: descrip, formatstring !------------------------------------------- open(file_id_common,file=trim(adjustl(infile)),status='old',iostat=ios) if(ios.ne.0)then write(*,*)'problem opening the SLHA file: $'//trim(adjustl(infile))//'$' else k_out=file_id_common if(.not.newSLHAfile) then call readSLHAfile(file_id_common,.True.) rewind(file_id_common) call writeSLHAfile_except(k_out,'HiggsSignalsResults','HiggsSignalsPeakObservables',& & 'HiggsSignalsMassCenteredObservables') endif write(k_out,'(a)')'BLOCK HiggsSignalsResults' write(k_out,'(3X,I2,17X,A2,A,A2,15X,A)') 0,'||',trim(adjustl(HSvers)),'||', & & '# HiggsSignals version' write(k_out,'(3X,I2,9X,A2,A,A2,15X,A)')1,'||',trim(adjustl(Exptdir)),'||', & & '# experimental data set' select case(runmode) case('peak') write(k_out,'(3X,I2,25X,I1,15X,A)') 2,1, & & '# Chi-squared method ("peak"(1) or "mass"(2)-centered or "both"(3))' case('mass') write(k_out,'(3X,I2,25X,I1,15X,A)') 2,2, & & '# Chi-squared method ("peak"(1) or "mass"(2)-centered or "both"(3))' case('both') write(k_out,'(3X,I2,25X,I1,15X,A)') 2,3, & & '# Chi-squared method ("peak"(1) or "mass"(2)-centered or "both"(3))' end select write(k_out,'(3X,I2,11X,I15,15X,A)') 3,pdf, & & '# Parametrization of Higgs mass uncertainty (1:box, 2:gaussian, 3:box+gaussian)' write(k_out,'(3X,I2,11X,I15,15X,A)') 4,HSres(1)%nobs_peak_mu, & & '# Number of signal strength peak observables' write(k_out,'(3X,I2,11X,I15,15X,A)') 5,HSres(1)%nobs_STXS_rates, & & '# Number of simplified template cross section (STXS) signal rate observables' write(k_out,'(3X,I2,11X,I15,15X,A)') 6,HSres(1)%nobs_LHCRun1_mu, & & '# Number of LHC Run-1 signal rate observables' write(k_out,'(3X,I2,11X,I15,15X,A)') 7,HSres(1)%nobs_peak_mh + & & HSres(1)%nobs_LHCRun1_mh + HSres(1)%nobs_STXS_mh, & & '# Number of Higgs mass observables' ! write(k_out,'(3X,I2,11X,I15,15X,A)') 7,HSres(1)%nobs_mpred, & ! & '# Number of mass-centered observables' write(k_out,'(3X,I2,11X,I15,15X,A)') 8,HSres(1)%nobs, & & '# Number of observables (total)' write(k_out,'(3X,I2,11X,F15.8,15X,A)') 9,HSres(1)%Chisq_peak_mu, & & '# chi^2 from signal strength peak observables' write(k_out,'(3X,I2,11X,F15.8,15X,A)') 10,HSres(1)%Chisq_STXS_rates, & & '# chi^2 from STXS signal rate observables' write(k_out,'(3X,I2,11X,F15.8,15X,A)') 11,HSres(1)%Chisq_LHCRun1_mu, & & '# chi^2 from LHC Run-1 signal rate observables' write(k_out,'(3X,I2,11X,F15.8,15X,A)') 12,HSres(1)%Chisq_peak_mh, & & '# chi^2 from Higgs mass peak observables' write(k_out,'(3X,I2,11X,F15.8,15X,A)') 13,HSres(1)%Chisq_STXS_mh, & & '# chi^2 from STXS mass observables' write(k_out,'(3X,I2,11X,F15.8,15X,A)') 14,HSres(1)%Chisq_LHCRun1_mh, & & '# chi^2 from LHC Run-1 mass observables' ! write(k_out,'(3X,I2,11X,F15.8,15X,A)') 10,HSres(1)%Chisq_mpred, & ! & '# chi^2 from mass-centered observables' write(k_out,'(3X,I2,11X,F15.8,15X,A)') 15,HSres(1)%Chisq_mu, & & '# chi^2 from signal strength (total)' write(k_out,'(3X,I2,11X,F15.8,15X,A)') 16,HSres(1)%Chisq, '# chi^2 (total)' write(k_out,'(3X,I2,11X,F15.8,15X,A)') 17,HSres(1)%Pvalue_peak, & & '# Probability for peak observables' write(k_out,'(3X,I2,11X,F15.8,15X,A)') 18,HSres(1)%Pvalue_LHCRun1, & & '# Probability for LHC-Run1 observables' write(k_out,'(3X,I2,11X,F15.8,15X,A)') 19,HSres(1)%Pvalue_STXS, & & '# Probability for STXS observables' write(k_out,'(3X,I2,11X,F15.8,15X,A)') 20,HSres(1)%Pvalue, & & '# Probability (total chi^2, total number observables)' if(SLHAdetailed) then select case(runmode) case('peak') call writeSLHAblock_HiggsSignalsPeakObservables(k_out) case('mass') call writeSLHAblock_HiggsSignalsMassCenteredObservables(k_out) case('both') call writeSLHAblock_HiggsSignalsPeakObservables(k_out) call writeSLHAblock_HiggsSignalsMassCenteredObservables(k_out) case default end select endif SLHAdetailed=.True. close(file_id_common) if(k_out.ne.file_id_common)close(k_out) if(.not.newSLHAfile) then call finishwithSLHA endif endif end subroutine HiggsSignals_outputSLHAdata !-------------------------------------------------------------------- subroutine writeSLHAblock_HiggsSignalsPeakObservables(k_out) use usefulbits_hs, only : analyses, StrCompress use extra_bits_for_SLHA, only : h implicit none integer, intent(in) :: k_out integer :: i,j,a, Nh character(LEN=200):: formatstring write(k_out,'(a)')'BLOCK HiggsSignalsPeakObservables' write(k_out,'(A6,3X,A4,25X,A5,3X,A)')'# OBS','FLAG','VALUE','# DESCRIPTION' a=0 do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do j=lbound(analyses(i)%peaks,dim=1),ubound(analyses(i)%peaks,dim=1) a=a+1 Nh = size(analyses(i)%peaks(j)%Higgs_comb) write(k_out,'(3X,I3,4X,I2,1X,I30,3X,A)')a,1,analyses(i)%table%id,'# Analysis ID' write(k_out,'(3X,I3,4X,I2,5X,A2,A,A2,8X,A)')a,2,'||',trim(analyses(i)%table%label), & & '||','# Reference to publication' write(k_out,'(3X,I3,4X,I2,5X,A2,A,A2,6X,A)')a,3,'||', & & trim(strcompress(analyses(i)%table%desc)),'||','# Description (Search channel)' write(k_out,'(3X,I3,4X,I2,23X,F8.2,3X,A)')a,4,analyses(i)%table%energy, & & '# Center-of-mass energy' write(k_out,'(3X,I3,4X,I2,23X,F8.2,3X,A)')a,5,analyses(i)%table%lumi, & & '# Luminosity' write(k_out,'(3X,I3,4X,I2,23X,F8.2,3X,A)')a,6,analyses(i)%table%dlumi*100.0D0, & & '# Luminosity uncertainty (in %)' write(k_out,'(3X,I3,4X,I2,23X,F8.2,3X,A)')a,7,analyses(i)%table%deltam, & & '# Mass resolution (GeV)' write(k_out,'(3X,I3,4X,I2,23X,F8.2,3X,A)')a,8,analyses(i)%peaks(j)%mpeak, & & '# Mass value at peak position (in GeV)' write(k_out,'(3X,I3,4X,I2,23X,F8.4,3X,A)')a,9,analyses(i)%peaks(j)%mu, & & '# Observed signal strength modifier (mu)' write(k_out,'(3X,I3,4X,I2,23X,F8.4,3X,A)')a,10,analyses(i)%peaks(j)%dmulow, & & '# Lower 68%C.L. uncertainty on observed mu' write(k_out,'(3X,I3,4X,I2,23X,F8.4,3X,A)')a,11,analyses(i)%peaks(j)%dmuup, & & '# Upper 68%C.L. uncertainty on observed mu' ! write(k_out,'(3X,I3,4X,I2,23X,F8.4,3X,A)')a,12,analyses(i)%peaks(j)%dmulow0sq, & !& '# Intrinsic squared lower 68%C.L. cyan band value on observed mu (corrected by HS)' ! write(k_out,'(3X,I3,4X,I2,23X,F8.4,3X,A)')a,13,analyses(i)%peaks(j)%dmuup0sq, & !& '# Intrinsic squared upper 68%C.L. cyan band value on observed mu (corrected by HS)' ! write(formatstring,'(A13,I2,A2,I2,A8)') '(3X,I3,4X,I2,',31-1*Nh,'X,',Nh,'I1,3X,A)' ! write(k_out,formatstring) a,12,analyses(i)%peaks(j)%Higgs_comb, & !& '# Higgs combination (= indices of Higgs bosons which have been used)' write(formatstring,'(A13,I2,A3,I1,A1,I1,A6)') & & '(3X,I3,4X,I2,',31-1*Nh,'X,I',Nh,'.',Nh,',3X,A)' write(k_out,formatstring) a,12, & & convert_Higgscomb_to_bin(analyses(i)%peaks(j)%Higgs_comb), & & '# Assigned Higgs combination' !-------TODO: List the pdg numbers here of these combinations! write(k_out,'(3X,I3,4X,I2,23X,I8,3X,A)')a,13,analyses(i)%peaks(j)%domH,& & '# Index of dominant Higgs boson' if(analyses(i)%peaks(j)%domH.eq.0) then write(k_out,'(3X,I3,4X,I2,23X,A8,3X,A)')a,14,'NaN', & & '# pdg number of dominant Higgs boson' write(k_out,'(3X,I3,4X,I2,23X,A8,3X,A)')a,15,'NaN', & & '# Mass of the dominant Higgs boson' write(k_out,'(3X,I3,4X,I2,23X,A8,3X,A)')a,16,'NaN', & & '# Signal strength modifier of the dominant Higgs boson' else write(k_out,'(3X,I3,4X,I2,23X,I8,3X,A)')a,14,h(analyses(i)%peaks(j)%domH), & & '# pdg number of dominant Higgs boson' write(k_out,'(3X,I3,4X,I2,23X,F8.4,3X,A)')a,15, & & analyses(i)%peaks(j)%Higgses(analyses(i)%peaks(j)%domH)%m, & & '# Mass of dominant Higgs boson' write(k_out,'(3X,I3,4X,I2,23X,F8.4,3X,A)')a,16, & & analyses(i)%peaks(j)%Higgses(analyses(i)%peaks(j)%domH)%mu, & & '# Signal strength modifier of dominant Higgs boson' endif write(k_out,'(3X,I3,4X,I2,23X,F8.4,3X,A)')a,17,analyses(i)%peaks(j)%total_mu,& & '# Total predicted signal strength modifier mu' write(k_out,'(3X,I3,4X,I2,23X,F8.4,3X,A)')a,18,analyses(i)%peaks(j)%chisq_mu,& & '# Chi-squared value (mu-part)' write(k_out,'(3X,I3,4X,I2,23X,F8.4,3X,A)')a,19,analyses(i)%peaks(j)%chisq_mh,& & '# Chi-squared value (mh-part)' write(k_out,'(3X,I3,4X,I2,23X,F8.4,3X,A)')a,20,analyses(i)%peaks(j)%chisq_tot,& & '# Chi-squared value (total)' write(k_out,'(3X,I3,4X,I2,23X,F8.4,3X,A)')a,21,analyses(i)%peaks(j)%chisq_max,& & '# Chi-squared value for no predicted signal (mu=0)' enddo enddo end subroutine writeSLHAblock_HiggsSignalsPeakObservables !-------------------------------------------------------------------- subroutine writeSLHAblock_HiggsSignalsMassCenteredObservables(k_out) !-------------------------------------------------------------------- use usefulbits_hs, only : analyses, StrCompress use usefulbits, only : np, Hneut ! use extra_bits_for_SLHA, only : h implicit none integer, intent(in) :: k_out integer :: i,j,a, Nh character(LEN=200):: formatstring Nh = np(Hneut) write(k_out,'(a)')'BLOCK HiggsSignalsMassCenteredObservables' write(k_out,'(A6,3X,A4,25X,A5,3X,A)')'# OBS','FLAG','VALUE','# DESCRIPTION' a=0 do i=lbound(analyses,dim=1),ubound(analyses,dim=1) do j=lbound(analyses(i)%mpred%mp_Higgses,dim=1), & & ubound(analyses(i)%mpred%mp_Higgses,dim=1) a=a+1 write(k_out,'(3X,I3,4X,I2,1X,I30,3X,A)')a,1,analyses(i)%table%id,'# Analysis ID' write(k_out,'(3X,I3,4X,I2,5X,A2,A,A2,8X,A)')a,2,'||',trim(analyses(i)%table%label), & & '||','# Reference to publication' write(k_out,'(3X,I3,4X,I2,5X,A2,A,A2,6X,A)')a,3,'||', & & trim(strcompress(analyses(i)%table%desc)),'||','# Description (Search channel)' write(k_out,'(3X,I3,4X,I2,23X,F8.2,3X,A)')a,4,analyses(i)%table%energy, & & '# Center-of-mass energy' write(k_out,'(3X,I3,4X,I2,23X,F8.2,3X,A)')a,5,analyses(i)%table%lumi, & & '# Luminosity' write(k_out,'(3X,I3,4X,I2,23X,F8.2,3X,A)')a,6,analyses(i)%table%dlumi*100.0D0, & & '# Luminosity uncertainty (in %)' write(k_out,'(3X,I3,4X,I2,23X,F8.2,3X,A)')a,7,analyses(i)%table%deltam, & & '# Mass resolution (GeV)' write(k_out,'(3X,I3,4X,I2,23X,F8.2,3X,A)')a,8,analyses(i)%mpred%mp_Higgses(j)%m, & '# Mass of tested Higgs boson (GeV)' write(k_out,'(3X,I3,4X,I2,23X,F8.2,3X,A)')a,9,analyses(i)%mpred%mp_Higgses(j)%dm, & & '# Mass uncertainty of tested Higgs boson (GeV)' write(k_out,'(3X,I3,4X,I2,23X,F8.4,3X,A)')a,10,analyses(i)%mpred%mp_Higgses(j)%mu, & & '# Signal strength of tested Higgs boson' write(k_out,'(3X,I3,4X,I2,23X,I8,3X,A)')a,11, & & size(analyses(i)%mpred%mp_Higgses(j)%Higgses,dim=1), & & '# Number of combined Higgs bosons' write(formatstring,'(A13,I2,A3,I1,A1,I1,A6)') & & '(3X,I3,4X,I2,',31-1*Nh,'X,I',Nh,'.',Nh,',3X,A)' write(k_out,formatstring) a,12, & & convert_Higgscombint_to_bin(analyses(i)%mpred%mp_Higgses(j)%Higgscomb), & & '# Combined Higgs boson code' write(k_out,'(3X,I3,4X,I2,23X,F8.2,3X,A)')a,13, & & analyses(i)%mpred%mp_Higgses(j)%m_obs,'# Observed mass value (GeV)' write(k_out,'(3X,I3,4X,I2,23X,F8.4,3X,A)')a,14, & & analyses(i)%mpred%mp_Higgses(j)%mu_obs, & & '# Observed signal strength (from experiment)' write(k_out,'(3X,I3,4X,I2,23X,F8.4,3X,A)')a,15, & & analyses(i)%mpred%mp_Higgses(j)%dmu_low_obs, & & '# Lower 68%C.L. uncertainty of observed signal strength' write(k_out,'(3X,I3,4X,I2,23X,F8.4,3X,A)')a,16, & & analyses(i)%mpred%mp_Higgses(j)%dmu_up_obs, & & '# Upper 68%C.L. uncertainty of observed signal strength' ! write(k_out,'(3X,I3,4X,I2,23X,F8.4,3X,A)')a,16, & !& analyses(i)%mpred%mp_Higgses(j)%dmu_low0_obs, & !& '# Intrinsic lower 68%C.L. cyan band value of observed mu (corrected by HS)' ! write(k_out,'(3X,I3,4X,I2,23X,F8.4,3X,A)')a,17, & !& analyses(i)%mpred%mp_Higgses(j)%dmu_up0_obs, & !& '# Intrinsic upper 68%C.L. cyan band value of observed mu (corrected by HS)' write(k_out,'(3X,I3,4X,I2,23X,F8.4,3X,A)')a,17,analyses(i)%mpred%mp_Higgses(j)%chisq,& & '# Chi-squared value' enddo enddo end subroutine writeSLHAblock_HiggsSignalsMassCenteredObservables !-------------------------------------------------------------------- function convert_Higgscomb_to_bin(Higgscomb) !-------------------------------------------------------------------- implicit none integer, dimension(:), intent(in) :: Higgscomb integer :: convert_Higgscomb_to_bin integer :: i, j integer :: decnum decnum=0 do i=lbound(Higgscomb,dim=1),ubound(Higgscomb,dim=1) if(Higgscomb(i).eq.0) decnum=decnum+0 if(Higgscomb(i).eq.1) decnum=decnum+1 if(Higgscomb(i).eq.2) decnum=decnum+2 if(Higgscomb(i).eq.3) decnum=decnum+4 if(Higgscomb(i).eq.4) decnum=decnum+8 if(Higgscomb(i).eq.5) decnum=decnum+16 if(Higgscomb(i).eq.6) decnum=decnum+32 if(Higgscomb(i).eq.7) decnum=decnum+64 if(Higgscomb(i).eq.8) decnum=decnum+128 if(Higgscomb(i).eq.9) decnum=decnum+256 enddo convert_Higgscomb_to_bin = convert_dec_to_bin(decnum) end function convert_Higgscomb_to_bin !-------------------------------------------------------------------- function convert_Higgscombint_to_bin(Higgscomb) !-------------------------------------------------------------------- implicit none integer, intent(in) :: Higgscomb integer :: convert_Higgscombint_to_bin integer :: i, j integer :: decnum, Higgscombtmp Higgscombtmp = Higgscomb decnum=0 do while(Higgscombtmp > 0) i=MOD(Higgscombtmp,10) if(i.eq.0) decnum=decnum+0 if(i.eq.1) decnum=decnum+1 if(i.eq.2) decnum=decnum+2 if(i.eq.3) decnum=decnum+4 if(i.eq.4) decnum=decnum+8 if(i.eq.5) decnum=decnum+16 if(i.eq.6) decnum=decnum+32 if(i.eq.7) decnum=decnum+64 if(i.eq.8) decnum=decnum+128 if(i.eq.9) decnum=decnum+256 Higgscombtmp=(Higgscombtmp-i)/10 enddo convert_Higgscombint_to_bin = convert_dec_to_bin(decnum) end function convert_Higgscombint_to_bin !------------------------------------------------------------ subroutine read_matrix_from_file(length, filename, m, status) !------------------------------------------------------------ use usefulbits, only : file_id_common3 implicit none ! use store_pathname_hs, only : pathname_HS ! use usefulbits_hs, only : delta_rate integer, intent(in) :: length character(LEN=*), intent(in) :: filename double precision, dimension(:,:), intent(inout) :: m logical, intent(out) :: status integer :: n, ios double precision, dimension(length) :: dblline status=.False. if((size(m,dim=1).ne.length).or.(size(m,dim=2).ne.length)) then write(*,*) 'Problem in subroutine read_matrix_from_file!' else open(file_id_common3, file=filename,form='formatted') n=0 do read(file_id_common3,*, iostat=ios) dblline if(ios.ne.0) exit n=n+1 m(n,:)=dblline(:) enddo if(n.ne.length) then write(*,*) 'Problem with reading in the matrix from ',filename else status=.True. endif endif close(file_id_common3) end subroutine read_matrix_from_file !-------------------------------------------------------------------- function convert_dec_to_bin(dec) !-------------------------------------------------------------------- ! implicit none integer, intent(in) :: dec integer :: convert_dec_to_bin integer :: bineq integer :: power integer :: temp bineq = 0 power = 0 temp = dec do while(temp > 0) bineq = bineq + (MOD(temp, 2) * (MOD(temp, 2) * (10 ** power))) power = power + 1 temp = temp / 2 enddo convert_dec_to_bin = bineq end function convert_dec_to_bin !-------------------------------------------------------------------- end module io !-------------------------------------------------------------------- \ No newline at end of file