From 41b378d59e3c796bf3d11595ca78badfaf5268b1 Mon Sep 17 00:00:00 2001 From: Andrea Valassi Date: Mon, 14 Aug 2023 19:45:20 +0200 Subject: [PATCH] [patchMadsh] regenerate the other 7 processes mad --- .../ee_mumu.mad/CODEGEN_mad_ee_mumu_log.txt | 16 ++-- .../ee_mumu.mad/bin/internal/lhe_parser.py | 75 +++++++++++++------ .../bin/internal/madevent_interface.py | 2 + .../gg_tt01g.mad/CODEGEN_mad_gg_tt01g_log.txt | 22 +++--- .../gg_tt01g.mad/bin/internal/lhe_parser.py | 75 +++++++++++++------ .../bin/internal/madevent_interface.py | 2 + .../gg_ttg.mad/CODEGEN_mad_gg_ttg_log.txt | 18 ++--- .../gg_ttg.mad/bin/internal/lhe_parser.py | 75 +++++++++++++------ .../bin/internal/madevent_interface.py | 2 + .../gg_ttgg.mad/CODEGEN_mad_gg_ttgg_log.txt | 18 ++--- .../gg_ttgg.mad/bin/internal/lhe_parser.py | 75 +++++++++++++------ .../bin/internal/madevent_interface.py | 2 + .../gg_ttggg.mad/CODEGEN_mad_gg_ttggg_log.txt | 20 ++--- .../gg_ttggg.mad/bin/internal/lhe_parser.py | 75 +++++++++++++------ .../bin/internal/madevent_interface.py | 2 + .../gq_ttq.mad/CODEGEN_mad_gq_ttq_log.txt | 20 ++--- .../gq_ttq.mad/bin/internal/lhe_parser.py | 75 +++++++++++++------ .../bin/internal/madevent_interface.py | 2 + .../CODEGEN_mad_pp_tt012j_log.txt | 56 +++++++------- .../pp_tt012j.mad/bin/internal/lhe_parser.py | 75 +++++++++++++------ .../bin/internal/madevent_interface.py | 2 + 21 files changed, 456 insertions(+), 253 deletions(-) diff --git a/epochX/cudacpp/ee_mumu.mad/CODEGEN_mad_ee_mumu_log.txt b/epochX/cudacpp/ee_mumu.mad/CODEGEN_mad_ee_mumu_log.txt index 335ce917ba..9de26423cd 100644 --- a/epochX/cudacpp/ee_mumu.mad/CODEGEN_mad_ee_mumu_log.txt +++ b/epochX/cudacpp/ee_mumu.mad/CODEGEN_mad_ee_mumu_log.txt @@ -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  @@ -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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -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 FFV1 FFV1 FFV2 @@ -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 diff --git a/epochX/cudacpp/ee_mumu.mad/bin/internal/lhe_parser.py b/epochX/cudacpp/ee_mumu.mad/bin/internal/lhe_parser.py index cff8789e38..4c1d5f0d23 100755 --- a/epochX/cudacpp/ee_mumu.mad/bin/internal/lhe_parser.py +++ b/epochX/cudacpp/ee_mumu.mad/bin/internal/lhe_parser.py @@ -342,7 +342,12 @@ def next_event(self): text.append(line) if '' 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 @@ -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 @@ -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) @@ -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 @@ -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. @@ -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) @@ -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'', '', text) # remove pointless tag status = 'first' - + tags = [] if not isinstance(text, list): text = text.split('\n') @@ -1354,24 +1365,28 @@ def parse(self, text): if '' 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 '' in line: + if line.endswith(''): line = line.replace('','',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): @@ -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. @@ -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) diff --git a/epochX/cudacpp/ee_mumu.mad/bin/internal/madevent_interface.py b/epochX/cudacpp/ee_mumu.mad/bin/internal/madevent_interface.py index b70b548e53..920e07a926 100755 --- a/epochX/cudacpp/ee_mumu.mad/bin/internal/madevent_interface.py +++ b/epochX/cudacpp/ee_mumu.mad/bin/internal/madevent_interface.py @@ -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') @@ -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') diff --git a/epochX/cudacpp/gg_tt01g.mad/CODEGEN_mad_gg_tt01g_log.txt b/epochX/cudacpp/gg_tt01g.mad/CODEGEN_mad_gg_tt01g_log.txt index 6311841444..5667730a51 100644 --- a/epochX/cudacpp/gg_tt01g.mad/CODEGEN_mad_gg_tt01g_log.txt +++ b/epochX/cudacpp/gg_tt01g.mad/CODEGEN_mad_gg_tt01g_log.txt @@ -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  @@ -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 @@ -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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -264,15 +264,15 @@ 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 @@ -280,7 +280,7 @@ 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 VVV1 VVV1 FFV1 @@ -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 diff --git a/epochX/cudacpp/gg_tt01g.mad/bin/internal/lhe_parser.py b/epochX/cudacpp/gg_tt01g.mad/bin/internal/lhe_parser.py index cff8789e38..4c1d5f0d23 100755 --- a/epochX/cudacpp/gg_tt01g.mad/bin/internal/lhe_parser.py +++ b/epochX/cudacpp/gg_tt01g.mad/bin/internal/lhe_parser.py @@ -342,7 +342,12 @@ def next_event(self): text.append(line) if '' 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 @@ -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 @@ -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) @@ -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 @@ -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. @@ -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) @@ -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'', '', text) # remove pointless tag status = 'first' - + tags = [] if not isinstance(text, list): text = text.split('\n') @@ -1354,24 +1365,28 @@ def parse(self, text): if '' 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 '' in line: + if line.endswith(''): line = line.replace('','',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): @@ -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. @@ -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) diff --git a/epochX/cudacpp/gg_tt01g.mad/bin/internal/madevent_interface.py b/epochX/cudacpp/gg_tt01g.mad/bin/internal/madevent_interface.py index b70b548e53..920e07a926 100755 --- a/epochX/cudacpp/gg_tt01g.mad/bin/internal/madevent_interface.py +++ b/epochX/cudacpp/gg_tt01g.mad/bin/internal/madevent_interface.py @@ -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') @@ -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') diff --git a/epochX/cudacpp/gg_ttg.mad/CODEGEN_mad_gg_ttg_log.txt b/epochX/cudacpp/gg_ttg.mad/CODEGEN_mad_gg_ttg_log.txt index 70e5f32a71..a61611dad3 100644 --- a/epochX/cudacpp/gg_ttg.mad/CODEGEN_mad_gg_ttg_log.txt +++ b/epochX/cudacpp/gg_ttg.mad/CODEGEN_mad_gg_ttg_log.txt @@ -62,7 +62,7 @@ generate 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.004417896270751953  +DEBUG: model prefixing takes 0.004815578460693359  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  @@ -155,7 +155,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 @1 INFO: Process has 16 diagrams -1 processes with 16 diagrams generated in 0.019 s +1 processes with 16 diagrams generated in 0.021 s Total: 1 processes with 16 diagrams output madevent CODEGEN_mad_gg_ttg --hel_recycling=False --vector_size=16384 --me_exporter=standalone_cudacpp Load PLUGIN.CUDACPP_SA_OUTPUT @@ -177,7 +177,7 @@ INFO: Creating files in directory P1_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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -216,14 +216,14 @@ INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. INFO: Generating Feynman diagrams for Process: g g > t t~ g WEIGHTED<=3 @1 INFO: Finding symmetric diagrams for subprocess group gg_ttxg Generated helas calls for 1 subprocesses (16 diagrams) in 0.034 s -Wrote files for 36 helas calls in 0.150 s +Wrote files for 36 helas calls in 0.153 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.279 s +ALOHA: aloha creates 5 routines in 0.287 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 @@ -231,7 +231,7 @@ 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.267 s +ALOHA: aloha creates 10 routines in 0.318 s VVV1 VVV1 FFV1 @@ -351,6 +351,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.934s -user 0m2.290s -sys 0m0.323s +real 0m3.149s +user 0m2.310s +sys 0m0.350s diff --git a/epochX/cudacpp/gg_ttg.mad/bin/internal/lhe_parser.py b/epochX/cudacpp/gg_ttg.mad/bin/internal/lhe_parser.py index cff8789e38..4c1d5f0d23 100755 --- a/epochX/cudacpp/gg_ttg.mad/bin/internal/lhe_parser.py +++ b/epochX/cudacpp/gg_ttg.mad/bin/internal/lhe_parser.py @@ -342,7 +342,12 @@ def next_event(self): text.append(line) if '' 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 @@ -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 @@ -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) @@ -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 @@ -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. @@ -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) @@ -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'', '', text) # remove pointless tag status = 'first' - + tags = [] if not isinstance(text, list): text = text.split('\n') @@ -1354,24 +1365,28 @@ def parse(self, text): if '' 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 '' in line: + if line.endswith(''): line = line.replace('','',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): @@ -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. @@ -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) diff --git a/epochX/cudacpp/gg_ttg.mad/bin/internal/madevent_interface.py b/epochX/cudacpp/gg_ttg.mad/bin/internal/madevent_interface.py index b70b548e53..920e07a926 100755 --- a/epochX/cudacpp/gg_ttg.mad/bin/internal/madevent_interface.py +++ b/epochX/cudacpp/gg_ttg.mad/bin/internal/madevent_interface.py @@ -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') @@ -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') diff --git a/epochX/cudacpp/gg_ttgg.mad/CODEGEN_mad_gg_ttgg_log.txt b/epochX/cudacpp/gg_ttgg.mad/CODEGEN_mad_gg_ttgg_log.txt index ba8cde5cc9..0ea9b455c0 100644 --- a/epochX/cudacpp/gg_ttgg.mad/CODEGEN_mad_gg_ttgg_log.txt +++ b/epochX/cudacpp/gg_ttgg.mad/CODEGEN_mad_gg_ttgg_log.txt @@ -62,7 +62,7 @@ generate g g > t t~ g g No model currently active, so we import the Standard Model INFO: load particles INFO: load vertices -DEBUG: model prefixing takes 0.0047588348388671875  +DEBUG: model prefixing takes 0.004689216613769531  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  @@ -155,7 +155,7 @@ INFO: Please specify coupling orders to bypass this step. INFO: Trying coupling order WEIGHTED<=4: WEIGTHED IS QCD+2*QED INFO: Trying process: g g > t t~ g g WEIGHTED<=4 @1 INFO: Process has 123 diagrams -1 processes with 123 diagrams generated in 0.143 s +1 processes with 123 diagrams generated in 0.142 s Total: 1 processes with 123 diagrams output madevent CODEGEN_mad_gg_ttgg --hel_recycling=False --vector_size=16384 --me_exporter=standalone_cudacpp Load PLUGIN.CUDACPP_SA_OUTPUT @@ -177,7 +177,7 @@ INFO: Creating files in directory P1_gg_ttxgg 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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -218,14 +218,14 @@ INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. INFO: Generating Feynman diagrams for Process: g g > t t~ g g WEIGHTED<=4 @1 INFO: Finding symmetric diagrams for subprocess group gg_ttxgg Generated helas calls for 1 subprocesses (123 diagrams) in 0.383 s -Wrote files for 222 helas calls in 0.733 s +Wrote files for 222 helas calls in 0.659 s ALOHA: aloha starts to compute helicity amplitudes ALOHA: aloha creates VVV1 routines ALOHA: aloha creates FFV1 routines ALOHA: aloha creates VVVV1 routines ALOHA: aloha creates VVVV3 routines ALOHA: aloha creates VVVV4 routines -ALOHA: aloha creates 5 routines in 0.283 s +ALOHA: aloha creates 5 routines in 0.490 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 @@ -233,7 +233,7 @@ ALOHA: aloha creates FFV1 routines ALOHA: aloha creates VVVV1 routines ALOHA: aloha creates VVVV3 routines ALOHA: aloha creates VVVV4 routines -ALOHA: aloha creates 10 routines in 0.270 s +ALOHA: aloha creates 10 routines in 0.289 s VVV1 VVV1 FFV1 @@ -356,6 +356,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.930s -user 0m3.272s -sys 0m0.337s +real 0m4.349s +user 0m3.257s +sys 0m0.369s diff --git a/epochX/cudacpp/gg_ttgg.mad/bin/internal/lhe_parser.py b/epochX/cudacpp/gg_ttgg.mad/bin/internal/lhe_parser.py index cff8789e38..4c1d5f0d23 100755 --- a/epochX/cudacpp/gg_ttgg.mad/bin/internal/lhe_parser.py +++ b/epochX/cudacpp/gg_ttgg.mad/bin/internal/lhe_parser.py @@ -342,7 +342,12 @@ def next_event(self): text.append(line) if '' 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 @@ -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 @@ -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) @@ -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 @@ -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. @@ -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) @@ -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'', '', text) # remove pointless tag status = 'first' - + tags = [] if not isinstance(text, list): text = text.split('\n') @@ -1354,24 +1365,28 @@ def parse(self, text): if '' 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 '' in line: + if line.endswith(''): line = line.replace('','',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): @@ -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. @@ -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) diff --git a/epochX/cudacpp/gg_ttgg.mad/bin/internal/madevent_interface.py b/epochX/cudacpp/gg_ttgg.mad/bin/internal/madevent_interface.py index b70b548e53..920e07a926 100755 --- a/epochX/cudacpp/gg_ttgg.mad/bin/internal/madevent_interface.py +++ b/epochX/cudacpp/gg_ttgg.mad/bin/internal/madevent_interface.py @@ -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') @@ -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') diff --git a/epochX/cudacpp/gg_ttggg.mad/CODEGEN_mad_gg_ttggg_log.txt b/epochX/cudacpp/gg_ttggg.mad/CODEGEN_mad_gg_ttggg_log.txt index e561eb44c7..1a6691ed23 100644 --- a/epochX/cudacpp/gg_ttggg.mad/CODEGEN_mad_gg_ttggg_log.txt +++ b/epochX/cudacpp/gg_ttggg.mad/CODEGEN_mad_gg_ttggg_log.txt @@ -62,7 +62,7 @@ generate g g > t t~ g g g No model currently active, so we import the Standard Model INFO: load particles INFO: load vertices -DEBUG: model prefixing takes 0.00453495979309082  +DEBUG: model prefixing takes 0.00460052490234375  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  @@ -155,7 +155,7 @@ INFO: Please specify coupling orders to bypass this step. INFO: Trying coupling order WEIGHTED<=5: WEIGTHED IS QCD+2*QED INFO: Trying process: g g > t t~ g g g WEIGHTED<=5 @1 INFO: Process has 1240 diagrams -1 processes with 1240 diagrams generated in 1.705 s +1 processes with 1240 diagrams generated in 1.679 s Total: 1 processes with 1240 diagrams output madevent CODEGEN_mad_gg_ttggg --hel_recycling=False --vector_size=16384 --me_exporter=standalone_cudacpp Load PLUGIN.CUDACPP_SA_OUTPUT @@ -179,7 +179,7 @@ INFO: Color-Flow passed to 1592 term in 30s. Introduce 2768 contraction 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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -221,15 +221,15 @@ 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~ g g g WEIGHTED<=5 @1 INFO: Finding symmetric diagrams for subprocess group gg_ttxggg -Generated helas calls for 1 subprocesses (1240 diagrams) in 5.841 s -Wrote files for 2281 helas calls in 39.140 s +Generated helas calls for 1 subprocesses (1240 diagrams) in 5.786 s +Wrote files for 2281 helas calls in 39.165 s ALOHA: aloha starts to compute helicity amplitudes ALOHA: aloha creates VVV1 routines ALOHA: aloha creates FFV1 routines ALOHA: aloha creates VVVV1 routines ALOHA: aloha creates VVVV3 routines ALOHA: aloha creates VVVV4 routines -ALOHA: aloha creates 5 routines in 0.273 s +ALOHA: aloha creates 5 routines in 0.271 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 @@ -237,7 +237,7 @@ ALOHA: aloha creates FFV1 routines ALOHA: aloha creates VVVV1 routines ALOHA: aloha creates VVVV3 routines ALOHA: aloha creates VVVV4 routines -ALOHA: aloha creates 10 routines in 0.269 s +ALOHA: aloha creates 10 routines in 0.265 s VVV1 VVV1 FFV1 @@ -360,6 +360,6 @@ Type "launch" to generate events from this process, or see Run "open index.html" to see more information about this process. quit -real 0m49.420s -user 0m48.158s -sys 0m0.998s +real 0m49.427s +user 0m48.193s +sys 0m0.994s diff --git a/epochX/cudacpp/gg_ttggg.mad/bin/internal/lhe_parser.py b/epochX/cudacpp/gg_ttggg.mad/bin/internal/lhe_parser.py index cff8789e38..4c1d5f0d23 100755 --- a/epochX/cudacpp/gg_ttggg.mad/bin/internal/lhe_parser.py +++ b/epochX/cudacpp/gg_ttggg.mad/bin/internal/lhe_parser.py @@ -342,7 +342,12 @@ def next_event(self): text.append(line) if '' 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 @@ -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 @@ -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) @@ -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 @@ -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. @@ -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) @@ -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'', '', text) # remove pointless tag status = 'first' - + tags = [] if not isinstance(text, list): text = text.split('\n') @@ -1354,24 +1365,28 @@ def parse(self, text): if '' 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 '' in line: + if line.endswith(''): line = line.replace('','',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): @@ -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. @@ -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) diff --git a/epochX/cudacpp/gg_ttggg.mad/bin/internal/madevent_interface.py b/epochX/cudacpp/gg_ttggg.mad/bin/internal/madevent_interface.py index b70b548e53..920e07a926 100755 --- a/epochX/cudacpp/gg_ttggg.mad/bin/internal/madevent_interface.py +++ b/epochX/cudacpp/gg_ttggg.mad/bin/internal/madevent_interface.py @@ -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') @@ -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') diff --git a/epochX/cudacpp/gq_ttq.mad/CODEGEN_mad_gq_ttq_log.txt b/epochX/cudacpp/gq_ttq.mad/CODEGEN_mad_gq_ttq_log.txt index 07f6578acf..aaff3a83c2 100644 --- a/epochX/cudacpp/gq_ttq.mad/CODEGEN_mad_gq_ttq_log.txt +++ b/epochX/cudacpp/gq_ttq.mad/CODEGEN_mad_gq_ttq_log.txt @@ -61,7 +61,7 @@ set zerowidth_tchannel F define q = u c d s u~ c~ d~ s~; generate g q > t t~ q INFO: load particles INFO: load vertices -DEBUG: model prefixing takes 0.004458189010620117  +DEBUG: model prefixing takes 0.004550457000732422  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  @@ -169,7 +169,7 @@ INFO: Crossed process found for g u~ > t t~ u~, reuse diagrams. INFO: Crossed process found for g c~ > t t~ c~, reuse diagrams. INFO: Crossed process found for g d~ > t t~ d~, reuse diagrams. INFO: Crossed process found for g s~ > t t~ s~, reuse diagrams. -8 processes with 40 diagrams generated in 0.070 s +8 processes with 40 diagrams generated in 0.071 s Total: 8 processes with 40 diagrams output madevent CODEGEN_mad_gq_ttq --hel_recycling=False --vector_size=16384 --me_exporter=standalone_cudacpp Load PLUGIN.CUDACPP_SA_OUTPUT @@ -199,7 +199,7 @@ INFO: Creating files in directory P1_gu_ttxu 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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -237,7 +237,7 @@ INFO: Creating files in directory P1_gux_ttxux 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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -272,16 +272,16 @@ INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. INFO: Generating Feynman diagrams for Process: g u~ > t t~ u~ WEIGHTED<=3 @1 INFO: Finding symmetric diagrams for subprocess group gux_ttxux Generated helas calls for 2 subprocesses (10 diagrams) in 0.028 s -Wrote files for 32 helas calls in 0.213 s +Wrote files for 32 helas calls in 0.212 s ALOHA: aloha starts to compute helicity amplitudes ALOHA: aloha creates FFV1 routines ALOHA: aloha creates VVV1 routines -ALOHA: aloha creates 2 routines in 0.125 s +ALOHA: aloha creates 2 routines in 0.124 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 VVV1 routines -ALOHA: aloha creates 4 routines in 0.114 s +ALOHA: aloha creates 4 routines in 0.113 s FFV1 FFV1 FFV1 @@ -411,6 +411,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.933s -user 0m2.053s -sys 0m0.345s +real 0m2.502s +user 0m2.042s +sys 0m0.359s diff --git a/epochX/cudacpp/gq_ttq.mad/bin/internal/lhe_parser.py b/epochX/cudacpp/gq_ttq.mad/bin/internal/lhe_parser.py index cff8789e38..4c1d5f0d23 100755 --- a/epochX/cudacpp/gq_ttq.mad/bin/internal/lhe_parser.py +++ b/epochX/cudacpp/gq_ttq.mad/bin/internal/lhe_parser.py @@ -342,7 +342,12 @@ def next_event(self): text.append(line) if '' 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 @@ -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 @@ -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) @@ -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 @@ -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. @@ -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) @@ -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'', '', text) # remove pointless tag status = 'first' - + tags = [] if not isinstance(text, list): text = text.split('\n') @@ -1354,24 +1365,28 @@ def parse(self, text): if '' 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 '' in line: + if line.endswith(''): line = line.replace('','',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): @@ -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. @@ -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) diff --git a/epochX/cudacpp/gq_ttq.mad/bin/internal/madevent_interface.py b/epochX/cudacpp/gq_ttq.mad/bin/internal/madevent_interface.py index b70b548e53..920e07a926 100755 --- a/epochX/cudacpp/gq_ttq.mad/bin/internal/madevent_interface.py +++ b/epochX/cudacpp/gq_ttq.mad/bin/internal/madevent_interface.py @@ -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') @@ -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') diff --git a/epochX/cudacpp/pp_tt012j.mad/CODEGEN_mad_pp_tt012j_log.txt b/epochX/cudacpp/pp_tt012j.mad/CODEGEN_mad_pp_tt012j_log.txt index f96416a951..33628b47d6 100644 --- a/epochX/cudacpp/pp_tt012j.mad/CODEGEN_mad_pp_tt012j_log.txt +++ b/epochX/cudacpp/pp_tt012j.mad/CODEGEN_mad_pp_tt012j_log.txt @@ -61,7 +61,7 @@ set zerowidth_tchannel F define j = p INFO: load particles INFO: load vertices -DEBUG: model prefixing takes 0.004494905471801758  +DEBUG: model prefixing takes 0.004655361175537109  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  @@ -212,7 +212,7 @@ INFO: Process d~ g > t t~ d~ added to mirror process g d~ > t t~ d~ INFO: Process d~ d > t t~ g added to mirror process d d~ > t t~ g INFO: Process s~ g > t t~ s~ added to mirror process g s~ > t t~ s~ INFO: Process s~ s > t t~ g added to mirror process s s~ > t t~ g -13 processes with 76 diagrams generated in 0.123 s +13 processes with 76 diagrams generated in 0.124 s Total: 18 processes with 83 diagrams add process p p > t t~ j j @2 INFO: Checking for minimal orders which gives processes. @@ -378,7 +378,7 @@ INFO: Process s~ u~ > t t~ u~ s~ added to mirror process u~ s~ > t t~ u~ s~ INFO: Process s~ c~ > t t~ c~ s~ added to mirror process c~ s~ > t t~ c~ s~ INFO: Process s~ d~ > t t~ d~ s~ added to mirror process d~ s~ > t t~ d~ s~ INFO: Crossed process found for s~ s~ > t t~ s~ s~, reuse diagrams. -65 processes with 1119 diagrams generated in 1.648 s +65 processes with 1119 diagrams generated in 1.642 s Total: 83 processes with 1202 diagrams output madevent CODEGEN_mad_pp_tt012j --hel_recycling=False --vector_size=16384 --me_exporter=standalone_cudacpp Load PLUGIN.CUDACPP_SA_OUTPUT @@ -499,7 +499,7 @@ INFO: Creating files in directory P2_gg_ttxgg 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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -543,7 +543,7 @@ INFO: Creating files in directory P2_gg_ttxuux 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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -583,7 +583,7 @@ INFO: Creating files in directory P2_gu_ttxgu 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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -623,7 +623,7 @@ INFO: Creating files in directory P2_gux_ttxgux 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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -663,7 +663,7 @@ INFO: Creating files in directory P2_uux_ttxgg 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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -703,7 +703,7 @@ INFO: Creating files in directory P1_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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -745,7 +745,7 @@ INFO: Creating files in directory P2_uu_ttxuu 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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -781,7 +781,7 @@ INFO: Creating files in directory P2_uux_ttxuux 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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -817,7 +817,7 @@ INFO: Creating files in directory P2_uxux_ttxuxux 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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -853,7 +853,7 @@ INFO: Creating files in directory P2_uc_ttxuc 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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -889,7 +889,7 @@ INFO: Creating files in directory P2_uux_ttxccx 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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -925,7 +925,7 @@ INFO: Creating files in directory P2_ucx_ttxucx 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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -961,7 +961,7 @@ INFO: Creating files in directory P2_uxcx_ttxuxcx 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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -997,7 +997,7 @@ INFO: Creating files in directory P1_gu_ttxu 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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -1035,7 +1035,7 @@ INFO: Creating files in directory P1_gux_ttxux 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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -1073,7 +1073,7 @@ INFO: Creating files in directory P1_uux_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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -1111,7 +1111,7 @@ INFO: Creating files in directory P0_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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -1151,7 +1151,7 @@ INFO: Creating files in directory P0_uux_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 =  [export_v4.py at line 6180]  +DEBUG: process_exporter_cpp =  [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]  @@ -1183,15 +1183,15 @@ INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: u u~ > t t~ WEIGHTED<=2 INFO: Finding symmetric diagrams for subprocess group uux_ttx -Generated helas calls for 18 subprocesses (372 diagrams) in 1.143 s -Wrote files for 810 helas calls in 3.112 s +Generated helas calls for 18 subprocesses (372 diagrams) in 1.278 s +Wrote files for 810 helas calls in 3.082 s ALOHA: aloha starts to compute helicity amplitudes ALOHA: aloha creates VVV1 routines ALOHA: aloha creates FFV1 routines ALOHA: aloha creates VVVV1 routines ALOHA: aloha creates VVVV3 routines ALOHA: aloha creates VVVV4 routines -ALOHA: aloha creates 5 routines in 0.286 s +ALOHA: aloha creates 5 routines in 0.287 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 @@ -1199,7 +1199,7 @@ ALOHA: aloha creates FFV1 routines ALOHA: aloha creates VVVV1 routines ALOHA: aloha creates VVVV3 routines ALOHA: aloha creates VVVV4 routines -ALOHA: aloha creates 10 routines in 0.265 s +ALOHA: aloha creates 10 routines in 0.268 s VVV1 VVV1 FFV1 @@ -1516,6 +1516,6 @@ Type "launch" to generate events from this process, or see Run "open index.html" to see more information about this process. quit -real 0m8.957s -user 0m8.125s -sys 0m0.643s +real 0m9.100s +user 0m8.140s +sys 0m0.683s diff --git a/epochX/cudacpp/pp_tt012j.mad/bin/internal/lhe_parser.py b/epochX/cudacpp/pp_tt012j.mad/bin/internal/lhe_parser.py index cff8789e38..4c1d5f0d23 100755 --- a/epochX/cudacpp/pp_tt012j.mad/bin/internal/lhe_parser.py +++ b/epochX/cudacpp/pp_tt012j.mad/bin/internal/lhe_parser.py @@ -342,7 +342,12 @@ def next_event(self): text.append(line) if '' 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 @@ -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 @@ -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) @@ -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 @@ -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. @@ -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) @@ -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'', '', text) # remove pointless tag status = 'first' - + tags = [] if not isinstance(text, list): text = text.split('\n') @@ -1354,24 +1365,28 @@ def parse(self, text): if '' 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 '' in line: + if line.endswith(''): line = line.replace('','',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): @@ -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. @@ -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) diff --git a/epochX/cudacpp/pp_tt012j.mad/bin/internal/madevent_interface.py b/epochX/cudacpp/pp_tt012j.mad/bin/internal/madevent_interface.py index b70b548e53..920e07a926 100755 --- a/epochX/cudacpp/pp_tt012j.mad/bin/internal/madevent_interface.py +++ b/epochX/cudacpp/pp_tt012j.mad/bin/internal/madevent_interface.py @@ -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') @@ -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')