| 24 | | The user is then asked to edit the different cards needed for the run. The information for the density matrices computation is given in the reweight_card. Examples for different benchmark processes are given in https://arxiv.org/abs/2510.17730. |
| | 24 | The user is then asked to edit the different cards needed for the run. The information for the density matrices computation is given in the reweight_card. Examples for different benchmark processes are given in https://arxiv.org/abs/2510.17730. At the end of the run, the density matrix for each event is written in the Les Houches Event (LHE) file. |
| | 25 | |
| | 26 | ==How to read the density matrices in the LHE file |
| | 27 | The LHE file can be read with the parser lhe_parser.py available in MadGraph. An example of code that would parse the density matrix value for each event is: |
| | 28 | |
| | 29 | {{{ |
| | 30 | import sys |
| | 31 | sys.path.append('PATH TO MADGRAPH') |
| | 32 | import madgraph.various.Density_functions as dens |
| | 33 | import madgraph.various.lhe_parser as lhe_parser |
| | 34 | |
| | 35 | lhe_path = os.path.join('PATH TO MADGRAPH', Data_Path) |
| | 36 | for event in lhe_parser.EventFile(lhe_path): |
| | 37 | density = event.density |
| | 38 | square_density = dens.square_matrix(density) |
| | 39 | |
| | 40 | }}} |
| | 41 | |
| | 42 | With this code, for each event of the file, you read the value `density` which contains the independent coefficients of the density matrix. The utility function `square_matrix` allows to write it in the usual matrix form needed for further analysis. |
| | 43 | |