DESY Hbb Analysis Framework
|
Core Analysis Framework of the DESY CMS Higgs -> bb group
See also the code documentation Doxygen page
:warning: This package is supposed to contain only general codes to be used for analysis. Codes for specific analysis must be developed in dedicated packages/repositories, e.g. for the MSSM Hbb analyses one can use for developments the package Analysis/MssmHbb, which is currently under construction.
The codes as well as the ntuples are independent of CMSSW. However, in order to compile it uses scram
. So the latest version in any architecture should be fine.
:zzz: The USER_CXXFLAGS="-Wno-misleading-indentation"
prevents a large number of warnings from misleading identation in modules of the boost library. User can also define the environment variable below in .bashrc
or every time after the command cmsenv
Scale factors, efficiencies etc can be obtained from the analysis-calibrations repository (see also the README.md in each run period directory). It is recommended to install it in the Analysis/Tools/data directory, for the framework loads the calibrations files from that path
The lists of ntuples files can be obtained from the analysis-ntuples repository (see also the README.md in each run period directory). The repository can be installed in a directory of your convenience, e.g.
The ntuples path name is the global one for general grid access. If you are running your jobs on the NAF, it should be faster to use the /pnfs/...
path name. To make the conversion simply issue the following command once for each installation of the analysis-ntuples as described above
The script will modify all the files in $CMSSW_BASE/src/Analysis/Tools/data/ntuples
.
A simple example macro can be found in Analysis/Tools/bin/AnalyserSimpleExample.cc. The example is a simple offline and online dijet selection (+ muon selection in the semileptonic case) using signal MC samples and triggers from 2017 and 2018 periods. The macro uses a configuration file as input. Configuration files are avaialble for both the all-hadronic and semileptonic cases for both 2017 and 2018 periods:
To execute an example
A python script to submit to NAF condor queue, naf_submit.py
, is available.
N.B.: So far the script does not make a single submission of multiple jobs. So be careful not to make too many submissions.
If you provide a configuration file with the NTUPLES and JSON parameters, you do not need to parse them, the script will read out that information from the configuration file.
Using the example above to be submitted to the naf using HTCondor
After the jobs were submitted there will be a directory called Condor_AnalyserSimpleExample_analyser_example_semilep_2018
containing several subdirectories called job_xxxx
. In each of this subdirectory there will be several files. Files to take note will be:
<output>.root
- the output file containing histograms etc of your analysisfinished.txt
- a file that indicates whether the executable ran until the end (only if you are using the framework)job.submit
- HTCondor submit configuration file. If a job is not finished you can resubmit that job manually by issuing the command Once the directory Condor_AnalyserSimpleExample_analyser_example_semilep_2018
is created, one can use the status options, e.g.
will display a table like this
where v
will appear as a green tick mark and x
as a red X.
If jobs were aborted or finished with error, you can resubmit all of those jobs with the command
which, in the example above, will resubmit the jobs job_0004
and job_0005
.
In the macro the first thing done is the main Analyser
instantiation
The [Info]
block in the .cfg
file
passes general information to initialise the Analyser
in the macro. The process
parameter is the name of the parent TDirectoryFile
in the ntuple. To find it
Where ntuple.root
is any input ntuple file, such as the ones in your roorFileList.txt
or in the analysis-ntuples.
Hopefully the other names of the config parameters are self-explanatory.
In data one must specify the json file with certified lumis, e.g.
The event loop must start like this
where the analyser.event(i)
reads the event from the ntuple and performs some actions, such as applying generator event weights in MC and JSON certified lumis selection in data.
The Analyser
has several predefined selection methods that reads parameters from the configuration file and apply to the event. The selections must be within the event loop.
For example, if the analysis involves jets, one must define which collection to be used, the minimum number of jets, the jet identification, the jet pT etc. In the configuration there is a block for jets with the relevant parameters
:warning: Parameters such as ptMin or etaMax are vectors, so the order in which they are put in the configuration makes a difference, so the first entry corresponds to the leading object, the second entry to the second leading object and so on.
In the macro, the selections are performed within the event loop calling the methods, which automatically reads the parameters from the configuration, e.g.
This will prepare a list of jets containing only jets passing the required identification criteria and with a certain number of jets defined in the configuration.
In the Analyser::selectionJet
method the argument is the jet rank, i.e., 1
refers to the leading jets, 2
refers to the second leading jet. the method will select the jet according to its pt and eta criteria defined in the configuration.
For the b-tagging there is a block in the configuration file, where one defines the algorithm, working points etc.
With this configuration, one intends to select events with at least the two leading jets tagged with medium working point using the deepflavour algorithm. The thresholds of the working points myst be specified.
To perform the selection in the event loop:
where the argument of the Analyser::selectionBJet
is the jet rank as in the jet kinematic selection above.
Muon selection has its own configuration block and the procedure works in a similar way as jets
The selection code can be for example
:warning: The method Analyser::selectionMuons
for muon kinematic selection differs from the one used for jet kinematic selection, for it makes a list of muons passing the required kinematic selection and the event is good if there is at list the minimum number of jets required. This method is useful for the muon-jet association in analyses requiring jets containing a muon.
If one wants to select muons depending on their ranking, then one can use, like in the jets case,
Histograms can be predefined in the Analyser
, e.g. for jets one can use the method jetHistograms
, which receives the arguments number of jets
, which must be at most the minimum number of jets required, and a name of a directory. One can create as many directories as needed and fill the histograms at different steps of the analysis workflow, e.g. before the event loop:
then within the event loop: