Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into up-fcchh-examples
Browse files Browse the repository at this point in the history
  • Loading branch information
bistapf committed Sep 20, 2024
2 parents 4a71e08 + a95fd03 commit a178c42
Show file tree
Hide file tree
Showing 10 changed files with 1,023 additions and 425 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# FCCAnalyses

[![DOI](https://zenodo.org/badge/177151745.svg)](https://zenodo.org/doi/10.5281/zenodo.4767810)

![test](https://github.com/HEP-FCC/FCCAnalyses/actions/workflows/test.yml/badge.svg)
![docs](https://github.com/HEP-FCC/FCCAnalyses/actions/workflows/docs.yml/badge.svg)

Common framework for FCC related analyses. This framework allows one to write
full analysis, taking [EDM4hep](https://github.com/key4hep/EDM4hep) input ROOT
files and producing the plots.
Expand Down
126 changes: 93 additions & 33 deletions examples/FCCee/higgs/mH-recoil/mumu/analysis_final.py
Original file line number Diff line number Diff line change
@@ -1,50 +1,110 @@
#Input directory where the files produced at the pre-selection level are
inputDir = "outputs/FCCee/higgs/mH-recoil/mumu/stage2/"
'''
Final stage of the example Z(mumu)H recoil mass analysis.
'''

#Input directory where the files produced at the pre-selection level are
outputDir = "outputs/FCCee/higgs/mH-recoil/mumu/final/"
# Input directory where the files produced in the pre-selection stages are
# stored
inputDir = "outputs/FCCee/higgs/mH-recoil/mumu/stage2/"

# Output directory where the resulting files will be stored
outputDir = "outputs/FCCee/higgs/mH-recoil/mumu/final/"

processList = {
'p8_ee_ZZ_ecm240':{},#Run over the full statistics from stage2 input file <inputDir>/p8_ee_ZZ_ecm240.root. Keep the same output name as input
'p8_ee_WW_ecm240':{}, #Run over the statistics from stage2 input files <inputDir>/p8_ee_WW_ecm240_out/*.root. Keep the same output name as input
'MySample_p8_ee_ZH_ecm240':{} #Run over the full statistics from stage2 input file <inputDir>/p8_ee_ZH_ecm240_out.root. Change the output name to MySample_p8_ee_ZH_ecm240
# Run over the full statistics from stage2 input file
# <inputDir>/p8_ee_ZZ_ecm240.root. Keep the same output name as input
'p8_ee_ZZ_ecm240': {},
# Run over the statistics from stage2 input files
# <inputDir>/p8_ee_WW_ecm240_out/*.root. Keep the same output name as input
'p8_ee_WW_ecm240': {},
# Run over the full statistics from stage2 input file
# <inputDir>/p8_ee_ZH_ecm240_out.root. Change the output name to
# MySample_p8_ee_ZH_ecm240
'MySample_p8_ee_ZH_ecm240': {}
}

#Link to the dictonary that contains all the cross section informations etc...
# Link to the dictionary that contains all the cross section information etc...
procDict = "FCCee_procDict_spring2021_IDEA.json"

#Add MySample_p8_ee_ZH_ecm240 as it is not an offical process
procDictAdd={"MySample_p8_ee_ZH_ecm240":{"numberOfEvents": 10000000, "sumOfWeights": 10000000, "crossSection": 0.201868, "kfactor": 1.0, "matchingEfficiency": 1.0}}
# Add MySample_p8_ee_ZH_ecm240 as it is not an offical process
procDictAdd = {"MySample_p8_ee_ZH_ecm240": {"numberOfEvents": 10000000,
"sumOfWeights": 10000000,
"crossSection": 0.201868,
"kfactor": 1.0,
"matchingEfficiency": 1.0}}

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

#Number of CPUs to use
# Whether to scale to expected integrated luminosity
doScale = True

# Number of threads to use
nCPUS = 2

#produces ROOT TTrees, default is False
doTree = False
# Whether to produce ROOT TTrees, default is False
doTree = True

# Save cut yields and efficiencies in LaTeX table
saveTabular = True

###Dictionnay of the list of cuts. The key is the name of the selection that will be added to the output file
cutList = {"sel0":"Zcand_q == 0",
"sel1":"Zcand_q == -1 || Zcand_q == 1",
"sel2":"Zcand_m > 80 && Zcand_m < 100",
"sel3":"MyFilter==true && (Zcand_m < 80 || Zcand_m > 100)"
}
# Save cut yields and efficiencies in JSON file
saveJSON = True

# Dictionary with the list of cuts. The key is the name of the selection that
# will be added to the output file
cutList = {"sel0": "Zcand_q == 0",
"sel1": "Zcand_q == -1 || Zcand_q == 1",
"sel2": "Zcand_m > 80 && Zcand_m < 100",
"sel3": "MyFilter==true && (Zcand_m < 80 || Zcand_m > 100)"}


#Dictionary for the ouput variable/hitograms. 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.
# Dictionary for the output variables/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 = {
"mz":{"name":"Zcand_m","title":"m_{Z} [GeV]","bin":125,"xmin":0,"xmax":250},
"mz_zoom":{"name":"Zcand_m","title":"m_{Z} [GeV]","bin":40,"xmin":80,"xmax":100},
"leptonic_recoil_m":{"name":"Zcand_recoil_m","title":"Z leptonic recoil [GeV]","bin":100,"xmin":0,"xmax":200},
"leptonic_recoil_m_zoom":{"name":"Zcand_recoil_m","title":"Z leptonic recoil [GeV]","bin":200,"xmin":80,"xmax":160},
"leptonic_recoil_m_zoom1":{"name":"Zcand_recoil_m","title":"Z leptonic recoil [GeV]","bin":100,"xmin":120,"xmax":140},
"leptonic_recoil_m_zoom2":{"name":"Zcand_recoil_m","title":"Z leptonic recoil [GeV]","bin":200,"xmin":120,"xmax":140},
"leptonic_recoil_m_zoom3":{"name":"Zcand_recoil_m","title":"Z leptonic recoil [GeV]","bin":400,"xmin":120,"xmax":140},
"leptonic_recoil_m_zoom4":{"name":"Zcand_recoil_m","title":"Z leptonic recoil [GeV]","bin":800,"xmin":120,"xmax":140},
"leptonic_recoil_m_zoom5":{"name":"Zcand_recoil_m","title":"Z leptonic recoil [GeV]","bin":2000,"xmin":120,"xmax":140},
"leptonic_recoil_m_zoom6":{"name":"Zcand_recoil_m","title":"Z leptonic recoil [GeV]","bin":100,"xmin":130.3,"xmax":132.5},
"mz_1D":{"cols":["Zcand_m"],"title":"m_{Z} [GeV]", "bins": [(40,80,100)]}, # 1D histogram (alternative syntax)
"mz_recoil_2D":{"cols":["Zcand_m", "Zcand_recoil_m"],"title":"m_{Z} - leptonic recoil [GeV]", "bins": [(40,80,100), (100,120,140)]}, # 2D histogram
"mz_recoil_3D":{"cols":["Zcand_m", "Zcand_recoil_m", "Zcand_recoil_m"],"title":"m_{Z} - leptonic recoil - leptonic recoil [GeV]", "bins": [(40,80,100), (100,120,140), (100,120,140)]}, # 3D histogram
"mz": {"name": "Zcand_m",
"title": "m_{Z} [GeV]",
"bin": 125, "xmin": 0, "xmax": 250},
"mz_zoom": {"name": "Zcand_m",
"title": "m_{Z} [GeV]",
"bin": 40, "xmin": 80, "xmax": 100},
"leptonic_recoil_m": {"name": "Zcand_recoil_m",
"title": "Z leptonic recoil [GeV]",
"bin": 100, "xmin": 0, "xmax": 200},
"leptonic_recoil_m_zoom": {"name": "Zcand_recoil_m",
"title": "Z leptonic recoil [GeV]",
"bin": 200, "xmin": 80, "xmax": 160},
"leptonic_recoil_m_zoom1": {"name": "Zcand_recoil_m",
"title": "Z leptonic recoil [GeV]",
"bin": 100, "xmin": 120, "xmax": 140},
"leptonic_recoil_m_zoom2": {"name": "Zcand_recoil_m",
"title": "Z leptonic recoil [GeV]",
"bin": 200, "xmin": 120, "xmax": 140},
"leptonic_recoil_m_zoom3": {"name": "Zcand_recoil_m",
"title": "Z leptonic recoil [GeV]",
"bin": 400, "xmin": 120, "xmax": 140},
"leptonic_recoil_m_zoom4": {"name": "Zcand_recoil_m",
"title": "Z leptonic recoil [GeV]",
"bin": 800, "xmin": 120, "xmax": 140},
"leptonic_recoil_m_zoom5": {"name": "Zcand_recoil_m",
"title": "Z leptonic recoil [GeV]",
"bin": 2000, "xmin": 120, "xmax": 140},
"leptonic_recoil_m_zoom6": {"name": "Zcand_recoil_m",
"title": "Z leptonic recoil [GeV]",
"bin": 100, "xmin": 130.3, "xmax": 132.5},
# 1D histogram (alternative syntax)
"mz_1D": {"cols": ["Zcand_m"],
"title": "m_{Z} [GeV]",
"bins": [(40, 80, 100)]},
# 2D histogram
"mz_recoil_2D": {"cols": ["Zcand_m", "Zcand_recoil_m"],
"title": "m_{Z} - leptonic recoil [GeV]",
"bins": [(40, 80, 100), (100, 120, 140)]},
# 3D histogram
"mz_recoil_3D": {
"cols": ["Zcand_m", "Zcand_recoil_m", "Zcand_recoil_m"],
"title": "m_{Z} - leptonic recoil - leptonic recoil [GeV]",
"bins": [(40, 80, 100), (100, 120, 140), (100, 120, 140)]},
}
46 changes: 29 additions & 17 deletions examples/FCCee/higgs/mH-recoil/mumu/analysis_plots.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
import ROOT

# global parameters
intLumi = 5.0e+06 #in pb-1
# Global parameters
intLumi = 5.0e+06 # in pb-1
ana_tex = 'e^{+}e^{-} #rightarrow ZH #rightarrow #mu^{+}#mu^{-} + X'
delphesVersion = '3.4.2'
energy = 240.0
collider = 'FCC-ee'
inputDir = 'outputs/FCCee/higgs/mH-recoil/mumu/final/'
formats = ['png','pdf']
yaxis = ['lin','log']
stacksig = ['stack','nostack']
formats = ['png', 'pdf']
yaxis = ['lin', 'log']
stacksig = ['stack', 'nostack']
outdir = 'outputs/FCCee/higgs/mH-recoil/mumu/plots/'
plotStatUnc = True

variables = ['mz','mz_zoom','leptonic_recoil_m','leptonic_recoil_m_zoom','leptonic_recoil_m_zoom2']
rebin = [1, 1, 1, 1, 2] # uniform rebin per variable (optional)
variables = ['mz',
'mz_zoom',
'leptonic_recoil_m',
'leptonic_recoil_m_zoom',
'leptonic_recoil_m_zoom2']
rebin = [1, 1, 1, 1, 2] # uniform rebin per variable (optional)

###Dictonnary 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
# Dictionary with the list of selections to be plotted for this analysis. The
# name of the selections should be the same than in the final selection
selections = {}
selections['ZH'] = ["sel0","sel1"]
selections['ZH_2'] = ["sel0","sel1"]
selections['ZH'] = ["sel0", "sel1"]
selections['ZH_2'] = ["sel0", "sel1"]
selections['ZH_3'] = ["sel0", "sel1"]
selections['ZH_4'] = ["sel0", "sel1"]
selections['ZH_5'] = ["sel0", "sel1"]

extralabel = {}
extralabel['sel0'] = "Selection: N_{Z} = 1"
Expand All @@ -32,15 +40,19 @@
colors['VV'] = ROOT.kGreen+3

plots = {}
plots['ZH'] = {'signal':{'ZH':['MySample_p8_ee_ZH_ecm240']},
'backgrounds':{'WW':['p8_ee_WW_ecm240'],
'ZZ':['p8_ee_ZZ_ecm240']}
}
plots['ZH'] = {'signal': {'ZH': ['MySample_p8_ee_ZH_ecm240']},
'backgrounds': {'WW': ['p8_ee_WW_ecm240'],
'ZZ': ['p8_ee_ZZ_ecm240']}}

plots['ZH_2'] = {'signal': {'ZH': ['MySample_p8_ee_ZH_ecm240']},
'backgrounds': {'VV': ['p8_ee_WW_ecm240', 'p8_ee_ZZ_ecm240']}}

plots['ZH_2'] = {'signal':{'ZH':['MySample_p8_ee_ZH_ecm240']},
'backgrounds':{'VV':['p8_ee_WW_ecm240','p8_ee_ZZ_ecm240']}
}
plots['ZH_3'] = {'signal': {'ZH': ['MySample_p8_ee_ZH_ecm240']}}

plots['ZH_4'] = {'backgrounds': {'VV': ['p8_ee_WW_ecm240', 'p8_ee_ZZ_ecm240']}}

plots['ZH_5'] = {'backgrounds': {'WW': ['p8_ee_WW_ecm240'],
'ZZ': ['p8_ee_ZZ_ecm240']}}

legend = {}
legend['ZH'] = 'ZH'
Expand Down
118 changes: 118 additions & 0 deletions man/man7/fccanalysis-final-script.7
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
.\" Manpage for fccanalysis-final-script
.\" Contact [email protected] to correct errors or typos.
.TH FCCANALYSIS\-FINAL\-SCRIPT 7 "05 Aug 2024" "0.9.0" "fccanalysis-final-script man page"
.SH NAME
\fBfccanalysis\-final\-script\fR \(en analysis script for the final stage of the
analysis
.SH SYNOPSIS
.IP
*
.SH DESCRIPTION
.PP
The analysis script for the final stage of the analysis is expected to be a
valid Python script containing definitions of the cuts and the final
histograms\&. To run the final stage do
.IP
fccanalysis final \fIanalysis_script.py\fR

.RE
.SH ATTRIBUTES
User can use the following global attributes to control the behavior of the
final analysis stage\&.
.TP
\fBprocDict\fR (mandatory)
This variable controls which process dictionary will be used. It can be either
simple file name, absolute path or url\&. In the case of a simple filename, the
file is being searched for first in the working directory and then at the
locations indicated in the $FCCDICTSDIR environment variable\&.
.TP
\fBprocDictAdd\fR (optional)
User can provide additional processes, which are not included in the main
processes dictionary\&.
.TP
\fBinputDir\fR (mandatory)
User has to specify the directory where the input files coming from the previous
analysis stage are stored\&.
.TP
\fBoutputDir\fR (optional)
User can specify the directory for the output files\&.
.br
Default value: \&. (current working directory)
.TP
\fBnCPUS\fR (optional)
Number of threads the RDataFrame will use\&. If -1 is specified all available
cores will be used\&.
.br
Default value: 4
.TP
\fBcutList\fR (optional)
Dictionary of cuts to be done of form "<cut_name>: <cut_definition>"\&. The
cuts are independent and there is one special cut "all_events"\&.
.br
Default value: Empty dictionary
.TP
\fBcutLabels\fR (optional)
Dictionary of labels for cuts defined in \fBcutList\fR which will be used in
LaTeX table(s)\&.
.br
Default value: Empty dictionary
.TP
\fBdoScale\fR (optional)
Whether to scale the results to the expected integrated luminosity\&.
.br
Default value: True
.TP
\fBintLumi\fR (optional)
Expected integrated luminosity in pb^{-1}\&.
.br
Default value: 1.0 pb^{-1}
.TP
\fBdoTree\fR (optional)
Save events passing final cuts into output TTree\&.
.br
Default value: False
.TP
\fBsaveTabular\fR (optional)
Save results into LaTeX table(s)\&.
.br
Default value: False
.TP
\fBsaveJSON\fR (optional)
Save results into JSON file.
.br
Default value: False
.PP
This section is under construction. You are invited to help :)
.SH SEE ALSO
fccanalysis(1), fccanalysis-final(1)
.SH BUGS
Many
.SH AUTHORS
There are many contributors to the FCCAnalyses framework, but the principal
authors are:
.in +4
Clement Helsens
.br
Valentin Volkl
.br
Gerardo Ganis
.SH FCCANALYSES
Part of the FCCAnalyses framework\&.
.SH LINKS
.PP
.UR https://hep-fcc\&.github\&.io/FCCAnalyses/
FCCAnalyses webpage
.UE
.PP
.UR https://github\&.com/HEP\-FCC/FCCAnalyses/
FCCAnalysises GitHub repository
.UE
.PP
.UR https://fccsw\-forum\&.web\&.cern\&.ch/
FCCSW Forum
.UE
.SH CONTACT
.pp
.MT [email protected]
FCC-PED-SoftwareAndComputing-Analysis
.ME
Loading

0 comments on commit a178c42

Please sign in to comment.