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.
The work was done in EOS:
cd /eos/home-m/mmarjama/nanogen_studyThe directory currently contains:
lsExpected 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
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
Before accessing the file, a valid CMS VOMS proxy is needed.
Create the proxy:
voms-proxy-init --voms cms --out ~/myProxy --valid 192:00Make sure the correct proxy is used:
export X509_USER_PROXY=/afs/cern.ch/user/m/mmarjama/myProxyCheck it:
echo $X509_USER_PROXY
voms-proxy-info -allThe proxy should contain CMS information, for example:
VO : cms
attribute : /cms/Role=NULL/Capability=NULL
The top-level sample directory was listed with:
xrdfs hip-cms-se.csc.fi ls /store/user/nmancill/Inc_jet/NP_production/MadGraphThen 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_v8xrdfs hip-cms-se.csc.fi ls /store/user/nmancill/Inc_jet/NP_production/MadGraph/QCD-2Jets_HT_100to200_Pythia_NP_ON_v8/Run3_2024_Summer24xrdfs 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_123242The 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/0000The 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.rootInside ROOT, the file content was checked with:
.lsThe 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
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.
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.CSuccessful 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.
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 distributionparticle_pt.png: generator-level particle transverse momentum distributionjet_eta.png: generator-level jet pseudorapidity distributionparticle_eta.png: generator-level particle pseudorapidity distributionnjet_per_event.png: number of generator-level jets per eventnparticles_per_event.png: number of generator-level particles per event
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