Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Elliot Lipeles committed Feb 11, 2025
1 parent ddb825c commit 9b7737a
Show file tree
Hide file tree
Showing 5 changed files with 654 additions and 0 deletions.
54 changes: 54 additions & 0 deletions examples/FCChh/vbf_hww/analysis_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This propagates config from one to stage to the next
# Mandatory: List of processes to run over
fraction = 1.0
testconfig = False
version='gentest'

if version=='private':
process_list = {
# # Add your processes like this:
## '<name of process>':{'fraction':<fraction of events to run over>, 'chunks':<number of chunks to split the output into>, 'output':<name of the output file> },
# # - <name of process> needs to correspond either the name of the input .root file, or the name of a directory containing root files
# # If you want to process only part of the events, split the output into chunks or give a different name to the output use the optional arguments
# # or leave blank to use defaults = run the full statistics in one output file named the same as the process:
'vbf_hww_llvv': {'fraction':fraction, 'chunks': 1},
'vv_lep': {'fraction':fraction, 'chunks': 8},
'ggh_hww_llvv' : {'fraction':fraction, 'chunks': 10},
'ttbar_lep' : {'fraction':fraction,'chunks': 26},
'z_tautau' : {'fraction':fraction, 'chunks': 10},
'vbf_z_tautau' : {'fraction':fraction, 'chunks': 1},
}
if testconfig:
process_list = {'ttbar_lep': {'fraction':0.01}}
input_dir = '/afs/cern.ch/user/l/lipeles/FCC/data/datasets_v3/'
elif version =='gentest':
process_list = {
# # Add your processes like this:
## '<name of process>':{'fraction':<fraction of events to run over>, 'chunks':<number of chunks to split the output into>, 'output':<name of the output file> },
# # - <name of process> needs to correspond either the name of the input .root file, or the name of a directory containing root files
# # If you want to process only part of the events, split the output into chunks or give a different name to the output use the optional arguments
# # or leave blank to use defaults = run the full statistics in one output file named the same as the process:
#'mgp8_pp_vbf_h01j_5f_hww_lvlv' : { 'fraction':0.01},
#'mgp8_pp_vbf_h01j_5f_hwwlvlv' : { 'fraction': 0.01 },
#'mgp8_pp_tt012j_5f_blvblv' : { 'fraction' : 0.01 },
'mgp8_pp_z0123j_4f_ztautau' : { 'fraction' : 1.0, 'chunks': 30},
}
input_dir = '/eos/user/l/lipeles/FCC/hh/generation/DelphesEvents/fcc_v07/II'
elif version =='official':
process_list = {
# # Add your processes like this:
## '<name of process>':{'fraction':<fraction of events to run over>, 'chunks':<number of chunks to split the output into>, 'output':<name of the output file> },
# # - <name of process> needs to correspond either the name of the input .root file, or the name of a directory containing root files
# # If you want to process only part of the events, split the output into chunks or give a different name to the output use the optional arguments
# # or leave blank to use defaults = run the full statistics in one output file named the same as the process:
#'mgp8_pp_vbf_h01j_5f_hww_lvlv' : { 'fraction':0.01},
#'mgp8_pp_vbf_h01j_5f_hwwlvlv' : { 'fraction': 0.01 },
#'mgp8_pp_tt012j_5f_blvblv' : { 'fraction' : 0.01 },
#'mgp8_pp_z0123j_4f_ztautau' : { 'fraction' : 1.0},
}
input_dir = '/eos/experiment/fcc/hh/generation/DelphesEvents/fcc_v07/II'

stage1_output = '/afs/cern.ch/user/l/lipeles/FCC/FCCAnalyses/examples/FCChh/outputs/FCChh/vbf_hww/presel_{}'.format(version)
final_output = "/afs/cern.ch/user/l/lipeles/FCC/FCCAnalyses/examples/FCChh/outputs/FCChh/vbf_hww/final_{}/".format(version)
plots_output = "/afs/cern.ch/user/l/lipeles/FCC/FCCAnalyses/examples/FCChh/outputs/FCChh/vbf_hww/plots_{}/".format(version)

108 changes: 108 additions & 0 deletions examples/FCChh/vbf_hww/analysis_final.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import vbf_hww.analysis_config as analysis_config


#Input directory where the files produced at the pre-selection level are
#inputDir = "outputs/FCChh/vbf_hww/presel_condor/"
inputDir = analysis_config.stage1_output

#Input directory where the files produced at the pre-selection level are
outputDir = analysis_config.final_output

processList = {}
for proc in analysis_config.process_list:
processList[proc] : {}

#Link to the dictonary that contains all the cross section informations etc...
#procDict = "/eos/experiment/fcc/hh/tutorials/edm4hep_tutorial_data/FCChh_procDict_tutorial.json"
procDict = '/eos/experiment/fcc/hh/utils/FCCDicts/FCChh_procDict_fcc_v07_II.json'
#Note the numbeOfEvents and sumOfWeights are placeholders that get overwritten with the correct values in the samples

# BRs
BRHww = 0.215 # Higgs X-sec working group
BRWlep = 0.108 # PDG
BRZlep = 0.03365 # PDG

#How to add a process that is not in the official dictionary:
procDictAdd={
"vbf_hww_llvv": {"numberOfEvents": 70000, "sumOfWeights": 70000, "crossSection": 8.411e+01*(BRWlep*3)**2*BRHww , "kfactor": 1.0, "matchingEfficiency": 1.0},
"ggh_hww_llvv": {"numberOfEvents": 659940, "sumOfWeights": 659940, "crossSection": 5.849e+02*(BRWlep*3)**2*BRHww , "kfactor": 1.0, "matchingEfficiency": 1.0},
'vv_lep': {"numberOfEvents": 660000 , "sumOfWeights": 660000 , "crossSection": 3.320e+04*(BRWlep*3)**2 , "kfactor": 0.0432, "matchingEfficiency": 1.0}, # 0.02 accounts for ngenW=2 filter
'ttbar_lep' : {"numberOfEvents": 2500000, "sumOfWeights": 2500000, "crossSection": 4.265e+04*(BRWlep*3)**2, "kfactor": 1.0, "matchingEfficiency": 1.0},
'z_tautau' : {"numberOfEvents": 751378, "sumOfWeights": 751378, "crossSection": 8.787e+06*BRZlep, "kfactor": 1.0, "matchingEfficiency": 1.0},
'vbf_z_tautau' : {"numberOfEvents": 474, "sumOfWeights": 474, "crossSection": 5.133e+03*BRZlep, "kfactor": 1.0, "matchingEfficiency": 1.0},
}

# Expected integrated luminosity
intLumi = 30e+06 # pb-1

# Whether to scale to expected integrated luminosity
doScale = True

#Number of CPUs to use
nCPUS = 2

#produces ROOT TTrees, default is False
doTree = True

saveTabular = True

# Optional: Use weighted events
do_weighted = False

# Define new variables
defineList = {
"n_lep" : "n_el+n_mu",
"n_genW" : "n_genWp+n_genWm"
}



# Dictionary of the list of cuts. The key is the name of the selection that will be added to the output file
cutList = {}
cutList['sel0_all']='1.0'
cutList['sel1_bjeteveto']='n_bjets_loose==0'
cutList['sel2_jeteveto']='n_jets==2'
cutList['sel3_both']=cutList['sel1_bjeteveto'] + ' && ' + cutList['sel2_jeteveto']
cutList['sel4_mjj']=cutList['sel3_both']+ '&& (m_jj[0]>1000.0)&&(deta_jj[0]>4.5)'
cutList['sel5_mem']=cutList['sel3_both']+ '&&(m_em[0]<70.0)'
cutList['sel6_mjj_dphiem_lepcent']= cutList['sel4_mjj']+ ' && (dphi_em[0]<0.75) && (lep_cent[0]<0.40)'
cutList['sel7_mjj_dphiem_lepcent_mt']= cutList['sel6_mjj_dphiem_lepcent']+ ' && (MT[0]<150.0) && (MT[0]>50.0) '


# Dictionary for the output variable/histograms. The key is the name of the variable in the output files. "name" is the name of the variable in the input file, "title" is the x-axis label of the histogram, "bin" the number of bins of the histogram, "xmin" the minimum x-axis value and "xmax" the maximum x-axis value.
histoList = {
#"n_el" : {"title":"Number Electrons","bin":10,"xmin":0,"xmax":10},
#"n_mu" : {"title":"Number Muons","bin":10,"xmin":0,"xmax":10},
#"n_lep" : {"title":"Number Leptons","bin":10,"xmin":0,"xmax":10},
"n_jets" : {"title":"Number Jets","bin":10,"xmin":0,"xmax":10},
'n_centraljets' : {"title":"Number Centeral Jets","bin":10,"xmin":0,"xmax":10},
"n_bjets" : {"title":"Number b-Jets","bin":10,"xmin":0,"xmax":10},
"n_bjets_loose" : {"title":"Number Jets","bin":10,"xmin":0,"xmax":10},
"n_genb" : {"title":"Number Jets","bin":10,"xmin":0,"xmax":10},
'n_RecoTracks' : {"title":"Number Tracks","bin":100,"xmin":0,"xmax":1000},
"genb_eta" : {"title":"Generator Level b-quark Eta","bin":100,"xmin":-10,"xmax":10},
"genb_pt" : {"title":"Generator Level b-quark Pt","bin":100,"xmin":0,"xmax":500},
"j1_eta" : {"title":"Leading Jet Eta","bin":100,"xmin":-10,"xmax":10},
"j2_eta" : {"title":"Subleading Jet Eta","bin":100,"xmin":-10,"xmax":10},
"j1_pt" : {"title":"Leading Jet pT","bin":100,"xmin":0,"xmax":500},
"j2_pt" : {"title":"Subleading Jet Pt","bin":100,"xmin":0,"xmax":500},
"pt_jj" : {"title":"Di-Jet Pt","bin":100,"xmin":0,"xmax":500},
"el1_pt" : {"title":"Leading Electron pT","bin":40,"xmin":0,"xmax":200},
"mu1_pt" : {"title":"Leading Muon pT","bin":40,"xmin":0,"xmax":200},
"MET" : {"title":"MET","bin":40,"xmin":0,"xmax":1000},
"m_em":{"title":"m_{#ell#mu} [GeV]","bin":60,"xmin":0,"xmax":300},
'MT' : {"title":"MT [GeV]","bin":30,"xmin":0,"xmax":300},
'lep_cent' : {"title":"lepton centrality","bin":60,"xmin":0,"xmax":3},
"m_jj":{"title":"m_{jj} [GeV]","bin":40,"xmin":0,"xmax":10000},
"dphi_jj":{"title":"#delta#phi_{jj} ","bin":30,"xmin":0,"xmax":3.1416},
"deta_jj":{"title":"#delta#eta_{jj} ","bin":120,"xmin":0,"xmax":12.0},
"dphi_em":{"title":"#delta#phi_{e#mu} ","bin":30,"xmin":0,"xmax":3.1416},
"deta_em":{"title":"#delta#eta_{e#mu} ","bin":12,"xmin":0,"xmax":12.0},
'dphi_emMET' : {"title":"#delta#phi(em,MET)","bin":30,"xmin":0,"xmax":3.1415},
"n_genW" : {"title": "N generator W","bin":10, "xmin":0,"xmax":10},
"n_genZ" : {"title": "N generator Z","bin":10, "xmin":0,"xmax":10},
}

for key,val in histoList.items():
if "name" not in val.keys():
val["name"]=key
81 changes: 81 additions & 0 deletions examples/FCChh/vbf_hww/analysis_plots.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import ROOT
from analysis_final import histoList
import vbf_hww.analysis_config as analysis_config

# global parameters
intLumi = 30e+06 #in pb-1
ana_tex = 'VBF H#rightarrow WW #rightarrow llvv'
delphesVersion = '3.4.2'
energy = 100
collider = 'FCC-hh'
inputDir = analysis_config.final_output
formats = ['png',] #'pdf']
yaxis = ['log',] #'log']
stacksig = ['nostack']
# stacksig = ['stack','nostack']
outdir = analysis_config.plots_output
plotStatUnc = True

#variables = ['n_el','n_mu','n_lep']
variables = histoList.keys()

# rebin = [1, 1, 1, 1, 2] # uniform rebin per variable (optional)

### Dictionary with the analysis name as a key, and the list of selections to be plotted for this analysis. The name of the selections should be the same than in the final selection

extralabel = {}
extralabel['sel0_all'] = "Preselection Events"
extralabel['sel1_bjeteveto'] = "b-jet veto"
extralabel['sel2_jeteveto'] = "2-jet exclusive"
extralabel['sel3_both'] = "2-jet exclusive and b-jet veto"
extralabel['sel4_mjj'] = "mjj cut applied"
extralabel['sel5_mem'] = "m_em cut applied"
extralabel['sel6_mjj_dphiem_lepcent'] = "m_{jj}, #Delta#eta_{jj}, #Delta#phi_{em}, lep cent"
extralabel['sel7_mjj_dphiem_lepcent_mt'] = extralabel['sel6_mjj_dphiem_lepcent'] + ", MT"


selections = {}
selections['vbf_hww'] = extralabel.keys()


colors = {}
colors['vbf_hww'] = ROOT.kRed
colors['ggH'] = ROOT.kTeal
colors['ttbar'] = ROOT.kBlue
colors['z_tautau'] = ROOT.kViolet
colors['vbf_z_tautau'] = ROOT.kViolet-20
colors['vv_lep'] = ROOT.kGreen



# this is selection: signal/backgrounds category : {final histo label : [set of input procs]}
plots = {}
plots['vbf_hww']={}
plots['vbf_hww']['signal']={}
plots['vbf_hww']['backgrounds']={}

procs = {}
procs['vbf_hww_llvv'] = ['signal','vbf_hww']
procs['mgp8_pp_vbf_h01j_5f_hwwlvlv'] = ['signal','vbf_hww']
procs['ggh_hww_llvv'] = ['backgrounds','ggH']
procs['ttbar_lep'] = ['backgrounds','ttbar']
procs['mgp8_pp_tt012j_5f_blvblv'] = ['backgrounds','ttbar']
procs['z_tautau'] = ['backgrounds','z_tautau']
procs['vv_lep'] = ['backgrounds','vv_lep']
procs['mgp8_pp_z0123j_4f_ztautau'] = ['backgrounds','z_tautau']


for proc in analysis_config.process_list:
proc_config = procs[proc]
if not proc in plots['vbf_hww'][proc_config[0]]:
plots['vbf_hww'][proc_config[0]][proc_config[1]]=[]
plots['vbf_hww'][proc_config[0]][proc_config[1]].append(proc)


legend = {}
legend['vbf_hww'] = 'VBF H #rightarrow WW'
legend['ggH'] = 'gg #rightarrow H #rightarrow WW'
legend['ttbar'] = 't#bar{t}'
legend['z_tautau'] = 'Z #rightarrow #tau#tau'
legend['vbf_z_tautau'] = 'VBF Z #rightarrow #tau#tau'
legend['vv_lep'] = 'VV leptonic'
Loading

0 comments on commit 9b7737a

Please sign in to comment.