Skip to content

Commit

Permalink
[patchMadsh] regenerate the other 7 processes mad
Browse files Browse the repository at this point in the history
  • Loading branch information
valassi committed Aug 14, 2023
1 parent a1af041 commit 41b378d
Show file tree
Hide file tree
Showing 21 changed files with 456 additions and 253 deletions.
16 changes: 8 additions & 8 deletions epochX/cudacpp/ee_mumu.mad/CODEGEN_mad_ee_mumu_log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ generate e+ e- > mu+ mu-
No model currently active, so we import the Standard Model
INFO: load particles
INFO: load vertices
DEBUG: model prefixing takes 0.0047299861907958984 
DEBUG: model prefixing takes 0.004727363586425781 
INFO: Restrict model sm with file models/sm/restrict_default.dat .
DEBUG: Simplifying conditional expressions 
DEBUG: remove interactions: u s w+ at order: QED=1 
Expand Down Expand Up @@ -176,7 +176,7 @@ INFO: Creating files in directory P1_epem_mupmum
DEBUG: Entering PLUGIN_OneProcessExporter.__init__ [model_handling.py at line 1039] 
DEBUG: kwargs[prefix] = 0 [model_handling.py at line 1040] 
DEBUG: proc_id =  1 [model_handling.py at line 1046] 
DEBUG: process_exporter_cpp =  <PLUGIN.CUDACPP_SA_OUTPUT.model_handling.PLUGIN_OneProcessExporter object at 0x7f0b21f9c580> [export_v4.py at line 6180] 
DEBUG: process_exporter_cpp =  <PLUGIN.CUDACPP_SA_OUTPUT.model_handling.PLUGIN_OneProcessExporter object at 0x7fe88ec9b550> [export_v4.py at line 6180] 
INFO: Creating files in directory .
DEBUG: Entering PLUGIN_OneProcessExporter.generate_process_files [model_handling.py at line 1298] 
DEBUG: self.include_multi_channel is already defined: this is madevent+second_exporter mode [model_handling.py at line 1300] 
Expand Down Expand Up @@ -210,19 +210,19 @@ INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./.
INFO: Generating Feynman diagrams for Process: e+ e- > mu+ mu- WEIGHTED<=4 @1
INFO: Finding symmetric diagrams for subprocess group epem_mupmum
Generated helas calls for 1 subprocesses (2 diagrams) in 0.004 s
Wrote files for 8 helas calls in 0.094 s
Wrote files for 8 helas calls in 0.100 s
ALOHA: aloha starts to compute helicity amplitudes
ALOHA: aloha creates FFV1 routines
ALOHA: aloha creates FFV2 routines
ALOHA: aloha creates FFV4 routines
ALOHA: aloha creates 3 routines in 0.170 s
ALOHA: aloha creates 3 routines in 0.177 s
DEBUG: Entering PLUGIN_ProcessExporter.convert_model (create the model) [output.py at line 195] 
ALOHA: aloha starts to compute helicity amplitudes
ALOHA: aloha creates FFV1 routines
ALOHA: aloha creates FFV2 routines
ALOHA: aloha creates FFV4 routines
ALOHA: aloha creates FFV2_4 routines
ALOHA: aloha creates 7 routines in 0.217 s
ALOHA: aloha creates 7 routines in 0.215 s
<class 'aloha.create_aloha.AbstractRoutine'> FFV1
<class 'aloha.create_aloha.AbstractRoutine'> FFV1
<class 'aloha.create_aloha.AbstractRoutine'> FFV2
Expand Down Expand Up @@ -338,6 +338,6 @@ Type "launch" to generate events from this process, or see
Run "open index.html" to see more information about this process.
quit

real 0m2.363s
user 0m2.013s
sys 0m0.301s
real 0m2.550s
user 0m1.990s
sys 0m0.376s
75 changes: 51 additions & 24 deletions epochX/cudacpp/ee_mumu.mad/bin/internal/lhe_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,12 @@ def next_event(self):
text.append(line)

if '</event>' in line:
if self.parsing:
if self.parsing == "wgt_only":
out = Event(text, parse_momenta=False)
#if len(out) == 0 and not self.allow_empty_event:
# raise Exception
return out
elif self.parsing:
out = Event(text)
if len(out) == 0 and not self.allow_empty_event:
raise Exception
Expand Down Expand Up @@ -448,6 +453,8 @@ def unweight(self, outputpath, get_wgt=None, max_wgt=0, trunc_error=0,
event_target reweight for that many event with maximal trunc_error.
(stop to write event when target is reached)
"""
self.parsing = 'wgt_only'

if not get_wgt:
def weight(event):
return event.wgt
Expand Down Expand Up @@ -914,6 +921,8 @@ class MultiEventFile(EventFile):
The number of events in each file need to be provide in advance
(if not provide the file is first read to find that number"""

parsing = True # check if/when we need to parse the event.

def __new__(cls, start_list=[],parse=True):
return object.__new__(MultiEventFile)

Expand Down Expand Up @@ -986,6 +995,7 @@ def next(self):
nb_event = random.randint(1, remaining_event)
sum_nb=0
for i, obj in enumerate(self.files):
obj.parsing = "wgt_only"
sum_nb += self.initial_nb_events[i] - self.curr_nb_events[i]
if nb_event <= sum_nb:
self.curr_nb_events[i] += 1
Expand Down Expand Up @@ -1115,6 +1125,7 @@ def initialize_unweighting(self, getwgt, trunc_error):
total_event = 0
sum_cross = collections.defaultdict(int)
for i,f in enumerate(self.files):
f.parsing = 'wgt_only'
nb_event = 0
# We need to loop over the event file to get some information about the
# new cross-section/ wgt of event.
Expand Down Expand Up @@ -1302,7 +1313,7 @@ class Event(list):

warning_order = True # raise a warning if the order of the particle are not in accordance of child/mother

def __init__(self, text=None):
def __init__(self, text=None, parse_momenta=True):
"""The initialization of an empty Event (or one associate to a text file)"""
list.__init__(self)

Expand All @@ -1322,15 +1333,15 @@ def __init__(self, text=None):
self.matched_scale_data = None
self.syscalc_data = {}
if text:
self.parse(text)
self.parse(text, parse_momenta=parse_momenta)


def parse(self, text):
event_flag_pattern = re.compile(r"""(\w*)=(?:(?:['"])([^'"]*)(?=['"])|(\S*))""")
def parse(self, text, parse_momenta=True):
"""Take the input file and create the structured information"""
#text = re.sub(r'</?event>', '', text) # remove pointless tag
status = 'first'

tags = []
if not isinstance(text, list):
text = text.split('\n')

Expand All @@ -1354,24 +1365,28 @@ def parse(self, text):
if '<rwgt>' in line:
status = 'tag'
else:
self.assign_scale_line(line)
self.assign_scale_line(line, convert=parse_momenta)
status = 'part'
continue
if '<' in line:
status = 'tag'

if 'part' == status:
part = Particle(line, event=self)
if part.E != 0 or part.status==-1:
self.append(part)
elif self.nexternal:
self.nexternal-=1
if parse_momenta:
part = Particle(line, event=self)
if part.E != 0 or part.status==-1:
self.append(part)
elif self.nexternal:
self.nexternal-=1
else:
tags.append(line)
else:
if '</event>' in line:
if line.endswith('</event>'):
line = line.replace('</event>','',1)
self.tag += '%s\n' % line

self.assign_mother()
tags.append(line)
self.tag += "\n".join(tags)
if parse_momenta:
self.assign_mother()


def assign_mother(self):
Expand Down Expand Up @@ -1905,19 +1920,27 @@ def check(self):
#3. check mass


def assign_scale_line(self, line):
def assign_scale_line(self, line, convert=True):
"""read the line corresponding to global event line
format of the line is:
Nexternal IEVENT WEIGHT SCALE AEW AS
"""
inputs = line.split()
assert len(inputs) == 6
self.nexternal=int(inputs[0])
self.ievent=int(inputs[1])
self.wgt=float(inputs[2])
self.scale=float(inputs[3])
self.aqed=float(inputs[4])
self.aqcd=float(inputs[5])
if convert:
self.nexternal=int(inputs[0])
self.ievent=int(inputs[1])
self.wgt=float(inputs[2])
self.scale=float(inputs[3])
self.aqed=float(inputs[4])
self.aqcd=float(inputs[5])
else:
self.nexternal=inputs[0]
self.ievent=inputs[1]
self.wgt=float(inputs[2])
self.scale=inputs[3]
self.aqed=inputs[4]
self.aqcd=inputs[5]

def get_tag_and_order(self):
"""Return the unique tag identifying the SubProcesses for the generation.
Expand Down Expand Up @@ -2269,7 +2292,11 @@ def __str__(self, event_id=''):
else:
event_flag = ''

scale_str = "%2d %6d %+13.7e %14.8e %14.8e %14.8e" % \
try:
scale_str = "%2d %6d %+13.7e %14.8e %14.8e %14.8e" % \
(self.nexternal,self.ievent,self.wgt,self.scale,self.aqed,self.aqcd)
except:
scale_str = "%s %s %+13.7e %s %s %s" % \
(self.nexternal,self.ievent,self.wgt,self.scale,self.aqed,self.aqcd)


Expand Down
2 changes: 2 additions & 0 deletions epochX/cudacpp/ee_mumu.mad/bin/internal/madevent_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -3705,6 +3705,7 @@ def do_combine_events(self, line):
"""Advanced commands: Launch combine events"""

args = self.split_arg(line)
start = time.time()
# Check argument's validity
self.check_combine_events(args)
self.update_status('Combining Events', level='parton')
Expand Down Expand Up @@ -3796,6 +3797,7 @@ def do_combine_events(self, line):
if self.run_card['bias_module'].lower() not in ['dummy', 'none'] and nb_event:
self.correct_bias()

logger.info("combine events done in %s", time.time()-start)


self.to_store.append('event')
Expand Down
22 changes: 11 additions & 11 deletions epochX/cudacpp/gg_tt01g.mad/CODEGEN_mad_gg_tt01g_log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ generate g g > t t~; add process g g > t t~ g
No model currently active, so we import the Standard Model
INFO: load particles
INFO: load vertices
DEBUG: model prefixing takes 0.0047647953033447266 
DEBUG: model prefixing takes 0.004500389099121094 
INFO: Restrict model sm with file models/sm/restrict_default.dat .
DEBUG: Simplifying conditional expressions 
DEBUG: remove interactions: u s w+ at order: QED=1 
Expand Down Expand Up @@ -162,7 +162,7 @@ INFO: Please specify coupling orders to bypass this step.
INFO: Trying coupling order WEIGHTED<=3: WEIGTHED IS QCD+2*QED
INFO: Trying process: g g > t t~ g WEIGHTED<=3 @2
INFO: Process has 16 diagrams
1 processes with 16 diagrams generated in 0.018 s
1 processes with 16 diagrams generated in 0.017 s
Total: 2 processes with 19 diagrams
output madevent CODEGEN_mad_gg_tt01g --hel_recycling=False --vector_size=16384 --me_exporter=standalone_cudacpp
Load PLUGIN.CUDACPP_SA_OUTPUT
Expand All @@ -186,7 +186,7 @@ INFO: Creating files in directory P2_gg_ttxg
DEBUG: Entering PLUGIN_OneProcessExporter.__init__ [model_handling.py at line 1039] 
DEBUG: kwargs[prefix] = 0 [model_handling.py at line 1040] 
DEBUG: proc_id =  1 [model_handling.py at line 1046] 
DEBUG: process_exporter_cpp =  <PLUGIN.CUDACPP_SA_OUTPUT.model_handling.PLUGIN_OneProcessExporter object at 0x7fb98183adf0> [export_v4.py at line 6180] 
DEBUG: process_exporter_cpp =  <PLUGIN.CUDACPP_SA_OUTPUT.model_handling.PLUGIN_OneProcessExporter object at 0x7f2475558f10> [export_v4.py at line 6180] 
INFO: Creating files in directory .
DEBUG: Entering PLUGIN_OneProcessExporter.generate_process_files [model_handling.py at line 1298] 
DEBUG: self.include_multi_channel is already defined: this is madevent+second_exporter mode [model_handling.py at line 1300] 
Expand Down Expand Up @@ -228,7 +228,7 @@ INFO: Creating files in directory P1_gg_ttx
DEBUG: Entering PLUGIN_OneProcessExporter.__init__ [model_handling.py at line 1039] 
DEBUG: kwargs[prefix] = 0 [model_handling.py at line 1040] 
DEBUG: proc_id =  1 [model_handling.py at line 1046] 
DEBUG: process_exporter_cpp =  <PLUGIN.CUDACPP_SA_OUTPUT.model_handling.PLUGIN_OneProcessExporter object at 0x7fb98190e5b0> [export_v4.py at line 6180] 
DEBUG: process_exporter_cpp =  <PLUGIN.CUDACPP_SA_OUTPUT.model_handling.PLUGIN_OneProcessExporter object at 0x7f2475558f10> [export_v4.py at line 6180] 
INFO: Creating files in directory .
DEBUG: Entering PLUGIN_OneProcessExporter.generate_process_files [model_handling.py at line 1298] 
DEBUG: self.include_multi_channel is already defined: this is madevent+second_exporter mode [model_handling.py at line 1300] 
Expand Down Expand Up @@ -264,23 +264,23 @@ INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./.
DEBUG: Done [export_cpp.py at line 713] 
INFO: Generating Feynman diagrams for Process: g g > t t~ WEIGHTED<=2 @1
INFO: Finding symmetric diagrams for subprocess group gg_ttx
Generated helas calls for 2 subprocesses (19 diagrams) in 0.039 s
Wrote files for 46 helas calls in 0.250 s
Generated helas calls for 2 subprocesses (19 diagrams) in 0.038 s
Wrote files for 46 helas calls in 0.251 s
ALOHA: aloha starts to compute helicity amplitudes
ALOHA: aloha creates VVV1 routines
ALOHA: aloha creates FFV1 routines
ALOHA: aloha creates VVVV1 set of routines with options: P0
ALOHA: aloha creates VVVV3 set of routines with options: P0
ALOHA: aloha creates VVVV4 set of routines with options: P0
ALOHA: aloha creates 5 routines in 0.280 s
ALOHA: aloha creates 5 routines in 0.285 s
DEBUG: Entering PLUGIN_ProcessExporter.convert_model (create the model) [output.py at line 195] 
ALOHA: aloha starts to compute helicity amplitudes
ALOHA: aloha creates VVV1 routines
ALOHA: aloha creates FFV1 routines
ALOHA: aloha creates VVVV1 set of routines with options: P0
ALOHA: aloha creates VVVV3 set of routines with options: P0
ALOHA: aloha creates VVVV4 set of routines with options: P0
ALOHA: aloha creates 10 routines in 0.265 s
ALOHA: aloha creates 10 routines in 0.276 s
<class 'aloha.create_aloha.AbstractRoutine'> VVV1
<class 'aloha.create_aloha.AbstractRoutine'> VVV1
<class 'aloha.create_aloha.AbstractRoutine'> FFV1
Expand Down Expand Up @@ -404,6 +404,6 @@ Type "launch" to generate events from this process, or see
Run "open index.html" to see more information about this process.
quit

real 0m3.092s
user 0m2.406s
sys 0m0.343s
real 0m2.909s
user 0m2.412s
sys 0m0.359s
Loading

0 comments on commit 41b378d

Please sign in to comment.