├── .github ├── aux │ └── gh-pages-redirect.html ├── scripts │ └── yamlheader.md └── workflows │ ├── publish.yml │ └── test.yml ├── .gitignore ├── .nojekyll ├── CMakeLists.txt ├── CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── _static ├── css │ └── custom-admonitions.css └── img │ ├── favicon.ico │ └── fcc-logo-light.png ├── _templates └── versions.html ├── archive ├── FCC-ee-higgs.ipynb ├── FCC-hh-AnalysisFlow.ipynb ├── FCCeeDriftChamber.ipynb ├── FCCeeDriftChamber.md ├── FCChhFullAnalysis.ipynb ├── FCChhFullAnalysis.md ├── FCChhFullAnalysis_files │ └── FCChhFullAnalysis_16_1.png ├── FccCMakeGuide.md ├── FccCaloPerformance.ipynb ├── FccCaloPerformance.md ├── FccCaloPerformance_2021 │ ├── FccCaloPerformance.md │ └── runFullCaloSystem_ReconstructionSW_noiseFromFile.py ├── FccDocPage.md ├── FccFullAnalysis.md ├── FccSoftwareFramework.md ├── FccSoftwareGettingStarted.md ├── FccSoftwareGettingStartedFastSim.ipynb ├── FccSoftwareGettingStartedFastSim.md ├── FccSoftwareGit.md ├── FccVirtualMachine.md ├── FcceeAnalysis.md ├── InterfacingMCGen.md ├── analysis_pp_hTo4l_simple_cfg.py ├── images │ ├── FccFullAnalysis │ │ ├── ele1_pt.png │ │ ├── higgs_m.png │ │ ├── higgs_m_cms.png │ │ ├── lep1vsEta_eta.png │ │ ├── lep1vsPt_pt.png │ │ └── m4l_80_170_allYear_125.png │ ├── FccSoftwareGettingStarted │ │ └── flow_chart_starting.png │ ├── FccSoftwareGettingStartedFastSim │ │ ├── higgs_m.png │ │ ├── mtw.png │ │ ├── recoil_m.png │ │ ├── xy.png │ │ ├── yz.png │ │ └── zed_m.png │ ├── FccVirtualMachine │ │ └── x-session.png │ └── FcceeAnalysis │ │ └── ZH_Zee │ │ ├── mrecoil_sel0_nostack_lin.png │ │ ├── mrecoil_sel1_nostack_lin.png │ │ ├── mrecoil_sel2_nostack_lin.png │ │ ├── mrecoil_sel3_nostack_lin.png │ │ ├── mrecoil_sel4_nostack_lin.png │ │ ├── mrecoil_sel5_nostack_lin.png │ │ ├── mrecoil_sel6_nostack_lin.png │ │ └── mrecoil_sel7_nostack_lin.png ├── installing-fcc.md ├── notebooks │ └── nbSnapshots │ │ ├── FCC-ee-higgs.png │ │ ├── FCC-hh-AnalysisFlow.png │ │ ├── FCCFullAnalysis.png │ │ ├── FccSoftwareGettingStartedFastSim.png │ │ └── SwanCustomization.png └── releases.md ├── conf.py ├── developing-fcc-software ├── DevelopingDD4hep.md ├── Edm4hepTransition.md ├── FccCMakeGuide.md ├── FccDocPage.md ├── FccSoftwareGit.md ├── README.md └── WritingAlgorithms.md ├── distributed-computing ├── OutputStructure.md ├── README.md ├── RegisteringToFccVO.md ├── Workflows.md └── workflows │ ├── 01 │ └── DiTauKKMCeeDelphesStandAlone.md │ └── Overview.md ├── fast-sim-and-analysis ├── EventProduction.md ├── FCCAnalysesProblemsAndSolutions.md ├── FccFastSimGeneration.md ├── README.md ├── fccanalyses │ └── doc │ │ └── starterkit │ │ ├── FccFastSimAnalysis │ │ ├── Readme.md │ │ ├── analysis.py │ │ ├── doPlots.py │ │ ├── finalSel.py │ │ └── plots.py │ │ └── FccFastSimVertexing │ │ ├── Exercises │ │ ├── MyAnalysis.cc │ │ ├── MyAnalysis.h │ │ ├── analysis_Tau3Mu_MCseeded.py │ │ └── analysis_Tau3Mu_stage1.py │ │ ├── Readme.md │ │ ├── analysis_Bs2JpsiPhi_MCseeded.py │ │ ├── analysis_Tau3Mu_final.py │ │ ├── analysis_Tau3Mu_plots.py │ │ ├── analysis_primary_vertex.py │ │ ├── plots_Bs2JsiPhi.x │ │ └── plots_primary_vertex.x ├── images │ ├── FccFullAnalysis │ │ ├── ele1_pt.png │ │ ├── higgs_m.png │ │ ├── higgs_m_cms.png │ │ ├── lep1vsEta_eta.png │ │ ├── lep1vsPt_pt.png │ │ └── m4l_80_170_allYear_125.png │ ├── FccSoftwareGettingStarted │ │ └── flow_chart_starting.png │ ├── FccSoftwareGettingStartedFastSim │ │ ├── higgs_m.png │ │ ├── mtw.png │ │ ├── recoil_m.png │ │ ├── xy.png │ │ ├── yz.png │ │ └── zed_m.png │ ├── FccVirtualMachine │ │ └── x-session.png │ ├── FcceeAnalysis │ │ └── ZH_Zee │ │ │ ├── mrecoil_sel0_nostack_lin.png │ │ │ ├── mrecoil_sel1_nostack_lin.png │ │ │ ├── mrecoil_sel2_nostack_lin.png │ │ │ ├── mrecoil_sel3_nostack_lin.png │ │ │ ├── mrecoil_sel4_nostack_lin.png │ │ │ ├── mrecoil_sel5_nostack_lin.png │ │ │ ├── mrecoil_sel6_nostack_lin.png │ │ │ └── mrecoil_sel7_nostack_lin.png │ ├── acolmu.png │ ├── browser_Muon0.png │ ├── browser_events.png │ ├── browser_events_part1.png │ ├── browser_events_part2.png │ ├── browser_missingET.png │ ├── costheta_mup.png │ └── p_mup.png └── k4simdelphes │ └── doc │ └── starterkit │ └── FccFastSimDelphes │ └── Readme.md ├── full-detector-simulations ├── FCCeeCLD │ └── FCCeeCLD.md ├── FCCeeCaloPhotonPi0Discrimination │ ├── FCCeeCaloPhotonPi0Discrimination.md │ ├── draw_rocCurve_pi0_gamma_GNN.py │ └── rocCurveFacility.py ├── FCCeeDriftChamber │ └── FCCeeDriftChamber.md ├── FCCeeGeneralOverview │ ├── FCCeeGeneralOverview.md │ ├── plot_calo_energy_resolution.py │ ├── plot_recoil_mass.C │ ├── plot_recoil_mass.py │ ├── recoil_mass.png │ ├── run_ALLEGRO_RECO.py │ └── run_IDEA_DIGI.py ├── FCCeeGuineaPigIRBackgrounds │ ├── HitAnalysisMarlin │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ └── HitAnalysis.h │ │ └── src │ │ │ └── HitAnalysis.cc │ ├── README.md │ ├── SR │ │ └── Scripts │ │ │ └── SR_sim.py │ ├── eepairs │ │ └── sub_gp_pairs.sh │ └── ggToHadrons │ │ └── hadron.tar.gz ├── FccCaloPerformance │ ├── CaloFullSimExercise.md │ ├── display_detector.py │ ├── plot_energy_resolution.py │ └── runCaloSim.py ├── Geometry │ └── Geometry.md ├── README.md └── Visualization │ └── Visualization.md ├── index.md ├── requirements.txt └── software-basics ├── README.md ├── asking-questions.md ├── bookkeeping.md ├── exploring-fcc-files.md ├── fccsw.md ├── introduction-to-course.md ├── prerequisites.md ├── swan.md ├── swan.png └── tips-tricks.md /.github/aux/gh-pages-redirect.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Redirecting to main branch 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.github/scripts/yamlheader.md: -------------------------------------------------------------------------------- 1 | --- 2 | jupyter: 3 | kernelspec: 4 | display_name: Python 3 5 | language: python 6 | name: python3 7 | --- 8 | 9 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | sphinx: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v4 13 | with: 14 | fetch-depth: 0 15 | - name: Install Requirements 16 | run: | 17 | pip3 install -r requirements.txt 18 | - name: Sphinx build 19 | run: | 20 | sphinx-multiversion . build 21 | - name: Publish gh-pages 22 | run: | 23 | cd build 24 | cp -r main master 25 | git init 26 | git config user.name "FCCSW Bot" 27 | git config user.email "fccsw.bot@example.com" 28 | git remote add upstream https://kjvbrt:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git 29 | 30 | touch .nojekyll 31 | git add .nojekyll 32 | git commit -m "Initial commit" 33 | git branch -m gh-pages 34 | touch . 35 | cp ../.github/aux/gh-pages-redirect.html index.html 36 | git add -A . 37 | git commit -m "Rebuild page at ${GITHUB_SHA}" 38 | git push -f upstream gh-pages:gh-pages 39 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | test: 7 | runs-on: ubuntu-latest 8 | strategy: 9 | fail-fast: false 10 | matrix: 11 | STACK: ['/cvmfs/sw.hsf.org/key4hep/setup.sh', 12 | '/cvmfs/sw-nightlies.hsf.org/key4hep/setup.sh'] 13 | steps: 14 | - uses: actions/checkout@v4 15 | - uses: cvmfs-contrib/github-action-cvmfs@v4 16 | - name: Start container 17 | run: | 18 | docker run -it \ 19 | --name CI_container \ 20 | -v ${GITHUB_WORKSPACE}:/Package \ 21 | -v /cvmfs:/cvmfs:shared \ 22 | -d ghcr.io/key4hep/key4hep-images/alma9:latest /bin/bash 23 | - name: Run tests 24 | run: | 25 | docker exec CI_container /bin/bash -c \ 26 | 'curl -LO https://github.com/jgm/pandoc/releases/download/2.18/pandoc-2.18-linux-amd64.tar.gz;\ 27 | tar -xzf pandoc-2.18-linux-amd64.tar.gz;\ 28 | cp pandoc-2.18/bin/pandoc /usr/local/bin/;\ 29 | cd ./Package;\ 30 | source ${{ matrix.STACK }};\ 31 | mkdir build;\ 32 | cd build;\ 33 | cmake ..;\ 34 | make;\ 35 | make test; 36 | ' 37 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | _book 2 | 3 | __pycache__ 4 | plots 5 | .ipynb_checkpoints 6 | *.ipynb 7 | 8 | *.input 9 | *.output 10 | *-test.md 11 | *.lhe 12 | *.mod 13 | *.cmd* 14 | semaphore 15 | *.sin* 16 | *.la 17 | *.makefile 18 | *.phs 19 | *.vgx 20 | *.evx 21 | iniseed 22 | .libs 23 | *.LHE 24 | *.hst 25 | option.py 26 | *.vg 27 | *.f90 28 | *.lo 29 | *.gdml 30 | *.tcl* 31 | 32 | *.root 33 | *.log 34 | *.out 35 | *.so 36 | *.o 37 | *.save 38 | *.dat 39 | node_modules 40 | book.pdf 41 | *~ 42 | build 43 | venv 44 | -------------------------------------------------------------------------------- /.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/.nojekyll -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8) 2 | 3 | project(FCCTutorials LANGUAGES NONE) 4 | 5 | include(CTest) 6 | 7 | 8 | # jupytext needs a yamlheader with the kernel name 9 | file(READ ${CMAKE_SOURCE_DIR}/.github/scripts/yamlheader.md _yamlheader) 10 | 11 | # macro: add yamlheader, run jupytext --execute 12 | function(add_nb_test testpage) 13 | file(READ ${CMAKE_SOURCE_DIR}/${testpage}.md _testpage_content) 14 | file(WRITE ${CMAKE_SOURCE_DIR}/${testpage}-test.md ${_yamlheader} ${_testpage_content}) 15 | get_filename_component(_testpage_dir ${CMAKE_SOURCE_DIR}/${testpage} DIRECTORY) 16 | message(${_testpage_dir}) 17 | execute_process(COMMAND jupytext ${CMAKE_SOURCE_DIR}/${testpage}-test.md -o ${CMAKE_SOURCE_DIR}/${testpage}.ipynb) 18 | add_test(NAME ${testpage} 19 | COMMAND jupytext ${CMAKE_SOURCE_DIR}/${testpage}.ipynb -o ${CMAKE_SOURCE_DIR}/${testpage}-executed.ipynb --execute 20 | WORKING_DIRECTORY ${_testpage_dir}) 21 | endfunction() 22 | 23 | add_nb_test("software-basics/fccsw") 24 | add_nb_test("software-basics/exploring-fcc-files") 25 | add_nb_test("fast-sim-and-analysis/fccanalyses/doc/starterkit/FccFastSimAnalysis/Readme") 26 | add_nb_test("fast-sim-and-analysis/k4simdelphes/doc/starterkit/FccFastSimDelphes/Readme") 27 | add_nb_test("fast-sim-and-analysis/FccFastSimGeneration") 28 | add_nb_test("full-detector-simulations/FccCaloPerformance/CaloFullSimExercise") 29 | -------------------------------------------------------------------------------- /CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. 4 | 5 | We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion. 6 | 7 | Examples of unacceptable behaviour by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct. 8 | 9 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team. 10 | 11 | Instances of abusive, harassing, or otherwise unacceptable behaviour may be reported by opening an issue or contacting one or more of the project maintainers. 12 | 13 | This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 1.0.0, available at [https://contributor-covenant.org/version/1/0/0/](https://www.contributor-covenant.org/version/1/0/0/). 14 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | (contributing-lesson)= 2 | # Contributing 3 | 4 | [FCC Software][fcc-software] is an open source project, and we welcome 5 | contributions of all kinds: 6 | 7 | * New lessons; 8 | * Fixes to existing material; 9 | * Bug reports; and 10 | * Reviews of proposed changes. 11 | 12 | By contributing, you are agreeing that we may redistribute your work under 13 | [these licenses][license]. 14 | You also agree to abide by our [contributor code of conduct][conduct]. 15 | 16 | ## Getting Started 17 | 18 | 1. We use the [fork and pull][gh-fork-pull] model to manage changes. 19 | More information about [forking a repository][gh-fork] and [making a Pull Request][gh-pull]. 20 | 21 | 2. For our lessons, you should branch from and submit pull requests against the `main` branch. 22 | 23 | 3. When editing lesson pages, you need only commit changes to the Markdown source files. 24 | 25 | 4. To build the lessons please follow the [instructions](#building-the-lessons). 26 | 27 | 5. If you're looking for things to work on, please see [the list of issues for this repository][issues]. 28 | Comments on issues and reviews of pull requests are equally welcome. 29 | 30 | 31 | ## Building the lessons 32 | 33 | ### Requirements 34 | 35 | Make sure you have `venv` (virtual environment) in your working directory. It 36 | can be created with the following command: 37 | ```shell 38 | $ python3 -m venv venv 39 | ``` 40 | Activate it in your shell and install the requirements, which are gathered in a 41 | file provided by the repository. 42 | ```shell 43 | $ source venv/bin/activate 44 | $ pip3 install -r requirements.txt 45 | ``` 46 | After sourcing, your shell prompt will be augmented by the `(venv)` prefix, e.g. 47 | ```shell 48 | (venv) mylaptop:~/fcc/fcc-tutorials 49 | ``` 50 | 51 | :::{admonition} Building `fcc-tutorials` in FCC Software stack 52 | :class: callout 53 | 54 | In case the Python from the FCC Software stack is being used, it is necessary to 55 | clear `PYTHONPATH` environment variable after sourcing of the stack 56 | ```shell 57 | source /cvmfs/fcc.cern.ch/sw/latest/setup.sh 58 | unset PYTHONPATH 59 | ``` 60 | 61 | Sourcing of the FCCSW stack might be needed in cases when the Python provided by 62 | the OS is too old, currently this is the case for CentOS 7 (`lxplus7`). 63 | ::: 64 | 65 | ### Building 66 | 67 | The documentation pages are build by executing 68 | ```shell 69 | $ sphinx-build -b html . build 70 | ``` 71 | 72 | ### Browsing the result 73 | 74 | Start a web server to host the generated files from `build` directory 75 | ```shell 76 | $ cd build 77 | $ python -m http.server 78 | ``` 79 | 80 | You should be able to see your local version by opening a web-browser and 81 | navigating to [http://localhost:8000](http://localhost:8000). 82 | 83 | 84 | ## How to Write Documentation 85 | 86 | More information about how to write the documentation/tutorials for the FCC 87 | Software visit 88 | [](./developing-fcc-software/FccDocPage.md#writing-documentation-for-the-fcc-software). 89 | 90 | ## Legal 91 | 92 | ```{eval-rst} 93 | .. toctree:: 94 | 95 | CONDUCT.md 96 | LICENSE.md 97 | ``` 98 | 99 | 100 | [fcc-software]: https://fccsw.web.cern.ch/ 101 | [conduct]: CONDUCT.md 102 | [license]: LICENSE.md 103 | [issues]: https://github.com/HEP-FCC/fcc-tutorials/issues 104 | [pro-git-chapter]: https://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project 105 | [gh-fork]: https://help.github.com/en/articles/fork-a-repo 106 | [gh-pull]: https://help.github.com/en/articles/about-pull-requests 107 | [gh-fork-pull]: https://reflectoring.io/github-fork-and-pull/ 108 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # License 2 | 3 | ## Instructional Material 4 | 5 | All instructional material is made available under the [Creative Commons 6 | Attribution license][cc-by-human]. The following is a human-readable summary of 7 | (and not a substitute for) the [full legal text of the CC BY 4.0 8 | license][cc-by-legal]. 9 | 10 | You are free to: 11 | 12 | * to **Share** --- copy and redistribute the material in any medium or format 13 | * to **Adapt** --- remix, transform, and build upon the material for any 14 | purpose, even commercially. 15 | 16 | The licensor cannot revoke these freedoms as long as you follow the license 17 | terms. 18 | 19 | Under the following terms: 20 | 21 | * **Attribution** --- You must give appropriate credit, provide a [link to the 22 | license][cc-by-human], and indicate if changes were made. You may do so in 23 | any reasonable manner, but not in any way that suggests the licensor endorses 24 | you or your use. 25 | 26 | * **No additional restrictions** --- You may not apply legal terms or 27 | technological measures that legally restrict others from doing anything the 28 | license permits. 29 | 30 | Notices: 31 | 32 | * You do not have to comply with the license for elements of the material in 33 | the public domain or where your use is permitted by an applicable exception 34 | or limitation. 35 | * No warranties are given. The license may not give you all of the permissions 36 | necessary for your intended use. For example, other rights such as publicity, 37 | privacy, or moral rights may limit how you use the material. 38 | 39 | 40 | ## Software 41 | 42 | Except where otherwise noted, the example programs and other software provided 43 | by Software Carpentry are made available under the [OSI][osi]-approved 44 | [Apache 2.0][apache-license] license. 45 | 46 | 47 | [cc-by-human]: https://creativecommons.org/licenses/by/4.0/ 48 | [cc-by-legal]: https://creativecommons.org/licenses/by/4.0/legalcode 49 | [apache-license]: https://opensource.org/license/apache-2-0/ 50 | [osi]: https://opensource.org 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # The FCC Tutorials 2 | 3 | These are the lessons taught during the [FCC Software Tutorials][tutorial] (the 4 | format is heavily inspired by the [LHCb starterkit][lhcb-starterkit]). 5 | 6 | List of previous workshop/tutorial events: 7 | * Computing and software tutorials as part of 8 | [Second Annual U.S. Future Circular Collider (FCC) Workshop 2024](https://indico.mit.edu/event/876/) 9 | at MIT; 25--27 Mar 2024. 10 | * Software tutorials as part of 11 | [First Annual U.S. Future Circular Collider (FCC) Workshop 2023](https://www.bnl.gov/usfccworkshop/) 12 | ([Indico](https://indico.cern.ch/event/1244371/)) at Brookhaven National 13 | Laboratory; 24--26 April 2023. 14 | * [FCC Software Hands-on Tutorial](https://indico.cern.ch/event/1182767/) at 15 | CERN; 19--21 October 2022. 16 | * [Software tutorial](https://indico.cern.ch/event/945608/timetable/?layout=room#147-link-to-software-tutorial) 17 | in the context of the Snowmass 2021 studies; 22, 23 and 29 September 2020. 18 | * [Software tutorial](https://indico.cern.ch/event/838435/timetable/?layout=room#147-link-to-software-tutorial) as part of the FCC Physics week; 15 January 2020. 19 | * [Software Workshop and hands-on tutorial](https://indico.cern.ch/event/839794/) on 2-3 October 2019; an introduction to many topics. 20 | 21 | The next tutorial, will be anounced in 22 | [FCC-PED-SoftwareAndComputing-Documentation](https://e-groups.cern.ch/e-groups/Egroup.do?egroupName=FCC-PED-SoftwareAndComputing-Documentation) e-group, make sure you 23 | are subscribed in order to know how to sign up. 24 | 25 | If you'd just like to learn about how to use the FCC Software, 26 | [read on][first-steps]! 27 | 28 | [fccsw-website]: https://cern.ch/fccsw 29 | [tutorial]: https://hep-fcc.github.io/fcc-tutorials 30 | [lhcb-starterkit]: https://lhcb.github.io/starterkit-lessons/index.html 31 | [first-steps]: ./software-basics/README.md#first-steps 32 | 33 | 34 | ```{eval-rst} 35 | .. toctree:: 36 | :numbered: 37 | :maxdepth: 2 38 | :includehidden: 39 | :caption: Contents: 40 | 41 | software-basics/README.md 42 | fast-sim-and-analysis/README.md 43 | full-detector-simulations/README.md 44 | distributed-computing/README.md 45 | developing-fcc-software/README.md 46 | CONTRIBUTING.md 47 | 48 | .. toctree:: 49 | :numbered: 50 | :maxdepth: 2 51 | :includehidden: 52 | :caption: External links: 53 | 54 | FCC Software 55 | FCC-ee Detector Full Sim 56 | FCCAnalyses 57 | Analysis essentials 58 | FCC Software glossary 59 | ``` 60 | -------------------------------------------------------------------------------- /_static/css/custom-admonitions.css: -------------------------------------------------------------------------------- 1 | /* Custom admonitions inspired by LHCb Starterkit*/ 2 | 3 | .rst-content .admonition button.toggle-button { 4 | top: .15em; 5 | right: 0.4em; 6 | } 7 | 8 | .rst-content .admonition button.toggle-button:before { 9 | top: -0.5em; 10 | position: relative; 11 | } 12 | 13 | 14 | /* Prerequisite admonition */ 15 | .rst-content .prereq.admonition { 16 | background-color: inherit; 17 | border: 2px solid; 18 | border-color: #faebcc; 19 | } 20 | 21 | .rst-content .prereq.admonition .admonition-title { 22 | color: #8a6d3b; 23 | background-color: #fcf8e3; 24 | border-bottom: 2px solid; 25 | border-color: inherit; 26 | } 27 | 28 | .rst-content .prereq.admonition .admonition-title:before { 29 | margin-right: 12px; 30 | content: "\f135"; /* rocket */ 31 | } 32 | 33 | .rst-content .prereq.admonition button.toggle-button { 34 | color: #8a6d3b; 35 | } 36 | 37 | 38 | /* Callout admonition */ 39 | .rst-content .callout.admonition { 40 | background-color: inherit; 41 | border: 2px solid; 42 | border-color: #73a9d9; 43 | } 44 | 45 | .rst-content .callout.admonition .admonition-title { 46 | color: #214f78; 47 | background-color: #9bc2e4; 48 | border-bottom: 2px solid; 49 | border-color: inherit; 50 | } 51 | 52 | .rst-content .callout.admonition .admonition-title:before { 53 | margin-right: 12px; 54 | /* content: "\f05a"; /* info-circle */ 55 | content: "\f129"; /* info */ 56 | } 57 | 58 | .rst-content .callout.admonition button.toggle-button { 59 | color: #214f78; 60 | } 61 | 62 | 63 | /* Challenge admonition */ 64 | .rst-content .challenge.admonition { 65 | background-color: inherit; 66 | border: 2px solid; 67 | border-color: #d6e9c6; 68 | } 69 | 70 | .rst-content .challenge.admonition .admonition-title { 71 | color: #3c763d; 72 | background-color: #dff0d8; 73 | border-bottom: 2px solid; 74 | border-color: inherit; 75 | } 76 | 77 | .rst-content .challenge.admonition .admonition-title:before { 78 | margin-right: 12px; 79 | /* content: "\f456"; /* flag-pennant */ 80 | /* content: "\f11e"; /* flag-checkered */ 81 | content: "\f024"; /* flag */ 82 | } 83 | 84 | .rst-content .challenge.admonition button.toggle-button { 85 | color: #3c763d; 86 | } 87 | 88 | 89 | /* Solution admonition */ 90 | .rst-content .solution.admonition { 91 | background-color: inherit; 92 | border: 2px solid; 93 | border-color: #ebccd1; 94 | } 95 | 96 | .rst-content .solution.admonition .admonition-title { 97 | color: #a94442; 98 | background-color: #f2dede; 99 | border-bottom: 2px solid; 100 | border-color: inherit; 101 | } 102 | 103 | .rst-content .solution.admonition .admonition-title:before { 104 | margin-right: 12px; 105 | content: "\f00c"; /* check */ 106 | } 107 | 108 | .rst-content .objectives.admonition button.toggle-button { 109 | color: #a94442; 110 | } 111 | 112 | 113 | /* Objectives admonition */ 114 | .rst-content .objectives.admonition { 115 | background-color: inherit; 116 | border: 2px solid; 117 | border-color: #faebcc; 118 | } 119 | 120 | .rst-content .objectives.admonition .admonition-title { 121 | color: #8a6d3b; 122 | background-color: #fcf8e3; 123 | border-bottom: 2px solid; 124 | border-color: inherit; 125 | } 126 | 127 | .rst-content .objectives.admonition .admonition-title:before { 128 | margin-right: 12px; 129 | content: "\f201"; /* chart-line */ 130 | } 131 | 132 | .rst-content .objectives.admonition button.toggle-button { 133 | color: #8a6d3b; 134 | } 135 | 136 | 137 | /* Keypoints admonition */ 138 | .rst-content .keypoints.admonition { 139 | background-color: inherit; 140 | border: 2px solid; 141 | border-color: #d6e9c6; 142 | } 143 | 144 | .rst-content .keypoints.admonition .admonition-title { 145 | color: #3c763d; 146 | background-color: #dff0d8; 147 | border-bottom: 2px solid; 148 | border-color: inherit; 149 | } 150 | 151 | .rst-content .keypoints.admonition .admonition-title:before { 152 | margin-right: 12px; 153 | content: "\f084"; /* key */ 154 | } 155 | 156 | .rst-content .keypoints.admonition button.toggle-button { 157 | color: #3c763d; 158 | } 159 | 160 | 161 | /* Discussion admonition */ 162 | .rst-content .discussion.admonition { 163 | background-color: inherit; 164 | border: 2px solid; 165 | border-color: #bce8f1; 166 | } 167 | 168 | .rst-content .discussion.admonition .admonition-title { 169 | color: #31708f; 170 | background-color: #d9edf7; 171 | border-bottom: 2px solid; 172 | border-color: inherit; 173 | } 174 | 175 | .rst-content .discussion.admonition .admonition-title:before { 176 | margin-right: 12px; 177 | content: "\f0f3"; /* bell */ 178 | } 179 | 180 | .rst-content .discussion.admonition button.toggle-button { 181 | color: #31708f; 182 | } 183 | -------------------------------------------------------------------------------- /_static/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/_static/img/favicon.ico -------------------------------------------------------------------------------- /_static/img/fcc-logo-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/_static/img/fcc-logo-light.png -------------------------------------------------------------------------------- /_templates/versions.html: -------------------------------------------------------------------------------- 1 | {%- if current_version %} 2 |
3 | 4 | Other Versions 5 | v: {{ current_version.name }} 6 | 7 | 8 |
9 | {%- if versions.tags %} 10 |
11 |
Tags
12 | {%- for item in versions.tags %} 13 |
{{ item.name }}
14 | {%- endfor %} 15 |
16 | {%- endif %} 17 | {%- if versions.branches %} 18 |
19 |
Branches
20 | {%- for item in versions.branches %} 21 |
{{ item.name }}
22 | {%- endfor %} 23 |
24 | {%- endif %} 25 |
26 |
27 | {%- endif %} 28 | -------------------------------------------------------------------------------- /archive/FCChhFullAnalysis_files/FCChhFullAnalysis_16_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/FCChhFullAnalysis_files/FCChhFullAnalysis_16_1.png -------------------------------------------------------------------------------- /archive/FccCMakeGuide.md: -------------------------------------------------------------------------------- 1 | CMake guide for the FCC software 2 | ===================================== 3 | 4 | - [CMake guide for the FCC 5 | software](#cmake-guide-for-the-fcc-software) 6 | - [Overview](#overview) 7 | - [Quick start into building FCCSW](#quick-start-into-building-fccsw) 8 | - [CMake example packages](#cmake-example-packages) 9 | - [CMake in the FCC software 10 | framework](#cmake-in-the-fcc-software-framew) 11 | - [Using an internal library](#using-an-internal-library) 12 | - [Building a new Gaudi module](#building-a-new-gaudi-module) 13 | - [Using an external library](#using-an-external-library) 14 | - [Customizing how CMake is run](#customizing-how-cmke-is-run) 15 | 16 | Overview 17 | ------------- 18 | 19 | CMake is a tool for building software, which has become the de-facto 20 | standard outside HEP. In HEP, it is for example used by the ILC/CLIC 21 | communities and by the LHCb collaboration. For CMS people, CMake is the 22 | equivalent of scram. In FCCSW, CMake is used mainly via Gaudi macros, which are however fairly similar to plain CMake commands in syntax. 23 | 24 | This [LHCb Twiki](https://twiki.cern.ch/twiki/bin/view/LHCb/GaudiCMakeConfiguration) has some additional information on 25 | various Gaudi CMake functions. 26 | 27 | Quick start into building FCCSW 28 | --- 29 | 30 | - The software can be compiled in the root directory with `make -j8`. 31 | - After adding new files, do `make configure` 32 | - Building single packages: `make packagename` 33 | - Cleaning up (rebuild from scratch): `make purge` 34 | - To change the build-type (e.g. Release or Debug), set the `BUILDTYPE` variable (e.g. `BUILDTYPE=Debug make`) 35 | 36 | CMake example packages 37 | --------------------------- 38 | 39 | Colin provides [a few simple CMake 40 | examples](https://github.com/cbernet/cmake-examples) independent from 41 | the FCC software framework. They are helpful to understand the basics of 42 | CMake. 43 | 44 | Get these packages: 45 | 46 | git clone https://github.com/cbernet/cmake-examples.git 47 | cd cmake-examples 48 | 49 | Follow the instructions in 50 | [README.md](https://github.com/cbernet/cmake-examples/blob/master/README.md). 51 | 52 | CMake in the FCC software framework 53 | ------------------------------------ 54 | 55 | The FCC software framework is split into single packages `Generation`, `Examples`, `Simulation` , .... Each of these packages contains 56 | the file `CMakeLists.txt`, defining its content. To build the entire 57 | SW, a Makefile is provided in the top level directory, so `make` can be invoked there to build FCCSW. To rebuild a single package 58 | `make packagename` is sufficient. 59 | 60 | When adding new source files to a package, the CMake build system needs 61 | to be made aware of them. Usually `CMakeLists.txt` contains a wildcard 62 | expression that adds all implementation files in a subfolder, e.g. 63 | `src/*.cpp` , so there is no need to explicitly add the names of the 64 | new files. To update the list of files, it is fastest to run 65 | `make configure` . 66 | 67 | Note that when changing the name of a property of an algorithm or a 68 | tool, `make` (and not only `make packagename` ) needs to be run for 69 | Gaudi to be aware of the change. 70 | 71 | The `make` command creates a directory `build.xxxx` where `xxxx` depends on your platform and compiler. All build files 72 | are writtin in that directory. There are situations where you need to clean this build folder before you can 73 | successfully build the software: 74 | 75 | - The FCCSW environment changed (version change) 76 | - Fetching changes from other users or the HEP-FCC repository with deleted files 77 | 78 | In those cases you'll need to do `make purge` (this target deletes the build and install directories) and rebuild the 79 | entire software. 80 | 81 | ### CTest in FCCSW 82 | 83 | FCCSW also uses the cmake for integration tests. 84 | This is described in detail in the documentation page on [adding tests to FCCSW](https://github.com/HEP-FCC/FCCSW/blob/master/doc/AddingTestsToFCCSW.md). 85 | 86 | ### Using an internal library 87 | 88 | Libraries are the main tool to avoid code duplication, i.e. make pieces of code available in other parts of the framework. 89 | Once Gaudi is notified that a certain subdirectory is needed by invoking `gaudi_depends_on_subdir`, internal libraries defined in this subdirectory can be used by simply adding them to the list of `INCLUDE_DIRS` and `LINK_LIBRARIES`. An example would be the way the internal library `DetCommon` is used by the module [`Test/TestGeometryPlugins`](https://github.com/HEP-FCC/FCCSW/blob/master/Test/TestGeometry/CMakeLists.txt) in FCCSW. 90 | The required changes to use the `DetCommon` library are 91 | * declare the dependency on the subdirectory `Detector/DetCommon` 92 | * add the `DetCommon` headers by adding `DetCommon` to the `INCLUDE_DIRS` line 93 | * link the `DetCommon` libraries by adding `DetCommon` to the `LINK_LIBRARIES` line. 94 | 95 | 96 | ### Building a new Gaudi module 97 | 98 | A more general introduction to Gaudi modules and the differences with respect to libraries can be found in the [LHCb twiki](https://twiki.cern.ch/twiki/bin/view/LHCb/GaudiCMakeConfiguration#Building_a_Module_AKA_component). 99 | The best way is to look at existing modules in FCCSW for inspiration. The syntax to declare the module [`TestGeometryPlugins`](https://github.com/HEP-FCC/FCCSW/blob/master/Test/TestGeometry/CMakeLists.txt), for example, is: 100 | 101 | ```cmake 102 | gaudi_add_module(TestGeometryPlugins 103 | src/components/*.cpp 104 | INCLUDE_DIRS Geant4 FWCore SimG4Interface SimG4Common DetInterface DetCommon TestGeometry 105 | LINK_LIBRARIES GaudiKernel FWCore Geant4 DetCommon TestGeometry) 106 | 107 | ``` 108 | 109 | ### Using an external library 110 | 111 | This can be done using the standard cmake command [find_package](https://cmake.org/cmake/help/v3.0/command/find_package.html). See [Colins CMake examples](https://github.com/cbernet/cmake-examples) for details. 112 | 113 | Sometimes external libraries require special treatment, and their documentation needs to be consulted. One known case is DD4hep, for which in some cases the CMake variable `${DD4hep_COMPONENT_LIBRARIES}` needs to be used in the `LINK_LIBRARIES` line (if the DDRec or DDSegmentation package is used). Example: 114 | 115 | ```cmake 116 | gaudi_add_library(DetCommon 117 | src/*.cpp 118 | INCLUDE_DIRS DD4hep ROOT Geant4 DetSegmentation 119 | LINK_LIBRARIES GaudiKernel DD4hep ROOT Geant4 DetSegmentation ${DD4hep_COMPONENT_LIBRARIES} 120 | PUBLIC_HEADERS DetCommon) 121 | 122 | ``` 123 | 124 | ROOT is needed in many modules of FCCSW. More information how to use it in a CMake-based project is available on the [ROOT website](https://root.cern.ch/how/integrate-root-my-project-cmake). 125 | 126 | ### Customizing how CMake is run 127 | 128 | An environment variable is used to forward command line arguments to the cmake command, for example to run cmake with the `trace` option: 129 | 130 | ``` 131 | CMAKEFLAGS='--trace' make 132 | ``` 133 | 134 | ### How do I check compilation flags? 135 | 136 | Instead of running ` make` , run: 137 | 138 | ```{.bash} 139 | make VERBOSE=1 140 | ``` 141 | -------------------------------------------------------------------------------- /archive/FccCaloPerformance_2021/runFullCaloSystem_ReconstructionSW_noiseFromFile.py: -------------------------------------------------------------------------------- 1 | # Setup 2 | # Names of cells collections 3 | ecalBarrelCellsName = "ECalBarrelCells" 4 | # Readouts 5 | ecalBarrelReadoutName = "ECalBarrelPhiEta" 6 | 7 | # Number of events 8 | num_events = -1 9 | 10 | from Gaudi.Configuration import * 11 | from Configurables import ApplicationMgr, FCCDataSvc, PodioOutput 12 | import sys 13 | 14 | podioevent = FCCDataSvc("EventDataSvc") 15 | import glob 16 | podioevent.inputs=glob.glob("output_fullCalo_SimAndDigi_*.root") 17 | # reads HepMC text file and write the HepMC::GenEvent to the data service 18 | from Configurables import PodioInput 19 | podioinput = PodioInput("PodioReader", 20 | collections = [ecalBarrelCellsName, 21 | "GenParticles", 22 | ]) 23 | 24 | 25 | from Configurables import GeoSvc 26 | geoservice = GeoSvc("GeoSvc") 27 | # if FCC_DETECTORS is empty, this should use relative path to working directory 28 | path_to_detector = os.environ.get("FCCDETECTORS", "") 29 | detectors_to_use=[ 30 | 'Detector/DetFCCeeIDEA-LAr/compact/FCCee_DectMaster.xml' 31 | ] 32 | # prefix all xmls with path_to_detector 33 | geoservice.detectors = [os.path.join(path_to_detector, _det) for _det in detectors_to_use] 34 | geoservice.OutputLevel = WARNING 35 | 36 | 37 | ecalBarrelNoisePath = "http://fccsw.web.cern.ch/fccsw/testsamples/elecNoise_ecalBarrelFCCee_50Ohm_traces1_4shieldWidth.root" 38 | ecalBarrelNoiseHistName = "h_elecNoise_fcc_" 39 | 40 | # add noise, create all existing cells in detector 41 | from Configurables import NoiseCaloCellsFromFileTool 42 | noiseBarrel = NoiseCaloCellsFromFileTool("NoiseBarrel", 43 | readoutName = ecalBarrelReadoutName, 44 | noiseFileName = ecalBarrelNoisePath, 45 | elecNoiseHistoName = ecalBarrelNoiseHistName, 46 | activeFieldName = "layer", 47 | addPileup = False, 48 | numRadialLayers = 8) 49 | from Configurables import TubeLayerPhiEtaCaloTool 50 | barrelGeometry = TubeLayerPhiEtaCaloTool("EcalBarrelGeo", 51 | readoutName = ecalBarrelReadoutName, 52 | activeVolumeName = "LAr_sensitive", 53 | activeFieldName = "layer", 54 | fieldNames = ["system"], 55 | fieldValues = [4], 56 | activeVolumesNumber = 8) 57 | from Configurables import CreateCaloCellsNoise 58 | createEcalBarrelCells = CreateCaloCellsNoise("CreateECalBarrelCells", 59 | geometryTool = barrelGeometry, 60 | doCellCalibration=False, # already calibrated 61 | addCellNoise=True, filterCellNoise=False, 62 | noiseTool = noiseBarrel, 63 | hits=ecalBarrelCellsName, 64 | cells=ecalBarrelCellsName+"Noise", 65 | OutputLevel=INFO) 66 | 67 | #Empty cells for parts of calorimeter not implemented yet 68 | from Configurables import CreateEmptyCaloCellsCollection 69 | createemptycells =CreateEmptyCaloCellsCollection("CreateEmptyCaloCells") 70 | createemptycells.cells.Path = "emptyCaloCells" 71 | 72 | #Create calorimeter clusters 73 | from GaudiKernel.PhysicalConstants import pi 74 | 75 | from Configurables import CaloTowerTool 76 | towers = CaloTowerTool("towers", 77 | deltaEtaTower = 0.01, deltaPhiTower = 2*pi/704., 78 | ecalBarrelReadoutName = ecalBarrelReadoutName, 79 | ecalEndcapReadoutName = "", 80 | ecalFwdReadoutName = "", 81 | hcalBarrelReadoutName = "", 82 | hcalExtBarrelReadoutName = "", 83 | hcalEndcapReadoutName = "", 84 | hcalFwdReadoutName = "", 85 | OutputLevel = INFO) 86 | towers.ecalBarrelCells.Path = ecalBarrelCellsName + "Noise" 87 | towers.ecalEndcapCells.Path = "emptyCaloCells" 88 | towers.ecalFwdCells.Path = "emptyCaloCells" 89 | towers.hcalBarrelCells.Path = "emptyCaloCells" 90 | towers.hcalExtBarrelCells.Path = "emptyCaloCells" 91 | towers.hcalEndcapCells.Path = "emptyCaloCells" 92 | towers.hcalFwdCells.Path = "emptyCaloCells" 93 | 94 | # Cluster variables 95 | windE = 9 96 | windP = 17 97 | posE = 5 98 | posP = 11 99 | dupE = 7 100 | dupP = 13 101 | finE = 9 102 | finP = 17 103 | # approx in GeV: changed from default of 12 in FCC-hh 104 | threshold = 2 105 | 106 | from Configurables import CreateCaloClustersSlidingWindow 107 | createClusters = CreateCaloClustersSlidingWindow("CreateClusters", 108 | towerTool = towers, 109 | nEtaWindow = windE, nPhiWindow = windP, 110 | nEtaPosition = posE, nPhiPosition = posP, 111 | nEtaDuplicates = dupE, nPhiDuplicates = dupP, 112 | nEtaFinal = finE, nPhiFinal = finP, 113 | energyThreshold = threshold) 114 | createClusters.clusters.Path = "CaloClustersFinal" 115 | createClusters.clusterCells.Path = "CaloClusterCellsFinal" 116 | 117 | import uuid 118 | out = PodioOutput("out", filename="output_allCalo_reco_noise_" + uuid.uuid4().hex + ".root") 119 | 120 | #CPU information 121 | from Configurables import AuditorSvc, ChronoAuditor 122 | chra = ChronoAuditor() 123 | audsvc = AuditorSvc() 124 | audsvc.Auditors = [chra] 125 | podioinput.AuditExecute = True 126 | createClusters.AuditExecute = True 127 | out.AuditExecute = True 128 | 129 | ApplicationMgr( 130 | TopAlg = [podioinput, 131 | createemptycells, 132 | createEcalBarrelCells, 133 | createClusters, 134 | out 135 | ], 136 | EvtSel = 'NONE', 137 | EvtMax = num_events, 138 | ExtSvc = [podioevent, geoservice]) 139 | -------------------------------------------------------------------------------- /archive/FccDocPage.md: -------------------------------------------------------------------------------- 1 | # Writing documentation for the FCC software 2 | 3 | **Contents:** 4 | 5 | 6 | 7 | - [Writing documentation for the FCC software](#writing-documentation-for-the-fcc-software) 8 | - [Where to put documentation](#where-to-put-documentation) 9 | - [When and how is the documentation page updated?](#when-and-how-is-the-documentation-page-updated) 10 | - [Running website generation locally](#running-website-generation-locally) 11 | - [About jekyll](#about-jekyll) 12 | - [Tricks for writing documentation](#tricks-for-writing-documentation) 13 | - [Getting newest version name](#getting-newest-version-name) 14 | - [Using bootstrap](#using-bootstrap) 15 | - [Linking to other resources](#linking-to-other-resources) 16 | - [For website admins](#for-website-admins) 17 | 18 | 19 | 20 | ## Where to put documentation 21 | 22 | - API documentation is done with Doxygen in the source code 23 | - Slightly higher level documentation on usage of a piece of software is usually put directly in the corresponding repository 24 | - Tutorials that introduce users to a piece of software belong in fcc-tutorials 25 | 26 | > It is sometimes difficult to decide between the last two. In those cases either will be great. 27 | 28 | ## When and how is the documentation page updated? 29 | 30 | The documentation page consists of a static website based on `github-pages`. The content of the website is hosted in EOS (`/eos/project/f/fccsw-web/www`). Only members 31 | of the corresponding e-group have write access. All markdown and configuration files are stored in the [`gh-pages`](https://github.com/HEP-FCC/FCCSW/tree/gh-pages) branch of the 32 | FCCSW Github repository. All dependencies (jquery, bootstrap-sass) are included in the mentioned repository and any change should be automatically deployed to: 33 | 34 | [http://hep-fcc.github.io/FCCSW/](http://hep-fcc.github.io/FCCSW/) 35 | 36 | The old URL [http://cern.ch/fccsw](http://cern.ch/fccsw) now redirects to [http://hep-fcc.github.io/FCCSW/](http://hep-fcc.github.io/FCCSW/). 37 | 38 | ## Structure of the content 39 | 40 | There are four main folder which aggregate markdown files by category: 41 | 42 | - `computing`: FCC Computing Resources 43 | - `presentations`: Selection of Publications and Presentations relating to FCC Software 44 | - `stack`: Main pieces of software that compose the FCC Software stack 45 | - `tutorials`: Different how-to guides for getting started with the different FCC Software packages 46 | 47 | The rest of folders and files are mainly configuration files to generate the website itself with [Jekyll](https://jekyllrb.com/): 48 | 49 | - `_data`: Contains `permalinks.yaml` YAML file with the links shown on the website 50 | - `_includes`: HTML files to define the structure of the website (header, footer, ...) 51 | - `_layouts`: HTML Structure for those part that are commonly used (posts, sites, title headers, ...) 52 | - `css`: Define the style of the website 53 | - `geo`: Geometry visualization 54 | - `node_modules`: Contains Javascript installed dependencies 55 | - `Gemfile`: Define Ruby dependencies 56 | - `package.json`: Define Javascript dependencies 57 | - `_config`: General configuration file with metadata used by Jekyll 58 | 59 | 60 | ## Running website generation locally 61 | 62 | **This is meant for testing not to override the generated website!** 63 | 64 | Modify the content and serve the page with: 65 | 66 | ```bash 67 | jekyll serve --baseurl= 68 | ``` 69 | 70 | Now you should be able to see the website at `localhost:4000`. 71 | 72 | 73 | ### About jekyll 74 | 75 | We are using jekyll to build our website. If you are interested in extending the website have a look in 76 | the [repository](https://github.com/HEP-FCC/FCCSW/tree/gh-pages). Documentation of jekyll may be found 77 | [elsewhere](https://jekyllrb.com/). In case of questions contact the fcc-experiments-sw-dev mailing list. 78 | 79 | 80 | ## For website admins 81 | 82 | Administrators controlling access to the webspace need to be members of the e-group `cernbox-project-fccsw-web-admins`. 83 | 84 | If you want to have write-access you need to request membership in 85 | `cernbox-project-fccsw-web-writers`. If you are the main responsible for these activities, you should own the service account `fccsweos` that has admin rights for both the physics data EOS space and the web EOS space. 86 | -------------------------------------------------------------------------------- /archive/FccSoftwareFramework.md: -------------------------------------------------------------------------------- 1 | FCCSW 2 | == 3 | 4 | Contents: 5 | 6 | - [FCCSW](#fccsw) 7 | - [Overview](#overview) 8 | - [Git guide for FCC](#git-guide-for-fcc) 9 | - [CMake](#cmake) 10 | - [Installation](#installation) 11 | - [Example process](#example-process) 12 | - [Exercises](#exercises) 13 | - [1- Modifying an existing algorithm](#1--modifying-an-existing-algorithm) 14 | - [2- Changing an algorithm parameter](#2--changing-an-algorithm-parameter) 15 | - [3- Adding a filtering algorithm](#3--adding-a-filtering-algorithm) 16 | 17 | Overview 18 | -- 19 | 20 | The FCC software framework is based on Gaudi, with a simple event data 21 | model (EDM) library called PODIO (Plain Old Data Input / Output). The 22 | code is managed with Git, and built using CMake. 23 | 24 | Git guide for FCC 25 | -- 26 | 27 | The code for both the FCC software and Gaudi is managed on Git 28 | repositories. We have set up a short [Git guide](./FccSoftwareGit.md) for 29 | people who are not familar with Git, and where we explain the 30 | recommended way to contribute code to the FCC software. 31 | 32 |
33 |

34 | 35 | Recommendation 36 |

37 |
38 |

All new developers should read this guide since it also contains information on how to contribute to the FCC software.

39 |
40 |
41 | 42 | CMake 43 | -- 44 | 45 | The build process of the FCC software is managed with CMake. Here is a 46 | [short CMake guide](./FccCMakeGuide.md) for FCC developers. 47 | 48 | Installation 49 | -- 50 | 51 | Log in an lxplus6 machine and follow [these instructions](https://github.com/HEP-FCC/FCCSW/blob/master/README.md), also 52 | see the [getting started instructions](./FccSoftwareGettingStarted.md). 53 | 54 | Example process 55 | -- 56 | 57 | An example configuration file is provided in 58 | [simple\_workflow.py](https://github.com/HEP-FCC/FCCSW/blob/tutorial/simple_workflow.py). This configuration file allows to execute the following tasks for each 59 | event: 60 | 61 | - read an [HepMC](http://lcgapp.cern.ch/project/simu/HepMC/20400/html/classHepMC_1_1GenEvent.html) text file 62 | - convert the HepMC particles to a collection of EDM 63 | [ParticleCollection](http://fccsw.web.cern.ch/fccsw/fcc-edm/d5/d95/classfcc_1_1_m_c_particle_collection.html) 64 | - read the EDM 65 | [Particles](http://fccsw.web.cern.ch/fccsw/fcc-edm/0.4/de/d22/classfcc_1_1_m_c_particle.html) 66 | and use fastjet to cluster them into EDM [Jets](http://fccsw.web.cern.ch/fccsw/fcc-edm/0.4/d9/dd7/classfcc_1_1_gen_jet.html) . 67 | - write an EDM root file 68 | 69 | 70 | Run Gaudi on the example HepMC source text file (1000 Z production events in an e+e- collider at sqrt(s) = 91 GeV) using this configuration file: 71 | 72 | ```bash 73 | ./run gaudirun.py Examples/options/simple_workflow.py 74 | ``` 75 | 76 | Please have a detailed look at [simple\_workflow.py](https://github.com/HEP-FCC/FCCSW/blob/master/Examples/options/simple_workflow.py). 77 | . 78 | 79 | Exercises 80 | -- 81 | 82 | ### 1- Modifying an existing algorithm 83 | 84 | - locate the C++ code of the jet clustering algorithm (maybe do a 85 | recursive grep for jet or clustering?) 86 | - add a printout for the reconstructed jets in the `execute` 87 | function of the jet clustering algorithm. 88 | - recompile and run again: 89 | 90 | ~~~{.sh} 91 | # in the FCCSW directory: 92 | make 93 | ~~~ 94 | 95 | Note how the total energy is generally way too high. It is due to the 96 | fact that both stable and unstable particles are clustered into jets, 97 | hence a double counting of the energy. In exercise 3, we will see how to 98 | filter the generated particles to send only the stables ones to jet 99 | clustering. 100 | 101 | ### 2- Changing an algorithm parameter 102 | 103 | Open [JetClustering.cpp](https://github.com/HEP-FCC/FCCSW/blob/master/Reconstruction/RecCalorimeter/src/components/JetClustering.cpp) and [JetClustering.h](https://github.com/HEP-FCC/FCCSW/blob/master/Reconstruction/RecCalorimeter/src/components/JetClustering.h), and have a look at the constructor of the class. Several properties 104 | are declared. 105 | 106 | Properties can be set in the configuration file. 107 | 108 | Change the configuration of the JetClustering algorithm in the following 109 | way: 110 | 111 | ~~~{.py} 112 | genjet_clustering = JetClustering_MCParticleCollection_GenJetCollection_( 113 | "GenJetClustering", 114 | ptMin = 30., 115 | ) 116 | ~~~ 117 | 118 | And check the results. Do you see a difference in the momentum distribution of the jets? 119 | 120 | ### 3- Adding a filtering algorithm 121 | 122 | The goal of this exercise is to fix the energy double counting obersved 123 | in exercise 1. The current algorithm sequence contains three algorithms: 124 | `[reader, hepmc_converter, genjet_clustering]`. We want to insert a 125 | new algorithm in the sequence, which would become: 126 | `[reader, hepmc_converter, genp_filter, genjet_clustering]`. 127 | 128 | The new algorithm, `genp_filter`, will: 129 | 130 | - read in input the genparticles created by the `hepmc_converter` 131 | - write in output a copy of all the stable gen particles (status 1), 132 | discarding the other particles. 133 | 134 | Go to the `Generation/` directory. 135 | 136 | ~~~{.sh} 137 | cd Generation/src/components 138 | ~~~ 139 | 140 | Take the ReadTestConsumer as a baseline, and make a GenParticleFilter 141 | algorithm: 142 | 143 | ~~~{.sh} 144 | cp ../../../Examples/src/ReadTestConsumer.cpp MyGenParticleFilter.cpp 145 | # If the relative path does not work: Examples is directly in the FCCSW folder 146 | ~~~ 147 | 148 | Since you created new files, next time you compile, you will need to do 149 | the following so that your files are detected by the build system: 150 | 151 | ~~~{.sh} 152 | cd ../../../ # go to the FCCSW root directory 153 | pwd # make sure you actually are in the FCCSW root directory 154 | make configure 155 | make -j 4 156 | ~~~ 157 | 158 | When you just edit existing files, you don't need to reconfigure, and just do: 159 | 160 | ~~~{.sh} 161 | make -j 4 162 | ~~~ 163 | 164 | **Edit the GenParticleFilter** so that: 165 | 166 | - the class name matches your file name (also note the `DECLARE_COMPONENT` at the end of the file) 167 | - it creates as output a MCParticleCollection (see [HepMCConverter](https://github.com/HEP-FCC/FCCSW/blob/master/Generation/src/HepMCConverter.cpp)) 168 | - it copies only the particles with status 1 to the output collection 169 | (see the [MCParticle.h](http://fccsw.web.cern.ch/fccsw/fcc-edm/0.4/de/d22/classfcc_1_1_m_c_particle.html) 170 | and [BareParticle.h](http://fccsw.web.cern.ch/fccsw/fcc-edm/0.4/d2/df9/classfcc_1_1_bare_particle.html) 171 | classes to see which data members are available) 172 | 173 | Finally, insert the new algorithm in the sequence in the configuration 174 | file, and run again. Check the printout and make sure that the jet 175 | energy is now what you would expect (around 45 GeV). 176 | -------------------------------------------------------------------------------- /archive/FcceeAnalysis.md: -------------------------------------------------------------------------------- 1 | FCC-ee: Getting started with analysing simulated physics events 2 | =================================================================================== 3 | 4 | 5 | 6 | Contents: 7 | 8 | * [FCC-ee: Getting started with analysing simulated physics events](#getting-started-with-analysing-simulated-physics-events) 9 | * [Overview](#overview) 10 | * [Installation](#installation) 11 | * [Instructions](#instructions) 12 | * [Exercices](#exercices) 13 | 14 | 15 | ## Overview 16 | 17 | The FCC software is the common software for the FCC detector design study. We support the whole chain starting 18 | from event generation through parameterized and full detector simulation, reconstruction and data analysis. 19 | In this tutorial 20 | 21 | 22 | ## Installation 23 | 24 | For this tutorial the software needs to be locally installed. Create a directory for this tutorial and go there: 25 | ``` 26 | mkdir FCCeePhysics 27 | cd FCCeePhysics 28 | ``` 29 | 30 | Clone the repository and go there: 31 | 32 | ``` 33 | git clone https://github.com/HEP-FCC/FlatTreeAnalyzer.git 34 | cd FlatTreeAnalyzer 35 | ``` 36 | 37 | then initialize: 38 | ``` 39 | source ./init.sh 40 | ``` 41 | 42 | 43 | ## Instructions 44 | 45 | Analyses are run the following way: 46 | 47 | ``` 48 | ./bin/analyze.py -n [analysis_name_in_heppy] -c [heppy_cfg] -t [heppy_tree_location] -o [output_dir] -p [analysis_parameters] -j [proc_dict] 49 | ``` 50 | 51 | The example we will run here for the ZH with Z to electrons is: 52 | 53 | ``` 54 | ./bin/analyze.py -n ZH_Zee -c /eos/project/f/fccsw-web/www/share/tutorials/FcceeAnalysis/FCCSW_WS/heppy/ZH_Zee/analysis.py -t /eos/project/f/fccsw-web/www/share/tutorials//FcceeAnalysis/FCCSW_WS/data/ZH_Zee/ -o outputs/ZH_zee_ecm240_recoil/ -p templates/FCCee/zh_zee_ecm240_recoil.py -j /eos/project/f/fccsw-web/www/share/tutorials/FcceeAnalysis/FCCSW_WS/dict/FCCee_procDict_fcc_v01.json --nev 50000 -m 55 | ``` 56 | 57 | The example we will run here for the ZH with Z to muons is: 58 | 59 | ``` 60 | ./bin/analyze.py -n ZH_Zmumu -c /eos/project/f/fccsw-web/www/share/tutorials/FcceeAnalysis/FCCSW_WS/heppy/ZH_Zmumu/analysis.py -t /eos/project/f/fccsw-web/www/share/tutorials/FcceeAnalysis/FCCSW_WS/data/ZH_Zmumu/ -o outputs/ZH_zmumu_ecm240_recoil/ -p templates/FCCee/zh_zmumu_ecm240_recoil.py -j /eos/project/f/fccsw-web/www/share/tutorials/FcceeAnalysis/FCCSW_WS/dict/FCCee_procDict_fcc_v01.json --nev 50000 -m 61 | ``` 62 | 63 | The files that will need to be edited are ```templates/FCCee/zh_zee_ecm240_recoil.p``` for the Z boson decaying to electrons and ``` 64 | templates/FCCee/zh_mumu_ecm240_recoil.py``` for the Z boson decaying to muons. 65 | 66 | Different selections are alrready implemented at the end of the files: ```selbase``` with no cut, ```selopt``` that tries to optimise based on some variables, ```selbb``` that only selects events with exactly 2 b-jets in the recoil, ```seltautau``` that only selects events with exactly 2 tau-jets in the recoil, ```selWhadWhad``` that only selects events with exactly 4 jets in the recoil, ```selWhadWlep``` that only selects events with exactly 2 jets and one lepton in the recoil, ```selWlepWlep``` that only selects events with exactly 2 leptons in the recoil and ```selWW``` that is a logical or between the various W boson selections. 67 | 68 | 69 | Then let's run the Z->ee+X analysis with only 50 000 events 70 | ``` 71 | ./bin/analyze.py -n ZH_Zee -c /eos/project/f/fccsw-web/www/share/tutorials/FcceeAnalysis/FCCSW_WS/heppy/ZH_Zee/analysis.py -t /eos/project/f/fccsw-web/www/share/tutorials/FcceeAnalysis/FCCSW_WS/data/ZH_Zee/ -o outputs/ZH_zee_ecm240_recoil/ -p templates/FCCee/zh_zee_ecm240_recoil.py -j /eos/project/f/fccsw-web/www/share/tutorials/FcceeAnalysis/FCCSW_WS/dict/FCCee_procDict_fcc_v01.json --nev 50000 -m 72 | ``` 73 | 74 | and look at the plots in ```outputs/ZH_zee_ecm240_recoil/plots_ZH/```. The selections are ordered respecting how they have been added in the configuration file, and the plots for selection ```0==selbase``` to ```7===selWW``` should look more or less like those (that have been produced with all the statistics). 75 | 76 | 77 |
78 | 79 |
[No selection]
80 |
81 | 82 |
83 | 84 |
[Optimised selection based on some variables]
85 |
86 | 87 |
88 | 89 |
[Selecting 2 bjet in recoil]
90 |
91 | 92 |
93 | 94 |
[Selecting 2 taus in recoil]
95 |
96 | 97 | 98 | ## Exercices 99 | 100 | What you can do for example now, is add a new selection that will select events with 2 photons in the recoil (the variable is ```nph```), comment all the other selection except this new one and run over the full statistics by removing the ```--nev 50000``` in-line argument. 101 | 102 | Then you can also try to further optimise the selection by looking at other variables (check them in the input tree ```/eos/project/f/fccsw-web/www/share/tutorials/FcceeAnalysis/FCCSW_WS/data/ZH_Zee/p8_ee_ZZ_ecm240/FCCeeAnalyses.ZH_Zee.TreeProducer.TreeProducer_1/tree.root ```) 103 | 104 | Then you can also do the same with the Z-> mumu analysis 105 | -------------------------------------------------------------------------------- /archive/InterfacingMCGen.md: -------------------------------------------------------------------------------- 1 | # Guide to interfacing a Monte Carlo generator 2 | 3 | The way a Monte Carlo generator program is interfaced to the FCC software is twofold: 4 | 1. Through a Gaudi algorithm acfing as interface (see for exple, PythiaInterface). 5 | This is possible when the generator provides a library with well defined calls for initialization, generartion of an event, finalization; 6 | 1. Through a event data frmat understood by FCCSW: `stdhep`, `LHEf`. 7 | 8 | Using common data format is is the most common way, less demanding for the generator. There are however generators not providign events in the common 9 | data, or even not providing the evets at all. These generators need either to be modified to make them able to write out the events in one of the 10 | formats understood by FCCSW, or, if teh format they provide is potentially of common interest, a Gaudi algorithm needs to be writen not read the format. 11 | 12 | ## From `Pythia6` to `LHEf` 13 | For generators written at the time of `Pythia6`, a typical case was that the events were internally stored in the `PYTHIA COMMON BLOCK`. 14 | Converters from such a common block to `LHEf` exist thogh not in modular form. 15 | 16 | ### The `LHEf` format 17 | 18 | ### The conversion code 19 | 20 | ### Example of interface 21 | 22 | ## Reading `LHEf` data files 23 | 24 | 25 | -------------------------------------------------------------------------------- /archive/analysis_pp_hTo4l_simple_cfg.py: -------------------------------------------------------------------------------- 1 | import os 2 | import copy 3 | import heppy.framework.config as cfg 4 | 5 | import logging 6 | # next 2 lines necessary to deal with reimports from ipython 7 | logging.shutdown() 8 | reload(logging) 9 | logging.basicConfig(level=logging.WARNING) 10 | 11 | comp = cfg.Component( 12 | 'example', 13 | files = ['FCCDelphesOutput.root'] 14 | ) 15 | selectedComponents = [comp] 16 | 17 | from heppy.analyzers.fcc.Reader import Reader 18 | source = cfg.Analyzer( 19 | Reader, 20 | 21 | weights = 'mcEventWeights', 22 | 23 | gen_particles = 'skimmedGenParticles', 24 | 25 | electrons = 'electrons', 26 | electronITags = 'electronITags', 27 | electronsToMC = 'electronsToMC', 28 | 29 | muons = 'muons', 30 | muonITags = 'muonITags', 31 | muonsToMC = 'muonsToMC', 32 | 33 | ) 34 | 35 | from ROOT import gSystem 36 | gSystem.Load("libdatamodelDict") 37 | from EventStore import EventStore as Events 38 | 39 | ############################# 40 | ## Gen Level Analysis ## 41 | ############################# 42 | 43 | # select stable electrons and muons 44 | from heppy.analyzers.Selector import Selector 45 | gen_leptons = cfg.Analyzer( 46 | Selector, 47 | 'gen_leptons', 48 | output = 'gen_leptons', 49 | input_objects = 'gen_particles', 50 | filter_func = lambda ptc: (abs(ptc.pdgid()) == 11 or (abs(ptc.pdgid()) == 13) ) and ptc.status() == 1 51 | ) 52 | 53 | # produce flat root tree containing information about stable leptons in the event 54 | from heppy.analyzers.examples.hzz4l.HTo4lGenTreeProducer import HTo4lGenTreeProducer 55 | gen_tree = cfg.Analyzer( 56 | HTo4lGenTreeProducer, 57 | leptons = 'gen_leptons', 58 | ) 59 | 60 | ############################# 61 | ## Reco Level Analysis ## 62 | ############################# 63 | 64 | 65 | # select isolated muons with pT > 5 GeV and relIso < 0.4 66 | from heppy.analyzers.Selector import Selector 67 | selected_muons = cfg.Analyzer( 68 | Selector, 69 | 'selected_muons', 70 | output = 'selected_muons', 71 | input_objects = 'muons', 72 | filter_func = lambda ptc: ptc.pt()>5 and ptc.iso.sumpt/ptc.pt()<0.4 73 | ) 74 | 75 | # select electrons with pT > 7 GeV and relIso < 0.4 76 | selected_electrons = cfg.Analyzer( 77 | Selector, 78 | 'selected_electrons', 79 | output = 'selected_electrons', 80 | input_objects = 'electrons', 81 | filter_func = lambda ptc: ptc.pt()>7 and ptc.iso.sumpt/ptc.pt()<0.4 82 | ) 83 | 84 | # merge electrons and muons into a single lepton collection 85 | from heppy.analyzers.Merger import Merger 86 | selected_leptons = cfg.Analyzer( 87 | Merger, 88 | instance_label = 'selected_leptons', 89 | inputs = ['selected_electrons','selected_muons'], 90 | output = 'selected_leptons' 91 | ) 92 | 93 | # create Z boson candidates with leptons 94 | from heppy.analyzers.LeptonicZedBuilder import LeptonicZedBuilder 95 | zeds = cfg.Analyzer( 96 | LeptonicZedBuilder, 97 | output = 'zeds', 98 | leptons = 'selected_leptons', 99 | ) 100 | 101 | # create H boson candidates 102 | from heppy.analyzers.ResonanceBuilder import ResonanceBuilder 103 | higgses = cfg.Analyzer( 104 | ResonanceBuilder, 105 | output = 'higgses', 106 | leg_collection = 'zeds', 107 | pdgid = 25 108 | ) 109 | 110 | # apply event selection. Defined in "analyzers/examples/hzz4l/selection.py" 111 | from heppy.analyzers.examples.hzz4l.selection import Selection 112 | selection = cfg.Analyzer( 113 | Selection, 114 | instance_label='cuts' 115 | ) 116 | 117 | # store interesting quantities into flat ROOT tree 118 | from heppy.analyzers.examples.hzz4l.HTo4lTreeProducer import HTo4lTreeProducer 119 | reco_tree = cfg.Analyzer( 120 | HTo4lTreeProducer, 121 | zeds = 'zeds', 122 | higgses = 'higgses', 123 | ) 124 | 125 | # definition of a sequence of analyzers, 126 | # the analyzers will process each event in this order 127 | sequence = cfg.Sequence( [ 128 | source, 129 | gen_leptons, 130 | gen_tree, 131 | selected_muons, 132 | selected_electrons, 133 | selected_leptons, 134 | zeds, 135 | selection, 136 | higgses, 137 | reco_tree, 138 | ] ) 139 | 140 | 141 | config = cfg.Config( 142 | components = selectedComponents, 143 | sequence = sequence, 144 | services = [], 145 | events_class = Events 146 | ) 147 | 148 | if __name__ == '__main__': 149 | import sys 150 | from heppy.framework.looper import Looper 151 | 152 | def next(): 153 | loop.process(loop.iEvent+1) 154 | 155 | loop = Looper( 'looper', config, 156 | nEvents=100, 157 | nPrint=0) 158 | loop.process(6) 159 | print loop.event 160 | -------------------------------------------------------------------------------- /archive/images/FccFullAnalysis/ele1_pt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/images/FccFullAnalysis/ele1_pt.png -------------------------------------------------------------------------------- /archive/images/FccFullAnalysis/higgs_m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/images/FccFullAnalysis/higgs_m.png -------------------------------------------------------------------------------- /archive/images/FccFullAnalysis/higgs_m_cms.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/images/FccFullAnalysis/higgs_m_cms.png -------------------------------------------------------------------------------- /archive/images/FccFullAnalysis/lep1vsEta_eta.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/images/FccFullAnalysis/lep1vsEta_eta.png -------------------------------------------------------------------------------- /archive/images/FccFullAnalysis/lep1vsPt_pt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/images/FccFullAnalysis/lep1vsPt_pt.png -------------------------------------------------------------------------------- /archive/images/FccFullAnalysis/m4l_80_170_allYear_125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/images/FccFullAnalysis/m4l_80_170_allYear_125.png -------------------------------------------------------------------------------- /archive/images/FccSoftwareGettingStarted/flow_chart_starting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/images/FccSoftwareGettingStarted/flow_chart_starting.png -------------------------------------------------------------------------------- /archive/images/FccSoftwareGettingStartedFastSim/higgs_m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/images/FccSoftwareGettingStartedFastSim/higgs_m.png -------------------------------------------------------------------------------- /archive/images/FccSoftwareGettingStartedFastSim/mtw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/images/FccSoftwareGettingStartedFastSim/mtw.png -------------------------------------------------------------------------------- /archive/images/FccSoftwareGettingStartedFastSim/recoil_m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/images/FccSoftwareGettingStartedFastSim/recoil_m.png -------------------------------------------------------------------------------- /archive/images/FccSoftwareGettingStartedFastSim/xy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/images/FccSoftwareGettingStartedFastSim/xy.png -------------------------------------------------------------------------------- /archive/images/FccSoftwareGettingStartedFastSim/yz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/images/FccSoftwareGettingStartedFastSim/yz.png -------------------------------------------------------------------------------- /archive/images/FccSoftwareGettingStartedFastSim/zed_m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/images/FccSoftwareGettingStartedFastSim/zed_m.png -------------------------------------------------------------------------------- /archive/images/FccVirtualMachine/x-session.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/images/FccVirtualMachine/x-session.png -------------------------------------------------------------------------------- /archive/images/FcceeAnalysis/ZH_Zee/mrecoil_sel0_nostack_lin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/images/FcceeAnalysis/ZH_Zee/mrecoil_sel0_nostack_lin.png -------------------------------------------------------------------------------- /archive/images/FcceeAnalysis/ZH_Zee/mrecoil_sel1_nostack_lin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/images/FcceeAnalysis/ZH_Zee/mrecoil_sel1_nostack_lin.png -------------------------------------------------------------------------------- /archive/images/FcceeAnalysis/ZH_Zee/mrecoil_sel2_nostack_lin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/images/FcceeAnalysis/ZH_Zee/mrecoil_sel2_nostack_lin.png -------------------------------------------------------------------------------- /archive/images/FcceeAnalysis/ZH_Zee/mrecoil_sel3_nostack_lin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/images/FcceeAnalysis/ZH_Zee/mrecoil_sel3_nostack_lin.png -------------------------------------------------------------------------------- /archive/images/FcceeAnalysis/ZH_Zee/mrecoil_sel4_nostack_lin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/images/FcceeAnalysis/ZH_Zee/mrecoil_sel4_nostack_lin.png -------------------------------------------------------------------------------- /archive/images/FcceeAnalysis/ZH_Zee/mrecoil_sel5_nostack_lin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/images/FcceeAnalysis/ZH_Zee/mrecoil_sel5_nostack_lin.png -------------------------------------------------------------------------------- /archive/images/FcceeAnalysis/ZH_Zee/mrecoil_sel6_nostack_lin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/images/FcceeAnalysis/ZH_Zee/mrecoil_sel6_nostack_lin.png -------------------------------------------------------------------------------- /archive/images/FcceeAnalysis/ZH_Zee/mrecoil_sel7_nostack_lin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/images/FcceeAnalysis/ZH_Zee/mrecoil_sel7_nostack_lin.png -------------------------------------------------------------------------------- /archive/installing-fcc.md: -------------------------------------------------------------------------------- 1 | # Installing the FCC software locally 2 | 3 | ## Overview 4 | 5 | This page explains how to install the part of the FCC software that can be used locally on your laptop. 6 | We encourage to use the [Virtual Machine](./FccVirtualMachine.md) or the centrally installed software. 7 | 8 | ## What can I use locally? 9 | 10 | The packages that are supported for local usage are [fcc-physics](https://github.com/HEP-FCC/fcc-physics) and 11 | [heppy](https://github.com/HEP-FCC/heppy). This allows you to do physics analysis on your laptop. 12 | 13 | ## Installing the latest version 14 | 15 | ### Setup a development area: 16 | 17 | ~~~{.sh} 18 | mkdir FCC 19 | cd FCC 20 | export FCC=${PWD} 21 | ~~~ 22 | 23 | You need to install the **external** dependencies, check the [fcc-physics README](https://github.com/HEP-FCC/fcc-physics#installing-required-software): 24 | 25 | > Set up as mentioned in the README (and set `CMAKE_PREFIX_PATH` accordingly) and also set the `PYTHIA8_DIR`. 26 | 27 | ### Install the latest version of the standalone FCC packages 28 | 29 | You can copy the instructions below into a file and (after making it executable) execute it or copy paste them into a bash shell. 30 | 31 | > Be sure to have set the `$FCC` environment variable before you execute. 32 | 33 | ~~~{.sh} 34 | cd $FCC # your local development area 35 | # get all the sources 36 | declare -a repos=("podio" "fcc-edm" "fcc-physics" "heppy") 37 | for r in "${repos[@]}" 38 | do 39 | git clone https://github.com/HEP-FCC/$r 40 | done 41 | mkdir podio/build;mkdir fcc-edm/build;mkdir fcc-physics/build 42 | mkdir fcc-install 43 | # create a setup.sh file that you'll have to source every time 44 | echo "export FCCEDM=$FCC/fcc-install;export PODIO=$FCC/fcc-install;export FCCPHYSICS=$FCC/fcc-install" > setup.sh 45 | echo source $FCC/fcc-install/init_fcc_stack.sh >> setup.sh 46 | curl https://raw.githubusercontent.com/HEP-FCC/fcc-spi/master/init_fcc_stack.sh -o $FCC/fcc-install/init_fcc_stack.sh 47 | source setup.sh 48 | ~~~ 49 | 50 | Now you have all repository sources in your `$FCC` directory. If you do `ls` you should see them. To compile you need to 51 | go through the list in this order: 52 | 53 | 1. podio 54 | 2. fcc-edm 55 | 3. fcc-physics 56 | 57 | For each of them go into the build directory: `cd $FCC//build` and do: 58 | 59 | ~~~{.sh} 60 | cmake -DCMAKE_INSTALL_PREFIX=$FCC/fcc-install/ .. 61 | make install 62 | ~~~ 63 | 64 | If you encounter errors check the README of the corresponding repository. 65 | 66 | 67 | ## Using the local installation 68 | 69 | The above lines created a setup script `setup.sh` in the folder `$FCC`. To use the software you'll have to source that file. 70 | Additionally, make sure that the external software is also setup properly. In order to use heppy you need to also source the 71 | `init.sh` script in the heppy folder. 72 | 73 | For more information on usage, check the individual repositories or tutorial pages. 74 | -------------------------------------------------------------------------------- /archive/notebooks/nbSnapshots/FCC-ee-higgs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/notebooks/nbSnapshots/FCC-ee-higgs.png -------------------------------------------------------------------------------- /archive/notebooks/nbSnapshots/FCC-hh-AnalysisFlow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/notebooks/nbSnapshots/FCC-hh-AnalysisFlow.png -------------------------------------------------------------------------------- /archive/notebooks/nbSnapshots/FCCFullAnalysis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/notebooks/nbSnapshots/FCCFullAnalysis.png -------------------------------------------------------------------------------- /archive/notebooks/nbSnapshots/FccSoftwareGettingStartedFastSim.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/notebooks/nbSnapshots/FccSoftwareGettingStartedFastSim.png -------------------------------------------------------------------------------- /archive/notebooks/nbSnapshots/SwanCustomization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/archive/notebooks/nbSnapshots/SwanCustomization.png -------------------------------------------------------------------------------- /archive/releases.md: -------------------------------------------------------------------------------- 1 | # How to do software releases of the FCC stack 2 | 3 | ## Overview 4 | 5 | This page is a tutorial for admins of the FCC software and explains how a software release is done on AFS and CVMFS. 6 | 7 | ## How to do a release 8 | 9 | ### Step 1: Externals 10 | 11 | Currently we do not have a procedure to automatically install the external packages used in FCC software. That means we 12 | currently need to install them before we actually push the "release button". 13 | 14 | The only external packages that are not in the LCG releases currently are [Delphes](https://github.com/delphes/delphes) 15 | and [ACTS](http://acts.web.cern.ch/). The location is explicitly set in the 16 | [init script located in fcc-spi](https://github.com/HEP-FCC/fcc-spi/blob/master/init_fcc_stack.sh). 17 | 18 | Install on AFS and CVMFS and set the `*_DIR` in that script to the correct location. 19 | 20 | ### Step 2: Tag the software 21 | 22 | [Create the releases](https://help.github.com/articles/creating-releases/) in the repositories that need to be released. 23 | Release notes written on github for the release are automatically picked up by the documentation web-site. 24 | 25 | To generate the change-logs, have a look at this [github-changelog-generator](https://github.com/skywinder/github-changelog-generator). 26 | After installation, generating a github token and setting it up as per the [README](https://github.com/skywinder/github-changelog-generator), 27 | simply do: 28 | 29 | ``` 30 | github_changelog_generator -p [e.g. FCCSW] -u HEP-FCC -o changelog.md --since-tag [last release] 31 | ``` 32 | 33 | And copy the contents of `changelog.md` as the changelog (modifying the *Unreleased* headline). 34 | 35 | ### Step 3: Launch the release job in Jenkins 36 | 37 | [Go to Jenkins and launch a new release job](https://phsft-jenkins.cern.ch/view/FCC/job/FCC-release/build?delay=0sec). 38 | You will be confronted with a form: 39 | 40 | - `*_version` correspond to the tag-names you defined [step 2](#step-2-tag-the-software) 41 | - `lcg_version` corresponds to the LCG release you want to use (e.g. `LCG_86`) 42 | - `cvmfs_out` is an accesible directory (e.g. on AFS) where the CVMFS release is put to copy on CVMFS 43 | - Currently we cannot copy to CVMFS from the job but have to do that by hand 44 | - Also if you put an AFS path here, the release will be linked to CVMFS 45 | - `release_name` a name for the release (e.g. `0.8`) 46 | 47 | During the release, also the documentation website will be regenerated. If you are interested in learning how to 48 | generate the website have a look at [this tutorial](FccDocPage.md) 49 | 50 | ### Step 4: Test the release 51 | 52 | [Go to Jenkins and launch a new test job](https://phsft-jenkins.cern.ch/view/FCC/job/FCCSW-integration/build?delay=0sec). 53 | 54 | ## Modifying the build and init scripts 55 | 56 | ### Adding a dependency 57 | 58 | For external dependencies as mentioned above, you will need to modify the [init_fcc_stack.sh](https://github.com/HEP-FCC/fcc-spi/blob/master/init_fcc_stack.sh) 59 | to properly set the needed `PATH` variables. 60 | 61 | For *internal* dependencies, i.e. software that is part of the release (at the moment everything that is located under 62 | [HEP-FCC](https://github.com/HEP-FCC)) you need to modify both the init and the build scripts: 63 | 64 | - Adding the new dependency to the build script - look at how the versions for e.g. `podio` are set with the environment 65 | variable `podio_version`. You need to define it in the script and echo it into the `setup.sh` script. Also add it to the 66 | packages that are built at the end of the script. For setting the version also in Jenkins, you need to add the option to the release job. 67 | 68 | - Adding the new dependency to the init script - again have a look at how `podio` is handled and add the corresponding 69 | statements for the new package: once `export MYPACKAGE=/the/path` and then adding it at the end of the script: 70 | `add_to_path CMAKE_PREFIX_PATH $MYPACKAGE` (look at the other `PATH` variables and decide what you need.) 71 | -------------------------------------------------------------------------------- /conf.py: -------------------------------------------------------------------------------- 1 | # import sphinx_rtd_theme 2 | 3 | project = 'FCC Tutorials' 4 | copyright = '2024, CERN' 5 | html_logo = '_static/img/fcc-logo-light.png' 6 | html_favicon = '_static/img/favicon.ico' 7 | html_theme = 'sphinx_rtd_theme' 8 | 9 | exclude_patterns = [ 10 | 'venv', 11 | '.github', 12 | 'README.md', 13 | 'archive' 14 | ] 15 | 16 | html_theme = "sphinx_rtd_theme" 17 | 18 | html_context = { 19 | 'display_github': True, 20 | 'github_user': 'HEP-FCC', 21 | 'github_repo': 'fcc-tutorials', 22 | 'github_version': 'main/', 23 | } 24 | 25 | extensions = [ 26 | 'myst_parser', 27 | 'sphinx_rtd_theme', 28 | 'sphinx_togglebutton', 29 | 'sphinx_copybutton', 30 | 'sphinx_multiversion', 31 | ] 32 | 33 | myst_enable_extensions = [ 34 | "dollarmath", 35 | "amsmath", 36 | 'colon_fence', 37 | 'html_admonition' 38 | ] 39 | 40 | myst_heading_anchors = 3 41 | 42 | html_static_path = [ 43 | '_static' 44 | ] 45 | 46 | html_css_files = [ 47 | 'css/custom-admonitions.css' 48 | ] 49 | 50 | templates_path = [ 51 | '_templates', 52 | ] 53 | 54 | smv_tag_whitelist = r'^(?!(v0.1.0|v0.2.0))$' 55 | smv_branch_whitelist = r'^(?!(HEAD|vvolkl-patch-|starterkit|gh-pages)).*$' 56 | smv_remote_whitelist = r'^(origin)$' 57 | 58 | linkcheck_ignore = [ 59 | # FIXME: The URLs have changed 60 | r'https://research\.cs\.wisc\.edu/htcondor/.*', 61 | ] 62 | -------------------------------------------------------------------------------- /developing-fcc-software/DevelopingDD4hep.md: -------------------------------------------------------------------------------- 1 | # Developing DD4hep Detector models 2 | 3 | :::{admonition} Learning Objectives 4 | :class: objectives 5 | 6 | This tutorial will teach you how to: 7 | 8 | * implement detector models in DD4hep 9 | ::: 10 | 11 | See indico: https://indico.cern.ch/event/1182767/contributions/5093296/ 12 | -------------------------------------------------------------------------------- /developing-fcc-software/Edm4hepTransition.md: -------------------------------------------------------------------------------- 1 | # Guide to the Transition of FCCSW to EDM4hep 2 | 3 | For the studies of the Conceptual Design Report, FCC software used its own datamodel, [FCCEDM](https://github.com/hep-fcc/fccedm). 4 | The technical implementation was based on a novel library called [PODIO](https://github.com/aidasoft/podio), and tries to use "Plain Old Data" to achieve thread safety and general ease of use. 5 | 6 | While FCCEDM has served its purpose, continued use has revealed some minor issues, inconsistencies and impracticalities (see [here](https://github.com/HEP-FCC/fcc-edm/issues?q=is%3Aissue+) and [here](https://fccsw-forum.web.cern.ch/t/event-data-model-discussion/32)). 7 | Since then, FCC has joined a common software effort with other Future Collider Communities, and decided to base the common software ([Key4HEP](https://cern.ch/key4hep)) on a new, common datamodel ([EDM4HEP](https://github.com/key4hep/edm4hep)). 8 | 9 | The types defined by EDM4HEP are somewhat closer to [LCIO](https://github.com/ilcsoft/lcio), but like FCCEDM it is implemented with PODIO. 10 | In any case, the transition, while time-intensive, is no major technical challenge, and provides the basis for a common experiment software beyond FCC. 11 | 12 | 13 | This document should guide users and developers through the transition. 14 | 15 | EDM4HEP and FCCEDM can coexist, but for a frictionless transition, FCCEDM should be replaced completely as soon as possible. 16 | 17 | 18 | The following sections focus on the Gaudi-based framework FCCSW and explain how to transition the components of the datamodel. 19 | The latest developments can be found on [this branch](https://github.com/HEP-FCC/FCCSW/tree/edm4hep) (PRs welcome). 20 | 21 | 22 | 23 | ## Technical Information 24 | 25 | ### Build System 26 | 27 | EDM4HEP ships a CMake configuration (in uppercase: `EDM4HEPConfig.cmake`) that defines CMake Targets (in lowercase: `EDM4HEP::edm4hep`). 28 | To include and link edm4hep, it is sufficient to add the following to the `CMakeLists.txt` of an example project: 29 | 30 | 31 | 32 | 33 | ``` 34 | 35 | find_package(EDM4HEP) 36 | 37 | gaudi_add_module(ExampleModule 38 | src/components/*.cpp 39 | INCLUDE_DIRS # nothing needs to be added here, the target defines the includes 40 | LINK_LIBRARIES EDM4HEP::edm4hep) 41 | ``` 42 | 43 | 44 | ### Component source Code 45 | 46 | The code now can be adapted changing any mention of `datamodel` to `edm4hep` and converting the types: 47 | 48 | #### Generation / MCParticles 49 | 50 | FCCEDM had several types to describe particles at the Generator Level: `GenParticle`, `GenVertex` and `GenJet`. 51 | The mother/daughter relationship was encoded in the vertices; A particle and its decay product were supposed to share one vertex object (the mother particle as its endvertex, the daughter particle as its startvertex). A library for creating directed acyclic graphs was supposed to help deal with this slightly cumbersome system, but was not really used in practice. 52 | 53 | EDM4HEP replaces this by the single type `MCParticle`. This contains the vertex information, and Jets are generally treated as particles in EDM4hep. 54 | 55 | The correspondence is fairly direct: 56 | 57 | | | | 58 | |----|----| 59 | | EDM4HEP | FCCEDM | 60 | | MCParticle | MCParticle/GenVertex/GenJet | 61 | | PDG | core.pdgId | 62 | | generatorStatus | core.status | 63 | | charge | charge | 64 | | time | startVertex.ctau # Note the unit differences! | 65 | | vertex | startVertex.position | 66 | | endpoint | endVertex.position | 67 | | momentum, mass | core.p4 | 68 | | momentumAtEndpoint || 69 | | spin | | 70 | | colorFlow | | 71 | 72 | 73 | 74 | ### Job options 75 | 76 | As the GenVertex type is no longer an independent type in edm4hep, any components that used to write GenParticles and GenVertices need to be adapted (the opportunity was used to also update the spelling from `genparticles` to `GenParticles` for the Gaudi data property): 77 | 78 | ```diff 79 | - hepmc_converter.genparticles.Path="allGenParticles" 80 | - hepmc_converter.genvertices.Path="allGenVertices" 81 | + hepmc_converter.GenParticles.Path="allGenParticles" 82 | ``` 83 | 84 | The configuration for the SimG4SaveSmearedParticles tool needs to be adapted in the following way: 85 | 86 | ```diff 87 | - from Configurables import SimG4SaveSmearedParticles 88 | - saveparticlestool = SimG4SaveSmearedParticles("saveSmearedParticles") 89 | - saveparticlestool.particles.Path = "smearedParticles" 90 | - saveparticlestool.particlesMCparticles.Path = "particleMCparticleAssociation" 91 | + saveparticlestool.RecParticles.Path = "smearedParticles" 92 | + saveparticlestool.MCRecoParticleAssoc.Path = "particleMCparticleAssociation" 93 | 94 | ``` 95 | 96 | ```diff 97 | 98 | - particle_converter = SimG4PrimariesFromEdmTool("EdmConverter") 99 | - particle_converter.genParticles.Path = "allGenParticles" 100 | + particle_converter.GenParticles.Path = "allGenParticles" 101 | ``` 102 | -------------------------------------------------------------------------------- /developing-fcc-software/FccDocPage.md: -------------------------------------------------------------------------------- 1 | # Writing documentation for the FCC Software 2 | 3 | 4 | ## Where to put documentation 5 | 6 | - API documentation of classes and functions should be done using Doxygen 7 | notation directly in the source code. 8 | - Slightly higher level documentation on usage of a piece of software is 9 | usually put directly in the corresponding repository. 10 | - Long-form documentations that introduces users to a piece of software belongs 11 | into [fcc-tutorials](https://hep-fcc.github.io/fcc-tutorials/). 12 | 13 | :::{admonition} Where to put documentation 14 | :class: callout 15 | 16 | It is sometimes difficult to decide between the last two. In those cases either 17 | will be great. 18 | ::: 19 | 20 | 21 | ## How to write Mardown 22 | 23 | This tutorial website is generated with [Sphinx](https://www.sphinx-doc.org/) 24 | machinery using [Read the Docs](https://readthedocs.org/) theme. Specific 25 | parser of Mardown we use is [MyST](https://myst-parser.readthedocs.io). 26 | 27 | 28 | ## Custom Admonitions 29 | 30 | The `fcc-tutorial` makes use of the following custom admonition classes 31 | inherited from [LHCb Starterkit](https://lhcb.github.io/starterkit-lessons/): 32 | 33 | * prereq 34 | * callout 35 | * challenge 36 | * solution 37 | * objectives 38 | * keypoints 39 | * discussion 40 | 41 | Example of an admonition: 42 | ```markdown 43 | :::{admonition} Custom admonition 44 | :class: solution 45 | 46 | Text of a custom admonition. 47 | ::: 48 | ``` 49 | 50 | :::{admonition} Custom admonition 51 | :class: solution 52 | 53 | Text of a custom admonition. 54 | ::: 55 | 56 | To create collapsible admonition add additional classes: 57 | * To create collapsible admonition closed by default add only `dropdown` class. 58 | * To create collapsible admonition open by default add two classes `dropdown` and 59 | `toggle-shown`. 60 | 61 | Example of collapsible admonition: 62 | ```markdown 63 | :::{admonition} Collapsable admonition 64 | :class: prereq dropdown toggle-shown 65 | 66 | Text of a collapsable admonition. 67 | ::: 68 | ``` 69 | 70 | :::{admonition} Collapsable admonition 71 | :class: prereq dropdown toggle-shown 72 | 73 | Text of a collapsable admonition. 74 | ::: 75 | 76 | 77 | ## When and how is the tutorials page updated? 78 | 79 | This tutorials page is hosted at and 80 | the edits are managed using Github pull requests. Once the pull request is 81 | merged the change to the tutorials page will happen within few minutes. 82 | 83 | 84 | ## For website admins 85 | 86 | Administrators controlling access to the webspace need to be members of the 87 | `cernbox-project-fccsw-web-admins` e-group. 88 | 89 | If you want to have write-access you need to request membership in 90 | `cernbox-project-fccsw-web-writers`. If you are the main responsible for these 91 | activities, you should own the service account `fccsweos` that has admin rights 92 | for both the physics data EOS space and the web EOS space. 93 | -------------------------------------------------------------------------------- /developing-fcc-software/README.md: -------------------------------------------------------------------------------- 1 | # Developing FCCSW 2 | 3 | Sooner rather than later you will find it necessary write code for FCCSW. These pages cover some software development topics to remove any friction. 4 | 5 | 6 | 7 | ```{eval-rst} 8 | .. toctree:: 9 | :caption: Contents: 10 | 11 | FccSoftwareGit.md 12 | FccCMakeGuide.md 13 | WritingAlgorithms.md 14 | DevelopingDD4hep.md 15 | Edm4hepTransition.md 16 | FccDocPage.md 17 | 18 | ``` 19 | -------------------------------------------------------------------------------- /developing-fcc-software/WritingAlgorithms.md: -------------------------------------------------------------------------------- 1 | # Writing Gaudi Algorithms 2 | 3 | 4 | :::{admonition} Learning Objectives 5 | :class: objectives 6 | 7 | This tutorial will teach you how to: 8 | 9 | * write an algorithm for FCCSW 10 | * interact with the cmake based build system 11 | * use other Gaudi components in the algorithms 12 | ::: 13 | 14 | 15 | ## Getting Started 16 | 17 | Writing Gaudi components requires a bit of boilerplate code. 18 | Often it is easiest to start from existing files and modify them as needed. 19 | For this tutorial, there is a dedicated repository that contains an example. 20 | Start by cloning it locally: 21 | 22 | ```bash 23 | git clone https://github.com/key4hep/k4-project-template 24 | ``` 25 | 26 | It contains a CMake configuration (as described in more detail in the previous tutorial) so it can be built with: 27 | 28 | ```bash 29 | cd k4-project-template 30 | mkdir build install 31 | cd build 32 | cmake .. -DCMAKE_INSTALL_PREFIX=../install 33 | make -j 4 34 | ``` 35 | 36 | To run the algorithms contained in this repository, it is not necesary to run 37 | 38 | ``` 39 | make install 40 | ``` 41 | 42 | you can use the `run` script in the `build` directory, like: 43 | 44 | ```bash 45 | ./run fccrun ../K4TestFWCore/options/createExampleEventData.py 46 | 47 | ``` 48 | 49 | 50 | ## Exercise: Adding an Algorithm 51 | 52 | The repository contains an `EmptyAlg` in `K4TestFWCore/src/components`. 53 | 54 | 55 | * As a first exercise, copy and modify this algorithm to print out the current event number. 56 | 57 | * Second step: If you used `std::cout` in the first step, try to use the gaudi logging service instead. 58 | 59 | * Third Step: Print out a string before the event number that should be configurable at runtime. 60 | 61 | * Finally: use the Gaudi Random Number Generator Service to approximate pi with a [Monte Carlo Integration](https://en.wikipedia.org/wiki/Monte_Carlo_integration) 62 | -------------------------------------------------------------------------------- /distributed-computing/OutputStructure.md: -------------------------------------------------------------------------------- 1 | # Structure for /eos/experiment/fcc/prod 2 | 3 | ## Overview 4 | FCC Monte Carlo productions will be handled by the DIRAC system and stored at CERN under 5 | 6 | ``` 7 | /eos/experiment/fcc/prod/fcc 8 | ``` 9 | 10 | where `/eos/experiment/fcc/prod` is the mapped endpoint and `/fcc` is required to honour DIRAC request to start with `/`. 11 | The directory `/eos/experiment/fcc/prod` is divided in two grand zones: 12 | `/fcc/user/[u]/[username]` and `/fcc/[ee,hh,eh]`. 13 | 14 | The purpose of the user area is to provide some temporary space for user private jobs. 15 | 16 | The other areas are meant for production files. A hierarchical structure for the output files is being defined for an efficient use of this area. 17 | The purpose of these pages is to describe such a structure. 18 | 19 | Complete metadata will be available from DIRAC through the unique identifier `DiracProdID` discussed above. 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /distributed-computing/README.md: -------------------------------------------------------------------------------- 1 | # Distributed computing 2 | 3 | These pages provide --- and dissect --- examples of workflows to be run on distributed resources with the [DIRAC Interware system][dirac] 4 | through [iLCDirac][ilcdirac], the extension developed by the Linear Collider community and used also by CALICE. 5 | 6 | The procedure to be enabled to use the FCC resources through DIRAC is first described. Additional information about the use of 7 | iLCDirac can be found in the [CLIC][wikiclic] and [ILC][wikiilc] dedicated Wiki pages. 8 | 9 | Unless specified, in the rest of this section the word `DIRAC` refers to the `iLCDirac` extension introduced above. 10 | 11 | [dirac]: https://dirac.readthedocs.io/en/latest/ 12 | [ilcdirac]: https://iopscience.iop.org/article/10.1088/1742-6596/513/3/032077/meta 13 | [wikiclic]: https://twiki.cern.ch/twiki/bin/view/CLIC/DiracForUsers 14 | [wikiilc]: https://flcwiki.desy.de/ILCDirac 15 | 16 | ```{eval-rst} 17 | .. toctree:: 18 | :caption: Contents: 19 | 20 | RegisteringToFccVO.md 21 | Workflows.md 22 | OutputStructure.md 23 | ``` 24 | -------------------------------------------------------------------------------- /distributed-computing/RegisteringToFccVO.md: -------------------------------------------------------------------------------- 1 | # Getting started with FCC distributed computing 2 | 3 | ## Registering to the FCC VO 4 | 5 | The [standard Grid VO registration procedure][signup] 6 | should be followed to be enable to use the resources connected with the FCC VO. 7 | 8 | :::{admonition} Note 9 | :class: callout 10 | 11 | You need to use a browser where you have installed your certificate and the 12 | [CERN CA][cernca] certificates. Firefox usually works fine, Google Chrome 13 | usually does not work. Safari might also work. 14 | ::: 15 | 16 | [signup]: https://fcc-auth.cern.ch/dashboard#!/newClient 17 | 18 | ## Enabling DIRAC 19 | 20 | DIRAC is available on CernVM-FS. To enable the relevant applications and 21 | scripts, the following setup script needs to be sourced first 22 | 23 | ```bash 24 | source /cvmfs/clicdp.cern.ch/DIRAC/bashrc 25 | ``` 26 | 27 | To submit jobs through DIRAC a proxy needs to be created and uploaded: 28 | 29 | ```bash 30 | dirac-proxy-init -g fcc_user 31 | ``` 32 | A successful creation looks like this: 33 | ``` 34 | Generating proxy... 35 | Enter Certificate password: 36 | Added VOMS attribute /fcc 37 | Uploading proxy.. 38 | Proxy generated: 39 | subject : /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=ganis/CN=393971/CN=Gerardo Ganis/CN=2178341058/CN=3000266373 40 | issuer : /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=ganis/CN=393971/CN=Gerardo Ganis/CN=2178341058 41 | identity : /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=ganis/CN=393971/CN=Gerardo Ganis 42 | timeleft : 23:53:58 43 | DIRAC group : fcc_user 44 | path : /tmp/x509up_u2759 45 | username : ganis 46 | properties : NormalUser 47 | VOMS : True 48 | VOMS fqan : ['/fcc'] 49 | 50 | Proxies uploaded: 51 | DN | Group | Until (GMT) 52 | /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=ganis/CN=393971/CN=Gerardo Ganis | | 2022/05/13 12:12 53 | ``` 54 | The last section shows the valid proxies upload to the DIRAC system. It can also be checked with 55 | ```bash 56 | dirac-proxy-info -m 57 | ``` 58 | with output similar to 59 | ``` 60 | subject : /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=ganis/CN=393971/CN=Gerardo Ganis/CN=2178341058/CN=3000266373 61 | issuer : /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=ganis/CN=393971/CN=Gerardo Ganis/CN=2178341058 62 | identity : /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=ganis/CN=393971/CN=Gerardo Ganis 63 | timeleft : 23:50:40 64 | DIRAC group : fcc_user 65 | path : /tmp/x509up_u2759 66 | username : ganis 67 | properties : NormalUser 68 | VOMS : True 69 | VOMS fqan : ['/fcc'] 70 | == Proxies uploaded == 71 | DN | Group | Until (GMT) 72 | /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=ganis/CN=393971/CN=Gerardo Ganis | | 2022/05/13 12:12 73 | ``` 74 | 75 | If everything worked fine, your proxy should be mapped to the `fcc001` user. This can be checked this way: 76 | 77 | ```bash 78 | export EOS_MGM_URL=root://eospublic.cern.ch 79 | XrdSecPROTOCOL=gsi,unix eos whoami 80 | ``` 81 | the result should look similar to this: 82 | ``` 83 | Virtual Identity: uid=140035 (99,140035) gid=2855 (99,2855) [authz:gsi] host=lxplus743.cern.ch domain=cern.ch geo-location=0513 84 | ``` 85 | 86 | At CERN the uid of `fcc001` is 140035. 87 | 88 | ## Copying, browsing, accessing files 89 | 90 | Once DIRAC is enabled it is possible to copy, browse and access files. 91 | For the example we used the file `edm4hep_test_output.root` . 92 | 93 | Files can be copied in the area of each user with, for example, `xrdcp`: 94 | ``` 95 | xrdcp edm4hep_test_output.root root://eospublic.cern.ch//eos/experiment/fcc/user/g/ganis/edm4hep_test_output.root 96 | [5B/5B][100%][==================================================][5B/s] 97 | 98 | ``` 99 | The immediate availability of the file can be checked with 100 | ``` 101 | $ xrdfs eospublic.cern.ch ls /eos/experiment/fcc/prod/fcc/user/g/ganis 102 | /eos/experiment/fcc/prod/fcc/user/g/ganis/edm4hep_test_output.root 103 | ``` 104 | or, `/eos` is mounted, with 105 | ``` 106 | $ ls -lt /eos/experiment/fcc/prod/fcc/user/g/ganis 107 | total 9545 108 | -rw-r--r--. 1 fcc001 fcc-cg 9768981 Nov 3 2021 edm4hep_test_output.root 109 | ``` 110 | Files can be replicated to another STorage Element, e.g. CNAF-DISK, using 111 | `dirac-dms-replicate-lfn`: 112 | ``` 113 | $ dirac-dms-replicate-lfn /fcc/user/g/ganis/edm4hep_test_output.root CNAF-DISK 114 | ``` 115 | 116 | The availability of the files can be browsed using the command `dirac-dms-lfn-replicas`: 117 | 118 | ``` 119 | $ dirac-dms-lfn-replicas /fcc/user/g/ganis/edm4hep_test_output.root 120 | LFN StorageElement URL 121 | ============================================================= 122 | /fcc/user/g/ganis/edm4hep_test_output.root CNAF-DISK davs://xfer-archive.cr.cnaf.infn.it:8443/fcc/user/g/ganis/edm4hep_test_output.root 123 | CERN-DST-EOS gsiftp://eospublicftp.cern.ch//eos/experiment/fcc/prod/fcc/user/g/ganis/edm4hep_test_output.root 124 | ``` 125 | 126 | The file can be accessed through the indicate path; for example: 127 | ``` 128 | $ source /cvmfs/sw.hsf.org/key4hep/setup.sh 129 | $ root -l 130 | root [0] TFile *f1 = TFile::Open(“davs://xfer-archive.cr.cnaf.infn.it:8443/fcc/user/g/ganis/edm4hep_test_output.root”) 131 | (TFile *) 0x2ec28b0 132 | root [1] 133 | ``` 134 | 135 | ## The web portal 136 | 137 | The [DIRAC web portal][diracweb] is available to check the status of things. It shows all the jobs submitted and the 138 | files registered. 139 | 140 | 141 | :::{admonition} Note 142 | :class: callout 143 | 144 | As for the VO registration, you need to use a browser where you have installed 145 | your certificate and the [CERN CA][cernca] certificates. Firefox usually works 146 | fine, Safari might also work. Google Chrome usually does not work. 147 | ::: 148 | 149 | [diracweb]: https://voilcdiracwebapp2.cern.ch/DIRAC/?view=tabs&theme=Crisp&url_state=1|*DIRAC.JobMonitor.classes.JobMonitor 150 | [cernca]: https://ca.cern.ch/cafiles/certificates/Grid.aspx 151 | -------------------------------------------------------------------------------- /distributed-computing/Workflows.md: -------------------------------------------------------------------------------- 1 | # FCC DIRAC example workflows 2 | 3 | These pages provide - and dissect - examples of workflows to be run on distributed resources with the [DIRAC Interware system][dirac]. 4 | 5 | The python scripts discussed in these pages are available at [https://github.com/HEP-FCC/FCCDIRAC][fccdirac]. 6 | 7 | [dirac]: https://dirac.readthedocs.io/en/latest/ 8 | [fccdirac]: https://github.com/HEP-FCC/FCCDIRAC 9 | 10 | ```{eval-rst} 11 | .. toctree:: 12 | :caption: Contents: 13 | 14 | workflows/Overview.md 15 | workflows/01/DiTauKKMCeeDelphesStandAlone.md 16 | ``` 17 | -------------------------------------------------------------------------------- /distributed-computing/workflows/Overview.md: -------------------------------------------------------------------------------- 1 | # Overview of the submission scripts 2 | 3 | Command line submission to DIRAC is performed using python scripts instantiating the relevant classes. 4 | The general structure of the script is the following: 5 | 6 | 1. Instantiation of the interface to DIRAC; 7 | 2. Creation of a Job manager instance, including input and output sandbox, and all relevant config and data files; 8 | 3. Creation and configuration of the application to be run and their registration to the job manager instance; 9 | 4. Job submission 10 | 11 | The script may contain or import all the code relevant to the correct definition of the various steps above. 12 | DIRAC also provides some standard tooling for parsing arguments and homogenize the submission script experience. 13 | 14 | The parser is defined the DIRAC core, is part of the generic definition of [Script][script] and provides a callback for 15 | customizing the actions. Typical usage looks like this: 16 | 17 | ```python 18 | from DIRAC import S_OK, S_ERROR 19 | from DIRAC.Core.Base import Script 20 | 21 | # Define a simple class to hold the script parameters 22 | class Params(object): 23 | def __init__(self): 24 | self.wms = 'wms' 25 | def setWMS(self, value): 26 | self.wms = value 27 | return S_OK() 28 | 29 | # Instantiate the params class 30 | cliParams = Params() 31 | Script.registerSwitch('w', 'wms', "WMS where to run", cliParams.setWMS) 32 | Script.parseCommandLine(ignoreErrors=False) 33 | 34 | # Get the list of services (the switch above appearer as servicesList[0]) 35 | servicesList = Script.getPositionalArgs() 36 | # The value for argument 'wms' is the first entry in servicelist list 37 | 38 | ``` 39 | 40 | [script]: https://dirac.readthedocs.io/en/latest/CodeDocumentation/Core/Base/Script.html 41 | 42 | The DIRAC interface is controlled by the API interface class `DiracILC`, which derives from the upstream [DIRAC API][diracapi]. 43 | Typical usage is the following: 44 | 45 | ```python 46 | from ILCDIRAC.Interfaces.API.DiracILC import DiracILC 47 | ... 48 | dIlc = DiracILC() 49 | ``` 50 | 51 | The returned `dILc` variable contais the API context to be used when relevant. 52 | 53 | [diracapi]: https://raw.githubusercontent.com/DIRACGrid/DIRAC/integration/src/DIRAC/Interfaces/API/Dirac.py 54 | 55 | The job manager is an instance of `UserJob` - which derives from [Job][job] - is instantiated next. 56 | Typical usage is the following: 57 | 58 | ```python 59 | from ILCDIRAC.Interfaces.API.NewInterface.UserJob import UserJob 60 | ... 61 | job = UserJob() 62 | job.setOutputSandbox(['*.log', '*.sh', '*.py', '*.xml']) 63 | outputdatafile='kktautau_delphes_edm4hep_output.root' 64 | job.setOutputData(outputdatafile, '','CERN-DST-EOS' ) 65 | job.setJobGroup( "KKMC_EDM4HEP_Run" ) 66 | job.setName( "KKMC_EDM4HEP" ) 67 | job.setLogLevel("DEBUG") 68 | ... 69 | # Information can be added thorugh out the script 70 | delphescard='delphes_card_IDEA.tcl' 71 | ... 72 | # Set the sandbox content 73 | job.setInputSandbox(['./' + delphescard, './' + edm4hepoutdef, './' + pythiacard]) 74 | ``` 75 | 76 | [job]: https://dirac.readthedocs.io/en/latest/UserGuide/GettingStarted/UserJobs/ 77 | 78 | Applications are created, configured and added to the job manager in the order of running: 79 | An example is the following: 80 | 81 | ```python 82 | from ILCDIRAC.Interfaces.API.NewInterface.Applications import KKMC 83 | ... 84 | kkmc = KKMC() 85 | kkmc.setVersion('Key4hep-2021-04-30') 86 | kkmc.setEvtType('Tau') 87 | kkmc.setEnergy(91.2) 88 | nevts = 10000 89 | outputfile = 'kktautau_delphes_' + str(nevts) + '.LHE' 90 | kkmc.setNumberOfEvents(nevts) 91 | kkmc.setOutputFile(outputfile) 92 | 93 | job.append(kkmc) 94 | ``` 95 | 96 | Available applications defined in [here][diracapp]. 97 | 98 | [diracapp]: https://gitlab.cern.ch/CLICdp/iLCDirac/ILCDIRAC/-/tree/Rel-v31r0/Interfaces/API/NewInterface 99 | 100 | Finally the job is submitted: 101 | 102 | ```python 103 | print job.submit(dIlc, mode='wms') 104 | # Use wms='local' for running on the local computer 105 | ``` 106 | 107 | Local submission can be used for testing. 108 | 109 | ## Before starting: cloning of workflows repository 110 | 111 | The example scripts described in these pages, together with the relevant setup scripts, are available from the 112 | [FCCDIRAC][fccdirac] repository. 113 | 114 | The following steps must be executed (only once!) before trying to execute any of the workflows: 115 | 116 | ```bash 117 | $ git clone https://github.com/HEP-FCC/FCCDIRAC 118 | $ cd FCCDIRAC 119 | 120 | $ source init_fcc.sh 121 | Setting up the latest Key4HEP software stack from CVMFS ... 122 | ... Key4HEP release: key4hep-stack/2021-07-16 123 | ... Use the following command to reproduce the current environment: 124 | ... 125 | source /cvmfs/sw.hsf.org/spackages2/key4hep-stack/2021-07-16/x86_64-centos7-gcc8.3.0-opt/wxwfgu65rjnk7s6frj25qsoq5miay4ft/setup.sh 126 | ... 127 | ... done. 128 | 129 | $ source init_dirac.sh 130 | Setting the iLCDirac environment ... 131 | 132 | $ source init_dirac_proxy.sh 133 | Initializing the DIRAC/Grid proxy ... 134 | Generating proxy... 135 | Enter Certificate password: 136 | Added VOMS attribute /fcc 137 | Uploading proxy.. 138 | Proxy generated: 139 | subject : /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=ganis/CN=393971/CN=Gerardo Ganis/CN=2888907760/CN=1791020771 140 | issuer : /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=ganis/CN=393971/CN=Gerardo Ganis/CN=2888907760 141 | identity : /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=ganis/CN=393971/CN=Gerardo Ganis 142 | timeleft : 23:53:59 143 | DIRAC group : fcc_user 144 | path : /tmp/x509up_u2759 145 | username : ganis 146 | properties : NormalUser 147 | VOMS : True 148 | VOMS fqan : ['/fcc'] 149 | 150 | Proxies uploaded: 151 | DN | Group | Until (GMT) 152 | /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=ganis/CN=393971/CN=Gerardo Ganis | | 2022/05/13 12:12 153 | ``` 154 | 155 | [fccdirac]: https://github.com/HEP-FCC/FCCDIRAC 156 | -------------------------------------------------------------------------------- /fast-sim-and-analysis/README.md: -------------------------------------------------------------------------------- 1 | # Generators, Fast Simulation and Analysis 2 | 3 | 4 | If you want to get started with generation and analysis of fast-simulated 5 | events, you're at the right place. 6 | 7 | Fast simulation is currently supported through the Delphes approach. Support for the Papas approach, initially used for FCC-ee, is 8 | discontinued. 9 | 10 | An analysis ntuple will be produced with ROOT's RDataFrame, a simple modular event processing framework for high energy physics. 11 | 12 | If you have any problems or questions, you can 13 | [open an issue][fcc-tutorials-issues] on the 14 | [GitHub repository where these lessons are developed][fcc-tutorials-repo]. 15 | 16 | 17 | [fcc-tutorials-issues]: https://github.com/HEP-FCC/fcc-tutorials/issues 18 | [fcc-tutorials-repo]: https://github.com/HEP-FCC/fcc-tutorials 19 | 20 | ```{eval-rst} 21 | .. toctree:: 22 | :caption: Contents: 23 | 24 | FccFastSimGeneration.md 25 | k4simdelphes/doc/starterkit/FccFastSimDelphes/Readme.md 26 | fccanalyses/doc/starterkit/FccFastSimAnalysis/Readme.md 27 | fccanalyses/doc/starterkit/FccFastSimVertexing/Readme.md 28 | FCCAnalysesProblemsAndSolutions.md 29 | EventProduction.md 30 | ``` 31 | -------------------------------------------------------------------------------- /fast-sim-and-analysis/fccanalyses/doc/starterkit/FccFastSimAnalysis/analysis.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import ROOT 3 | 4 | print ("Load cxx analyzers ... ",) 5 | ROOT.gSystem.Load("libedm4hep") 6 | ROOT.gSystem.Load("libpodio") 7 | ROOT.gSystem.Load("libFCCAnalyses") 8 | ROOT.gErrorIgnoreLevel = ROOT.kFatal 9 | _edm = ROOT.edm4hep.ReconstructedParticleData() 10 | _pod = ROOT.podio.ObjectID() 11 | _fcc = ROOT.dummyLoader 12 | 13 | print ('edm4hep ',_edm) 14 | print ('podio ',_pod) 15 | print ('fccana ',_fcc) 16 | 17 | class analysis(): 18 | 19 | #__________________________________________________________ 20 | def __init__(self, inputlist, outname, ncpu): 21 | self.outname = outname 22 | if ".root" not in outname: 23 | self.outname+=".root" 24 | 25 | ROOT.ROOT.EnableImplicitMT(ncpu) 26 | 27 | self.df = ROOT.RDataFrame("events", inputlist) 28 | print (" done") 29 | #__________________________________________________________ 30 | def run(self): 31 | df2 = (self.df 32 | # define an alias for muon index collection 33 | .Alias("Muon0", "Muon#0.index") 34 | # define the muon collection 35 | .Define("muons", "ReconstructedParticle::get(Muon0, ReconstructedParticles)") 36 | #select muons on pT 37 | .Define("selected_muons", "ReconstructedParticle::sel_pt(10.)(muons)") 38 | # create branch with muon transverse momentum 39 | .Define("selected_muons_pt", "ReconstructedParticle::get_pt(selected_muons)") 40 | # create branch with muon rapidity 41 | .Define("selected_muons_y", "ReconstructedParticle::get_y(selected_muons)") 42 | # create branch with muon total momentum 43 | .Define("selected_muons_p", "ReconstructedParticle::get_p(selected_muons)") 44 | # create branch with muon energy 45 | .Define("selected_muons_e", "ReconstructedParticle::get_e(selected_muons)") 46 | # find zed candidates from di-muon resonances 47 | .Define("zed_leptonic", "ReconstructedParticle::resonanceBuilder(91)(selected_muons)") 48 | # write branch with zed mass 49 | .Define("zed_leptonic_m", "ReconstructedParticle::get_mass(zed_leptonic)") 50 | # write branch with zed transverse momenta 51 | .Define("zed_leptonic_pt", "ReconstructedParticle::get_pt(zed_leptonic)") 52 | # calculate recoil of zed_leptonic 53 | .Define("zed_leptonic_recoil", "ReconstructedParticle::recoilBuilder(240)(zed_leptonic)") 54 | # write branch with recoil mass 55 | .Define("zed_leptonic_recoil_m","ReconstructedParticle::get_mass(zed_leptonic_recoil)") 56 | 57 | ) 58 | 59 | # select branches for output file 60 | branchList = ROOT.vector('string')() 61 | for branchName in [ 62 | "selected_muons_pt", 63 | "selected_muons_y", 64 | "selected_muons_p", 65 | "selected_muons_e", 66 | "zed_leptonic_pt", 67 | "zed_leptonic_m", 68 | "zed_leptonic_recoil_m" 69 | ]: 70 | branchList.push_back(branchName) 71 | df2.Snapshot("events", self.outname, branchList) 72 | 73 | if __name__ == "__main__": 74 | 75 | infile = sys.argv[2] 76 | outfile = sys.argv[1] 77 | ncpus = 2 78 | analysis = analysis(infile, outfile, ncpus) 79 | analysis.run() 80 | -------------------------------------------------------------------------------- /fast-sim-and-analysis/fccanalyses/doc/starterkit/FccFastSimAnalysis/finalSel.py: -------------------------------------------------------------------------------- 1 | import sys, os 2 | import ROOT 3 | 4 | ###Input directory where the files produced at the pre-selection level are 5 | baseDir = "" 6 | 7 | ###Link to the dictonary that contains all the cross section informations etc... 8 | procDict = "https://fcc-physics-events.web.cern.ch/data/FCCDicts/FCCee_procDict_spring2021_IDEA.json" 9 | process_list=['p8_ee_ZZ_ecm240','p8_ee_WW_ecm240','p8_ee_ZH_ecm240'] 10 | 11 | ###Dictionnay of the list of cuts. The key is the name of the selection that will be added to the output file 12 | cut_list = {"sel0":"zed_leptonic_m.size() == 1", 13 | "sel1":"zed_leptonic_m.size() == 1 && zed_leptonic_m[0] > 80 && zed_leptonic_m[0] < 100" 14 | } 15 | 16 | 17 | ###Dictionary for the ouput variable/hitograms. The key is the name of the variable in the output files. "name" is the name of the variable in the input file, "title" is the x-axis label of the histogram, "bin" the number of bins of the histogram, "xmin" the minimum x-axis value and "xmax" the maximum x-axis value. 18 | variables = { 19 | "mz" :{"name":"zed_leptonic_m" ,"title":"m_{Z} [GeV]" ,"bin":125,"xmin":0 ,"xmax":250}, 20 | "mz_zoom" :{"name":"zed_leptonic_m" ,"title":"m_{Z} [GeV]" ,"bin":40 ,"xmin":80,"xmax":100}, 21 | "leptonic_recoil_m" :{"name":"zed_leptonic_recoil_m","title":"Z leptonic recoil [GeV]","bin":100,"xmin":0 ,"xmax":200}, 22 | "leptonic_recoil_m_zoom":{"name":"zed_leptonic_recoil_m","title":"Z leptonic recoil [GeV]","bin":200,"xmin":80,"xmax":160} 23 | } 24 | 25 | ###Number of CPUs to use 26 | NUM_CPUS = 2 27 | 28 | ###Produce TTrees 29 | DO_TREE=True 30 | 31 | ###This part is standard to all analyses 32 | import config.runDataFrameFinal as rdf 33 | myana=rdf.runDataFrameFinal(baseDir,procDict,process_list,cut_list,variables) 34 | myana.run(ncpu=NUM_CPUS, doTree=DO_TREE) 35 | -------------------------------------------------------------------------------- /fast-sim-and-analysis/fccanalyses/doc/starterkit/FccFastSimAnalysis/plots.py: -------------------------------------------------------------------------------- 1 | import ROOT 2 | 3 | # global parameters 4 | intLumi = 5.0e+06 #in pb-1 5 | ana_tex = 'e^{+}e^{-} #rightarrow ZH #rightarrow #mu^{+}#mu^{-} + X' 6 | delphesVersion = '3.4.2' 7 | energy = 240.0 8 | collider = 'FCC-ee' 9 | inputDir = '' 10 | formats = ['png','pdf'] 11 | yaxis = ['lin','log'] 12 | stacksig = ['stack','nostack'] 13 | outdir = 'plots/' 14 | 15 | variables = ['mz','mz_zoom','leptonic_recoil_m','leptonic_recoil_m_zoom'] 16 | 17 | ###Dictonnary with the analysis name as a key, and the list of selections to be plotted for this analysis. The name of the selections should be the same than in the final selection 18 | selections = {} 19 | selections['ZH'] = ["sel0","sel1"] 20 | selections['ZH_2'] = ["sel0","sel1"] 21 | 22 | extralabel = {} 23 | extralabel['sel0'] = "Selection: N_{Z} = 1" 24 | extralabel['sel1'] = "Selection: N_{Z} = 1; 80 GeV < m_{Z} < 100 GeV" 25 | 26 | colors = {} 27 | colors['ZH'] = ROOT.kRed 28 | colors['WW'] = ROOT.kBlue+1 29 | colors['ZZ'] = ROOT.kGreen+2 30 | colors['VV'] = ROOT.kGreen+3 31 | 32 | plots = {} 33 | plots['ZH'] = {'signal':{'ZH':['p8_ee_ZH_ecm240']}, 34 | 'backgrounds':{'WW':['p8_ee_WW_ecm240'], 35 | 'ZZ':['p8_ee_ZZ_ecm240']} 36 | } 37 | 38 | 39 | plots['ZH_2'] = {'signal':{'ZH':['p8_ee_ZH_ecm240']}, 40 | 'backgrounds':{'VV':['p8_ee_WW_ecm240','p8_ee_ZZ_ecm240']} 41 | } 42 | 43 | legend = {} 44 | legend['ZH'] = 'ZH' 45 | legend['WW'] = 'WW' 46 | legend['ZZ'] = 'ZZ' 47 | legend['VV'] = 'VV boson' 48 | -------------------------------------------------------------------------------- /fast-sim-and-analysis/fccanalyses/doc/starterkit/FccFastSimVertexing/Exercises/MyAnalysis.cc: -------------------------------------------------------------------------------- 1 | #include "FCCAnalyses/MyAnalysis.h" 2 | #include 3 | 4 | namespace FCCAnalyses{ 5 | 6 | namespace MyAnalysis { 7 | 8 | 9 | double sum_momentum_tracks( const VertexingUtils::FCCAnalysesVertex& vertex) { 10 | double sum = 0; 11 | ROOT::VecOps::RVec< TVector3 > momenta = vertex.updated_track_momentum_at_vertex ; 12 | int n = momenta.size(); 13 | for (int i=0; i < n; i++) { 14 | TVector3 p = momenta[i]; 15 | double px = p[0]; 16 | double py = p[1]; 17 | double pt = sqrt(pow(px,2)+pow(py,2)) ; 18 | sum += pt; 19 | } 20 | return sum; 21 | } 22 | 23 | 24 | // ------------------------------------------------------------------------------------------------- 25 | 26 | double tau3mu_vertex_mass( const VertexingUtils::FCCAnalysesVertex& vertex ) { 27 | double muon_mass = 0.1056; 28 | TLorentzVector tau; 29 | ROOT::VecOps::RVec< TVector3 > momenta = vertex.updated_track_momentum_at_vertex ; 30 | int n = momenta.size(); 31 | for (int ileg=0; ileg < n; ileg++) { 32 | TVector3 track_momentum = momenta[ ileg ]; 33 | TLorentzVector leg; 34 | leg.SetXYZM( track_momentum[0], track_momentum[1], track_momentum[2], muon_mass ) ; 35 | tau += leg; 36 | } 37 | return tau.M(); 38 | } 39 | 40 | 41 | double tau3mu_raw_mass( const ROOT::VecOps::RVec& legs ) { 42 | double muon_mass = 0.1056; 43 | TLorentzVector tau; 44 | int n = legs.size(); 45 | for (int ileg=0; ileg < n; ileg++) { 46 | TLorentzVector leg; 47 | leg.SetXYZM(legs[ileg].momentum.x, legs[ileg].momentum.y, legs[ileg].momentum.z, muon_mass ); 48 | tau += leg; 49 | } 50 | return tau.M(); 51 | } 52 | 53 | 54 | // ------------------------------------------------------------------------------------------------- 55 | 56 | ROOT::VecOps::RVec< ROOT::VecOps::RVec > build_triplets( const ROOT::VecOps::RVec& in , float total_charge ) { 57 | 58 | ROOT::VecOps::RVec< ROOT::VecOps::RVec< edm4hep::ReconstructedParticleData> > results; 59 | float charge =0; 60 | int n = in.size(); 61 | if ( n < 3 ) return results; 62 | 63 | for (int i=0; i < n; i++) { 64 | edm4hep::ReconstructedParticleData pi = in[i]; 65 | float charge_i = pi.charge ; 66 | 67 | for (int j=i+1; j < n; j++) { 68 | edm4hep::ReconstructedParticleData pj = in[j]; 69 | float charge_j = pj.charge ; 70 | 71 | for (int k=j+1; k < n; k++) { 72 | edm4hep::ReconstructedParticleData pk = in[k]; 73 | float charge_k = pk.charge ; 74 | float charge_tot = charge_i + charge_j + charge_k; 75 | if ( charge_tot == total_charge ) { 76 | ROOT::VecOps::RVec a_triplet; 77 | a_triplet.push_back( pi ); 78 | a_triplet.push_back( pj ); 79 | a_triplet.push_back( pk ); 80 | results.push_back( a_triplet ); 81 | } 82 | 83 | } 84 | 85 | } 86 | 87 | } 88 | return results; 89 | } 90 | 91 | 92 | ROOT::VecOps::RVec< VertexingUtils::FCCAnalysesVertex > build_AllTauVertexObject( 93 | const ROOT::VecOps::RVec< ROOT::VecOps::RVec >& triplets, 94 | const ROOT::VecOps::RVec& allTracks ) { 95 | ROOT::VecOps::RVec< VertexingUtils::FCCAnalysesVertex > results; 96 | int ntriplets = triplets.size(); 97 | for (int i=0; i < ntriplets; i++) { 98 | ROOT::VecOps::RVec legs = triplets[i]; 99 | 100 | ROOT::VecOps::RVec the_tracks = ReconstructedParticle2Track::getRP2TRK( legs, allTracks ); 101 | VertexingUtils::FCCAnalysesVertex vertex = VertexFitterSimple::VertexFitter_Tk( 2, the_tracks ); 102 | results.push_back( vertex ); 103 | } 104 | return results; 105 | } 106 | 107 | 108 | ROOT::VecOps::RVec< double > build_AllTauMasses( const ROOT::VecOps::RVec< VertexingUtils::FCCAnalysesVertex>& vertices ) { 109 | ROOT::VecOps::RVec< double > results; 110 | for ( auto& v: vertices) { 111 | double mass = tau3mu_vertex_mass( v ); 112 | results.push_back( mass ); 113 | } 114 | return results; 115 | } 116 | 117 | // ------------------------------------------------------------------------------------------------- 118 | 119 | 120 | 121 | selRP_Fakes::selRP_Fakes( float arg_fakeRate, float arg_mass ) : m_fakeRate(arg_fakeRate), m_mass( arg_mass) { 122 | unsigned seed = std::chrono::system_clock::now().time_since_epoch().count(); 123 | std::default_random_engine generator (seed); 124 | m_generator = generator; 125 | std::uniform_real_distribution flatdis(0.,1.); 126 | m_flat.param( flatdis.param() ); 127 | }; 128 | 129 | std::vector selRP_Fakes::operator() (ROOT::VecOps::RVec in) { 130 | std::vector result; 131 | for (size_t i = 0; i < in.size(); ++i) { 132 | auto & p = in[i]; 133 | float arandom = m_flat (m_generator ); 134 | if ( arandom <= m_fakeRate) { 135 | edm4hep::ReconstructedParticleData reso = p; 136 | //reso.momentum.x = p.momentum.x ; 137 | //reso.momentum.y = p.momentum.y ; 138 | //reso.momentum.z = p.momentum.z ; 139 | reso.mass = m_mass; 140 | //reso.charge = p.charge; 141 | result.push_back( reso ); 142 | } 143 | } 144 | return result; 145 | } 146 | 147 | 148 | 149 | // --- for tests... 150 | 151 | float get_p(const edm4hep::MCParticleData& p) { 152 | TLorentzVector tlv; 153 | tlv.SetXYZM(p.momentum.x, p.momentum.y, p.momentum.z, p.mass); 154 | return tlv.P(); 155 | } 156 | 157 | float get_e(const edm4hep::MCParticleData& p) { 158 | TLorentzVector tlv; 159 | tlv.SetXYZM(p.momentum.x, p.momentum.y, p.momentum.z, p.mass); 160 | return tlv.E(); 161 | } 162 | 163 | float get_theta(const edm4hep::MCParticleData& p) { 164 | TLorentzVector tlv; 165 | tlv.SetXYZM(p.momentum.x, p.momentum.y, p.momentum.z, p.mass); 166 | return tlv.Theta(); 167 | } 168 | 169 | 170 | 171 | 172 | } //end NS 173 | } // end NS 174 | 175 | -------------------------------------------------------------------------------- /fast-sim-and-analysis/fccanalyses/doc/starterkit/FccFastSimVertexing/Exercises/MyAnalysis.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef MYANALYSIS_ANALYZERS_H 3 | #define MYANALYSIS_ANALYZERS_H 4 | 5 | #include 6 | #include 7 | 8 | #include "TLorentzVector.h" 9 | #include "ROOT/RVec.hxx" 10 | #include "edm4hep/ReconstructedParticleData.h" 11 | #include "edm4hep/ParticleIDData.h" 12 | #include "edm4hep/TrackState.h" 13 | 14 | #include "VertexingUtils.h" 15 | #include "ReconstructedParticle2Track.h" 16 | #include "VertexFitterSimple.h" 17 | 18 | #include 19 | #include 20 | 21 | 22 | namespace FCCAnalyses{ 23 | 24 | namespace MyAnalysis { 25 | 26 | double sum_momentum_tracks( const VertexingUtils::FCCAnalysesVertex& vertex ); 27 | 28 | double tau3mu_vertex_mass( const VertexingUtils::FCCAnalysesVertex& vertex ); 29 | double tau3mu_raw_mass( const ROOT::VecOps::RVec& legs ) ; 30 | 31 | 32 | ROOT::VecOps::RVec< ROOT::VecOps::RVec > build_triplets( 33 | const ROOT::VecOps::RVec& in , float total_charge) ; 34 | 35 | ROOT::VecOps::RVec< VertexingUtils::FCCAnalysesVertex > build_AllTauVertexObject( 36 | const ROOT::VecOps::RVec< ROOT::VecOps::RVec >& triplets, 37 | const ROOT::VecOps::RVec& allTracks ) ; 38 | 39 | ROOT::VecOps::RVec< double > build_AllTauMasses( const ROOT::VecOps::RVec< VertexingUtils::FCCAnalysesVertex>& vertices ) ; 40 | 41 | 42 | struct selRP_Fakes { 43 | selRP_Fakes( float arg_fakeRate, float arg_mass ); 44 | float m_fakeRate = 1e-3; 45 | float m_mass = 0.106; // muon mass 46 | std::default_random_engine m_generator; 47 | std::uniform_real_distribution m_flat; 48 | std::vector operator() (ROOT::VecOps::RVec in); 49 | }; 50 | 51 | 52 | 53 | 54 | float get_p(const edm4hep::MCParticleData& p) ; 55 | float get_e(const edm4hep::MCParticleData& p) ; 56 | float get_theta(const edm4hep::MCParticleData& in) ; 57 | 58 | }//end NS MyAnalysis 59 | 60 | }//end NS FCCAnalyses 61 | 62 | #endif 63 | 64 | -------------------------------------------------------------------------------- /fast-sim-and-analysis/fccanalyses/doc/starterkit/FccFastSimVertexing/Exercises/analysis_Tau3Mu_stage1.py: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # 4 | # To run: 5 | # 6 | # fccanalysis run analysis_Tau3Mu_stage1.py 7 | 8 | 9 | #Mandatory: List of processes 10 | processList = { 11 | 'p8_noBES_ee_Ztautau_ecm91_EvtGen_TauMinus2MuMuMu':{},#Run the full statistics in one output file named /xxx.root 12 | 'p8_noBES_ee_Ztautau_ecm91_EvtGen_TauMinus2PiPiPinu':{} 13 | #'p8_ee_WW_ecm240':{'fraction':0.5, 'chunks':2}, #Run 50% of the statistics in two files named /p8_ee_WW_ecm240/chunk.root 14 | #'p8_ee_ZH_ecm240':{'fraction':0.2, 'output':'p8_ee_ZH_ecm240_out'} #Run 20% of the statistics in one file named /p8_ee_ZH_ecm240_out.root (example on how to change the output name) 15 | } 16 | 17 | #Mandatory: Production tag when running over EDM4Hep centrally produced events, this points to the yaml files for getting sample statistics 18 | prodTag = "FCCee/spring2021/IDEA/" 19 | 20 | #Optional: output directory, default is local running directory 21 | outputDir = "Tau3Mu" 22 | 23 | #Optional: analysisName, default is "" 24 | #analysisName = "My Analysis" 25 | 26 | #Optional: ncpus, default is 4 27 | #nCPUS = 8 28 | 29 | #Optional running on HTCondor, default is False 30 | #runBatch = False 31 | 32 | #Optional batch queue name when running on HTCondor, default is workday 33 | #batchQueue = "longlunch" 34 | 35 | #Optional computing account when running on HTCondor, default is group_u_FCC.local_gen 36 | #compGroup = "group_u_FCC.local_gen" 37 | 38 | #Optional test file 39 | testFile= "/eos/experiment/fcc/ee/generation/DelphesEvents/spring2021/IDEA/p8_noBES_ee_Ztautau_ecm91_EvtGen_TauMinus2PiPiPinu/events_179808277.root" 40 | 41 | 42 | #Mandatory: RDFanalysis class where the use defines the operations on the TTree 43 | class RDFanalysis(): 44 | 45 | #__________________________________________________________ 46 | #Mandatory: analysers funtion to define the analysers to process, please make sure you return the last dataframe, in this example it is df2 47 | def analysers(df): 48 | df2 = ( 49 | df 50 | 51 | # Use the "AllMuons" collection, which contains also non-isolated muons (in contrast to the "Muons" collection) 52 | # Actually, "Muon" or ("AllMuon") just contain pointers (indices) to the RecoParticle collections, 53 | # hence one needs to first retrieve the RecoParticles corresponding to these muons. 54 | # ( for more detail about the collections, see https://github.com/HEP-FCC/FCCAnalyses/tree/master/examples/basics ) 55 | .Alias("Muon0", "AllMuon#0.index") 56 | .Define("muons", "ReconstructedParticle::get(Muon0, ReconstructedParticles)") 57 | .Define("n_muons", "ReconstructedParticle::get_n( muons ) ") 58 | 59 | # ----------------------------------------- 60 | # Add fake muons from pi -> mu 61 | 62 | # This selects the charged hadrons : 63 | .Alias("MCRecoAssociations0", "MCRecoAssociations#0.index") 64 | .Alias("MCRecoAssociations1", "MCRecoAssociations#1.index") 65 | .Define("ChargedHadrons", "ReconstructedParticle2MC::selRP_ChargedHadrons( MCRecoAssociations0,MCRecoAssociations1,ReconstructedParticles,Particle)") 66 | # Only the ones with p > 2 GeV could be selected as muons : 67 | .Define("ChargedHadrons_pgt2", "ReconstructedParticle::sel_p(2.) ( ChargedHadrons )") 68 | # Build fake muons based on a flat fake rate (random selection) : 69 | .Define("fakeMuons_5em2", "MyAnalysis::selRP_Fakes( 5e-2, 0.106)(ChargedHadrons_pgt2)" ) 70 | 71 | # Now we marge the collection of fake muons with the genuine muons : 72 | .Define("muons_with_fakes", "ReconstructedParticle::merge( muons, fakeMuons_5em2 )") 73 | # and we use this collection later on, instead of "muons" : 74 | .Alias("theMuons", "muons_with_fakes") 75 | .Define("n_muons_withFakes", "ReconstructedParticle::get_n( theMuons )") 76 | 77 | # ----------------------------------------- 78 | 79 | 80 | # Build triplets of muons. 81 | # We are interested in tau- -> mu- mu- mu+ (the MC files produced for this tutorial 82 | # only forced the decay of the tau- , not the tau+ ). 83 | # Hence we look for triples of total charge = -1 : 84 | .Define("triplets_m", "MyAnalysis::build_triplets( theMuons, -1. )") # returns a vector of triplets, i.e. of vectors of 3 RecoParticles 85 | .Define("n_triplets_m", "return triplets_m.size() ; " ) 86 | #.Filter( "n_triplets_m > 0" ) 87 | 88 | # ---------------------------------------------------- 89 | # Simple: consider only the 1st triplet : 90 | 91 | #.Define("the_muons_candidate_0", "return triplets_m[0] ; ") # the_muons_candidates = a vector of 3 RecoParticles 92 | 93 | # get the corresponding tracks: 94 | #.Define("the_muontracks_candidate_0", "ReconstructedParticle2Track::getRP2TRK( the_muons_candidate_0, EFlowTrack_1)") 95 | # and fit them to a common vertex : 96 | #.Define("TauVertexObject_candidate_0", "VertexFitterSimple::VertexFitter_Tk( 2, the_muontracks_candidate_0)" ) 97 | # Now we can get the mass of this candidate, as before : 98 | #.Define("TauMass_candidate_0", "MyAnalysis::tau3mu_vertex_mass( TauVertexObject_candidate_0 )" ) 99 | 100 | 101 | # ---------------------------------------------------- 102 | # Now consider all triplets : 103 | 104 | .Define("TauVertexObject_allCandidates", "MyAnalysis::build_AllTauVertexObject( triplets_m , EFlowTrack_1 ) ") 105 | .Define("TauMass_allCandidates", "MyAnalysis::build_AllTauMasses( TauVertexObject_allCandidates )" ) 106 | 107 | 108 | # Total visible energy in the event : 109 | .Define("RecoPartEnergies", "ReconstructedParticle::get_e( ReconstructedParticles )") 110 | .Define("visible_energy", "Sum( RecoPartEnergies )") 111 | 112 | ) 113 | return df2 114 | 115 | 116 | #__________________________________________________________ 117 | #Mandatory: output function, please make sure you return the branchlist as a python list 118 | def output(): 119 | branchList = [ 120 | "n_muons", 121 | "n_triplets_m", 122 | #"TauMass_candidate_0", 123 | "TauMass_allCandidates", 124 | "visible_energy" 125 | 126 | ] 127 | return branchList 128 | 129 | 130 | -------------------------------------------------------------------------------- /fast-sim-and-analysis/fccanalyses/doc/starterkit/FccFastSimVertexing/analysis_Bs2JpsiPhi_MCseeded.py: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # 4 | # To run: 5 | # 6 | # fccanalysis run analysis_Bs2JpsiPhi.py --test --nevents 1000 --output Bs2JpsiPhi_MCseeded.root 7 | 8 | 9 | #Mandatory: List of processes 10 | processList = { 11 | 'p8_noBES_ee_Ztautau_ecm91_EvtGen_TauMinus2MuMuMu':{},#Run the full statistics in one output file named /xxx.root 12 | 'p8_noBES_ee_Ztautau_ecm91_EvtGen_TauMinus2PiPiPinu':{} 13 | #'p8_ee_WW_ecm240':{'fraction':0.5, 'chunks':2}, #Run 50% of the statistics in two files named /p8_ee_WW_ecm240/chunk.root 14 | #'p8_ee_ZH_ecm240':{'fraction':0.2, 'output':'p8_ee_ZH_ecm240_out'} #Run 20% of the statistics in one file named /p8_ee_ZH_ecm240_out.root (example on how to change the output name) 15 | } 16 | 17 | #Mandatory: Production tag when running over EDM4Hep centrally produced events, this points to the yaml files for getting sample statistics 18 | prodTag = "FCCee/spring2021/IDEA/" 19 | 20 | #Optional: output directory, default is local running directory 21 | #outputDir = "outputs/FCCee/higgs/mH-recoil/mumu/stage1" 22 | 23 | #Optional: analysisName, default is "" 24 | #analysisName = "My Analysis" 25 | 26 | #Optional: ncpus, default is 4 27 | #nCPUS = 8 28 | 29 | #Optional running on HTCondor, default is False 30 | #runBatch = False 31 | 32 | #Optional batch queue name when running on HTCondor, default is workday 33 | #batchQueue = "longlunch" 34 | 35 | #Optional computing account when running on HTCondor, default is group_u_FCC.local_gen 36 | #compGroup = "group_u_FCC.local_gen" 37 | 38 | #Optional test file 39 | testFile=" /eos/experiment/fcc/ee/examples/lowerTriangle/p8_ecm91GeV_Zbb_EvtGen_Bs2JpsiPhi_IDEAtrkCov.root" 40 | 41 | 42 | #Mandatory: RDFanalysis class where the use defines the operations on the TTree 43 | class RDFanalysis(): 44 | 45 | #__________________________________________________________ 46 | #Mandatory: analysers funtion to define the analysers to process, please make sure you return the last dataframe, in this example it is df2 47 | def analysers(df): 48 | df2 = ( 49 | df 50 | 51 | .Alias("Particle1", "Particle#1.index") 52 | .Alias("MCRecoAssociations0", "MCRecoAssociations#0.index") 53 | .Alias("MCRecoAssociations1", "MCRecoAssociations#1.index") 54 | 55 | # MC indices of the decay Bs (PDG = 531) -> mu+ (PDG = -13) mu- (PDG = 13) K+ (PDG = 321) K- (PDG = -321) 56 | # Retrieves a vector of int's which correspond to indices in the Particle block 57 | # vector[0] = the mother, and then the daughters in the order specified, i.e. here 58 | # [1] = the mu+, [2] = the mu-, [3] = the K+, [4] = the K- 59 | # Boolean arguments : 60 | # 1st: stableDaughters. when set to true, the dsughters specified in the list are looked 61 | # for among the final, stable particles that come out from the mother, i.e. the decay tree is 62 | # explored recursively if needed. 63 | # 2nd: chargeConjugateMother 64 | # 3rd: chargeConjugateDaughters 65 | # 4th: inclusiveDecay: when set to false, if a mother is found, that decays 66 | # into the particles specified in the list plus other particle(s), this decay is not selected. 67 | # If the event contains more than one such decays,only the first one is kept. 68 | .Define("Bs2MuMuKK_indices", "MCParticle::get_indices( 531, {-13,13,321,-321}, true, true, true, false) ( Particle, Particle1)" ) 69 | 70 | # select events for which the requested decay chain has been found: 71 | .Filter("Bs2MuMuKK_indices.size() > 0") 72 | 73 | # the mu+ (MCParticle) that comes from the Bs decay : 74 | .Define("MC_Muplus", "return Particle.at( Bs2MuMuKK_indices[1] ) ;") 75 | # Decay vertex (an edm4hep::Vector3d) of the Bs (MC) = production vertex of the muplus : 76 | .Define("BsMCDecayVertex", " return MC_Muplus.vertex ; ") 77 | 78 | # Returns the RecoParticles associated with the four Bs decay products. 79 | # The size of this collection is always 4 provided that Bs2MuMuKK_indices is not empty, 80 | # possibly including "dummy" particles in case one of the legs did not make a RecoParticle 81 | # (e.g. because it is outsice the tracker acceptance). 82 | # This is done on purpose, in order to maintain the mapping with the indices - i.e. the 1st particle in 83 | # the list BsRecoParticles is the mu+, then the mu-, etc. 84 | # (selRP_matched_to_list ignores the unstable MC particles that are in the input list of indices 85 | # hence the mother particle, which is the [0] element of the Bs2MuMuKK_indices vector). 86 | # 87 | # The matching between RecoParticles and MCParticles requires 4 collections. For more 88 | # detail, see https://github.com/HEP-FCC/FCCAnalyses/tree/master/examples/basics 89 | .Define("BsRecoParticles", "ReconstructedParticle2MC::selRP_matched_to_list( Bs2MuMuKK_indices, MCRecoAssociations0,MCRecoAssociations1,ReconstructedParticles,Particle)") 90 | 91 | # the corresponding tracks - here, dummy particles, if any, are removed, i.e. one may have < 4 tracks, 92 | # e.g. if one muon or kaon was emitted outside of the acceptance 93 | .Define("BsTracks", "ReconstructedParticle2Track::getRP2TRK( BsRecoParticles, EFlowTrack_1)" ) 94 | 95 | # number of tracks in this BsTracks collection ( = the #tracks used to reconstruct the Bs vertex) 96 | .Define("n_BsTracks", "ReconstructedParticle2Track::getTK_n( BsTracks )") 97 | 98 | # Fit the tracks to a common vertex. That would be a secondary vertex, hence we put 99 | # a "2" as the first argument of VertexFitter_Tk : 100 | # First the full object, of type Vertexing::FCCAnalysesVertex 101 | .Define("BsVertexObject", "VertexFitterSimple::VertexFitter_Tk( 2, BsTracks)" ) 102 | # from which we extract the edm4hep::VertexData object, which contains the vertex positiob in mm 103 | .Define("BsVertex", "VertexingUtils::get_VertexData( BsVertexObject )") 104 | 105 | 106 | ) 107 | return df2 108 | 109 | 110 | #__________________________________________________________ 111 | #Mandatory: output function, please make sure you return the branchlist as a python list 112 | def output(): 113 | branchList = [ 114 | "MC_Muplus", 115 | "n_BsTracks", 116 | "BsMCDecayVertex", 117 | "BsVertex", 118 | 119 | ] 120 | return branchList 121 | 122 | 123 | -------------------------------------------------------------------------------- /fast-sim-and-analysis/fccanalyses/doc/starterkit/FccFastSimVertexing/analysis_Tau3Mu_final.py: -------------------------------------------------------------------------------- 1 | #Input directory where the files produced at the pre-selection level are 2 | inputDir = "Tau3Mu/" 3 | 4 | #Input directory where the files produced at the pre-selection level are 5 | outputDir = "Tau3Mu/final/" 6 | 7 | 8 | processList = { 9 | 'p8_noBES_ee_Ztautau_ecm91_EvtGen_TauMinus2MuMuMu':{}, #Run over the full statistics from stage2 input file /xx.root. Keep the same output name as input 10 | 'p8_noBES_ee_Ztautau_ecm91_EvtGen_TauMinus2PiPiPinu':{} 11 | } 12 | 13 | 14 | #Link to the dictonary that contains all the cross section informations etc... 15 | procDict = "FCCee_procDict_spring2021_IDEA.json" 16 | 17 | #Add MySample_p8_ee_ZH_ecm240 as it is not an offical process 18 | #procDictAdd={"MySample_p8_ee_ZH_ecm240":{"numberOfEvents": 10000000, "sumOfWeights": 10000000, "crossSection": 0.201868, "kfactor": 1.0, "matchingEfficiency": 1.0}} 19 | 20 | #Number of CPUs to use 21 | nCPUS = 2 22 | 23 | #produces ROOT TTrees, default is False 24 | doTree = False 25 | 26 | ###Dictionnay of the list of cuts. The key is the name of the selection that will be added to the output file 27 | cutList = {"sel0":"n_triplets_m > 0", 28 | "sel1":"Min( TauMass_allCandidates ) < 3" 29 | } 30 | 31 | 32 | #Dictionary for the ouput variable/hitograms. The key is the name of the variable in the output files. "name" is the name of the variable in the input file, "title" is the x-axis label of the histogram, "bin" the number of bins of the histogram, "xmin" the minimum x-axis value and "xmax" the maximum x-axis value. 33 | histoList = { 34 | "mTau":{"name":"TauMass_allCandidates","title":"m_{tau} [GeV]","bin":100,"xmin":0,"xmax":3}, 35 | "mTau_zoom":{"name":"TauMass_allCandidates","title":"m_{tau} [GeV]","bin":100,"xmin":1.7,"xmax":1.9}, 36 | "Evis":{"name":"visible_energy","title":"E_{vis} [GeV]","bin":100,"xmin":0,"xmax":91.2}, 37 | } 38 | -------------------------------------------------------------------------------- /fast-sim-and-analysis/fccanalyses/doc/starterkit/FccFastSimVertexing/analysis_Tau3Mu_plots.py: -------------------------------------------------------------------------------- 1 | import ROOT 2 | 3 | # global parameters 4 | intLumi = 100.0e+06 #in pb-1 5 | ana_tex = 'e^{+}e^{-} #rightarrow #tau #tau' 6 | delphesVersion = '3.4.2' 7 | energy = 91.2 8 | collider = 'FCC-ee' 9 | inputDir = 'Tau3Mu/final/' 10 | formats = ['png','pdf'] 11 | yaxis = ['lin','log'] 12 | stacksig = ['stack','nostack'] 13 | outdir = 'Tau3Mu/plots/' 14 | 15 | variables = ['mTau', 'mTau_zoom', 'Evis' ] 16 | 17 | ###Dictonnary with the analysis name as a key, and the list of selections to be plotted for this analysis. The name of the selections should be the same than in the final selection 18 | selections = {} 19 | selections['Tau3Mu'] = ["sel0","sel1"] 20 | 21 | extralabel = {} 22 | extralabel['sel0'] = "Selection: N_{candidate} > 0" 23 | extralabel['sel1'] = "Selection: a candidate with M < 3 GeV" 24 | 25 | colors = {} 26 | colors['Tau3Mu'] = ROOT.kRed 27 | colors['Tau3Pi'] = ROOT.kBlue+1 28 | 29 | plots = {} 30 | plots['Tau3Mu'] = {'signal':{'Tau3Mu':['p8_noBES_ee_Ztautau_ecm91_EvtGen_TauMinus2MuMuMu']}, 31 | 'backgrounds':{'Tau3Pi':['p8_noBES_ee_Ztautau_ecm91_EvtGen_TauMinus2PiPiPinu'], 32 | } 33 | } 34 | 35 | 36 | 37 | legend = {} 38 | legend['Tau3Mu'] = 'Tau3Mu' 39 | legend['Tau3Pi'] = 'Tau3Pi' 40 | -------------------------------------------------------------------------------- /fast-sim-and-analysis/fccanalyses/doc/starterkit/FccFastSimVertexing/analysis_primary_vertex.py: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # 4 | # To run: 5 | # 6 | # fccanalysis run analysis_primary_vertex.py --test --nevents 1000 --output primary_Zuds.root 7 | 8 | 9 | #Mandatory: List of processes 10 | processList = { 11 | 'p8_ee_ZZ_ecm240':{},#Run the full statistics in one output file named /p8_ee_ZZ_ecm240.root 12 | 'p8_ee_WW_ecm240':{'fraction':0.5, 'chunks':2}, #Run 50% of the statistics in two files named /p8_ee_WW_ecm240/chunk.root 13 | 'p8_ee_ZH_ecm240':{'fraction':0.2, 'output':'p8_ee_ZH_ecm240_out'} #Run 20% of the statistics in one file named /p8_ee_ZH_ecm240_out.root (example on how to change the output name) 14 | } 15 | 16 | #Mandatory: Production tag when running over EDM4Hep centrally produced events, this points to the yaml files for getting sample statistics 17 | prodTag = "FCCee/spring2021/IDEA/" 18 | 19 | #Optional: output directory, default is local running directory 20 | #outputDir = "outputs/FCCee/higgs/mH-recoil/mumu/stage1" 21 | 22 | #Optional: analysisName, default is "" 23 | #analysisName = "My Analysis" 24 | 25 | #Optional: ncpus, default is 4 26 | #nCPUS = 8 27 | 28 | #Optional running on HTCondor, default is False 29 | #runBatch = False 30 | 31 | #Optional batch queue name when running on HTCondor, default is workday 32 | #batchQueue = "longlunch" 33 | 34 | #Optional computing account when running on HTCondor, default is group_u_FCC.local_gen 35 | #compGroup = "group_u_FCC.local_gen" 36 | 37 | #Optional test file 38 | testFile="/eos/experiment/fcc/ee/generation/DelphesEvents/spring2021/IDEA/p8_ee_Zuds_ecm91/events_125841058.root" 39 | #testFile="/eos/experiment/fcc/ee/generation/DelphesEvents/spring2021/IDEA/events_092272862.root" 40 | 41 | #Mandatory: RDFanalysis class where the use defines the operations on the TTree 42 | class RDFanalysis(): 43 | 44 | #__________________________________________________________ 45 | #Mandatory: analysers funtion to define the analysers to process, please make sure you return the last dataframe, in this example it is df2 46 | def analysers(df): 47 | df2 = ( 48 | df 49 | 50 | # MC event primary vertex 51 | .Define("MC_PrimaryVertex", "FCCAnalyses::MCParticle::get_EventPrimaryVertex(21)( Particle )" ) 52 | 53 | # number of tracks 54 | .Define("ntracks","ReconstructedParticle2Track::getTK_n(EFlowTrack_1)") 55 | 56 | 57 | # Fit all tracks of the events to a common vertex - here using a beam-spot constraint: 58 | 59 | # VertexObject_allTracks is an object of type VertexingUtils::FCCAnalysesVertex 60 | # It contains in particular : 61 | # - an edm4hep::VertexData : 62 | # std::int32_t primary{}; ///< boolean flag, if vertex is the primary vertex of the event 63 | # float chi2{}; ///< chi-squared of the vertex fit 64 | # ::edm4hep::Vector3f position{}; ///< [mm] position of the vertex. 65 | # std::array covMatrix{}; ///< covariance matrix of the position (stored as lower triangle matrix, i.e. cov(xx),cov(y,x),cov(z,x),cov(y,y),... ) 66 | # - ROOT::VecOps::RVec reco_chi2 : the contribution to the chi2 of all tracks used in the fit 67 | # - ROOT::VecOps::RVec< TVector3 > updated_track_momentum_at_vertex : the post-fit (px, py, pz ) of the tracks, at the vertex (and not at their d.c.a.) 68 | .Define("VertexObject_allTracks", "VertexFitterSimple::VertexFitter_Tk ( 1, EFlowTrack_1, true, 4.5, 20e-3, 300)") 69 | 70 | # EFlowTrack_1 is the collection of all tracks (the fitting method can of course be applied to a subset of tracks (see later)). 71 | # "true" means that a beam-spot constraint is applied. Default is no BSC. Following args are the BS size and position, in mum : 72 | # bool BeamSpotConstraint = false, 73 | # double sigmax=0., double sigmay=0., double sigmaz=0., 74 | # double bsc_x=0., double bsc_y=0., double bsc_z=0. ) ; 75 | 76 | 77 | # This returns the edm4hep::VertexData : 78 | .Define("Vertex_allTracks", "VertexingUtils::get_VertexData( VertexObject_allTracks )") # primary vertex, in mm 79 | 80 | 81 | # This is not a good estimate of the primary vertex: even in a Z -> uds event, there are displaced tracks (e.g. Ks, Lambdas), which would bias the fit. 82 | # Below, we determine the "primary tracks" using an iterative algorithm - cf LCFI+. 83 | .Define("RecoedPrimaryTracks", "VertexFitterSimple::get_PrimaryTracks( VertexObject_allTracks, EFlowTrack_1, true, 4.5, 20e-3, 300, 0., 0., 0., 0)") 84 | 85 | # Now we run again the vertex fit, but only on the primary tracks : 86 | .Define("PrimaryVertexObject", "VertexFitterSimple::VertexFitter_Tk ( 1, RecoedPrimaryTracks, true, 4.5, 20e-3, 300) ") 87 | .Define("PrimaryVertex", "VertexingUtils::get_VertexData( PrimaryVertexObject )") 88 | 89 | # It is often useful to retrieve the secondary (i.e. non-primary) tracks, for example to search for secondary vertices. 90 | # The method below simply "subtracts" the primary tracks from the full collection : 91 | .Define("SecondaryTracks", "VertexFitterSimple::get_NonPrimaryTracks( EFlowTrack_1, RecoedPrimaryTracks )") 92 | 93 | 94 | ) 95 | return df2 96 | 97 | 98 | #__________________________________________________________ 99 | #Mandatory: output function, please make sure you return the branchlist as a python list 100 | def output(): 101 | branchList = [ 102 | # 103 | "MC_PrimaryVertex", 104 | "ntracks", 105 | "Vertex_allTracks", 106 | "PrimaryVertex", 107 | ] 108 | return branchList 109 | 110 | 111 | -------------------------------------------------------------------------------- /fast-sim-and-analysis/fccanalyses/doc/starterkit/FccFastSimVertexing/plots_Bs2JsiPhi.x: -------------------------------------------------------------------------------- 1 | { 2 | 3 | TChain* events = new TChain("events","events"); 4 | events -> Add("Bs2JpsiPhi_MCseeded.root"); 5 | 6 | 7 | TString cut0 = "BsMCDecayVertex.position.z < 1e10" ; // a Bs -> mumuKK has been found in MCParticle 8 | 9 | // Number of tracks 10 | TCanvas* c0 = new TCanvas("Ntracks","Ntracks"); 11 | TH1F* hntr = new TH1F("hntr",";N( Bs tracks ); a.u.",5,-0.5,4.5); 12 | events->Draw("n_BsTracks >>hntr", cut0); 13 | gStyle->SetOptStat(10); // Entries only 14 | hntr->Draw(); 15 | gStyle->SetOptStat(10); 16 | TLatex tt; 17 | tt.SetTextSize(0.04); 18 | tt.DrawLatexNDC(0.2,0.96,"B_{s} #rightarrow J/#psi #phi #rightarrow #mu#muKK"); 19 | gPad -> SetLogy(1); 20 | 21 | // Chi2 of the vertex fit 22 | gStyle->SetOptStat(1110); 23 | TCanvas* c1 = new TCanvas("chi2","chi2"); 24 | TH1F* hchi2 = new TH1F("hchi2",";#chi^{2}/n.d.f.; a.u.",100,0.,10.); 25 | gStyle->SetOptStat(1110); 26 | events->Draw("BsVertex.chi2 >>hchi2",cut0+"&& BsVertex.chi2>0"); 27 | tt.DrawLatexNDC(0.2,0.96,"B_{s} #rightarrow J/#psi #phi #rightarrow #mu#muKK"); 28 | gPad -> SetLogy(1); 29 | //c1->SaveAs("plots/Bs2JPsiPhi_chi2.pdf"); 30 | 31 | 32 | TCanvas* c2 = new TCanvas("pulls","pulls"); 33 | c2 -> Divide(2,2); 34 | 35 | TString cut = cut0+" && BsVertex.chi2 < 10"; 36 | 37 | c2->cd(1); 38 | // Pulls of the vertex in x, y, z 39 | TH1F* px = new TH1F("px",";Pull x_{vtx}; a.u.",100,-5,5) ; 40 | events->Draw("(BsVertex.position.x-BsMCDecayVertex.x[0])/TMath::Sqrt(BsVertex.covMatrix[0])>>px",cut); 41 | px->Draw(); px->Fit("gaus"); 42 | 43 | c2->cd(2); 44 | TH1F* py = new TH1F("py",";Pull y_{vtx}; a.u.",100,-5,5); 45 | events->Draw("(BsVertex.position.y-BsMCDecayVertex.y[0])/TMath::Sqrt(BsVertex.covMatrix[2])>>py",cut); 46 | py->Draw();py->Fit("gaus"); 47 | 48 | c2->cd(3); 49 | TH1F* pz = new TH1F("pz",";Pull z_{vtx}; a.u.",100,-5,5); 50 | events->Draw("(BsVertex.position.z-BsMCDecayVertex.z[0])/TMath::Sqrt(BsVertex.covMatrix[5])>>pz",cut); 51 | pz->Draw(); pz->Fit("gaus"); 52 | tt.DrawLatexNDC(0.2,0.96,"B_{s} #rightarrow J/#psi #phi #rightarrow #mu#muKK"); 53 | 54 | 55 | // resolutions on the Bs decay vertex : 56 | TCanvas* c2r = new TCanvas("reso","reso"); 57 | c2r->Divide(2,2); 58 | c2r->cd(1); 59 | TH1F* hx = new TH1F("hx",";(vtx_{reco} - vtx_{gen}).x (#mum); Events",100,-40,40); 60 | events->Draw("1e3*(BsVertex.position.x-BsMCDecayVertex.x[0]) >>hx",cut); 61 | 62 | TF1* ff =new TF1("ff","gaus(0)+gaus(3)",-40,40); 63 | ff->SetParameter(1,-5e-2) ; 64 | ff->SetParameter(2,6); 65 | ff->SetParameter(3,500) ; 66 | ff->SetParameter(4,1e-2) ; 67 | ff->SetParameter(5,15) ; 68 | hx->Fit("ff","l") ; 69 | 70 | c2r->cd(2); 71 | TH1F* hy = new TH1F("hy",";(vtx_{reco} - vtx_{gen}).y (#mum); Events",100,-40,40); 72 | events->Draw("1e3*(BsVertex.position.y-BsMCDecayVertex.y[0]) >>hy",cut); 73 | hy->Fit("ff","l"); 74 | 75 | c2r->cd(3); 76 | TH1F* hz = new TH1F("hz",";(vtx_{reco} - vtx_{gen}).z (#mum); Events",100,-40,40); 77 | events->Draw("1e3*(BsVertex.position.z-BsMCDecayVertex.z[0]) >>hz",cut); 78 | hz->Fit("ff","l"); 79 | 80 | 81 | // ---------------------------------------------------------------------------- 82 | 83 | // resolution on flight distance : 84 | 85 | TCanvas* c3 = new TCanvas("fd","fd"); 86 | 87 | TString fld = "TMath::Sqrt( pow( 1e3*BsVertex.position.x, 2) + pow( 1e3*BsVertex.position.y,2) + pow( 1e3*BsVertex.position.z,2))"; 88 | TString fld_gen = "TMath::Sqrt( pow( 1e3*BsMCDecayVertex.x[0], 2) + pow( 1e3*BsMCDecayVertex.y[0],2) + pow( 1e3*BsMCDecayVertex.z[0],2) )"; 89 | TString fld_res = fld + " - " + fld_gen; 90 | 91 | TH1F* hfld = new TH1F("hfld","; flight distance (rec-true) (#mum); Events",100,-70,70); 92 | events->Draw(fld_res+ " >> hfld", cut); 93 | hfld->Fit("gaus"); 94 | tt.DrawLatexNDC(0.2,0.96,"B_{s} #rightarrow J/#psi #phi #rightarrow #mu#muKK"); 95 | 96 | 97 | TCanvas* c4 = new TCanvas("pull_fd","pull_fd"); 98 | 99 | // Pull of the flight distance : 100 | 101 | TString fld_mm = "TMath::Sqrt( pow( BsVertex.position.x, 2) + pow( BsVertex.position.y,2) + pow( BsVertex.position.z,2))"; 102 | TString fld_gen_mm = "TMath::Sqrt( pow( BsMCDecayVertex.x[0], 2) + pow( BsMCDecayVertex.y[0],2) + pow( BsMCDecayVertex.z[0],2) )"; 103 | TString fld_res_mm = fld_mm + " - " + fld_gen_mm; 104 | TString term1 = " BsVertex.position.x * ( BsVertex.covMatrix[0] * BsVertex.position.x + BsVertex.covMatrix[1] * BsVertex.position.y + BsVertex.covMatrix[3] * BsVertex.position.z ) " ; 105 | TString term2 = " BsVertex.position.y * ( BsVertex.covMatrix[1] * BsVertex.position.x + BsVertex.covMatrix[2] * BsVertex.position.y + BsVertex.covMatrix[4] * BsVertex.position.z ) " ; 106 | TString term3 = " BsVertex.position.z * ( BsVertex.covMatrix[3] * BsVertex.position.x + BsVertex.covMatrix[4] * BsVertex.position.y + BsVertex.covMatrix[5] * BsVertex.position.z ) "; 107 | TString tsum = term1 + " + " + term2 + " + " + term3; 108 | TString fld_unc = " ( TMath::Sqrt( " + tsum + ") / " + fld_mm +" ) "; 109 | TString fld_pull = "( " + fld_res_mm + " ) / " + fld_unc; 110 | TH1F* h_fld_pull = new TH1F("h_fld_pull","; Pull flight distance; a.u.",100,-5,5); 111 | events->Draw(fld_pull+" >> h_fld_pull" , cut); 112 | h_fld_pull->Fit("gaus"); 113 | 114 | 115 | 116 | } 117 | 118 | -------------------------------------------------------------------------------- /fast-sim-and-analysis/fccanalyses/doc/starterkit/FccFastSimVertexing/plots_primary_vertex.x: -------------------------------------------------------------------------------- 1 | { 2 | 3 | gROOT->Reset(); 4 | 5 | 6 | TFile* f = new TFile("primary_Zuds.root"); 7 | TTree* events = (TTree*)f->Get("events"); 8 | 9 | //TString vtx = "Vertex_primaryTracks"; // primary tracks selected based on MC-matching 10 | //TString vtx = "Vertex_primaryTracks_BSC"; // primary tracks selected based on MC-matching, fit with beam-spot constraint 11 | TString vtx = "PrimaryVertex"; // primary tracks selected from the reco algorithm, fit with beam spot constraint 12 | 13 | 14 | 15 | 16 | // plot the normalised chi2 / ndf : 17 | TH1F* hchi2 = new TH1F("hchi2",";chi2; Events",100,0,10); 18 | events->Draw("PrimaryVertex.chi2>>hchi2" ); 19 | 20 | 21 | TString cut = "PrimaryVertex.chi2 <10 "; 22 | 23 | // --------------------------------------------------------------------------- 24 | // 25 | // Vertex resolutions 26 | // The MC_PrimaryVertex and the reco'ed vertex in the ntuple are both in mm 27 | // 28 | // The resolutions are of a few microns. 29 | // --------------------------------------------------------------------------- 30 | 31 | 32 | TH1F* hx = new TH1F("hx",";(vtx_{reco} - vtx_{gen}).x (#mum); Events",100,-40,40); 33 | events -> Draw( "PrimaryVertex.position.x * 1e3 - MC_PrimaryVertex.x()*1e3>> hx", cut); 34 | hx -> Fit("gaus"); 35 | 36 | TH1F* hy = new TH1F("hy",";(vtx_{reco} - vtx_{gen}).y (#mum); Events",100,-40,40); 37 | events -> Draw( "PrimaryVertex.position.y * 1e3 - MC_PrimaryVertex.y()*1e3 >> hy", cut); 38 | hy -> Fit("gaus"); 39 | 40 | TH1F* hz = new TH1F("hz",";(vtx_{reco} - vtx_{gen}).z (#mum); Events",100,-40,40); 41 | events -> Draw( "PrimaryVertex.position.z * 1e3 - MC_PrimaryVertex.z()*1e3 >> hz", cut); 42 | hz -> Fit("gaus"); 43 | 44 | 45 | 46 | // --------------------------------------------------------------- 47 | // 48 | // Pulls of the reconstructed vertex 49 | // 50 | // --------------------------------------------------------------- 51 | 52 | // covMatrix[0] = cov(0,0) = variance of the x position 53 | // covMatrix[2] = cov(1,1) = variance of the y position 54 | // covMatrix[5] = cov(2,2) = variance of the z position 55 | 56 | TH1F* px = new TH1F("px","; Pull x_{vtx}; Events",100,-5,5); 57 | events -> Draw( " (PrimaryVertex.position.x - MC_PrimaryVertex.x()) / TMath::Sqrt( PrimaryVertex.covMatrix[0] ) >> px",cut); 58 | px->Fit("gaus"); 59 | 60 | TH1F* py = new TH1F("py","; Pull y_{vtx}; Events",100,-5,5); 61 | events -> Draw( "(PrimaryVertex.position.y - MC_PrimaryVertex.y()) / TMath::Sqrt( PrimaryVertex.covMatrix[2] ) >> py",cut); 62 | py->Fit("gaus"); 63 | 64 | TH1F* pz = new TH1F("pz","; Pull z_{vtx}; Events",100,-5,5); 65 | events -> Draw( "(PrimaryVertex.position.z - MC_PrimaryVertex.z()) / TMath::Sqrt( PrimaryVertex.covMatrix[5] ) >> pz",cut); 66 | pz->Fit("gaus"); 67 | 68 | 69 | 70 | // --------------------------------------------------------------- 71 | // 72 | // Plots : 73 | 74 | TCanvas* c1 = new TCanvas("c1","c1"); 75 | //gStyle->SetOptStat(0); 76 | c1 -> Divide(2,2); 77 | c1 ->cd(1); hchi2 -> Draw(); 78 | c1->cd(2); hx->Draw(); 79 | c1->cd(3); hy -> Draw(); 80 | c1->cd(4); hz->Draw(); 81 | 82 | TCanvas* c2 = new TCanvas("c2","c2"); 83 | gStyle->SetOptStat(1111); 84 | c2->Divide(2,2); 85 | c2->cd(1); px->Draw(); 86 | c2->cd(2); py->Draw(); 87 | c2->cd(3); pz->Draw(); 88 | 89 | 90 | 91 | } 92 | 93 | -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/FccFullAnalysis/ele1_pt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/FccFullAnalysis/ele1_pt.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/FccFullAnalysis/higgs_m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/FccFullAnalysis/higgs_m.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/FccFullAnalysis/higgs_m_cms.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/FccFullAnalysis/higgs_m_cms.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/FccFullAnalysis/lep1vsEta_eta.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/FccFullAnalysis/lep1vsEta_eta.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/FccFullAnalysis/lep1vsPt_pt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/FccFullAnalysis/lep1vsPt_pt.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/FccFullAnalysis/m4l_80_170_allYear_125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/FccFullAnalysis/m4l_80_170_allYear_125.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/FccSoftwareGettingStarted/flow_chart_starting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/FccSoftwareGettingStarted/flow_chart_starting.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/FccSoftwareGettingStartedFastSim/higgs_m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/FccSoftwareGettingStartedFastSim/higgs_m.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/FccSoftwareGettingStartedFastSim/mtw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/FccSoftwareGettingStartedFastSim/mtw.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/FccSoftwareGettingStartedFastSim/recoil_m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/FccSoftwareGettingStartedFastSim/recoil_m.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/FccSoftwareGettingStartedFastSim/xy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/FccSoftwareGettingStartedFastSim/xy.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/FccSoftwareGettingStartedFastSim/yz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/FccSoftwareGettingStartedFastSim/yz.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/FccSoftwareGettingStartedFastSim/zed_m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/FccSoftwareGettingStartedFastSim/zed_m.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/FccVirtualMachine/x-session.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/FccVirtualMachine/x-session.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/FcceeAnalysis/ZH_Zee/mrecoil_sel0_nostack_lin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/FcceeAnalysis/ZH_Zee/mrecoil_sel0_nostack_lin.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/FcceeAnalysis/ZH_Zee/mrecoil_sel1_nostack_lin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/FcceeAnalysis/ZH_Zee/mrecoil_sel1_nostack_lin.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/FcceeAnalysis/ZH_Zee/mrecoil_sel2_nostack_lin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/FcceeAnalysis/ZH_Zee/mrecoil_sel2_nostack_lin.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/FcceeAnalysis/ZH_Zee/mrecoil_sel3_nostack_lin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/FcceeAnalysis/ZH_Zee/mrecoil_sel3_nostack_lin.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/FcceeAnalysis/ZH_Zee/mrecoil_sel4_nostack_lin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/FcceeAnalysis/ZH_Zee/mrecoil_sel4_nostack_lin.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/FcceeAnalysis/ZH_Zee/mrecoil_sel5_nostack_lin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/FcceeAnalysis/ZH_Zee/mrecoil_sel5_nostack_lin.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/FcceeAnalysis/ZH_Zee/mrecoil_sel6_nostack_lin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/FcceeAnalysis/ZH_Zee/mrecoil_sel6_nostack_lin.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/FcceeAnalysis/ZH_Zee/mrecoil_sel7_nostack_lin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/FcceeAnalysis/ZH_Zee/mrecoil_sel7_nostack_lin.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/acolmu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/acolmu.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/browser_Muon0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/browser_Muon0.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/browser_events.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/browser_events.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/browser_events_part1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/browser_events_part1.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/browser_events_part2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/browser_events_part2.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/browser_missingET.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/browser_missingET.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/costheta_mup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/costheta_mup.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/images/p_mup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/fast-sim-and-analysis/images/p_mup.png -------------------------------------------------------------------------------- /fast-sim-and-analysis/k4simdelphes/doc/starterkit/FccFastSimDelphes/Readme.md: -------------------------------------------------------------------------------- 1 | # FCC: Getting started with simulating events in Delphes 2 | 3 | :::{admonition} Learning Objectives 4 | :class: objectives 5 | 6 | This tutorial will teach you how to: 7 | 8 | - **generate** signal and background samples with **Pythia8** with and without EvtGen 9 | - run a fast parametric **detector simulation** with **Delphes** in the EDM4Hep format 10 | - apply an **event selection** on those samples with **FCCAnalyses** 11 | - produce **flat ntuples** with observables of interest with **FCCAnalyses** 12 | - produce plots with **FCCAnalyses** 13 | ::: 14 | 15 | First login to a fresh shell on lxplus, on OSG, or in one of the virtual machines that could be provided on open stack. Usage of bash shell is highly recommended. Create a working directory and go inside 16 | 17 | ``` 18 | mkdir mytutorial 19 | cd mytutorial 20 | ``` 21 | 22 | Then, make sure your **setup of the FCC software** is working correctly. A quick check is that the executable `DelphesPythia8_EDM4HEP`, which allows you to run jobs in the EDM4Hep format is available on the command line: 23 | 24 | 25 | ```bash 26 | which DelphesPythia8_EDM4HEP 27 | ``` 28 | 29 | If the above command fails without printing a path like `/cvmfs/sw.hsf.org/spackages7/k4simdelphes/00-03-01/x86_64-centos7-gcc11.2.0-opt/7he4m/bin/DelphesPythia8_EDM4HEP`, you need to setup the FCC software stack 30 | 31 | ``` 32 | source /cvmfs/fcc.cern.ch/sw/latest/setup.sh 33 | ``` 34 | 35 | When sourcing the stack, you should see a message like: 36 | 37 | ``` 38 | ... Key4HEP release: key4hep-stack/2023-04-08 39 | ... Use the following command to reproduce the current environment: 40 | ... 41 | source /cvmfs/sw.hsf.org/spackages7/key4hep-stack/2023-04-08/x86_64-centos7-gcc11.2.0-opt/urwcv/setup.sh 42 | ... 43 | ... done. 44 | ``` 45 | 46 | which means that the version `2023-04-08` of `key4hep-stack` is sourced. 47 | 48 | 49 | (delphesedm4hep)= 50 | ## Generate and Simulate Events with DelphesEDM4Hep 51 | 52 | For this tutorial we will consider the following **physics processes**: 53 | 54 | - e+ e- -> ZH -> Z and H to anything 55 | - e+ e- -> ZZ -> Z to anything 56 | - e+ e- -> WW -> W to anything 57 | 58 | 59 | Let's start by downloading the official pythia cards for the various processes: 60 | 61 | ```bash 62 | wget https://raw.githubusercontent.com/HEP-FCC/FCC-config/winter2023/FCCee/Generator/Pythia8/p8_ee_ZH_ecm240.cmd 63 | wget https://raw.githubusercontent.com/HEP-FCC/FCC-config/winter2023/FCCee/Generator/Pythia8/p8_ee_ZZ_ecm240.cmd 64 | wget https://raw.githubusercontent.com/HEP-FCC/FCC-config/winter2023/FCCee/Generator/Pythia8/p8_ee_WW_ecm240.cmd 65 | ``` 66 | 67 | 68 | The detector response of the baseline FCC-ee IDEA detector configuration is estimated with Delphes. 69 | Other detector cards can be found in the `$DELPHES_DIR/cards` directory, such as a ATLAS, CMS or ILD detector configurations: 70 | `delphes_card_ATLAS.tcl`, `delphes_card_CMS.tcl` and `delphes_card_ILD.tcl`. 71 | 72 | But let's download the official one: 73 | 74 | ```bash 75 | wget https://raw.githubusercontent.com/HEP-FCC/FCC-config/winter2023/FCCee/Delphes/card_IDEA.tcl 76 | ``` 77 | 78 | To check the arguments ordering, please run the executable: 79 | 80 | ``` 81 | DelphesPythia8_EDM4HEP -h 82 | ``` 83 | 84 | it should produce the following message: 85 | 86 | ``` 87 | Usage: DelphesPythia8config_file output_config_file pythia_card output_file 88 | config_file - configuration file in Tcl format, 89 | output_config_file - configuration file steering the content of the edm4hep output in Tcl format, 90 | pythia_card - Pythia8 configuration file, 91 | output_file - output file in ROOT format. 92 | ``` 93 | 94 | where the first argument is the delphes card, the second argument the configuration file for the edm4hep output (see later), the third argument is the pythia card and the last argument is the output file name. 95 | 96 | Before running we need to define the collections that we want to write. The first name for example `GenParticleCollections` is the type of output collection in EDM4hep (in this case `GenParticleCollections` is of type `edm4hep::MCParticleCollection`) and the second argument for example `Particle` is the name of the collection in the Delphes card that will be used and stored in the EDM4Hep output file with the same name. 97 | 98 | 99 | We also download the official version of this file: 100 | 101 | ```bash 102 | wget https://raw.githubusercontent.com/HEP-FCC/FCC-config/winter2023/FCCee/Delphes/edm4hep_IDEA.tcl 103 | ``` 104 | 105 | The following commands will run Pythia8 and Delphes and produce the relevant signal and background samples: 106 | 107 | 108 | ```bash 109 | DelphesPythia8_EDM4HEP card_IDEA.tcl edm4hep_IDEA.tcl p8_ee_ZH_ecm240.cmd p8_ee_ZH_ecm240_edm4hep.root 110 | DelphesPythia8_EDM4HEP card_IDEA.tcl edm4hep_IDEA.tcl p8_ee_ZZ_ecm240.cmd p8_ee_ZZ_ecm240_edm4hep.root 111 | DelphesPythia8_EDM4HEP card_IDEA.tcl edm4hep_IDEA.tcl p8_ee_WW_ecm240.cmd p8_ee_WW_ecm240_edm4hep.root 112 | ``` 113 | -------------------------------------------------------------------------------- /full-detector-simulations/FCCeeCLD/FCCeeCLD.md: -------------------------------------------------------------------------------- 1 | 2 | # FCCee: Full Simulation of CLD, the CLID detector for FCC 3 | 4 | An adaptation of the CLIC detector for FCC-ee has been implemented and made available for tests at the times of the CDR 5 | (see, for example, [N. Bacchetta et al., CLD -- A Detector Concept for the FCC-ee](https://arxiv.org/abs/1911.12230)) 6 | The DD4hep description, initially implemented under [iLCSoft/lcgeo](https://github.com/iLCSoft/lcgeo/tree/master/FCCee/compact), is now 7 | availble under [FCCDetectors](https://github.com/HEP-FCC/FCCDetectors/tree/main/Detector/DetFCCeeCLD) which serves as reference. 8 | 9 | While it is possible to simulate the detector through `k4SimGeant4` for the Geant4-based full simulation and produce a `EDM4hep` output, 10 | to use the iLCSoft reconstruction tools it is still required to go through the `SLCIO` file format. 11 | The easiest way to do that is to use `DDSim` for the full simulation. 12 | In this chapter we illustrate how to run this workflow. 13 | 14 | ## Setting up the environment 15 | 16 | The solution described in this chapter is still in preview mode. Therefore we need the latest version of the software 17 | 18 | ``` 19 | source /cvmfs/sw-nightlies.hsf.org/key4hep/setup.sh 20 | ``` 21 | 22 | ## Generate some signal to process: taus from the particle gun 23 | 24 | To illustrate this workflow we use a simple but significat example: single taus generated with the particle gun. 25 | We generate this with `k4run` and we save the result in `stdHEP` format for later processing in `DDSim`. 26 | -------------------------------------------------------------------------------- /full-detector-simulations/FCCeeCaloPhotonPi0Discrimination/draw_rocCurve_pi0_gamma_GNN.py: -------------------------------------------------------------------------------- 1 | import os 2 | import ROOT 3 | import sys 4 | from rocCurveFacility import * 5 | 6 | ROOT.gROOT.SetBatch(ROOT.kTRUE) 7 | 8 | #Where your files are 9 | input_file_path = "" 10 | #name of your files 11 | pi0_file = os.path.join(input_file_path, "") 12 | photon_file = os.path.join(input_file_path, "") 13 | #output name 14 | output_string_suffix = "" 15 | 16 | # Retrive the MVA score data as TH1 and draw them 17 | pi0_rootfile = ROOT.TFile(pi0_file) 18 | pi0_events = pi0_rootfile.Get("events") 19 | pi0_th1 = ROOT.TH1F("pi0_score", "PI0 MVA score", 200, 0, 1) 20 | pi0_events.Draw("Cluster_isPhoton >> pi0_score") 21 | pi0_th1.SetLineColor(ROOT.kRed) 22 | 23 | photon_rootfile = ROOT.TFile(photon_file) 24 | photon_events = photon_rootfile.Get("events") 25 | photon_th1 = ROOT.TH1F("photon_score", "Photon MVA score", 200, 0, 1) 26 | photon_events.Draw("Cluster_isPhoton >> photon_score") 27 | 28 | score_canvas = ROOT.TCanvas("MVA score", "MVA score") 29 | score_canvas.SetLogy() 30 | pi0_th1.Draw() 31 | photon_th1.Draw("same") 32 | legend = ROOT.TLegend(0.47, 0.65, 0.8, 0.8) 33 | legend.SetBorderSize(0) 34 | legend.SetFillStyle(0) 35 | legend.AddEntry(pi0_th1, "#pi^{0}") 36 | legend.AddEntry(photon_th1, "#gamma") 37 | legend.Draw() 38 | score_canvas.Print("MVA_score" + output_string_suffix + ".png") 39 | 40 | # Draw ROC curve to asses the MVA performance 41 | pi0_efficiency_vs_cut = drawEffVsCutCurve(pi0_th1) 42 | photon_efficiency_vs_cut = drawEffVsCutCurve(photon_th1) 43 | roc = drawROCfromEffVsCutCurves(photon_efficiency_vs_cut, pi0_efficiency_vs_cut) 44 | drawTGraph([roc], "ROC" + output_string_suffix, "#pi^{0} Efficiency", "#gamma Efficiency")#, None, "Sample X%s %s"%(spin_sig, mass_sig), "", ["pdf", "png", "root"], outFileDir) 45 | -------------------------------------------------------------------------------- /full-detector-simulations/FCCeeDriftChamber/FCCeeDriftChamber.md: -------------------------------------------------------------------------------- 1 | 2 | # FCCee: Full Simulation of IDEA Driftchamber 3 | 4 | An updated implementation of the IDEA driftchamber for full simulations is under development. The old documentation (using FCCSW v0.16, pre-Key4hep ) can be found [here](https://github.com/HEP-FCC/fcc-tutorials/blob/v0.1.0/full-detector-simulations/FCCeeDriftChamber/FCCeeDriftChamber.md). 5 | 6 | -------------------------------------------------------------------------------- /full-detector-simulations/FCCeeGeneralOverview/plot_calo_energy_resolution.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import ROOT 3 | 4 | # prevent ROOT to display anything 5 | ROOT.gROOT.SetBatch(ROOT.kTRUE) 6 | 7 | f = ROOT.TFile(sys.argv[1]) 8 | events = f.Get("events") 9 | 10 | # raw clusters 11 | c = ROOT.TCanvas("c_clusterEnergyResolution", "") 12 | h = ROOT.TH1F("h_clusterEnergyResolution", ";ECal Barrel Cluster Energy [GeV]; Number of Clusters", 100, 5, 15) 13 | events.Draw("AugmentedEMBCaloClusters.energy >> h_clusterEnergyResolution") 14 | fit_range_min = h.GetXaxis().GetBinCenter(h.GetMaximumBin()) - 3 * h.GetRMS() 15 | fit_range_max = h.GetXaxis().GetBinCenter(h.GetMaximumBin()) + 3 * h.GetRMS() 16 | fit_result = h.Fit("gaus", "SQ", "", fit_range_min, fit_range_max) 17 | mean = str(round(fit_result.Get().Parameter(1), 2)) 18 | resolution = str(round(fit_result.Get().Parameter(2), 2)) 19 | legend = ROOT.TLegend(0.47, 0.65, 0.8, 0.8) 20 | legend.SetBorderSize(0) 21 | legend.SetFillStyle(0) 22 | legend.AddEntry(ROOT.nullptr, "#color[2]{#mu: %s GeV}"%mean, "") 23 | legend.AddEntry(ROOT.nullptr, "#color[2]{#sigma = %s GeV}"%resolution, "") 24 | legend.Draw() 25 | c.Print(sys.argv[1].replace(".root", "_clusterEnergyResolution.png")) 26 | 27 | # MVA calibrated clusters 28 | c = ROOT.TCanvas("c_calibratedClusterEnergyResolution", "") 29 | h = ROOT.TH1F("h_calibratedClusterEnergyResolution", ";ECal Barrel Calibrated Cluster Energy [GeV]; Number of Clusters", 100, 5, 15) 30 | events.Draw("CalibratedEMBCaloClusters.energy >> h_calibratedClusterEnergyResolution") 31 | fit_range_min = h.GetXaxis().GetBinCenter(h.GetMaximumBin()) - 3 * h.GetRMS() 32 | fit_range_max = h.GetXaxis().GetBinCenter(h.GetMaximumBin()) + 3 * h.GetRMS() 33 | fit_result = h.Fit("gaus", "SQ", "", fit_range_min, fit_range_max) 34 | mean = str(round(fit_result.Get().Parameter(1), 2)) 35 | resolution = str(round(fit_result.Get().Parameter(2), 2)) 36 | legend = ROOT.TLegend(0.47, 0.65, 0.8, 0.8) 37 | legend.SetBorderSize(0) 38 | legend.SetFillStyle(0) 39 | legend.AddEntry(ROOT.nullptr, "#color[2]{#mu: %s GeV}"%mean, "") 40 | legend.AddEntry(ROOT.nullptr, "#color[2]{#sigma = %s GeV}"%resolution, "") 41 | legend.Draw() 42 | c.Print(sys.argv[1].replace(".root", "_calibratedClusterEnergyResolution.png")) 43 | 44 | -------------------------------------------------------------------------------- /full-detector-simulations/FCCeeGeneralOverview/plot_recoil_mass.C: -------------------------------------------------------------------------------- 1 | #include "podio/ROOTFrameReader.h" 2 | #include "podio/Frame.h" 3 | 4 | #include "edm4hep/ReconstructedParticleCollection.h" 5 | 6 | int plot_recoil_mass(std::string input_file_path) { 7 | auto reader = podio::ROOTFrameReader(); 8 | reader.openFile(input_file_path); 9 | 10 | TH1* th1_recoil = new TH1F("Recoil Mass", "Recoil Mass", 100, 110., 160.); 11 | 12 | ROOT::Math::LorentzVector> p_cm(0., 0., 0., 240.); 13 | for (size_t i = 0; i < reader.getEntries("events"); ++i) { 14 | auto event = podio::Frame(reader.readNextEntry("events")); 15 | auto& pfos = event.get("TightSelectedPandoraPFOs"); 16 | int n_good_muons = 0; 17 | ROOT::Math::LorentzVector> p_mumu; 18 | for (const auto& pfo : pfos) { 19 | if (std::abs(pfo.getPDG()) == 13 and pfo.getEnergy() > 20.) { 20 | n_good_muons++; 21 | p_mumu += ROOT::Math::LorentzVector>(pfo.getMomentum().x, pfo.getMomentum().y, pfo.getMomentum().z, pfo.getEnergy()); 22 | } 23 | } 24 | if(n_good_muons == 2) 25 | th1_recoil->Fill((p_cm - p_mumu).M()); 26 | } 27 | TCanvas* canvas_recoil = new TCanvas("Recoil Mass", "Recoil Mass"); 28 | th1_recoil->Draw(); 29 | canvas_recoil->Print("recoil_mass.png"); 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /full-detector-simulations/FCCeeGeneralOverview/plot_recoil_mass.py: -------------------------------------------------------------------------------- 1 | import sys 2 | from podio import root_io 3 | import ROOT 4 | ROOT.gROOT.SetBatch(True) 5 | 6 | input_file_path = sys.argv[1] 7 | podio_reader = root_io.Reader(input_file_path) 8 | 9 | th1_recoil = ROOT.TH1F("Recoil Mass", "Recoil Mass", 100, 110., 160.) 10 | 11 | p_cm = ROOT.Math.LorentzVector('ROOT::Math::PxPyPzE4D')(0., 0., 0., 240.) 12 | for event in podio_reader.get("events"): 13 | pfos = event.get("TightSelectedPandoraPFOs") 14 | n_good_muons = 0 15 | p_mumu = ROOT.Math.LorentzVector('ROOT::Math::PxPyPzE4D')() 16 | for pfo in pfos: 17 | if abs(pfo.getPDG()) == 13 and pfo.getEnergy() > 20.: 18 | n_good_muons += 1 19 | p_mumu += ROOT.Math.LorentzVector('ROOT::Math::PxPyPzE4D')(pfo.getMomentum().x, pfo.getMomentum().y, pfo.getMomentum().z, pfo.getEnergy()) 20 | if n_good_muons == 2: 21 | th1_recoil.Fill((p_cm - p_mumu).M()) 22 | 23 | canvas_recoil = ROOT.TCanvas("Recoil Mass", "Recoil Mass") 24 | th1_recoil.Draw() 25 | canvas_recoil.Print("recoil_mass.png") 26 | 27 | 28 | -------------------------------------------------------------------------------- /full-detector-simulations/FCCeeGeneralOverview/recoil_mass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/full-detector-simulations/FCCeeGeneralOverview/recoil_mass.png -------------------------------------------------------------------------------- /full-detector-simulations/FCCeeGeneralOverview/run_IDEA_DIGI.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from Gaudi.Configuration import * 4 | 5 | # Loading the input SIM file 6 | from Configurables import k4DataSvc, PodioInput 7 | evtsvc = k4DataSvc('EventDataSvc') 8 | evtsvc.input = "electron_gun_10GeV_IDEA_SIM.root" 9 | inp = PodioInput('InputReader') 10 | 11 | ################## Simulation setup 12 | # Detector geometry 13 | from Configurables import GeoSvc 14 | geoservice = GeoSvc("GeoSvc") 15 | path_to_detector = os.environ.get("K4GEO", "") 16 | print(path_to_detector) 17 | detectors_to_use=[ 18 | 'FCCee/IDEA/compact/IDEA_o1_v02/IDEA_o1_v02.xml' 19 | ] 20 | # prefix all xmls with path_to_detector 21 | geoservice.detectors = [os.path.join(path_to_detector, _det) for _det in detectors_to_use] 22 | geoservice.OutputLevel = INFO 23 | 24 | # digitize vertex hits 25 | from Configurables import VTXdigitizer 26 | import math 27 | innerVertexResolution_x = 0.003 # [mm], assume 5 µm resolution for ARCADIA sensor 28 | innerVertexResolution_y = 0.003 # [mm], assume 5 µm resolution for ARCADIA sensor 29 | innerVertexResolution_t = 1000 # [ns] 30 | outerVertexResolution_x = 0.050/math.sqrt(12) # [mm], assume ATLASPix3 sensor with 50 µm pitch 31 | outerVertexResolution_y = 0.150/math.sqrt(12) # [mm], assume ATLASPix3 sensor with 150 µm pitch 32 | outerVertexResolution_t = 1000 # [ns] 33 | 34 | vtxib_digitizer = VTXdigitizer("VTXIBdigitizer", 35 | inputSimHits = "VTXIBCollection", 36 | outputDigiHits = "VTXIBDigis", 37 | detectorName = "Vertex", 38 | readoutName = "VTXIBCollection", 39 | xResolution = innerVertexResolution_x, # mm, r-phi direction 40 | yResolution = innerVertexResolution_y, # mm, z direction 41 | tResolution = innerVertexResolution_t, 42 | forceHitsOntoSurface = False, 43 | OutputLevel = INFO 44 | ) 45 | 46 | vtxob_digitizer = VTXdigitizer("VTXOBdigitizer", 47 | inputSimHits = "VTXOBCollection", 48 | outputDigiHits = "VTXOBDigis", 49 | detectorName = "Vertex", 50 | readoutName = "VTXOBCollection", 51 | xResolution = outerVertexResolution_x, # mm, r-phi direction 52 | yResolution = outerVertexResolution_y, # mm, z direction 53 | tResolution = outerVertexResolution_t, # ns 54 | forceHitsOntoSurface = False, 55 | OutputLevel = INFO 56 | ) 57 | 58 | vtxd_digitizer = VTXdigitizer("VTXDdigitizer", 59 | inputSimHits = "VTXDCollection", 60 | outputDigiHits = "VTXDDigis", 61 | detectorName = "Vertex", 62 | readoutName = "VTXDCollection", 63 | xResolution = outerVertexResolution_x, # mm, r direction 64 | yResolution = outerVertexResolution_y, # mm, phi direction 65 | tResolution = outerVertexResolution_t, # ns 66 | forceHitsOntoSurface = False, 67 | OutputLevel = INFO 68 | ) 69 | 70 | # digitize drift chamber hits 71 | from Configurables import DCHsimpleDigitizerExtendedEdm 72 | dch_digitizer = DCHsimpleDigitizerExtendedEdm("DCHsimpleDigitizerExtendedEdm", 73 | inputSimHits = "CDCHHits", 74 | outputDigiHits = "CDCHDigis", 75 | outputSimDigiAssociation = "DC_simDigiAssociation", 76 | readoutName = "CDCHHits", 77 | xyResolution = 0.1, # mm 78 | zResolution = 1, # mm 79 | debugMode = True, 80 | OutputLevel = INFO 81 | ) 82 | 83 | ################ Output 84 | from Configurables import PodioOutput 85 | out = PodioOutput("out", 86 | OutputLevel=INFO) 87 | out.outputCommands = ["keep *"] 88 | 89 | out.filename = "electron_gun_10GeV_IDEA_DIGI.root" 90 | 91 | #CPU information 92 | from Configurables import AuditorSvc, ChronoAuditor 93 | chra = ChronoAuditor() 94 | audsvc = AuditorSvc() 95 | audsvc.Auditors = [chra] 96 | out.AuditExecute = True 97 | 98 | from Configurables import EventCounter 99 | event_counter = EventCounter('event_counter') 100 | event_counter.Frequency = 1 101 | 102 | from Configurables import ApplicationMgr 103 | ApplicationMgr( 104 | TopAlg = [ 105 | inp, 106 | event_counter, 107 | vtxib_digitizer, 108 | vtxob_digitizer, 109 | vtxd_digitizer, 110 | dch_digitizer, 111 | out 112 | ], 113 | EvtSel = 'NONE', 114 | EvtMax = -1, 115 | ExtSvc = [geoservice, evtsvc, audsvc], 116 | StopOnSignal = True, 117 | ) 118 | -------------------------------------------------------------------------------- /full-detector-simulations/FCCeeGuineaPigIRBackgrounds/HitAnalysisMarlin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ######################################################## 2 | # cmake file for building Marlin example Package 3 | # @author Jan Engels, Desy IT 4 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR) 5 | ######################################################## 6 | 7 | 8 | # project name 9 | PROJECT( HitAnalysis ) 10 | 11 | 12 | # project version 13 | SET( ${PROJECT_NAME}_VERSION_MAJOR 0 ) 14 | SET( ${PROJECT_NAME}_VERSION_MINOR 1 ) 15 | SET( ${PROJECT_NAME}_VERSION_PATCH 0 ) 16 | 17 | 18 | 19 | ### DEPENDENCIES ############################################################ 20 | 21 | FIND_PACKAGE( ILCUTIL REQUIRED COMPONENTS ILCSOFT_CMAKE_MODULES ) 22 | 23 | # load default settings from ILCSOFT_CMAKE_MODULES 24 | INCLUDE( ilcsoft_default_settings ) 25 | 26 | 27 | FIND_PACKAGE( Marlin 1.0 REQUIRED ) # minimum required Marlin version 28 | INCLUDE_DIRECTORIES( SYSTEM ${Marlin_INCLUDE_DIRS} ) 29 | LINK_LIBRARIES( ${Marlin_LIBRARIES} ) 30 | ADD_DEFINITIONS( ${Marlin_DEFINITIONS} ) 31 | 32 | FIND_PACKAGE( MarlinUtil 1.0 REQUIRED ) # minimum required MarlinUtil version 33 | INCLUDE_DIRECTORIES( SYSTEM ${MarlinUtil_INCLUDE_DIRS} ) 34 | LINK_LIBRARIES( ${MarlinUtil_LIBRARIES} ) 35 | ADD_DEFINITIONS( ${MarlinUtil_DEFINITIONS} ) 36 | 37 | FIND_PACKAGE( ROOT REQUIRED ) 38 | INCLUDE_DIRECTORIES( SYSTEM ${ROOT_INCLUDE_DIRS} ) 39 | LINK_LIBRARIES( ${ROOT_LIBRARIES} ) 40 | ADD_DEFINITIONS( ${ROOT_DEFINITIONS} ) 41 | 42 | FIND_PACKAGE( RAIDA REQUIRED ) 43 | INCLUDE_DIRECTORIES( SYSTEM ${RAIDA_INCLUDE_DIRS} ) 44 | LINK_LIBRARIES( ${RAIDA_LIBRARIES} ) 45 | ADD_DEFINITIONS( ${RAIDA_DEFINITIONS} ) 46 | 47 | find_package( DD4hep REQUIRED COMPONENTS DDRec ) 48 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${DD4hep_ROOT}/cmake ) 49 | include( DD4hep ) 50 | 51 | if(DD4HEP_USE_XERCESC) 52 | find_package(XercesC) 53 | endif() 54 | include(DD4hep_XML_setup) 55 | INCLUDE_DIRECTORIES( SYSTEM ${DD4hep_INCLUDE_DIRS} ) 56 | LINK_LIBRARIES( ${DD4hep_LIBRARIES} ${DD4hep_COMPONENT_LIBRARIES} ) 57 | 58 | ### DOCUMENTATION ########################################################### 59 | 60 | OPTION( INSTALL_DOC "Set to OFF to skip build/install Documentation" OFF ) 61 | 62 | IF( INSTALL_DOC AND EXISTS "${PROJECT_SOURCE_DIR}/doc/CMakeLists.txt" ) 63 | ADD_SUBDIRECTORY( ./doc ) 64 | ENDIF() 65 | 66 | 67 | 68 | ### LIBRARY ################################################################# 69 | 70 | # definitions to pass to the compiler 71 | #ADD_DEFINITIONS( "-Wall -ansi -pedantic" ) 72 | #ADD_DEFINITIONS( "-Wno-long-long" ) 73 | 74 | # include directories 75 | INCLUDE_DIRECTORIES( ./include ) 76 | #INSTALL_DIRECTORY( ./include DESTINATION . FILES_MATCHING PATTERN "*.h" ) 77 | 78 | # add library 79 | AUX_SOURCE_DIRECTORY( ./src library_sources ) 80 | ADD_SHARED_LIBRARY( ${PROJECT_NAME} ${library_sources} ) 81 | INSTALL_SHARED_LIBRARY( ${PROJECT_NAME} DESTINATION lib ) 82 | 83 | # display some variables and write them to cache 84 | DISPLAY_STD_VARIABLES() 85 | -------------------------------------------------------------------------------- /full-detector-simulations/FCCeeGuineaPigIRBackgrounds/README.md: -------------------------------------------------------------------------------- 1 | # Using Guinea-Pig to generate interaction region backgrounds 2 | 3 | :::{admonition} Learning objectives 4 | :class: objectives 5 | 6 | * get to know tools to study FCCee interaction region backgrounds 7 | * know how to setup and use GuineaPig 8 | ::: 9 | 10 | 11 | Guinea-Pig is included in releases of the FCC software and is developed at this repository: 12 | 13 | 14 | 15 | Issues and Pull Requests can be submitted there. 16 | 17 | 18 | ## Generating $e^{+} e^{-}$ pairs with Guinea-Pig 19 | 20 | In order to run Guinea-Pig (hereafter GP) and generate e- e+ pair background, one should provide the relevant accelerator (beam) parameters, plus some steering parameters to run the software. Those parameters are set in the file acc.dat. 21 | Currently, one can find the four following accelerators, where the beam parameters correspond to the values considered for FCC CDR (2019). 22 | - FCCee Z working point (Ecm = 91.2 GeV): FCCee_Z 23 | - FCCee W working point (Ecm = 160 GeV): FCCee_W 24 | - FCCee ZH working point (Ecm = 240 GeV): FCCee_ZH 25 | - FCCee Top working point (Ecm = 365 GeV): FCCee_Top 26 | 27 | and the following 2 sets of configuration parameters: 28 | - FCCee_Z 29 | - FCCee_Top 30 | 31 | It is recommended to run the FCCee Z accelerator together with the FCCee_Z parameters, while the other 3 accelerators can be run with the FCCee_Top parameters. 32 | 33 | To run GP you should type the following: 34 | 35 | ```bash 36 | guinea $ACC #PAR output 37 | ``` 38 | 39 | e.g. 40 | 41 | ```bash 42 | guinea FCCee_Z FCCee_Z output 43 | ``` 44 | 45 | `output` it is the produced log file, and it can be given any name. Below we will try to explain the main GP configuration parameters. Each GP run corresponds to 1 bunch crossing. 46 | 47 | 48 | ## Generating large amounts of data with Guinea-Pig 49 | 50 | One can use the script at: 51 | 52 | 53 | 54 | that sends a user defined number of bunch crossings to be generated in parallel in Condor. You should modify accordingly the following parts of the script: 55 | 56 | ```bash 57 | nruns=100 58 | ``` 59 | 60 | defines the number of bunch crossings to be generated 61 | 62 | ```bash 63 | ROOTDIR=/afs/cern.ch/user/v/voutsina/Work/FCCeeBKG_WrapUp/eepairs 64 | ``` 65 | 66 | This variable defines the directory where the results will be stored. The script will generate there a new directory, data${i} for the ith generated bunch crossing. 67 | 68 | Command 69 | 70 | ```bash 71 | sed -i -e 's/rndm_seed=1/rndm_seed='${nn}'/g' acc.dat 72 | ``` 73 | 74 | Changes the random seed for the ith bunch crossing according to the pattern 75 | 76 | ```bash 77 | nn=${i}*100000 78 | ``` 79 | 80 | Feel free to modify the pattern, but have in mind that if you run N BXs with the same seed, you will generate N times the same data. 81 | 82 | In the following line 83 | 84 | ```bash 85 | /afs/cern.ch/user/v/voutsina/Work/testarea/CodeTest/GP++/guinea-pig.r3238/src/guinea FCCee_Top FCCee_Top output 86 | ``` 87 | 88 | you should replace the path where your guinea executable is located, the desired accelerator and configuration-parameters names and the desired output file name. 89 | 90 | The queueing in Condor is defined by the following line 91 | 92 | ```bash 93 | +JobFlavour = "tomorrow" 94 | ``` 95 | 96 | For the set of parameters FCCee_Z, featuring an estimating running time of few hours, a job flavour "workday" is recommended. For the set of parameters FCCee_Top, job flavour "longlunch" should be enough. 97 | 98 | ## Analysing the data (only for ILCSOFT users) 99 | 100 | Marlin processors can be used to analyse the simulated data. They were used for CDR results. 101 | In order to compile them: please initialise ILCSoft environment first. 102 | 103 | ```bash 104 | mkdir build; cd build 105 | cmake -C $ILCSOFT/ILCSoft.cmake .. 106 | make install 107 | ``` 108 | 109 | 110 | ## Tracking the pairs in the detector using Key4HEP 111 | 112 | The incoherent e+e- pairs produced by GP for a bunch crossing are stored in the file `pairs.dat`, which can be directly read as input for full simulation in Key4HEP using the `MDIReader` tool. 113 | This is used to boost the particles in the detector frame and shoot them in the detector using the particle gun. 114 | An example on how to call this in the Key4HEP steering file is the following: 115 | 116 | ``` 117 | ... 118 | 119 | from Configurables import MDIReader 120 | mdi_converter = MDIReader("Reader",MDIFilename="pairs.dat") 121 | mdi_converter.GenParticles.Path = "allGenParticles" 122 | mdi_converter.CrossingAngle = 0.015 #crossing angle [rad] 123 | mdi_converter.LongitudinalCut = 0 124 | mdi_converter.InputType = "guineapig" #flag to read GP files 125 | mdi_converter.BeamEnergy = 182.5 #beam energy [GeV] 126 | 127 | ... 128 | 129 | particle_converter = SimG4PrimariesFromEdmTool("EdmConverter") 130 | particle_converter.GenParticles.Path = "allGenParticles" 131 | 132 | ... 133 | 134 | geantsim = SimG4Alg("SimG4Alg", 135 | outputs = [ 136 | #your_list_of_outputs 137 | ], 138 | eventProvider=particle_converter) 139 | 140 | ... 141 | 142 | from Configurables import ApplicationMgr 143 | ApplicationMgr( TopAlg = [mdi_converter, geantsim, out], 144 | EvtSel = 'NONE', 145 | EvtMax = 1, 146 | ExtSvc = [podioevent, geoservice, geantservice], 147 | OutputLevel=INFO 148 | ) 149 | ``` 150 | 151 | 152 | ## GP production of $\gamma\gamma$ hadrons 153 | 154 | In order to produce $\gamma\gamma$ to hadrons with GP, we need to add the following commands inside the configuration file acc.dat 155 | 156 | ```bash 157 | hadron_ratio=100000; 158 | do_hadrons=3; 159 | store_hadrons=1; 160 | ``` 161 | 162 | while switching off pair production: 163 | 164 | ```shell 165 | do_pairs= 0; 166 | ``` 167 | 168 | `do_hadrons = 3;` will make GP to produce a hadron.dat file, which contains the produced partons, with the same cross-section parametrisation as Pythia does. "hadron_ratio=100000;" is the weight factor with which the cross section of the 169 | hadronic interaction is scaled. As a second step, we invoke Pythia to do the fragmentation. To do so, we use the "hades" library from Daniel Schulte, which allows to feed the GuineaPig's output to Pythia. Finally we translate the Pythia's output to .HEPEvt style events. To perform the last 2 steps, we can use the tar file at 170 | 171 | 172 | 173 | 174 | This file was made by Dominik Arominski, and contains the HADES library. Please unpack it and follow the instructions given in the README file. 175 | -------------------------------------------------------------------------------- /full-detector-simulations/FCCeeGuineaPigIRBackgrounds/SR/Scripts/SR_sim.py: -------------------------------------------------------------------------------- 1 | import math 2 | import random 3 | import os 4 | 5 | theFile = open("/afs/cern.ch/user/v/voutsina/Work/SR/data_gen/FCC_TTPLS_BND_18JUL_TA_M38_5MI_INC_TRKS_BOT.DAT") # all impinging photons to the mask 6 | #theFile = open("/afs/cern.ch/user/v/voutsina/Work/SR/data_gen/FCC_TTPLS_BND_18JUL_TA_M38_250MI_ALL_TRKS.DAT") # all scattered photons from 1 beam & 1 mask 7 | #theFile = open("/afs/cern.ch/user/v/voutsina/Work/SR/data_gen/FCC_TTPLS_BND_18JUL_TA_M38_1BI_TRKS.DAT") # forward scattered photons from 1 beam & 1 mask 8 | 9 | j = -1 10 | 11 | #MeV = 1e-3 # Mike's energies are in MeV, convert to GeV 12 | 13 | MeV = 1 # when we run ddsim via enableGun and the ddg4 commands, the energy is passed in MeV, not in GeV... 14 | cm = 10 # Mike's positions in cm, convert to mm 15 | 16 | ijob = 0 17 | Nev = 1 #10 BX 18 | #Nev = 12 #3.4872 # 5# Nb of events to run for each line in Mike's file #100 m bend 19 | #Nev = 169 # Nb of events to run for each line in Mike's file #42 m bend 20 | Nlines = 5000000 # Nb of lines to be processed per job 21 | 22 | k = 0 # counter that is reset when Nlines lines have been read 23 | 24 | NJOBMAX=-1 # set NJOBMAX=-1 for full prod, NJOBMAX = e.g. 3 or 4 for a test 25 | 26 | #NJOBMAX=2 27 | #HalfCrossingAngle = 15./1000. # 15 mrad 28 | #CosTheta = math.cos( HalfCrossingAngle ) 29 | #SinTheta = math.sin( HalfCrossingAngle ) 30 | 31 | def submit( steeringFile, subjobFile, ijob ) : 32 | steeringFile.close() 33 | outputFile.close() 34 | aa="echo exit >>"+steeringFile.name 35 | os.system(aa) 36 | execFile.write("#!/bin/sh" + "\n") 37 | execFile.write("source /cvmfs/clicdp.cern.ch/iLCSoft/builds/2019-04-17/x86_64-slc6-gcc7-opt/init_ilcsoft.sh" + "\n") 38 | execFile.write("DETFILE=/afs/cern.ch/work/v/voutsina/guineapig++/guinea-pig.r3238/data/PairsZ/BeamParTest/Pairs/Geometry/FCCee_o1_v04/FCCee_o1_v04.xml" + "\n") 39 | execFile.write("cp /afs/cern.ch/user/v/voutsina/Work/SR/Scripts/"+steeringFile.name +" ./. \n") 40 | #execFile.write("ddsim --compactFile $DETFILE --physics.rangecut 50e-3 --numberOfEvents 35 --outputFile=" +outputFile.name+ " --steeringFile=" + steeringFile.name+ "\n" ) 41 | execFile.write("ddsim --compactFile $DETFILE --outputFile=" +outputFile.name+ " --enableGun --physics.rangecut 50e-3 --runType shell < " + steeringFile.name + " > lo \n") 42 | #execFile.write("mv dummyOutput.slcio /afs/cern.ch/user/v/voutsina/Work/SR/Scripts/Results/ddsim_"+str(ijob)+".slcio" + "\n") 43 | execFile.write("mv " +outputFile.name+ " /afs/cern.ch/user/v/voutsina/Work/SR/Scripts/Results/Simulation/ALL_INCIDENT_PHOTONS" + "\n") 44 | execFile.close() 45 | 46 | subjobFile.write("executable = "+execFile.name +"\n") 47 | subjobFile.write("log = /afs/cern.ch/user/v/voutsina/Work/SR/Scripts/Output/logfile.log \n") 48 | subjobFile.write("output = /afs/cern.ch/user/v/voutsina/Work/SR/Scripts/Output/STDOUT \n") 49 | subjobFile.write("error = /afs/cern.ch/user/v/voutsina/Work/SR/Scripts/Output/STDERR \n") 50 | subjobFile.write("+JobFlavour =\"workday\" \n") 51 | subjobFile.write("queue 1\n") 52 | # subjobFile.write("cp /afs/cern.ch/user/a/akolano/private/SIMULATIONS/NEW_GEO_FIX/hits_sim.xml hits_sim.xml \n") 53 | # subjobFile.write("sed -e \"s@HACKRUNNUMBER@"+str(ijob)+"@g\" lctuple_simhits_digi_Oct27.xml > lctuple_simhits_digi.xml \n") 54 | # subjobFile.write("Marlin --global.LCIOInputFiles=dummyOutput.slcio hits_sim.xml > lo2 \n") 55 | # subjobFile.write("eos cp blah.root /eos/fcc/user/a/akolano/SynchRad/NEW_GEO_BX/lctuple_"+str(ijob)+".root \n") 56 | subjobFile.close() 57 | 58 | os.system("chmod 777 "+subjobFile.name ) 59 | os.system("chmod 777 "+execFile.name ) 60 | # os.system("bsub -q 1nd "+subjobFile.name ) 61 | # os.system("bsub -q 1nd "+subjobFile.name ) 62 | os.system("condor_submit " +subjobFile.name ) 63 | 64 | 65 | if __name__ == '__main__': 66 | 67 | 68 | for fl in theFile : 69 | 70 | if NJOBMAX>0 and ijob > NJOBMAX: 71 | break 72 | 73 | if j < 0 : # skip header line 74 | j=j+1 75 | continue 76 | 77 | if k == 0: 78 | ijob = ijob + 1 79 | 80 | outputFile = open("output_"+str(ijob)+".slcio","w") 81 | steeringFile = open("steering_"+str(ijob)+".py","w") 82 | steeringFile.write("/ddg4/Gun/Particle gamma \n") 83 | #steeringFile.write("SIM.gun.particle = \"gamma\" \n") 84 | print "created steering for ijob =",ijob 85 | 86 | execFile = open("exec_"+str(ijob)+".sh","w") 87 | subjobFile = open("sub_"+str(ijob),"w") 88 | #os.system(" cp subbase.tmp sub_"+str(ijob) ) 89 | 90 | #os.system("cat subbase.tmp > " +execFile.name ) 91 | subjobFile.close() 92 | subjobFile = open("sub_"+str(ijob),"a") 93 | 94 | 95 | j = j +1 96 | k = k + 1 97 | 98 | 99 | 100 | ############################ 101 | thesplit = fl.split() 102 | energy = float(thesplit[0]) 103 | energy = energy * MeV # I assume that the energy is in MeV in Mike's file 104 | 105 | cosalpha_p = float(thesplit[4] ) 106 | cosbeta = float( thesplit[5] ) 107 | cosgamma_p = float( thesplit[6] ) 108 | 109 | vx = float(thesplit[1] ) * cm 110 | #vx = -23.0 original Mikes, had different cord sys 111 | vy = float( thesplit[2]) * cm 112 | vz = float( thesplit[3] ) * cm 113 | ################################################ 114 | #px_prime = energy * cosalpha_p 115 | #pz_prime = energy * cosgamma_p 116 | 117 | #pz = CosTheta * pz_prime - SinTheta * px_prime 118 | #px = SinTheta * pz_prime + CosTheta * px_prime 119 | 120 | #cosalpha = px / energy 121 | #cosgamma = pz / energy 122 | 123 | p = str(energy) 124 | 125 | steeringFile.write("/ddg4/Gun/energy "+p + " \n") 126 | steeringFile.write("/ddg4/Gun/direction ("+str(cosalpha_p)+", "+str(cosbeta)+", "+str(cosgamma_p)+") \n" ) 127 | steeringFile.write("/ddg4/Gun/Position ("+str(vx)+", "+str(vy)+", "+str(vz)+") \n" ) 128 | steeringFile.write("/run/beamOn "+str(Nev) + "\n") 129 | 130 | 131 | if k ==Nlines: 132 | submit( steeringFile, subjobFile, ijob ) 133 | k = 0 134 | 135 | if k > 0 : # the last job was not submitted because less than NLines 136 | submit( steeringFile, subjobFile, ijob ) 137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /full-detector-simulations/FCCeeGuineaPigIRBackgrounds/eepairs/sub_gp_pairs.sh: -------------------------------------------------------------------------------- 1 | nruns=100 2 | 3 | let "j=1" 4 | 5 | for i in `seq ${j} ${nruns}` 6 | do 7 | 8 | ROOTDIR=/afs/cern.ch/user/v/voutsina/Work/FCCeeBKG_WrapUp/eepairs 9 | mkdir $ROOTDIR/data${i} 10 | cd $ROOTDIR/data${i} 11 | 12 | cd $ROOTDIR/data${i} 13 | #echo directory 14 | #echo $ROOTDIR 15 | nn=${i}*100000 16 | echo $nn 17 | 18 | cp $ROOTDIR/acc.dat . 19 | sed -i -e 's/rndm_seed=100000/rndm_seed='${nn}'/g' acc.dat 20 | 21 | cat > test_sub.sh << EOF1 22 | #!/bin/sh 23 | cp $ROOTDIR/data${i}/acc.dat . 24 | /afs/cern.ch/user/v/voutsina/Work/testarea/CodeTest/GP++/guinea-pig.r3238/src/guinea FCCee_Top FCCee_Top output 25 | mv pairs.dat $ROOTDIR/data${i} 26 | mv pairs0.dat $ROOTDIR/data${i} 27 | mv output $ROOTDIR/data${i} 28 | EOF1 29 | 30 | chmod u+x test_sub.sh 31 | 32 | cat > paok.sub << EOF1 33 | executable = test_sub.sh 34 | log =$ROOTDIR/data${i}/logfile.log 35 | output =$ROOTDIR/data${i}/STDOUT 36 | error =$ROOTDIR/data${i}/STDERR 37 | +JobFlavour = "tomorrow" 38 | queue 1 39 | EOF1 40 | 41 | chmod u+x paok.sub 42 | 43 | condor_submit paok.sub 44 | 45 | done -------------------------------------------------------------------------------- /full-detector-simulations/FCCeeGuineaPigIRBackgrounds/ggToHadrons/hadron.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/full-detector-simulations/FCCeeGuineaPigIRBackgrounds/ggToHadrons/hadron.tar.gz -------------------------------------------------------------------------------- /full-detector-simulations/FccCaloPerformance/display_detector.py: -------------------------------------------------------------------------------- 1 | import ROOT 2 | import dd4hep 3 | import os 4 | fcc_det_path = os.path.join(os.environ.get("FCCDETECTORS"), "Detector/DetFCCeeIDEA-LAr/compact/FCCee_DectMaster.xml") 5 | print(fcc_det_path) 6 | description = dd4hep.Detector.getInstance() 7 | description.fromXML(fcc_det_path) 8 | c = ROOT.TCanvas("c_detector_display", "", 600,600) 9 | description.manager().SetVisLevel(6) 10 | description.manager().SetVisOption(1) 11 | vol = description.manager().GetTopVolume() 12 | vol.Draw() 13 | wait = input("Press enter to quit the program") 14 | -------------------------------------------------------------------------------- /full-detector-simulations/FccCaloPerformance/plot_energy_resolution.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import ROOT 3 | 4 | # prevent ROOT to display anything 5 | ROOT.gROOT.SetBatch(ROOT.kTRUE) 6 | 7 | f = ROOT.TFile(sys.argv[1]) 8 | events = f.Get("events") 9 | 10 | c = ROOT.TCanvas("c_energyResolution", "") 11 | 12 | h = ROOT.TH1F("h_energyResolution", ";ECal Barrel Cluster Energy [GeV]; Number of Clusters", 50, 5, 15) 13 | events.Draw("CaloClusters.energy >> h_energyResolution") 14 | fit_range_min = h.GetXaxis().GetBinCenter(h.GetMaximumBin()) - 3 * h.GetRMS() 15 | fit_range_max = h.GetXaxis().GetBinCenter(h.GetMaximumBin()) + 3 * h.GetRMS() 16 | fit_result = h.Fit("gaus", "SQ", "", fit_range_min, fit_range_max) 17 | mean = str(round(fit_result.Get().Parameter(1), 2)) 18 | resolution = str(round(fit_result.Get().Parameter(2), 2)) 19 | legend = ROOT.TLegend(0.47, 0.65, 0.8, 0.8) 20 | legend.SetBorderSize(0) 21 | legend.SetFillStyle(0) 22 | legend.AddEntry(ROOT.nullptr, "#color[2]{#mu: %s GeV}"%mean, "") 23 | legend.AddEntry(ROOT.nullptr, "#color[2]{#sigma = %s GeV}"%resolution, "") 24 | legend.Draw() 25 | c.Print(sys.argv[1].replace(".root", "_energyResolution.png")) 26 | -------------------------------------------------------------------------------- /full-detector-simulations/README.md: -------------------------------------------------------------------------------- 1 | # Full Simulation 2 | 3 | 4 | If you have any problems or questions, you can 5 | [open an issue][fcc-tutorials-issues] on the 6 | [GitHub repository where these lessons are developed][fcc-tutorials-repo]. 7 | 8 | 9 | [fcc-tutorials-issues]: https://github.com/HEP-FCC/fcc-tutorials/issues 10 | [fcc-tutorials-repo]: https://github.com/HEP-FCC/fcc-tutorials 11 | 12 | ```{eval-rst} 13 | .. toctree:: 14 | :caption: Contents: 15 | 16 | FCCeeGeneralOverview/FCCeeGeneralOverview.md 17 | FCCeeGuineaPigIRBackgrounds/README.md 18 | Geometry/Geometry.md 19 | Visualization/Visualization.md 20 | 21 | ``` 22 | -------------------------------------------------------------------------------- /index.md: -------------------------------------------------------------------------------- 1 | README.md -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | Sphinx==7.3.7 2 | myst-parser==3.0.0 3 | sphinx-rtd-theme==2.0.0 4 | sphinx-togglebutton==0.3.2 5 | sphinx-copybutton==0.5.2 6 | sphinx-multiversion==0.2.4 7 | -------------------------------------------------------------------------------- /software-basics/README.md: -------------------------------------------------------------------------------- 1 | # First Steps 2 | 3 | This is the FCC Tutorials, a series of lessons for getting physicists working confidently with FCC data and software. 4 | The lessons are best approached one after the other, as most lessons build on the knowledge gained from the previous ones. 5 | 6 | If you have any problems or questions, you can [send an email to `FCC-PED-SoftwareAndComputing-Documentation@cern.ch`](mailto:FCC-PED-SoftwareAndComputing-Documentation@cern.ch). 7 | 8 | :::{admonition} Prerequisites 9 | :class: prereq 10 | 11 | Before starting, you should be familiar with using a shell, like `bash`, and with programming in Python. 12 | 13 | The [analysis essentials course](https://hsf-training.github.io/analysis-essentials/) has an introduction to these topics, as does the [Software Carpentry workshop](https://software-carpentry.org/lessons/), which includes many other useful computing tools. 14 | ::: 15 | 16 | ```{eval-rst} 17 | .. toctree:: 18 | :hidden: 19 | :caption: Contents: 20 | 21 | prerequisites.md 22 | swan.md 23 | introduction-to-course.md 24 | fccsw.md 25 | bookkeeping.md 26 | exploring-fcc-files.md 27 | tips-tricks.md 28 | asking-questions.md 29 | ``` 30 | -------------------------------------------------------------------------------- /software-basics/asking-questions.md: -------------------------------------------------------------------------------- 1 | # Asking good questions 2 | 3 | :::{admonition} Learning Objectives 4 | :class: objectives 5 | 6 | * Where to ask questions 7 | ::: 8 | 9 | 10 | Eventually you will get stuck when trying to do something. 11 | This lesson is about how to get help with getting unstuck. 12 | 13 | 14 | :::{admonition} Mailing lists 15 | :class: callout 16 | 17 | For FCC specific questions your best bet are the FCC mailing 18 | list : `FCC-PED-SoftwareAndComputing-Documentation@cern.ch` 19 | A recent alternative to the mailing lists is the [Mattermost chat](https://mattermost.web.cern.ch/fccsw) having dedicated channels, and the [discourse forum](https://fccsw-forum.web.cern.ch) 20 | 21 | For more general questions [Stack Overflow](https://stackoverflow.com/) and 22 | [Google](https://www.google.com) are good starting places. 23 | ::: 24 | 25 | 26 | :::{admonition} FCC glossary 27 | :class: callout 28 | 29 | A broad range of FCC-related terms, abbreviations and definitions can be found in the [FCC Glossary](https://hep-fcc.github.io/glossary/) linked from the main experiment page. 30 | Feel free to [contribute](https://github.com/HEP-FCC/glossary). 31 | ::: 32 | -------------------------------------------------------------------------------- /software-basics/bookkeeping.md: -------------------------------------------------------------------------------- 1 | # Finding data in the Bookkeeping 2 | 3 | Knowing how data flows through the various Gaudi applications is crucial for 4 | knowing where to look for your data. 5 | 6 | Data are catalogued in ‘the bookkeeping’, and are initially sorted in broad 7 | groups such as 'Delphes Events', ‘Full detector simulation’, and according to the FCC flavor (ee, hh or eh). 8 | After this, a tree of various application and processing versions will 9 | eventually lead to the data you need. 10 | 11 | :::{admonition} Learning Objectives 12 | :class: objectives 13 | 14 | * Find FCC data in the central storage 15 | * Store FCC data in the central storage 16 | ::: 17 | 18 | ## Obtaining access permissions 19 | 20 | In general, access to the EOS shared filesystem is obtained by subscribing to the relevant egroups [here](https://e-groups.cern.ch/e-groups/EgroupsSearchForm.do). 21 | For running the tutorials read access is sufficient, which is granted through subscription to the following e-group: 22 | ``` 23 | fcc-eos-access 24 | ``` 25 | which is open for self subscription requests. 26 | 27 | For analysis activities, the physics groups have dedicated areas under `/eos/experiment/fcc/ee/analyses_storage/` 28 | ``` 29 | /eos/experiment/fcc/ee/analyses_storage/BSM 30 | /eos/experiment/fcc/ee/analyses_storage/EW_and_QCD 31 | /eos/experiment/fcc/ee/analyses_storage/flavour 32 | /eos/experiment/fcc/ee/analyses_storage/Higgs_and_TOP 33 | ``` 34 | Write access to those areas is controlled by dedicated e-groups 35 | ``` 36 | fcc-eos-write-ee-analyses-bsm 37 | fcc-eos-write-ee-analyses-ew-qcd 38 | fcc-eos-write-ee-analyses-flavor 39 | fcc-eos-write-ee-analyses-higgs-top 40 | ``` 41 | managed by the conveners of those physics groups, which should be contacted for subscription. 42 | 43 | See the [here](https://hep-fcc.github.io/FCCSW/computing/) for more information about FCC computing resources. 44 | 45 | ## Finding Data 46 | 47 | Browse the fcc directory on `eos`, the shared filesystem used by CERN. 48 | 49 | ```bash 50 | tree /eos/experiment/fcc/ -L 2 51 | ``` 52 | 53 | You should see an output similar to: 54 | 55 | ``` 56 | /eos/experiment/fcc/ 57 | ├── ee 58 | │   ├── accelerator 59 | │   ├── analyses 60 | │   ├── datasets 61 | │   ├── generation 62 | │   ├── mdi 63 | │   ├── simulation 64 | │   ├── tutorial 65 | │   └── utils 66 | ├── eh 67 | │   └── datasets 68 | ├── helhc 69 | │   ├── analyses 70 | │   ├── generation 71 | │   ├── utils 72 | │   └── YR_summary 73 | ├── hh 74 | │   ├── analyses 75 | │   ├── CDR_script 76 | │   ├── generation 77 | │   ├── hcal 78 | │   ├── simulation 79 | │   ├── tests 80 | │   ├── testsamples 81 | │   ├── tutorials 82 | │   └── utils 83 | ``` 84 | 85 | The file paths on eos already give an indication where to find what kind of data. In some instances, the information is very detailed: 86 | 87 | ```bash 88 | 89 | ls /eos/experiment/fcc/ee/tutorial/ 90 | ``` 91 | 92 | But not all datasets follow this exact format. In case of questions simply contact the software team. 93 | 94 | On lxplus `eos` is mounted as a standard directory and you can use standard bash tools such as `ls`, `cp`, `mv` ... to manipulate the files - Also to write them provided you have the correct permissions. 95 | 96 | 97 | However, using eos like this is not recommended to transfer actual data (we speak from experience) and also not possible on machines where eos has not been mounted. The right tool here is `xrdcp`, which uses the xrootd protocol. It works like `cp` (minus some features) but all paths must be prefixed by the URL `root://eospublic.cern.ch/`. 98 | -------------------------------------------------------------------------------- /software-basics/exploring-fcc-files.md: -------------------------------------------------------------------------------- 1 | # Inspecting an FCC data file 2 | 3 | :::{admonition} Learning Objectives 4 | :class: objectives 5 | 6 | * Get to know FCC data files and the tools to inspect them 7 | ::: 8 | 9 | :::{admonition} Old data format 10 | :class: warning 11 | 12 | The following sections talk about the old dataformat `fcc-edm`. 13 | They are kept for historical reasons as there is large FCC-hh dataset already 14 | generated. 15 | 16 | To find out more about currently used data format: EDM4hep, click 17 | [here](structure-of-edm4hep-files). 18 | ::: 19 | 20 | 21 | ## The `events` tree 22 | 23 | FCC Data is generally stored in ROOT files. The layout of the file is determined by the "Event Data Model", which describes conceptually how the data is structured, and technically what branches are written in the final file. 24 | 25 | The implementation of the event data model uses simple structs in order to keep the resulting file simple - it already has a "flat tree" structure. 26 | The definition of the structs can be found in the [`fcc-edm` repository](https://github.com/HEP-FCC/fcc-edm/blob/master/edm.yaml). 27 | You will see that the FCC ROOT files contain a branch for every member of theses structs. So they can either be processed individually, or as a complete struct. The event data model also allows to store pointers to other objects - to use these it is best to use the provided [code](https://github.com/HEP-FCC/fcc-edm/blob/master/examples/simplewrite.cc) 28 | 29 | 30 | 31 | In configuring jobs with the FCC software framework, users can choose the Branch names in the produced file. Mostly, they will be one of the following: 32 | 33 | * `GenParticles`: Particles from either a generator like Pythia8 or a particle gun 34 | * `GenParticlesFiltered`: The same collection, but filtered according to some criteria (mostly used to select stable particles that are seen in the detector) 35 | * `SimTrackerHits`: Geant information on energy deposits in the tracker 36 | * `SimTrackerHitsPositions`: The same, but including the MC truth information on the exact coordinates of the deposits 37 | * `SimCaloHits`: Geant information on energy deposits in the calorimeter 38 | * `SimCaloHitsPositions`: The same, but including the MC truth information on the exact coordinates of the deposits 39 | * `SimParticles`: MC truth information about the particles in Geant simulations 40 | * `RecTrackStates`: Helix parameters as reconstructed by the software 41 | * `RecParticles` Full particle information after Reconstruction 42 | 43 | 44 | 45 | 46 | :::{admonition} Inspecting a [ROOT file](https://root.cern/manual/storing_root_objects/) 47 | :class: challenge 48 | 49 | Let's take a look at an example: `root://eospublic.cern.ch//eos/experiment/fcc/hh/tutorials/fccee_idea_pgun.root`. 50 | (For machines without eos access, this is mirrored at ) 51 | This file 52 | contains simulated data of a single particle passing through the detector and hits from the detector simulation. 53 | Open the file with ROOT and determine: 54 | 55 | * How many events does it contain? 56 | * What particle type is being simulated? 57 | * What is the energy of the primary particle? 58 | * How many hits were recorded (averaged over the run) in the Tracker? And in the calorimeter? What is the event with the maximum number of hits? 59 | ::: 60 | 61 | 62 | ## The `metadata` tree 63 | 64 | FCC data files contain another tree called `metadata`. 65 | As the name suggests, this information is mostly used to process the actual data in the `events` tree. 66 | However, files produced with newer (>0.11) versions of FCCSW 67 | will store the information of the job options file here, so that they can be reproduced (using the same versions of the software). FCCSW provides a script `fcc_dump_joboptions` that can easily access this information. 68 | 69 | ```bash 70 | k4-print-joboptions https://fccsw.web.cern.ch/fccsw/testsamples/tutorial/fccee_idea_pgun.root 71 | ``` 72 | 73 | 74 | ``` 75 | EventDataSvc.input = ""; 76 | 77 | GeoSvc.OutputLevel = 3; 78 | GeoSvc.detectors = ['/cvmfs/fcc.cern.ch/sw/releases/fccsw/0.12/x86_64-centos7-gcc8-opt/share/FCCSW/Detector/DetFCCeeIDEA/compact/FCCee_DectMaster.xml']; 79 | 80 | SimG4Alg.eventProvider = "SimG4SingleParticleGeneratorTool/GeantinoGun"; 81 | SimG4Alg.outputs = ['SimG4SaveParticleHistory/saveHistory', 'SimG4SaveTrackerHits/saveTrackerHits_Barrel', 'SimG4SaveTrackerHits/saveTrackerHits_Endcap', 'SimG4SaveTrackerHits/saveTrackerHits_DCH']; 82 | 83 | SimG4Alg.GeantinoGun.energyMax = "2400.0"; 84 | SimG4Alg.GeantinoGun.energyMin = "2400.0"; 85 | SimG4Alg.GeantinoGun.etaMax = "3.5"; 86 | SimG4Alg.GeantinoGun.etaMin = "-3.5"; 87 | SimG4Alg.GeantinoGun.particleName = "mu-"; 88 | SimG4Alg.GeantinoGun.phiMax = "360.0"; 89 | SimG4Alg.GeantinoGun.phiMin = "0.0"; 90 | SimG4Alg.GeantinoGun.saveEdm = False; 91 | SimG4Alg.GeantinoGun.vertexX = "0.0"; 92 | SimG4Alg.GeantinoGun.vertexY = "0.0"; 93 | SimG4Alg.GeantinoGun.vertexZ = "0.0"; 94 | ... 95 | ``` 96 | 97 | The output can be redirected to a new job options file that can be run with `fccrun`, provided that all the paths to the detector xmls etc. are still valid. 98 | 99 | Note that some older files on eos may not contain the metadata information. 100 | 101 | 102 | -------------------------------------------------------------------------------- /software-basics/fccsw.md: -------------------------------------------------------------------------------- 1 | 2 | # An introduction to FCC Software 3 | 4 | :::{admonition} Learning Objectives 5 | :class: objectives 6 | 7 | - Learn the key concepts needed to work with the FCC software 8 | - Learn how to launch the FCC software with `fccrun` 9 | ::: 10 | 11 | Imagine you want to design and run a new particle detector. 12 | Apart from organizing a collaboration, creating the design and specification, and several other tasks, you will also have to find solutions to many computational challenges. 13 | It's worth thinking about these for a second: 14 | 15 | - How do we collect data as it is recorded by the detector? 16 | - How do we filter and process the recorded data efficiently? 17 | - How do we manage all the complex tasks required to work with collision data? 18 | - How do we organize all the data of a single bunch crossing in a flexible way? 19 | - How do we configure our software flexibly without having to recompile it? 20 | - Can you think of more? 21 | 22 | How would you go about solving these? 23 | The decisions you make will affect the performance of your experiment during datataking and analysis. 24 | 25 | At FCC, we base our software on the [Gaudi](https://gaudi.web.cern.ch/gaudi/) framework, which was specifically designed with the above questions in mind. 26 | It's worth getting an idea of some of the most important Gaudi concepts at this point. 27 | After this, we will jump right into running the software and getting useful things done. 28 | 29 | **Event Loop:** 30 | Because the individual bunch crossings (events) are almost completely independent of each other, it makes sense to process them one by one, without holding them all in memory at once. 31 | Gaudi provides a global EventLoop, which allows you to process events one by one. 32 | 33 | **Transient Event Store:** 34 | A single event contains lots of different data objects (Particles, Vertices, Tracks, Hits). 35 | In Gaudi, these are organized in the Transient Event Store (TES). 36 | You can think of it as a per-event file system with locations like `/Event/Rec/Track/Best` or `/Event/Phys/MyParticles`. 37 | When running over the event stream, Gaudi allows you to get and put from/to these locations. 38 | The contents of the TES are emptied at the end of the processing of each event. 39 | 40 | **Algorithms:** 41 | An *Algorithm* is a C++ class that can be inserted into the EventLoop. 42 | These allow you to perform a certain function for each event (like filtering according to trigger decision, reconstructing particles). 43 | 44 | **Tools:** 45 | Often, algorithms will want to make use of some common function (vertex fitting, calculating distances, associating a primary vertex). 46 | These are implemented as *Tools*, which are shared between Algorithms. 47 | 48 | **Options:** 49 | To make all of this configurable, Gaudi allows you to set properties of *Algorithms* and *Tools* from a Python script, called an *option* file. 50 | In an option file, you can specify which Algorithms are run in which order, and set their properties (strings, integers, doubles, and lists and dicts of these things can be set). 51 | You can then start the Gaudi EventLoop using this option file, and it will set up and run the corresponding C++ objects with specified settings. 52 | 53 | You can find comprehensive documentation in the [Gaudi Doxygen](https://gaudi.web.cern.ch/gaudi/doxygen/v30r3/index.html) or the [Gaudi Manual](https://gaudi.web.cern.ch/gaudi/resources/GUG.pdf). 54 | 55 | Usually, you will work with one of the FCC software framework FCCSW that are based on Gaudi. 56 | One of the most important ones is *DaVinci*, which provides lots of *Algorithms* and *Tools* for physics analysis. 57 | 58 | 59 | 60 | You can run gaudi using the following command [on lxplus](prerequisites.md): 61 | 62 | 63 | 64 | ```bash 65 | source /cvmfs/fcc.cern.ch/sw/latest/setup.sh 66 | echo "from Configurables import ApplicationMgr" > option.py 67 | fccrun option.py 68 | ``` 69 | 70 | `ApplicationMgr` is a component that sets up the EventLoop. 71 | You should get the following output: 72 | 73 | ``` 74 | ==================================================================================================================================== 75 | Welcome to ApplicationMgr (GaudiCoreSvc v32r2) 76 | running on lxplus707.cern.ch on Thu Sep 19 14:17:08 2019 77 | ==================================================================================================================================== 78 | ApplicationMgr INFO Application Manager Configured successfully 79 | HistogramPersis...WARNING Histograms saving not required. 80 | ApplicationMgr INFO Application Manager Initialized successfully 81 | ApplicationMgr INFO Application Manager Started successfully 82 | EventSelector INFO End of event input reached. 83 | EventLoopMgr INFO No more events in event selection 84 | ApplicationMgr INFO Application Manager Stopped successfully 85 | EventLoopMgr INFO Histograms converted successfully according to request. 86 | ToolSvc INFO Removing all tools created by ToolSvc 87 | ApplicationMgr INFO Application Manager Finalized successfully 88 | ApplicationMgr INFO Application Manager Terminated successfully 89 | ``` 90 | 91 | During this run, FCCSW didn't do anything: We didn't specify any algorithms to run or any data to run over. 92 | 93 | An `option.py` is just a regular Python script that specifies how to set things up in the software. 94 | Many of the following lessons will teach you how to do something with FCCSW by showing you how to write or extend an `options.py`. 95 | You can use the above command to test it. 96 | You can also specify several option files like this: 97 | ``` 98 | fccrun options1.py options2.py 99 | ``` 100 | They will then both be used to set up FCCSW. 101 | 102 | Do you want to get an overview of which Components of FCCSW exist? Use 103 | ```bash 104 | fccrun --list 105 | ``` 106 | 107 | You can then look components up on [github](https://github.com/HEP-FCC/FCCSW) to find more information. 108 | However, it is advised to follow this tutorial, as many of the components are introduced here and used in example jobs. 109 | 110 | 111 | :::{admonition} `fccrun` and command line arguments 112 | :class: callout 113 | 114 | `fccrun` is a wrapper around a gaudi script called `gaudirun.py`. `fccrun` makes it easier to configure jobs on the command line. It is a dynamic script, i.e. it command line options depend on the options file and let you modify `options.py` without opening an editor. 115 | Take a look at the example job to run Pythia8: 116 | 117 | ```shell 118 | less $FCCSW/Examples/options/pythia.py 119 | ``` 120 | and compare it with the command line options for fccrun: 121 | ```shell 122 | fccrun $FCCSW/Examples/options/pythia.py -h 123 | ``` 124 | And note that you have to give an `options.py` as the first argument to `fccrun` in order for this to work: 125 | 126 | ```shell 127 | fccrun -h 128 | ``` 129 | ::: 130 | -------------------------------------------------------------------------------- /software-basics/introduction-to-course.md: -------------------------------------------------------------------------------- 1 | # Goals of the course 2 | 3 | :::{admonition} Learning Objectives 4 | :class: objectives 5 | 6 | * Understand what we'll be doing, and why we'll be doing it. 7 | ::: 8 | 9 | 10 | The FCC Tutorials are all about getting you the knowledge and tools you need to 11 | do your studies. 12 | 13 | We want this course to give you the confidence to be able to start by yourself, 14 | to understand what the code, you'll be writing, does and why you're writing it, 15 | and to teach others how to do the same. 16 | Each lesson follows on the previous one, but each can also serve as a standalone 17 | reference when you need to revisit a particular topic. 18 | 19 | We'll be looking at: 20 | 21 | * How data flows through the FCC processing chain, what software is involved, 22 | and how the data is stored; 23 | * How the data flow is different for simulated (Monte Carlo) events; 24 | * Where the data ends up, how it's indexed, and how you can find and access the 25 | data you need; 26 | * How to work with events in the EDM4hep data format and eventually convert it 27 | to ROOT ntuples; and 28 | * How to add more variables to the ntuples. 29 | 30 | We'll also cover how to efficiently run software locally and on the Batch System 31 | using HTCondor, as well as how to ask good questions when you're stuck and where 32 | to ask them. 33 | 34 | The lessons will start with a lot of explaining, but then we'll get in to the 35 | hands-on stuff. 36 | 37 | These lessons have been put together over the years by a lot of people who are 38 | passionate about good software practices and demystifying code. 39 | Over the course of 2015, the first version of these lessons have been written on 40 | [GitHub][github], a code sharing and collaboration website. You can find the 41 | source code of these lessons in the [HEP-FCC/fcc-tutorials][fcc-tutorials] 42 | repository, and __you__ can contribute! 43 | 44 | Please [submit an issue][fcc-tutorials-issues] if you spot a mistake or you 45 | think something isn't clear enough, or you can 46 | [make the changes yourself](contributing-lesson) and open a pull request. 47 | 48 | If you're not already familiar with git, you could check out the HSF 49 | [Analysis essentials][analysis-essentials] course. 50 | 51 | So, enough with the introduction, let's dive in! 52 | 53 | 54 | [github]: https://github.com/ 55 | [fcc-tutorials]: https://github.com/hep-fcc/fcc-tutorials/ 56 | [fcc-tutorials-issues]: https://github.com/hep-fcc/fcc-tutorials/issues/ 57 | [analysis-essentials]: https://hsf-training.github.io/analysis-essentials/ 58 | -------------------------------------------------------------------------------- /software-basics/swan.md: -------------------------------------------------------------------------------- 1 | # Running the software in SWAN notebooks 2 | 3 | 4 | :::{admonition} Learning Objectives 5 | :class: objectives 6 | 7 | * Learn how to run tutorials in SWAN notebooks 8 | ::: 9 | 10 | SWAN is a web service for running jupyter notebooks at CERN, and is a very convenient way of running tutorials if one has a CERN computing account. 11 | 12 | SWAN can be used only with a browser and is reached by visiting . 13 | 14 | After logging in, SWAN will ask you to configure your session. The default software stack (`102` at the moment can be kept, but to use the Key4hep, software the following environment script has to be used: 15 | ``` 16 | 17 | /cvmfs/sw.hsf.org/key4hep/setup.sh 18 | ``` 19 | 20 | ![](swan.png) 21 | 22 | Documentation on how to use notebooks is easy to find online (). Basically, the code cells behave like a muli-line python prompt (as in ipython) and can be executed with `Shift+Enter`. Variables are kept between cells, and the working directory is persistent too - notebooks are run in your eos user directory under `/eos/user/v/vavolkl/SWAN_projects/` (substitute `v` and `vavolkl` for your username initial and username). 23 | 24 | The default kernel is running python3, but you can run general bash commands as well, either by prefixing a command with an exclamation mark 25 | 26 | ``` 27 | !ls 28 | ``` 29 | or the bash cell magic (works for multiple files): 30 | 31 | ``` 32 | %%bash 33 | ls 34 | ``` 35 | 36 | Setting environment variables will be only effective for the current cell though. 37 | 38 | 39 | Plots can be drawn directly in the notebooks, see for example 40 | 41 | -------------------------------------------------------------------------------- /software-basics/swan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HEP-FCC/fcc-tutorials/165b7fadf2e7f549c9a0fefd34700a134b4aaeab/software-basics/swan.png -------------------------------------------------------------------------------- /software-basics/tips-tricks.md: -------------------------------------------------------------------------------- 1 | # Tips and tricks 2 | 3 | ## Autocompletion using bash history 4 | 5 | Add 6 | 7 | ``` 8 | bind '"\e[A": history-search-backward' 9 | bind '"\e[B": history-search-forward' 10 | ``` 11 | 12 | to the file `$HOME/.bashrc` to cycle through previously executed command with the up/down keys. 13 | --------------------------------------------------------------------------------