Skip to content

Custom NTuples

Theo Chatzistavrou edited this page Jul 28, 2023 · 6 revisions

Some Motivation

The standard NanoAOD files in CMS are not containing some pieces of information for space reduction. One important information for example is the prescale information for triggers. Also for any study concerning future deployments one has to modify HLT configuration and re-run on RAW events. In this case NanoAOD for data do not even exist! (Not to mention future detector developments - like HL-LHC triggers) To cope with these problems we make custom NTuples with the JMETriggerAnalysis framework. And then run the processor on those NTuples.

Bellow you can find info for:

Producing Custom NTuples

JMETriggerAnalysis Framework Setup

To setup the framework use the following commands:

cmsrel CMSSW_13_0_7_patch1
cd CMSSW_13_0_7_patch1/src
cmsenv
git clone https://github.com/theochatzis/JMETriggerAnalysis.git -b run3_13_0_X
scram b -j 12

(Temporarily available only in Theo Chatzistavrou repo - soon will be integrated in official framework)

Creating the NTuples

The NTuplizer

The basic configuration file for producing the NTuples is the jmeTriggerNTuple2023Data_miniAOD_cfg.py located in JMETriggerAnalysis/NTuplizers/test directory.

You can try to run this script locally to produce an NTuple named out_HLT_Run3TRK.root:

cmsRun jmeTriggerNTuple2023Data_miniAOD_cfg.py maxEvents=10 output=out_HLT_Run3TRK.root globalTag=130X_dataRun3_Prompt_v3

Basic options definitions:

  • maxEvents maximum number of events
  • output name of output file
  • globalTag the globalTag for conditions. (In case you re-run HLT not mandatory)

Note: For seeing exactly the full configuration file the cmsRun command runs above you can use the dumpPython option. For example you can get the test_config.py with:

python3 jmeTriggerNTuple_cfg.py dumpPython=test_config.py

Running batch jobs

The above configuration file can be used in a batch system to produce large size samples. The used in this setup are with CRAB or HTC Condor. You can find some instructions for both of them bellow.

HTC Condor

For HTC Condor there are 2 python scripts that are used, located in JMETriggerAnalysis/NTuplizers/scripts.

  • bdriver.py: this script creates condor configuration files, each containing a different subset of events, and the corresponding executables (.sh scripts) that these use. It can also submit the jobs right after the configuration files creation using the --submit option. For the creation of the executables it needs a config file as input, which we produce via the dumpPython option mentioned above.
  • bmonitor.py: this script can be used to monitor and submit scripts created by bdriver. To run these scripts one can use an executable shell scripts like the ones located in JMETriggerAnalysis/NTuplizers/test/scripts. An example of such a script is:
./makeNTuples_run3_miniAOD.sh

for the output dir you can change the OUTPUT_DIR_EOS inside the script.

CRAB

For CRAB you can find some configuration scripts used in the JMETriggerAnalysis/NTuplizers/test/crab folder. One example of a submission to CRAB:

crab submit -c crab3_miniAOD.py

one can change the outputfiles location from options: config.Site.storageSite for the Site and config.Data.outLFNDirBase for the output directory path.