effofex
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee
  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Repository https://github.com/effofex/madanalysis5_WSL # What Will I Learn? [MadAnalysis5](https://launchpad.net/madanalysis5) is a suite of software used to generate c/c++ code to analyze particle collider data. It was developed for Linux systems, but, with some tweaks can be run using the [Windows Subsystem for Linux](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux) (WSL, a.k.a. Bash on Ubuntu on Windows) available in Windows 10. - You will learn how to install MadAnalysis5 and its core dependencies under the WSL - You will learn how to generate and run the equivalent of 'hello world' to test the installation. # Requirements - An current installation (build 16215 or later) of Windows 10 - Approximately 1 to 2 gigabytes of drive space, mainly for the WSL installation - An activated WSL with Ubuntu installed - Installing WSL itself is beyond the scope of this tutorial, as there are already details [installation instructions](https://docs.microsoft.com/en-us/windows/wsl/install-win10) from Microsoft and from [third parties](https://www.computerhope.com/issues/ch001879.htm) - This tutorial was specifically tested using ``Ubuntu 16.04.4 LTS``, the user may check their version by typing `lsb_release -a` in the console. # Difficulty - **Intermediate**. The user does not need to be an expert using the command line, but must not be intimidated by it. # Tutorial Contents There are three components to successfully run MadAnalysis5 using a fresh WSL: 1. Installing relevant development tools 1. Installing the software and its dependencies 1. Testing the installation using the equivalent of 'Hello, world!' to analyze some Large Hadron Collider (LHC) data. All of these steps will be performed within the Bash shell, which is available from the start menu or can be found by pressing the Windows key and searching for 'ubuntu'. ## Preparing the WSL environment for development A base install of Ubuntu under WSL will not include the necessary development tools for c/c++ (*e.g.* `gcc` and `make`). The simplest way to install these is to use `build-essential` [metapackage](https://superuser.com/questions/151557/what-are-build-essential-build-dep). The following three commands will update your [package manager](https://www.digitalocean.com/community/tutorials/how-to-manage-packages-in-ubuntu-and-debian-with-apt-get-apt-cache) and install `build-essential`: ```bash sudo apt-get update sudo apt-get upgrade sudo apt-get install build-essential ``` ## Installing MadAnalysis5 and its dependencies Althought MadAnalysis5 has the ability to install some of its dependencies, that route does not always work under WSL. It is advisable to follow the order of installation listed here. ## Python **2.7** As installed under the WSL, Ubuntu does not have Python, which MadAnalysis5 depends on. You must first install Python itself and then set up the environment so that MadAnalysis5 can find it. ```bash sudo apt install python2.7 sudo ln -s /usr/bin/python2.7 /usr/bin/python ``` *Note:* This method assumes that a custom WSL instance is being set up for MadAnalysis5. Although creating a symbolic link to python2.7 is the simplest solution, it can cause issues in environments where other projects requiring Python3 are being run. Setting up a Python `virtualenv` is probably a workable solution in that case, but is beyond the scope of this tutorial. ### Installing the `ROOT` dependency In this section, `ROOT` doe *not* refer to the Unix term, but rather the [CERN particle physics data analysis package](https://root.cern.ch/). Although other versions of ROOT are likely to work, this tutorial was developed using [release 6.10.08](https://root.cern.ch/content/release-61008). The binary release for the appropriate Ubuntu version (here, 16.xx) can be installed using the following commands: ```bash cd ~ curl https://root.cern.ch/download/root_v6.10.08.Linux-ubuntu16-x86_64-gcc5.4.tar.gz | tar xvz cd root/bin/ source thisroot.sh cd ~ ``` **Note:** To avoid having to `source thisroot.sh` for every new WSL instance, the user is advised to [update their `.bashrc`](https://unix.stackexchange.com/questions/129143/what-is-the-purpose-of-bashrc-and-how-does-it-work) to do so. ### Installing madanalysis5 MadAnalysis5 can be installed similarly to `ROOT`: ```bash wget https://launchpad.net/madanalysis5/trunk/v1.6/+download/ma5_v1.6.tgz tar -xvzf ma5_v1.6.tgz ``` After unarchiving, run `./bin/ma5`. <center> ![ma5_install.png](https://ipfs.busy.org/ipfs/QmXVBA4vttWehRFwhJLMgLJNaqbKiBddzRcwfHyMbygExY) </center> The screen displayed should be similar to above and list mostly disabled dependencies, but indicate that `ROOT` has been found. There should be a prompt asking the number of cores to be configured for. Choose the default number of cores and let the program run. It should list the component number and total number of components it is preparing, as below: <center> ![ma5_cores.png](https://ipfs.busy.org/ipfs/QmYgECSPKoPmGC8E5PTFaoCe2px8NGHxV4zuZCkgf4Ni5f) </center> ### Installing delphes This is *one of the major installation steps which differs* from installing MadAnalysis5 under a dedicated Linux environment. Instead of using the MadAnalysis5 prompt to 'install delphes', the user should clone the delphes git repository into the appropraite location and build from source: From the madanalysis5 directory ```bash cd tools git clone https://github.com/delphes/delphes.git cd delphes make ``` Compilation should take approximately 30 to 60 minutes on a contemporary computer (*e.g.* an i7-3xxx with 8 gb RAM was sufficient for this tutorial). MadAnalysis5 should be run again (`~/madanalysis/bin/ma5`) to check that `delphes` was found and to reconfigure the components. ## Generating the equivalent of 'Hello, world!' to test the installation. MadAnalysis5 serves as a code generator to create programs for specific analyses of data. The code resulting from this section of tutorial serves as both a test of the installation and as a completed [Task 1a](https://steemit.com/utopian-io/@lemouth/particle-physics-utopian-detecting-particles-at-colliders-and-implementing-this-on-a-computer) for the associated Utopian project. The user is advised to work through the example themselves, but a working version is [available on github](https://github.com/effofex/madanalysis5_WSL). ### Code generation As in the associated task, the first step is to tell MadAnalysis5 where to create the skeleton code: ```bash ./bin/ma5 -E test_folder test_analysis ``` For the generated code to compile under the WSL ***an additional step is needed***. This is because the environment variables referenced in the generated `Build/setup.sh` script, when expanded, contain spaces as as result of Windows naming conventions, and the conditionals used in the script cannot handle them, as written. To fix the script, edit `Build/setup.sh` in in `vim` or your text editor of choice, and surround all environment variables in conditional statements with double quotes . For example, `if [[ $MA5_BASE && $PATH && $LD_LIBRARY_PATH ]]; then` should become `if [[ "$MA5_BASE" && "$PATH" && "$LD_LIBRARY_PATH" ]]; then` (GUI users will need to [setup their system to use X](https://virtualizationreview.com/articles/2018/01/30/hands-on-with-wsl-graphical-apps.aspx) should they wish to use an editor like `gedit`). ### Downloading example data It is generally best to treat the WSL file system and the host windows file system as two separate entities. The best way to download the example data file is then to use wget, such as we did with the `ROOT` binaries. This is also a good time to create the input file read by the generated program. ```bash cd test_folder\test_analysis\Input wget http://madanalysis.irmp.ucl.ac.be/raw-attachment/wiki/MA5PublicSandBox/tth_aa.root realpath tth_aa.root > tth_aa.list ``` ### Running the software The generated code, after the modifications above, will run, but will not produce the output required by Task 1a. The user is encouraged to figure out how to modify `test_folder/Build/SampleAnalyzer/User/Analyzer/test_analysis.cpp` to produce the desired output. However, one approach is published at the [github repository](https://github.com/effofex/madanalysis5_WSL) associated with this tutorial, should they become stuck. For completeness, the rest of the build process is the same as under native Ubuntu and should not take more than a few minutes. ```bash cd test_folder/Build source setup.sh make ./MadAnalysis5job ../Input/tth_aa.list ``` The expected output will differ slightly, based on how the user chose to display the output, but should appear similar to below: <center> ![ma5_run.png](https://ipfs.busy.org/ipfs/QmTPtZ1gsq3JmN1GNazteVnjcWhSF1QENCPif84X4uQrMX) </center> # Proof of Work Done The modified generated code used in this tutorial is available at https://github.com/effofex/madanalysis5_WSL

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully