Skip to content

Add interface for sim parameters to JSON#8017

Merged
sawenzel merged 7 commits intoAliceO2Group:devfrom
benedikt-voelkel:transport-cuts
Mar 3, 2022
Merged

Add interface for sim parameters to JSON#8017
sawenzel merged 7 commits intoAliceO2Group:devfrom
benedikt-voelkel:transport-cuts

Conversation

@benedikt-voelkel
Copy link
Copy Markdown
Contributor

  • first step to give cut and process setting from the outside more
    structure

  • introduce JSON parsing into MaterialManager for that matter

  • leave previous interface for now where cuts and processes are set from
    bare text files

  • introduce configurable params

    • MaterialManagerParam.paramFile to pass and overwrite parameters
      from command line
    • MaterialManagerParam.outputFile to write parameters used in sim to
      JSON for further usage and inspection
  • introduced policy:
    parameters set later will overwrite previous settings

@benedikt-voelkel
Copy link
Copy Markdown
Contributor Author

benedikt-voelkel commented Jan 27, 2022

usage to overwrite from cmd

o2-sim <args> --configKeyValues "MaterialManagerParam.inputFile=<path/to/file.json>"

to write to med_params.json

o2-sim <args> --configKeyValues "MaterialManagerParam.outputFile=med_params.json"

Of course, both configKeyValues can be passed simultaneously.

The output in med_params.json looks like

{
  "module_1": [
    {
      "local_id": 1,
      "global_id": 5,
      "medium_name": "med_1_1",
      "material_name": "mat_1_1",
      "cuts": {
        "CUTGAM": 0.1,
        "CUTELE": 0.1,
        "CUTNEU": 0.1,
        "CUTHAD": 0.1,
        "CUTMUO": 0.1,
        "BCUTE": 0.1,
        "BCUTM": 0.1,
        "...": 0.1},
      "processes": {
        "PAIR": 0,
        "COMP": 1,
        "PHOT": -1,
        "PFIS": 1,
        "DRAY": 0,
        "ANNI": 0,
        "BREM": 1,
        "...": -1}
    },
    {
      "local_id": 2,
      "global_id": 3,
      "medium_name": "med_1_2",
      "material_name": "mat_1_2",
      "cuts": {"...": "..."},
      "processes": {"...": "..."}
    }
  ],
  "module_N": [
    {
      "local_id": 10,
      "global_id": 50,
      "medium_name": "med_N_10",
      "material_name": "mat_N_10",
      "cuts": {"...": "..."},
      "processes": {"...": "..."}
    },
    {
      "local_id": 20,
      "global_id": 30,
      "medium_name": "med_N_20",
      "material_name": "mat_N_20",
      "cuts": {"...": "..."},
      "processes": {"...": "..."}
    }
  ],
  "default":
    {
      "cuts": {"...": "..."},
      "processes": {"...": "..."}
    }
    "enableSpecialCuts": true,
    "enableSpecialProcesses": false
}

This can be edited/extended and used again as input as well. The global_id is the ID assigned by ROOT's TGeo and it is indeed useful to have that available when internal information of module-local medium IDs is not available.

In addition, the latter is extremely useful to be used in parameter optimisation together with the MCReplay engine

@benedikt-voelkel benedikt-voelkel force-pushed the transport-cuts branch 2 times, most recently from fdf416e to c39ce4a Compare January 31, 2022 10:15
@benedikt-voelkel benedikt-voelkel marked this pull request as ready for review January 31, 2022 10:18
Benedikt Volkel added 3 commits February 8, 2022 08:48
* first step to give cut and process setting from the outside more
  structure

* introduce JSON parsing into MaterialManager for that matter

* leave previous interface for now where cuts and processes are set from
  bare text files

* introduce configurable params
  * MaterialManagerParam.inputFile to pass and overwrite parameters
    from JSON
  * MaterialManagerParam.outputFile to write parameters used in sim to
    JSON for further usage and inspection

* introduced policy:
  * parameters set later will overwrite previous settings
  * parameters set from MaterialManagerParam.inputFile have highest
    priority
* fix typos in helper functions

* remove rapidjson dependency from header file
* change policy to "first come first serve"

* if MaterialManagerParam.inputFile is present via config-key
  1) set defaults in gconfig/src/SetCuts.cxx before anything else is set
  2) set special in O2MCApplication::InitGeometry before FairModules get
     the chance to do so via SetSpecialPhysicsCuts

* two step procedure is necessary because TVirtualMC::SetCut
  TVirtualMC::Gstpar have to be called at two different points during
  setup
@benedikt-voelkel
Copy link
Copy Markdown
Contributor Author

as discussed today in the WP12 meeting I will add an additional comment key for each medium in the output file to get a quick informative overview

Benedikt Volkel added 2 commits February 10, 2022 10:15
* print medium and material name

* add options to enable/disable special cut and process setting
@benedikt-voelkel
Copy link
Copy Markdown
Contributor Author

@amorsch @sawenzel See the above comment for the current JSON output format.
The output contains material name, medium name and maps the parameter values to the named keys.

@sawenzel sawenzel enabled auto-merge (squash) February 14, 2022 10:22
auto-merge was automatically disabled February 16, 2022 09:22

Head branch was pushed to by a user without write access

@benedikt-voelkel
Copy link
Copy Markdown
Contributor Author

@sawenzel I pushed a typo fix cause it was still waiting for all tests to pass. Then I realised that this commit killed your automerge. CI is green now, could you enable the automerge again or merge it?
Thanks a lot!

@sawenzel
Copy link
Copy Markdown
Collaborator

The full-CI for this PR is failing due to a missing alien-token for the CCDB access:

[19894:CPVDigitizer]: [09:32:21][INFO] CCDB: Reading o2::cpv::Pedestals from CPV/Calib/Pedestals
[19894:CPVDigitizer]: [09:32:21][WARN] CCDB: Did not find an alien token; Cannot serve objects located on alien://
[19894:CPVDigitizer]: [09:32:21][ERROR] Requested resource does not exist: http://alice-ccdb.cern.ch/download/9b4a8fe2-9638-11ec-982e-0aa202a21b9a
[19894:CPVDigitizer]: [09:32:21][FATAL] Got nullptr from CCDB for path CPV/Calib/Pedestals and timestamp 1645953636034
[19894:CPVDigitizer]: For later analysis we write a core dump to core_dump_19894
[19896:HMPIDDigitizer]: Info in <TGeoManager::CountLevels>: max level = 13, max placements = 735
[1

@TimoWilken : Is this problem already fixed or being taken care of? (Maybe the full-CI merely needs a restart)

@sawenzel sawenzel enabled auto-merge (squash) March 3, 2022 10:39
@sawenzel sawenzel merged commit ee545bd into AliceO2Group:dev Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants