| 120 | | NEW_CPP_LIB = { |
| 121 | | # check status of the directory. Remove it if already exists |
| 122 | | 'check': True, |
| 123 | | # Language type: 'v4' for f77/ 'cpp' for C++ output |
| 124 | | 'exporter': 'cpp', |
| 125 | | # Output type: |
| 126 | | #[Template/dir/None] copy the Template, just create dir or do nothing |
| 127 | | 'output': 'Template', |
| 128 | | # Decide which type of merging if used [madevent/madweight] |
| 129 | | 'group_mode': 'madweight', |
| 130 | | # if no grouping on can decide to merge uu~ and u~u anyway: |
| 131 | | 'sa_symmetry': True, |
| 132 | | # The most important part where the exporter is defined: |
| 133 | | # a plugin typically defines this file in another file (here tak one of MG5) |
| 134 | | 'exporter_class': MY_CPP_Standalone |
| 135 | | } |
| | 142 | def modify_grouping(self, matrix_element): |
| | 143 | """allow to modify the grouping (if grouping is in place) |
| | 144 | return two value: |
| | 145 | - True/False if the matrix_element was modified |
| | 146 | - the new(or old) matrix element""" |
| | 147 | #irrelevant here since group_mode=False so this function is never called |
| | 148 | return False, matrix_element |
| 137 | | NEW_MW_OUTPUT = { |
| 138 | | # check status of the directory. Remove it if already exists |
| 139 | | 'check': True, |
| 140 | | # Language type: 'v4' for f77/ 'cpp' for C++ output |
| 141 | | 'exporter': 'v4', |
| 142 | | # Output type: |
| 143 | | #[Template/dir/None] copy the Template, just create dir or do nothing |
| 144 | | 'output': 'Template', |
| 145 | | # Decide which type of merging to used [madevent/madweight] |
| 146 | | 'group_mode': 'madweight', |
| 147 | | # if no grouping on can decide to merge uu~ and u~u anyway: |
| 148 | | 'sa_symmetry': True, |
| 149 | | # The most important part where the exporter is defined: |
| 150 | | # a plugin typically defines this file in another file (here tak one of MG5) |
| 151 | | 'exporter_class': My_MW_Exporter |
| 152 | | } |
| 171 | | === List of function that need to be defined in the exporter For Cpp output: |
| 172 | | |
| 173 | | Note: All of them are defined in ProcessExporterCPP. So you need to define them only if you start a class from scratch. |
| 174 | | This list correspond to the call to the exporter performed outside the class itself. |
| 175 | | |
| 176 | | 1. __init__(self, mgme_dir = "", dir_path = "", opt=None) |
| 177 | | 2. setup_cpp_standalone_dir(self, model) |
| 178 | | 3. generate_subprocess_directory(self, subproc_group, helicity_model, me=None) [for grouped] |
| 179 | | returns an integer (used only to print info to screen as the number of call to helicity routine) |
| 180 | | 4. generate_subprocess_directory(self, matrix_element, helicity_model, me_number) [for ungrouped] |
| 181 | | returns an integer (used only to print info to screen as the number of call to helicity routine) |
| 182 | | 4. convert_model(model, wanted_lorentz=[], wanted_coupling=[]) |
| 183 | | 5. finalize(self,matrix_element, cmdhistory, MG5options, outputflag) |
| 184 | | 6. modify_grouping(self, matrix_element) |
| 185 | | 7. compile_model(self) |
| 192 | | 1. grouped_mode # says which type of exporter to use. |
| | 174 | 1. '''grouped_mode''' This variable changes the type of object called within 'generate_subprocess_directory' functions. |
| | 175 | a. '''False''' to avoid grouping (only identical matrix element are merged) |
| | 176 | b. ''' 'madevent' ''' group the massless quark and massless lepton |
| | 177 | c. ''' 'madweight' ''' group the gluon with the massless quark |
| | 178 | 2. '''sa_symmetry''' If no grouped_mode=False, uu~ and u~u will be called independently. Putting sa_symmetry generates only one of the two matrix-element. (might not work for cpp output. |
| | 179 | 3. '''check''' Ask madgraph to check if the directory already exists and propose to the user to remove it first if this is the case |
| | 180 | 4. '''output''' [Template, None, dir] |
| | 181 | a. ''''Template'''', madgraph will call copy_template |
| | 182 | b. ''''dir'''', madgraph will just create an empty directory for initialisation |
| | 183 | c. '''None''', madgraph do nothing for initialisation |
| | 184 | 5. '''exporter''' ['v4'/'cpp'] language of the output 'v4' for Fortran output, 'cpp' for C++ output |
| | 185 | |
| 200 | | grouped_mode=True |
| 201 | | |
| 202 | | def __init__(self, mgme_dir = "", dir_path = "", opt=None): |
| 203 | | return |
| 204 | | |
| 205 | | def copy_v4template(self, modelname): |
| 206 | | return |
| 207 | | |
| 208 | | def generate_subprocess_directory(self, subproc_group, helicity_model, me=None): |
| 209 | | # generate_subprocess_directory(self, matrix_element, helicity_model, me_number) [for ungrouped] |
| 210 | | return 0 # return an integer stating the number of call to helicity routine |
| 211 | | def convert_model(self, model, wanted_lorentz=[], wanted_coupling=[]): |
| 212 | | return |
| 213 | | def finalize(self,matrix_element, cmdhistory, MG5options, outputflag): |
| 214 | | return |
| 215 | | def modify_grouping(self, matrix_element): |
| 216 | | return False, matrix_element |
| 217 | | def export_model_files(self, model_v4_path): |
| 218 | | return |
| 219 | | def export_helas(self, HELAS_PATH): |
| 220 | | return |
| 221 | | |
| 222 | | |
| 223 | | class MyCPPEmptyOutput(object): |
| 224 | | |
| 225 | | grouped_mode=True |
| 226 | | |
| 227 | | def __init__(self, mgme_dir = "", dir_path = "", opt=None): |
| 228 | | return |
| 229 | | |
| 230 | | def setup_cpp_standalone_dir(self, model): |
| 231 | | return |
| 232 | | |
| 233 | | def generate_subprocess_directory(self, subproc_group, helicity_model, me=None): |
| 234 | | # generate_subprocess_directory(self, matrix_element, helicity_model, me_number) [for ungrouped] |
| 235 | | return 0 # return an integer stating the number of call to helicity routine |
| 236 | | def convert_model(self, model, wanted_lorentz=[], wanted_coupling=[]): |
| 237 | | return |
| 238 | | |
| 239 | | def finalize(self,matrix_element, cmdhistory, MG5options, outputflag): |
| 240 | | return |
| 241 | | |
| 242 | | def modify_grouping(self, matrix_element): |
| 243 | | return False, matrix_element |
| 244 | | |
| 245 | | def compile_model(self): |
| 246 | | #compile the model to create a library |
| 247 | | return |
| 248 | | |
| 249 | | }}} |
| 250 | | |
| 251 | | |