From 19872be9edce393cf7287ae9265bfc59ddc1b8e7 Mon Sep 17 00:00:00 2001
From: Dmitry Romanov <romanovda@gmail.com>
Date: Tue, 20 Jul 2021 12:42:03 -0400
Subject: [PATCH] Athena index

---
 docs/howto/athena.yaml         |  27 +++++++++
 docs/howto/full_simulation.rst |  27 ++++++++-
 docs/howto/local_install.rst   | 102 +++++++++++++++++++++++++++++++++
 docs/howto/run_simulation.rst  |   6 --
 docs/index.rst                 |   3 +-
 5 files changed, 156 insertions(+), 9 deletions(-)
 create mode 100644 docs/howto/athena.yaml
 create mode 100644 docs/howto/local_install.rst
 delete mode 100644 docs/howto/run_simulation.rst

diff --git a/docs/howto/athena.yaml b/docs/howto/athena.yaml
new file mode 100644
index 0000000..f089e04
--- /dev/null
+++ b/docs/howto/athena.yaml
@@ -0,0 +1,27 @@
+spack:
+  specs:
+    - assimp +ipo
+    - acts@8.03.0 +dd4hep +digitization +examples +fatras +identification +json +tgeo +ipo
+    - cmake
+    - clhep cxxstd=17
+    - dd4hep +geant4 +hepmc3 +lcio +ipo
+    - eigen
+    - gaudi@34.0 +ipo
+    - geant4 +ipo -qt -opengl -python +vecgeom cxxstd=17
+    - genfit +ipo
+    - hepmc3 +interfaces +python +rootio
+    - lcio +ipo
+    - nano
+    - opencascade +ipo +tbb -vtk
+    - podio +ipo
+    - pythia8 +fastjet
+    - root cxxstd=17 +fftw +fortran +gdml +mlp +pythia8 +root7 +tmva +vc +xrootd +ssl
+    - singularity +suid
+    - xrootd cxxstd=17 +python
+    - eicd
+    - npdet@master
+  concretization: together
+  config:
+    install_missing_compilers: true
+    # install_tree: /opt/software
+  view: false
\ No newline at end of file
diff --git a/docs/howto/full_simulation.rst b/docs/howto/full_simulation.rst
index 71a141a..7bbec88 100644
--- a/docs/howto/full_simulation.rst
+++ b/docs/howto/full_simulation.rst
@@ -47,15 +47,38 @@ Using npsim (wrapper around ddsim) command line:
 
 
 
+Geometry visualization
+----------------------
+
+There are many ways to see the geometry and tracks: 
+
+1. Through Geant4 event display
+2. geoDisplay (root geoViewer)
+3. ddeve (root EVE based event display...)
+4. dd_web_display (using browser and jsroot library)
+
+
+Geometry conversion
+-------------------
+
 Convert to GDML
----------------
+~~~~~~~~~~~~~~~
 
 There is a convert_to_gdml.py script in the detector repository 
 (https://eicweb.phy.anl.gov/EIC/detectors/athena/-/blob/master/scripts/convert_to_gdml.py). 
 That can be used to export ALL of ATHENA to gdml, but not individual detector systems. 
 
-This is actually [done](https://eicweb.phy.anl.gov/EIC/detectors/athena/-/blob/master/.gitlab-ci.yml#L168) on every commit
+This is actually `done <https://eicweb.phy.anl.gov/EIC/detectors/athena/-/blob/master/.gitlab-ci.yml#L168>`_ on every commit
 and the results are saved as job artifacts. 
 
 `The latest athena.gdml from the master branch <https://eicweb.phy.anl.gov/api/v4/projects/473/jobs/artifacts/master/raw/geo/athena.gdml?job=report&item=default>`_
 
+
+Convert to root
+~~~~~~~~~~~~~~~
+
+One can use dd_web_display to actually just save root geometry
+
+.. code:: bash
+
+    dd_web_display --export athena.xml  # will create a .root file with the geometry
\ No newline at end of file
diff --git a/docs/howto/local_install.rst b/docs/howto/local_install.rst
new file mode 100644
index 0000000..1986c8a
--- /dev/null
+++ b/docs/howto/local_install.rst
@@ -0,0 +1,102 @@
+Local installation
+==================
+
+***(!)Warning(!)*** - local installation is for expert users only! 
+There are many possible pitfalls why some parts of the software might not be installed, give compilation errors, etc. 
+Then it require some spack-kung-foo to debug and recover the installation. Finally you may end up with different
+options compiled (like QT support for Geant4) so your installation (or even simulation results!) are different than in production. 
+
+We release container images exactly to avoid all the problems above. So if you don't want to struggle use them. But if you want...
+
+Spack
+-----
+
+
+Install spack
+.............
+
+Spack is a package management tool designed to support multiple versions
+and configurations of software on a wide variety of platforms and
+environments. Spack allows to automatically build target packages with
+all needed dependencies. `Sapck
+documentation <https://spack.readthedocs.io/en/latest/getting_started.html#installation>`__
+
+The installation consist of 3 steps then: 1. Install spack itself 2.
+Install  `eic-spack repository <https://github.com/eic/eic-spack>`__ (with EIC
+packages) 3. Run spack command to install athena packages (like npdet)
+
+To install spack and EIC repository:
+
+.. code:: bash
+
+    git clone https://github.com/spack/spack.git
+
+    #Source environment
+
+    # For bash/zsh users
+    $ . spack/share/spack/setup-env.sh
+
+    # For tcsh/csh users
+    $ source spack/share/spack/setup-env.csh
+
+You should be able now to use spack:
+
+.. code:: bash
+
+    spack info root
+
+(!) By default, all packages will be downloaded, built and installed in this spack directory
+
+`More documentation on spack installation <https://spack.readthedocs.io/en/latest/getting_started.html#installation>`_
+
+Clone and add `eic-spack repository <https://github.com/eic/eic-spack>`_:
+
+.. code:: bash
+
+    # Adding the EIC Spack Repository
+    git clone https://github.com/eic/eic-spack.git
+
+    # Add this repository to your Spack configuration
+    spack repo add eic-spack
+
+
+Then you should be able to install ATHENA packages. The full spack environment for the stack:
+
+.. code:: yaml
+
+    spack:
+        specs:
+            - assimp +ipo
+            - acts@8.03.0 +dd4hep +digitization +examples +fatras +identification +json +tgeo
+                +ipo
+            - cmake
+            - clhep cxxstd=17
+            - dd4hep +geant4 +hepmc3 +lcio +ipo
+            - eigen
+            - gaudi@34.0 +ipo
+            - geant4 +ipo -qt -opengl -python +vecgeom cxxstd=17
+            - genfit +ipo
+            - hepmc3 +interfaces +python +rootio
+            - lcio +ipo
+            - nano
+            - opencascade +ipo +tbb -vtk
+            - podio +ipo
+            - pythia8 +fastjet
+            - root cxxstd=17 +fftw +fortran +gdml +mlp +pythia8 +root7 +tmva +vc +xrootd +ssl
+            - singularity +suid
+            - xrootd cxxstd=17 +python
+            - eicd
+            - npdet@master
+        concretization: together
+        config:
+            install_missing_compilers: true
+            # install_tree: /opt/software
+        view: false
+
+Copy this or download `athena.yaml <athena.yaml>`_
+
+.. code:: bash
+
+    spack env create athena athena.yaml
+    spack env activate athena
+    spack install
\ No newline at end of file
diff --git a/docs/howto/run_simulation.rst b/docs/howto/run_simulation.rst
deleted file mode 100644
index eede9ca..0000000
--- a/docs/howto/run_simulation.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-Run simulation
-==============
-
-This page provides information and tips about running the simulation, geometry visualization and 
-data processing. 
-
diff --git a/docs/index.rst b/docs/index.rst
index e2541d1..31876e6 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -26,11 +26,12 @@ ATHENA Software
    :caption: HOWTOs:
    
    howto/run_fast_simulation
-   howto/full_simulation_tutorial
+   howto/full_simulation
    howto/use_singularity
    howto/s3_file_storage
    howto/beagle_generator
    howto/geometry_viewer
+   howto/local_install
 
 .. toctree::
    :maxdepth: 1
-- 
GitLab