{"id":18372722,"url":"https://github.com/marinang/simprod","last_synced_at":"2025-04-06T19:32:10.638Z","repository":{"id":57467770,"uuid":"109375742","full_name":"marinang/SimProd","owner":"marinang","description":"Mini framework to send LHCb simulation jobs to lxplus or a slurm batch system!","archived":false,"fork":false,"pushed_at":"2020-10-08T08:29:24.000Z","size":5875,"stargazers_count":5,"open_issues_count":2,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-22T05:51:07.675Z","etag":null,"topics":["gauss","hep","lhcb","lhcb-experiment","lhcb-simulation","mc","monte-carlo","simulation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marinang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-03T09:14:32.000Z","updated_at":"2022-11-16T08:52:53.000Z","dependencies_parsed_at":"2022-09-19T08:20:26.836Z","dependency_job_id":null,"html_url":"https://github.com/marinang/SimProd","commit_stats":null,"previous_names":["marinang/simulationproduction"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marinang%2FSimProd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marinang%2FSimProd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marinang%2FSimProd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marinang%2FSimProd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marinang","download_url":"https://codeload.github.com/marinang/SimProd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247539208,"owners_count":20955268,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gauss","hep","lhcb","lhcb-experiment","lhcb-simulation","mc","monte-carlo","simulation"],"created_at":"2024-11-06T00:06:53.537Z","updated_at":"2025-04-06T19:32:09.065Z","avatar_url":"https://github.com/marinang.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![DOI](https://zenodo.org/badge/109375742.svg)](https://zenodo.org/badge/latestdoi/109375742)\n\n# SimProd\n\nMini framework to send LHCb simulation jobs on a batch system (HTCondor, Slurm)!\n\nA LHCb mattermost channel called `SimProd` is available for discussing any issues.\n\n**A new maintainer is needed for the near future.**\n\n## Installation\n\nTo install the module do\n\n```\npython setup.py install --user\n```\n\nYou will be asked to enter some directories where you want to find your simulated samples.\n\n### Dependencies:\n\n* [IPython](https://ipython.org)\n\n* [TinyDB](https://tinydb.readthedocs.io/en/latest/index.html)\n\n* [UltraJSON](https://github.com/esnme/ultrajson) (Optionnal, Recommended)\n\n* [setuptools](https://setuptools.readthedocs.io/en/latest/) (Optionnal, Recommended)\n\n## Usage\n\nTo launch the module just type `SimProd`.\n\n\u003cp align=\"center\"\u003e\n\u003cimg width=\"600\" height=\"200\"\nsrc=\"https://github.com/marinang/SimulationProduction/blob/master/etc/begin_interface.png\"\u003e\n\u003c/p\u003e\n\nYou need to to know:\n\n* the EvtType of the process you want to generate ([DecFiles webpage](http://lhcbdoc.web.cern.ch/lhcbdoc/decfiles/))\n\n* Year of data taking to simulate (Run I: 2011, 2012, Run II: 2015, 2016, 2017, 2018)\n\n* Number of events you want to produce.\n\nDescription of simulation setups can be found [here](https://github.com/marinang/SimulationProduction/tree/master/simprod/simjob/setup). To start a new simulation job do:\n\n```python\n\u003e\u003e\u003e j = SimulationJob(evttype=EVTTYPE, year=YEAR, nevents=NEVENTS)\n\u003e\u003e\u003e j.prepare()\n\u003e\u003e\u003e j.send()\n```\n\n\u003cp align=\"center\"\u003e\n\u003cimg width=\"750\" height=\"300\" src=\"https://github.com/marinang/SimulationProduction/blob/master/etc/submission.png\"\u003e\n\u003c/p\u003e\n\n\n### Options\n\nYour have other options by default that you can change:\n\n* `j.polarity`: Magnet conditions to simulate [MagUp or MagDown, default: half MagUp, half MagDown].\n\n* `j.neventsjob`: Number of events per jobs [default: 50].\n\n* `j.runnumber`: Run number for simulation in Gauss.\n\n* `j.simcond`: Simulation condition [Sim09b, Sim09c, Sim09e, Sim09g, Sim09h default: Sim09h].\n\n* `j.stripping`: Version of the stripping (default = '').\n\n* `j.turbo`: Run the Turbo step.\n\n* `j.mudst`: Produce a muDST output.\n\n* `j.decfiles`: Version of the DecFiles package (default = v30r46).\n\n* `j.infiles`: External files to provide for generation (for example LHE or HepMC files).\n\n* `j.cpu`: Number of CPU memory (in MB) per simulation job.\n\n* `j.keeplogs`: keeps the log files even if the jobs is marked as completed (default = True).\n\n* `j.keepxmls`: keeps the generator log xml files (default = True).\n\n* `j.redecay`: use redecay at generation (default = False).\n\n* `j.simmodel`: \"pythia8\" or \"BcVegPy\" (default = \"pythia8\").\n\nThese argument are also available at instantiation of a SimulationJob but also as property, i.e:\n\n```python\n\u003e\u003e\u003e j = SimulationJob(evttype=EVTTYPE, year=YEAR, nevents=NEVENTS, neventsjob=NEVENTSJOB)\n```\n\nis equivalent to\n\n```python\n\u003e\u003e\u003e j = SimulationJob(evttype=EVTTYPE, year=YEAR, nevents=NEVENTS)\n\u003e\u003e\u003e j.neventsjob = NEVENTSJOB\n```\n\nyou can also modify options for the scheduler you are using through\n```\n\u003e\u003e\u003e j.deliveryclerk\n```\n\n#### HTCondor options\n\nOptions for htcondor batch system:\n\n* `j.deliveryclerk.jobflavour`: flavour of a job correspoinding to a maximum runtime (default = \"workday\").\n\nThe available job flavours are as follows:\n\n```\n    espresso     = 20 minutes\n    microcentury = 1 hour\n    longlunch    = 2 hours\n    workday      = 8 hours\n    tomorrow     = 1 day\n    testmatch    = 3 days\n    nextweek     = 1 week\n```\n\n#### Slurm options\n\nOptions for slurm batch system with default values designed for EPFL usage:\n\n* `j.deliveryclerk.time`: Maximum running time per simulation job in hours.\n\n* `j.deliveryclerk.nsimjobs`: Maximum number of simultaneous simulation jobs running.\n\n* `j.deliveryclerk.nsimuserjobs`: Maximum number of simultaneous simulation jobs running for the user.\n\n* `j.deliveryclerk.nuserjobs`: Maximum number of simultaneous jobs running for the user.\n\n* `j.deliveryclerk.npendingjobs`: Maximum number of pending jobs for the user.\n\n* `j.deliveryclerk.nfreenodes`: Number of nodes to be free of user's simulation jobs.\n\n* `j.deliveryclerk.subtime`: Time interval when the jobs are sent (e.g. 16 18 means from 4pm to 6pm).\n\nIf using the EPFL cluster, please avoid using these options, a configuration file is read with agreed values for these options.\n\n[PySlurm](https://github.com/PySlurm/pyslurm/wiki/Installing-PySlurm) can be installed for faster monitoring of the jobs.\n\n\n## Monitoring\n\nJust after the lauching the program type `jobs` and you can see the status of submitted jobs:\n\n\u003cp align=\"center\"\u003e\n\u003cimg width=\"540\" height=\"500\" src=\"https://github.com/marinang/SimulationProduction/blob/master/etc/monitor.png\"\u003e\n\u003c/p\u003e\n\n### Resend failed subjobs\n\nUse the SimulationJob method **send**:\n```python\n\u003e\u003e\u003e jobs[JOBNUMBER].send()\n```\nThis will send only unsubmitted and failed jobs.\n\n### Kill a subjob\n\n```python\n\u003e\u003e\u003e jobs[JOBNUMBER][SUBJOBNUMBER].kill()\n```\n\n### Remove jobs from the collection\n\nIf you wish to remove a job from the `jobs` container do\n\n```python\n\u003e\u003e\u003e jobs[JOBNUMBER].remove()\n```\nand the simulation job will not be seen anymore when typing `jobs`. Note that if subjobs are still running they will be killed.\n\nIf you wish to remove only completed jobs do\n\n```python\n\u003e\u003e\u003e for j in jobs.select(\"completed\"):\n\u003e\u003e\u003e     j.remove()\n```\nThe log files are also with removed with the job.\n\n## Evttypes\n\nFor generation Gauss needs an option file callled EVTTYPE.py which is stored in a folder called **Evttypes**. In you need to modify your option file prior to submission you can type in the `SimProd` prompt\n\n```python\n\u003e\u003e\u003e getevttype(EVTTYPE)\n```\n\nand all option files related to this EVTTYPE should be downloaded into the **Evttypes** directory.\n\n## Where are the simulated samples stored?\nOne the jobs are marked as successfully completed you should find the simulated `dst` files in the production directory printed when you start `SimProd`.\nYou can also retrieve the production directory by typing in the prompt\n\n```python\n\u003e\u003e\u003e simoutput\n'/eos/lhcb/user/m/mmarinan/SimulationJobs'\n```\n\nThe `dst` are then stored in `EVTTYPE/YEAR/SIMCOND/POLARITY`, see for instance the following example of the tree of the directories in the production directory:\n```markdown\n- SimulationJobs\n    - EVTTYPE_1\n        - 2016\n            - Sim09h\n                - MagUp\n                    - xml\n                        - 1234567.xml\n                        - ...\n                        - 1891234.dst\n                    - 50evts_s28r2_1234567.dst\n                    - ...\n                    - 50evts_s28r2_1891234.dst\n                - MagDown\n                    - xml\n                        - 2345671.xml\n                        - ...\n                        - 8912342.dst\n                    - 50evts_s28r2_2345671.dst\n                    - ...\n                    - 50evts_s28r2_8912342.dst\n\n    - EVTTYPE_2\n        - 2018\n            - Sim09g\n                - MagUp\n                    - xml\n                    - 50evts_s34_3456712.dst\n                    - ...\n                    - 50evts_s34_9123418.dst\n                - MagDown\n                    - xml\n                    - 50evts_s34_5345671.dst\n                    - ...\n                    - 50evts_s34_6912342.dst\n```\n\nThe `dst` files are named `NEVENTSJOBevts_STRIPPING_RUNNUMBER.(m)dst`. In the `xml` directory are stored the `RUNNUMBER.xml` files which contain informations of event generation such as the generator level efficiency. The generator level informations of your jobs are stored only if `j.keepxmls == True`.\n\nTo analyse your simulated samples you can create ROOT ntuples using the `dst` files. The [LHCb starterkit](https://lhcb.github.io/starterkit-lessons/first-analysis-steps/minimal-dv-job.html) explains how to do a local `DaVinci` job with local `dst` files.\n\n\n## Contributing\n\nFeel free to contribute by the mean of Pull Requests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarinang%2Fsimprod","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarinang%2Fsimprod","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarinang%2Fsimprod/lists"}