# O2 simulation: how to start?

**URL:** <https://alice-talk.web.cern.ch/t/o2-simulation-how-to-start/76>\
**Category:** O²\
**Created:** [May 29, 2018, 6:37am UTC](https://alice-talk.web.cern.ch/t/o2-simulation-how-to-start/76 "2018-05-29T06:37:30Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ken](https://alice-talk.web.cern.ch/user_avatar/alice-talk.web.cern.ch/ken/32/33_2.png) [@Ken](https://alice-talk.web.cern.ch/u/Ken)\
**Post date:** [May 29, 2018, 6:37am UTC](https://alice-talk.web.cern.ch/t/o2-simulation-how-to-start/76/1 "2018-05-29T06:37:30Z")

</div>

Could anyone guide me to some tutorial or beginner’s guide for how to do O2 simulation?  
I succeeded to build (aliBuild) and “alienv enter O2/latest” is fine.  
From this point I don’t know what to do. The tutorial [https://alice-doc.github.io/alice-analysis-tutorial/analysis/running.html](https://alice-doc.github.io/alice-analysis-tutorial/analysis/running.html) is for AliPhysics and aliRoot, not O2.

What I need to do is the following:

1: Run O2 simulation (Geant4 is fine) with ALICE detector and electronics structure  
2: Develop/modify TPC digit (data stream) generation part, especially  
2a: Logic such as digital filters in the CRU TPC userlogic (VHDL) has to be implemented as C++ code in O2  
2b: Evaluate performance of different kind of filters with simulated SAMPA data

Any suggestion, pointer are welcome!

Ken

---

<div class="post-metadata">

**Author:** ![dberzano](https://alice-talk.web.cern.ch/user_avatar/alice-talk.web.cern.ch/dberzano/32/7_2.png) [@dberzano](https://alice-talk.web.cern.ch/u/dberzano)\
**Post date:** [June 6, 2018, 1:02pm UTC](https://alice-talk.web.cern.ch/t/o2-simulation-how-to-start/76/2 "2018-06-06T13:02:41Z")

</div>

I am pinging our simulation expert @swenzel here 🙂

---

<div class="post-metadata">

**Author:** ![swenzel](https://alice-talk.web.cern.ch/letter_avatar_proxy/v4/letter/s/839c29/32.png) [@swenzel](https://alice-talk.web.cern.ch/u/swenzel)\
**Post date:** [June 7, 2018, 7:58am UTC](https://alice-talk.web.cern.ch/t/o2-simulation-how-to-start/76/3 "2018-06-07T07:58:31Z")

</div>

To run a simulation using the TPC detector with 10 pythia events you simply say

```auto
o2sim -m TPC [ITS PIPE] -n 10 -g pythia -e TGeant4

```

The hits will be accessible in the `o2sim.root` file.

Concerning question on digits, eletronic structures, etc. I suggest you contact the TPC team in charge  
(@wichula, @a-mathis … but I am not sure if everyone is reachable in alice-talk yet??)

---

<div class="post-metadata">

**Author:** ![amathis](https://alice-talk.web.cern.ch/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@amathis](https://alice-talk.web.cern.ch/u/amathis)\
**Post date:** [June 7, 2018, 11:50am UTC](https://alice-talk.web.cern.ch/t/o2-simulation-how-to-start/76/4 "2018-06-07T11:50:32Z")

</div>

To digitise the hits produced above just run

> ` digitizer-workflow -b --tpc-lanes=2 --simFileS o2sim.root -n 10`

which gives you an output file with branches with digits (sorted by time bin and pad) per sector

---

<div class="post-metadata">

**Author:** ![amathis](https://alice-talk.web.cern.ch/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@amathis](https://alice-talk.web.cern.ch/u/amathis)\
**Post date:** [June 7, 2018, 11:55am UTC](https://alice-talk.web.cern.ch/t/o2-simulation-how-to-start/76/5 "2018-06-07T11:55:00Z")

</div>

I think there’s a typo, the generator for o2sim should be

> `o2sim ... -g pythia8`

At least for me `pythia` does not work

---

<div class="post-metadata">

**Author:** ![Ken](https://alice-talk.web.cern.ch/user_avatar/alice-talk.web.cern.ch/ken/32/33_2.png) [@Ken](https://alice-talk.web.cern.ch/u/Ken)\
**Post date:** [June 19, 2018, 4:47am UTC](https://alice-talk.web.cern.ch/t/o2-simulation-how-to-start/76/6 "2018-06-19T04:47:37Z")

</div>

Thanks for your help!

o2sim ran without problem. For 10 Pythia events it took 1-2 minutes.

digitizer-workflow doesn’t really work. It fist didn’t accept option  
–tpc-lanes=2 however without that option it launches.  
Then it stops forever after showing  
[6063]: [06:33:32][STATE] Entering INITIALIZING DEVICE state  
. There are many processes that appears on ‘top’ command like  
digitizer-workflow --id TPCDigitizer6 – …  
And memory (32GB) is used up and CPU is 100% busy for hours.

I simulated 10 events. It is hard to imagine what uses that large memory  
and CPU power for digitization.

---

<div class="post-metadata">

**Author:** ![amathis](https://alice-talk.web.cern.ch/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@amathis](https://alice-talk.web.cern.ch/u/amathis)\
**Post date:** [June 19, 2018, 12:33pm UTC](https://alice-talk.web.cern.ch/t/o2-simulation-how-to-start/76/7 "2018-06-19T12:33:56Z")

</div>

For me the commands work flawless, when did you update your o2 installation the last time?  
Some of the features are rather freshly implemented by Sandro, hence I suggest to update your alidist and o2

---

<div class="post-metadata">

**Author:** ![swenzel](https://alice-talk.web.cern.ch/letter_avatar_proxy/v4/letter/s/839c29/32.png) [@swenzel](https://alice-talk.web.cern.ch/u/swenzel)\
**Post date:** [June 19, 2018, 2:02pm UTC](https://alice-talk.web.cern.ch/t/o2-simulation-how-to-start/76/8 "2018-06-19T14:02:01Z")

</div>

`--tpc-lanes=2` should work (note that there are are **two** dashes in front of tpc). With this you should not run into memory problems. Also please make sure to use the latest version of alidist and the code.

---

<div class="post-metadata">

**Author:** ![Ken](https://alice-talk.web.cern.ch/user_avatar/alice-talk.web.cern.ch/ken/32/33_2.png) [@Ken](https://alice-talk.web.cern.ch/u/Ken)\
**Post date:** [June 20, 2018, 1:56am UTC](https://alice-talk.web.cern.ch/t/o2-simulation-how-to-start/76/9 "2018-06-20T01:56:34Z")

</div>

Hi,

> digitizer-workflow -b --tpc-lanes=2 --simFileS o2sim.root -n 10  
> Error: unrecognised option ‘–tpc-lanes=2’

I’m using O2/latest but my last update was 3-4 weeks before. I will try again with fresh one  
then report.

---

<div class="post-metadata">

**Author:** ![bvonhall](https://alice-talk.web.cern.ch/user_avatar/alice-talk.web.cern.ch/bvonhall/32/8_2.png) [@bvonhall](https://alice-talk.web.cern.ch/u/bvonhall)\
**Post date:** [August 13, 2019, 2:15pm UTC](https://alice-talk.web.cern.ch/t/o2-simulation-how-to-start/76/10 "2019-08-13T14:15:25Z")

</div>

A post was split to a new topic: [Difference between o2-sim and o2-sim-serial](https://alice-talk.web.cern.ch/t/difference-between-o2-sim-and-o2-sim-serial/319)
