Skip to content

Commit

Permalink
Merge pull request cms-sw#3698 from danielwinterbottom/ditau_biased_mass
Browse files Browse the repository at this point in the history
Cards and bias files for ggH->tautau and VBF->tautau flat mass samples
  • Loading branch information
bbilin authored May 8, 2024
2 parents c064bdb + 2f7dad0 commit 3fad331
Show file tree
Hide file tree
Showing 11 changed files with 776 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
include ../../make_opts

all: mass_bias

clean:
$(RM) *.o $(BIASLIBDIR)$(BIASLIBRARY)

#
# Compilation of the module ptj_bias
#
mass_bias.o: mass_bias.f ../bias.inc
$(FC) $(FFLAGS) $(LDFLAGS) -c -o mass_bias.o mass_bias.f

mass_bias: mass_bias.o
$(call CREATELIB, $(BIASLIBDIR)$(BIASLIBRARY), $^)

#
# List of the requirements for this module.
# 'VALID' is the keyword that *must* be returned if everything is in order.
#
requirements:
@echo "VALID"

Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
C ************************************************************
C Source for the library implementing a dummt bias function
C always returns one
C ************************************************************

subroutine bias_wgt(p, original_weight, bias_weight)
implicit none
C
C Parameters
C
include '../../nexternal.inc'
C
C Arguments
C
double precision p(0:3,nexternal)
double precision original_weight, bias_weight
C
C local variables
C
integer i,j
double precision mass,mass_wgt,acceptance_wgt
C
C local variables defined in the run_card
C
C
C Global variables
C
C Mandatory common block to be defined in bias modules
C
double precision stored_bias_weight
data stored_bias_weight/1.0d0/
logical impact_xsec, requires_full_event_info
data impact_xsec/.True./
C Of course this module does not require the full event
C information (color, resonances, helicities, etc..)
data requires_full_event_info/.False./
common/bias/stored_bias_weight,impact_xsec,
& requires_full_event_info

C
C Accessingt the details of the event
C
logical is_a_j(nexternal),is_a_l(nexternal),
& is_a_b(nexternal),is_a_a(nexternal),
& is_a_onium(nexternal),is_a_nu(nexternal),
& is_heavy(nexternal),do_cuts(nexternal)
common/to_specisa/is_a_j,is_a_a,is_a_l,is_a_b,is_a_nu,
& is_heavy,is_a_onium,do_cuts
C
C Setup the value of the parameters from the run_card
C
include '../bias.inc'

C --------------------
C BEGIN IMPLEMENTATION
C --------------------

c The 'bias_wgt' should be a IR-safe function of the momenta.
c
c For this to be used, the 'event_norm' option in the run_card should be
c set to
c 'bias' = event_norm
c Note as the purpose of this MC sample is for training a mass regression,
c we do not set this option since it would results in a distribiution
c peaked at 125 GeV, whereas a flat distribution is required to avoid
c a bias towards a specific mass in the training

mass_wgt=1d0
acceptance_wgt=1d0

do i=1,nexternal
do j=i+1,nexternal
if (is_a_l(i) .and. is_a_l(j)) then
mass=dsqrt((p(0,i)+p(0,j))**2 - ( (p(1,i)+p(1,j))**2 + (p(2,i)+p(2,j))**2 + (p(3,i)+p(3,j))**2) )
mass=max(mass,40.)
C function used to define bias found from fitting mass spectrume with Breit-Wigner*pol2
mass_wgt=((mass**2-125.**2)**2+(125.*12.3)**2)/(125.*12.3*(0.0000159*mass**2+0.000327*mass-0.0199))/78000.
C Since we apply some pT cuts to the tau objects, which leads to a lower
C acceptance for lower mass points, we apply an additional weight to
C re-flatten the mass distribution after the cuts
acceptance_wgt=1./(-0.199+0.0154*mass -0.0000337*mass**2)
endif
enddo
enddo

bias_weight=mass_wgt*acceptance_wgt

return

end subroutine bias_wgt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
set param_card mass 25 125.0
set param_card decay 25 12.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import model sm

generate p p > ta+ ta- j j $$ w+ w- z / a ta+ ta- vt vt~ QCD=0

output VBFToScalarToTauTau_BiasedMass_Mass30to300

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
include ../../make_opts

all: mass_bias

clean:
$(RM) *.o $(BIASLIBDIR)$(BIASLIBRARY)

#
# Compilation of the module ptj_bias
#
mass_bias.o: mass_bias.f ../bias.inc
$(FC) $(FFLAGS) $(LDFLAGS) -c -o mass_bias.o mass_bias.f

mass_bias: mass_bias.o
$(call CREATELIB, $(BIASLIBDIR)$(BIASLIBRARY), $^)

#
# List of the requirements for this module.
# 'VALID' is the keyword that *must* be returned if everything is in order.
#
requirements:
@echo "VALID"

Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
C ************************************************************
C Source for the library implementing a dummt bias function
C always returns one
C ************************************************************

subroutine bias_wgt(p, original_weight, bias_weight)
implicit none
C
C Parameters
C
include '../../nexternal.inc'
C
C Arguments
C
double precision p(0:3,nexternal)
double precision original_weight, bias_weight
C
C local variables
C
integer i,j
double precision mass,mass_wgt,acceptance_wgt
C
C local variables defined in the run_card
C
C
C Global variables
C
C Mandatory common block to be defined in bias modules
C
double precision stored_bias_weight
data stored_bias_weight/1.0d0/
logical impact_xsec, requires_full_event_info
data impact_xsec/.True./
C Of course this module does not require the full event
C information (color, resonances, helicities, etc..)
data requires_full_event_info/.False./
common/bias/stored_bias_weight,impact_xsec,
& requires_full_event_info

C
C Accessingt the details of the event
C
logical is_a_j(nexternal),is_a_l(nexternal),
& is_a_b(nexternal),is_a_a(nexternal),
& is_a_onium(nexternal),is_a_nu(nexternal),
& is_heavy(nexternal),do_cuts(nexternal)
common/to_specisa/is_a_j,is_a_a,is_a_l,is_a_b,is_a_nu,
& is_heavy,is_a_onium,do_cuts
C
C Setup the value of the parameters from the run_card
C
include '../bias.inc'

C --------------------
C BEGIN IMPLEMENTATION
C --------------------

c The 'bias_wgt' should be a IR-safe function of the momenta.
c
c For this to be used, the 'event_norm' option in the run_card should be
c set to
c 'bias' = event_norm
c Note as the purpose of this MC sample is for training a mass regression,
c we do not set this option since it would results in a distribiution
c peaked at 125 GeV, whereas a flat distribution is required to avoid
c a bias towards a specific mass in the training

mass_wgt=1d0
acceptance_wgt=1d0

do i=1,nexternal
do j=i+1,nexternal
if (is_a_l(i) .and. is_a_l(j)) then
mass=dsqrt((p(0,i)+p(0,j))**2 - ( (p(1,i)+p(1,j))**2 + (p(2,i)+p(2,j))**2 + (p(3,i)+p(3,j))**2) )
C function used to define bias found from fitting mass spectrum with
C a Breit-Wigner*pol2
mass=max(mass,40.)
mass_wgt=((mass**2-125.**2)**2+(125.*12.5)**2)/(125.*12.5*(-0.249+0.0118*mass + 0.00000930*mass**2))/16400.
C Since we apply some pT cuts to the tau objects, which leads to a lower
C acceptance for lower mass points, we apply an additional weight to
C re-flatten the mass distribution after the cuts
acceptance_wgt=1./(0.01167*mass-0.210)
endif
enddo
enddo

bias_weight=mass_wgt*acceptance_wgt

return

end subroutine bias_wgt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
set param_card mass 25 125.0
set param_card decay 25 12.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import model loop_sm

generate p p > h > ta+ ta- [QCD]

output ggToScalarToTauTau_BiasedMass_Mass30to300
Loading

0 comments on commit 3fad331

Please sign in to comment.