Skip to content

matildamarjamaki/nanogen-study

Repository files navigation

NanoGEN Study

This repository contains a set of exploratory ROOT macros developed to study NanoGEN event samples.

The repository includes:

  • plot_nanogen.C – reads NanoGEN data from a ROOT TTree and produces basic histograms.
  • convert_nanogen_to_rntuple.C – converts selected NanoGEN branches from a TTree into an RNTuple.
  • plot_nanogen_rntuple.C – reads the converted RNTuple and produces the same set of histograms.
  • plot_nanogen_ttree_modern.C – modernized TTree example using automatic resource management (std::unique_ptr) and stack allocation.

The scripts were written to explore NanoGEN data and compare TTree- and RNTuple-based analysis workflows.

1. Working directory

The work was done in EOS:

cd /eos/home-m/mmarjama/nanogen_study

The directory currently contains:

ls

Expected files:

plot_nanogen.C
nanogen_histograms.root
jet_pt.png
particle_pt.png
jet_eta.png
particle_eta.png
njet_per_event.png
nparticles_per_event.png
QCD.root

2. NanoGEN sample location

Nestor provided the samples at Helsinki T2:

/store/user/nmancill/Inc_jet/NP_production/MadGraph

The samples are organized by:

  • HT bin
  • generator: Pythia or Herwig
  • NP setting: NP_ON or NP_OFF
  • production version

The sample used here was:

QCD-2Jets_HT_100to200_Pythia_NP_ON_v8

The specific ROOT file used was:

/store/user/nmancill/Inc_jet/NP_production/MadGraph/QCD-2Jets_HT_100to200_Pythia_NP_ON_v8/Run3_2024_Summer24/260623_123242/0000/QCD-2Jets_HT_100to200_Pythia_NP_ON_999.root

The full XRootD path is:

root://hip-cms-se.csc.fi//store/user/nmancill/Inc_jet/NP_production/MadGraph/QCD-2Jets_HT_100to200_Pythia_NP_ON_v8/Run3_2024_Summer24/260623_123242/0000/QCD-2Jets_HT_100to200_Pythia_NP_ON_999.root

3. Grid proxy setup

Before accessing the file, a valid CMS VOMS proxy is needed.

Create the proxy:

voms-proxy-init --voms cms --out ~/myProxy --valid 192:00

Make sure the correct proxy is used:

export X509_USER_PROXY=/afs/cern.ch/user/m/mmarjama/myProxy

Check it:

echo $X509_USER_PROXY
voms-proxy-info -all

The proxy should contain CMS information, for example:

VO        : cms
attribute : /cms/Role=NULL/Capability=NULL

4. Listing the NanoGEN samples

The top-level sample directory was listed with:

xrdfs hip-cms-se.csc.fi ls /store/user/nmancill/Inc_jet/NP_production/MadGraph

Then the chosen sample was explored step by step:

xrdfs hip-cms-se.csc.fi ls /store/user/nmancill/Inc_jet/NP_production/MadGraph/QCD-2Jets_HT_100to200_Pythia_NP_ON_v8
xrdfs hip-cms-se.csc.fi ls /store/user/nmancill/Inc_jet/NP_production/MadGraph/QCD-2Jets_HT_100to200_Pythia_NP_ON_v8/Run3_2024_Summer24
xrdfs hip-cms-se.csc.fi ls /store/user/nmancill/Inc_jet/NP_production/MadGraph/QCD-2Jets_HT_100to200_Pythia_NP_ON_v8/Run3_2024_Summer24/260623_123242

The last level contained subdirectories such as:

0000
0001

The ROOT files were found with:

xrdfs hip-cms-se.csc.fi ls /store/user/nmancill/Inc_jet/NP_production/MadGraph/QCD-2Jets_HT_100to200_Pythia_NP_ON_v8/Run3_2024_Summer24/260623_123242/0000

5. Exploring the ROOT file

The file was opened interactively with ROOT:

root -l root://hip-cms-se.csc.fi//store/user/nmancill/Inc_jet/NP_production/MadGraph/QCD-2Jets_HT_100to200_Pythia_NP_ON_v8/Run3_2024_Summer24/260623_123242/0000/QCD-2Jets_HT_100to200_Pythia_NP_ON_999.root

Inside ROOT, the file content was checked with:

.ls

The file contains these trees:

Events
LuminosityBlocks
Runs
MetaData
ParameterSets

The main physics tree is:

Events

The branches were printed with:

Events->Print()

One event was inspected with:

Events->Show(0)

The number of events was checked with:

Events->GetEntries()

The file contains:

794 events

6. Important branches

Important generator-level jet branches:

nGenJet
GenJet_pt
GenJet_eta
GenJet_phi
GenJet_mass
GenJet_partonFlavour
GenJet_hadronFlavour

Important generator-level particle branches:

nGenPart
GenPart_pt
GenPart_eta
GenPart_phi
GenPart_mass
GenPart_pdgId
GenPart_status
GenPart_statusFlags
GenPart_genPartIdxMother

Other useful branches:

genWeight
Generator_weight
LHE_HT
LHE_AlphaS
nLHEPart
LHEPart_pt
LHEPart_eta
LHEPart_pdgId
nPSWeight
PSWeight

In the first event, for example:

nGenJet = 5
nGenPart = 1222

This means that the event contains 5 generator-level jets and 1222 generator-level particles.

7. Plotting script

The plotting script is:

plot_nanogen.C

It is a ROOT C++ macro. It opens the NanoGEN ROOT file, reads the Events tree, and creates histograms from the following branches:

GenJet_pt
GenPart_pt
GenJet_eta
GenPart_eta
nGenJet
nGenPart

The macro is run with:

cd /eos/home-m/mmarjama/nanogen_study
export X509_USER_PROXY=/afs/cern.ch/user/m/mmarjama/myProxy
root -l -q plot_nanogen.C

Successful output should look like:

Number of events: 794
Info in <TCanvas::Print>: png file jet_pt.png has been created
Info in <TCanvas::Print>: png file particle_pt.png has been created
Info in <TCanvas::Print>: png file jet_eta.png has been created
Info in <TCanvas::Print>: png file particle_eta.png has been created
Info in <TCanvas::Print>: png file njet_per_event.png has been created
Info in <TCanvas::Print>: png file nparticles_per_event.png has been created
Saved histograms and PNG plots.

8. Output files

The macro produces one ROOT file:

nanogen_histograms.root

and six PNG plots:

jet_pt.png
particle_pt.png
jet_eta.png
particle_eta.png
njet_per_event.png
nparticles_per_event.png

The meaning of the plots:

  • jet_pt.png: generator-level jet transverse momentum distribution
  • particle_pt.png: generator-level particle transverse momentum distribution
  • jet_eta.png: generator-level jet pseudorapidity distribution
  • particle_eta.png: generator-level particle pseudorapidity distribution
  • njet_per_event.png: number of generator-level jets per event
  • nparticles_per_event.png: number of generator-level particles per event

9. Summary

First, an example NanoGEN sample produced by Nestor was located at Helsinki T2. Second, one ROOT file was opened and its trees, branches, and event content were inspected. Third, a ROOT C++ macro was written to read the file and produce exploratory plots.

The current study uses one Pythia NP_ON sample in the HT 100–200 bin. A natural next step would be to repeat the same script for:

Pythia NP_ON vs Pythia NP_OFF
Herwig NP_ON vs Herwig NP_OFF
Pythia vs Herwig

This would make it possible to start comparing the effect of non-perturbative corrections and generator differences.

aja -->

cd /eos/home-m/mmarjama/nanogen_study

export X509_USER_PROXY=/afs/cern.ch/user/m/mmarjama/myProxy

root -l -q plot_nanogen.C

About

Exploratory ROOT and RNTuple analysis scripts for NanoGEN event samples.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages