Skip to content

cmstas/ZPrimeSnT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Environment & setup

git clone [email protected]:cmstas/ZPrimeSnT.git
pushd ZPrimeSnT/
source /cvmfs/cms.cern.ch/cmsset_default.sh
export SCRAM_ARCH=slc7_amd64_gcc700
cmsrel CMSSW_10_2_13
pushd CMSSW_10_2_13/src
cmsenv
git clone https://github.com/cms-nanoAOD/nanoAOD-tools.git PhysicsTools/NanoAODTools
git clone https://github.com/cms-analysis/HiggsAnalysis-CombinedLimit.git HiggsAnalysis/CombinedLimit
pushd HiggsAnalysis/CombinedLimit
git fetch origin
git checkout v8.2.0
scramv1 b clean; scramv1 b # always make a clean build
popd
scram b
popd
pushd NanoCORE
make -j12
popd

Analysis code:

For more dedtails, refer to cpp/README.md.

Example instructions

Edit cpp/doAll_Zp.C and/or cpp/ScanChain_Zp.C with an appropriate file (or hopefully the default one still exists).

To run locally:

sh cpp/runOutput_Zp.sh DIRECTORY/FOR/OUTPUT/FILES YEAR RUNDATA RUNBKG RUNSIGNAL RUNBFF SAMPLE ADDITIONALBOOLEANFLAGS

For example, to run all data, bkg and signal but not the BFF samples, for all years and with all additional flags to their default values, the command to save the files in a folder called "temp_data" would be:

sh cpp/runOutput_Zp.sh temp_data all 1 1 1 0 all

One should check cpp/doAll_Zp.C for details on the (additional) arguments and their meaning.

This loops and creates a number of output files of the form output_"process"_"year".root containing histograms. Optionally, the file also contains a RooDataSet to be used as input for fitting (see below).

To run on condor:

voms-proxy-init -voms cms
export X509_USER_PROXY=/ABSOLUTE/PATH/TO/PROXY/LOCATION
sh utils/condor/runOutput_Zp_onCondor.sh FOLDER/FOR/OUTPUT/FILES

This script will package the current state of the repository and send it to condor jobs running the cpp/runOutput_Zp.sh with the arguments included in the different lines of utils/condor/runOutput_Zp_onCondor.sub (please edit this file to control what condor jobs you send). More details on this are included in the description of PR#57.

The output of your jobs will be found under /ceph/cms/store/user/$USER/ZPrimeSnTOutput/FOLDER/FOR/OUTPUT/FILES and the plotting logs under utils/condor/plotting_logs.

To produce plots:

python python/stack_plots.py

To produce cutflow table:

python python/make_cutflow_table.py

Fitting code:

pushd CMSSW_10_2_13/src/
cmsenv
popd
pushd cpp/
root -b -q -l -n doAll_fitDimuonMass.C
popd

This creates a ROOT file with a workspace containing all relevant PDFs, to be used as input to combine. Optionally, fits are drawn and fit results are saved in a dedicated ROOT file. In order to plot fit results:

python python/plot_fitResults.py

Limit code (condor):

git clone https://github.com/cms-analysis/HiggsAnalysis-CombinedLimit.git HiggsAnalysis/CombinedLimit
cd HiggsAnalysis/CombinedLimit/
git fetch origin
git checkout v8.2.0
. env_standalone.sh
make

sh utils/condor_limits/runLimits_onCondor.sh <datacard directory> <limit output directory>

Then, use scripts in combineScripts/ to read and plot limits from <limit output directory>. For standard limits:

python combineScripts/readToyLimits.py nomodel <limit output directory>
python combineScripts/plot2DLimits.py <limit output directory>

cmsrel CMSSW_12_5_0
pushd CMSSW_12_5_0/src
cmsenv
python3 combineScripts/getWeightedLimits.py <model> <limit output directory> <expected or observed>
python3 combineScripts/plotWeightedLimits.py <model> <limit output directory> <expected or observed>

NOTE: as of today (November 15, 2022), we only plot expected limits by itself.

Pull requests:

When opening a PR against the main branch, please make sure your code is up-to-date:

pushd ZPrimeSnt/
git checkout main
git pull
git checkout -b <branchname>
<Do your developmets and commit>
git push origin <branchname>

Then, open a PR against main branch and request review.

NanoCORE synchronization:

The NanoCORE subdirectory shall be synchronized often with [email protected]:cmstas/NanoTools.git. For the first time only:

git clone [email protected]:cmstas/NanoTools.git

To pull updates from NanoTools:

pushd NanoTools
git pull
cp NanoCORE/* ../ZPrimeSnT/NanoCORE/
popd
pushd ZPrimeSnT/
git checkout -b <branchname>
git commit -a -m "<description>"
git push origin <branchname>

Then, open pull request to ZPrimeSnT remote repository.

To push updates to NanoTools:

pushd NanoTools
git pull
git checkout -b <branchname>
cp ../ZPrimeSnT/NanoCORE/* NanoCORE/*
git commit -a -m "<description>"
git push origin <branchname>

Then, open pull request to NanoTools remote repository.

Style:

We use clang-format based on LLVM style to format our code. To format the ElectronSelections.cc file in-place, do

clang-format -style="{BasedOnStyle: llvm, IndentWidth: 4, ColumnLimit: 120, AllowShortIfStatementsOnASingleLine: true, AllowShortBlocksOnASingleLine: true}" -i ElectronSelections.cc

If you use vim, add this to the ~/.vimrc (assumes you are working on UAF):

autocmd BufNewFile,BufRead *.cc,*.h,*.C,*.cxx set formatprg=clang-format\ -style=\"{BasedOnStyle:\ llvm,\ IndentWidth:\ 4,\ ColumnLimit:\ 100,\ AllowShortIfStatementsOnASingleLine:\ true,\ AllowShortBlocksOnASingleLine:\ false,\ BreakBeforeBraces:\ Allman}\"

To format your code in vim, press ggvGgq.