General purpose analysis software for (SI)DIS at the EIC
This repository provides a set of common tools for the analysis of both full and fast simulations, including the following features:
src/AnalysisDelphes.cxx
for reading Delphes treesPhiH
and qT
, for single
particles, as well as jet variablesTTrees
If you prefer to use your own analysis code, but would still like to make use of the common tools provided in this repository (e.g., kinematics reconstruction), this is also possible; you only need to stream the data structure you need, most likely within the event loop. In this situation, it is recommended you fork the repository (pull requests are also welcome).
Here is a flowchart showing the main classes (underlined) and the connections to upstream simulation output:
First, clone this epic-analysis
Github repository:
git clone git@github.com:eic/epic-analysis.git # if you have SSH permission
git clone https://github.com/eic/epic-analysis.git # if you do not have SSH permission
This will create the directory epic-analysis
, which you can then cd
into.
These are common dependencies used for the upstream simulation, some of which
are needed for epic-analysis
as well.
Follow the EIC Software Environment Setup Guide to obtain and install the EIC software image.
eic-shell
script is used to start a container shelleic-shell
If you upgrade your image (eic-shell --upgrade
), you may need to clean
build
everything: make all-clean && make
These are additional dependencies needed by epic-analysis
; they will be built
locally and stored in the deps/
directory (see deps/README.md
for more details). This section documents how to obtain and build local dependencies:
Delphes is the only local dependency that
is not mirrored in deps/
, so you must download and build it first:
deps/install_delphes.sh
delphes
build elsewhere, symlink deps/delphes
to itdeps/
are mirrors, and are already included with epic-analysis
;
they will be built automatically laterWhile you are waiting for Delphes to build, you may want to:
Kinematics
class header and source, along
with documentation, to see what physics reconstruction methods are availabletutorial/
directory, to learn how to run epic-analysis
First, set environment variables:
source environ.sh
Then compile analysis-epic
(and some other local dependencies):
make
cmake
in this repository, and still use Makefiles
epic-analysis
(e.g.,
libaries will be installd in lib/
)make
targets are available (see Makefile
), for more control during
development:make # builds dependencies, then `epic-analysis` (equivalent to `make all`)
make release # build with optimization enabled
make debug # build with debugging symbols
make clean # clean `epic-analysis` (but not dependencies)
make deps # builds only dependencies
make deps-clean # clean dependencies
make all-clean # clean `epic-analysis` and dependencies
make <dependency> # build a particular `<dependency>`
make <dependency>-clean # clean a particular `<dependency>`
Additional build options are available:
INCLUDE_CENTAURO=1 make # build with fastjet plugin Centauro (not included in Delphes by default!)
EXCLUDE_DELPHES=1 make # build without Delphes support; primarily used to expedite CI workflows
INCLUDE_PODIO=1 make # build with support for reading data with PODIO
If you're ready to try the software hands-on, follow the tutorials in
the tutorial/
directory. Otherwise continue reading below.
deps/run_delphes.sh
is provided, which runs
delphes
on a given hepmc
or hepmc.gz
file, and sets the output file
names and the appropriate configuration card
deps/delphes_EIC/
directory,
a mirror of eic/delphes_EIC
source environ.sh
)deps/run_delphes.sh
with no arguments for usage guideexeDelphes
to the proper
executable, e.g., DelphesHepMC2
or DelphesHepMC3
, depending
on the format of your generator input*.hepmc.gz
), this script will automatically
stream it through gunzip
, so there is no need to decompress beforehandhepmc
files on S3; follow s3tools documentation
for scripts and guidanceTTree
stored in a root
file
datarec/
hepmc(.gz)
files can be kept in datagen/
AnalysisDelphes
contains the event loop for reading Delphes trees
Analysis
class;
Analysis
handles common setup and final output, whereas the derived
classes are tuned to read the upstream data formatssrc/AnalysisDelphes.cxx
for details of how the full
simulation data are readAnalysisDelphes
with
AnalysisEpic
src/AnalysisEpic.cxx
for details of how the full
simulation data are readAnalysisEcce
or AnalysisAthena
After simulation, this repository separates the analysis procedure into two stages: (1) the Analysis stage includes the event loop, which processes either fast or full simulation output, kinematics reconstruction, and your specified binning scheme, while (2) the Post-processing stage includes histogram drawing, comparisons, table printouts, and any feature you would like to add.
The two stages are driven by macros. See examples in the tutorial
directory,
and follow the README.
epic-analysis
top directory, not from within their subdirectory, e.g., run
root -b -q tutorial/analysis_template.C
; this is because certain library
and data directory paths are given as relative pathsIn general, these macros will run single-threaded. See HPC documentation for guidance how to run multi-threaded or on a High Performance Computing (HPC) cluster.
Analysis
class is the main class that performs the analysis; it is
controlled at the macro level
Analysis
derived class (e.g., AnalysisDelphes
)root
file, filled with TObjArray
s of
histogramsTObjArray
can be for a different subset of events (bin), e.g.,
different minimum y
cuts, so that their histograms can be compared and
divided; you can open the root
file in a TBrowser
to browse the
histogramsHistos
class is a container for the histograms, and instances of
Histos
will also be streamed to root
files, along with the binning
scheme (handled by the Adage BinSet
class); downstream post processing code
makes use of these streamed objects, rather than the TObjArray
sAnalysisDelphes
for Delphes trees (fast simulations)AnalysisAthena
for trees from the DD4hep+Juggler stack (ATHENA full simulations)AnalysisEcce
for trees from the Fun4all+EventEvaluator stack (ECCE full simulations)Kinematics
class is used to calculate all kinematicsAnalysis
-derived classes have one instance of Kinematics
for generated
variables, and another for reconstructed variables, to allow quick
comparison (e.g., for resolutions)Analysis
-derived classes, event-by-event or
particle-by-particle or jet-by-jetKinematics
BinSet
and CutDef
classes
analysis_*C
macros in tutorial/
CutDef
can store and apply an arbitrary cut for a single variable, such as:a<x<b
or |x-a|<b
x>a
or x<a
BinSet
, a set of binsCutDef
class; you can either:
N
bins between a
and b
x
and Q2
)TAxis
z
and pT
:
|z-0.3|<0.1
and |pT-0.2|<0.05
|z-0.7|<0.1
and |pT-0.5|<0.05
y
minima:
y>0.05
y>0.03
y>0
(no cut)y=0.1
will appear in all three binsx
,Q2
,z
Analysis
class is also capable of producing a simple TTree
, handled by the
SidisTree
class, which can also be useful for analysis
Analysis
to enable/disable whether this tree is
writtenPostProcessor
class, which does tasks
such as printing tables of average values, and drawing ratios of histograms
postprocess_*.C
macros, which includes the
following:PostProcessor
, with the specified root
file that contains
output from the analysis macrosrc/PostProcessor.h
and src/PostProcessor.cxx
for available
post-processing routines; you are welcome to add your ownAdd your own analysis scripts (macros, etc.) in macro/
, either in the main
directory or in a subdirectory of macro/
.
macro/ci
directory is for scripts used by the CI (see .github/workflows/ci.yml
);
you are welcome to add new analysis scripts to the CIPostProcessor
as neededGit workflow:
Actions
tab for workflows for detailsInsights
tab, and clicking Network
to show the commit graph