@@ -57,6 +57,7 @@ def main():
5757 parser .add_argument ('--mode' , type = str , help = 'Run generator in sequential or parallel mode for quicker event generation (multi-threading)' )
5858 parser .add_argument ('--output' , type = str , required = True , help = 'Output JSON file path' )
5959 parser .add_argument ('--clone' , type = int , help = 'Number of clones to make of the generator list' )
60+ parser .add_argument ('--trigger' , action = 'store_true' , help = 'Add triggers to the template JSON file' )
6061
6162 args = parser .parse_args ()
6263
@@ -72,15 +73,7 @@ def main():
7273 # Available options for trigger are "off", "or", "and"
7374 # in all the other cases the trigger is forced "off"
7475
75- trgbase = {
76- "mode" : "off" ,
77- "specs" : [
78- {
79- "macro" : "" ,
80- "function" : ""
81- }
82- ]
83- }
76+ add_trigger = lambda d : d .update ({"triggers" : {"mode" : "off" , "specs" : [{"macro" : "" , "function" : "" }]}}) if args .trigger else None
8477
8578 # put in a list all the elementes in the gen flag
8679 noConfGen = ["pythia8pp" , "pythia8hf" , "pythia8hi" , "pythia8powheg" ]
@@ -96,25 +89,25 @@ def main():
9689 configs = [get_params (cmd_instance , cmd_params ), get_params (gens_instances [gen ], gens_params [gen ])]
9790 gens .append ({
9891 'name' : gen ,
99- 'triggers' : trgbase ,
10092 'config' : {
10193 "configcmd" : configs [0 ],
10294 "confighepmc" : configs [1 ]
10395 }
10496 })
97+ add_trigger (gens [- 1 ])
10598 else :
10699 configs = get_params (gens_instances [gen ],gens_params [gen ])
107100 gens .append ({
108101 'name' : gen ,
109- 'triggers' : trgbase ,
110102 'config' : configs
111103 })
104+ add_trigger (gens [- 1 ])
112105 elif gen in noConfGen :
113106 gens .append ({
114107 "name" : gen ,
115- 'triggers' : trgbase ,
116108 "config" : ""
117109 })
110+ add_trigger (gens [- 1 ])
118111 else :
119112 print (f"Generator { gen } not found in the list of available generators" )
120113 exit (1 )
@@ -129,9 +122,9 @@ def main():
129122 configs ["iniFile" ] = ini
130123 gens .append ({
131124 'name' : 'external' ,
132- 'triggers' : trgbase ,
133125 'config' : configs
134126 })
127+ add_trigger (gens [- 1 ])
135128
136129 if args .clone :
137130 if args .clone < 2 :
0 commit comments