This code is based in the Run2 Analysis https://github.com/irenedutta23/HmmAna
cmsrel CMSSW_15_0_19
cd CMSSW_15_0_19/src
cmsenv
git clone git@github.com:LPC-HH/HToMuMu.git
scram b clean
scram b -j 8
cd HToMuMu
make -j4
You need to have a CMS GRID certificate established
voms-proxy-init -voms cms
The format for running the analyzer is
./bin/HmmAnalyzer runList.txt(or .list) out.root mc/data is_data year_num if_include_Z_region if_include_H_region
For simulations
./bin/HmmAnalyzer runList.txt out.root mc F 2024 F T
For data
./bin/HmmAnalyzer runList.txt out.root data T 2024 F T
To run over all the data sets look at condor/README.md to run it in condor jobs
This will create a root file with tuples with all the usefull variables and the correspodeting weights;
For data/simulation
./bin/CreateTuple analyzer_output.root output_directory era dataset T(data)/F(simulation) T(signal)/F(Bkg-data)
To run over all the data sets look at condor/README.md to run it in condor jobs.
If you want to run it over a small dataset look at scripts/README.md
Analyzer and tuplizer should be run over all datasets using condor jobs. To do this, look at the README in condor/
After you have the tuples, you need them locally to plot from and run the BDT on.
cd ./root_io/tuples/
bash hadd_tuples_EOS.sh
bash hadd_tuples.sh
The second hadd creates combined era tuple files
BDT does not like big files, so we need to generate a tuples that contain just the events from that production mode and the training variables.
To this use src/SkimTuples_VBF.cc src/SkimTuplesggH.cc and the scripts ./scripts/run_skim_ggH.py ./scripts/run_skim_VBF.py
You can change the datasets by changing the lists eras, background_datasets, and signal_datasets in the script.
Run
python3 ./scripts/run_skim_ggH.py
python3 ./scripts/run_skim_VBF.py
Once we have the skim tuples, you must hadd to have one background tuple and one signal sample, you can just do
cd ./root_io/skim/(ggH/VBF)
bash hadd_skim.sh
You can also run the skimming, hadd, and removal of previous tuples at once with:
bash scripts/run_skim.sh (bdt/kin/both)This logs the scripts for the skimming and hadd in scripts/logs/
Look at python/xgboost/README.md
All plotting codes are located at plot_macros/
This section describes the complete workflow, from producing the analyzer tuples to calculating the final systematic uncertainties.
Go to the condor/ directory:
cd ./condor/Edit:
./condor/utils/version.py
and set the version name you want to use to tag your tuples.
From the condor/ directory, run:
python3 create_analyzer_jobs_LPC.py
bash condor_job_sender.shThis creates and submits the analyzer jobs. The resulting tuples will be stored in the EOS space defined by the configuration.
If you also want to produce the muon (p_T) systematic variations, run:
python3 create_analyzer_jobs_LPC_muonsys.py
bash condor_ctuple_job_sender_syst.shOnce the jobs have finished, check for failed or missing jobs with:
bash analyzer_job_checker_rerun.sh versionReplace "version" with the analysis version you are using. For example:
bash analyzer_job_checker_rerun.sh 2.2The script will check the submitted jobs and rerun the ones that failed.
To produce the histograms containing the sum of generated weights, go to the scripts/ directory:
cd ../scripts/Run:
python3 ComputeWeights.py
python3 ComputeWeights_muon_sys.pyComputeWeights.py computes the nominal generated-weight information, while ComputeWeights_muon_sys.py does the same for the muon systematic samples.
Return to the condor/ directory:
cd ../condor/Create and submit the nominal ctuple jobs:
python3 create_ctuples_jobs_LPC.py
bash condor_ctuple_job_sender.shTo produce the ctuples for the muon and jet (p_T) systematic variations, run:
python3 create_ctuples_jobs_LPC_syst.py
bash condor_ctuple_job_sender_syst.shAfter the jobs have finished, check for failed jobs with:
bash ctuple_job_checker_rerun.sh versionFor example:
bash ctuple_job_checker_rerun.sh 2.2.2Go to the tuple directory:
cd ../root_io/tuples/Run:
bash hadd_tuples_EOS.sh -eos
bash hadd_tuplesThis merges the nominal tuples required for the analysis.
To merge the systematic tuples using Condor jobs, return to the condor/ directory:
cd ../../condor/Then run:
bash submit_hadd_systematics.shGo to the XGBoost directory:
cd ../python/xgboost/Submit the jobs that add the BDT scores to the systematic tuples:
bash submit_bdt_systematics.shFinally, return to the initial project directory and run:
bash ./scripts/calculate_all_systematics.shc This calculates the systematic uncertainties from the nominal and systematic tuples.
The complete workflow is:
Set version
↓
Produce analyzer tuples
↓
Check analyzer jobs
↓
Compute generated-weight histograms
↓
Produce ctuples
↓
Check ctuple jobs
↓
Hadd nominal tuples
↓
Hadd systematic tuples
↓
Add BDT scores to systematic tuples
↓
Calculate systematic uncertainties
The muon and jet systematic steps are optional if only the nominal analysis is needed.