-- SaskiaCharity - 17 Feb 2023

Installing MUonE at Liverpool

This is a guide to install and run the MUonE FairRoot simulation on the HEP machines at Liverpool.

Background

Repositories to be installed:

FairSoft: https://github.com/FairRootGroup/FairSoft

FairRoot: https://github.com/FairRootGroup/FairRoot

FairMUonE: https://gitlab.cern.ch/mgoncerz/fairmuone

Instructions to install on MacBook (warning: installation is 30GB): https://hep.ph.liv.ac.uk/twiki/Main/FairMUonE

1. Obtain Singularity container and setup script

Make a copy of the singularity container /hepstore/scharity/Containers/muone_ubuntu_2004.sif:

cp /hepstore/scharity/Containers/muone_ubuntu_2004.sif /path/to/your/container/muone_ubuntu_2004.sif

Download the setup script from here: cp to your chosen area on Liverpool machines e.g. $HOME/MUonE/.

Edit the top lines of the setup script to set your chosen paths to singularity file and install directory

# Location of your chosen .sif file                                                                                                                                                 
export MUONE_SING_IMG=/hepstore/scharity/Containers/muone_ubuntu_2004.sif

# Name of your chosen install folder - script will create $HOME/$DIRNAME and                                                                                                        
# install the repositories there                                                                                                                                                    
DIRNAME=MUonE

# Number of cores to use for build - default is 2                                                                                                                                   
NCORES=2

Check out the code

The setup script will check out the repositories and creates functions for building them. To check out the code do:
source setup_muone.sh

The first time you run this, you should do the following:
singularity shell /path/to/your/container/muone_ubuntu_2004.sif
source $FAIRSOFTBASE/bootstrap-cmake.sh cmake-install
exit

This only needs to be run once, the first time you want to compile FairSoft. On subsequent times you don't need to do this step. Just source the setup_muone.sh script above each time you start a new shell.

To compile FairSoft, do:
 fairsoft_build 

This will take around one hour. Highly recommended to run this on one of phi, iota etc, otherwise build time is much longer. If the load is light you can increase the number of cores in the setup, but the limiting factor on the speed of compilation is the install of ROOT and GEANT4.

Once this script has completed you can now build FairROOT. The MUonE directory has already been moved to the correct place within FairROOT by the setup script.

To build FairRoot, do:
 fairroot_build 

At this point, you might see errors like this:
[ 25%] Building CXX object MUonE/MUonEDetector/Configuration/CMakeFiles/MUonEDetectorConfiguration.dir/MUonEDetectorCalorimeterConfiguration.cxx.o
/user/scharity/MUonE/FairRoot/MUonE/MUonEDetector/Configuration/MUonEDetectorCalorimeterConfiguration.cxx:3:10: fatal error: FairLogger.h: No such file or directory
    3 | #include "FairLogger.h"
      |          ^~~~~~~~~~~~~~

or
-- Configuring done
CMake Error at MUonE/MUonEGeantConfiguration/CMakeLists.txt:34 (target_link_libraries):
  Target "MUonEGeantConfiguration" links to:

    FairRoot::FairTools

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

In this case you can use the following function:
update_muone_cmakelists

which will add/correct the problematic CMakeLists.txt. Then try
fairroot_build 

again. This takes around 20 minutes or so the first time you compile it.

Running code and tests

You will need to be inside the singularity container to run ROOT macros and call executables using the compiled code. The setup script uses singularity exec to do this, but it is probably easier to use a shell within the container. For some background information on singularity containers see https://hep.ph.liv.ac.uk/twiki/Computing/HEPContainerGuide.

Open a shell in the muone singularity container and run the test ROOT macro (assuming you are starting from a clean shell on a HEP machine):
cd /path/to/your/MUonE
source setup_muone.sh
cd $FAIRROOTINSTALL/share/MUonE/macros
singularity shell /path/to/your/container/muone_ubuntu_2004.sif
source $FAIRROOTINSTALL/bin/FairRootConfig.sh

At this point you should see the following output:
Singularity> source $FAIRROOTINSTALL/bin/FairRootConfig.sh
bash: lsb_release: command not found
System during compilation: 
                           x86_64
System now               : 
                           x86_64

If you don't and instead you see an error message complaining that the code was compiled with a different operating system than you are currently in, stop and check which singularity image file (.sif) you are using.

Assuming that worked you can now try and run the test macros:
cd $FAIRROOTINSTALL/share/MUonE/macros
root -l 'runProductionJob.C+("exampleProductionJob")'

If this is successful you'll see the following output:
>>> Event 9
Time of this run:   User=0.180000s Real=0.190755s Sys=0.010000s
Number of events processed: 10
[INFO] Reconstructed events filter: 0 events out of 10 passed. Filter efficiency: 0
[INFO] Combined results of event filters: 0 events out of 10 passed. Filter efficiency: 0
[INFO] 
[INFO] Run complete.

========================================================================
N generated events        = 8
N weights                 = 8
N negative weights        = 0
N weights above Wmax      = 0
True Max weight           = 2.091
Cross section             = 1888.145 +/- 648.482
Cross section (negative)  = 0.000 +/- 0.000
Cross section (above max) = 0.000 +/- 0.000
========================================================================

Note about a bug: there appears to be a bug in the runProductionJob.C macro. To fix it, change line 45:
//tmp_run->SetSimulationConfig(geant_config);                                                                                                              tmp_run->SetSimulationConfig(std::unique_ptr<FairGenericVMCConfig>(geant_config));
Topic attachments
I Attachment Action Size Date Who Comment
setup_muone.shsh setup_muone.sh manage 3 K 17 Feb 2023 - 16:15 SaskiaCharity Setup script for MUonE FairSoft installation
Topic revision: r2 - 20 Feb 2023, SaskiaCharity
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback