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 7f4c11f820..dd8c14a54f 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 @@ -14,7 +14,7 @@ Running MG5 in debug mode * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect 2023-12-23 * +* VERSION 3.6.0_lo_vect 2024-06-17 * * * * WARNING: UNKNOWN DEVELOPMENT VERSION. * * WARNING: DO NOT USE FOR PRODUCTION * @@ -45,15 +45,10 @@ Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (inclu Note that you can still compile and run aMC@NLO with the built-in PDFs MG5_aMC> set lhapdf /PATH/TO/lhapdf-config -None does not seem to correspond to a valid lhapdf-config executable. -Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config). -Note that you can still compile and run aMC@NLO with the built-in PDFs - MG5_aMC> set lhapdf /PATH/TO/lhapdf-config - Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt -import /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu.mg +import /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu.mg The import format was not given, so we guess it as command set stdout_level DEBUG set output information to level: 10 @@ -62,7 +57,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.005466938018798828  +DEBUG: model prefixing takes 0.005581378936767578  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  @@ -158,20 +153,20 @@ INFO: Process has 2 diagrams Total: 1 processes with 2 diagrams output madevent_simd ../TMPOUT/CODEGEN_mad_ee_mumu --hel_recycling=False --vector_size=32 Load PLUGIN.CUDACPP_OUTPUT -Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.5.3_lo_vect. +Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.6.0_lo_vect. It has been validated for the last time with version: 3.5.2 Output will be done with PLUGIN: CUDACPP_OUTPUT Addition matrix-element will be done with PLUGIN: CUDACPP_OUTPUT +DEBUG: opt['output_options']['vector_size'] =  32 [export_v4.py at line 4334]  Output will be done with PLUGIN: CUDACPP_OUTPUT -DEBUG: cformat =  standalone_simd [export_cpp.py at line 3070]  DEBUG: Entering PLUGIN_ProcessExporter.__init__ (initialise the exporter) [output.py at line 165]  INFO: initialize a new directory: CODEGEN_mad_ee_mumu INFO: remove old information in CODEGEN_mad_ee_mumu DEBUG: Entering PLUGIN_ProcessExporter.copy_template (initialise the directory) [output.py at line 170]  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu  -INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/Cards  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/SubProcesses  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu  +INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/Cards  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/SubProcesses  INFO: Organizing processes into subprocess groups INFO: Generating Helas calls for process: e+ e- > mu+ mu- WEIGHTED<=4 @1 INFO: Processing color information for process: e+ e- > mu+ mu- @1 @@ -181,30 +176,25 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2] [export_cpp.py at line 711]  -DEBUG: subproc_number =  0 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  -WARNING: vector code for lepton pdf not implemented. We removed the option to run dressed lepton  INFO: Generating Feynman diagrams for Process: e+ e- > mu+ mu- WEIGHTED<=4 @1 INFO: Finding symmetric diagrams for subprocess group epem_mupmum -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/SubProcesses/P1_epem_mupmum [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  2 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2} [model_handling.py at line 1548]  Generated helas calls for 1 subprocesses (2 diagrams) in 0.004 s -Wrote files for 8 helas calls in 0.081 s +Wrote files for 8 helas calls in 0.073 s +DEBUG: self.vector_size =  32 [export_v4.py at line 7023]  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.203 s +ALOHA: aloha creates 3 routines in 0.206 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 FFV2_4 routines -ALOHA: aloha creates 7 routines in 0.258 s +ALOHA: aloha creates 7 routines in 0.262 s FFV1 FFV1 FFV2 @@ -213,38 +203,40 @@ ALOHA: aloha creates 7 routines in 0.258 s FFV4 FFV2_4 FFV2_4 -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/src/./HelAmps_sm.h -INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/src/. +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/src/./HelAmps_sm.h +INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/src/. super_write_set_parameters_onlyfixMajorana (hardcoded=False) super_write_set_parameters_onlyfixMajorana (hardcoded=True) -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/src/./Parameters_sm.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/src/./Parameters_sm.cc +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/src/./Parameters_sm.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/src/./Parameters_sm.cc INFO: Created files Parameters_sm.h and Parameters_sm.cc in directory -INFO: /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/src/. and /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/src/. +INFO: /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/src/. and /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/src/. The option zerowidth_tchannel is modified [True] but will not be written in the configuration files. If you want to make this value the default for future session, you can run 'save options --all' -save configuration file to /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/Cards/me5_configuration.txt +save configuration file to /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/Cards/me5_configuration.txt INFO: Use Fortran compiler gfortran INFO: Use c++ compiler g++ INFO: Generate jpeg diagrams INFO: Generate web pages -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common -patching file Source/genps.inc +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common patching file SubProcesses/makefile -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/SubProcesses/P1_epem_mupmum; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/SubProcesses/P1_epem_mupmum; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #2 succeeded at 242 (offset 9 lines). +Hunk #2 succeeded at 236 (offset 22 lines). DEBUG: p.returncode =  0 [output.py at line 258]  -Output to directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu done. +Output to directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu done. Type "launch" to generate events from this process, or see -/data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/README +/data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/README Run "open index.html" to see more information about this process. quit -real 0m2.059s -user 0m1.802s -sys 0m0.254s +real 0m2.540s +user 0m1.832s +sys 0m0.262s Code generation completed in 2 seconds ************************************************************ * * @@ -258,7 +250,7 @@ Code generation completed in 2 seconds * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect * +* VERSION 3.6.0_lo_vect * * * * The MadGraph5_aMC@NLO Development Team - Find us at * * https://server06.fynu.ucl.ac.be/projects/madgraph * @@ -266,9 +258,9 @@ Code generation completed in 2 seconds * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt @@ -288,7 +280,7 @@ launch in debug mode * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect * +* VERSION 3.6.0_lo_vect * * * * The MadGraph5_aMC@NLO Development Team - Find us at * * https://server06.fynu.ucl.ac.be/projects/madgraph * @@ -296,9 +288,9 @@ launch in debug mode * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt diff --git a/epochX/cudacpp/ee_mumu.mad/Cards/me5_configuration.txt b/epochX/cudacpp/ee_mumu.mad/Cards/me5_configuration.txt index cdeedc7863..4f5079f78a 100644 --- a/epochX/cudacpp/ee_mumu.mad/Cards/me5_configuration.txt +++ b/epochX/cudacpp/ee_mumu.mad/Cards/me5_configuration.txt @@ -116,6 +116,7 @@ # cluster_type = condor # cluster_queue = madgraph # cluster_size = 150 +# cluster_walltime = # time in minute for slurm and second for condor (not supported for other scheduller) #! Path to a node directory to avoid direct writing on the central disk #! Note that condor clusters avoid direct writing by default (therefore this @@ -234,7 +235,7 @@ # pineappl = pineappl -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo # MG5 MAIN DIRECTORY -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo diff --git a/epochX/cudacpp/ee_mumu.mad/Cards/param_card.dat b/epochX/cudacpp/ee_mumu.mad/Cards/param_card.dat index caf4a67ea8..bb150ef10d 100644 --- a/epochX/cudacpp/ee_mumu.mad/Cards/param_card.dat +++ b/epochX/cudacpp/ee_mumu.mad/Cards/param_card.dat @@ -1,5 +1,5 @@ ###################################################################### -## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL #### +## PARAM_CARD AUTOMATICALLY GENERATED BY MG5 FOLLOWING UFO MODEL #### ###################################################################### ## ## ## Width set on Auto will be computed following the information ## diff --git a/epochX/cudacpp/ee_mumu.mad/Cards/param_card_default.dat b/epochX/cudacpp/ee_mumu.mad/Cards/param_card_default.dat index caf4a67ea8..bb150ef10d 100644 --- a/epochX/cudacpp/ee_mumu.mad/Cards/param_card_default.dat +++ b/epochX/cudacpp/ee_mumu.mad/Cards/param_card_default.dat @@ -1,5 +1,5 @@ ###################################################################### -## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL #### +## PARAM_CARD AUTOMATICALLY GENERATED BY MG5 FOLLOWING UFO MODEL #### ###################################################################### ## ## ## Width set on Auto will be computed following the information ## diff --git a/epochX/cudacpp/ee_mumu.mad/Cards/proc_card_mg5.dat b/epochX/cudacpp/ee_mumu.mad/Cards/proc_card_mg5.dat index 9b246807bc..694519b041 100644 --- a/epochX/cudacpp/ee_mumu.mad/Cards/proc_card_mg5.dat +++ b/epochX/cudacpp/ee_mumu.mad/Cards/proc_card_mg5.dat @@ -8,7 +8,7 @@ #* * * * #* * #* * -#* VERSION 3.5.3_lo_vect 2023-12-23 * +#* VERSION 3.6.0_lo_vect 2024-06-17 * #* * #* WARNING: UNKNOWN DEVELOPMENT VERSION. * #* WARNING: DO NOT USE FOR PRODUCTION * diff --git a/epochX/cudacpp/ee_mumu.mad/Cards/reweight_card_default.dat b/epochX/cudacpp/ee_mumu.mad/Cards/reweight_card_default.dat index ace534ae02..5cc65fe095 100644 --- a/epochX/cudacpp/ee_mumu.mad/Cards/reweight_card_default.dat +++ b/epochX/cudacpp/ee_mumu.mad/Cards/reweight_card_default.dat @@ -19,8 +19,16 @@ change mode NLO # Define type of Reweighting. For LO sample this command # has no effect since only "LO" mode is allowed. + +#uncomment if you do not want to overwrite the reweight file of Sudakov in rw_me +#change rwgt_dir /PATH_MG5_BRANCH/NAME_FOLDER + +#uncomment if you want to use Sudakov Reweight +#change include_sudakov True + launch + # SPECIFY A PATH OR USE THE SET COMMAND LIKE THIS: # set sminputs 1 130 # modify 1/alpha_EW diff --git a/epochX/cudacpp/ee_mumu.mad/Cards/run_card.dat b/epochX/cudacpp/ee_mumu.mad/Cards/run_card.dat index 69a8fac41b..74f70b567b 100644 --- a/epochX/cudacpp/ee_mumu.mad/Cards/run_card.dat +++ b/epochX/cudacpp/ee_mumu.mad/Cards/run_card.dat @@ -145,7 +145,7 @@ # Maximum and minimum absolute rapidity (for max, -1 means no cut) * #********************************************************************* 2.5 = etal ! max rap for the charged leptons - 0.0 = etalmin ! main rap for the charged leptons + 0.0 = etalmin ! min rap for the charged leptons {} = eta_min_pdg ! rap cut for other particles (use pdg code). Applied on particle and anti-particle {} = eta_max_pdg ! rap cut for other particles (syntax e.g. {6: 2.5, 23: 5}) #********************************************************************* @@ -199,6 +199,7 @@ systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++] ['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule + #*********************************************************************** # SIMD/GPU configuration for the CUDACPP plugin #************************************************************************ diff --git a/epochX/cudacpp/ee_mumu.mad/Cards/run_card_default.dat b/epochX/cudacpp/ee_mumu.mad/Cards/run_card_default.dat index 1f7d945f88..83399afb42 100644 --- a/epochX/cudacpp/ee_mumu.mad/Cards/run_card_default.dat +++ b/epochX/cudacpp/ee_mumu.mad/Cards/run_card_default.dat @@ -145,7 +145,7 @@ # Maximum and minimum absolute rapidity (for max, -1 means no cut) * #********************************************************************* 2.5 = etal ! max rap for the charged leptons - 0.0 = etalmin ! main rap for the charged leptons + 0.0 = etalmin ! min rap for the charged leptons {} = eta_min_pdg ! rap cut for other particles (use pdg code). Applied on particle and anti-particle {} = eta_max_pdg ! rap cut for other particles (syntax e.g. {6: 2.5, 23: 5}) #********************************************************************* @@ -199,6 +199,7 @@ systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++] ['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule + #*********************************************************************** # SIMD/GPU configuration for the CUDACPP plugin #************************************************************************ diff --git a/epochX/cudacpp/ee_mumu.mad/MGMEVersion.txt b/epochX/cudacpp/ee_mumu.mad/MGMEVersion.txt index 9d3a5c0ba0..a806d3938c 100644 --- a/epochX/cudacpp/ee_mumu.mad/MGMEVersion.txt +++ b/epochX/cudacpp/ee_mumu.mad/MGMEVersion.txt @@ -1 +1 @@ -3.5.3_lo_vect \ No newline at end of file +3.6.0_lo_vect \ No newline at end of file diff --git a/epochX/cudacpp/ee_mumu.mad/Source/DHELAS/aloha_functions.f b/epochX/cudacpp/ee_mumu.mad/Source/DHELAS/aloha_functions.f index 975725737f..47699fa614 100644 --- a/epochX/cudacpp/ee_mumu.mad/Source/DHELAS/aloha_functions.f +++ b/epochX/cudacpp/ee_mumu.mad/Source/DHELAS/aloha_functions.f @@ -351,7 +351,7 @@ subroutine oxxxxx(p,fmass,nhel,nsf , fo) fo(6) = ip * sqm(abs(im)) else - pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2)) +c pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2)) sf(1) = dble(1+nsf+(1-nsf)*nh)*rHalf sf(2) = dble(1+nsf-(1-nsf)*nh)*rHalf omega(1) = dsqrt(p(0)+pp) @@ -2054,7 +2054,7 @@ subroutine CombineAmp(nb, ihels, iwfcts, W1, Wall, Amp) enddo return end - + subroutine CombineAmpS(nb, ihels, iwfcts, W1, Wall, Amp) integer nb ! size of the vectors diff --git a/epochX/cudacpp/ee_mumu.mad/Source/MODEL/couplings.f b/epochX/cudacpp/ee_mumu.mad/Source/MODEL/couplings.f index f3b620ab58..04d6bb5333 100644 --- a/epochX/cudacpp/ee_mumu.mad/Source/MODEL/couplings.f +++ b/epochX/cudacpp/ee_mumu.mad/Source/MODEL/couplings.f @@ -10,18 +10,27 @@ SUBROUTINE COUP() PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + LOGICAL UPDATELOOP COMMON /TO_UPDATELOOP/UPDATELOOP INCLUDE 'input.inc' - INCLUDE '../vector.inc' + + INCLUDE 'coupl.inc' READLHA = .TRUE. INCLUDE 'intparam_definition.inc' CALL COUP1() + IF (UPDATELOOP) THEN + + CALL COUP2() + + ENDIF + C couplings needed to be evaluated points by points C - CALL COUP2(1) + CALL COUP3(1) RETURN END @@ -47,7 +56,11 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) INCLUDE '../maxparticles.inc' INCLUDE '../cuts.inc' + + INCLUDE '../vector.inc' + + INCLUDE '../run.inc' DOUBLE PRECISION ALPHAS @@ -65,7 +78,7 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) couplings needed to be evaluated points by points C ALL_G(VECID) = G - CALL COUP2(VECID) + CALL COUP3(VECID) RETURN END @@ -80,7 +93,9 @@ SUBROUTINE UPDATE_AS_PARAM2(MU_R2,AS2 ,VECID) INTEGER VECID INCLUDE 'model_functions.inc' INCLUDE 'input.inc' + INCLUDE '../vector.inc' + INCLUDE 'coupl.inc' DOUBLE PRECISION MODEL_SCALE COMMON /MODEL_SCALE/MODEL_SCALE diff --git a/epochX/cudacpp/ee_mumu.mad/Source/MODEL/couplings1.f b/epochX/cudacpp/ee_mumu.mad/Source/MODEL/couplings1.f index 5272ec5da5..e4dad93f44 100644 --- a/epochX/cudacpp/ee_mumu.mad/Source/MODEL/couplings1.f +++ b/epochX/cudacpp/ee_mumu.mad/Source/MODEL/couplings1.f @@ -7,12 +7,13 @@ SUBROUTINE COUP1( ) IMPLICIT NONE INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' GC_3 = -(MDL_EE*MDL_COMPLEXI) GC_50 = -(MDL_CW*MDL_EE*MDL_COMPLEXI)/(2.000000D+00*MDL_SW) diff --git a/epochX/cudacpp/ee_mumu.mad/Source/MODEL/couplings2.f b/epochX/cudacpp/ee_mumu.mad/Source/MODEL/couplings2.f index 28daa93647..30f3a04e3b 100644 --- a/epochX/cudacpp/ee_mumu.mad/Source/MODEL/couplings2.f +++ b/epochX/cudacpp/ee_mumu.mad/Source/MODEL/couplings2.f @@ -2,16 +2,17 @@ c written by the UFO converter ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc - SUBROUTINE COUP2( VECID) + SUBROUTINE COUP2( ) IMPLICIT NONE - INTEGER VECID + INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' END diff --git a/epochX/cudacpp/ee_mumu.mad/Source/MODEL/couplings3.f b/epochX/cudacpp/ee_mumu.mad/Source/MODEL/couplings3.f index 2cebce3012..d691cab086 100644 --- a/epochX/cudacpp/ee_mumu.mad/Source/MODEL/couplings3.f +++ b/epochX/cudacpp/ee_mumu.mad/Source/MODEL/couplings3.f @@ -7,11 +7,12 @@ SUBROUTINE COUP3( VECID) IMPLICIT NONE INTEGER VECID INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' END diff --git a/epochX/cudacpp/ee_mumu.mad/Source/MODEL/makefile b/epochX/cudacpp/ee_mumu.mad/Source/MODEL/makefile index 0b24445a53..5a5681d220 100644 --- a/epochX/cudacpp/ee_mumu.mad/Source/MODEL/makefile +++ b/epochX/cudacpp/ee_mumu.mad/Source/MODEL/makefile @@ -3,7 +3,7 @@ # Makefile for model library # # ---------------------------------------------------------------------------- - +# template models/template_files/makefile_madevent # Check for ../make_opts ifeq ($(wildcard ../make_opts), ../make_opts) include ../make_opts diff --git a/epochX/cudacpp/ee_mumu.mad/Source/MODEL/makeinc.inc b/epochX/cudacpp/ee_mumu.mad/Source/MODEL/makeinc.inc index 6e2743eac1..4a9e1b2cc5 100644 --- a/epochX/cudacpp/ee_mumu.mad/Source/MODEL/makeinc.inc +++ b/epochX/cudacpp/ee_mumu.mad/Source/MODEL/makeinc.inc @@ -2,4 +2,4 @@ # written by the UFO converter ############################################################################# -MODEL = couplings.o lha_read.o printout.o rw_para.o model_functions.o couplings1.o couplings2.o \ No newline at end of file +MODEL = couplings.o lha_read.o printout.o rw_para.o model_functions.o couplings1.o couplings2.o couplings3.o \ No newline at end of file diff --git a/epochX/cudacpp/ee_mumu.mad/Source/MODEL/printout.f b/epochX/cudacpp/ee_mumu.mad/Source/MODEL/printout.f index 18b8f35b08..3e195b03a2 100644 --- a/epochX/cudacpp/ee_mumu.mad/Source/MODEL/printout.f +++ b/epochX/cudacpp/ee_mumu.mad/Source/MODEL/printout.f @@ -1,3 +1,7 @@ +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +c written by the UFO converter +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc + c************************************************************************ c** ** c** MadGraph/MadEvent Interface to FeynRules ** @@ -9,7 +13,7 @@ subroutine printout implicit none - include '../vector.inc' ! defines VECSIZE_MEMMAX + include '../vector.inc' ! VECSIZE_MEMMAX (needed by coupl.inc) include 'coupl.inc' ! needs VECSIZE_MEMMAX (defined in vector.inc) include 'input.inc' diff --git a/epochX/cudacpp/ee_mumu.mad/Source/PDF/eepdf.inc b/epochX/cudacpp/ee_mumu.mad/Source/PDF/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/ee_mumu.mad/Source/PDF/eepdf.inc +++ b/epochX/cudacpp/ee_mumu.mad/Source/PDF/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/ee_mumu.mad/Source/PDF/pdfwrap_emela.f b/epochX/cudacpp/ee_mumu.mad/Source/PDF/pdfwrap_emela.f index bce10819d5..da1e4e2276 100644 --- a/epochX/cudacpp/ee_mumu.mad/Source/PDF/pdfwrap_emela.f +++ b/epochX/cudacpp/ee_mumu.mad/Source/PDF/pdfwrap_emela.f @@ -13,7 +13,7 @@ SUBROUTINE PDFWRAP DOUBLE PRECISION VALUE(20) REAL*8 ALPHASPDF EXTERNAL ALPHASPDF - ! PDFs with beamstrahlung use specific initialisation/evaluation +C PDFs with beamstrahlung use specific initialisation/evaluation LOGICAL HAS_BSTRAHL COMMON /TO_HAS_BS/ HAS_BSTRAHL diff --git a/epochX/cudacpp/ee_mumu.mad/Source/PDF/pdg2pdf.f b/epochX/cudacpp/ee_mumu.mad/Source/PDF/pdg2pdf.f index 46f321e66b..2e7343a69b 100644 --- a/epochX/cudacpp/ee_mumu.mad/Source/PDF/pdg2pdf.f +++ b/epochX/cudacpp/ee_mumu.mad/Source/PDF/pdg2pdf.f @@ -108,7 +108,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) else if (abs(ipart).eq.10) then ipart = sign(1,ipart) * 15 endif - pdg2pdf = 0d0 + pdg2pdf = 0d0 if (beamid.lt.0) then ih_local = ipart @@ -122,7 +122,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) endif do i_ee = 1, n_ee ee_components(i_ee) = compute_eepdf(x,omx_ee(iabs(beamid)),xmu,i_ee,ipart,ih_local) - enddo + enddo pdg2pdf = ee_components(1) ! temporary to test pdf load c write(*,*), x, beamid ,omx_ee(iabs(beamid)),xmu,1,ipart,ih_local,pdg2pdf return diff --git a/epochX/cudacpp/ee_mumu.mad/Source/dsample.f b/epochX/cudacpp/ee_mumu.mad/Source/dsample.f index 09d482b45a..b0bc0547ad 100644 --- a/epochX/cudacpp/ee_mumu.mad/Source/dsample.f +++ b/epochX/cudacpp/ee_mumu.mad/Source/dsample.f @@ -204,6 +204,9 @@ subroutine sample_full(ndim,ncall,itmax,itmin,dsig,ninvar,nconfigs,VECSIZE_USED) if (VECSIZE_USED.le.1) then all_fx(1) = dsig(all_p, all_wgt,0) + ivec=0 + ilock=0 + iwarp=1 else c Here "i" is the position in the full grid of the event do i=(iwarp-1)*WARP_SIZE+1, iwarp*warp_size diff --git a/epochX/cudacpp/ee_mumu.mad/Source/eepdf.inc b/epochX/cudacpp/ee_mumu.mad/Source/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/ee_mumu.mad/Source/eepdf.inc +++ b/epochX/cudacpp/ee_mumu.mad/Source/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/ee_mumu.mad/Source/genps.inc b/epochX/cudacpp/ee_mumu.mad/Source/genps.inc index af7e0efbce..ef78e7e812 100644 --- a/epochX/cudacpp/ee_mumu.mad/Source/genps.inc +++ b/epochX/cudacpp/ee_mumu.mad/Source/genps.inc @@ -29,9 +29,8 @@ c parameter (max_host=99,maxplace=199,maxpoints=100,maxans=50) c************************************************************************* c Parameters for helicity sums in matrixN.f c************************************************************************* - REAL*8 LIMHEL -c PARAMETER(LIMHEL=1e-8) ! ME threshold for helicity filtering (Fortran default) - PARAMETER(LIMHEL=0) ! ME threshold for helicity filtering (force Fortran to mimic cudacpp, see #419) +c REAL*8 LIMHEL +c PARAMETER(LIMHEL=1e-8) -> pass in the run_card.dat INTEGER MAXTRIES PARAMETER(MAXTRIES=25) C To pass the helicity configuration chosen by the DiscreteSampler to diff --git a/epochX/cudacpp/ee_mumu.mad/Source/run.inc b/epochX/cudacpp/ee_mumu.mad/Source/run.inc index 5433a23583..81c8df6bf2 100644 --- a/epochX/cudacpp/ee_mumu.mad/Source/run.inc +++ b/epochX/cudacpp/ee_mumu.mad/Source/run.inc @@ -106,4 +106,7 @@ c double precision tmin_for_channel integer sde_strat ! 1 means standard single diagram enhancement strategy, c 2 means approximation by the denominator of the propagator - common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat \ No newline at end of file + common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat +c + double precision limhel + common/to_limhel/limhel diff --git a/epochX/cudacpp/ee_mumu.mad/Source/run_card.inc b/epochX/cudacpp/ee_mumu.mad/Source/run_card.inc index 97eaca8ead..80d5ae41aa 100644 --- a/epochX/cudacpp/ee_mumu.mad/Source/run_card.inc +++ b/epochX/cudacpp/ee_mumu.mad/Source/run_card.inc @@ -88,6 +88,8 @@ DSQRT_SHAT = 0.000000000000000D+00 + LIMHEL = 0.000000000000000D+00 + PTJ = 2.000000000000000D+01 PTB = 0.000000000000000D+00 diff --git a/epochX/cudacpp/ee_mumu.mad/Source/setrun.f b/epochX/cudacpp/ee_mumu.mad/Source/setrun.f index 9e9ef7fdbd..dc6caef748 100644 --- a/epochX/cudacpp/ee_mumu.mad/Source/setrun.f +++ b/epochX/cudacpp/ee_mumu.mad/Source/setrun.f @@ -162,9 +162,21 @@ subroutine setrun C Fill common block for Les Houches init info do i=1,2 if(lpp(i).eq.1.or.lpp(i).eq.2) then - idbmup(i)=2212 + if (nb_proton(i).eq.1.and.nb_neutron(i).eq.0) then + idbmup(i)=2212 + elseif (nb_proton(i).eq.0.and.nb_neutron(i).eq.1) then + idbmup(i)=2112 + else + idbmup(i) = 1000000000 + (nb_proton(i)+nb_neutron(i))*10 + $ + nb_proton(i)*10000 + endif elseif(lpp(i).eq.-1.or.lpp(i).eq.-2) then - idbmup(i)=-2212 + if (nb_proton(i).eq.1.and.nb_neutron(i).eq.0) then + idbmup(i)=-2212 + else + idbmup(i) = -1*(1000000000 + (nb_proton(i)+nb_neutron(i))*10 + $ + nb_proton(i)*10000) + endif elseif(lpp(i).eq.3) then idbmup(i)=11 elseif(lpp(i).eq.-3) then diff --git a/epochX/cudacpp/ee_mumu.mad/SubProcesses/MGVersion.txt b/epochX/cudacpp/ee_mumu.mad/SubProcesses/MGVersion.txt index 9d3a5c0ba0..a806d3938c 100644 --- a/epochX/cudacpp/ee_mumu.mad/SubProcesses/MGVersion.txt +++ b/epochX/cudacpp/ee_mumu.mad/SubProcesses/MGVersion.txt @@ -1 +1 @@ -3.5.3_lo_vect \ No newline at end of file +3.6.0_lo_vect \ No newline at end of file diff --git a/epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum/CPPProcess.cc b/epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum/CPPProcess.cc index 2ec087a2a6..b6fb333a80 100644 --- a/epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum/CPPProcess.cc +++ b/epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum/CPPProcess.h b/epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum/CPPProcess.h index fd18ce5fcd..d236db5397 100644 --- a/epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum/CPPProcess.h +++ b/epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum/auto_dsig.f b/epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum/auto_dsig.f index 0eaee07165..3c54117efb 100644 --- a/epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum/auto_dsig.f +++ b/epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1134,11 +1134,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=16) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1148,32 +1149,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=16) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=16) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum/auto_dsig1.f b/epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum/auto_dsig1.f index 67089678cd..252b6d4e2b 100644 --- a/epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum/auto_dsig1.f +++ b/epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -54,8 +54,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD DOUBLE PRECISION DUMMY_COMPONENTS(N_EE) - DOUBLE PRECISION EP1_COMPONENTS(N_EE) - DOUBLE PRECISION EM2_COMPONENTS(N_EE) + DOUBLE PRECISION EP1_COMPONENTS(N_EE ) + DOUBLE PRECISION EM2_COMPONENTS(N_EE ) INTEGER I_EE C @@ -104,6 +104,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -141,7 +143,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) QSCALE=DSQRT(Q2FACT(IB(1))) ENDIF EP1=PDG2PDF(LPP(IB(1)),-11, IB(1),XBK(IB(1)), QSCALE) - IF (PDLABEL.EQ.'dressed') EP1_COMPONENTS(1:4) = + IF (PDLABEL.EQ.'dressed') EP1_COMPONENTS(1:4 ) = $ EE_COMPONENTS(1:4) ENDIF IF (ABS(LPP(IB(2))).GE.1) THEN @@ -150,7 +152,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) QSCALE=DSQRT(Q2FACT(IB(2))) ENDIF EM2=PDG2PDF(LPP(IB(2)),11, IB(2),XBK(IB(2)), QSCALE) - IF (PDLABEL.EQ.'dressed') EM2_COMPONENTS(1:4) = + IF (PDLABEL.EQ.'dressed') EM2_COMPONENTS(1:4 ) = $ EE_COMPONENTS(1:4) ENDIF PD(0) = 0D0 @@ -226,7 +228,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -290,13 +292,13 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD DOUBLE PRECISION DUMMY_COMPONENTS(N_EE) - DOUBLE PRECISION EP1_COMPONENTS(N_EE) - DOUBLE PRECISION EM2_COMPONENTS(N_EE) + DOUBLE PRECISION EP1_COMPONENTS(N_EE , VECSIZE_MEMMAX) + DOUBLE PRECISION EM2_COMPONENTS(N_EE , VECSIZE_MEMMAX) INTEGER I_EE C @@ -332,9 +334,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -350,6 +353,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -381,11 +386,15 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C LP=SIGN(1,LPP(IB(1))) EP1(IVEC)=PDG2PDF(LPP(IB(1)),-11, IB(1),ALL_XBK(IB(1),IVEC) $ ,DSQRT(ALL_Q2FACT(IB(1), IVEC))) + IF (PDLABEL.EQ.'dressed') EP1_COMPONENTS(1:4 , IVEC) = + $ EE_COMPONENTS(1:4) ENDIF IF (ABS(LPP(IB(2))).GE.1) THEN C LP=SIGN(1,LPP(IB(2))) EM2(IVEC)=PDG2PDF(LPP(IB(2)),11, IB(2),ALL_XBK(IB(2),IVEC) $ ,DSQRT(ALL_Q2FACT(IB(2), IVEC))) + IF (PDLABEL.EQ.'dressed') EM2_COMPONENTS(1:4 , IVEC) = + $ EE_COMPONENTS(1:4) ENDIF ENDDO ! IWARP LOOP ENDDO ! CURRWARP LOOP @@ -394,6 +403,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, IPROC=IPROC+1 ! e+ e- > mu+ mu- DO IVEC=1, VECSIZE_USED ALL_PD(IPROC,IVEC)=EP1(IVEC)*EM2(IVEC) + IF (PDLABEL.EQ.'dressed')ALL_PD(IPROC,IVEC) + $ =EE_COMP_PROD(EP1_COMPONENTS(1,IVEC),EM2_COMPONENTS(1,IVEC)) ALL_PD(0,IVEC)=ALL_PD(0,IVEC)+DABS(ALL_PD(IPROC,IVEC)) ENDDO @@ -497,11 +508,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -601,9 +607,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -716,3 +724,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum/driver.f b/epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum/driver.f index 27a6e46742..ec5722702a 100644 --- a/epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum/driver.f +++ b/epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum/matrix1.f b/epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum/matrix1.f index b1a73743d7..986be9742a 100644 --- a/epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum/matrix1.f +++ b/epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -23,6 +23,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=16) INTEGER NGRAPHS @@ -46,8 +48,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -56,26 +58,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -86,7 +85,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -96,26 +94,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,4) /-1, 1, 1,-1/ DATA (NHEL(I, 2),I=1,4) /-1, 1, 1, 1/ DATA (NHEL(I, 3),I=1,4) /-1, 1,-1,-1/ @@ -143,8 +140,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -153,11 +149,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=1 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=1 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -167,12 +163,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -193,7 +188,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -222,35 +218,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -331,7 +325,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/ee_mumu.mad/SubProcesses/cluster.f b/epochX/cudacpp/ee_mumu.mad/SubProcesses/cluster.f index 649e46f4e9..b8995283ed 100644 --- a/epochX/cudacpp/ee_mumu.mad/SubProcesses/cluster.f +++ b/epochX/cudacpp/ee_mumu.mad/SubProcesses/cluster.f @@ -552,6 +552,8 @@ logical function cluster(p, ivec) if (btest(mlevel,1)) $ write (*,*)'New event' + iwin = 0 + jwin = 0 cluster=.false. clustered=.false. do i=0,3 @@ -663,7 +665,8 @@ logical function cluster(p, ivec) c initialize graph storage igraphs(0)=0 nleft=nexternal -c cluster +c cluster + if (iwin.eq.0.or.jwin.eq.0) stop 21 do n=1,nexternal-2 c combine winner imocl(n)=imap(iwin,2)+imap(jwin,2) diff --git a/epochX/cudacpp/ee_mumu.mad/SubProcesses/proc_characteristics b/epochX/cudacpp/ee_mumu.mad/SubProcesses/proc_characteristics index 95773bcf0c..c43d2203f9 100644 --- a/epochX/cudacpp/ee_mumu.mad/SubProcesses/proc_characteristics +++ b/epochX/cudacpp/ee_mumu.mad/SubProcesses/proc_characteristics @@ -16,7 +16,9 @@ pdg_initial2 = [11] splitting_types = [] perturbation_order = [] - limitations = ['dressed_ee'] + limitations = [] + ew_sudakov = False hel_recycling = False single_color = True nlo_mixed_expansion = True + gauge = unitary diff --git a/epochX/cudacpp/ee_mumu.mad/SubProcesses/refine.sh b/epochX/cudacpp/ee_mumu.mad/SubProcesses/refine.sh index afb9b99ad1..b46170ba23 100644 --- a/epochX/cudacpp/ee_mumu.mad/SubProcesses/refine.sh +++ b/epochX/cudacpp/ee_mumu.mad/SubProcesses/refine.sh @@ -57,7 +57,11 @@ j=%(directory)s for((try=1;try<=16;try+=1)); do if [ "$keeplog" = true ] ; then + if [[ -e ../madevent ]];then ../madevent 2>&1 >> $k &1 >> $k &1 >> log.txt &1 >> log.txt &1 >> $k \w*)>') - pat_end=re.compile('\w*)>') + pat_begin=re.compile(r'<(?P\w*)>') + pat_end=re.compile(r'\w*)>') tag_to_file={'slha':'param_card.dat', 'mgruncard':'run_card.dat', @@ -319,7 +319,7 @@ def check_pid(self, pid2label): def get_lha_strategy(self): """get the lha_strategy: how the weight have to be handle by the shower""" - if not self["init"]: + if "init" not in self or not self["init"]: raise Exception("No init block define") data = self["init"].split('\n')[0].split() @@ -537,7 +537,8 @@ def charge_card(self, tag): self.param_card = param_card_reader.ParamCard(param_card) return self.param_card elif tag == 'mgruncard': - self.run_card = RunCard(self[tag], unknown_warning=False) + with misc.TMP_variable(RunCard, 'allow_scan', True): + self.run_card = RunCard(self[tag], consistency=False, unknow_warning=False) return self.run_card elif tag == 'mg5proccard': proc_card = self[tag].split('\n') @@ -976,6 +977,8 @@ class ConfigFile(dict): """ a class for storing/dealing with input file. """ + allow_scan = False + def __init__(self, finput=None, **opt): """initialize a new instance. input can be an instance of MadLoopParam, a file, a path to a file, or simply Nothing""" @@ -993,6 +996,7 @@ def __init__(self, finput=None, **opt): # Initialize it with all the default value self.user_set = set() self.auto_set = set() + self.scan_set = {} #key -> type of list (int/float/bool/str/... for scan self.system_only = set() self.lower_to_case = {} self.list_parameter = {} #key -> type of list (int/float/bool/str/... @@ -1109,6 +1113,8 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): #1. check if the parameter is set to auto -> pass it to special if lower_name in self: targettype = type(dict.__getitem__(self, lower_name)) + if lower_name in self.scan_set: + targettype = self.scan_set[lower_name] if targettype != str and isinstance(value, str) and value.lower() == 'auto': self.auto_set.add(lower_name) if lower_name in self.user_set: @@ -1118,13 +1124,26 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): return elif lower_name in self.auto_set: self.auto_set.remove(lower_name) - + + + #1. check if the parameter is set to auto -> pass it to special + scan_targettype = None + if self.allow_scan and isinstance(value, str) and value.strip().startswith('scan'): + if lower_name in self.user_set: + self.user_set.remove(lower_name) + self.scan_set[lower_name] = type(self[lower_name]) + dict.__setitem__(self, lower_name, value) + #keep old value. + self.post_set(lower_name,value, change_userdefine, raiseerror) + return + elif lower_name in self.scan_set: + scan_targettype = self.scan_set[lower_name] + del self.scan_set[lower_name] + # 2. Find the type of the attribute that we want if lower_name in self.list_parameter: targettype = self.list_parameter[lower_name] - - if isinstance(value, str): # split for each comma/space value = value.strip() @@ -1248,8 +1267,11 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): if change_userdefine: self.user_set.add(lower_name) return self.post_set(lower_name, None, change_userdefine, raiseerror) - elif name in self: - targettype = type(self[name]) + elif name in self: + if scan_targettype: + targettype = targettype + else: + targettype = type(self[name]) else: logger.debug('Trying to add argument %s in %s. ' % (name, self.__class__.__name__) +\ 'This argument is not defined by default. Please consider adding it.') @@ -1262,7 +1284,7 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): if change_userdefine: self.user_set.add(lower_name) return self.post_set(lower_name, None, change_userdefine, raiseerror) - + value = self.format_variable(value, targettype, name=name) #check that the value is allowed: if lower_name in self.allowed_value and '*' not in self.allowed_value[lower_name]: @@ -1444,7 +1466,7 @@ def format_variable(value, targettype, name="unknown"): value =int(value[:-1]) * convert[value[-1]] elif '/' in value or '*' in value: try: - split = re.split('(\*|/)',value) + split = re.split(r'(\*|/)',value) v = float(split[0]) for i in range((len(split)//2)): if split[2*i+1] == '*': @@ -1482,7 +1504,7 @@ def format_variable(value, targettype, name="unknown"): value = float(value) except ValueError: try: - split = re.split('(\*|/)',value) + split = re.split(r'(\*|/)',value) v = float(split[0]) for i in range((len(split)//2)): if split[2*i+1] == '*': @@ -1491,7 +1513,10 @@ def format_variable(value, targettype, name="unknown"): v /= float(split[2*i+2]) except: v=0 - raise InvalidCmd("%s can not be mapped to a float" % value) + if "scan" in value: + raise InvalidCmd("%s is not supported here. Note that scan command can not be present simultaneously in the run_card and param_card." % value) + else: + raise InvalidCmd("%s can not be mapped to a float" % value) finally: value = v else: @@ -1737,10 +1762,12 @@ def default_setup(self): self.add_param('splitting_types',[], typelist=str) self.add_param('perturbation_order', [], typelist=str) self.add_param('limitations', [], typelist=str) + self.add_param('ew_sudakov', False) self.add_param('hel_recycling', False) self.add_param('single_color', True) self.add_param('nlo_mixed_expansion', True) - + self.add_param('gauge', 'U') + def read(self, finput): """Read the input file, this can be a path to a file, a file object, a str with the content of the file.""" @@ -3104,7 +3131,7 @@ def write(self, output_file, template=None, python_template=False, # do not write hidden parameter not hidden for this template # if python_template: - written = written.union(set(re.findall('\%\((\w*)\)s', open(template,'r').read(), re.M))) + written = written.union(set(re.findall(r'\%\((\w*)\)s', open(template,'r').read(), re.M))) to_write = to_write.union(set(self.hidden_param)) to_write = to_write.difference(written) @@ -3157,7 +3184,6 @@ def get_value_from_include(self, path, list_of_params, output_dir): if path does not exists return the current value in self for all parameter""" #WARNING DOES NOT HANDLE LIST/DICT so far - misc.sprint(output_dir, path) # handle case where file is missing if not os.path.exists(pjoin(output_dir,path)): misc.sprint("include file not existing", pjoin(output_dir,path)) @@ -3259,7 +3285,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): text = open(path,'r').read() #misc.sprint(text) f77_type = ['real*8', 'integer', 'double precision', 'logical'] - pattern = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I+re.M) for fct in pattern.findall(text): fsock = file_writers.FortranWriter(tmp,'w') @@ -3287,6 +3313,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): starttext = open(pjoin(outdir, path+'.orig')).read() fsock.remove_routine(starttext, to_mod[path][0]) for text in to_mod[path][1]: + text = self.retro_compatible_custom_fct(text) fsock.writelines(text) fsock.close() if not filecmp.cmp(pjoin(outdir, path), pjoin(outdir, path+'.tmp')): @@ -3303,7 +3330,33 @@ def edit_dummy_fct_from_file(self, filelist, outdir): files.mv(pjoin(outdir,path+'.orig'), pjoin(outdir, path)) + @staticmethod + def retro_compatible_custom_fct(lines, mode=None): + f77_type = ['real*8', 'integer', 'double precision', 'logical'] + function_pat = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + % {'type':'|'.join(f77_type)}, re.I+re.M) + include_pat = re.compile(r"\s+include\s+[\'\"]([\w\./]*)") + + assert isinstance(lines, list) + sol = [] + + if mode is None or 'vector.inc' in mode: + search = True + for i,line in enumerate(lines[:]): + if search and re.search(include_pat, line): + name = re.findall(include_pat, line)[0] + misc.sprint('DETECTED INCLUDE', name) + if 'vector.inc' in name: + search = False + if 'run.inc' in name: + sol.append(" include 'vector.inc'") + search = False + sol.append(line) + if re.search(function_pat, line): + misc.sprint("DETECTED FCT") + search = True + return sol def guess_entry_fromname(self, name, value): """ @@ -3346,7 +3399,7 @@ def update_typelist(value, name, opts): #handle metadata opts = {} forced_opts = [] - for key,val in re.findall("\<(?P[_\-\w]+)\=(?P[^>]*)\>", str(name)): + for key,val in re.findall(r"\<(?P[_\-\w]+)\=(?P[^>]*)\>", str(name)): forced_opts.append(key) if val in ['True', 'False']: opts[key] = eval(val) @@ -3681,11 +3734,22 @@ def write_autodef(self, output_dir, output_file=None): out = ["%s\n" %l for l in out] fsock.writelines(out) - @staticmethod - def get_idbmup(lpp): + def get_idbmup(self, lpp, beam=1): """return the particle colliding pdg code""" if lpp in (1,2, -1,-2): - return math.copysign(2212, lpp) + target = 2212 + if 'nb_proton1' in self: + nbp = self['nb_proton%s' % beam] + nbn = self['nb_neutron%s' % beam] + if nbp == 1 and nbn ==0: + target = 2212 + elif nbp==0 and nbn ==1: + target = 2112 + else: + target = 1000000000 + target += 10 * (nbp+nbn) + target += 10000 * nbp + return math.copysign(target, lpp) elif lpp in (3,-3): return math.copysign(11, lpp) elif lpp in (4,-4): @@ -3701,8 +3765,8 @@ def get_banner_init_information(self): the first line of the block of the lhe file.""" output = {} - output["idbmup1"] = self.get_idbmup(self['lpp1']) - output["idbmup2"] = self.get_idbmup(self['lpp2']) + output["idbmup1"] = self.get_idbmup(self['lpp1'], beam=1) + output["idbmup2"] = self.get_idbmup(self['lpp2'], beam=2) output["ebmup1"] = self["ebeam1"] output["ebmup2"] = self["ebeam2"] output["pdfgup1"] = 0 @@ -3959,7 +4023,8 @@ def check_validity(self, card): dict.__setitem__(card, 'pdlabel1', card['pdlabel']) dict.__setitem__(card, 'pdlabel2', card['pdlabel']) - if abs(card['lpp1']) == 1 == abs(card['lpp2']) and card['pdlabel1'] != card['pdlabel2']: + if isinstance(card['lpp1'],int) and isinstance(card['lpp2'],int) and \ + abs(card['lpp1']) == 1 == abs(card['lpp2']) and card['pdlabel1'] != card['pdlabel2']: raise InvalidRunCard("Assymetric beam pdf not supported for proton-proton collision") def status(self, card): @@ -4156,12 +4221,16 @@ def default_setup(self): self.add_param('frame_id', 6, system=True) self.add_param("event_norm", "average", allowed=['sum','average', 'unity'], include=False, sys_default='sum', hidden=True) + self.add_param("keep_log", "normal", include=False, hidden=True, + comment="none: all log send to /dev/null.\n minimal: keep only log for survey of the last run.\n normal: keep only log for survey of all run. \n debug: keep all log (survey and refine)", + allowed=['none', 'minimal', 'normal', 'debug']) #cut self.add_param("auto_ptj_mjj", True, hidden=True) self.add_param("bwcutoff", 15.0) self.add_param("cut_decays", False, cut='d') self.add_param('dsqrt_shat',0., cut=True) self.add_param("nhel", 0, include=False) + self.add_param("limhel", 1e-8, hidden=True, comment="threshold to determine if an helicity contributes when not MC over helicity.") #pt cut self.add_param("ptj", 20.0, cut='j') self.add_param("ptb", 0.0, cut='b') @@ -4842,7 +4911,7 @@ def create_default_for_process(self, proc_characteristic, history, proc_def): # here pick strategy 2 if only one QCD color flow # and for pure multi-jet case jet_id = [21] + list(range(1, self['maxjetflavor']+1)) - if proc_characteristic['single_color']: + if proc_characteristic['gauge'] != 'FD' and proc_characteristic['single_color']: self['sde_strategy'] = 2 #for pure lepton final state go back to sde_strategy=1 pure_lepton=True @@ -5741,9 +5810,10 @@ def check_validity(self): # check that ebeam is bigger than the proton mass. for i in [1,2]: - if self['lpp%s' % i ] not in [1,2]: + # do not for proton mass if not proton PDF (or when scan initialization) + if self['lpp%s' % i ] not in [1,2] or isinstance(self['ebeam%i' % i], str): continue - + if self['ebeam%i' % i] < 0.938: if self['ebeam%i' %i] == 0: logger.warning("At-rest proton mode set: energy beam set to 0.938 GeV") @@ -6193,3 +6263,181 @@ def log_and_update(self, banner, card, par, v): xcard = banner.charge_card(card) xcard[par[0]].param_dict[(par[1],)].value = v xcard.write(os.path.join(self.me_dir, 'Cards', '%s.dat' % card)) + + + + +class RunCardIterator(object): + """A class keeping track of the scan: flag in the param_card and + having an __iter__() function to scan over all the points of the scan. + """ + + logging = True + def __init__(self, input_path=None): + with misc.TMP_variable(RunCard, 'allow_scan', True): + self.run_card = RunCard(input_path, consistency=False) + self.run_card.allow_scan = True + + self.itertag = [] #all the current value use + self.cross = [] # keep track of all the cross-section computed + self.param_order = [] + + def __iter__(self): + """generate the next param_card (in a abstract way) related to the scan. + Technically this generates only the generator.""" + + if hasattr(self, 'iterator'): + return self.iterator + self.iterator = self.iterate() + return self.iterator + + def write(self, path): + self.__iter__.write(path) + + def next(self, autostart=False): + """call the next iteration value""" + try: + iterator = self.iterator + except: + if autostart: + iterator = self.__iter__() + else: + raise + try: + out = next(iterator) + except StopIteration: + del self.iterator + raise + return out + + def iterate(self): + """create the actual generator""" + all_iterators = {} # dictionary of key -> block of object to scan [([param, [values]), ...] + pattern = re.compile(r'''scan\s*(?P\d*)\s*:\s*(?P[^#]*)''', re.I) + + # fill all_iterators with the run_card information + for name in self.run_card.scan_set: + value = self.run_card[name] + try: + key, def_list = pattern.findall(value)[0] + except Exception as error: + misc.sprint(error) + raise Exception("Fail to handle scanning tag in run_card: Please check that the syntax is valid") + if key == '': + key = -1 * len(all_iterators) + if key not in all_iterators: + all_iterators[key] = [] + try: + all_iterators[key].append( (name, eval(def_list))) + except SyntaxError as error: + raise Exception("Fail to handle your scan definition. Please check your syntax:\n entry: %s \n Error reported: %s" %(def_list, error)) + + #prepare to keep track of parameter changing for the report + keys = list(all_iterators.keys()) # need to fix an order for the scan + #store the type of parameter + for key in keys: + for param, values in all_iterators[key]: + self.param_order.append("run_card#%s" % (param)) + + # do the loop + lengths = [list(range(len(all_iterators[key][0][1]))) for key in keys] + from functools import reduce + total = reduce((lambda x, y: x * y),[len(x) for x in lengths]) + for i,positions in enumerate(itertools.product(*lengths)): + self.itertag = [] + if self.logging: + logger.info("Create the next run_card in the scan definition (%s/%s) " %( i+1, total), '$MG:BOLD') + for i, pos in enumerate(positions): + key = keys[i] + for param, values in all_iterators[key]: + # assign the value in the card. + self.run_card[param] = values[pos] + self.itertag.append(values[pos]) + if self.logging: + logger.info("change parameter %s to %s", \ + param, values[pos]) + + + # retrun the current param_card up to next iteration + yield self.run_card + + + def store_entry(self, run_name, cross, error=None, run_card_path=None): + """store the value of the cross-section""" + + if isinstance(cross, dict): + info = dict(cross) + info.update({'bench' : self.itertag, 'run_name': run_name}) + self.cross.append(info) + else: + if error is None: + self.cross.append({'bench' : self.itertag, 'run_name': run_name, 'cross(pb)':cross}) + else: + self.cross.append({'bench' : self.itertag, 'run_name': run_name, 'cross(pb)':cross, 'error(pb)':error}) + + + def write_summary(self, path, order=None, lastline=False, nbcol=20): + """ """ + + if path: + ff = open(path, 'w') + path_events = path.rsplit("/", 1)[0] + #identCard = open(pjoin(path.rsplit("/", 2)[0], "Cards", "ident_card.dat")) + #identLines = identCard.readlines() + #identCard.close() + else: + ff = StringIO.StringIO() + if order: + keys = order + else: + keys = list(self.cross[0].keys()) + if 'bench' in keys: keys.remove('bench') + if 'run_name' in keys: keys.remove('run_name') + keys.sort() + if 'cross(pb)' in keys: + keys.remove('cross(pb)') + keys.append('cross(pb)') + if 'error(pb)' in keys: + keys.remove('error(pb)') + keys.append('error(pb)') + + formatting = "#%s%s%s\n" %('%%-%is ' % (nbcol-1), ('%%-%is ' % (nbcol))* len(self.param_order), + ('%%-%is ' % (nbcol))* len(keys)) + # header + if not lastline: + ff.write(formatting % tuple(['run_name'] + self.param_order + keys)) + formatting = "%s%s%s\n" %('%%-%is ' % (nbcol), ('%%-%ie ' % (nbcol))* len(self.param_order), + ('%%-%ie ' % (nbcol))* len(keys)) + + if not lastline: + to_print = self.cross + else: + to_print = self.cross[-1:] + for info in to_print: + name = info['run_name'] + bench = info['bench'] + data = [] + for k in keys: + if k in info: + data.append(info[k]) + else: + data.append(0.) + ff.write(formatting % tuple([name] + bench + data)) + ff_single = open(pjoin(path_events, name, "params.dat"), "w") + for i_bench in range(0, len(bench)): + ff_single.write(self.param_order[i_bench] + " = " + str(bench[i_bench]) +"\n") + ff_single.close() + + if not path: + return ff.getvalue() + + + def get_next_name(self, run_name): + """returns a smart name for the next run""" + + if '_' in run_name: + name, value = run_name.rsplit('_',1) + if value.isdigit(): + return '%s_%02i' % (name, float(value)+1) + # no valid '_' in the name + return '%s_scan_02' % run_name diff --git a/epochX/cudacpp/ee_mumu.mad/bin/internal/check_param_card.py b/epochX/cudacpp/ee_mumu.mad/bin/internal/check_param_card.py index 71089d7480..bc785b5de6 100755 --- a/epochX/cudacpp/ee_mumu.mad/bin/internal/check_param_card.py +++ b/epochX/cudacpp/ee_mumu.mad/bin/internal/check_param_card.py @@ -649,7 +649,7 @@ def write_inc_file(self, outpath, identpath, default, need_mp=False): #check if we need to write the value of scale for some block if os.path.exists(input_inc): text = open(input_inc).read() - scales = list(set(re.findall('mdl__(\w*)__scale', text, re.I))) + scales = list(set(re.findall(r'mdl__(\w*)__scale', text, re.I))) else: scales = [] @@ -1000,10 +1000,12 @@ def iterate(self): self.param_order.append("%s#%s" % (param.lhablock, '_'.join(repr(i) for i in param.lhacode))) # do the loop lengths = [list(range(len(all_iterators[key][0][1]))) for key in keys] - for positions in itertools.product(*lengths): + from functools import reduce + total = reduce((lambda x, y: x * y),[len(x) for x in lengths]) + for i,positions in enumerate(itertools.product(*lengths)): self.itertag = [] if self.logging: - logger.info("Create the next param_card in the scan definition", '$MG:BOLD') + logger.info("Create the next param_card in the scan definition (%s/%s)" % (i+1,total), '$MG:BOLD') for i, pos in enumerate(positions): key = keys[i] for param, values in all_iterators[key]: diff --git a/epochX/cudacpp/ee_mumu.mad/bin/internal/cluster.py b/epochX/cudacpp/ee_mumu.mad/bin/internal/cluster.py index 9a893f630d..1ad860e04f 100755 --- a/epochX/cudacpp/ee_mumu.mad/bin/internal/cluster.py +++ b/epochX/cudacpp/ee_mumu.mad/bin/internal/cluster.py @@ -646,7 +646,10 @@ def worker(self): if os.path.exists(exe) and not exe.startswith('/'): exe = './' + exe if isinstance(opt['stdout'],str): - opt['stdout'] = open(opt['stdout'],'w') + if opt['stdout'] == '/dev/null': + opt['stdout'] = os.open(os.devnull, os.O_RDWR) + else: + opt['stdout'] = open(opt['stdout'],'w') if opt['stderr'] == None: opt['stderr'] = subprocess.STDOUT if arg: @@ -671,11 +674,12 @@ def worker(self): self.pids.put(pid) # the function should return 0 if everything is fine # the error message otherwise - returncode = exe(*arg, **opt) - if returncode != 0: - logger.warning("fct %s does not return 0. Stopping the code in a clean way. The error was:\n%s", exe, returncode) + try: + returncode = exe(*arg, **opt) + except Exception as error: + #logger.warning("fct %s does not return 0. Stopping the code in a clean way. The error was:\n%s", exe, returncode) self.stoprequest.set() - self.remove("fct %s does not return 0:\n %s" % (exe, returncode)) + self.remove("fct %s does raise %s\n %s" % (exe, error)) except Exception as error: self.fail_msg = sys.exc_info() logger.warning(str(error)) @@ -700,7 +704,7 @@ def worker(self): def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, - log=None, required_output=[], nb_submit=0): + log=None, required_output=[], nb_submit=0, python_opts={}): """submit a job on multicore machine""" # open threads if needed @@ -720,7 +724,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, return tag else: # python function - self.queue.put((tag, prog, argument, {})) + self.queue.put((tag, prog, argument, python_opts)) self.submitted.put(1) return tag @@ -908,6 +912,10 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None else: requirement = '' + if 'cluster_walltime' in self.options and self.options['cluster_walltime']\ + and self.options['cluster_walltime'] != 'None': + requirement+='\n MaxRuntime = %s' % self.options['cluster_walltime'] + if cwd is None: cwd = os.getcwd() if stdout is None: @@ -936,7 +944,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None #Submitting job(s). #Logging submit event(s). #1 job(s) submitted to cluster 2253622. - pat = re.compile("submitted to cluster (\d*)",re.MULTILINE) + pat = re.compile(r"submitted to cluster (\d*)",re.MULTILINE) output = output.decode(errors='ignore') try: id = pat.search(output).groups()[0] @@ -1025,7 +1033,7 @@ def submit2(self, prog, argument=[], cwd=None, stdout=None, stderr=None, #Logging submit event(s). #1 job(s) submitted to cluster 2253622. output = output.decode(errors='ignore') - pat = re.compile("submitted to cluster (\d*)",re.MULTILINE) + pat = re.compile(r"submitted to cluster (\d*)",re.MULTILINE) try: id = pat.search(output).groups()[0] except: @@ -1588,7 +1596,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None output = a.communicate()[0].decode(errors='ignore') #Your job 874511 ("test.sh") has been submitted - pat = re.compile("Your job (\d*) \(",re.MULTILINE) + pat = re.compile(r"Your job (\d*) \(",re.MULTILINE) try: id = pat.search(output).groups()[0] except: @@ -1606,7 +1614,7 @@ def control_one_job(self, id): if not status: return 'F' #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 - pat = re.compile("^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") + pat = re.compile(r"^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") stat = '' for line in status.stdout.read().decode(errors='ignore').split('\n'): if not line: @@ -1636,7 +1644,7 @@ def control(self, me_dir=None): cmd = 'qstat -s %s' % statusflag status = misc.Popen([cmd], shell=True, stdout=subprocess.PIPE) #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 - pat = re.compile("^(\d+)") + pat = re.compile(r"^(\d+)") for line in status.stdout.read().decode(errors='ignore').split('\n'): line = line.strip() try: @@ -1715,6 +1723,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None stderr = stdout if log is None: log = '/dev/null' + command = ['sbatch', '-o', stdout, '-J', me_dir, @@ -1726,6 +1735,12 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None command.insert(1, '-p') command.insert(2, self.cluster_queue) + if 'cluster_walltime' in self.options and self.options['cluster_walltime']\ + and self.options['cluster_walltime'] != 'None': + command.insert(1, '-t') + command.insert(2, self.options['cluster_walltime']) + + a = misc.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -1736,7 +1751,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None id = output_arr[3].rstrip() if not id.isdigit(): - id = re.findall('Submitted batch job ([\d\.]+)', ' '.join(output_arr)) + id = re.findall(r'Submitted batch job ([\d\.]+)', ' '.join(output_arr)) if not id or len(id)>1: raise ClusterManagmentError( 'fail to submit to the cluster: \n%s' \ diff --git a/epochX/cudacpp/ee_mumu.mad/bin/internal/combine_runs.py b/epochX/cudacpp/ee_mumu.mad/bin/internal/combine_runs.py index 4de6b84ec0..b1e8c88eac 100755 --- a/epochX/cudacpp/ee_mumu.mad/bin/internal/combine_runs.py +++ b/epochX/cudacpp/ee_mumu.mad/bin/internal/combine_runs.py @@ -20,6 +20,7 @@ from __future__ import absolute_import import math import os +import shutil import re import logging from six.moves import range @@ -117,6 +118,7 @@ def sum_multichannel(self, channel): #Now read in all of the events and write them #back out with the appropriate scaled weight + to_clean = [] fsock = open(pjoin(channel, 'events.lhe'), 'w') wgt = results.axsec / results.nunwgt tot_nevents, nb_file = 0, 0 @@ -129,8 +131,14 @@ def sum_multichannel(self, channel): nw = self.copy_events(fsock, pjoin(path,'events.lhe'), wgt) tot_nevents += nw nb_file += 1 + to_clean.append(path) logger.debug("Combined %s file generating %s events for %s " , nb_file, tot_nevents, channel) - + for path in to_clean: + try: + shutil.rmtree(path) + except Exception as error: + pass + @staticmethod def get_fortran_str(nb): data = '%E' % nb @@ -162,6 +170,7 @@ def copy_events(self, fsock, input, new_wgt): fsock.write(line) old_line = line return nb_evt + def get_channels(self, proc_path): """Opens file symfact.dat to determine all channels""" sympath = os.path.join(proc_path, 'symfact.dat') diff --git a/epochX/cudacpp/ee_mumu.mad/bin/internal/common_run_interface.py b/epochX/cudacpp/ee_mumu.mad/bin/internal/common_run_interface.py index 9bd9d9cb50..194f0cdfbd 100755 --- a/epochX/cudacpp/ee_mumu.mad/bin/internal/common_run_interface.py +++ b/epochX/cudacpp/ee_mumu.mad/bin/internal/common_run_interface.py @@ -23,6 +23,7 @@ import ast import logging import math +import copy import os import re import shutil @@ -181,6 +182,23 @@ def help_add_time_of_flight(self): logger.info(' threshold option allows to change the minimal value required to') logger.info(' a non zero value for the particle (default:1e-12s)') + def help_print_results(self): + logger.info("syntax: print_results [RUN_NAME] [OPTIONS]") + logger.info("-- print the results of the previous run on the screen") + logger.info(" If not RUN_NAME is provided, the information of all run") + logger.info(" are printed one after another.") + logger.info("") + logger.info(" supported options:") + logger.info(" ------------------") + logger.info(" --format=full|short # default is full") + logger.info(" full format contains banner/... ") + logger.info(" while short is a simple multi-column format (nice for plotting)") + logger.info(" --path=") + logger.info(" allow to write the information to a file.") + logger.info(" --mode=w|a #default is w ") + logger.info(" when the information is printed to a file, you can choose ") + logger.info(" to either overwrite the file if already exists (w mode)") + logger.info(" to append the information at the end of the file (a mode)") class CheckValidForCmd(object): @@ -727,7 +745,7 @@ def __init__(self, me_dir, options, *args, **opts): if not self.proc_characteristics['ninitial']: # Get number of initial states nexternal = open(pjoin(self.me_dir,'Source','nexternal.inc')).read() - found = re.search("PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) + found = re.search(r"PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) self.ninitial = int(found.group(1)) else: self.ninitial = self.proc_characteristics['ninitial'] @@ -989,7 +1007,22 @@ def do_treatcards(self, line, amcatnlo=False): #raise Exception, "%s %s %s" % (sys.path, os.path.exists(pjoin(self.me_dir,'bin','internal', 'ufomodel')), os.listdir(pjoin(self.me_dir,'bin','internal', 'ufomodel'))) import ufomodel as ufomodel zero = ufomodel.parameters.ZERO - if self.proc_characteristics['nlo_mixed_expansion']: + no_width = [] + + if self.proc_characteristics['ew_sudakov']: + # if the sudakov approximation is used, force all particle widths to zero + # unless the complex mass scheme is used + if not self.proc_characteristics['complex_mass_scheme']: + no_width = [p for p in ufomodel.all_particles if p.width != zero] + logger.info('''Setting all particle widths to zero (needed for EW Sudakov approximation).''','$MG:BOLD') + # also, check that the model features the 'ntadpole' parameter, and set it to 1 + try: + param_card['tadpole'].get(1).value = 1. + logger.info('''Setting the value of ntadpole to 1 (needed for EW Sudakov approximation).''','$MG:BOLD') + except KeyError: + logger.warning('''The model has no 'ntadpole' parameter. The Sudakov approximation for EW corrections may give wrong results.''') + + elif self.proc_characteristics['nlo_mixed_expansion']: no_width = [p for p in ufomodel.all_particles if (str(p.pdg_code) in pids or str(-p.pdg_code) in pids) and p.width != zero] @@ -1168,17 +1201,17 @@ def detect_card_type(path): 'Begin Minpts', 'gridpack', 'ebeam1', - 'block\s+mw_run', + r'block\s+mw_run', 'BLOCK', 'DECAY', 'launch', 'madspin', - 'transfer_card\.dat', + r'transfer_card\.dat', 'set', 'main:numberofevents', # pythia8, '@MG5aMC skip_analysis', #MA5 --both-- - '@MG5aMC\s*inputs\s*=\s*\*\.(?:hepmc|lhe)', #MA5 --both-- - '@MG5aMC\s*reconstruction_name', # MA5 hadronique + r'@MG5aMC\s*inputs\s*=\s*\*\.(?:hepmc|lhe)', #MA5 --both-- + r'@MG5aMC\s*reconstruction_name', # MA5 hadronique '@MG5aMC', # MA5 hadronique 'run_rivet_later', # Rivet ] @@ -1237,7 +1270,7 @@ def detect_card_type(path): return 'madspin_card.dat' if 'decay' in text: # need to check if this a line like "decay w+" or "set decay" - if re.search("(^|;)\s*decay", fulltext, re.M): + if re.search(r"(^|;)\s*decay", fulltext, re.M): return 'madspin_card.dat' else: return 'reweight_card.dat' @@ -2074,6 +2107,12 @@ def check_multicore(self): # ensure that the run_card is present if not hasattr(self, 'run_card'): self.run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat')) + # Below reads the run_card in the LHE file rather than the Cards/run_card + import madgraph.various.lhe_parser as lhe_parser + args_path = list(args) + self.check_decay_events(args_path) + self.run_card = banner_mod.RunCard(lhe_parser.EventFile(args_path[0]).get_banner()['mgruncard']) + # we want to run this in a separate shell to avoid hard f2py crash command = [sys.executable] @@ -2085,6 +2124,12 @@ def check_multicore(self): command.append('--web') command.append('reweight') + ## TV: copy the event file as backup before starting reweighting + event_path = pjoin(self.me_dir, 'Events', self.run_name, 'events.lhe.gz') + event_path_backup = pjoin(self.me_dir, 'Events', self.run_name, 'events_orig.lhe.gz') + if os.path.exists(event_path) and not os.path.exists(event_path_backup): + shutil.copyfile(event_path, event_path_backup) + ######### START SINGLE CORE MODE ############ if self.options['nb_core']==1 or self.run_card['nevents'] < 101 or not check_multicore(self): if self.run_name: @@ -2200,7 +2245,7 @@ def check_multicore(self): cross_sections[key] = value / (nb_event+1) lhe.remove() for key in cross_sections: - if key == 'orig' or key.isdigit(): + if key == 'orig' or (key.isdigit() and not (key[0] == '2')): continue logger.info('%s : %s pb' % (key, cross_sections[key])) return @@ -2461,7 +2506,7 @@ def do_add_time_of_flight(self, line): ############################################################################ def do_print_results(self, line): - """Not in help:Print the cross-section/ number of events for a given run""" + """Print the cross-section/ number of events for a given run""" args = self.split_arg(line) options={'path':None, 'mode':'w', 'format':'full'} @@ -2942,10 +2987,15 @@ def do_rivet(self, line, postprocess=False): #2 Prepare Rivet setup environments rivet_path = self.options['rivet_path'] yoda_path = self.options['yoda_path'] + fastjet_path = subprocess.Popen([self.options['fastjet'], '--prefix'], + stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip() + set_env = set_env + "export PATH={0}:$PATH\n".format(pjoin(rivet_path, 'bin')) set_env = set_env + "export PATH={0}:$PATH\n".format(pjoin(yoda_path, 'bin')) set_env = set_env + "export LD_LIBRARY_PATH={0}:{1}:$LD_LIBRARY_PATH\n".format(pjoin(rivet_path, 'lib'), pjoin(rivet_path, 'lib64')) set_env = set_env + "export LD_LIBRARY_PATH={0}:{1}:$LD_LIBRARY_PATH\n".format(pjoin(yoda_path, 'lib'), pjoin(yoda_path, 'lib64')) + set_env = set_env + "export LD_LIBRARY_PATH={0}:$LD_LIBRARY_PATH\n".format(pjoin(self.options['hepmc_path'], 'lib')) + set_env = set_env + "export LD_LIBRARY_PATH={0}:$LD_LIBRARY_PATH\n".format(pjoin(fastjet_path, 'lib')) major, minor = sys.version_info[0:2] set_env = set_env + "export PYTHONPATH={0}:{1}:$PYTHONPATH\n".format(pjoin(rivet_path, 'lib', 'python%s.%s' %(major,minor), 'site-packages'),\ pjoin(rivet_path, 'lib64', 'python%s.%s' %(major,minor), 'site-packages')) @@ -4311,8 +4361,8 @@ def complete_compute_widths(self, text, line, begidx, endidx, formatting=True): else: completion = {} completion['options'] = self.list_completion(text, - ['--path=', '--output=', '--min_br=0.\$', '--nlo', - '--precision_channel=0.\$', '--body_decay=']) + ['--path=', '--output=', r'--min_br=0.\$', '--nlo', + r'--precision_channel=0.\$', '--body_decay=']) return self.deal_multiple_categories(completion, formatting) @@ -4821,9 +4871,9 @@ class AskforEditCard(cmd.OneLinePathCompletion): (return False to repeat the question) """ - all_card_name = ['param_card', 'run_card', 'pythia_card', 'pythia8_card', + all_card_name = ['param_card', 'run_card', 'pythia_card', 'pythia8_card', 'fo_analysis_card' 'madweight_card', 'MadLoopParams', 'shower_card', 'rivet_card'] - to_init_card = ['param', 'run', 'madweight', 'madloop', + to_init_card = ['param', 'run', 'madweight', 'madloop', 'fo_analysis', 'shower', 'pythia8','delphes','madspin', 'rivet'] special_shortcut = {} special_shortcut_help = {} @@ -4853,6 +4903,7 @@ def load_default(self): self.has_PY8 = False self.has_delphes = False self.has_rivet = False + self.has_fo_card = False self.paths = {} self.update_block = [] @@ -5058,7 +5109,8 @@ def init_run(self, cards): try: - self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning') + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning') except IOError: self.run_card = {} try: @@ -5248,6 +5300,15 @@ def init_delphes(self, cards): self.has_delphes = True return [] + def init_fo_analysis(self, cards): + self.has_fo_card = False + if not self.get_path('FO_analyse', cards): + return [] + self.has_fo_card = True + self.fo_card = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse']) + self.fo_card_def = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse_default']) + return list(self.fo_card.string_vars) + def set_CM_velocity(self, line): """compute sqrts from the velocity in the center of mass frame""" @@ -5508,6 +5569,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): allowed['delphes_card'] = '' if self.has_rivet: allowed['rivet_card'] = '' + if self.has_fo_card: + allowed['fo_card'] = '' elif len(args) == 2: if args[1] == 'run_card': @@ -5532,6 +5595,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): allowed = {'delphes_card':'default'} elif args[1] == 'rivet_card': allowed = {'rivet_card':'default'} + elif args[1] == 'fo_card': + allowed = {'fo_card':'default'} else: allowed = {'value':''} @@ -5539,6 +5604,7 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): start = 1 if args[1] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', 'MadLoop_card','pythia8_card','delphes_card','plot_card', + 'fo_card', 'madanalysis5_parton_card','madanalysis5_hadron_card', 'rivet_card']: start = 2 @@ -5576,6 +5642,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): categories.append('delphes_card') if self.has_rivet: categories.append('rivet_card') + if self.has_fo_card: + categories.append('fo_card') possibilities['category of parameter (optional)'] = \ self.list_completion(text, categories) @@ -5630,7 +5698,13 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): if 'delphes_card' in allowed: if allowed['delphes_card'] == 'default': opts = ['default', 'atlas', 'cms'] - possibilities['Delphes Card'] = self.list_completion(text, opts) + possibilities['Delphes Card'] = self.list_completion(text, opts) + + if 'fo_card' in allowed: + opts = self.fo_card.string_vars + if allowed['fo_card'] == 'default': + opts.append('default') + possibilities['FO Card'] = self.list_completion(text, opts) if 'value' in list(allowed.keys()): opts = ['default', 'scale'] @@ -5733,21 +5807,28 @@ def do_set(self, line): if args[0] in self.special_shortcut: targettypes , cmd = self.special_shortcut[args[0]] if len(args) != len(targettypes) +1: - logger.warning('shortcut %s requires %s argument' % (args[0], len(targettypes))) - if len(args) < len(targettypes) +1: - return + if len(targettypes) == 1 and args[len(targettypes)].startswith('scan'): + args = args[:len(targettypes)] + [' '.join(args[len(targettypes):])] + targettypes = [str] else: - logger.warning('additional argument will be ignored') + logger.warning('shortcut %s requires %s argument' % (args[0], len(targettypes))) + if len(args) < len(targettypes) +1: + return + else: + logger.warning('additional argument will be ignored') values ={} for i, argtype in enumerate(targettypes): try: - values = {str(i): banner_mod.ConfigFile.format_variable(args[i+1], argtype, args[0])} + values[str(i)] = banner_mod.ConfigFile.format_variable(args[i+1], argtype, args[0]) except ValueError as e: logger.warning("Wrong argument: The entry #%s should be of type %s.", i+1, argtype) return except InvalidCmd as e: - logger.warning(str(e)) - return + if isinstance(args[i+1], str) and args[i+1].startswith('scan'): + values[str(i)] = args[i+1] + else: + logger.warning(str(e)) + return #else: # logger.warning("too many argument for this command") # return @@ -5787,7 +5868,7 @@ def do_set(self, line): if os.path.exists(pythia_path): logger.info('add line QCUT = %s in pythia_card.dat' % args[1]) p_card = open(pythia_path,'r').read() - p_card, n = re.subn('''^\s*QCUT\s*=\s*[\de\+\-\.]*\s*$''', + p_card, n = re.subn(r'''^\s*QCUT\s*=\s*[\de\+\-\.]*\s*$''', ''' QCUT = %s ''' % args[1], \ p_card, flags=(re.M+re.I)) if n==0: @@ -5801,7 +5882,7 @@ def do_set(self, line): if os.path.exists(pythia_path): logger.info('add line SHOWERKT = %s in pythia_card.dat' % args[1].upper()) p_card = open(pythia_path,'r').read() - p_card, n = re.subn('''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''', + p_card, n = re.subn(r'''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''', ''' SHOWERKT = %s ''' % args[1].upper(), \ p_card, flags=(re.M+re.I)) if n==0: @@ -5856,7 +5937,7 @@ def do_set(self, line): pjoin(self.me_dir,'Cards', 'delphes_card.dat')) return - if args[0] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', + if args[0] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', 'fo_card', 'delphes_card','madanalysis5_hadron_card','madanalysis5_parton_card','rivet_card']: if args[1] == 'default': @@ -6176,6 +6257,22 @@ def do_set(self, line): self.setRivet(args[start], value, default=default) self.rivet_card.write(self.paths['rivet'], self.paths['rivet_default']) + elif self.has_fo_card and (card in ['', 'fo_card'])\ + and args[start].lower() in [k.lower() for k in self.fo_card.string_vars]: + + if args[start] in self.conflict and card == '': + text = 'ambiguous name (present in more than one card). Please specify which card to edit' + logger.warning(text) + return + if args[start+1] == 'default': + value = self.fo_card_default[args[start]] + default = True + else: + value = args[start+1] + default = False + self.fo_card[args[start]] = value + self.modified_card.add('fo_card') + #INVALID -------------------------------------------------------------- else: logger.warning('invalid set command %s ' % line) @@ -6222,12 +6319,13 @@ def setM(self, block, name, value): def setR(self, name, value): - if self.mother_interface.inputfile: - self.run_card.set(name, value, user=True, raiseerror=True) - else: - self.run_card.set(name, value, user=True) - new_value = self.run_card.get(name) - logger.info('modify parameter %s of the run_card.dat to %s' % (name, new_value),'$MG:BOLD') + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + if self.mother_interface.inputfile: + self.run_card.set(name, value, user=True, raiseerror=True) + else: + self.run_card.set(name, value, user=True) + new_value = self.run_card.get(name) + logger.info('modify parameter %s of the run_card.dat to %s' % (name, new_value),'$MG:BOLD') def setML(self, name, value, default=False): @@ -6314,6 +6412,7 @@ def check_card_consistency(self): proc_charac = self.mother_interface.proc_characteristics if proc_charac['grouped_matrix'] and \ + isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int) and \ abs(self.run_card['lpp1']) == 1 == abs(self.run_card['lpp2']) and \ (self.run_card['nb_proton1'] != self.run_card['nb_proton2'] or self.run_card['nb_neutron1'] != self.run_card['nb_neutron2'] or @@ -6403,41 +6502,42 @@ def check_card_consistency(self): # check that only quark/gluon/photon are in initial beam if lpp=+-1 pdg_in_p = list(range(-6,7))+[21,22] - if (abs(self.run_card['lpp1'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial1'])) \ + if isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int): + if(abs(self.run_card['lpp1'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial1'])) \ or (abs(self.run_card['lpp2'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial2'])): - if 'pythia_card.dat' in self.cards or 'pythia8_card.dat' in self.cards: - path_to_remove = None - if 'pythia_card.dat' in self.cards: - path_to_remove = self.paths['pythia'] - card_to_remove = 'pythia_card.dat' - elif 'pythia8_card.dat' in self.cards: - path_to_remove = self.paths['pythia8'] - card_to_remove = 'pythia8_card.dat' - if path_to_remove: - if 'partonshower' in self.run_card['bypass_check']: + if 'pythia_card.dat' in self.cards or 'pythia8_card.dat' in self.cards: + path_to_remove = None + if 'pythia_card.dat' in self.cards: + path_to_remove = self.paths['pythia'] + card_to_remove = 'pythia_card.dat' + elif 'pythia8_card.dat' in self.cards: + path_to_remove = self.paths['pythia8'] + card_to_remove = 'pythia8_card.dat' + if path_to_remove: + if 'partonshower' in self.run_card['bypass_check']: + logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") + else: + logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') + os.remove(path_to_remove) + self.cards.remove(card_to_remove) + else: + logger.info('Remember that Parton-Shower are not yet ready for such proton component definition (HW implementation in progress).', '$MG:BOLD' ) + elif (abs(self.run_card['lpp1'])==3 and abs(self.run_card['lpp2'])==3): + if 'pythia8_card.dat' in self.cards: + if self.run_card['pdlabel'] == 'isronlyll': + if 'partonshower' not in self.run_card['bypass_check']: + # force that QED shower is on? + for param in ['TimeShower:QEDshowerByQ', 'TimeShower:QEDshowerByL', 'TimeShower:QEDshowerByGamma', 'SpaceShower:QEDshowerByQ', 'SpaceShower:QEDshowerByL']: + if param not in self.PY8Card or \ + (not self.PY8Card[param] and param.lower() not in self.PY8Card.user_set): + logger.warning('Activating QED shower: setting %s to True', param) + self.PY8Card[param] = True + elif 'partonshower' in self.run_card['bypass_check']: logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") - else: + else: logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') - os.remove(path_to_remove) - self.cards.remove(card_to_remove) - else: - logger.info('Remember that Parton-Shower are not yet ready for such proton component definition (HW implementation in progress).', '$MG:BOLD' ) - elif (abs(self.run_card['lpp1'])==3 and abs(self.run_card['lpp2'])==3): - if 'pythia8_card.dat' in self.cards: - if self.run_card['pdlabel'] == 'isronlyll': - if 'partonshower' not in self.run_card['bypass_check']: - # force that QED shower is on? - for param in ['TimeShower:QEDshowerByQ', 'TimeShower:QEDshowerByL', 'TimeShower:QEDshowerByGamma', 'SpaceShower:QEDshowerByQ', 'SpaceShower:QEDshowerByL']: - if param not in self.PY8Card or \ - (not self.PY8Card[param] and param.lower() not in self.PY8Card.user_set): - logger.warning('Activating QED shower: setting %s to True', param) - self.PY8Card[param] = True - elif 'partonshower' in self.run_card['bypass_check']: - logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") - else: - logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') - os.remove(self.paths['pythia8']) - self.cards.remove('pythia8_card.dat') + os.remove(self.paths['pythia8']) + self.cards.remove('pythia8_card.dat') ######################################################################## @@ -6514,7 +6614,8 @@ def check_card_consistency(self): #check relation between lepton PDF // dressed lepton collisions // ... - if abs(self.run_card['lpp1']) != 1 or abs(self.run_card['lpp2']) != 1: + if isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int) and \ + abs(self.run_card['lpp1']) != 1 or abs(self.run_card['lpp2']) != 1: if abs(self.run_card['lpp1']) == abs(self.run_card['lpp2']) == 3: # this can be dressed lepton or photon-flux if proc_charac['pdg_initial1'] in [[11],[-11]] and proc_charac['pdg_initial2'] in [[11],[-11]]: @@ -6732,7 +6833,11 @@ def write_card_param(self): """ write the param_card """ self.param_card.write(self.paths['param']) - + + def write_card_fo_card(self): + """ write the fo_card""" + self.fo_card.write_card_from_template(self.paths['FO_analyse'], self.paths['FO_analyse_default']) + @staticmethod def update_dependent(mecmd, me_dir, param_card, path ,timer=0, run_card=None, lhapdfconfig=None): @@ -7076,7 +7181,7 @@ def do_decay(self, line): #first find the particle particle = line.split('>')[0].strip() logger.info("change madspin_card to define the decay of %s: %s" %(particle, line.strip()), '$MG:BOLD') - particle = particle.replace('+','\+').replace('-','\-') + particle = particle.replace('+',r'\+').replace('-',r'\-') decay_pattern = re.compile(r"^\s*decay\s+%s\s*>[\s\w+-~]*?$" % particle, re.I+re.M) text= open(path).read() text = decay_pattern.sub('', text) @@ -7193,7 +7298,7 @@ def help_edit(self, prefix=True): logger.info( ' --clean remove all previously existing line in the file') logger.info( ' --comment_line="" comment all lines matching the regular expression') logger.info('') - logger.info(' Note: all regular-expression will be prefixed by ^\s*') + logger.info(r' Note: all regular-expression will be prefixed by ^\s*') logger.info('') logger.info( ' example: edit reweight --after_line="change mode\b" change model heft') logger.info( ' edit madspin --after_line="banner" change model XXXX') @@ -7314,7 +7419,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''replace_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[14:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[14:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7344,7 +7449,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''comment_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[14:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[14:-1] nb_mod = 0 for posline,l in enumerate(split): if re.search(pattern, l): @@ -7366,7 +7471,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''before_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[13:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[13:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7383,7 +7488,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern = r'''after_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[12:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[12:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7527,16 +7632,19 @@ def open_file(self, answer): answer = 'plot' else: answer = self.cards[int(answer)-self.integer_bias] - + path = '' if 'madweight' in answer: answer = answer.replace('madweight', 'MadWeight') elif 'MadLoopParams' in answer: answer = self.paths['ML'] elif 'pythia8_card' in answer: answer = self.paths['pythia8'] + elif 'FO_analyse' in answer: + path = self.paths['FO_analyse'] + answer = 'fo_card' if os.path.exists(answer): path = answer - else: + elif not os.path.exists(path): if not '.dat' in answer and not '.lhco' in answer: if answer != 'trigger': path = self.paths[answer] @@ -7595,7 +7703,8 @@ def reload_card(self, path): logger.error('Please re-open the file and fix the problem.') logger.warning('using the \'set\' command without opening the file will discard all your manual change') elif path == self.paths['run']: - self.run_card = banner_mod.RunCard(path) + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + self.run_card = banner_mod.RunCard(path) elif path == self.paths['shower']: self.shower_card = shower_card_mod.ShowerCard(path) elif path == self.paths['ML']: @@ -7614,6 +7723,8 @@ def reload_card(self, path): except: import internal.madweight.Cards as mwcards self.mw_card = mwcards.Card(path) + elif path == self.paths['FO_analyse']: + self.fo_card = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse']) else: logger.debug('not keep in sync: %s', path) return path @@ -7629,6 +7740,9 @@ def scanparamcardhandling(input_path=lambda obj: pjoin(obj.me_dir, 'Cards', 'par iteratorclass=param_card_mod.ParamCardIterator, summaryorder=lambda obj: lambda:None, check_card=lambda obj: CommonRunCmd.static_check_param_card, + run_card_scan=False, + run_card_input= lambda obj: pjoin(obj.me_dir, 'Cards', 'run_card.dat'), + run_card_iteratorclass=banner_mod.RunCardIterator, ): """ This is a decorator for customizing/using scan over the param_card (or technically other) This should be use like this: @@ -7678,7 +7792,60 @@ def __enter__(self): def __exit__(self, ctype, value, traceback ): self.iterator.write(self.path) - def decorator(original_fct): + def scan_over_run_card(original_fct, obj, *args, **opts): + + if isinstance(input_path, str): + card_path = run_card_input + else: + card_path = run_card_input(obj) + + run_card_iterator = run_card_iteratorclass(card_path) + orig_card = copy.deepcopy(run_card_iterator.run_card) + if not run_card_iterator.run_card.scan_set: + return original_fct(obj, *args, **opts) + + + with restore_iterator(orig_card, card_path): + # this with statement ensure that the original card is restore + # whatever happens inside those block + + if not hasattr(obj, 'allow_notification_center'): + obj.allow_notification_center = False + with misc.TMP_variable(obj, 'allow_notification_center', False): + orig_name = get_run_name(obj) + if not orig_name and args[1]: + orig_name = args[1][0] + args = (args[0], args[1][1:]) + #orig_name = "scan_%s" % len(obj.results) + + try: + os.mkdir(pjoin(obj.me_dir, 'Events', orig_name)) + except Exception: + pass + next_name = orig_name + "_00" + + for i,card in enumerate(run_card_iterator): + card.write(card_path) + # still have to check for the auto-wdith + #if i !=0: + next_name = run_card_iterator.get_next_name(next_name) + set_run_name(obj)(next_name) + try: + original_fct(obj, *args, **opts) + except ignoreerror as error: + run_card_iterator.store_entry(next_name, {'exception': error}) + else: + run_card_iterator.store_entry(next_name, store_for_scan(obj)(), run_card_path=card_path) + + #param_card_iterator.write(card_path) #-> this is done by the with statement + name = misc.get_scan_name(orig_name, next_name) + path = result_path(obj) % name + logger.info("write scan results in %s" % path ,'$MG:BOLD') + order = summaryorder(obj)() + run_card_iterator.write_summary(path, order=order) + + + def decorator(original_fct): def new_fct(obj, *args, **opts): if isinstance(input_path, str): @@ -7702,8 +7869,13 @@ def new_fct(obj, *args, **opts): if not param_card_iterator: #first run of the function - original_fct(obj, *args, **opts) - return + if run_card_scan: + scan_over_run_card(original_fct, obj, *args, **opts) + return + else: + #first run of the function + original_fct(obj, *args, **opts) + return with restore_iterator(param_card_iterator, card_path): # this with statement ensure that the original card is restore diff --git a/epochX/cudacpp/ee_mumu.mad/bin/internal/extended_cmd.py b/epochX/cudacpp/ee_mumu.mad/bin/internal/extended_cmd.py index 2f37070580..789976beee 100755 --- a/epochX/cudacpp/ee_mumu.mad/bin/internal/extended_cmd.py +++ b/epochX/cudacpp/ee_mumu.mad/bin/internal/extended_cmd.py @@ -624,12 +624,12 @@ def complete(self, text, state): compfunc = self.completenames # correct wrong splittion with '\ ' - if line and begidx > 2 and line[begidx-2:begidx] == '\ ': + if line and begidx > 2 and line[begidx-2:begidx] == r'\ ': Ntext = line.split(os.path.sep)[-1] - self.completion_prefix = Ntext.rsplit('\ ', 1)[0] + '\ ' + self.completion_prefix = Ntext.rsplit(r'\ ', 1)[0] + r'\ ' to_rm = len(self.completion_prefix) - 1 Nbegidx = len(line.rsplit(os.path.sep, 1)[0]) + 1 - data = compfunc(Ntext.replace('\ ', ' '), line, Nbegidx, endidx) + data = compfunc(Ntext.replace(r'\ ', ' '), line, Nbegidx, endidx) self.completion_matches = [p[to_rm:] for p in data if len(p)>to_rm] # correct wrong splitting with '-'/"=" @@ -742,7 +742,7 @@ def path_completion(text, base_dir = None, only_dirs = False, completion += [prefix + f for f in ['.'+os.path.sep, '..'+os.path.sep] if \ f.startswith(text) and not prefix.startswith('.')] - completion = [a.replace(' ','\ ') for a in completion] + completion = [a.replace(' ',r'\ ') for a in completion] return completion @@ -1253,7 +1253,7 @@ def check_answer_in_input_file(self, question_instance, default, path=False, lin return possibility[0] if '=' in line and ' ' in line.strip(): leninit = len(line) - line,n = re.subn('\s*=\s*','=', line) + line,n = re.subn(r'\s*=\s*','=', line) if n and len(line) != leninit: return self.check_answer_in_input_file(question_instance, default, path=path, line=line) @@ -1311,7 +1311,7 @@ def nice_error_handling(self, error, line): if os.path.exists(self.debug_output): os.remove(self.debug_output) try: - super(Cmd,self).onecmd('history %s' % self.debug_output.replace(' ', '\ ')) + super(Cmd,self).onecmd('history %s' % self.debug_output.replace(' ', r'\ ')) except Exception as error: logger.error(error) @@ -2001,6 +2001,7 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): text = "" has_mg5_path = False # Use local configuration => Need to update the path + already_written = set() for line in open(basefile): if '=' in line: data, value = line.split('=',1) @@ -2018,9 +2019,12 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): comment = '' if key in to_keep: value = str(to_keep[key]) - else: + elif line not in already_written: + already_written.add(line) text += line continue + else: + continue if key == 'mg5_path': has_mg5_path = True try: @@ -2032,14 +2036,20 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): # check if absolute path if not os.path.isabs(value): value = os.path.realpath(os.path.join(basedir, value)) - text += '%s = %s # %s \n' % (key, value, comment) + new_line = '%s = %s # %s \n' % (key, value, comment) + if new_line not in already_written: + text += new_line + already_written.add(new_line) for key in to_write: if key in to_keep: - text += '%s = %s \n' % (key, to_keep[key]) + new_line = '%s = %s \n' % (key, to_keep[key]) + if new_line not in already_written: + text += new_line if not MADEVENT and not has_mg5_path: - text += """\n# MG5 MAIN DIRECTORY\n""" - text += "mg5_path = %s\n" % MG5DIR + if "mg5_path = %s\n" % MG5DIR not in already_written: + text += """\n# MG5 MAIN DIRECTORY\n""" + text += "mg5_path = %s\n" % MG5DIR writer = open(filepath,'w') writer.write(text) @@ -2190,7 +2200,7 @@ def onecmd(self, line, **opt): raise def reask(self, reprint_opt=True): - pat = re.compile('\[(\d*)s to answer\]') + pat = re.compile(r'\[(\d*)s to answer\]') prev_timer = signal.alarm(0) # avoid timer if any if prev_timer: @@ -2991,7 +3001,7 @@ def question_formatting(self, nb_col = 80, lpotential_switch=0, lnb_key=0, key=None): - """should return four lines: + r"""should return four lines: 1. The upper band (typically /========\ 2. The lower band (typically \========/ 3. The line without conflict | %(nb)2d. %(descrip)-20s %(name)5s = %(switch)-10s | @@ -3239,13 +3249,13 @@ def create_question(self, help_text=True): data_to_format['conflict_switch'] = self.color_for_value(key,self.inconsistent_keys[key], consistency=False) if hidden_line: - f2 = re.sub('%(\((?:name|descrip|add_info)\)-?)(\d+)s', + f2 = re.sub(r'%(\((?:name|descrip|add_info)\)-?)(\d+)s', lambda x: '%%%s%ds' % (x.group(1),int(x.group(2))+9), f2) text.append(f2 % data_to_format) elif hidden_line: if not f3: - f3 = re.sub('%(\((?:name|descrip|add_info)\)-?)(\d+)s', + f3 = re.sub(r'%(\((?:name|descrip|add_info)\)-?)(\d+)s', lambda x: '%%%s%ds' % (x.group(1),int(x.group(2))+9), f1) text.append(f3 % data_to_format) diff --git a/epochX/cudacpp/ee_mumu.mad/bin/internal/file_writers.py b/epochX/cudacpp/ee_mumu.mad/bin/internal/file_writers.py index 41bff05276..526756129f 100755 --- a/epochX/cudacpp/ee_mumu.mad/bin/internal/file_writers.py +++ b/epochX/cudacpp/ee_mumu.mad/bin/internal/file_writers.py @@ -36,10 +36,10 @@ class FileWriter(io.FileIO): supported_preprocessor_commands = ['if'] preprocessor_command_re=re.compile( - "\s*(?P%s)\s*\(\s*(?P.*)\s*\)\s*{\s*"\ + r"\s*(?P%s)\s*\(\s*(?P.*)\s*\)\s*{\s*"\ %('|'.join(supported_preprocessor_commands))) preprocessor_endif_re=re.compile(\ - "\s*}\s*(?Pelse)?\s*(\((?P.*)\))?\s*(?P{)?\s*") + r"\s*}\s*(?Pelse)?\s*(\((?P.*)\))?\s*(?P{)?\s*") class FileWriterError(IOError): """Exception raised if an error occurs in the definition @@ -191,15 +191,15 @@ class FortranWriterError(FileWriter.FileWriterError): pass # Parameters defining the output of the Fortran writer - keyword_pairs = {'^if.+then\s*$': ('^endif', 2), - '^type(?!\s*\()\s*.+\s*$': ('^endtype', 2), - '^do(?!\s+\d+)\s+': ('^enddo\s*$', 2), - '^subroutine': ('^end\s*$', 0), - '^module': ('^end\s*$', 0), - 'function': ('^end\s*$', 0)} - single_indents = {'^else\s*$':-2, - '^else\s*if.+then\s*$':-2} - number_re = re.compile('^(?P\d+)\s+(?P.*)') + keyword_pairs = {r'^if.+then\s*$': ('^endif', 2), + r'^type(?!\s*\()\s*.+\s*$': ('^endtype', 2), + r'^do(?!\s+\d+)\s+': (r'^enddo\s*$', 2), + '^subroutine': (r'^end\s*$', 0), + '^module': (r'^end\s*$', 0), + 'function': (r'^end\s*$', 0)} + single_indents = {r'^else\s*$':-2, + r'^else\s*if.+then\s*$':-2} + number_re = re.compile(r'^(?P\d+)\s+(?P.*)') line_cont_char = '$' comment_char = 'c' uniformcase = True #force everyting to be lower/upper case @@ -212,7 +212,7 @@ class FortranWriterError(FileWriter.FileWriterError): # Private variables __indent = 0 __keyword_list = [] - __comment_pattern = re.compile(r"^(\s*#|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|!)", re.IGNORECASE) + __comment_pattern = re.compile(r"^(\s*#|c\$|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|\s*!|!\$)", re.IGNORECASE) __continuation_line = re.compile(r"(?: )[$&]") def write_line(self, line): @@ -424,26 +424,20 @@ def count_number_of_quotes(self, line): i = i + 1 return len(splitline)-1 - def remove_routine(self, text, fct_names, formatting=True): - """write the incoming text but fully removing the associate routine/function - text can be a path to a file, an iterator, a string - fct_names should be a list of functions to remove + @staticmethod + def get_routine(text, fct_names, call_back=None): + """ + get the fortran function from a fortran file """ - f77_type = ['real*8', 'integer', 'double precision', 'logical'] - pattern = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I) - + + if isinstance(text, str): + text = text.split('\n') + + to_write=False removed = [] - if isinstance(text, str): - if '\n' in text: - text = text.split('\n') - else: - text = open(text) - if isinstance(fct_names, str): - fct_names = [fct_names] - - to_write=True for line in text: fct = pattern.findall(line) if fct: @@ -451,22 +445,38 @@ def remove_routine(self, text, fct_names, formatting=True): to_write = False else: to_write = True - if to_write: - if formatting: - if line.endswith('\n'): - line = line[:-1] - self.writelines(line) - else: - if not line.endswith('\n'): - line = '%s\n' % line - super(FileWriter,self).writelines(line) + if call_back: + call_back(line) else: removed.append(line) - + return removed + + def remove_routine(self, text, fct_names, formatting=True): + """write the incoming text but fully removing the associate routine/function + text can be a path to a file, an iterator, a string + fct_names should be a list of functions to remove + """ + + def call_back(line): + if formatting: + if line.endswith('\n'): + line = line[:-1] + self.writelines(line) + else: + if not line.endswith('\n'): + line = '%s\n' % line + super(FileWriter,self).writelines(line) + + return self.get_routine(text, fct_names, call_back) + +class FortranWriter90(FortranWriter): + + comment_char = ' !' + #=============================================================================== # CPPWriter #=============================================================================== @@ -497,50 +507,50 @@ class CPPWriterError(FileWriter.FileWriterError): '^private': standard_indent, '^protected': standard_indent} - spacing_patterns = [ - ('\s*\"\s*}', '\"'), - ('\s*,\s*', ', '), - ('\s*-\s*', ' - '), - ('([{(,=])\s*-\s*', '\g<1> -'), - ('(return)\s*-\s*', '\g<1> -'), - ('\s*\+\s*', ' + '), - ('([{(,=])\s*\+\s*', '\g<1> +'), - ('\(\s*', '('), - ('\s*\)', ')'), - ('\{\s*', '{'), - ('\s*\}', '}'), - ('\s*=\s*', ' = '), - ('\s*>\s*', ' > '), - ('\s*<\s*', ' < '), - ('\s*!\s*', ' !'), - ('\s*/\s*', '/'), - ('(?\s+>\s*', ' >> '), - ('<\s*double\s*>>\s*', ' > '), - ('\s*<\s+<\s*', ' << '), - ('\s*-\s+>\s*', '->'), - ('\s*=\s+=\s*', ' == '), - ('\s*!\s+=\s*', ' != '), - ('\s*>\s+=\s*', ' >= '), - ('\s*<\s+=\s*', ' <= '), - ('\s*&&\s*', ' && '), - ('\s*\|\|\s*', ' || '), - ('\s*{\s*}', ' {}'), - ('\s*;\s*', '; '), - (';\s*\}', ';}'), - (';\s*$}', ';'), - ('\s*<\s*([a-zA-Z0-9]+?)\s*>', '<\g<1>>'), - ('^#include\s*<\s*(.*?)\s*>', '#include <\g<1>>'), - ('(\d+\.{0,1}\d*|\.\d+)\s*[eE]\s*([+-]{0,1})\s*(\d+)', - '\g<1>e\g<2>\g<3>'), - ('\s+',' '), - ('^\s*#','#')] + spacing_patterns = [(r'\s*\"\s*}', '\"'), + (r'\s*,\s*', ', '), + (r'\s*-\s*', ' - '), + (r'([{(,=])\s*-\s*', r'\g<1> -'), + (r'(return)\s*-\s*', r'\g<1> -'), + (r'\s*\+\s*', ' + '), + (r'([{(,=])\s*\+\s*', r'\g<1> +'), + (r'\(\s*', '('), + (r'\s*\)', ')'), + (r'\{\s*', '{'), + (r'\s*\}', '}'), + (r'\s*=\s*', ' = '), + (r'\s*>\s*', ' > '), + (r'\s*<\s*', ' < '), + (r'\s*!\s*', ' !'), + (r'\s*/\s*', '/'), + (r'\s*\*\s*', ' * '), + (r'\s*-\s+-\s*', '-- '), + (r'\s*\+\s+\+\s*', '++ '), + (r'\s*-\s+=\s*', ' -= '), + (r'\s*\+\s+=\s*', ' += '), + (r'\s*\*\s+=\s*', ' *= '), + (r'\s*/=\s*', ' /= '), + (r'\s*>\s+>\s*', ' >> '), + (r'<\s*double\s*>>\s*', ' > '), + (r'\s*<\s+<\s*', ' << '), + (r'\s*-\s+>\s*', '->'), + (r'\s*=\s+=\s*', ' == '), + (r'\s*!\s+=\s*', ' != '), + (r'\s*>\s+=\s*', ' >= '), + (r'\s*<\s+=\s*', ' <= '), + (r'\s*&&\s*', ' && '), + (r'\s*\|\|\s*', ' || '), + (r'\s*{\s*}', ' {}'), + (r'\s*;\s*', '; '), + (r';\s*\}', ';}'), + (r';\s*$}', ';'), + (r'\s*<\s*([a-zA-Z0-9]+?)\s*>', r'<\g<1>>'), + (r'^#include\s*<\s*(.*?)\s*>', r'#include <\g<1>>'), + (r'(\d+\.{0,1}\d*|\.\d+)\s*[eE]\s*([+-]{0,1})\s*(\d+)', + r'\g<1>e\g<2>\g<3>'), + (r'\s+',' '), + (r'^\s*#','#')] + spacing_re = dict([(key[0], re.compile(key[0])) for key in \ spacing_patterns]) diff --git a/epochX/cudacpp/ee_mumu.mad/bin/internal/gen_crossxhtml.py b/epochX/cudacpp/ee_mumu.mad/bin/internal/gen_crossxhtml.py index d58ec573bc..681bf9d09b 100755 --- a/epochX/cudacpp/ee_mumu.mad/bin/internal/gen_crossxhtml.py +++ b/epochX/cudacpp/ee_mumu.mad/bin/internal/gen_crossxhtml.py @@ -648,7 +648,7 @@ def recreate(self, banner): if run_card['ickkw'] != 0: #parse the file to have back the information pythia_log = misc.BackRead(pjoin(path, '%s_pythia.log' % tag)) - pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") + pythiare = re.compile(r"\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") for line in pythia_log: info = pythiare.search(line) if not info: @@ -1623,7 +1623,7 @@ def get_html(self, runresults): elif self.debug: text = str(self.debug).replace('. ','.
') if 'http' in text: - pat = re.compile('(http[\S]*)') + pat = re.compile(r'(http[\S]*)') text = pat.sub(r' here ', text) debug = '
%s
%s
' % \ (self.debug.__class__.__name__, text) diff --git a/epochX/cudacpp/ee_mumu.mad/bin/internal/gen_ximprove.py b/epochX/cudacpp/ee_mumu.mad/bin/internal/gen_ximprove.py index c86da36a05..415ecc9de0 100755 --- a/epochX/cudacpp/ee_mumu.mad/bin/internal/gen_ximprove.py +++ b/epochX/cudacpp/ee_mumu.mad/bin/internal/gen_ximprove.py @@ -158,8 +158,11 @@ def get_helicity(self, to_submit=True, clean=True): (stdout, _) = p.communicate(''.encode()) stdout = stdout.decode('ascii',errors='ignore') if stdout: - nb_channel = max([math.floor(float(d)) for d in stdout.split()]) + lines = stdout.strip().split('\n') + nb_channel = max([math.floor(float(d)) for d in lines[-1].split()]) else: + if os.path.exists(pjoin(self.me_dir, 'error')): + os.remove(pjoin(self.me_dir, 'error')) for matrix_file in misc.glob('matrix*orig.f', Pdir): files.cp(matrix_file, matrix_file.replace('orig','optim')) P_zero_result.append(Pdir) @@ -297,12 +300,14 @@ def get_helicity(self, to_submit=True, clean=True): bad_amps_perhel = [] if __debug__: mtext = open(matrix_file).read() - nb_amp = int(re.findall('PARAMETER \(NGRAPHS=(\d+)\)', mtext)[0]) - logger.debug('nb_hel: %s zero amp: %s bad_amps_hel: %s/%s', len(good_hels),len(bad_amps),len(bad_amps_perhel), len(good_hels)*nb_amp ) + nb_amp = int(re.findall(r'PARAMETER \(NGRAPHS=(\d+)\)', mtext)[0]) + logger.debug('(%s) nb_hel: %s zero amp: %s bad_amps_hel: %s/%s', split_file[-1], len(good_hels),len(bad_amps),len(bad_amps_perhel), len(good_hels)*nb_amp ) if len(good_hels) == 1: files.cp(matrix_file, matrix_file.replace('orig','optim')) continue # avoid optimization if onlye one helicity - recycler = hel_recycle.HelicityRecycler(good_hels, bad_amps, bad_amps_perhel) + + gauge = self.cmd.proc_characteristics['gauge'] + recycler = hel_recycle.HelicityRecycler(good_hels, bad_amps, bad_amps_perhel, gauge=gauge) # In case of bugs you can play around with these: recycler.hel_filt = self.run_card['hel_filtering'] recycler.amp_splt = self.run_card['hel_splitamp'] @@ -1299,7 +1304,7 @@ def get_job_for_event(self): 'script_name': 'unknown', 'directory': C.name, # need to be change for splitted job 'P_dir': C.parent_name, - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # needed for RO gridpack 'offset': 1, # need to be change for splitted job 'nevents': nevents, 'maxiter': self.max_iter, @@ -1387,7 +1392,7 @@ def create_ajob(self, template, jobs, write_dir=None): break info = jobs[j] info['script_name'] = 'ajob%i' % script_number - info['keeplog'] = 'false' + info['keeplog'] = 'false' if self.run_card['keep_log'] != 'debug' else 'true' if "base_directory" not in info: info["base_directory"] = "./" fsock.write(template_text % info) @@ -1456,7 +1461,7 @@ def get_job_for_precision(self): 'script_name': 'unknown', 'directory': C.name, # need to be change for splitted job 'P_dir': C.parent_name, - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # used for RO gridpack 'offset': 1, # need to be change for splitted job 'nevents': nevents, 'maxiter': self.max_iter, @@ -1916,7 +1921,7 @@ def get_job_for_event(self): 'directory': C.name, # need to be change for splitted job 'P_dir': os.path.basename(C.parent_name), 'offset': 1, # need to be change for splitted job - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # use for RO gridpack 'nevents': nevents, #int(nevents*self.gen_events_security)+1, 'maxiter': self.max_iter, 'miniter': self.min_iter, diff --git a/epochX/cudacpp/ee_mumu.mad/bin/internal/hel_recycle.py b/epochX/cudacpp/ee_mumu.mad/bin/internal/hel_recycle.py index dfa45d5d20..6c86611f68 100755 --- a/epochX/cudacpp/ee_mumu.mad/bin/internal/hel_recycle.py +++ b/epochX/cudacpp/ee_mumu.mad/bin/internal/hel_recycle.py @@ -383,7 +383,7 @@ def get_number(cls, *args): class HelicityRecycler(): '''Class for recycling helicity''' - def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[]): + def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[], gauge='U'): External.good_hel = [] External.nhel_lines = '' @@ -427,6 +427,7 @@ def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[]): self.all_hel = [] self.hel_filt = True + self.gauge = gauge def set_input(self, file): if 'born_matrix' in file: @@ -612,7 +613,7 @@ def unfold_helicities(self, line, nature): def apply_amps(self, line, new_objs): if self.amp_splt: - return split_amps(line, new_objs) + return split_amps(line, new_objs, gauge=self.gauge) else: return apply_args(line, [i.args for i in new_objs]) @@ -785,7 +786,7 @@ def apply_args(old_line, all_the_args): return ''.join(new_lines) -def split_amps(line, new_amps): +def split_amps(line, new_amps, gauge): if not new_amps: return '' fct = line.split('(',1)[0].split('_0')[0] @@ -841,34 +842,31 @@ def split_amps(line, new_amps): spin = fct.split(None,1)[1][to_remove] lines.append('%sP1N_%s(%s)' % (fct, to_remove+1, ', '.join(args))) - hel, iamp = re.findall('AMP\((\d+),(\d+)\)', amp_result)[0] + hel, iamp = re.findall(r'AMP\((\d+),(\d+)\)', amp_result)[0] hel_calculated.append(hel) #lines.append(' %(result)s = TMP(3) * W(3,%(w)s) + TMP(4) * W(4,%(w)s)+' # % {'result': amp_result, 'w': windex}) #lines.append(' & TMP(5) * W(5,%(w)s)+TMP(6) * W(6,%(w)s)' # % {'result': amp_result, 'w': windex}) - if spin in "VF": - lines.append(""" call CombineAmp(%(nb)i, - & (/%(hel_list)s/), - & (/%(w_list)s/), - & TMP, W, AMP(1,%(iamp)s))""" % - {'nb': len(sub_amps), - 'hel_list': ','.join(hel_calculated), - 'w_list': ','.join(windices), - 'iamp': iamp - }) + if spin == "F" or ( spin == "V" and gauge !='FD'): + suffix = '' elif spin == "S": - lines.append(""" call CombineAmpS(%(nb)i, - &(/%(hel_list)s/), - & (/%(w_list)s/), - & TMP, W, AMP(1,%(iamp)s))""" % - {'nb': len(sub_amps), - 'hel_list': ','.join(hel_calculated), - 'w_list': ','.join(windices), - 'iamp': iamp - }) + suffix = 'S' + elif spin == "V" and gauge == "FD": + suffix = "FD" else: - raise Exception("split amp are not supported for spin2 and 3/2") + raise Exception("split amp not supported for spin2, 3/2") + + lines.append(""" call CombineAmp%(suffix)s(%(nb)i, + & (/%(hel_list)s/), + & (/%(w_list)s/), + & TMP, W, AMP(1,%(iamp)s))""" % {'suffix':suffix, + 'nb': len(sub_amps), + 'hel_list': ','.join(hel_calculated), + 'w_list': ','.join(windices), + 'iamp': iamp + }) + #lines.append('') return '\n'.join(lines) diff --git a/epochX/cudacpp/ee_mumu.mad/bin/internal/histograms.py b/epochX/cudacpp/ee_mumu.mad/bin/internal/histograms.py index 98f22c4c3a..9931127f66 100755 --- a/epochX/cudacpp/ee_mumu.mad/bin/internal/histograms.py +++ b/epochX/cudacpp/ee_mumu.mad/bin/internal/histograms.py @@ -632,34 +632,34 @@ class HwU(Histogram): # than necessary because the HwU standard allows for spaces from within # the name of a weight weight_header_re = re.compile( - '&\s*(?P(\S|(\s(?!\s*(&|$))))+)(\s(?!(&|$)))*') + r'&\s*(?P(\S|(\s(?!\s*(&|$))))+)(\s(?!(&|$)))*') # ================================ # Histo weight specification RE's # ================================ # The start of a plot - histo_start_re = re.compile('^\s*\s*(?P\d+)\s*"\s*'+ - '(?P(\S|(\s(?!\s*")))+)\s*"\s*$') + histo_start_re = re.compile(r'^\s*\s*(?P\d+)\s*"\s*'+ + r'(?P(\S|(\s(?!\s*")))+)\s*"\s*$') # A given weight specifier - a_float_re = '[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' - histo_bin_weight_re = re.compile('(?P%s|NaN)'%a_float_re,re.IGNORECASE) - a_int_re = '[\+|-]?\d+' + a_float_re = r'[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' + histo_bin_weight_re = re.compile(r'(?P%s|NaN)'%a_float_re,re.IGNORECASE) + a_int_re = r'[\+|-]?\d+' # The end of a plot histo_end_re = re.compile(r'^\s*<\\histogram>\s*$') # A scale type of weight - weight_label_scale = re.compile('^\s*mur\s*=\s*(?P%s)'%a_float_re+\ - '\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) - weight_label_PDF = re.compile('^\s*PDF\s*=\s*(?P\d+)\s*$') - weight_label_PDF_XML = re.compile('^\s*pdfset\s*=\s*(?P\d+)\s*$') - weight_label_TMS = re.compile('^\s*TMS\s*=\s*(?P%s)\s*$'%a_float_re) - weight_label_alpsfact = re.compile('^\s*alpsfact\s*=\s*(?P%s)\s*$'%a_float_re, + weight_label_scale = re.compile(r'^\s*mur\s*=\s*(?P%s)'%a_float_re+\ + r'\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) + weight_label_PDF = re.compile(r'^\s*PDF\s*=\s*(?P\d+)\s*$') + weight_label_PDF_XML = re.compile(r'^\s*pdfset\s*=\s*(?P\d+)\s*$') + weight_label_TMS = re.compile(r'^\s*TMS\s*=\s*(?P%s)\s*$'%a_float_re) + weight_label_alpsfact = re.compile(r'^\s*alpsfact\s*=\s*(?P%s)\s*$'%a_float_re, re.IGNORECASE) - weight_label_scale_adv = re.compile('^\s*dyn\s*=\s*(?P%s)'%a_int_re+\ - '\s*mur\s*=\s*(?P%s)'%a_float_re+\ - '\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) - weight_label_PDF_adv = re.compile('^\s*PDF\s*=\s*(?P\d+)\s+(?P\S+)\s*$') + weight_label_scale_adv = re.compile(r'^\s*dyn\s*=\s*(?P%s)'%a_int_re+\ + r'\s*mur\s*=\s*(?P%s)'%a_float_re+\ + r'\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) + weight_label_PDF_adv = re.compile(r'^\s*PDF\s*=\s*(?P\d+)\s+(?P\S+)\s*$') class ParseError(MadGraph5Error): @@ -926,7 +926,7 @@ def get_HwU_source(self, print_header=True): res.append(' '.join('%+16.7e'%wgt for wgt in list(bin.boundaries))) res[-1] += ' '.join('%+16.7e'%bin.wgts[key] for key in self.bins.weight_labels if key not in ['central','stat_error']) - res.append('<\histogram>') + res.append(r'<\histogram>') return res def output(self, path=None, format='HwU', print_header=True): @@ -1149,6 +1149,8 @@ def parse_one_histo_from_stream(self, stream, all_weight_header, boundaries = [0.0,0.0] for j, weight in \ enumerate(HwU.histo_bin_weight_re.finditer(line_bin)): + if (j == len(weight_header)): + continue if j == len(all_weight_header): raise HwU.ParseError("There is more bin weights"+\ " specified than expected (%i)"%len(weight_header)) @@ -1803,7 +1805,7 @@ def parse_histos_from_PY8_XML_stream(self, stream, run_id=None, # Filter empty weights coming from the split weight_label_list = [wgt.strip() for wgt in str(selected_run_node.getAttribute('header')).split(';') if - not re.match('^\s*$',wgt)] + not re.match(r'^\s*$',wgt)] ordered_weight_label_list = [w for w in weight_label_list if w not\ in ['xmin','xmax']] # Remove potential repetition of identical weight labels @@ -1827,7 +1829,7 @@ def parse_histos_from_PY8_XML_stream(self, stream, run_id=None, all_weights = [] for wgt_position, wgt_label in \ enumerate(str(selected_run_node.getAttribute('header')).split(';')): - if not re.match('^\s*$',wgt_label) is None: + if not re.match(r'^\s*$',wgt_label) is None: continue all_weights.append({'POSITION':wgt_position}) for wgt_item in wgt_label.strip().split('_'): @@ -2714,7 +2716,7 @@ def ratio_no_correlations(wgtsA, wgtsB): # First the global gnuplot header for this histogram group global_header =\ -""" +r""" ################################################################################ ### Rendering of the plot titled '%(title)s' ################################################################################ @@ -2862,9 +2864,9 @@ def ratio_no_correlations(wgtsA, wgtsB): major_title = ', '.join(major_title) if not mu[0] in ['none',None]: - major_title += ', dynamical\_scale\_choice=%s'%mu[0] + major_title += r', dynamical\_scale\_choice=%s'%mu[0] if not pdf[0] in ['none',None]: - major_title += ', PDF=%s'%pdf[0].replace('_','\_') + major_title += ', PDF=%s'%pdf[0].replace('_',r'\_') # Do not show uncertainties for individual jet samples (unless first # or specified explicitely and uniquely) @@ -2937,7 +2939,7 @@ def ratio_no_correlations(wgtsA, wgtsB): plot_lines.append( "'%s' index %d using (($1+$2)/2):%d ls %d title '%s'"\ %(HwU_name,block_position+i,mu_var+3,color_index,\ -'%s dynamical\_scale\_choice=%s' % (title,mu[j]))) +r'%s dynamical\_scale\_choice=%s' % (title,mu[j]))) # And now PDF_variation if available if not PDF_var_pos is None: for j,PDF_var in enumerate(PDF_var_pos): @@ -2947,7 +2949,7 @@ def ratio_no_correlations(wgtsA, wgtsB): plot_lines.append( "'%s' index %d using (($1+$2)/2):%d ls %d title '%s'"\ %(HwU_name,block_position+i,PDF_var+3,color_index,\ -'%s PDF=%s' % (title,pdf[j].replace('_','\_')))) +'%s PDF=%s' % (title,pdf[j].replace('_',r'\_')))) # Now add the uncertainty lines, those not using a band so that they # are not covered by those using a band after we reverse plo_lines diff --git a/epochX/cudacpp/ee_mumu.mad/bin/internal/launch_plugin.py b/epochX/cudacpp/ee_mumu.mad/bin/internal/launch_plugin.py index 7b10bedcef..9ec09eb71d 100644 --- a/epochX/cudacpp/ee_mumu.mad/bin/internal/launch_plugin.py +++ b/epochX/cudacpp/ee_mumu.mad/bin/internal/launch_plugin.py @@ -98,6 +98,7 @@ def default_setup(self): self['vector_size'] = 16 # already setup in default class (just change value) self['aloha_flag'] = '--fast-math' self['matrix_flag'] = '-O3' + self['limhel'] = 0 self.display_block.append('simd') self.display_block.append('psoptim') 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 eee9ba4522..f6e47956cd 100755 --- a/epochX/cudacpp/ee_mumu.mad/bin/internal/lhe_parser.py +++ b/epochX/cudacpp/ee_mumu.mad/bin/internal/lhe_parser.py @@ -7,6 +7,7 @@ import numbers import math import time +import copy import os import shutil import sys @@ -101,7 +102,7 @@ def __init__(self, line=None, event=None): self.rwgt = 0 return - + self.event = event if event is not None: self.event_id = len(event) #not yet in the event @@ -1066,6 +1067,8 @@ def define_init_banner(self, wgt, lha_strategy, proc_charac=None): #special case for 1>N init_information = run_card.get_banner_init_information() event = next(self) + if not len(event): #if parse-momenta was false we have to parse the first event + event = Event(str(event)) init_information["idbmup1"] = event[0].pdg init_information["ebmup1"] = event[0].mass init_information["idbmup2"] = 0 @@ -1149,6 +1152,7 @@ def initialize_unweighting(self, getwgt, trunc_error): nb_keep = max(20, int(nb_event*trunc_error*15)) new_wgt = new_wgt[-nb_keep:] if nb_event == 0: + misc.sprint(i,f) raise Exception # store the information self.initial_nb_events[i] = nb_event @@ -1203,7 +1207,6 @@ def unweight(self, outputpath, get_wgt, **opts): (stop to write event when target is reached) """ - if isinstance(get_wgt, (str,six.text_type)): unwgt_name =get_wgt def get_wgt_multi(event): @@ -1483,12 +1486,12 @@ def reorder_mother_child(self): particle.mother2 -= 1 # re-call the function for the next potential change return self.reorder_mother_child() - - - - - + + + + + def parse_reweight(self): """Parse the re-weight information in order to return a dictionary {key: value}. If no group is define group should be '' """ @@ -1522,6 +1525,37 @@ def parse_nlo_weight(self, real_type=(1,11), threshold=None): threshold=threshold) return self.nloweight + def get_fks_pair(self, real_type=(1,11), threshold=None): + """ Gives the fks pair labels""" + start, stop = self.tag.find(''), self.tag.find('') + if start != -1 != stop: + text = self.tag[start+8:stop] + all_line = text.split('\n') + text = text.lower().replace('d','e') + all_line = text.split('\n') + for line in all_line: + data = line.split() + if len(data)>16: + wgt = OneNLOWeight(line, real_type=real_type) + return wgt.to_merge_pdg,wgt.nexternal + + def get_born_momenta(self,real_type=(1,11), threshold=None): + """ Gets the underlying n+1 body kinematics""" + start, stop = self.tag.find(''), self.tag.find('') + if start != -1 != stop: + text = self.tag[start+8:stop] + text = text.lower().replace('d','e') + all_line = text.split('\n') + for line in all_line: + data = line.split() + if len(data)>16: + wgt = OneNLOWeight(line, real_type=real_type) + nexternal = wgt.nexternal + real_momenta = all_line[2:2+nexternal] + return real_momenta + + + def rewrite_nlo_weight(self, wgt=None): """get the string associate to the weight""" @@ -1558,11 +1592,11 @@ def parse_lo_weight(self): return self.loweight if not hasattr(Event, 'loweight_pattern'): - Event.loweight_pattern = re.compile('''\s*(?P\d+)\s+(?P[\d.e+-]+)\s*\s*\n\s* - \s*(?P[\s\d.+-e]+)\s*\s*\n\s* - 1|2)["']?\>\s*(?P[\s\d.e+-]*)\s*\s*\n\s* - 1|2)["']?\>\s*(?P[\s\d.e+-]*)\s*\s*\n\s* - \s*(?P[\d.e+-]*)\s* + Event.loweight_pattern = re.compile('''\\s*(?P\\d+)\\s+(?P[\\d.e+-]+)\\s*\\s*\n\\s* + \\s*(?P[\\s\\d.+-e]+)\\s*\\s*\n\\s* + 1|2)["']?\\>\\s*(?P[\\s\\d.e+-]*)\\s*\\s*\n\\s* + 1|2)["']?\\>\\s*(?P[\\s\\d.e+-]*)\\s*\\s*\n\\s* + \\s*(?P[\\d.e+-]*)\\s* ''',re.X+re.I+re.M) start, stop = self.tag.find(''), self.tag.find('') @@ -1615,7 +1649,7 @@ def parse_matching_scale(self): self.matched_scale_data = [] - pattern = re.compile("") + pattern = re.compile(r"") data = re.split(pattern,self.tag) if len(data) == 1: return [] @@ -1623,7 +1657,7 @@ def parse_matching_scale(self): tmp = {} start,content, end = data self.tag = "%s%s" % (start, end) - pattern = re.compile("pt_clust_(\d*)=\"([\de+-.]*)\"") + pattern = re.compile("pt_clust_(\\d*)=\"([\\de+-.]*)\"") for id,value in pattern.findall(content): tmp[int(id)] = float(value) for i in range(1, len(self)+1): @@ -1647,7 +1681,7 @@ def parse_syscalc_info(self): return self.syscalc_data pattern = re.compile("|") - pattern2 = re.compile("<(?P[\w]*)(?:\s*(\w*)=[\"'](.*)[\"']\s*|\s*)>(.*)") + pattern2 = re.compile("<(?P[\\w]*)(?:\\s*(\\w*)=[\"'](.*)[\"']\\s*|\\s*)>(.*)") data = re.split(pattern,self.tag) if len(data) == 1: return [] @@ -1850,6 +1884,240 @@ def get_decay(self, pdg_code=0, event_id=None): return new_event + + def set_initial_mass_to_zero(self): + """set the masses of the initial particles to zero, by reshuffling the respective momenta + Works only in the **partonic** com frame, so the event must be boosted to such frame + before calling the function + """ + + if not misc.equal(self[0].px, 0) or not misc.equal(self[1].px, 0) or \ + not misc.equal(self[0].py, 0) or not misc.equal(self[1].py, 0) or \ + not misc.equal(self[0].pz, - self[1].pz, zero_limit=False): + misc.sprint(self[0]) + misc.sprint(self[1]) + raise Exception('momenta should be in the partonic center of mass frame') + + self[0].mass = 0. + self[1].mass = 0. + tot_E=0. + for ip,part in enumerate(self): + if part.status == 1 : + tot_E += part.E + if (self[0].pz > 0. and self[1].pz < 0): + self[0].set_momentum(FourMomentum([tot_E/2., 0., 0., tot_E/2.])) + self[1].set_momentum(FourMomentum([tot_E/2., 0., 0., -tot_E/2.])) + elif (self[0].pz < 0. and self[1].pz > 0): + self[0].set_momentum(FourMomentum([tot_E/2., 0., 0., -tot_E/2.])) + self[1].set_momentum(FourMomentum([tot_E/2., 0., 0., tot_E/2.])) + else: + logger.critical('ERROR: two incoming partons not back.-to-back') + + def set_final_jet_mass_to_zero(self): + """set the final light particle masses to zero + """ + + for ip,part in enumerate(self): + if ((abs(part.pid) <= 5) or (abs(part.pid) == 11) or (abs(part.pid) == 12)) and (part.status == 1): + part.mass = 0. + E_1_new = math.sqrt(part.mass**2 + part.px**2 + part.py**2 + part.pz**2) + part.set_momentum(FourMomentum([E_1_new, part.px, part.py, part.pz])) + + + + def merge_particles_kinematics(self, i,j, moth): + """Map to an underlying n-body kinematics for two given + particles i,j to be merged and a resulting moth""" + """ note! kinematics (and id) mapping only! """ + + recoil = True + fks_type = False + + if recoil and not fks_type: + if (i == moth[0].get('number')-1): + fks_i = i + fks_j = j + elif (j == moth[0].get('number')-1): + fks_i = j + fks_j = i + to_remove = fks_j + + merge_i = self[fks_i] + merge_j = self[fks_j] + + i_4mom = FourMomentum(merge_i) + j_4mom = FourMomentum(merge_j) + if (fks_i <= 1): + sign1 = -1.0 + else: + sign1 = 1.0 + mother_4mom = i_4mom + sign1*j_4mom + + new_event = copy.deepcopy(self) + + self[fks_i].pid = moth[0]['id'] + self[fks_i].set_momentum(mother_4mom) + + if fks_i <= 1: # initial-state recoil + new_p = FourMomentum() + for ip,part in enumerate(self): + if (ip != fks_i and ip != fks_j and ip >= 2): + new_p += part + + if fks_i == 0: + self[1].set_momentum(new_p - FourMomentum(self[0])) + elif fks_i == 1: + self[0].set_momentum(new_p - FourMomentum(self[1])) + + pz_1_new = self.recoil_eq(self[0],self[1]) + pz_2_new = self[0].pz + self[1].pz - pz_1_new + E_1_new = math.sqrt(self[0].mass**2 + self[0].px**2 + self[0].py**2 + pz_1_new **2) + E_2_new = math.sqrt(self[1].mass**2 + self[1].px**2 + self[1].py**2 + pz_2_new **2) + self[0].set_momentum(FourMomentum([E_1_new,self[0].px,self[0].py,pz_1_new])) + self[1].set_momentum(FourMomentum([E_2_new,self[1].px,self[1].py,pz_2_new])) + self.pop(to_remove) + + if fks_i > 1: # final-state recoil + + # Re-scale the energy of fks_i to make it on-shell + for ip,part in enumerate(self): + if (ip == fks_i): + part.E = math.sqrt(part.mass**2 + part.px**2 + part.py**2 + part.pz**2) + new_p.E = part.E + + # Find the overall energy in the final state + new_p.E = 0.0 + for ip,part in enumerate(self): + if (ip != fks_j and ip >= 2): + new_p.E += part.E + + # Use one of the initial states to absorb the energy change in the final state + self[1].set_momentum(FourMomentum([new_p.E-self[0].E,self[1].px,self[1].py,self[1].pz])) + + # Change the initial state pz and E + pz_1_new = self.recoil_eq(self[0],self[1]) + pz_2_new = self[0].pz + self[1].pz - pz_1_new + E_1_new = math.sqrt(self[0].mass**2 + self[0].px**2 + self[0].py**2 + pz_1_new **2) + E_2_new = math.sqrt(self[1].mass**2 + self[1].px**2 + self[1].py**2 + pz_2_new **2) + self[0].set_momentum(FourMomentum([E_1_new,self[0].px,self[0].py,pz_1_new])) + self[1].set_momentum(FourMomentum([E_2_new,self[1].px,self[1].py,pz_2_new])) + self.pop(to_remove) + + elif fks_type and not recoil: + ## Do it in a more FKS-style + if (i == moth[0].get('number')-1): + fks_i = i + fks_j = j + elif (j == moth[0].get('number')-1): + fks_i = j + fks_j = i + to_remove = fks_j + new_event = copy.copy(event) + + if fks_i <= 1: # initial-state recoil + + # First boost to partonic CM frame + q = FourMomentum(self[0])+FourMomentum(self[1]) + for ip,part in enumerate(self): + vec = FourMomentum(part) + self[ip].set_momentum(vec.zboost(pboost=q)) + + k_tot = FourMomentum([self[0].E+self[1].E-self[fks_j].E,self[0].px+self[1].px-self[fks_j].px,\ + self[0].py+self[1].py-self[fks_j].py,self[0].pz+self[1].pz-self[fks_j].pz]) + + final = FourMomentum([0,0,0,0]) + for ip,part in enumerate(self): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + if (ip != fks_i and ip != fks_j and ip >= 2): + final = final + vec + + s = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz])**2 + ksi = self[fks_j].E/(math.sqrt(s)/2.0) + y = self[fks_j].pz/self[fks_j].E + + self[0].pz = self[0].pz * math.sqrt(1.0-ksi)*math.sqrt((2.0-ksi*(1.0+y))/((2.0-ksi*(1.0-y)))) + self[0].E = math.sqrt(self[0].mass**2 + self[0].pz**2) + self[1].pz = self[1].pz * math.sqrt(1.0-ksi)*math.sqrt((2.0-ksi*(1.0-y))/((2.0-ksi*(1.0+y)))) + self[1].E = math.sqrt(self[1].mass**2 + self[1].pz**2) + + final = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + k_tot_1 = k_tot.zboost(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + k_tot_2 = k_tot_1.pt_boost(pboost=FourMomentum([k_tot_1.E,k_tot_1.px,k_tot_1.py,k_tot_1.pz])) + k_tot_3 = k_tot_2.zboost_inv(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + + for ip,part in enumerate(self): + if (ip >= 2): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + vec2 = vec.zboost(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + vec3 = vec2.pt_boost(pboost=FourMomentum([k_tot_1.E,k_tot_1.px,k_tot_1.py,k_tot_1.pz])) + vec_new = vec3.zboost_inv(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + self[ip].set_momentum(FourMomentum([vec_new.E,vec_new.px,vec_new.py,vec_new.pz])) + + self.pop(to_remove) + + else: # final-state recoil + q = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + for ip,part in enumerate(self): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + self[ip].set_momentum(vec.zboost(pboost=q)) + + q = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + k = FourMomentum([self[fks_i].E+self[fks_j].E,self[fks_i].px+self[fks_j].px,\ + self[fks_i].py+self[fks_j].py,self[fks_i].pz+self[fks_j].pz]) + + k_rec = FourMomentum([0,0,0,0]) + for ip,part in enumerate(self): + if ip >= 2 and ip != fks_i and ip != fks_j: # add only final-states to the recoil and not the FKS pair + k_rec = k_rec + FourMomentum([part.E,part.px,part.py,part.pz]) + + k_mom = math.sqrt(k_rec.px**2 + k_rec.py**2 + k_rec.pz**2) + beta = (q**2 - (k_rec.E+k_mom)**2)/(q**2 + (k_rec.E+k_mom)**2) + for ip,part in enumerate(self): + if ip >= 2 and ip != fks_i and ip != fks_j: + vec = FourMomentum([self[ip].E,self[ip].px,self[ip].py,self[ip].pz]) + self[ip].set_momentum(vec.boost_beta(beta,k_rec)) + if ip == fks_i: + self[ip].set_momentum(q - k_rec.boost_beta(beta,k_rec)) + self.pop(to_remove) + else: + logger.info('Error in Sudakov Born mapping: no recoil scheme found!') + + def recoil_eq(self,part1, part2): + """ In general, solves the equation + E1 + E2 = K + p1 + p2 = c + E1^2 - p1^2 = a + E2^2 - p2^2 = b + and returns p1 + """ + thresh = 1e-6 + import random + a = part1.mass**2 + part1.px**2 + part1.py**2 + b = part2.mass**2 + part2.px**2 + part2.py**2 + c = part1.pz + part2.pz + K = part1.E + part2.E + K2 = K**2 + sol1 = (-a*c + b*c + c**3 - c*K2 - math.sqrt(K2*(a**2 + (b + c**2 - K2)**2 - 2*a*(b - c**2 + K2))))/(2*(c**2-K2)) + sol2 = (-a*c + b*c + c**3 - c*K2 + math.sqrt(K2*(a**2 + (b + c**2 - K2)**2 - 2*a*(b - c**2 + K2))))/(2*(c**2-K2)) + + if abs(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2) - (math.sqrt(a+sol2**2) + math.sqrt(b+(c-sol2)**2))) > thresh: + logger.critical('Error in recoil_eq solver 1') + logger.critical(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2)) + logger.critical(math.sqrt(a+sol2**2) + math.sqrt(b+(c-sol2)**2)) + if abs(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2) - K) > thresh: + logger.critical('Error in recoil_eq solver 2') + logger.critical(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2)) + logger.critical(K) + return sol1 + + def boost(self, filter=None): """modify the current event to boost it according to the current filter""" if filter is None: @@ -1861,7 +2129,7 @@ def boost(self, filter=None): if list(filter(p)): pboost += p else: - pboost = FourMomentum(pboost) + pboost = FourMomentum(filter) # change sign of three-component due to helas convention pboost.px *=-1 @@ -1877,7 +2145,7 @@ def check(self): """check various property of the events""" # check that relative error is under control - threshold = 1e-6 + threshold = 1e-4 #1. Check that the 4-momenta are conserved E, px, py, pz = 0,0,0,0 @@ -1920,7 +2188,50 @@ def check(self): self.check_color_structure() #3. check mass - + + def check_kinematics_only(self): + """check various property of the events - only kinematics""" + + # check that relative error is under control + threshold = 1e-3 + + #1. Check that the 4-momenta are conserved + E, px, py, pz = 0,0,0,0 + absE, abspx, abspy, abspz = 0,0,0,0 + for particle in self: + coeff = 1 + if particle.status == -1: + coeff = -1 + elif particle.status != 1: + continue + E += coeff * particle.E + absE += abs(particle.E) + px += coeff * particle.px + py += coeff * particle.py + pz += coeff * particle.pz + abspx += abs(particle.px) + abspy += abs(particle.py) + abspz += abs(particle.pz) + # check mass + fourmass = FourMomentum(particle).mass + + if particle.mass and (abs(particle.mass) - fourmass)/ abs(particle.mass) > threshold: + logger.critical(self) + raise Exception( "Do not have correct mass lhe: %s momentum: %s (error at %s" % (particle.mass, fourmass, (abs(particle.mass) - fourmass)/ abs(particle.mass))) + + if abs(E/absE) > threshold: + logger.critical(self) + raise Exception("Do not conserve Energy %s, %s" % (E/absE, E)) + if abs(px/abspx) > threshold: + logger.critical(self) + raise Exception("Do not conserve Px %s, %s" % (px/abspx, px)) + if abs(py/abspy) > threshold: + logger.critical(self) + raise Exception("Do not conserve Py %s, %s" % (py/abspy, py)) + if abs(pz/abspz) > threshold: + logger.critical(self) + raise Exception("Do not conserve Pz %s, %s" % (pz/abspz, pz)) + def assign_scale_line(self, line, convert=True): """read the line corresponding to global event line @@ -2764,7 +3075,7 @@ def zboost(self, pboost=None, E=0, pz=0): if isinstance(pboost, FourMomentum): E = pboost.E pz = pboost.pz - + #beta = pz/E gamma = E / math.sqrt(E**2-pz**2) gammabeta = pz / math.sqrt(E**2-pz**2) @@ -2778,6 +3089,74 @@ def zboost(self, pboost=None, E=0, pz=0): out.pz = 0 return out + def zboost_inv(self, pboost=None, E=0, pz=0): + """Both momenta should be in the same frame. + The boost perform correspond to the boost required to set pboost at + rest (only z boost applied). + """ + if isinstance(pboost, FourMomentum): + E = pboost.E + pz = pboost.pz + + #beta = pz/E + gamma = E / math.sqrt(E**2-pz**2) + gammabeta = pz / math.sqrt(E**2-pz**2) + + out = FourMomentum([gamma*self.E + gammabeta*self.pz, + self.px, + self.py, + gamma*self.pz + gammabeta*self.E]) + + if abs(out.pz) < 1e-6 * out.E: + out.pz = 0 + return out + + + def pt_boost(self, pboost=None, E=0, pz=0): + """Both momenta should be in the same frame. + The boost perform correspond to the boost required to set pboost at + rest (only pT boost applied). + """ + + if isinstance(pboost, FourMomentum): + E = pboost.E + px = pboost.px + py = pboost.py + mass = math.sqrt(E**2 - px**2 - py**2) + + betax = px/E + betay = py/E + beta = math.sqrt(betax**2+betay**2) + gamma = 1 / math.sqrt(1.0-beta**2) + + out = FourMomentum([gamma*self.E - gamma*betax*self.px - gamma*betay*self.py, + -gamma*betax*self.E + (1.0 + (gamma-1.0)*betax**2/(beta**2))*self.px + (gamma-1.0)*betax*betay/(beta**2)*self.py, + -gamma*betay*self.E + ((gamma-1.0)*betax*betay/(beta**2))*self.px + (1.0+(gamma-1.0)*(betay**2)/(beta**2))*self.py, + self.pz]) + + if abs(out.px) < 1e-6 * out.E: + out.px = 0 + if abs(out.py) < 1e-6 * out.E: + out.py = 0 + return out + + def boost_beta(self,beta,mom): + """ Boost along the three-momentum of mom with a boost of size beta""" + + unit = mom * (1.0/math.sqrt(mom.px**2+mom.py**2+mom.pz**2)) + beta_vec = beta*unit + bx = beta_vec.px + by = beta_vec.py + bz = beta_vec.pz + gamma = 1.0 / math.sqrt(1.0-beta**2) + + out = FourMomentum([gamma*self.E - gamma*bx*self.px - gamma*by*self.py - gamma*bz*self.pz, + -gamma*bx*self.E + (1.0 + (gamma-1.0)*bx**2/(beta**2))*self.px + (gamma-1.0)*bx*by/(beta**2)*self.py + (gamma-1.0)*bx*bz/(beta**2)*self.pz, + -gamma*by*self.E + ((gamma-1.0)*bx*by/(beta**2))*self.px + (1.0+(gamma-1.0)*(by**2)/(beta**2))*self.py + (gamma-1.0)*by*bz/(beta**2)*self.pz, + -gamma*bz*self.E + (gamma-1.0)*bx*bz/(beta**2)*self.px + (gamma-1.0)*(by*bz)/(beta**2)*self.py + (1.0+(gamma-1.0)*bz**2/(beta**2))*self.pz]) + + return out + def boost_to_restframe(self, pboost): """apply the boost transformation such that pboost is at rest in the new frame. First apply a rotation to allign the pboost to the z axis and then use @@ -2789,27 +3168,64 @@ def boost_to_restframe(self, pboost): return out - # write pboost as (E, p cosT sinF, p sinT sinF, p cosF) - # rotation such that it become (E, 0 , 0 , p ) is - # cosT sinF , -sinT , cosT sinF - # sinT cosF , cosT , sinT sinF - # -sinT , 0 , cosF - p = math.sqrt( pboost.px**2 + pboost.py**2+ pboost.pz**2) - cosF = pboost.pz / p - sinF = math.sqrt(1-cosF**2) - sinT = pboost.py/p/sinF - cosT = pboost.px/p/sinF - - out=FourMomentum([self.E, - self.px*cosT*cosF + self.py*sinT*cosF-self.pz*sinF, - -self.px*sinT+ self.py*cosT, - self.px*cosT*sinF + self.py*sinT*sinF + self.pz*cosF - ]) - out = out.zboost(E=pboost.E,pz=p) + # see here https://physics.stackexchange.com/questions/749036/general-lorentz-boost-of-four-momentum-in-cm-frame-particle-physics + vx = pboost.px/pboost.E + vy = pboost.py/pboost.E + vz = pboost.pz/pboost.E + v = pboost.norm/pboost.E + v2 = pboost.norm_sq/pboost.E**2 + gamma = 1./math.sqrt(1.-v**2) + gammo = gamma-1. + out = FourMomentum(E = gamma*(self.E - vx*self.px - vy*self.py - vz*self.pz), + px= -gamma*vx*self.E + (1+gammo*vx**2/v2)*self.px + gammo*vx*vy/v2*self.py + gammo*vx*vz/v2*self.pz, + py= -gamma*vy*self.E + gammo*vy*vx/v2*self.px + (1+gammo*vy**2/v2)*self.py + gammo*vy*vz/v2*self.pz, + pz= -gamma*vz*self.E + gammo*vz*vx/v2*self.px + gammo*vz*vy/v2*self.py + (1+gammo*vz**2/v2)*self.pz) + return out + def rotate_to_z(self,prot): + + import math + import numpy as np + + z = np.array([0.,0.,1.]) + + px = self.px + py = self.py + pz = self.pz + + refx = prot.px + refy = prot.py + refz = prot.pz + + prot_mom = np.array([px, py, pz]) + ref_mom = np.array([refx, refy, refz]) + + # Create normal vector + n = np.array([refy, -refx, 0.]) + n = n * 1./math.sqrt(self.threedot(n,n)) + t = prot_mom - self.threedot(n,prot_mom)*n + p = ref_mom - self.threedot(ref_mom,z)*z + p = p/math.sqrt(self.threedot(p,p)) + + t_pz = np.array([self.threedot(t,p), self.threedot(t,z), 0.]) + costheta = self.threedot(ref_mom,z)* 1./math.sqrt(self.threedot(ref_mom, ref_mom)) + sintheta=math.sqrt(1.-costheta**2) + + sgn = 1. + t_pz_p = np.array([0., 0., 0.]) + t_pz_p[0] = costheta*t_pz[0] + sgn*(-sintheta) * t_pz[1] + t_pz_p[1] = sgn*sintheta*t_pz[0] + costheta * t_pz[1] + + out_mom = self.threedot(n,prot_mom)*n + t_pz_p[0]*p + t_pz_p[1]*z + + out = FourMomentum([self.E,out_mom[0], out_mom[1], out_mom[2] ] ) + + return out - + def threedot(self,a,b): + + return a[0]*b[0]+a[1]*b[1]+a[2]*b[2] class OneNLOWeight(object): 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 2a118e21bf..8e30cf690c 100755 --- a/epochX/cudacpp/ee_mumu.mad/bin/internal/madevent_interface.py +++ b/epochX/cudacpp/ee_mumu.mad/bin/internal/madevent_interface.py @@ -496,7 +496,6 @@ def help_remove(self): logger.info(" the optional '-f' allows to by-pass all security question") logger.info(" The banner can be remove only if all files are removed first.") - class AskRun(cmd.ControlSwitch): """a class for the question on what to do on a madevent run""" @@ -2393,13 +2392,17 @@ def do_generate_events(self, line): # Check argument's validity mode = self.check_generate_events(args) switch_mode = self.ask_run_configuration(mode, args) - if not args: - # No run name assigned -> assigned one automaticaly - self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton') - else: - self.set_run_name(args[0], None, 'parton', True) - args.pop(0) - + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat'), consistency=False) + if not run_card.scan_set: + if not args: + # No run name assigned -> assigned one automaticaly + self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton') + else: + self.set_run_name(args[0], None, 'parton', True) + args.pop(0) + + self.run_generate_events(switch_mode, args) self.postprocessing() @@ -2560,7 +2563,7 @@ def wait_monitoring(Idle, Running, Done): self.update_status("postprocessing contur done", level="rivet") # this decorator handle the loop related to scan. - @common_run.scanparamcardhandling() + @common_run.scanparamcardhandling(run_card_scan=True) def run_generate_events(self, switch_mode, args): if self.proc_characteristics['loop_induced'] and self.options['run_mode']==0: @@ -2593,7 +2596,6 @@ def run_generate_events(self, switch_mode, args): # Regular run mode logger.info('Generating %s events with run name %s' % (self.run_card['nevents'], self.run_name)) - self.exec_cmd('survey %s %s' % (self.run_name,' '.join(args)), postcmd=False) nb_event = self.run_card['nevents'] @@ -2975,7 +2977,7 @@ def update_width_in_param_card(decay_info, initial=None, output=None): particle = 0 # Read BRs for this decay line = param_card[line_number] - while re.search('^(#|\s|\d)', line): + while re.search(r'^(#|\s|\d)', line): line = param_card.pop(line_number) if not particle or line.startswith('#'): line=param_card[line_number] @@ -3226,7 +3228,7 @@ def do_treatcards(self, line, mode=None, opt=None): for line in open(pjoin(bias_module_path,'%s.f'%os.path.basename(bias_module_path))): if start and last: break - if not start and not re.search('c\s*parameters\s*=\s*{',line, re.I): + if not start and not re.search(r'c\s*parameters\s*=\s*{',line, re.I): continue start = True if not line.startswith('C'): @@ -3235,7 +3237,7 @@ def do_treatcards(self, line, mode=None, opt=None): if '{' in line: line = line.split('{')[-1] # split for } ! # - split_result = re.split('(\}|!|\#)', line,1, re.M) + split_result = re.split(r'(\}|!|\#)', line,1, re.M) line = split_result[0] sep = split_result[1] if len(split_result)>1 else None if sep == '}': @@ -3514,8 +3516,8 @@ def pass_in_difficult_integration_mode(self, rate=1): text = open(conf_path).read() min_evt, max_evt = 2500 *(2+rate), 10000*(rate+1) - text = re.sub('''\(min_events = \d+\)''', '(min_events = %i )' % min_evt, text) - text = re.sub('''\(max_events = \d+\)''', '(max_events = %i )' % max_evt, text) + text = re.sub(r'''\(min_events = \d+\)''', '(min_events = %i )' % min_evt, text) + text = re.sub(r'''\(max_events = \d+\)''', '(max_events = %i )' % max_evt, text) fsock = open(conf_path, 'w') fsock.write(text) fsock.close() @@ -3619,7 +3621,7 @@ def do_refine(self, line): alljobs = misc.glob('ajob*', Pdir) #remove associated results.dat (ensure to not mix with all data) - Gre = re.compile("\s*j=(G[\d\.\w]+)") + Gre = re.compile(r"\s*j=(G[\d\.\w]+)") for job in alljobs: Gdirs = Gre.findall(open(job).read()) for Gdir in Gdirs: @@ -3727,58 +3729,126 @@ def do_combine_events(self, line): sum_xsec, sum_xerru, sum_axsec = 0,[],0 Gdirs = self.get_Gdir() Gdirs.sort() - for Gdir in Gdirs: - if os.path.exists(pjoin(Gdir, 'events.lhe')): - result = sum_html.OneResult('') - result.read_results(pjoin(Gdir, 'results.dat')) - sum_xsec += result.get('xsec') - sum_xerru.append(result.get('xerru')) - sum_axsec += result.get('axsec') - - if self.run_card['gridpack'] or self.run_card['nevents']==0: - os.remove(pjoin(Gdir, 'events.lhe')) - continue + partials_info = [] + try: + p = subprocess.Popen(["ulimit", "-n"], stdout=subprocess.PIPE) + out, err = p.communicate() + max_G = out.decode() + if max_G == "unlimited": + max_G =2500 + else: + max_G = int(max_G) - 40 + except Exception as error: + logger.debug(error) + max_G = 80 # max(20, len(Gdirs)/self.options['nb_core']) - AllEvent.add(pjoin(Gdir, 'events.lhe'), - result.get('xsec'), - result.get('xerru'), - result.get('axsec') - ) - - if len(AllEvent) >= 80: #perform a partial unweighting - AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % partials), - get_wgt, log_level=5, trunc_error=1e-2, event_target=self.run_card['nevents']) - AllEvent = lhe_parser.MultiEventFile() - AllEvent.banner = self.banner - AllEvent.add(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % partials), - sum_xsec, - math.sqrt(sum(x**2 for x in sum_xerru)), - sum_axsec) - partials +=1 - if not hasattr(self,'proc_characteristic'): self.proc_characteristic = self.get_characteristics() - if len(AllEvent) == 0: - nb_event = 0 - else: + mycluster = cluster.MultiCore(nb_core=self.options['nb_core']) + + def split(a, n): + """split a list "a" into n chunk of same size (or nearly same size)""" + k, m = divmod(len(a), n) + return (a[i*k+min(i, m):(i+1)*k+min(i+1, m)] for i in range(n)) + + partials_info = [] + if len(Gdirs) >= max_G: + start_unweight= time.perf_counter() + # first check in how many chunk we have to split (always use a multiple of nb_core) + nb_split = 1 + nb_G = len(Gdirs) // (2* self.options['nb_core']) + while nb_G > min(80, max_G): + nb_split += 1 + nb_G = len(Gdirs)//(nb_split*2*self.options['nb_core']) + if nb_G < 10: + nb_split -=1 + nb_G = len(Gdirs)//(nb_split*2*self.options['nb_core']) + + #enforce at least 10 directory per thread + if nb_G > 10 or nb_split>1: + # do the unweighting of each chunk on their own thread + nb_chunk = (nb_split*2*self.options['nb_core']) + else: + nb_chunk = len(Gdirs) // 10 + nb_G =10 + + # security that the number of combine events is too large + if nb_chunk >= max_G: + nb_chunk = max_G -1 + nb_G = len(Gdirs) // nb_chunk + + for i, local_G in enumerate(split(Gdirs, nb_chunk)): + line = [pjoin(self.me_dir, "Events", self.run_name, "partials%d.lhe.gz" % i)] + line.append(pjoin(self.me_dir, 'Events', self.run_name, '%s_%s_banner.txt' % (self.run_name, tag))) + line.append(str(self.results.current['cross'])) + line += local_G + partials_info.append(self.do_combine_events_partial(' '.join(line), preprocess_only=True)) + mycluster.submit(sys.executable, + [pjoin(self.me_dir, 'bin', 'internal', 'madevent_interface.py'), 'combine_events_partial'] + line, + stdout='/dev/null' + ) + + starttime = time.time() + update_status = lambda idle, run, finish: \ + self.update_status((idle, run, finish, 'unweight'), level=None, + force=False, starttime=starttime) + mycluster.wait(self.me_dir, update_status) + # do the final combination + for data in partials_info: + AllEvent.add(*data) + + start_unweight= time.perf_counter() nb_event = AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "unweighted_events.lhe.gz"), get_wgt, trunc_error=1e-2, event_target=self.run_card['nevents'], log_level=logging.DEBUG, normalization=self.run_card['event_norm'], proc_charac=self.proc_characteristic) + + #cleaning + for data in partials_info: + path = data[0] + try: + os.remove(path) + except Exception as error: + try: + os.remove(path[:-3]) # try without the .gz + except: + misc.sprint('no file ', path, 'to clean') + else: + for Gdir in Gdirs: + if os.path.exists(pjoin(Gdir, 'events.lhe')): + result = sum_html.OneResult('') + result.read_results(pjoin(Gdir, 'results.dat')) + sum_xsec += result.get('xsec') + sum_xerru.append(result.get('xerru')) + sum_axsec += result.get('axsec') + + if self.run_card['gridpack'] or self.run_card['nevents']==0: + os.remove(pjoin(Gdir, 'events.lhe')) + continue + + AllEvent.add(pjoin(Gdir, 'events.lhe'), + result.get('xsec'), + result.get('xerru'), + result.get('axsec') + ) + + if len(AllEvent) == 0: + nb_event = 0 + else: + nb_event = AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "unweighted_events.lhe.gz"), + get_wgt, trunc_error=1e-2, event_target=self.run_card['nevents'], + log_level=logging.DEBUG, normalization=self.run_card['event_norm'], + proc_charac=self.proc_characteristic) + + if nb_event < self.run_card['nevents']: + logger.warning("failed to generate enough events. Please follow one of the following suggestions to fix the issue:") + logger.warning(" - set in the run_card.dat 'sde_strategy' to %s", 1 + self.run_card['sde_strategy'] % 2) + logger.warning(" - set in the run_card.dat 'hard_survey' to 1 or 2.") + logger.warning(" - reduce the number of requested events (if set too high)") + logger.warning(" - check that you do not have -integrable- singularity in your amplitude.") + logger.warning(" - regenerate your process directory by selecting another gauge (in particular try FD gauge).") - if nb_event < self.run_card['nevents']: - logger.warning("failed to generate enough events. Please follow one of the following suggestions to fix the issue:") - logger.warning(" - set in the run_card.dat 'sde_strategy' to %s", 1 + self.run_card['sde_strategy'] % 2) - logger.warning(" - set in the run_card.dat 'hard_survey' to 1 or 2.") - logger.warning(" - reduce the number of requested events (if set too high)") - logger.warning(" - check that you do not have -integrable- singularity in your amplitude.") - if partials: - for i in range(partials): - try: - os.remove(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % i)) - except Exception: - os.remove(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe" % i)) self.results.add_detail('nb_event', nb_event) @@ -3789,7 +3859,50 @@ def do_combine_events(self, line): logger.info("combination of events done in %s s ", time.time()-start) self.to_store.append('event') + + ############################################################################ + def do_combine_events_partial(self, line, preprocess_only=False): + """ """ + + AllEvent = lhe_parser.MultiEventFile() + + sum_xsec, sum_xerru, sum_axsec = 0,[],0 + output, banner_path,cross = line.split()[:3] + Gdirs = line.split()[3:] + + cross = float(cross) + if not self.banner: + self.banner = banner_mod.Banner(banner_path) + if not hasattr(self, 'run_card'): + self.run_card = banner_mod.RunCard(self.banner['mgruncard']) + AllEvent.banner = self.banner + + for Gdir in Gdirs: + if os.path.exists(pjoin(Gdir, 'events.lhe')): + result = sum_html.OneResult('') + result.read_results(pjoin(Gdir, 'results.dat')) + sum_xsec += result.get('xsec') + sum_xerru.append(result.get('xerru')) + sum_axsec += result.get('axsec') + + if self.run_card['gridpack'] or self.run_card['nevents']==0: + os.remove(pjoin(Gdir, 'events.lhe')) + continue + if not preprocess_only: + AllEvent.add(pjoin(Gdir, 'events.lhe'), + result.get('xsec'), + result.get('xerru'), + result.get('axsec') + ) + if preprocess_only: + return output, sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), sum_axsec + nb_event = max(min(abs(1.01*self.run_card['nevents']*sum_axsec/cross),self.run_card['nevents']), 10) + get_wgt = lambda event: event.wgt + AllEvent.unweight(output, + get_wgt, log_level=5, trunc_error=1e-2, event_target=nb_event) + return output, sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), sum_axsec + ############################################################################ def correct_bias(self): """check the first event and correct the weight by the bias @@ -3902,13 +4015,19 @@ def do_store_events(self, line): #except Exception: # continue # Store log - try: - if os.path.exists(pjoin(G_path, 'log.txt')): - input = pjoin(G_path, 'log.txt') + input = pjoin(G_path, 'log.txt') + if os.path.exists(input): + if self.run_card['keep_log'] not in ["none", "minimal"]: output = pjoin(G_path, '%s_log.txt' % run) - files.mv(input, output) - except Exception: - continue + try: + files.mv(input, output) + except Exception: + continue + elif self.run_card['keep_log'] == "none": + try: + os.remove(input) + except Exception: + continue #try: # # Grid # for name in ['ftn26']: @@ -3989,7 +4108,7 @@ def do_create_gridpack(self, line): misc.call(['./bin/internal/make_gridpack'], cwd=self.me_dir) files.mv(pjoin(self.me_dir, 'gridpack.tar.gz'), pjoin(self.me_dir, '%s_gridpack.tar.gz' % self.run_name)) - os.system("sed -i.bak \"s/\s*.true.*=.*GridRun/ .false. = GridRun/g\" %s/Cards/grid_card.dat" \ + os.system("sed -i.bak \"s/\\s*.true.*=.*GridRun/ .false. = GridRun/g\" %s/Cards/grid_card.dat" \ % self.me_dir) self.update_status('gridpack created', level='gridpack') @@ -4476,7 +4595,7 @@ def do_pythia8(self, line): else: preamble = misc.get_HEPTools_location_setter( pjoin(MG5DIR,'HEPTools'),'lib') - preamble += "\n unset PYTHIA8DATA\n" + #preamble += "\n unset PYTHIA8DATA\n" open(pythia_cmd_card,'w').write("""! ! It is possible to run this card manually with: @@ -4691,7 +4810,7 @@ def do_pythia8(self, line): # Make sure to sure the number of split_events determined during the splitting. split_PY8_Card.systemSet('Main:numberOfEvents',partition_for_PY8[i]) split_PY8_Card.systemSet('HEPMCoutput:scaling',split_PY8_Card['HEPMCoutput:scaling']* - (float(partition_for_PY8[i])/float(n_events))) + (float(partition_for_PY8[i]))) # Add_missing set to False so as to be sure not to add any additional parameter w.r.t # the ones in the original PY8 param_card copied. split_PY8_Card.write(pjoin(parallelization_dir,'PY8Card_%d.dat'%i), @@ -4963,9 +5082,9 @@ def wait_monitoring(Idle, Running, Done): if cross_sections: # Filter the cross_sections specified an keep only the ones # with central parameters and a different merging scale - a_float_re = '[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' + a_float_re = r'[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' central_merging_re = re.compile( - '^\s*Weight_MERGING\s*=\s*(?P%s)\s*$'%a_float_re, + r'^\s*Weight_MERGING\s*=\s*(?P%s)\s*$'%a_float_re, re.IGNORECASE) cross_sections = dict( (float(central_merging_re.match(xsec).group('merging')),value) @@ -5016,8 +5135,8 @@ def wait_monitoring(Idle, Running, Done): def parse_PY8_log_file(self, log_file_path): """ Parse a log file to extract number of event and cross-section. """ - pythiare = re.compile("Les Houches User Process\(es\)\s*\d+\s*\|\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)\s*\|\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") - pythia_xsec_re = re.compile("Inclusive cross section\s*:\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") + pythiare = re.compile(r"Les Houches User Process\(es\)\s*\d+\s*\|\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)\s*\|\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") + pythia_xsec_re = re.compile(r"Inclusive cross section\s*:\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") sigma_m, Nacc, Ntry = None, None, None for line in misc.BackRead(log_file_path): info = pythiare.search(line) @@ -5158,7 +5277,7 @@ def do_pythia(self, line): # read the line from the bottom of the file #pythia_log = misc.BackRead(pjoin(self.me_dir,'Events', self.run_name, # '%s_pythia.log' % tag)) - pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") + pythiare = re.compile(r"\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") for line in misc.reverse_readline(pjoin(self.me_dir,'Events', self.run_name, '%s_pythia.log' % tag)): info = pythiare.search(line) @@ -5619,8 +5738,8 @@ def launch_job(self,exe, cwd=None, stdout=None, argument = [], remaining=0, input_files.append(self.get_pdf_input_filename()) #Find the correct ajob - Gre = re.compile("\s*j=(G[\d\.\w]+)") - origre = re.compile("grid_directory=(G[\d\.\w]+)") + Gre = re.compile(r"\s*j=(G[\d\.\w]+)") + origre = re.compile(r"grid_directory=(G[\d\.\w]+)") try : fsock = open(exe) except Exception: @@ -5628,7 +5747,7 @@ def launch_job(self,exe, cwd=None, stdout=None, argument = [], remaining=0, text = fsock.read() output_files = Gre.findall(text) if not output_files: - Ire = re.compile("for i in ([\d\.\s]*) ; do") + Ire = re.compile(r"for i in ([\d\.\s]*) ; do") data = Ire.findall(text) data = ' '.join(data).split() for nb in data: @@ -6035,7 +6154,7 @@ def get_last_tag(self, level): 'syscalc':[], 'rivet':['rivet']} - if name == self.run_name: + if name and name == self.run_name: if reload_card: run_card = pjoin(self.me_dir, 'Cards','run_card.dat') self.run_card = banner_mod.RunCard(run_card) @@ -6334,7 +6453,7 @@ def run_syscalc(self, mode='parton', event_path=None, output=None): elif mode == 'Pythia': stdout = open(pjoin(event_dir, self.run_name, '%s_%s_syscalc.log' % (tag,mode)),'w') if 'mgpythiacard' in self.banner: - pat = re.compile('''^\s*qcut\s*=\s*([\+\-\d.e]*)''', re.M+re.I) + pat = re.compile(r'''^\s*qcut\s*=\s*([\+\-\d.e]*)''', re.M+re.I) data = pat.search(self.banner['mgpythiacard']) if data: qcut = float(data.group(1)) @@ -6611,7 +6730,7 @@ def get_subP_ids(path): for line in open(pjoin(path, 'leshouche.inc')): if not 'IDUP' in line: continue - particles = re.search("/([\d,-]+)/", line) + particles = re.search(r"/([\d,-]+)/", line) all_ids.append([int(p) for p in particles.group(1).split(',')]) return all_ids @@ -6899,6 +7018,7 @@ def do_combine_events(self, line): partials = 0 # if too many file make some partial unweighting sum_xsec, sum_xerru, sum_axsec = 0,[],0 + partials_info = [] Gdirs = self.get_Gdir() Gdirs.sort() for Gdir in Gdirs: @@ -6917,16 +7037,21 @@ def do_combine_events(self, line): sum_axsec += result.get('axsec')*gscalefact[Gdir] if len(AllEvent) >= 80: #perform a partial unweighting + nb_event = min(abs(1.01*self.nb_event*sum_axsec/self.results.current['cross']),self.run_card['nevents']) AllEvent.unweight(pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), - get_wgt, log_level=5, trunc_error=1e-2, event_target=self.nb_event) + get_wgt, log_level=5, trunc_error=1e-2, event_target=nb_event) AllEvent = lhe_parser.MultiEventFile() AllEvent.banner = self.banner - AllEvent.add(pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), + partials_info.append((pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), - sum_axsec) + sum_axsec) ) + sum_xsec, sum_xerru, sum_axsec = 0,[],0 partials +=1 + for data in partials_info: + AllEvent.add(*data) + if not hasattr(self,'proc_characteristic'): self.proc_characteristic = self.get_characteristics() diff --git a/epochX/cudacpp/ee_mumu.mad/bin/internal/misc.py b/epochX/cudacpp/ee_mumu.mad/bin/internal/misc.py index c4c669f36b..e7fd60be0d 100755 --- a/epochX/cudacpp/ee_mumu.mad/bin/internal/misc.py +++ b/epochX/cudacpp/ee_mumu.mad/bin/internal/misc.py @@ -67,7 +67,7 @@ def parse_info_str(fsock): """ info_dict = {} - pattern = re.compile("(?P\w*)\s*=\s*(?P.*)", + pattern = re.compile(r"(?P\w*)\s*=\s*(?P.*)", re.IGNORECASE | re.VERBOSE) for entry in fsock: entry = entry.strip() @@ -84,7 +84,7 @@ def parse_info_str(fsock): def glob(name, path=''): """call to glob.glob with automatic security on path""" import glob as glob_module - path = re.sub('(?P\?|\*|\[|\])', '[\g]', path) + path = re.sub(r'(?P\?|\*|\[|\])', r'[\g]', path) return glob_module.glob(pjoin(path, name)) #=============================================================================== @@ -614,10 +614,10 @@ def mod_compilator(directory, new='gfortran', current=None, compiler_type='gfort #search file file_to_change=find_makefile_in_dir(directory) if compiler_type == 'gfortran': - comp_re = re.compile('^(\s*)FC\s*=\s*(.+)\s*$') + comp_re = re.compile(r'^(\s*)FC\s*=\s*(.+)\s*$') var = 'FC' elif compiler_type == 'cpp': - comp_re = re.compile('^(\s*)CXX\s*=\s*(.+)\s*$') + comp_re = re.compile(r'^(\s*)CXX\s*=\s*(.+)\s*$') var = 'CXX' else: MadGraph5Error, 'Unknown compiler type: %s' % compiler_type @@ -861,9 +861,9 @@ def detect_current_compiler(path, compiler_type='fortran'): # comp = re.compile("^\s*FC\s*=\s*(\w+)\s*") # The regular expression below allows for compiler definition with absolute path if compiler_type == 'fortran': - comp = re.compile("^\s*FC\s*=\s*([\w\/\\.\-]+)\s*") + comp = re.compile("^\\s*FC\\s*=\\s*([\\w\\/\\.\\-]+)\\s*") elif compiler_type == 'cpp': - comp = re.compile("^\s*CXX\s*=\s*([\w\/\\.\-]+)\s*") + comp = re.compile("^\\s*CXX\\s*=\\s*([\\w\\/\\.\\-]+)\\s*") else: MadGraph5Error, 'Unknown compiler type: %s' % compiler_type @@ -1001,7 +1001,19 @@ def call_stdout(arg, *args, **opt): def copytree(src, dst, symlinks = False, ignore = None): if not os.path.exists(dst): os.makedirs(dst) - shutil.copystat(src, dst) + try: + shutil.copystat(src, dst) + except PermissionError: + if os.path.realpath(src).startswith('/cvmfs') and os.path.realpath(dst).startswith('/afs'): + # allowing missmatch from cvmfs to afs since sounds to not create issue --at least in general-- + logger.critical(f'Ignoring that we could not copy permissions from {src} to {dst}') + else: + logger.critical(f'Permission error detected from {src} to {dst}.\n'+\ + 'If you are using WSL with windows partition, please try using python3.12\n'+\ + 'or avoid moving your data from the WSL partition to the UNIX one') + # we do not have enough experience in WSL to allow it to get trough. + raise + lst = os.listdir(src) if ignore: excl = ignore(src, lst) @@ -1895,12 +1907,12 @@ class EasterEgg(object): May4_banner = "* _____ *\n" + \ "* ,-~\" \"~-. *\n" + \ "* * ,^ ___ ^. * *\n" + \ - "* * / .^ ^. \ * *\n" + \ + "* * / .^ ^. \\ * *\n" + \ "* * Y l o ! Y * *\n" + \ "* * l_ `.___.' _,[ * *\n" + \ "* * |^~\"--------------~\"\"^| * *\n" + \ "* * ! May the 4th ! * *\n" + \ - "* * \ / * *\n" + \ + "* * \\ / * *\n" + \ "* * ^. .^ * *\n" + \ "* * \"-.._____.,-\" * *\n" @@ -1909,13 +1921,13 @@ class EasterEgg(object): "* M::::::::::M M::::::::::M *\n" + \ "* M:::::::::::M M:::::::::::M (_)___ *\n" + \ "* M:::::::M::::M M::::M:::::::M | / __| *\n" + \ - "* M::::::M M::::M M::::M M::::::M | \__ \ *\n" + \ + "* M::::::M M::::M M::::M M::::::M | \\__ \\ *\n" + \ "* M::::::M M::::M::::M M::::::M |_|___/ *\n" + \ "* M::::::M M:::::::M M::::::M *\n" + \ "* M::::::M M:::::M M::::::M / _| ___ _ __ *\n" + \ - "* M::::::M MMMMM M::::::M | |_ / _ \| '__| *\n" + \ + "* M::::::M MMMMM M::::::M | |_ / _ \\| '__| *\n" + \ "* M::::::M M::::::M | _| (_) | | *\n" + \ - "* M::::::M M::::::M |_/\/\___/|_| *\n" + \ + "* M::::::M M::::::M |_/\\/\\___/|_| *\n" + \ "* M::::::M M::::::M *\n" + \ "* MMMMMMMM MMMMMMMM *\n" + \ "* *\n" + \ @@ -2233,39 +2245,51 @@ def import_python_lhapdf(lhapdfconfig): os.environ['LD_LIBRARY_PATH'] = lhapdf_libdir else: os.environ['LD_LIBRARY_PATH'] = '%s:%s' %(lhapdf_libdir,os.environ['LD_LIBRARY_PATH']) - try: candidates=[dirname for dirname in os.listdir(lhapdf_libdir) \ if os.path.isdir(os.path.join(lhapdf_libdir,dirname))] except OSError: candidates=[] + if os.path.isdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')): + candidates += [pjoin(os.pardir,'local', 'lib', dirname) for dirname in os.listdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')) + if os.path.isdir(os.path.join(lhapdf_libdir,os.pardir, 'local', 'lib', dirname))] for candidate in candidates: - if os.path.isdir(os.path.join(lhapdf_libdir,candidate,'site-packages')): - sys.path.insert(0,os.path.join(lhapdf_libdir,candidate,'site-packages')) - try: - import lhapdf - use_lhapdf=True - break - except ImportError: - sys.path.pop(0) - continue + for subdir in ['site-packages', 'dist-packages']: + if os.path.isdir(os.path.join(lhapdf_libdir,candidate, subdir)): + sys.path.insert(0,os.path.join(lhapdf_libdir,candidate, subdir)) + try: + import lhapdf + use_lhapdf=True + break + except ImportError as error: + sys.path.pop(0) + continue + else: + continue + break if not use_lhapdf: try: candidates=[dirname for dirname in os.listdir(lhapdf_libdir+'64') \ if os.path.isdir(os.path.join(lhapdf_libdir+'64',dirname))] except OSError: candidates=[] - + if os.path.isdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib64')): + candidates += [pjoin(os.pardir,'local', 'lib64', dirname) for dirname in os.listdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')) + if os.path.isdir(os.path.join(lhapdf_libdir,os.pardir, 'local', 'lib64', dirname))] for candidate in candidates: - if os.path.isdir(os.path.join(lhapdf_libdir+'64',candidate,'site-packages')): - sys.path.insert(0,os.path.join(lhapdf_libdir+'64',candidate,'site-packages')) - try: - import lhapdf - use_lhapdf=True - break - except ImportError: - sys.path.pop(0) - continue + for subdir in ['site-packages', 'dist-packages']: + if os.path.isdir(os.path.join(lhapdf_libdir+'64',candidate, subdir)): + sys.path.insert(0,os.path.join(lhapdf_libdir+'64',candidate, subdir)) + try: + import lhapdf + use_lhapdf=True + break + except ImportError as error: + sys.path.pop(0) + continue + else: + continue + break if not use_lhapdf: try: import lhapdf diff --git a/epochX/cudacpp/ee_mumu.mad/bin/internal/shower_card.py b/epochX/cudacpp/ee_mumu.mad/bin/internal/shower_card.py index e87d534177..16ed72b1a0 100755 --- a/epochX/cudacpp/ee_mumu.mad/bin/internal/shower_card.py +++ b/epochX/cudacpp/ee_mumu.mad/bin/internal/shower_card.py @@ -288,7 +288,7 @@ def write(self, output_file, template=None, python_template=False, self.text = open(template,'r').read() - key_re = re.compile('^(\s*)([\S^#]+)(\s*)=(\s*)([^#]*?)(\s*)(\#.*|$)') + key_re = re.compile(r'^(\s*)([\S^#]+)(\s*)=(\s*)([^#]*?)(\s*)(\#.*|$)') newlines = [] for line in self.text.split('\n'): key_match = key_re.findall(line) diff --git a/epochX/cudacpp/ee_mumu.mad/bin/internal/systematics.py b/epochX/cudacpp/ee_mumu.mad/bin/internal/systematics.py index 28eaed00e2..2acebd087c 100644 --- a/epochX/cudacpp/ee_mumu.mad/bin/internal/systematics.py +++ b/epochX/cudacpp/ee_mumu.mad/bin/internal/systematics.py @@ -582,7 +582,7 @@ def print_cross_sections(self, all_cross, nb_event, stdout): else: resume.write( '#PDF %s: %g +%2.3g%% -%2.3g%%\n' % (pdfset.name, pdferr.central,pdferr.errplus*100/all_cross[0], pdferr.errminus*100/all_cross[0])) - dyn_name = {1: '\sum ET', 2:'\sum\sqrt{m^2+pt^2}', 3:'0.5 \sum\sqrt{m^2+pt^2}',4:'\sqrt{\hat s}' } + dyn_name = {1: r'\sum ET', 2:r'\sum\sqrt{m^2+pt^2}', 3:r'0.5 \sum\sqrt{m^2+pt^2}',4:r'\sqrt{\hat s}' } for key, curr in dyns.items(): if key ==-1: continue @@ -789,7 +789,7 @@ def get_id(self): return int(self.start_wgt_id) if 'initrwgt' in self.banner: - pattern = re.compile(' set lhapdf /PATH/TO/lhapdf-config -None does not seem to correspond to a valid lhapdf-config executable. -Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config). -Note that you can still compile and run aMC@NLO with the built-in PDFs - MG5_aMC> set lhapdf /PATH/TO/lhapdf-config - Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt -import /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu.mg +import /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu.mg The import format was not given, so we guess it as command set stdout_level DEBUG set output information to level: 10 @@ -62,7 +58,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.0058383941650390625  +DEBUG: model prefixing takes 0.00561213493347168  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  @@ -154,17 +150,16 @@ INFO: Checking for minimal orders which gives processes. INFO: Please specify coupling orders to bypass this step. INFO: Trying process: e+ e- > mu+ mu- WEIGHTED<=4 @1 INFO: Process has 2 diagrams -1 processes with 2 diagrams generated in 0.004 s +1 processes with 2 diagrams generated in 0.005 s Total: 1 processes with 2 diagrams output standalone_cudacpp ../TMPOUT/CODEGEN_cudacpp_ee_mumu Load PLUGIN.CUDACPP_OUTPUT -Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.5.3_lo_vect. +Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.6.0_lo_vect. It has been validated for the last time with version: 3.5.2 Output will be done with PLUGIN: CUDACPP_OUTPUT -DEBUG: cformat =  plugin [export_cpp.py at line 3070]  DEBUG: Entering PLUGIN_ProcessExporter.__init__ (initialise the exporter) [output.py at line 165]  DEBUG: Entering PLUGIN_ProcessExporter.copy_template (initialise the directory) [output.py at line 170]  -INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu +INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu INFO: Organizing processes into subprocess groups INFO: Generating Helas calls for process: e+ e- > mu+ mu- WEIGHTED<=4 @1 INFO: Processing color information for process: e+ e- > mu+ mu- @1 @@ -173,17 +168,17 @@ INFO: Processing color information for process: e+ e- > mu+ mu- @1 DEBUG: type(fortran_model)= [output.py at line 214]  DEBUG: type(me)= me=0 [output.py at line 215]  DEBUG: "need to link", self.to_link_in_P =  need to link ['nvtx.h', 'timer.h', 'timermap.h', 'ompnumthreads.h', 'GpuRuntime.h', 'GpuAbstraction.h', 'MemoryAccessHelpers.h', 'MemoryAccessVectors.h', 'MemoryAccessMatrixElements.h', 'MemoryAccessMomenta.h', 'MemoryAccessRandomNumbers.h', 'MemoryAccessWeights.h', 'MemoryAccessAmplitudes.h', 'MemoryAccessWavefunctions.h', 'MemoryAccessGs.h', 'MemoryAccessCouplingsFixed.h', 'MemoryAccessNumerators.h', 'MemoryAccessDenominators.h', 'MemoryAccessChannelIds.h', 'EventStatistics.h', 'CommonRandomNumbers.h', 'CrossSectionKernels.cc', 'CrossSectionKernels.h', 'MatrixElementKernels.cc', 'MatrixElementKernels.h', 'RamboSamplingKernels.cc', 'RamboSamplingKernels.h', 'RandomNumberKernels.h', 'CommonRandomNumberKernel.cc', 'CurandRandomNumberKernel.cc', 'HiprandRandomNumberKernel.cc', 'Bridge.h', 'BridgeKernels.cc', 'BridgeKernels.h', 'fbridge.cc', 'fbridge.inc', 'fsampler.cc', 'fsampler.inc', 'MadgraphTest.h', 'runTest.cc', 'testmisc.cc', 'testxxx_cc_ref.txt', 'valgrind.h', 'cudacpp.mk', 'testxxx.cc', 'MemoryBuffers.h', 'MemoryAccessCouplings.h', 'perf.py', 'profile.sh'] [output.py at line 216]  -INFO: Creating files in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu/SubProcesses/P1_Sigma_sm_epem_mupmum -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu/SubProcesses/P1_Sigma_sm_epem_mupmum/./CPPProcess.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu/SubProcesses/P1_Sigma_sm_epem_mupmum/./CPPProcess.cc -INFO: Created files CPPProcess.h and CPPProcess.cc in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu/SubProcesses/P1_Sigma_sm_epem_mupmum/. +INFO: Creating files in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu/SubProcesses/P1_Sigma_sm_epem_mupmum +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu/SubProcesses/P1_Sigma_sm_epem_mupmum/./CPPProcess.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu/SubProcesses/P1_Sigma_sm_epem_mupmum/./CPPProcess.cc +INFO: Created files CPPProcess.h and CPPProcess.cc in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu/SubProcesses/P1_Sigma_sm_epem_mupmum/. Generated helas calls for 1 subprocesses (2 diagrams) in 0.004 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 FFV2_4 routines -ALOHA: aloha creates 4 routines in 0.269 s +ALOHA: aloha creates 4 routines in 0.281 s FFV1 FFV1 FFV2 @@ -192,17 +187,17 @@ ALOHA: aloha creates 4 routines in 0.269 s FFV4 FFV2_4 FFV2_4 -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu/src/./HelAmps_sm.h -INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu/src/. +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu/src/./HelAmps_sm.h +INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu/src/. super_write_set_parameters_onlyfixMajorana (hardcoded=False) super_write_set_parameters_onlyfixMajorana (hardcoded=True) -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu/src/./Parameters_sm.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu/src/./Parameters_sm.cc +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu/src/./Parameters_sm.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu/src/./Parameters_sm.cc INFO: Created files Parameters_sm.h and Parameters_sm.cc in directory -INFO: /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu/src/. and /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu/src/. +INFO: /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu/src/. and /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu/src/. quit -real 0m0.667s -user 0m0.596s -sys 0m0.059s -Code generation completed in 1 seconds +real 0m1.777s +user 0m1.371s +sys 0m0.095s +Code generation completed in 2 seconds diff --git a/epochX/cudacpp/gg_tt.mad/CODEGEN_mad_gg_tt_log.txt b/epochX/cudacpp/gg_tt.mad/CODEGEN_mad_gg_tt_log.txt index efc4366a5c..451b75637f 100644 --- a/epochX/cudacpp/gg_tt.mad/CODEGEN_mad_gg_tt_log.txt +++ b/epochX/cudacpp/gg_tt.mad/CODEGEN_mad_gg_tt_log.txt @@ -2,7 +2,6 @@ This version is intended for development/beta testing and NOT for production. This version has not been fully tested (if at all) and might have limited user support (if at all) Running MG5 in debug mode -('WARNING: loading of madgraph too slow!!!', 0.986461877822876) ************************************************************ * * * W E L C O M E to * @@ -49,7 +48,7 @@ Note that you can still compile and run aMC@NLO with the built-in PDFs Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt -import /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt.mg +import /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt.mg The import format was not given, so we guess it as command set stdout_level DEBUG set output information to level: 10 @@ -58,7 +57,7 @@ generate g g > t t~ No model currently active, so we import the Standard Model INFO: load particles INFO: load vertices -DEBUG: model prefixing takes 0.005642414093017578  +DEBUG: model prefixing takes 0.005722761154174805  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  @@ -158,18 +157,17 @@ Load PLUGIN.CUDACPP_OUTPUT Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.6.0_lo_vect. It has been validated for the last time with version: 3.5.2 Output will be done with PLUGIN: CUDACPP_OUTPUT -DEBUG: args =  ['--hel_recycling=False', '--vector_size=32', '--hel_recycling=False', '--me_exporter=standalone_simd', '--nb_wrap=1'] [madgraph_interface.py at line 8230]  Addition matrix-element will be done with PLUGIN: CUDACPP_OUTPUT +DEBUG: opt['output_options']['vector_size'] =  32 [export_v4.py at line 4334]  Output will be done with PLUGIN: CUDACPP_OUTPUT -DEBUG: cformat =  standalone_simd [export_cpp.py at line 3481]  DEBUG: Entering PLUGIN_ProcessExporter.__init__ (initialise the exporter) [output.py at line 165]  INFO: initialize a new directory: CODEGEN_mad_gg_tt INFO: remove old information in CODEGEN_mad_gg_tt DEBUG: Entering PLUGIN_ProcessExporter.copy_template (initialise the directory) [output.py at line 170]  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt  -INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/Cards  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/SubProcesses  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt  +INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/Cards  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/SubProcesses  INFO: Organizing processes into subprocess groups INFO: Generating Helas calls for process: g g > t t~ WEIGHTED<=2 @1 INFO: Processing color information for process: g g > t t~ @1 @@ -179,59 +177,60 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3] [export_cpp.py at line 711]  -DEBUG: subproc_number =  0 [export_cpp.py at line 712]  -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 DEBUG: len(subproc_diagrams_for_config) =  3 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3} [model_handling.py at line 1548]  Generated helas calls for 1 subprocesses (3 diagrams) in 0.006 s -Wrote files for 10 helas calls in 0.094 s +Wrote files for 10 helas calls in 0.073 s +DEBUG: self.vector_size =  32 [export_v4.py at line 7023]  ALOHA: aloha starts to compute helicity amplitudes ALOHA: aloha creates VVV1 set of routines with options: P0 ALOHA: aloha creates FFV1 routines -ALOHA: aloha creates 2 routines in 0.139 s +ALOHA: aloha creates 2 routines in 0.149 s ALOHA: aloha starts to compute helicity amplitudes ALOHA: aloha creates VVV1 set of routines with options: P0 ALOHA: aloha creates FFV1 routines -ALOHA: aloha creates 4 routines in 0.137 s +ALOHA: aloha creates 4 routines in 0.135 s VVV1 FFV1 FFV1 FFV1 -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/src/./HelAmps_sm.h -INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/src/. +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/src/./HelAmps_sm.h +INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/src/. super_write_set_parameters_onlyfixMajorana (hardcoded=False) super_write_set_parameters_onlyfixMajorana (hardcoded=True) -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/src/./Parameters_sm.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/src/./Parameters_sm.cc +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/src/./Parameters_sm.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/src/./Parameters_sm.cc INFO: Created files Parameters_sm.h and Parameters_sm.cc in directory -INFO: /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/src/. and /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/src/. +INFO: /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/src/. and /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/src/. The option zerowidth_tchannel is modified [True] but will not be written in the configuration files. If you want to make this value the default for future session, you can run 'save options --all' -save configuration file to /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/Cards/me5_configuration.txt +save configuration file to /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/Cards/me5_configuration.txt INFO: Use Fortran compiler gfortran INFO: Use c++ compiler g++ INFO: Generate jpeg diagrams INFO: Generate web pages -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common patching file SubProcesses/makefile -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/SubProcesses/P1_gg_ttx; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/SubProcesses/P1_gg_ttx; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f +Hunk #2 succeeded at 227 (offset 13 lines). DEBUG: p.returncode =  0 [output.py at line 258]  -Output to directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt done. +Output to directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt done. Type "launch" to generate events from this process, or see -/data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/README +/data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/README Run "open index.html" to see more information about this process. quit -real 0m2.907s -user 0m2.416s -sys 0m0.299s +real 0m1.917s +user 0m1.636s +sys 0m0.269s Code generation completed in 2 seconds ************************************************************ * * @@ -253,9 +252,9 @@ Code generation completed in 2 seconds * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt @@ -283,9 +282,9 @@ launch in debug mode * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt diff --git a/epochX/cudacpp/gg_tt.mad/Cards/me5_configuration.txt b/epochX/cudacpp/gg_tt.mad/Cards/me5_configuration.txt index 68b4c46295..4f5079f78a 100644 --- a/epochX/cudacpp/gg_tt.mad/Cards/me5_configuration.txt +++ b/epochX/cudacpp/gg_tt.mad/Cards/me5_configuration.txt @@ -235,7 +235,7 @@ # pineappl = pineappl -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo # MG5 MAIN DIRECTORY -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo diff --git a/epochX/cudacpp/gg_tt.mad/Source/MODEL/couplings.f b/epochX/cudacpp/gg_tt.mad/Source/MODEL/couplings.f index 748af3ae72..04d6bb5333 100644 --- a/epochX/cudacpp/gg_tt.mad/Source/MODEL/couplings.f +++ b/epochX/cudacpp/gg_tt.mad/Source/MODEL/couplings.f @@ -10,10 +10,13 @@ SUBROUTINE COUP() PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + LOGICAL UPDATELOOP COMMON /TO_UPDATELOOP/UPDATELOOP INCLUDE 'input.inc' - INCLUDE '../vector.inc' + + INCLUDE 'coupl.inc' READLHA = .TRUE. INCLUDE 'intparam_definition.inc' @@ -53,7 +56,11 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) INCLUDE '../maxparticles.inc' INCLUDE '../cuts.inc' + + INCLUDE '../vector.inc' + + INCLUDE '../run.inc' DOUBLE PRECISION ALPHAS @@ -86,7 +93,9 @@ SUBROUTINE UPDATE_AS_PARAM2(MU_R2,AS2 ,VECID) INTEGER VECID INCLUDE 'model_functions.inc' INCLUDE 'input.inc' + INCLUDE '../vector.inc' + INCLUDE 'coupl.inc' DOUBLE PRECISION MODEL_SCALE COMMON /MODEL_SCALE/MODEL_SCALE diff --git a/epochX/cudacpp/gg_tt.mad/Source/MODEL/couplings1.f b/epochX/cudacpp/gg_tt.mad/Source/MODEL/couplings1.f index e14f3a1770..72cfa0f6e4 100644 --- a/epochX/cudacpp/gg_tt.mad/Source/MODEL/couplings1.f +++ b/epochX/cudacpp/gg_tt.mad/Source/MODEL/couplings1.f @@ -7,11 +7,12 @@ SUBROUTINE COUP1( ) IMPLICIT NONE INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' END diff --git a/epochX/cudacpp/gg_tt.mad/Source/MODEL/couplings2.f b/epochX/cudacpp/gg_tt.mad/Source/MODEL/couplings2.f index aa02de33c5..30f3a04e3b 100644 --- a/epochX/cudacpp/gg_tt.mad/Source/MODEL/couplings2.f +++ b/epochX/cudacpp/gg_tt.mad/Source/MODEL/couplings2.f @@ -7,11 +7,12 @@ SUBROUTINE COUP2( ) IMPLICIT NONE INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' END diff --git a/epochX/cudacpp/gg_tt.mad/Source/MODEL/couplings3.f b/epochX/cudacpp/gg_tt.mad/Source/MODEL/couplings3.f index c77bd60b5a..2d4127fa27 100644 --- a/epochX/cudacpp/gg_tt.mad/Source/MODEL/couplings3.f +++ b/epochX/cudacpp/gg_tt.mad/Source/MODEL/couplings3.f @@ -7,12 +7,13 @@ SUBROUTINE COUP3( VECID) IMPLICIT NONE INTEGER VECID INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' GC_10(VECID) = -G GC_11(VECID) = MDL_COMPLEXI*G diff --git a/epochX/cudacpp/gg_tt.mad/Source/MODEL/makefile b/epochX/cudacpp/gg_tt.mad/Source/MODEL/makefile index 0b24445a53..5a5681d220 100644 --- a/epochX/cudacpp/gg_tt.mad/Source/MODEL/makefile +++ b/epochX/cudacpp/gg_tt.mad/Source/MODEL/makefile @@ -3,7 +3,7 @@ # Makefile for model library # # ---------------------------------------------------------------------------- - +# template models/template_files/makefile_madevent # Check for ../make_opts ifeq ($(wildcard ../make_opts), ../make_opts) include ../make_opts diff --git a/epochX/cudacpp/gg_tt.mad/Source/MODEL/printout.f b/epochX/cudacpp/gg_tt.mad/Source/MODEL/printout.f index 18b8f35b08..3e195b03a2 100644 --- a/epochX/cudacpp/gg_tt.mad/Source/MODEL/printout.f +++ b/epochX/cudacpp/gg_tt.mad/Source/MODEL/printout.f @@ -1,3 +1,7 @@ +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +c written by the UFO converter +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc + c************************************************************************ c** ** c** MadGraph/MadEvent Interface to FeynRules ** @@ -9,7 +13,7 @@ subroutine printout implicit none - include '../vector.inc' ! defines VECSIZE_MEMMAX + include '../vector.inc' ! VECSIZE_MEMMAX (needed by coupl.inc) include 'coupl.inc' ! needs VECSIZE_MEMMAX (defined in vector.inc) include 'input.inc' diff --git a/epochX/cudacpp/gg_tt.mad/Source/PDF/eepdf.inc b/epochX/cudacpp/gg_tt.mad/Source/PDF/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/gg_tt.mad/Source/PDF/eepdf.inc +++ b/epochX/cudacpp/gg_tt.mad/Source/PDF/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/gg_tt.mad/Source/PDF/pdfwrap_emela.f b/epochX/cudacpp/gg_tt.mad/Source/PDF/pdfwrap_emela.f index bce10819d5..da1e4e2276 100644 --- a/epochX/cudacpp/gg_tt.mad/Source/PDF/pdfwrap_emela.f +++ b/epochX/cudacpp/gg_tt.mad/Source/PDF/pdfwrap_emela.f @@ -13,7 +13,7 @@ SUBROUTINE PDFWRAP DOUBLE PRECISION VALUE(20) REAL*8 ALPHASPDF EXTERNAL ALPHASPDF - ! PDFs with beamstrahlung use specific initialisation/evaluation +C PDFs with beamstrahlung use specific initialisation/evaluation LOGICAL HAS_BSTRAHL COMMON /TO_HAS_BS/ HAS_BSTRAHL diff --git a/epochX/cudacpp/gg_tt.mad/Source/PDF/pdg2pdf.f b/epochX/cudacpp/gg_tt.mad/Source/PDF/pdg2pdf.f index 46f321e66b..2e7343a69b 100644 --- a/epochX/cudacpp/gg_tt.mad/Source/PDF/pdg2pdf.f +++ b/epochX/cudacpp/gg_tt.mad/Source/PDF/pdg2pdf.f @@ -108,7 +108,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) else if (abs(ipart).eq.10) then ipart = sign(1,ipart) * 15 endif - pdg2pdf = 0d0 + pdg2pdf = 0d0 if (beamid.lt.0) then ih_local = ipart @@ -122,7 +122,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) endif do i_ee = 1, n_ee ee_components(i_ee) = compute_eepdf(x,omx_ee(iabs(beamid)),xmu,i_ee,ipart,ih_local) - enddo + enddo pdg2pdf = ee_components(1) ! temporary to test pdf load c write(*,*), x, beamid ,omx_ee(iabs(beamid)),xmu,1,ipart,ih_local,pdg2pdf return diff --git a/epochX/cudacpp/gg_tt.mad/Source/eepdf.inc b/epochX/cudacpp/gg_tt.mad/Source/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/gg_tt.mad/Source/eepdf.inc +++ b/epochX/cudacpp/gg_tt.mad/Source/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/auto_dsig1.f b/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/auto_dsig1.f index 4def093ebd..51cde595e2 100644 --- a/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/auto_dsig1.f +++ b/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/auto_dsig1.f @@ -101,6 +101,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -126,7 +128,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) IF (ABS(LPP(IB(1))).GE.1) THEN - !LP=SIGN(1,LPP(IB(1))) +C LP=SIGN(1,LPP(IB(1))) IF (DSQRT(Q2FACT(IB(1))).EQ.0D0) THEN QSCALE=0D0 DO I=3,NEXTERNAL @@ -140,7 +142,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) G1=PDG2PDF(LPP(IB(1)),0, IB(1),XBK(IB(1)), QSCALE) ENDIF IF (ABS(LPP(IB(2))).GE.1) THEN - !LP=SIGN(1,LPP(IB(2))) +C LP=SIGN(1,LPP(IB(2))) IF (DSQRT(Q2FACT(IB(2))).NE.0D0) THEN QSCALE=DSQRT(Q2FACT(IB(2))) ENDIF @@ -281,7 +283,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -320,9 +322,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -338,6 +341,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -366,12 +371,12 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DO IWARP=1, WARP_SIZE IVEC = (CURR_WARP-1)*WARP_SIZE+IWARP IF (ABS(LPP(IB(1))).GE.1) THEN - !LP=SIGN(1,LPP(IB(1))) +C LP=SIGN(1,LPP(IB(1))) G1(IVEC)=PDG2PDF(LPP(IB(1)),0, IB(1),ALL_XBK(IB(1),IVEC) $ ,DSQRT(ALL_Q2FACT(IB(1), IVEC))) ENDIF IF (ABS(LPP(IB(2))).GE.1) THEN - !LP=SIGN(1,LPP(IB(2))) +C LP=SIGN(1,LPP(IB(2))) G2(IVEC)=PDG2PDF(LPP(IB(2)),0, IB(2),ALL_XBK(IB(2),IVEC) $ ,DSQRT(ALL_Q2FACT(IB(2), IVEC))) ENDIF @@ -485,11 +490,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -589,9 +589,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -704,3 +706,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/driver.f b/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/driver.f index 27a6e46742..ec5722702a 100644 --- a/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/driver.f +++ b/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/matrix1.f b/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/matrix1.f index 069c74ef46..2233869649 100644 --- a/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/matrix1.f +++ b/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/matrix1.f @@ -149,18 +149,20 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=2 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=2 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 ENDDO - ! If the helicity grid status is 0, this means that it is not yet initialized. - ! If HEL_PICKED==-1, this means that calls to other matrix where in initialization mode as well for the helicity. +C If the helicity grid status is 0, this means that it is not yet +C initialized. +C If HEL_PICKED==-1, this means that calls to other matrix +C where in initialization mode as well for the helicity. IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN @@ -182,16 +184,27 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN - ! We set HEL_PICKED to -1 here so that later on, the call to DS_add_point in dsample.f does not add anything to the grid since it was already done here. +C We set HEL_PICKED to -1 here so that later on, the call to +C DS_add_point in dsample.f does not add anything to the grid +C since it was already done here. HEL_PICKED = -1 - ! For safety, hardset the helicity sampling jacobian to 0.0d0 to make sure it is not . +C For safety, hardset the helicity sampling jacobian to 0.0d0 +C to make sure it is not . HEL_JACOBIAN = 1.0D0 - ! We don't want to re-update the helicity grid if it was already updated by another matrix, so we make sure that the reference grid is empty. +C We don't want to re-update the helicity grid if it was +C already updated by another matrix, so we make sure that +C the reference grid is empty. REF_HELICITY_GRID = DS_GET_DIMENSION(REF_GRID,'Helicity') IF((DS_GET_DIM_STATUS('Helicity').EQ.1) $ .AND.(REF_HELICITY_GRID%N_TOT_ENTRIES.EQ.0)) THEN - ! If we finished the initialization we can update the grid so as to start sampling over it. - ! However the grid will now be filled by dsample with different kind of weights (including pdf, flux, etc...) so by setting the grid_mode of the reference grid to 'initialization' we make sure it will be overwritten (as opposed to 'combined') by the running grid at the next update. +C If we finished the initialization we can update the grid +C so as to start sampling over it. +C However the grid will now be filled by dsample with +C different kind of weights (including pdf, flux, etc...) +C so by setting the grid_mode of the reference grid to +C 'initialization' we make sure it will be overwritten (as +C opposed to 'combined') by the running grid at the next +C update. CALL DS_UPDATE_GRID('Helicity') CALL DS_SET_GRID_MODE('Helicity','init') ENDIF diff --git a/epochX/cudacpp/gg_tt.mad/SubProcesses/cluster.f b/epochX/cudacpp/gg_tt.mad/SubProcesses/cluster.f index 649e46f4e9..b8995283ed 100644 --- a/epochX/cudacpp/gg_tt.mad/SubProcesses/cluster.f +++ b/epochX/cudacpp/gg_tt.mad/SubProcesses/cluster.f @@ -552,6 +552,8 @@ logical function cluster(p, ivec) if (btest(mlevel,1)) $ write (*,*)'New event' + iwin = 0 + jwin = 0 cluster=.false. clustered=.false. do i=0,3 @@ -663,7 +665,8 @@ logical function cluster(p, ivec) c initialize graph storage igraphs(0)=0 nleft=nexternal -c cluster +c cluster + if (iwin.eq.0.or.jwin.eq.0) stop 21 do n=1,nexternal-2 c combine winner imocl(n)=imap(iwin,2)+imap(jwin,2) diff --git a/epochX/cudacpp/gg_tt.mad/SubProcesses/reweight.f b/epochX/cudacpp/gg_tt.mad/SubProcesses/reweight.f index 0d57772e28..0a0bafa7c1 100644 --- a/epochX/cudacpp/gg_tt.mad/SubProcesses/reweight.f +++ b/epochX/cudacpp/gg_tt.mad/SubProcesses/reweight.f @@ -640,8 +640,7 @@ logical function setclscales(p, keepq2bck, ivec) c In case of weird behavior, uncomment line c111 to debug/investigate goodjet(:) = .false. c111 set_goodjet(:) = .false. - - if(ickkw.le.0.and.xqcut.le.0d0.and.q2fact(1).gt.0.and.q2fact(2).gt.0.and.scale.gt.0) then + if(ickkw.le.0.and.(xqcut.le.0d0.or.init_mode).and.q2fact(1).gt.0.and.q2fact(2).gt.0.and.scale.gt.0) then if(use_syst)then s_scale(ivec)=scale n_qcd(ivec)=nqcd(iconfig) diff --git a/epochX/cudacpp/gg_tt.mad/bin/internal/banner.py b/epochX/cudacpp/gg_tt.mad/bin/internal/banner.py index 286913623c..842f43e67a 100755 --- a/epochX/cudacpp/gg_tt.mad/bin/internal/banner.py +++ b/epochX/cudacpp/gg_tt.mad/bin/internal/banner.py @@ -3184,7 +3184,6 @@ def get_value_from_include(self, path, list_of_params, output_dir): if path does not exists return the current value in self for all parameter""" #WARNING DOES NOT HANDLE LIST/DICT so far - # handle case where file is missing if not os.path.exists(pjoin(output_dir,path)): misc.sprint("include file not existing", pjoin(output_dir,path)) @@ -3314,6 +3313,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): starttext = open(pjoin(outdir, path+'.orig')).read() fsock.remove_routine(starttext, to_mod[path][0]) for text in to_mod[path][1]: + text = self.retro_compatible_custom_fct(text) fsock.writelines(text) fsock.close() if not filecmp.cmp(pjoin(outdir, path), pjoin(outdir, path+'.tmp')): @@ -3330,7 +3330,33 @@ def edit_dummy_fct_from_file(self, filelist, outdir): files.mv(pjoin(outdir,path+'.orig'), pjoin(outdir, path)) + @staticmethod + def retro_compatible_custom_fct(lines, mode=None): + f77_type = ['real*8', 'integer', 'double precision', 'logical'] + function_pat = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + % {'type':'|'.join(f77_type)}, re.I+re.M) + include_pat = re.compile(r"\s+include\s+[\'\"]([\w\./]*)") + + assert isinstance(lines, list) + sol = [] + + if mode is None or 'vector.inc' in mode: + search = True + for i,line in enumerate(lines[:]): + if search and re.search(include_pat, line): + name = re.findall(include_pat, line)[0] + misc.sprint('DETECTED INCLUDE', name) + if 'vector.inc' in name: + search = False + if 'run.inc' in name: + sol.append(" include 'vector.inc'") + search = False + sol.append(line) + if re.search(function_pat, line): + misc.sprint("DETECTED FCT") + search = True + return sol def guess_entry_fromname(self, name, value): """ @@ -3506,8 +3532,10 @@ def write_include_file(self, output_dir, output_file=None): #ensusre that system only parameter are correctly set self.update_system_parameter_for_include() - value_in_old_include = self.get_last_value_include(output_dir) - + if output_dir: #output_dir is set to None in some unittest + value_in_old_include = self.get_last_value_include(output_dir) + else: + value_in_old_include = {} if output_dir: self.write_autodef(output_dir, output_file=None) @@ -3524,7 +3552,6 @@ def write_include_file(self, output_dir, output_file=None): def write_one_include_file(self, output_dir, incname, output_file=None): """write one include file at the time""" - misc.sprint(incname) if incname is True: pathinc = self.default_include_file elif incname is False: diff --git a/epochX/cudacpp/gg_tt.mad/bin/internal/file_writers.py b/epochX/cudacpp/gg_tt.mad/bin/internal/file_writers.py index ac9c46e53e..526756129f 100755 --- a/epochX/cudacpp/gg_tt.mad/bin/internal/file_writers.py +++ b/epochX/cudacpp/gg_tt.mad/bin/internal/file_writers.py @@ -212,7 +212,7 @@ class FortranWriterError(FileWriter.FileWriterError): # Private variables __indent = 0 __keyword_list = [] - __comment_pattern = re.compile(r"^(\s*#|c\$|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|!\$)", re.IGNORECASE) + __comment_pattern = re.compile(r"^(\s*#|c\$|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|\s*!|!\$)", re.IGNORECASE) __continuation_line = re.compile(r"(?: )[$&]") def write_line(self, line): @@ -424,26 +424,20 @@ def count_number_of_quotes(self, line): i = i + 1 return len(splitline)-1 - def remove_routine(self, text, fct_names, formatting=True): - """write the incoming text but fully removing the associate routine/function - text can be a path to a file, an iterator, a string - fct_names should be a list of functions to remove + @staticmethod + def get_routine(text, fct_names, call_back=None): + """ + get the fortran function from a fortran file """ - f77_type = ['real*8', 'integer', 'double precision', 'logical'] pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I) - + + if isinstance(text, str): + text = text.split('\n') + + to_write=False removed = [] - if isinstance(text, str): - if '\n' in text: - text = text.split('\n') - else: - text = open(text) - if isinstance(fct_names, str): - fct_names = [fct_names] - - to_write=True for line in text: fct = pattern.findall(line) if fct: @@ -451,22 +445,38 @@ def remove_routine(self, text, fct_names, formatting=True): to_write = False else: to_write = True - if to_write: - if formatting: - if line.endswith('\n'): - line = line[:-1] - self.writelines(line) - else: - if not line.endswith('\n'): - line = '%s\n' % line - super(FileWriter,self).writelines(line) + if call_back: + call_back(line) else: removed.append(line) - + return removed + + def remove_routine(self, text, fct_names, formatting=True): + """write the incoming text but fully removing the associate routine/function + text can be a path to a file, an iterator, a string + fct_names should be a list of functions to remove + """ + + def call_back(line): + if formatting: + if line.endswith('\n'): + line = line[:-1] + self.writelines(line) + else: + if not line.endswith('\n'): + line = '%s\n' % line + super(FileWriter,self).writelines(line) + + return self.get_routine(text, fct_names, call_back) + +class FortranWriter90(FortranWriter): + + comment_char = ' !' + #=============================================================================== # CPPWriter #=============================================================================== diff --git a/epochX/cudacpp/gg_tt.mad/bin/internal/lhe_parser.py b/epochX/cudacpp/gg_tt.mad/bin/internal/lhe_parser.py index 693b19367f..f6e47956cd 100755 --- a/epochX/cudacpp/gg_tt.mad/bin/internal/lhe_parser.py +++ b/epochX/cudacpp/gg_tt.mad/bin/internal/lhe_parser.py @@ -1067,6 +1067,8 @@ def define_init_banner(self, wgt, lha_strategy, proc_charac=None): #special case for 1>N init_information = run_card.get_banner_init_information() event = next(self) + if not len(event): #if parse-momenta was false we have to parse the first event + event = Event(str(event)) init_information["idbmup1"] = event[0].pdg init_information["ebmup1"] = event[0].mass init_information["idbmup2"] = 0 diff --git a/epochX/cudacpp/gg_tt.sa/CODEGEN_cudacpp_gg_tt_log.txt b/epochX/cudacpp/gg_tt.sa/CODEGEN_cudacpp_gg_tt_log.txt index 379d3e24b4..0ee963873f 100644 --- a/epochX/cudacpp/gg_tt.sa/CODEGEN_cudacpp_gg_tt_log.txt +++ b/epochX/cudacpp/gg_tt.sa/CODEGEN_cudacpp_gg_tt_log.txt @@ -14,7 +14,7 @@ Running MG5 in debug mode * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect 2023-12-23 * +* VERSION 3.6.0_lo_vect 2024-06-17 * * * * WARNING: UNKNOWN DEVELOPMENT VERSION. * * WARNING: DO NOT USE FOR PRODUCTION * @@ -45,15 +45,10 @@ Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (inclu Note that you can still compile and run aMC@NLO with the built-in PDFs MG5_aMC> set lhapdf /PATH/TO/lhapdf-config -None does not seem to correspond to a valid lhapdf-config executable. -Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config). -Note that you can still compile and run aMC@NLO with the built-in PDFs - MG5_aMC> set lhapdf /PATH/TO/lhapdf-config - Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt -import /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_tt.mg +import /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_tt.mg The import format was not given, so we guess it as command set stdout_level DEBUG set output information to level: 10 @@ -62,7 +57,7 @@ generate g g > t t~ No model currently active, so we import the Standard Model INFO: load particles INFO: load vertices -DEBUG: model prefixing takes 0.005359172821044922  +DEBUG: model prefixing takes 0.005754947662353516  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  @@ -159,13 +154,12 @@ INFO: Process has 3 diagrams Total: 1 processes with 3 diagrams output standalone_cudacpp ../TMPOUT/CODEGEN_cudacpp_gg_tt Load PLUGIN.CUDACPP_OUTPUT -Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.5.3_lo_vect. +Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.6.0_lo_vect. It has been validated for the last time with version: 3.5.2 Output will be done with PLUGIN: CUDACPP_OUTPUT -DEBUG: cformat =  plugin [export_cpp.py at line 3070]  DEBUG: Entering PLUGIN_ProcessExporter.__init__ (initialise the exporter) [output.py at line 165]  DEBUG: Entering PLUGIN_ProcessExporter.copy_template (initialise the directory) [output.py at line 170]  -INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_tt +INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_tt INFO: Organizing processes into subprocess groups INFO: Generating Helas calls for process: g g > t t~ WEIGHTED<=2 @1 INFO: Processing color information for process: g g > t t~ @1 @@ -174,30 +168,30 @@ INFO: Processing color information for process: g g > t t~ @1 DEBUG: type(fortran_model)= [output.py at line 214]  DEBUG: type(me)= me=0 [output.py at line 215]  DEBUG: "need to link", self.to_link_in_P =  need to link ['nvtx.h', 'timer.h', 'timermap.h', 'ompnumthreads.h', 'GpuRuntime.h', 'GpuAbstraction.h', 'MemoryAccessHelpers.h', 'MemoryAccessVectors.h', 'MemoryAccessMatrixElements.h', 'MemoryAccessMomenta.h', 'MemoryAccessRandomNumbers.h', 'MemoryAccessWeights.h', 'MemoryAccessAmplitudes.h', 'MemoryAccessWavefunctions.h', 'MemoryAccessGs.h', 'MemoryAccessCouplingsFixed.h', 'MemoryAccessNumerators.h', 'MemoryAccessDenominators.h', 'MemoryAccessChannelIds.h', 'EventStatistics.h', 'CommonRandomNumbers.h', 'CrossSectionKernels.cc', 'CrossSectionKernels.h', 'MatrixElementKernels.cc', 'MatrixElementKernels.h', 'RamboSamplingKernels.cc', 'RamboSamplingKernels.h', 'RandomNumberKernels.h', 'CommonRandomNumberKernel.cc', 'CurandRandomNumberKernel.cc', 'HiprandRandomNumberKernel.cc', 'Bridge.h', 'BridgeKernels.cc', 'BridgeKernels.h', 'fbridge.cc', 'fbridge.inc', 'fsampler.cc', 'fsampler.inc', 'MadgraphTest.h', 'runTest.cc', 'testmisc.cc', 'testxxx_cc_ref.txt', 'valgrind.h', 'cudacpp.mk', 'testxxx.cc', 'MemoryBuffers.h', 'MemoryAccessCouplings.h', 'perf.py', 'profile.sh'] [output.py at line 216]  -INFO: Creating files in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_tt/SubProcesses/P1_Sigma_sm_gg_ttx -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_tt/SubProcesses/P1_Sigma_sm_gg_ttx/./CPPProcess.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_tt/SubProcesses/P1_Sigma_sm_gg_ttx/./CPPProcess.cc -INFO: Created files CPPProcess.h and CPPProcess.cc in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_tt/SubProcesses/P1_Sigma_sm_gg_ttx/. +INFO: Creating files in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_tt/SubProcesses/P1_Sigma_sm_gg_ttx +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_tt/SubProcesses/P1_Sigma_sm_gg_ttx/./CPPProcess.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_tt/SubProcesses/P1_Sigma_sm_gg_ttx/./CPPProcess.cc +INFO: Created files CPPProcess.h and CPPProcess.cc in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_tt/SubProcesses/P1_Sigma_sm_gg_ttx/. Generated helas calls for 1 subprocesses (3 diagrams) in 0.006 s ALOHA: aloha starts to compute helicity amplitudes ALOHA: aloha creates VVV1 set of routines with options: P0 ALOHA: aloha creates FFV1 routines -ALOHA: aloha creates 2 routines in 0.145 s +ALOHA: aloha creates 2 routines in 0.147 s VVV1 FFV1 FFV1 FFV1 -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_tt/src/./HelAmps_sm.h -INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_tt/src/. +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_tt/src/./HelAmps_sm.h +INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_tt/src/. super_write_set_parameters_onlyfixMajorana (hardcoded=False) super_write_set_parameters_onlyfixMajorana (hardcoded=True) -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_tt/src/./Parameters_sm.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_tt/src/./Parameters_sm.cc +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_tt/src/./Parameters_sm.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_tt/src/./Parameters_sm.cc INFO: Created files Parameters_sm.h and Parameters_sm.cc in directory -INFO: /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_tt/src/. and /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_tt/src/. +INFO: /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_tt/src/. and /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_tt/src/. quit -real 0m0.557s -user 0m0.478s -sys 0m0.057s +real 0m0.547s +user 0m0.488s +sys 0m0.047s Code generation completed in 0 seconds 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 c5e2f4d9fe..b05f9d17ae 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 @@ -14,7 +14,7 @@ Running MG5 in debug mode * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect 2023-12-23 * +* VERSION 3.6.0_lo_vect 2024-06-17 * * * * WARNING: UNKNOWN DEVELOPMENT VERSION. * * WARNING: DO NOT USE FOR PRODUCTION * @@ -45,15 +45,10 @@ Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (inclu Note that you can still compile and run aMC@NLO with the built-in PDFs MG5_aMC> set lhapdf /PATH/TO/lhapdf-config -None does not seem to correspond to a valid lhapdf-config executable. -Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config). -Note that you can still compile and run aMC@NLO with the built-in PDFs - MG5_aMC> set lhapdf /PATH/TO/lhapdf-config - Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt -import /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g.mg +import /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g.mg The import format was not given, so we guess it as command set stdout_level DEBUG set output information to level: 10 @@ -62,7 +57,7 @@ generate g g > t t~ No model currently active, so we import the Standard Model INFO: load particles INFO: load vertices -DEBUG: model prefixing takes 0.005418300628662109  +DEBUG: model prefixing takes 0.005604743957519531  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 +150,7 @@ INFO: Please specify coupling orders to bypass this step. INFO: Trying coupling order WEIGHTED<=2: WEIGTHED IS QCD+2*QED INFO: Trying process: g g > t t~ WEIGHTED<=2 @1 INFO: Process has 3 diagrams -1 processes with 3 diagrams generated in 0.009 s +1 processes with 3 diagrams generated in 0.008 s Total: 1 processes with 3 diagrams add process g g > t t~ g INFO: Checking for minimal orders which gives processes. @@ -163,24 +158,24 @@ 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.021 s +1 processes with 16 diagrams generated in 0.020 s Total: 2 processes with 19 diagrams output madevent_simd ../TMPOUT/CODEGEN_mad_gg_tt01g --hel_recycling=False --vector_size=32 Load PLUGIN.CUDACPP_OUTPUT -Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.5.3_lo_vect. +Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.6.0_lo_vect. It has been validated for the last time with version: 3.5.2 Output will be done with PLUGIN: CUDACPP_OUTPUT Addition matrix-element will be done with PLUGIN: CUDACPP_OUTPUT +DEBUG: opt['output_options']['vector_size'] =  32 [export_v4.py at line 4334]  Output will be done with PLUGIN: CUDACPP_OUTPUT -DEBUG: cformat =  standalone_simd [export_cpp.py at line 3070]  DEBUG: Entering PLUGIN_ProcessExporter.__init__ (initialise the exporter) [output.py at line 165]  INFO: initialize a new directory: CODEGEN_mad_gg_tt01g INFO: remove old information in CODEGEN_mad_gg_tt01g DEBUG: Entering PLUGIN_ProcessExporter.copy_template (initialise the directory) [output.py at line 170]  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g  -INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/Cards  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/SubProcesses  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g  +INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/Cards  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/SubProcesses  INFO: Organizing processes into subprocess groups INFO: Generating Helas calls for process: g g > t t~ g WEIGHTED<=3 @2 INFO: Processing color information for process: g g > t t~ g @2 @@ -192,13 +187,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0] [export_cpp.py at line 711]  -DEBUG: subproc_number =  0 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: g g > t t~ g WEIGHTED<=3 @2 INFO: Finding symmetric diagrams for subprocess group gg_ttxg -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/SubProcesses/P2_gg_ttxg [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  15 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15} [model_handling.py at line 1548]  @@ -208,32 +198,28 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3] [export_cpp.py at line 711]  -DEBUG: subproc_number =  1 [export_cpp.py at line 712]  -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 -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/SubProcesses/P1_gg_ttx [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  3 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3} [model_handling.py at line 1548]  -Generated helas calls for 2 subprocesses (19 diagrams) in 0.044 s -Wrote files for 46 helas calls in 0.208 s +Generated helas calls for 2 subprocesses (19 diagrams) in 0.043 s +Wrote files for 46 helas calls in 0.192 s +DEBUG: self.vector_size =  32 [export_v4.py at line 7023]  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.328 s +ALOHA: aloha creates 5 routines in 0.332 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 10 routines in 0.317 s +ALOHA: aloha creates 10 routines in 0.318 s VVV1 VVV1 FFV1 @@ -243,41 +229,47 @@ ALOHA: aloha creates 10 routines in 0.317 s VVVV1 VVVV3 VVVV4 -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/src/./HelAmps_sm.h -INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/src/. +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/src/./HelAmps_sm.h +INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/src/. super_write_set_parameters_onlyfixMajorana (hardcoded=False) super_write_set_parameters_onlyfixMajorana (hardcoded=True) -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/src/./Parameters_sm.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/src/./Parameters_sm.cc +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/src/./Parameters_sm.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/src/./Parameters_sm.cc INFO: Created files Parameters_sm.h and Parameters_sm.cc in directory -INFO: /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/src/. and /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/src/. +INFO: /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/src/. and /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/src/. The option zerowidth_tchannel is modified [True] but will not be written in the configuration files. If you want to make this value the default for future session, you can run 'save options --all' -save configuration file to /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/Cards/me5_configuration.txt +save configuration file to /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/Cards/me5_configuration.txt INFO: Use Fortran compiler gfortran INFO: Use c++ compiler g++ INFO: Generate jpeg diagrams INFO: Generate web pages -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common -patching file Source/genps.inc +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common patching file SubProcesses/makefile -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/SubProcesses/P1_gg_ttx; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/SubProcesses/P1_gg_ttx; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/SubProcesses/P2_gg_ttxg; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #2 succeeded at 227 (offset 13 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/SubProcesses/P2_gg_ttxg; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #2 succeeded at 249 (offset 16 lines). +Hunk #2 succeeded at 243 (offset 29 lines). DEBUG: p.returncode =  0 [output.py at line 258]  -Output to directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g done. +Output to directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g done. Type "launch" to generate events from this process, or see -/data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/README +/data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/README Run "open index.html" to see more information about this process. quit -real 0m2.670s -user 0m2.325s -sys 0m0.289s +real 0m2.620s +user 0m2.318s +sys 0m0.298s Code generation completed in 3 seconds ************************************************************ * * @@ -291,7 +283,7 @@ Code generation completed in 3 seconds * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect * +* VERSION 3.6.0_lo_vect * * * * The MadGraph5_aMC@NLO Development Team - Find us at * * https://server06.fynu.ucl.ac.be/projects/madgraph * @@ -299,9 +291,9 @@ Code generation completed in 3 seconds * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt @@ -321,7 +313,7 @@ launch in debug mode * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect * +* VERSION 3.6.0_lo_vect * * * * The MadGraph5_aMC@NLO Development Team - Find us at * * https://server06.fynu.ucl.ac.be/projects/madgraph * @@ -329,9 +321,9 @@ launch in debug mode * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_tt01g/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt diff --git a/epochX/cudacpp/gg_tt01g.mad/Cards/me5_configuration.txt b/epochX/cudacpp/gg_tt01g.mad/Cards/me5_configuration.txt index cdeedc7863..4f5079f78a 100644 --- a/epochX/cudacpp/gg_tt01g.mad/Cards/me5_configuration.txt +++ b/epochX/cudacpp/gg_tt01g.mad/Cards/me5_configuration.txt @@ -116,6 +116,7 @@ # cluster_type = condor # cluster_queue = madgraph # cluster_size = 150 +# cluster_walltime = # time in minute for slurm and second for condor (not supported for other scheduller) #! Path to a node directory to avoid direct writing on the central disk #! Note that condor clusters avoid direct writing by default (therefore this @@ -234,7 +235,7 @@ # pineappl = pineappl -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo # MG5 MAIN DIRECTORY -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo diff --git a/epochX/cudacpp/gg_tt01g.mad/Cards/param_card.dat b/epochX/cudacpp/gg_tt01g.mad/Cards/param_card.dat index caf4a67ea8..bb150ef10d 100644 --- a/epochX/cudacpp/gg_tt01g.mad/Cards/param_card.dat +++ b/epochX/cudacpp/gg_tt01g.mad/Cards/param_card.dat @@ -1,5 +1,5 @@ ###################################################################### -## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL #### +## PARAM_CARD AUTOMATICALLY GENERATED BY MG5 FOLLOWING UFO MODEL #### ###################################################################### ## ## ## Width set on Auto will be computed following the information ## diff --git a/epochX/cudacpp/gg_tt01g.mad/Cards/param_card_default.dat b/epochX/cudacpp/gg_tt01g.mad/Cards/param_card_default.dat index caf4a67ea8..bb150ef10d 100644 --- a/epochX/cudacpp/gg_tt01g.mad/Cards/param_card_default.dat +++ b/epochX/cudacpp/gg_tt01g.mad/Cards/param_card_default.dat @@ -1,5 +1,5 @@ ###################################################################### -## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL #### +## PARAM_CARD AUTOMATICALLY GENERATED BY MG5 FOLLOWING UFO MODEL #### ###################################################################### ## ## ## Width set on Auto will be computed following the information ## diff --git a/epochX/cudacpp/gg_tt01g.mad/Cards/proc_card_mg5.dat b/epochX/cudacpp/gg_tt01g.mad/Cards/proc_card_mg5.dat index 1b2fc5f0b6..862c94ebe6 100644 --- a/epochX/cudacpp/gg_tt01g.mad/Cards/proc_card_mg5.dat +++ b/epochX/cudacpp/gg_tt01g.mad/Cards/proc_card_mg5.dat @@ -8,7 +8,7 @@ #* * * * #* * #* * -#* VERSION 3.5.3_lo_vect 2023-12-23 * +#* VERSION 3.6.0_lo_vect 2024-06-17 * #* * #* WARNING: UNKNOWN DEVELOPMENT VERSION. * #* WARNING: DO NOT USE FOR PRODUCTION * diff --git a/epochX/cudacpp/gg_tt01g.mad/Cards/reweight_card_default.dat b/epochX/cudacpp/gg_tt01g.mad/Cards/reweight_card_default.dat index ace534ae02..5cc65fe095 100644 --- a/epochX/cudacpp/gg_tt01g.mad/Cards/reweight_card_default.dat +++ b/epochX/cudacpp/gg_tt01g.mad/Cards/reweight_card_default.dat @@ -19,8 +19,16 @@ change mode NLO # Define type of Reweighting. For LO sample this command # has no effect since only "LO" mode is allowed. + +#uncomment if you do not want to overwrite the reweight file of Sudakov in rw_me +#change rwgt_dir /PATH_MG5_BRANCH/NAME_FOLDER + +#uncomment if you want to use Sudakov Reweight +#change include_sudakov True + launch + # SPECIFY A PATH OR USE THE SET COMMAND LIKE THIS: # set sminputs 1 130 # modify 1/alpha_EW diff --git a/epochX/cudacpp/gg_tt01g.mad/Cards/run_card.dat b/epochX/cudacpp/gg_tt01g.mad/Cards/run_card.dat index 00b4e5f92c..1711d30371 100644 --- a/epochX/cudacpp/gg_tt01g.mad/Cards/run_card.dat +++ b/epochX/cudacpp/gg_tt01g.mad/Cards/run_card.dat @@ -178,6 +178,7 @@ systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++] ['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset', '--alps=0.5,1,2'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule + #*********************************************************************** # SIMD/GPU configuration for the CUDACPP plugin #************************************************************************ diff --git a/epochX/cudacpp/gg_tt01g.mad/Cards/run_card_default.dat b/epochX/cudacpp/gg_tt01g.mad/Cards/run_card_default.dat index a94a9d3a15..07d42df6c1 100644 --- a/epochX/cudacpp/gg_tt01g.mad/Cards/run_card_default.dat +++ b/epochX/cudacpp/gg_tt01g.mad/Cards/run_card_default.dat @@ -178,6 +178,7 @@ systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++] ['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset', '--alps=0.5,1,2'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule + #*********************************************************************** # SIMD/GPU configuration for the CUDACPP plugin #************************************************************************ diff --git a/epochX/cudacpp/gg_tt01g.mad/MGMEVersion.txt b/epochX/cudacpp/gg_tt01g.mad/MGMEVersion.txt index 9d3a5c0ba0..a806d3938c 100644 --- a/epochX/cudacpp/gg_tt01g.mad/MGMEVersion.txt +++ b/epochX/cudacpp/gg_tt01g.mad/MGMEVersion.txt @@ -1 +1 @@ -3.5.3_lo_vect \ No newline at end of file +3.6.0_lo_vect \ No newline at end of file diff --git a/epochX/cudacpp/gg_tt01g.mad/Source/DHELAS/aloha_functions.f b/epochX/cudacpp/gg_tt01g.mad/Source/DHELAS/aloha_functions.f index 975725737f..47699fa614 100644 --- a/epochX/cudacpp/gg_tt01g.mad/Source/DHELAS/aloha_functions.f +++ b/epochX/cudacpp/gg_tt01g.mad/Source/DHELAS/aloha_functions.f @@ -351,7 +351,7 @@ subroutine oxxxxx(p,fmass,nhel,nsf , fo) fo(6) = ip * sqm(abs(im)) else - pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2)) +c pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2)) sf(1) = dble(1+nsf+(1-nsf)*nh)*rHalf sf(2) = dble(1+nsf-(1-nsf)*nh)*rHalf omega(1) = dsqrt(p(0)+pp) @@ -2054,7 +2054,7 @@ subroutine CombineAmp(nb, ihels, iwfcts, W1, Wall, Amp) enddo return end - + subroutine CombineAmpS(nb, ihels, iwfcts, W1, Wall, Amp) integer nb ! size of the vectors diff --git a/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/couplings.f b/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/couplings.f index f3b620ab58..04d6bb5333 100644 --- a/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/couplings.f +++ b/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/couplings.f @@ -10,18 +10,27 @@ SUBROUTINE COUP() PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + LOGICAL UPDATELOOP COMMON /TO_UPDATELOOP/UPDATELOOP INCLUDE 'input.inc' - INCLUDE '../vector.inc' + + INCLUDE 'coupl.inc' READLHA = .TRUE. INCLUDE 'intparam_definition.inc' CALL COUP1() + IF (UPDATELOOP) THEN + + CALL COUP2() + + ENDIF + C couplings needed to be evaluated points by points C - CALL COUP2(1) + CALL COUP3(1) RETURN END @@ -47,7 +56,11 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) INCLUDE '../maxparticles.inc' INCLUDE '../cuts.inc' + + INCLUDE '../vector.inc' + + INCLUDE '../run.inc' DOUBLE PRECISION ALPHAS @@ -65,7 +78,7 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) couplings needed to be evaluated points by points C ALL_G(VECID) = G - CALL COUP2(VECID) + CALL COUP3(VECID) RETURN END @@ -80,7 +93,9 @@ SUBROUTINE UPDATE_AS_PARAM2(MU_R2,AS2 ,VECID) INTEGER VECID INCLUDE 'model_functions.inc' INCLUDE 'input.inc' + INCLUDE '../vector.inc' + INCLUDE 'coupl.inc' DOUBLE PRECISION MODEL_SCALE COMMON /MODEL_SCALE/MODEL_SCALE diff --git a/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/couplings1.f b/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/couplings1.f index e14f3a1770..72cfa0f6e4 100644 --- a/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/couplings1.f +++ b/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/couplings1.f @@ -7,11 +7,12 @@ SUBROUTINE COUP1( ) IMPLICIT NONE INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' END diff --git a/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/couplings2.f b/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/couplings2.f index e638b28035..30f3a04e3b 100644 --- a/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/couplings2.f +++ b/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/couplings2.f @@ -2,19 +2,17 @@ c written by the UFO converter ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc - SUBROUTINE COUP2( VECID) + SUBROUTINE COUP2( ) IMPLICIT NONE - INTEGER VECID + INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' - GC_10(VECID) = -G - GC_11(VECID) = MDL_COMPLEXI*G - GC_12(VECID) = MDL_COMPLEXI*MDL_G__EXP__2 END diff --git a/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/couplings3.f b/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/couplings3.f index f537dd3764..ad696f2865 100644 --- a/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/couplings3.f +++ b/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/couplings3.f @@ -7,12 +7,13 @@ SUBROUTINE COUP3( VECID) IMPLICIT NONE INTEGER VECID INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' GC_10(VECID) = -G GC_11(VECID) = MDL_COMPLEXI*G diff --git a/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/makefile b/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/makefile index 0b24445a53..5a5681d220 100644 --- a/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/makefile +++ b/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/makefile @@ -3,7 +3,7 @@ # Makefile for model library # # ---------------------------------------------------------------------------- - +# template models/template_files/makefile_madevent # Check for ../make_opts ifeq ($(wildcard ../make_opts), ../make_opts) include ../make_opts diff --git a/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/makeinc.inc b/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/makeinc.inc index 6e2743eac1..4a9e1b2cc5 100644 --- a/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/makeinc.inc +++ b/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/makeinc.inc @@ -2,4 +2,4 @@ # written by the UFO converter ############################################################################# -MODEL = couplings.o lha_read.o printout.o rw_para.o model_functions.o couplings1.o couplings2.o \ No newline at end of file +MODEL = couplings.o lha_read.o printout.o rw_para.o model_functions.o couplings1.o couplings2.o couplings3.o \ No newline at end of file diff --git a/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/printout.f b/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/printout.f index 18b8f35b08..3e195b03a2 100644 --- a/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/printout.f +++ b/epochX/cudacpp/gg_tt01g.mad/Source/MODEL/printout.f @@ -1,3 +1,7 @@ +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +c written by the UFO converter +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc + c************************************************************************ c** ** c** MadGraph/MadEvent Interface to FeynRules ** @@ -9,7 +13,7 @@ subroutine printout implicit none - include '../vector.inc' ! defines VECSIZE_MEMMAX + include '../vector.inc' ! VECSIZE_MEMMAX (needed by coupl.inc) include 'coupl.inc' ! needs VECSIZE_MEMMAX (defined in vector.inc) include 'input.inc' diff --git a/epochX/cudacpp/gg_tt01g.mad/Source/PDF/eepdf.inc b/epochX/cudacpp/gg_tt01g.mad/Source/PDF/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/gg_tt01g.mad/Source/PDF/eepdf.inc +++ b/epochX/cudacpp/gg_tt01g.mad/Source/PDF/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/gg_tt01g.mad/Source/PDF/pdfwrap_emela.f b/epochX/cudacpp/gg_tt01g.mad/Source/PDF/pdfwrap_emela.f index bce10819d5..da1e4e2276 100644 --- a/epochX/cudacpp/gg_tt01g.mad/Source/PDF/pdfwrap_emela.f +++ b/epochX/cudacpp/gg_tt01g.mad/Source/PDF/pdfwrap_emela.f @@ -13,7 +13,7 @@ SUBROUTINE PDFWRAP DOUBLE PRECISION VALUE(20) REAL*8 ALPHASPDF EXTERNAL ALPHASPDF - ! PDFs with beamstrahlung use specific initialisation/evaluation +C PDFs with beamstrahlung use specific initialisation/evaluation LOGICAL HAS_BSTRAHL COMMON /TO_HAS_BS/ HAS_BSTRAHL diff --git a/epochX/cudacpp/gg_tt01g.mad/Source/PDF/pdg2pdf.f b/epochX/cudacpp/gg_tt01g.mad/Source/PDF/pdg2pdf.f index 46f321e66b..2e7343a69b 100644 --- a/epochX/cudacpp/gg_tt01g.mad/Source/PDF/pdg2pdf.f +++ b/epochX/cudacpp/gg_tt01g.mad/Source/PDF/pdg2pdf.f @@ -108,7 +108,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) else if (abs(ipart).eq.10) then ipart = sign(1,ipart) * 15 endif - pdg2pdf = 0d0 + pdg2pdf = 0d0 if (beamid.lt.0) then ih_local = ipart @@ -122,7 +122,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) endif do i_ee = 1, n_ee ee_components(i_ee) = compute_eepdf(x,omx_ee(iabs(beamid)),xmu,i_ee,ipart,ih_local) - enddo + enddo pdg2pdf = ee_components(1) ! temporary to test pdf load c write(*,*), x, beamid ,omx_ee(iabs(beamid)),xmu,1,ipart,ih_local,pdg2pdf return diff --git a/epochX/cudacpp/gg_tt01g.mad/Source/dsample.f b/epochX/cudacpp/gg_tt01g.mad/Source/dsample.f index 09d482b45a..b0bc0547ad 100644 --- a/epochX/cudacpp/gg_tt01g.mad/Source/dsample.f +++ b/epochX/cudacpp/gg_tt01g.mad/Source/dsample.f @@ -204,6 +204,9 @@ subroutine sample_full(ndim,ncall,itmax,itmin,dsig,ninvar,nconfigs,VECSIZE_USED) if (VECSIZE_USED.le.1) then all_fx(1) = dsig(all_p, all_wgt,0) + ivec=0 + ilock=0 + iwarp=1 else c Here "i" is the position in the full grid of the event do i=(iwarp-1)*WARP_SIZE+1, iwarp*warp_size diff --git a/epochX/cudacpp/gg_tt01g.mad/Source/eepdf.inc b/epochX/cudacpp/gg_tt01g.mad/Source/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/gg_tt01g.mad/Source/eepdf.inc +++ b/epochX/cudacpp/gg_tt01g.mad/Source/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/gg_tt01g.mad/Source/genps.inc b/epochX/cudacpp/gg_tt01g.mad/Source/genps.inc index af7e0efbce..ef78e7e812 100644 --- a/epochX/cudacpp/gg_tt01g.mad/Source/genps.inc +++ b/epochX/cudacpp/gg_tt01g.mad/Source/genps.inc @@ -29,9 +29,8 @@ c parameter (max_host=99,maxplace=199,maxpoints=100,maxans=50) c************************************************************************* c Parameters for helicity sums in matrixN.f c************************************************************************* - REAL*8 LIMHEL -c PARAMETER(LIMHEL=1e-8) ! ME threshold for helicity filtering (Fortran default) - PARAMETER(LIMHEL=0) ! ME threshold for helicity filtering (force Fortran to mimic cudacpp, see #419) +c REAL*8 LIMHEL +c PARAMETER(LIMHEL=1e-8) -> pass in the run_card.dat INTEGER MAXTRIES PARAMETER(MAXTRIES=25) C To pass the helicity configuration chosen by the DiscreteSampler to diff --git a/epochX/cudacpp/gg_tt01g.mad/Source/run.inc b/epochX/cudacpp/gg_tt01g.mad/Source/run.inc index 5433a23583..81c8df6bf2 100644 --- a/epochX/cudacpp/gg_tt01g.mad/Source/run.inc +++ b/epochX/cudacpp/gg_tt01g.mad/Source/run.inc @@ -106,4 +106,7 @@ c double precision tmin_for_channel integer sde_strat ! 1 means standard single diagram enhancement strategy, c 2 means approximation by the denominator of the propagator - common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat \ No newline at end of file + common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat +c + double precision limhel + common/to_limhel/limhel diff --git a/epochX/cudacpp/gg_tt01g.mad/Source/run_card.inc b/epochX/cudacpp/gg_tt01g.mad/Source/run_card.inc index 22d8b7aaa9..2588190439 100644 --- a/epochX/cudacpp/gg_tt01g.mad/Source/run_card.inc +++ b/epochX/cudacpp/gg_tt01g.mad/Source/run_card.inc @@ -88,6 +88,8 @@ DSQRT_SHAT = 0.000000000000000D+00 + LIMHEL = 0.000000000000000D+00 + PTJ = 2.000000000000000D+01 PTB = 0.000000000000000D+00 diff --git a/epochX/cudacpp/gg_tt01g.mad/Source/setrun.f b/epochX/cudacpp/gg_tt01g.mad/Source/setrun.f index 9e9ef7fdbd..dc6caef748 100644 --- a/epochX/cudacpp/gg_tt01g.mad/Source/setrun.f +++ b/epochX/cudacpp/gg_tt01g.mad/Source/setrun.f @@ -162,9 +162,21 @@ subroutine setrun C Fill common block for Les Houches init info do i=1,2 if(lpp(i).eq.1.or.lpp(i).eq.2) then - idbmup(i)=2212 + if (nb_proton(i).eq.1.and.nb_neutron(i).eq.0) then + idbmup(i)=2212 + elseif (nb_proton(i).eq.0.and.nb_neutron(i).eq.1) then + idbmup(i)=2112 + else + idbmup(i) = 1000000000 + (nb_proton(i)+nb_neutron(i))*10 + $ + nb_proton(i)*10000 + endif elseif(lpp(i).eq.-1.or.lpp(i).eq.-2) then - idbmup(i)=-2212 + if (nb_proton(i).eq.1.and.nb_neutron(i).eq.0) then + idbmup(i)=-2212 + else + idbmup(i) = -1*(1000000000 + (nb_proton(i)+nb_neutron(i))*10 + $ + nb_proton(i)*10000) + endif elseif(lpp(i).eq.3) then idbmup(i)=11 elseif(lpp(i).eq.-3) then diff --git a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/MGVersion.txt b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/MGVersion.txt index 9d3a5c0ba0..a806d3938c 100644 --- a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/MGVersion.txt +++ b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/MGVersion.txt @@ -1 +1 @@ -3.5.3_lo_vect \ No newline at end of file +3.6.0_lo_vect \ No newline at end of file diff --git a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P1_gg_ttx/CPPProcess.cc b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P1_gg_ttx/CPPProcess.cc index 4942958c59..cf0c87de10 100644 --- a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P1_gg_ttx/CPPProcess.cc +++ b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P1_gg_ttx/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P1_gg_ttx/CPPProcess.h b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P1_gg_ttx/CPPProcess.h index d11c697a5f..132108c2fa 100644 --- a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P1_gg_ttx/CPPProcess.h +++ b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P1_gg_ttx/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P1_gg_ttx/auto_dsig.f b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P1_gg_ttx/auto_dsig.f index ef6cba5d03..ff10374363 100644 --- a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P1_gg_ttx/auto_dsig.f +++ b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P1_gg_ttx/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1134,11 +1134,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=16) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1148,32 +1149,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=16) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=16) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P1_gg_ttx/auto_dsig1.f b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P1_gg_ttx/auto_dsig1.f index e00e2f9e40..51cde595e2 100644 --- a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P1_gg_ttx/auto_dsig1.f +++ b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P1_gg_ttx/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -101,6 +101,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -217,7 +219,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -281,7 +283,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -320,9 +322,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -338,6 +341,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -485,11 +490,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -589,9 +589,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -704,3 +706,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P1_gg_ttx/driver.f b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P1_gg_ttx/driver.f index 27a6e46742..ec5722702a 100644 --- a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P1_gg_ttx/driver.f +++ b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P1_gg_ttx/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P1_gg_ttx/matrix1.f b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P1_gg_ttx/matrix1.f index 710fd12977..2233869649 100644 --- a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P1_gg_ttx/matrix1.f +++ b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P1_gg_ttx/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -23,6 +23,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=16) INTEGER NGRAPHS @@ -46,8 +48,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -56,26 +58,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -86,7 +85,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -96,26 +94,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,4) /-1,-1,-1, 1/ DATA (NHEL(I, 2),I=1,4) /-1,-1,-1,-1/ DATA (NHEL(I, 3),I=1,4) /-1,-1, 1, 1/ @@ -143,8 +140,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -153,11 +149,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=2 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=2 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -167,12 +163,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -184,7 +179,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -213,35 +209,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -313,7 +307,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P2_gg_ttxg/CPPProcess.cc b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P2_gg_ttxg/CPPProcess.cc index be182f91bc..ff58257c0e 100644 --- a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P2_gg_ttxg/CPPProcess.cc +++ b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P2_gg_ttxg/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P2_gg_ttxg/CPPProcess.h b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P2_gg_ttxg/CPPProcess.h index e94f9acfb2..b1a51cefe9 100644 --- a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P2_gg_ttxg/CPPProcess.h +++ b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P2_gg_ttxg/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P2_gg_ttxg/auto_dsig.f b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P2_gg_ttxg/auto_dsig.f index 6a15061a04..8bb6a95aa0 100644 --- a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P2_gg_ttxg/auto_dsig.f +++ b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P2_gg_ttxg/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1134,11 +1134,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=32) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1148,32 +1149,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=32) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=32) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P2_gg_ttxg/auto_dsig1.f b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P2_gg_ttxg/auto_dsig1.f index d9d48565b5..608ec15cda 100644 --- a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P2_gg_ttxg/auto_dsig1.f +++ b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P2_gg_ttxg/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -101,6 +101,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -217,7 +219,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -281,7 +283,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -320,9 +322,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -338,6 +341,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -485,11 +490,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -589,9 +589,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -720,3 +722,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P2_gg_ttxg/driver.f b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P2_gg_ttxg/driver.f index c45686a3b2..c2eadb2c31 100644 --- a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P2_gg_ttxg/driver.f +++ b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P2_gg_ttxg/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P2_gg_ttxg/matrix1.f b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P2_gg_ttxg/matrix1.f index 0c713c8fcf..b695473cac 100644 --- a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P2_gg_ttxg/matrix1.f +++ b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/P2_gg_ttxg/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -23,6 +23,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=32) INTEGER NGRAPHS @@ -46,8 +48,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -56,26 +58,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -86,7 +85,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -96,26 +94,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,5) /-1,-1,-1, 1,-1/ DATA (NHEL(I, 2),I=1,5) /-1,-1,-1, 1, 1/ DATA (NHEL(I, 3),I=1,5) /-1,-1,-1,-1,-1/ @@ -159,8 +156,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -169,11 +165,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=6 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=6 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -183,12 +179,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -200,7 +195,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -229,35 +225,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -329,7 +323,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/cluster.f b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/cluster.f index 649e46f4e9..b8995283ed 100644 --- a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/cluster.f +++ b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/cluster.f @@ -552,6 +552,8 @@ logical function cluster(p, ivec) if (btest(mlevel,1)) $ write (*,*)'New event' + iwin = 0 + jwin = 0 cluster=.false. clustered=.false. do i=0,3 @@ -663,7 +665,8 @@ logical function cluster(p, ivec) c initialize graph storage igraphs(0)=0 nleft=nexternal -c cluster +c cluster + if (iwin.eq.0.or.jwin.eq.0) stop 21 do n=1,nexternal-2 c combine winner imocl(n)=imap(iwin,2)+imap(jwin,2) diff --git a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/proc_characteristics b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/proc_characteristics index 6711fb7544..633ee016af 100644 --- a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/proc_characteristics +++ b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/proc_characteristics @@ -17,6 +17,8 @@ splitting_types = [] perturbation_order = [] limitations = [] + ew_sudakov = False hel_recycling = False single_color = True nlo_mixed_expansion = True + gauge = unitary diff --git a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/refine.sh b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/refine.sh index afb9b99ad1..b46170ba23 100644 --- a/epochX/cudacpp/gg_tt01g.mad/SubProcesses/refine.sh +++ b/epochX/cudacpp/gg_tt01g.mad/SubProcesses/refine.sh @@ -57,7 +57,11 @@ j=%(directory)s for((try=1;try<=16;try+=1)); do if [ "$keeplog" = true ] ; then + if [[ -e ../madevent ]];then ../madevent 2>&1 >> $k &1 >> $k &1 >> log.txt &1 >> log.txt &1 >> $k \w*)>') - pat_end=re.compile('\w*)>') + pat_begin=re.compile(r'<(?P\w*)>') + pat_end=re.compile(r'\w*)>') tag_to_file={'slha':'param_card.dat', 'mgruncard':'run_card.dat', @@ -319,7 +319,7 @@ def check_pid(self, pid2label): def get_lha_strategy(self): """get the lha_strategy: how the weight have to be handle by the shower""" - if not self["init"]: + if "init" not in self or not self["init"]: raise Exception("No init block define") data = self["init"].split('\n')[0].split() @@ -537,7 +537,8 @@ def charge_card(self, tag): self.param_card = param_card_reader.ParamCard(param_card) return self.param_card elif tag == 'mgruncard': - self.run_card = RunCard(self[tag], unknown_warning=False) + with misc.TMP_variable(RunCard, 'allow_scan', True): + self.run_card = RunCard(self[tag], consistency=False, unknow_warning=False) return self.run_card elif tag == 'mg5proccard': proc_card = self[tag].split('\n') @@ -976,6 +977,8 @@ class ConfigFile(dict): """ a class for storing/dealing with input file. """ + allow_scan = False + def __init__(self, finput=None, **opt): """initialize a new instance. input can be an instance of MadLoopParam, a file, a path to a file, or simply Nothing""" @@ -993,6 +996,7 @@ def __init__(self, finput=None, **opt): # Initialize it with all the default value self.user_set = set() self.auto_set = set() + self.scan_set = {} #key -> type of list (int/float/bool/str/... for scan self.system_only = set() self.lower_to_case = {} self.list_parameter = {} #key -> type of list (int/float/bool/str/... @@ -1109,6 +1113,8 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): #1. check if the parameter is set to auto -> pass it to special if lower_name in self: targettype = type(dict.__getitem__(self, lower_name)) + if lower_name in self.scan_set: + targettype = self.scan_set[lower_name] if targettype != str and isinstance(value, str) and value.lower() == 'auto': self.auto_set.add(lower_name) if lower_name in self.user_set: @@ -1118,13 +1124,26 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): return elif lower_name in self.auto_set: self.auto_set.remove(lower_name) - + + + #1. check if the parameter is set to auto -> pass it to special + scan_targettype = None + if self.allow_scan and isinstance(value, str) and value.strip().startswith('scan'): + if lower_name in self.user_set: + self.user_set.remove(lower_name) + self.scan_set[lower_name] = type(self[lower_name]) + dict.__setitem__(self, lower_name, value) + #keep old value. + self.post_set(lower_name,value, change_userdefine, raiseerror) + return + elif lower_name in self.scan_set: + scan_targettype = self.scan_set[lower_name] + del self.scan_set[lower_name] + # 2. Find the type of the attribute that we want if lower_name in self.list_parameter: targettype = self.list_parameter[lower_name] - - if isinstance(value, str): # split for each comma/space value = value.strip() @@ -1248,8 +1267,11 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): if change_userdefine: self.user_set.add(lower_name) return self.post_set(lower_name, None, change_userdefine, raiseerror) - elif name in self: - targettype = type(self[name]) + elif name in self: + if scan_targettype: + targettype = targettype + else: + targettype = type(self[name]) else: logger.debug('Trying to add argument %s in %s. ' % (name, self.__class__.__name__) +\ 'This argument is not defined by default. Please consider adding it.') @@ -1262,7 +1284,7 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): if change_userdefine: self.user_set.add(lower_name) return self.post_set(lower_name, None, change_userdefine, raiseerror) - + value = self.format_variable(value, targettype, name=name) #check that the value is allowed: if lower_name in self.allowed_value and '*' not in self.allowed_value[lower_name]: @@ -1444,7 +1466,7 @@ def format_variable(value, targettype, name="unknown"): value =int(value[:-1]) * convert[value[-1]] elif '/' in value or '*' in value: try: - split = re.split('(\*|/)',value) + split = re.split(r'(\*|/)',value) v = float(split[0]) for i in range((len(split)//2)): if split[2*i+1] == '*': @@ -1482,7 +1504,7 @@ def format_variable(value, targettype, name="unknown"): value = float(value) except ValueError: try: - split = re.split('(\*|/)',value) + split = re.split(r'(\*|/)',value) v = float(split[0]) for i in range((len(split)//2)): if split[2*i+1] == '*': @@ -1491,7 +1513,10 @@ def format_variable(value, targettype, name="unknown"): v /= float(split[2*i+2]) except: v=0 - raise InvalidCmd("%s can not be mapped to a float" % value) + if "scan" in value: + raise InvalidCmd("%s is not supported here. Note that scan command can not be present simultaneously in the run_card and param_card." % value) + else: + raise InvalidCmd("%s can not be mapped to a float" % value) finally: value = v else: @@ -1737,10 +1762,12 @@ def default_setup(self): self.add_param('splitting_types',[], typelist=str) self.add_param('perturbation_order', [], typelist=str) self.add_param('limitations', [], typelist=str) + self.add_param('ew_sudakov', False) self.add_param('hel_recycling', False) self.add_param('single_color', True) self.add_param('nlo_mixed_expansion', True) - + self.add_param('gauge', 'U') + def read(self, finput): """Read the input file, this can be a path to a file, a file object, a str with the content of the file.""" @@ -3104,7 +3131,7 @@ def write(self, output_file, template=None, python_template=False, # do not write hidden parameter not hidden for this template # if python_template: - written = written.union(set(re.findall('\%\((\w*)\)s', open(template,'r').read(), re.M))) + written = written.union(set(re.findall(r'\%\((\w*)\)s', open(template,'r').read(), re.M))) to_write = to_write.union(set(self.hidden_param)) to_write = to_write.difference(written) @@ -3157,7 +3184,6 @@ def get_value_from_include(self, path, list_of_params, output_dir): if path does not exists return the current value in self for all parameter""" #WARNING DOES NOT HANDLE LIST/DICT so far - misc.sprint(output_dir, path) # handle case where file is missing if not os.path.exists(pjoin(output_dir,path)): misc.sprint("include file not existing", pjoin(output_dir,path)) @@ -3259,7 +3285,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): text = open(path,'r').read() #misc.sprint(text) f77_type = ['real*8', 'integer', 'double precision', 'logical'] - pattern = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I+re.M) for fct in pattern.findall(text): fsock = file_writers.FortranWriter(tmp,'w') @@ -3287,6 +3313,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): starttext = open(pjoin(outdir, path+'.orig')).read() fsock.remove_routine(starttext, to_mod[path][0]) for text in to_mod[path][1]: + text = self.retro_compatible_custom_fct(text) fsock.writelines(text) fsock.close() if not filecmp.cmp(pjoin(outdir, path), pjoin(outdir, path+'.tmp')): @@ -3303,7 +3330,33 @@ def edit_dummy_fct_from_file(self, filelist, outdir): files.mv(pjoin(outdir,path+'.orig'), pjoin(outdir, path)) + @staticmethod + def retro_compatible_custom_fct(lines, mode=None): + f77_type = ['real*8', 'integer', 'double precision', 'logical'] + function_pat = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + % {'type':'|'.join(f77_type)}, re.I+re.M) + include_pat = re.compile(r"\s+include\s+[\'\"]([\w\./]*)") + + assert isinstance(lines, list) + sol = [] + + if mode is None or 'vector.inc' in mode: + search = True + for i,line in enumerate(lines[:]): + if search and re.search(include_pat, line): + name = re.findall(include_pat, line)[0] + misc.sprint('DETECTED INCLUDE', name) + if 'vector.inc' in name: + search = False + if 'run.inc' in name: + sol.append(" include 'vector.inc'") + search = False + sol.append(line) + if re.search(function_pat, line): + misc.sprint("DETECTED FCT") + search = True + return sol def guess_entry_fromname(self, name, value): """ @@ -3346,7 +3399,7 @@ def update_typelist(value, name, opts): #handle metadata opts = {} forced_opts = [] - for key,val in re.findall("\<(?P[_\-\w]+)\=(?P[^>]*)\>", str(name)): + for key,val in re.findall(r"\<(?P[_\-\w]+)\=(?P[^>]*)\>", str(name)): forced_opts.append(key) if val in ['True', 'False']: opts[key] = eval(val) @@ -3681,11 +3734,22 @@ def write_autodef(self, output_dir, output_file=None): out = ["%s\n" %l for l in out] fsock.writelines(out) - @staticmethod - def get_idbmup(lpp): + def get_idbmup(self, lpp, beam=1): """return the particle colliding pdg code""" if lpp in (1,2, -1,-2): - return math.copysign(2212, lpp) + target = 2212 + if 'nb_proton1' in self: + nbp = self['nb_proton%s' % beam] + nbn = self['nb_neutron%s' % beam] + if nbp == 1 and nbn ==0: + target = 2212 + elif nbp==0 and nbn ==1: + target = 2112 + else: + target = 1000000000 + target += 10 * (nbp+nbn) + target += 10000 * nbp + return math.copysign(target, lpp) elif lpp in (3,-3): return math.copysign(11, lpp) elif lpp in (4,-4): @@ -3701,8 +3765,8 @@ def get_banner_init_information(self): the first line of the block of the lhe file.""" output = {} - output["idbmup1"] = self.get_idbmup(self['lpp1']) - output["idbmup2"] = self.get_idbmup(self['lpp2']) + output["idbmup1"] = self.get_idbmup(self['lpp1'], beam=1) + output["idbmup2"] = self.get_idbmup(self['lpp2'], beam=2) output["ebmup1"] = self["ebeam1"] output["ebmup2"] = self["ebeam2"] output["pdfgup1"] = 0 @@ -3959,7 +4023,8 @@ def check_validity(self, card): dict.__setitem__(card, 'pdlabel1', card['pdlabel']) dict.__setitem__(card, 'pdlabel2', card['pdlabel']) - if abs(card['lpp1']) == 1 == abs(card['lpp2']) and card['pdlabel1'] != card['pdlabel2']: + if isinstance(card['lpp1'],int) and isinstance(card['lpp2'],int) and \ + abs(card['lpp1']) == 1 == abs(card['lpp2']) and card['pdlabel1'] != card['pdlabel2']: raise InvalidRunCard("Assymetric beam pdf not supported for proton-proton collision") def status(self, card): @@ -4156,12 +4221,16 @@ def default_setup(self): self.add_param('frame_id', 6, system=True) self.add_param("event_norm", "average", allowed=['sum','average', 'unity'], include=False, sys_default='sum', hidden=True) + self.add_param("keep_log", "normal", include=False, hidden=True, + comment="none: all log send to /dev/null.\n minimal: keep only log for survey of the last run.\n normal: keep only log for survey of all run. \n debug: keep all log (survey and refine)", + allowed=['none', 'minimal', 'normal', 'debug']) #cut self.add_param("auto_ptj_mjj", True, hidden=True) self.add_param("bwcutoff", 15.0) self.add_param("cut_decays", False, cut='d') self.add_param('dsqrt_shat',0., cut=True) self.add_param("nhel", 0, include=False) + self.add_param("limhel", 1e-8, hidden=True, comment="threshold to determine if an helicity contributes when not MC over helicity.") #pt cut self.add_param("ptj", 20.0, cut='j') self.add_param("ptb", 0.0, cut='b') @@ -4842,7 +4911,7 @@ def create_default_for_process(self, proc_characteristic, history, proc_def): # here pick strategy 2 if only one QCD color flow # and for pure multi-jet case jet_id = [21] + list(range(1, self['maxjetflavor']+1)) - if proc_characteristic['single_color']: + if proc_characteristic['gauge'] != 'FD' and proc_characteristic['single_color']: self['sde_strategy'] = 2 #for pure lepton final state go back to sde_strategy=1 pure_lepton=True @@ -5741,9 +5810,10 @@ def check_validity(self): # check that ebeam is bigger than the proton mass. for i in [1,2]: - if self['lpp%s' % i ] not in [1,2]: + # do not for proton mass if not proton PDF (or when scan initialization) + if self['lpp%s' % i ] not in [1,2] or isinstance(self['ebeam%i' % i], str): continue - + if self['ebeam%i' % i] < 0.938: if self['ebeam%i' %i] == 0: logger.warning("At-rest proton mode set: energy beam set to 0.938 GeV") @@ -6193,3 +6263,181 @@ def log_and_update(self, banner, card, par, v): xcard = banner.charge_card(card) xcard[par[0]].param_dict[(par[1],)].value = v xcard.write(os.path.join(self.me_dir, 'Cards', '%s.dat' % card)) + + + + +class RunCardIterator(object): + """A class keeping track of the scan: flag in the param_card and + having an __iter__() function to scan over all the points of the scan. + """ + + logging = True + def __init__(self, input_path=None): + with misc.TMP_variable(RunCard, 'allow_scan', True): + self.run_card = RunCard(input_path, consistency=False) + self.run_card.allow_scan = True + + self.itertag = [] #all the current value use + self.cross = [] # keep track of all the cross-section computed + self.param_order = [] + + def __iter__(self): + """generate the next param_card (in a abstract way) related to the scan. + Technically this generates only the generator.""" + + if hasattr(self, 'iterator'): + return self.iterator + self.iterator = self.iterate() + return self.iterator + + def write(self, path): + self.__iter__.write(path) + + def next(self, autostart=False): + """call the next iteration value""" + try: + iterator = self.iterator + except: + if autostart: + iterator = self.__iter__() + else: + raise + try: + out = next(iterator) + except StopIteration: + del self.iterator + raise + return out + + def iterate(self): + """create the actual generator""" + all_iterators = {} # dictionary of key -> block of object to scan [([param, [values]), ...] + pattern = re.compile(r'''scan\s*(?P\d*)\s*:\s*(?P[^#]*)''', re.I) + + # fill all_iterators with the run_card information + for name in self.run_card.scan_set: + value = self.run_card[name] + try: + key, def_list = pattern.findall(value)[0] + except Exception as error: + misc.sprint(error) + raise Exception("Fail to handle scanning tag in run_card: Please check that the syntax is valid") + if key == '': + key = -1 * len(all_iterators) + if key not in all_iterators: + all_iterators[key] = [] + try: + all_iterators[key].append( (name, eval(def_list))) + except SyntaxError as error: + raise Exception("Fail to handle your scan definition. Please check your syntax:\n entry: %s \n Error reported: %s" %(def_list, error)) + + #prepare to keep track of parameter changing for the report + keys = list(all_iterators.keys()) # need to fix an order for the scan + #store the type of parameter + for key in keys: + for param, values in all_iterators[key]: + self.param_order.append("run_card#%s" % (param)) + + # do the loop + lengths = [list(range(len(all_iterators[key][0][1]))) for key in keys] + from functools import reduce + total = reduce((lambda x, y: x * y),[len(x) for x in lengths]) + for i,positions in enumerate(itertools.product(*lengths)): + self.itertag = [] + if self.logging: + logger.info("Create the next run_card in the scan definition (%s/%s) " %( i+1, total), '$MG:BOLD') + for i, pos in enumerate(positions): + key = keys[i] + for param, values in all_iterators[key]: + # assign the value in the card. + self.run_card[param] = values[pos] + self.itertag.append(values[pos]) + if self.logging: + logger.info("change parameter %s to %s", \ + param, values[pos]) + + + # retrun the current param_card up to next iteration + yield self.run_card + + + def store_entry(self, run_name, cross, error=None, run_card_path=None): + """store the value of the cross-section""" + + if isinstance(cross, dict): + info = dict(cross) + info.update({'bench' : self.itertag, 'run_name': run_name}) + self.cross.append(info) + else: + if error is None: + self.cross.append({'bench' : self.itertag, 'run_name': run_name, 'cross(pb)':cross}) + else: + self.cross.append({'bench' : self.itertag, 'run_name': run_name, 'cross(pb)':cross, 'error(pb)':error}) + + + def write_summary(self, path, order=None, lastline=False, nbcol=20): + """ """ + + if path: + ff = open(path, 'w') + path_events = path.rsplit("/", 1)[0] + #identCard = open(pjoin(path.rsplit("/", 2)[0], "Cards", "ident_card.dat")) + #identLines = identCard.readlines() + #identCard.close() + else: + ff = StringIO.StringIO() + if order: + keys = order + else: + keys = list(self.cross[0].keys()) + if 'bench' in keys: keys.remove('bench') + if 'run_name' in keys: keys.remove('run_name') + keys.sort() + if 'cross(pb)' in keys: + keys.remove('cross(pb)') + keys.append('cross(pb)') + if 'error(pb)' in keys: + keys.remove('error(pb)') + keys.append('error(pb)') + + formatting = "#%s%s%s\n" %('%%-%is ' % (nbcol-1), ('%%-%is ' % (nbcol))* len(self.param_order), + ('%%-%is ' % (nbcol))* len(keys)) + # header + if not lastline: + ff.write(formatting % tuple(['run_name'] + self.param_order + keys)) + formatting = "%s%s%s\n" %('%%-%is ' % (nbcol), ('%%-%ie ' % (nbcol))* len(self.param_order), + ('%%-%ie ' % (nbcol))* len(keys)) + + if not lastline: + to_print = self.cross + else: + to_print = self.cross[-1:] + for info in to_print: + name = info['run_name'] + bench = info['bench'] + data = [] + for k in keys: + if k in info: + data.append(info[k]) + else: + data.append(0.) + ff.write(formatting % tuple([name] + bench + data)) + ff_single = open(pjoin(path_events, name, "params.dat"), "w") + for i_bench in range(0, len(bench)): + ff_single.write(self.param_order[i_bench] + " = " + str(bench[i_bench]) +"\n") + ff_single.close() + + if not path: + return ff.getvalue() + + + def get_next_name(self, run_name): + """returns a smart name for the next run""" + + if '_' in run_name: + name, value = run_name.rsplit('_',1) + if value.isdigit(): + return '%s_%02i' % (name, float(value)+1) + # no valid '_' in the name + return '%s_scan_02' % run_name diff --git a/epochX/cudacpp/gg_tt01g.mad/bin/internal/check_param_card.py b/epochX/cudacpp/gg_tt01g.mad/bin/internal/check_param_card.py index 71089d7480..bc785b5de6 100755 --- a/epochX/cudacpp/gg_tt01g.mad/bin/internal/check_param_card.py +++ b/epochX/cudacpp/gg_tt01g.mad/bin/internal/check_param_card.py @@ -649,7 +649,7 @@ def write_inc_file(self, outpath, identpath, default, need_mp=False): #check if we need to write the value of scale for some block if os.path.exists(input_inc): text = open(input_inc).read() - scales = list(set(re.findall('mdl__(\w*)__scale', text, re.I))) + scales = list(set(re.findall(r'mdl__(\w*)__scale', text, re.I))) else: scales = [] @@ -1000,10 +1000,12 @@ def iterate(self): self.param_order.append("%s#%s" % (param.lhablock, '_'.join(repr(i) for i in param.lhacode))) # do the loop lengths = [list(range(len(all_iterators[key][0][1]))) for key in keys] - for positions in itertools.product(*lengths): + from functools import reduce + total = reduce((lambda x, y: x * y),[len(x) for x in lengths]) + for i,positions in enumerate(itertools.product(*lengths)): self.itertag = [] if self.logging: - logger.info("Create the next param_card in the scan definition", '$MG:BOLD') + logger.info("Create the next param_card in the scan definition (%s/%s)" % (i+1,total), '$MG:BOLD') for i, pos in enumerate(positions): key = keys[i] for param, values in all_iterators[key]: diff --git a/epochX/cudacpp/gg_tt01g.mad/bin/internal/cluster.py b/epochX/cudacpp/gg_tt01g.mad/bin/internal/cluster.py index 9a893f630d..1ad860e04f 100755 --- a/epochX/cudacpp/gg_tt01g.mad/bin/internal/cluster.py +++ b/epochX/cudacpp/gg_tt01g.mad/bin/internal/cluster.py @@ -646,7 +646,10 @@ def worker(self): if os.path.exists(exe) and not exe.startswith('/'): exe = './' + exe if isinstance(opt['stdout'],str): - opt['stdout'] = open(opt['stdout'],'w') + if opt['stdout'] == '/dev/null': + opt['stdout'] = os.open(os.devnull, os.O_RDWR) + else: + opt['stdout'] = open(opt['stdout'],'w') if opt['stderr'] == None: opt['stderr'] = subprocess.STDOUT if arg: @@ -671,11 +674,12 @@ def worker(self): self.pids.put(pid) # the function should return 0 if everything is fine # the error message otherwise - returncode = exe(*arg, **opt) - if returncode != 0: - logger.warning("fct %s does not return 0. Stopping the code in a clean way. The error was:\n%s", exe, returncode) + try: + returncode = exe(*arg, **opt) + except Exception as error: + #logger.warning("fct %s does not return 0. Stopping the code in a clean way. The error was:\n%s", exe, returncode) self.stoprequest.set() - self.remove("fct %s does not return 0:\n %s" % (exe, returncode)) + self.remove("fct %s does raise %s\n %s" % (exe, error)) except Exception as error: self.fail_msg = sys.exc_info() logger.warning(str(error)) @@ -700,7 +704,7 @@ def worker(self): def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, - log=None, required_output=[], nb_submit=0): + log=None, required_output=[], nb_submit=0, python_opts={}): """submit a job on multicore machine""" # open threads if needed @@ -720,7 +724,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, return tag else: # python function - self.queue.put((tag, prog, argument, {})) + self.queue.put((tag, prog, argument, python_opts)) self.submitted.put(1) return tag @@ -908,6 +912,10 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None else: requirement = '' + if 'cluster_walltime' in self.options and self.options['cluster_walltime']\ + and self.options['cluster_walltime'] != 'None': + requirement+='\n MaxRuntime = %s' % self.options['cluster_walltime'] + if cwd is None: cwd = os.getcwd() if stdout is None: @@ -936,7 +944,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None #Submitting job(s). #Logging submit event(s). #1 job(s) submitted to cluster 2253622. - pat = re.compile("submitted to cluster (\d*)",re.MULTILINE) + pat = re.compile(r"submitted to cluster (\d*)",re.MULTILINE) output = output.decode(errors='ignore') try: id = pat.search(output).groups()[0] @@ -1025,7 +1033,7 @@ def submit2(self, prog, argument=[], cwd=None, stdout=None, stderr=None, #Logging submit event(s). #1 job(s) submitted to cluster 2253622. output = output.decode(errors='ignore') - pat = re.compile("submitted to cluster (\d*)",re.MULTILINE) + pat = re.compile(r"submitted to cluster (\d*)",re.MULTILINE) try: id = pat.search(output).groups()[0] except: @@ -1588,7 +1596,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None output = a.communicate()[0].decode(errors='ignore') #Your job 874511 ("test.sh") has been submitted - pat = re.compile("Your job (\d*) \(",re.MULTILINE) + pat = re.compile(r"Your job (\d*) \(",re.MULTILINE) try: id = pat.search(output).groups()[0] except: @@ -1606,7 +1614,7 @@ def control_one_job(self, id): if not status: return 'F' #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 - pat = re.compile("^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") + pat = re.compile(r"^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") stat = '' for line in status.stdout.read().decode(errors='ignore').split('\n'): if not line: @@ -1636,7 +1644,7 @@ def control(self, me_dir=None): cmd = 'qstat -s %s' % statusflag status = misc.Popen([cmd], shell=True, stdout=subprocess.PIPE) #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 - pat = re.compile("^(\d+)") + pat = re.compile(r"^(\d+)") for line in status.stdout.read().decode(errors='ignore').split('\n'): line = line.strip() try: @@ -1715,6 +1723,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None stderr = stdout if log is None: log = '/dev/null' + command = ['sbatch', '-o', stdout, '-J', me_dir, @@ -1726,6 +1735,12 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None command.insert(1, '-p') command.insert(2, self.cluster_queue) + if 'cluster_walltime' in self.options and self.options['cluster_walltime']\ + and self.options['cluster_walltime'] != 'None': + command.insert(1, '-t') + command.insert(2, self.options['cluster_walltime']) + + a = misc.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -1736,7 +1751,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None id = output_arr[3].rstrip() if not id.isdigit(): - id = re.findall('Submitted batch job ([\d\.]+)', ' '.join(output_arr)) + id = re.findall(r'Submitted batch job ([\d\.]+)', ' '.join(output_arr)) if not id or len(id)>1: raise ClusterManagmentError( 'fail to submit to the cluster: \n%s' \ diff --git a/epochX/cudacpp/gg_tt01g.mad/bin/internal/combine_runs.py b/epochX/cudacpp/gg_tt01g.mad/bin/internal/combine_runs.py index 4de6b84ec0..b1e8c88eac 100755 --- a/epochX/cudacpp/gg_tt01g.mad/bin/internal/combine_runs.py +++ b/epochX/cudacpp/gg_tt01g.mad/bin/internal/combine_runs.py @@ -20,6 +20,7 @@ from __future__ import absolute_import import math import os +import shutil import re import logging from six.moves import range @@ -117,6 +118,7 @@ def sum_multichannel(self, channel): #Now read in all of the events and write them #back out with the appropriate scaled weight + to_clean = [] fsock = open(pjoin(channel, 'events.lhe'), 'w') wgt = results.axsec / results.nunwgt tot_nevents, nb_file = 0, 0 @@ -129,8 +131,14 @@ def sum_multichannel(self, channel): nw = self.copy_events(fsock, pjoin(path,'events.lhe'), wgt) tot_nevents += nw nb_file += 1 + to_clean.append(path) logger.debug("Combined %s file generating %s events for %s " , nb_file, tot_nevents, channel) - + for path in to_clean: + try: + shutil.rmtree(path) + except Exception as error: + pass + @staticmethod def get_fortran_str(nb): data = '%E' % nb @@ -162,6 +170,7 @@ def copy_events(self, fsock, input, new_wgt): fsock.write(line) old_line = line return nb_evt + def get_channels(self, proc_path): """Opens file symfact.dat to determine all channels""" sympath = os.path.join(proc_path, 'symfact.dat') diff --git a/epochX/cudacpp/gg_tt01g.mad/bin/internal/common_run_interface.py b/epochX/cudacpp/gg_tt01g.mad/bin/internal/common_run_interface.py index 9bd9d9cb50..194f0cdfbd 100755 --- a/epochX/cudacpp/gg_tt01g.mad/bin/internal/common_run_interface.py +++ b/epochX/cudacpp/gg_tt01g.mad/bin/internal/common_run_interface.py @@ -23,6 +23,7 @@ import ast import logging import math +import copy import os import re import shutil @@ -181,6 +182,23 @@ def help_add_time_of_flight(self): logger.info(' threshold option allows to change the minimal value required to') logger.info(' a non zero value for the particle (default:1e-12s)') + def help_print_results(self): + logger.info("syntax: print_results [RUN_NAME] [OPTIONS]") + logger.info("-- print the results of the previous run on the screen") + logger.info(" If not RUN_NAME is provided, the information of all run") + logger.info(" are printed one after another.") + logger.info("") + logger.info(" supported options:") + logger.info(" ------------------") + logger.info(" --format=full|short # default is full") + logger.info(" full format contains banner/... ") + logger.info(" while short is a simple multi-column format (nice for plotting)") + logger.info(" --path=") + logger.info(" allow to write the information to a file.") + logger.info(" --mode=w|a #default is w ") + logger.info(" when the information is printed to a file, you can choose ") + logger.info(" to either overwrite the file if already exists (w mode)") + logger.info(" to append the information at the end of the file (a mode)") class CheckValidForCmd(object): @@ -727,7 +745,7 @@ def __init__(self, me_dir, options, *args, **opts): if not self.proc_characteristics['ninitial']: # Get number of initial states nexternal = open(pjoin(self.me_dir,'Source','nexternal.inc')).read() - found = re.search("PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) + found = re.search(r"PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) self.ninitial = int(found.group(1)) else: self.ninitial = self.proc_characteristics['ninitial'] @@ -989,7 +1007,22 @@ def do_treatcards(self, line, amcatnlo=False): #raise Exception, "%s %s %s" % (sys.path, os.path.exists(pjoin(self.me_dir,'bin','internal', 'ufomodel')), os.listdir(pjoin(self.me_dir,'bin','internal', 'ufomodel'))) import ufomodel as ufomodel zero = ufomodel.parameters.ZERO - if self.proc_characteristics['nlo_mixed_expansion']: + no_width = [] + + if self.proc_characteristics['ew_sudakov']: + # if the sudakov approximation is used, force all particle widths to zero + # unless the complex mass scheme is used + if not self.proc_characteristics['complex_mass_scheme']: + no_width = [p for p in ufomodel.all_particles if p.width != zero] + logger.info('''Setting all particle widths to zero (needed for EW Sudakov approximation).''','$MG:BOLD') + # also, check that the model features the 'ntadpole' parameter, and set it to 1 + try: + param_card['tadpole'].get(1).value = 1. + logger.info('''Setting the value of ntadpole to 1 (needed for EW Sudakov approximation).''','$MG:BOLD') + except KeyError: + logger.warning('''The model has no 'ntadpole' parameter. The Sudakov approximation for EW corrections may give wrong results.''') + + elif self.proc_characteristics['nlo_mixed_expansion']: no_width = [p for p in ufomodel.all_particles if (str(p.pdg_code) in pids or str(-p.pdg_code) in pids) and p.width != zero] @@ -1168,17 +1201,17 @@ def detect_card_type(path): 'Begin Minpts', 'gridpack', 'ebeam1', - 'block\s+mw_run', + r'block\s+mw_run', 'BLOCK', 'DECAY', 'launch', 'madspin', - 'transfer_card\.dat', + r'transfer_card\.dat', 'set', 'main:numberofevents', # pythia8, '@MG5aMC skip_analysis', #MA5 --both-- - '@MG5aMC\s*inputs\s*=\s*\*\.(?:hepmc|lhe)', #MA5 --both-- - '@MG5aMC\s*reconstruction_name', # MA5 hadronique + r'@MG5aMC\s*inputs\s*=\s*\*\.(?:hepmc|lhe)', #MA5 --both-- + r'@MG5aMC\s*reconstruction_name', # MA5 hadronique '@MG5aMC', # MA5 hadronique 'run_rivet_later', # Rivet ] @@ -1237,7 +1270,7 @@ def detect_card_type(path): return 'madspin_card.dat' if 'decay' in text: # need to check if this a line like "decay w+" or "set decay" - if re.search("(^|;)\s*decay", fulltext, re.M): + if re.search(r"(^|;)\s*decay", fulltext, re.M): return 'madspin_card.dat' else: return 'reweight_card.dat' @@ -2074,6 +2107,12 @@ def check_multicore(self): # ensure that the run_card is present if not hasattr(self, 'run_card'): self.run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat')) + # Below reads the run_card in the LHE file rather than the Cards/run_card + import madgraph.various.lhe_parser as lhe_parser + args_path = list(args) + self.check_decay_events(args_path) + self.run_card = banner_mod.RunCard(lhe_parser.EventFile(args_path[0]).get_banner()['mgruncard']) + # we want to run this in a separate shell to avoid hard f2py crash command = [sys.executable] @@ -2085,6 +2124,12 @@ def check_multicore(self): command.append('--web') command.append('reweight') + ## TV: copy the event file as backup before starting reweighting + event_path = pjoin(self.me_dir, 'Events', self.run_name, 'events.lhe.gz') + event_path_backup = pjoin(self.me_dir, 'Events', self.run_name, 'events_orig.lhe.gz') + if os.path.exists(event_path) and not os.path.exists(event_path_backup): + shutil.copyfile(event_path, event_path_backup) + ######### START SINGLE CORE MODE ############ if self.options['nb_core']==1 or self.run_card['nevents'] < 101 or not check_multicore(self): if self.run_name: @@ -2200,7 +2245,7 @@ def check_multicore(self): cross_sections[key] = value / (nb_event+1) lhe.remove() for key in cross_sections: - if key == 'orig' or key.isdigit(): + if key == 'orig' or (key.isdigit() and not (key[0] == '2')): continue logger.info('%s : %s pb' % (key, cross_sections[key])) return @@ -2461,7 +2506,7 @@ def do_add_time_of_flight(self, line): ############################################################################ def do_print_results(self, line): - """Not in help:Print the cross-section/ number of events for a given run""" + """Print the cross-section/ number of events for a given run""" args = self.split_arg(line) options={'path':None, 'mode':'w', 'format':'full'} @@ -2942,10 +2987,15 @@ def do_rivet(self, line, postprocess=False): #2 Prepare Rivet setup environments rivet_path = self.options['rivet_path'] yoda_path = self.options['yoda_path'] + fastjet_path = subprocess.Popen([self.options['fastjet'], '--prefix'], + stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip() + set_env = set_env + "export PATH={0}:$PATH\n".format(pjoin(rivet_path, 'bin')) set_env = set_env + "export PATH={0}:$PATH\n".format(pjoin(yoda_path, 'bin')) set_env = set_env + "export LD_LIBRARY_PATH={0}:{1}:$LD_LIBRARY_PATH\n".format(pjoin(rivet_path, 'lib'), pjoin(rivet_path, 'lib64')) set_env = set_env + "export LD_LIBRARY_PATH={0}:{1}:$LD_LIBRARY_PATH\n".format(pjoin(yoda_path, 'lib'), pjoin(yoda_path, 'lib64')) + set_env = set_env + "export LD_LIBRARY_PATH={0}:$LD_LIBRARY_PATH\n".format(pjoin(self.options['hepmc_path'], 'lib')) + set_env = set_env + "export LD_LIBRARY_PATH={0}:$LD_LIBRARY_PATH\n".format(pjoin(fastjet_path, 'lib')) major, minor = sys.version_info[0:2] set_env = set_env + "export PYTHONPATH={0}:{1}:$PYTHONPATH\n".format(pjoin(rivet_path, 'lib', 'python%s.%s' %(major,minor), 'site-packages'),\ pjoin(rivet_path, 'lib64', 'python%s.%s' %(major,minor), 'site-packages')) @@ -4311,8 +4361,8 @@ def complete_compute_widths(self, text, line, begidx, endidx, formatting=True): else: completion = {} completion['options'] = self.list_completion(text, - ['--path=', '--output=', '--min_br=0.\$', '--nlo', - '--precision_channel=0.\$', '--body_decay=']) + ['--path=', '--output=', r'--min_br=0.\$', '--nlo', + r'--precision_channel=0.\$', '--body_decay=']) return self.deal_multiple_categories(completion, formatting) @@ -4821,9 +4871,9 @@ class AskforEditCard(cmd.OneLinePathCompletion): (return False to repeat the question) """ - all_card_name = ['param_card', 'run_card', 'pythia_card', 'pythia8_card', + all_card_name = ['param_card', 'run_card', 'pythia_card', 'pythia8_card', 'fo_analysis_card' 'madweight_card', 'MadLoopParams', 'shower_card', 'rivet_card'] - to_init_card = ['param', 'run', 'madweight', 'madloop', + to_init_card = ['param', 'run', 'madweight', 'madloop', 'fo_analysis', 'shower', 'pythia8','delphes','madspin', 'rivet'] special_shortcut = {} special_shortcut_help = {} @@ -4853,6 +4903,7 @@ def load_default(self): self.has_PY8 = False self.has_delphes = False self.has_rivet = False + self.has_fo_card = False self.paths = {} self.update_block = [] @@ -5058,7 +5109,8 @@ def init_run(self, cards): try: - self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning') + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning') except IOError: self.run_card = {} try: @@ -5248,6 +5300,15 @@ def init_delphes(self, cards): self.has_delphes = True return [] + def init_fo_analysis(self, cards): + self.has_fo_card = False + if not self.get_path('FO_analyse', cards): + return [] + self.has_fo_card = True + self.fo_card = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse']) + self.fo_card_def = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse_default']) + return list(self.fo_card.string_vars) + def set_CM_velocity(self, line): """compute sqrts from the velocity in the center of mass frame""" @@ -5508,6 +5569,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): allowed['delphes_card'] = '' if self.has_rivet: allowed['rivet_card'] = '' + if self.has_fo_card: + allowed['fo_card'] = '' elif len(args) == 2: if args[1] == 'run_card': @@ -5532,6 +5595,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): allowed = {'delphes_card':'default'} elif args[1] == 'rivet_card': allowed = {'rivet_card':'default'} + elif args[1] == 'fo_card': + allowed = {'fo_card':'default'} else: allowed = {'value':''} @@ -5539,6 +5604,7 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): start = 1 if args[1] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', 'MadLoop_card','pythia8_card','delphes_card','plot_card', + 'fo_card', 'madanalysis5_parton_card','madanalysis5_hadron_card', 'rivet_card']: start = 2 @@ -5576,6 +5642,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): categories.append('delphes_card') if self.has_rivet: categories.append('rivet_card') + if self.has_fo_card: + categories.append('fo_card') possibilities['category of parameter (optional)'] = \ self.list_completion(text, categories) @@ -5630,7 +5698,13 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): if 'delphes_card' in allowed: if allowed['delphes_card'] == 'default': opts = ['default', 'atlas', 'cms'] - possibilities['Delphes Card'] = self.list_completion(text, opts) + possibilities['Delphes Card'] = self.list_completion(text, opts) + + if 'fo_card' in allowed: + opts = self.fo_card.string_vars + if allowed['fo_card'] == 'default': + opts.append('default') + possibilities['FO Card'] = self.list_completion(text, opts) if 'value' in list(allowed.keys()): opts = ['default', 'scale'] @@ -5733,21 +5807,28 @@ def do_set(self, line): if args[0] in self.special_shortcut: targettypes , cmd = self.special_shortcut[args[0]] if len(args) != len(targettypes) +1: - logger.warning('shortcut %s requires %s argument' % (args[0], len(targettypes))) - if len(args) < len(targettypes) +1: - return + if len(targettypes) == 1 and args[len(targettypes)].startswith('scan'): + args = args[:len(targettypes)] + [' '.join(args[len(targettypes):])] + targettypes = [str] else: - logger.warning('additional argument will be ignored') + logger.warning('shortcut %s requires %s argument' % (args[0], len(targettypes))) + if len(args) < len(targettypes) +1: + return + else: + logger.warning('additional argument will be ignored') values ={} for i, argtype in enumerate(targettypes): try: - values = {str(i): banner_mod.ConfigFile.format_variable(args[i+1], argtype, args[0])} + values[str(i)] = banner_mod.ConfigFile.format_variable(args[i+1], argtype, args[0]) except ValueError as e: logger.warning("Wrong argument: The entry #%s should be of type %s.", i+1, argtype) return except InvalidCmd as e: - logger.warning(str(e)) - return + if isinstance(args[i+1], str) and args[i+1].startswith('scan'): + values[str(i)] = args[i+1] + else: + logger.warning(str(e)) + return #else: # logger.warning("too many argument for this command") # return @@ -5787,7 +5868,7 @@ def do_set(self, line): if os.path.exists(pythia_path): logger.info('add line QCUT = %s in pythia_card.dat' % args[1]) p_card = open(pythia_path,'r').read() - p_card, n = re.subn('''^\s*QCUT\s*=\s*[\de\+\-\.]*\s*$''', + p_card, n = re.subn(r'''^\s*QCUT\s*=\s*[\de\+\-\.]*\s*$''', ''' QCUT = %s ''' % args[1], \ p_card, flags=(re.M+re.I)) if n==0: @@ -5801,7 +5882,7 @@ def do_set(self, line): if os.path.exists(pythia_path): logger.info('add line SHOWERKT = %s in pythia_card.dat' % args[1].upper()) p_card = open(pythia_path,'r').read() - p_card, n = re.subn('''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''', + p_card, n = re.subn(r'''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''', ''' SHOWERKT = %s ''' % args[1].upper(), \ p_card, flags=(re.M+re.I)) if n==0: @@ -5856,7 +5937,7 @@ def do_set(self, line): pjoin(self.me_dir,'Cards', 'delphes_card.dat')) return - if args[0] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', + if args[0] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', 'fo_card', 'delphes_card','madanalysis5_hadron_card','madanalysis5_parton_card','rivet_card']: if args[1] == 'default': @@ -6176,6 +6257,22 @@ def do_set(self, line): self.setRivet(args[start], value, default=default) self.rivet_card.write(self.paths['rivet'], self.paths['rivet_default']) + elif self.has_fo_card and (card in ['', 'fo_card'])\ + and args[start].lower() in [k.lower() for k in self.fo_card.string_vars]: + + if args[start] in self.conflict and card == '': + text = 'ambiguous name (present in more than one card). Please specify which card to edit' + logger.warning(text) + return + if args[start+1] == 'default': + value = self.fo_card_default[args[start]] + default = True + else: + value = args[start+1] + default = False + self.fo_card[args[start]] = value + self.modified_card.add('fo_card') + #INVALID -------------------------------------------------------------- else: logger.warning('invalid set command %s ' % line) @@ -6222,12 +6319,13 @@ def setM(self, block, name, value): def setR(self, name, value): - if self.mother_interface.inputfile: - self.run_card.set(name, value, user=True, raiseerror=True) - else: - self.run_card.set(name, value, user=True) - new_value = self.run_card.get(name) - logger.info('modify parameter %s of the run_card.dat to %s' % (name, new_value),'$MG:BOLD') + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + if self.mother_interface.inputfile: + self.run_card.set(name, value, user=True, raiseerror=True) + else: + self.run_card.set(name, value, user=True) + new_value = self.run_card.get(name) + logger.info('modify parameter %s of the run_card.dat to %s' % (name, new_value),'$MG:BOLD') def setML(self, name, value, default=False): @@ -6314,6 +6412,7 @@ def check_card_consistency(self): proc_charac = self.mother_interface.proc_characteristics if proc_charac['grouped_matrix'] and \ + isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int) and \ abs(self.run_card['lpp1']) == 1 == abs(self.run_card['lpp2']) and \ (self.run_card['nb_proton1'] != self.run_card['nb_proton2'] or self.run_card['nb_neutron1'] != self.run_card['nb_neutron2'] or @@ -6403,41 +6502,42 @@ def check_card_consistency(self): # check that only quark/gluon/photon are in initial beam if lpp=+-1 pdg_in_p = list(range(-6,7))+[21,22] - if (abs(self.run_card['lpp1'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial1'])) \ + if isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int): + if(abs(self.run_card['lpp1'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial1'])) \ or (abs(self.run_card['lpp2'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial2'])): - if 'pythia_card.dat' in self.cards or 'pythia8_card.dat' in self.cards: - path_to_remove = None - if 'pythia_card.dat' in self.cards: - path_to_remove = self.paths['pythia'] - card_to_remove = 'pythia_card.dat' - elif 'pythia8_card.dat' in self.cards: - path_to_remove = self.paths['pythia8'] - card_to_remove = 'pythia8_card.dat' - if path_to_remove: - if 'partonshower' in self.run_card['bypass_check']: + if 'pythia_card.dat' in self.cards or 'pythia8_card.dat' in self.cards: + path_to_remove = None + if 'pythia_card.dat' in self.cards: + path_to_remove = self.paths['pythia'] + card_to_remove = 'pythia_card.dat' + elif 'pythia8_card.dat' in self.cards: + path_to_remove = self.paths['pythia8'] + card_to_remove = 'pythia8_card.dat' + if path_to_remove: + if 'partonshower' in self.run_card['bypass_check']: + logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") + else: + logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') + os.remove(path_to_remove) + self.cards.remove(card_to_remove) + else: + logger.info('Remember that Parton-Shower are not yet ready for such proton component definition (HW implementation in progress).', '$MG:BOLD' ) + elif (abs(self.run_card['lpp1'])==3 and abs(self.run_card['lpp2'])==3): + if 'pythia8_card.dat' in self.cards: + if self.run_card['pdlabel'] == 'isronlyll': + if 'partonshower' not in self.run_card['bypass_check']: + # force that QED shower is on? + for param in ['TimeShower:QEDshowerByQ', 'TimeShower:QEDshowerByL', 'TimeShower:QEDshowerByGamma', 'SpaceShower:QEDshowerByQ', 'SpaceShower:QEDshowerByL']: + if param not in self.PY8Card or \ + (not self.PY8Card[param] and param.lower() not in self.PY8Card.user_set): + logger.warning('Activating QED shower: setting %s to True', param) + self.PY8Card[param] = True + elif 'partonshower' in self.run_card['bypass_check']: logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") - else: + else: logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') - os.remove(path_to_remove) - self.cards.remove(card_to_remove) - else: - logger.info('Remember that Parton-Shower are not yet ready for such proton component definition (HW implementation in progress).', '$MG:BOLD' ) - elif (abs(self.run_card['lpp1'])==3 and abs(self.run_card['lpp2'])==3): - if 'pythia8_card.dat' in self.cards: - if self.run_card['pdlabel'] == 'isronlyll': - if 'partonshower' not in self.run_card['bypass_check']: - # force that QED shower is on? - for param in ['TimeShower:QEDshowerByQ', 'TimeShower:QEDshowerByL', 'TimeShower:QEDshowerByGamma', 'SpaceShower:QEDshowerByQ', 'SpaceShower:QEDshowerByL']: - if param not in self.PY8Card or \ - (not self.PY8Card[param] and param.lower() not in self.PY8Card.user_set): - logger.warning('Activating QED shower: setting %s to True', param) - self.PY8Card[param] = True - elif 'partonshower' in self.run_card['bypass_check']: - logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") - else: - logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') - os.remove(self.paths['pythia8']) - self.cards.remove('pythia8_card.dat') + os.remove(self.paths['pythia8']) + self.cards.remove('pythia8_card.dat') ######################################################################## @@ -6514,7 +6614,8 @@ def check_card_consistency(self): #check relation between lepton PDF // dressed lepton collisions // ... - if abs(self.run_card['lpp1']) != 1 or abs(self.run_card['lpp2']) != 1: + if isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int) and \ + abs(self.run_card['lpp1']) != 1 or abs(self.run_card['lpp2']) != 1: if abs(self.run_card['lpp1']) == abs(self.run_card['lpp2']) == 3: # this can be dressed lepton or photon-flux if proc_charac['pdg_initial1'] in [[11],[-11]] and proc_charac['pdg_initial2'] in [[11],[-11]]: @@ -6732,7 +6833,11 @@ def write_card_param(self): """ write the param_card """ self.param_card.write(self.paths['param']) - + + def write_card_fo_card(self): + """ write the fo_card""" + self.fo_card.write_card_from_template(self.paths['FO_analyse'], self.paths['FO_analyse_default']) + @staticmethod def update_dependent(mecmd, me_dir, param_card, path ,timer=0, run_card=None, lhapdfconfig=None): @@ -7076,7 +7181,7 @@ def do_decay(self, line): #first find the particle particle = line.split('>')[0].strip() logger.info("change madspin_card to define the decay of %s: %s" %(particle, line.strip()), '$MG:BOLD') - particle = particle.replace('+','\+').replace('-','\-') + particle = particle.replace('+',r'\+').replace('-',r'\-') decay_pattern = re.compile(r"^\s*decay\s+%s\s*>[\s\w+-~]*?$" % particle, re.I+re.M) text= open(path).read() text = decay_pattern.sub('', text) @@ -7193,7 +7298,7 @@ def help_edit(self, prefix=True): logger.info( ' --clean remove all previously existing line in the file') logger.info( ' --comment_line="" comment all lines matching the regular expression') logger.info('') - logger.info(' Note: all regular-expression will be prefixed by ^\s*') + logger.info(r' Note: all regular-expression will be prefixed by ^\s*') logger.info('') logger.info( ' example: edit reweight --after_line="change mode\b" change model heft') logger.info( ' edit madspin --after_line="banner" change model XXXX') @@ -7314,7 +7419,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''replace_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[14:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[14:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7344,7 +7449,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''comment_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[14:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[14:-1] nb_mod = 0 for posline,l in enumerate(split): if re.search(pattern, l): @@ -7366,7 +7471,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''before_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[13:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[13:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7383,7 +7488,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern = r'''after_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[12:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[12:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7527,16 +7632,19 @@ def open_file(self, answer): answer = 'plot' else: answer = self.cards[int(answer)-self.integer_bias] - + path = '' if 'madweight' in answer: answer = answer.replace('madweight', 'MadWeight') elif 'MadLoopParams' in answer: answer = self.paths['ML'] elif 'pythia8_card' in answer: answer = self.paths['pythia8'] + elif 'FO_analyse' in answer: + path = self.paths['FO_analyse'] + answer = 'fo_card' if os.path.exists(answer): path = answer - else: + elif not os.path.exists(path): if not '.dat' in answer and not '.lhco' in answer: if answer != 'trigger': path = self.paths[answer] @@ -7595,7 +7703,8 @@ def reload_card(self, path): logger.error('Please re-open the file and fix the problem.') logger.warning('using the \'set\' command without opening the file will discard all your manual change') elif path == self.paths['run']: - self.run_card = banner_mod.RunCard(path) + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + self.run_card = banner_mod.RunCard(path) elif path == self.paths['shower']: self.shower_card = shower_card_mod.ShowerCard(path) elif path == self.paths['ML']: @@ -7614,6 +7723,8 @@ def reload_card(self, path): except: import internal.madweight.Cards as mwcards self.mw_card = mwcards.Card(path) + elif path == self.paths['FO_analyse']: + self.fo_card = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse']) else: logger.debug('not keep in sync: %s', path) return path @@ -7629,6 +7740,9 @@ def scanparamcardhandling(input_path=lambda obj: pjoin(obj.me_dir, 'Cards', 'par iteratorclass=param_card_mod.ParamCardIterator, summaryorder=lambda obj: lambda:None, check_card=lambda obj: CommonRunCmd.static_check_param_card, + run_card_scan=False, + run_card_input= lambda obj: pjoin(obj.me_dir, 'Cards', 'run_card.dat'), + run_card_iteratorclass=banner_mod.RunCardIterator, ): """ This is a decorator for customizing/using scan over the param_card (or technically other) This should be use like this: @@ -7678,7 +7792,60 @@ def __enter__(self): def __exit__(self, ctype, value, traceback ): self.iterator.write(self.path) - def decorator(original_fct): + def scan_over_run_card(original_fct, obj, *args, **opts): + + if isinstance(input_path, str): + card_path = run_card_input + else: + card_path = run_card_input(obj) + + run_card_iterator = run_card_iteratorclass(card_path) + orig_card = copy.deepcopy(run_card_iterator.run_card) + if not run_card_iterator.run_card.scan_set: + return original_fct(obj, *args, **opts) + + + with restore_iterator(orig_card, card_path): + # this with statement ensure that the original card is restore + # whatever happens inside those block + + if not hasattr(obj, 'allow_notification_center'): + obj.allow_notification_center = False + with misc.TMP_variable(obj, 'allow_notification_center', False): + orig_name = get_run_name(obj) + if not orig_name and args[1]: + orig_name = args[1][0] + args = (args[0], args[1][1:]) + #orig_name = "scan_%s" % len(obj.results) + + try: + os.mkdir(pjoin(obj.me_dir, 'Events', orig_name)) + except Exception: + pass + next_name = orig_name + "_00" + + for i,card in enumerate(run_card_iterator): + card.write(card_path) + # still have to check for the auto-wdith + #if i !=0: + next_name = run_card_iterator.get_next_name(next_name) + set_run_name(obj)(next_name) + try: + original_fct(obj, *args, **opts) + except ignoreerror as error: + run_card_iterator.store_entry(next_name, {'exception': error}) + else: + run_card_iterator.store_entry(next_name, store_for_scan(obj)(), run_card_path=card_path) + + #param_card_iterator.write(card_path) #-> this is done by the with statement + name = misc.get_scan_name(orig_name, next_name) + path = result_path(obj) % name + logger.info("write scan results in %s" % path ,'$MG:BOLD') + order = summaryorder(obj)() + run_card_iterator.write_summary(path, order=order) + + + def decorator(original_fct): def new_fct(obj, *args, **opts): if isinstance(input_path, str): @@ -7702,8 +7869,13 @@ def new_fct(obj, *args, **opts): if not param_card_iterator: #first run of the function - original_fct(obj, *args, **opts) - return + if run_card_scan: + scan_over_run_card(original_fct, obj, *args, **opts) + return + else: + #first run of the function + original_fct(obj, *args, **opts) + return with restore_iterator(param_card_iterator, card_path): # this with statement ensure that the original card is restore diff --git a/epochX/cudacpp/gg_tt01g.mad/bin/internal/extended_cmd.py b/epochX/cudacpp/gg_tt01g.mad/bin/internal/extended_cmd.py index 2f37070580..789976beee 100755 --- a/epochX/cudacpp/gg_tt01g.mad/bin/internal/extended_cmd.py +++ b/epochX/cudacpp/gg_tt01g.mad/bin/internal/extended_cmd.py @@ -624,12 +624,12 @@ def complete(self, text, state): compfunc = self.completenames # correct wrong splittion with '\ ' - if line and begidx > 2 and line[begidx-2:begidx] == '\ ': + if line and begidx > 2 and line[begidx-2:begidx] == r'\ ': Ntext = line.split(os.path.sep)[-1] - self.completion_prefix = Ntext.rsplit('\ ', 1)[0] + '\ ' + self.completion_prefix = Ntext.rsplit(r'\ ', 1)[0] + r'\ ' to_rm = len(self.completion_prefix) - 1 Nbegidx = len(line.rsplit(os.path.sep, 1)[0]) + 1 - data = compfunc(Ntext.replace('\ ', ' '), line, Nbegidx, endidx) + data = compfunc(Ntext.replace(r'\ ', ' '), line, Nbegidx, endidx) self.completion_matches = [p[to_rm:] for p in data if len(p)>to_rm] # correct wrong splitting with '-'/"=" @@ -742,7 +742,7 @@ def path_completion(text, base_dir = None, only_dirs = False, completion += [prefix + f for f in ['.'+os.path.sep, '..'+os.path.sep] if \ f.startswith(text) and not prefix.startswith('.')] - completion = [a.replace(' ','\ ') for a in completion] + completion = [a.replace(' ',r'\ ') for a in completion] return completion @@ -1253,7 +1253,7 @@ def check_answer_in_input_file(self, question_instance, default, path=False, lin return possibility[0] if '=' in line and ' ' in line.strip(): leninit = len(line) - line,n = re.subn('\s*=\s*','=', line) + line,n = re.subn(r'\s*=\s*','=', line) if n and len(line) != leninit: return self.check_answer_in_input_file(question_instance, default, path=path, line=line) @@ -1311,7 +1311,7 @@ def nice_error_handling(self, error, line): if os.path.exists(self.debug_output): os.remove(self.debug_output) try: - super(Cmd,self).onecmd('history %s' % self.debug_output.replace(' ', '\ ')) + super(Cmd,self).onecmd('history %s' % self.debug_output.replace(' ', r'\ ')) except Exception as error: logger.error(error) @@ -2001,6 +2001,7 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): text = "" has_mg5_path = False # Use local configuration => Need to update the path + already_written = set() for line in open(basefile): if '=' in line: data, value = line.split('=',1) @@ -2018,9 +2019,12 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): comment = '' if key in to_keep: value = str(to_keep[key]) - else: + elif line not in already_written: + already_written.add(line) text += line continue + else: + continue if key == 'mg5_path': has_mg5_path = True try: @@ -2032,14 +2036,20 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): # check if absolute path if not os.path.isabs(value): value = os.path.realpath(os.path.join(basedir, value)) - text += '%s = %s # %s \n' % (key, value, comment) + new_line = '%s = %s # %s \n' % (key, value, comment) + if new_line not in already_written: + text += new_line + already_written.add(new_line) for key in to_write: if key in to_keep: - text += '%s = %s \n' % (key, to_keep[key]) + new_line = '%s = %s \n' % (key, to_keep[key]) + if new_line not in already_written: + text += new_line if not MADEVENT and not has_mg5_path: - text += """\n# MG5 MAIN DIRECTORY\n""" - text += "mg5_path = %s\n" % MG5DIR + if "mg5_path = %s\n" % MG5DIR not in already_written: + text += """\n# MG5 MAIN DIRECTORY\n""" + text += "mg5_path = %s\n" % MG5DIR writer = open(filepath,'w') writer.write(text) @@ -2190,7 +2200,7 @@ def onecmd(self, line, **opt): raise def reask(self, reprint_opt=True): - pat = re.compile('\[(\d*)s to answer\]') + pat = re.compile(r'\[(\d*)s to answer\]') prev_timer = signal.alarm(0) # avoid timer if any if prev_timer: @@ -2991,7 +3001,7 @@ def question_formatting(self, nb_col = 80, lpotential_switch=0, lnb_key=0, key=None): - """should return four lines: + r"""should return four lines: 1. The upper band (typically /========\ 2. The lower band (typically \========/ 3. The line without conflict | %(nb)2d. %(descrip)-20s %(name)5s = %(switch)-10s | @@ -3239,13 +3249,13 @@ def create_question(self, help_text=True): data_to_format['conflict_switch'] = self.color_for_value(key,self.inconsistent_keys[key], consistency=False) if hidden_line: - f2 = re.sub('%(\((?:name|descrip|add_info)\)-?)(\d+)s', + f2 = re.sub(r'%(\((?:name|descrip|add_info)\)-?)(\d+)s', lambda x: '%%%s%ds' % (x.group(1),int(x.group(2))+9), f2) text.append(f2 % data_to_format) elif hidden_line: if not f3: - f3 = re.sub('%(\((?:name|descrip|add_info)\)-?)(\d+)s', + f3 = re.sub(r'%(\((?:name|descrip|add_info)\)-?)(\d+)s', lambda x: '%%%s%ds' % (x.group(1),int(x.group(2))+9), f1) text.append(f3 % data_to_format) diff --git a/epochX/cudacpp/gg_tt01g.mad/bin/internal/file_writers.py b/epochX/cudacpp/gg_tt01g.mad/bin/internal/file_writers.py index 41bff05276..526756129f 100755 --- a/epochX/cudacpp/gg_tt01g.mad/bin/internal/file_writers.py +++ b/epochX/cudacpp/gg_tt01g.mad/bin/internal/file_writers.py @@ -36,10 +36,10 @@ class FileWriter(io.FileIO): supported_preprocessor_commands = ['if'] preprocessor_command_re=re.compile( - "\s*(?P%s)\s*\(\s*(?P.*)\s*\)\s*{\s*"\ + r"\s*(?P%s)\s*\(\s*(?P.*)\s*\)\s*{\s*"\ %('|'.join(supported_preprocessor_commands))) preprocessor_endif_re=re.compile(\ - "\s*}\s*(?Pelse)?\s*(\((?P.*)\))?\s*(?P{)?\s*") + r"\s*}\s*(?Pelse)?\s*(\((?P.*)\))?\s*(?P{)?\s*") class FileWriterError(IOError): """Exception raised if an error occurs in the definition @@ -191,15 +191,15 @@ class FortranWriterError(FileWriter.FileWriterError): pass # Parameters defining the output of the Fortran writer - keyword_pairs = {'^if.+then\s*$': ('^endif', 2), - '^type(?!\s*\()\s*.+\s*$': ('^endtype', 2), - '^do(?!\s+\d+)\s+': ('^enddo\s*$', 2), - '^subroutine': ('^end\s*$', 0), - '^module': ('^end\s*$', 0), - 'function': ('^end\s*$', 0)} - single_indents = {'^else\s*$':-2, - '^else\s*if.+then\s*$':-2} - number_re = re.compile('^(?P\d+)\s+(?P.*)') + keyword_pairs = {r'^if.+then\s*$': ('^endif', 2), + r'^type(?!\s*\()\s*.+\s*$': ('^endtype', 2), + r'^do(?!\s+\d+)\s+': (r'^enddo\s*$', 2), + '^subroutine': (r'^end\s*$', 0), + '^module': (r'^end\s*$', 0), + 'function': (r'^end\s*$', 0)} + single_indents = {r'^else\s*$':-2, + r'^else\s*if.+then\s*$':-2} + number_re = re.compile(r'^(?P\d+)\s+(?P.*)') line_cont_char = '$' comment_char = 'c' uniformcase = True #force everyting to be lower/upper case @@ -212,7 +212,7 @@ class FortranWriterError(FileWriter.FileWriterError): # Private variables __indent = 0 __keyword_list = [] - __comment_pattern = re.compile(r"^(\s*#|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|!)", re.IGNORECASE) + __comment_pattern = re.compile(r"^(\s*#|c\$|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|\s*!|!\$)", re.IGNORECASE) __continuation_line = re.compile(r"(?: )[$&]") def write_line(self, line): @@ -424,26 +424,20 @@ def count_number_of_quotes(self, line): i = i + 1 return len(splitline)-1 - def remove_routine(self, text, fct_names, formatting=True): - """write the incoming text but fully removing the associate routine/function - text can be a path to a file, an iterator, a string - fct_names should be a list of functions to remove + @staticmethod + def get_routine(text, fct_names, call_back=None): + """ + get the fortran function from a fortran file """ - f77_type = ['real*8', 'integer', 'double precision', 'logical'] - pattern = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I) - + + if isinstance(text, str): + text = text.split('\n') + + to_write=False removed = [] - if isinstance(text, str): - if '\n' in text: - text = text.split('\n') - else: - text = open(text) - if isinstance(fct_names, str): - fct_names = [fct_names] - - to_write=True for line in text: fct = pattern.findall(line) if fct: @@ -451,22 +445,38 @@ def remove_routine(self, text, fct_names, formatting=True): to_write = False else: to_write = True - if to_write: - if formatting: - if line.endswith('\n'): - line = line[:-1] - self.writelines(line) - else: - if not line.endswith('\n'): - line = '%s\n' % line - super(FileWriter,self).writelines(line) + if call_back: + call_back(line) else: removed.append(line) - + return removed + + def remove_routine(self, text, fct_names, formatting=True): + """write the incoming text but fully removing the associate routine/function + text can be a path to a file, an iterator, a string + fct_names should be a list of functions to remove + """ + + def call_back(line): + if formatting: + if line.endswith('\n'): + line = line[:-1] + self.writelines(line) + else: + if not line.endswith('\n'): + line = '%s\n' % line + super(FileWriter,self).writelines(line) + + return self.get_routine(text, fct_names, call_back) + +class FortranWriter90(FortranWriter): + + comment_char = ' !' + #=============================================================================== # CPPWriter #=============================================================================== @@ -497,50 +507,50 @@ class CPPWriterError(FileWriter.FileWriterError): '^private': standard_indent, '^protected': standard_indent} - spacing_patterns = [ - ('\s*\"\s*}', '\"'), - ('\s*,\s*', ', '), - ('\s*-\s*', ' - '), - ('([{(,=])\s*-\s*', '\g<1> -'), - ('(return)\s*-\s*', '\g<1> -'), - ('\s*\+\s*', ' + '), - ('([{(,=])\s*\+\s*', '\g<1> +'), - ('\(\s*', '('), - ('\s*\)', ')'), - ('\{\s*', '{'), - ('\s*\}', '}'), - ('\s*=\s*', ' = '), - ('\s*>\s*', ' > '), - ('\s*<\s*', ' < '), - ('\s*!\s*', ' !'), - ('\s*/\s*', '/'), - ('(?\s+>\s*', ' >> '), - ('<\s*double\s*>>\s*', ' > '), - ('\s*<\s+<\s*', ' << '), - ('\s*-\s+>\s*', '->'), - ('\s*=\s+=\s*', ' == '), - ('\s*!\s+=\s*', ' != '), - ('\s*>\s+=\s*', ' >= '), - ('\s*<\s+=\s*', ' <= '), - ('\s*&&\s*', ' && '), - ('\s*\|\|\s*', ' || '), - ('\s*{\s*}', ' {}'), - ('\s*;\s*', '; '), - (';\s*\}', ';}'), - (';\s*$}', ';'), - ('\s*<\s*([a-zA-Z0-9]+?)\s*>', '<\g<1>>'), - ('^#include\s*<\s*(.*?)\s*>', '#include <\g<1>>'), - ('(\d+\.{0,1}\d*|\.\d+)\s*[eE]\s*([+-]{0,1})\s*(\d+)', - '\g<1>e\g<2>\g<3>'), - ('\s+',' '), - ('^\s*#','#')] + spacing_patterns = [(r'\s*\"\s*}', '\"'), + (r'\s*,\s*', ', '), + (r'\s*-\s*', ' - '), + (r'([{(,=])\s*-\s*', r'\g<1> -'), + (r'(return)\s*-\s*', r'\g<1> -'), + (r'\s*\+\s*', ' + '), + (r'([{(,=])\s*\+\s*', r'\g<1> +'), + (r'\(\s*', '('), + (r'\s*\)', ')'), + (r'\{\s*', '{'), + (r'\s*\}', '}'), + (r'\s*=\s*', ' = '), + (r'\s*>\s*', ' > '), + (r'\s*<\s*', ' < '), + (r'\s*!\s*', ' !'), + (r'\s*/\s*', '/'), + (r'\s*\*\s*', ' * '), + (r'\s*-\s+-\s*', '-- '), + (r'\s*\+\s+\+\s*', '++ '), + (r'\s*-\s+=\s*', ' -= '), + (r'\s*\+\s+=\s*', ' += '), + (r'\s*\*\s+=\s*', ' *= '), + (r'\s*/=\s*', ' /= '), + (r'\s*>\s+>\s*', ' >> '), + (r'<\s*double\s*>>\s*', ' > '), + (r'\s*<\s+<\s*', ' << '), + (r'\s*-\s+>\s*', '->'), + (r'\s*=\s+=\s*', ' == '), + (r'\s*!\s+=\s*', ' != '), + (r'\s*>\s+=\s*', ' >= '), + (r'\s*<\s+=\s*', ' <= '), + (r'\s*&&\s*', ' && '), + (r'\s*\|\|\s*', ' || '), + (r'\s*{\s*}', ' {}'), + (r'\s*;\s*', '; '), + (r';\s*\}', ';}'), + (r';\s*$}', ';'), + (r'\s*<\s*([a-zA-Z0-9]+?)\s*>', r'<\g<1>>'), + (r'^#include\s*<\s*(.*?)\s*>', r'#include <\g<1>>'), + (r'(\d+\.{0,1}\d*|\.\d+)\s*[eE]\s*([+-]{0,1})\s*(\d+)', + r'\g<1>e\g<2>\g<3>'), + (r'\s+',' '), + (r'^\s*#','#')] + spacing_re = dict([(key[0], re.compile(key[0])) for key in \ spacing_patterns]) diff --git a/epochX/cudacpp/gg_tt01g.mad/bin/internal/gen_crossxhtml.py b/epochX/cudacpp/gg_tt01g.mad/bin/internal/gen_crossxhtml.py index d58ec573bc..681bf9d09b 100755 --- a/epochX/cudacpp/gg_tt01g.mad/bin/internal/gen_crossxhtml.py +++ b/epochX/cudacpp/gg_tt01g.mad/bin/internal/gen_crossxhtml.py @@ -648,7 +648,7 @@ def recreate(self, banner): if run_card['ickkw'] != 0: #parse the file to have back the information pythia_log = misc.BackRead(pjoin(path, '%s_pythia.log' % tag)) - pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") + pythiare = re.compile(r"\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") for line in pythia_log: info = pythiare.search(line) if not info: @@ -1623,7 +1623,7 @@ def get_html(self, runresults): elif self.debug: text = str(self.debug).replace('. ','.
') if 'http' in text: - pat = re.compile('(http[\S]*)') + pat = re.compile(r'(http[\S]*)') text = pat.sub(r' here ', text) debug = '
%s
%s
' % \ (self.debug.__class__.__name__, text) diff --git a/epochX/cudacpp/gg_tt01g.mad/bin/internal/gen_ximprove.py b/epochX/cudacpp/gg_tt01g.mad/bin/internal/gen_ximprove.py index c86da36a05..415ecc9de0 100755 --- a/epochX/cudacpp/gg_tt01g.mad/bin/internal/gen_ximprove.py +++ b/epochX/cudacpp/gg_tt01g.mad/bin/internal/gen_ximprove.py @@ -158,8 +158,11 @@ def get_helicity(self, to_submit=True, clean=True): (stdout, _) = p.communicate(''.encode()) stdout = stdout.decode('ascii',errors='ignore') if stdout: - nb_channel = max([math.floor(float(d)) for d in stdout.split()]) + lines = stdout.strip().split('\n') + nb_channel = max([math.floor(float(d)) for d in lines[-1].split()]) else: + if os.path.exists(pjoin(self.me_dir, 'error')): + os.remove(pjoin(self.me_dir, 'error')) for matrix_file in misc.glob('matrix*orig.f', Pdir): files.cp(matrix_file, matrix_file.replace('orig','optim')) P_zero_result.append(Pdir) @@ -297,12 +300,14 @@ def get_helicity(self, to_submit=True, clean=True): bad_amps_perhel = [] if __debug__: mtext = open(matrix_file).read() - nb_amp = int(re.findall('PARAMETER \(NGRAPHS=(\d+)\)', mtext)[0]) - logger.debug('nb_hel: %s zero amp: %s bad_amps_hel: %s/%s', len(good_hels),len(bad_amps),len(bad_amps_perhel), len(good_hels)*nb_amp ) + nb_amp = int(re.findall(r'PARAMETER \(NGRAPHS=(\d+)\)', mtext)[0]) + logger.debug('(%s) nb_hel: %s zero amp: %s bad_amps_hel: %s/%s', split_file[-1], len(good_hels),len(bad_amps),len(bad_amps_perhel), len(good_hels)*nb_amp ) if len(good_hels) == 1: files.cp(matrix_file, matrix_file.replace('orig','optim')) continue # avoid optimization if onlye one helicity - recycler = hel_recycle.HelicityRecycler(good_hels, bad_amps, bad_amps_perhel) + + gauge = self.cmd.proc_characteristics['gauge'] + recycler = hel_recycle.HelicityRecycler(good_hels, bad_amps, bad_amps_perhel, gauge=gauge) # In case of bugs you can play around with these: recycler.hel_filt = self.run_card['hel_filtering'] recycler.amp_splt = self.run_card['hel_splitamp'] @@ -1299,7 +1304,7 @@ def get_job_for_event(self): 'script_name': 'unknown', 'directory': C.name, # need to be change for splitted job 'P_dir': C.parent_name, - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # needed for RO gridpack 'offset': 1, # need to be change for splitted job 'nevents': nevents, 'maxiter': self.max_iter, @@ -1387,7 +1392,7 @@ def create_ajob(self, template, jobs, write_dir=None): break info = jobs[j] info['script_name'] = 'ajob%i' % script_number - info['keeplog'] = 'false' + info['keeplog'] = 'false' if self.run_card['keep_log'] != 'debug' else 'true' if "base_directory" not in info: info["base_directory"] = "./" fsock.write(template_text % info) @@ -1456,7 +1461,7 @@ def get_job_for_precision(self): 'script_name': 'unknown', 'directory': C.name, # need to be change for splitted job 'P_dir': C.parent_name, - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # used for RO gridpack 'offset': 1, # need to be change for splitted job 'nevents': nevents, 'maxiter': self.max_iter, @@ -1916,7 +1921,7 @@ def get_job_for_event(self): 'directory': C.name, # need to be change for splitted job 'P_dir': os.path.basename(C.parent_name), 'offset': 1, # need to be change for splitted job - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # use for RO gridpack 'nevents': nevents, #int(nevents*self.gen_events_security)+1, 'maxiter': self.max_iter, 'miniter': self.min_iter, diff --git a/epochX/cudacpp/gg_tt01g.mad/bin/internal/hel_recycle.py b/epochX/cudacpp/gg_tt01g.mad/bin/internal/hel_recycle.py index dfa45d5d20..6c86611f68 100755 --- a/epochX/cudacpp/gg_tt01g.mad/bin/internal/hel_recycle.py +++ b/epochX/cudacpp/gg_tt01g.mad/bin/internal/hel_recycle.py @@ -383,7 +383,7 @@ def get_number(cls, *args): class HelicityRecycler(): '''Class for recycling helicity''' - def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[]): + def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[], gauge='U'): External.good_hel = [] External.nhel_lines = '' @@ -427,6 +427,7 @@ def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[]): self.all_hel = [] self.hel_filt = True + self.gauge = gauge def set_input(self, file): if 'born_matrix' in file: @@ -612,7 +613,7 @@ def unfold_helicities(self, line, nature): def apply_amps(self, line, new_objs): if self.amp_splt: - return split_amps(line, new_objs) + return split_amps(line, new_objs, gauge=self.gauge) else: return apply_args(line, [i.args for i in new_objs]) @@ -785,7 +786,7 @@ def apply_args(old_line, all_the_args): return ''.join(new_lines) -def split_amps(line, new_amps): +def split_amps(line, new_amps, gauge): if not new_amps: return '' fct = line.split('(',1)[0].split('_0')[0] @@ -841,34 +842,31 @@ def split_amps(line, new_amps): spin = fct.split(None,1)[1][to_remove] lines.append('%sP1N_%s(%s)' % (fct, to_remove+1, ', '.join(args))) - hel, iamp = re.findall('AMP\((\d+),(\d+)\)', amp_result)[0] + hel, iamp = re.findall(r'AMP\((\d+),(\d+)\)', amp_result)[0] hel_calculated.append(hel) #lines.append(' %(result)s = TMP(3) * W(3,%(w)s) + TMP(4) * W(4,%(w)s)+' # % {'result': amp_result, 'w': windex}) #lines.append(' & TMP(5) * W(5,%(w)s)+TMP(6) * W(6,%(w)s)' # % {'result': amp_result, 'w': windex}) - if spin in "VF": - lines.append(""" call CombineAmp(%(nb)i, - & (/%(hel_list)s/), - & (/%(w_list)s/), - & TMP, W, AMP(1,%(iamp)s))""" % - {'nb': len(sub_amps), - 'hel_list': ','.join(hel_calculated), - 'w_list': ','.join(windices), - 'iamp': iamp - }) + if spin == "F" or ( spin == "V" and gauge !='FD'): + suffix = '' elif spin == "S": - lines.append(""" call CombineAmpS(%(nb)i, - &(/%(hel_list)s/), - & (/%(w_list)s/), - & TMP, W, AMP(1,%(iamp)s))""" % - {'nb': len(sub_amps), - 'hel_list': ','.join(hel_calculated), - 'w_list': ','.join(windices), - 'iamp': iamp - }) + suffix = 'S' + elif spin == "V" and gauge == "FD": + suffix = "FD" else: - raise Exception("split amp are not supported for spin2 and 3/2") + raise Exception("split amp not supported for spin2, 3/2") + + lines.append(""" call CombineAmp%(suffix)s(%(nb)i, + & (/%(hel_list)s/), + & (/%(w_list)s/), + & TMP, W, AMP(1,%(iamp)s))""" % {'suffix':suffix, + 'nb': len(sub_amps), + 'hel_list': ','.join(hel_calculated), + 'w_list': ','.join(windices), + 'iamp': iamp + }) + #lines.append('') return '\n'.join(lines) diff --git a/epochX/cudacpp/gg_tt01g.mad/bin/internal/histograms.py b/epochX/cudacpp/gg_tt01g.mad/bin/internal/histograms.py index 98f22c4c3a..9931127f66 100755 --- a/epochX/cudacpp/gg_tt01g.mad/bin/internal/histograms.py +++ b/epochX/cudacpp/gg_tt01g.mad/bin/internal/histograms.py @@ -632,34 +632,34 @@ class HwU(Histogram): # than necessary because the HwU standard allows for spaces from within # the name of a weight weight_header_re = re.compile( - '&\s*(?P(\S|(\s(?!\s*(&|$))))+)(\s(?!(&|$)))*') + r'&\s*(?P(\S|(\s(?!\s*(&|$))))+)(\s(?!(&|$)))*') # ================================ # Histo weight specification RE's # ================================ # The start of a plot - histo_start_re = re.compile('^\s*\s*(?P\d+)\s*"\s*'+ - '(?P(\S|(\s(?!\s*")))+)\s*"\s*$') + histo_start_re = re.compile(r'^\s*\s*(?P\d+)\s*"\s*'+ + r'(?P(\S|(\s(?!\s*")))+)\s*"\s*$') # A given weight specifier - a_float_re = '[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' - histo_bin_weight_re = re.compile('(?P%s|NaN)'%a_float_re,re.IGNORECASE) - a_int_re = '[\+|-]?\d+' + a_float_re = r'[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' + histo_bin_weight_re = re.compile(r'(?P%s|NaN)'%a_float_re,re.IGNORECASE) + a_int_re = r'[\+|-]?\d+' # The end of a plot histo_end_re = re.compile(r'^\s*<\\histogram>\s*$') # A scale type of weight - weight_label_scale = re.compile('^\s*mur\s*=\s*(?P%s)'%a_float_re+\ - '\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) - weight_label_PDF = re.compile('^\s*PDF\s*=\s*(?P\d+)\s*$') - weight_label_PDF_XML = re.compile('^\s*pdfset\s*=\s*(?P\d+)\s*$') - weight_label_TMS = re.compile('^\s*TMS\s*=\s*(?P%s)\s*$'%a_float_re) - weight_label_alpsfact = re.compile('^\s*alpsfact\s*=\s*(?P%s)\s*$'%a_float_re, + weight_label_scale = re.compile(r'^\s*mur\s*=\s*(?P%s)'%a_float_re+\ + r'\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) + weight_label_PDF = re.compile(r'^\s*PDF\s*=\s*(?P\d+)\s*$') + weight_label_PDF_XML = re.compile(r'^\s*pdfset\s*=\s*(?P\d+)\s*$') + weight_label_TMS = re.compile(r'^\s*TMS\s*=\s*(?P%s)\s*$'%a_float_re) + weight_label_alpsfact = re.compile(r'^\s*alpsfact\s*=\s*(?P%s)\s*$'%a_float_re, re.IGNORECASE) - weight_label_scale_adv = re.compile('^\s*dyn\s*=\s*(?P%s)'%a_int_re+\ - '\s*mur\s*=\s*(?P%s)'%a_float_re+\ - '\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) - weight_label_PDF_adv = re.compile('^\s*PDF\s*=\s*(?P\d+)\s+(?P\S+)\s*$') + weight_label_scale_adv = re.compile(r'^\s*dyn\s*=\s*(?P%s)'%a_int_re+\ + r'\s*mur\s*=\s*(?P%s)'%a_float_re+\ + r'\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) + weight_label_PDF_adv = re.compile(r'^\s*PDF\s*=\s*(?P\d+)\s+(?P\S+)\s*$') class ParseError(MadGraph5Error): @@ -926,7 +926,7 @@ def get_HwU_source(self, print_header=True): res.append(' '.join('%+16.7e'%wgt for wgt in list(bin.boundaries))) res[-1] += ' '.join('%+16.7e'%bin.wgts[key] for key in self.bins.weight_labels if key not in ['central','stat_error']) - res.append('<\histogram>') + res.append(r'<\histogram>') return res def output(self, path=None, format='HwU', print_header=True): @@ -1149,6 +1149,8 @@ def parse_one_histo_from_stream(self, stream, all_weight_header, boundaries = [0.0,0.0] for j, weight in \ enumerate(HwU.histo_bin_weight_re.finditer(line_bin)): + if (j == len(weight_header)): + continue if j == len(all_weight_header): raise HwU.ParseError("There is more bin weights"+\ " specified than expected (%i)"%len(weight_header)) @@ -1803,7 +1805,7 @@ def parse_histos_from_PY8_XML_stream(self, stream, run_id=None, # Filter empty weights coming from the split weight_label_list = [wgt.strip() for wgt in str(selected_run_node.getAttribute('header')).split(';') if - not re.match('^\s*$',wgt)] + not re.match(r'^\s*$',wgt)] ordered_weight_label_list = [w for w in weight_label_list if w not\ in ['xmin','xmax']] # Remove potential repetition of identical weight labels @@ -1827,7 +1829,7 @@ def parse_histos_from_PY8_XML_stream(self, stream, run_id=None, all_weights = [] for wgt_position, wgt_label in \ enumerate(str(selected_run_node.getAttribute('header')).split(';')): - if not re.match('^\s*$',wgt_label) is None: + if not re.match(r'^\s*$',wgt_label) is None: continue all_weights.append({'POSITION':wgt_position}) for wgt_item in wgt_label.strip().split('_'): @@ -2714,7 +2716,7 @@ def ratio_no_correlations(wgtsA, wgtsB): # First the global gnuplot header for this histogram group global_header =\ -""" +r""" ################################################################################ ### Rendering of the plot titled '%(title)s' ################################################################################ @@ -2862,9 +2864,9 @@ def ratio_no_correlations(wgtsA, wgtsB): major_title = ', '.join(major_title) if not mu[0] in ['none',None]: - major_title += ', dynamical\_scale\_choice=%s'%mu[0] + major_title += r', dynamical\_scale\_choice=%s'%mu[0] if not pdf[0] in ['none',None]: - major_title += ', PDF=%s'%pdf[0].replace('_','\_') + major_title += ', PDF=%s'%pdf[0].replace('_',r'\_') # Do not show uncertainties for individual jet samples (unless first # or specified explicitely and uniquely) @@ -2937,7 +2939,7 @@ def ratio_no_correlations(wgtsA, wgtsB): plot_lines.append( "'%s' index %d using (($1+$2)/2):%d ls %d title '%s'"\ %(HwU_name,block_position+i,mu_var+3,color_index,\ -'%s dynamical\_scale\_choice=%s' % (title,mu[j]))) +r'%s dynamical\_scale\_choice=%s' % (title,mu[j]))) # And now PDF_variation if available if not PDF_var_pos is None: for j,PDF_var in enumerate(PDF_var_pos): @@ -2947,7 +2949,7 @@ def ratio_no_correlations(wgtsA, wgtsB): plot_lines.append( "'%s' index %d using (($1+$2)/2):%d ls %d title '%s'"\ %(HwU_name,block_position+i,PDF_var+3,color_index,\ -'%s PDF=%s' % (title,pdf[j].replace('_','\_')))) +'%s PDF=%s' % (title,pdf[j].replace('_',r'\_')))) # Now add the uncertainty lines, those not using a band so that they # are not covered by those using a band after we reverse plo_lines diff --git a/epochX/cudacpp/gg_tt01g.mad/bin/internal/launch_plugin.py b/epochX/cudacpp/gg_tt01g.mad/bin/internal/launch_plugin.py index 7b10bedcef..9ec09eb71d 100644 --- a/epochX/cudacpp/gg_tt01g.mad/bin/internal/launch_plugin.py +++ b/epochX/cudacpp/gg_tt01g.mad/bin/internal/launch_plugin.py @@ -98,6 +98,7 @@ def default_setup(self): self['vector_size'] = 16 # already setup in default class (just change value) self['aloha_flag'] = '--fast-math' self['matrix_flag'] = '-O3' + self['limhel'] = 0 self.display_block.append('simd') self.display_block.append('psoptim') 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 eee9ba4522..f6e47956cd 100755 --- a/epochX/cudacpp/gg_tt01g.mad/bin/internal/lhe_parser.py +++ b/epochX/cudacpp/gg_tt01g.mad/bin/internal/lhe_parser.py @@ -7,6 +7,7 @@ import numbers import math import time +import copy import os import shutil import sys @@ -101,7 +102,7 @@ def __init__(self, line=None, event=None): self.rwgt = 0 return - + self.event = event if event is not None: self.event_id = len(event) #not yet in the event @@ -1066,6 +1067,8 @@ def define_init_banner(self, wgt, lha_strategy, proc_charac=None): #special case for 1>N init_information = run_card.get_banner_init_information() event = next(self) + if not len(event): #if parse-momenta was false we have to parse the first event + event = Event(str(event)) init_information["idbmup1"] = event[0].pdg init_information["ebmup1"] = event[0].mass init_information["idbmup2"] = 0 @@ -1149,6 +1152,7 @@ def initialize_unweighting(self, getwgt, trunc_error): nb_keep = max(20, int(nb_event*trunc_error*15)) new_wgt = new_wgt[-nb_keep:] if nb_event == 0: + misc.sprint(i,f) raise Exception # store the information self.initial_nb_events[i] = nb_event @@ -1203,7 +1207,6 @@ def unweight(self, outputpath, get_wgt, **opts): (stop to write event when target is reached) """ - if isinstance(get_wgt, (str,six.text_type)): unwgt_name =get_wgt def get_wgt_multi(event): @@ -1483,12 +1486,12 @@ def reorder_mother_child(self): particle.mother2 -= 1 # re-call the function for the next potential change return self.reorder_mother_child() - - - - - + + + + + def parse_reweight(self): """Parse the re-weight information in order to return a dictionary {key: value}. If no group is define group should be '' """ @@ -1522,6 +1525,37 @@ def parse_nlo_weight(self, real_type=(1,11), threshold=None): threshold=threshold) return self.nloweight + def get_fks_pair(self, real_type=(1,11), threshold=None): + """ Gives the fks pair labels""" + start, stop = self.tag.find(''), self.tag.find('') + if start != -1 != stop: + text = self.tag[start+8:stop] + all_line = text.split('\n') + text = text.lower().replace('d','e') + all_line = text.split('\n') + for line in all_line: + data = line.split() + if len(data)>16: + wgt = OneNLOWeight(line, real_type=real_type) + return wgt.to_merge_pdg,wgt.nexternal + + def get_born_momenta(self,real_type=(1,11), threshold=None): + """ Gets the underlying n+1 body kinematics""" + start, stop = self.tag.find(''), self.tag.find('') + if start != -1 != stop: + text = self.tag[start+8:stop] + text = text.lower().replace('d','e') + all_line = text.split('\n') + for line in all_line: + data = line.split() + if len(data)>16: + wgt = OneNLOWeight(line, real_type=real_type) + nexternal = wgt.nexternal + real_momenta = all_line[2:2+nexternal] + return real_momenta + + + def rewrite_nlo_weight(self, wgt=None): """get the string associate to the weight""" @@ -1558,11 +1592,11 @@ def parse_lo_weight(self): return self.loweight if not hasattr(Event, 'loweight_pattern'): - Event.loweight_pattern = re.compile('''\s*(?P\d+)\s+(?P[\d.e+-]+)\s*\s*\n\s* - \s*(?P[\s\d.+-e]+)\s*\s*\n\s* - 1|2)["']?\>\s*(?P[\s\d.e+-]*)\s*\s*\n\s* - 1|2)["']?\>\s*(?P[\s\d.e+-]*)\s*\s*\n\s* - \s*(?P[\d.e+-]*)\s* + Event.loweight_pattern = re.compile('''\\s*(?P\\d+)\\s+(?P[\\d.e+-]+)\\s*\\s*\n\\s* + \\s*(?P[\\s\\d.+-e]+)\\s*\\s*\n\\s* + 1|2)["']?\\>\\s*(?P[\\s\\d.e+-]*)\\s*\\s*\n\\s* + 1|2)["']?\\>\\s*(?P[\\s\\d.e+-]*)\\s*\\s*\n\\s* + \\s*(?P[\\d.e+-]*)\\s* ''',re.X+re.I+re.M) start, stop = self.tag.find(''), self.tag.find('') @@ -1615,7 +1649,7 @@ def parse_matching_scale(self): self.matched_scale_data = [] - pattern = re.compile("") + pattern = re.compile(r"") data = re.split(pattern,self.tag) if len(data) == 1: return [] @@ -1623,7 +1657,7 @@ def parse_matching_scale(self): tmp = {} start,content, end = data self.tag = "%s%s" % (start, end) - pattern = re.compile("pt_clust_(\d*)=\"([\de+-.]*)\"") + pattern = re.compile("pt_clust_(\\d*)=\"([\\de+-.]*)\"") for id,value in pattern.findall(content): tmp[int(id)] = float(value) for i in range(1, len(self)+1): @@ -1647,7 +1681,7 @@ def parse_syscalc_info(self): return self.syscalc_data pattern = re.compile("|") - pattern2 = re.compile("<(?P[\w]*)(?:\s*(\w*)=[\"'](.*)[\"']\s*|\s*)>(.*)") + pattern2 = re.compile("<(?P[\\w]*)(?:\\s*(\\w*)=[\"'](.*)[\"']\\s*|\\s*)>(.*)") data = re.split(pattern,self.tag) if len(data) == 1: return [] @@ -1850,6 +1884,240 @@ def get_decay(self, pdg_code=0, event_id=None): return new_event + + def set_initial_mass_to_zero(self): + """set the masses of the initial particles to zero, by reshuffling the respective momenta + Works only in the **partonic** com frame, so the event must be boosted to such frame + before calling the function + """ + + if not misc.equal(self[0].px, 0) or not misc.equal(self[1].px, 0) or \ + not misc.equal(self[0].py, 0) or not misc.equal(self[1].py, 0) or \ + not misc.equal(self[0].pz, - self[1].pz, zero_limit=False): + misc.sprint(self[0]) + misc.sprint(self[1]) + raise Exception('momenta should be in the partonic center of mass frame') + + self[0].mass = 0. + self[1].mass = 0. + tot_E=0. + for ip,part in enumerate(self): + if part.status == 1 : + tot_E += part.E + if (self[0].pz > 0. and self[1].pz < 0): + self[0].set_momentum(FourMomentum([tot_E/2., 0., 0., tot_E/2.])) + self[1].set_momentum(FourMomentum([tot_E/2., 0., 0., -tot_E/2.])) + elif (self[0].pz < 0. and self[1].pz > 0): + self[0].set_momentum(FourMomentum([tot_E/2., 0., 0., -tot_E/2.])) + self[1].set_momentum(FourMomentum([tot_E/2., 0., 0., tot_E/2.])) + else: + logger.critical('ERROR: two incoming partons not back.-to-back') + + def set_final_jet_mass_to_zero(self): + """set the final light particle masses to zero + """ + + for ip,part in enumerate(self): + if ((abs(part.pid) <= 5) or (abs(part.pid) == 11) or (abs(part.pid) == 12)) and (part.status == 1): + part.mass = 0. + E_1_new = math.sqrt(part.mass**2 + part.px**2 + part.py**2 + part.pz**2) + part.set_momentum(FourMomentum([E_1_new, part.px, part.py, part.pz])) + + + + def merge_particles_kinematics(self, i,j, moth): + """Map to an underlying n-body kinematics for two given + particles i,j to be merged and a resulting moth""" + """ note! kinematics (and id) mapping only! """ + + recoil = True + fks_type = False + + if recoil and not fks_type: + if (i == moth[0].get('number')-1): + fks_i = i + fks_j = j + elif (j == moth[0].get('number')-1): + fks_i = j + fks_j = i + to_remove = fks_j + + merge_i = self[fks_i] + merge_j = self[fks_j] + + i_4mom = FourMomentum(merge_i) + j_4mom = FourMomentum(merge_j) + if (fks_i <= 1): + sign1 = -1.0 + else: + sign1 = 1.0 + mother_4mom = i_4mom + sign1*j_4mom + + new_event = copy.deepcopy(self) + + self[fks_i].pid = moth[0]['id'] + self[fks_i].set_momentum(mother_4mom) + + if fks_i <= 1: # initial-state recoil + new_p = FourMomentum() + for ip,part in enumerate(self): + if (ip != fks_i and ip != fks_j and ip >= 2): + new_p += part + + if fks_i == 0: + self[1].set_momentum(new_p - FourMomentum(self[0])) + elif fks_i == 1: + self[0].set_momentum(new_p - FourMomentum(self[1])) + + pz_1_new = self.recoil_eq(self[0],self[1]) + pz_2_new = self[0].pz + self[1].pz - pz_1_new + E_1_new = math.sqrt(self[0].mass**2 + self[0].px**2 + self[0].py**2 + pz_1_new **2) + E_2_new = math.sqrt(self[1].mass**2 + self[1].px**2 + self[1].py**2 + pz_2_new **2) + self[0].set_momentum(FourMomentum([E_1_new,self[0].px,self[0].py,pz_1_new])) + self[1].set_momentum(FourMomentum([E_2_new,self[1].px,self[1].py,pz_2_new])) + self.pop(to_remove) + + if fks_i > 1: # final-state recoil + + # Re-scale the energy of fks_i to make it on-shell + for ip,part in enumerate(self): + if (ip == fks_i): + part.E = math.sqrt(part.mass**2 + part.px**2 + part.py**2 + part.pz**2) + new_p.E = part.E + + # Find the overall energy in the final state + new_p.E = 0.0 + for ip,part in enumerate(self): + if (ip != fks_j and ip >= 2): + new_p.E += part.E + + # Use one of the initial states to absorb the energy change in the final state + self[1].set_momentum(FourMomentum([new_p.E-self[0].E,self[1].px,self[1].py,self[1].pz])) + + # Change the initial state pz and E + pz_1_new = self.recoil_eq(self[0],self[1]) + pz_2_new = self[0].pz + self[1].pz - pz_1_new + E_1_new = math.sqrt(self[0].mass**2 + self[0].px**2 + self[0].py**2 + pz_1_new **2) + E_2_new = math.sqrt(self[1].mass**2 + self[1].px**2 + self[1].py**2 + pz_2_new **2) + self[0].set_momentum(FourMomentum([E_1_new,self[0].px,self[0].py,pz_1_new])) + self[1].set_momentum(FourMomentum([E_2_new,self[1].px,self[1].py,pz_2_new])) + self.pop(to_remove) + + elif fks_type and not recoil: + ## Do it in a more FKS-style + if (i == moth[0].get('number')-1): + fks_i = i + fks_j = j + elif (j == moth[0].get('number')-1): + fks_i = j + fks_j = i + to_remove = fks_j + new_event = copy.copy(event) + + if fks_i <= 1: # initial-state recoil + + # First boost to partonic CM frame + q = FourMomentum(self[0])+FourMomentum(self[1]) + for ip,part in enumerate(self): + vec = FourMomentum(part) + self[ip].set_momentum(vec.zboost(pboost=q)) + + k_tot = FourMomentum([self[0].E+self[1].E-self[fks_j].E,self[0].px+self[1].px-self[fks_j].px,\ + self[0].py+self[1].py-self[fks_j].py,self[0].pz+self[1].pz-self[fks_j].pz]) + + final = FourMomentum([0,0,0,0]) + for ip,part in enumerate(self): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + if (ip != fks_i and ip != fks_j and ip >= 2): + final = final + vec + + s = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz])**2 + ksi = self[fks_j].E/(math.sqrt(s)/2.0) + y = self[fks_j].pz/self[fks_j].E + + self[0].pz = self[0].pz * math.sqrt(1.0-ksi)*math.sqrt((2.0-ksi*(1.0+y))/((2.0-ksi*(1.0-y)))) + self[0].E = math.sqrt(self[0].mass**2 + self[0].pz**2) + self[1].pz = self[1].pz * math.sqrt(1.0-ksi)*math.sqrt((2.0-ksi*(1.0-y))/((2.0-ksi*(1.0+y)))) + self[1].E = math.sqrt(self[1].mass**2 + self[1].pz**2) + + final = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + k_tot_1 = k_tot.zboost(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + k_tot_2 = k_tot_1.pt_boost(pboost=FourMomentum([k_tot_1.E,k_tot_1.px,k_tot_1.py,k_tot_1.pz])) + k_tot_3 = k_tot_2.zboost_inv(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + + for ip,part in enumerate(self): + if (ip >= 2): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + vec2 = vec.zboost(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + vec3 = vec2.pt_boost(pboost=FourMomentum([k_tot_1.E,k_tot_1.px,k_tot_1.py,k_tot_1.pz])) + vec_new = vec3.zboost_inv(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + self[ip].set_momentum(FourMomentum([vec_new.E,vec_new.px,vec_new.py,vec_new.pz])) + + self.pop(to_remove) + + else: # final-state recoil + q = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + for ip,part in enumerate(self): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + self[ip].set_momentum(vec.zboost(pboost=q)) + + q = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + k = FourMomentum([self[fks_i].E+self[fks_j].E,self[fks_i].px+self[fks_j].px,\ + self[fks_i].py+self[fks_j].py,self[fks_i].pz+self[fks_j].pz]) + + k_rec = FourMomentum([0,0,0,0]) + for ip,part in enumerate(self): + if ip >= 2 and ip != fks_i and ip != fks_j: # add only final-states to the recoil and not the FKS pair + k_rec = k_rec + FourMomentum([part.E,part.px,part.py,part.pz]) + + k_mom = math.sqrt(k_rec.px**2 + k_rec.py**2 + k_rec.pz**2) + beta = (q**2 - (k_rec.E+k_mom)**2)/(q**2 + (k_rec.E+k_mom)**2) + for ip,part in enumerate(self): + if ip >= 2 and ip != fks_i and ip != fks_j: + vec = FourMomentum([self[ip].E,self[ip].px,self[ip].py,self[ip].pz]) + self[ip].set_momentum(vec.boost_beta(beta,k_rec)) + if ip == fks_i: + self[ip].set_momentum(q - k_rec.boost_beta(beta,k_rec)) + self.pop(to_remove) + else: + logger.info('Error in Sudakov Born mapping: no recoil scheme found!') + + def recoil_eq(self,part1, part2): + """ In general, solves the equation + E1 + E2 = K + p1 + p2 = c + E1^2 - p1^2 = a + E2^2 - p2^2 = b + and returns p1 + """ + thresh = 1e-6 + import random + a = part1.mass**2 + part1.px**2 + part1.py**2 + b = part2.mass**2 + part2.px**2 + part2.py**2 + c = part1.pz + part2.pz + K = part1.E + part2.E + K2 = K**2 + sol1 = (-a*c + b*c + c**3 - c*K2 - math.sqrt(K2*(a**2 + (b + c**2 - K2)**2 - 2*a*(b - c**2 + K2))))/(2*(c**2-K2)) + sol2 = (-a*c + b*c + c**3 - c*K2 + math.sqrt(K2*(a**2 + (b + c**2 - K2)**2 - 2*a*(b - c**2 + K2))))/(2*(c**2-K2)) + + if abs(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2) - (math.sqrt(a+sol2**2) + math.sqrt(b+(c-sol2)**2))) > thresh: + logger.critical('Error in recoil_eq solver 1') + logger.critical(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2)) + logger.critical(math.sqrt(a+sol2**2) + math.sqrt(b+(c-sol2)**2)) + if abs(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2) - K) > thresh: + logger.critical('Error in recoil_eq solver 2') + logger.critical(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2)) + logger.critical(K) + return sol1 + + def boost(self, filter=None): """modify the current event to boost it according to the current filter""" if filter is None: @@ -1861,7 +2129,7 @@ def boost(self, filter=None): if list(filter(p)): pboost += p else: - pboost = FourMomentum(pboost) + pboost = FourMomentum(filter) # change sign of three-component due to helas convention pboost.px *=-1 @@ -1877,7 +2145,7 @@ def check(self): """check various property of the events""" # check that relative error is under control - threshold = 1e-6 + threshold = 1e-4 #1. Check that the 4-momenta are conserved E, px, py, pz = 0,0,0,0 @@ -1920,7 +2188,50 @@ def check(self): self.check_color_structure() #3. check mass - + + def check_kinematics_only(self): + """check various property of the events - only kinematics""" + + # check that relative error is under control + threshold = 1e-3 + + #1. Check that the 4-momenta are conserved + E, px, py, pz = 0,0,0,0 + absE, abspx, abspy, abspz = 0,0,0,0 + for particle in self: + coeff = 1 + if particle.status == -1: + coeff = -1 + elif particle.status != 1: + continue + E += coeff * particle.E + absE += abs(particle.E) + px += coeff * particle.px + py += coeff * particle.py + pz += coeff * particle.pz + abspx += abs(particle.px) + abspy += abs(particle.py) + abspz += abs(particle.pz) + # check mass + fourmass = FourMomentum(particle).mass + + if particle.mass and (abs(particle.mass) - fourmass)/ abs(particle.mass) > threshold: + logger.critical(self) + raise Exception( "Do not have correct mass lhe: %s momentum: %s (error at %s" % (particle.mass, fourmass, (abs(particle.mass) - fourmass)/ abs(particle.mass))) + + if abs(E/absE) > threshold: + logger.critical(self) + raise Exception("Do not conserve Energy %s, %s" % (E/absE, E)) + if abs(px/abspx) > threshold: + logger.critical(self) + raise Exception("Do not conserve Px %s, %s" % (px/abspx, px)) + if abs(py/abspy) > threshold: + logger.critical(self) + raise Exception("Do not conserve Py %s, %s" % (py/abspy, py)) + if abs(pz/abspz) > threshold: + logger.critical(self) + raise Exception("Do not conserve Pz %s, %s" % (pz/abspz, pz)) + def assign_scale_line(self, line, convert=True): """read the line corresponding to global event line @@ -2764,7 +3075,7 @@ def zboost(self, pboost=None, E=0, pz=0): if isinstance(pboost, FourMomentum): E = pboost.E pz = pboost.pz - + #beta = pz/E gamma = E / math.sqrt(E**2-pz**2) gammabeta = pz / math.sqrt(E**2-pz**2) @@ -2778,6 +3089,74 @@ def zboost(self, pboost=None, E=0, pz=0): out.pz = 0 return out + def zboost_inv(self, pboost=None, E=0, pz=0): + """Both momenta should be in the same frame. + The boost perform correspond to the boost required to set pboost at + rest (only z boost applied). + """ + if isinstance(pboost, FourMomentum): + E = pboost.E + pz = pboost.pz + + #beta = pz/E + gamma = E / math.sqrt(E**2-pz**2) + gammabeta = pz / math.sqrt(E**2-pz**2) + + out = FourMomentum([gamma*self.E + gammabeta*self.pz, + self.px, + self.py, + gamma*self.pz + gammabeta*self.E]) + + if abs(out.pz) < 1e-6 * out.E: + out.pz = 0 + return out + + + def pt_boost(self, pboost=None, E=0, pz=0): + """Both momenta should be in the same frame. + The boost perform correspond to the boost required to set pboost at + rest (only pT boost applied). + """ + + if isinstance(pboost, FourMomentum): + E = pboost.E + px = pboost.px + py = pboost.py + mass = math.sqrt(E**2 - px**2 - py**2) + + betax = px/E + betay = py/E + beta = math.sqrt(betax**2+betay**2) + gamma = 1 / math.sqrt(1.0-beta**2) + + out = FourMomentum([gamma*self.E - gamma*betax*self.px - gamma*betay*self.py, + -gamma*betax*self.E + (1.0 + (gamma-1.0)*betax**2/(beta**2))*self.px + (gamma-1.0)*betax*betay/(beta**2)*self.py, + -gamma*betay*self.E + ((gamma-1.0)*betax*betay/(beta**2))*self.px + (1.0+(gamma-1.0)*(betay**2)/(beta**2))*self.py, + self.pz]) + + if abs(out.px) < 1e-6 * out.E: + out.px = 0 + if abs(out.py) < 1e-6 * out.E: + out.py = 0 + return out + + def boost_beta(self,beta,mom): + """ Boost along the three-momentum of mom with a boost of size beta""" + + unit = mom * (1.0/math.sqrt(mom.px**2+mom.py**2+mom.pz**2)) + beta_vec = beta*unit + bx = beta_vec.px + by = beta_vec.py + bz = beta_vec.pz + gamma = 1.0 / math.sqrt(1.0-beta**2) + + out = FourMomentum([gamma*self.E - gamma*bx*self.px - gamma*by*self.py - gamma*bz*self.pz, + -gamma*bx*self.E + (1.0 + (gamma-1.0)*bx**2/(beta**2))*self.px + (gamma-1.0)*bx*by/(beta**2)*self.py + (gamma-1.0)*bx*bz/(beta**2)*self.pz, + -gamma*by*self.E + ((gamma-1.0)*bx*by/(beta**2))*self.px + (1.0+(gamma-1.0)*(by**2)/(beta**2))*self.py + (gamma-1.0)*by*bz/(beta**2)*self.pz, + -gamma*bz*self.E + (gamma-1.0)*bx*bz/(beta**2)*self.px + (gamma-1.0)*(by*bz)/(beta**2)*self.py + (1.0+(gamma-1.0)*bz**2/(beta**2))*self.pz]) + + return out + def boost_to_restframe(self, pboost): """apply the boost transformation such that pboost is at rest in the new frame. First apply a rotation to allign the pboost to the z axis and then use @@ -2789,27 +3168,64 @@ def boost_to_restframe(self, pboost): return out - # write pboost as (E, p cosT sinF, p sinT sinF, p cosF) - # rotation such that it become (E, 0 , 0 , p ) is - # cosT sinF , -sinT , cosT sinF - # sinT cosF , cosT , sinT sinF - # -sinT , 0 , cosF - p = math.sqrt( pboost.px**2 + pboost.py**2+ pboost.pz**2) - cosF = pboost.pz / p - sinF = math.sqrt(1-cosF**2) - sinT = pboost.py/p/sinF - cosT = pboost.px/p/sinF - - out=FourMomentum([self.E, - self.px*cosT*cosF + self.py*sinT*cosF-self.pz*sinF, - -self.px*sinT+ self.py*cosT, - self.px*cosT*sinF + self.py*sinT*sinF + self.pz*cosF - ]) - out = out.zboost(E=pboost.E,pz=p) + # see here https://physics.stackexchange.com/questions/749036/general-lorentz-boost-of-four-momentum-in-cm-frame-particle-physics + vx = pboost.px/pboost.E + vy = pboost.py/pboost.E + vz = pboost.pz/pboost.E + v = pboost.norm/pboost.E + v2 = pboost.norm_sq/pboost.E**2 + gamma = 1./math.sqrt(1.-v**2) + gammo = gamma-1. + out = FourMomentum(E = gamma*(self.E - vx*self.px - vy*self.py - vz*self.pz), + px= -gamma*vx*self.E + (1+gammo*vx**2/v2)*self.px + gammo*vx*vy/v2*self.py + gammo*vx*vz/v2*self.pz, + py= -gamma*vy*self.E + gammo*vy*vx/v2*self.px + (1+gammo*vy**2/v2)*self.py + gammo*vy*vz/v2*self.pz, + pz= -gamma*vz*self.E + gammo*vz*vx/v2*self.px + gammo*vz*vy/v2*self.py + (1+gammo*vz**2/v2)*self.pz) + return out + def rotate_to_z(self,prot): + + import math + import numpy as np + + z = np.array([0.,0.,1.]) + + px = self.px + py = self.py + pz = self.pz + + refx = prot.px + refy = prot.py + refz = prot.pz + + prot_mom = np.array([px, py, pz]) + ref_mom = np.array([refx, refy, refz]) + + # Create normal vector + n = np.array([refy, -refx, 0.]) + n = n * 1./math.sqrt(self.threedot(n,n)) + t = prot_mom - self.threedot(n,prot_mom)*n + p = ref_mom - self.threedot(ref_mom,z)*z + p = p/math.sqrt(self.threedot(p,p)) + + t_pz = np.array([self.threedot(t,p), self.threedot(t,z), 0.]) + costheta = self.threedot(ref_mom,z)* 1./math.sqrt(self.threedot(ref_mom, ref_mom)) + sintheta=math.sqrt(1.-costheta**2) + + sgn = 1. + t_pz_p = np.array([0., 0., 0.]) + t_pz_p[0] = costheta*t_pz[0] + sgn*(-sintheta) * t_pz[1] + t_pz_p[1] = sgn*sintheta*t_pz[0] + costheta * t_pz[1] + + out_mom = self.threedot(n,prot_mom)*n + t_pz_p[0]*p + t_pz_p[1]*z + + out = FourMomentum([self.E,out_mom[0], out_mom[1], out_mom[2] ] ) + + return out - + def threedot(self,a,b): + + return a[0]*b[0]+a[1]*b[1]+a[2]*b[2] class OneNLOWeight(object): 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 2a118e21bf..8e30cf690c 100755 --- a/epochX/cudacpp/gg_tt01g.mad/bin/internal/madevent_interface.py +++ b/epochX/cudacpp/gg_tt01g.mad/bin/internal/madevent_interface.py @@ -496,7 +496,6 @@ def help_remove(self): logger.info(" the optional '-f' allows to by-pass all security question") logger.info(" The banner can be remove only if all files are removed first.") - class AskRun(cmd.ControlSwitch): """a class for the question on what to do on a madevent run""" @@ -2393,13 +2392,17 @@ def do_generate_events(self, line): # Check argument's validity mode = self.check_generate_events(args) switch_mode = self.ask_run_configuration(mode, args) - if not args: - # No run name assigned -> assigned one automaticaly - self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton') - else: - self.set_run_name(args[0], None, 'parton', True) - args.pop(0) - + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat'), consistency=False) + if not run_card.scan_set: + if not args: + # No run name assigned -> assigned one automaticaly + self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton') + else: + self.set_run_name(args[0], None, 'parton', True) + args.pop(0) + + self.run_generate_events(switch_mode, args) self.postprocessing() @@ -2560,7 +2563,7 @@ def wait_monitoring(Idle, Running, Done): self.update_status("postprocessing contur done", level="rivet") # this decorator handle the loop related to scan. - @common_run.scanparamcardhandling() + @common_run.scanparamcardhandling(run_card_scan=True) def run_generate_events(self, switch_mode, args): if self.proc_characteristics['loop_induced'] and self.options['run_mode']==0: @@ -2593,7 +2596,6 @@ def run_generate_events(self, switch_mode, args): # Regular run mode logger.info('Generating %s events with run name %s' % (self.run_card['nevents'], self.run_name)) - self.exec_cmd('survey %s %s' % (self.run_name,' '.join(args)), postcmd=False) nb_event = self.run_card['nevents'] @@ -2975,7 +2977,7 @@ def update_width_in_param_card(decay_info, initial=None, output=None): particle = 0 # Read BRs for this decay line = param_card[line_number] - while re.search('^(#|\s|\d)', line): + while re.search(r'^(#|\s|\d)', line): line = param_card.pop(line_number) if not particle or line.startswith('#'): line=param_card[line_number] @@ -3226,7 +3228,7 @@ def do_treatcards(self, line, mode=None, opt=None): for line in open(pjoin(bias_module_path,'%s.f'%os.path.basename(bias_module_path))): if start and last: break - if not start and not re.search('c\s*parameters\s*=\s*{',line, re.I): + if not start and not re.search(r'c\s*parameters\s*=\s*{',line, re.I): continue start = True if not line.startswith('C'): @@ -3235,7 +3237,7 @@ def do_treatcards(self, line, mode=None, opt=None): if '{' in line: line = line.split('{')[-1] # split for } ! # - split_result = re.split('(\}|!|\#)', line,1, re.M) + split_result = re.split(r'(\}|!|\#)', line,1, re.M) line = split_result[0] sep = split_result[1] if len(split_result)>1 else None if sep == '}': @@ -3514,8 +3516,8 @@ def pass_in_difficult_integration_mode(self, rate=1): text = open(conf_path).read() min_evt, max_evt = 2500 *(2+rate), 10000*(rate+1) - text = re.sub('''\(min_events = \d+\)''', '(min_events = %i )' % min_evt, text) - text = re.sub('''\(max_events = \d+\)''', '(max_events = %i )' % max_evt, text) + text = re.sub(r'''\(min_events = \d+\)''', '(min_events = %i )' % min_evt, text) + text = re.sub(r'''\(max_events = \d+\)''', '(max_events = %i )' % max_evt, text) fsock = open(conf_path, 'w') fsock.write(text) fsock.close() @@ -3619,7 +3621,7 @@ def do_refine(self, line): alljobs = misc.glob('ajob*', Pdir) #remove associated results.dat (ensure to not mix with all data) - Gre = re.compile("\s*j=(G[\d\.\w]+)") + Gre = re.compile(r"\s*j=(G[\d\.\w]+)") for job in alljobs: Gdirs = Gre.findall(open(job).read()) for Gdir in Gdirs: @@ -3727,58 +3729,126 @@ def do_combine_events(self, line): sum_xsec, sum_xerru, sum_axsec = 0,[],0 Gdirs = self.get_Gdir() Gdirs.sort() - for Gdir in Gdirs: - if os.path.exists(pjoin(Gdir, 'events.lhe')): - result = sum_html.OneResult('') - result.read_results(pjoin(Gdir, 'results.dat')) - sum_xsec += result.get('xsec') - sum_xerru.append(result.get('xerru')) - sum_axsec += result.get('axsec') - - if self.run_card['gridpack'] or self.run_card['nevents']==0: - os.remove(pjoin(Gdir, 'events.lhe')) - continue + partials_info = [] + try: + p = subprocess.Popen(["ulimit", "-n"], stdout=subprocess.PIPE) + out, err = p.communicate() + max_G = out.decode() + if max_G == "unlimited": + max_G =2500 + else: + max_G = int(max_G) - 40 + except Exception as error: + logger.debug(error) + max_G = 80 # max(20, len(Gdirs)/self.options['nb_core']) - AllEvent.add(pjoin(Gdir, 'events.lhe'), - result.get('xsec'), - result.get('xerru'), - result.get('axsec') - ) - - if len(AllEvent) >= 80: #perform a partial unweighting - AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % partials), - get_wgt, log_level=5, trunc_error=1e-2, event_target=self.run_card['nevents']) - AllEvent = lhe_parser.MultiEventFile() - AllEvent.banner = self.banner - AllEvent.add(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % partials), - sum_xsec, - math.sqrt(sum(x**2 for x in sum_xerru)), - sum_axsec) - partials +=1 - if not hasattr(self,'proc_characteristic'): self.proc_characteristic = self.get_characteristics() - if len(AllEvent) == 0: - nb_event = 0 - else: + mycluster = cluster.MultiCore(nb_core=self.options['nb_core']) + + def split(a, n): + """split a list "a" into n chunk of same size (or nearly same size)""" + k, m = divmod(len(a), n) + return (a[i*k+min(i, m):(i+1)*k+min(i+1, m)] for i in range(n)) + + partials_info = [] + if len(Gdirs) >= max_G: + start_unweight= time.perf_counter() + # first check in how many chunk we have to split (always use a multiple of nb_core) + nb_split = 1 + nb_G = len(Gdirs) // (2* self.options['nb_core']) + while nb_G > min(80, max_G): + nb_split += 1 + nb_G = len(Gdirs)//(nb_split*2*self.options['nb_core']) + if nb_G < 10: + nb_split -=1 + nb_G = len(Gdirs)//(nb_split*2*self.options['nb_core']) + + #enforce at least 10 directory per thread + if nb_G > 10 or nb_split>1: + # do the unweighting of each chunk on their own thread + nb_chunk = (nb_split*2*self.options['nb_core']) + else: + nb_chunk = len(Gdirs) // 10 + nb_G =10 + + # security that the number of combine events is too large + if nb_chunk >= max_G: + nb_chunk = max_G -1 + nb_G = len(Gdirs) // nb_chunk + + for i, local_G in enumerate(split(Gdirs, nb_chunk)): + line = [pjoin(self.me_dir, "Events", self.run_name, "partials%d.lhe.gz" % i)] + line.append(pjoin(self.me_dir, 'Events', self.run_name, '%s_%s_banner.txt' % (self.run_name, tag))) + line.append(str(self.results.current['cross'])) + line += local_G + partials_info.append(self.do_combine_events_partial(' '.join(line), preprocess_only=True)) + mycluster.submit(sys.executable, + [pjoin(self.me_dir, 'bin', 'internal', 'madevent_interface.py'), 'combine_events_partial'] + line, + stdout='/dev/null' + ) + + starttime = time.time() + update_status = lambda idle, run, finish: \ + self.update_status((idle, run, finish, 'unweight'), level=None, + force=False, starttime=starttime) + mycluster.wait(self.me_dir, update_status) + # do the final combination + for data in partials_info: + AllEvent.add(*data) + + start_unweight= time.perf_counter() nb_event = AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "unweighted_events.lhe.gz"), get_wgt, trunc_error=1e-2, event_target=self.run_card['nevents'], log_level=logging.DEBUG, normalization=self.run_card['event_norm'], proc_charac=self.proc_characteristic) + + #cleaning + for data in partials_info: + path = data[0] + try: + os.remove(path) + except Exception as error: + try: + os.remove(path[:-3]) # try without the .gz + except: + misc.sprint('no file ', path, 'to clean') + else: + for Gdir in Gdirs: + if os.path.exists(pjoin(Gdir, 'events.lhe')): + result = sum_html.OneResult('') + result.read_results(pjoin(Gdir, 'results.dat')) + sum_xsec += result.get('xsec') + sum_xerru.append(result.get('xerru')) + sum_axsec += result.get('axsec') + + if self.run_card['gridpack'] or self.run_card['nevents']==0: + os.remove(pjoin(Gdir, 'events.lhe')) + continue + + AllEvent.add(pjoin(Gdir, 'events.lhe'), + result.get('xsec'), + result.get('xerru'), + result.get('axsec') + ) + + if len(AllEvent) == 0: + nb_event = 0 + else: + nb_event = AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "unweighted_events.lhe.gz"), + get_wgt, trunc_error=1e-2, event_target=self.run_card['nevents'], + log_level=logging.DEBUG, normalization=self.run_card['event_norm'], + proc_charac=self.proc_characteristic) + + if nb_event < self.run_card['nevents']: + logger.warning("failed to generate enough events. Please follow one of the following suggestions to fix the issue:") + logger.warning(" - set in the run_card.dat 'sde_strategy' to %s", 1 + self.run_card['sde_strategy'] % 2) + logger.warning(" - set in the run_card.dat 'hard_survey' to 1 or 2.") + logger.warning(" - reduce the number of requested events (if set too high)") + logger.warning(" - check that you do not have -integrable- singularity in your amplitude.") + logger.warning(" - regenerate your process directory by selecting another gauge (in particular try FD gauge).") - if nb_event < self.run_card['nevents']: - logger.warning("failed to generate enough events. Please follow one of the following suggestions to fix the issue:") - logger.warning(" - set in the run_card.dat 'sde_strategy' to %s", 1 + self.run_card['sde_strategy'] % 2) - logger.warning(" - set in the run_card.dat 'hard_survey' to 1 or 2.") - logger.warning(" - reduce the number of requested events (if set too high)") - logger.warning(" - check that you do not have -integrable- singularity in your amplitude.") - if partials: - for i in range(partials): - try: - os.remove(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % i)) - except Exception: - os.remove(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe" % i)) self.results.add_detail('nb_event', nb_event) @@ -3789,7 +3859,50 @@ def do_combine_events(self, line): logger.info("combination of events done in %s s ", time.time()-start) self.to_store.append('event') + + ############################################################################ + def do_combine_events_partial(self, line, preprocess_only=False): + """ """ + + AllEvent = lhe_parser.MultiEventFile() + + sum_xsec, sum_xerru, sum_axsec = 0,[],0 + output, banner_path,cross = line.split()[:3] + Gdirs = line.split()[3:] + + cross = float(cross) + if not self.banner: + self.banner = banner_mod.Banner(banner_path) + if not hasattr(self, 'run_card'): + self.run_card = banner_mod.RunCard(self.banner['mgruncard']) + AllEvent.banner = self.banner + + for Gdir in Gdirs: + if os.path.exists(pjoin(Gdir, 'events.lhe')): + result = sum_html.OneResult('') + result.read_results(pjoin(Gdir, 'results.dat')) + sum_xsec += result.get('xsec') + sum_xerru.append(result.get('xerru')) + sum_axsec += result.get('axsec') + + if self.run_card['gridpack'] or self.run_card['nevents']==0: + os.remove(pjoin(Gdir, 'events.lhe')) + continue + if not preprocess_only: + AllEvent.add(pjoin(Gdir, 'events.lhe'), + result.get('xsec'), + result.get('xerru'), + result.get('axsec') + ) + if preprocess_only: + return output, sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), sum_axsec + nb_event = max(min(abs(1.01*self.run_card['nevents']*sum_axsec/cross),self.run_card['nevents']), 10) + get_wgt = lambda event: event.wgt + AllEvent.unweight(output, + get_wgt, log_level=5, trunc_error=1e-2, event_target=nb_event) + return output, sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), sum_axsec + ############################################################################ def correct_bias(self): """check the first event and correct the weight by the bias @@ -3902,13 +4015,19 @@ def do_store_events(self, line): #except Exception: # continue # Store log - try: - if os.path.exists(pjoin(G_path, 'log.txt')): - input = pjoin(G_path, 'log.txt') + input = pjoin(G_path, 'log.txt') + if os.path.exists(input): + if self.run_card['keep_log'] not in ["none", "minimal"]: output = pjoin(G_path, '%s_log.txt' % run) - files.mv(input, output) - except Exception: - continue + try: + files.mv(input, output) + except Exception: + continue + elif self.run_card['keep_log'] == "none": + try: + os.remove(input) + except Exception: + continue #try: # # Grid # for name in ['ftn26']: @@ -3989,7 +4108,7 @@ def do_create_gridpack(self, line): misc.call(['./bin/internal/make_gridpack'], cwd=self.me_dir) files.mv(pjoin(self.me_dir, 'gridpack.tar.gz'), pjoin(self.me_dir, '%s_gridpack.tar.gz' % self.run_name)) - os.system("sed -i.bak \"s/\s*.true.*=.*GridRun/ .false. = GridRun/g\" %s/Cards/grid_card.dat" \ + os.system("sed -i.bak \"s/\\s*.true.*=.*GridRun/ .false. = GridRun/g\" %s/Cards/grid_card.dat" \ % self.me_dir) self.update_status('gridpack created', level='gridpack') @@ -4476,7 +4595,7 @@ def do_pythia8(self, line): else: preamble = misc.get_HEPTools_location_setter( pjoin(MG5DIR,'HEPTools'),'lib') - preamble += "\n unset PYTHIA8DATA\n" + #preamble += "\n unset PYTHIA8DATA\n" open(pythia_cmd_card,'w').write("""! ! It is possible to run this card manually with: @@ -4691,7 +4810,7 @@ def do_pythia8(self, line): # Make sure to sure the number of split_events determined during the splitting. split_PY8_Card.systemSet('Main:numberOfEvents',partition_for_PY8[i]) split_PY8_Card.systemSet('HEPMCoutput:scaling',split_PY8_Card['HEPMCoutput:scaling']* - (float(partition_for_PY8[i])/float(n_events))) + (float(partition_for_PY8[i]))) # Add_missing set to False so as to be sure not to add any additional parameter w.r.t # the ones in the original PY8 param_card copied. split_PY8_Card.write(pjoin(parallelization_dir,'PY8Card_%d.dat'%i), @@ -4963,9 +5082,9 @@ def wait_monitoring(Idle, Running, Done): if cross_sections: # Filter the cross_sections specified an keep only the ones # with central parameters and a different merging scale - a_float_re = '[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' + a_float_re = r'[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' central_merging_re = re.compile( - '^\s*Weight_MERGING\s*=\s*(?P%s)\s*$'%a_float_re, + r'^\s*Weight_MERGING\s*=\s*(?P%s)\s*$'%a_float_re, re.IGNORECASE) cross_sections = dict( (float(central_merging_re.match(xsec).group('merging')),value) @@ -5016,8 +5135,8 @@ def wait_monitoring(Idle, Running, Done): def parse_PY8_log_file(self, log_file_path): """ Parse a log file to extract number of event and cross-section. """ - pythiare = re.compile("Les Houches User Process\(es\)\s*\d+\s*\|\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)\s*\|\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") - pythia_xsec_re = re.compile("Inclusive cross section\s*:\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") + pythiare = re.compile(r"Les Houches User Process\(es\)\s*\d+\s*\|\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)\s*\|\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") + pythia_xsec_re = re.compile(r"Inclusive cross section\s*:\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") sigma_m, Nacc, Ntry = None, None, None for line in misc.BackRead(log_file_path): info = pythiare.search(line) @@ -5158,7 +5277,7 @@ def do_pythia(self, line): # read the line from the bottom of the file #pythia_log = misc.BackRead(pjoin(self.me_dir,'Events', self.run_name, # '%s_pythia.log' % tag)) - pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") + pythiare = re.compile(r"\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") for line in misc.reverse_readline(pjoin(self.me_dir,'Events', self.run_name, '%s_pythia.log' % tag)): info = pythiare.search(line) @@ -5619,8 +5738,8 @@ def launch_job(self,exe, cwd=None, stdout=None, argument = [], remaining=0, input_files.append(self.get_pdf_input_filename()) #Find the correct ajob - Gre = re.compile("\s*j=(G[\d\.\w]+)") - origre = re.compile("grid_directory=(G[\d\.\w]+)") + Gre = re.compile(r"\s*j=(G[\d\.\w]+)") + origre = re.compile(r"grid_directory=(G[\d\.\w]+)") try : fsock = open(exe) except Exception: @@ -5628,7 +5747,7 @@ def launch_job(self,exe, cwd=None, stdout=None, argument = [], remaining=0, text = fsock.read() output_files = Gre.findall(text) if not output_files: - Ire = re.compile("for i in ([\d\.\s]*) ; do") + Ire = re.compile(r"for i in ([\d\.\s]*) ; do") data = Ire.findall(text) data = ' '.join(data).split() for nb in data: @@ -6035,7 +6154,7 @@ def get_last_tag(self, level): 'syscalc':[], 'rivet':['rivet']} - if name == self.run_name: + if name and name == self.run_name: if reload_card: run_card = pjoin(self.me_dir, 'Cards','run_card.dat') self.run_card = banner_mod.RunCard(run_card) @@ -6334,7 +6453,7 @@ def run_syscalc(self, mode='parton', event_path=None, output=None): elif mode == 'Pythia': stdout = open(pjoin(event_dir, self.run_name, '%s_%s_syscalc.log' % (tag,mode)),'w') if 'mgpythiacard' in self.banner: - pat = re.compile('''^\s*qcut\s*=\s*([\+\-\d.e]*)''', re.M+re.I) + pat = re.compile(r'''^\s*qcut\s*=\s*([\+\-\d.e]*)''', re.M+re.I) data = pat.search(self.banner['mgpythiacard']) if data: qcut = float(data.group(1)) @@ -6611,7 +6730,7 @@ def get_subP_ids(path): for line in open(pjoin(path, 'leshouche.inc')): if not 'IDUP' in line: continue - particles = re.search("/([\d,-]+)/", line) + particles = re.search(r"/([\d,-]+)/", line) all_ids.append([int(p) for p in particles.group(1).split(',')]) return all_ids @@ -6899,6 +7018,7 @@ def do_combine_events(self, line): partials = 0 # if too many file make some partial unweighting sum_xsec, sum_xerru, sum_axsec = 0,[],0 + partials_info = [] Gdirs = self.get_Gdir() Gdirs.sort() for Gdir in Gdirs: @@ -6917,16 +7037,21 @@ def do_combine_events(self, line): sum_axsec += result.get('axsec')*gscalefact[Gdir] if len(AllEvent) >= 80: #perform a partial unweighting + nb_event = min(abs(1.01*self.nb_event*sum_axsec/self.results.current['cross']),self.run_card['nevents']) AllEvent.unweight(pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), - get_wgt, log_level=5, trunc_error=1e-2, event_target=self.nb_event) + get_wgt, log_level=5, trunc_error=1e-2, event_target=nb_event) AllEvent = lhe_parser.MultiEventFile() AllEvent.banner = self.banner - AllEvent.add(pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), + partials_info.append((pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), - sum_axsec) + sum_axsec) ) + sum_xsec, sum_xerru, sum_axsec = 0,[],0 partials +=1 + for data in partials_info: + AllEvent.add(*data) + if not hasattr(self,'proc_characteristic'): self.proc_characteristic = self.get_characteristics() diff --git a/epochX/cudacpp/gg_tt01g.mad/bin/internal/misc.py b/epochX/cudacpp/gg_tt01g.mad/bin/internal/misc.py index c4c669f36b..e7fd60be0d 100755 --- a/epochX/cudacpp/gg_tt01g.mad/bin/internal/misc.py +++ b/epochX/cudacpp/gg_tt01g.mad/bin/internal/misc.py @@ -67,7 +67,7 @@ def parse_info_str(fsock): """ info_dict = {} - pattern = re.compile("(?P\w*)\s*=\s*(?P.*)", + pattern = re.compile(r"(?P\w*)\s*=\s*(?P.*)", re.IGNORECASE | re.VERBOSE) for entry in fsock: entry = entry.strip() @@ -84,7 +84,7 @@ def parse_info_str(fsock): def glob(name, path=''): """call to glob.glob with automatic security on path""" import glob as glob_module - path = re.sub('(?P\?|\*|\[|\])', '[\g]', path) + path = re.sub(r'(?P\?|\*|\[|\])', r'[\g]', path) return glob_module.glob(pjoin(path, name)) #=============================================================================== @@ -614,10 +614,10 @@ def mod_compilator(directory, new='gfortran', current=None, compiler_type='gfort #search file file_to_change=find_makefile_in_dir(directory) if compiler_type == 'gfortran': - comp_re = re.compile('^(\s*)FC\s*=\s*(.+)\s*$') + comp_re = re.compile(r'^(\s*)FC\s*=\s*(.+)\s*$') var = 'FC' elif compiler_type == 'cpp': - comp_re = re.compile('^(\s*)CXX\s*=\s*(.+)\s*$') + comp_re = re.compile(r'^(\s*)CXX\s*=\s*(.+)\s*$') var = 'CXX' else: MadGraph5Error, 'Unknown compiler type: %s' % compiler_type @@ -861,9 +861,9 @@ def detect_current_compiler(path, compiler_type='fortran'): # comp = re.compile("^\s*FC\s*=\s*(\w+)\s*") # The regular expression below allows for compiler definition with absolute path if compiler_type == 'fortran': - comp = re.compile("^\s*FC\s*=\s*([\w\/\\.\-]+)\s*") + comp = re.compile("^\\s*FC\\s*=\\s*([\\w\\/\\.\\-]+)\\s*") elif compiler_type == 'cpp': - comp = re.compile("^\s*CXX\s*=\s*([\w\/\\.\-]+)\s*") + comp = re.compile("^\\s*CXX\\s*=\\s*([\\w\\/\\.\\-]+)\\s*") else: MadGraph5Error, 'Unknown compiler type: %s' % compiler_type @@ -1001,7 +1001,19 @@ def call_stdout(arg, *args, **opt): def copytree(src, dst, symlinks = False, ignore = None): if not os.path.exists(dst): os.makedirs(dst) - shutil.copystat(src, dst) + try: + shutil.copystat(src, dst) + except PermissionError: + if os.path.realpath(src).startswith('/cvmfs') and os.path.realpath(dst).startswith('/afs'): + # allowing missmatch from cvmfs to afs since sounds to not create issue --at least in general-- + logger.critical(f'Ignoring that we could not copy permissions from {src} to {dst}') + else: + logger.critical(f'Permission error detected from {src} to {dst}.\n'+\ + 'If you are using WSL with windows partition, please try using python3.12\n'+\ + 'or avoid moving your data from the WSL partition to the UNIX one') + # we do not have enough experience in WSL to allow it to get trough. + raise + lst = os.listdir(src) if ignore: excl = ignore(src, lst) @@ -1895,12 +1907,12 @@ class EasterEgg(object): May4_banner = "* _____ *\n" + \ "* ,-~\" \"~-. *\n" + \ "* * ,^ ___ ^. * *\n" + \ - "* * / .^ ^. \ * *\n" + \ + "* * / .^ ^. \\ * *\n" + \ "* * Y l o ! Y * *\n" + \ "* * l_ `.___.' _,[ * *\n" + \ "* * |^~\"--------------~\"\"^| * *\n" + \ "* * ! May the 4th ! * *\n" + \ - "* * \ / * *\n" + \ + "* * \\ / * *\n" + \ "* * ^. .^ * *\n" + \ "* * \"-.._____.,-\" * *\n" @@ -1909,13 +1921,13 @@ class EasterEgg(object): "* M::::::::::M M::::::::::M *\n" + \ "* M:::::::::::M M:::::::::::M (_)___ *\n" + \ "* M:::::::M::::M M::::M:::::::M | / __| *\n" + \ - "* M::::::M M::::M M::::M M::::::M | \__ \ *\n" + \ + "* M::::::M M::::M M::::M M::::::M | \\__ \\ *\n" + \ "* M::::::M M::::M::::M M::::::M |_|___/ *\n" + \ "* M::::::M M:::::::M M::::::M *\n" + \ "* M::::::M M:::::M M::::::M / _| ___ _ __ *\n" + \ - "* M::::::M MMMMM M::::::M | |_ / _ \| '__| *\n" + \ + "* M::::::M MMMMM M::::::M | |_ / _ \\| '__| *\n" + \ "* M::::::M M::::::M | _| (_) | | *\n" + \ - "* M::::::M M::::::M |_/\/\___/|_| *\n" + \ + "* M::::::M M::::::M |_/\\/\\___/|_| *\n" + \ "* M::::::M M::::::M *\n" + \ "* MMMMMMMM MMMMMMMM *\n" + \ "* *\n" + \ @@ -2233,39 +2245,51 @@ def import_python_lhapdf(lhapdfconfig): os.environ['LD_LIBRARY_PATH'] = lhapdf_libdir else: os.environ['LD_LIBRARY_PATH'] = '%s:%s' %(lhapdf_libdir,os.environ['LD_LIBRARY_PATH']) - try: candidates=[dirname for dirname in os.listdir(lhapdf_libdir) \ if os.path.isdir(os.path.join(lhapdf_libdir,dirname))] except OSError: candidates=[] + if os.path.isdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')): + candidates += [pjoin(os.pardir,'local', 'lib', dirname) for dirname in os.listdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')) + if os.path.isdir(os.path.join(lhapdf_libdir,os.pardir, 'local', 'lib', dirname))] for candidate in candidates: - if os.path.isdir(os.path.join(lhapdf_libdir,candidate,'site-packages')): - sys.path.insert(0,os.path.join(lhapdf_libdir,candidate,'site-packages')) - try: - import lhapdf - use_lhapdf=True - break - except ImportError: - sys.path.pop(0) - continue + for subdir in ['site-packages', 'dist-packages']: + if os.path.isdir(os.path.join(lhapdf_libdir,candidate, subdir)): + sys.path.insert(0,os.path.join(lhapdf_libdir,candidate, subdir)) + try: + import lhapdf + use_lhapdf=True + break + except ImportError as error: + sys.path.pop(0) + continue + else: + continue + break if not use_lhapdf: try: candidates=[dirname for dirname in os.listdir(lhapdf_libdir+'64') \ if os.path.isdir(os.path.join(lhapdf_libdir+'64',dirname))] except OSError: candidates=[] - + if os.path.isdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib64')): + candidates += [pjoin(os.pardir,'local', 'lib64', dirname) for dirname in os.listdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')) + if os.path.isdir(os.path.join(lhapdf_libdir,os.pardir, 'local', 'lib64', dirname))] for candidate in candidates: - if os.path.isdir(os.path.join(lhapdf_libdir+'64',candidate,'site-packages')): - sys.path.insert(0,os.path.join(lhapdf_libdir+'64',candidate,'site-packages')) - try: - import lhapdf - use_lhapdf=True - break - except ImportError: - sys.path.pop(0) - continue + for subdir in ['site-packages', 'dist-packages']: + if os.path.isdir(os.path.join(lhapdf_libdir+'64',candidate, subdir)): + sys.path.insert(0,os.path.join(lhapdf_libdir+'64',candidate, subdir)) + try: + import lhapdf + use_lhapdf=True + break + except ImportError as error: + sys.path.pop(0) + continue + else: + continue + break if not use_lhapdf: try: import lhapdf diff --git a/epochX/cudacpp/gg_tt01g.mad/bin/internal/shower_card.py b/epochX/cudacpp/gg_tt01g.mad/bin/internal/shower_card.py index e87d534177..16ed72b1a0 100755 --- a/epochX/cudacpp/gg_tt01g.mad/bin/internal/shower_card.py +++ b/epochX/cudacpp/gg_tt01g.mad/bin/internal/shower_card.py @@ -288,7 +288,7 @@ def write(self, output_file, template=None, python_template=False, self.text = open(template,'r').read() - key_re = re.compile('^(\s*)([\S^#]+)(\s*)=(\s*)([^#]*?)(\s*)(\#.*|$)') + key_re = re.compile(r'^(\s*)([\S^#]+)(\s*)=(\s*)([^#]*?)(\s*)(\#.*|$)') newlines = [] for line in self.text.split('\n'): key_match = key_re.findall(line) diff --git a/epochX/cudacpp/gg_tt01g.mad/bin/internal/systematics.py b/epochX/cudacpp/gg_tt01g.mad/bin/internal/systematics.py index 28eaed00e2..2acebd087c 100644 --- a/epochX/cudacpp/gg_tt01g.mad/bin/internal/systematics.py +++ b/epochX/cudacpp/gg_tt01g.mad/bin/internal/systematics.py @@ -582,7 +582,7 @@ def print_cross_sections(self, all_cross, nb_event, stdout): else: resume.write( '#PDF %s: %g +%2.3g%% -%2.3g%%\n' % (pdfset.name, pdferr.central,pdferr.errplus*100/all_cross[0], pdferr.errminus*100/all_cross[0])) - dyn_name = {1: '\sum ET', 2:'\sum\sqrt{m^2+pt^2}', 3:'0.5 \sum\sqrt{m^2+pt^2}',4:'\sqrt{\hat s}' } + dyn_name = {1: r'\sum ET', 2:r'\sum\sqrt{m^2+pt^2}', 3:r'0.5 \sum\sqrt{m^2+pt^2}',4:r'\sqrt{\hat s}' } for key, curr in dyns.items(): if key ==-1: continue @@ -789,7 +789,7 @@ def get_id(self): return int(self.start_wgt_id) if 'initrwgt' in self.banner: - pattern = re.compile(' set lhapdf /PATH/TO/lhapdf-config -None does not seem to correspond to a valid lhapdf-config executable. -Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config). -Note that you can still compile and run aMC@NLO with the built-in PDFs - MG5_aMC> set lhapdf /PATH/TO/lhapdf-config - Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt -import /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg.mg +import /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg.mg The import format was not given, so we guess it as command set stdout_level DEBUG set output information to level: 10 @@ -62,7 +57,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.005491018295288086  +DEBUG: model prefixing takes 0.00537419319152832  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,24 +150,24 @@ 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.023 s +1 processes with 16 diagrams generated in 0.022 s Total: 1 processes with 16 diagrams output madevent_simd ../TMPOUT/CODEGEN_mad_gg_ttg --hel_recycling=False --vector_size=32 Load PLUGIN.CUDACPP_OUTPUT -Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.5.3_lo_vect. +Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.6.0_lo_vect. It has been validated for the last time with version: 3.5.2 Output will be done with PLUGIN: CUDACPP_OUTPUT Addition matrix-element will be done with PLUGIN: CUDACPP_OUTPUT +DEBUG: opt['output_options']['vector_size'] =  32 [export_v4.py at line 4334]  Output will be done with PLUGIN: CUDACPP_OUTPUT -DEBUG: cformat =  standalone_simd [export_cpp.py at line 3070]  DEBUG: Entering PLUGIN_ProcessExporter.__init__ (initialise the exporter) [output.py at line 165]  INFO: initialize a new directory: CODEGEN_mad_gg_ttg INFO: remove old information in CODEGEN_mad_gg_ttg DEBUG: Entering PLUGIN_ProcessExporter.copy_template (initialise the directory) [output.py at line 170]  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg  -INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/Cards  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/SubProcesses  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg  +INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/Cards  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/SubProcesses  INFO: Organizing processes into subprocess groups INFO: Generating Helas calls for process: g g > t t~ g WEIGHTED<=3 @1 INFO: Processing color information for process: g g > t t~ g @1 @@ -182,32 +177,28 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0] [export_cpp.py at line 711]  -DEBUG: subproc_number =  0 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: g g > t t~ g WEIGHTED<=3 @1 INFO: Finding symmetric diagrams for subprocess group gg_ttxg -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/SubProcesses/P1_gg_ttxg [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  15 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15} [model_handling.py at line 1548]  -Generated helas calls for 1 subprocesses (16 diagrams) in 0.040 s -Wrote files for 36 helas calls in 0.138 s +Generated helas calls for 1 subprocesses (16 diagrams) in 0.038 s +Wrote files for 36 helas calls in 0.122 s +DEBUG: self.vector_size =  32 [export_v4.py at line 7023]  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.333 s +ALOHA: aloha creates 5 routines in 0.334 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 10 routines in 0.317 s +ALOHA: aloha creates 10 routines in 0.320 s VVV1 VVV1 FFV1 @@ -217,39 +208,41 @@ ALOHA: aloha creates 10 routines in 0.317 s VVVV1 VVVV3 VVVV4 -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/src/./HelAmps_sm.h -INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/src/. +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/src/./HelAmps_sm.h +INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/src/. super_write_set_parameters_onlyfixMajorana (hardcoded=False) super_write_set_parameters_onlyfixMajorana (hardcoded=True) -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/src/./Parameters_sm.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/src/./Parameters_sm.cc +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/src/./Parameters_sm.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/src/./Parameters_sm.cc INFO: Created files Parameters_sm.h and Parameters_sm.cc in directory -INFO: /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/src/. and /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/src/. +INFO: /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/src/. and /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/src/. The option zerowidth_tchannel is modified [True] but will not be written in the configuration files. If you want to make this value the default for future session, you can run 'save options --all' -save configuration file to /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/Cards/me5_configuration.txt +save configuration file to /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/Cards/me5_configuration.txt INFO: Use Fortran compiler gfortran INFO: Use c++ compiler g++ INFO: Generate jpeg diagrams INFO: Generate web pages -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common -patching file Source/genps.inc +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common patching file SubProcesses/makefile -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/SubProcesses/P1_gg_ttxg; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/SubProcesses/P1_gg_ttxg; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #2 succeeded at 249 (offset 16 lines). +Hunk #2 succeeded at 243 (offset 29 lines). DEBUG: p.returncode =  0 [output.py at line 258]  -Output to directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg done. +Output to directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg done. Type "launch" to generate events from this process, or see -/data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/README +/data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/README Run "open index.html" to see more information about this process. quit -real 0m3.227s -user 0m2.210s -sys 0m0.272s -Code generation completed in 3 seconds +real 0m2.478s +user 0m2.208s +sys 0m0.251s +Code generation completed in 2 seconds ************************************************************ * * * W E L C O M E to * @@ -262,7 +255,7 @@ Code generation completed in 3 seconds * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect * +* VERSION 3.6.0_lo_vect * * * * The MadGraph5_aMC@NLO Development Team - Find us at * * https://server06.fynu.ucl.ac.be/projects/madgraph * @@ -270,9 +263,9 @@ Code generation completed in 3 seconds * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt @@ -292,7 +285,7 @@ launch in debug mode * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect * +* VERSION 3.6.0_lo_vect * * * * The MadGraph5_aMC@NLO Development Team - Find us at * * https://server06.fynu.ucl.ac.be/projects/madgraph * @@ -300,9 +293,9 @@ launch in debug mode * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttg/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt diff --git a/epochX/cudacpp/gg_ttg.mad/Cards/me5_configuration.txt b/epochX/cudacpp/gg_ttg.mad/Cards/me5_configuration.txt index cdeedc7863..4f5079f78a 100644 --- a/epochX/cudacpp/gg_ttg.mad/Cards/me5_configuration.txt +++ b/epochX/cudacpp/gg_ttg.mad/Cards/me5_configuration.txt @@ -116,6 +116,7 @@ # cluster_type = condor # cluster_queue = madgraph # cluster_size = 150 +# cluster_walltime = # time in minute for slurm and second for condor (not supported for other scheduller) #! Path to a node directory to avoid direct writing on the central disk #! Note that condor clusters avoid direct writing by default (therefore this @@ -234,7 +235,7 @@ # pineappl = pineappl -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo # MG5 MAIN DIRECTORY -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo diff --git a/epochX/cudacpp/gg_ttg.mad/Cards/param_card.dat b/epochX/cudacpp/gg_ttg.mad/Cards/param_card.dat index caf4a67ea8..bb150ef10d 100644 --- a/epochX/cudacpp/gg_ttg.mad/Cards/param_card.dat +++ b/epochX/cudacpp/gg_ttg.mad/Cards/param_card.dat @@ -1,5 +1,5 @@ ###################################################################### -## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL #### +## PARAM_CARD AUTOMATICALLY GENERATED BY MG5 FOLLOWING UFO MODEL #### ###################################################################### ## ## ## Width set on Auto will be computed following the information ## diff --git a/epochX/cudacpp/gg_ttg.mad/Cards/param_card_default.dat b/epochX/cudacpp/gg_ttg.mad/Cards/param_card_default.dat index caf4a67ea8..bb150ef10d 100644 --- a/epochX/cudacpp/gg_ttg.mad/Cards/param_card_default.dat +++ b/epochX/cudacpp/gg_ttg.mad/Cards/param_card_default.dat @@ -1,5 +1,5 @@ ###################################################################### -## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL #### +## PARAM_CARD AUTOMATICALLY GENERATED BY MG5 FOLLOWING UFO MODEL #### ###################################################################### ## ## ## Width set on Auto will be computed following the information ## diff --git a/epochX/cudacpp/gg_ttg.mad/Cards/proc_card_mg5.dat b/epochX/cudacpp/gg_ttg.mad/Cards/proc_card_mg5.dat index 72d7a0efd4..b78bb56b1e 100644 --- a/epochX/cudacpp/gg_ttg.mad/Cards/proc_card_mg5.dat +++ b/epochX/cudacpp/gg_ttg.mad/Cards/proc_card_mg5.dat @@ -8,7 +8,7 @@ #* * * * #* * #* * -#* VERSION 3.5.3_lo_vect 2023-12-23 * +#* VERSION 3.6.0_lo_vect 2024-06-17 * #* * #* WARNING: UNKNOWN DEVELOPMENT VERSION. * #* WARNING: DO NOT USE FOR PRODUCTION * diff --git a/epochX/cudacpp/gg_ttg.mad/Cards/reweight_card_default.dat b/epochX/cudacpp/gg_ttg.mad/Cards/reweight_card_default.dat index ace534ae02..5cc65fe095 100644 --- a/epochX/cudacpp/gg_ttg.mad/Cards/reweight_card_default.dat +++ b/epochX/cudacpp/gg_ttg.mad/Cards/reweight_card_default.dat @@ -19,8 +19,16 @@ change mode NLO # Define type of Reweighting. For LO sample this command # has no effect since only "LO" mode is allowed. + +#uncomment if you do not want to overwrite the reweight file of Sudakov in rw_me +#change rwgt_dir /PATH_MG5_BRANCH/NAME_FOLDER + +#uncomment if you want to use Sudakov Reweight +#change include_sudakov True + launch + # SPECIFY A PATH OR USE THE SET COMMAND LIKE THIS: # set sminputs 1 130 # modify 1/alpha_EW diff --git a/epochX/cudacpp/gg_ttg.mad/Cards/run_card.dat b/epochX/cudacpp/gg_ttg.mad/Cards/run_card.dat index c545f67660..d087670827 100644 --- a/epochX/cudacpp/gg_ttg.mad/Cards/run_card.dat +++ b/epochX/cudacpp/gg_ttg.mad/Cards/run_card.dat @@ -160,6 +160,7 @@ systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++] ['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule + #*********************************************************************** # SIMD/GPU configuration for the CUDACPP plugin #************************************************************************ diff --git a/epochX/cudacpp/gg_ttg.mad/Cards/run_card_default.dat b/epochX/cudacpp/gg_ttg.mad/Cards/run_card_default.dat index 06d9e5c206..7f66363ba0 100644 --- a/epochX/cudacpp/gg_ttg.mad/Cards/run_card_default.dat +++ b/epochX/cudacpp/gg_ttg.mad/Cards/run_card_default.dat @@ -160,6 +160,7 @@ systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++] ['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule + #*********************************************************************** # SIMD/GPU configuration for the CUDACPP plugin #************************************************************************ diff --git a/epochX/cudacpp/gg_ttg.mad/MGMEVersion.txt b/epochX/cudacpp/gg_ttg.mad/MGMEVersion.txt index 9d3a5c0ba0..a806d3938c 100644 --- a/epochX/cudacpp/gg_ttg.mad/MGMEVersion.txt +++ b/epochX/cudacpp/gg_ttg.mad/MGMEVersion.txt @@ -1 +1 @@ -3.5.3_lo_vect \ No newline at end of file +3.6.0_lo_vect \ No newline at end of file diff --git a/epochX/cudacpp/gg_ttg.mad/Source/DHELAS/aloha_functions.f b/epochX/cudacpp/gg_ttg.mad/Source/DHELAS/aloha_functions.f index 975725737f..47699fa614 100644 --- a/epochX/cudacpp/gg_ttg.mad/Source/DHELAS/aloha_functions.f +++ b/epochX/cudacpp/gg_ttg.mad/Source/DHELAS/aloha_functions.f @@ -351,7 +351,7 @@ subroutine oxxxxx(p,fmass,nhel,nsf , fo) fo(6) = ip * sqm(abs(im)) else - pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2)) +c pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2)) sf(1) = dble(1+nsf+(1-nsf)*nh)*rHalf sf(2) = dble(1+nsf-(1-nsf)*nh)*rHalf omega(1) = dsqrt(p(0)+pp) @@ -2054,7 +2054,7 @@ subroutine CombineAmp(nb, ihels, iwfcts, W1, Wall, Amp) enddo return end - + subroutine CombineAmpS(nb, ihels, iwfcts, W1, Wall, Amp) integer nb ! size of the vectors diff --git a/epochX/cudacpp/gg_ttg.mad/Source/MODEL/couplings.f b/epochX/cudacpp/gg_ttg.mad/Source/MODEL/couplings.f index f3b620ab58..04d6bb5333 100644 --- a/epochX/cudacpp/gg_ttg.mad/Source/MODEL/couplings.f +++ b/epochX/cudacpp/gg_ttg.mad/Source/MODEL/couplings.f @@ -10,18 +10,27 @@ SUBROUTINE COUP() PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + LOGICAL UPDATELOOP COMMON /TO_UPDATELOOP/UPDATELOOP INCLUDE 'input.inc' - INCLUDE '../vector.inc' + + INCLUDE 'coupl.inc' READLHA = .TRUE. INCLUDE 'intparam_definition.inc' CALL COUP1() + IF (UPDATELOOP) THEN + + CALL COUP2() + + ENDIF + C couplings needed to be evaluated points by points C - CALL COUP2(1) + CALL COUP3(1) RETURN END @@ -47,7 +56,11 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) INCLUDE '../maxparticles.inc' INCLUDE '../cuts.inc' + + INCLUDE '../vector.inc' + + INCLUDE '../run.inc' DOUBLE PRECISION ALPHAS @@ -65,7 +78,7 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) couplings needed to be evaluated points by points C ALL_G(VECID) = G - CALL COUP2(VECID) + CALL COUP3(VECID) RETURN END @@ -80,7 +93,9 @@ SUBROUTINE UPDATE_AS_PARAM2(MU_R2,AS2 ,VECID) INTEGER VECID INCLUDE 'model_functions.inc' INCLUDE 'input.inc' + INCLUDE '../vector.inc' + INCLUDE 'coupl.inc' DOUBLE PRECISION MODEL_SCALE COMMON /MODEL_SCALE/MODEL_SCALE diff --git a/epochX/cudacpp/gg_ttg.mad/Source/MODEL/couplings1.f b/epochX/cudacpp/gg_ttg.mad/Source/MODEL/couplings1.f index e14f3a1770..72cfa0f6e4 100644 --- a/epochX/cudacpp/gg_ttg.mad/Source/MODEL/couplings1.f +++ b/epochX/cudacpp/gg_ttg.mad/Source/MODEL/couplings1.f @@ -7,11 +7,12 @@ SUBROUTINE COUP1( ) IMPLICIT NONE INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' END diff --git a/epochX/cudacpp/gg_ttg.mad/Source/MODEL/couplings2.f b/epochX/cudacpp/gg_ttg.mad/Source/MODEL/couplings2.f index e638b28035..30f3a04e3b 100644 --- a/epochX/cudacpp/gg_ttg.mad/Source/MODEL/couplings2.f +++ b/epochX/cudacpp/gg_ttg.mad/Source/MODEL/couplings2.f @@ -2,19 +2,17 @@ c written by the UFO converter ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc - SUBROUTINE COUP2( VECID) + SUBROUTINE COUP2( ) IMPLICIT NONE - INTEGER VECID + INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' - GC_10(VECID) = -G - GC_11(VECID) = MDL_COMPLEXI*G - GC_12(VECID) = MDL_COMPLEXI*MDL_G__EXP__2 END diff --git a/epochX/cudacpp/gg_ttg.mad/Source/MODEL/couplings3.f b/epochX/cudacpp/gg_ttg.mad/Source/MODEL/couplings3.f index f537dd3764..ad696f2865 100644 --- a/epochX/cudacpp/gg_ttg.mad/Source/MODEL/couplings3.f +++ b/epochX/cudacpp/gg_ttg.mad/Source/MODEL/couplings3.f @@ -7,12 +7,13 @@ SUBROUTINE COUP3( VECID) IMPLICIT NONE INTEGER VECID INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' GC_10(VECID) = -G GC_11(VECID) = MDL_COMPLEXI*G diff --git a/epochX/cudacpp/gg_ttg.mad/Source/MODEL/makefile b/epochX/cudacpp/gg_ttg.mad/Source/MODEL/makefile index 0b24445a53..5a5681d220 100644 --- a/epochX/cudacpp/gg_ttg.mad/Source/MODEL/makefile +++ b/epochX/cudacpp/gg_ttg.mad/Source/MODEL/makefile @@ -3,7 +3,7 @@ # Makefile for model library # # ---------------------------------------------------------------------------- - +# template models/template_files/makefile_madevent # Check for ../make_opts ifeq ($(wildcard ../make_opts), ../make_opts) include ../make_opts diff --git a/epochX/cudacpp/gg_ttg.mad/Source/MODEL/makeinc.inc b/epochX/cudacpp/gg_ttg.mad/Source/MODEL/makeinc.inc index 6e2743eac1..4a9e1b2cc5 100644 --- a/epochX/cudacpp/gg_ttg.mad/Source/MODEL/makeinc.inc +++ b/epochX/cudacpp/gg_ttg.mad/Source/MODEL/makeinc.inc @@ -2,4 +2,4 @@ # written by the UFO converter ############################################################################# -MODEL = couplings.o lha_read.o printout.o rw_para.o model_functions.o couplings1.o couplings2.o \ No newline at end of file +MODEL = couplings.o lha_read.o printout.o rw_para.o model_functions.o couplings1.o couplings2.o couplings3.o \ No newline at end of file diff --git a/epochX/cudacpp/gg_ttg.mad/Source/MODEL/printout.f b/epochX/cudacpp/gg_ttg.mad/Source/MODEL/printout.f index 18b8f35b08..3e195b03a2 100644 --- a/epochX/cudacpp/gg_ttg.mad/Source/MODEL/printout.f +++ b/epochX/cudacpp/gg_ttg.mad/Source/MODEL/printout.f @@ -1,3 +1,7 @@ +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +c written by the UFO converter +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc + c************************************************************************ c** ** c** MadGraph/MadEvent Interface to FeynRules ** @@ -9,7 +13,7 @@ subroutine printout implicit none - include '../vector.inc' ! defines VECSIZE_MEMMAX + include '../vector.inc' ! VECSIZE_MEMMAX (needed by coupl.inc) include 'coupl.inc' ! needs VECSIZE_MEMMAX (defined in vector.inc) include 'input.inc' diff --git a/epochX/cudacpp/gg_ttg.mad/Source/PDF/eepdf.inc b/epochX/cudacpp/gg_ttg.mad/Source/PDF/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/gg_ttg.mad/Source/PDF/eepdf.inc +++ b/epochX/cudacpp/gg_ttg.mad/Source/PDF/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/gg_ttg.mad/Source/PDF/pdfwrap_emela.f b/epochX/cudacpp/gg_ttg.mad/Source/PDF/pdfwrap_emela.f index bce10819d5..da1e4e2276 100644 --- a/epochX/cudacpp/gg_ttg.mad/Source/PDF/pdfwrap_emela.f +++ b/epochX/cudacpp/gg_ttg.mad/Source/PDF/pdfwrap_emela.f @@ -13,7 +13,7 @@ SUBROUTINE PDFWRAP DOUBLE PRECISION VALUE(20) REAL*8 ALPHASPDF EXTERNAL ALPHASPDF - ! PDFs with beamstrahlung use specific initialisation/evaluation +C PDFs with beamstrahlung use specific initialisation/evaluation LOGICAL HAS_BSTRAHL COMMON /TO_HAS_BS/ HAS_BSTRAHL diff --git a/epochX/cudacpp/gg_ttg.mad/Source/PDF/pdg2pdf.f b/epochX/cudacpp/gg_ttg.mad/Source/PDF/pdg2pdf.f index 46f321e66b..2e7343a69b 100644 --- a/epochX/cudacpp/gg_ttg.mad/Source/PDF/pdg2pdf.f +++ b/epochX/cudacpp/gg_ttg.mad/Source/PDF/pdg2pdf.f @@ -108,7 +108,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) else if (abs(ipart).eq.10) then ipart = sign(1,ipart) * 15 endif - pdg2pdf = 0d0 + pdg2pdf = 0d0 if (beamid.lt.0) then ih_local = ipart @@ -122,7 +122,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) endif do i_ee = 1, n_ee ee_components(i_ee) = compute_eepdf(x,omx_ee(iabs(beamid)),xmu,i_ee,ipart,ih_local) - enddo + enddo pdg2pdf = ee_components(1) ! temporary to test pdf load c write(*,*), x, beamid ,omx_ee(iabs(beamid)),xmu,1,ipart,ih_local,pdg2pdf return diff --git a/epochX/cudacpp/gg_ttg.mad/Source/dsample.f b/epochX/cudacpp/gg_ttg.mad/Source/dsample.f index 09d482b45a..b0bc0547ad 100644 --- a/epochX/cudacpp/gg_ttg.mad/Source/dsample.f +++ b/epochX/cudacpp/gg_ttg.mad/Source/dsample.f @@ -204,6 +204,9 @@ subroutine sample_full(ndim,ncall,itmax,itmin,dsig,ninvar,nconfigs,VECSIZE_USED) if (VECSIZE_USED.le.1) then all_fx(1) = dsig(all_p, all_wgt,0) + ivec=0 + ilock=0 + iwarp=1 else c Here "i" is the position in the full grid of the event do i=(iwarp-1)*WARP_SIZE+1, iwarp*warp_size diff --git a/epochX/cudacpp/gg_ttg.mad/Source/eepdf.inc b/epochX/cudacpp/gg_ttg.mad/Source/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/gg_ttg.mad/Source/eepdf.inc +++ b/epochX/cudacpp/gg_ttg.mad/Source/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/gg_ttg.mad/Source/genps.inc b/epochX/cudacpp/gg_ttg.mad/Source/genps.inc index af7e0efbce..ef78e7e812 100644 --- a/epochX/cudacpp/gg_ttg.mad/Source/genps.inc +++ b/epochX/cudacpp/gg_ttg.mad/Source/genps.inc @@ -29,9 +29,8 @@ c parameter (max_host=99,maxplace=199,maxpoints=100,maxans=50) c************************************************************************* c Parameters for helicity sums in matrixN.f c************************************************************************* - REAL*8 LIMHEL -c PARAMETER(LIMHEL=1e-8) ! ME threshold for helicity filtering (Fortran default) - PARAMETER(LIMHEL=0) ! ME threshold for helicity filtering (force Fortran to mimic cudacpp, see #419) +c REAL*8 LIMHEL +c PARAMETER(LIMHEL=1e-8) -> pass in the run_card.dat INTEGER MAXTRIES PARAMETER(MAXTRIES=25) C To pass the helicity configuration chosen by the DiscreteSampler to diff --git a/epochX/cudacpp/gg_ttg.mad/Source/run.inc b/epochX/cudacpp/gg_ttg.mad/Source/run.inc index 5433a23583..81c8df6bf2 100644 --- a/epochX/cudacpp/gg_ttg.mad/Source/run.inc +++ b/epochX/cudacpp/gg_ttg.mad/Source/run.inc @@ -106,4 +106,7 @@ c double precision tmin_for_channel integer sde_strat ! 1 means standard single diagram enhancement strategy, c 2 means approximation by the denominator of the propagator - common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat \ No newline at end of file + common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat +c + double precision limhel + common/to_limhel/limhel diff --git a/epochX/cudacpp/gg_ttg.mad/Source/run_card.inc b/epochX/cudacpp/gg_ttg.mad/Source/run_card.inc index 67af0f2051..1a1bc782bd 100644 --- a/epochX/cudacpp/gg_ttg.mad/Source/run_card.inc +++ b/epochX/cudacpp/gg_ttg.mad/Source/run_card.inc @@ -88,6 +88,8 @@ DSQRT_SHAT = 0.000000000000000D+00 + LIMHEL = 0.000000000000000D+00 + PTJ = 2.000000000000000D+01 PTB = 0.000000000000000D+00 diff --git a/epochX/cudacpp/gg_ttg.mad/Source/setrun.f b/epochX/cudacpp/gg_ttg.mad/Source/setrun.f index 9e9ef7fdbd..dc6caef748 100644 --- a/epochX/cudacpp/gg_ttg.mad/Source/setrun.f +++ b/epochX/cudacpp/gg_ttg.mad/Source/setrun.f @@ -162,9 +162,21 @@ subroutine setrun C Fill common block for Les Houches init info do i=1,2 if(lpp(i).eq.1.or.lpp(i).eq.2) then - idbmup(i)=2212 + if (nb_proton(i).eq.1.and.nb_neutron(i).eq.0) then + idbmup(i)=2212 + elseif (nb_proton(i).eq.0.and.nb_neutron(i).eq.1) then + idbmup(i)=2112 + else + idbmup(i) = 1000000000 + (nb_proton(i)+nb_neutron(i))*10 + $ + nb_proton(i)*10000 + endif elseif(lpp(i).eq.-1.or.lpp(i).eq.-2) then - idbmup(i)=-2212 + if (nb_proton(i).eq.1.and.nb_neutron(i).eq.0) then + idbmup(i)=-2212 + else + idbmup(i) = -1*(1000000000 + (nb_proton(i)+nb_neutron(i))*10 + $ + nb_proton(i)*10000) + endif elseif(lpp(i).eq.3) then idbmup(i)=11 elseif(lpp(i).eq.-3) then diff --git a/epochX/cudacpp/gg_ttg.mad/SubProcesses/MGVersion.txt b/epochX/cudacpp/gg_ttg.mad/SubProcesses/MGVersion.txt index 9d3a5c0ba0..a806d3938c 100644 --- a/epochX/cudacpp/gg_ttg.mad/SubProcesses/MGVersion.txt +++ b/epochX/cudacpp/gg_ttg.mad/SubProcesses/MGVersion.txt @@ -1 +1 @@ -3.5.3_lo_vect \ No newline at end of file +3.6.0_lo_vect \ No newline at end of file diff --git a/epochX/cudacpp/gg_ttg.mad/SubProcesses/P1_gg_ttxg/CPPProcess.cc b/epochX/cudacpp/gg_ttg.mad/SubProcesses/P1_gg_ttxg/CPPProcess.cc index 6a72bd0004..c117c80635 100644 --- a/epochX/cudacpp/gg_ttg.mad/SubProcesses/P1_gg_ttxg/CPPProcess.cc +++ b/epochX/cudacpp/gg_ttg.mad/SubProcesses/P1_gg_ttxg/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/gg_ttg.mad/SubProcesses/P1_gg_ttxg/CPPProcess.h b/epochX/cudacpp/gg_ttg.mad/SubProcesses/P1_gg_ttxg/CPPProcess.h index 4cf0de0da5..1336561d98 100644 --- a/epochX/cudacpp/gg_ttg.mad/SubProcesses/P1_gg_ttxg/CPPProcess.h +++ b/epochX/cudacpp/gg_ttg.mad/SubProcesses/P1_gg_ttxg/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/gg_ttg.mad/SubProcesses/P1_gg_ttxg/auto_dsig.f b/epochX/cudacpp/gg_ttg.mad/SubProcesses/P1_gg_ttxg/auto_dsig.f index e443f9d74a..18102513a2 100644 --- a/epochX/cudacpp/gg_ttg.mad/SubProcesses/P1_gg_ttxg/auto_dsig.f +++ b/epochX/cudacpp/gg_ttg.mad/SubProcesses/P1_gg_ttxg/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1134,11 +1134,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=32) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1148,32 +1149,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=32) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=32) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/gg_ttg.mad/SubProcesses/P1_gg_ttxg/auto_dsig1.f b/epochX/cudacpp/gg_ttg.mad/SubProcesses/P1_gg_ttxg/auto_dsig1.f index c9392f3f6a..feae52d0d1 100644 --- a/epochX/cudacpp/gg_ttg.mad/SubProcesses/P1_gg_ttxg/auto_dsig1.f +++ b/epochX/cudacpp/gg_ttg.mad/SubProcesses/P1_gg_ttxg/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -101,6 +101,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -217,7 +219,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -281,7 +283,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -320,9 +322,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -338,6 +341,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -485,11 +490,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -589,9 +589,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -720,3 +722,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/gg_ttg.mad/SubProcesses/P1_gg_ttxg/driver.f b/epochX/cudacpp/gg_ttg.mad/SubProcesses/P1_gg_ttxg/driver.f index c45686a3b2..c2eadb2c31 100644 --- a/epochX/cudacpp/gg_ttg.mad/SubProcesses/P1_gg_ttxg/driver.f +++ b/epochX/cudacpp/gg_ttg.mad/SubProcesses/P1_gg_ttxg/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/gg_ttg.mad/SubProcesses/P1_gg_ttxg/matrix1.f b/epochX/cudacpp/gg_ttg.mad/SubProcesses/P1_gg_ttxg/matrix1.f index a8c7e012bf..80c1d61cc8 100644 --- a/epochX/cudacpp/gg_ttg.mad/SubProcesses/P1_gg_ttxg/matrix1.f +++ b/epochX/cudacpp/gg_ttg.mad/SubProcesses/P1_gg_ttxg/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -23,6 +23,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=32) INTEGER NGRAPHS @@ -46,8 +48,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -56,26 +58,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -86,7 +85,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -96,26 +94,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,5) /-1,-1,-1, 1,-1/ DATA (NHEL(I, 2),I=1,5) /-1,-1,-1, 1, 1/ DATA (NHEL(I, 3),I=1,5) /-1,-1,-1,-1,-1/ @@ -159,8 +156,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -169,11 +165,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=6 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=6 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -183,12 +179,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -200,7 +195,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -229,35 +225,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -329,7 +323,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/gg_ttg.mad/SubProcesses/cluster.f b/epochX/cudacpp/gg_ttg.mad/SubProcesses/cluster.f index 649e46f4e9..b8995283ed 100644 --- a/epochX/cudacpp/gg_ttg.mad/SubProcesses/cluster.f +++ b/epochX/cudacpp/gg_ttg.mad/SubProcesses/cluster.f @@ -552,6 +552,8 @@ logical function cluster(p, ivec) if (btest(mlevel,1)) $ write (*,*)'New event' + iwin = 0 + jwin = 0 cluster=.false. clustered=.false. do i=0,3 @@ -663,7 +665,8 @@ logical function cluster(p, ivec) c initialize graph storage igraphs(0)=0 nleft=nexternal -c cluster +c cluster + if (iwin.eq.0.or.jwin.eq.0) stop 21 do n=1,nexternal-2 c combine winner imocl(n)=imap(iwin,2)+imap(jwin,2) diff --git a/epochX/cudacpp/gg_ttg.mad/SubProcesses/proc_characteristics b/epochX/cudacpp/gg_ttg.mad/SubProcesses/proc_characteristics index 119c7424dc..c11ed5a292 100644 --- a/epochX/cudacpp/gg_ttg.mad/SubProcesses/proc_characteristics +++ b/epochX/cudacpp/gg_ttg.mad/SubProcesses/proc_characteristics @@ -17,6 +17,8 @@ splitting_types = [] perturbation_order = [] limitations = [] + ew_sudakov = False hel_recycling = False single_color = True nlo_mixed_expansion = True + gauge = unitary diff --git a/epochX/cudacpp/gg_ttg.mad/SubProcesses/refine.sh b/epochX/cudacpp/gg_ttg.mad/SubProcesses/refine.sh index afb9b99ad1..b46170ba23 100644 --- a/epochX/cudacpp/gg_ttg.mad/SubProcesses/refine.sh +++ b/epochX/cudacpp/gg_ttg.mad/SubProcesses/refine.sh @@ -57,7 +57,11 @@ j=%(directory)s for((try=1;try<=16;try+=1)); do if [ "$keeplog" = true ] ; then + if [[ -e ../madevent ]];then ../madevent 2>&1 >> $k &1 >> $k &1 >> log.txt &1 >> log.txt &1 >> $k \w*)>') - pat_end=re.compile('\w*)>') + pat_begin=re.compile(r'<(?P\w*)>') + pat_end=re.compile(r'\w*)>') tag_to_file={'slha':'param_card.dat', 'mgruncard':'run_card.dat', @@ -319,7 +319,7 @@ def check_pid(self, pid2label): def get_lha_strategy(self): """get the lha_strategy: how the weight have to be handle by the shower""" - if not self["init"]: + if "init" not in self or not self["init"]: raise Exception("No init block define") data = self["init"].split('\n')[0].split() @@ -537,7 +537,8 @@ def charge_card(self, tag): self.param_card = param_card_reader.ParamCard(param_card) return self.param_card elif tag == 'mgruncard': - self.run_card = RunCard(self[tag], unknown_warning=False) + with misc.TMP_variable(RunCard, 'allow_scan', True): + self.run_card = RunCard(self[tag], consistency=False, unknow_warning=False) return self.run_card elif tag == 'mg5proccard': proc_card = self[tag].split('\n') @@ -976,6 +977,8 @@ class ConfigFile(dict): """ a class for storing/dealing with input file. """ + allow_scan = False + def __init__(self, finput=None, **opt): """initialize a new instance. input can be an instance of MadLoopParam, a file, a path to a file, or simply Nothing""" @@ -993,6 +996,7 @@ def __init__(self, finput=None, **opt): # Initialize it with all the default value self.user_set = set() self.auto_set = set() + self.scan_set = {} #key -> type of list (int/float/bool/str/... for scan self.system_only = set() self.lower_to_case = {} self.list_parameter = {} #key -> type of list (int/float/bool/str/... @@ -1109,6 +1113,8 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): #1. check if the parameter is set to auto -> pass it to special if lower_name in self: targettype = type(dict.__getitem__(self, lower_name)) + if lower_name in self.scan_set: + targettype = self.scan_set[lower_name] if targettype != str and isinstance(value, str) and value.lower() == 'auto': self.auto_set.add(lower_name) if lower_name in self.user_set: @@ -1118,13 +1124,26 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): return elif lower_name in self.auto_set: self.auto_set.remove(lower_name) - + + + #1. check if the parameter is set to auto -> pass it to special + scan_targettype = None + if self.allow_scan and isinstance(value, str) and value.strip().startswith('scan'): + if lower_name in self.user_set: + self.user_set.remove(lower_name) + self.scan_set[lower_name] = type(self[lower_name]) + dict.__setitem__(self, lower_name, value) + #keep old value. + self.post_set(lower_name,value, change_userdefine, raiseerror) + return + elif lower_name in self.scan_set: + scan_targettype = self.scan_set[lower_name] + del self.scan_set[lower_name] + # 2. Find the type of the attribute that we want if lower_name in self.list_parameter: targettype = self.list_parameter[lower_name] - - if isinstance(value, str): # split for each comma/space value = value.strip() @@ -1248,8 +1267,11 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): if change_userdefine: self.user_set.add(lower_name) return self.post_set(lower_name, None, change_userdefine, raiseerror) - elif name in self: - targettype = type(self[name]) + elif name in self: + if scan_targettype: + targettype = targettype + else: + targettype = type(self[name]) else: logger.debug('Trying to add argument %s in %s. ' % (name, self.__class__.__name__) +\ 'This argument is not defined by default. Please consider adding it.') @@ -1262,7 +1284,7 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): if change_userdefine: self.user_set.add(lower_name) return self.post_set(lower_name, None, change_userdefine, raiseerror) - + value = self.format_variable(value, targettype, name=name) #check that the value is allowed: if lower_name in self.allowed_value and '*' not in self.allowed_value[lower_name]: @@ -1444,7 +1466,7 @@ def format_variable(value, targettype, name="unknown"): value =int(value[:-1]) * convert[value[-1]] elif '/' in value or '*' in value: try: - split = re.split('(\*|/)',value) + split = re.split(r'(\*|/)',value) v = float(split[0]) for i in range((len(split)//2)): if split[2*i+1] == '*': @@ -1482,7 +1504,7 @@ def format_variable(value, targettype, name="unknown"): value = float(value) except ValueError: try: - split = re.split('(\*|/)',value) + split = re.split(r'(\*|/)',value) v = float(split[0]) for i in range((len(split)//2)): if split[2*i+1] == '*': @@ -1491,7 +1513,10 @@ def format_variable(value, targettype, name="unknown"): v /= float(split[2*i+2]) except: v=0 - raise InvalidCmd("%s can not be mapped to a float" % value) + if "scan" in value: + raise InvalidCmd("%s is not supported here. Note that scan command can not be present simultaneously in the run_card and param_card." % value) + else: + raise InvalidCmd("%s can not be mapped to a float" % value) finally: value = v else: @@ -1737,10 +1762,12 @@ def default_setup(self): self.add_param('splitting_types',[], typelist=str) self.add_param('perturbation_order', [], typelist=str) self.add_param('limitations', [], typelist=str) + self.add_param('ew_sudakov', False) self.add_param('hel_recycling', False) self.add_param('single_color', True) self.add_param('nlo_mixed_expansion', True) - + self.add_param('gauge', 'U') + def read(self, finput): """Read the input file, this can be a path to a file, a file object, a str with the content of the file.""" @@ -3104,7 +3131,7 @@ def write(self, output_file, template=None, python_template=False, # do not write hidden parameter not hidden for this template # if python_template: - written = written.union(set(re.findall('\%\((\w*)\)s', open(template,'r').read(), re.M))) + written = written.union(set(re.findall(r'\%\((\w*)\)s', open(template,'r').read(), re.M))) to_write = to_write.union(set(self.hidden_param)) to_write = to_write.difference(written) @@ -3157,7 +3184,6 @@ def get_value_from_include(self, path, list_of_params, output_dir): if path does not exists return the current value in self for all parameter""" #WARNING DOES NOT HANDLE LIST/DICT so far - misc.sprint(output_dir, path) # handle case where file is missing if not os.path.exists(pjoin(output_dir,path)): misc.sprint("include file not existing", pjoin(output_dir,path)) @@ -3259,7 +3285,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): text = open(path,'r').read() #misc.sprint(text) f77_type = ['real*8', 'integer', 'double precision', 'logical'] - pattern = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I+re.M) for fct in pattern.findall(text): fsock = file_writers.FortranWriter(tmp,'w') @@ -3287,6 +3313,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): starttext = open(pjoin(outdir, path+'.orig')).read() fsock.remove_routine(starttext, to_mod[path][0]) for text in to_mod[path][1]: + text = self.retro_compatible_custom_fct(text) fsock.writelines(text) fsock.close() if not filecmp.cmp(pjoin(outdir, path), pjoin(outdir, path+'.tmp')): @@ -3303,7 +3330,33 @@ def edit_dummy_fct_from_file(self, filelist, outdir): files.mv(pjoin(outdir,path+'.orig'), pjoin(outdir, path)) + @staticmethod + def retro_compatible_custom_fct(lines, mode=None): + f77_type = ['real*8', 'integer', 'double precision', 'logical'] + function_pat = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + % {'type':'|'.join(f77_type)}, re.I+re.M) + include_pat = re.compile(r"\s+include\s+[\'\"]([\w\./]*)") + + assert isinstance(lines, list) + sol = [] + + if mode is None or 'vector.inc' in mode: + search = True + for i,line in enumerate(lines[:]): + if search and re.search(include_pat, line): + name = re.findall(include_pat, line)[0] + misc.sprint('DETECTED INCLUDE', name) + if 'vector.inc' in name: + search = False + if 'run.inc' in name: + sol.append(" include 'vector.inc'") + search = False + sol.append(line) + if re.search(function_pat, line): + misc.sprint("DETECTED FCT") + search = True + return sol def guess_entry_fromname(self, name, value): """ @@ -3346,7 +3399,7 @@ def update_typelist(value, name, opts): #handle metadata opts = {} forced_opts = [] - for key,val in re.findall("\<(?P[_\-\w]+)\=(?P[^>]*)\>", str(name)): + for key,val in re.findall(r"\<(?P[_\-\w]+)\=(?P[^>]*)\>", str(name)): forced_opts.append(key) if val in ['True', 'False']: opts[key] = eval(val) @@ -3681,11 +3734,22 @@ def write_autodef(self, output_dir, output_file=None): out = ["%s\n" %l for l in out] fsock.writelines(out) - @staticmethod - def get_idbmup(lpp): + def get_idbmup(self, lpp, beam=1): """return the particle colliding pdg code""" if lpp in (1,2, -1,-2): - return math.copysign(2212, lpp) + target = 2212 + if 'nb_proton1' in self: + nbp = self['nb_proton%s' % beam] + nbn = self['nb_neutron%s' % beam] + if nbp == 1 and nbn ==0: + target = 2212 + elif nbp==0 and nbn ==1: + target = 2112 + else: + target = 1000000000 + target += 10 * (nbp+nbn) + target += 10000 * nbp + return math.copysign(target, lpp) elif lpp in (3,-3): return math.copysign(11, lpp) elif lpp in (4,-4): @@ -3701,8 +3765,8 @@ def get_banner_init_information(self): the first line of the block of the lhe file.""" output = {} - output["idbmup1"] = self.get_idbmup(self['lpp1']) - output["idbmup2"] = self.get_idbmup(self['lpp2']) + output["idbmup1"] = self.get_idbmup(self['lpp1'], beam=1) + output["idbmup2"] = self.get_idbmup(self['lpp2'], beam=2) output["ebmup1"] = self["ebeam1"] output["ebmup2"] = self["ebeam2"] output["pdfgup1"] = 0 @@ -3959,7 +4023,8 @@ def check_validity(self, card): dict.__setitem__(card, 'pdlabel1', card['pdlabel']) dict.__setitem__(card, 'pdlabel2', card['pdlabel']) - if abs(card['lpp1']) == 1 == abs(card['lpp2']) and card['pdlabel1'] != card['pdlabel2']: + if isinstance(card['lpp1'],int) and isinstance(card['lpp2'],int) and \ + abs(card['lpp1']) == 1 == abs(card['lpp2']) and card['pdlabel1'] != card['pdlabel2']: raise InvalidRunCard("Assymetric beam pdf not supported for proton-proton collision") def status(self, card): @@ -4156,12 +4221,16 @@ def default_setup(self): self.add_param('frame_id', 6, system=True) self.add_param("event_norm", "average", allowed=['sum','average', 'unity'], include=False, sys_default='sum', hidden=True) + self.add_param("keep_log", "normal", include=False, hidden=True, + comment="none: all log send to /dev/null.\n minimal: keep only log for survey of the last run.\n normal: keep only log for survey of all run. \n debug: keep all log (survey and refine)", + allowed=['none', 'minimal', 'normal', 'debug']) #cut self.add_param("auto_ptj_mjj", True, hidden=True) self.add_param("bwcutoff", 15.0) self.add_param("cut_decays", False, cut='d') self.add_param('dsqrt_shat',0., cut=True) self.add_param("nhel", 0, include=False) + self.add_param("limhel", 1e-8, hidden=True, comment="threshold to determine if an helicity contributes when not MC over helicity.") #pt cut self.add_param("ptj", 20.0, cut='j') self.add_param("ptb", 0.0, cut='b') @@ -4842,7 +4911,7 @@ def create_default_for_process(self, proc_characteristic, history, proc_def): # here pick strategy 2 if only one QCD color flow # and for pure multi-jet case jet_id = [21] + list(range(1, self['maxjetflavor']+1)) - if proc_characteristic['single_color']: + if proc_characteristic['gauge'] != 'FD' and proc_characteristic['single_color']: self['sde_strategy'] = 2 #for pure lepton final state go back to sde_strategy=1 pure_lepton=True @@ -5741,9 +5810,10 @@ def check_validity(self): # check that ebeam is bigger than the proton mass. for i in [1,2]: - if self['lpp%s' % i ] not in [1,2]: + # do not for proton mass if not proton PDF (or when scan initialization) + if self['lpp%s' % i ] not in [1,2] or isinstance(self['ebeam%i' % i], str): continue - + if self['ebeam%i' % i] < 0.938: if self['ebeam%i' %i] == 0: logger.warning("At-rest proton mode set: energy beam set to 0.938 GeV") @@ -6193,3 +6263,181 @@ def log_and_update(self, banner, card, par, v): xcard = banner.charge_card(card) xcard[par[0]].param_dict[(par[1],)].value = v xcard.write(os.path.join(self.me_dir, 'Cards', '%s.dat' % card)) + + + + +class RunCardIterator(object): + """A class keeping track of the scan: flag in the param_card and + having an __iter__() function to scan over all the points of the scan. + """ + + logging = True + def __init__(self, input_path=None): + with misc.TMP_variable(RunCard, 'allow_scan', True): + self.run_card = RunCard(input_path, consistency=False) + self.run_card.allow_scan = True + + self.itertag = [] #all the current value use + self.cross = [] # keep track of all the cross-section computed + self.param_order = [] + + def __iter__(self): + """generate the next param_card (in a abstract way) related to the scan. + Technically this generates only the generator.""" + + if hasattr(self, 'iterator'): + return self.iterator + self.iterator = self.iterate() + return self.iterator + + def write(self, path): + self.__iter__.write(path) + + def next(self, autostart=False): + """call the next iteration value""" + try: + iterator = self.iterator + except: + if autostart: + iterator = self.__iter__() + else: + raise + try: + out = next(iterator) + except StopIteration: + del self.iterator + raise + return out + + def iterate(self): + """create the actual generator""" + all_iterators = {} # dictionary of key -> block of object to scan [([param, [values]), ...] + pattern = re.compile(r'''scan\s*(?P\d*)\s*:\s*(?P[^#]*)''', re.I) + + # fill all_iterators with the run_card information + for name in self.run_card.scan_set: + value = self.run_card[name] + try: + key, def_list = pattern.findall(value)[0] + except Exception as error: + misc.sprint(error) + raise Exception("Fail to handle scanning tag in run_card: Please check that the syntax is valid") + if key == '': + key = -1 * len(all_iterators) + if key not in all_iterators: + all_iterators[key] = [] + try: + all_iterators[key].append( (name, eval(def_list))) + except SyntaxError as error: + raise Exception("Fail to handle your scan definition. Please check your syntax:\n entry: %s \n Error reported: %s" %(def_list, error)) + + #prepare to keep track of parameter changing for the report + keys = list(all_iterators.keys()) # need to fix an order for the scan + #store the type of parameter + for key in keys: + for param, values in all_iterators[key]: + self.param_order.append("run_card#%s" % (param)) + + # do the loop + lengths = [list(range(len(all_iterators[key][0][1]))) for key in keys] + from functools import reduce + total = reduce((lambda x, y: x * y),[len(x) for x in lengths]) + for i,positions in enumerate(itertools.product(*lengths)): + self.itertag = [] + if self.logging: + logger.info("Create the next run_card in the scan definition (%s/%s) " %( i+1, total), '$MG:BOLD') + for i, pos in enumerate(positions): + key = keys[i] + for param, values in all_iterators[key]: + # assign the value in the card. + self.run_card[param] = values[pos] + self.itertag.append(values[pos]) + if self.logging: + logger.info("change parameter %s to %s", \ + param, values[pos]) + + + # retrun the current param_card up to next iteration + yield self.run_card + + + def store_entry(self, run_name, cross, error=None, run_card_path=None): + """store the value of the cross-section""" + + if isinstance(cross, dict): + info = dict(cross) + info.update({'bench' : self.itertag, 'run_name': run_name}) + self.cross.append(info) + else: + if error is None: + self.cross.append({'bench' : self.itertag, 'run_name': run_name, 'cross(pb)':cross}) + else: + self.cross.append({'bench' : self.itertag, 'run_name': run_name, 'cross(pb)':cross, 'error(pb)':error}) + + + def write_summary(self, path, order=None, lastline=False, nbcol=20): + """ """ + + if path: + ff = open(path, 'w') + path_events = path.rsplit("/", 1)[0] + #identCard = open(pjoin(path.rsplit("/", 2)[0], "Cards", "ident_card.dat")) + #identLines = identCard.readlines() + #identCard.close() + else: + ff = StringIO.StringIO() + if order: + keys = order + else: + keys = list(self.cross[0].keys()) + if 'bench' in keys: keys.remove('bench') + if 'run_name' in keys: keys.remove('run_name') + keys.sort() + if 'cross(pb)' in keys: + keys.remove('cross(pb)') + keys.append('cross(pb)') + if 'error(pb)' in keys: + keys.remove('error(pb)') + keys.append('error(pb)') + + formatting = "#%s%s%s\n" %('%%-%is ' % (nbcol-1), ('%%-%is ' % (nbcol))* len(self.param_order), + ('%%-%is ' % (nbcol))* len(keys)) + # header + if not lastline: + ff.write(formatting % tuple(['run_name'] + self.param_order + keys)) + formatting = "%s%s%s\n" %('%%-%is ' % (nbcol), ('%%-%ie ' % (nbcol))* len(self.param_order), + ('%%-%ie ' % (nbcol))* len(keys)) + + if not lastline: + to_print = self.cross + else: + to_print = self.cross[-1:] + for info in to_print: + name = info['run_name'] + bench = info['bench'] + data = [] + for k in keys: + if k in info: + data.append(info[k]) + else: + data.append(0.) + ff.write(formatting % tuple([name] + bench + data)) + ff_single = open(pjoin(path_events, name, "params.dat"), "w") + for i_bench in range(0, len(bench)): + ff_single.write(self.param_order[i_bench] + " = " + str(bench[i_bench]) +"\n") + ff_single.close() + + if not path: + return ff.getvalue() + + + def get_next_name(self, run_name): + """returns a smart name for the next run""" + + if '_' in run_name: + name, value = run_name.rsplit('_',1) + if value.isdigit(): + return '%s_%02i' % (name, float(value)+1) + # no valid '_' in the name + return '%s_scan_02' % run_name diff --git a/epochX/cudacpp/gg_ttg.mad/bin/internal/check_param_card.py b/epochX/cudacpp/gg_ttg.mad/bin/internal/check_param_card.py index 71089d7480..bc785b5de6 100755 --- a/epochX/cudacpp/gg_ttg.mad/bin/internal/check_param_card.py +++ b/epochX/cudacpp/gg_ttg.mad/bin/internal/check_param_card.py @@ -649,7 +649,7 @@ def write_inc_file(self, outpath, identpath, default, need_mp=False): #check if we need to write the value of scale for some block if os.path.exists(input_inc): text = open(input_inc).read() - scales = list(set(re.findall('mdl__(\w*)__scale', text, re.I))) + scales = list(set(re.findall(r'mdl__(\w*)__scale', text, re.I))) else: scales = [] @@ -1000,10 +1000,12 @@ def iterate(self): self.param_order.append("%s#%s" % (param.lhablock, '_'.join(repr(i) for i in param.lhacode))) # do the loop lengths = [list(range(len(all_iterators[key][0][1]))) for key in keys] - for positions in itertools.product(*lengths): + from functools import reduce + total = reduce((lambda x, y: x * y),[len(x) for x in lengths]) + for i,positions in enumerate(itertools.product(*lengths)): self.itertag = [] if self.logging: - logger.info("Create the next param_card in the scan definition", '$MG:BOLD') + logger.info("Create the next param_card in the scan definition (%s/%s)" % (i+1,total), '$MG:BOLD') for i, pos in enumerate(positions): key = keys[i] for param, values in all_iterators[key]: diff --git a/epochX/cudacpp/gg_ttg.mad/bin/internal/cluster.py b/epochX/cudacpp/gg_ttg.mad/bin/internal/cluster.py index 9a893f630d..1ad860e04f 100755 --- a/epochX/cudacpp/gg_ttg.mad/bin/internal/cluster.py +++ b/epochX/cudacpp/gg_ttg.mad/bin/internal/cluster.py @@ -646,7 +646,10 @@ def worker(self): if os.path.exists(exe) and not exe.startswith('/'): exe = './' + exe if isinstance(opt['stdout'],str): - opt['stdout'] = open(opt['stdout'],'w') + if opt['stdout'] == '/dev/null': + opt['stdout'] = os.open(os.devnull, os.O_RDWR) + else: + opt['stdout'] = open(opt['stdout'],'w') if opt['stderr'] == None: opt['stderr'] = subprocess.STDOUT if arg: @@ -671,11 +674,12 @@ def worker(self): self.pids.put(pid) # the function should return 0 if everything is fine # the error message otherwise - returncode = exe(*arg, **opt) - if returncode != 0: - logger.warning("fct %s does not return 0. Stopping the code in a clean way. The error was:\n%s", exe, returncode) + try: + returncode = exe(*arg, **opt) + except Exception as error: + #logger.warning("fct %s does not return 0. Stopping the code in a clean way. The error was:\n%s", exe, returncode) self.stoprequest.set() - self.remove("fct %s does not return 0:\n %s" % (exe, returncode)) + self.remove("fct %s does raise %s\n %s" % (exe, error)) except Exception as error: self.fail_msg = sys.exc_info() logger.warning(str(error)) @@ -700,7 +704,7 @@ def worker(self): def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, - log=None, required_output=[], nb_submit=0): + log=None, required_output=[], nb_submit=0, python_opts={}): """submit a job on multicore machine""" # open threads if needed @@ -720,7 +724,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, return tag else: # python function - self.queue.put((tag, prog, argument, {})) + self.queue.put((tag, prog, argument, python_opts)) self.submitted.put(1) return tag @@ -908,6 +912,10 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None else: requirement = '' + if 'cluster_walltime' in self.options and self.options['cluster_walltime']\ + and self.options['cluster_walltime'] != 'None': + requirement+='\n MaxRuntime = %s' % self.options['cluster_walltime'] + if cwd is None: cwd = os.getcwd() if stdout is None: @@ -936,7 +944,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None #Submitting job(s). #Logging submit event(s). #1 job(s) submitted to cluster 2253622. - pat = re.compile("submitted to cluster (\d*)",re.MULTILINE) + pat = re.compile(r"submitted to cluster (\d*)",re.MULTILINE) output = output.decode(errors='ignore') try: id = pat.search(output).groups()[0] @@ -1025,7 +1033,7 @@ def submit2(self, prog, argument=[], cwd=None, stdout=None, stderr=None, #Logging submit event(s). #1 job(s) submitted to cluster 2253622. output = output.decode(errors='ignore') - pat = re.compile("submitted to cluster (\d*)",re.MULTILINE) + pat = re.compile(r"submitted to cluster (\d*)",re.MULTILINE) try: id = pat.search(output).groups()[0] except: @@ -1588,7 +1596,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None output = a.communicate()[0].decode(errors='ignore') #Your job 874511 ("test.sh") has been submitted - pat = re.compile("Your job (\d*) \(",re.MULTILINE) + pat = re.compile(r"Your job (\d*) \(",re.MULTILINE) try: id = pat.search(output).groups()[0] except: @@ -1606,7 +1614,7 @@ def control_one_job(self, id): if not status: return 'F' #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 - pat = re.compile("^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") + pat = re.compile(r"^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") stat = '' for line in status.stdout.read().decode(errors='ignore').split('\n'): if not line: @@ -1636,7 +1644,7 @@ def control(self, me_dir=None): cmd = 'qstat -s %s' % statusflag status = misc.Popen([cmd], shell=True, stdout=subprocess.PIPE) #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 - pat = re.compile("^(\d+)") + pat = re.compile(r"^(\d+)") for line in status.stdout.read().decode(errors='ignore').split('\n'): line = line.strip() try: @@ -1715,6 +1723,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None stderr = stdout if log is None: log = '/dev/null' + command = ['sbatch', '-o', stdout, '-J', me_dir, @@ -1726,6 +1735,12 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None command.insert(1, '-p') command.insert(2, self.cluster_queue) + if 'cluster_walltime' in self.options and self.options['cluster_walltime']\ + and self.options['cluster_walltime'] != 'None': + command.insert(1, '-t') + command.insert(2, self.options['cluster_walltime']) + + a = misc.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -1736,7 +1751,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None id = output_arr[3].rstrip() if not id.isdigit(): - id = re.findall('Submitted batch job ([\d\.]+)', ' '.join(output_arr)) + id = re.findall(r'Submitted batch job ([\d\.]+)', ' '.join(output_arr)) if not id or len(id)>1: raise ClusterManagmentError( 'fail to submit to the cluster: \n%s' \ diff --git a/epochX/cudacpp/gg_ttg.mad/bin/internal/combine_runs.py b/epochX/cudacpp/gg_ttg.mad/bin/internal/combine_runs.py index 4de6b84ec0..b1e8c88eac 100755 --- a/epochX/cudacpp/gg_ttg.mad/bin/internal/combine_runs.py +++ b/epochX/cudacpp/gg_ttg.mad/bin/internal/combine_runs.py @@ -20,6 +20,7 @@ from __future__ import absolute_import import math import os +import shutil import re import logging from six.moves import range @@ -117,6 +118,7 @@ def sum_multichannel(self, channel): #Now read in all of the events and write them #back out with the appropriate scaled weight + to_clean = [] fsock = open(pjoin(channel, 'events.lhe'), 'w') wgt = results.axsec / results.nunwgt tot_nevents, nb_file = 0, 0 @@ -129,8 +131,14 @@ def sum_multichannel(self, channel): nw = self.copy_events(fsock, pjoin(path,'events.lhe'), wgt) tot_nevents += nw nb_file += 1 + to_clean.append(path) logger.debug("Combined %s file generating %s events for %s " , nb_file, tot_nevents, channel) - + for path in to_clean: + try: + shutil.rmtree(path) + except Exception as error: + pass + @staticmethod def get_fortran_str(nb): data = '%E' % nb @@ -162,6 +170,7 @@ def copy_events(self, fsock, input, new_wgt): fsock.write(line) old_line = line return nb_evt + def get_channels(self, proc_path): """Opens file symfact.dat to determine all channels""" sympath = os.path.join(proc_path, 'symfact.dat') diff --git a/epochX/cudacpp/gg_ttg.mad/bin/internal/common_run_interface.py b/epochX/cudacpp/gg_ttg.mad/bin/internal/common_run_interface.py index 9bd9d9cb50..194f0cdfbd 100755 --- a/epochX/cudacpp/gg_ttg.mad/bin/internal/common_run_interface.py +++ b/epochX/cudacpp/gg_ttg.mad/bin/internal/common_run_interface.py @@ -23,6 +23,7 @@ import ast import logging import math +import copy import os import re import shutil @@ -181,6 +182,23 @@ def help_add_time_of_flight(self): logger.info(' threshold option allows to change the minimal value required to') logger.info(' a non zero value for the particle (default:1e-12s)') + def help_print_results(self): + logger.info("syntax: print_results [RUN_NAME] [OPTIONS]") + logger.info("-- print the results of the previous run on the screen") + logger.info(" If not RUN_NAME is provided, the information of all run") + logger.info(" are printed one after another.") + logger.info("") + logger.info(" supported options:") + logger.info(" ------------------") + logger.info(" --format=full|short # default is full") + logger.info(" full format contains banner/... ") + logger.info(" while short is a simple multi-column format (nice for plotting)") + logger.info(" --path=") + logger.info(" allow to write the information to a file.") + logger.info(" --mode=w|a #default is w ") + logger.info(" when the information is printed to a file, you can choose ") + logger.info(" to either overwrite the file if already exists (w mode)") + logger.info(" to append the information at the end of the file (a mode)") class CheckValidForCmd(object): @@ -727,7 +745,7 @@ def __init__(self, me_dir, options, *args, **opts): if not self.proc_characteristics['ninitial']: # Get number of initial states nexternal = open(pjoin(self.me_dir,'Source','nexternal.inc')).read() - found = re.search("PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) + found = re.search(r"PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) self.ninitial = int(found.group(1)) else: self.ninitial = self.proc_characteristics['ninitial'] @@ -989,7 +1007,22 @@ def do_treatcards(self, line, amcatnlo=False): #raise Exception, "%s %s %s" % (sys.path, os.path.exists(pjoin(self.me_dir,'bin','internal', 'ufomodel')), os.listdir(pjoin(self.me_dir,'bin','internal', 'ufomodel'))) import ufomodel as ufomodel zero = ufomodel.parameters.ZERO - if self.proc_characteristics['nlo_mixed_expansion']: + no_width = [] + + if self.proc_characteristics['ew_sudakov']: + # if the sudakov approximation is used, force all particle widths to zero + # unless the complex mass scheme is used + if not self.proc_characteristics['complex_mass_scheme']: + no_width = [p for p in ufomodel.all_particles if p.width != zero] + logger.info('''Setting all particle widths to zero (needed for EW Sudakov approximation).''','$MG:BOLD') + # also, check that the model features the 'ntadpole' parameter, and set it to 1 + try: + param_card['tadpole'].get(1).value = 1. + logger.info('''Setting the value of ntadpole to 1 (needed for EW Sudakov approximation).''','$MG:BOLD') + except KeyError: + logger.warning('''The model has no 'ntadpole' parameter. The Sudakov approximation for EW corrections may give wrong results.''') + + elif self.proc_characteristics['nlo_mixed_expansion']: no_width = [p for p in ufomodel.all_particles if (str(p.pdg_code) in pids or str(-p.pdg_code) in pids) and p.width != zero] @@ -1168,17 +1201,17 @@ def detect_card_type(path): 'Begin Minpts', 'gridpack', 'ebeam1', - 'block\s+mw_run', + r'block\s+mw_run', 'BLOCK', 'DECAY', 'launch', 'madspin', - 'transfer_card\.dat', + r'transfer_card\.dat', 'set', 'main:numberofevents', # pythia8, '@MG5aMC skip_analysis', #MA5 --both-- - '@MG5aMC\s*inputs\s*=\s*\*\.(?:hepmc|lhe)', #MA5 --both-- - '@MG5aMC\s*reconstruction_name', # MA5 hadronique + r'@MG5aMC\s*inputs\s*=\s*\*\.(?:hepmc|lhe)', #MA5 --both-- + r'@MG5aMC\s*reconstruction_name', # MA5 hadronique '@MG5aMC', # MA5 hadronique 'run_rivet_later', # Rivet ] @@ -1237,7 +1270,7 @@ def detect_card_type(path): return 'madspin_card.dat' if 'decay' in text: # need to check if this a line like "decay w+" or "set decay" - if re.search("(^|;)\s*decay", fulltext, re.M): + if re.search(r"(^|;)\s*decay", fulltext, re.M): return 'madspin_card.dat' else: return 'reweight_card.dat' @@ -2074,6 +2107,12 @@ def check_multicore(self): # ensure that the run_card is present if not hasattr(self, 'run_card'): self.run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat')) + # Below reads the run_card in the LHE file rather than the Cards/run_card + import madgraph.various.lhe_parser as lhe_parser + args_path = list(args) + self.check_decay_events(args_path) + self.run_card = banner_mod.RunCard(lhe_parser.EventFile(args_path[0]).get_banner()['mgruncard']) + # we want to run this in a separate shell to avoid hard f2py crash command = [sys.executable] @@ -2085,6 +2124,12 @@ def check_multicore(self): command.append('--web') command.append('reweight') + ## TV: copy the event file as backup before starting reweighting + event_path = pjoin(self.me_dir, 'Events', self.run_name, 'events.lhe.gz') + event_path_backup = pjoin(self.me_dir, 'Events', self.run_name, 'events_orig.lhe.gz') + if os.path.exists(event_path) and not os.path.exists(event_path_backup): + shutil.copyfile(event_path, event_path_backup) + ######### START SINGLE CORE MODE ############ if self.options['nb_core']==1 or self.run_card['nevents'] < 101 or not check_multicore(self): if self.run_name: @@ -2200,7 +2245,7 @@ def check_multicore(self): cross_sections[key] = value / (nb_event+1) lhe.remove() for key in cross_sections: - if key == 'orig' or key.isdigit(): + if key == 'orig' or (key.isdigit() and not (key[0] == '2')): continue logger.info('%s : %s pb' % (key, cross_sections[key])) return @@ -2461,7 +2506,7 @@ def do_add_time_of_flight(self, line): ############################################################################ def do_print_results(self, line): - """Not in help:Print the cross-section/ number of events for a given run""" + """Print the cross-section/ number of events for a given run""" args = self.split_arg(line) options={'path':None, 'mode':'w', 'format':'full'} @@ -2942,10 +2987,15 @@ def do_rivet(self, line, postprocess=False): #2 Prepare Rivet setup environments rivet_path = self.options['rivet_path'] yoda_path = self.options['yoda_path'] + fastjet_path = subprocess.Popen([self.options['fastjet'], '--prefix'], + stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip() + set_env = set_env + "export PATH={0}:$PATH\n".format(pjoin(rivet_path, 'bin')) set_env = set_env + "export PATH={0}:$PATH\n".format(pjoin(yoda_path, 'bin')) set_env = set_env + "export LD_LIBRARY_PATH={0}:{1}:$LD_LIBRARY_PATH\n".format(pjoin(rivet_path, 'lib'), pjoin(rivet_path, 'lib64')) set_env = set_env + "export LD_LIBRARY_PATH={0}:{1}:$LD_LIBRARY_PATH\n".format(pjoin(yoda_path, 'lib'), pjoin(yoda_path, 'lib64')) + set_env = set_env + "export LD_LIBRARY_PATH={0}:$LD_LIBRARY_PATH\n".format(pjoin(self.options['hepmc_path'], 'lib')) + set_env = set_env + "export LD_LIBRARY_PATH={0}:$LD_LIBRARY_PATH\n".format(pjoin(fastjet_path, 'lib')) major, minor = sys.version_info[0:2] set_env = set_env + "export PYTHONPATH={0}:{1}:$PYTHONPATH\n".format(pjoin(rivet_path, 'lib', 'python%s.%s' %(major,minor), 'site-packages'),\ pjoin(rivet_path, 'lib64', 'python%s.%s' %(major,minor), 'site-packages')) @@ -4311,8 +4361,8 @@ def complete_compute_widths(self, text, line, begidx, endidx, formatting=True): else: completion = {} completion['options'] = self.list_completion(text, - ['--path=', '--output=', '--min_br=0.\$', '--nlo', - '--precision_channel=0.\$', '--body_decay=']) + ['--path=', '--output=', r'--min_br=0.\$', '--nlo', + r'--precision_channel=0.\$', '--body_decay=']) return self.deal_multiple_categories(completion, formatting) @@ -4821,9 +4871,9 @@ class AskforEditCard(cmd.OneLinePathCompletion): (return False to repeat the question) """ - all_card_name = ['param_card', 'run_card', 'pythia_card', 'pythia8_card', + all_card_name = ['param_card', 'run_card', 'pythia_card', 'pythia8_card', 'fo_analysis_card' 'madweight_card', 'MadLoopParams', 'shower_card', 'rivet_card'] - to_init_card = ['param', 'run', 'madweight', 'madloop', + to_init_card = ['param', 'run', 'madweight', 'madloop', 'fo_analysis', 'shower', 'pythia8','delphes','madspin', 'rivet'] special_shortcut = {} special_shortcut_help = {} @@ -4853,6 +4903,7 @@ def load_default(self): self.has_PY8 = False self.has_delphes = False self.has_rivet = False + self.has_fo_card = False self.paths = {} self.update_block = [] @@ -5058,7 +5109,8 @@ def init_run(self, cards): try: - self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning') + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning') except IOError: self.run_card = {} try: @@ -5248,6 +5300,15 @@ def init_delphes(self, cards): self.has_delphes = True return [] + def init_fo_analysis(self, cards): + self.has_fo_card = False + if not self.get_path('FO_analyse', cards): + return [] + self.has_fo_card = True + self.fo_card = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse']) + self.fo_card_def = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse_default']) + return list(self.fo_card.string_vars) + def set_CM_velocity(self, line): """compute sqrts from the velocity in the center of mass frame""" @@ -5508,6 +5569,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): allowed['delphes_card'] = '' if self.has_rivet: allowed['rivet_card'] = '' + if self.has_fo_card: + allowed['fo_card'] = '' elif len(args) == 2: if args[1] == 'run_card': @@ -5532,6 +5595,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): allowed = {'delphes_card':'default'} elif args[1] == 'rivet_card': allowed = {'rivet_card':'default'} + elif args[1] == 'fo_card': + allowed = {'fo_card':'default'} else: allowed = {'value':''} @@ -5539,6 +5604,7 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): start = 1 if args[1] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', 'MadLoop_card','pythia8_card','delphes_card','plot_card', + 'fo_card', 'madanalysis5_parton_card','madanalysis5_hadron_card', 'rivet_card']: start = 2 @@ -5576,6 +5642,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): categories.append('delphes_card') if self.has_rivet: categories.append('rivet_card') + if self.has_fo_card: + categories.append('fo_card') possibilities['category of parameter (optional)'] = \ self.list_completion(text, categories) @@ -5630,7 +5698,13 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): if 'delphes_card' in allowed: if allowed['delphes_card'] == 'default': opts = ['default', 'atlas', 'cms'] - possibilities['Delphes Card'] = self.list_completion(text, opts) + possibilities['Delphes Card'] = self.list_completion(text, opts) + + if 'fo_card' in allowed: + opts = self.fo_card.string_vars + if allowed['fo_card'] == 'default': + opts.append('default') + possibilities['FO Card'] = self.list_completion(text, opts) if 'value' in list(allowed.keys()): opts = ['default', 'scale'] @@ -5733,21 +5807,28 @@ def do_set(self, line): if args[0] in self.special_shortcut: targettypes , cmd = self.special_shortcut[args[0]] if len(args) != len(targettypes) +1: - logger.warning('shortcut %s requires %s argument' % (args[0], len(targettypes))) - if len(args) < len(targettypes) +1: - return + if len(targettypes) == 1 and args[len(targettypes)].startswith('scan'): + args = args[:len(targettypes)] + [' '.join(args[len(targettypes):])] + targettypes = [str] else: - logger.warning('additional argument will be ignored') + logger.warning('shortcut %s requires %s argument' % (args[0], len(targettypes))) + if len(args) < len(targettypes) +1: + return + else: + logger.warning('additional argument will be ignored') values ={} for i, argtype in enumerate(targettypes): try: - values = {str(i): banner_mod.ConfigFile.format_variable(args[i+1], argtype, args[0])} + values[str(i)] = banner_mod.ConfigFile.format_variable(args[i+1], argtype, args[0]) except ValueError as e: logger.warning("Wrong argument: The entry #%s should be of type %s.", i+1, argtype) return except InvalidCmd as e: - logger.warning(str(e)) - return + if isinstance(args[i+1], str) and args[i+1].startswith('scan'): + values[str(i)] = args[i+1] + else: + logger.warning(str(e)) + return #else: # logger.warning("too many argument for this command") # return @@ -5787,7 +5868,7 @@ def do_set(self, line): if os.path.exists(pythia_path): logger.info('add line QCUT = %s in pythia_card.dat' % args[1]) p_card = open(pythia_path,'r').read() - p_card, n = re.subn('''^\s*QCUT\s*=\s*[\de\+\-\.]*\s*$''', + p_card, n = re.subn(r'''^\s*QCUT\s*=\s*[\de\+\-\.]*\s*$''', ''' QCUT = %s ''' % args[1], \ p_card, flags=(re.M+re.I)) if n==0: @@ -5801,7 +5882,7 @@ def do_set(self, line): if os.path.exists(pythia_path): logger.info('add line SHOWERKT = %s in pythia_card.dat' % args[1].upper()) p_card = open(pythia_path,'r').read() - p_card, n = re.subn('''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''', + p_card, n = re.subn(r'''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''', ''' SHOWERKT = %s ''' % args[1].upper(), \ p_card, flags=(re.M+re.I)) if n==0: @@ -5856,7 +5937,7 @@ def do_set(self, line): pjoin(self.me_dir,'Cards', 'delphes_card.dat')) return - if args[0] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', + if args[0] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', 'fo_card', 'delphes_card','madanalysis5_hadron_card','madanalysis5_parton_card','rivet_card']: if args[1] == 'default': @@ -6176,6 +6257,22 @@ def do_set(self, line): self.setRivet(args[start], value, default=default) self.rivet_card.write(self.paths['rivet'], self.paths['rivet_default']) + elif self.has_fo_card and (card in ['', 'fo_card'])\ + and args[start].lower() in [k.lower() for k in self.fo_card.string_vars]: + + if args[start] in self.conflict and card == '': + text = 'ambiguous name (present in more than one card). Please specify which card to edit' + logger.warning(text) + return + if args[start+1] == 'default': + value = self.fo_card_default[args[start]] + default = True + else: + value = args[start+1] + default = False + self.fo_card[args[start]] = value + self.modified_card.add('fo_card') + #INVALID -------------------------------------------------------------- else: logger.warning('invalid set command %s ' % line) @@ -6222,12 +6319,13 @@ def setM(self, block, name, value): def setR(self, name, value): - if self.mother_interface.inputfile: - self.run_card.set(name, value, user=True, raiseerror=True) - else: - self.run_card.set(name, value, user=True) - new_value = self.run_card.get(name) - logger.info('modify parameter %s of the run_card.dat to %s' % (name, new_value),'$MG:BOLD') + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + if self.mother_interface.inputfile: + self.run_card.set(name, value, user=True, raiseerror=True) + else: + self.run_card.set(name, value, user=True) + new_value = self.run_card.get(name) + logger.info('modify parameter %s of the run_card.dat to %s' % (name, new_value),'$MG:BOLD') def setML(self, name, value, default=False): @@ -6314,6 +6412,7 @@ def check_card_consistency(self): proc_charac = self.mother_interface.proc_characteristics if proc_charac['grouped_matrix'] and \ + isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int) and \ abs(self.run_card['lpp1']) == 1 == abs(self.run_card['lpp2']) and \ (self.run_card['nb_proton1'] != self.run_card['nb_proton2'] or self.run_card['nb_neutron1'] != self.run_card['nb_neutron2'] or @@ -6403,41 +6502,42 @@ def check_card_consistency(self): # check that only quark/gluon/photon are in initial beam if lpp=+-1 pdg_in_p = list(range(-6,7))+[21,22] - if (abs(self.run_card['lpp1'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial1'])) \ + if isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int): + if(abs(self.run_card['lpp1'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial1'])) \ or (abs(self.run_card['lpp2'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial2'])): - if 'pythia_card.dat' in self.cards or 'pythia8_card.dat' in self.cards: - path_to_remove = None - if 'pythia_card.dat' in self.cards: - path_to_remove = self.paths['pythia'] - card_to_remove = 'pythia_card.dat' - elif 'pythia8_card.dat' in self.cards: - path_to_remove = self.paths['pythia8'] - card_to_remove = 'pythia8_card.dat' - if path_to_remove: - if 'partonshower' in self.run_card['bypass_check']: + if 'pythia_card.dat' in self.cards or 'pythia8_card.dat' in self.cards: + path_to_remove = None + if 'pythia_card.dat' in self.cards: + path_to_remove = self.paths['pythia'] + card_to_remove = 'pythia_card.dat' + elif 'pythia8_card.dat' in self.cards: + path_to_remove = self.paths['pythia8'] + card_to_remove = 'pythia8_card.dat' + if path_to_remove: + if 'partonshower' in self.run_card['bypass_check']: + logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") + else: + logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') + os.remove(path_to_remove) + self.cards.remove(card_to_remove) + else: + logger.info('Remember that Parton-Shower are not yet ready for such proton component definition (HW implementation in progress).', '$MG:BOLD' ) + elif (abs(self.run_card['lpp1'])==3 and abs(self.run_card['lpp2'])==3): + if 'pythia8_card.dat' in self.cards: + if self.run_card['pdlabel'] == 'isronlyll': + if 'partonshower' not in self.run_card['bypass_check']: + # force that QED shower is on? + for param in ['TimeShower:QEDshowerByQ', 'TimeShower:QEDshowerByL', 'TimeShower:QEDshowerByGamma', 'SpaceShower:QEDshowerByQ', 'SpaceShower:QEDshowerByL']: + if param not in self.PY8Card or \ + (not self.PY8Card[param] and param.lower() not in self.PY8Card.user_set): + logger.warning('Activating QED shower: setting %s to True', param) + self.PY8Card[param] = True + elif 'partonshower' in self.run_card['bypass_check']: logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") - else: + else: logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') - os.remove(path_to_remove) - self.cards.remove(card_to_remove) - else: - logger.info('Remember that Parton-Shower are not yet ready for such proton component definition (HW implementation in progress).', '$MG:BOLD' ) - elif (abs(self.run_card['lpp1'])==3 and abs(self.run_card['lpp2'])==3): - if 'pythia8_card.dat' in self.cards: - if self.run_card['pdlabel'] == 'isronlyll': - if 'partonshower' not in self.run_card['bypass_check']: - # force that QED shower is on? - for param in ['TimeShower:QEDshowerByQ', 'TimeShower:QEDshowerByL', 'TimeShower:QEDshowerByGamma', 'SpaceShower:QEDshowerByQ', 'SpaceShower:QEDshowerByL']: - if param not in self.PY8Card or \ - (not self.PY8Card[param] and param.lower() not in self.PY8Card.user_set): - logger.warning('Activating QED shower: setting %s to True', param) - self.PY8Card[param] = True - elif 'partonshower' in self.run_card['bypass_check']: - logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") - else: - logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') - os.remove(self.paths['pythia8']) - self.cards.remove('pythia8_card.dat') + os.remove(self.paths['pythia8']) + self.cards.remove('pythia8_card.dat') ######################################################################## @@ -6514,7 +6614,8 @@ def check_card_consistency(self): #check relation between lepton PDF // dressed lepton collisions // ... - if abs(self.run_card['lpp1']) != 1 or abs(self.run_card['lpp2']) != 1: + if isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int) and \ + abs(self.run_card['lpp1']) != 1 or abs(self.run_card['lpp2']) != 1: if abs(self.run_card['lpp1']) == abs(self.run_card['lpp2']) == 3: # this can be dressed lepton or photon-flux if proc_charac['pdg_initial1'] in [[11],[-11]] and proc_charac['pdg_initial2'] in [[11],[-11]]: @@ -6732,7 +6833,11 @@ def write_card_param(self): """ write the param_card """ self.param_card.write(self.paths['param']) - + + def write_card_fo_card(self): + """ write the fo_card""" + self.fo_card.write_card_from_template(self.paths['FO_analyse'], self.paths['FO_analyse_default']) + @staticmethod def update_dependent(mecmd, me_dir, param_card, path ,timer=0, run_card=None, lhapdfconfig=None): @@ -7076,7 +7181,7 @@ def do_decay(self, line): #first find the particle particle = line.split('>')[0].strip() logger.info("change madspin_card to define the decay of %s: %s" %(particle, line.strip()), '$MG:BOLD') - particle = particle.replace('+','\+').replace('-','\-') + particle = particle.replace('+',r'\+').replace('-',r'\-') decay_pattern = re.compile(r"^\s*decay\s+%s\s*>[\s\w+-~]*?$" % particle, re.I+re.M) text= open(path).read() text = decay_pattern.sub('', text) @@ -7193,7 +7298,7 @@ def help_edit(self, prefix=True): logger.info( ' --clean remove all previously existing line in the file') logger.info( ' --comment_line="" comment all lines matching the regular expression') logger.info('') - logger.info(' Note: all regular-expression will be prefixed by ^\s*') + logger.info(r' Note: all regular-expression will be prefixed by ^\s*') logger.info('') logger.info( ' example: edit reweight --after_line="change mode\b" change model heft') logger.info( ' edit madspin --after_line="banner" change model XXXX') @@ -7314,7 +7419,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''replace_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[14:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[14:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7344,7 +7449,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''comment_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[14:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[14:-1] nb_mod = 0 for posline,l in enumerate(split): if re.search(pattern, l): @@ -7366,7 +7471,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''before_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[13:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[13:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7383,7 +7488,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern = r'''after_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[12:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[12:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7527,16 +7632,19 @@ def open_file(self, answer): answer = 'plot' else: answer = self.cards[int(answer)-self.integer_bias] - + path = '' if 'madweight' in answer: answer = answer.replace('madweight', 'MadWeight') elif 'MadLoopParams' in answer: answer = self.paths['ML'] elif 'pythia8_card' in answer: answer = self.paths['pythia8'] + elif 'FO_analyse' in answer: + path = self.paths['FO_analyse'] + answer = 'fo_card' if os.path.exists(answer): path = answer - else: + elif not os.path.exists(path): if not '.dat' in answer and not '.lhco' in answer: if answer != 'trigger': path = self.paths[answer] @@ -7595,7 +7703,8 @@ def reload_card(self, path): logger.error('Please re-open the file and fix the problem.') logger.warning('using the \'set\' command without opening the file will discard all your manual change') elif path == self.paths['run']: - self.run_card = banner_mod.RunCard(path) + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + self.run_card = banner_mod.RunCard(path) elif path == self.paths['shower']: self.shower_card = shower_card_mod.ShowerCard(path) elif path == self.paths['ML']: @@ -7614,6 +7723,8 @@ def reload_card(self, path): except: import internal.madweight.Cards as mwcards self.mw_card = mwcards.Card(path) + elif path == self.paths['FO_analyse']: + self.fo_card = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse']) else: logger.debug('not keep in sync: %s', path) return path @@ -7629,6 +7740,9 @@ def scanparamcardhandling(input_path=lambda obj: pjoin(obj.me_dir, 'Cards', 'par iteratorclass=param_card_mod.ParamCardIterator, summaryorder=lambda obj: lambda:None, check_card=lambda obj: CommonRunCmd.static_check_param_card, + run_card_scan=False, + run_card_input= lambda obj: pjoin(obj.me_dir, 'Cards', 'run_card.dat'), + run_card_iteratorclass=banner_mod.RunCardIterator, ): """ This is a decorator for customizing/using scan over the param_card (or technically other) This should be use like this: @@ -7678,7 +7792,60 @@ def __enter__(self): def __exit__(self, ctype, value, traceback ): self.iterator.write(self.path) - def decorator(original_fct): + def scan_over_run_card(original_fct, obj, *args, **opts): + + if isinstance(input_path, str): + card_path = run_card_input + else: + card_path = run_card_input(obj) + + run_card_iterator = run_card_iteratorclass(card_path) + orig_card = copy.deepcopy(run_card_iterator.run_card) + if not run_card_iterator.run_card.scan_set: + return original_fct(obj, *args, **opts) + + + with restore_iterator(orig_card, card_path): + # this with statement ensure that the original card is restore + # whatever happens inside those block + + if not hasattr(obj, 'allow_notification_center'): + obj.allow_notification_center = False + with misc.TMP_variable(obj, 'allow_notification_center', False): + orig_name = get_run_name(obj) + if not orig_name and args[1]: + orig_name = args[1][0] + args = (args[0], args[1][1:]) + #orig_name = "scan_%s" % len(obj.results) + + try: + os.mkdir(pjoin(obj.me_dir, 'Events', orig_name)) + except Exception: + pass + next_name = orig_name + "_00" + + for i,card in enumerate(run_card_iterator): + card.write(card_path) + # still have to check for the auto-wdith + #if i !=0: + next_name = run_card_iterator.get_next_name(next_name) + set_run_name(obj)(next_name) + try: + original_fct(obj, *args, **opts) + except ignoreerror as error: + run_card_iterator.store_entry(next_name, {'exception': error}) + else: + run_card_iterator.store_entry(next_name, store_for_scan(obj)(), run_card_path=card_path) + + #param_card_iterator.write(card_path) #-> this is done by the with statement + name = misc.get_scan_name(orig_name, next_name) + path = result_path(obj) % name + logger.info("write scan results in %s" % path ,'$MG:BOLD') + order = summaryorder(obj)() + run_card_iterator.write_summary(path, order=order) + + + def decorator(original_fct): def new_fct(obj, *args, **opts): if isinstance(input_path, str): @@ -7702,8 +7869,13 @@ def new_fct(obj, *args, **opts): if not param_card_iterator: #first run of the function - original_fct(obj, *args, **opts) - return + if run_card_scan: + scan_over_run_card(original_fct, obj, *args, **opts) + return + else: + #first run of the function + original_fct(obj, *args, **opts) + return with restore_iterator(param_card_iterator, card_path): # this with statement ensure that the original card is restore diff --git a/epochX/cudacpp/gg_ttg.mad/bin/internal/extended_cmd.py b/epochX/cudacpp/gg_ttg.mad/bin/internal/extended_cmd.py index 2f37070580..789976beee 100755 --- a/epochX/cudacpp/gg_ttg.mad/bin/internal/extended_cmd.py +++ b/epochX/cudacpp/gg_ttg.mad/bin/internal/extended_cmd.py @@ -624,12 +624,12 @@ def complete(self, text, state): compfunc = self.completenames # correct wrong splittion with '\ ' - if line and begidx > 2 and line[begidx-2:begidx] == '\ ': + if line and begidx > 2 and line[begidx-2:begidx] == r'\ ': Ntext = line.split(os.path.sep)[-1] - self.completion_prefix = Ntext.rsplit('\ ', 1)[0] + '\ ' + self.completion_prefix = Ntext.rsplit(r'\ ', 1)[0] + r'\ ' to_rm = len(self.completion_prefix) - 1 Nbegidx = len(line.rsplit(os.path.sep, 1)[0]) + 1 - data = compfunc(Ntext.replace('\ ', ' '), line, Nbegidx, endidx) + data = compfunc(Ntext.replace(r'\ ', ' '), line, Nbegidx, endidx) self.completion_matches = [p[to_rm:] for p in data if len(p)>to_rm] # correct wrong splitting with '-'/"=" @@ -742,7 +742,7 @@ def path_completion(text, base_dir = None, only_dirs = False, completion += [prefix + f for f in ['.'+os.path.sep, '..'+os.path.sep] if \ f.startswith(text) and not prefix.startswith('.')] - completion = [a.replace(' ','\ ') for a in completion] + completion = [a.replace(' ',r'\ ') for a in completion] return completion @@ -1253,7 +1253,7 @@ def check_answer_in_input_file(self, question_instance, default, path=False, lin return possibility[0] if '=' in line and ' ' in line.strip(): leninit = len(line) - line,n = re.subn('\s*=\s*','=', line) + line,n = re.subn(r'\s*=\s*','=', line) if n and len(line) != leninit: return self.check_answer_in_input_file(question_instance, default, path=path, line=line) @@ -1311,7 +1311,7 @@ def nice_error_handling(self, error, line): if os.path.exists(self.debug_output): os.remove(self.debug_output) try: - super(Cmd,self).onecmd('history %s' % self.debug_output.replace(' ', '\ ')) + super(Cmd,self).onecmd('history %s' % self.debug_output.replace(' ', r'\ ')) except Exception as error: logger.error(error) @@ -2001,6 +2001,7 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): text = "" has_mg5_path = False # Use local configuration => Need to update the path + already_written = set() for line in open(basefile): if '=' in line: data, value = line.split('=',1) @@ -2018,9 +2019,12 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): comment = '' if key in to_keep: value = str(to_keep[key]) - else: + elif line not in already_written: + already_written.add(line) text += line continue + else: + continue if key == 'mg5_path': has_mg5_path = True try: @@ -2032,14 +2036,20 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): # check if absolute path if not os.path.isabs(value): value = os.path.realpath(os.path.join(basedir, value)) - text += '%s = %s # %s \n' % (key, value, comment) + new_line = '%s = %s # %s \n' % (key, value, comment) + if new_line not in already_written: + text += new_line + already_written.add(new_line) for key in to_write: if key in to_keep: - text += '%s = %s \n' % (key, to_keep[key]) + new_line = '%s = %s \n' % (key, to_keep[key]) + if new_line not in already_written: + text += new_line if not MADEVENT and not has_mg5_path: - text += """\n# MG5 MAIN DIRECTORY\n""" - text += "mg5_path = %s\n" % MG5DIR + if "mg5_path = %s\n" % MG5DIR not in already_written: + text += """\n# MG5 MAIN DIRECTORY\n""" + text += "mg5_path = %s\n" % MG5DIR writer = open(filepath,'w') writer.write(text) @@ -2190,7 +2200,7 @@ def onecmd(self, line, **opt): raise def reask(self, reprint_opt=True): - pat = re.compile('\[(\d*)s to answer\]') + pat = re.compile(r'\[(\d*)s to answer\]') prev_timer = signal.alarm(0) # avoid timer if any if prev_timer: @@ -2991,7 +3001,7 @@ def question_formatting(self, nb_col = 80, lpotential_switch=0, lnb_key=0, key=None): - """should return four lines: + r"""should return four lines: 1. The upper band (typically /========\ 2. The lower band (typically \========/ 3. The line without conflict | %(nb)2d. %(descrip)-20s %(name)5s = %(switch)-10s | @@ -3239,13 +3249,13 @@ def create_question(self, help_text=True): data_to_format['conflict_switch'] = self.color_for_value(key,self.inconsistent_keys[key], consistency=False) if hidden_line: - f2 = re.sub('%(\((?:name|descrip|add_info)\)-?)(\d+)s', + f2 = re.sub(r'%(\((?:name|descrip|add_info)\)-?)(\d+)s', lambda x: '%%%s%ds' % (x.group(1),int(x.group(2))+9), f2) text.append(f2 % data_to_format) elif hidden_line: if not f3: - f3 = re.sub('%(\((?:name|descrip|add_info)\)-?)(\d+)s', + f3 = re.sub(r'%(\((?:name|descrip|add_info)\)-?)(\d+)s', lambda x: '%%%s%ds' % (x.group(1),int(x.group(2))+9), f1) text.append(f3 % data_to_format) diff --git a/epochX/cudacpp/gg_ttg.mad/bin/internal/file_writers.py b/epochX/cudacpp/gg_ttg.mad/bin/internal/file_writers.py index 41bff05276..526756129f 100755 --- a/epochX/cudacpp/gg_ttg.mad/bin/internal/file_writers.py +++ b/epochX/cudacpp/gg_ttg.mad/bin/internal/file_writers.py @@ -36,10 +36,10 @@ class FileWriter(io.FileIO): supported_preprocessor_commands = ['if'] preprocessor_command_re=re.compile( - "\s*(?P%s)\s*\(\s*(?P.*)\s*\)\s*{\s*"\ + r"\s*(?P%s)\s*\(\s*(?P.*)\s*\)\s*{\s*"\ %('|'.join(supported_preprocessor_commands))) preprocessor_endif_re=re.compile(\ - "\s*}\s*(?Pelse)?\s*(\((?P.*)\))?\s*(?P{)?\s*") + r"\s*}\s*(?Pelse)?\s*(\((?P.*)\))?\s*(?P{)?\s*") class FileWriterError(IOError): """Exception raised if an error occurs in the definition @@ -191,15 +191,15 @@ class FortranWriterError(FileWriter.FileWriterError): pass # Parameters defining the output of the Fortran writer - keyword_pairs = {'^if.+then\s*$': ('^endif', 2), - '^type(?!\s*\()\s*.+\s*$': ('^endtype', 2), - '^do(?!\s+\d+)\s+': ('^enddo\s*$', 2), - '^subroutine': ('^end\s*$', 0), - '^module': ('^end\s*$', 0), - 'function': ('^end\s*$', 0)} - single_indents = {'^else\s*$':-2, - '^else\s*if.+then\s*$':-2} - number_re = re.compile('^(?P\d+)\s+(?P.*)') + keyword_pairs = {r'^if.+then\s*$': ('^endif', 2), + r'^type(?!\s*\()\s*.+\s*$': ('^endtype', 2), + r'^do(?!\s+\d+)\s+': (r'^enddo\s*$', 2), + '^subroutine': (r'^end\s*$', 0), + '^module': (r'^end\s*$', 0), + 'function': (r'^end\s*$', 0)} + single_indents = {r'^else\s*$':-2, + r'^else\s*if.+then\s*$':-2} + number_re = re.compile(r'^(?P\d+)\s+(?P.*)') line_cont_char = '$' comment_char = 'c' uniformcase = True #force everyting to be lower/upper case @@ -212,7 +212,7 @@ class FortranWriterError(FileWriter.FileWriterError): # Private variables __indent = 0 __keyword_list = [] - __comment_pattern = re.compile(r"^(\s*#|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|!)", re.IGNORECASE) + __comment_pattern = re.compile(r"^(\s*#|c\$|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|\s*!|!\$)", re.IGNORECASE) __continuation_line = re.compile(r"(?: )[$&]") def write_line(self, line): @@ -424,26 +424,20 @@ def count_number_of_quotes(self, line): i = i + 1 return len(splitline)-1 - def remove_routine(self, text, fct_names, formatting=True): - """write the incoming text but fully removing the associate routine/function - text can be a path to a file, an iterator, a string - fct_names should be a list of functions to remove + @staticmethod + def get_routine(text, fct_names, call_back=None): + """ + get the fortran function from a fortran file """ - f77_type = ['real*8', 'integer', 'double precision', 'logical'] - pattern = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I) - + + if isinstance(text, str): + text = text.split('\n') + + to_write=False removed = [] - if isinstance(text, str): - if '\n' in text: - text = text.split('\n') - else: - text = open(text) - if isinstance(fct_names, str): - fct_names = [fct_names] - - to_write=True for line in text: fct = pattern.findall(line) if fct: @@ -451,22 +445,38 @@ def remove_routine(self, text, fct_names, formatting=True): to_write = False else: to_write = True - if to_write: - if formatting: - if line.endswith('\n'): - line = line[:-1] - self.writelines(line) - else: - if not line.endswith('\n'): - line = '%s\n' % line - super(FileWriter,self).writelines(line) + if call_back: + call_back(line) else: removed.append(line) - + return removed + + def remove_routine(self, text, fct_names, formatting=True): + """write the incoming text but fully removing the associate routine/function + text can be a path to a file, an iterator, a string + fct_names should be a list of functions to remove + """ + + def call_back(line): + if formatting: + if line.endswith('\n'): + line = line[:-1] + self.writelines(line) + else: + if not line.endswith('\n'): + line = '%s\n' % line + super(FileWriter,self).writelines(line) + + return self.get_routine(text, fct_names, call_back) + +class FortranWriter90(FortranWriter): + + comment_char = ' !' + #=============================================================================== # CPPWriter #=============================================================================== @@ -497,50 +507,50 @@ class CPPWriterError(FileWriter.FileWriterError): '^private': standard_indent, '^protected': standard_indent} - spacing_patterns = [ - ('\s*\"\s*}', '\"'), - ('\s*,\s*', ', '), - ('\s*-\s*', ' - '), - ('([{(,=])\s*-\s*', '\g<1> -'), - ('(return)\s*-\s*', '\g<1> -'), - ('\s*\+\s*', ' + '), - ('([{(,=])\s*\+\s*', '\g<1> +'), - ('\(\s*', '('), - ('\s*\)', ')'), - ('\{\s*', '{'), - ('\s*\}', '}'), - ('\s*=\s*', ' = '), - ('\s*>\s*', ' > '), - ('\s*<\s*', ' < '), - ('\s*!\s*', ' !'), - ('\s*/\s*', '/'), - ('(?\s+>\s*', ' >> '), - ('<\s*double\s*>>\s*', ' > '), - ('\s*<\s+<\s*', ' << '), - ('\s*-\s+>\s*', '->'), - ('\s*=\s+=\s*', ' == '), - ('\s*!\s+=\s*', ' != '), - ('\s*>\s+=\s*', ' >= '), - ('\s*<\s+=\s*', ' <= '), - ('\s*&&\s*', ' && '), - ('\s*\|\|\s*', ' || '), - ('\s*{\s*}', ' {}'), - ('\s*;\s*', '; '), - (';\s*\}', ';}'), - (';\s*$}', ';'), - ('\s*<\s*([a-zA-Z0-9]+?)\s*>', '<\g<1>>'), - ('^#include\s*<\s*(.*?)\s*>', '#include <\g<1>>'), - ('(\d+\.{0,1}\d*|\.\d+)\s*[eE]\s*([+-]{0,1})\s*(\d+)', - '\g<1>e\g<2>\g<3>'), - ('\s+',' '), - ('^\s*#','#')] + spacing_patterns = [(r'\s*\"\s*}', '\"'), + (r'\s*,\s*', ', '), + (r'\s*-\s*', ' - '), + (r'([{(,=])\s*-\s*', r'\g<1> -'), + (r'(return)\s*-\s*', r'\g<1> -'), + (r'\s*\+\s*', ' + '), + (r'([{(,=])\s*\+\s*', r'\g<1> +'), + (r'\(\s*', '('), + (r'\s*\)', ')'), + (r'\{\s*', '{'), + (r'\s*\}', '}'), + (r'\s*=\s*', ' = '), + (r'\s*>\s*', ' > '), + (r'\s*<\s*', ' < '), + (r'\s*!\s*', ' !'), + (r'\s*/\s*', '/'), + (r'\s*\*\s*', ' * '), + (r'\s*-\s+-\s*', '-- '), + (r'\s*\+\s+\+\s*', '++ '), + (r'\s*-\s+=\s*', ' -= '), + (r'\s*\+\s+=\s*', ' += '), + (r'\s*\*\s+=\s*', ' *= '), + (r'\s*/=\s*', ' /= '), + (r'\s*>\s+>\s*', ' >> '), + (r'<\s*double\s*>>\s*', ' > '), + (r'\s*<\s+<\s*', ' << '), + (r'\s*-\s+>\s*', '->'), + (r'\s*=\s+=\s*', ' == '), + (r'\s*!\s+=\s*', ' != '), + (r'\s*>\s+=\s*', ' >= '), + (r'\s*<\s+=\s*', ' <= '), + (r'\s*&&\s*', ' && '), + (r'\s*\|\|\s*', ' || '), + (r'\s*{\s*}', ' {}'), + (r'\s*;\s*', '; '), + (r';\s*\}', ';}'), + (r';\s*$}', ';'), + (r'\s*<\s*([a-zA-Z0-9]+?)\s*>', r'<\g<1>>'), + (r'^#include\s*<\s*(.*?)\s*>', r'#include <\g<1>>'), + (r'(\d+\.{0,1}\d*|\.\d+)\s*[eE]\s*([+-]{0,1})\s*(\d+)', + r'\g<1>e\g<2>\g<3>'), + (r'\s+',' '), + (r'^\s*#','#')] + spacing_re = dict([(key[0], re.compile(key[0])) for key in \ spacing_patterns]) diff --git a/epochX/cudacpp/gg_ttg.mad/bin/internal/gen_crossxhtml.py b/epochX/cudacpp/gg_ttg.mad/bin/internal/gen_crossxhtml.py index d58ec573bc..681bf9d09b 100755 --- a/epochX/cudacpp/gg_ttg.mad/bin/internal/gen_crossxhtml.py +++ b/epochX/cudacpp/gg_ttg.mad/bin/internal/gen_crossxhtml.py @@ -648,7 +648,7 @@ def recreate(self, banner): if run_card['ickkw'] != 0: #parse the file to have back the information pythia_log = misc.BackRead(pjoin(path, '%s_pythia.log' % tag)) - pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") + pythiare = re.compile(r"\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") for line in pythia_log: info = pythiare.search(line) if not info: @@ -1623,7 +1623,7 @@ def get_html(self, runresults): elif self.debug: text = str(self.debug).replace('. ','.
') if 'http' in text: - pat = re.compile('(http[\S]*)') + pat = re.compile(r'(http[\S]*)') text = pat.sub(r' here ', text) debug = '
%s
%s
' % \ (self.debug.__class__.__name__, text) diff --git a/epochX/cudacpp/gg_ttg.mad/bin/internal/gen_ximprove.py b/epochX/cudacpp/gg_ttg.mad/bin/internal/gen_ximprove.py index c86da36a05..415ecc9de0 100755 --- a/epochX/cudacpp/gg_ttg.mad/bin/internal/gen_ximprove.py +++ b/epochX/cudacpp/gg_ttg.mad/bin/internal/gen_ximprove.py @@ -158,8 +158,11 @@ def get_helicity(self, to_submit=True, clean=True): (stdout, _) = p.communicate(''.encode()) stdout = stdout.decode('ascii',errors='ignore') if stdout: - nb_channel = max([math.floor(float(d)) for d in stdout.split()]) + lines = stdout.strip().split('\n') + nb_channel = max([math.floor(float(d)) for d in lines[-1].split()]) else: + if os.path.exists(pjoin(self.me_dir, 'error')): + os.remove(pjoin(self.me_dir, 'error')) for matrix_file in misc.glob('matrix*orig.f', Pdir): files.cp(matrix_file, matrix_file.replace('orig','optim')) P_zero_result.append(Pdir) @@ -297,12 +300,14 @@ def get_helicity(self, to_submit=True, clean=True): bad_amps_perhel = [] if __debug__: mtext = open(matrix_file).read() - nb_amp = int(re.findall('PARAMETER \(NGRAPHS=(\d+)\)', mtext)[0]) - logger.debug('nb_hel: %s zero amp: %s bad_amps_hel: %s/%s', len(good_hels),len(bad_amps),len(bad_amps_perhel), len(good_hels)*nb_amp ) + nb_amp = int(re.findall(r'PARAMETER \(NGRAPHS=(\d+)\)', mtext)[0]) + logger.debug('(%s) nb_hel: %s zero amp: %s bad_amps_hel: %s/%s', split_file[-1], len(good_hels),len(bad_amps),len(bad_amps_perhel), len(good_hels)*nb_amp ) if len(good_hels) == 1: files.cp(matrix_file, matrix_file.replace('orig','optim')) continue # avoid optimization if onlye one helicity - recycler = hel_recycle.HelicityRecycler(good_hels, bad_amps, bad_amps_perhel) + + gauge = self.cmd.proc_characteristics['gauge'] + recycler = hel_recycle.HelicityRecycler(good_hels, bad_amps, bad_amps_perhel, gauge=gauge) # In case of bugs you can play around with these: recycler.hel_filt = self.run_card['hel_filtering'] recycler.amp_splt = self.run_card['hel_splitamp'] @@ -1299,7 +1304,7 @@ def get_job_for_event(self): 'script_name': 'unknown', 'directory': C.name, # need to be change for splitted job 'P_dir': C.parent_name, - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # needed for RO gridpack 'offset': 1, # need to be change for splitted job 'nevents': nevents, 'maxiter': self.max_iter, @@ -1387,7 +1392,7 @@ def create_ajob(self, template, jobs, write_dir=None): break info = jobs[j] info['script_name'] = 'ajob%i' % script_number - info['keeplog'] = 'false' + info['keeplog'] = 'false' if self.run_card['keep_log'] != 'debug' else 'true' if "base_directory" not in info: info["base_directory"] = "./" fsock.write(template_text % info) @@ -1456,7 +1461,7 @@ def get_job_for_precision(self): 'script_name': 'unknown', 'directory': C.name, # need to be change for splitted job 'P_dir': C.parent_name, - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # used for RO gridpack 'offset': 1, # need to be change for splitted job 'nevents': nevents, 'maxiter': self.max_iter, @@ -1916,7 +1921,7 @@ def get_job_for_event(self): 'directory': C.name, # need to be change for splitted job 'P_dir': os.path.basename(C.parent_name), 'offset': 1, # need to be change for splitted job - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # use for RO gridpack 'nevents': nevents, #int(nevents*self.gen_events_security)+1, 'maxiter': self.max_iter, 'miniter': self.min_iter, diff --git a/epochX/cudacpp/gg_ttg.mad/bin/internal/hel_recycle.py b/epochX/cudacpp/gg_ttg.mad/bin/internal/hel_recycle.py index dfa45d5d20..6c86611f68 100755 --- a/epochX/cudacpp/gg_ttg.mad/bin/internal/hel_recycle.py +++ b/epochX/cudacpp/gg_ttg.mad/bin/internal/hel_recycle.py @@ -383,7 +383,7 @@ def get_number(cls, *args): class HelicityRecycler(): '''Class for recycling helicity''' - def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[]): + def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[], gauge='U'): External.good_hel = [] External.nhel_lines = '' @@ -427,6 +427,7 @@ def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[]): self.all_hel = [] self.hel_filt = True + self.gauge = gauge def set_input(self, file): if 'born_matrix' in file: @@ -612,7 +613,7 @@ def unfold_helicities(self, line, nature): def apply_amps(self, line, new_objs): if self.amp_splt: - return split_amps(line, new_objs) + return split_amps(line, new_objs, gauge=self.gauge) else: return apply_args(line, [i.args for i in new_objs]) @@ -785,7 +786,7 @@ def apply_args(old_line, all_the_args): return ''.join(new_lines) -def split_amps(line, new_amps): +def split_amps(line, new_amps, gauge): if not new_amps: return '' fct = line.split('(',1)[0].split('_0')[0] @@ -841,34 +842,31 @@ def split_amps(line, new_amps): spin = fct.split(None,1)[1][to_remove] lines.append('%sP1N_%s(%s)' % (fct, to_remove+1, ', '.join(args))) - hel, iamp = re.findall('AMP\((\d+),(\d+)\)', amp_result)[0] + hel, iamp = re.findall(r'AMP\((\d+),(\d+)\)', amp_result)[0] hel_calculated.append(hel) #lines.append(' %(result)s = TMP(3) * W(3,%(w)s) + TMP(4) * W(4,%(w)s)+' # % {'result': amp_result, 'w': windex}) #lines.append(' & TMP(5) * W(5,%(w)s)+TMP(6) * W(6,%(w)s)' # % {'result': amp_result, 'w': windex}) - if spin in "VF": - lines.append(""" call CombineAmp(%(nb)i, - & (/%(hel_list)s/), - & (/%(w_list)s/), - & TMP, W, AMP(1,%(iamp)s))""" % - {'nb': len(sub_amps), - 'hel_list': ','.join(hel_calculated), - 'w_list': ','.join(windices), - 'iamp': iamp - }) + if spin == "F" or ( spin == "V" and gauge !='FD'): + suffix = '' elif spin == "S": - lines.append(""" call CombineAmpS(%(nb)i, - &(/%(hel_list)s/), - & (/%(w_list)s/), - & TMP, W, AMP(1,%(iamp)s))""" % - {'nb': len(sub_amps), - 'hel_list': ','.join(hel_calculated), - 'w_list': ','.join(windices), - 'iamp': iamp - }) + suffix = 'S' + elif spin == "V" and gauge == "FD": + suffix = "FD" else: - raise Exception("split amp are not supported for spin2 and 3/2") + raise Exception("split amp not supported for spin2, 3/2") + + lines.append(""" call CombineAmp%(suffix)s(%(nb)i, + & (/%(hel_list)s/), + & (/%(w_list)s/), + & TMP, W, AMP(1,%(iamp)s))""" % {'suffix':suffix, + 'nb': len(sub_amps), + 'hel_list': ','.join(hel_calculated), + 'w_list': ','.join(windices), + 'iamp': iamp + }) + #lines.append('') return '\n'.join(lines) diff --git a/epochX/cudacpp/gg_ttg.mad/bin/internal/histograms.py b/epochX/cudacpp/gg_ttg.mad/bin/internal/histograms.py index 98f22c4c3a..9931127f66 100755 --- a/epochX/cudacpp/gg_ttg.mad/bin/internal/histograms.py +++ b/epochX/cudacpp/gg_ttg.mad/bin/internal/histograms.py @@ -632,34 +632,34 @@ class HwU(Histogram): # than necessary because the HwU standard allows for spaces from within # the name of a weight weight_header_re = re.compile( - '&\s*(?P(\S|(\s(?!\s*(&|$))))+)(\s(?!(&|$)))*') + r'&\s*(?P(\S|(\s(?!\s*(&|$))))+)(\s(?!(&|$)))*') # ================================ # Histo weight specification RE's # ================================ # The start of a plot - histo_start_re = re.compile('^\s*\s*(?P\d+)\s*"\s*'+ - '(?P(\S|(\s(?!\s*")))+)\s*"\s*$') + histo_start_re = re.compile(r'^\s*\s*(?P\d+)\s*"\s*'+ + r'(?P(\S|(\s(?!\s*")))+)\s*"\s*$') # A given weight specifier - a_float_re = '[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' - histo_bin_weight_re = re.compile('(?P%s|NaN)'%a_float_re,re.IGNORECASE) - a_int_re = '[\+|-]?\d+' + a_float_re = r'[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' + histo_bin_weight_re = re.compile(r'(?P%s|NaN)'%a_float_re,re.IGNORECASE) + a_int_re = r'[\+|-]?\d+' # The end of a plot histo_end_re = re.compile(r'^\s*<\\histogram>\s*$') # A scale type of weight - weight_label_scale = re.compile('^\s*mur\s*=\s*(?P%s)'%a_float_re+\ - '\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) - weight_label_PDF = re.compile('^\s*PDF\s*=\s*(?P\d+)\s*$') - weight_label_PDF_XML = re.compile('^\s*pdfset\s*=\s*(?P\d+)\s*$') - weight_label_TMS = re.compile('^\s*TMS\s*=\s*(?P%s)\s*$'%a_float_re) - weight_label_alpsfact = re.compile('^\s*alpsfact\s*=\s*(?P%s)\s*$'%a_float_re, + weight_label_scale = re.compile(r'^\s*mur\s*=\s*(?P%s)'%a_float_re+\ + r'\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) + weight_label_PDF = re.compile(r'^\s*PDF\s*=\s*(?P\d+)\s*$') + weight_label_PDF_XML = re.compile(r'^\s*pdfset\s*=\s*(?P\d+)\s*$') + weight_label_TMS = re.compile(r'^\s*TMS\s*=\s*(?P%s)\s*$'%a_float_re) + weight_label_alpsfact = re.compile(r'^\s*alpsfact\s*=\s*(?P%s)\s*$'%a_float_re, re.IGNORECASE) - weight_label_scale_adv = re.compile('^\s*dyn\s*=\s*(?P%s)'%a_int_re+\ - '\s*mur\s*=\s*(?P%s)'%a_float_re+\ - '\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) - weight_label_PDF_adv = re.compile('^\s*PDF\s*=\s*(?P\d+)\s+(?P\S+)\s*$') + weight_label_scale_adv = re.compile(r'^\s*dyn\s*=\s*(?P%s)'%a_int_re+\ + r'\s*mur\s*=\s*(?P%s)'%a_float_re+\ + r'\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) + weight_label_PDF_adv = re.compile(r'^\s*PDF\s*=\s*(?P\d+)\s+(?P\S+)\s*$') class ParseError(MadGraph5Error): @@ -926,7 +926,7 @@ def get_HwU_source(self, print_header=True): res.append(' '.join('%+16.7e'%wgt for wgt in list(bin.boundaries))) res[-1] += ' '.join('%+16.7e'%bin.wgts[key] for key in self.bins.weight_labels if key not in ['central','stat_error']) - res.append('<\histogram>') + res.append(r'<\histogram>') return res def output(self, path=None, format='HwU', print_header=True): @@ -1149,6 +1149,8 @@ def parse_one_histo_from_stream(self, stream, all_weight_header, boundaries = [0.0,0.0] for j, weight in \ enumerate(HwU.histo_bin_weight_re.finditer(line_bin)): + if (j == len(weight_header)): + continue if j == len(all_weight_header): raise HwU.ParseError("There is more bin weights"+\ " specified than expected (%i)"%len(weight_header)) @@ -1803,7 +1805,7 @@ def parse_histos_from_PY8_XML_stream(self, stream, run_id=None, # Filter empty weights coming from the split weight_label_list = [wgt.strip() for wgt in str(selected_run_node.getAttribute('header')).split(';') if - not re.match('^\s*$',wgt)] + not re.match(r'^\s*$',wgt)] ordered_weight_label_list = [w for w in weight_label_list if w not\ in ['xmin','xmax']] # Remove potential repetition of identical weight labels @@ -1827,7 +1829,7 @@ def parse_histos_from_PY8_XML_stream(self, stream, run_id=None, all_weights = [] for wgt_position, wgt_label in \ enumerate(str(selected_run_node.getAttribute('header')).split(';')): - if not re.match('^\s*$',wgt_label) is None: + if not re.match(r'^\s*$',wgt_label) is None: continue all_weights.append({'POSITION':wgt_position}) for wgt_item in wgt_label.strip().split('_'): @@ -2714,7 +2716,7 @@ def ratio_no_correlations(wgtsA, wgtsB): # First the global gnuplot header for this histogram group global_header =\ -""" +r""" ################################################################################ ### Rendering of the plot titled '%(title)s' ################################################################################ @@ -2862,9 +2864,9 @@ def ratio_no_correlations(wgtsA, wgtsB): major_title = ', '.join(major_title) if not mu[0] in ['none',None]: - major_title += ', dynamical\_scale\_choice=%s'%mu[0] + major_title += r', dynamical\_scale\_choice=%s'%mu[0] if not pdf[0] in ['none',None]: - major_title += ', PDF=%s'%pdf[0].replace('_','\_') + major_title += ', PDF=%s'%pdf[0].replace('_',r'\_') # Do not show uncertainties for individual jet samples (unless first # or specified explicitely and uniquely) @@ -2937,7 +2939,7 @@ def ratio_no_correlations(wgtsA, wgtsB): plot_lines.append( "'%s' index %d using (($1+$2)/2):%d ls %d title '%s'"\ %(HwU_name,block_position+i,mu_var+3,color_index,\ -'%s dynamical\_scale\_choice=%s' % (title,mu[j]))) +r'%s dynamical\_scale\_choice=%s' % (title,mu[j]))) # And now PDF_variation if available if not PDF_var_pos is None: for j,PDF_var in enumerate(PDF_var_pos): @@ -2947,7 +2949,7 @@ def ratio_no_correlations(wgtsA, wgtsB): plot_lines.append( "'%s' index %d using (($1+$2)/2):%d ls %d title '%s'"\ %(HwU_name,block_position+i,PDF_var+3,color_index,\ -'%s PDF=%s' % (title,pdf[j].replace('_','\_')))) +'%s PDF=%s' % (title,pdf[j].replace('_',r'\_')))) # Now add the uncertainty lines, those not using a band so that they # are not covered by those using a band after we reverse plo_lines diff --git a/epochX/cudacpp/gg_ttg.mad/bin/internal/launch_plugin.py b/epochX/cudacpp/gg_ttg.mad/bin/internal/launch_plugin.py index 7b10bedcef..9ec09eb71d 100644 --- a/epochX/cudacpp/gg_ttg.mad/bin/internal/launch_plugin.py +++ b/epochX/cudacpp/gg_ttg.mad/bin/internal/launch_plugin.py @@ -98,6 +98,7 @@ def default_setup(self): self['vector_size'] = 16 # already setup in default class (just change value) self['aloha_flag'] = '--fast-math' self['matrix_flag'] = '-O3' + self['limhel'] = 0 self.display_block.append('simd') self.display_block.append('psoptim') 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 eee9ba4522..f6e47956cd 100755 --- a/epochX/cudacpp/gg_ttg.mad/bin/internal/lhe_parser.py +++ b/epochX/cudacpp/gg_ttg.mad/bin/internal/lhe_parser.py @@ -7,6 +7,7 @@ import numbers import math import time +import copy import os import shutil import sys @@ -101,7 +102,7 @@ def __init__(self, line=None, event=None): self.rwgt = 0 return - + self.event = event if event is not None: self.event_id = len(event) #not yet in the event @@ -1066,6 +1067,8 @@ def define_init_banner(self, wgt, lha_strategy, proc_charac=None): #special case for 1>N init_information = run_card.get_banner_init_information() event = next(self) + if not len(event): #if parse-momenta was false we have to parse the first event + event = Event(str(event)) init_information["idbmup1"] = event[0].pdg init_information["ebmup1"] = event[0].mass init_information["idbmup2"] = 0 @@ -1149,6 +1152,7 @@ def initialize_unweighting(self, getwgt, trunc_error): nb_keep = max(20, int(nb_event*trunc_error*15)) new_wgt = new_wgt[-nb_keep:] if nb_event == 0: + misc.sprint(i,f) raise Exception # store the information self.initial_nb_events[i] = nb_event @@ -1203,7 +1207,6 @@ def unweight(self, outputpath, get_wgt, **opts): (stop to write event when target is reached) """ - if isinstance(get_wgt, (str,six.text_type)): unwgt_name =get_wgt def get_wgt_multi(event): @@ -1483,12 +1486,12 @@ def reorder_mother_child(self): particle.mother2 -= 1 # re-call the function for the next potential change return self.reorder_mother_child() - - - - - + + + + + def parse_reweight(self): """Parse the re-weight information in order to return a dictionary {key: value}. If no group is define group should be '' """ @@ -1522,6 +1525,37 @@ def parse_nlo_weight(self, real_type=(1,11), threshold=None): threshold=threshold) return self.nloweight + def get_fks_pair(self, real_type=(1,11), threshold=None): + """ Gives the fks pair labels""" + start, stop = self.tag.find(''), self.tag.find('') + if start != -1 != stop: + text = self.tag[start+8:stop] + all_line = text.split('\n') + text = text.lower().replace('d','e') + all_line = text.split('\n') + for line in all_line: + data = line.split() + if len(data)>16: + wgt = OneNLOWeight(line, real_type=real_type) + return wgt.to_merge_pdg,wgt.nexternal + + def get_born_momenta(self,real_type=(1,11), threshold=None): + """ Gets the underlying n+1 body kinematics""" + start, stop = self.tag.find(''), self.tag.find('') + if start != -1 != stop: + text = self.tag[start+8:stop] + text = text.lower().replace('d','e') + all_line = text.split('\n') + for line in all_line: + data = line.split() + if len(data)>16: + wgt = OneNLOWeight(line, real_type=real_type) + nexternal = wgt.nexternal + real_momenta = all_line[2:2+nexternal] + return real_momenta + + + def rewrite_nlo_weight(self, wgt=None): """get the string associate to the weight""" @@ -1558,11 +1592,11 @@ def parse_lo_weight(self): return self.loweight if not hasattr(Event, 'loweight_pattern'): - Event.loweight_pattern = re.compile('''\s*(?P\d+)\s+(?P[\d.e+-]+)\s*\s*\n\s* - \s*(?P[\s\d.+-e]+)\s*\s*\n\s* - 1|2)["']?\>\s*(?P[\s\d.e+-]*)\s*\s*\n\s* - 1|2)["']?\>\s*(?P[\s\d.e+-]*)\s*\s*\n\s* - \s*(?P[\d.e+-]*)\s* + Event.loweight_pattern = re.compile('''\\s*(?P\\d+)\\s+(?P[\\d.e+-]+)\\s*\\s*\n\\s* + \\s*(?P[\\s\\d.+-e]+)\\s*\\s*\n\\s* + 1|2)["']?\\>\\s*(?P[\\s\\d.e+-]*)\\s*\\s*\n\\s* + 1|2)["']?\\>\\s*(?P[\\s\\d.e+-]*)\\s*\\s*\n\\s* + \\s*(?P[\\d.e+-]*)\\s* ''',re.X+re.I+re.M) start, stop = self.tag.find(''), self.tag.find('') @@ -1615,7 +1649,7 @@ def parse_matching_scale(self): self.matched_scale_data = [] - pattern = re.compile("") + pattern = re.compile(r"") data = re.split(pattern,self.tag) if len(data) == 1: return [] @@ -1623,7 +1657,7 @@ def parse_matching_scale(self): tmp = {} start,content, end = data self.tag = "%s%s" % (start, end) - pattern = re.compile("pt_clust_(\d*)=\"([\de+-.]*)\"") + pattern = re.compile("pt_clust_(\\d*)=\"([\\de+-.]*)\"") for id,value in pattern.findall(content): tmp[int(id)] = float(value) for i in range(1, len(self)+1): @@ -1647,7 +1681,7 @@ def parse_syscalc_info(self): return self.syscalc_data pattern = re.compile("|") - pattern2 = re.compile("<(?P[\w]*)(?:\s*(\w*)=[\"'](.*)[\"']\s*|\s*)>(.*)") + pattern2 = re.compile("<(?P[\\w]*)(?:\\s*(\\w*)=[\"'](.*)[\"']\\s*|\\s*)>(.*)") data = re.split(pattern,self.tag) if len(data) == 1: return [] @@ -1850,6 +1884,240 @@ def get_decay(self, pdg_code=0, event_id=None): return new_event + + def set_initial_mass_to_zero(self): + """set the masses of the initial particles to zero, by reshuffling the respective momenta + Works only in the **partonic** com frame, so the event must be boosted to such frame + before calling the function + """ + + if not misc.equal(self[0].px, 0) or not misc.equal(self[1].px, 0) or \ + not misc.equal(self[0].py, 0) or not misc.equal(self[1].py, 0) or \ + not misc.equal(self[0].pz, - self[1].pz, zero_limit=False): + misc.sprint(self[0]) + misc.sprint(self[1]) + raise Exception('momenta should be in the partonic center of mass frame') + + self[0].mass = 0. + self[1].mass = 0. + tot_E=0. + for ip,part in enumerate(self): + if part.status == 1 : + tot_E += part.E + if (self[0].pz > 0. and self[1].pz < 0): + self[0].set_momentum(FourMomentum([tot_E/2., 0., 0., tot_E/2.])) + self[1].set_momentum(FourMomentum([tot_E/2., 0., 0., -tot_E/2.])) + elif (self[0].pz < 0. and self[1].pz > 0): + self[0].set_momentum(FourMomentum([tot_E/2., 0., 0., -tot_E/2.])) + self[1].set_momentum(FourMomentum([tot_E/2., 0., 0., tot_E/2.])) + else: + logger.critical('ERROR: two incoming partons not back.-to-back') + + def set_final_jet_mass_to_zero(self): + """set the final light particle masses to zero + """ + + for ip,part in enumerate(self): + if ((abs(part.pid) <= 5) or (abs(part.pid) == 11) or (abs(part.pid) == 12)) and (part.status == 1): + part.mass = 0. + E_1_new = math.sqrt(part.mass**2 + part.px**2 + part.py**2 + part.pz**2) + part.set_momentum(FourMomentum([E_1_new, part.px, part.py, part.pz])) + + + + def merge_particles_kinematics(self, i,j, moth): + """Map to an underlying n-body kinematics for two given + particles i,j to be merged and a resulting moth""" + """ note! kinematics (and id) mapping only! """ + + recoil = True + fks_type = False + + if recoil and not fks_type: + if (i == moth[0].get('number')-1): + fks_i = i + fks_j = j + elif (j == moth[0].get('number')-1): + fks_i = j + fks_j = i + to_remove = fks_j + + merge_i = self[fks_i] + merge_j = self[fks_j] + + i_4mom = FourMomentum(merge_i) + j_4mom = FourMomentum(merge_j) + if (fks_i <= 1): + sign1 = -1.0 + else: + sign1 = 1.0 + mother_4mom = i_4mom + sign1*j_4mom + + new_event = copy.deepcopy(self) + + self[fks_i].pid = moth[0]['id'] + self[fks_i].set_momentum(mother_4mom) + + if fks_i <= 1: # initial-state recoil + new_p = FourMomentum() + for ip,part in enumerate(self): + if (ip != fks_i and ip != fks_j and ip >= 2): + new_p += part + + if fks_i == 0: + self[1].set_momentum(new_p - FourMomentum(self[0])) + elif fks_i == 1: + self[0].set_momentum(new_p - FourMomentum(self[1])) + + pz_1_new = self.recoil_eq(self[0],self[1]) + pz_2_new = self[0].pz + self[1].pz - pz_1_new + E_1_new = math.sqrt(self[0].mass**2 + self[0].px**2 + self[0].py**2 + pz_1_new **2) + E_2_new = math.sqrt(self[1].mass**2 + self[1].px**2 + self[1].py**2 + pz_2_new **2) + self[0].set_momentum(FourMomentum([E_1_new,self[0].px,self[0].py,pz_1_new])) + self[1].set_momentum(FourMomentum([E_2_new,self[1].px,self[1].py,pz_2_new])) + self.pop(to_remove) + + if fks_i > 1: # final-state recoil + + # Re-scale the energy of fks_i to make it on-shell + for ip,part in enumerate(self): + if (ip == fks_i): + part.E = math.sqrt(part.mass**2 + part.px**2 + part.py**2 + part.pz**2) + new_p.E = part.E + + # Find the overall energy in the final state + new_p.E = 0.0 + for ip,part in enumerate(self): + if (ip != fks_j and ip >= 2): + new_p.E += part.E + + # Use one of the initial states to absorb the energy change in the final state + self[1].set_momentum(FourMomentum([new_p.E-self[0].E,self[1].px,self[1].py,self[1].pz])) + + # Change the initial state pz and E + pz_1_new = self.recoil_eq(self[0],self[1]) + pz_2_new = self[0].pz + self[1].pz - pz_1_new + E_1_new = math.sqrt(self[0].mass**2 + self[0].px**2 + self[0].py**2 + pz_1_new **2) + E_2_new = math.sqrt(self[1].mass**2 + self[1].px**2 + self[1].py**2 + pz_2_new **2) + self[0].set_momentum(FourMomentum([E_1_new,self[0].px,self[0].py,pz_1_new])) + self[1].set_momentum(FourMomentum([E_2_new,self[1].px,self[1].py,pz_2_new])) + self.pop(to_remove) + + elif fks_type and not recoil: + ## Do it in a more FKS-style + if (i == moth[0].get('number')-1): + fks_i = i + fks_j = j + elif (j == moth[0].get('number')-1): + fks_i = j + fks_j = i + to_remove = fks_j + new_event = copy.copy(event) + + if fks_i <= 1: # initial-state recoil + + # First boost to partonic CM frame + q = FourMomentum(self[0])+FourMomentum(self[1]) + for ip,part in enumerate(self): + vec = FourMomentum(part) + self[ip].set_momentum(vec.zboost(pboost=q)) + + k_tot = FourMomentum([self[0].E+self[1].E-self[fks_j].E,self[0].px+self[1].px-self[fks_j].px,\ + self[0].py+self[1].py-self[fks_j].py,self[0].pz+self[1].pz-self[fks_j].pz]) + + final = FourMomentum([0,0,0,0]) + for ip,part in enumerate(self): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + if (ip != fks_i and ip != fks_j and ip >= 2): + final = final + vec + + s = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz])**2 + ksi = self[fks_j].E/(math.sqrt(s)/2.0) + y = self[fks_j].pz/self[fks_j].E + + self[0].pz = self[0].pz * math.sqrt(1.0-ksi)*math.sqrt((2.0-ksi*(1.0+y))/((2.0-ksi*(1.0-y)))) + self[0].E = math.sqrt(self[0].mass**2 + self[0].pz**2) + self[1].pz = self[1].pz * math.sqrt(1.0-ksi)*math.sqrt((2.0-ksi*(1.0-y))/((2.0-ksi*(1.0+y)))) + self[1].E = math.sqrt(self[1].mass**2 + self[1].pz**2) + + final = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + k_tot_1 = k_tot.zboost(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + k_tot_2 = k_tot_1.pt_boost(pboost=FourMomentum([k_tot_1.E,k_tot_1.px,k_tot_1.py,k_tot_1.pz])) + k_tot_3 = k_tot_2.zboost_inv(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + + for ip,part in enumerate(self): + if (ip >= 2): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + vec2 = vec.zboost(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + vec3 = vec2.pt_boost(pboost=FourMomentum([k_tot_1.E,k_tot_1.px,k_tot_1.py,k_tot_1.pz])) + vec_new = vec3.zboost_inv(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + self[ip].set_momentum(FourMomentum([vec_new.E,vec_new.px,vec_new.py,vec_new.pz])) + + self.pop(to_remove) + + else: # final-state recoil + q = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + for ip,part in enumerate(self): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + self[ip].set_momentum(vec.zboost(pboost=q)) + + q = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + k = FourMomentum([self[fks_i].E+self[fks_j].E,self[fks_i].px+self[fks_j].px,\ + self[fks_i].py+self[fks_j].py,self[fks_i].pz+self[fks_j].pz]) + + k_rec = FourMomentum([0,0,0,0]) + for ip,part in enumerate(self): + if ip >= 2 and ip != fks_i and ip != fks_j: # add only final-states to the recoil and not the FKS pair + k_rec = k_rec + FourMomentum([part.E,part.px,part.py,part.pz]) + + k_mom = math.sqrt(k_rec.px**2 + k_rec.py**2 + k_rec.pz**2) + beta = (q**2 - (k_rec.E+k_mom)**2)/(q**2 + (k_rec.E+k_mom)**2) + for ip,part in enumerate(self): + if ip >= 2 and ip != fks_i and ip != fks_j: + vec = FourMomentum([self[ip].E,self[ip].px,self[ip].py,self[ip].pz]) + self[ip].set_momentum(vec.boost_beta(beta,k_rec)) + if ip == fks_i: + self[ip].set_momentum(q - k_rec.boost_beta(beta,k_rec)) + self.pop(to_remove) + else: + logger.info('Error in Sudakov Born mapping: no recoil scheme found!') + + def recoil_eq(self,part1, part2): + """ In general, solves the equation + E1 + E2 = K + p1 + p2 = c + E1^2 - p1^2 = a + E2^2 - p2^2 = b + and returns p1 + """ + thresh = 1e-6 + import random + a = part1.mass**2 + part1.px**2 + part1.py**2 + b = part2.mass**2 + part2.px**2 + part2.py**2 + c = part1.pz + part2.pz + K = part1.E + part2.E + K2 = K**2 + sol1 = (-a*c + b*c + c**3 - c*K2 - math.sqrt(K2*(a**2 + (b + c**2 - K2)**2 - 2*a*(b - c**2 + K2))))/(2*(c**2-K2)) + sol2 = (-a*c + b*c + c**3 - c*K2 + math.sqrt(K2*(a**2 + (b + c**2 - K2)**2 - 2*a*(b - c**2 + K2))))/(2*(c**2-K2)) + + if abs(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2) - (math.sqrt(a+sol2**2) + math.sqrt(b+(c-sol2)**2))) > thresh: + logger.critical('Error in recoil_eq solver 1') + logger.critical(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2)) + logger.critical(math.sqrt(a+sol2**2) + math.sqrt(b+(c-sol2)**2)) + if abs(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2) - K) > thresh: + logger.critical('Error in recoil_eq solver 2') + logger.critical(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2)) + logger.critical(K) + return sol1 + + def boost(self, filter=None): """modify the current event to boost it according to the current filter""" if filter is None: @@ -1861,7 +2129,7 @@ def boost(self, filter=None): if list(filter(p)): pboost += p else: - pboost = FourMomentum(pboost) + pboost = FourMomentum(filter) # change sign of three-component due to helas convention pboost.px *=-1 @@ -1877,7 +2145,7 @@ def check(self): """check various property of the events""" # check that relative error is under control - threshold = 1e-6 + threshold = 1e-4 #1. Check that the 4-momenta are conserved E, px, py, pz = 0,0,0,0 @@ -1920,7 +2188,50 @@ def check(self): self.check_color_structure() #3. check mass - + + def check_kinematics_only(self): + """check various property of the events - only kinematics""" + + # check that relative error is under control + threshold = 1e-3 + + #1. Check that the 4-momenta are conserved + E, px, py, pz = 0,0,0,0 + absE, abspx, abspy, abspz = 0,0,0,0 + for particle in self: + coeff = 1 + if particle.status == -1: + coeff = -1 + elif particle.status != 1: + continue + E += coeff * particle.E + absE += abs(particle.E) + px += coeff * particle.px + py += coeff * particle.py + pz += coeff * particle.pz + abspx += abs(particle.px) + abspy += abs(particle.py) + abspz += abs(particle.pz) + # check mass + fourmass = FourMomentum(particle).mass + + if particle.mass and (abs(particle.mass) - fourmass)/ abs(particle.mass) > threshold: + logger.critical(self) + raise Exception( "Do not have correct mass lhe: %s momentum: %s (error at %s" % (particle.mass, fourmass, (abs(particle.mass) - fourmass)/ abs(particle.mass))) + + if abs(E/absE) > threshold: + logger.critical(self) + raise Exception("Do not conserve Energy %s, %s" % (E/absE, E)) + if abs(px/abspx) > threshold: + logger.critical(self) + raise Exception("Do not conserve Px %s, %s" % (px/abspx, px)) + if abs(py/abspy) > threshold: + logger.critical(self) + raise Exception("Do not conserve Py %s, %s" % (py/abspy, py)) + if abs(pz/abspz) > threshold: + logger.critical(self) + raise Exception("Do not conserve Pz %s, %s" % (pz/abspz, pz)) + def assign_scale_line(self, line, convert=True): """read the line corresponding to global event line @@ -2764,7 +3075,7 @@ def zboost(self, pboost=None, E=0, pz=0): if isinstance(pboost, FourMomentum): E = pboost.E pz = pboost.pz - + #beta = pz/E gamma = E / math.sqrt(E**2-pz**2) gammabeta = pz / math.sqrt(E**2-pz**2) @@ -2778,6 +3089,74 @@ def zboost(self, pboost=None, E=0, pz=0): out.pz = 0 return out + def zboost_inv(self, pboost=None, E=0, pz=0): + """Both momenta should be in the same frame. + The boost perform correspond to the boost required to set pboost at + rest (only z boost applied). + """ + if isinstance(pboost, FourMomentum): + E = pboost.E + pz = pboost.pz + + #beta = pz/E + gamma = E / math.sqrt(E**2-pz**2) + gammabeta = pz / math.sqrt(E**2-pz**2) + + out = FourMomentum([gamma*self.E + gammabeta*self.pz, + self.px, + self.py, + gamma*self.pz + gammabeta*self.E]) + + if abs(out.pz) < 1e-6 * out.E: + out.pz = 0 + return out + + + def pt_boost(self, pboost=None, E=0, pz=0): + """Both momenta should be in the same frame. + The boost perform correspond to the boost required to set pboost at + rest (only pT boost applied). + """ + + if isinstance(pboost, FourMomentum): + E = pboost.E + px = pboost.px + py = pboost.py + mass = math.sqrt(E**2 - px**2 - py**2) + + betax = px/E + betay = py/E + beta = math.sqrt(betax**2+betay**2) + gamma = 1 / math.sqrt(1.0-beta**2) + + out = FourMomentum([gamma*self.E - gamma*betax*self.px - gamma*betay*self.py, + -gamma*betax*self.E + (1.0 + (gamma-1.0)*betax**2/(beta**2))*self.px + (gamma-1.0)*betax*betay/(beta**2)*self.py, + -gamma*betay*self.E + ((gamma-1.0)*betax*betay/(beta**2))*self.px + (1.0+(gamma-1.0)*(betay**2)/(beta**2))*self.py, + self.pz]) + + if abs(out.px) < 1e-6 * out.E: + out.px = 0 + if abs(out.py) < 1e-6 * out.E: + out.py = 0 + return out + + def boost_beta(self,beta,mom): + """ Boost along the three-momentum of mom with a boost of size beta""" + + unit = mom * (1.0/math.sqrt(mom.px**2+mom.py**2+mom.pz**2)) + beta_vec = beta*unit + bx = beta_vec.px + by = beta_vec.py + bz = beta_vec.pz + gamma = 1.0 / math.sqrt(1.0-beta**2) + + out = FourMomentum([gamma*self.E - gamma*bx*self.px - gamma*by*self.py - gamma*bz*self.pz, + -gamma*bx*self.E + (1.0 + (gamma-1.0)*bx**2/(beta**2))*self.px + (gamma-1.0)*bx*by/(beta**2)*self.py + (gamma-1.0)*bx*bz/(beta**2)*self.pz, + -gamma*by*self.E + ((gamma-1.0)*bx*by/(beta**2))*self.px + (1.0+(gamma-1.0)*(by**2)/(beta**2))*self.py + (gamma-1.0)*by*bz/(beta**2)*self.pz, + -gamma*bz*self.E + (gamma-1.0)*bx*bz/(beta**2)*self.px + (gamma-1.0)*(by*bz)/(beta**2)*self.py + (1.0+(gamma-1.0)*bz**2/(beta**2))*self.pz]) + + return out + def boost_to_restframe(self, pboost): """apply the boost transformation such that pboost is at rest in the new frame. First apply a rotation to allign the pboost to the z axis and then use @@ -2789,27 +3168,64 @@ def boost_to_restframe(self, pboost): return out - # write pboost as (E, p cosT sinF, p sinT sinF, p cosF) - # rotation such that it become (E, 0 , 0 , p ) is - # cosT sinF , -sinT , cosT sinF - # sinT cosF , cosT , sinT sinF - # -sinT , 0 , cosF - p = math.sqrt( pboost.px**2 + pboost.py**2+ pboost.pz**2) - cosF = pboost.pz / p - sinF = math.sqrt(1-cosF**2) - sinT = pboost.py/p/sinF - cosT = pboost.px/p/sinF - - out=FourMomentum([self.E, - self.px*cosT*cosF + self.py*sinT*cosF-self.pz*sinF, - -self.px*sinT+ self.py*cosT, - self.px*cosT*sinF + self.py*sinT*sinF + self.pz*cosF - ]) - out = out.zboost(E=pboost.E,pz=p) + # see here https://physics.stackexchange.com/questions/749036/general-lorentz-boost-of-four-momentum-in-cm-frame-particle-physics + vx = pboost.px/pboost.E + vy = pboost.py/pboost.E + vz = pboost.pz/pboost.E + v = pboost.norm/pboost.E + v2 = pboost.norm_sq/pboost.E**2 + gamma = 1./math.sqrt(1.-v**2) + gammo = gamma-1. + out = FourMomentum(E = gamma*(self.E - vx*self.px - vy*self.py - vz*self.pz), + px= -gamma*vx*self.E + (1+gammo*vx**2/v2)*self.px + gammo*vx*vy/v2*self.py + gammo*vx*vz/v2*self.pz, + py= -gamma*vy*self.E + gammo*vy*vx/v2*self.px + (1+gammo*vy**2/v2)*self.py + gammo*vy*vz/v2*self.pz, + pz= -gamma*vz*self.E + gammo*vz*vx/v2*self.px + gammo*vz*vy/v2*self.py + (1+gammo*vz**2/v2)*self.pz) + return out + def rotate_to_z(self,prot): + + import math + import numpy as np + + z = np.array([0.,0.,1.]) + + px = self.px + py = self.py + pz = self.pz + + refx = prot.px + refy = prot.py + refz = prot.pz + + prot_mom = np.array([px, py, pz]) + ref_mom = np.array([refx, refy, refz]) + + # Create normal vector + n = np.array([refy, -refx, 0.]) + n = n * 1./math.sqrt(self.threedot(n,n)) + t = prot_mom - self.threedot(n,prot_mom)*n + p = ref_mom - self.threedot(ref_mom,z)*z + p = p/math.sqrt(self.threedot(p,p)) + + t_pz = np.array([self.threedot(t,p), self.threedot(t,z), 0.]) + costheta = self.threedot(ref_mom,z)* 1./math.sqrt(self.threedot(ref_mom, ref_mom)) + sintheta=math.sqrt(1.-costheta**2) + + sgn = 1. + t_pz_p = np.array([0., 0., 0.]) + t_pz_p[0] = costheta*t_pz[0] + sgn*(-sintheta) * t_pz[1] + t_pz_p[1] = sgn*sintheta*t_pz[0] + costheta * t_pz[1] + + out_mom = self.threedot(n,prot_mom)*n + t_pz_p[0]*p + t_pz_p[1]*z + + out = FourMomentum([self.E,out_mom[0], out_mom[1], out_mom[2] ] ) + + return out - + def threedot(self,a,b): + + return a[0]*b[0]+a[1]*b[1]+a[2]*b[2] class OneNLOWeight(object): 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 2a118e21bf..8e30cf690c 100755 --- a/epochX/cudacpp/gg_ttg.mad/bin/internal/madevent_interface.py +++ b/epochX/cudacpp/gg_ttg.mad/bin/internal/madevent_interface.py @@ -496,7 +496,6 @@ def help_remove(self): logger.info(" the optional '-f' allows to by-pass all security question") logger.info(" The banner can be remove only if all files are removed first.") - class AskRun(cmd.ControlSwitch): """a class for the question on what to do on a madevent run""" @@ -2393,13 +2392,17 @@ def do_generate_events(self, line): # Check argument's validity mode = self.check_generate_events(args) switch_mode = self.ask_run_configuration(mode, args) - if not args: - # No run name assigned -> assigned one automaticaly - self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton') - else: - self.set_run_name(args[0], None, 'parton', True) - args.pop(0) - + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat'), consistency=False) + if not run_card.scan_set: + if not args: + # No run name assigned -> assigned one automaticaly + self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton') + else: + self.set_run_name(args[0], None, 'parton', True) + args.pop(0) + + self.run_generate_events(switch_mode, args) self.postprocessing() @@ -2560,7 +2563,7 @@ def wait_monitoring(Idle, Running, Done): self.update_status("postprocessing contur done", level="rivet") # this decorator handle the loop related to scan. - @common_run.scanparamcardhandling() + @common_run.scanparamcardhandling(run_card_scan=True) def run_generate_events(self, switch_mode, args): if self.proc_characteristics['loop_induced'] and self.options['run_mode']==0: @@ -2593,7 +2596,6 @@ def run_generate_events(self, switch_mode, args): # Regular run mode logger.info('Generating %s events with run name %s' % (self.run_card['nevents'], self.run_name)) - self.exec_cmd('survey %s %s' % (self.run_name,' '.join(args)), postcmd=False) nb_event = self.run_card['nevents'] @@ -2975,7 +2977,7 @@ def update_width_in_param_card(decay_info, initial=None, output=None): particle = 0 # Read BRs for this decay line = param_card[line_number] - while re.search('^(#|\s|\d)', line): + while re.search(r'^(#|\s|\d)', line): line = param_card.pop(line_number) if not particle or line.startswith('#'): line=param_card[line_number] @@ -3226,7 +3228,7 @@ def do_treatcards(self, line, mode=None, opt=None): for line in open(pjoin(bias_module_path,'%s.f'%os.path.basename(bias_module_path))): if start and last: break - if not start and not re.search('c\s*parameters\s*=\s*{',line, re.I): + if not start and not re.search(r'c\s*parameters\s*=\s*{',line, re.I): continue start = True if not line.startswith('C'): @@ -3235,7 +3237,7 @@ def do_treatcards(self, line, mode=None, opt=None): if '{' in line: line = line.split('{')[-1] # split for } ! # - split_result = re.split('(\}|!|\#)', line,1, re.M) + split_result = re.split(r'(\}|!|\#)', line,1, re.M) line = split_result[0] sep = split_result[1] if len(split_result)>1 else None if sep == '}': @@ -3514,8 +3516,8 @@ def pass_in_difficult_integration_mode(self, rate=1): text = open(conf_path).read() min_evt, max_evt = 2500 *(2+rate), 10000*(rate+1) - text = re.sub('''\(min_events = \d+\)''', '(min_events = %i )' % min_evt, text) - text = re.sub('''\(max_events = \d+\)''', '(max_events = %i )' % max_evt, text) + text = re.sub(r'''\(min_events = \d+\)''', '(min_events = %i )' % min_evt, text) + text = re.sub(r'''\(max_events = \d+\)''', '(max_events = %i )' % max_evt, text) fsock = open(conf_path, 'w') fsock.write(text) fsock.close() @@ -3619,7 +3621,7 @@ def do_refine(self, line): alljobs = misc.glob('ajob*', Pdir) #remove associated results.dat (ensure to not mix with all data) - Gre = re.compile("\s*j=(G[\d\.\w]+)") + Gre = re.compile(r"\s*j=(G[\d\.\w]+)") for job in alljobs: Gdirs = Gre.findall(open(job).read()) for Gdir in Gdirs: @@ -3727,58 +3729,126 @@ def do_combine_events(self, line): sum_xsec, sum_xerru, sum_axsec = 0,[],0 Gdirs = self.get_Gdir() Gdirs.sort() - for Gdir in Gdirs: - if os.path.exists(pjoin(Gdir, 'events.lhe')): - result = sum_html.OneResult('') - result.read_results(pjoin(Gdir, 'results.dat')) - sum_xsec += result.get('xsec') - sum_xerru.append(result.get('xerru')) - sum_axsec += result.get('axsec') - - if self.run_card['gridpack'] or self.run_card['nevents']==0: - os.remove(pjoin(Gdir, 'events.lhe')) - continue + partials_info = [] + try: + p = subprocess.Popen(["ulimit", "-n"], stdout=subprocess.PIPE) + out, err = p.communicate() + max_G = out.decode() + if max_G == "unlimited": + max_G =2500 + else: + max_G = int(max_G) - 40 + except Exception as error: + logger.debug(error) + max_G = 80 # max(20, len(Gdirs)/self.options['nb_core']) - AllEvent.add(pjoin(Gdir, 'events.lhe'), - result.get('xsec'), - result.get('xerru'), - result.get('axsec') - ) - - if len(AllEvent) >= 80: #perform a partial unweighting - AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % partials), - get_wgt, log_level=5, trunc_error=1e-2, event_target=self.run_card['nevents']) - AllEvent = lhe_parser.MultiEventFile() - AllEvent.banner = self.banner - AllEvent.add(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % partials), - sum_xsec, - math.sqrt(sum(x**2 for x in sum_xerru)), - sum_axsec) - partials +=1 - if not hasattr(self,'proc_characteristic'): self.proc_characteristic = self.get_characteristics() - if len(AllEvent) == 0: - nb_event = 0 - else: + mycluster = cluster.MultiCore(nb_core=self.options['nb_core']) + + def split(a, n): + """split a list "a" into n chunk of same size (or nearly same size)""" + k, m = divmod(len(a), n) + return (a[i*k+min(i, m):(i+1)*k+min(i+1, m)] for i in range(n)) + + partials_info = [] + if len(Gdirs) >= max_G: + start_unweight= time.perf_counter() + # first check in how many chunk we have to split (always use a multiple of nb_core) + nb_split = 1 + nb_G = len(Gdirs) // (2* self.options['nb_core']) + while nb_G > min(80, max_G): + nb_split += 1 + nb_G = len(Gdirs)//(nb_split*2*self.options['nb_core']) + if nb_G < 10: + nb_split -=1 + nb_G = len(Gdirs)//(nb_split*2*self.options['nb_core']) + + #enforce at least 10 directory per thread + if nb_G > 10 or nb_split>1: + # do the unweighting of each chunk on their own thread + nb_chunk = (nb_split*2*self.options['nb_core']) + else: + nb_chunk = len(Gdirs) // 10 + nb_G =10 + + # security that the number of combine events is too large + if nb_chunk >= max_G: + nb_chunk = max_G -1 + nb_G = len(Gdirs) // nb_chunk + + for i, local_G in enumerate(split(Gdirs, nb_chunk)): + line = [pjoin(self.me_dir, "Events", self.run_name, "partials%d.lhe.gz" % i)] + line.append(pjoin(self.me_dir, 'Events', self.run_name, '%s_%s_banner.txt' % (self.run_name, tag))) + line.append(str(self.results.current['cross'])) + line += local_G + partials_info.append(self.do_combine_events_partial(' '.join(line), preprocess_only=True)) + mycluster.submit(sys.executable, + [pjoin(self.me_dir, 'bin', 'internal', 'madevent_interface.py'), 'combine_events_partial'] + line, + stdout='/dev/null' + ) + + starttime = time.time() + update_status = lambda idle, run, finish: \ + self.update_status((idle, run, finish, 'unweight'), level=None, + force=False, starttime=starttime) + mycluster.wait(self.me_dir, update_status) + # do the final combination + for data in partials_info: + AllEvent.add(*data) + + start_unweight= time.perf_counter() nb_event = AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "unweighted_events.lhe.gz"), get_wgt, trunc_error=1e-2, event_target=self.run_card['nevents'], log_level=logging.DEBUG, normalization=self.run_card['event_norm'], proc_charac=self.proc_characteristic) + + #cleaning + for data in partials_info: + path = data[0] + try: + os.remove(path) + except Exception as error: + try: + os.remove(path[:-3]) # try without the .gz + except: + misc.sprint('no file ', path, 'to clean') + else: + for Gdir in Gdirs: + if os.path.exists(pjoin(Gdir, 'events.lhe')): + result = sum_html.OneResult('') + result.read_results(pjoin(Gdir, 'results.dat')) + sum_xsec += result.get('xsec') + sum_xerru.append(result.get('xerru')) + sum_axsec += result.get('axsec') + + if self.run_card['gridpack'] or self.run_card['nevents']==0: + os.remove(pjoin(Gdir, 'events.lhe')) + continue + + AllEvent.add(pjoin(Gdir, 'events.lhe'), + result.get('xsec'), + result.get('xerru'), + result.get('axsec') + ) + + if len(AllEvent) == 0: + nb_event = 0 + else: + nb_event = AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "unweighted_events.lhe.gz"), + get_wgt, trunc_error=1e-2, event_target=self.run_card['nevents'], + log_level=logging.DEBUG, normalization=self.run_card['event_norm'], + proc_charac=self.proc_characteristic) + + if nb_event < self.run_card['nevents']: + logger.warning("failed to generate enough events. Please follow one of the following suggestions to fix the issue:") + logger.warning(" - set in the run_card.dat 'sde_strategy' to %s", 1 + self.run_card['sde_strategy'] % 2) + logger.warning(" - set in the run_card.dat 'hard_survey' to 1 or 2.") + logger.warning(" - reduce the number of requested events (if set too high)") + logger.warning(" - check that you do not have -integrable- singularity in your amplitude.") + logger.warning(" - regenerate your process directory by selecting another gauge (in particular try FD gauge).") - if nb_event < self.run_card['nevents']: - logger.warning("failed to generate enough events. Please follow one of the following suggestions to fix the issue:") - logger.warning(" - set in the run_card.dat 'sde_strategy' to %s", 1 + self.run_card['sde_strategy'] % 2) - logger.warning(" - set in the run_card.dat 'hard_survey' to 1 or 2.") - logger.warning(" - reduce the number of requested events (if set too high)") - logger.warning(" - check that you do not have -integrable- singularity in your amplitude.") - if partials: - for i in range(partials): - try: - os.remove(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % i)) - except Exception: - os.remove(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe" % i)) self.results.add_detail('nb_event', nb_event) @@ -3789,7 +3859,50 @@ def do_combine_events(self, line): logger.info("combination of events done in %s s ", time.time()-start) self.to_store.append('event') + + ############################################################################ + def do_combine_events_partial(self, line, preprocess_only=False): + """ """ + + AllEvent = lhe_parser.MultiEventFile() + + sum_xsec, sum_xerru, sum_axsec = 0,[],0 + output, banner_path,cross = line.split()[:3] + Gdirs = line.split()[3:] + + cross = float(cross) + if not self.banner: + self.banner = banner_mod.Banner(banner_path) + if not hasattr(self, 'run_card'): + self.run_card = banner_mod.RunCard(self.banner['mgruncard']) + AllEvent.banner = self.banner + + for Gdir in Gdirs: + if os.path.exists(pjoin(Gdir, 'events.lhe')): + result = sum_html.OneResult('') + result.read_results(pjoin(Gdir, 'results.dat')) + sum_xsec += result.get('xsec') + sum_xerru.append(result.get('xerru')) + sum_axsec += result.get('axsec') + + if self.run_card['gridpack'] or self.run_card['nevents']==0: + os.remove(pjoin(Gdir, 'events.lhe')) + continue + if not preprocess_only: + AllEvent.add(pjoin(Gdir, 'events.lhe'), + result.get('xsec'), + result.get('xerru'), + result.get('axsec') + ) + if preprocess_only: + return output, sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), sum_axsec + nb_event = max(min(abs(1.01*self.run_card['nevents']*sum_axsec/cross),self.run_card['nevents']), 10) + get_wgt = lambda event: event.wgt + AllEvent.unweight(output, + get_wgt, log_level=5, trunc_error=1e-2, event_target=nb_event) + return output, sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), sum_axsec + ############################################################################ def correct_bias(self): """check the first event and correct the weight by the bias @@ -3902,13 +4015,19 @@ def do_store_events(self, line): #except Exception: # continue # Store log - try: - if os.path.exists(pjoin(G_path, 'log.txt')): - input = pjoin(G_path, 'log.txt') + input = pjoin(G_path, 'log.txt') + if os.path.exists(input): + if self.run_card['keep_log'] not in ["none", "minimal"]: output = pjoin(G_path, '%s_log.txt' % run) - files.mv(input, output) - except Exception: - continue + try: + files.mv(input, output) + except Exception: + continue + elif self.run_card['keep_log'] == "none": + try: + os.remove(input) + except Exception: + continue #try: # # Grid # for name in ['ftn26']: @@ -3989,7 +4108,7 @@ def do_create_gridpack(self, line): misc.call(['./bin/internal/make_gridpack'], cwd=self.me_dir) files.mv(pjoin(self.me_dir, 'gridpack.tar.gz'), pjoin(self.me_dir, '%s_gridpack.tar.gz' % self.run_name)) - os.system("sed -i.bak \"s/\s*.true.*=.*GridRun/ .false. = GridRun/g\" %s/Cards/grid_card.dat" \ + os.system("sed -i.bak \"s/\\s*.true.*=.*GridRun/ .false. = GridRun/g\" %s/Cards/grid_card.dat" \ % self.me_dir) self.update_status('gridpack created', level='gridpack') @@ -4476,7 +4595,7 @@ def do_pythia8(self, line): else: preamble = misc.get_HEPTools_location_setter( pjoin(MG5DIR,'HEPTools'),'lib') - preamble += "\n unset PYTHIA8DATA\n" + #preamble += "\n unset PYTHIA8DATA\n" open(pythia_cmd_card,'w').write("""! ! It is possible to run this card manually with: @@ -4691,7 +4810,7 @@ def do_pythia8(self, line): # Make sure to sure the number of split_events determined during the splitting. split_PY8_Card.systemSet('Main:numberOfEvents',partition_for_PY8[i]) split_PY8_Card.systemSet('HEPMCoutput:scaling',split_PY8_Card['HEPMCoutput:scaling']* - (float(partition_for_PY8[i])/float(n_events))) + (float(partition_for_PY8[i]))) # Add_missing set to False so as to be sure not to add any additional parameter w.r.t # the ones in the original PY8 param_card copied. split_PY8_Card.write(pjoin(parallelization_dir,'PY8Card_%d.dat'%i), @@ -4963,9 +5082,9 @@ def wait_monitoring(Idle, Running, Done): if cross_sections: # Filter the cross_sections specified an keep only the ones # with central parameters and a different merging scale - a_float_re = '[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' + a_float_re = r'[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' central_merging_re = re.compile( - '^\s*Weight_MERGING\s*=\s*(?P%s)\s*$'%a_float_re, + r'^\s*Weight_MERGING\s*=\s*(?P%s)\s*$'%a_float_re, re.IGNORECASE) cross_sections = dict( (float(central_merging_re.match(xsec).group('merging')),value) @@ -5016,8 +5135,8 @@ def wait_monitoring(Idle, Running, Done): def parse_PY8_log_file(self, log_file_path): """ Parse a log file to extract number of event and cross-section. """ - pythiare = re.compile("Les Houches User Process\(es\)\s*\d+\s*\|\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)\s*\|\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") - pythia_xsec_re = re.compile("Inclusive cross section\s*:\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") + pythiare = re.compile(r"Les Houches User Process\(es\)\s*\d+\s*\|\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)\s*\|\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") + pythia_xsec_re = re.compile(r"Inclusive cross section\s*:\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") sigma_m, Nacc, Ntry = None, None, None for line in misc.BackRead(log_file_path): info = pythiare.search(line) @@ -5158,7 +5277,7 @@ def do_pythia(self, line): # read the line from the bottom of the file #pythia_log = misc.BackRead(pjoin(self.me_dir,'Events', self.run_name, # '%s_pythia.log' % tag)) - pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") + pythiare = re.compile(r"\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") for line in misc.reverse_readline(pjoin(self.me_dir,'Events', self.run_name, '%s_pythia.log' % tag)): info = pythiare.search(line) @@ -5619,8 +5738,8 @@ def launch_job(self,exe, cwd=None, stdout=None, argument = [], remaining=0, input_files.append(self.get_pdf_input_filename()) #Find the correct ajob - Gre = re.compile("\s*j=(G[\d\.\w]+)") - origre = re.compile("grid_directory=(G[\d\.\w]+)") + Gre = re.compile(r"\s*j=(G[\d\.\w]+)") + origre = re.compile(r"grid_directory=(G[\d\.\w]+)") try : fsock = open(exe) except Exception: @@ -5628,7 +5747,7 @@ def launch_job(self,exe, cwd=None, stdout=None, argument = [], remaining=0, text = fsock.read() output_files = Gre.findall(text) if not output_files: - Ire = re.compile("for i in ([\d\.\s]*) ; do") + Ire = re.compile(r"for i in ([\d\.\s]*) ; do") data = Ire.findall(text) data = ' '.join(data).split() for nb in data: @@ -6035,7 +6154,7 @@ def get_last_tag(self, level): 'syscalc':[], 'rivet':['rivet']} - if name == self.run_name: + if name and name == self.run_name: if reload_card: run_card = pjoin(self.me_dir, 'Cards','run_card.dat') self.run_card = banner_mod.RunCard(run_card) @@ -6334,7 +6453,7 @@ def run_syscalc(self, mode='parton', event_path=None, output=None): elif mode == 'Pythia': stdout = open(pjoin(event_dir, self.run_name, '%s_%s_syscalc.log' % (tag,mode)),'w') if 'mgpythiacard' in self.banner: - pat = re.compile('''^\s*qcut\s*=\s*([\+\-\d.e]*)''', re.M+re.I) + pat = re.compile(r'''^\s*qcut\s*=\s*([\+\-\d.e]*)''', re.M+re.I) data = pat.search(self.banner['mgpythiacard']) if data: qcut = float(data.group(1)) @@ -6611,7 +6730,7 @@ def get_subP_ids(path): for line in open(pjoin(path, 'leshouche.inc')): if not 'IDUP' in line: continue - particles = re.search("/([\d,-]+)/", line) + particles = re.search(r"/([\d,-]+)/", line) all_ids.append([int(p) for p in particles.group(1).split(',')]) return all_ids @@ -6899,6 +7018,7 @@ def do_combine_events(self, line): partials = 0 # if too many file make some partial unweighting sum_xsec, sum_xerru, sum_axsec = 0,[],0 + partials_info = [] Gdirs = self.get_Gdir() Gdirs.sort() for Gdir in Gdirs: @@ -6917,16 +7037,21 @@ def do_combine_events(self, line): sum_axsec += result.get('axsec')*gscalefact[Gdir] if len(AllEvent) >= 80: #perform a partial unweighting + nb_event = min(abs(1.01*self.nb_event*sum_axsec/self.results.current['cross']),self.run_card['nevents']) AllEvent.unweight(pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), - get_wgt, log_level=5, trunc_error=1e-2, event_target=self.nb_event) + get_wgt, log_level=5, trunc_error=1e-2, event_target=nb_event) AllEvent = lhe_parser.MultiEventFile() AllEvent.banner = self.banner - AllEvent.add(pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), + partials_info.append((pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), - sum_axsec) + sum_axsec) ) + sum_xsec, sum_xerru, sum_axsec = 0,[],0 partials +=1 + for data in partials_info: + AllEvent.add(*data) + if not hasattr(self,'proc_characteristic'): self.proc_characteristic = self.get_characteristics() diff --git a/epochX/cudacpp/gg_ttg.mad/bin/internal/misc.py b/epochX/cudacpp/gg_ttg.mad/bin/internal/misc.py index c4c669f36b..e7fd60be0d 100755 --- a/epochX/cudacpp/gg_ttg.mad/bin/internal/misc.py +++ b/epochX/cudacpp/gg_ttg.mad/bin/internal/misc.py @@ -67,7 +67,7 @@ def parse_info_str(fsock): """ info_dict = {} - pattern = re.compile("(?P\w*)\s*=\s*(?P.*)", + pattern = re.compile(r"(?P\w*)\s*=\s*(?P.*)", re.IGNORECASE | re.VERBOSE) for entry in fsock: entry = entry.strip() @@ -84,7 +84,7 @@ def parse_info_str(fsock): def glob(name, path=''): """call to glob.glob with automatic security on path""" import glob as glob_module - path = re.sub('(?P\?|\*|\[|\])', '[\g]', path) + path = re.sub(r'(?P\?|\*|\[|\])', r'[\g]', path) return glob_module.glob(pjoin(path, name)) #=============================================================================== @@ -614,10 +614,10 @@ def mod_compilator(directory, new='gfortran', current=None, compiler_type='gfort #search file file_to_change=find_makefile_in_dir(directory) if compiler_type == 'gfortran': - comp_re = re.compile('^(\s*)FC\s*=\s*(.+)\s*$') + comp_re = re.compile(r'^(\s*)FC\s*=\s*(.+)\s*$') var = 'FC' elif compiler_type == 'cpp': - comp_re = re.compile('^(\s*)CXX\s*=\s*(.+)\s*$') + comp_re = re.compile(r'^(\s*)CXX\s*=\s*(.+)\s*$') var = 'CXX' else: MadGraph5Error, 'Unknown compiler type: %s' % compiler_type @@ -861,9 +861,9 @@ def detect_current_compiler(path, compiler_type='fortran'): # comp = re.compile("^\s*FC\s*=\s*(\w+)\s*") # The regular expression below allows for compiler definition with absolute path if compiler_type == 'fortran': - comp = re.compile("^\s*FC\s*=\s*([\w\/\\.\-]+)\s*") + comp = re.compile("^\\s*FC\\s*=\\s*([\\w\\/\\.\\-]+)\\s*") elif compiler_type == 'cpp': - comp = re.compile("^\s*CXX\s*=\s*([\w\/\\.\-]+)\s*") + comp = re.compile("^\\s*CXX\\s*=\\s*([\\w\\/\\.\\-]+)\\s*") else: MadGraph5Error, 'Unknown compiler type: %s' % compiler_type @@ -1001,7 +1001,19 @@ def call_stdout(arg, *args, **opt): def copytree(src, dst, symlinks = False, ignore = None): if not os.path.exists(dst): os.makedirs(dst) - shutil.copystat(src, dst) + try: + shutil.copystat(src, dst) + except PermissionError: + if os.path.realpath(src).startswith('/cvmfs') and os.path.realpath(dst).startswith('/afs'): + # allowing missmatch from cvmfs to afs since sounds to not create issue --at least in general-- + logger.critical(f'Ignoring that we could not copy permissions from {src} to {dst}') + else: + logger.critical(f'Permission error detected from {src} to {dst}.\n'+\ + 'If you are using WSL with windows partition, please try using python3.12\n'+\ + 'or avoid moving your data from the WSL partition to the UNIX one') + # we do not have enough experience in WSL to allow it to get trough. + raise + lst = os.listdir(src) if ignore: excl = ignore(src, lst) @@ -1895,12 +1907,12 @@ class EasterEgg(object): May4_banner = "* _____ *\n" + \ "* ,-~\" \"~-. *\n" + \ "* * ,^ ___ ^. * *\n" + \ - "* * / .^ ^. \ * *\n" + \ + "* * / .^ ^. \\ * *\n" + \ "* * Y l o ! Y * *\n" + \ "* * l_ `.___.' _,[ * *\n" + \ "* * |^~\"--------------~\"\"^| * *\n" + \ "* * ! May the 4th ! * *\n" + \ - "* * \ / * *\n" + \ + "* * \\ / * *\n" + \ "* * ^. .^ * *\n" + \ "* * \"-.._____.,-\" * *\n" @@ -1909,13 +1921,13 @@ class EasterEgg(object): "* M::::::::::M M::::::::::M *\n" + \ "* M:::::::::::M M:::::::::::M (_)___ *\n" + \ "* M:::::::M::::M M::::M:::::::M | / __| *\n" + \ - "* M::::::M M::::M M::::M M::::::M | \__ \ *\n" + \ + "* M::::::M M::::M M::::M M::::::M | \\__ \\ *\n" + \ "* M::::::M M::::M::::M M::::::M |_|___/ *\n" + \ "* M::::::M M:::::::M M::::::M *\n" + \ "* M::::::M M:::::M M::::::M / _| ___ _ __ *\n" + \ - "* M::::::M MMMMM M::::::M | |_ / _ \| '__| *\n" + \ + "* M::::::M MMMMM M::::::M | |_ / _ \\| '__| *\n" + \ "* M::::::M M::::::M | _| (_) | | *\n" + \ - "* M::::::M M::::::M |_/\/\___/|_| *\n" + \ + "* M::::::M M::::::M |_/\\/\\___/|_| *\n" + \ "* M::::::M M::::::M *\n" + \ "* MMMMMMMM MMMMMMMM *\n" + \ "* *\n" + \ @@ -2233,39 +2245,51 @@ def import_python_lhapdf(lhapdfconfig): os.environ['LD_LIBRARY_PATH'] = lhapdf_libdir else: os.environ['LD_LIBRARY_PATH'] = '%s:%s' %(lhapdf_libdir,os.environ['LD_LIBRARY_PATH']) - try: candidates=[dirname for dirname in os.listdir(lhapdf_libdir) \ if os.path.isdir(os.path.join(lhapdf_libdir,dirname))] except OSError: candidates=[] + if os.path.isdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')): + candidates += [pjoin(os.pardir,'local', 'lib', dirname) for dirname in os.listdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')) + if os.path.isdir(os.path.join(lhapdf_libdir,os.pardir, 'local', 'lib', dirname))] for candidate in candidates: - if os.path.isdir(os.path.join(lhapdf_libdir,candidate,'site-packages')): - sys.path.insert(0,os.path.join(lhapdf_libdir,candidate,'site-packages')) - try: - import lhapdf - use_lhapdf=True - break - except ImportError: - sys.path.pop(0) - continue + for subdir in ['site-packages', 'dist-packages']: + if os.path.isdir(os.path.join(lhapdf_libdir,candidate, subdir)): + sys.path.insert(0,os.path.join(lhapdf_libdir,candidate, subdir)) + try: + import lhapdf + use_lhapdf=True + break + except ImportError as error: + sys.path.pop(0) + continue + else: + continue + break if not use_lhapdf: try: candidates=[dirname for dirname in os.listdir(lhapdf_libdir+'64') \ if os.path.isdir(os.path.join(lhapdf_libdir+'64',dirname))] except OSError: candidates=[] - + if os.path.isdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib64')): + candidates += [pjoin(os.pardir,'local', 'lib64', dirname) for dirname in os.listdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')) + if os.path.isdir(os.path.join(lhapdf_libdir,os.pardir, 'local', 'lib64', dirname))] for candidate in candidates: - if os.path.isdir(os.path.join(lhapdf_libdir+'64',candidate,'site-packages')): - sys.path.insert(0,os.path.join(lhapdf_libdir+'64',candidate,'site-packages')) - try: - import lhapdf - use_lhapdf=True - break - except ImportError: - sys.path.pop(0) - continue + for subdir in ['site-packages', 'dist-packages']: + if os.path.isdir(os.path.join(lhapdf_libdir+'64',candidate, subdir)): + sys.path.insert(0,os.path.join(lhapdf_libdir+'64',candidate, subdir)) + try: + import lhapdf + use_lhapdf=True + break + except ImportError as error: + sys.path.pop(0) + continue + else: + continue + break if not use_lhapdf: try: import lhapdf diff --git a/epochX/cudacpp/gg_ttg.mad/bin/internal/shower_card.py b/epochX/cudacpp/gg_ttg.mad/bin/internal/shower_card.py index e87d534177..16ed72b1a0 100755 --- a/epochX/cudacpp/gg_ttg.mad/bin/internal/shower_card.py +++ b/epochX/cudacpp/gg_ttg.mad/bin/internal/shower_card.py @@ -288,7 +288,7 @@ def write(self, output_file, template=None, python_template=False, self.text = open(template,'r').read() - key_re = re.compile('^(\s*)([\S^#]+)(\s*)=(\s*)([^#]*?)(\s*)(\#.*|$)') + key_re = re.compile(r'^(\s*)([\S^#]+)(\s*)=(\s*)([^#]*?)(\s*)(\#.*|$)') newlines = [] for line in self.text.split('\n'): key_match = key_re.findall(line) diff --git a/epochX/cudacpp/gg_ttg.mad/bin/internal/systematics.py b/epochX/cudacpp/gg_ttg.mad/bin/internal/systematics.py index 28eaed00e2..2acebd087c 100644 --- a/epochX/cudacpp/gg_ttg.mad/bin/internal/systematics.py +++ b/epochX/cudacpp/gg_ttg.mad/bin/internal/systematics.py @@ -582,7 +582,7 @@ def print_cross_sections(self, all_cross, nb_event, stdout): else: resume.write( '#PDF %s: %g +%2.3g%% -%2.3g%%\n' % (pdfset.name, pdferr.central,pdferr.errplus*100/all_cross[0], pdferr.errminus*100/all_cross[0])) - dyn_name = {1: '\sum ET', 2:'\sum\sqrt{m^2+pt^2}', 3:'0.5 \sum\sqrt{m^2+pt^2}',4:'\sqrt{\hat s}' } + dyn_name = {1: r'\sum ET', 2:r'\sum\sqrt{m^2+pt^2}', 3:r'0.5 \sum\sqrt{m^2+pt^2}',4:r'\sqrt{\hat s}' } for key, curr in dyns.items(): if key ==-1: continue @@ -789,7 +789,7 @@ def get_id(self): return int(self.start_wgt_id) if 'initrwgt' in self.banner: - pattern = re.compile(' set lhapdf /PATH/TO/lhapdf-config -None does not seem to correspond to a valid lhapdf-config executable. -Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config). -Note that you can still compile and run aMC@NLO with the built-in PDFs - MG5_aMC> set lhapdf /PATH/TO/lhapdf-config - Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt -import /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttg.mg +import /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttg.mg The import format was not given, so we guess it as command set stdout_level DEBUG set output information to level: 10 @@ -62,7 +57,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.005768537521362305  +DEBUG: model prefixing takes 0.005707740783691406  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  @@ -159,13 +154,12 @@ INFO: Process has 16 diagrams Total: 1 processes with 16 diagrams output standalone_cudacpp ../TMPOUT/CODEGEN_cudacpp_gg_ttg Load PLUGIN.CUDACPP_OUTPUT -Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.5.3_lo_vect. +Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.6.0_lo_vect. It has been validated for the last time with version: 3.5.2 Output will be done with PLUGIN: CUDACPP_OUTPUT -DEBUG: cformat =  plugin [export_cpp.py at line 3070]  DEBUG: Entering PLUGIN_ProcessExporter.__init__ (initialise the exporter) [output.py at line 165]  DEBUG: Entering PLUGIN_ProcessExporter.copy_template (initialise the directory) [output.py at line 170]  -INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttg +INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttg INFO: Organizing processes into subprocess groups INFO: Generating Helas calls for process: g g > t t~ g WEIGHTED<=3 @1 INFO: Processing color information for process: g g > t t~ g @1 @@ -174,18 +168,18 @@ INFO: Processing color information for process: g g > t t~ g @1 DEBUG: type(fortran_model)= [output.py at line 214]  DEBUG: type(me)= me=0 [output.py at line 215]  DEBUG: "need to link", self.to_link_in_P =  need to link ['nvtx.h', 'timer.h', 'timermap.h', 'ompnumthreads.h', 'GpuRuntime.h', 'GpuAbstraction.h', 'MemoryAccessHelpers.h', 'MemoryAccessVectors.h', 'MemoryAccessMatrixElements.h', 'MemoryAccessMomenta.h', 'MemoryAccessRandomNumbers.h', 'MemoryAccessWeights.h', 'MemoryAccessAmplitudes.h', 'MemoryAccessWavefunctions.h', 'MemoryAccessGs.h', 'MemoryAccessCouplingsFixed.h', 'MemoryAccessNumerators.h', 'MemoryAccessDenominators.h', 'MemoryAccessChannelIds.h', 'EventStatistics.h', 'CommonRandomNumbers.h', 'CrossSectionKernels.cc', 'CrossSectionKernels.h', 'MatrixElementKernels.cc', 'MatrixElementKernels.h', 'RamboSamplingKernels.cc', 'RamboSamplingKernels.h', 'RandomNumberKernels.h', 'CommonRandomNumberKernel.cc', 'CurandRandomNumberKernel.cc', 'HiprandRandomNumberKernel.cc', 'Bridge.h', 'BridgeKernels.cc', 'BridgeKernels.h', 'fbridge.cc', 'fbridge.inc', 'fsampler.cc', 'fsampler.inc', 'MadgraphTest.h', 'runTest.cc', 'testmisc.cc', 'testxxx_cc_ref.txt', 'valgrind.h', 'cudacpp.mk', 'testxxx.cc', 'MemoryBuffers.h', 'MemoryAccessCouplings.h', 'perf.py', 'profile.sh'] [output.py at line 216]  -INFO: Creating files in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttg/SubProcesses/P1_Sigma_sm_gg_ttxg -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttg/SubProcesses/P1_Sigma_sm_gg_ttxg/./CPPProcess.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttg/SubProcesses/P1_Sigma_sm_gg_ttxg/./CPPProcess.cc -INFO: Created files CPPProcess.h and CPPProcess.cc in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttg/SubProcesses/P1_Sigma_sm_gg_ttxg/. -Generated helas calls for 1 subprocesses (16 diagrams) in 0.039 s +INFO: Creating files in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttg/SubProcesses/P1_Sigma_sm_gg_ttxg +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttg/SubProcesses/P1_Sigma_sm_gg_ttxg/./CPPProcess.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttg/SubProcesses/P1_Sigma_sm_gg_ttxg/./CPPProcess.cc +INFO: Created files CPPProcess.h and CPPProcess.cc in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttg/SubProcesses/P1_Sigma_sm_gg_ttxg/. +Generated helas calls for 1 subprocesses (16 diagrams) in 0.038 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.331 s +ALOHA: aloha creates 5 routines in 0.334 s VVV1 VVV1 FFV1 @@ -195,17 +189,17 @@ ALOHA: aloha creates 5 routines in 0.331 s VVVV1 VVVV3 VVVV4 -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttg/src/./HelAmps_sm.h -INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttg/src/. +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttg/src/./HelAmps_sm.h +INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttg/src/. super_write_set_parameters_onlyfixMajorana (hardcoded=False) super_write_set_parameters_onlyfixMajorana (hardcoded=True) -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttg/src/./Parameters_sm.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttg/src/./Parameters_sm.cc +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttg/src/./Parameters_sm.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttg/src/./Parameters_sm.cc INFO: Created files Parameters_sm.h and Parameters_sm.cc in directory -INFO: /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttg/src/. and /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttg/src/. +INFO: /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttg/src/. and /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttg/src/. quit -real 0m1.054s -user 0m0.733s -sys 0m0.055s +real 0m0.791s +user 0m0.726s +sys 0m0.056s Code generation completed in 1 seconds 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 220b4c8811..65f27cc918 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 @@ -14,7 +14,7 @@ Running MG5 in debug mode * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect 2023-12-23 * +* VERSION 3.6.0_lo_vect 2024-06-17 * * * * WARNING: UNKNOWN DEVELOPMENT VERSION. * * WARNING: DO NOT USE FOR PRODUCTION * @@ -45,15 +45,10 @@ Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (inclu Note that you can still compile and run aMC@NLO with the built-in PDFs MG5_aMC> set lhapdf /PATH/TO/lhapdf-config -None does not seem to correspond to a valid lhapdf-config executable. -Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config). -Note that you can still compile and run aMC@NLO with the built-in PDFs - MG5_aMC> set lhapdf /PATH/TO/lhapdf-config - Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt -import /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg.mg +import /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg.mg The import format was not given, so we guess it as command set stdout_level DEBUG set output information to level: 10 @@ -62,7 +57,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.005507946014404297  +DEBUG: model prefixing takes 0.005572319030761719  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,24 +150,24 @@ 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.158 s +1 processes with 123 diagrams generated in 0.164 s Total: 1 processes with 123 diagrams output madevent_simd ../TMPOUT/CODEGEN_mad_gg_ttgg --hel_recycling=False --vector_size=32 Load PLUGIN.CUDACPP_OUTPUT -Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.5.3_lo_vect. +Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.6.0_lo_vect. It has been validated for the last time with version: 3.5.2 Output will be done with PLUGIN: CUDACPP_OUTPUT Addition matrix-element will be done with PLUGIN: CUDACPP_OUTPUT +DEBUG: opt['output_options']['vector_size'] =  32 [export_v4.py at line 4334]  Output will be done with PLUGIN: CUDACPP_OUTPUT -DEBUG: cformat =  standalone_simd [export_cpp.py at line 3070]  DEBUG: Entering PLUGIN_ProcessExporter.__init__ (initialise the exporter) [output.py at line 165]  INFO: initialize a new directory: CODEGEN_mad_gg_ttgg INFO: remove old information in CODEGEN_mad_gg_ttgg DEBUG: Entering PLUGIN_ProcessExporter.copy_template (initialise the directory) [output.py at line 170]  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg  -INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/Cards  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/SubProcesses  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg  +INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/Cards  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/SubProcesses  INFO: Organizing processes into subprocess groups INFO: Generating Helas calls for process: g g > t t~ g g WEIGHTED<=4 @1 INFO: Processing color information for process: g g > t t~ g g @1 @@ -182,32 +177,28 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 0, 46, 47, 48, 49, 50, 51, 52, 53, 54, 0, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 0, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 0, 88, 89, 90, 91, 92, 93, 0, 94, 95, 96, 97, 98, 99, 0, 100, 101, 102, 103, 104, 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [export_cpp.py at line 711]  -DEBUG: subproc_number =  0 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: g g > t t~ g g WEIGHTED<=4 @1 INFO: Finding symmetric diagrams for subprocess group gg_ttxgg -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/SubProcesses/P1_gg_ttxgg [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  105 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 2, 2: 3, 3: 4, 4: 5, 5: 6, 6: 7, 7: 8, 8: 9, 9: 10, 10: 11, 11: 12, 12: 13, 13: 14, 14: 15, 15: 16, 16: 17, 17: 18, 18: 19, 19: 20, 20: 21, 21: 22, 22: 23, 23: 24, 24: 25, 25: 26, 26: 27, 27: 28, 28: 29, 29: 30, 30: 31, 31: 33, 32: 34, 33: 35, 34: 36, 35: 37, 36: 38, 37: 39, 38: 40, 39: 41, 40: 42, 41: 43, 42: 44, 43: 45, 44: 46, 45: 47, 46: 49, 47: 50, 48: 51, 49: 52, 50: 53, 51: 54, 52: 55, 53: 56, 54: 57, 55: 59, 56: 60, 57: 61, 58: 62, 59: 63, 60: 64, 61: 65, 62: 66, 63: 67, 64: 68, 65: 69, 66: 70, 67: 71, 68: 72, 69: 73, 70: 75, 71: 76, 72: 77, 73: 78, 74: 79, 75: 80, 76: 81, 77: 82, 78: 83, 79: 84, 80: 85, 81: 86, 82: 87, 83: 88, 84: 89, 85: 90, 86: 91, 87: 92, 88: 94, 89: 95, 90: 96, 91: 97, 92: 98, 93: 99, 94: 101, 95: 102, 96: 103, 97: 104, 98: 105, 99: 106, 100: 108, 101: 109, 102: 110, 103: 111, 104: 112, 105: 113} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {2: 1, 3: 2, 4: 3, 5: 4, 6: 5, 7: 6, 8: 7, 9: 8, 10: 9, 11: 10, 12: 11, 13: 12, 14: 13, 15: 14, 16: 15, 17: 16, 18: 17, 19: 18, 20: 19, 21: 20, 22: 21, 23: 22, 24: 23, 25: 24, 26: 25, 27: 26, 28: 27, 29: 28, 30: 29, 31: 30, 33: 31, 34: 32, 35: 33, 36: 34, 37: 35, 38: 36, 39: 37, 40: 38, 41: 39, 42: 40, 43: 41, 44: 42, 45: 43, 46: 44, 47: 45, 49: 46, 50: 47, 51: 48, 52: 49, 53: 50, 54: 51, 55: 52, 56: 53, 57: 54, 59: 55, 60: 56, 61: 57, 62: 58, 63: 59, 64: 60, 65: 61, 66: 62, 67: 63, 68: 64, 69: 65, 70: 66, 71: 67, 72: 68, 73: 69, 75: 70, 76: 71, 77: 72, 78: 73, 79: 74, 80: 75, 81: 76, 82: 77, 83: 78, 84: 79, 85: 80, 86: 81, 87: 82, 88: 83, 89: 84, 90: 85, 91: 86, 92: 87, 94: 88, 95: 89, 96: 90, 97: 91, 98: 92, 99: 93, 101: 94, 102: 95, 103: 96, 104: 97, 105: 98, 106: 99, 108: 100, 109: 101, 110: 102, 111: 103, 112: 104, 113: 105} [model_handling.py at line 1548]  -Generated helas calls for 1 subprocesses (123 diagrams) in 0.430 s -Wrote files for 222 helas calls in 0.678 s +Generated helas calls for 1 subprocesses (123 diagrams) in 0.437 s +Wrote files for 222 helas calls in 0.682 s +DEBUG: self.vector_size =  32 [export_v4.py at line 7023]  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.332 s +ALOHA: aloha creates 5 routines in 0.341 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 10 routines in 0.316 s +ALOHA: aloha creates 10 routines in 0.322 s VVV1 VVV1 FFV1 @@ -220,38 +211,40 @@ ALOHA: aloha creates 10 routines in 0.316 s VVVV3 VVVV4 VVVV4 -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/src/./HelAmps_sm.h -INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/src/. +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/src/./HelAmps_sm.h +INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/src/. super_write_set_parameters_onlyfixMajorana (hardcoded=False) super_write_set_parameters_onlyfixMajorana (hardcoded=True) -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/src/./Parameters_sm.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/src/./Parameters_sm.cc +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/src/./Parameters_sm.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/src/./Parameters_sm.cc INFO: Created files Parameters_sm.h and Parameters_sm.cc in directory -INFO: /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/src/. and /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/src/. +INFO: /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/src/. and /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/src/. The option zerowidth_tchannel is modified [True] but will not be written in the configuration files. If you want to make this value the default for future session, you can run 'save options --all' -save configuration file to /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/Cards/me5_configuration.txt +save configuration file to /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/Cards/me5_configuration.txt INFO: Use Fortran compiler gfortran INFO: Use c++ compiler g++ INFO: Generate jpeg diagrams INFO: Generate web pages -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common -patching file Source/genps.inc +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common patching file SubProcesses/makefile -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/SubProcesses/P1_gg_ttxgg; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/SubProcesses/P1_gg_ttxgg; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #2 succeeded at 281 (offset 48 lines). +Hunk #2 succeeded at 275 (offset 61 lines). DEBUG: p.returncode =  0 [output.py at line 258]  -Output to directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg done. +Output to directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg done. Type "launch" to generate events from this process, or see -/data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/README +/data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/README Run "open index.html" to see more information about this process. quit -real 0m3.834s -user 0m3.505s -sys 0m0.298s +real 0m3.904s +user 0m3.584s +sys 0m0.268s Code generation completed in 4 seconds ************************************************************ * * @@ -265,7 +258,7 @@ Code generation completed in 4 seconds * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect * +* VERSION 3.6.0_lo_vect * * * * The MadGraph5_aMC@NLO Development Team - Find us at * * https://server06.fynu.ucl.ac.be/projects/madgraph * @@ -273,9 +266,9 @@ Code generation completed in 4 seconds * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt @@ -295,7 +288,7 @@ launch in debug mode * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect * +* VERSION 3.6.0_lo_vect * * * * The MadGraph5_aMC@NLO Development Team - Find us at * * https://server06.fynu.ucl.ac.be/projects/madgraph * @@ -303,9 +296,9 @@ launch in debug mode * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttgg/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt diff --git a/epochX/cudacpp/gg_ttgg.mad/Cards/me5_configuration.txt b/epochX/cudacpp/gg_ttgg.mad/Cards/me5_configuration.txt index cdeedc7863..4f5079f78a 100644 --- a/epochX/cudacpp/gg_ttgg.mad/Cards/me5_configuration.txt +++ b/epochX/cudacpp/gg_ttgg.mad/Cards/me5_configuration.txt @@ -116,6 +116,7 @@ # cluster_type = condor # cluster_queue = madgraph # cluster_size = 150 +# cluster_walltime = # time in minute for slurm and second for condor (not supported for other scheduller) #! Path to a node directory to avoid direct writing on the central disk #! Note that condor clusters avoid direct writing by default (therefore this @@ -234,7 +235,7 @@ # pineappl = pineappl -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo # MG5 MAIN DIRECTORY -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo diff --git a/epochX/cudacpp/gg_ttgg.mad/Cards/param_card.dat b/epochX/cudacpp/gg_ttgg.mad/Cards/param_card.dat index caf4a67ea8..bb150ef10d 100644 --- a/epochX/cudacpp/gg_ttgg.mad/Cards/param_card.dat +++ b/epochX/cudacpp/gg_ttgg.mad/Cards/param_card.dat @@ -1,5 +1,5 @@ ###################################################################### -## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL #### +## PARAM_CARD AUTOMATICALLY GENERATED BY MG5 FOLLOWING UFO MODEL #### ###################################################################### ## ## ## Width set on Auto will be computed following the information ## diff --git a/epochX/cudacpp/gg_ttgg.mad/Cards/param_card_default.dat b/epochX/cudacpp/gg_ttgg.mad/Cards/param_card_default.dat index caf4a67ea8..bb150ef10d 100644 --- a/epochX/cudacpp/gg_ttgg.mad/Cards/param_card_default.dat +++ b/epochX/cudacpp/gg_ttgg.mad/Cards/param_card_default.dat @@ -1,5 +1,5 @@ ###################################################################### -## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL #### +## PARAM_CARD AUTOMATICALLY GENERATED BY MG5 FOLLOWING UFO MODEL #### ###################################################################### ## ## ## Width set on Auto will be computed following the information ## diff --git a/epochX/cudacpp/gg_ttgg.mad/Cards/proc_card_mg5.dat b/epochX/cudacpp/gg_ttgg.mad/Cards/proc_card_mg5.dat index f4efb79920..d53bfad86b 100644 --- a/epochX/cudacpp/gg_ttgg.mad/Cards/proc_card_mg5.dat +++ b/epochX/cudacpp/gg_ttgg.mad/Cards/proc_card_mg5.dat @@ -8,7 +8,7 @@ #* * * * #* * #* * -#* VERSION 3.5.3_lo_vect 2023-12-23 * +#* VERSION 3.6.0_lo_vect 2024-06-17 * #* * #* WARNING: UNKNOWN DEVELOPMENT VERSION. * #* WARNING: DO NOT USE FOR PRODUCTION * diff --git a/epochX/cudacpp/gg_ttgg.mad/Cards/reweight_card_default.dat b/epochX/cudacpp/gg_ttgg.mad/Cards/reweight_card_default.dat index ace534ae02..5cc65fe095 100644 --- a/epochX/cudacpp/gg_ttgg.mad/Cards/reweight_card_default.dat +++ b/epochX/cudacpp/gg_ttgg.mad/Cards/reweight_card_default.dat @@ -19,8 +19,16 @@ change mode NLO # Define type of Reweighting. For LO sample this command # has no effect since only "LO" mode is allowed. + +#uncomment if you do not want to overwrite the reweight file of Sudakov in rw_me +#change rwgt_dir /PATH_MG5_BRANCH/NAME_FOLDER + +#uncomment if you want to use Sudakov Reweight +#change include_sudakov True + launch + # SPECIFY A PATH OR USE THE SET COMMAND LIKE THIS: # set sminputs 1 130 # modify 1/alpha_EW diff --git a/epochX/cudacpp/gg_ttgg.mad/Cards/run_card.dat b/epochX/cudacpp/gg_ttgg.mad/Cards/run_card.dat index a1e27dfa2b..ecdc7fd25c 100644 --- a/epochX/cudacpp/gg_ttgg.mad/Cards/run_card.dat +++ b/epochX/cudacpp/gg_ttgg.mad/Cards/run_card.dat @@ -185,6 +185,7 @@ systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++] ['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule + #*********************************************************************** # SIMD/GPU configuration for the CUDACPP plugin #************************************************************************ diff --git a/epochX/cudacpp/gg_ttgg.mad/Cards/run_card_default.dat b/epochX/cudacpp/gg_ttgg.mad/Cards/run_card_default.dat index b8ea7253a9..35153b7e3f 100644 --- a/epochX/cudacpp/gg_ttgg.mad/Cards/run_card_default.dat +++ b/epochX/cudacpp/gg_ttgg.mad/Cards/run_card_default.dat @@ -185,6 +185,7 @@ systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++] ['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule + #*********************************************************************** # SIMD/GPU configuration for the CUDACPP plugin #************************************************************************ diff --git a/epochX/cudacpp/gg_ttgg.mad/MGMEVersion.txt b/epochX/cudacpp/gg_ttgg.mad/MGMEVersion.txt index 9d3a5c0ba0..a806d3938c 100644 --- a/epochX/cudacpp/gg_ttgg.mad/MGMEVersion.txt +++ b/epochX/cudacpp/gg_ttgg.mad/MGMEVersion.txt @@ -1 +1 @@ -3.5.3_lo_vect \ No newline at end of file +3.6.0_lo_vect \ No newline at end of file diff --git a/epochX/cudacpp/gg_ttgg.mad/Source/DHELAS/aloha_functions.f b/epochX/cudacpp/gg_ttgg.mad/Source/DHELAS/aloha_functions.f index 975725737f..47699fa614 100644 --- a/epochX/cudacpp/gg_ttgg.mad/Source/DHELAS/aloha_functions.f +++ b/epochX/cudacpp/gg_ttgg.mad/Source/DHELAS/aloha_functions.f @@ -351,7 +351,7 @@ subroutine oxxxxx(p,fmass,nhel,nsf , fo) fo(6) = ip * sqm(abs(im)) else - pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2)) +c pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2)) sf(1) = dble(1+nsf+(1-nsf)*nh)*rHalf sf(2) = dble(1+nsf-(1-nsf)*nh)*rHalf omega(1) = dsqrt(p(0)+pp) @@ -2054,7 +2054,7 @@ subroutine CombineAmp(nb, ihels, iwfcts, W1, Wall, Amp) enddo return end - + subroutine CombineAmpS(nb, ihels, iwfcts, W1, Wall, Amp) integer nb ! size of the vectors diff --git a/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/couplings.f b/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/couplings.f index f3b620ab58..04d6bb5333 100644 --- a/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/couplings.f +++ b/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/couplings.f @@ -10,18 +10,27 @@ SUBROUTINE COUP() PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + LOGICAL UPDATELOOP COMMON /TO_UPDATELOOP/UPDATELOOP INCLUDE 'input.inc' - INCLUDE '../vector.inc' + + INCLUDE 'coupl.inc' READLHA = .TRUE. INCLUDE 'intparam_definition.inc' CALL COUP1() + IF (UPDATELOOP) THEN + + CALL COUP2() + + ENDIF + C couplings needed to be evaluated points by points C - CALL COUP2(1) + CALL COUP3(1) RETURN END @@ -47,7 +56,11 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) INCLUDE '../maxparticles.inc' INCLUDE '../cuts.inc' + + INCLUDE '../vector.inc' + + INCLUDE '../run.inc' DOUBLE PRECISION ALPHAS @@ -65,7 +78,7 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) couplings needed to be evaluated points by points C ALL_G(VECID) = G - CALL COUP2(VECID) + CALL COUP3(VECID) RETURN END @@ -80,7 +93,9 @@ SUBROUTINE UPDATE_AS_PARAM2(MU_R2,AS2 ,VECID) INTEGER VECID INCLUDE 'model_functions.inc' INCLUDE 'input.inc' + INCLUDE '../vector.inc' + INCLUDE 'coupl.inc' DOUBLE PRECISION MODEL_SCALE COMMON /MODEL_SCALE/MODEL_SCALE diff --git a/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/couplings1.f b/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/couplings1.f index e14f3a1770..72cfa0f6e4 100644 --- a/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/couplings1.f +++ b/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/couplings1.f @@ -7,11 +7,12 @@ SUBROUTINE COUP1( ) IMPLICIT NONE INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' END diff --git a/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/couplings2.f b/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/couplings2.f index e638b28035..30f3a04e3b 100644 --- a/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/couplings2.f +++ b/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/couplings2.f @@ -2,19 +2,17 @@ c written by the UFO converter ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc - SUBROUTINE COUP2( VECID) + SUBROUTINE COUP2( ) IMPLICIT NONE - INTEGER VECID + INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' - GC_10(VECID) = -G - GC_11(VECID) = MDL_COMPLEXI*G - GC_12(VECID) = MDL_COMPLEXI*MDL_G__EXP__2 END diff --git a/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/couplings3.f b/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/couplings3.f index f537dd3764..ad696f2865 100644 --- a/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/couplings3.f +++ b/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/couplings3.f @@ -7,12 +7,13 @@ SUBROUTINE COUP3( VECID) IMPLICIT NONE INTEGER VECID INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' GC_10(VECID) = -G GC_11(VECID) = MDL_COMPLEXI*G diff --git a/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/makefile b/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/makefile index 0b24445a53..5a5681d220 100644 --- a/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/makefile +++ b/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/makefile @@ -3,7 +3,7 @@ # Makefile for model library # # ---------------------------------------------------------------------------- - +# template models/template_files/makefile_madevent # Check for ../make_opts ifeq ($(wildcard ../make_opts), ../make_opts) include ../make_opts diff --git a/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/makeinc.inc b/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/makeinc.inc index 6e2743eac1..4a9e1b2cc5 100644 --- a/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/makeinc.inc +++ b/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/makeinc.inc @@ -2,4 +2,4 @@ # written by the UFO converter ############################################################################# -MODEL = couplings.o lha_read.o printout.o rw_para.o model_functions.o couplings1.o couplings2.o \ No newline at end of file +MODEL = couplings.o lha_read.o printout.o rw_para.o model_functions.o couplings1.o couplings2.o couplings3.o \ No newline at end of file diff --git a/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/printout.f b/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/printout.f index 18b8f35b08..3e195b03a2 100644 --- a/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/printout.f +++ b/epochX/cudacpp/gg_ttgg.mad/Source/MODEL/printout.f @@ -1,3 +1,7 @@ +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +c written by the UFO converter +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc + c************************************************************************ c** ** c** MadGraph/MadEvent Interface to FeynRules ** @@ -9,7 +13,7 @@ subroutine printout implicit none - include '../vector.inc' ! defines VECSIZE_MEMMAX + include '../vector.inc' ! VECSIZE_MEMMAX (needed by coupl.inc) include 'coupl.inc' ! needs VECSIZE_MEMMAX (defined in vector.inc) include 'input.inc' diff --git a/epochX/cudacpp/gg_ttgg.mad/Source/PDF/eepdf.inc b/epochX/cudacpp/gg_ttgg.mad/Source/PDF/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/gg_ttgg.mad/Source/PDF/eepdf.inc +++ b/epochX/cudacpp/gg_ttgg.mad/Source/PDF/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/gg_ttgg.mad/Source/PDF/pdfwrap_emela.f b/epochX/cudacpp/gg_ttgg.mad/Source/PDF/pdfwrap_emela.f index bce10819d5..da1e4e2276 100644 --- a/epochX/cudacpp/gg_ttgg.mad/Source/PDF/pdfwrap_emela.f +++ b/epochX/cudacpp/gg_ttgg.mad/Source/PDF/pdfwrap_emela.f @@ -13,7 +13,7 @@ SUBROUTINE PDFWRAP DOUBLE PRECISION VALUE(20) REAL*8 ALPHASPDF EXTERNAL ALPHASPDF - ! PDFs with beamstrahlung use specific initialisation/evaluation +C PDFs with beamstrahlung use specific initialisation/evaluation LOGICAL HAS_BSTRAHL COMMON /TO_HAS_BS/ HAS_BSTRAHL diff --git a/epochX/cudacpp/gg_ttgg.mad/Source/PDF/pdg2pdf.f b/epochX/cudacpp/gg_ttgg.mad/Source/PDF/pdg2pdf.f index 46f321e66b..2e7343a69b 100644 --- a/epochX/cudacpp/gg_ttgg.mad/Source/PDF/pdg2pdf.f +++ b/epochX/cudacpp/gg_ttgg.mad/Source/PDF/pdg2pdf.f @@ -108,7 +108,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) else if (abs(ipart).eq.10) then ipart = sign(1,ipart) * 15 endif - pdg2pdf = 0d0 + pdg2pdf = 0d0 if (beamid.lt.0) then ih_local = ipart @@ -122,7 +122,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) endif do i_ee = 1, n_ee ee_components(i_ee) = compute_eepdf(x,omx_ee(iabs(beamid)),xmu,i_ee,ipart,ih_local) - enddo + enddo pdg2pdf = ee_components(1) ! temporary to test pdf load c write(*,*), x, beamid ,omx_ee(iabs(beamid)),xmu,1,ipart,ih_local,pdg2pdf return diff --git a/epochX/cudacpp/gg_ttgg.mad/Source/dsample.f b/epochX/cudacpp/gg_ttgg.mad/Source/dsample.f index 09d482b45a..b0bc0547ad 100644 --- a/epochX/cudacpp/gg_ttgg.mad/Source/dsample.f +++ b/epochX/cudacpp/gg_ttgg.mad/Source/dsample.f @@ -204,6 +204,9 @@ subroutine sample_full(ndim,ncall,itmax,itmin,dsig,ninvar,nconfigs,VECSIZE_USED) if (VECSIZE_USED.le.1) then all_fx(1) = dsig(all_p, all_wgt,0) + ivec=0 + ilock=0 + iwarp=1 else c Here "i" is the position in the full grid of the event do i=(iwarp-1)*WARP_SIZE+1, iwarp*warp_size diff --git a/epochX/cudacpp/gg_ttgg.mad/Source/eepdf.inc b/epochX/cudacpp/gg_ttgg.mad/Source/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/gg_ttgg.mad/Source/eepdf.inc +++ b/epochX/cudacpp/gg_ttgg.mad/Source/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/gg_ttgg.mad/Source/genps.inc b/epochX/cudacpp/gg_ttgg.mad/Source/genps.inc index af7e0efbce..ef78e7e812 100644 --- a/epochX/cudacpp/gg_ttgg.mad/Source/genps.inc +++ b/epochX/cudacpp/gg_ttgg.mad/Source/genps.inc @@ -29,9 +29,8 @@ c parameter (max_host=99,maxplace=199,maxpoints=100,maxans=50) c************************************************************************* c Parameters for helicity sums in matrixN.f c************************************************************************* - REAL*8 LIMHEL -c PARAMETER(LIMHEL=1e-8) ! ME threshold for helicity filtering (Fortran default) - PARAMETER(LIMHEL=0) ! ME threshold for helicity filtering (force Fortran to mimic cudacpp, see #419) +c REAL*8 LIMHEL +c PARAMETER(LIMHEL=1e-8) -> pass in the run_card.dat INTEGER MAXTRIES PARAMETER(MAXTRIES=25) C To pass the helicity configuration chosen by the DiscreteSampler to diff --git a/epochX/cudacpp/gg_ttgg.mad/Source/run.inc b/epochX/cudacpp/gg_ttgg.mad/Source/run.inc index 5433a23583..81c8df6bf2 100644 --- a/epochX/cudacpp/gg_ttgg.mad/Source/run.inc +++ b/epochX/cudacpp/gg_ttgg.mad/Source/run.inc @@ -106,4 +106,7 @@ c double precision tmin_for_channel integer sde_strat ! 1 means standard single diagram enhancement strategy, c 2 means approximation by the denominator of the propagator - common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat \ No newline at end of file + common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat +c + double precision limhel + common/to_limhel/limhel diff --git a/epochX/cudacpp/gg_ttgg.mad/Source/run_card.inc b/epochX/cudacpp/gg_ttgg.mad/Source/run_card.inc index 67af0f2051..1a1bc782bd 100644 --- a/epochX/cudacpp/gg_ttgg.mad/Source/run_card.inc +++ b/epochX/cudacpp/gg_ttgg.mad/Source/run_card.inc @@ -88,6 +88,8 @@ DSQRT_SHAT = 0.000000000000000D+00 + LIMHEL = 0.000000000000000D+00 + PTJ = 2.000000000000000D+01 PTB = 0.000000000000000D+00 diff --git a/epochX/cudacpp/gg_ttgg.mad/Source/setrun.f b/epochX/cudacpp/gg_ttgg.mad/Source/setrun.f index 9e9ef7fdbd..dc6caef748 100644 --- a/epochX/cudacpp/gg_ttgg.mad/Source/setrun.f +++ b/epochX/cudacpp/gg_ttgg.mad/Source/setrun.f @@ -162,9 +162,21 @@ subroutine setrun C Fill common block for Les Houches init info do i=1,2 if(lpp(i).eq.1.or.lpp(i).eq.2) then - idbmup(i)=2212 + if (nb_proton(i).eq.1.and.nb_neutron(i).eq.0) then + idbmup(i)=2212 + elseif (nb_proton(i).eq.0.and.nb_neutron(i).eq.1) then + idbmup(i)=2112 + else + idbmup(i) = 1000000000 + (nb_proton(i)+nb_neutron(i))*10 + $ + nb_proton(i)*10000 + endif elseif(lpp(i).eq.-1.or.lpp(i).eq.-2) then - idbmup(i)=-2212 + if (nb_proton(i).eq.1.and.nb_neutron(i).eq.0) then + idbmup(i)=-2212 + else + idbmup(i) = -1*(1000000000 + (nb_proton(i)+nb_neutron(i))*10 + $ + nb_proton(i)*10000) + endif elseif(lpp(i).eq.3) then idbmup(i)=11 elseif(lpp(i).eq.-3) then diff --git a/epochX/cudacpp/gg_ttgg.mad/SubProcesses/MGVersion.txt b/epochX/cudacpp/gg_ttgg.mad/SubProcesses/MGVersion.txt index 9d3a5c0ba0..a806d3938c 100644 --- a/epochX/cudacpp/gg_ttgg.mad/SubProcesses/MGVersion.txt +++ b/epochX/cudacpp/gg_ttgg.mad/SubProcesses/MGVersion.txt @@ -1 +1 @@ -3.5.3_lo_vect \ No newline at end of file +3.6.0_lo_vect \ No newline at end of file diff --git a/epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/CPPProcess.cc b/epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/CPPProcess.cc index 63aa2a8900..b9a359a354 100644 --- a/epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/CPPProcess.cc +++ b/epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/CPPProcess.h b/epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/CPPProcess.h index a0f4d7d7b5..6d43b06ac6 100644 --- a/epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/CPPProcess.h +++ b/epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/auto_dsig.f b/epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/auto_dsig.f index 10d3eb1082..04661b1cdf 100644 --- a/epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/auto_dsig.f +++ b/epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1134,11 +1134,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1148,32 +1149,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/auto_dsig1.f b/epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/auto_dsig1.f index 51653e4244..52b70294cc 100644 --- a/epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/auto_dsig1.f +++ b/epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -101,6 +101,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -217,7 +219,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -281,7 +283,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -320,9 +322,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -338,6 +341,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -485,11 +490,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -589,9 +589,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -752,3 +754,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/driver.f b/epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/driver.f index 526cc3b0ae..f7f23196eb 100644 --- a/epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/driver.f +++ b/epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/matrix1.f b/epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/matrix1.f index c00a648e15..66a35ffb59 100644 --- a/epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/matrix1.f +++ b/epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -23,6 +23,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) INTEGER NGRAPHS @@ -46,8 +48,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -56,26 +58,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -86,7 +85,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -96,26 +94,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,6) /-1,-1,-1, 1,-1,-1/ DATA (NHEL(I, 2),I=1,6) /-1,-1,-1, 1,-1, 1/ DATA (NHEL(I, 3),I=1,6) /-1,-1,-1, 1, 1,-1/ @@ -191,8 +188,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -201,11 +197,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=24 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=24 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -215,12 +211,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -232,7 +227,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -261,35 +257,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -361,7 +355,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/gg_ttgg.mad/SubProcesses/cluster.f b/epochX/cudacpp/gg_ttgg.mad/SubProcesses/cluster.f index 649e46f4e9..b8995283ed 100644 --- a/epochX/cudacpp/gg_ttgg.mad/SubProcesses/cluster.f +++ b/epochX/cudacpp/gg_ttgg.mad/SubProcesses/cluster.f @@ -552,6 +552,8 @@ logical function cluster(p, ivec) if (btest(mlevel,1)) $ write (*,*)'New event' + iwin = 0 + jwin = 0 cluster=.false. clustered=.false. do i=0,3 @@ -663,7 +665,8 @@ logical function cluster(p, ivec) c initialize graph storage igraphs(0)=0 nleft=nexternal -c cluster +c cluster + if (iwin.eq.0.or.jwin.eq.0) stop 21 do n=1,nexternal-2 c combine winner imocl(n)=imap(iwin,2)+imap(jwin,2) diff --git a/epochX/cudacpp/gg_ttgg.mad/SubProcesses/proc_characteristics b/epochX/cudacpp/gg_ttgg.mad/SubProcesses/proc_characteristics index 61b8ce0c6c..13deb6127f 100644 --- a/epochX/cudacpp/gg_ttgg.mad/SubProcesses/proc_characteristics +++ b/epochX/cudacpp/gg_ttgg.mad/SubProcesses/proc_characteristics @@ -17,6 +17,8 @@ splitting_types = [] perturbation_order = [] limitations = [] + ew_sudakov = False hel_recycling = False single_color = True nlo_mixed_expansion = True + gauge = unitary diff --git a/epochX/cudacpp/gg_ttgg.mad/SubProcesses/refine.sh b/epochX/cudacpp/gg_ttgg.mad/SubProcesses/refine.sh index afb9b99ad1..b46170ba23 100644 --- a/epochX/cudacpp/gg_ttgg.mad/SubProcesses/refine.sh +++ b/epochX/cudacpp/gg_ttgg.mad/SubProcesses/refine.sh @@ -57,7 +57,11 @@ j=%(directory)s for((try=1;try<=16;try+=1)); do if [ "$keeplog" = true ] ; then + if [[ -e ../madevent ]];then ../madevent 2>&1 >> $k &1 >> $k &1 >> log.txt &1 >> log.txt &1 >> $k \w*)>') - pat_end=re.compile('\w*)>') + pat_begin=re.compile(r'<(?P\w*)>') + pat_end=re.compile(r'\w*)>') tag_to_file={'slha':'param_card.dat', 'mgruncard':'run_card.dat', @@ -319,7 +319,7 @@ def check_pid(self, pid2label): def get_lha_strategy(self): """get the lha_strategy: how the weight have to be handle by the shower""" - if not self["init"]: + if "init" not in self or not self["init"]: raise Exception("No init block define") data = self["init"].split('\n')[0].split() @@ -537,7 +537,8 @@ def charge_card(self, tag): self.param_card = param_card_reader.ParamCard(param_card) return self.param_card elif tag == 'mgruncard': - self.run_card = RunCard(self[tag], unknown_warning=False) + with misc.TMP_variable(RunCard, 'allow_scan', True): + self.run_card = RunCard(self[tag], consistency=False, unknow_warning=False) return self.run_card elif tag == 'mg5proccard': proc_card = self[tag].split('\n') @@ -976,6 +977,8 @@ class ConfigFile(dict): """ a class for storing/dealing with input file. """ + allow_scan = False + def __init__(self, finput=None, **opt): """initialize a new instance. input can be an instance of MadLoopParam, a file, a path to a file, or simply Nothing""" @@ -993,6 +996,7 @@ def __init__(self, finput=None, **opt): # Initialize it with all the default value self.user_set = set() self.auto_set = set() + self.scan_set = {} #key -> type of list (int/float/bool/str/... for scan self.system_only = set() self.lower_to_case = {} self.list_parameter = {} #key -> type of list (int/float/bool/str/... @@ -1109,6 +1113,8 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): #1. check if the parameter is set to auto -> pass it to special if lower_name in self: targettype = type(dict.__getitem__(self, lower_name)) + if lower_name in self.scan_set: + targettype = self.scan_set[lower_name] if targettype != str and isinstance(value, str) and value.lower() == 'auto': self.auto_set.add(lower_name) if lower_name in self.user_set: @@ -1118,13 +1124,26 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): return elif lower_name in self.auto_set: self.auto_set.remove(lower_name) - + + + #1. check if the parameter is set to auto -> pass it to special + scan_targettype = None + if self.allow_scan and isinstance(value, str) and value.strip().startswith('scan'): + if lower_name in self.user_set: + self.user_set.remove(lower_name) + self.scan_set[lower_name] = type(self[lower_name]) + dict.__setitem__(self, lower_name, value) + #keep old value. + self.post_set(lower_name,value, change_userdefine, raiseerror) + return + elif lower_name in self.scan_set: + scan_targettype = self.scan_set[lower_name] + del self.scan_set[lower_name] + # 2. Find the type of the attribute that we want if lower_name in self.list_parameter: targettype = self.list_parameter[lower_name] - - if isinstance(value, str): # split for each comma/space value = value.strip() @@ -1248,8 +1267,11 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): if change_userdefine: self.user_set.add(lower_name) return self.post_set(lower_name, None, change_userdefine, raiseerror) - elif name in self: - targettype = type(self[name]) + elif name in self: + if scan_targettype: + targettype = targettype + else: + targettype = type(self[name]) else: logger.debug('Trying to add argument %s in %s. ' % (name, self.__class__.__name__) +\ 'This argument is not defined by default. Please consider adding it.') @@ -1262,7 +1284,7 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): if change_userdefine: self.user_set.add(lower_name) return self.post_set(lower_name, None, change_userdefine, raiseerror) - + value = self.format_variable(value, targettype, name=name) #check that the value is allowed: if lower_name in self.allowed_value and '*' not in self.allowed_value[lower_name]: @@ -1444,7 +1466,7 @@ def format_variable(value, targettype, name="unknown"): value =int(value[:-1]) * convert[value[-1]] elif '/' in value or '*' in value: try: - split = re.split('(\*|/)',value) + split = re.split(r'(\*|/)',value) v = float(split[0]) for i in range((len(split)//2)): if split[2*i+1] == '*': @@ -1482,7 +1504,7 @@ def format_variable(value, targettype, name="unknown"): value = float(value) except ValueError: try: - split = re.split('(\*|/)',value) + split = re.split(r'(\*|/)',value) v = float(split[0]) for i in range((len(split)//2)): if split[2*i+1] == '*': @@ -1491,7 +1513,10 @@ def format_variable(value, targettype, name="unknown"): v /= float(split[2*i+2]) except: v=0 - raise InvalidCmd("%s can not be mapped to a float" % value) + if "scan" in value: + raise InvalidCmd("%s is not supported here. Note that scan command can not be present simultaneously in the run_card and param_card." % value) + else: + raise InvalidCmd("%s can not be mapped to a float" % value) finally: value = v else: @@ -1737,10 +1762,12 @@ def default_setup(self): self.add_param('splitting_types',[], typelist=str) self.add_param('perturbation_order', [], typelist=str) self.add_param('limitations', [], typelist=str) + self.add_param('ew_sudakov', False) self.add_param('hel_recycling', False) self.add_param('single_color', True) self.add_param('nlo_mixed_expansion', True) - + self.add_param('gauge', 'U') + def read(self, finput): """Read the input file, this can be a path to a file, a file object, a str with the content of the file.""" @@ -3104,7 +3131,7 @@ def write(self, output_file, template=None, python_template=False, # do not write hidden parameter not hidden for this template # if python_template: - written = written.union(set(re.findall('\%\((\w*)\)s', open(template,'r').read(), re.M))) + written = written.union(set(re.findall(r'\%\((\w*)\)s', open(template,'r').read(), re.M))) to_write = to_write.union(set(self.hidden_param)) to_write = to_write.difference(written) @@ -3157,7 +3184,6 @@ def get_value_from_include(self, path, list_of_params, output_dir): if path does not exists return the current value in self for all parameter""" #WARNING DOES NOT HANDLE LIST/DICT so far - misc.sprint(output_dir, path) # handle case where file is missing if not os.path.exists(pjoin(output_dir,path)): misc.sprint("include file not existing", pjoin(output_dir,path)) @@ -3259,7 +3285,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): text = open(path,'r').read() #misc.sprint(text) f77_type = ['real*8', 'integer', 'double precision', 'logical'] - pattern = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I+re.M) for fct in pattern.findall(text): fsock = file_writers.FortranWriter(tmp,'w') @@ -3287,6 +3313,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): starttext = open(pjoin(outdir, path+'.orig')).read() fsock.remove_routine(starttext, to_mod[path][0]) for text in to_mod[path][1]: + text = self.retro_compatible_custom_fct(text) fsock.writelines(text) fsock.close() if not filecmp.cmp(pjoin(outdir, path), pjoin(outdir, path+'.tmp')): @@ -3303,7 +3330,33 @@ def edit_dummy_fct_from_file(self, filelist, outdir): files.mv(pjoin(outdir,path+'.orig'), pjoin(outdir, path)) + @staticmethod + def retro_compatible_custom_fct(lines, mode=None): + f77_type = ['real*8', 'integer', 'double precision', 'logical'] + function_pat = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + % {'type':'|'.join(f77_type)}, re.I+re.M) + include_pat = re.compile(r"\s+include\s+[\'\"]([\w\./]*)") + + assert isinstance(lines, list) + sol = [] + + if mode is None or 'vector.inc' in mode: + search = True + for i,line in enumerate(lines[:]): + if search and re.search(include_pat, line): + name = re.findall(include_pat, line)[0] + misc.sprint('DETECTED INCLUDE', name) + if 'vector.inc' in name: + search = False + if 'run.inc' in name: + sol.append(" include 'vector.inc'") + search = False + sol.append(line) + if re.search(function_pat, line): + misc.sprint("DETECTED FCT") + search = True + return sol def guess_entry_fromname(self, name, value): """ @@ -3346,7 +3399,7 @@ def update_typelist(value, name, opts): #handle metadata opts = {} forced_opts = [] - for key,val in re.findall("\<(?P[_\-\w]+)\=(?P[^>]*)\>", str(name)): + for key,val in re.findall(r"\<(?P[_\-\w]+)\=(?P[^>]*)\>", str(name)): forced_opts.append(key) if val in ['True', 'False']: opts[key] = eval(val) @@ -3681,11 +3734,22 @@ def write_autodef(self, output_dir, output_file=None): out = ["%s\n" %l for l in out] fsock.writelines(out) - @staticmethod - def get_idbmup(lpp): + def get_idbmup(self, lpp, beam=1): """return the particle colliding pdg code""" if lpp in (1,2, -1,-2): - return math.copysign(2212, lpp) + target = 2212 + if 'nb_proton1' in self: + nbp = self['nb_proton%s' % beam] + nbn = self['nb_neutron%s' % beam] + if nbp == 1 and nbn ==0: + target = 2212 + elif nbp==0 and nbn ==1: + target = 2112 + else: + target = 1000000000 + target += 10 * (nbp+nbn) + target += 10000 * nbp + return math.copysign(target, lpp) elif lpp in (3,-3): return math.copysign(11, lpp) elif lpp in (4,-4): @@ -3701,8 +3765,8 @@ def get_banner_init_information(self): the first line of the block of the lhe file.""" output = {} - output["idbmup1"] = self.get_idbmup(self['lpp1']) - output["idbmup2"] = self.get_idbmup(self['lpp2']) + output["idbmup1"] = self.get_idbmup(self['lpp1'], beam=1) + output["idbmup2"] = self.get_idbmup(self['lpp2'], beam=2) output["ebmup1"] = self["ebeam1"] output["ebmup2"] = self["ebeam2"] output["pdfgup1"] = 0 @@ -3959,7 +4023,8 @@ def check_validity(self, card): dict.__setitem__(card, 'pdlabel1', card['pdlabel']) dict.__setitem__(card, 'pdlabel2', card['pdlabel']) - if abs(card['lpp1']) == 1 == abs(card['lpp2']) and card['pdlabel1'] != card['pdlabel2']: + if isinstance(card['lpp1'],int) and isinstance(card['lpp2'],int) and \ + abs(card['lpp1']) == 1 == abs(card['lpp2']) and card['pdlabel1'] != card['pdlabel2']: raise InvalidRunCard("Assymetric beam pdf not supported for proton-proton collision") def status(self, card): @@ -4156,12 +4221,16 @@ def default_setup(self): self.add_param('frame_id', 6, system=True) self.add_param("event_norm", "average", allowed=['sum','average', 'unity'], include=False, sys_default='sum', hidden=True) + self.add_param("keep_log", "normal", include=False, hidden=True, + comment="none: all log send to /dev/null.\n minimal: keep only log for survey of the last run.\n normal: keep only log for survey of all run. \n debug: keep all log (survey and refine)", + allowed=['none', 'minimal', 'normal', 'debug']) #cut self.add_param("auto_ptj_mjj", True, hidden=True) self.add_param("bwcutoff", 15.0) self.add_param("cut_decays", False, cut='d') self.add_param('dsqrt_shat',0., cut=True) self.add_param("nhel", 0, include=False) + self.add_param("limhel", 1e-8, hidden=True, comment="threshold to determine if an helicity contributes when not MC over helicity.") #pt cut self.add_param("ptj", 20.0, cut='j') self.add_param("ptb", 0.0, cut='b') @@ -4842,7 +4911,7 @@ def create_default_for_process(self, proc_characteristic, history, proc_def): # here pick strategy 2 if only one QCD color flow # and for pure multi-jet case jet_id = [21] + list(range(1, self['maxjetflavor']+1)) - if proc_characteristic['single_color']: + if proc_characteristic['gauge'] != 'FD' and proc_characteristic['single_color']: self['sde_strategy'] = 2 #for pure lepton final state go back to sde_strategy=1 pure_lepton=True @@ -5741,9 +5810,10 @@ def check_validity(self): # check that ebeam is bigger than the proton mass. for i in [1,2]: - if self['lpp%s' % i ] not in [1,2]: + # do not for proton mass if not proton PDF (or when scan initialization) + if self['lpp%s' % i ] not in [1,2] or isinstance(self['ebeam%i' % i], str): continue - + if self['ebeam%i' % i] < 0.938: if self['ebeam%i' %i] == 0: logger.warning("At-rest proton mode set: energy beam set to 0.938 GeV") @@ -6193,3 +6263,181 @@ def log_and_update(self, banner, card, par, v): xcard = banner.charge_card(card) xcard[par[0]].param_dict[(par[1],)].value = v xcard.write(os.path.join(self.me_dir, 'Cards', '%s.dat' % card)) + + + + +class RunCardIterator(object): + """A class keeping track of the scan: flag in the param_card and + having an __iter__() function to scan over all the points of the scan. + """ + + logging = True + def __init__(self, input_path=None): + with misc.TMP_variable(RunCard, 'allow_scan', True): + self.run_card = RunCard(input_path, consistency=False) + self.run_card.allow_scan = True + + self.itertag = [] #all the current value use + self.cross = [] # keep track of all the cross-section computed + self.param_order = [] + + def __iter__(self): + """generate the next param_card (in a abstract way) related to the scan. + Technically this generates only the generator.""" + + if hasattr(self, 'iterator'): + return self.iterator + self.iterator = self.iterate() + return self.iterator + + def write(self, path): + self.__iter__.write(path) + + def next(self, autostart=False): + """call the next iteration value""" + try: + iterator = self.iterator + except: + if autostart: + iterator = self.__iter__() + else: + raise + try: + out = next(iterator) + except StopIteration: + del self.iterator + raise + return out + + def iterate(self): + """create the actual generator""" + all_iterators = {} # dictionary of key -> block of object to scan [([param, [values]), ...] + pattern = re.compile(r'''scan\s*(?P\d*)\s*:\s*(?P[^#]*)''', re.I) + + # fill all_iterators with the run_card information + for name in self.run_card.scan_set: + value = self.run_card[name] + try: + key, def_list = pattern.findall(value)[0] + except Exception as error: + misc.sprint(error) + raise Exception("Fail to handle scanning tag in run_card: Please check that the syntax is valid") + if key == '': + key = -1 * len(all_iterators) + if key not in all_iterators: + all_iterators[key] = [] + try: + all_iterators[key].append( (name, eval(def_list))) + except SyntaxError as error: + raise Exception("Fail to handle your scan definition. Please check your syntax:\n entry: %s \n Error reported: %s" %(def_list, error)) + + #prepare to keep track of parameter changing for the report + keys = list(all_iterators.keys()) # need to fix an order for the scan + #store the type of parameter + for key in keys: + for param, values in all_iterators[key]: + self.param_order.append("run_card#%s" % (param)) + + # do the loop + lengths = [list(range(len(all_iterators[key][0][1]))) for key in keys] + from functools import reduce + total = reduce((lambda x, y: x * y),[len(x) for x in lengths]) + for i,positions in enumerate(itertools.product(*lengths)): + self.itertag = [] + if self.logging: + logger.info("Create the next run_card in the scan definition (%s/%s) " %( i+1, total), '$MG:BOLD') + for i, pos in enumerate(positions): + key = keys[i] + for param, values in all_iterators[key]: + # assign the value in the card. + self.run_card[param] = values[pos] + self.itertag.append(values[pos]) + if self.logging: + logger.info("change parameter %s to %s", \ + param, values[pos]) + + + # retrun the current param_card up to next iteration + yield self.run_card + + + def store_entry(self, run_name, cross, error=None, run_card_path=None): + """store the value of the cross-section""" + + if isinstance(cross, dict): + info = dict(cross) + info.update({'bench' : self.itertag, 'run_name': run_name}) + self.cross.append(info) + else: + if error is None: + self.cross.append({'bench' : self.itertag, 'run_name': run_name, 'cross(pb)':cross}) + else: + self.cross.append({'bench' : self.itertag, 'run_name': run_name, 'cross(pb)':cross, 'error(pb)':error}) + + + def write_summary(self, path, order=None, lastline=False, nbcol=20): + """ """ + + if path: + ff = open(path, 'w') + path_events = path.rsplit("/", 1)[0] + #identCard = open(pjoin(path.rsplit("/", 2)[0], "Cards", "ident_card.dat")) + #identLines = identCard.readlines() + #identCard.close() + else: + ff = StringIO.StringIO() + if order: + keys = order + else: + keys = list(self.cross[0].keys()) + if 'bench' in keys: keys.remove('bench') + if 'run_name' in keys: keys.remove('run_name') + keys.sort() + if 'cross(pb)' in keys: + keys.remove('cross(pb)') + keys.append('cross(pb)') + if 'error(pb)' in keys: + keys.remove('error(pb)') + keys.append('error(pb)') + + formatting = "#%s%s%s\n" %('%%-%is ' % (nbcol-1), ('%%-%is ' % (nbcol))* len(self.param_order), + ('%%-%is ' % (nbcol))* len(keys)) + # header + if not lastline: + ff.write(formatting % tuple(['run_name'] + self.param_order + keys)) + formatting = "%s%s%s\n" %('%%-%is ' % (nbcol), ('%%-%ie ' % (nbcol))* len(self.param_order), + ('%%-%ie ' % (nbcol))* len(keys)) + + if not lastline: + to_print = self.cross + else: + to_print = self.cross[-1:] + for info in to_print: + name = info['run_name'] + bench = info['bench'] + data = [] + for k in keys: + if k in info: + data.append(info[k]) + else: + data.append(0.) + ff.write(formatting % tuple([name] + bench + data)) + ff_single = open(pjoin(path_events, name, "params.dat"), "w") + for i_bench in range(0, len(bench)): + ff_single.write(self.param_order[i_bench] + " = " + str(bench[i_bench]) +"\n") + ff_single.close() + + if not path: + return ff.getvalue() + + + def get_next_name(self, run_name): + """returns a smart name for the next run""" + + if '_' in run_name: + name, value = run_name.rsplit('_',1) + if value.isdigit(): + return '%s_%02i' % (name, float(value)+1) + # no valid '_' in the name + return '%s_scan_02' % run_name diff --git a/epochX/cudacpp/gg_ttgg.mad/bin/internal/check_param_card.py b/epochX/cudacpp/gg_ttgg.mad/bin/internal/check_param_card.py index 71089d7480..bc785b5de6 100755 --- a/epochX/cudacpp/gg_ttgg.mad/bin/internal/check_param_card.py +++ b/epochX/cudacpp/gg_ttgg.mad/bin/internal/check_param_card.py @@ -649,7 +649,7 @@ def write_inc_file(self, outpath, identpath, default, need_mp=False): #check if we need to write the value of scale for some block if os.path.exists(input_inc): text = open(input_inc).read() - scales = list(set(re.findall('mdl__(\w*)__scale', text, re.I))) + scales = list(set(re.findall(r'mdl__(\w*)__scale', text, re.I))) else: scales = [] @@ -1000,10 +1000,12 @@ def iterate(self): self.param_order.append("%s#%s" % (param.lhablock, '_'.join(repr(i) for i in param.lhacode))) # do the loop lengths = [list(range(len(all_iterators[key][0][1]))) for key in keys] - for positions in itertools.product(*lengths): + from functools import reduce + total = reduce((lambda x, y: x * y),[len(x) for x in lengths]) + for i,positions in enumerate(itertools.product(*lengths)): self.itertag = [] if self.logging: - logger.info("Create the next param_card in the scan definition", '$MG:BOLD') + logger.info("Create the next param_card in the scan definition (%s/%s)" % (i+1,total), '$MG:BOLD') for i, pos in enumerate(positions): key = keys[i] for param, values in all_iterators[key]: diff --git a/epochX/cudacpp/gg_ttgg.mad/bin/internal/cluster.py b/epochX/cudacpp/gg_ttgg.mad/bin/internal/cluster.py index 9a893f630d..1ad860e04f 100755 --- a/epochX/cudacpp/gg_ttgg.mad/bin/internal/cluster.py +++ b/epochX/cudacpp/gg_ttgg.mad/bin/internal/cluster.py @@ -646,7 +646,10 @@ def worker(self): if os.path.exists(exe) and not exe.startswith('/'): exe = './' + exe if isinstance(opt['stdout'],str): - opt['stdout'] = open(opt['stdout'],'w') + if opt['stdout'] == '/dev/null': + opt['stdout'] = os.open(os.devnull, os.O_RDWR) + else: + opt['stdout'] = open(opt['stdout'],'w') if opt['stderr'] == None: opt['stderr'] = subprocess.STDOUT if arg: @@ -671,11 +674,12 @@ def worker(self): self.pids.put(pid) # the function should return 0 if everything is fine # the error message otherwise - returncode = exe(*arg, **opt) - if returncode != 0: - logger.warning("fct %s does not return 0. Stopping the code in a clean way. The error was:\n%s", exe, returncode) + try: + returncode = exe(*arg, **opt) + except Exception as error: + #logger.warning("fct %s does not return 0. Stopping the code in a clean way. The error was:\n%s", exe, returncode) self.stoprequest.set() - self.remove("fct %s does not return 0:\n %s" % (exe, returncode)) + self.remove("fct %s does raise %s\n %s" % (exe, error)) except Exception as error: self.fail_msg = sys.exc_info() logger.warning(str(error)) @@ -700,7 +704,7 @@ def worker(self): def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, - log=None, required_output=[], nb_submit=0): + log=None, required_output=[], nb_submit=0, python_opts={}): """submit a job on multicore machine""" # open threads if needed @@ -720,7 +724,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, return tag else: # python function - self.queue.put((tag, prog, argument, {})) + self.queue.put((tag, prog, argument, python_opts)) self.submitted.put(1) return tag @@ -908,6 +912,10 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None else: requirement = '' + if 'cluster_walltime' in self.options and self.options['cluster_walltime']\ + and self.options['cluster_walltime'] != 'None': + requirement+='\n MaxRuntime = %s' % self.options['cluster_walltime'] + if cwd is None: cwd = os.getcwd() if stdout is None: @@ -936,7 +944,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None #Submitting job(s). #Logging submit event(s). #1 job(s) submitted to cluster 2253622. - pat = re.compile("submitted to cluster (\d*)",re.MULTILINE) + pat = re.compile(r"submitted to cluster (\d*)",re.MULTILINE) output = output.decode(errors='ignore') try: id = pat.search(output).groups()[0] @@ -1025,7 +1033,7 @@ def submit2(self, prog, argument=[], cwd=None, stdout=None, stderr=None, #Logging submit event(s). #1 job(s) submitted to cluster 2253622. output = output.decode(errors='ignore') - pat = re.compile("submitted to cluster (\d*)",re.MULTILINE) + pat = re.compile(r"submitted to cluster (\d*)",re.MULTILINE) try: id = pat.search(output).groups()[0] except: @@ -1588,7 +1596,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None output = a.communicate()[0].decode(errors='ignore') #Your job 874511 ("test.sh") has been submitted - pat = re.compile("Your job (\d*) \(",re.MULTILINE) + pat = re.compile(r"Your job (\d*) \(",re.MULTILINE) try: id = pat.search(output).groups()[0] except: @@ -1606,7 +1614,7 @@ def control_one_job(self, id): if not status: return 'F' #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 - pat = re.compile("^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") + pat = re.compile(r"^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") stat = '' for line in status.stdout.read().decode(errors='ignore').split('\n'): if not line: @@ -1636,7 +1644,7 @@ def control(self, me_dir=None): cmd = 'qstat -s %s' % statusflag status = misc.Popen([cmd], shell=True, stdout=subprocess.PIPE) #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 - pat = re.compile("^(\d+)") + pat = re.compile(r"^(\d+)") for line in status.stdout.read().decode(errors='ignore').split('\n'): line = line.strip() try: @@ -1715,6 +1723,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None stderr = stdout if log is None: log = '/dev/null' + command = ['sbatch', '-o', stdout, '-J', me_dir, @@ -1726,6 +1735,12 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None command.insert(1, '-p') command.insert(2, self.cluster_queue) + if 'cluster_walltime' in self.options and self.options['cluster_walltime']\ + and self.options['cluster_walltime'] != 'None': + command.insert(1, '-t') + command.insert(2, self.options['cluster_walltime']) + + a = misc.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -1736,7 +1751,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None id = output_arr[3].rstrip() if not id.isdigit(): - id = re.findall('Submitted batch job ([\d\.]+)', ' '.join(output_arr)) + id = re.findall(r'Submitted batch job ([\d\.]+)', ' '.join(output_arr)) if not id or len(id)>1: raise ClusterManagmentError( 'fail to submit to the cluster: \n%s' \ diff --git a/epochX/cudacpp/gg_ttgg.mad/bin/internal/combine_runs.py b/epochX/cudacpp/gg_ttgg.mad/bin/internal/combine_runs.py index 4de6b84ec0..b1e8c88eac 100755 --- a/epochX/cudacpp/gg_ttgg.mad/bin/internal/combine_runs.py +++ b/epochX/cudacpp/gg_ttgg.mad/bin/internal/combine_runs.py @@ -20,6 +20,7 @@ from __future__ import absolute_import import math import os +import shutil import re import logging from six.moves import range @@ -117,6 +118,7 @@ def sum_multichannel(self, channel): #Now read in all of the events and write them #back out with the appropriate scaled weight + to_clean = [] fsock = open(pjoin(channel, 'events.lhe'), 'w') wgt = results.axsec / results.nunwgt tot_nevents, nb_file = 0, 0 @@ -129,8 +131,14 @@ def sum_multichannel(self, channel): nw = self.copy_events(fsock, pjoin(path,'events.lhe'), wgt) tot_nevents += nw nb_file += 1 + to_clean.append(path) logger.debug("Combined %s file generating %s events for %s " , nb_file, tot_nevents, channel) - + for path in to_clean: + try: + shutil.rmtree(path) + except Exception as error: + pass + @staticmethod def get_fortran_str(nb): data = '%E' % nb @@ -162,6 +170,7 @@ def copy_events(self, fsock, input, new_wgt): fsock.write(line) old_line = line return nb_evt + def get_channels(self, proc_path): """Opens file symfact.dat to determine all channels""" sympath = os.path.join(proc_path, 'symfact.dat') diff --git a/epochX/cudacpp/gg_ttgg.mad/bin/internal/common_run_interface.py b/epochX/cudacpp/gg_ttgg.mad/bin/internal/common_run_interface.py index 9bd9d9cb50..194f0cdfbd 100755 --- a/epochX/cudacpp/gg_ttgg.mad/bin/internal/common_run_interface.py +++ b/epochX/cudacpp/gg_ttgg.mad/bin/internal/common_run_interface.py @@ -23,6 +23,7 @@ import ast import logging import math +import copy import os import re import shutil @@ -181,6 +182,23 @@ def help_add_time_of_flight(self): logger.info(' threshold option allows to change the minimal value required to') logger.info(' a non zero value for the particle (default:1e-12s)') + def help_print_results(self): + logger.info("syntax: print_results [RUN_NAME] [OPTIONS]") + logger.info("-- print the results of the previous run on the screen") + logger.info(" If not RUN_NAME is provided, the information of all run") + logger.info(" are printed one after another.") + logger.info("") + logger.info(" supported options:") + logger.info(" ------------------") + logger.info(" --format=full|short # default is full") + logger.info(" full format contains banner/... ") + logger.info(" while short is a simple multi-column format (nice for plotting)") + logger.info(" --path=") + logger.info(" allow to write the information to a file.") + logger.info(" --mode=w|a #default is w ") + logger.info(" when the information is printed to a file, you can choose ") + logger.info(" to either overwrite the file if already exists (w mode)") + logger.info(" to append the information at the end of the file (a mode)") class CheckValidForCmd(object): @@ -727,7 +745,7 @@ def __init__(self, me_dir, options, *args, **opts): if not self.proc_characteristics['ninitial']: # Get number of initial states nexternal = open(pjoin(self.me_dir,'Source','nexternal.inc')).read() - found = re.search("PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) + found = re.search(r"PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) self.ninitial = int(found.group(1)) else: self.ninitial = self.proc_characteristics['ninitial'] @@ -989,7 +1007,22 @@ def do_treatcards(self, line, amcatnlo=False): #raise Exception, "%s %s %s" % (sys.path, os.path.exists(pjoin(self.me_dir,'bin','internal', 'ufomodel')), os.listdir(pjoin(self.me_dir,'bin','internal', 'ufomodel'))) import ufomodel as ufomodel zero = ufomodel.parameters.ZERO - if self.proc_characteristics['nlo_mixed_expansion']: + no_width = [] + + if self.proc_characteristics['ew_sudakov']: + # if the sudakov approximation is used, force all particle widths to zero + # unless the complex mass scheme is used + if not self.proc_characteristics['complex_mass_scheme']: + no_width = [p for p in ufomodel.all_particles if p.width != zero] + logger.info('''Setting all particle widths to zero (needed for EW Sudakov approximation).''','$MG:BOLD') + # also, check that the model features the 'ntadpole' parameter, and set it to 1 + try: + param_card['tadpole'].get(1).value = 1. + logger.info('''Setting the value of ntadpole to 1 (needed for EW Sudakov approximation).''','$MG:BOLD') + except KeyError: + logger.warning('''The model has no 'ntadpole' parameter. The Sudakov approximation for EW corrections may give wrong results.''') + + elif self.proc_characteristics['nlo_mixed_expansion']: no_width = [p for p in ufomodel.all_particles if (str(p.pdg_code) in pids or str(-p.pdg_code) in pids) and p.width != zero] @@ -1168,17 +1201,17 @@ def detect_card_type(path): 'Begin Minpts', 'gridpack', 'ebeam1', - 'block\s+mw_run', + r'block\s+mw_run', 'BLOCK', 'DECAY', 'launch', 'madspin', - 'transfer_card\.dat', + r'transfer_card\.dat', 'set', 'main:numberofevents', # pythia8, '@MG5aMC skip_analysis', #MA5 --both-- - '@MG5aMC\s*inputs\s*=\s*\*\.(?:hepmc|lhe)', #MA5 --both-- - '@MG5aMC\s*reconstruction_name', # MA5 hadronique + r'@MG5aMC\s*inputs\s*=\s*\*\.(?:hepmc|lhe)', #MA5 --both-- + r'@MG5aMC\s*reconstruction_name', # MA5 hadronique '@MG5aMC', # MA5 hadronique 'run_rivet_later', # Rivet ] @@ -1237,7 +1270,7 @@ def detect_card_type(path): return 'madspin_card.dat' if 'decay' in text: # need to check if this a line like "decay w+" or "set decay" - if re.search("(^|;)\s*decay", fulltext, re.M): + if re.search(r"(^|;)\s*decay", fulltext, re.M): return 'madspin_card.dat' else: return 'reweight_card.dat' @@ -2074,6 +2107,12 @@ def check_multicore(self): # ensure that the run_card is present if not hasattr(self, 'run_card'): self.run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat')) + # Below reads the run_card in the LHE file rather than the Cards/run_card + import madgraph.various.lhe_parser as lhe_parser + args_path = list(args) + self.check_decay_events(args_path) + self.run_card = banner_mod.RunCard(lhe_parser.EventFile(args_path[0]).get_banner()['mgruncard']) + # we want to run this in a separate shell to avoid hard f2py crash command = [sys.executable] @@ -2085,6 +2124,12 @@ def check_multicore(self): command.append('--web') command.append('reweight') + ## TV: copy the event file as backup before starting reweighting + event_path = pjoin(self.me_dir, 'Events', self.run_name, 'events.lhe.gz') + event_path_backup = pjoin(self.me_dir, 'Events', self.run_name, 'events_orig.lhe.gz') + if os.path.exists(event_path) and not os.path.exists(event_path_backup): + shutil.copyfile(event_path, event_path_backup) + ######### START SINGLE CORE MODE ############ if self.options['nb_core']==1 or self.run_card['nevents'] < 101 or not check_multicore(self): if self.run_name: @@ -2200,7 +2245,7 @@ def check_multicore(self): cross_sections[key] = value / (nb_event+1) lhe.remove() for key in cross_sections: - if key == 'orig' or key.isdigit(): + if key == 'orig' or (key.isdigit() and not (key[0] == '2')): continue logger.info('%s : %s pb' % (key, cross_sections[key])) return @@ -2461,7 +2506,7 @@ def do_add_time_of_flight(self, line): ############################################################################ def do_print_results(self, line): - """Not in help:Print the cross-section/ number of events for a given run""" + """Print the cross-section/ number of events for a given run""" args = self.split_arg(line) options={'path':None, 'mode':'w', 'format':'full'} @@ -2942,10 +2987,15 @@ def do_rivet(self, line, postprocess=False): #2 Prepare Rivet setup environments rivet_path = self.options['rivet_path'] yoda_path = self.options['yoda_path'] + fastjet_path = subprocess.Popen([self.options['fastjet'], '--prefix'], + stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip() + set_env = set_env + "export PATH={0}:$PATH\n".format(pjoin(rivet_path, 'bin')) set_env = set_env + "export PATH={0}:$PATH\n".format(pjoin(yoda_path, 'bin')) set_env = set_env + "export LD_LIBRARY_PATH={0}:{1}:$LD_LIBRARY_PATH\n".format(pjoin(rivet_path, 'lib'), pjoin(rivet_path, 'lib64')) set_env = set_env + "export LD_LIBRARY_PATH={0}:{1}:$LD_LIBRARY_PATH\n".format(pjoin(yoda_path, 'lib'), pjoin(yoda_path, 'lib64')) + set_env = set_env + "export LD_LIBRARY_PATH={0}:$LD_LIBRARY_PATH\n".format(pjoin(self.options['hepmc_path'], 'lib')) + set_env = set_env + "export LD_LIBRARY_PATH={0}:$LD_LIBRARY_PATH\n".format(pjoin(fastjet_path, 'lib')) major, minor = sys.version_info[0:2] set_env = set_env + "export PYTHONPATH={0}:{1}:$PYTHONPATH\n".format(pjoin(rivet_path, 'lib', 'python%s.%s' %(major,minor), 'site-packages'),\ pjoin(rivet_path, 'lib64', 'python%s.%s' %(major,minor), 'site-packages')) @@ -4311,8 +4361,8 @@ def complete_compute_widths(self, text, line, begidx, endidx, formatting=True): else: completion = {} completion['options'] = self.list_completion(text, - ['--path=', '--output=', '--min_br=0.\$', '--nlo', - '--precision_channel=0.\$', '--body_decay=']) + ['--path=', '--output=', r'--min_br=0.\$', '--nlo', + r'--precision_channel=0.\$', '--body_decay=']) return self.deal_multiple_categories(completion, formatting) @@ -4821,9 +4871,9 @@ class AskforEditCard(cmd.OneLinePathCompletion): (return False to repeat the question) """ - all_card_name = ['param_card', 'run_card', 'pythia_card', 'pythia8_card', + all_card_name = ['param_card', 'run_card', 'pythia_card', 'pythia8_card', 'fo_analysis_card' 'madweight_card', 'MadLoopParams', 'shower_card', 'rivet_card'] - to_init_card = ['param', 'run', 'madweight', 'madloop', + to_init_card = ['param', 'run', 'madweight', 'madloop', 'fo_analysis', 'shower', 'pythia8','delphes','madspin', 'rivet'] special_shortcut = {} special_shortcut_help = {} @@ -4853,6 +4903,7 @@ def load_default(self): self.has_PY8 = False self.has_delphes = False self.has_rivet = False + self.has_fo_card = False self.paths = {} self.update_block = [] @@ -5058,7 +5109,8 @@ def init_run(self, cards): try: - self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning') + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning') except IOError: self.run_card = {} try: @@ -5248,6 +5300,15 @@ def init_delphes(self, cards): self.has_delphes = True return [] + def init_fo_analysis(self, cards): + self.has_fo_card = False + if not self.get_path('FO_analyse', cards): + return [] + self.has_fo_card = True + self.fo_card = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse']) + self.fo_card_def = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse_default']) + return list(self.fo_card.string_vars) + def set_CM_velocity(self, line): """compute sqrts from the velocity in the center of mass frame""" @@ -5508,6 +5569,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): allowed['delphes_card'] = '' if self.has_rivet: allowed['rivet_card'] = '' + if self.has_fo_card: + allowed['fo_card'] = '' elif len(args) == 2: if args[1] == 'run_card': @@ -5532,6 +5595,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): allowed = {'delphes_card':'default'} elif args[1] == 'rivet_card': allowed = {'rivet_card':'default'} + elif args[1] == 'fo_card': + allowed = {'fo_card':'default'} else: allowed = {'value':''} @@ -5539,6 +5604,7 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): start = 1 if args[1] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', 'MadLoop_card','pythia8_card','delphes_card','plot_card', + 'fo_card', 'madanalysis5_parton_card','madanalysis5_hadron_card', 'rivet_card']: start = 2 @@ -5576,6 +5642,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): categories.append('delphes_card') if self.has_rivet: categories.append('rivet_card') + if self.has_fo_card: + categories.append('fo_card') possibilities['category of parameter (optional)'] = \ self.list_completion(text, categories) @@ -5630,7 +5698,13 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): if 'delphes_card' in allowed: if allowed['delphes_card'] == 'default': opts = ['default', 'atlas', 'cms'] - possibilities['Delphes Card'] = self.list_completion(text, opts) + possibilities['Delphes Card'] = self.list_completion(text, opts) + + if 'fo_card' in allowed: + opts = self.fo_card.string_vars + if allowed['fo_card'] == 'default': + opts.append('default') + possibilities['FO Card'] = self.list_completion(text, opts) if 'value' in list(allowed.keys()): opts = ['default', 'scale'] @@ -5733,21 +5807,28 @@ def do_set(self, line): if args[0] in self.special_shortcut: targettypes , cmd = self.special_shortcut[args[0]] if len(args) != len(targettypes) +1: - logger.warning('shortcut %s requires %s argument' % (args[0], len(targettypes))) - if len(args) < len(targettypes) +1: - return + if len(targettypes) == 1 and args[len(targettypes)].startswith('scan'): + args = args[:len(targettypes)] + [' '.join(args[len(targettypes):])] + targettypes = [str] else: - logger.warning('additional argument will be ignored') + logger.warning('shortcut %s requires %s argument' % (args[0], len(targettypes))) + if len(args) < len(targettypes) +1: + return + else: + logger.warning('additional argument will be ignored') values ={} for i, argtype in enumerate(targettypes): try: - values = {str(i): banner_mod.ConfigFile.format_variable(args[i+1], argtype, args[0])} + values[str(i)] = banner_mod.ConfigFile.format_variable(args[i+1], argtype, args[0]) except ValueError as e: logger.warning("Wrong argument: The entry #%s should be of type %s.", i+1, argtype) return except InvalidCmd as e: - logger.warning(str(e)) - return + if isinstance(args[i+1], str) and args[i+1].startswith('scan'): + values[str(i)] = args[i+1] + else: + logger.warning(str(e)) + return #else: # logger.warning("too many argument for this command") # return @@ -5787,7 +5868,7 @@ def do_set(self, line): if os.path.exists(pythia_path): logger.info('add line QCUT = %s in pythia_card.dat' % args[1]) p_card = open(pythia_path,'r').read() - p_card, n = re.subn('''^\s*QCUT\s*=\s*[\de\+\-\.]*\s*$''', + p_card, n = re.subn(r'''^\s*QCUT\s*=\s*[\de\+\-\.]*\s*$''', ''' QCUT = %s ''' % args[1], \ p_card, flags=(re.M+re.I)) if n==0: @@ -5801,7 +5882,7 @@ def do_set(self, line): if os.path.exists(pythia_path): logger.info('add line SHOWERKT = %s in pythia_card.dat' % args[1].upper()) p_card = open(pythia_path,'r').read() - p_card, n = re.subn('''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''', + p_card, n = re.subn(r'''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''', ''' SHOWERKT = %s ''' % args[1].upper(), \ p_card, flags=(re.M+re.I)) if n==0: @@ -5856,7 +5937,7 @@ def do_set(self, line): pjoin(self.me_dir,'Cards', 'delphes_card.dat')) return - if args[0] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', + if args[0] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', 'fo_card', 'delphes_card','madanalysis5_hadron_card','madanalysis5_parton_card','rivet_card']: if args[1] == 'default': @@ -6176,6 +6257,22 @@ def do_set(self, line): self.setRivet(args[start], value, default=default) self.rivet_card.write(self.paths['rivet'], self.paths['rivet_default']) + elif self.has_fo_card and (card in ['', 'fo_card'])\ + and args[start].lower() in [k.lower() for k in self.fo_card.string_vars]: + + if args[start] in self.conflict and card == '': + text = 'ambiguous name (present in more than one card). Please specify which card to edit' + logger.warning(text) + return + if args[start+1] == 'default': + value = self.fo_card_default[args[start]] + default = True + else: + value = args[start+1] + default = False + self.fo_card[args[start]] = value + self.modified_card.add('fo_card') + #INVALID -------------------------------------------------------------- else: logger.warning('invalid set command %s ' % line) @@ -6222,12 +6319,13 @@ def setM(self, block, name, value): def setR(self, name, value): - if self.mother_interface.inputfile: - self.run_card.set(name, value, user=True, raiseerror=True) - else: - self.run_card.set(name, value, user=True) - new_value = self.run_card.get(name) - logger.info('modify parameter %s of the run_card.dat to %s' % (name, new_value),'$MG:BOLD') + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + if self.mother_interface.inputfile: + self.run_card.set(name, value, user=True, raiseerror=True) + else: + self.run_card.set(name, value, user=True) + new_value = self.run_card.get(name) + logger.info('modify parameter %s of the run_card.dat to %s' % (name, new_value),'$MG:BOLD') def setML(self, name, value, default=False): @@ -6314,6 +6412,7 @@ def check_card_consistency(self): proc_charac = self.mother_interface.proc_characteristics if proc_charac['grouped_matrix'] and \ + isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int) and \ abs(self.run_card['lpp1']) == 1 == abs(self.run_card['lpp2']) and \ (self.run_card['nb_proton1'] != self.run_card['nb_proton2'] or self.run_card['nb_neutron1'] != self.run_card['nb_neutron2'] or @@ -6403,41 +6502,42 @@ def check_card_consistency(self): # check that only quark/gluon/photon are in initial beam if lpp=+-1 pdg_in_p = list(range(-6,7))+[21,22] - if (abs(self.run_card['lpp1'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial1'])) \ + if isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int): + if(abs(self.run_card['lpp1'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial1'])) \ or (abs(self.run_card['lpp2'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial2'])): - if 'pythia_card.dat' in self.cards or 'pythia8_card.dat' in self.cards: - path_to_remove = None - if 'pythia_card.dat' in self.cards: - path_to_remove = self.paths['pythia'] - card_to_remove = 'pythia_card.dat' - elif 'pythia8_card.dat' in self.cards: - path_to_remove = self.paths['pythia8'] - card_to_remove = 'pythia8_card.dat' - if path_to_remove: - if 'partonshower' in self.run_card['bypass_check']: + if 'pythia_card.dat' in self.cards or 'pythia8_card.dat' in self.cards: + path_to_remove = None + if 'pythia_card.dat' in self.cards: + path_to_remove = self.paths['pythia'] + card_to_remove = 'pythia_card.dat' + elif 'pythia8_card.dat' in self.cards: + path_to_remove = self.paths['pythia8'] + card_to_remove = 'pythia8_card.dat' + if path_to_remove: + if 'partonshower' in self.run_card['bypass_check']: + logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") + else: + logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') + os.remove(path_to_remove) + self.cards.remove(card_to_remove) + else: + logger.info('Remember that Parton-Shower are not yet ready for such proton component definition (HW implementation in progress).', '$MG:BOLD' ) + elif (abs(self.run_card['lpp1'])==3 and abs(self.run_card['lpp2'])==3): + if 'pythia8_card.dat' in self.cards: + if self.run_card['pdlabel'] == 'isronlyll': + if 'partonshower' not in self.run_card['bypass_check']: + # force that QED shower is on? + for param in ['TimeShower:QEDshowerByQ', 'TimeShower:QEDshowerByL', 'TimeShower:QEDshowerByGamma', 'SpaceShower:QEDshowerByQ', 'SpaceShower:QEDshowerByL']: + if param not in self.PY8Card or \ + (not self.PY8Card[param] and param.lower() not in self.PY8Card.user_set): + logger.warning('Activating QED shower: setting %s to True', param) + self.PY8Card[param] = True + elif 'partonshower' in self.run_card['bypass_check']: logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") - else: + else: logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') - os.remove(path_to_remove) - self.cards.remove(card_to_remove) - else: - logger.info('Remember that Parton-Shower are not yet ready for such proton component definition (HW implementation in progress).', '$MG:BOLD' ) - elif (abs(self.run_card['lpp1'])==3 and abs(self.run_card['lpp2'])==3): - if 'pythia8_card.dat' in self.cards: - if self.run_card['pdlabel'] == 'isronlyll': - if 'partonshower' not in self.run_card['bypass_check']: - # force that QED shower is on? - for param in ['TimeShower:QEDshowerByQ', 'TimeShower:QEDshowerByL', 'TimeShower:QEDshowerByGamma', 'SpaceShower:QEDshowerByQ', 'SpaceShower:QEDshowerByL']: - if param not in self.PY8Card or \ - (not self.PY8Card[param] and param.lower() not in self.PY8Card.user_set): - logger.warning('Activating QED shower: setting %s to True', param) - self.PY8Card[param] = True - elif 'partonshower' in self.run_card['bypass_check']: - logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") - else: - logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') - os.remove(self.paths['pythia8']) - self.cards.remove('pythia8_card.dat') + os.remove(self.paths['pythia8']) + self.cards.remove('pythia8_card.dat') ######################################################################## @@ -6514,7 +6614,8 @@ def check_card_consistency(self): #check relation between lepton PDF // dressed lepton collisions // ... - if abs(self.run_card['lpp1']) != 1 or abs(self.run_card['lpp2']) != 1: + if isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int) and \ + abs(self.run_card['lpp1']) != 1 or abs(self.run_card['lpp2']) != 1: if abs(self.run_card['lpp1']) == abs(self.run_card['lpp2']) == 3: # this can be dressed lepton or photon-flux if proc_charac['pdg_initial1'] in [[11],[-11]] and proc_charac['pdg_initial2'] in [[11],[-11]]: @@ -6732,7 +6833,11 @@ def write_card_param(self): """ write the param_card """ self.param_card.write(self.paths['param']) - + + def write_card_fo_card(self): + """ write the fo_card""" + self.fo_card.write_card_from_template(self.paths['FO_analyse'], self.paths['FO_analyse_default']) + @staticmethod def update_dependent(mecmd, me_dir, param_card, path ,timer=0, run_card=None, lhapdfconfig=None): @@ -7076,7 +7181,7 @@ def do_decay(self, line): #first find the particle particle = line.split('>')[0].strip() logger.info("change madspin_card to define the decay of %s: %s" %(particle, line.strip()), '$MG:BOLD') - particle = particle.replace('+','\+').replace('-','\-') + particle = particle.replace('+',r'\+').replace('-',r'\-') decay_pattern = re.compile(r"^\s*decay\s+%s\s*>[\s\w+-~]*?$" % particle, re.I+re.M) text= open(path).read() text = decay_pattern.sub('', text) @@ -7193,7 +7298,7 @@ def help_edit(self, prefix=True): logger.info( ' --clean remove all previously existing line in the file') logger.info( ' --comment_line="" comment all lines matching the regular expression') logger.info('') - logger.info(' Note: all regular-expression will be prefixed by ^\s*') + logger.info(r' Note: all regular-expression will be prefixed by ^\s*') logger.info('') logger.info( ' example: edit reweight --after_line="change mode\b" change model heft') logger.info( ' edit madspin --after_line="banner" change model XXXX') @@ -7314,7 +7419,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''replace_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[14:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[14:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7344,7 +7449,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''comment_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[14:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[14:-1] nb_mod = 0 for posline,l in enumerate(split): if re.search(pattern, l): @@ -7366,7 +7471,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''before_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[13:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[13:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7383,7 +7488,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern = r'''after_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[12:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[12:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7527,16 +7632,19 @@ def open_file(self, answer): answer = 'plot' else: answer = self.cards[int(answer)-self.integer_bias] - + path = '' if 'madweight' in answer: answer = answer.replace('madweight', 'MadWeight') elif 'MadLoopParams' in answer: answer = self.paths['ML'] elif 'pythia8_card' in answer: answer = self.paths['pythia8'] + elif 'FO_analyse' in answer: + path = self.paths['FO_analyse'] + answer = 'fo_card' if os.path.exists(answer): path = answer - else: + elif not os.path.exists(path): if not '.dat' in answer and not '.lhco' in answer: if answer != 'trigger': path = self.paths[answer] @@ -7595,7 +7703,8 @@ def reload_card(self, path): logger.error('Please re-open the file and fix the problem.') logger.warning('using the \'set\' command without opening the file will discard all your manual change') elif path == self.paths['run']: - self.run_card = banner_mod.RunCard(path) + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + self.run_card = banner_mod.RunCard(path) elif path == self.paths['shower']: self.shower_card = shower_card_mod.ShowerCard(path) elif path == self.paths['ML']: @@ -7614,6 +7723,8 @@ def reload_card(self, path): except: import internal.madweight.Cards as mwcards self.mw_card = mwcards.Card(path) + elif path == self.paths['FO_analyse']: + self.fo_card = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse']) else: logger.debug('not keep in sync: %s', path) return path @@ -7629,6 +7740,9 @@ def scanparamcardhandling(input_path=lambda obj: pjoin(obj.me_dir, 'Cards', 'par iteratorclass=param_card_mod.ParamCardIterator, summaryorder=lambda obj: lambda:None, check_card=lambda obj: CommonRunCmd.static_check_param_card, + run_card_scan=False, + run_card_input= lambda obj: pjoin(obj.me_dir, 'Cards', 'run_card.dat'), + run_card_iteratorclass=banner_mod.RunCardIterator, ): """ This is a decorator for customizing/using scan over the param_card (or technically other) This should be use like this: @@ -7678,7 +7792,60 @@ def __enter__(self): def __exit__(self, ctype, value, traceback ): self.iterator.write(self.path) - def decorator(original_fct): + def scan_over_run_card(original_fct, obj, *args, **opts): + + if isinstance(input_path, str): + card_path = run_card_input + else: + card_path = run_card_input(obj) + + run_card_iterator = run_card_iteratorclass(card_path) + orig_card = copy.deepcopy(run_card_iterator.run_card) + if not run_card_iterator.run_card.scan_set: + return original_fct(obj, *args, **opts) + + + with restore_iterator(orig_card, card_path): + # this with statement ensure that the original card is restore + # whatever happens inside those block + + if not hasattr(obj, 'allow_notification_center'): + obj.allow_notification_center = False + with misc.TMP_variable(obj, 'allow_notification_center', False): + orig_name = get_run_name(obj) + if not orig_name and args[1]: + orig_name = args[1][0] + args = (args[0], args[1][1:]) + #orig_name = "scan_%s" % len(obj.results) + + try: + os.mkdir(pjoin(obj.me_dir, 'Events', orig_name)) + except Exception: + pass + next_name = orig_name + "_00" + + for i,card in enumerate(run_card_iterator): + card.write(card_path) + # still have to check for the auto-wdith + #if i !=0: + next_name = run_card_iterator.get_next_name(next_name) + set_run_name(obj)(next_name) + try: + original_fct(obj, *args, **opts) + except ignoreerror as error: + run_card_iterator.store_entry(next_name, {'exception': error}) + else: + run_card_iterator.store_entry(next_name, store_for_scan(obj)(), run_card_path=card_path) + + #param_card_iterator.write(card_path) #-> this is done by the with statement + name = misc.get_scan_name(orig_name, next_name) + path = result_path(obj) % name + logger.info("write scan results in %s" % path ,'$MG:BOLD') + order = summaryorder(obj)() + run_card_iterator.write_summary(path, order=order) + + + def decorator(original_fct): def new_fct(obj, *args, **opts): if isinstance(input_path, str): @@ -7702,8 +7869,13 @@ def new_fct(obj, *args, **opts): if not param_card_iterator: #first run of the function - original_fct(obj, *args, **opts) - return + if run_card_scan: + scan_over_run_card(original_fct, obj, *args, **opts) + return + else: + #first run of the function + original_fct(obj, *args, **opts) + return with restore_iterator(param_card_iterator, card_path): # this with statement ensure that the original card is restore diff --git a/epochX/cudacpp/gg_ttgg.mad/bin/internal/extended_cmd.py b/epochX/cudacpp/gg_ttgg.mad/bin/internal/extended_cmd.py index 2f37070580..789976beee 100755 --- a/epochX/cudacpp/gg_ttgg.mad/bin/internal/extended_cmd.py +++ b/epochX/cudacpp/gg_ttgg.mad/bin/internal/extended_cmd.py @@ -624,12 +624,12 @@ def complete(self, text, state): compfunc = self.completenames # correct wrong splittion with '\ ' - if line and begidx > 2 and line[begidx-2:begidx] == '\ ': + if line and begidx > 2 and line[begidx-2:begidx] == r'\ ': Ntext = line.split(os.path.sep)[-1] - self.completion_prefix = Ntext.rsplit('\ ', 1)[0] + '\ ' + self.completion_prefix = Ntext.rsplit(r'\ ', 1)[0] + r'\ ' to_rm = len(self.completion_prefix) - 1 Nbegidx = len(line.rsplit(os.path.sep, 1)[0]) + 1 - data = compfunc(Ntext.replace('\ ', ' '), line, Nbegidx, endidx) + data = compfunc(Ntext.replace(r'\ ', ' '), line, Nbegidx, endidx) self.completion_matches = [p[to_rm:] for p in data if len(p)>to_rm] # correct wrong splitting with '-'/"=" @@ -742,7 +742,7 @@ def path_completion(text, base_dir = None, only_dirs = False, completion += [prefix + f for f in ['.'+os.path.sep, '..'+os.path.sep] if \ f.startswith(text) and not prefix.startswith('.')] - completion = [a.replace(' ','\ ') for a in completion] + completion = [a.replace(' ',r'\ ') for a in completion] return completion @@ -1253,7 +1253,7 @@ def check_answer_in_input_file(self, question_instance, default, path=False, lin return possibility[0] if '=' in line and ' ' in line.strip(): leninit = len(line) - line,n = re.subn('\s*=\s*','=', line) + line,n = re.subn(r'\s*=\s*','=', line) if n and len(line) != leninit: return self.check_answer_in_input_file(question_instance, default, path=path, line=line) @@ -1311,7 +1311,7 @@ def nice_error_handling(self, error, line): if os.path.exists(self.debug_output): os.remove(self.debug_output) try: - super(Cmd,self).onecmd('history %s' % self.debug_output.replace(' ', '\ ')) + super(Cmd,self).onecmd('history %s' % self.debug_output.replace(' ', r'\ ')) except Exception as error: logger.error(error) @@ -2001,6 +2001,7 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): text = "" has_mg5_path = False # Use local configuration => Need to update the path + already_written = set() for line in open(basefile): if '=' in line: data, value = line.split('=',1) @@ -2018,9 +2019,12 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): comment = '' if key in to_keep: value = str(to_keep[key]) - else: + elif line not in already_written: + already_written.add(line) text += line continue + else: + continue if key == 'mg5_path': has_mg5_path = True try: @@ -2032,14 +2036,20 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): # check if absolute path if not os.path.isabs(value): value = os.path.realpath(os.path.join(basedir, value)) - text += '%s = %s # %s \n' % (key, value, comment) + new_line = '%s = %s # %s \n' % (key, value, comment) + if new_line not in already_written: + text += new_line + already_written.add(new_line) for key in to_write: if key in to_keep: - text += '%s = %s \n' % (key, to_keep[key]) + new_line = '%s = %s \n' % (key, to_keep[key]) + if new_line not in already_written: + text += new_line if not MADEVENT and not has_mg5_path: - text += """\n# MG5 MAIN DIRECTORY\n""" - text += "mg5_path = %s\n" % MG5DIR + if "mg5_path = %s\n" % MG5DIR not in already_written: + text += """\n# MG5 MAIN DIRECTORY\n""" + text += "mg5_path = %s\n" % MG5DIR writer = open(filepath,'w') writer.write(text) @@ -2190,7 +2200,7 @@ def onecmd(self, line, **opt): raise def reask(self, reprint_opt=True): - pat = re.compile('\[(\d*)s to answer\]') + pat = re.compile(r'\[(\d*)s to answer\]') prev_timer = signal.alarm(0) # avoid timer if any if prev_timer: @@ -2991,7 +3001,7 @@ def question_formatting(self, nb_col = 80, lpotential_switch=0, lnb_key=0, key=None): - """should return four lines: + r"""should return four lines: 1. The upper band (typically /========\ 2. The lower band (typically \========/ 3. The line without conflict | %(nb)2d. %(descrip)-20s %(name)5s = %(switch)-10s | @@ -3239,13 +3249,13 @@ def create_question(self, help_text=True): data_to_format['conflict_switch'] = self.color_for_value(key,self.inconsistent_keys[key], consistency=False) if hidden_line: - f2 = re.sub('%(\((?:name|descrip|add_info)\)-?)(\d+)s', + f2 = re.sub(r'%(\((?:name|descrip|add_info)\)-?)(\d+)s', lambda x: '%%%s%ds' % (x.group(1),int(x.group(2))+9), f2) text.append(f2 % data_to_format) elif hidden_line: if not f3: - f3 = re.sub('%(\((?:name|descrip|add_info)\)-?)(\d+)s', + f3 = re.sub(r'%(\((?:name|descrip|add_info)\)-?)(\d+)s', lambda x: '%%%s%ds' % (x.group(1),int(x.group(2))+9), f1) text.append(f3 % data_to_format) diff --git a/epochX/cudacpp/gg_ttgg.mad/bin/internal/file_writers.py b/epochX/cudacpp/gg_ttgg.mad/bin/internal/file_writers.py index 41bff05276..526756129f 100755 --- a/epochX/cudacpp/gg_ttgg.mad/bin/internal/file_writers.py +++ b/epochX/cudacpp/gg_ttgg.mad/bin/internal/file_writers.py @@ -36,10 +36,10 @@ class FileWriter(io.FileIO): supported_preprocessor_commands = ['if'] preprocessor_command_re=re.compile( - "\s*(?P%s)\s*\(\s*(?P.*)\s*\)\s*{\s*"\ + r"\s*(?P%s)\s*\(\s*(?P.*)\s*\)\s*{\s*"\ %('|'.join(supported_preprocessor_commands))) preprocessor_endif_re=re.compile(\ - "\s*}\s*(?Pelse)?\s*(\((?P.*)\))?\s*(?P{)?\s*") + r"\s*}\s*(?Pelse)?\s*(\((?P.*)\))?\s*(?P{)?\s*") class FileWriterError(IOError): """Exception raised if an error occurs in the definition @@ -191,15 +191,15 @@ class FortranWriterError(FileWriter.FileWriterError): pass # Parameters defining the output of the Fortran writer - keyword_pairs = {'^if.+then\s*$': ('^endif', 2), - '^type(?!\s*\()\s*.+\s*$': ('^endtype', 2), - '^do(?!\s+\d+)\s+': ('^enddo\s*$', 2), - '^subroutine': ('^end\s*$', 0), - '^module': ('^end\s*$', 0), - 'function': ('^end\s*$', 0)} - single_indents = {'^else\s*$':-2, - '^else\s*if.+then\s*$':-2} - number_re = re.compile('^(?P\d+)\s+(?P.*)') + keyword_pairs = {r'^if.+then\s*$': ('^endif', 2), + r'^type(?!\s*\()\s*.+\s*$': ('^endtype', 2), + r'^do(?!\s+\d+)\s+': (r'^enddo\s*$', 2), + '^subroutine': (r'^end\s*$', 0), + '^module': (r'^end\s*$', 0), + 'function': (r'^end\s*$', 0)} + single_indents = {r'^else\s*$':-2, + r'^else\s*if.+then\s*$':-2} + number_re = re.compile(r'^(?P\d+)\s+(?P.*)') line_cont_char = '$' comment_char = 'c' uniformcase = True #force everyting to be lower/upper case @@ -212,7 +212,7 @@ class FortranWriterError(FileWriter.FileWriterError): # Private variables __indent = 0 __keyword_list = [] - __comment_pattern = re.compile(r"^(\s*#|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|!)", re.IGNORECASE) + __comment_pattern = re.compile(r"^(\s*#|c\$|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|\s*!|!\$)", re.IGNORECASE) __continuation_line = re.compile(r"(?: )[$&]") def write_line(self, line): @@ -424,26 +424,20 @@ def count_number_of_quotes(self, line): i = i + 1 return len(splitline)-1 - def remove_routine(self, text, fct_names, formatting=True): - """write the incoming text but fully removing the associate routine/function - text can be a path to a file, an iterator, a string - fct_names should be a list of functions to remove + @staticmethod + def get_routine(text, fct_names, call_back=None): + """ + get the fortran function from a fortran file """ - f77_type = ['real*8', 'integer', 'double precision', 'logical'] - pattern = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I) - + + if isinstance(text, str): + text = text.split('\n') + + to_write=False removed = [] - if isinstance(text, str): - if '\n' in text: - text = text.split('\n') - else: - text = open(text) - if isinstance(fct_names, str): - fct_names = [fct_names] - - to_write=True for line in text: fct = pattern.findall(line) if fct: @@ -451,22 +445,38 @@ def remove_routine(self, text, fct_names, formatting=True): to_write = False else: to_write = True - if to_write: - if formatting: - if line.endswith('\n'): - line = line[:-1] - self.writelines(line) - else: - if not line.endswith('\n'): - line = '%s\n' % line - super(FileWriter,self).writelines(line) + if call_back: + call_back(line) else: removed.append(line) - + return removed + + def remove_routine(self, text, fct_names, formatting=True): + """write the incoming text but fully removing the associate routine/function + text can be a path to a file, an iterator, a string + fct_names should be a list of functions to remove + """ + + def call_back(line): + if formatting: + if line.endswith('\n'): + line = line[:-1] + self.writelines(line) + else: + if not line.endswith('\n'): + line = '%s\n' % line + super(FileWriter,self).writelines(line) + + return self.get_routine(text, fct_names, call_back) + +class FortranWriter90(FortranWriter): + + comment_char = ' !' + #=============================================================================== # CPPWriter #=============================================================================== @@ -497,50 +507,50 @@ class CPPWriterError(FileWriter.FileWriterError): '^private': standard_indent, '^protected': standard_indent} - spacing_patterns = [ - ('\s*\"\s*}', '\"'), - ('\s*,\s*', ', '), - ('\s*-\s*', ' - '), - ('([{(,=])\s*-\s*', '\g<1> -'), - ('(return)\s*-\s*', '\g<1> -'), - ('\s*\+\s*', ' + '), - ('([{(,=])\s*\+\s*', '\g<1> +'), - ('\(\s*', '('), - ('\s*\)', ')'), - ('\{\s*', '{'), - ('\s*\}', '}'), - ('\s*=\s*', ' = '), - ('\s*>\s*', ' > '), - ('\s*<\s*', ' < '), - ('\s*!\s*', ' !'), - ('\s*/\s*', '/'), - ('(?\s+>\s*', ' >> '), - ('<\s*double\s*>>\s*', ' > '), - ('\s*<\s+<\s*', ' << '), - ('\s*-\s+>\s*', '->'), - ('\s*=\s+=\s*', ' == '), - ('\s*!\s+=\s*', ' != '), - ('\s*>\s+=\s*', ' >= '), - ('\s*<\s+=\s*', ' <= '), - ('\s*&&\s*', ' && '), - ('\s*\|\|\s*', ' || '), - ('\s*{\s*}', ' {}'), - ('\s*;\s*', '; '), - (';\s*\}', ';}'), - (';\s*$}', ';'), - ('\s*<\s*([a-zA-Z0-9]+?)\s*>', '<\g<1>>'), - ('^#include\s*<\s*(.*?)\s*>', '#include <\g<1>>'), - ('(\d+\.{0,1}\d*|\.\d+)\s*[eE]\s*([+-]{0,1})\s*(\d+)', - '\g<1>e\g<2>\g<3>'), - ('\s+',' '), - ('^\s*#','#')] + spacing_patterns = [(r'\s*\"\s*}', '\"'), + (r'\s*,\s*', ', '), + (r'\s*-\s*', ' - '), + (r'([{(,=])\s*-\s*', r'\g<1> -'), + (r'(return)\s*-\s*', r'\g<1> -'), + (r'\s*\+\s*', ' + '), + (r'([{(,=])\s*\+\s*', r'\g<1> +'), + (r'\(\s*', '('), + (r'\s*\)', ')'), + (r'\{\s*', '{'), + (r'\s*\}', '}'), + (r'\s*=\s*', ' = '), + (r'\s*>\s*', ' > '), + (r'\s*<\s*', ' < '), + (r'\s*!\s*', ' !'), + (r'\s*/\s*', '/'), + (r'\s*\*\s*', ' * '), + (r'\s*-\s+-\s*', '-- '), + (r'\s*\+\s+\+\s*', '++ '), + (r'\s*-\s+=\s*', ' -= '), + (r'\s*\+\s+=\s*', ' += '), + (r'\s*\*\s+=\s*', ' *= '), + (r'\s*/=\s*', ' /= '), + (r'\s*>\s+>\s*', ' >> '), + (r'<\s*double\s*>>\s*', ' > '), + (r'\s*<\s+<\s*', ' << '), + (r'\s*-\s+>\s*', '->'), + (r'\s*=\s+=\s*', ' == '), + (r'\s*!\s+=\s*', ' != '), + (r'\s*>\s+=\s*', ' >= '), + (r'\s*<\s+=\s*', ' <= '), + (r'\s*&&\s*', ' && '), + (r'\s*\|\|\s*', ' || '), + (r'\s*{\s*}', ' {}'), + (r'\s*;\s*', '; '), + (r';\s*\}', ';}'), + (r';\s*$}', ';'), + (r'\s*<\s*([a-zA-Z0-9]+?)\s*>', r'<\g<1>>'), + (r'^#include\s*<\s*(.*?)\s*>', r'#include <\g<1>>'), + (r'(\d+\.{0,1}\d*|\.\d+)\s*[eE]\s*([+-]{0,1})\s*(\d+)', + r'\g<1>e\g<2>\g<3>'), + (r'\s+',' '), + (r'^\s*#','#')] + spacing_re = dict([(key[0], re.compile(key[0])) for key in \ spacing_patterns]) diff --git a/epochX/cudacpp/gg_ttgg.mad/bin/internal/gen_crossxhtml.py b/epochX/cudacpp/gg_ttgg.mad/bin/internal/gen_crossxhtml.py index d58ec573bc..681bf9d09b 100755 --- a/epochX/cudacpp/gg_ttgg.mad/bin/internal/gen_crossxhtml.py +++ b/epochX/cudacpp/gg_ttgg.mad/bin/internal/gen_crossxhtml.py @@ -648,7 +648,7 @@ def recreate(self, banner): if run_card['ickkw'] != 0: #parse the file to have back the information pythia_log = misc.BackRead(pjoin(path, '%s_pythia.log' % tag)) - pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") + pythiare = re.compile(r"\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") for line in pythia_log: info = pythiare.search(line) if not info: @@ -1623,7 +1623,7 @@ def get_html(self, runresults): elif self.debug: text = str(self.debug).replace('. ','.
') if 'http' in text: - pat = re.compile('(http[\S]*)') + pat = re.compile(r'(http[\S]*)') text = pat.sub(r' here ', text) debug = '
%s
%s
' % \ (self.debug.__class__.__name__, text) diff --git a/epochX/cudacpp/gg_ttgg.mad/bin/internal/gen_ximprove.py b/epochX/cudacpp/gg_ttgg.mad/bin/internal/gen_ximprove.py index c86da36a05..415ecc9de0 100755 --- a/epochX/cudacpp/gg_ttgg.mad/bin/internal/gen_ximprove.py +++ b/epochX/cudacpp/gg_ttgg.mad/bin/internal/gen_ximprove.py @@ -158,8 +158,11 @@ def get_helicity(self, to_submit=True, clean=True): (stdout, _) = p.communicate(''.encode()) stdout = stdout.decode('ascii',errors='ignore') if stdout: - nb_channel = max([math.floor(float(d)) for d in stdout.split()]) + lines = stdout.strip().split('\n') + nb_channel = max([math.floor(float(d)) for d in lines[-1].split()]) else: + if os.path.exists(pjoin(self.me_dir, 'error')): + os.remove(pjoin(self.me_dir, 'error')) for matrix_file in misc.glob('matrix*orig.f', Pdir): files.cp(matrix_file, matrix_file.replace('orig','optim')) P_zero_result.append(Pdir) @@ -297,12 +300,14 @@ def get_helicity(self, to_submit=True, clean=True): bad_amps_perhel = [] if __debug__: mtext = open(matrix_file).read() - nb_amp = int(re.findall('PARAMETER \(NGRAPHS=(\d+)\)', mtext)[0]) - logger.debug('nb_hel: %s zero amp: %s bad_amps_hel: %s/%s', len(good_hels),len(bad_amps),len(bad_amps_perhel), len(good_hels)*nb_amp ) + nb_amp = int(re.findall(r'PARAMETER \(NGRAPHS=(\d+)\)', mtext)[0]) + logger.debug('(%s) nb_hel: %s zero amp: %s bad_amps_hel: %s/%s', split_file[-1], len(good_hels),len(bad_amps),len(bad_amps_perhel), len(good_hels)*nb_amp ) if len(good_hels) == 1: files.cp(matrix_file, matrix_file.replace('orig','optim')) continue # avoid optimization if onlye one helicity - recycler = hel_recycle.HelicityRecycler(good_hels, bad_amps, bad_amps_perhel) + + gauge = self.cmd.proc_characteristics['gauge'] + recycler = hel_recycle.HelicityRecycler(good_hels, bad_amps, bad_amps_perhel, gauge=gauge) # In case of bugs you can play around with these: recycler.hel_filt = self.run_card['hel_filtering'] recycler.amp_splt = self.run_card['hel_splitamp'] @@ -1299,7 +1304,7 @@ def get_job_for_event(self): 'script_name': 'unknown', 'directory': C.name, # need to be change for splitted job 'P_dir': C.parent_name, - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # needed for RO gridpack 'offset': 1, # need to be change for splitted job 'nevents': nevents, 'maxiter': self.max_iter, @@ -1387,7 +1392,7 @@ def create_ajob(self, template, jobs, write_dir=None): break info = jobs[j] info['script_name'] = 'ajob%i' % script_number - info['keeplog'] = 'false' + info['keeplog'] = 'false' if self.run_card['keep_log'] != 'debug' else 'true' if "base_directory" not in info: info["base_directory"] = "./" fsock.write(template_text % info) @@ -1456,7 +1461,7 @@ def get_job_for_precision(self): 'script_name': 'unknown', 'directory': C.name, # need to be change for splitted job 'P_dir': C.parent_name, - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # used for RO gridpack 'offset': 1, # need to be change for splitted job 'nevents': nevents, 'maxiter': self.max_iter, @@ -1916,7 +1921,7 @@ def get_job_for_event(self): 'directory': C.name, # need to be change for splitted job 'P_dir': os.path.basename(C.parent_name), 'offset': 1, # need to be change for splitted job - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # use for RO gridpack 'nevents': nevents, #int(nevents*self.gen_events_security)+1, 'maxiter': self.max_iter, 'miniter': self.min_iter, diff --git a/epochX/cudacpp/gg_ttgg.mad/bin/internal/hel_recycle.py b/epochX/cudacpp/gg_ttgg.mad/bin/internal/hel_recycle.py index dfa45d5d20..6c86611f68 100755 --- a/epochX/cudacpp/gg_ttgg.mad/bin/internal/hel_recycle.py +++ b/epochX/cudacpp/gg_ttgg.mad/bin/internal/hel_recycle.py @@ -383,7 +383,7 @@ def get_number(cls, *args): class HelicityRecycler(): '''Class for recycling helicity''' - def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[]): + def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[], gauge='U'): External.good_hel = [] External.nhel_lines = '' @@ -427,6 +427,7 @@ def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[]): self.all_hel = [] self.hel_filt = True + self.gauge = gauge def set_input(self, file): if 'born_matrix' in file: @@ -612,7 +613,7 @@ def unfold_helicities(self, line, nature): def apply_amps(self, line, new_objs): if self.amp_splt: - return split_amps(line, new_objs) + return split_amps(line, new_objs, gauge=self.gauge) else: return apply_args(line, [i.args for i in new_objs]) @@ -785,7 +786,7 @@ def apply_args(old_line, all_the_args): return ''.join(new_lines) -def split_amps(line, new_amps): +def split_amps(line, new_amps, gauge): if not new_amps: return '' fct = line.split('(',1)[0].split('_0')[0] @@ -841,34 +842,31 @@ def split_amps(line, new_amps): spin = fct.split(None,1)[1][to_remove] lines.append('%sP1N_%s(%s)' % (fct, to_remove+1, ', '.join(args))) - hel, iamp = re.findall('AMP\((\d+),(\d+)\)', amp_result)[0] + hel, iamp = re.findall(r'AMP\((\d+),(\d+)\)', amp_result)[0] hel_calculated.append(hel) #lines.append(' %(result)s = TMP(3) * W(3,%(w)s) + TMP(4) * W(4,%(w)s)+' # % {'result': amp_result, 'w': windex}) #lines.append(' & TMP(5) * W(5,%(w)s)+TMP(6) * W(6,%(w)s)' # % {'result': amp_result, 'w': windex}) - if spin in "VF": - lines.append(""" call CombineAmp(%(nb)i, - & (/%(hel_list)s/), - & (/%(w_list)s/), - & TMP, W, AMP(1,%(iamp)s))""" % - {'nb': len(sub_amps), - 'hel_list': ','.join(hel_calculated), - 'w_list': ','.join(windices), - 'iamp': iamp - }) + if spin == "F" or ( spin == "V" and gauge !='FD'): + suffix = '' elif spin == "S": - lines.append(""" call CombineAmpS(%(nb)i, - &(/%(hel_list)s/), - & (/%(w_list)s/), - & TMP, W, AMP(1,%(iamp)s))""" % - {'nb': len(sub_amps), - 'hel_list': ','.join(hel_calculated), - 'w_list': ','.join(windices), - 'iamp': iamp - }) + suffix = 'S' + elif spin == "V" and gauge == "FD": + suffix = "FD" else: - raise Exception("split amp are not supported for spin2 and 3/2") + raise Exception("split amp not supported for spin2, 3/2") + + lines.append(""" call CombineAmp%(suffix)s(%(nb)i, + & (/%(hel_list)s/), + & (/%(w_list)s/), + & TMP, W, AMP(1,%(iamp)s))""" % {'suffix':suffix, + 'nb': len(sub_amps), + 'hel_list': ','.join(hel_calculated), + 'w_list': ','.join(windices), + 'iamp': iamp + }) + #lines.append('') return '\n'.join(lines) diff --git a/epochX/cudacpp/gg_ttgg.mad/bin/internal/histograms.py b/epochX/cudacpp/gg_ttgg.mad/bin/internal/histograms.py index 98f22c4c3a..9931127f66 100755 --- a/epochX/cudacpp/gg_ttgg.mad/bin/internal/histograms.py +++ b/epochX/cudacpp/gg_ttgg.mad/bin/internal/histograms.py @@ -632,34 +632,34 @@ class HwU(Histogram): # than necessary because the HwU standard allows for spaces from within # the name of a weight weight_header_re = re.compile( - '&\s*(?P(\S|(\s(?!\s*(&|$))))+)(\s(?!(&|$)))*') + r'&\s*(?P(\S|(\s(?!\s*(&|$))))+)(\s(?!(&|$)))*') # ================================ # Histo weight specification RE's # ================================ # The start of a plot - histo_start_re = re.compile('^\s*\s*(?P\d+)\s*"\s*'+ - '(?P(\S|(\s(?!\s*")))+)\s*"\s*$') + histo_start_re = re.compile(r'^\s*\s*(?P\d+)\s*"\s*'+ + r'(?P(\S|(\s(?!\s*")))+)\s*"\s*$') # A given weight specifier - a_float_re = '[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' - histo_bin_weight_re = re.compile('(?P%s|NaN)'%a_float_re,re.IGNORECASE) - a_int_re = '[\+|-]?\d+' + a_float_re = r'[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' + histo_bin_weight_re = re.compile(r'(?P%s|NaN)'%a_float_re,re.IGNORECASE) + a_int_re = r'[\+|-]?\d+' # The end of a plot histo_end_re = re.compile(r'^\s*<\\histogram>\s*$') # A scale type of weight - weight_label_scale = re.compile('^\s*mur\s*=\s*(?P%s)'%a_float_re+\ - '\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) - weight_label_PDF = re.compile('^\s*PDF\s*=\s*(?P\d+)\s*$') - weight_label_PDF_XML = re.compile('^\s*pdfset\s*=\s*(?P\d+)\s*$') - weight_label_TMS = re.compile('^\s*TMS\s*=\s*(?P%s)\s*$'%a_float_re) - weight_label_alpsfact = re.compile('^\s*alpsfact\s*=\s*(?P%s)\s*$'%a_float_re, + weight_label_scale = re.compile(r'^\s*mur\s*=\s*(?P%s)'%a_float_re+\ + r'\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) + weight_label_PDF = re.compile(r'^\s*PDF\s*=\s*(?P\d+)\s*$') + weight_label_PDF_XML = re.compile(r'^\s*pdfset\s*=\s*(?P\d+)\s*$') + weight_label_TMS = re.compile(r'^\s*TMS\s*=\s*(?P%s)\s*$'%a_float_re) + weight_label_alpsfact = re.compile(r'^\s*alpsfact\s*=\s*(?P%s)\s*$'%a_float_re, re.IGNORECASE) - weight_label_scale_adv = re.compile('^\s*dyn\s*=\s*(?P%s)'%a_int_re+\ - '\s*mur\s*=\s*(?P%s)'%a_float_re+\ - '\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) - weight_label_PDF_adv = re.compile('^\s*PDF\s*=\s*(?P\d+)\s+(?P\S+)\s*$') + weight_label_scale_adv = re.compile(r'^\s*dyn\s*=\s*(?P%s)'%a_int_re+\ + r'\s*mur\s*=\s*(?P%s)'%a_float_re+\ + r'\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) + weight_label_PDF_adv = re.compile(r'^\s*PDF\s*=\s*(?P\d+)\s+(?P\S+)\s*$') class ParseError(MadGraph5Error): @@ -926,7 +926,7 @@ def get_HwU_source(self, print_header=True): res.append(' '.join('%+16.7e'%wgt for wgt in list(bin.boundaries))) res[-1] += ' '.join('%+16.7e'%bin.wgts[key] for key in self.bins.weight_labels if key not in ['central','stat_error']) - res.append('<\histogram>') + res.append(r'<\histogram>') return res def output(self, path=None, format='HwU', print_header=True): @@ -1149,6 +1149,8 @@ def parse_one_histo_from_stream(self, stream, all_weight_header, boundaries = [0.0,0.0] for j, weight in \ enumerate(HwU.histo_bin_weight_re.finditer(line_bin)): + if (j == len(weight_header)): + continue if j == len(all_weight_header): raise HwU.ParseError("There is more bin weights"+\ " specified than expected (%i)"%len(weight_header)) @@ -1803,7 +1805,7 @@ def parse_histos_from_PY8_XML_stream(self, stream, run_id=None, # Filter empty weights coming from the split weight_label_list = [wgt.strip() for wgt in str(selected_run_node.getAttribute('header')).split(';') if - not re.match('^\s*$',wgt)] + not re.match(r'^\s*$',wgt)] ordered_weight_label_list = [w for w in weight_label_list if w not\ in ['xmin','xmax']] # Remove potential repetition of identical weight labels @@ -1827,7 +1829,7 @@ def parse_histos_from_PY8_XML_stream(self, stream, run_id=None, all_weights = [] for wgt_position, wgt_label in \ enumerate(str(selected_run_node.getAttribute('header')).split(';')): - if not re.match('^\s*$',wgt_label) is None: + if not re.match(r'^\s*$',wgt_label) is None: continue all_weights.append({'POSITION':wgt_position}) for wgt_item in wgt_label.strip().split('_'): @@ -2714,7 +2716,7 @@ def ratio_no_correlations(wgtsA, wgtsB): # First the global gnuplot header for this histogram group global_header =\ -""" +r""" ################################################################################ ### Rendering of the plot titled '%(title)s' ################################################################################ @@ -2862,9 +2864,9 @@ def ratio_no_correlations(wgtsA, wgtsB): major_title = ', '.join(major_title) if not mu[0] in ['none',None]: - major_title += ', dynamical\_scale\_choice=%s'%mu[0] + major_title += r', dynamical\_scale\_choice=%s'%mu[0] if not pdf[0] in ['none',None]: - major_title += ', PDF=%s'%pdf[0].replace('_','\_') + major_title += ', PDF=%s'%pdf[0].replace('_',r'\_') # Do not show uncertainties for individual jet samples (unless first # or specified explicitely and uniquely) @@ -2937,7 +2939,7 @@ def ratio_no_correlations(wgtsA, wgtsB): plot_lines.append( "'%s' index %d using (($1+$2)/2):%d ls %d title '%s'"\ %(HwU_name,block_position+i,mu_var+3,color_index,\ -'%s dynamical\_scale\_choice=%s' % (title,mu[j]))) +r'%s dynamical\_scale\_choice=%s' % (title,mu[j]))) # And now PDF_variation if available if not PDF_var_pos is None: for j,PDF_var in enumerate(PDF_var_pos): @@ -2947,7 +2949,7 @@ def ratio_no_correlations(wgtsA, wgtsB): plot_lines.append( "'%s' index %d using (($1+$2)/2):%d ls %d title '%s'"\ %(HwU_name,block_position+i,PDF_var+3,color_index,\ -'%s PDF=%s' % (title,pdf[j].replace('_','\_')))) +'%s PDF=%s' % (title,pdf[j].replace('_',r'\_')))) # Now add the uncertainty lines, those not using a band so that they # are not covered by those using a band after we reverse plo_lines diff --git a/epochX/cudacpp/gg_ttgg.mad/bin/internal/launch_plugin.py b/epochX/cudacpp/gg_ttgg.mad/bin/internal/launch_plugin.py index 7b10bedcef..9ec09eb71d 100644 --- a/epochX/cudacpp/gg_ttgg.mad/bin/internal/launch_plugin.py +++ b/epochX/cudacpp/gg_ttgg.mad/bin/internal/launch_plugin.py @@ -98,6 +98,7 @@ def default_setup(self): self['vector_size'] = 16 # already setup in default class (just change value) self['aloha_flag'] = '--fast-math' self['matrix_flag'] = '-O3' + self['limhel'] = 0 self.display_block.append('simd') self.display_block.append('psoptim') 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 eee9ba4522..f6e47956cd 100755 --- a/epochX/cudacpp/gg_ttgg.mad/bin/internal/lhe_parser.py +++ b/epochX/cudacpp/gg_ttgg.mad/bin/internal/lhe_parser.py @@ -7,6 +7,7 @@ import numbers import math import time +import copy import os import shutil import sys @@ -101,7 +102,7 @@ def __init__(self, line=None, event=None): self.rwgt = 0 return - + self.event = event if event is not None: self.event_id = len(event) #not yet in the event @@ -1066,6 +1067,8 @@ def define_init_banner(self, wgt, lha_strategy, proc_charac=None): #special case for 1>N init_information = run_card.get_banner_init_information() event = next(self) + if not len(event): #if parse-momenta was false we have to parse the first event + event = Event(str(event)) init_information["idbmup1"] = event[0].pdg init_information["ebmup1"] = event[0].mass init_information["idbmup2"] = 0 @@ -1149,6 +1152,7 @@ def initialize_unweighting(self, getwgt, trunc_error): nb_keep = max(20, int(nb_event*trunc_error*15)) new_wgt = new_wgt[-nb_keep:] if nb_event == 0: + misc.sprint(i,f) raise Exception # store the information self.initial_nb_events[i] = nb_event @@ -1203,7 +1207,6 @@ def unweight(self, outputpath, get_wgt, **opts): (stop to write event when target is reached) """ - if isinstance(get_wgt, (str,six.text_type)): unwgt_name =get_wgt def get_wgt_multi(event): @@ -1483,12 +1486,12 @@ def reorder_mother_child(self): particle.mother2 -= 1 # re-call the function for the next potential change return self.reorder_mother_child() - - - - - + + + + + def parse_reweight(self): """Parse the re-weight information in order to return a dictionary {key: value}. If no group is define group should be '' """ @@ -1522,6 +1525,37 @@ def parse_nlo_weight(self, real_type=(1,11), threshold=None): threshold=threshold) return self.nloweight + def get_fks_pair(self, real_type=(1,11), threshold=None): + """ Gives the fks pair labels""" + start, stop = self.tag.find(''), self.tag.find('') + if start != -1 != stop: + text = self.tag[start+8:stop] + all_line = text.split('\n') + text = text.lower().replace('d','e') + all_line = text.split('\n') + for line in all_line: + data = line.split() + if len(data)>16: + wgt = OneNLOWeight(line, real_type=real_type) + return wgt.to_merge_pdg,wgt.nexternal + + def get_born_momenta(self,real_type=(1,11), threshold=None): + """ Gets the underlying n+1 body kinematics""" + start, stop = self.tag.find(''), self.tag.find('') + if start != -1 != stop: + text = self.tag[start+8:stop] + text = text.lower().replace('d','e') + all_line = text.split('\n') + for line in all_line: + data = line.split() + if len(data)>16: + wgt = OneNLOWeight(line, real_type=real_type) + nexternal = wgt.nexternal + real_momenta = all_line[2:2+nexternal] + return real_momenta + + + def rewrite_nlo_weight(self, wgt=None): """get the string associate to the weight""" @@ -1558,11 +1592,11 @@ def parse_lo_weight(self): return self.loweight if not hasattr(Event, 'loweight_pattern'): - Event.loweight_pattern = re.compile('''\s*(?P\d+)\s+(?P[\d.e+-]+)\s*\s*\n\s* - \s*(?P[\s\d.+-e]+)\s*\s*\n\s* - 1|2)["']?\>\s*(?P[\s\d.e+-]*)\s*\s*\n\s* - 1|2)["']?\>\s*(?P[\s\d.e+-]*)\s*\s*\n\s* - \s*(?P[\d.e+-]*)\s* + Event.loweight_pattern = re.compile('''\\s*(?P\\d+)\\s+(?P[\\d.e+-]+)\\s*\\s*\n\\s* + \\s*(?P[\\s\\d.+-e]+)\\s*\\s*\n\\s* + 1|2)["']?\\>\\s*(?P[\\s\\d.e+-]*)\\s*\\s*\n\\s* + 1|2)["']?\\>\\s*(?P[\\s\\d.e+-]*)\\s*\\s*\n\\s* + \\s*(?P[\\d.e+-]*)\\s* ''',re.X+re.I+re.M) start, stop = self.tag.find(''), self.tag.find('') @@ -1615,7 +1649,7 @@ def parse_matching_scale(self): self.matched_scale_data = [] - pattern = re.compile("") + pattern = re.compile(r"") data = re.split(pattern,self.tag) if len(data) == 1: return [] @@ -1623,7 +1657,7 @@ def parse_matching_scale(self): tmp = {} start,content, end = data self.tag = "%s%s" % (start, end) - pattern = re.compile("pt_clust_(\d*)=\"([\de+-.]*)\"") + pattern = re.compile("pt_clust_(\\d*)=\"([\\de+-.]*)\"") for id,value in pattern.findall(content): tmp[int(id)] = float(value) for i in range(1, len(self)+1): @@ -1647,7 +1681,7 @@ def parse_syscalc_info(self): return self.syscalc_data pattern = re.compile("|") - pattern2 = re.compile("<(?P[\w]*)(?:\s*(\w*)=[\"'](.*)[\"']\s*|\s*)>(.*)") + pattern2 = re.compile("<(?P[\\w]*)(?:\\s*(\\w*)=[\"'](.*)[\"']\\s*|\\s*)>(.*)") data = re.split(pattern,self.tag) if len(data) == 1: return [] @@ -1850,6 +1884,240 @@ def get_decay(self, pdg_code=0, event_id=None): return new_event + + def set_initial_mass_to_zero(self): + """set the masses of the initial particles to zero, by reshuffling the respective momenta + Works only in the **partonic** com frame, so the event must be boosted to such frame + before calling the function + """ + + if not misc.equal(self[0].px, 0) or not misc.equal(self[1].px, 0) or \ + not misc.equal(self[0].py, 0) or not misc.equal(self[1].py, 0) or \ + not misc.equal(self[0].pz, - self[1].pz, zero_limit=False): + misc.sprint(self[0]) + misc.sprint(self[1]) + raise Exception('momenta should be in the partonic center of mass frame') + + self[0].mass = 0. + self[1].mass = 0. + tot_E=0. + for ip,part in enumerate(self): + if part.status == 1 : + tot_E += part.E + if (self[0].pz > 0. and self[1].pz < 0): + self[0].set_momentum(FourMomentum([tot_E/2., 0., 0., tot_E/2.])) + self[1].set_momentum(FourMomentum([tot_E/2., 0., 0., -tot_E/2.])) + elif (self[0].pz < 0. and self[1].pz > 0): + self[0].set_momentum(FourMomentum([tot_E/2., 0., 0., -tot_E/2.])) + self[1].set_momentum(FourMomentum([tot_E/2., 0., 0., tot_E/2.])) + else: + logger.critical('ERROR: two incoming partons not back.-to-back') + + def set_final_jet_mass_to_zero(self): + """set the final light particle masses to zero + """ + + for ip,part in enumerate(self): + if ((abs(part.pid) <= 5) or (abs(part.pid) == 11) or (abs(part.pid) == 12)) and (part.status == 1): + part.mass = 0. + E_1_new = math.sqrt(part.mass**2 + part.px**2 + part.py**2 + part.pz**2) + part.set_momentum(FourMomentum([E_1_new, part.px, part.py, part.pz])) + + + + def merge_particles_kinematics(self, i,j, moth): + """Map to an underlying n-body kinematics for two given + particles i,j to be merged and a resulting moth""" + """ note! kinematics (and id) mapping only! """ + + recoil = True + fks_type = False + + if recoil and not fks_type: + if (i == moth[0].get('number')-1): + fks_i = i + fks_j = j + elif (j == moth[0].get('number')-1): + fks_i = j + fks_j = i + to_remove = fks_j + + merge_i = self[fks_i] + merge_j = self[fks_j] + + i_4mom = FourMomentum(merge_i) + j_4mom = FourMomentum(merge_j) + if (fks_i <= 1): + sign1 = -1.0 + else: + sign1 = 1.0 + mother_4mom = i_4mom + sign1*j_4mom + + new_event = copy.deepcopy(self) + + self[fks_i].pid = moth[0]['id'] + self[fks_i].set_momentum(mother_4mom) + + if fks_i <= 1: # initial-state recoil + new_p = FourMomentum() + for ip,part in enumerate(self): + if (ip != fks_i and ip != fks_j and ip >= 2): + new_p += part + + if fks_i == 0: + self[1].set_momentum(new_p - FourMomentum(self[0])) + elif fks_i == 1: + self[0].set_momentum(new_p - FourMomentum(self[1])) + + pz_1_new = self.recoil_eq(self[0],self[1]) + pz_2_new = self[0].pz + self[1].pz - pz_1_new + E_1_new = math.sqrt(self[0].mass**2 + self[0].px**2 + self[0].py**2 + pz_1_new **2) + E_2_new = math.sqrt(self[1].mass**2 + self[1].px**2 + self[1].py**2 + pz_2_new **2) + self[0].set_momentum(FourMomentum([E_1_new,self[0].px,self[0].py,pz_1_new])) + self[1].set_momentum(FourMomentum([E_2_new,self[1].px,self[1].py,pz_2_new])) + self.pop(to_remove) + + if fks_i > 1: # final-state recoil + + # Re-scale the energy of fks_i to make it on-shell + for ip,part in enumerate(self): + if (ip == fks_i): + part.E = math.sqrt(part.mass**2 + part.px**2 + part.py**2 + part.pz**2) + new_p.E = part.E + + # Find the overall energy in the final state + new_p.E = 0.0 + for ip,part in enumerate(self): + if (ip != fks_j and ip >= 2): + new_p.E += part.E + + # Use one of the initial states to absorb the energy change in the final state + self[1].set_momentum(FourMomentum([new_p.E-self[0].E,self[1].px,self[1].py,self[1].pz])) + + # Change the initial state pz and E + pz_1_new = self.recoil_eq(self[0],self[1]) + pz_2_new = self[0].pz + self[1].pz - pz_1_new + E_1_new = math.sqrt(self[0].mass**2 + self[0].px**2 + self[0].py**2 + pz_1_new **2) + E_2_new = math.sqrt(self[1].mass**2 + self[1].px**2 + self[1].py**2 + pz_2_new **2) + self[0].set_momentum(FourMomentum([E_1_new,self[0].px,self[0].py,pz_1_new])) + self[1].set_momentum(FourMomentum([E_2_new,self[1].px,self[1].py,pz_2_new])) + self.pop(to_remove) + + elif fks_type and not recoil: + ## Do it in a more FKS-style + if (i == moth[0].get('number')-1): + fks_i = i + fks_j = j + elif (j == moth[0].get('number')-1): + fks_i = j + fks_j = i + to_remove = fks_j + new_event = copy.copy(event) + + if fks_i <= 1: # initial-state recoil + + # First boost to partonic CM frame + q = FourMomentum(self[0])+FourMomentum(self[1]) + for ip,part in enumerate(self): + vec = FourMomentum(part) + self[ip].set_momentum(vec.zboost(pboost=q)) + + k_tot = FourMomentum([self[0].E+self[1].E-self[fks_j].E,self[0].px+self[1].px-self[fks_j].px,\ + self[0].py+self[1].py-self[fks_j].py,self[0].pz+self[1].pz-self[fks_j].pz]) + + final = FourMomentum([0,0,0,0]) + for ip,part in enumerate(self): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + if (ip != fks_i and ip != fks_j and ip >= 2): + final = final + vec + + s = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz])**2 + ksi = self[fks_j].E/(math.sqrt(s)/2.0) + y = self[fks_j].pz/self[fks_j].E + + self[0].pz = self[0].pz * math.sqrt(1.0-ksi)*math.sqrt((2.0-ksi*(1.0+y))/((2.0-ksi*(1.0-y)))) + self[0].E = math.sqrt(self[0].mass**2 + self[0].pz**2) + self[1].pz = self[1].pz * math.sqrt(1.0-ksi)*math.sqrt((2.0-ksi*(1.0-y))/((2.0-ksi*(1.0+y)))) + self[1].E = math.sqrt(self[1].mass**2 + self[1].pz**2) + + final = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + k_tot_1 = k_tot.zboost(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + k_tot_2 = k_tot_1.pt_boost(pboost=FourMomentum([k_tot_1.E,k_tot_1.px,k_tot_1.py,k_tot_1.pz])) + k_tot_3 = k_tot_2.zboost_inv(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + + for ip,part in enumerate(self): + if (ip >= 2): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + vec2 = vec.zboost(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + vec3 = vec2.pt_boost(pboost=FourMomentum([k_tot_1.E,k_tot_1.px,k_tot_1.py,k_tot_1.pz])) + vec_new = vec3.zboost_inv(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + self[ip].set_momentum(FourMomentum([vec_new.E,vec_new.px,vec_new.py,vec_new.pz])) + + self.pop(to_remove) + + else: # final-state recoil + q = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + for ip,part in enumerate(self): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + self[ip].set_momentum(vec.zboost(pboost=q)) + + q = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + k = FourMomentum([self[fks_i].E+self[fks_j].E,self[fks_i].px+self[fks_j].px,\ + self[fks_i].py+self[fks_j].py,self[fks_i].pz+self[fks_j].pz]) + + k_rec = FourMomentum([0,0,0,0]) + for ip,part in enumerate(self): + if ip >= 2 and ip != fks_i and ip != fks_j: # add only final-states to the recoil and not the FKS pair + k_rec = k_rec + FourMomentum([part.E,part.px,part.py,part.pz]) + + k_mom = math.sqrt(k_rec.px**2 + k_rec.py**2 + k_rec.pz**2) + beta = (q**2 - (k_rec.E+k_mom)**2)/(q**2 + (k_rec.E+k_mom)**2) + for ip,part in enumerate(self): + if ip >= 2 and ip != fks_i and ip != fks_j: + vec = FourMomentum([self[ip].E,self[ip].px,self[ip].py,self[ip].pz]) + self[ip].set_momentum(vec.boost_beta(beta,k_rec)) + if ip == fks_i: + self[ip].set_momentum(q - k_rec.boost_beta(beta,k_rec)) + self.pop(to_remove) + else: + logger.info('Error in Sudakov Born mapping: no recoil scheme found!') + + def recoil_eq(self,part1, part2): + """ In general, solves the equation + E1 + E2 = K + p1 + p2 = c + E1^2 - p1^2 = a + E2^2 - p2^2 = b + and returns p1 + """ + thresh = 1e-6 + import random + a = part1.mass**2 + part1.px**2 + part1.py**2 + b = part2.mass**2 + part2.px**2 + part2.py**2 + c = part1.pz + part2.pz + K = part1.E + part2.E + K2 = K**2 + sol1 = (-a*c + b*c + c**3 - c*K2 - math.sqrt(K2*(a**2 + (b + c**2 - K2)**2 - 2*a*(b - c**2 + K2))))/(2*(c**2-K2)) + sol2 = (-a*c + b*c + c**3 - c*K2 + math.sqrt(K2*(a**2 + (b + c**2 - K2)**2 - 2*a*(b - c**2 + K2))))/(2*(c**2-K2)) + + if abs(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2) - (math.sqrt(a+sol2**2) + math.sqrt(b+(c-sol2)**2))) > thresh: + logger.critical('Error in recoil_eq solver 1') + logger.critical(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2)) + logger.critical(math.sqrt(a+sol2**2) + math.sqrt(b+(c-sol2)**2)) + if abs(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2) - K) > thresh: + logger.critical('Error in recoil_eq solver 2') + logger.critical(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2)) + logger.critical(K) + return sol1 + + def boost(self, filter=None): """modify the current event to boost it according to the current filter""" if filter is None: @@ -1861,7 +2129,7 @@ def boost(self, filter=None): if list(filter(p)): pboost += p else: - pboost = FourMomentum(pboost) + pboost = FourMomentum(filter) # change sign of three-component due to helas convention pboost.px *=-1 @@ -1877,7 +2145,7 @@ def check(self): """check various property of the events""" # check that relative error is under control - threshold = 1e-6 + threshold = 1e-4 #1. Check that the 4-momenta are conserved E, px, py, pz = 0,0,0,0 @@ -1920,7 +2188,50 @@ def check(self): self.check_color_structure() #3. check mass - + + def check_kinematics_only(self): + """check various property of the events - only kinematics""" + + # check that relative error is under control + threshold = 1e-3 + + #1. Check that the 4-momenta are conserved + E, px, py, pz = 0,0,0,0 + absE, abspx, abspy, abspz = 0,0,0,0 + for particle in self: + coeff = 1 + if particle.status == -1: + coeff = -1 + elif particle.status != 1: + continue + E += coeff * particle.E + absE += abs(particle.E) + px += coeff * particle.px + py += coeff * particle.py + pz += coeff * particle.pz + abspx += abs(particle.px) + abspy += abs(particle.py) + abspz += abs(particle.pz) + # check mass + fourmass = FourMomentum(particle).mass + + if particle.mass and (abs(particle.mass) - fourmass)/ abs(particle.mass) > threshold: + logger.critical(self) + raise Exception( "Do not have correct mass lhe: %s momentum: %s (error at %s" % (particle.mass, fourmass, (abs(particle.mass) - fourmass)/ abs(particle.mass))) + + if abs(E/absE) > threshold: + logger.critical(self) + raise Exception("Do not conserve Energy %s, %s" % (E/absE, E)) + if abs(px/abspx) > threshold: + logger.critical(self) + raise Exception("Do not conserve Px %s, %s" % (px/abspx, px)) + if abs(py/abspy) > threshold: + logger.critical(self) + raise Exception("Do not conserve Py %s, %s" % (py/abspy, py)) + if abs(pz/abspz) > threshold: + logger.critical(self) + raise Exception("Do not conserve Pz %s, %s" % (pz/abspz, pz)) + def assign_scale_line(self, line, convert=True): """read the line corresponding to global event line @@ -2764,7 +3075,7 @@ def zboost(self, pboost=None, E=0, pz=0): if isinstance(pboost, FourMomentum): E = pboost.E pz = pboost.pz - + #beta = pz/E gamma = E / math.sqrt(E**2-pz**2) gammabeta = pz / math.sqrt(E**2-pz**2) @@ -2778,6 +3089,74 @@ def zboost(self, pboost=None, E=0, pz=0): out.pz = 0 return out + def zboost_inv(self, pboost=None, E=0, pz=0): + """Both momenta should be in the same frame. + The boost perform correspond to the boost required to set pboost at + rest (only z boost applied). + """ + if isinstance(pboost, FourMomentum): + E = pboost.E + pz = pboost.pz + + #beta = pz/E + gamma = E / math.sqrt(E**2-pz**2) + gammabeta = pz / math.sqrt(E**2-pz**2) + + out = FourMomentum([gamma*self.E + gammabeta*self.pz, + self.px, + self.py, + gamma*self.pz + gammabeta*self.E]) + + if abs(out.pz) < 1e-6 * out.E: + out.pz = 0 + return out + + + def pt_boost(self, pboost=None, E=0, pz=0): + """Both momenta should be in the same frame. + The boost perform correspond to the boost required to set pboost at + rest (only pT boost applied). + """ + + if isinstance(pboost, FourMomentum): + E = pboost.E + px = pboost.px + py = pboost.py + mass = math.sqrt(E**2 - px**2 - py**2) + + betax = px/E + betay = py/E + beta = math.sqrt(betax**2+betay**2) + gamma = 1 / math.sqrt(1.0-beta**2) + + out = FourMomentum([gamma*self.E - gamma*betax*self.px - gamma*betay*self.py, + -gamma*betax*self.E + (1.0 + (gamma-1.0)*betax**2/(beta**2))*self.px + (gamma-1.0)*betax*betay/(beta**2)*self.py, + -gamma*betay*self.E + ((gamma-1.0)*betax*betay/(beta**2))*self.px + (1.0+(gamma-1.0)*(betay**2)/(beta**2))*self.py, + self.pz]) + + if abs(out.px) < 1e-6 * out.E: + out.px = 0 + if abs(out.py) < 1e-6 * out.E: + out.py = 0 + return out + + def boost_beta(self,beta,mom): + """ Boost along the three-momentum of mom with a boost of size beta""" + + unit = mom * (1.0/math.sqrt(mom.px**2+mom.py**2+mom.pz**2)) + beta_vec = beta*unit + bx = beta_vec.px + by = beta_vec.py + bz = beta_vec.pz + gamma = 1.0 / math.sqrt(1.0-beta**2) + + out = FourMomentum([gamma*self.E - gamma*bx*self.px - gamma*by*self.py - gamma*bz*self.pz, + -gamma*bx*self.E + (1.0 + (gamma-1.0)*bx**2/(beta**2))*self.px + (gamma-1.0)*bx*by/(beta**2)*self.py + (gamma-1.0)*bx*bz/(beta**2)*self.pz, + -gamma*by*self.E + ((gamma-1.0)*bx*by/(beta**2))*self.px + (1.0+(gamma-1.0)*(by**2)/(beta**2))*self.py + (gamma-1.0)*by*bz/(beta**2)*self.pz, + -gamma*bz*self.E + (gamma-1.0)*bx*bz/(beta**2)*self.px + (gamma-1.0)*(by*bz)/(beta**2)*self.py + (1.0+(gamma-1.0)*bz**2/(beta**2))*self.pz]) + + return out + def boost_to_restframe(self, pboost): """apply the boost transformation such that pboost is at rest in the new frame. First apply a rotation to allign the pboost to the z axis and then use @@ -2789,27 +3168,64 @@ def boost_to_restframe(self, pboost): return out - # write pboost as (E, p cosT sinF, p sinT sinF, p cosF) - # rotation such that it become (E, 0 , 0 , p ) is - # cosT sinF , -sinT , cosT sinF - # sinT cosF , cosT , sinT sinF - # -sinT , 0 , cosF - p = math.sqrt( pboost.px**2 + pboost.py**2+ pboost.pz**2) - cosF = pboost.pz / p - sinF = math.sqrt(1-cosF**2) - sinT = pboost.py/p/sinF - cosT = pboost.px/p/sinF - - out=FourMomentum([self.E, - self.px*cosT*cosF + self.py*sinT*cosF-self.pz*sinF, - -self.px*sinT+ self.py*cosT, - self.px*cosT*sinF + self.py*sinT*sinF + self.pz*cosF - ]) - out = out.zboost(E=pboost.E,pz=p) + # see here https://physics.stackexchange.com/questions/749036/general-lorentz-boost-of-four-momentum-in-cm-frame-particle-physics + vx = pboost.px/pboost.E + vy = pboost.py/pboost.E + vz = pboost.pz/pboost.E + v = pboost.norm/pboost.E + v2 = pboost.norm_sq/pboost.E**2 + gamma = 1./math.sqrt(1.-v**2) + gammo = gamma-1. + out = FourMomentum(E = gamma*(self.E - vx*self.px - vy*self.py - vz*self.pz), + px= -gamma*vx*self.E + (1+gammo*vx**2/v2)*self.px + gammo*vx*vy/v2*self.py + gammo*vx*vz/v2*self.pz, + py= -gamma*vy*self.E + gammo*vy*vx/v2*self.px + (1+gammo*vy**2/v2)*self.py + gammo*vy*vz/v2*self.pz, + pz= -gamma*vz*self.E + gammo*vz*vx/v2*self.px + gammo*vz*vy/v2*self.py + (1+gammo*vz**2/v2)*self.pz) + return out + def rotate_to_z(self,prot): + + import math + import numpy as np + + z = np.array([0.,0.,1.]) + + px = self.px + py = self.py + pz = self.pz + + refx = prot.px + refy = prot.py + refz = prot.pz + + prot_mom = np.array([px, py, pz]) + ref_mom = np.array([refx, refy, refz]) + + # Create normal vector + n = np.array([refy, -refx, 0.]) + n = n * 1./math.sqrt(self.threedot(n,n)) + t = prot_mom - self.threedot(n,prot_mom)*n + p = ref_mom - self.threedot(ref_mom,z)*z + p = p/math.sqrt(self.threedot(p,p)) + + t_pz = np.array([self.threedot(t,p), self.threedot(t,z), 0.]) + costheta = self.threedot(ref_mom,z)* 1./math.sqrt(self.threedot(ref_mom, ref_mom)) + sintheta=math.sqrt(1.-costheta**2) + + sgn = 1. + t_pz_p = np.array([0., 0., 0.]) + t_pz_p[0] = costheta*t_pz[0] + sgn*(-sintheta) * t_pz[1] + t_pz_p[1] = sgn*sintheta*t_pz[0] + costheta * t_pz[1] + + out_mom = self.threedot(n,prot_mom)*n + t_pz_p[0]*p + t_pz_p[1]*z + + out = FourMomentum([self.E,out_mom[0], out_mom[1], out_mom[2] ] ) + + return out - + def threedot(self,a,b): + + return a[0]*b[0]+a[1]*b[1]+a[2]*b[2] class OneNLOWeight(object): 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 2a118e21bf..8e30cf690c 100755 --- a/epochX/cudacpp/gg_ttgg.mad/bin/internal/madevent_interface.py +++ b/epochX/cudacpp/gg_ttgg.mad/bin/internal/madevent_interface.py @@ -496,7 +496,6 @@ def help_remove(self): logger.info(" the optional '-f' allows to by-pass all security question") logger.info(" The banner can be remove only if all files are removed first.") - class AskRun(cmd.ControlSwitch): """a class for the question on what to do on a madevent run""" @@ -2393,13 +2392,17 @@ def do_generate_events(self, line): # Check argument's validity mode = self.check_generate_events(args) switch_mode = self.ask_run_configuration(mode, args) - if not args: - # No run name assigned -> assigned one automaticaly - self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton') - else: - self.set_run_name(args[0], None, 'parton', True) - args.pop(0) - + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat'), consistency=False) + if not run_card.scan_set: + if not args: + # No run name assigned -> assigned one automaticaly + self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton') + else: + self.set_run_name(args[0], None, 'parton', True) + args.pop(0) + + self.run_generate_events(switch_mode, args) self.postprocessing() @@ -2560,7 +2563,7 @@ def wait_monitoring(Idle, Running, Done): self.update_status("postprocessing contur done", level="rivet") # this decorator handle the loop related to scan. - @common_run.scanparamcardhandling() + @common_run.scanparamcardhandling(run_card_scan=True) def run_generate_events(self, switch_mode, args): if self.proc_characteristics['loop_induced'] and self.options['run_mode']==0: @@ -2593,7 +2596,6 @@ def run_generate_events(self, switch_mode, args): # Regular run mode logger.info('Generating %s events with run name %s' % (self.run_card['nevents'], self.run_name)) - self.exec_cmd('survey %s %s' % (self.run_name,' '.join(args)), postcmd=False) nb_event = self.run_card['nevents'] @@ -2975,7 +2977,7 @@ def update_width_in_param_card(decay_info, initial=None, output=None): particle = 0 # Read BRs for this decay line = param_card[line_number] - while re.search('^(#|\s|\d)', line): + while re.search(r'^(#|\s|\d)', line): line = param_card.pop(line_number) if not particle or line.startswith('#'): line=param_card[line_number] @@ -3226,7 +3228,7 @@ def do_treatcards(self, line, mode=None, opt=None): for line in open(pjoin(bias_module_path,'%s.f'%os.path.basename(bias_module_path))): if start and last: break - if not start and not re.search('c\s*parameters\s*=\s*{',line, re.I): + if not start and not re.search(r'c\s*parameters\s*=\s*{',line, re.I): continue start = True if not line.startswith('C'): @@ -3235,7 +3237,7 @@ def do_treatcards(self, line, mode=None, opt=None): if '{' in line: line = line.split('{')[-1] # split for } ! # - split_result = re.split('(\}|!|\#)', line,1, re.M) + split_result = re.split(r'(\}|!|\#)', line,1, re.M) line = split_result[0] sep = split_result[1] if len(split_result)>1 else None if sep == '}': @@ -3514,8 +3516,8 @@ def pass_in_difficult_integration_mode(self, rate=1): text = open(conf_path).read() min_evt, max_evt = 2500 *(2+rate), 10000*(rate+1) - text = re.sub('''\(min_events = \d+\)''', '(min_events = %i )' % min_evt, text) - text = re.sub('''\(max_events = \d+\)''', '(max_events = %i )' % max_evt, text) + text = re.sub(r'''\(min_events = \d+\)''', '(min_events = %i )' % min_evt, text) + text = re.sub(r'''\(max_events = \d+\)''', '(max_events = %i )' % max_evt, text) fsock = open(conf_path, 'w') fsock.write(text) fsock.close() @@ -3619,7 +3621,7 @@ def do_refine(self, line): alljobs = misc.glob('ajob*', Pdir) #remove associated results.dat (ensure to not mix with all data) - Gre = re.compile("\s*j=(G[\d\.\w]+)") + Gre = re.compile(r"\s*j=(G[\d\.\w]+)") for job in alljobs: Gdirs = Gre.findall(open(job).read()) for Gdir in Gdirs: @@ -3727,58 +3729,126 @@ def do_combine_events(self, line): sum_xsec, sum_xerru, sum_axsec = 0,[],0 Gdirs = self.get_Gdir() Gdirs.sort() - for Gdir in Gdirs: - if os.path.exists(pjoin(Gdir, 'events.lhe')): - result = sum_html.OneResult('') - result.read_results(pjoin(Gdir, 'results.dat')) - sum_xsec += result.get('xsec') - sum_xerru.append(result.get('xerru')) - sum_axsec += result.get('axsec') - - if self.run_card['gridpack'] or self.run_card['nevents']==0: - os.remove(pjoin(Gdir, 'events.lhe')) - continue + partials_info = [] + try: + p = subprocess.Popen(["ulimit", "-n"], stdout=subprocess.PIPE) + out, err = p.communicate() + max_G = out.decode() + if max_G == "unlimited": + max_G =2500 + else: + max_G = int(max_G) - 40 + except Exception as error: + logger.debug(error) + max_G = 80 # max(20, len(Gdirs)/self.options['nb_core']) - AllEvent.add(pjoin(Gdir, 'events.lhe'), - result.get('xsec'), - result.get('xerru'), - result.get('axsec') - ) - - if len(AllEvent) >= 80: #perform a partial unweighting - AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % partials), - get_wgt, log_level=5, trunc_error=1e-2, event_target=self.run_card['nevents']) - AllEvent = lhe_parser.MultiEventFile() - AllEvent.banner = self.banner - AllEvent.add(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % partials), - sum_xsec, - math.sqrt(sum(x**2 for x in sum_xerru)), - sum_axsec) - partials +=1 - if not hasattr(self,'proc_characteristic'): self.proc_characteristic = self.get_characteristics() - if len(AllEvent) == 0: - nb_event = 0 - else: + mycluster = cluster.MultiCore(nb_core=self.options['nb_core']) + + def split(a, n): + """split a list "a" into n chunk of same size (or nearly same size)""" + k, m = divmod(len(a), n) + return (a[i*k+min(i, m):(i+1)*k+min(i+1, m)] for i in range(n)) + + partials_info = [] + if len(Gdirs) >= max_G: + start_unweight= time.perf_counter() + # first check in how many chunk we have to split (always use a multiple of nb_core) + nb_split = 1 + nb_G = len(Gdirs) // (2* self.options['nb_core']) + while nb_G > min(80, max_G): + nb_split += 1 + nb_G = len(Gdirs)//(nb_split*2*self.options['nb_core']) + if nb_G < 10: + nb_split -=1 + nb_G = len(Gdirs)//(nb_split*2*self.options['nb_core']) + + #enforce at least 10 directory per thread + if nb_G > 10 or nb_split>1: + # do the unweighting of each chunk on their own thread + nb_chunk = (nb_split*2*self.options['nb_core']) + else: + nb_chunk = len(Gdirs) // 10 + nb_G =10 + + # security that the number of combine events is too large + if nb_chunk >= max_G: + nb_chunk = max_G -1 + nb_G = len(Gdirs) // nb_chunk + + for i, local_G in enumerate(split(Gdirs, nb_chunk)): + line = [pjoin(self.me_dir, "Events", self.run_name, "partials%d.lhe.gz" % i)] + line.append(pjoin(self.me_dir, 'Events', self.run_name, '%s_%s_banner.txt' % (self.run_name, tag))) + line.append(str(self.results.current['cross'])) + line += local_G + partials_info.append(self.do_combine_events_partial(' '.join(line), preprocess_only=True)) + mycluster.submit(sys.executable, + [pjoin(self.me_dir, 'bin', 'internal', 'madevent_interface.py'), 'combine_events_partial'] + line, + stdout='/dev/null' + ) + + starttime = time.time() + update_status = lambda idle, run, finish: \ + self.update_status((idle, run, finish, 'unweight'), level=None, + force=False, starttime=starttime) + mycluster.wait(self.me_dir, update_status) + # do the final combination + for data in partials_info: + AllEvent.add(*data) + + start_unweight= time.perf_counter() nb_event = AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "unweighted_events.lhe.gz"), get_wgt, trunc_error=1e-2, event_target=self.run_card['nevents'], log_level=logging.DEBUG, normalization=self.run_card['event_norm'], proc_charac=self.proc_characteristic) + + #cleaning + for data in partials_info: + path = data[0] + try: + os.remove(path) + except Exception as error: + try: + os.remove(path[:-3]) # try without the .gz + except: + misc.sprint('no file ', path, 'to clean') + else: + for Gdir in Gdirs: + if os.path.exists(pjoin(Gdir, 'events.lhe')): + result = sum_html.OneResult('') + result.read_results(pjoin(Gdir, 'results.dat')) + sum_xsec += result.get('xsec') + sum_xerru.append(result.get('xerru')) + sum_axsec += result.get('axsec') + + if self.run_card['gridpack'] or self.run_card['nevents']==0: + os.remove(pjoin(Gdir, 'events.lhe')) + continue + + AllEvent.add(pjoin(Gdir, 'events.lhe'), + result.get('xsec'), + result.get('xerru'), + result.get('axsec') + ) + + if len(AllEvent) == 0: + nb_event = 0 + else: + nb_event = AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "unweighted_events.lhe.gz"), + get_wgt, trunc_error=1e-2, event_target=self.run_card['nevents'], + log_level=logging.DEBUG, normalization=self.run_card['event_norm'], + proc_charac=self.proc_characteristic) + + if nb_event < self.run_card['nevents']: + logger.warning("failed to generate enough events. Please follow one of the following suggestions to fix the issue:") + logger.warning(" - set in the run_card.dat 'sde_strategy' to %s", 1 + self.run_card['sde_strategy'] % 2) + logger.warning(" - set in the run_card.dat 'hard_survey' to 1 or 2.") + logger.warning(" - reduce the number of requested events (if set too high)") + logger.warning(" - check that you do not have -integrable- singularity in your amplitude.") + logger.warning(" - regenerate your process directory by selecting another gauge (in particular try FD gauge).") - if nb_event < self.run_card['nevents']: - logger.warning("failed to generate enough events. Please follow one of the following suggestions to fix the issue:") - logger.warning(" - set in the run_card.dat 'sde_strategy' to %s", 1 + self.run_card['sde_strategy'] % 2) - logger.warning(" - set in the run_card.dat 'hard_survey' to 1 or 2.") - logger.warning(" - reduce the number of requested events (if set too high)") - logger.warning(" - check that you do not have -integrable- singularity in your amplitude.") - if partials: - for i in range(partials): - try: - os.remove(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % i)) - except Exception: - os.remove(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe" % i)) self.results.add_detail('nb_event', nb_event) @@ -3789,7 +3859,50 @@ def do_combine_events(self, line): logger.info("combination of events done in %s s ", time.time()-start) self.to_store.append('event') + + ############################################################################ + def do_combine_events_partial(self, line, preprocess_only=False): + """ """ + + AllEvent = lhe_parser.MultiEventFile() + + sum_xsec, sum_xerru, sum_axsec = 0,[],0 + output, banner_path,cross = line.split()[:3] + Gdirs = line.split()[3:] + + cross = float(cross) + if not self.banner: + self.banner = banner_mod.Banner(banner_path) + if not hasattr(self, 'run_card'): + self.run_card = banner_mod.RunCard(self.banner['mgruncard']) + AllEvent.banner = self.banner + + for Gdir in Gdirs: + if os.path.exists(pjoin(Gdir, 'events.lhe')): + result = sum_html.OneResult('') + result.read_results(pjoin(Gdir, 'results.dat')) + sum_xsec += result.get('xsec') + sum_xerru.append(result.get('xerru')) + sum_axsec += result.get('axsec') + + if self.run_card['gridpack'] or self.run_card['nevents']==0: + os.remove(pjoin(Gdir, 'events.lhe')) + continue + if not preprocess_only: + AllEvent.add(pjoin(Gdir, 'events.lhe'), + result.get('xsec'), + result.get('xerru'), + result.get('axsec') + ) + if preprocess_only: + return output, sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), sum_axsec + nb_event = max(min(abs(1.01*self.run_card['nevents']*sum_axsec/cross),self.run_card['nevents']), 10) + get_wgt = lambda event: event.wgt + AllEvent.unweight(output, + get_wgt, log_level=5, trunc_error=1e-2, event_target=nb_event) + return output, sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), sum_axsec + ############################################################################ def correct_bias(self): """check the first event and correct the weight by the bias @@ -3902,13 +4015,19 @@ def do_store_events(self, line): #except Exception: # continue # Store log - try: - if os.path.exists(pjoin(G_path, 'log.txt')): - input = pjoin(G_path, 'log.txt') + input = pjoin(G_path, 'log.txt') + if os.path.exists(input): + if self.run_card['keep_log'] not in ["none", "minimal"]: output = pjoin(G_path, '%s_log.txt' % run) - files.mv(input, output) - except Exception: - continue + try: + files.mv(input, output) + except Exception: + continue + elif self.run_card['keep_log'] == "none": + try: + os.remove(input) + except Exception: + continue #try: # # Grid # for name in ['ftn26']: @@ -3989,7 +4108,7 @@ def do_create_gridpack(self, line): misc.call(['./bin/internal/make_gridpack'], cwd=self.me_dir) files.mv(pjoin(self.me_dir, 'gridpack.tar.gz'), pjoin(self.me_dir, '%s_gridpack.tar.gz' % self.run_name)) - os.system("sed -i.bak \"s/\s*.true.*=.*GridRun/ .false. = GridRun/g\" %s/Cards/grid_card.dat" \ + os.system("sed -i.bak \"s/\\s*.true.*=.*GridRun/ .false. = GridRun/g\" %s/Cards/grid_card.dat" \ % self.me_dir) self.update_status('gridpack created', level='gridpack') @@ -4476,7 +4595,7 @@ def do_pythia8(self, line): else: preamble = misc.get_HEPTools_location_setter( pjoin(MG5DIR,'HEPTools'),'lib') - preamble += "\n unset PYTHIA8DATA\n" + #preamble += "\n unset PYTHIA8DATA\n" open(pythia_cmd_card,'w').write("""! ! It is possible to run this card manually with: @@ -4691,7 +4810,7 @@ def do_pythia8(self, line): # Make sure to sure the number of split_events determined during the splitting. split_PY8_Card.systemSet('Main:numberOfEvents',partition_for_PY8[i]) split_PY8_Card.systemSet('HEPMCoutput:scaling',split_PY8_Card['HEPMCoutput:scaling']* - (float(partition_for_PY8[i])/float(n_events))) + (float(partition_for_PY8[i]))) # Add_missing set to False so as to be sure not to add any additional parameter w.r.t # the ones in the original PY8 param_card copied. split_PY8_Card.write(pjoin(parallelization_dir,'PY8Card_%d.dat'%i), @@ -4963,9 +5082,9 @@ def wait_monitoring(Idle, Running, Done): if cross_sections: # Filter the cross_sections specified an keep only the ones # with central parameters and a different merging scale - a_float_re = '[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' + a_float_re = r'[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' central_merging_re = re.compile( - '^\s*Weight_MERGING\s*=\s*(?P%s)\s*$'%a_float_re, + r'^\s*Weight_MERGING\s*=\s*(?P%s)\s*$'%a_float_re, re.IGNORECASE) cross_sections = dict( (float(central_merging_re.match(xsec).group('merging')),value) @@ -5016,8 +5135,8 @@ def wait_monitoring(Idle, Running, Done): def parse_PY8_log_file(self, log_file_path): """ Parse a log file to extract number of event and cross-section. """ - pythiare = re.compile("Les Houches User Process\(es\)\s*\d+\s*\|\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)\s*\|\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") - pythia_xsec_re = re.compile("Inclusive cross section\s*:\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") + pythiare = re.compile(r"Les Houches User Process\(es\)\s*\d+\s*\|\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)\s*\|\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") + pythia_xsec_re = re.compile(r"Inclusive cross section\s*:\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") sigma_m, Nacc, Ntry = None, None, None for line in misc.BackRead(log_file_path): info = pythiare.search(line) @@ -5158,7 +5277,7 @@ def do_pythia(self, line): # read the line from the bottom of the file #pythia_log = misc.BackRead(pjoin(self.me_dir,'Events', self.run_name, # '%s_pythia.log' % tag)) - pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") + pythiare = re.compile(r"\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") for line in misc.reverse_readline(pjoin(self.me_dir,'Events', self.run_name, '%s_pythia.log' % tag)): info = pythiare.search(line) @@ -5619,8 +5738,8 @@ def launch_job(self,exe, cwd=None, stdout=None, argument = [], remaining=0, input_files.append(self.get_pdf_input_filename()) #Find the correct ajob - Gre = re.compile("\s*j=(G[\d\.\w]+)") - origre = re.compile("grid_directory=(G[\d\.\w]+)") + Gre = re.compile(r"\s*j=(G[\d\.\w]+)") + origre = re.compile(r"grid_directory=(G[\d\.\w]+)") try : fsock = open(exe) except Exception: @@ -5628,7 +5747,7 @@ def launch_job(self,exe, cwd=None, stdout=None, argument = [], remaining=0, text = fsock.read() output_files = Gre.findall(text) if not output_files: - Ire = re.compile("for i in ([\d\.\s]*) ; do") + Ire = re.compile(r"for i in ([\d\.\s]*) ; do") data = Ire.findall(text) data = ' '.join(data).split() for nb in data: @@ -6035,7 +6154,7 @@ def get_last_tag(self, level): 'syscalc':[], 'rivet':['rivet']} - if name == self.run_name: + if name and name == self.run_name: if reload_card: run_card = pjoin(self.me_dir, 'Cards','run_card.dat') self.run_card = banner_mod.RunCard(run_card) @@ -6334,7 +6453,7 @@ def run_syscalc(self, mode='parton', event_path=None, output=None): elif mode == 'Pythia': stdout = open(pjoin(event_dir, self.run_name, '%s_%s_syscalc.log' % (tag,mode)),'w') if 'mgpythiacard' in self.banner: - pat = re.compile('''^\s*qcut\s*=\s*([\+\-\d.e]*)''', re.M+re.I) + pat = re.compile(r'''^\s*qcut\s*=\s*([\+\-\d.e]*)''', re.M+re.I) data = pat.search(self.banner['mgpythiacard']) if data: qcut = float(data.group(1)) @@ -6611,7 +6730,7 @@ def get_subP_ids(path): for line in open(pjoin(path, 'leshouche.inc')): if not 'IDUP' in line: continue - particles = re.search("/([\d,-]+)/", line) + particles = re.search(r"/([\d,-]+)/", line) all_ids.append([int(p) for p in particles.group(1).split(',')]) return all_ids @@ -6899,6 +7018,7 @@ def do_combine_events(self, line): partials = 0 # if too many file make some partial unweighting sum_xsec, sum_xerru, sum_axsec = 0,[],0 + partials_info = [] Gdirs = self.get_Gdir() Gdirs.sort() for Gdir in Gdirs: @@ -6917,16 +7037,21 @@ def do_combine_events(self, line): sum_axsec += result.get('axsec')*gscalefact[Gdir] if len(AllEvent) >= 80: #perform a partial unweighting + nb_event = min(abs(1.01*self.nb_event*sum_axsec/self.results.current['cross']),self.run_card['nevents']) AllEvent.unweight(pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), - get_wgt, log_level=5, trunc_error=1e-2, event_target=self.nb_event) + get_wgt, log_level=5, trunc_error=1e-2, event_target=nb_event) AllEvent = lhe_parser.MultiEventFile() AllEvent.banner = self.banner - AllEvent.add(pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), + partials_info.append((pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), - sum_axsec) + sum_axsec) ) + sum_xsec, sum_xerru, sum_axsec = 0,[],0 partials +=1 + for data in partials_info: + AllEvent.add(*data) + if not hasattr(self,'proc_characteristic'): self.proc_characteristic = self.get_characteristics() diff --git a/epochX/cudacpp/gg_ttgg.mad/bin/internal/misc.py b/epochX/cudacpp/gg_ttgg.mad/bin/internal/misc.py index c4c669f36b..e7fd60be0d 100755 --- a/epochX/cudacpp/gg_ttgg.mad/bin/internal/misc.py +++ b/epochX/cudacpp/gg_ttgg.mad/bin/internal/misc.py @@ -67,7 +67,7 @@ def parse_info_str(fsock): """ info_dict = {} - pattern = re.compile("(?P\w*)\s*=\s*(?P.*)", + pattern = re.compile(r"(?P\w*)\s*=\s*(?P.*)", re.IGNORECASE | re.VERBOSE) for entry in fsock: entry = entry.strip() @@ -84,7 +84,7 @@ def parse_info_str(fsock): def glob(name, path=''): """call to glob.glob with automatic security on path""" import glob as glob_module - path = re.sub('(?P\?|\*|\[|\])', '[\g]', path) + path = re.sub(r'(?P\?|\*|\[|\])', r'[\g]', path) return glob_module.glob(pjoin(path, name)) #=============================================================================== @@ -614,10 +614,10 @@ def mod_compilator(directory, new='gfortran', current=None, compiler_type='gfort #search file file_to_change=find_makefile_in_dir(directory) if compiler_type == 'gfortran': - comp_re = re.compile('^(\s*)FC\s*=\s*(.+)\s*$') + comp_re = re.compile(r'^(\s*)FC\s*=\s*(.+)\s*$') var = 'FC' elif compiler_type == 'cpp': - comp_re = re.compile('^(\s*)CXX\s*=\s*(.+)\s*$') + comp_re = re.compile(r'^(\s*)CXX\s*=\s*(.+)\s*$') var = 'CXX' else: MadGraph5Error, 'Unknown compiler type: %s' % compiler_type @@ -861,9 +861,9 @@ def detect_current_compiler(path, compiler_type='fortran'): # comp = re.compile("^\s*FC\s*=\s*(\w+)\s*") # The regular expression below allows for compiler definition with absolute path if compiler_type == 'fortran': - comp = re.compile("^\s*FC\s*=\s*([\w\/\\.\-]+)\s*") + comp = re.compile("^\\s*FC\\s*=\\s*([\\w\\/\\.\\-]+)\\s*") elif compiler_type == 'cpp': - comp = re.compile("^\s*CXX\s*=\s*([\w\/\\.\-]+)\s*") + comp = re.compile("^\\s*CXX\\s*=\\s*([\\w\\/\\.\\-]+)\\s*") else: MadGraph5Error, 'Unknown compiler type: %s' % compiler_type @@ -1001,7 +1001,19 @@ def call_stdout(arg, *args, **opt): def copytree(src, dst, symlinks = False, ignore = None): if not os.path.exists(dst): os.makedirs(dst) - shutil.copystat(src, dst) + try: + shutil.copystat(src, dst) + except PermissionError: + if os.path.realpath(src).startswith('/cvmfs') and os.path.realpath(dst).startswith('/afs'): + # allowing missmatch from cvmfs to afs since sounds to not create issue --at least in general-- + logger.critical(f'Ignoring that we could not copy permissions from {src} to {dst}') + else: + logger.critical(f'Permission error detected from {src} to {dst}.\n'+\ + 'If you are using WSL with windows partition, please try using python3.12\n'+\ + 'or avoid moving your data from the WSL partition to the UNIX one') + # we do not have enough experience in WSL to allow it to get trough. + raise + lst = os.listdir(src) if ignore: excl = ignore(src, lst) @@ -1895,12 +1907,12 @@ class EasterEgg(object): May4_banner = "* _____ *\n" + \ "* ,-~\" \"~-. *\n" + \ "* * ,^ ___ ^. * *\n" + \ - "* * / .^ ^. \ * *\n" + \ + "* * / .^ ^. \\ * *\n" + \ "* * Y l o ! Y * *\n" + \ "* * l_ `.___.' _,[ * *\n" + \ "* * |^~\"--------------~\"\"^| * *\n" + \ "* * ! May the 4th ! * *\n" + \ - "* * \ / * *\n" + \ + "* * \\ / * *\n" + \ "* * ^. .^ * *\n" + \ "* * \"-.._____.,-\" * *\n" @@ -1909,13 +1921,13 @@ class EasterEgg(object): "* M::::::::::M M::::::::::M *\n" + \ "* M:::::::::::M M:::::::::::M (_)___ *\n" + \ "* M:::::::M::::M M::::M:::::::M | / __| *\n" + \ - "* M::::::M M::::M M::::M M::::::M | \__ \ *\n" + \ + "* M::::::M M::::M M::::M M::::::M | \\__ \\ *\n" + \ "* M::::::M M::::M::::M M::::::M |_|___/ *\n" + \ "* M::::::M M:::::::M M::::::M *\n" + \ "* M::::::M M:::::M M::::::M / _| ___ _ __ *\n" + \ - "* M::::::M MMMMM M::::::M | |_ / _ \| '__| *\n" + \ + "* M::::::M MMMMM M::::::M | |_ / _ \\| '__| *\n" + \ "* M::::::M M::::::M | _| (_) | | *\n" + \ - "* M::::::M M::::::M |_/\/\___/|_| *\n" + \ + "* M::::::M M::::::M |_/\\/\\___/|_| *\n" + \ "* M::::::M M::::::M *\n" + \ "* MMMMMMMM MMMMMMMM *\n" + \ "* *\n" + \ @@ -2233,39 +2245,51 @@ def import_python_lhapdf(lhapdfconfig): os.environ['LD_LIBRARY_PATH'] = lhapdf_libdir else: os.environ['LD_LIBRARY_PATH'] = '%s:%s' %(lhapdf_libdir,os.environ['LD_LIBRARY_PATH']) - try: candidates=[dirname for dirname in os.listdir(lhapdf_libdir) \ if os.path.isdir(os.path.join(lhapdf_libdir,dirname))] except OSError: candidates=[] + if os.path.isdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')): + candidates += [pjoin(os.pardir,'local', 'lib', dirname) for dirname in os.listdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')) + if os.path.isdir(os.path.join(lhapdf_libdir,os.pardir, 'local', 'lib', dirname))] for candidate in candidates: - if os.path.isdir(os.path.join(lhapdf_libdir,candidate,'site-packages')): - sys.path.insert(0,os.path.join(lhapdf_libdir,candidate,'site-packages')) - try: - import lhapdf - use_lhapdf=True - break - except ImportError: - sys.path.pop(0) - continue + for subdir in ['site-packages', 'dist-packages']: + if os.path.isdir(os.path.join(lhapdf_libdir,candidate, subdir)): + sys.path.insert(0,os.path.join(lhapdf_libdir,candidate, subdir)) + try: + import lhapdf + use_lhapdf=True + break + except ImportError as error: + sys.path.pop(0) + continue + else: + continue + break if not use_lhapdf: try: candidates=[dirname for dirname in os.listdir(lhapdf_libdir+'64') \ if os.path.isdir(os.path.join(lhapdf_libdir+'64',dirname))] except OSError: candidates=[] - + if os.path.isdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib64')): + candidates += [pjoin(os.pardir,'local', 'lib64', dirname) for dirname in os.listdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')) + if os.path.isdir(os.path.join(lhapdf_libdir,os.pardir, 'local', 'lib64', dirname))] for candidate in candidates: - if os.path.isdir(os.path.join(lhapdf_libdir+'64',candidate,'site-packages')): - sys.path.insert(0,os.path.join(lhapdf_libdir+'64',candidate,'site-packages')) - try: - import lhapdf - use_lhapdf=True - break - except ImportError: - sys.path.pop(0) - continue + for subdir in ['site-packages', 'dist-packages']: + if os.path.isdir(os.path.join(lhapdf_libdir+'64',candidate, subdir)): + sys.path.insert(0,os.path.join(lhapdf_libdir+'64',candidate, subdir)) + try: + import lhapdf + use_lhapdf=True + break + except ImportError as error: + sys.path.pop(0) + continue + else: + continue + break if not use_lhapdf: try: import lhapdf diff --git a/epochX/cudacpp/gg_ttgg.mad/bin/internal/shower_card.py b/epochX/cudacpp/gg_ttgg.mad/bin/internal/shower_card.py index e87d534177..16ed72b1a0 100755 --- a/epochX/cudacpp/gg_ttgg.mad/bin/internal/shower_card.py +++ b/epochX/cudacpp/gg_ttgg.mad/bin/internal/shower_card.py @@ -288,7 +288,7 @@ def write(self, output_file, template=None, python_template=False, self.text = open(template,'r').read() - key_re = re.compile('^(\s*)([\S^#]+)(\s*)=(\s*)([^#]*?)(\s*)(\#.*|$)') + key_re = re.compile(r'^(\s*)([\S^#]+)(\s*)=(\s*)([^#]*?)(\s*)(\#.*|$)') newlines = [] for line in self.text.split('\n'): key_match = key_re.findall(line) diff --git a/epochX/cudacpp/gg_ttgg.mad/bin/internal/systematics.py b/epochX/cudacpp/gg_ttgg.mad/bin/internal/systematics.py index 28eaed00e2..2acebd087c 100644 --- a/epochX/cudacpp/gg_ttgg.mad/bin/internal/systematics.py +++ b/epochX/cudacpp/gg_ttgg.mad/bin/internal/systematics.py @@ -582,7 +582,7 @@ def print_cross_sections(self, all_cross, nb_event, stdout): else: resume.write( '#PDF %s: %g +%2.3g%% -%2.3g%%\n' % (pdfset.name, pdferr.central,pdferr.errplus*100/all_cross[0], pdferr.errminus*100/all_cross[0])) - dyn_name = {1: '\sum ET', 2:'\sum\sqrt{m^2+pt^2}', 3:'0.5 \sum\sqrt{m^2+pt^2}',4:'\sqrt{\hat s}' } + dyn_name = {1: r'\sum ET', 2:r'\sum\sqrt{m^2+pt^2}', 3:r'0.5 \sum\sqrt{m^2+pt^2}',4:r'\sqrt{\hat s}' } for key, curr in dyns.items(): if key ==-1: continue @@ -789,7 +789,7 @@ def get_id(self): return int(self.start_wgt_id) if 'initrwgt' in self.banner: - pattern = re.compile(' set lhapdf /PATH/TO/lhapdf-config -None does not seem to correspond to a valid lhapdf-config executable. -Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config). -Note that you can still compile and run aMC@NLO with the built-in PDFs - MG5_aMC> set lhapdf /PATH/TO/lhapdf-config - Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt -import /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttgg.mg +import /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttgg.mg The import format was not given, so we guess it as command set stdout_level DEBUG set output information to level: 10 @@ -62,7 +57,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.005625247955322266  +DEBUG: model prefixing takes 0.005681276321411133  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,17 +150,16 @@ 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.160 s +1 processes with 123 diagrams generated in 0.161 s Total: 1 processes with 123 diagrams output standalone_cudacpp ../TMPOUT/CODEGEN_cudacpp_gg_ttgg Load PLUGIN.CUDACPP_OUTPUT -Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.5.3_lo_vect. +Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.6.0_lo_vect. It has been validated for the last time with version: 3.5.2 Output will be done with PLUGIN: CUDACPP_OUTPUT -DEBUG: cformat =  plugin [export_cpp.py at line 3070]  DEBUG: Entering PLUGIN_ProcessExporter.__init__ (initialise the exporter) [output.py at line 165]  DEBUG: Entering PLUGIN_ProcessExporter.copy_template (initialise the directory) [output.py at line 170]  -INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttgg +INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttgg INFO: Organizing processes into subprocess groups INFO: Generating Helas calls for process: g g > t t~ g g WEIGHTED<=4 @1 INFO: Processing color information for process: g g > t t~ g g @1 @@ -174,18 +168,18 @@ INFO: Processing color information for process: g g > t t~ g g @1 DEBUG: type(fortran_model)= [output.py at line 214]  DEBUG: type(me)= me=0 [output.py at line 215]  DEBUG: "need to link", self.to_link_in_P =  need to link ['nvtx.h', 'timer.h', 'timermap.h', 'ompnumthreads.h', 'GpuRuntime.h', 'GpuAbstraction.h', 'MemoryAccessHelpers.h', 'MemoryAccessVectors.h', 'MemoryAccessMatrixElements.h', 'MemoryAccessMomenta.h', 'MemoryAccessRandomNumbers.h', 'MemoryAccessWeights.h', 'MemoryAccessAmplitudes.h', 'MemoryAccessWavefunctions.h', 'MemoryAccessGs.h', 'MemoryAccessCouplingsFixed.h', 'MemoryAccessNumerators.h', 'MemoryAccessDenominators.h', 'MemoryAccessChannelIds.h', 'EventStatistics.h', 'CommonRandomNumbers.h', 'CrossSectionKernels.cc', 'CrossSectionKernels.h', 'MatrixElementKernels.cc', 'MatrixElementKernels.h', 'RamboSamplingKernels.cc', 'RamboSamplingKernels.h', 'RandomNumberKernels.h', 'CommonRandomNumberKernel.cc', 'CurandRandomNumberKernel.cc', 'HiprandRandomNumberKernel.cc', 'Bridge.h', 'BridgeKernels.cc', 'BridgeKernels.h', 'fbridge.cc', 'fbridge.inc', 'fsampler.cc', 'fsampler.inc', 'MadgraphTest.h', 'runTest.cc', 'testmisc.cc', 'testxxx_cc_ref.txt', 'valgrind.h', 'cudacpp.mk', 'testxxx.cc', 'MemoryBuffers.h', 'MemoryAccessCouplings.h', 'perf.py', 'profile.sh'] [output.py at line 216]  -INFO: Creating files in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttgg/SubProcesses/P1_Sigma_sm_gg_ttxgg -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttgg/SubProcesses/P1_Sigma_sm_gg_ttxgg/./CPPProcess.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttgg/SubProcesses/P1_Sigma_sm_gg_ttxgg/./CPPProcess.cc -INFO: Created files CPPProcess.h and CPPProcess.cc in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttgg/SubProcesses/P1_Sigma_sm_gg_ttxgg/. -Generated helas calls for 1 subprocesses (123 diagrams) in 0.427 s +INFO: Creating files in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttgg/SubProcesses/P1_Sigma_sm_gg_ttxgg +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttgg/SubProcesses/P1_Sigma_sm_gg_ttxgg/./CPPProcess.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttgg/SubProcesses/P1_Sigma_sm_gg_ttxgg/./CPPProcess.cc +INFO: Created files CPPProcess.h and CPPProcess.cc in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttgg/SubProcesses/P1_Sigma_sm_gg_ttxgg/. +Generated helas calls for 1 subprocesses (123 diagrams) in 0.436 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.321 s +ALOHA: aloha creates 5 routines in 0.323 s VVV1 VVV1 FFV1 @@ -198,17 +192,17 @@ ALOHA: aloha creates 5 routines in 0.321 s VVVV3 VVVV4 VVVV4 -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttgg/src/./HelAmps_sm.h -INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttgg/src/. +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttgg/src/./HelAmps_sm.h +INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttgg/src/. super_write_set_parameters_onlyfixMajorana (hardcoded=False) super_write_set_parameters_onlyfixMajorana (hardcoded=True) -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttgg/src/./Parameters_sm.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttgg/src/./Parameters_sm.cc +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttgg/src/./Parameters_sm.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttgg/src/./Parameters_sm.cc INFO: Created files Parameters_sm.h and Parameters_sm.cc in directory -INFO: /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttgg/src/. and /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttgg/src/. +INFO: /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttgg/src/. and /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttgg/src/. quit -real 0m1.534s -user 0m1.381s -sys 0m0.064s -Code generation completed in 2 seconds +real 0m1.468s +user 0m1.395s +sys 0m0.062s +Code generation completed in 1 seconds 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 f6104016a5..2b142b4e41 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 @@ -14,7 +14,7 @@ Running MG5 in debug mode * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect 2023-12-23 * +* VERSION 3.6.0_lo_vect 2024-06-17 * * * * WARNING: UNKNOWN DEVELOPMENT VERSION. * * WARNING: DO NOT USE FOR PRODUCTION * @@ -45,15 +45,10 @@ Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (inclu Note that you can still compile and run aMC@NLO with the built-in PDFs MG5_aMC> set lhapdf /PATH/TO/lhapdf-config -None does not seem to correspond to a valid lhapdf-config executable. -Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config). -Note that you can still compile and run aMC@NLO with the built-in PDFs - MG5_aMC> set lhapdf /PATH/TO/lhapdf-config - Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt -import /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg.mg +import /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg.mg The import format was not given, so we guess it as command set stdout_level DEBUG set output information to level: 10 @@ -62,7 +57,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.005656003952026367  +DEBUG: model prefixing takes 0.005638599395751953  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,24 +150,24 @@ 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.910 s +1 processes with 1240 diagrams generated in 1.917 s Total: 1 processes with 1240 diagrams output madevent_simd ../TMPOUT/CODEGEN_mad_gg_ttggg --hel_recycling=False --vector_size=32 Load PLUGIN.CUDACPP_OUTPUT -Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.5.3_lo_vect. +Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.6.0_lo_vect. It has been validated for the last time with version: 3.5.2 Output will be done with PLUGIN: CUDACPP_OUTPUT Addition matrix-element will be done with PLUGIN: CUDACPP_OUTPUT +DEBUG: opt['output_options']['vector_size'] =  32 [export_v4.py at line 4334]  Output will be done with PLUGIN: CUDACPP_OUTPUT -DEBUG: cformat =  standalone_simd [export_cpp.py at line 3070]  DEBUG: Entering PLUGIN_ProcessExporter.__init__ (initialise the exporter) [output.py at line 165]  INFO: initialize a new directory: CODEGEN_mad_gg_ttggg INFO: remove old information in CODEGEN_mad_gg_ttggg DEBUG: Entering PLUGIN_ProcessExporter.copy_template (initialise the directory) [output.py at line 170]  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg  -INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/Cards  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/SubProcesses  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg  +INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/Cards  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/SubProcesses  INFO: Organizing processes into subprocess groups INFO: Generating Helas calls for process: g g > t t~ g g g WEIGHTED<=5 @1 INFO: Processing color information for process: g g > t t~ g g g @1 @@ -184,32 +179,28 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 0, 3, 4, 0, 5, 6, 0, 0, 0, 0, 0, 7, 8, 9, 0, 10, 11, 12, 0, 13, 14, 15, 0, 16, 17, 18, 19, 20, 21, 0, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 0, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 67, 68, 69, 70, 71, 72, 73, 74, 75, 0, 76, 77, 78, 79, 80, 81, 82, 83, 84, 0, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 0, 0, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 0, 121, 122, 0, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 0, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 0, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 0, 197, 198, 199, 200, 201, 202, 0, 203, 204, 205, 206, 207, 208, 0, 209, 210, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 0, 226, 227, 0, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 0, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 0, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 0, 302, 303, 304, 305, 306, 307, 0, 308, 309, 310, 311, 312, 313, 0, 314, 315, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 316, 317, 318, 319, 320, 321, 0, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 0, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 0, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 0, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 0, 378, 379, 0, 380, 381, 0, 0, 0, 0, 0, 382, 383, 384, 385, 386, 387, 388, 389, 390, 0, 391, 392, 393, 394, 395, 396, 397, 398, 399, 0, 400, 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, 410, 411, 412, 413, 414, 0, 415, 416, 417, 418, 419, 420, 0, 0, 0, 421, 422, 423, 424, 425, 426, 0, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 0, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 0, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 0, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 0, 483, 484, 0, 485, 486, 0, 0, 0, 0, 0, 487, 488, 489, 490, 491, 492, 493, 494, 495, 0, 496, 497, 498, 499, 500, 501, 502, 503, 504, 0, 505, 506, 507, 508, 509, 510, 511, 512, 513, 0, 514, 515, 516, 517, 518, 519, 0, 520, 521, 522, 523, 524, 525, 0, 0, 0, 526, 527, 528, 529, 530, 531, 0, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 0, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 0, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 0, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 0, 588, 589, 0, 590, 591, 0, 0, 0, 0, 0, 592, 593, 594, 595, 596, 597, 598, 599, 600, 0, 601, 602, 603, 604, 605, 606, 607, 608, 609, 0, 610, 611, 612, 613, 614, 615, 616, 617, 618, 0, 619, 620, 621, 622, 623, 624, 0, 625, 626, 627, 628, 629, 630, 0, 0, 0, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 0, 664, 665, 666, 667, 668, 669, 0, 670, 671, 672, 673, 674, 675, 0, 0, 0, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 0, 709, 710, 711, 712, 713, 714, 0, 715, 716, 717, 718, 719, 720, 0, 0, 0, 721, 722, 0, 723, 724, 0, 725, 726, 0, 0, 0, 0, 0, 727, 728, 729, 730, 731, 732, 733, 734, 735, 0, 736, 737, 738, 739, 740, 741, 742, 743, 744, 0, 745, 746, 747, 748, 749, 750, 751, 752, 753, 0, 754, 755, 756, 757, 758, 759, 0, 760, 761, 762, 763, 764, 765, 766, 767, 0, 768, 769, 0, 770, 771, 0, 0, 0, 0, 0, 772, 773, 774, 775, 776, 777, 778, 779, 780, 0, 781, 782, 783, 784, 785, 786, 787, 788, 789, 0, 790, 791, 792, 793, 794, 795, 796, 797, 798, 0, 799, 800, 801, 802, 803, 804, 0, 805, 806, 807, 808, 809, 810, 811, 812, 0, 813, 814, 0, 815, 816, 0, 0, 0, 0, 0, 817, 818, 819, 820, 821, 822, 823, 824, 825, 0, 826, 827, 828, 829, 830, 831, 832, 833, 834, 0, 835, 836, 837, 838, 839, 840, 841, 842, 843, 0, 844, 845, 846, 847, 848, 849, 0, 850, 851, 852, 853, 854, 855, 856, 857, 0, 858, 859, 0, 860, 861, 0, 0, 0, 0, 862, 863, 0, 864, 865, 0, 866, 867, 0, 0, 0, 0, 868, 869, 0, 870, 871, 0, 872, 873, 0, 0, 0, 0, 0, 0, 0, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 0, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 0, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 0, 928, 929, 930, 931, 932, 933, 0, 934, 935, 936, 937, 938, 939, 0, 940, 941, 942, 943, 944, 945, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [export_cpp.py at line 711]  -DEBUG: subproc_number =  0 [export_cpp.py at line 712]  -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 -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/SubProcesses/P1_gg_ttxggg [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  945 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 4, 4: 5, 5: 7, 6: 8, 7: 14, 8: 15, 9: 16, 10: 18, 11: 19, 12: 20, 13: 22, 14: 23, 15: 24, 16: 26, 17: 27, 18: 28, 19: 29, 20: 30, 21: 31, 22: 33, 23: 34, 24: 35, 25: 36, 26: 37, 27: 38, 28: 39, 29: 40, 30: 41, 31: 42, 32: 43, 33: 44, 34: 45, 35: 46, 36: 47, 37: 49, 38: 50, 39: 51, 40: 52, 41: 53, 42: 54, 43: 55, 44: 56, 45: 57, 46: 58, 47: 59, 48: 60, 49: 61, 50: 62, 51: 63, 52: 65, 53: 66, 54: 67, 55: 68, 56: 69, 57: 70, 58: 71, 59: 72, 60: 73, 61: 74, 62: 75, 63: 76, 64: 77, 65: 78, 66: 79, 67: 81, 68: 82, 69: 83, 70: 84, 71: 85, 72: 86, 73: 87, 74: 88, 75: 89, 76: 91, 77: 92, 78: 93, 79: 94, 80: 95, 81: 96, 82: 97, 83: 98, 84: 99, 85: 101, 86: 102, 87: 103, 88: 104, 89: 105, 90: 106, 91: 107, 92: 108, 93: 109, 94: 110, 95: 111, 96: 112, 97: 113, 98: 114, 99: 115, 100: 116, 101: 117, 102: 118, 103: 119, 104: 120, 105: 121, 106: 124, 107: 125, 108: 126, 109: 127, 110: 128, 111: 129, 112: 130, 113: 131, 114: 132, 115: 133, 116: 134, 117: 135, 118: 136, 119: 137, 120: 138, 121: 140, 122: 141, 123: 143, 124: 144, 125: 145, 126: 146, 127: 147, 128: 148, 129: 149, 130: 150, 131: 151, 132: 152, 133: 153, 134: 154, 135: 155, 136: 156, 137: 157, 138: 159, 139: 160, 140: 161, 141: 162, 142: 163, 143: 164, 144: 165, 145: 166, 146: 167, 147: 168, 148: 169, 149: 170, 150: 171, 151: 172, 152: 173, 153: 175, 154: 176, 155: 177, 156: 178, 157: 179, 158: 180, 159: 181, 160: 182, 161: 183, 162: 184, 163: 185, 164: 186, 165: 187, 166: 188, 167: 189, 168: 190, 169: 191, 170: 192, 171: 193, 172: 194, 173: 195, 174: 196, 175: 197, 176: 198, 177: 199, 178: 200, 179: 201, 180: 202, 181: 203, 182: 204, 183: 205, 184: 206, 185: 207, 186: 208, 187: 209, 188: 210, 189: 211, 190: 212, 191: 213, 192: 214, 193: 215, 194: 216, 195: 217, 196: 218, 197: 220, 198: 221, 199: 222, 200: 223, 201: 224, 202: 225, 203: 227, 204: 228, 205: 229, 206: 230, 207: 231, 208: 232, 209: 234, 210: 235, 211: 247, 212: 248, 213: 249, 214: 250, 215: 251, 216: 252, 217: 253, 218: 254, 219: 255, 220: 256, 221: 257, 222: 258, 223: 259, 224: 260, 225: 261, 226: 263, 227: 264, 228: 266, 229: 267, 230: 268, 231: 269, 232: 270, 233: 271, 234: 272, 235: 273, 236: 274, 237: 275, 238: 276, 239: 277, 240: 278, 241: 279, 242: 280, 243: 282, 244: 283, 245: 284, 246: 285, 247: 286, 248: 287, 249: 288, 250: 289, 251: 290, 252: 291, 253: 292, 254: 293, 255: 294, 256: 295, 257: 296, 258: 298, 259: 299, 260: 300, 261: 301, 262: 302, 263: 303, 264: 304, 265: 305, 266: 306, 267: 307, 268: 308, 269: 309, 270: 310, 271: 311, 272: 312, 273: 313, 274: 314, 275: 315, 276: 316, 277: 317, 278: 318, 279: 319, 280: 320, 281: 321, 282: 322, 283: 323, 284: 324, 285: 325, 286: 326, 287: 327, 288: 328, 289: 329, 290: 330, 291: 331, 292: 332, 293: 333, 294: 334, 295: 335, 296: 336, 297: 337, 298: 338, 299: 339, 300: 340, 301: 341, 302: 343, 303: 344, 304: 345, 305: 346, 306: 347, 307: 348, 308: 350, 309: 351, 310: 352, 311: 353, 312: 354, 313: 355, 314: 357, 315: 358, 316: 370, 317: 371, 318: 372, 319: 373, 320: 374, 321: 375, 322: 377, 323: 378, 324: 379, 325: 380, 326: 381, 327: 382, 328: 383, 329: 384, 330: 385, 331: 386, 332: 387, 333: 388, 334: 389, 335: 390, 336: 391, 337: 393, 338: 394, 339: 395, 340: 396, 341: 397, 342: 398, 343: 399, 344: 400, 345: 401, 346: 402, 347: 403, 348: 404, 349: 405, 350: 406, 351: 407, 352: 409, 353: 410, 354: 411, 355: 412, 356: 413, 357: 414, 358: 415, 359: 416, 360: 417, 361: 418, 362: 419, 363: 420, 364: 421, 365: 422, 366: 423, 367: 425, 368: 426, 369: 427, 370: 428, 371: 429, 372: 430, 373: 431, 374: 432, 375: 433, 376: 434, 377: 435, 378: 437, 379: 438, 380: 440, 381: 441, 382: 447, 383: 448, 384: 449, 385: 450, 386: 451, 387: 452, 388: 453, 389: 454, 390: 455, 391: 457, 392: 458, 393: 459, 394: 460, 395: 461, 396: 462, 397: 463, 398: 464, 399: 465, 400: 467, 401: 468, 402: 469, 403: 470, 404: 471, 405: 472, 406: 473, 407: 474, 408: 475, 409: 477, 410: 478, 411: 479, 412: 480, 413: 481, 414: 482, 415: 484, 416: 485, 417: 486, 418: 487, 419: 488, 420: 489, 421: 493, 422: 494, 423: 495, 424: 496, 425: 497, 426: 498, 427: 500, 428: 501, 429: 502, 430: 503, 431: 504, 432: 505, 433: 506, 434: 507, 435: 508, 436: 509, 437: 510, 438: 511, 439: 512, 440: 513, 441: 514, 442: 516, 443: 517, 444: 518, 445: 519, 446: 520, 447: 521, 448: 522, 449: 523, 450: 524, 451: 525, 452: 526, 453: 527, 454: 528, 455: 529, 456: 530, 457: 532, 458: 533, 459: 534, 460: 535, 461: 536, 462: 537, 463: 538, 464: 539, 465: 540, 466: 541, 467: 542, 468: 543, 469: 544, 470: 545, 471: 546, 472: 548, 473: 549, 474: 550, 475: 551, 476: 552, 477: 553, 478: 554, 479: 555, 480: 556, 481: 557, 482: 558, 483: 560, 484: 561, 485: 563, 486: 564, 487: 570, 488: 571, 489: 572, 490: 573, 491: 574, 492: 575, 493: 576, 494: 577, 495: 578, 496: 580, 497: 581, 498: 582, 499: 583, 500: 584, 501: 585, 502: 586, 503: 587, 504: 588, 505: 590, 506: 591, 507: 592, 508: 593, 509: 594, 510: 595, 511: 596, 512: 597, 513: 598, 514: 600, 515: 601, 516: 602, 517: 603, 518: 604, 519: 605, 520: 607, 521: 608, 522: 609, 523: 610, 524: 611, 525: 612, 526: 616, 527: 617, 528: 618, 529: 619, 530: 620, 531: 621, 532: 623, 533: 624, 534: 625, 535: 626, 536: 627, 537: 628, 538: 629, 539: 630, 540: 631, 541: 632, 542: 633, 543: 634, 544: 635, 545: 636, 546: 637, 547: 639, 548: 640, 549: 641, 550: 642, 551: 643, 552: 644, 553: 645, 554: 646, 555: 647, 556: 648, 557: 649, 558: 650, 559: 651, 560: 652, 561: 653, 562: 655, 563: 656, 564: 657, 565: 658, 566: 659, 567: 660, 568: 661, 569: 662, 570: 663, 571: 664, 572: 665, 573: 666, 574: 667, 575: 668, 576: 669, 577: 671, 578: 672, 579: 673, 580: 674, 581: 675, 582: 676, 583: 677, 584: 678, 585: 679, 586: 680, 587: 681, 588: 683, 589: 684, 590: 686, 591: 687, 592: 693, 593: 694, 594: 695, 595: 696, 596: 697, 597: 698, 598: 699, 599: 700, 600: 701, 601: 703, 602: 704, 603: 705, 604: 706, 605: 707, 606: 708, 607: 709, 608: 710, 609: 711, 610: 713, 611: 714, 612: 715, 613: 716, 614: 717, 615: 718, 616: 719, 617: 720, 618: 721, 619: 723, 620: 724, 621: 725, 622: 726, 623: 727, 624: 728, 625: 730, 626: 731, 627: 732, 628: 733, 629: 734, 630: 735, 631: 739, 632: 740, 633: 741, 634: 742, 635: 743, 636: 744, 637: 745, 638: 746, 639: 747, 640: 748, 641: 749, 642: 750, 643: 751, 644: 752, 645: 753, 646: 754, 647: 755, 648: 756, 649: 757, 650: 758, 651: 759, 652: 760, 653: 761, 654: 762, 655: 763, 656: 764, 657: 765, 658: 766, 659: 767, 660: 768, 661: 769, 662: 770, 663: 771, 664: 773, 665: 774, 666: 775, 667: 776, 668: 777, 669: 778, 670: 780, 671: 781, 672: 782, 673: 783, 674: 784, 675: 785, 676: 789, 677: 790, 678: 791, 679: 792, 680: 793, 681: 794, 682: 795, 683: 796, 684: 797, 685: 798, 686: 799, 687: 800, 688: 801, 689: 802, 690: 803, 691: 804, 692: 805, 693: 806, 694: 807, 695: 808, 696: 809, 697: 810, 698: 811, 699: 812, 700: 813, 701: 814, 702: 815, 703: 816, 704: 817, 705: 818, 706: 819, 707: 820, 708: 821, 709: 823, 710: 824, 711: 825, 712: 826, 713: 827, 714: 828, 715: 830, 716: 831, 717: 832, 718: 833, 719: 834, 720: 835, 721: 839, 722: 840, 723: 842, 724: 843, 725: 845, 726: 846, 727: 852, 728: 853, 729: 854, 730: 855, 731: 856, 732: 857, 733: 858, 734: 859, 735: 860, 736: 862, 737: 863, 738: 864, 739: 865, 740: 866, 741: 867, 742: 868, 743: 869, 744: 870, 745: 872, 746: 873, 747: 874, 748: 875, 749: 876, 750: 877, 751: 878, 752: 879, 753: 880, 754: 882, 755: 883, 756: 884, 757: 885, 758: 886, 759: 887, 760: 889, 761: 890, 762: 891, 763: 892, 764: 893, 765: 894, 766: 895, 767: 896, 768: 898, 769: 899, 770: 901, 771: 902, 772: 908, 773: 909, 774: 910, 775: 911, 776: 912, 777: 913, 778: 914, 779: 915, 780: 916, 781: 918, 782: 919, 783: 920, 784: 921, 785: 922, 786: 923, 787: 924, 788: 925, 789: 926, 790: 928, 791: 929, 792: 930, 793: 931, 794: 932, 795: 933, 796: 934, 797: 935, 798: 936, 799: 938, 800: 939, 801: 940, 802: 941, 803: 942, 804: 943, 805: 945, 806: 946, 807: 947, 808: 948, 809: 949, 810: 950, 811: 951, 812: 952, 813: 954, 814: 955, 815: 957, 816: 958, 817: 964, 818: 965, 819: 966, 820: 967, 821: 968, 822: 969, 823: 970, 824: 971, 825: 972, 826: 974, 827: 975, 828: 976, 829: 977, 830: 978, 831: 979, 832: 980, 833: 981, 834: 982, 835: 984, 836: 985, 837: 986, 838: 987, 839: 988, 840: 989, 841: 990, 842: 991, 843: 992, 844: 994, 845: 995, 846: 996, 847: 997, 848: 998, 849: 999, 850: 1001, 851: 1002, 852: 1003, 853: 1004, 854: 1005, 855: 1006, 856: 1007, 857: 1008, 858: 1010, 859: 1011, 860: 1013, 861: 1014, 862: 1019, 863: 1020, 864: 1022, 865: 1023, 866: 1025, 867: 1026, 868: 1031, 869: 1032, 870: 1034, 871: 1035, 872: 1037, 873: 1038, 874: 1046, 875: 1047, 876: 1048, 877: 1049, 878: 1050, 879: 1051, 880: 1052, 881: 1053, 882: 1054, 883: 1055, 884: 1056, 885: 1057, 886: 1058, 887: 1059, 888: 1060, 889: 1061, 890: 1062, 891: 1063, 892: 1065, 893: 1066, 894: 1067, 895: 1068, 896: 1069, 897: 1070, 898: 1071, 899: 1072, 900: 1073, 901: 1074, 902: 1075, 903: 1076, 904: 1077, 905: 1078, 906: 1079, 907: 1080, 908: 1081, 909: 1082, 910: 1084, 911: 1085, 912: 1086, 913: 1087, 914: 1088, 915: 1089, 916: 1090, 917: 1091, 918: 1092, 919: 1093, 920: 1094, 921: 1095, 922: 1096, 923: 1097, 924: 1098, 925: 1099, 926: 1100, 927: 1101, 928: 1103, 929: 1104, 930: 1105, 931: 1106, 932: 1107, 933: 1108, 934: 1110, 935: 1111, 936: 1112, 937: 1113, 938: 1114, 939: 1115, 940: 1117, 941: 1118, 942: 1119, 943: 1120, 944: 1121, 945: 1122} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 4: 3, 5: 4, 7: 5, 8: 6, 14: 7, 15: 8, 16: 9, 18: 10, 19: 11, 20: 12, 22: 13, 23: 14, 24: 15, 26: 16, 27: 17, 28: 18, 29: 19, 30: 20, 31: 21, 33: 22, 34: 23, 35: 24, 36: 25, 37: 26, 38: 27, 39: 28, 40: 29, 41: 30, 42: 31, 43: 32, 44: 33, 45: 34, 46: 35, 47: 36, 49: 37, 50: 38, 51: 39, 52: 40, 53: 41, 54: 42, 55: 43, 56: 44, 57: 45, 58: 46, 59: 47, 60: 48, 61: 49, 62: 50, 63: 51, 65: 52, 66: 53, 67: 54, 68: 55, 69: 56, 70: 57, 71: 58, 72: 59, 73: 60, 74: 61, 75: 62, 76: 63, 77: 64, 78: 65, 79: 66, 81: 67, 82: 68, 83: 69, 84: 70, 85: 71, 86: 72, 87: 73, 88: 74, 89: 75, 91: 76, 92: 77, 93: 78, 94: 79, 95: 80, 96: 81, 97: 82, 98: 83, 99: 84, 101: 85, 102: 86, 103: 87, 104: 88, 105: 89, 106: 90, 107: 91, 108: 92, 109: 93, 110: 94, 111: 95, 112: 96, 113: 97, 114: 98, 115: 99, 116: 100, 117: 101, 118: 102, 119: 103, 120: 104, 121: 105, 124: 106, 125: 107, 126: 108, 127: 109, 128: 110, 129: 111, 130: 112, 131: 113, 132: 114, 133: 115, 134: 116, 135: 117, 136: 118, 137: 119, 138: 120, 140: 121, 141: 122, 143: 123, 144: 124, 145: 125, 146: 126, 147: 127, 148: 128, 149: 129, 150: 130, 151: 131, 152: 132, 153: 133, 154: 134, 155: 135, 156: 136, 157: 137, 159: 138, 160: 139, 161: 140, 162: 141, 163: 142, 164: 143, 165: 144, 166: 145, 167: 146, 168: 147, 169: 148, 170: 149, 171: 150, 172: 151, 173: 152, 175: 153, 176: 154, 177: 155, 178: 156, 179: 157, 180: 158, 181: 159, 182: 160, 183: 161, 184: 162, 185: 163, 186: 164, 187: 165, 188: 166, 189: 167, 190: 168, 191: 169, 192: 170, 193: 171, 194: 172, 195: 173, 196: 174, 197: 175, 198: 176, 199: 177, 200: 178, 201: 179, 202: 180, 203: 181, 204: 182, 205: 183, 206: 184, 207: 185, 208: 186, 209: 187, 210: 188, 211: 189, 212: 190, 213: 191, 214: 192, 215: 193, 216: 194, 217: 195, 218: 196, 220: 197, 221: 198, 222: 199, 223: 200, 224: 201, 225: 202, 227: 203, 228: 204, 229: 205, 230: 206, 231: 207, 232: 208, 234: 209, 235: 210, 247: 211, 248: 212, 249: 213, 250: 214, 251: 215, 252: 216, 253: 217, 254: 218, 255: 219, 256: 220, 257: 221, 258: 222, 259: 223, 260: 224, 261: 225, 263: 226, 264: 227, 266: 228, 267: 229, 268: 230, 269: 231, 270: 232, 271: 233, 272: 234, 273: 235, 274: 236, 275: 237, 276: 238, 277: 239, 278: 240, 279: 241, 280: 242, 282: 243, 283: 244, 284: 245, 285: 246, 286: 247, 287: 248, 288: 249, 289: 250, 290: 251, 291: 252, 292: 253, 293: 254, 294: 255, 295: 256, 296: 257, 298: 258, 299: 259, 300: 260, 301: 261, 302: 262, 303: 263, 304: 264, 305: 265, 306: 266, 307: 267, 308: 268, 309: 269, 310: 270, 311: 271, 312: 272, 313: 273, 314: 274, 315: 275, 316: 276, 317: 277, 318: 278, 319: 279, 320: 280, 321: 281, 322: 282, 323: 283, 324: 284, 325: 285, 326: 286, 327: 287, 328: 288, 329: 289, 330: 290, 331: 291, 332: 292, 333: 293, 334: 294, 335: 295, 336: 296, 337: 297, 338: 298, 339: 299, 340: 300, 341: 301, 343: 302, 344: 303, 345: 304, 346: 305, 347: 306, 348: 307, 350: 308, 351: 309, 352: 310, 353: 311, 354: 312, 355: 313, 357: 314, 358: 315, 370: 316, 371: 317, 372: 318, 373: 319, 374: 320, 375: 321, 377: 322, 378: 323, 379: 324, 380: 325, 381: 326, 382: 327, 383: 328, 384: 329, 385: 330, 386: 331, 387: 332, 388: 333, 389: 334, 390: 335, 391: 336, 393: 337, 394: 338, 395: 339, 396: 340, 397: 341, 398: 342, 399: 343, 400: 344, 401: 345, 402: 346, 403: 347, 404: 348, 405: 349, 406: 350, 407: 351, 409: 352, 410: 353, 411: 354, 412: 355, 413: 356, 414: 357, 415: 358, 416: 359, 417: 360, 418: 361, 419: 362, 420: 363, 421: 364, 422: 365, 423: 366, 425: 367, 426: 368, 427: 369, 428: 370, 429: 371, 430: 372, 431: 373, 432: 374, 433: 375, 434: 376, 435: 377, 437: 378, 438: 379, 440: 380, 441: 381, 447: 382, 448: 383, 449: 384, 450: 385, 451: 386, 452: 387, 453: 388, 454: 389, 455: 390, 457: 391, 458: 392, 459: 393, 460: 394, 461: 395, 462: 396, 463: 397, 464: 398, 465: 399, 467: 400, 468: 401, 469: 402, 470: 403, 471: 404, 472: 405, 473: 406, 474: 407, 475: 408, 477: 409, 478: 410, 479: 411, 480: 412, 481: 413, 482: 414, 484: 415, 485: 416, 486: 417, 487: 418, 488: 419, 489: 420, 493: 421, 494: 422, 495: 423, 496: 424, 497: 425, 498: 426, 500: 427, 501: 428, 502: 429, 503: 430, 504: 431, 505: 432, 506: 433, 507: 434, 508: 435, 509: 436, 510: 437, 511: 438, 512: 439, 513: 440, 514: 441, 516: 442, 517: 443, 518: 444, 519: 445, 520: 446, 521: 447, 522: 448, 523: 449, 524: 450, 525: 451, 526: 452, 527: 453, 528: 454, 529: 455, 530: 456, 532: 457, 533: 458, 534: 459, 535: 460, 536: 461, 537: 462, 538: 463, 539: 464, 540: 465, 541: 466, 542: 467, 543: 468, 544: 469, 545: 470, 546: 471, 548: 472, 549: 473, 550: 474, 551: 475, 552: 476, 553: 477, 554: 478, 555: 479, 556: 480, 557: 481, 558: 482, 560: 483, 561: 484, 563: 485, 564: 486, 570: 487, 571: 488, 572: 489, 573: 490, 574: 491, 575: 492, 576: 493, 577: 494, 578: 495, 580: 496, 581: 497, 582: 498, 583: 499, 584: 500, 585: 501, 586: 502, 587: 503, 588: 504, 590: 505, 591: 506, 592: 507, 593: 508, 594: 509, 595: 510, 596: 511, 597: 512, 598: 513, 600: 514, 601: 515, 602: 516, 603: 517, 604: 518, 605: 519, 607: 520, 608: 521, 609: 522, 610: 523, 611: 524, 612: 525, 616: 526, 617: 527, 618: 528, 619: 529, 620: 530, 621: 531, 623: 532, 624: 533, 625: 534, 626: 535, 627: 536, 628: 537, 629: 538, 630: 539, 631: 540, 632: 541, 633: 542, 634: 543, 635: 544, 636: 545, 637: 546, 639: 547, 640: 548, 641: 549, 642: 550, 643: 551, 644: 552, 645: 553, 646: 554, 647: 555, 648: 556, 649: 557, 650: 558, 651: 559, 652: 560, 653: 561, 655: 562, 656: 563, 657: 564, 658: 565, 659: 566, 660: 567, 661: 568, 662: 569, 663: 570, 664: 571, 665: 572, 666: 573, 667: 574, 668: 575, 669: 576, 671: 577, 672: 578, 673: 579, 674: 580, 675: 581, 676: 582, 677: 583, 678: 584, 679: 585, 680: 586, 681: 587, 683: 588, 684: 589, 686: 590, 687: 591, 693: 592, 694: 593, 695: 594, 696: 595, 697: 596, 698: 597, 699: 598, 700: 599, 701: 600, 703: 601, 704: 602, 705: 603, 706: 604, 707: 605, 708: 606, 709: 607, 710: 608, 711: 609, 713: 610, 714: 611, 715: 612, 716: 613, 717: 614, 718: 615, 719: 616, 720: 617, 721: 618, 723: 619, 724: 620, 725: 621, 726: 622, 727: 623, 728: 624, 730: 625, 731: 626, 732: 627, 733: 628, 734: 629, 735: 630, 739: 631, 740: 632, 741: 633, 742: 634, 743: 635, 744: 636, 745: 637, 746: 638, 747: 639, 748: 640, 749: 641, 750: 642, 751: 643, 752: 644, 753: 645, 754: 646, 755: 647, 756: 648, 757: 649, 758: 650, 759: 651, 760: 652, 761: 653, 762: 654, 763: 655, 764: 656, 765: 657, 766: 658, 767: 659, 768: 660, 769: 661, 770: 662, 771: 663, 773: 664, 774: 665, 775: 666, 776: 667, 777: 668, 778: 669, 780: 670, 781: 671, 782: 672, 783: 673, 784: 674, 785: 675, 789: 676, 790: 677, 791: 678, 792: 679, 793: 680, 794: 681, 795: 682, 796: 683, 797: 684, 798: 685, 799: 686, 800: 687, 801: 688, 802: 689, 803: 690, 804: 691, 805: 692, 806: 693, 807: 694, 808: 695, 809: 696, 810: 697, 811: 698, 812: 699, 813: 700, 814: 701, 815: 702, 816: 703, 817: 704, 818: 705, 819: 706, 820: 707, 821: 708, 823: 709, 824: 710, 825: 711, 826: 712, 827: 713, 828: 714, 830: 715, 831: 716, 832: 717, 833: 718, 834: 719, 835: 720, 839: 721, 840: 722, 842: 723, 843: 724, 845: 725, 846: 726, 852: 727, 853: 728, 854: 729, 855: 730, 856: 731, 857: 732, 858: 733, 859: 734, 860: 735, 862: 736, 863: 737, 864: 738, 865: 739, 866: 740, 867: 741, 868: 742, 869: 743, 870: 744, 872: 745, 873: 746, 874: 747, 875: 748, 876: 749, 877: 750, 878: 751, 879: 752, 880: 753, 882: 754, 883: 755, 884: 756, 885: 757, 886: 758, 887: 759, 889: 760, 890: 761, 891: 762, 892: 763, 893: 764, 894: 765, 895: 766, 896: 767, 898: 768, 899: 769, 901: 770, 902: 771, 908: 772, 909: 773, 910: 774, 911: 775, 912: 776, 913: 777, 914: 778, 915: 779, 916: 780, 918: 781, 919: 782, 920: 783, 921: 784, 922: 785, 923: 786, 924: 787, 925: 788, 926: 789, 928: 790, 929: 791, 930: 792, 931: 793, 932: 794, 933: 795, 934: 796, 935: 797, 936: 798, 938: 799, 939: 800, 940: 801, 941: 802, 942: 803, 943: 804, 945: 805, 946: 806, 947: 807, 948: 808, 949: 809, 950: 810, 951: 811, 952: 812, 954: 813, 955: 814, 957: 815, 958: 816, 964: 817, 965: 818, 966: 819, 967: 820, 968: 821, 969: 822, 970: 823, 971: 824, 972: 825, 974: 826, 975: 827, 976: 828, 977: 829, 978: 830, 979: 831, 980: 832, 981: 833, 982: 834, 984: 835, 985: 836, 986: 837, 987: 838, 988: 839, 989: 840, 990: 841, 991: 842, 992: 843, 994: 844, 995: 845, 996: 846, 997: 847, 998: 848, 999: 849, 1001: 850, 1002: 851, 1003: 852, 1004: 853, 1005: 854, 1006: 855, 1007: 856, 1008: 857, 1010: 858, 1011: 859, 1013: 860, 1014: 861, 1019: 862, 1020: 863, 1022: 864, 1023: 865, 1025: 866, 1026: 867, 1031: 868, 1032: 869, 1034: 870, 1035: 871, 1037: 872, 1038: 873, 1046: 874, 1047: 875, 1048: 876, 1049: 877, 1050: 878, 1051: 879, 1052: 880, 1053: 881, 1054: 882, 1055: 883, 1056: 884, 1057: 885, 1058: 886, 1059: 887, 1060: 888, 1061: 889, 1062: 890, 1063: 891, 1065: 892, 1066: 893, 1067: 894, 1068: 895, 1069: 896, 1070: 897, 1071: 898, 1072: 899, 1073: 900, 1074: 901, 1075: 902, 1076: 903, 1077: 904, 1078: 905, 1079: 906, 1080: 907, 1081: 908, 1082: 909, 1084: 910, 1085: 911, 1086: 912, 1087: 913, 1088: 914, 1089: 915, 1090: 916, 1091: 917, 1092: 918, 1093: 919, 1094: 920, 1095: 921, 1096: 922, 1097: 923, 1098: 924, 1099: 925, 1100: 926, 1101: 927, 1103: 928, 1104: 929, 1105: 930, 1106: 931, 1107: 932, 1108: 933, 1110: 934, 1111: 935, 1112: 936, 1113: 937, 1114: 938, 1115: 939, 1117: 940, 1118: 941, 1119: 942, 1120: 943, 1121: 944, 1122: 945} [model_handling.py at line 1548]  -Generated helas calls for 1 subprocesses (1240 diagrams) in 6.661 s -Wrote files for 2281 helas calls in 18.701 s +Generated helas calls for 1 subprocesses (1240 diagrams) in 6.738 s +Wrote files for 2281 helas calls in 18.801 s +DEBUG: self.vector_size =  32 [export_v4.py at line 7023]  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.322 s +ALOHA: aloha creates 5 routines in 0.329 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 10 routines in 0.367 s +ALOHA: aloha creates 10 routines in 0.321 s VVV1 VVV1 FFV1 @@ -222,38 +213,40 @@ ALOHA: aloha creates 10 routines in 0.367 s VVVV3 VVVV4 VVVV4 -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/src/./HelAmps_sm.h -INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/src/. +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/src/./HelAmps_sm.h +INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/src/. super_write_set_parameters_onlyfixMajorana (hardcoded=False) super_write_set_parameters_onlyfixMajorana (hardcoded=True) -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/src/./Parameters_sm.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/src/./Parameters_sm.cc +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/src/./Parameters_sm.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/src/./Parameters_sm.cc INFO: Created files Parameters_sm.h and Parameters_sm.cc in directory -INFO: /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/src/. and /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/src/. +INFO: /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/src/. and /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/src/. The option zerowidth_tchannel is modified [True] but will not be written in the configuration files. If you want to make this value the default for future session, you can run 'save options --all' -save configuration file to /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/Cards/me5_configuration.txt +save configuration file to /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/Cards/me5_configuration.txt INFO: Use Fortran compiler gfortran INFO: Use c++ compiler g++ INFO: Generate jpeg diagrams INFO: Generate web pages -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common -patching file Source/genps.inc +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common patching file SubProcesses/makefile -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/SubProcesses/P1_gg_ttxggg; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/SubProcesses/P1_gg_ttxggg; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #2 succeeded at 345 (offset 112 lines). +Hunk #2 succeeded at 339 (offset 125 lines). DEBUG: p.returncode =  0 [output.py at line 258]  -Output to directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg done. +Output to directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg done. Type "launch" to generate events from this process, or see -/data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/README +/data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/README Run "open index.html" to see more information about this process. quit -real 0m33.094s -user 0m32.521s -sys 0m0.443s +real 0m33.303s +user 0m32.735s +sys 0m0.449s Code generation completed in 33 seconds ************************************************************ * * @@ -267,7 +260,7 @@ Code generation completed in 33 seconds * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect * +* VERSION 3.6.0_lo_vect * * * * The MadGraph5_aMC@NLO Development Team - Find us at * * https://server06.fynu.ucl.ac.be/projects/madgraph * @@ -275,9 +268,9 @@ Code generation completed in 33 seconds * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt @@ -297,7 +290,7 @@ launch in debug mode * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect * +* VERSION 3.6.0_lo_vect * * * * The MadGraph5_aMC@NLO Development Team - Find us at * * https://server06.fynu.ucl.ac.be/projects/madgraph * @@ -305,9 +298,9 @@ launch in debug mode * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gg_ttggg/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt diff --git a/epochX/cudacpp/gg_ttggg.mad/Cards/me5_configuration.txt b/epochX/cudacpp/gg_ttggg.mad/Cards/me5_configuration.txt index cdeedc7863..4f5079f78a 100644 --- a/epochX/cudacpp/gg_ttggg.mad/Cards/me5_configuration.txt +++ b/epochX/cudacpp/gg_ttggg.mad/Cards/me5_configuration.txt @@ -116,6 +116,7 @@ # cluster_type = condor # cluster_queue = madgraph # cluster_size = 150 +# cluster_walltime = # time in minute for slurm and second for condor (not supported for other scheduller) #! Path to a node directory to avoid direct writing on the central disk #! Note that condor clusters avoid direct writing by default (therefore this @@ -234,7 +235,7 @@ # pineappl = pineappl -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo # MG5 MAIN DIRECTORY -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo diff --git a/epochX/cudacpp/gg_ttggg.mad/Cards/param_card.dat b/epochX/cudacpp/gg_ttggg.mad/Cards/param_card.dat index caf4a67ea8..bb150ef10d 100644 --- a/epochX/cudacpp/gg_ttggg.mad/Cards/param_card.dat +++ b/epochX/cudacpp/gg_ttggg.mad/Cards/param_card.dat @@ -1,5 +1,5 @@ ###################################################################### -## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL #### +## PARAM_CARD AUTOMATICALLY GENERATED BY MG5 FOLLOWING UFO MODEL #### ###################################################################### ## ## ## Width set on Auto will be computed following the information ## diff --git a/epochX/cudacpp/gg_ttggg.mad/Cards/param_card_default.dat b/epochX/cudacpp/gg_ttggg.mad/Cards/param_card_default.dat index caf4a67ea8..bb150ef10d 100644 --- a/epochX/cudacpp/gg_ttggg.mad/Cards/param_card_default.dat +++ b/epochX/cudacpp/gg_ttggg.mad/Cards/param_card_default.dat @@ -1,5 +1,5 @@ ###################################################################### -## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL #### +## PARAM_CARD AUTOMATICALLY GENERATED BY MG5 FOLLOWING UFO MODEL #### ###################################################################### ## ## ## Width set on Auto will be computed following the information ## diff --git a/epochX/cudacpp/gg_ttggg.mad/Cards/proc_card_mg5.dat b/epochX/cudacpp/gg_ttggg.mad/Cards/proc_card_mg5.dat index c16335faca..c931dbb655 100644 --- a/epochX/cudacpp/gg_ttggg.mad/Cards/proc_card_mg5.dat +++ b/epochX/cudacpp/gg_ttggg.mad/Cards/proc_card_mg5.dat @@ -8,7 +8,7 @@ #* * * * #* * #* * -#* VERSION 3.5.3_lo_vect 2023-12-23 * +#* VERSION 3.6.0_lo_vect 2024-06-17 * #* * #* WARNING: UNKNOWN DEVELOPMENT VERSION. * #* WARNING: DO NOT USE FOR PRODUCTION * diff --git a/epochX/cudacpp/gg_ttggg.mad/Cards/reweight_card_default.dat b/epochX/cudacpp/gg_ttggg.mad/Cards/reweight_card_default.dat index ace534ae02..5cc65fe095 100644 --- a/epochX/cudacpp/gg_ttggg.mad/Cards/reweight_card_default.dat +++ b/epochX/cudacpp/gg_ttggg.mad/Cards/reweight_card_default.dat @@ -19,8 +19,16 @@ change mode NLO # Define type of Reweighting. For LO sample this command # has no effect since only "LO" mode is allowed. + +#uncomment if you do not want to overwrite the reweight file of Sudakov in rw_me +#change rwgt_dir /PATH_MG5_BRANCH/NAME_FOLDER + +#uncomment if you want to use Sudakov Reweight +#change include_sudakov True + launch + # SPECIFY A PATH OR USE THE SET COMMAND LIKE THIS: # set sminputs 1 130 # modify 1/alpha_EW diff --git a/epochX/cudacpp/gg_ttggg.mad/Cards/run_card.dat b/epochX/cudacpp/gg_ttggg.mad/Cards/run_card.dat index e1d6da3a51..a08f93d92b 100644 --- a/epochX/cudacpp/gg_ttggg.mad/Cards/run_card.dat +++ b/epochX/cudacpp/gg_ttggg.mad/Cards/run_card.dat @@ -191,6 +191,7 @@ systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++] ['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule + #*********************************************************************** # SIMD/GPU configuration for the CUDACPP plugin #************************************************************************ diff --git a/epochX/cudacpp/gg_ttggg.mad/Cards/run_card_default.dat b/epochX/cudacpp/gg_ttggg.mad/Cards/run_card_default.dat index 7985e9ab10..e9046320c6 100644 --- a/epochX/cudacpp/gg_ttggg.mad/Cards/run_card_default.dat +++ b/epochX/cudacpp/gg_ttggg.mad/Cards/run_card_default.dat @@ -191,6 +191,7 @@ systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++] ['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule + #*********************************************************************** # SIMD/GPU configuration for the CUDACPP plugin #************************************************************************ diff --git a/epochX/cudacpp/gg_ttggg.mad/MGMEVersion.txt b/epochX/cudacpp/gg_ttggg.mad/MGMEVersion.txt index 9d3a5c0ba0..a806d3938c 100644 --- a/epochX/cudacpp/gg_ttggg.mad/MGMEVersion.txt +++ b/epochX/cudacpp/gg_ttggg.mad/MGMEVersion.txt @@ -1 +1 @@ -3.5.3_lo_vect \ No newline at end of file +3.6.0_lo_vect \ No newline at end of file diff --git a/epochX/cudacpp/gg_ttggg.mad/Source/DHELAS/aloha_functions.f b/epochX/cudacpp/gg_ttggg.mad/Source/DHELAS/aloha_functions.f index 975725737f..47699fa614 100644 --- a/epochX/cudacpp/gg_ttggg.mad/Source/DHELAS/aloha_functions.f +++ b/epochX/cudacpp/gg_ttggg.mad/Source/DHELAS/aloha_functions.f @@ -351,7 +351,7 @@ subroutine oxxxxx(p,fmass,nhel,nsf , fo) fo(6) = ip * sqm(abs(im)) else - pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2)) +c pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2)) sf(1) = dble(1+nsf+(1-nsf)*nh)*rHalf sf(2) = dble(1+nsf-(1-nsf)*nh)*rHalf omega(1) = dsqrt(p(0)+pp) @@ -2054,7 +2054,7 @@ subroutine CombineAmp(nb, ihels, iwfcts, W1, Wall, Amp) enddo return end - + subroutine CombineAmpS(nb, ihels, iwfcts, W1, Wall, Amp) integer nb ! size of the vectors diff --git a/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/couplings.f b/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/couplings.f index f3b620ab58..04d6bb5333 100644 --- a/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/couplings.f +++ b/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/couplings.f @@ -10,18 +10,27 @@ SUBROUTINE COUP() PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + LOGICAL UPDATELOOP COMMON /TO_UPDATELOOP/UPDATELOOP INCLUDE 'input.inc' - INCLUDE '../vector.inc' + + INCLUDE 'coupl.inc' READLHA = .TRUE. INCLUDE 'intparam_definition.inc' CALL COUP1() + IF (UPDATELOOP) THEN + + CALL COUP2() + + ENDIF + C couplings needed to be evaluated points by points C - CALL COUP2(1) + CALL COUP3(1) RETURN END @@ -47,7 +56,11 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) INCLUDE '../maxparticles.inc' INCLUDE '../cuts.inc' + + INCLUDE '../vector.inc' + + INCLUDE '../run.inc' DOUBLE PRECISION ALPHAS @@ -65,7 +78,7 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) couplings needed to be evaluated points by points C ALL_G(VECID) = G - CALL COUP2(VECID) + CALL COUP3(VECID) RETURN END @@ -80,7 +93,9 @@ SUBROUTINE UPDATE_AS_PARAM2(MU_R2,AS2 ,VECID) INTEGER VECID INCLUDE 'model_functions.inc' INCLUDE 'input.inc' + INCLUDE '../vector.inc' + INCLUDE 'coupl.inc' DOUBLE PRECISION MODEL_SCALE COMMON /MODEL_SCALE/MODEL_SCALE diff --git a/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/couplings1.f b/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/couplings1.f index e14f3a1770..72cfa0f6e4 100644 --- a/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/couplings1.f +++ b/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/couplings1.f @@ -7,11 +7,12 @@ SUBROUTINE COUP1( ) IMPLICIT NONE INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' END diff --git a/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/couplings2.f b/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/couplings2.f index e638b28035..30f3a04e3b 100644 --- a/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/couplings2.f +++ b/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/couplings2.f @@ -2,19 +2,17 @@ c written by the UFO converter ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc - SUBROUTINE COUP2( VECID) + SUBROUTINE COUP2( ) IMPLICIT NONE - INTEGER VECID + INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' - GC_10(VECID) = -G - GC_11(VECID) = MDL_COMPLEXI*G - GC_12(VECID) = MDL_COMPLEXI*MDL_G__EXP__2 END diff --git a/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/couplings3.f b/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/couplings3.f index f537dd3764..ad696f2865 100644 --- a/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/couplings3.f +++ b/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/couplings3.f @@ -7,12 +7,13 @@ SUBROUTINE COUP3( VECID) IMPLICIT NONE INTEGER VECID INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' GC_10(VECID) = -G GC_11(VECID) = MDL_COMPLEXI*G diff --git a/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/makefile b/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/makefile index 0b24445a53..5a5681d220 100644 --- a/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/makefile +++ b/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/makefile @@ -3,7 +3,7 @@ # Makefile for model library # # ---------------------------------------------------------------------------- - +# template models/template_files/makefile_madevent # Check for ../make_opts ifeq ($(wildcard ../make_opts), ../make_opts) include ../make_opts diff --git a/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/makeinc.inc b/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/makeinc.inc index 6e2743eac1..4a9e1b2cc5 100644 --- a/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/makeinc.inc +++ b/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/makeinc.inc @@ -2,4 +2,4 @@ # written by the UFO converter ############################################################################# -MODEL = couplings.o lha_read.o printout.o rw_para.o model_functions.o couplings1.o couplings2.o \ No newline at end of file +MODEL = couplings.o lha_read.o printout.o rw_para.o model_functions.o couplings1.o couplings2.o couplings3.o \ No newline at end of file diff --git a/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/printout.f b/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/printout.f index 18b8f35b08..3e195b03a2 100644 --- a/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/printout.f +++ b/epochX/cudacpp/gg_ttggg.mad/Source/MODEL/printout.f @@ -1,3 +1,7 @@ +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +c written by the UFO converter +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc + c************************************************************************ c** ** c** MadGraph/MadEvent Interface to FeynRules ** @@ -9,7 +13,7 @@ subroutine printout implicit none - include '../vector.inc' ! defines VECSIZE_MEMMAX + include '../vector.inc' ! VECSIZE_MEMMAX (needed by coupl.inc) include 'coupl.inc' ! needs VECSIZE_MEMMAX (defined in vector.inc) include 'input.inc' diff --git a/epochX/cudacpp/gg_ttggg.mad/Source/PDF/eepdf.inc b/epochX/cudacpp/gg_ttggg.mad/Source/PDF/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/gg_ttggg.mad/Source/PDF/eepdf.inc +++ b/epochX/cudacpp/gg_ttggg.mad/Source/PDF/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/gg_ttggg.mad/Source/PDF/pdfwrap_emela.f b/epochX/cudacpp/gg_ttggg.mad/Source/PDF/pdfwrap_emela.f index bce10819d5..da1e4e2276 100644 --- a/epochX/cudacpp/gg_ttggg.mad/Source/PDF/pdfwrap_emela.f +++ b/epochX/cudacpp/gg_ttggg.mad/Source/PDF/pdfwrap_emela.f @@ -13,7 +13,7 @@ SUBROUTINE PDFWRAP DOUBLE PRECISION VALUE(20) REAL*8 ALPHASPDF EXTERNAL ALPHASPDF - ! PDFs with beamstrahlung use specific initialisation/evaluation +C PDFs with beamstrahlung use specific initialisation/evaluation LOGICAL HAS_BSTRAHL COMMON /TO_HAS_BS/ HAS_BSTRAHL diff --git a/epochX/cudacpp/gg_ttggg.mad/Source/PDF/pdg2pdf.f b/epochX/cudacpp/gg_ttggg.mad/Source/PDF/pdg2pdf.f index 46f321e66b..2e7343a69b 100644 --- a/epochX/cudacpp/gg_ttggg.mad/Source/PDF/pdg2pdf.f +++ b/epochX/cudacpp/gg_ttggg.mad/Source/PDF/pdg2pdf.f @@ -108,7 +108,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) else if (abs(ipart).eq.10) then ipart = sign(1,ipart) * 15 endif - pdg2pdf = 0d0 + pdg2pdf = 0d0 if (beamid.lt.0) then ih_local = ipart @@ -122,7 +122,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) endif do i_ee = 1, n_ee ee_components(i_ee) = compute_eepdf(x,omx_ee(iabs(beamid)),xmu,i_ee,ipart,ih_local) - enddo + enddo pdg2pdf = ee_components(1) ! temporary to test pdf load c write(*,*), x, beamid ,omx_ee(iabs(beamid)),xmu,1,ipart,ih_local,pdg2pdf return diff --git a/epochX/cudacpp/gg_ttggg.mad/Source/dsample.f b/epochX/cudacpp/gg_ttggg.mad/Source/dsample.f index 09d482b45a..b0bc0547ad 100644 --- a/epochX/cudacpp/gg_ttggg.mad/Source/dsample.f +++ b/epochX/cudacpp/gg_ttggg.mad/Source/dsample.f @@ -204,6 +204,9 @@ subroutine sample_full(ndim,ncall,itmax,itmin,dsig,ninvar,nconfigs,VECSIZE_USED) if (VECSIZE_USED.le.1) then all_fx(1) = dsig(all_p, all_wgt,0) + ivec=0 + ilock=0 + iwarp=1 else c Here "i" is the position in the full grid of the event do i=(iwarp-1)*WARP_SIZE+1, iwarp*warp_size diff --git a/epochX/cudacpp/gg_ttggg.mad/Source/eepdf.inc b/epochX/cudacpp/gg_ttggg.mad/Source/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/gg_ttggg.mad/Source/eepdf.inc +++ b/epochX/cudacpp/gg_ttggg.mad/Source/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/gg_ttggg.mad/Source/genps.inc b/epochX/cudacpp/gg_ttggg.mad/Source/genps.inc index af7e0efbce..ef78e7e812 100644 --- a/epochX/cudacpp/gg_ttggg.mad/Source/genps.inc +++ b/epochX/cudacpp/gg_ttggg.mad/Source/genps.inc @@ -29,9 +29,8 @@ c parameter (max_host=99,maxplace=199,maxpoints=100,maxans=50) c************************************************************************* c Parameters for helicity sums in matrixN.f c************************************************************************* - REAL*8 LIMHEL -c PARAMETER(LIMHEL=1e-8) ! ME threshold for helicity filtering (Fortran default) - PARAMETER(LIMHEL=0) ! ME threshold for helicity filtering (force Fortran to mimic cudacpp, see #419) +c REAL*8 LIMHEL +c PARAMETER(LIMHEL=1e-8) -> pass in the run_card.dat INTEGER MAXTRIES PARAMETER(MAXTRIES=25) C To pass the helicity configuration chosen by the DiscreteSampler to diff --git a/epochX/cudacpp/gg_ttggg.mad/Source/run.inc b/epochX/cudacpp/gg_ttggg.mad/Source/run.inc index 5433a23583..81c8df6bf2 100644 --- a/epochX/cudacpp/gg_ttggg.mad/Source/run.inc +++ b/epochX/cudacpp/gg_ttggg.mad/Source/run.inc @@ -106,4 +106,7 @@ c double precision tmin_for_channel integer sde_strat ! 1 means standard single diagram enhancement strategy, c 2 means approximation by the denominator of the propagator - common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat \ No newline at end of file + common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat +c + double precision limhel + common/to_limhel/limhel diff --git a/epochX/cudacpp/gg_ttggg.mad/Source/run_card.inc b/epochX/cudacpp/gg_ttggg.mad/Source/run_card.inc index 67af0f2051..1a1bc782bd 100644 --- a/epochX/cudacpp/gg_ttggg.mad/Source/run_card.inc +++ b/epochX/cudacpp/gg_ttggg.mad/Source/run_card.inc @@ -88,6 +88,8 @@ DSQRT_SHAT = 0.000000000000000D+00 + LIMHEL = 0.000000000000000D+00 + PTJ = 2.000000000000000D+01 PTB = 0.000000000000000D+00 diff --git a/epochX/cudacpp/gg_ttggg.mad/Source/setrun.f b/epochX/cudacpp/gg_ttggg.mad/Source/setrun.f index 9e9ef7fdbd..dc6caef748 100644 --- a/epochX/cudacpp/gg_ttggg.mad/Source/setrun.f +++ b/epochX/cudacpp/gg_ttggg.mad/Source/setrun.f @@ -162,9 +162,21 @@ subroutine setrun C Fill common block for Les Houches init info do i=1,2 if(lpp(i).eq.1.or.lpp(i).eq.2) then - idbmup(i)=2212 + if (nb_proton(i).eq.1.and.nb_neutron(i).eq.0) then + idbmup(i)=2212 + elseif (nb_proton(i).eq.0.and.nb_neutron(i).eq.1) then + idbmup(i)=2112 + else + idbmup(i) = 1000000000 + (nb_proton(i)+nb_neutron(i))*10 + $ + nb_proton(i)*10000 + endif elseif(lpp(i).eq.-1.or.lpp(i).eq.-2) then - idbmup(i)=-2212 + if (nb_proton(i).eq.1.and.nb_neutron(i).eq.0) then + idbmup(i)=-2212 + else + idbmup(i) = -1*(1000000000 + (nb_proton(i)+nb_neutron(i))*10 + $ + nb_proton(i)*10000) + endif elseif(lpp(i).eq.3) then idbmup(i)=11 elseif(lpp(i).eq.-3) then diff --git a/epochX/cudacpp/gg_ttggg.mad/SubProcesses/MGVersion.txt b/epochX/cudacpp/gg_ttggg.mad/SubProcesses/MGVersion.txt index 9d3a5c0ba0..a806d3938c 100644 --- a/epochX/cudacpp/gg_ttggg.mad/SubProcesses/MGVersion.txt +++ b/epochX/cudacpp/gg_ttggg.mad/SubProcesses/MGVersion.txt @@ -1 +1 @@ -3.5.3_lo_vect \ No newline at end of file +3.6.0_lo_vect \ No newline at end of file diff --git a/epochX/cudacpp/gg_ttggg.mad/SubProcesses/P1_gg_ttxggg/CPPProcess.cc b/epochX/cudacpp/gg_ttggg.mad/SubProcesses/P1_gg_ttxggg/CPPProcess.cc index 34ac05600b..887e7fd63e 100644 --- a/epochX/cudacpp/gg_ttggg.mad/SubProcesses/P1_gg_ttxggg/CPPProcess.cc +++ b/epochX/cudacpp/gg_ttggg.mad/SubProcesses/P1_gg_ttxggg/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/gg_ttggg.mad/SubProcesses/P1_gg_ttxggg/CPPProcess.h b/epochX/cudacpp/gg_ttggg.mad/SubProcesses/P1_gg_ttxggg/CPPProcess.h index 76b0c3a844..5cceaea083 100644 --- a/epochX/cudacpp/gg_ttggg.mad/SubProcesses/P1_gg_ttxggg/CPPProcess.h +++ b/epochX/cudacpp/gg_ttggg.mad/SubProcesses/P1_gg_ttxggg/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/gg_ttggg.mad/SubProcesses/P1_gg_ttxggg/auto_dsig.f b/epochX/cudacpp/gg_ttggg.mad/SubProcesses/P1_gg_ttxggg/auto_dsig.f index 6f04bdc5d5..95adb1231d 100644 --- a/epochX/cudacpp/gg_ttggg.mad/SubProcesses/P1_gg_ttxggg/auto_dsig.f +++ b/epochX/cudacpp/gg_ttggg.mad/SubProcesses/P1_gg_ttxggg/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1134,11 +1134,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=128) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1148,32 +1149,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=128) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=128) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/gg_ttggg.mad/SubProcesses/P1_gg_ttxggg/auto_dsig1.f b/epochX/cudacpp/gg_ttggg.mad/SubProcesses/P1_gg_ttxggg/auto_dsig1.f index 443ffbfd75..a1e98bce0d 100644 --- a/epochX/cudacpp/gg_ttggg.mad/SubProcesses/P1_gg_ttxggg/auto_dsig1.f +++ b/epochX/cudacpp/gg_ttggg.mad/SubProcesses/P1_gg_ttxggg/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -101,6 +101,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -217,7 +219,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -281,7 +283,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -320,9 +322,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -338,6 +341,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -485,11 +490,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -589,9 +589,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -816,3 +818,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/gg_ttggg.mad/SubProcesses/P1_gg_ttxggg/driver.f b/epochX/cudacpp/gg_ttggg.mad/SubProcesses/P1_gg_ttxggg/driver.f index f6ed180095..3671cdce55 100644 --- a/epochX/cudacpp/gg_ttggg.mad/SubProcesses/P1_gg_ttxggg/driver.f +++ b/epochX/cudacpp/gg_ttggg.mad/SubProcesses/P1_gg_ttxggg/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/gg_ttggg.mad/SubProcesses/P1_gg_ttxggg/matrix1.f b/epochX/cudacpp/gg_ttggg.mad/SubProcesses/P1_gg_ttxggg/matrix1.f index 22f41b2861..47e0261337 100644 --- a/epochX/cudacpp/gg_ttggg.mad/SubProcesses/P1_gg_ttxggg/matrix1.f +++ b/epochX/cudacpp/gg_ttggg.mad/SubProcesses/P1_gg_ttxggg/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -23,6 +23,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=128) INTEGER NGRAPHS @@ -46,8 +48,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -56,26 +58,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -86,7 +85,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -96,26 +94,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,7) /-1,-1,-1, 1,-1,-1,-1/ DATA (NHEL(I, 2),I=1,7) /-1,-1,-1, 1,-1,-1, 1/ DATA (NHEL(I, 3),I=1,7) /-1,-1,-1, 1,-1, 1,-1/ @@ -255,8 +252,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -265,11 +261,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=120 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=120 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -279,12 +275,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -296,7 +291,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -325,35 +321,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -425,7 +419,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/gg_ttggg.mad/SubProcesses/cluster.f b/epochX/cudacpp/gg_ttggg.mad/SubProcesses/cluster.f index 649e46f4e9..b8995283ed 100644 --- a/epochX/cudacpp/gg_ttggg.mad/SubProcesses/cluster.f +++ b/epochX/cudacpp/gg_ttggg.mad/SubProcesses/cluster.f @@ -552,6 +552,8 @@ logical function cluster(p, ivec) if (btest(mlevel,1)) $ write (*,*)'New event' + iwin = 0 + jwin = 0 cluster=.false. clustered=.false. do i=0,3 @@ -663,7 +665,8 @@ logical function cluster(p, ivec) c initialize graph storage igraphs(0)=0 nleft=nexternal -c cluster +c cluster + if (iwin.eq.0.or.jwin.eq.0) stop 21 do n=1,nexternal-2 c combine winner imocl(n)=imap(iwin,2)+imap(jwin,2) diff --git a/epochX/cudacpp/gg_ttggg.mad/SubProcesses/proc_characteristics b/epochX/cudacpp/gg_ttggg.mad/SubProcesses/proc_characteristics index e7f6392d16..2a6bb58e2b 100644 --- a/epochX/cudacpp/gg_ttggg.mad/SubProcesses/proc_characteristics +++ b/epochX/cudacpp/gg_ttggg.mad/SubProcesses/proc_characteristics @@ -17,6 +17,8 @@ splitting_types = [] perturbation_order = [] limitations = [] + ew_sudakov = False hel_recycling = False single_color = True nlo_mixed_expansion = True + gauge = unitary diff --git a/epochX/cudacpp/gg_ttggg.mad/SubProcesses/refine.sh b/epochX/cudacpp/gg_ttggg.mad/SubProcesses/refine.sh index afb9b99ad1..b46170ba23 100644 --- a/epochX/cudacpp/gg_ttggg.mad/SubProcesses/refine.sh +++ b/epochX/cudacpp/gg_ttggg.mad/SubProcesses/refine.sh @@ -57,7 +57,11 @@ j=%(directory)s for((try=1;try<=16;try+=1)); do if [ "$keeplog" = true ] ; then + if [[ -e ../madevent ]];then ../madevent 2>&1 >> $k &1 >> $k &1 >> log.txt &1 >> log.txt &1 >> $k \w*)>') - pat_end=re.compile('\w*)>') + pat_begin=re.compile(r'<(?P\w*)>') + pat_end=re.compile(r'\w*)>') tag_to_file={'slha':'param_card.dat', 'mgruncard':'run_card.dat', @@ -319,7 +319,7 @@ def check_pid(self, pid2label): def get_lha_strategy(self): """get the lha_strategy: how the weight have to be handle by the shower""" - if not self["init"]: + if "init" not in self or not self["init"]: raise Exception("No init block define") data = self["init"].split('\n')[0].split() @@ -537,7 +537,8 @@ def charge_card(self, tag): self.param_card = param_card_reader.ParamCard(param_card) return self.param_card elif tag == 'mgruncard': - self.run_card = RunCard(self[tag], unknown_warning=False) + with misc.TMP_variable(RunCard, 'allow_scan', True): + self.run_card = RunCard(self[tag], consistency=False, unknow_warning=False) return self.run_card elif tag == 'mg5proccard': proc_card = self[tag].split('\n') @@ -976,6 +977,8 @@ class ConfigFile(dict): """ a class for storing/dealing with input file. """ + allow_scan = False + def __init__(self, finput=None, **opt): """initialize a new instance. input can be an instance of MadLoopParam, a file, a path to a file, or simply Nothing""" @@ -993,6 +996,7 @@ def __init__(self, finput=None, **opt): # Initialize it with all the default value self.user_set = set() self.auto_set = set() + self.scan_set = {} #key -> type of list (int/float/bool/str/... for scan self.system_only = set() self.lower_to_case = {} self.list_parameter = {} #key -> type of list (int/float/bool/str/... @@ -1109,6 +1113,8 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): #1. check if the parameter is set to auto -> pass it to special if lower_name in self: targettype = type(dict.__getitem__(self, lower_name)) + if lower_name in self.scan_set: + targettype = self.scan_set[lower_name] if targettype != str and isinstance(value, str) and value.lower() == 'auto': self.auto_set.add(lower_name) if lower_name in self.user_set: @@ -1118,13 +1124,26 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): return elif lower_name in self.auto_set: self.auto_set.remove(lower_name) - + + + #1. check if the parameter is set to auto -> pass it to special + scan_targettype = None + if self.allow_scan and isinstance(value, str) and value.strip().startswith('scan'): + if lower_name in self.user_set: + self.user_set.remove(lower_name) + self.scan_set[lower_name] = type(self[lower_name]) + dict.__setitem__(self, lower_name, value) + #keep old value. + self.post_set(lower_name,value, change_userdefine, raiseerror) + return + elif lower_name in self.scan_set: + scan_targettype = self.scan_set[lower_name] + del self.scan_set[lower_name] + # 2. Find the type of the attribute that we want if lower_name in self.list_parameter: targettype = self.list_parameter[lower_name] - - if isinstance(value, str): # split for each comma/space value = value.strip() @@ -1248,8 +1267,11 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): if change_userdefine: self.user_set.add(lower_name) return self.post_set(lower_name, None, change_userdefine, raiseerror) - elif name in self: - targettype = type(self[name]) + elif name in self: + if scan_targettype: + targettype = targettype + else: + targettype = type(self[name]) else: logger.debug('Trying to add argument %s in %s. ' % (name, self.__class__.__name__) +\ 'This argument is not defined by default. Please consider adding it.') @@ -1262,7 +1284,7 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): if change_userdefine: self.user_set.add(lower_name) return self.post_set(lower_name, None, change_userdefine, raiseerror) - + value = self.format_variable(value, targettype, name=name) #check that the value is allowed: if lower_name in self.allowed_value and '*' not in self.allowed_value[lower_name]: @@ -1444,7 +1466,7 @@ def format_variable(value, targettype, name="unknown"): value =int(value[:-1]) * convert[value[-1]] elif '/' in value or '*' in value: try: - split = re.split('(\*|/)',value) + split = re.split(r'(\*|/)',value) v = float(split[0]) for i in range((len(split)//2)): if split[2*i+1] == '*': @@ -1482,7 +1504,7 @@ def format_variable(value, targettype, name="unknown"): value = float(value) except ValueError: try: - split = re.split('(\*|/)',value) + split = re.split(r'(\*|/)',value) v = float(split[0]) for i in range((len(split)//2)): if split[2*i+1] == '*': @@ -1491,7 +1513,10 @@ def format_variable(value, targettype, name="unknown"): v /= float(split[2*i+2]) except: v=0 - raise InvalidCmd("%s can not be mapped to a float" % value) + if "scan" in value: + raise InvalidCmd("%s is not supported here. Note that scan command can not be present simultaneously in the run_card and param_card." % value) + else: + raise InvalidCmd("%s can not be mapped to a float" % value) finally: value = v else: @@ -1737,10 +1762,12 @@ def default_setup(self): self.add_param('splitting_types',[], typelist=str) self.add_param('perturbation_order', [], typelist=str) self.add_param('limitations', [], typelist=str) + self.add_param('ew_sudakov', False) self.add_param('hel_recycling', False) self.add_param('single_color', True) self.add_param('nlo_mixed_expansion', True) - + self.add_param('gauge', 'U') + def read(self, finput): """Read the input file, this can be a path to a file, a file object, a str with the content of the file.""" @@ -3104,7 +3131,7 @@ def write(self, output_file, template=None, python_template=False, # do not write hidden parameter not hidden for this template # if python_template: - written = written.union(set(re.findall('\%\((\w*)\)s', open(template,'r').read(), re.M))) + written = written.union(set(re.findall(r'\%\((\w*)\)s', open(template,'r').read(), re.M))) to_write = to_write.union(set(self.hidden_param)) to_write = to_write.difference(written) @@ -3157,7 +3184,6 @@ def get_value_from_include(self, path, list_of_params, output_dir): if path does not exists return the current value in self for all parameter""" #WARNING DOES NOT HANDLE LIST/DICT so far - misc.sprint(output_dir, path) # handle case where file is missing if not os.path.exists(pjoin(output_dir,path)): misc.sprint("include file not existing", pjoin(output_dir,path)) @@ -3259,7 +3285,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): text = open(path,'r').read() #misc.sprint(text) f77_type = ['real*8', 'integer', 'double precision', 'logical'] - pattern = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I+re.M) for fct in pattern.findall(text): fsock = file_writers.FortranWriter(tmp,'w') @@ -3287,6 +3313,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): starttext = open(pjoin(outdir, path+'.orig')).read() fsock.remove_routine(starttext, to_mod[path][0]) for text in to_mod[path][1]: + text = self.retro_compatible_custom_fct(text) fsock.writelines(text) fsock.close() if not filecmp.cmp(pjoin(outdir, path), pjoin(outdir, path+'.tmp')): @@ -3303,7 +3330,33 @@ def edit_dummy_fct_from_file(self, filelist, outdir): files.mv(pjoin(outdir,path+'.orig'), pjoin(outdir, path)) + @staticmethod + def retro_compatible_custom_fct(lines, mode=None): + f77_type = ['real*8', 'integer', 'double precision', 'logical'] + function_pat = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + % {'type':'|'.join(f77_type)}, re.I+re.M) + include_pat = re.compile(r"\s+include\s+[\'\"]([\w\./]*)") + + assert isinstance(lines, list) + sol = [] + + if mode is None or 'vector.inc' in mode: + search = True + for i,line in enumerate(lines[:]): + if search and re.search(include_pat, line): + name = re.findall(include_pat, line)[0] + misc.sprint('DETECTED INCLUDE', name) + if 'vector.inc' in name: + search = False + if 'run.inc' in name: + sol.append(" include 'vector.inc'") + search = False + sol.append(line) + if re.search(function_pat, line): + misc.sprint("DETECTED FCT") + search = True + return sol def guess_entry_fromname(self, name, value): """ @@ -3346,7 +3399,7 @@ def update_typelist(value, name, opts): #handle metadata opts = {} forced_opts = [] - for key,val in re.findall("\<(?P[_\-\w]+)\=(?P[^>]*)\>", str(name)): + for key,val in re.findall(r"\<(?P[_\-\w]+)\=(?P[^>]*)\>", str(name)): forced_opts.append(key) if val in ['True', 'False']: opts[key] = eval(val) @@ -3681,11 +3734,22 @@ def write_autodef(self, output_dir, output_file=None): out = ["%s\n" %l for l in out] fsock.writelines(out) - @staticmethod - def get_idbmup(lpp): + def get_idbmup(self, lpp, beam=1): """return the particle colliding pdg code""" if lpp in (1,2, -1,-2): - return math.copysign(2212, lpp) + target = 2212 + if 'nb_proton1' in self: + nbp = self['nb_proton%s' % beam] + nbn = self['nb_neutron%s' % beam] + if nbp == 1 and nbn ==0: + target = 2212 + elif nbp==0 and nbn ==1: + target = 2112 + else: + target = 1000000000 + target += 10 * (nbp+nbn) + target += 10000 * nbp + return math.copysign(target, lpp) elif lpp in (3,-3): return math.copysign(11, lpp) elif lpp in (4,-4): @@ -3701,8 +3765,8 @@ def get_banner_init_information(self): the first line of the block of the lhe file.""" output = {} - output["idbmup1"] = self.get_idbmup(self['lpp1']) - output["idbmup2"] = self.get_idbmup(self['lpp2']) + output["idbmup1"] = self.get_idbmup(self['lpp1'], beam=1) + output["idbmup2"] = self.get_idbmup(self['lpp2'], beam=2) output["ebmup1"] = self["ebeam1"] output["ebmup2"] = self["ebeam2"] output["pdfgup1"] = 0 @@ -3959,7 +4023,8 @@ def check_validity(self, card): dict.__setitem__(card, 'pdlabel1', card['pdlabel']) dict.__setitem__(card, 'pdlabel2', card['pdlabel']) - if abs(card['lpp1']) == 1 == abs(card['lpp2']) and card['pdlabel1'] != card['pdlabel2']: + if isinstance(card['lpp1'],int) and isinstance(card['lpp2'],int) and \ + abs(card['lpp1']) == 1 == abs(card['lpp2']) and card['pdlabel1'] != card['pdlabel2']: raise InvalidRunCard("Assymetric beam pdf not supported for proton-proton collision") def status(self, card): @@ -4156,12 +4221,16 @@ def default_setup(self): self.add_param('frame_id', 6, system=True) self.add_param("event_norm", "average", allowed=['sum','average', 'unity'], include=False, sys_default='sum', hidden=True) + self.add_param("keep_log", "normal", include=False, hidden=True, + comment="none: all log send to /dev/null.\n minimal: keep only log for survey of the last run.\n normal: keep only log for survey of all run. \n debug: keep all log (survey and refine)", + allowed=['none', 'minimal', 'normal', 'debug']) #cut self.add_param("auto_ptj_mjj", True, hidden=True) self.add_param("bwcutoff", 15.0) self.add_param("cut_decays", False, cut='d') self.add_param('dsqrt_shat',0., cut=True) self.add_param("nhel", 0, include=False) + self.add_param("limhel", 1e-8, hidden=True, comment="threshold to determine if an helicity contributes when not MC over helicity.") #pt cut self.add_param("ptj", 20.0, cut='j') self.add_param("ptb", 0.0, cut='b') @@ -4842,7 +4911,7 @@ def create_default_for_process(self, proc_characteristic, history, proc_def): # here pick strategy 2 if only one QCD color flow # and for pure multi-jet case jet_id = [21] + list(range(1, self['maxjetflavor']+1)) - if proc_characteristic['single_color']: + if proc_characteristic['gauge'] != 'FD' and proc_characteristic['single_color']: self['sde_strategy'] = 2 #for pure lepton final state go back to sde_strategy=1 pure_lepton=True @@ -5741,9 +5810,10 @@ def check_validity(self): # check that ebeam is bigger than the proton mass. for i in [1,2]: - if self['lpp%s' % i ] not in [1,2]: + # do not for proton mass if not proton PDF (or when scan initialization) + if self['lpp%s' % i ] not in [1,2] or isinstance(self['ebeam%i' % i], str): continue - + if self['ebeam%i' % i] < 0.938: if self['ebeam%i' %i] == 0: logger.warning("At-rest proton mode set: energy beam set to 0.938 GeV") @@ -6193,3 +6263,181 @@ def log_and_update(self, banner, card, par, v): xcard = banner.charge_card(card) xcard[par[0]].param_dict[(par[1],)].value = v xcard.write(os.path.join(self.me_dir, 'Cards', '%s.dat' % card)) + + + + +class RunCardIterator(object): + """A class keeping track of the scan: flag in the param_card and + having an __iter__() function to scan over all the points of the scan. + """ + + logging = True + def __init__(self, input_path=None): + with misc.TMP_variable(RunCard, 'allow_scan', True): + self.run_card = RunCard(input_path, consistency=False) + self.run_card.allow_scan = True + + self.itertag = [] #all the current value use + self.cross = [] # keep track of all the cross-section computed + self.param_order = [] + + def __iter__(self): + """generate the next param_card (in a abstract way) related to the scan. + Technically this generates only the generator.""" + + if hasattr(self, 'iterator'): + return self.iterator + self.iterator = self.iterate() + return self.iterator + + def write(self, path): + self.__iter__.write(path) + + def next(self, autostart=False): + """call the next iteration value""" + try: + iterator = self.iterator + except: + if autostart: + iterator = self.__iter__() + else: + raise + try: + out = next(iterator) + except StopIteration: + del self.iterator + raise + return out + + def iterate(self): + """create the actual generator""" + all_iterators = {} # dictionary of key -> block of object to scan [([param, [values]), ...] + pattern = re.compile(r'''scan\s*(?P\d*)\s*:\s*(?P[^#]*)''', re.I) + + # fill all_iterators with the run_card information + for name in self.run_card.scan_set: + value = self.run_card[name] + try: + key, def_list = pattern.findall(value)[0] + except Exception as error: + misc.sprint(error) + raise Exception("Fail to handle scanning tag in run_card: Please check that the syntax is valid") + if key == '': + key = -1 * len(all_iterators) + if key not in all_iterators: + all_iterators[key] = [] + try: + all_iterators[key].append( (name, eval(def_list))) + except SyntaxError as error: + raise Exception("Fail to handle your scan definition. Please check your syntax:\n entry: %s \n Error reported: %s" %(def_list, error)) + + #prepare to keep track of parameter changing for the report + keys = list(all_iterators.keys()) # need to fix an order for the scan + #store the type of parameter + for key in keys: + for param, values in all_iterators[key]: + self.param_order.append("run_card#%s" % (param)) + + # do the loop + lengths = [list(range(len(all_iterators[key][0][1]))) for key in keys] + from functools import reduce + total = reduce((lambda x, y: x * y),[len(x) for x in lengths]) + for i,positions in enumerate(itertools.product(*lengths)): + self.itertag = [] + if self.logging: + logger.info("Create the next run_card in the scan definition (%s/%s) " %( i+1, total), '$MG:BOLD') + for i, pos in enumerate(positions): + key = keys[i] + for param, values in all_iterators[key]: + # assign the value in the card. + self.run_card[param] = values[pos] + self.itertag.append(values[pos]) + if self.logging: + logger.info("change parameter %s to %s", \ + param, values[pos]) + + + # retrun the current param_card up to next iteration + yield self.run_card + + + def store_entry(self, run_name, cross, error=None, run_card_path=None): + """store the value of the cross-section""" + + if isinstance(cross, dict): + info = dict(cross) + info.update({'bench' : self.itertag, 'run_name': run_name}) + self.cross.append(info) + else: + if error is None: + self.cross.append({'bench' : self.itertag, 'run_name': run_name, 'cross(pb)':cross}) + else: + self.cross.append({'bench' : self.itertag, 'run_name': run_name, 'cross(pb)':cross, 'error(pb)':error}) + + + def write_summary(self, path, order=None, lastline=False, nbcol=20): + """ """ + + if path: + ff = open(path, 'w') + path_events = path.rsplit("/", 1)[0] + #identCard = open(pjoin(path.rsplit("/", 2)[0], "Cards", "ident_card.dat")) + #identLines = identCard.readlines() + #identCard.close() + else: + ff = StringIO.StringIO() + if order: + keys = order + else: + keys = list(self.cross[0].keys()) + if 'bench' in keys: keys.remove('bench') + if 'run_name' in keys: keys.remove('run_name') + keys.sort() + if 'cross(pb)' in keys: + keys.remove('cross(pb)') + keys.append('cross(pb)') + if 'error(pb)' in keys: + keys.remove('error(pb)') + keys.append('error(pb)') + + formatting = "#%s%s%s\n" %('%%-%is ' % (nbcol-1), ('%%-%is ' % (nbcol))* len(self.param_order), + ('%%-%is ' % (nbcol))* len(keys)) + # header + if not lastline: + ff.write(formatting % tuple(['run_name'] + self.param_order + keys)) + formatting = "%s%s%s\n" %('%%-%is ' % (nbcol), ('%%-%ie ' % (nbcol))* len(self.param_order), + ('%%-%ie ' % (nbcol))* len(keys)) + + if not lastline: + to_print = self.cross + else: + to_print = self.cross[-1:] + for info in to_print: + name = info['run_name'] + bench = info['bench'] + data = [] + for k in keys: + if k in info: + data.append(info[k]) + else: + data.append(0.) + ff.write(formatting % tuple([name] + bench + data)) + ff_single = open(pjoin(path_events, name, "params.dat"), "w") + for i_bench in range(0, len(bench)): + ff_single.write(self.param_order[i_bench] + " = " + str(bench[i_bench]) +"\n") + ff_single.close() + + if not path: + return ff.getvalue() + + + def get_next_name(self, run_name): + """returns a smart name for the next run""" + + if '_' in run_name: + name, value = run_name.rsplit('_',1) + if value.isdigit(): + return '%s_%02i' % (name, float(value)+1) + # no valid '_' in the name + return '%s_scan_02' % run_name diff --git a/epochX/cudacpp/gg_ttggg.mad/bin/internal/check_param_card.py b/epochX/cudacpp/gg_ttggg.mad/bin/internal/check_param_card.py index 71089d7480..bc785b5de6 100755 --- a/epochX/cudacpp/gg_ttggg.mad/bin/internal/check_param_card.py +++ b/epochX/cudacpp/gg_ttggg.mad/bin/internal/check_param_card.py @@ -649,7 +649,7 @@ def write_inc_file(self, outpath, identpath, default, need_mp=False): #check if we need to write the value of scale for some block if os.path.exists(input_inc): text = open(input_inc).read() - scales = list(set(re.findall('mdl__(\w*)__scale', text, re.I))) + scales = list(set(re.findall(r'mdl__(\w*)__scale', text, re.I))) else: scales = [] @@ -1000,10 +1000,12 @@ def iterate(self): self.param_order.append("%s#%s" % (param.lhablock, '_'.join(repr(i) for i in param.lhacode))) # do the loop lengths = [list(range(len(all_iterators[key][0][1]))) for key in keys] - for positions in itertools.product(*lengths): + from functools import reduce + total = reduce((lambda x, y: x * y),[len(x) for x in lengths]) + for i,positions in enumerate(itertools.product(*lengths)): self.itertag = [] if self.logging: - logger.info("Create the next param_card in the scan definition", '$MG:BOLD') + logger.info("Create the next param_card in the scan definition (%s/%s)" % (i+1,total), '$MG:BOLD') for i, pos in enumerate(positions): key = keys[i] for param, values in all_iterators[key]: diff --git a/epochX/cudacpp/gg_ttggg.mad/bin/internal/cluster.py b/epochX/cudacpp/gg_ttggg.mad/bin/internal/cluster.py index 9a893f630d..1ad860e04f 100755 --- a/epochX/cudacpp/gg_ttggg.mad/bin/internal/cluster.py +++ b/epochX/cudacpp/gg_ttggg.mad/bin/internal/cluster.py @@ -646,7 +646,10 @@ def worker(self): if os.path.exists(exe) and not exe.startswith('/'): exe = './' + exe if isinstance(opt['stdout'],str): - opt['stdout'] = open(opt['stdout'],'w') + if opt['stdout'] == '/dev/null': + opt['stdout'] = os.open(os.devnull, os.O_RDWR) + else: + opt['stdout'] = open(opt['stdout'],'w') if opt['stderr'] == None: opt['stderr'] = subprocess.STDOUT if arg: @@ -671,11 +674,12 @@ def worker(self): self.pids.put(pid) # the function should return 0 if everything is fine # the error message otherwise - returncode = exe(*arg, **opt) - if returncode != 0: - logger.warning("fct %s does not return 0. Stopping the code in a clean way. The error was:\n%s", exe, returncode) + try: + returncode = exe(*arg, **opt) + except Exception as error: + #logger.warning("fct %s does not return 0. Stopping the code in a clean way. The error was:\n%s", exe, returncode) self.stoprequest.set() - self.remove("fct %s does not return 0:\n %s" % (exe, returncode)) + self.remove("fct %s does raise %s\n %s" % (exe, error)) except Exception as error: self.fail_msg = sys.exc_info() logger.warning(str(error)) @@ -700,7 +704,7 @@ def worker(self): def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, - log=None, required_output=[], nb_submit=0): + log=None, required_output=[], nb_submit=0, python_opts={}): """submit a job on multicore machine""" # open threads if needed @@ -720,7 +724,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, return tag else: # python function - self.queue.put((tag, prog, argument, {})) + self.queue.put((tag, prog, argument, python_opts)) self.submitted.put(1) return tag @@ -908,6 +912,10 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None else: requirement = '' + if 'cluster_walltime' in self.options and self.options['cluster_walltime']\ + and self.options['cluster_walltime'] != 'None': + requirement+='\n MaxRuntime = %s' % self.options['cluster_walltime'] + if cwd is None: cwd = os.getcwd() if stdout is None: @@ -936,7 +944,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None #Submitting job(s). #Logging submit event(s). #1 job(s) submitted to cluster 2253622. - pat = re.compile("submitted to cluster (\d*)",re.MULTILINE) + pat = re.compile(r"submitted to cluster (\d*)",re.MULTILINE) output = output.decode(errors='ignore') try: id = pat.search(output).groups()[0] @@ -1025,7 +1033,7 @@ def submit2(self, prog, argument=[], cwd=None, stdout=None, stderr=None, #Logging submit event(s). #1 job(s) submitted to cluster 2253622. output = output.decode(errors='ignore') - pat = re.compile("submitted to cluster (\d*)",re.MULTILINE) + pat = re.compile(r"submitted to cluster (\d*)",re.MULTILINE) try: id = pat.search(output).groups()[0] except: @@ -1588,7 +1596,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None output = a.communicate()[0].decode(errors='ignore') #Your job 874511 ("test.sh") has been submitted - pat = re.compile("Your job (\d*) \(",re.MULTILINE) + pat = re.compile(r"Your job (\d*) \(",re.MULTILINE) try: id = pat.search(output).groups()[0] except: @@ -1606,7 +1614,7 @@ def control_one_job(self, id): if not status: return 'F' #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 - pat = re.compile("^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") + pat = re.compile(r"^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") stat = '' for line in status.stdout.read().decode(errors='ignore').split('\n'): if not line: @@ -1636,7 +1644,7 @@ def control(self, me_dir=None): cmd = 'qstat -s %s' % statusflag status = misc.Popen([cmd], shell=True, stdout=subprocess.PIPE) #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 - pat = re.compile("^(\d+)") + pat = re.compile(r"^(\d+)") for line in status.stdout.read().decode(errors='ignore').split('\n'): line = line.strip() try: @@ -1715,6 +1723,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None stderr = stdout if log is None: log = '/dev/null' + command = ['sbatch', '-o', stdout, '-J', me_dir, @@ -1726,6 +1735,12 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None command.insert(1, '-p') command.insert(2, self.cluster_queue) + if 'cluster_walltime' in self.options and self.options['cluster_walltime']\ + and self.options['cluster_walltime'] != 'None': + command.insert(1, '-t') + command.insert(2, self.options['cluster_walltime']) + + a = misc.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -1736,7 +1751,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None id = output_arr[3].rstrip() if not id.isdigit(): - id = re.findall('Submitted batch job ([\d\.]+)', ' '.join(output_arr)) + id = re.findall(r'Submitted batch job ([\d\.]+)', ' '.join(output_arr)) if not id or len(id)>1: raise ClusterManagmentError( 'fail to submit to the cluster: \n%s' \ diff --git a/epochX/cudacpp/gg_ttggg.mad/bin/internal/combine_runs.py b/epochX/cudacpp/gg_ttggg.mad/bin/internal/combine_runs.py index 4de6b84ec0..b1e8c88eac 100755 --- a/epochX/cudacpp/gg_ttggg.mad/bin/internal/combine_runs.py +++ b/epochX/cudacpp/gg_ttggg.mad/bin/internal/combine_runs.py @@ -20,6 +20,7 @@ from __future__ import absolute_import import math import os +import shutil import re import logging from six.moves import range @@ -117,6 +118,7 @@ def sum_multichannel(self, channel): #Now read in all of the events and write them #back out with the appropriate scaled weight + to_clean = [] fsock = open(pjoin(channel, 'events.lhe'), 'w') wgt = results.axsec / results.nunwgt tot_nevents, nb_file = 0, 0 @@ -129,8 +131,14 @@ def sum_multichannel(self, channel): nw = self.copy_events(fsock, pjoin(path,'events.lhe'), wgt) tot_nevents += nw nb_file += 1 + to_clean.append(path) logger.debug("Combined %s file generating %s events for %s " , nb_file, tot_nevents, channel) - + for path in to_clean: + try: + shutil.rmtree(path) + except Exception as error: + pass + @staticmethod def get_fortran_str(nb): data = '%E' % nb @@ -162,6 +170,7 @@ def copy_events(self, fsock, input, new_wgt): fsock.write(line) old_line = line return nb_evt + def get_channels(self, proc_path): """Opens file symfact.dat to determine all channels""" sympath = os.path.join(proc_path, 'symfact.dat') diff --git a/epochX/cudacpp/gg_ttggg.mad/bin/internal/common_run_interface.py b/epochX/cudacpp/gg_ttggg.mad/bin/internal/common_run_interface.py index 9bd9d9cb50..194f0cdfbd 100755 --- a/epochX/cudacpp/gg_ttggg.mad/bin/internal/common_run_interface.py +++ b/epochX/cudacpp/gg_ttggg.mad/bin/internal/common_run_interface.py @@ -23,6 +23,7 @@ import ast import logging import math +import copy import os import re import shutil @@ -181,6 +182,23 @@ def help_add_time_of_flight(self): logger.info(' threshold option allows to change the minimal value required to') logger.info(' a non zero value for the particle (default:1e-12s)') + def help_print_results(self): + logger.info("syntax: print_results [RUN_NAME] [OPTIONS]") + logger.info("-- print the results of the previous run on the screen") + logger.info(" If not RUN_NAME is provided, the information of all run") + logger.info(" are printed one after another.") + logger.info("") + logger.info(" supported options:") + logger.info(" ------------------") + logger.info(" --format=full|short # default is full") + logger.info(" full format contains banner/... ") + logger.info(" while short is a simple multi-column format (nice for plotting)") + logger.info(" --path=") + logger.info(" allow to write the information to a file.") + logger.info(" --mode=w|a #default is w ") + logger.info(" when the information is printed to a file, you can choose ") + logger.info(" to either overwrite the file if already exists (w mode)") + logger.info(" to append the information at the end of the file (a mode)") class CheckValidForCmd(object): @@ -727,7 +745,7 @@ def __init__(self, me_dir, options, *args, **opts): if not self.proc_characteristics['ninitial']: # Get number of initial states nexternal = open(pjoin(self.me_dir,'Source','nexternal.inc')).read() - found = re.search("PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) + found = re.search(r"PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) self.ninitial = int(found.group(1)) else: self.ninitial = self.proc_characteristics['ninitial'] @@ -989,7 +1007,22 @@ def do_treatcards(self, line, amcatnlo=False): #raise Exception, "%s %s %s" % (sys.path, os.path.exists(pjoin(self.me_dir,'bin','internal', 'ufomodel')), os.listdir(pjoin(self.me_dir,'bin','internal', 'ufomodel'))) import ufomodel as ufomodel zero = ufomodel.parameters.ZERO - if self.proc_characteristics['nlo_mixed_expansion']: + no_width = [] + + if self.proc_characteristics['ew_sudakov']: + # if the sudakov approximation is used, force all particle widths to zero + # unless the complex mass scheme is used + if not self.proc_characteristics['complex_mass_scheme']: + no_width = [p for p in ufomodel.all_particles if p.width != zero] + logger.info('''Setting all particle widths to zero (needed for EW Sudakov approximation).''','$MG:BOLD') + # also, check that the model features the 'ntadpole' parameter, and set it to 1 + try: + param_card['tadpole'].get(1).value = 1. + logger.info('''Setting the value of ntadpole to 1 (needed for EW Sudakov approximation).''','$MG:BOLD') + except KeyError: + logger.warning('''The model has no 'ntadpole' parameter. The Sudakov approximation for EW corrections may give wrong results.''') + + elif self.proc_characteristics['nlo_mixed_expansion']: no_width = [p for p in ufomodel.all_particles if (str(p.pdg_code) in pids or str(-p.pdg_code) in pids) and p.width != zero] @@ -1168,17 +1201,17 @@ def detect_card_type(path): 'Begin Minpts', 'gridpack', 'ebeam1', - 'block\s+mw_run', + r'block\s+mw_run', 'BLOCK', 'DECAY', 'launch', 'madspin', - 'transfer_card\.dat', + r'transfer_card\.dat', 'set', 'main:numberofevents', # pythia8, '@MG5aMC skip_analysis', #MA5 --both-- - '@MG5aMC\s*inputs\s*=\s*\*\.(?:hepmc|lhe)', #MA5 --both-- - '@MG5aMC\s*reconstruction_name', # MA5 hadronique + r'@MG5aMC\s*inputs\s*=\s*\*\.(?:hepmc|lhe)', #MA5 --both-- + r'@MG5aMC\s*reconstruction_name', # MA5 hadronique '@MG5aMC', # MA5 hadronique 'run_rivet_later', # Rivet ] @@ -1237,7 +1270,7 @@ def detect_card_type(path): return 'madspin_card.dat' if 'decay' in text: # need to check if this a line like "decay w+" or "set decay" - if re.search("(^|;)\s*decay", fulltext, re.M): + if re.search(r"(^|;)\s*decay", fulltext, re.M): return 'madspin_card.dat' else: return 'reweight_card.dat' @@ -2074,6 +2107,12 @@ def check_multicore(self): # ensure that the run_card is present if not hasattr(self, 'run_card'): self.run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat')) + # Below reads the run_card in the LHE file rather than the Cards/run_card + import madgraph.various.lhe_parser as lhe_parser + args_path = list(args) + self.check_decay_events(args_path) + self.run_card = banner_mod.RunCard(lhe_parser.EventFile(args_path[0]).get_banner()['mgruncard']) + # we want to run this in a separate shell to avoid hard f2py crash command = [sys.executable] @@ -2085,6 +2124,12 @@ def check_multicore(self): command.append('--web') command.append('reweight') + ## TV: copy the event file as backup before starting reweighting + event_path = pjoin(self.me_dir, 'Events', self.run_name, 'events.lhe.gz') + event_path_backup = pjoin(self.me_dir, 'Events', self.run_name, 'events_orig.lhe.gz') + if os.path.exists(event_path) and not os.path.exists(event_path_backup): + shutil.copyfile(event_path, event_path_backup) + ######### START SINGLE CORE MODE ############ if self.options['nb_core']==1 or self.run_card['nevents'] < 101 or not check_multicore(self): if self.run_name: @@ -2200,7 +2245,7 @@ def check_multicore(self): cross_sections[key] = value / (nb_event+1) lhe.remove() for key in cross_sections: - if key == 'orig' or key.isdigit(): + if key == 'orig' or (key.isdigit() and not (key[0] == '2')): continue logger.info('%s : %s pb' % (key, cross_sections[key])) return @@ -2461,7 +2506,7 @@ def do_add_time_of_flight(self, line): ############################################################################ def do_print_results(self, line): - """Not in help:Print the cross-section/ number of events for a given run""" + """Print the cross-section/ number of events for a given run""" args = self.split_arg(line) options={'path':None, 'mode':'w', 'format':'full'} @@ -2942,10 +2987,15 @@ def do_rivet(self, line, postprocess=False): #2 Prepare Rivet setup environments rivet_path = self.options['rivet_path'] yoda_path = self.options['yoda_path'] + fastjet_path = subprocess.Popen([self.options['fastjet'], '--prefix'], + stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip() + set_env = set_env + "export PATH={0}:$PATH\n".format(pjoin(rivet_path, 'bin')) set_env = set_env + "export PATH={0}:$PATH\n".format(pjoin(yoda_path, 'bin')) set_env = set_env + "export LD_LIBRARY_PATH={0}:{1}:$LD_LIBRARY_PATH\n".format(pjoin(rivet_path, 'lib'), pjoin(rivet_path, 'lib64')) set_env = set_env + "export LD_LIBRARY_PATH={0}:{1}:$LD_LIBRARY_PATH\n".format(pjoin(yoda_path, 'lib'), pjoin(yoda_path, 'lib64')) + set_env = set_env + "export LD_LIBRARY_PATH={0}:$LD_LIBRARY_PATH\n".format(pjoin(self.options['hepmc_path'], 'lib')) + set_env = set_env + "export LD_LIBRARY_PATH={0}:$LD_LIBRARY_PATH\n".format(pjoin(fastjet_path, 'lib')) major, minor = sys.version_info[0:2] set_env = set_env + "export PYTHONPATH={0}:{1}:$PYTHONPATH\n".format(pjoin(rivet_path, 'lib', 'python%s.%s' %(major,minor), 'site-packages'),\ pjoin(rivet_path, 'lib64', 'python%s.%s' %(major,minor), 'site-packages')) @@ -4311,8 +4361,8 @@ def complete_compute_widths(self, text, line, begidx, endidx, formatting=True): else: completion = {} completion['options'] = self.list_completion(text, - ['--path=', '--output=', '--min_br=0.\$', '--nlo', - '--precision_channel=0.\$', '--body_decay=']) + ['--path=', '--output=', r'--min_br=0.\$', '--nlo', + r'--precision_channel=0.\$', '--body_decay=']) return self.deal_multiple_categories(completion, formatting) @@ -4821,9 +4871,9 @@ class AskforEditCard(cmd.OneLinePathCompletion): (return False to repeat the question) """ - all_card_name = ['param_card', 'run_card', 'pythia_card', 'pythia8_card', + all_card_name = ['param_card', 'run_card', 'pythia_card', 'pythia8_card', 'fo_analysis_card' 'madweight_card', 'MadLoopParams', 'shower_card', 'rivet_card'] - to_init_card = ['param', 'run', 'madweight', 'madloop', + to_init_card = ['param', 'run', 'madweight', 'madloop', 'fo_analysis', 'shower', 'pythia8','delphes','madspin', 'rivet'] special_shortcut = {} special_shortcut_help = {} @@ -4853,6 +4903,7 @@ def load_default(self): self.has_PY8 = False self.has_delphes = False self.has_rivet = False + self.has_fo_card = False self.paths = {} self.update_block = [] @@ -5058,7 +5109,8 @@ def init_run(self, cards): try: - self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning') + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning') except IOError: self.run_card = {} try: @@ -5248,6 +5300,15 @@ def init_delphes(self, cards): self.has_delphes = True return [] + def init_fo_analysis(self, cards): + self.has_fo_card = False + if not self.get_path('FO_analyse', cards): + return [] + self.has_fo_card = True + self.fo_card = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse']) + self.fo_card_def = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse_default']) + return list(self.fo_card.string_vars) + def set_CM_velocity(self, line): """compute sqrts from the velocity in the center of mass frame""" @@ -5508,6 +5569,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): allowed['delphes_card'] = '' if self.has_rivet: allowed['rivet_card'] = '' + if self.has_fo_card: + allowed['fo_card'] = '' elif len(args) == 2: if args[1] == 'run_card': @@ -5532,6 +5595,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): allowed = {'delphes_card':'default'} elif args[1] == 'rivet_card': allowed = {'rivet_card':'default'} + elif args[1] == 'fo_card': + allowed = {'fo_card':'default'} else: allowed = {'value':''} @@ -5539,6 +5604,7 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): start = 1 if args[1] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', 'MadLoop_card','pythia8_card','delphes_card','plot_card', + 'fo_card', 'madanalysis5_parton_card','madanalysis5_hadron_card', 'rivet_card']: start = 2 @@ -5576,6 +5642,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): categories.append('delphes_card') if self.has_rivet: categories.append('rivet_card') + if self.has_fo_card: + categories.append('fo_card') possibilities['category of parameter (optional)'] = \ self.list_completion(text, categories) @@ -5630,7 +5698,13 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): if 'delphes_card' in allowed: if allowed['delphes_card'] == 'default': opts = ['default', 'atlas', 'cms'] - possibilities['Delphes Card'] = self.list_completion(text, opts) + possibilities['Delphes Card'] = self.list_completion(text, opts) + + if 'fo_card' in allowed: + opts = self.fo_card.string_vars + if allowed['fo_card'] == 'default': + opts.append('default') + possibilities['FO Card'] = self.list_completion(text, opts) if 'value' in list(allowed.keys()): opts = ['default', 'scale'] @@ -5733,21 +5807,28 @@ def do_set(self, line): if args[0] in self.special_shortcut: targettypes , cmd = self.special_shortcut[args[0]] if len(args) != len(targettypes) +1: - logger.warning('shortcut %s requires %s argument' % (args[0], len(targettypes))) - if len(args) < len(targettypes) +1: - return + if len(targettypes) == 1 and args[len(targettypes)].startswith('scan'): + args = args[:len(targettypes)] + [' '.join(args[len(targettypes):])] + targettypes = [str] else: - logger.warning('additional argument will be ignored') + logger.warning('shortcut %s requires %s argument' % (args[0], len(targettypes))) + if len(args) < len(targettypes) +1: + return + else: + logger.warning('additional argument will be ignored') values ={} for i, argtype in enumerate(targettypes): try: - values = {str(i): banner_mod.ConfigFile.format_variable(args[i+1], argtype, args[0])} + values[str(i)] = banner_mod.ConfigFile.format_variable(args[i+1], argtype, args[0]) except ValueError as e: logger.warning("Wrong argument: The entry #%s should be of type %s.", i+1, argtype) return except InvalidCmd as e: - logger.warning(str(e)) - return + if isinstance(args[i+1], str) and args[i+1].startswith('scan'): + values[str(i)] = args[i+1] + else: + logger.warning(str(e)) + return #else: # logger.warning("too many argument for this command") # return @@ -5787,7 +5868,7 @@ def do_set(self, line): if os.path.exists(pythia_path): logger.info('add line QCUT = %s in pythia_card.dat' % args[1]) p_card = open(pythia_path,'r').read() - p_card, n = re.subn('''^\s*QCUT\s*=\s*[\de\+\-\.]*\s*$''', + p_card, n = re.subn(r'''^\s*QCUT\s*=\s*[\de\+\-\.]*\s*$''', ''' QCUT = %s ''' % args[1], \ p_card, flags=(re.M+re.I)) if n==0: @@ -5801,7 +5882,7 @@ def do_set(self, line): if os.path.exists(pythia_path): logger.info('add line SHOWERKT = %s in pythia_card.dat' % args[1].upper()) p_card = open(pythia_path,'r').read() - p_card, n = re.subn('''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''', + p_card, n = re.subn(r'''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''', ''' SHOWERKT = %s ''' % args[1].upper(), \ p_card, flags=(re.M+re.I)) if n==0: @@ -5856,7 +5937,7 @@ def do_set(self, line): pjoin(self.me_dir,'Cards', 'delphes_card.dat')) return - if args[0] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', + if args[0] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', 'fo_card', 'delphes_card','madanalysis5_hadron_card','madanalysis5_parton_card','rivet_card']: if args[1] == 'default': @@ -6176,6 +6257,22 @@ def do_set(self, line): self.setRivet(args[start], value, default=default) self.rivet_card.write(self.paths['rivet'], self.paths['rivet_default']) + elif self.has_fo_card and (card in ['', 'fo_card'])\ + and args[start].lower() in [k.lower() for k in self.fo_card.string_vars]: + + if args[start] in self.conflict and card == '': + text = 'ambiguous name (present in more than one card). Please specify which card to edit' + logger.warning(text) + return + if args[start+1] == 'default': + value = self.fo_card_default[args[start]] + default = True + else: + value = args[start+1] + default = False + self.fo_card[args[start]] = value + self.modified_card.add('fo_card') + #INVALID -------------------------------------------------------------- else: logger.warning('invalid set command %s ' % line) @@ -6222,12 +6319,13 @@ def setM(self, block, name, value): def setR(self, name, value): - if self.mother_interface.inputfile: - self.run_card.set(name, value, user=True, raiseerror=True) - else: - self.run_card.set(name, value, user=True) - new_value = self.run_card.get(name) - logger.info('modify parameter %s of the run_card.dat to %s' % (name, new_value),'$MG:BOLD') + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + if self.mother_interface.inputfile: + self.run_card.set(name, value, user=True, raiseerror=True) + else: + self.run_card.set(name, value, user=True) + new_value = self.run_card.get(name) + logger.info('modify parameter %s of the run_card.dat to %s' % (name, new_value),'$MG:BOLD') def setML(self, name, value, default=False): @@ -6314,6 +6412,7 @@ def check_card_consistency(self): proc_charac = self.mother_interface.proc_characteristics if proc_charac['grouped_matrix'] and \ + isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int) and \ abs(self.run_card['lpp1']) == 1 == abs(self.run_card['lpp2']) and \ (self.run_card['nb_proton1'] != self.run_card['nb_proton2'] or self.run_card['nb_neutron1'] != self.run_card['nb_neutron2'] or @@ -6403,41 +6502,42 @@ def check_card_consistency(self): # check that only quark/gluon/photon are in initial beam if lpp=+-1 pdg_in_p = list(range(-6,7))+[21,22] - if (abs(self.run_card['lpp1'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial1'])) \ + if isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int): + if(abs(self.run_card['lpp1'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial1'])) \ or (abs(self.run_card['lpp2'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial2'])): - if 'pythia_card.dat' in self.cards or 'pythia8_card.dat' in self.cards: - path_to_remove = None - if 'pythia_card.dat' in self.cards: - path_to_remove = self.paths['pythia'] - card_to_remove = 'pythia_card.dat' - elif 'pythia8_card.dat' in self.cards: - path_to_remove = self.paths['pythia8'] - card_to_remove = 'pythia8_card.dat' - if path_to_remove: - if 'partonshower' in self.run_card['bypass_check']: + if 'pythia_card.dat' in self.cards or 'pythia8_card.dat' in self.cards: + path_to_remove = None + if 'pythia_card.dat' in self.cards: + path_to_remove = self.paths['pythia'] + card_to_remove = 'pythia_card.dat' + elif 'pythia8_card.dat' in self.cards: + path_to_remove = self.paths['pythia8'] + card_to_remove = 'pythia8_card.dat' + if path_to_remove: + if 'partonshower' in self.run_card['bypass_check']: + logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") + else: + logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') + os.remove(path_to_remove) + self.cards.remove(card_to_remove) + else: + logger.info('Remember that Parton-Shower are not yet ready for such proton component definition (HW implementation in progress).', '$MG:BOLD' ) + elif (abs(self.run_card['lpp1'])==3 and abs(self.run_card['lpp2'])==3): + if 'pythia8_card.dat' in self.cards: + if self.run_card['pdlabel'] == 'isronlyll': + if 'partonshower' not in self.run_card['bypass_check']: + # force that QED shower is on? + for param in ['TimeShower:QEDshowerByQ', 'TimeShower:QEDshowerByL', 'TimeShower:QEDshowerByGamma', 'SpaceShower:QEDshowerByQ', 'SpaceShower:QEDshowerByL']: + if param not in self.PY8Card or \ + (not self.PY8Card[param] and param.lower() not in self.PY8Card.user_set): + logger.warning('Activating QED shower: setting %s to True', param) + self.PY8Card[param] = True + elif 'partonshower' in self.run_card['bypass_check']: logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") - else: + else: logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') - os.remove(path_to_remove) - self.cards.remove(card_to_remove) - else: - logger.info('Remember that Parton-Shower are not yet ready for such proton component definition (HW implementation in progress).', '$MG:BOLD' ) - elif (abs(self.run_card['lpp1'])==3 and abs(self.run_card['lpp2'])==3): - if 'pythia8_card.dat' in self.cards: - if self.run_card['pdlabel'] == 'isronlyll': - if 'partonshower' not in self.run_card['bypass_check']: - # force that QED shower is on? - for param in ['TimeShower:QEDshowerByQ', 'TimeShower:QEDshowerByL', 'TimeShower:QEDshowerByGamma', 'SpaceShower:QEDshowerByQ', 'SpaceShower:QEDshowerByL']: - if param not in self.PY8Card or \ - (not self.PY8Card[param] and param.lower() not in self.PY8Card.user_set): - logger.warning('Activating QED shower: setting %s to True', param) - self.PY8Card[param] = True - elif 'partonshower' in self.run_card['bypass_check']: - logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") - else: - logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') - os.remove(self.paths['pythia8']) - self.cards.remove('pythia8_card.dat') + os.remove(self.paths['pythia8']) + self.cards.remove('pythia8_card.dat') ######################################################################## @@ -6514,7 +6614,8 @@ def check_card_consistency(self): #check relation between lepton PDF // dressed lepton collisions // ... - if abs(self.run_card['lpp1']) != 1 or abs(self.run_card['lpp2']) != 1: + if isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int) and \ + abs(self.run_card['lpp1']) != 1 or abs(self.run_card['lpp2']) != 1: if abs(self.run_card['lpp1']) == abs(self.run_card['lpp2']) == 3: # this can be dressed lepton or photon-flux if proc_charac['pdg_initial1'] in [[11],[-11]] and proc_charac['pdg_initial2'] in [[11],[-11]]: @@ -6732,7 +6833,11 @@ def write_card_param(self): """ write the param_card """ self.param_card.write(self.paths['param']) - + + def write_card_fo_card(self): + """ write the fo_card""" + self.fo_card.write_card_from_template(self.paths['FO_analyse'], self.paths['FO_analyse_default']) + @staticmethod def update_dependent(mecmd, me_dir, param_card, path ,timer=0, run_card=None, lhapdfconfig=None): @@ -7076,7 +7181,7 @@ def do_decay(self, line): #first find the particle particle = line.split('>')[0].strip() logger.info("change madspin_card to define the decay of %s: %s" %(particle, line.strip()), '$MG:BOLD') - particle = particle.replace('+','\+').replace('-','\-') + particle = particle.replace('+',r'\+').replace('-',r'\-') decay_pattern = re.compile(r"^\s*decay\s+%s\s*>[\s\w+-~]*?$" % particle, re.I+re.M) text= open(path).read() text = decay_pattern.sub('', text) @@ -7193,7 +7298,7 @@ def help_edit(self, prefix=True): logger.info( ' --clean remove all previously existing line in the file') logger.info( ' --comment_line="" comment all lines matching the regular expression') logger.info('') - logger.info(' Note: all regular-expression will be prefixed by ^\s*') + logger.info(r' Note: all regular-expression will be prefixed by ^\s*') logger.info('') logger.info( ' example: edit reweight --after_line="change mode\b" change model heft') logger.info( ' edit madspin --after_line="banner" change model XXXX') @@ -7314,7 +7419,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''replace_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[14:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[14:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7344,7 +7449,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''comment_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[14:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[14:-1] nb_mod = 0 for posline,l in enumerate(split): if re.search(pattern, l): @@ -7366,7 +7471,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''before_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[13:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[13:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7383,7 +7488,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern = r'''after_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[12:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[12:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7527,16 +7632,19 @@ def open_file(self, answer): answer = 'plot' else: answer = self.cards[int(answer)-self.integer_bias] - + path = '' if 'madweight' in answer: answer = answer.replace('madweight', 'MadWeight') elif 'MadLoopParams' in answer: answer = self.paths['ML'] elif 'pythia8_card' in answer: answer = self.paths['pythia8'] + elif 'FO_analyse' in answer: + path = self.paths['FO_analyse'] + answer = 'fo_card' if os.path.exists(answer): path = answer - else: + elif not os.path.exists(path): if not '.dat' in answer and not '.lhco' in answer: if answer != 'trigger': path = self.paths[answer] @@ -7595,7 +7703,8 @@ def reload_card(self, path): logger.error('Please re-open the file and fix the problem.') logger.warning('using the \'set\' command without opening the file will discard all your manual change') elif path == self.paths['run']: - self.run_card = banner_mod.RunCard(path) + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + self.run_card = banner_mod.RunCard(path) elif path == self.paths['shower']: self.shower_card = shower_card_mod.ShowerCard(path) elif path == self.paths['ML']: @@ -7614,6 +7723,8 @@ def reload_card(self, path): except: import internal.madweight.Cards as mwcards self.mw_card = mwcards.Card(path) + elif path == self.paths['FO_analyse']: + self.fo_card = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse']) else: logger.debug('not keep in sync: %s', path) return path @@ -7629,6 +7740,9 @@ def scanparamcardhandling(input_path=lambda obj: pjoin(obj.me_dir, 'Cards', 'par iteratorclass=param_card_mod.ParamCardIterator, summaryorder=lambda obj: lambda:None, check_card=lambda obj: CommonRunCmd.static_check_param_card, + run_card_scan=False, + run_card_input= lambda obj: pjoin(obj.me_dir, 'Cards', 'run_card.dat'), + run_card_iteratorclass=banner_mod.RunCardIterator, ): """ This is a decorator for customizing/using scan over the param_card (or technically other) This should be use like this: @@ -7678,7 +7792,60 @@ def __enter__(self): def __exit__(self, ctype, value, traceback ): self.iterator.write(self.path) - def decorator(original_fct): + def scan_over_run_card(original_fct, obj, *args, **opts): + + if isinstance(input_path, str): + card_path = run_card_input + else: + card_path = run_card_input(obj) + + run_card_iterator = run_card_iteratorclass(card_path) + orig_card = copy.deepcopy(run_card_iterator.run_card) + if not run_card_iterator.run_card.scan_set: + return original_fct(obj, *args, **opts) + + + with restore_iterator(orig_card, card_path): + # this with statement ensure that the original card is restore + # whatever happens inside those block + + if not hasattr(obj, 'allow_notification_center'): + obj.allow_notification_center = False + with misc.TMP_variable(obj, 'allow_notification_center', False): + orig_name = get_run_name(obj) + if not orig_name and args[1]: + orig_name = args[1][0] + args = (args[0], args[1][1:]) + #orig_name = "scan_%s" % len(obj.results) + + try: + os.mkdir(pjoin(obj.me_dir, 'Events', orig_name)) + except Exception: + pass + next_name = orig_name + "_00" + + for i,card in enumerate(run_card_iterator): + card.write(card_path) + # still have to check for the auto-wdith + #if i !=0: + next_name = run_card_iterator.get_next_name(next_name) + set_run_name(obj)(next_name) + try: + original_fct(obj, *args, **opts) + except ignoreerror as error: + run_card_iterator.store_entry(next_name, {'exception': error}) + else: + run_card_iterator.store_entry(next_name, store_for_scan(obj)(), run_card_path=card_path) + + #param_card_iterator.write(card_path) #-> this is done by the with statement + name = misc.get_scan_name(orig_name, next_name) + path = result_path(obj) % name + logger.info("write scan results in %s" % path ,'$MG:BOLD') + order = summaryorder(obj)() + run_card_iterator.write_summary(path, order=order) + + + def decorator(original_fct): def new_fct(obj, *args, **opts): if isinstance(input_path, str): @@ -7702,8 +7869,13 @@ def new_fct(obj, *args, **opts): if not param_card_iterator: #first run of the function - original_fct(obj, *args, **opts) - return + if run_card_scan: + scan_over_run_card(original_fct, obj, *args, **opts) + return + else: + #first run of the function + original_fct(obj, *args, **opts) + return with restore_iterator(param_card_iterator, card_path): # this with statement ensure that the original card is restore diff --git a/epochX/cudacpp/gg_ttggg.mad/bin/internal/extended_cmd.py b/epochX/cudacpp/gg_ttggg.mad/bin/internal/extended_cmd.py index 2f37070580..789976beee 100755 --- a/epochX/cudacpp/gg_ttggg.mad/bin/internal/extended_cmd.py +++ b/epochX/cudacpp/gg_ttggg.mad/bin/internal/extended_cmd.py @@ -624,12 +624,12 @@ def complete(self, text, state): compfunc = self.completenames # correct wrong splittion with '\ ' - if line and begidx > 2 and line[begidx-2:begidx] == '\ ': + if line and begidx > 2 and line[begidx-2:begidx] == r'\ ': Ntext = line.split(os.path.sep)[-1] - self.completion_prefix = Ntext.rsplit('\ ', 1)[0] + '\ ' + self.completion_prefix = Ntext.rsplit(r'\ ', 1)[0] + r'\ ' to_rm = len(self.completion_prefix) - 1 Nbegidx = len(line.rsplit(os.path.sep, 1)[0]) + 1 - data = compfunc(Ntext.replace('\ ', ' '), line, Nbegidx, endidx) + data = compfunc(Ntext.replace(r'\ ', ' '), line, Nbegidx, endidx) self.completion_matches = [p[to_rm:] for p in data if len(p)>to_rm] # correct wrong splitting with '-'/"=" @@ -742,7 +742,7 @@ def path_completion(text, base_dir = None, only_dirs = False, completion += [prefix + f for f in ['.'+os.path.sep, '..'+os.path.sep] if \ f.startswith(text) and not prefix.startswith('.')] - completion = [a.replace(' ','\ ') for a in completion] + completion = [a.replace(' ',r'\ ') for a in completion] return completion @@ -1253,7 +1253,7 @@ def check_answer_in_input_file(self, question_instance, default, path=False, lin return possibility[0] if '=' in line and ' ' in line.strip(): leninit = len(line) - line,n = re.subn('\s*=\s*','=', line) + line,n = re.subn(r'\s*=\s*','=', line) if n and len(line) != leninit: return self.check_answer_in_input_file(question_instance, default, path=path, line=line) @@ -1311,7 +1311,7 @@ def nice_error_handling(self, error, line): if os.path.exists(self.debug_output): os.remove(self.debug_output) try: - super(Cmd,self).onecmd('history %s' % self.debug_output.replace(' ', '\ ')) + super(Cmd,self).onecmd('history %s' % self.debug_output.replace(' ', r'\ ')) except Exception as error: logger.error(error) @@ -2001,6 +2001,7 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): text = "" has_mg5_path = False # Use local configuration => Need to update the path + already_written = set() for line in open(basefile): if '=' in line: data, value = line.split('=',1) @@ -2018,9 +2019,12 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): comment = '' if key in to_keep: value = str(to_keep[key]) - else: + elif line not in already_written: + already_written.add(line) text += line continue + else: + continue if key == 'mg5_path': has_mg5_path = True try: @@ -2032,14 +2036,20 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): # check if absolute path if not os.path.isabs(value): value = os.path.realpath(os.path.join(basedir, value)) - text += '%s = %s # %s \n' % (key, value, comment) + new_line = '%s = %s # %s \n' % (key, value, comment) + if new_line not in already_written: + text += new_line + already_written.add(new_line) for key in to_write: if key in to_keep: - text += '%s = %s \n' % (key, to_keep[key]) + new_line = '%s = %s \n' % (key, to_keep[key]) + if new_line not in already_written: + text += new_line if not MADEVENT and not has_mg5_path: - text += """\n# MG5 MAIN DIRECTORY\n""" - text += "mg5_path = %s\n" % MG5DIR + if "mg5_path = %s\n" % MG5DIR not in already_written: + text += """\n# MG5 MAIN DIRECTORY\n""" + text += "mg5_path = %s\n" % MG5DIR writer = open(filepath,'w') writer.write(text) @@ -2190,7 +2200,7 @@ def onecmd(self, line, **opt): raise def reask(self, reprint_opt=True): - pat = re.compile('\[(\d*)s to answer\]') + pat = re.compile(r'\[(\d*)s to answer\]') prev_timer = signal.alarm(0) # avoid timer if any if prev_timer: @@ -2991,7 +3001,7 @@ def question_formatting(self, nb_col = 80, lpotential_switch=0, lnb_key=0, key=None): - """should return four lines: + r"""should return four lines: 1. The upper band (typically /========\ 2. The lower band (typically \========/ 3. The line without conflict | %(nb)2d. %(descrip)-20s %(name)5s = %(switch)-10s | @@ -3239,13 +3249,13 @@ def create_question(self, help_text=True): data_to_format['conflict_switch'] = self.color_for_value(key,self.inconsistent_keys[key], consistency=False) if hidden_line: - f2 = re.sub('%(\((?:name|descrip|add_info)\)-?)(\d+)s', + f2 = re.sub(r'%(\((?:name|descrip|add_info)\)-?)(\d+)s', lambda x: '%%%s%ds' % (x.group(1),int(x.group(2))+9), f2) text.append(f2 % data_to_format) elif hidden_line: if not f3: - f3 = re.sub('%(\((?:name|descrip|add_info)\)-?)(\d+)s', + f3 = re.sub(r'%(\((?:name|descrip|add_info)\)-?)(\d+)s', lambda x: '%%%s%ds' % (x.group(1),int(x.group(2))+9), f1) text.append(f3 % data_to_format) diff --git a/epochX/cudacpp/gg_ttggg.mad/bin/internal/file_writers.py b/epochX/cudacpp/gg_ttggg.mad/bin/internal/file_writers.py index 41bff05276..526756129f 100755 --- a/epochX/cudacpp/gg_ttggg.mad/bin/internal/file_writers.py +++ b/epochX/cudacpp/gg_ttggg.mad/bin/internal/file_writers.py @@ -36,10 +36,10 @@ class FileWriter(io.FileIO): supported_preprocessor_commands = ['if'] preprocessor_command_re=re.compile( - "\s*(?P%s)\s*\(\s*(?P.*)\s*\)\s*{\s*"\ + r"\s*(?P%s)\s*\(\s*(?P.*)\s*\)\s*{\s*"\ %('|'.join(supported_preprocessor_commands))) preprocessor_endif_re=re.compile(\ - "\s*}\s*(?Pelse)?\s*(\((?P.*)\))?\s*(?P{)?\s*") + r"\s*}\s*(?Pelse)?\s*(\((?P.*)\))?\s*(?P{)?\s*") class FileWriterError(IOError): """Exception raised if an error occurs in the definition @@ -191,15 +191,15 @@ class FortranWriterError(FileWriter.FileWriterError): pass # Parameters defining the output of the Fortran writer - keyword_pairs = {'^if.+then\s*$': ('^endif', 2), - '^type(?!\s*\()\s*.+\s*$': ('^endtype', 2), - '^do(?!\s+\d+)\s+': ('^enddo\s*$', 2), - '^subroutine': ('^end\s*$', 0), - '^module': ('^end\s*$', 0), - 'function': ('^end\s*$', 0)} - single_indents = {'^else\s*$':-2, - '^else\s*if.+then\s*$':-2} - number_re = re.compile('^(?P\d+)\s+(?P.*)') + keyword_pairs = {r'^if.+then\s*$': ('^endif', 2), + r'^type(?!\s*\()\s*.+\s*$': ('^endtype', 2), + r'^do(?!\s+\d+)\s+': (r'^enddo\s*$', 2), + '^subroutine': (r'^end\s*$', 0), + '^module': (r'^end\s*$', 0), + 'function': (r'^end\s*$', 0)} + single_indents = {r'^else\s*$':-2, + r'^else\s*if.+then\s*$':-2} + number_re = re.compile(r'^(?P\d+)\s+(?P.*)') line_cont_char = '$' comment_char = 'c' uniformcase = True #force everyting to be lower/upper case @@ -212,7 +212,7 @@ class FortranWriterError(FileWriter.FileWriterError): # Private variables __indent = 0 __keyword_list = [] - __comment_pattern = re.compile(r"^(\s*#|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|!)", re.IGNORECASE) + __comment_pattern = re.compile(r"^(\s*#|c\$|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|\s*!|!\$)", re.IGNORECASE) __continuation_line = re.compile(r"(?: )[$&]") def write_line(self, line): @@ -424,26 +424,20 @@ def count_number_of_quotes(self, line): i = i + 1 return len(splitline)-1 - def remove_routine(self, text, fct_names, formatting=True): - """write the incoming text but fully removing the associate routine/function - text can be a path to a file, an iterator, a string - fct_names should be a list of functions to remove + @staticmethod + def get_routine(text, fct_names, call_back=None): + """ + get the fortran function from a fortran file """ - f77_type = ['real*8', 'integer', 'double precision', 'logical'] - pattern = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I) - + + if isinstance(text, str): + text = text.split('\n') + + to_write=False removed = [] - if isinstance(text, str): - if '\n' in text: - text = text.split('\n') - else: - text = open(text) - if isinstance(fct_names, str): - fct_names = [fct_names] - - to_write=True for line in text: fct = pattern.findall(line) if fct: @@ -451,22 +445,38 @@ def remove_routine(self, text, fct_names, formatting=True): to_write = False else: to_write = True - if to_write: - if formatting: - if line.endswith('\n'): - line = line[:-1] - self.writelines(line) - else: - if not line.endswith('\n'): - line = '%s\n' % line - super(FileWriter,self).writelines(line) + if call_back: + call_back(line) else: removed.append(line) - + return removed + + def remove_routine(self, text, fct_names, formatting=True): + """write the incoming text but fully removing the associate routine/function + text can be a path to a file, an iterator, a string + fct_names should be a list of functions to remove + """ + + def call_back(line): + if formatting: + if line.endswith('\n'): + line = line[:-1] + self.writelines(line) + else: + if not line.endswith('\n'): + line = '%s\n' % line + super(FileWriter,self).writelines(line) + + return self.get_routine(text, fct_names, call_back) + +class FortranWriter90(FortranWriter): + + comment_char = ' !' + #=============================================================================== # CPPWriter #=============================================================================== @@ -497,50 +507,50 @@ class CPPWriterError(FileWriter.FileWriterError): '^private': standard_indent, '^protected': standard_indent} - spacing_patterns = [ - ('\s*\"\s*}', '\"'), - ('\s*,\s*', ', '), - ('\s*-\s*', ' - '), - ('([{(,=])\s*-\s*', '\g<1> -'), - ('(return)\s*-\s*', '\g<1> -'), - ('\s*\+\s*', ' + '), - ('([{(,=])\s*\+\s*', '\g<1> +'), - ('\(\s*', '('), - ('\s*\)', ')'), - ('\{\s*', '{'), - ('\s*\}', '}'), - ('\s*=\s*', ' = '), - ('\s*>\s*', ' > '), - ('\s*<\s*', ' < '), - ('\s*!\s*', ' !'), - ('\s*/\s*', '/'), - ('(?\s+>\s*', ' >> '), - ('<\s*double\s*>>\s*', ' > '), - ('\s*<\s+<\s*', ' << '), - ('\s*-\s+>\s*', '->'), - ('\s*=\s+=\s*', ' == '), - ('\s*!\s+=\s*', ' != '), - ('\s*>\s+=\s*', ' >= '), - ('\s*<\s+=\s*', ' <= '), - ('\s*&&\s*', ' && '), - ('\s*\|\|\s*', ' || '), - ('\s*{\s*}', ' {}'), - ('\s*;\s*', '; '), - (';\s*\}', ';}'), - (';\s*$}', ';'), - ('\s*<\s*([a-zA-Z0-9]+?)\s*>', '<\g<1>>'), - ('^#include\s*<\s*(.*?)\s*>', '#include <\g<1>>'), - ('(\d+\.{0,1}\d*|\.\d+)\s*[eE]\s*([+-]{0,1})\s*(\d+)', - '\g<1>e\g<2>\g<3>'), - ('\s+',' '), - ('^\s*#','#')] + spacing_patterns = [(r'\s*\"\s*}', '\"'), + (r'\s*,\s*', ', '), + (r'\s*-\s*', ' - '), + (r'([{(,=])\s*-\s*', r'\g<1> -'), + (r'(return)\s*-\s*', r'\g<1> -'), + (r'\s*\+\s*', ' + '), + (r'([{(,=])\s*\+\s*', r'\g<1> +'), + (r'\(\s*', '('), + (r'\s*\)', ')'), + (r'\{\s*', '{'), + (r'\s*\}', '}'), + (r'\s*=\s*', ' = '), + (r'\s*>\s*', ' > '), + (r'\s*<\s*', ' < '), + (r'\s*!\s*', ' !'), + (r'\s*/\s*', '/'), + (r'\s*\*\s*', ' * '), + (r'\s*-\s+-\s*', '-- '), + (r'\s*\+\s+\+\s*', '++ '), + (r'\s*-\s+=\s*', ' -= '), + (r'\s*\+\s+=\s*', ' += '), + (r'\s*\*\s+=\s*', ' *= '), + (r'\s*/=\s*', ' /= '), + (r'\s*>\s+>\s*', ' >> '), + (r'<\s*double\s*>>\s*', ' > '), + (r'\s*<\s+<\s*', ' << '), + (r'\s*-\s+>\s*', '->'), + (r'\s*=\s+=\s*', ' == '), + (r'\s*!\s+=\s*', ' != '), + (r'\s*>\s+=\s*', ' >= '), + (r'\s*<\s+=\s*', ' <= '), + (r'\s*&&\s*', ' && '), + (r'\s*\|\|\s*', ' || '), + (r'\s*{\s*}', ' {}'), + (r'\s*;\s*', '; '), + (r';\s*\}', ';}'), + (r';\s*$}', ';'), + (r'\s*<\s*([a-zA-Z0-9]+?)\s*>', r'<\g<1>>'), + (r'^#include\s*<\s*(.*?)\s*>', r'#include <\g<1>>'), + (r'(\d+\.{0,1}\d*|\.\d+)\s*[eE]\s*([+-]{0,1})\s*(\d+)', + r'\g<1>e\g<2>\g<3>'), + (r'\s+',' '), + (r'^\s*#','#')] + spacing_re = dict([(key[0], re.compile(key[0])) for key in \ spacing_patterns]) diff --git a/epochX/cudacpp/gg_ttggg.mad/bin/internal/gen_crossxhtml.py b/epochX/cudacpp/gg_ttggg.mad/bin/internal/gen_crossxhtml.py index d58ec573bc..681bf9d09b 100755 --- a/epochX/cudacpp/gg_ttggg.mad/bin/internal/gen_crossxhtml.py +++ b/epochX/cudacpp/gg_ttggg.mad/bin/internal/gen_crossxhtml.py @@ -648,7 +648,7 @@ def recreate(self, banner): if run_card['ickkw'] != 0: #parse the file to have back the information pythia_log = misc.BackRead(pjoin(path, '%s_pythia.log' % tag)) - pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") + pythiare = re.compile(r"\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") for line in pythia_log: info = pythiare.search(line) if not info: @@ -1623,7 +1623,7 @@ def get_html(self, runresults): elif self.debug: text = str(self.debug).replace('. ','.
') if 'http' in text: - pat = re.compile('(http[\S]*)') + pat = re.compile(r'(http[\S]*)') text = pat.sub(r' here ', text) debug = '
%s
%s
' % \ (self.debug.__class__.__name__, text) diff --git a/epochX/cudacpp/gg_ttggg.mad/bin/internal/gen_ximprove.py b/epochX/cudacpp/gg_ttggg.mad/bin/internal/gen_ximprove.py index c86da36a05..415ecc9de0 100755 --- a/epochX/cudacpp/gg_ttggg.mad/bin/internal/gen_ximprove.py +++ b/epochX/cudacpp/gg_ttggg.mad/bin/internal/gen_ximprove.py @@ -158,8 +158,11 @@ def get_helicity(self, to_submit=True, clean=True): (stdout, _) = p.communicate(''.encode()) stdout = stdout.decode('ascii',errors='ignore') if stdout: - nb_channel = max([math.floor(float(d)) for d in stdout.split()]) + lines = stdout.strip().split('\n') + nb_channel = max([math.floor(float(d)) for d in lines[-1].split()]) else: + if os.path.exists(pjoin(self.me_dir, 'error')): + os.remove(pjoin(self.me_dir, 'error')) for matrix_file in misc.glob('matrix*orig.f', Pdir): files.cp(matrix_file, matrix_file.replace('orig','optim')) P_zero_result.append(Pdir) @@ -297,12 +300,14 @@ def get_helicity(self, to_submit=True, clean=True): bad_amps_perhel = [] if __debug__: mtext = open(matrix_file).read() - nb_amp = int(re.findall('PARAMETER \(NGRAPHS=(\d+)\)', mtext)[0]) - logger.debug('nb_hel: %s zero amp: %s bad_amps_hel: %s/%s', len(good_hels),len(bad_amps),len(bad_amps_perhel), len(good_hels)*nb_amp ) + nb_amp = int(re.findall(r'PARAMETER \(NGRAPHS=(\d+)\)', mtext)[0]) + logger.debug('(%s) nb_hel: %s zero amp: %s bad_amps_hel: %s/%s', split_file[-1], len(good_hels),len(bad_amps),len(bad_amps_perhel), len(good_hels)*nb_amp ) if len(good_hels) == 1: files.cp(matrix_file, matrix_file.replace('orig','optim')) continue # avoid optimization if onlye one helicity - recycler = hel_recycle.HelicityRecycler(good_hels, bad_amps, bad_amps_perhel) + + gauge = self.cmd.proc_characteristics['gauge'] + recycler = hel_recycle.HelicityRecycler(good_hels, bad_amps, bad_amps_perhel, gauge=gauge) # In case of bugs you can play around with these: recycler.hel_filt = self.run_card['hel_filtering'] recycler.amp_splt = self.run_card['hel_splitamp'] @@ -1299,7 +1304,7 @@ def get_job_for_event(self): 'script_name': 'unknown', 'directory': C.name, # need to be change for splitted job 'P_dir': C.parent_name, - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # needed for RO gridpack 'offset': 1, # need to be change for splitted job 'nevents': nevents, 'maxiter': self.max_iter, @@ -1387,7 +1392,7 @@ def create_ajob(self, template, jobs, write_dir=None): break info = jobs[j] info['script_name'] = 'ajob%i' % script_number - info['keeplog'] = 'false' + info['keeplog'] = 'false' if self.run_card['keep_log'] != 'debug' else 'true' if "base_directory" not in info: info["base_directory"] = "./" fsock.write(template_text % info) @@ -1456,7 +1461,7 @@ def get_job_for_precision(self): 'script_name': 'unknown', 'directory': C.name, # need to be change for splitted job 'P_dir': C.parent_name, - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # used for RO gridpack 'offset': 1, # need to be change for splitted job 'nevents': nevents, 'maxiter': self.max_iter, @@ -1916,7 +1921,7 @@ def get_job_for_event(self): 'directory': C.name, # need to be change for splitted job 'P_dir': os.path.basename(C.parent_name), 'offset': 1, # need to be change for splitted job - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # use for RO gridpack 'nevents': nevents, #int(nevents*self.gen_events_security)+1, 'maxiter': self.max_iter, 'miniter': self.min_iter, diff --git a/epochX/cudacpp/gg_ttggg.mad/bin/internal/hel_recycle.py b/epochX/cudacpp/gg_ttggg.mad/bin/internal/hel_recycle.py index dfa45d5d20..6c86611f68 100755 --- a/epochX/cudacpp/gg_ttggg.mad/bin/internal/hel_recycle.py +++ b/epochX/cudacpp/gg_ttggg.mad/bin/internal/hel_recycle.py @@ -383,7 +383,7 @@ def get_number(cls, *args): class HelicityRecycler(): '''Class for recycling helicity''' - def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[]): + def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[], gauge='U'): External.good_hel = [] External.nhel_lines = '' @@ -427,6 +427,7 @@ def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[]): self.all_hel = [] self.hel_filt = True + self.gauge = gauge def set_input(self, file): if 'born_matrix' in file: @@ -612,7 +613,7 @@ def unfold_helicities(self, line, nature): def apply_amps(self, line, new_objs): if self.amp_splt: - return split_amps(line, new_objs) + return split_amps(line, new_objs, gauge=self.gauge) else: return apply_args(line, [i.args for i in new_objs]) @@ -785,7 +786,7 @@ def apply_args(old_line, all_the_args): return ''.join(new_lines) -def split_amps(line, new_amps): +def split_amps(line, new_amps, gauge): if not new_amps: return '' fct = line.split('(',1)[0].split('_0')[0] @@ -841,34 +842,31 @@ def split_amps(line, new_amps): spin = fct.split(None,1)[1][to_remove] lines.append('%sP1N_%s(%s)' % (fct, to_remove+1, ', '.join(args))) - hel, iamp = re.findall('AMP\((\d+),(\d+)\)', amp_result)[0] + hel, iamp = re.findall(r'AMP\((\d+),(\d+)\)', amp_result)[0] hel_calculated.append(hel) #lines.append(' %(result)s = TMP(3) * W(3,%(w)s) + TMP(4) * W(4,%(w)s)+' # % {'result': amp_result, 'w': windex}) #lines.append(' & TMP(5) * W(5,%(w)s)+TMP(6) * W(6,%(w)s)' # % {'result': amp_result, 'w': windex}) - if spin in "VF": - lines.append(""" call CombineAmp(%(nb)i, - & (/%(hel_list)s/), - & (/%(w_list)s/), - & TMP, W, AMP(1,%(iamp)s))""" % - {'nb': len(sub_amps), - 'hel_list': ','.join(hel_calculated), - 'w_list': ','.join(windices), - 'iamp': iamp - }) + if spin == "F" or ( spin == "V" and gauge !='FD'): + suffix = '' elif spin == "S": - lines.append(""" call CombineAmpS(%(nb)i, - &(/%(hel_list)s/), - & (/%(w_list)s/), - & TMP, W, AMP(1,%(iamp)s))""" % - {'nb': len(sub_amps), - 'hel_list': ','.join(hel_calculated), - 'w_list': ','.join(windices), - 'iamp': iamp - }) + suffix = 'S' + elif spin == "V" and gauge == "FD": + suffix = "FD" else: - raise Exception("split amp are not supported for spin2 and 3/2") + raise Exception("split amp not supported for spin2, 3/2") + + lines.append(""" call CombineAmp%(suffix)s(%(nb)i, + & (/%(hel_list)s/), + & (/%(w_list)s/), + & TMP, W, AMP(1,%(iamp)s))""" % {'suffix':suffix, + 'nb': len(sub_amps), + 'hel_list': ','.join(hel_calculated), + 'w_list': ','.join(windices), + 'iamp': iamp + }) + #lines.append('') return '\n'.join(lines) diff --git a/epochX/cudacpp/gg_ttggg.mad/bin/internal/histograms.py b/epochX/cudacpp/gg_ttggg.mad/bin/internal/histograms.py index 98f22c4c3a..9931127f66 100755 --- a/epochX/cudacpp/gg_ttggg.mad/bin/internal/histograms.py +++ b/epochX/cudacpp/gg_ttggg.mad/bin/internal/histograms.py @@ -632,34 +632,34 @@ class HwU(Histogram): # than necessary because the HwU standard allows for spaces from within # the name of a weight weight_header_re = re.compile( - '&\s*(?P(\S|(\s(?!\s*(&|$))))+)(\s(?!(&|$)))*') + r'&\s*(?P(\S|(\s(?!\s*(&|$))))+)(\s(?!(&|$)))*') # ================================ # Histo weight specification RE's # ================================ # The start of a plot - histo_start_re = re.compile('^\s*\s*(?P\d+)\s*"\s*'+ - '(?P(\S|(\s(?!\s*")))+)\s*"\s*$') + histo_start_re = re.compile(r'^\s*\s*(?P\d+)\s*"\s*'+ + r'(?P(\S|(\s(?!\s*")))+)\s*"\s*$') # A given weight specifier - a_float_re = '[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' - histo_bin_weight_re = re.compile('(?P%s|NaN)'%a_float_re,re.IGNORECASE) - a_int_re = '[\+|-]?\d+' + a_float_re = r'[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' + histo_bin_weight_re = re.compile(r'(?P%s|NaN)'%a_float_re,re.IGNORECASE) + a_int_re = r'[\+|-]?\d+' # The end of a plot histo_end_re = re.compile(r'^\s*<\\histogram>\s*$') # A scale type of weight - weight_label_scale = re.compile('^\s*mur\s*=\s*(?P%s)'%a_float_re+\ - '\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) - weight_label_PDF = re.compile('^\s*PDF\s*=\s*(?P\d+)\s*$') - weight_label_PDF_XML = re.compile('^\s*pdfset\s*=\s*(?P\d+)\s*$') - weight_label_TMS = re.compile('^\s*TMS\s*=\s*(?P%s)\s*$'%a_float_re) - weight_label_alpsfact = re.compile('^\s*alpsfact\s*=\s*(?P%s)\s*$'%a_float_re, + weight_label_scale = re.compile(r'^\s*mur\s*=\s*(?P%s)'%a_float_re+\ + r'\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) + weight_label_PDF = re.compile(r'^\s*PDF\s*=\s*(?P\d+)\s*$') + weight_label_PDF_XML = re.compile(r'^\s*pdfset\s*=\s*(?P\d+)\s*$') + weight_label_TMS = re.compile(r'^\s*TMS\s*=\s*(?P%s)\s*$'%a_float_re) + weight_label_alpsfact = re.compile(r'^\s*alpsfact\s*=\s*(?P%s)\s*$'%a_float_re, re.IGNORECASE) - weight_label_scale_adv = re.compile('^\s*dyn\s*=\s*(?P%s)'%a_int_re+\ - '\s*mur\s*=\s*(?P%s)'%a_float_re+\ - '\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) - weight_label_PDF_adv = re.compile('^\s*PDF\s*=\s*(?P\d+)\s+(?P\S+)\s*$') + weight_label_scale_adv = re.compile(r'^\s*dyn\s*=\s*(?P%s)'%a_int_re+\ + r'\s*mur\s*=\s*(?P%s)'%a_float_re+\ + r'\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) + weight_label_PDF_adv = re.compile(r'^\s*PDF\s*=\s*(?P\d+)\s+(?P\S+)\s*$') class ParseError(MadGraph5Error): @@ -926,7 +926,7 @@ def get_HwU_source(self, print_header=True): res.append(' '.join('%+16.7e'%wgt for wgt in list(bin.boundaries))) res[-1] += ' '.join('%+16.7e'%bin.wgts[key] for key in self.bins.weight_labels if key not in ['central','stat_error']) - res.append('<\histogram>') + res.append(r'<\histogram>') return res def output(self, path=None, format='HwU', print_header=True): @@ -1149,6 +1149,8 @@ def parse_one_histo_from_stream(self, stream, all_weight_header, boundaries = [0.0,0.0] for j, weight in \ enumerate(HwU.histo_bin_weight_re.finditer(line_bin)): + if (j == len(weight_header)): + continue if j == len(all_weight_header): raise HwU.ParseError("There is more bin weights"+\ " specified than expected (%i)"%len(weight_header)) @@ -1803,7 +1805,7 @@ def parse_histos_from_PY8_XML_stream(self, stream, run_id=None, # Filter empty weights coming from the split weight_label_list = [wgt.strip() for wgt in str(selected_run_node.getAttribute('header')).split(';') if - not re.match('^\s*$',wgt)] + not re.match(r'^\s*$',wgt)] ordered_weight_label_list = [w for w in weight_label_list if w not\ in ['xmin','xmax']] # Remove potential repetition of identical weight labels @@ -1827,7 +1829,7 @@ def parse_histos_from_PY8_XML_stream(self, stream, run_id=None, all_weights = [] for wgt_position, wgt_label in \ enumerate(str(selected_run_node.getAttribute('header')).split(';')): - if not re.match('^\s*$',wgt_label) is None: + if not re.match(r'^\s*$',wgt_label) is None: continue all_weights.append({'POSITION':wgt_position}) for wgt_item in wgt_label.strip().split('_'): @@ -2714,7 +2716,7 @@ def ratio_no_correlations(wgtsA, wgtsB): # First the global gnuplot header for this histogram group global_header =\ -""" +r""" ################################################################################ ### Rendering of the plot titled '%(title)s' ################################################################################ @@ -2862,9 +2864,9 @@ def ratio_no_correlations(wgtsA, wgtsB): major_title = ', '.join(major_title) if not mu[0] in ['none',None]: - major_title += ', dynamical\_scale\_choice=%s'%mu[0] + major_title += r', dynamical\_scale\_choice=%s'%mu[0] if not pdf[0] in ['none',None]: - major_title += ', PDF=%s'%pdf[0].replace('_','\_') + major_title += ', PDF=%s'%pdf[0].replace('_',r'\_') # Do not show uncertainties for individual jet samples (unless first # or specified explicitely and uniquely) @@ -2937,7 +2939,7 @@ def ratio_no_correlations(wgtsA, wgtsB): plot_lines.append( "'%s' index %d using (($1+$2)/2):%d ls %d title '%s'"\ %(HwU_name,block_position+i,mu_var+3,color_index,\ -'%s dynamical\_scale\_choice=%s' % (title,mu[j]))) +r'%s dynamical\_scale\_choice=%s' % (title,mu[j]))) # And now PDF_variation if available if not PDF_var_pos is None: for j,PDF_var in enumerate(PDF_var_pos): @@ -2947,7 +2949,7 @@ def ratio_no_correlations(wgtsA, wgtsB): plot_lines.append( "'%s' index %d using (($1+$2)/2):%d ls %d title '%s'"\ %(HwU_name,block_position+i,PDF_var+3,color_index,\ -'%s PDF=%s' % (title,pdf[j].replace('_','\_')))) +'%s PDF=%s' % (title,pdf[j].replace('_',r'\_')))) # Now add the uncertainty lines, those not using a band so that they # are not covered by those using a band after we reverse plo_lines diff --git a/epochX/cudacpp/gg_ttggg.mad/bin/internal/launch_plugin.py b/epochX/cudacpp/gg_ttggg.mad/bin/internal/launch_plugin.py index 7b10bedcef..9ec09eb71d 100644 --- a/epochX/cudacpp/gg_ttggg.mad/bin/internal/launch_plugin.py +++ b/epochX/cudacpp/gg_ttggg.mad/bin/internal/launch_plugin.py @@ -98,6 +98,7 @@ def default_setup(self): self['vector_size'] = 16 # already setup in default class (just change value) self['aloha_flag'] = '--fast-math' self['matrix_flag'] = '-O3' + self['limhel'] = 0 self.display_block.append('simd') self.display_block.append('psoptim') 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 eee9ba4522..f6e47956cd 100755 --- a/epochX/cudacpp/gg_ttggg.mad/bin/internal/lhe_parser.py +++ b/epochX/cudacpp/gg_ttggg.mad/bin/internal/lhe_parser.py @@ -7,6 +7,7 @@ import numbers import math import time +import copy import os import shutil import sys @@ -101,7 +102,7 @@ def __init__(self, line=None, event=None): self.rwgt = 0 return - + self.event = event if event is not None: self.event_id = len(event) #not yet in the event @@ -1066,6 +1067,8 @@ def define_init_banner(self, wgt, lha_strategy, proc_charac=None): #special case for 1>N init_information = run_card.get_banner_init_information() event = next(self) + if not len(event): #if parse-momenta was false we have to parse the first event + event = Event(str(event)) init_information["idbmup1"] = event[0].pdg init_information["ebmup1"] = event[0].mass init_information["idbmup2"] = 0 @@ -1149,6 +1152,7 @@ def initialize_unweighting(self, getwgt, trunc_error): nb_keep = max(20, int(nb_event*trunc_error*15)) new_wgt = new_wgt[-nb_keep:] if nb_event == 0: + misc.sprint(i,f) raise Exception # store the information self.initial_nb_events[i] = nb_event @@ -1203,7 +1207,6 @@ def unweight(self, outputpath, get_wgt, **opts): (stop to write event when target is reached) """ - if isinstance(get_wgt, (str,six.text_type)): unwgt_name =get_wgt def get_wgt_multi(event): @@ -1483,12 +1486,12 @@ def reorder_mother_child(self): particle.mother2 -= 1 # re-call the function for the next potential change return self.reorder_mother_child() - - - - - + + + + + def parse_reweight(self): """Parse the re-weight information in order to return a dictionary {key: value}. If no group is define group should be '' """ @@ -1522,6 +1525,37 @@ def parse_nlo_weight(self, real_type=(1,11), threshold=None): threshold=threshold) return self.nloweight + def get_fks_pair(self, real_type=(1,11), threshold=None): + """ Gives the fks pair labels""" + start, stop = self.tag.find(''), self.tag.find('') + if start != -1 != stop: + text = self.tag[start+8:stop] + all_line = text.split('\n') + text = text.lower().replace('d','e') + all_line = text.split('\n') + for line in all_line: + data = line.split() + if len(data)>16: + wgt = OneNLOWeight(line, real_type=real_type) + return wgt.to_merge_pdg,wgt.nexternal + + def get_born_momenta(self,real_type=(1,11), threshold=None): + """ Gets the underlying n+1 body kinematics""" + start, stop = self.tag.find(''), self.tag.find('') + if start != -1 != stop: + text = self.tag[start+8:stop] + text = text.lower().replace('d','e') + all_line = text.split('\n') + for line in all_line: + data = line.split() + if len(data)>16: + wgt = OneNLOWeight(line, real_type=real_type) + nexternal = wgt.nexternal + real_momenta = all_line[2:2+nexternal] + return real_momenta + + + def rewrite_nlo_weight(self, wgt=None): """get the string associate to the weight""" @@ -1558,11 +1592,11 @@ def parse_lo_weight(self): return self.loweight if not hasattr(Event, 'loweight_pattern'): - Event.loweight_pattern = re.compile('''\s*(?P\d+)\s+(?P[\d.e+-]+)\s*\s*\n\s* - \s*(?P[\s\d.+-e]+)\s*\s*\n\s* - 1|2)["']?\>\s*(?P[\s\d.e+-]*)\s*\s*\n\s* - 1|2)["']?\>\s*(?P[\s\d.e+-]*)\s*\s*\n\s* - \s*(?P[\d.e+-]*)\s* + Event.loweight_pattern = re.compile('''\\s*(?P\\d+)\\s+(?P[\\d.e+-]+)\\s*\\s*\n\\s* + \\s*(?P[\\s\\d.+-e]+)\\s*\\s*\n\\s* + 1|2)["']?\\>\\s*(?P[\\s\\d.e+-]*)\\s*\\s*\n\\s* + 1|2)["']?\\>\\s*(?P[\\s\\d.e+-]*)\\s*\\s*\n\\s* + \\s*(?P[\\d.e+-]*)\\s* ''',re.X+re.I+re.M) start, stop = self.tag.find(''), self.tag.find('') @@ -1615,7 +1649,7 @@ def parse_matching_scale(self): self.matched_scale_data = [] - pattern = re.compile("") + pattern = re.compile(r"") data = re.split(pattern,self.tag) if len(data) == 1: return [] @@ -1623,7 +1657,7 @@ def parse_matching_scale(self): tmp = {} start,content, end = data self.tag = "%s%s" % (start, end) - pattern = re.compile("pt_clust_(\d*)=\"([\de+-.]*)\"") + pattern = re.compile("pt_clust_(\\d*)=\"([\\de+-.]*)\"") for id,value in pattern.findall(content): tmp[int(id)] = float(value) for i in range(1, len(self)+1): @@ -1647,7 +1681,7 @@ def parse_syscalc_info(self): return self.syscalc_data pattern = re.compile("|") - pattern2 = re.compile("<(?P[\w]*)(?:\s*(\w*)=[\"'](.*)[\"']\s*|\s*)>(.*)") + pattern2 = re.compile("<(?P[\\w]*)(?:\\s*(\\w*)=[\"'](.*)[\"']\\s*|\\s*)>(.*)") data = re.split(pattern,self.tag) if len(data) == 1: return [] @@ -1850,6 +1884,240 @@ def get_decay(self, pdg_code=0, event_id=None): return new_event + + def set_initial_mass_to_zero(self): + """set the masses of the initial particles to zero, by reshuffling the respective momenta + Works only in the **partonic** com frame, so the event must be boosted to such frame + before calling the function + """ + + if not misc.equal(self[0].px, 0) or not misc.equal(self[1].px, 0) or \ + not misc.equal(self[0].py, 0) or not misc.equal(self[1].py, 0) or \ + not misc.equal(self[0].pz, - self[1].pz, zero_limit=False): + misc.sprint(self[0]) + misc.sprint(self[1]) + raise Exception('momenta should be in the partonic center of mass frame') + + self[0].mass = 0. + self[1].mass = 0. + tot_E=0. + for ip,part in enumerate(self): + if part.status == 1 : + tot_E += part.E + if (self[0].pz > 0. and self[1].pz < 0): + self[0].set_momentum(FourMomentum([tot_E/2., 0., 0., tot_E/2.])) + self[1].set_momentum(FourMomentum([tot_E/2., 0., 0., -tot_E/2.])) + elif (self[0].pz < 0. and self[1].pz > 0): + self[0].set_momentum(FourMomentum([tot_E/2., 0., 0., -tot_E/2.])) + self[1].set_momentum(FourMomentum([tot_E/2., 0., 0., tot_E/2.])) + else: + logger.critical('ERROR: two incoming partons not back.-to-back') + + def set_final_jet_mass_to_zero(self): + """set the final light particle masses to zero + """ + + for ip,part in enumerate(self): + if ((abs(part.pid) <= 5) or (abs(part.pid) == 11) or (abs(part.pid) == 12)) and (part.status == 1): + part.mass = 0. + E_1_new = math.sqrt(part.mass**2 + part.px**2 + part.py**2 + part.pz**2) + part.set_momentum(FourMomentum([E_1_new, part.px, part.py, part.pz])) + + + + def merge_particles_kinematics(self, i,j, moth): + """Map to an underlying n-body kinematics for two given + particles i,j to be merged and a resulting moth""" + """ note! kinematics (and id) mapping only! """ + + recoil = True + fks_type = False + + if recoil and not fks_type: + if (i == moth[0].get('number')-1): + fks_i = i + fks_j = j + elif (j == moth[0].get('number')-1): + fks_i = j + fks_j = i + to_remove = fks_j + + merge_i = self[fks_i] + merge_j = self[fks_j] + + i_4mom = FourMomentum(merge_i) + j_4mom = FourMomentum(merge_j) + if (fks_i <= 1): + sign1 = -1.0 + else: + sign1 = 1.0 + mother_4mom = i_4mom + sign1*j_4mom + + new_event = copy.deepcopy(self) + + self[fks_i].pid = moth[0]['id'] + self[fks_i].set_momentum(mother_4mom) + + if fks_i <= 1: # initial-state recoil + new_p = FourMomentum() + for ip,part in enumerate(self): + if (ip != fks_i and ip != fks_j and ip >= 2): + new_p += part + + if fks_i == 0: + self[1].set_momentum(new_p - FourMomentum(self[0])) + elif fks_i == 1: + self[0].set_momentum(new_p - FourMomentum(self[1])) + + pz_1_new = self.recoil_eq(self[0],self[1]) + pz_2_new = self[0].pz + self[1].pz - pz_1_new + E_1_new = math.sqrt(self[0].mass**2 + self[0].px**2 + self[0].py**2 + pz_1_new **2) + E_2_new = math.sqrt(self[1].mass**2 + self[1].px**2 + self[1].py**2 + pz_2_new **2) + self[0].set_momentum(FourMomentum([E_1_new,self[0].px,self[0].py,pz_1_new])) + self[1].set_momentum(FourMomentum([E_2_new,self[1].px,self[1].py,pz_2_new])) + self.pop(to_remove) + + if fks_i > 1: # final-state recoil + + # Re-scale the energy of fks_i to make it on-shell + for ip,part in enumerate(self): + if (ip == fks_i): + part.E = math.sqrt(part.mass**2 + part.px**2 + part.py**2 + part.pz**2) + new_p.E = part.E + + # Find the overall energy in the final state + new_p.E = 0.0 + for ip,part in enumerate(self): + if (ip != fks_j and ip >= 2): + new_p.E += part.E + + # Use one of the initial states to absorb the energy change in the final state + self[1].set_momentum(FourMomentum([new_p.E-self[0].E,self[1].px,self[1].py,self[1].pz])) + + # Change the initial state pz and E + pz_1_new = self.recoil_eq(self[0],self[1]) + pz_2_new = self[0].pz + self[1].pz - pz_1_new + E_1_new = math.sqrt(self[0].mass**2 + self[0].px**2 + self[0].py**2 + pz_1_new **2) + E_2_new = math.sqrt(self[1].mass**2 + self[1].px**2 + self[1].py**2 + pz_2_new **2) + self[0].set_momentum(FourMomentum([E_1_new,self[0].px,self[0].py,pz_1_new])) + self[1].set_momentum(FourMomentum([E_2_new,self[1].px,self[1].py,pz_2_new])) + self.pop(to_remove) + + elif fks_type and not recoil: + ## Do it in a more FKS-style + if (i == moth[0].get('number')-1): + fks_i = i + fks_j = j + elif (j == moth[0].get('number')-1): + fks_i = j + fks_j = i + to_remove = fks_j + new_event = copy.copy(event) + + if fks_i <= 1: # initial-state recoil + + # First boost to partonic CM frame + q = FourMomentum(self[0])+FourMomentum(self[1]) + for ip,part in enumerate(self): + vec = FourMomentum(part) + self[ip].set_momentum(vec.zboost(pboost=q)) + + k_tot = FourMomentum([self[0].E+self[1].E-self[fks_j].E,self[0].px+self[1].px-self[fks_j].px,\ + self[0].py+self[1].py-self[fks_j].py,self[0].pz+self[1].pz-self[fks_j].pz]) + + final = FourMomentum([0,0,0,0]) + for ip,part in enumerate(self): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + if (ip != fks_i and ip != fks_j and ip >= 2): + final = final + vec + + s = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz])**2 + ksi = self[fks_j].E/(math.sqrt(s)/2.0) + y = self[fks_j].pz/self[fks_j].E + + self[0].pz = self[0].pz * math.sqrt(1.0-ksi)*math.sqrt((2.0-ksi*(1.0+y))/((2.0-ksi*(1.0-y)))) + self[0].E = math.sqrt(self[0].mass**2 + self[0].pz**2) + self[1].pz = self[1].pz * math.sqrt(1.0-ksi)*math.sqrt((2.0-ksi*(1.0-y))/((2.0-ksi*(1.0+y)))) + self[1].E = math.sqrt(self[1].mass**2 + self[1].pz**2) + + final = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + k_tot_1 = k_tot.zboost(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + k_tot_2 = k_tot_1.pt_boost(pboost=FourMomentum([k_tot_1.E,k_tot_1.px,k_tot_1.py,k_tot_1.pz])) + k_tot_3 = k_tot_2.zboost_inv(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + + for ip,part in enumerate(self): + if (ip >= 2): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + vec2 = vec.zboost(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + vec3 = vec2.pt_boost(pboost=FourMomentum([k_tot_1.E,k_tot_1.px,k_tot_1.py,k_tot_1.pz])) + vec_new = vec3.zboost_inv(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + self[ip].set_momentum(FourMomentum([vec_new.E,vec_new.px,vec_new.py,vec_new.pz])) + + self.pop(to_remove) + + else: # final-state recoil + q = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + for ip,part in enumerate(self): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + self[ip].set_momentum(vec.zboost(pboost=q)) + + q = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + k = FourMomentum([self[fks_i].E+self[fks_j].E,self[fks_i].px+self[fks_j].px,\ + self[fks_i].py+self[fks_j].py,self[fks_i].pz+self[fks_j].pz]) + + k_rec = FourMomentum([0,0,0,0]) + for ip,part in enumerate(self): + if ip >= 2 and ip != fks_i and ip != fks_j: # add only final-states to the recoil and not the FKS pair + k_rec = k_rec + FourMomentum([part.E,part.px,part.py,part.pz]) + + k_mom = math.sqrt(k_rec.px**2 + k_rec.py**2 + k_rec.pz**2) + beta = (q**2 - (k_rec.E+k_mom)**2)/(q**2 + (k_rec.E+k_mom)**2) + for ip,part in enumerate(self): + if ip >= 2 and ip != fks_i and ip != fks_j: + vec = FourMomentum([self[ip].E,self[ip].px,self[ip].py,self[ip].pz]) + self[ip].set_momentum(vec.boost_beta(beta,k_rec)) + if ip == fks_i: + self[ip].set_momentum(q - k_rec.boost_beta(beta,k_rec)) + self.pop(to_remove) + else: + logger.info('Error in Sudakov Born mapping: no recoil scheme found!') + + def recoil_eq(self,part1, part2): + """ In general, solves the equation + E1 + E2 = K + p1 + p2 = c + E1^2 - p1^2 = a + E2^2 - p2^2 = b + and returns p1 + """ + thresh = 1e-6 + import random + a = part1.mass**2 + part1.px**2 + part1.py**2 + b = part2.mass**2 + part2.px**2 + part2.py**2 + c = part1.pz + part2.pz + K = part1.E + part2.E + K2 = K**2 + sol1 = (-a*c + b*c + c**3 - c*K2 - math.sqrt(K2*(a**2 + (b + c**2 - K2)**2 - 2*a*(b - c**2 + K2))))/(2*(c**2-K2)) + sol2 = (-a*c + b*c + c**3 - c*K2 + math.sqrt(K2*(a**2 + (b + c**2 - K2)**2 - 2*a*(b - c**2 + K2))))/(2*(c**2-K2)) + + if abs(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2) - (math.sqrt(a+sol2**2) + math.sqrt(b+(c-sol2)**2))) > thresh: + logger.critical('Error in recoil_eq solver 1') + logger.critical(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2)) + logger.critical(math.sqrt(a+sol2**2) + math.sqrt(b+(c-sol2)**2)) + if abs(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2) - K) > thresh: + logger.critical('Error in recoil_eq solver 2') + logger.critical(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2)) + logger.critical(K) + return sol1 + + def boost(self, filter=None): """modify the current event to boost it according to the current filter""" if filter is None: @@ -1861,7 +2129,7 @@ def boost(self, filter=None): if list(filter(p)): pboost += p else: - pboost = FourMomentum(pboost) + pboost = FourMomentum(filter) # change sign of three-component due to helas convention pboost.px *=-1 @@ -1877,7 +2145,7 @@ def check(self): """check various property of the events""" # check that relative error is under control - threshold = 1e-6 + threshold = 1e-4 #1. Check that the 4-momenta are conserved E, px, py, pz = 0,0,0,0 @@ -1920,7 +2188,50 @@ def check(self): self.check_color_structure() #3. check mass - + + def check_kinematics_only(self): + """check various property of the events - only kinematics""" + + # check that relative error is under control + threshold = 1e-3 + + #1. Check that the 4-momenta are conserved + E, px, py, pz = 0,0,0,0 + absE, abspx, abspy, abspz = 0,0,0,0 + for particle in self: + coeff = 1 + if particle.status == -1: + coeff = -1 + elif particle.status != 1: + continue + E += coeff * particle.E + absE += abs(particle.E) + px += coeff * particle.px + py += coeff * particle.py + pz += coeff * particle.pz + abspx += abs(particle.px) + abspy += abs(particle.py) + abspz += abs(particle.pz) + # check mass + fourmass = FourMomentum(particle).mass + + if particle.mass and (abs(particle.mass) - fourmass)/ abs(particle.mass) > threshold: + logger.critical(self) + raise Exception( "Do not have correct mass lhe: %s momentum: %s (error at %s" % (particle.mass, fourmass, (abs(particle.mass) - fourmass)/ abs(particle.mass))) + + if abs(E/absE) > threshold: + logger.critical(self) + raise Exception("Do not conserve Energy %s, %s" % (E/absE, E)) + if abs(px/abspx) > threshold: + logger.critical(self) + raise Exception("Do not conserve Px %s, %s" % (px/abspx, px)) + if abs(py/abspy) > threshold: + logger.critical(self) + raise Exception("Do not conserve Py %s, %s" % (py/abspy, py)) + if abs(pz/abspz) > threshold: + logger.critical(self) + raise Exception("Do not conserve Pz %s, %s" % (pz/abspz, pz)) + def assign_scale_line(self, line, convert=True): """read the line corresponding to global event line @@ -2764,7 +3075,7 @@ def zboost(self, pboost=None, E=0, pz=0): if isinstance(pboost, FourMomentum): E = pboost.E pz = pboost.pz - + #beta = pz/E gamma = E / math.sqrt(E**2-pz**2) gammabeta = pz / math.sqrt(E**2-pz**2) @@ -2778,6 +3089,74 @@ def zboost(self, pboost=None, E=0, pz=0): out.pz = 0 return out + def zboost_inv(self, pboost=None, E=0, pz=0): + """Both momenta should be in the same frame. + The boost perform correspond to the boost required to set pboost at + rest (only z boost applied). + """ + if isinstance(pboost, FourMomentum): + E = pboost.E + pz = pboost.pz + + #beta = pz/E + gamma = E / math.sqrt(E**2-pz**2) + gammabeta = pz / math.sqrt(E**2-pz**2) + + out = FourMomentum([gamma*self.E + gammabeta*self.pz, + self.px, + self.py, + gamma*self.pz + gammabeta*self.E]) + + if abs(out.pz) < 1e-6 * out.E: + out.pz = 0 + return out + + + def pt_boost(self, pboost=None, E=0, pz=0): + """Both momenta should be in the same frame. + The boost perform correspond to the boost required to set pboost at + rest (only pT boost applied). + """ + + if isinstance(pboost, FourMomentum): + E = pboost.E + px = pboost.px + py = pboost.py + mass = math.sqrt(E**2 - px**2 - py**2) + + betax = px/E + betay = py/E + beta = math.sqrt(betax**2+betay**2) + gamma = 1 / math.sqrt(1.0-beta**2) + + out = FourMomentum([gamma*self.E - gamma*betax*self.px - gamma*betay*self.py, + -gamma*betax*self.E + (1.0 + (gamma-1.0)*betax**2/(beta**2))*self.px + (gamma-1.0)*betax*betay/(beta**2)*self.py, + -gamma*betay*self.E + ((gamma-1.0)*betax*betay/(beta**2))*self.px + (1.0+(gamma-1.0)*(betay**2)/(beta**2))*self.py, + self.pz]) + + if abs(out.px) < 1e-6 * out.E: + out.px = 0 + if abs(out.py) < 1e-6 * out.E: + out.py = 0 + return out + + def boost_beta(self,beta,mom): + """ Boost along the three-momentum of mom with a boost of size beta""" + + unit = mom * (1.0/math.sqrt(mom.px**2+mom.py**2+mom.pz**2)) + beta_vec = beta*unit + bx = beta_vec.px + by = beta_vec.py + bz = beta_vec.pz + gamma = 1.0 / math.sqrt(1.0-beta**2) + + out = FourMomentum([gamma*self.E - gamma*bx*self.px - gamma*by*self.py - gamma*bz*self.pz, + -gamma*bx*self.E + (1.0 + (gamma-1.0)*bx**2/(beta**2))*self.px + (gamma-1.0)*bx*by/(beta**2)*self.py + (gamma-1.0)*bx*bz/(beta**2)*self.pz, + -gamma*by*self.E + ((gamma-1.0)*bx*by/(beta**2))*self.px + (1.0+(gamma-1.0)*(by**2)/(beta**2))*self.py + (gamma-1.0)*by*bz/(beta**2)*self.pz, + -gamma*bz*self.E + (gamma-1.0)*bx*bz/(beta**2)*self.px + (gamma-1.0)*(by*bz)/(beta**2)*self.py + (1.0+(gamma-1.0)*bz**2/(beta**2))*self.pz]) + + return out + def boost_to_restframe(self, pboost): """apply the boost transformation such that pboost is at rest in the new frame. First apply a rotation to allign the pboost to the z axis and then use @@ -2789,27 +3168,64 @@ def boost_to_restframe(self, pboost): return out - # write pboost as (E, p cosT sinF, p sinT sinF, p cosF) - # rotation such that it become (E, 0 , 0 , p ) is - # cosT sinF , -sinT , cosT sinF - # sinT cosF , cosT , sinT sinF - # -sinT , 0 , cosF - p = math.sqrt( pboost.px**2 + pboost.py**2+ pboost.pz**2) - cosF = pboost.pz / p - sinF = math.sqrt(1-cosF**2) - sinT = pboost.py/p/sinF - cosT = pboost.px/p/sinF - - out=FourMomentum([self.E, - self.px*cosT*cosF + self.py*sinT*cosF-self.pz*sinF, - -self.px*sinT+ self.py*cosT, - self.px*cosT*sinF + self.py*sinT*sinF + self.pz*cosF - ]) - out = out.zboost(E=pboost.E,pz=p) + # see here https://physics.stackexchange.com/questions/749036/general-lorentz-boost-of-four-momentum-in-cm-frame-particle-physics + vx = pboost.px/pboost.E + vy = pboost.py/pboost.E + vz = pboost.pz/pboost.E + v = pboost.norm/pboost.E + v2 = pboost.norm_sq/pboost.E**2 + gamma = 1./math.sqrt(1.-v**2) + gammo = gamma-1. + out = FourMomentum(E = gamma*(self.E - vx*self.px - vy*self.py - vz*self.pz), + px= -gamma*vx*self.E + (1+gammo*vx**2/v2)*self.px + gammo*vx*vy/v2*self.py + gammo*vx*vz/v2*self.pz, + py= -gamma*vy*self.E + gammo*vy*vx/v2*self.px + (1+gammo*vy**2/v2)*self.py + gammo*vy*vz/v2*self.pz, + pz= -gamma*vz*self.E + gammo*vz*vx/v2*self.px + gammo*vz*vy/v2*self.py + (1+gammo*vz**2/v2)*self.pz) + return out + def rotate_to_z(self,prot): + + import math + import numpy as np + + z = np.array([0.,0.,1.]) + + px = self.px + py = self.py + pz = self.pz + + refx = prot.px + refy = prot.py + refz = prot.pz + + prot_mom = np.array([px, py, pz]) + ref_mom = np.array([refx, refy, refz]) + + # Create normal vector + n = np.array([refy, -refx, 0.]) + n = n * 1./math.sqrt(self.threedot(n,n)) + t = prot_mom - self.threedot(n,prot_mom)*n + p = ref_mom - self.threedot(ref_mom,z)*z + p = p/math.sqrt(self.threedot(p,p)) + + t_pz = np.array([self.threedot(t,p), self.threedot(t,z), 0.]) + costheta = self.threedot(ref_mom,z)* 1./math.sqrt(self.threedot(ref_mom, ref_mom)) + sintheta=math.sqrt(1.-costheta**2) + + sgn = 1. + t_pz_p = np.array([0., 0., 0.]) + t_pz_p[0] = costheta*t_pz[0] + sgn*(-sintheta) * t_pz[1] + t_pz_p[1] = sgn*sintheta*t_pz[0] + costheta * t_pz[1] + + out_mom = self.threedot(n,prot_mom)*n + t_pz_p[0]*p + t_pz_p[1]*z + + out = FourMomentum([self.E,out_mom[0], out_mom[1], out_mom[2] ] ) + + return out - + def threedot(self,a,b): + + return a[0]*b[0]+a[1]*b[1]+a[2]*b[2] class OneNLOWeight(object): 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 2a118e21bf..8e30cf690c 100755 --- a/epochX/cudacpp/gg_ttggg.mad/bin/internal/madevent_interface.py +++ b/epochX/cudacpp/gg_ttggg.mad/bin/internal/madevent_interface.py @@ -496,7 +496,6 @@ def help_remove(self): logger.info(" the optional '-f' allows to by-pass all security question") logger.info(" The banner can be remove only if all files are removed first.") - class AskRun(cmd.ControlSwitch): """a class for the question on what to do on a madevent run""" @@ -2393,13 +2392,17 @@ def do_generate_events(self, line): # Check argument's validity mode = self.check_generate_events(args) switch_mode = self.ask_run_configuration(mode, args) - if not args: - # No run name assigned -> assigned one automaticaly - self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton') - else: - self.set_run_name(args[0], None, 'parton', True) - args.pop(0) - + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat'), consistency=False) + if not run_card.scan_set: + if not args: + # No run name assigned -> assigned one automaticaly + self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton') + else: + self.set_run_name(args[0], None, 'parton', True) + args.pop(0) + + self.run_generate_events(switch_mode, args) self.postprocessing() @@ -2560,7 +2563,7 @@ def wait_monitoring(Idle, Running, Done): self.update_status("postprocessing contur done", level="rivet") # this decorator handle the loop related to scan. - @common_run.scanparamcardhandling() + @common_run.scanparamcardhandling(run_card_scan=True) def run_generate_events(self, switch_mode, args): if self.proc_characteristics['loop_induced'] and self.options['run_mode']==0: @@ -2593,7 +2596,6 @@ def run_generate_events(self, switch_mode, args): # Regular run mode logger.info('Generating %s events with run name %s' % (self.run_card['nevents'], self.run_name)) - self.exec_cmd('survey %s %s' % (self.run_name,' '.join(args)), postcmd=False) nb_event = self.run_card['nevents'] @@ -2975,7 +2977,7 @@ def update_width_in_param_card(decay_info, initial=None, output=None): particle = 0 # Read BRs for this decay line = param_card[line_number] - while re.search('^(#|\s|\d)', line): + while re.search(r'^(#|\s|\d)', line): line = param_card.pop(line_number) if not particle or line.startswith('#'): line=param_card[line_number] @@ -3226,7 +3228,7 @@ def do_treatcards(self, line, mode=None, opt=None): for line in open(pjoin(bias_module_path,'%s.f'%os.path.basename(bias_module_path))): if start and last: break - if not start and not re.search('c\s*parameters\s*=\s*{',line, re.I): + if not start and not re.search(r'c\s*parameters\s*=\s*{',line, re.I): continue start = True if not line.startswith('C'): @@ -3235,7 +3237,7 @@ def do_treatcards(self, line, mode=None, opt=None): if '{' in line: line = line.split('{')[-1] # split for } ! # - split_result = re.split('(\}|!|\#)', line,1, re.M) + split_result = re.split(r'(\}|!|\#)', line,1, re.M) line = split_result[0] sep = split_result[1] if len(split_result)>1 else None if sep == '}': @@ -3514,8 +3516,8 @@ def pass_in_difficult_integration_mode(self, rate=1): text = open(conf_path).read() min_evt, max_evt = 2500 *(2+rate), 10000*(rate+1) - text = re.sub('''\(min_events = \d+\)''', '(min_events = %i )' % min_evt, text) - text = re.sub('''\(max_events = \d+\)''', '(max_events = %i )' % max_evt, text) + text = re.sub(r'''\(min_events = \d+\)''', '(min_events = %i )' % min_evt, text) + text = re.sub(r'''\(max_events = \d+\)''', '(max_events = %i )' % max_evt, text) fsock = open(conf_path, 'w') fsock.write(text) fsock.close() @@ -3619,7 +3621,7 @@ def do_refine(self, line): alljobs = misc.glob('ajob*', Pdir) #remove associated results.dat (ensure to not mix with all data) - Gre = re.compile("\s*j=(G[\d\.\w]+)") + Gre = re.compile(r"\s*j=(G[\d\.\w]+)") for job in alljobs: Gdirs = Gre.findall(open(job).read()) for Gdir in Gdirs: @@ -3727,58 +3729,126 @@ def do_combine_events(self, line): sum_xsec, sum_xerru, sum_axsec = 0,[],0 Gdirs = self.get_Gdir() Gdirs.sort() - for Gdir in Gdirs: - if os.path.exists(pjoin(Gdir, 'events.lhe')): - result = sum_html.OneResult('') - result.read_results(pjoin(Gdir, 'results.dat')) - sum_xsec += result.get('xsec') - sum_xerru.append(result.get('xerru')) - sum_axsec += result.get('axsec') - - if self.run_card['gridpack'] or self.run_card['nevents']==0: - os.remove(pjoin(Gdir, 'events.lhe')) - continue + partials_info = [] + try: + p = subprocess.Popen(["ulimit", "-n"], stdout=subprocess.PIPE) + out, err = p.communicate() + max_G = out.decode() + if max_G == "unlimited": + max_G =2500 + else: + max_G = int(max_G) - 40 + except Exception as error: + logger.debug(error) + max_G = 80 # max(20, len(Gdirs)/self.options['nb_core']) - AllEvent.add(pjoin(Gdir, 'events.lhe'), - result.get('xsec'), - result.get('xerru'), - result.get('axsec') - ) - - if len(AllEvent) >= 80: #perform a partial unweighting - AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % partials), - get_wgt, log_level=5, trunc_error=1e-2, event_target=self.run_card['nevents']) - AllEvent = lhe_parser.MultiEventFile() - AllEvent.banner = self.banner - AllEvent.add(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % partials), - sum_xsec, - math.sqrt(sum(x**2 for x in sum_xerru)), - sum_axsec) - partials +=1 - if not hasattr(self,'proc_characteristic'): self.proc_characteristic = self.get_characteristics() - if len(AllEvent) == 0: - nb_event = 0 - else: + mycluster = cluster.MultiCore(nb_core=self.options['nb_core']) + + def split(a, n): + """split a list "a" into n chunk of same size (or nearly same size)""" + k, m = divmod(len(a), n) + return (a[i*k+min(i, m):(i+1)*k+min(i+1, m)] for i in range(n)) + + partials_info = [] + if len(Gdirs) >= max_G: + start_unweight= time.perf_counter() + # first check in how many chunk we have to split (always use a multiple of nb_core) + nb_split = 1 + nb_G = len(Gdirs) // (2* self.options['nb_core']) + while nb_G > min(80, max_G): + nb_split += 1 + nb_G = len(Gdirs)//(nb_split*2*self.options['nb_core']) + if nb_G < 10: + nb_split -=1 + nb_G = len(Gdirs)//(nb_split*2*self.options['nb_core']) + + #enforce at least 10 directory per thread + if nb_G > 10 or nb_split>1: + # do the unweighting of each chunk on their own thread + nb_chunk = (nb_split*2*self.options['nb_core']) + else: + nb_chunk = len(Gdirs) // 10 + nb_G =10 + + # security that the number of combine events is too large + if nb_chunk >= max_G: + nb_chunk = max_G -1 + nb_G = len(Gdirs) // nb_chunk + + for i, local_G in enumerate(split(Gdirs, nb_chunk)): + line = [pjoin(self.me_dir, "Events", self.run_name, "partials%d.lhe.gz" % i)] + line.append(pjoin(self.me_dir, 'Events', self.run_name, '%s_%s_banner.txt' % (self.run_name, tag))) + line.append(str(self.results.current['cross'])) + line += local_G + partials_info.append(self.do_combine_events_partial(' '.join(line), preprocess_only=True)) + mycluster.submit(sys.executable, + [pjoin(self.me_dir, 'bin', 'internal', 'madevent_interface.py'), 'combine_events_partial'] + line, + stdout='/dev/null' + ) + + starttime = time.time() + update_status = lambda idle, run, finish: \ + self.update_status((idle, run, finish, 'unweight'), level=None, + force=False, starttime=starttime) + mycluster.wait(self.me_dir, update_status) + # do the final combination + for data in partials_info: + AllEvent.add(*data) + + start_unweight= time.perf_counter() nb_event = AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "unweighted_events.lhe.gz"), get_wgt, trunc_error=1e-2, event_target=self.run_card['nevents'], log_level=logging.DEBUG, normalization=self.run_card['event_norm'], proc_charac=self.proc_characteristic) + + #cleaning + for data in partials_info: + path = data[0] + try: + os.remove(path) + except Exception as error: + try: + os.remove(path[:-3]) # try without the .gz + except: + misc.sprint('no file ', path, 'to clean') + else: + for Gdir in Gdirs: + if os.path.exists(pjoin(Gdir, 'events.lhe')): + result = sum_html.OneResult('') + result.read_results(pjoin(Gdir, 'results.dat')) + sum_xsec += result.get('xsec') + sum_xerru.append(result.get('xerru')) + sum_axsec += result.get('axsec') + + if self.run_card['gridpack'] or self.run_card['nevents']==0: + os.remove(pjoin(Gdir, 'events.lhe')) + continue + + AllEvent.add(pjoin(Gdir, 'events.lhe'), + result.get('xsec'), + result.get('xerru'), + result.get('axsec') + ) + + if len(AllEvent) == 0: + nb_event = 0 + else: + nb_event = AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "unweighted_events.lhe.gz"), + get_wgt, trunc_error=1e-2, event_target=self.run_card['nevents'], + log_level=logging.DEBUG, normalization=self.run_card['event_norm'], + proc_charac=self.proc_characteristic) + + if nb_event < self.run_card['nevents']: + logger.warning("failed to generate enough events. Please follow one of the following suggestions to fix the issue:") + logger.warning(" - set in the run_card.dat 'sde_strategy' to %s", 1 + self.run_card['sde_strategy'] % 2) + logger.warning(" - set in the run_card.dat 'hard_survey' to 1 or 2.") + logger.warning(" - reduce the number of requested events (if set too high)") + logger.warning(" - check that you do not have -integrable- singularity in your amplitude.") + logger.warning(" - regenerate your process directory by selecting another gauge (in particular try FD gauge).") - if nb_event < self.run_card['nevents']: - logger.warning("failed to generate enough events. Please follow one of the following suggestions to fix the issue:") - logger.warning(" - set in the run_card.dat 'sde_strategy' to %s", 1 + self.run_card['sde_strategy'] % 2) - logger.warning(" - set in the run_card.dat 'hard_survey' to 1 or 2.") - logger.warning(" - reduce the number of requested events (if set too high)") - logger.warning(" - check that you do not have -integrable- singularity in your amplitude.") - if partials: - for i in range(partials): - try: - os.remove(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % i)) - except Exception: - os.remove(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe" % i)) self.results.add_detail('nb_event', nb_event) @@ -3789,7 +3859,50 @@ def do_combine_events(self, line): logger.info("combination of events done in %s s ", time.time()-start) self.to_store.append('event') + + ############################################################################ + def do_combine_events_partial(self, line, preprocess_only=False): + """ """ + + AllEvent = lhe_parser.MultiEventFile() + + sum_xsec, sum_xerru, sum_axsec = 0,[],0 + output, banner_path,cross = line.split()[:3] + Gdirs = line.split()[3:] + + cross = float(cross) + if not self.banner: + self.banner = banner_mod.Banner(banner_path) + if not hasattr(self, 'run_card'): + self.run_card = banner_mod.RunCard(self.banner['mgruncard']) + AllEvent.banner = self.banner + + for Gdir in Gdirs: + if os.path.exists(pjoin(Gdir, 'events.lhe')): + result = sum_html.OneResult('') + result.read_results(pjoin(Gdir, 'results.dat')) + sum_xsec += result.get('xsec') + sum_xerru.append(result.get('xerru')) + sum_axsec += result.get('axsec') + + if self.run_card['gridpack'] or self.run_card['nevents']==0: + os.remove(pjoin(Gdir, 'events.lhe')) + continue + if not preprocess_only: + AllEvent.add(pjoin(Gdir, 'events.lhe'), + result.get('xsec'), + result.get('xerru'), + result.get('axsec') + ) + if preprocess_only: + return output, sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), sum_axsec + nb_event = max(min(abs(1.01*self.run_card['nevents']*sum_axsec/cross),self.run_card['nevents']), 10) + get_wgt = lambda event: event.wgt + AllEvent.unweight(output, + get_wgt, log_level=5, trunc_error=1e-2, event_target=nb_event) + return output, sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), sum_axsec + ############################################################################ def correct_bias(self): """check the first event and correct the weight by the bias @@ -3902,13 +4015,19 @@ def do_store_events(self, line): #except Exception: # continue # Store log - try: - if os.path.exists(pjoin(G_path, 'log.txt')): - input = pjoin(G_path, 'log.txt') + input = pjoin(G_path, 'log.txt') + if os.path.exists(input): + if self.run_card['keep_log'] not in ["none", "minimal"]: output = pjoin(G_path, '%s_log.txt' % run) - files.mv(input, output) - except Exception: - continue + try: + files.mv(input, output) + except Exception: + continue + elif self.run_card['keep_log'] == "none": + try: + os.remove(input) + except Exception: + continue #try: # # Grid # for name in ['ftn26']: @@ -3989,7 +4108,7 @@ def do_create_gridpack(self, line): misc.call(['./bin/internal/make_gridpack'], cwd=self.me_dir) files.mv(pjoin(self.me_dir, 'gridpack.tar.gz'), pjoin(self.me_dir, '%s_gridpack.tar.gz' % self.run_name)) - os.system("sed -i.bak \"s/\s*.true.*=.*GridRun/ .false. = GridRun/g\" %s/Cards/grid_card.dat" \ + os.system("sed -i.bak \"s/\\s*.true.*=.*GridRun/ .false. = GridRun/g\" %s/Cards/grid_card.dat" \ % self.me_dir) self.update_status('gridpack created', level='gridpack') @@ -4476,7 +4595,7 @@ def do_pythia8(self, line): else: preamble = misc.get_HEPTools_location_setter( pjoin(MG5DIR,'HEPTools'),'lib') - preamble += "\n unset PYTHIA8DATA\n" + #preamble += "\n unset PYTHIA8DATA\n" open(pythia_cmd_card,'w').write("""! ! It is possible to run this card manually with: @@ -4691,7 +4810,7 @@ def do_pythia8(self, line): # Make sure to sure the number of split_events determined during the splitting. split_PY8_Card.systemSet('Main:numberOfEvents',partition_for_PY8[i]) split_PY8_Card.systemSet('HEPMCoutput:scaling',split_PY8_Card['HEPMCoutput:scaling']* - (float(partition_for_PY8[i])/float(n_events))) + (float(partition_for_PY8[i]))) # Add_missing set to False so as to be sure not to add any additional parameter w.r.t # the ones in the original PY8 param_card copied. split_PY8_Card.write(pjoin(parallelization_dir,'PY8Card_%d.dat'%i), @@ -4963,9 +5082,9 @@ def wait_monitoring(Idle, Running, Done): if cross_sections: # Filter the cross_sections specified an keep only the ones # with central parameters and a different merging scale - a_float_re = '[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' + a_float_re = r'[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' central_merging_re = re.compile( - '^\s*Weight_MERGING\s*=\s*(?P%s)\s*$'%a_float_re, + r'^\s*Weight_MERGING\s*=\s*(?P%s)\s*$'%a_float_re, re.IGNORECASE) cross_sections = dict( (float(central_merging_re.match(xsec).group('merging')),value) @@ -5016,8 +5135,8 @@ def wait_monitoring(Idle, Running, Done): def parse_PY8_log_file(self, log_file_path): """ Parse a log file to extract number of event and cross-section. """ - pythiare = re.compile("Les Houches User Process\(es\)\s*\d+\s*\|\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)\s*\|\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") - pythia_xsec_re = re.compile("Inclusive cross section\s*:\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") + pythiare = re.compile(r"Les Houches User Process\(es\)\s*\d+\s*\|\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)\s*\|\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") + pythia_xsec_re = re.compile(r"Inclusive cross section\s*:\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") sigma_m, Nacc, Ntry = None, None, None for line in misc.BackRead(log_file_path): info = pythiare.search(line) @@ -5158,7 +5277,7 @@ def do_pythia(self, line): # read the line from the bottom of the file #pythia_log = misc.BackRead(pjoin(self.me_dir,'Events', self.run_name, # '%s_pythia.log' % tag)) - pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") + pythiare = re.compile(r"\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") for line in misc.reverse_readline(pjoin(self.me_dir,'Events', self.run_name, '%s_pythia.log' % tag)): info = pythiare.search(line) @@ -5619,8 +5738,8 @@ def launch_job(self,exe, cwd=None, stdout=None, argument = [], remaining=0, input_files.append(self.get_pdf_input_filename()) #Find the correct ajob - Gre = re.compile("\s*j=(G[\d\.\w]+)") - origre = re.compile("grid_directory=(G[\d\.\w]+)") + Gre = re.compile(r"\s*j=(G[\d\.\w]+)") + origre = re.compile(r"grid_directory=(G[\d\.\w]+)") try : fsock = open(exe) except Exception: @@ -5628,7 +5747,7 @@ def launch_job(self,exe, cwd=None, stdout=None, argument = [], remaining=0, text = fsock.read() output_files = Gre.findall(text) if not output_files: - Ire = re.compile("for i in ([\d\.\s]*) ; do") + Ire = re.compile(r"for i in ([\d\.\s]*) ; do") data = Ire.findall(text) data = ' '.join(data).split() for nb in data: @@ -6035,7 +6154,7 @@ def get_last_tag(self, level): 'syscalc':[], 'rivet':['rivet']} - if name == self.run_name: + if name and name == self.run_name: if reload_card: run_card = pjoin(self.me_dir, 'Cards','run_card.dat') self.run_card = banner_mod.RunCard(run_card) @@ -6334,7 +6453,7 @@ def run_syscalc(self, mode='parton', event_path=None, output=None): elif mode == 'Pythia': stdout = open(pjoin(event_dir, self.run_name, '%s_%s_syscalc.log' % (tag,mode)),'w') if 'mgpythiacard' in self.banner: - pat = re.compile('''^\s*qcut\s*=\s*([\+\-\d.e]*)''', re.M+re.I) + pat = re.compile(r'''^\s*qcut\s*=\s*([\+\-\d.e]*)''', re.M+re.I) data = pat.search(self.banner['mgpythiacard']) if data: qcut = float(data.group(1)) @@ -6611,7 +6730,7 @@ def get_subP_ids(path): for line in open(pjoin(path, 'leshouche.inc')): if not 'IDUP' in line: continue - particles = re.search("/([\d,-]+)/", line) + particles = re.search(r"/([\d,-]+)/", line) all_ids.append([int(p) for p in particles.group(1).split(',')]) return all_ids @@ -6899,6 +7018,7 @@ def do_combine_events(self, line): partials = 0 # if too many file make some partial unweighting sum_xsec, sum_xerru, sum_axsec = 0,[],0 + partials_info = [] Gdirs = self.get_Gdir() Gdirs.sort() for Gdir in Gdirs: @@ -6917,16 +7037,21 @@ def do_combine_events(self, line): sum_axsec += result.get('axsec')*gscalefact[Gdir] if len(AllEvent) >= 80: #perform a partial unweighting + nb_event = min(abs(1.01*self.nb_event*sum_axsec/self.results.current['cross']),self.run_card['nevents']) AllEvent.unweight(pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), - get_wgt, log_level=5, trunc_error=1e-2, event_target=self.nb_event) + get_wgt, log_level=5, trunc_error=1e-2, event_target=nb_event) AllEvent = lhe_parser.MultiEventFile() AllEvent.banner = self.banner - AllEvent.add(pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), + partials_info.append((pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), - sum_axsec) + sum_axsec) ) + sum_xsec, sum_xerru, sum_axsec = 0,[],0 partials +=1 + for data in partials_info: + AllEvent.add(*data) + if not hasattr(self,'proc_characteristic'): self.proc_characteristic = self.get_characteristics() diff --git a/epochX/cudacpp/gg_ttggg.mad/bin/internal/misc.py b/epochX/cudacpp/gg_ttggg.mad/bin/internal/misc.py index c4c669f36b..e7fd60be0d 100755 --- a/epochX/cudacpp/gg_ttggg.mad/bin/internal/misc.py +++ b/epochX/cudacpp/gg_ttggg.mad/bin/internal/misc.py @@ -67,7 +67,7 @@ def parse_info_str(fsock): """ info_dict = {} - pattern = re.compile("(?P\w*)\s*=\s*(?P.*)", + pattern = re.compile(r"(?P\w*)\s*=\s*(?P.*)", re.IGNORECASE | re.VERBOSE) for entry in fsock: entry = entry.strip() @@ -84,7 +84,7 @@ def parse_info_str(fsock): def glob(name, path=''): """call to glob.glob with automatic security on path""" import glob as glob_module - path = re.sub('(?P\?|\*|\[|\])', '[\g]', path) + path = re.sub(r'(?P\?|\*|\[|\])', r'[\g]', path) return glob_module.glob(pjoin(path, name)) #=============================================================================== @@ -614,10 +614,10 @@ def mod_compilator(directory, new='gfortran', current=None, compiler_type='gfort #search file file_to_change=find_makefile_in_dir(directory) if compiler_type == 'gfortran': - comp_re = re.compile('^(\s*)FC\s*=\s*(.+)\s*$') + comp_re = re.compile(r'^(\s*)FC\s*=\s*(.+)\s*$') var = 'FC' elif compiler_type == 'cpp': - comp_re = re.compile('^(\s*)CXX\s*=\s*(.+)\s*$') + comp_re = re.compile(r'^(\s*)CXX\s*=\s*(.+)\s*$') var = 'CXX' else: MadGraph5Error, 'Unknown compiler type: %s' % compiler_type @@ -861,9 +861,9 @@ def detect_current_compiler(path, compiler_type='fortran'): # comp = re.compile("^\s*FC\s*=\s*(\w+)\s*") # The regular expression below allows for compiler definition with absolute path if compiler_type == 'fortran': - comp = re.compile("^\s*FC\s*=\s*([\w\/\\.\-]+)\s*") + comp = re.compile("^\\s*FC\\s*=\\s*([\\w\\/\\.\\-]+)\\s*") elif compiler_type == 'cpp': - comp = re.compile("^\s*CXX\s*=\s*([\w\/\\.\-]+)\s*") + comp = re.compile("^\\s*CXX\\s*=\\s*([\\w\\/\\.\\-]+)\\s*") else: MadGraph5Error, 'Unknown compiler type: %s' % compiler_type @@ -1001,7 +1001,19 @@ def call_stdout(arg, *args, **opt): def copytree(src, dst, symlinks = False, ignore = None): if not os.path.exists(dst): os.makedirs(dst) - shutil.copystat(src, dst) + try: + shutil.copystat(src, dst) + except PermissionError: + if os.path.realpath(src).startswith('/cvmfs') and os.path.realpath(dst).startswith('/afs'): + # allowing missmatch from cvmfs to afs since sounds to not create issue --at least in general-- + logger.critical(f'Ignoring that we could not copy permissions from {src} to {dst}') + else: + logger.critical(f'Permission error detected from {src} to {dst}.\n'+\ + 'If you are using WSL with windows partition, please try using python3.12\n'+\ + 'or avoid moving your data from the WSL partition to the UNIX one') + # we do not have enough experience in WSL to allow it to get trough. + raise + lst = os.listdir(src) if ignore: excl = ignore(src, lst) @@ -1895,12 +1907,12 @@ class EasterEgg(object): May4_banner = "* _____ *\n" + \ "* ,-~\" \"~-. *\n" + \ "* * ,^ ___ ^. * *\n" + \ - "* * / .^ ^. \ * *\n" + \ + "* * / .^ ^. \\ * *\n" + \ "* * Y l o ! Y * *\n" + \ "* * l_ `.___.' _,[ * *\n" + \ "* * |^~\"--------------~\"\"^| * *\n" + \ "* * ! May the 4th ! * *\n" + \ - "* * \ / * *\n" + \ + "* * \\ / * *\n" + \ "* * ^. .^ * *\n" + \ "* * \"-.._____.,-\" * *\n" @@ -1909,13 +1921,13 @@ class EasterEgg(object): "* M::::::::::M M::::::::::M *\n" + \ "* M:::::::::::M M:::::::::::M (_)___ *\n" + \ "* M:::::::M::::M M::::M:::::::M | / __| *\n" + \ - "* M::::::M M::::M M::::M M::::::M | \__ \ *\n" + \ + "* M::::::M M::::M M::::M M::::::M | \\__ \\ *\n" + \ "* M::::::M M::::M::::M M::::::M |_|___/ *\n" + \ "* M::::::M M:::::::M M::::::M *\n" + \ "* M::::::M M:::::M M::::::M / _| ___ _ __ *\n" + \ - "* M::::::M MMMMM M::::::M | |_ / _ \| '__| *\n" + \ + "* M::::::M MMMMM M::::::M | |_ / _ \\| '__| *\n" + \ "* M::::::M M::::::M | _| (_) | | *\n" + \ - "* M::::::M M::::::M |_/\/\___/|_| *\n" + \ + "* M::::::M M::::::M |_/\\/\\___/|_| *\n" + \ "* M::::::M M::::::M *\n" + \ "* MMMMMMMM MMMMMMMM *\n" + \ "* *\n" + \ @@ -2233,39 +2245,51 @@ def import_python_lhapdf(lhapdfconfig): os.environ['LD_LIBRARY_PATH'] = lhapdf_libdir else: os.environ['LD_LIBRARY_PATH'] = '%s:%s' %(lhapdf_libdir,os.environ['LD_LIBRARY_PATH']) - try: candidates=[dirname for dirname in os.listdir(lhapdf_libdir) \ if os.path.isdir(os.path.join(lhapdf_libdir,dirname))] except OSError: candidates=[] + if os.path.isdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')): + candidates += [pjoin(os.pardir,'local', 'lib', dirname) for dirname in os.listdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')) + if os.path.isdir(os.path.join(lhapdf_libdir,os.pardir, 'local', 'lib', dirname))] for candidate in candidates: - if os.path.isdir(os.path.join(lhapdf_libdir,candidate,'site-packages')): - sys.path.insert(0,os.path.join(lhapdf_libdir,candidate,'site-packages')) - try: - import lhapdf - use_lhapdf=True - break - except ImportError: - sys.path.pop(0) - continue + for subdir in ['site-packages', 'dist-packages']: + if os.path.isdir(os.path.join(lhapdf_libdir,candidate, subdir)): + sys.path.insert(0,os.path.join(lhapdf_libdir,candidate, subdir)) + try: + import lhapdf + use_lhapdf=True + break + except ImportError as error: + sys.path.pop(0) + continue + else: + continue + break if not use_lhapdf: try: candidates=[dirname for dirname in os.listdir(lhapdf_libdir+'64') \ if os.path.isdir(os.path.join(lhapdf_libdir+'64',dirname))] except OSError: candidates=[] - + if os.path.isdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib64')): + candidates += [pjoin(os.pardir,'local', 'lib64', dirname) for dirname in os.listdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')) + if os.path.isdir(os.path.join(lhapdf_libdir,os.pardir, 'local', 'lib64', dirname))] for candidate in candidates: - if os.path.isdir(os.path.join(lhapdf_libdir+'64',candidate,'site-packages')): - sys.path.insert(0,os.path.join(lhapdf_libdir+'64',candidate,'site-packages')) - try: - import lhapdf - use_lhapdf=True - break - except ImportError: - sys.path.pop(0) - continue + for subdir in ['site-packages', 'dist-packages']: + if os.path.isdir(os.path.join(lhapdf_libdir+'64',candidate, subdir)): + sys.path.insert(0,os.path.join(lhapdf_libdir+'64',candidate, subdir)) + try: + import lhapdf + use_lhapdf=True + break + except ImportError as error: + sys.path.pop(0) + continue + else: + continue + break if not use_lhapdf: try: import lhapdf diff --git a/epochX/cudacpp/gg_ttggg.mad/bin/internal/shower_card.py b/epochX/cudacpp/gg_ttggg.mad/bin/internal/shower_card.py index e87d534177..16ed72b1a0 100755 --- a/epochX/cudacpp/gg_ttggg.mad/bin/internal/shower_card.py +++ b/epochX/cudacpp/gg_ttggg.mad/bin/internal/shower_card.py @@ -288,7 +288,7 @@ def write(self, output_file, template=None, python_template=False, self.text = open(template,'r').read() - key_re = re.compile('^(\s*)([\S^#]+)(\s*)=(\s*)([^#]*?)(\s*)(\#.*|$)') + key_re = re.compile(r'^(\s*)([\S^#]+)(\s*)=(\s*)([^#]*?)(\s*)(\#.*|$)') newlines = [] for line in self.text.split('\n'): key_match = key_re.findall(line) diff --git a/epochX/cudacpp/gg_ttggg.mad/bin/internal/systematics.py b/epochX/cudacpp/gg_ttggg.mad/bin/internal/systematics.py index 28eaed00e2..2acebd087c 100644 --- a/epochX/cudacpp/gg_ttggg.mad/bin/internal/systematics.py +++ b/epochX/cudacpp/gg_ttggg.mad/bin/internal/systematics.py @@ -582,7 +582,7 @@ def print_cross_sections(self, all_cross, nb_event, stdout): else: resume.write( '#PDF %s: %g +%2.3g%% -%2.3g%%\n' % (pdfset.name, pdferr.central,pdferr.errplus*100/all_cross[0], pdferr.errminus*100/all_cross[0])) - dyn_name = {1: '\sum ET', 2:'\sum\sqrt{m^2+pt^2}', 3:'0.5 \sum\sqrt{m^2+pt^2}',4:'\sqrt{\hat s}' } + dyn_name = {1: r'\sum ET', 2:r'\sum\sqrt{m^2+pt^2}', 3:r'0.5 \sum\sqrt{m^2+pt^2}',4:r'\sqrt{\hat s}' } for key, curr in dyns.items(): if key ==-1: continue @@ -789,7 +789,7 @@ def get_id(self): return int(self.start_wgt_id) if 'initrwgt' in self.banner: - pattern = re.compile(' set lhapdf /PATH/TO/lhapdf-config -None does not seem to correspond to a valid lhapdf-config executable. -Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config). -Note that you can still compile and run aMC@NLO with the built-in PDFs - MG5_aMC> set lhapdf /PATH/TO/lhapdf-config - Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt -import /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttggg.mg +import /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttggg.mg The import format was not given, so we guess it as command set stdout_level DEBUG set output information to level: 10 @@ -62,7 +57,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.005467414855957031  +DEBUG: model prefixing takes 0.005609273910522461  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,17 +150,16 @@ 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.898 s +1 processes with 1240 diagrams generated in 1.925 s Total: 1 processes with 1240 diagrams output standalone_cudacpp ../TMPOUT/CODEGEN_cudacpp_gg_ttggg Load PLUGIN.CUDACPP_OUTPUT -Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.5.3_lo_vect. +Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.6.0_lo_vect. It has been validated for the last time with version: 3.5.2 Output will be done with PLUGIN: CUDACPP_OUTPUT -DEBUG: cformat =  plugin [export_cpp.py at line 3070]  DEBUG: Entering PLUGIN_ProcessExporter.__init__ (initialise the exporter) [output.py at line 165]  DEBUG: Entering PLUGIN_ProcessExporter.copy_template (initialise the directory) [output.py at line 170]  -INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttggg +INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttggg INFO: Organizing processes into subprocess groups INFO: Generating Helas calls for process: g g > t t~ g g g WEIGHTED<=5 @1 INFO: Processing color information for process: g g > t t~ g g g @1 @@ -174,18 +168,18 @@ INFO: Processing color information for process: g g > t t~ g g g @1 DEBUG: type(fortran_model)= [output.py at line 214]  DEBUG: type(me)= me=0 [output.py at line 215]  DEBUG: "need to link", self.to_link_in_P =  need to link ['nvtx.h', 'timer.h', 'timermap.h', 'ompnumthreads.h', 'GpuRuntime.h', 'GpuAbstraction.h', 'MemoryAccessHelpers.h', 'MemoryAccessVectors.h', 'MemoryAccessMatrixElements.h', 'MemoryAccessMomenta.h', 'MemoryAccessRandomNumbers.h', 'MemoryAccessWeights.h', 'MemoryAccessAmplitudes.h', 'MemoryAccessWavefunctions.h', 'MemoryAccessGs.h', 'MemoryAccessCouplingsFixed.h', 'MemoryAccessNumerators.h', 'MemoryAccessDenominators.h', 'MemoryAccessChannelIds.h', 'EventStatistics.h', 'CommonRandomNumbers.h', 'CrossSectionKernels.cc', 'CrossSectionKernels.h', 'MatrixElementKernels.cc', 'MatrixElementKernels.h', 'RamboSamplingKernels.cc', 'RamboSamplingKernels.h', 'RandomNumberKernels.h', 'CommonRandomNumberKernel.cc', 'CurandRandomNumberKernel.cc', 'HiprandRandomNumberKernel.cc', 'Bridge.h', 'BridgeKernels.cc', 'BridgeKernels.h', 'fbridge.cc', 'fbridge.inc', 'fsampler.cc', 'fsampler.inc', 'MadgraphTest.h', 'runTest.cc', 'testmisc.cc', 'testxxx_cc_ref.txt', 'valgrind.h', 'cudacpp.mk', 'testxxx.cc', 'MemoryBuffers.h', 'MemoryAccessCouplings.h', 'perf.py', 'profile.sh'] [output.py at line 216]  -INFO: Creating files in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttggg/SubProcesses/P1_Sigma_sm_gg_ttxggg -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttggg/SubProcesses/P1_Sigma_sm_gg_ttxggg/./CPPProcess.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttggg/SubProcesses/P1_Sigma_sm_gg_ttxggg/./CPPProcess.cc -INFO: Created files CPPProcess.h and CPPProcess.cc in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttggg/SubProcesses/P1_Sigma_sm_gg_ttxggg/. -Generated helas calls for 1 subprocesses (1240 diagrams) in 6.697 s +INFO: Creating files in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttggg/SubProcesses/P1_Sigma_sm_gg_ttxggg +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttggg/SubProcesses/P1_Sigma_sm_gg_ttxggg/./CPPProcess.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttggg/SubProcesses/P1_Sigma_sm_gg_ttxggg/./CPPProcess.cc +INFO: Created files CPPProcess.h and CPPProcess.cc in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttggg/SubProcesses/P1_Sigma_sm_gg_ttxggg/. +Generated helas calls for 1 subprocesses (1240 diagrams) in 6.699 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.350 s +ALOHA: aloha creates 5 routines in 0.354 s VVV1 VVV1 FFV1 @@ -198,17 +192,17 @@ ALOHA: aloha creates 5 routines in 0.350 s VVVV3 VVVV4 VVVV4 -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttggg/src/./HelAmps_sm.h -INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttggg/src/. +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttggg/src/./HelAmps_sm.h +INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttggg/src/. super_write_set_parameters_onlyfixMajorana (hardcoded=False) super_write_set_parameters_onlyfixMajorana (hardcoded=True) -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttggg/src/./Parameters_sm.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttggg/src/./Parameters_sm.cc +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttggg/src/./Parameters_sm.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttggg/src/./Parameters_sm.cc INFO: Created files Parameters_sm.h and Parameters_sm.cc in directory -INFO: /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttggg/src/. and /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttggg/src/. +INFO: /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttggg/src/. and /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gg_ttggg/src/. quit -real 0m13.364s -user 0m13.053s -sys 0m0.114s -Code generation completed in 14 seconds +real 0m13.246s +user 0m13.071s +sys 0m0.121s +Code generation completed in 13 seconds 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 0173a6def8..ac9431cf42 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 @@ -14,7 +14,7 @@ Running MG5 in debug mode * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect 2023-12-23 * +* VERSION 3.6.0_lo_vect 2024-06-17 * * * * WARNING: UNKNOWN DEVELOPMENT VERSION. * * WARNING: DO NOT USE FOR PRODUCTION * @@ -45,15 +45,10 @@ Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (inclu Note that you can still compile and run aMC@NLO with the built-in PDFs MG5_aMC> set lhapdf /PATH/TO/lhapdf-config -None does not seem to correspond to a valid lhapdf-config executable. -Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config). -Note that you can still compile and run aMC@NLO with the built-in PDFs - MG5_aMC> set lhapdf /PATH/TO/lhapdf-config - Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt -import /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq.mg +import /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq.mg The import format was not given, so we guess it as command set stdout_level DEBUG set output information to level: 10 @@ -61,7 +56,7 @@ set zerowidth_tchannel F define q = u c d s u~ c~ d~ s~ INFO: load particles INFO: load vertices -DEBUG: model prefixing takes 0.005719423294067383  +DEBUG: model prefixing takes 0.0056684017181396484  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  @@ -170,24 +165,24 @@ 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.079 s +8 processes with 40 diagrams generated in 0.080 s Total: 8 processes with 40 diagrams output madevent_simd ../TMPOUT/CODEGEN_mad_gq_ttq --hel_recycling=False --vector_size=32 Load PLUGIN.CUDACPP_OUTPUT -Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.5.3_lo_vect. +Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.6.0_lo_vect. It has been validated for the last time with version: 3.5.2 Output will be done with PLUGIN: CUDACPP_OUTPUT Addition matrix-element will be done with PLUGIN: CUDACPP_OUTPUT +DEBUG: opt['output_options']['vector_size'] =  32 [export_v4.py at line 4334]  Output will be done with PLUGIN: CUDACPP_OUTPUT -DEBUG: cformat =  standalone_simd [export_cpp.py at line 3070]  DEBUG: Entering PLUGIN_ProcessExporter.__init__ (initialise the exporter) [output.py at line 165]  INFO: initialize a new directory: CODEGEN_mad_gq_ttq INFO: remove old information in CODEGEN_mad_gq_ttq DEBUG: Entering PLUGIN_ProcessExporter.copy_template (initialise the directory) [output.py at line 170]  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq  -INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/Cards  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/SubProcesses  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq  +INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/Cards  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/SubProcesses  INFO: Organizing processes into subprocess groups INFO: Generating Helas calls for process: g u > t t~ u WEIGHTED<=3 @1 INFO: Processing color information for process: g u > t t~ u @1 @@ -205,13 +200,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5] [export_cpp.py at line 711]  -DEBUG: subproc_number =  0 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: g u > t t~ u WEIGHTED<=3 @1 INFO: Finding symmetric diagrams for subprocess group gu_ttxu -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/SubProcesses/P1_gu_ttxu [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  5 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5} [model_handling.py at line 1548]  @@ -221,70 +211,71 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5] [export_cpp.py at line 711]  -DEBUG: subproc_number =  1 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: g u~ > t t~ u~ WEIGHTED<=3 @1 INFO: Finding symmetric diagrams for subprocess group gux_ttxux -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/SubProcesses/P1_gux_ttxux [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  5 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5} [model_handling.py at line 1548]  -Generated helas calls for 2 subprocesses (10 diagrams) in 0.032 s -Wrote files for 32 helas calls in 0.184 s +Generated helas calls for 2 subprocesses (10 diagrams) in 0.031 s +Wrote files for 32 helas calls in 0.167 s +DEBUG: self.vector_size =  32 [export_v4.py at line 7023]  ALOHA: aloha starts to compute helicity amplitudes ALOHA: aloha creates FFV1 routines ALOHA: aloha creates VVV1 routines -ALOHA: aloha creates 2 routines in 0.148 s +ALOHA: aloha creates 2 routines in 0.147 s ALOHA: aloha starts to compute helicity amplitudes ALOHA: aloha creates FFV1 routines ALOHA: aloha creates VVV1 routines -ALOHA: aloha creates 4 routines in 0.134 s +ALOHA: aloha creates 4 routines in 0.135 s FFV1 FFV1 FFV1 FFV1 VVV1 -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/src/./HelAmps_sm.h -INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/src/. +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/src/./HelAmps_sm.h +INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/src/. super_write_set_parameters_onlyfixMajorana (hardcoded=False) super_write_set_parameters_onlyfixMajorana (hardcoded=True) -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/src/./Parameters_sm.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/src/./Parameters_sm.cc +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/src/./Parameters_sm.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/src/./Parameters_sm.cc INFO: Created files Parameters_sm.h and Parameters_sm.cc in directory -INFO: /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/src/. and /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/src/. +INFO: /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/src/. and /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/src/. The option zerowidth_tchannel is modified [True] but will not be written in the configuration files. If you want to make this value the default for future session, you can run 'save options --all' -save configuration file to /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/Cards/me5_configuration.txt +save configuration file to /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/Cards/me5_configuration.txt INFO: Use Fortran compiler gfortran INFO: Use c++ compiler g++ INFO: Generate jpeg diagrams INFO: Generate web pages -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common -patching file Source/genps.inc +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common patching file SubProcesses/makefile -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/SubProcesses/P1_gu_ttxu; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/SubProcesses/P1_gu_ttxu; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 75 (offset 3 lines). -Hunk #2 succeeded at 259 (offset 26 lines). -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/SubProcesses/P1_gux_ttxux; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #1 succeeded at 74 (offset 3 lines). +Hunk #2 succeeded at 254 (offset 40 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/SubProcesses/P1_gux_ttxux; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 75 (offset 3 lines). -Hunk #2 succeeded at 259 (offset 26 lines). +Hunk #1 succeeded at 74 (offset 3 lines). +Hunk #2 succeeded at 254 (offset 40 lines). DEBUG: p.returncode =  0 [output.py at line 258]  -Output to directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq done. +Output to directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq done. Type "launch" to generate events from this process, or see -/data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/README +/data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/README Run "open index.html" to see more information about this process. quit -real 0m2.246s -user 0m1.907s -sys 0m0.311s -Code generation completed in 3 seconds +real 0m2.217s +user 0m1.918s +sys 0m0.291s +Code generation completed in 2 seconds ************************************************************ * * * W E L C O M E to * @@ -297,7 +288,7 @@ Code generation completed in 3 seconds * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect * +* VERSION 3.6.0_lo_vect * * * * The MadGraph5_aMC@NLO Development Team - Find us at * * https://server06.fynu.ucl.ac.be/projects/madgraph * @@ -305,9 +296,9 @@ Code generation completed in 3 seconds * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt @@ -327,7 +318,7 @@ launch in debug mode * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect * +* VERSION 3.6.0_lo_vect * * * * The MadGraph5_aMC@NLO Development Team - Find us at * * https://server06.fynu.ucl.ac.be/projects/madgraph * @@ -335,9 +326,9 @@ launch in debug mode * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt diff --git a/epochX/cudacpp/gq_ttq.mad/Cards/me5_configuration.txt b/epochX/cudacpp/gq_ttq.mad/Cards/me5_configuration.txt index cdeedc7863..4f5079f78a 100644 --- a/epochX/cudacpp/gq_ttq.mad/Cards/me5_configuration.txt +++ b/epochX/cudacpp/gq_ttq.mad/Cards/me5_configuration.txt @@ -116,6 +116,7 @@ # cluster_type = condor # cluster_queue = madgraph # cluster_size = 150 +# cluster_walltime = # time in minute for slurm and second for condor (not supported for other scheduller) #! Path to a node directory to avoid direct writing on the central disk #! Note that condor clusters avoid direct writing by default (therefore this @@ -234,7 +235,7 @@ # pineappl = pineappl -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo # MG5 MAIN DIRECTORY -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo diff --git a/epochX/cudacpp/gq_ttq.mad/Cards/param_card.dat b/epochX/cudacpp/gq_ttq.mad/Cards/param_card.dat index caf4a67ea8..bb150ef10d 100644 --- a/epochX/cudacpp/gq_ttq.mad/Cards/param_card.dat +++ b/epochX/cudacpp/gq_ttq.mad/Cards/param_card.dat @@ -1,5 +1,5 @@ ###################################################################### -## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL #### +## PARAM_CARD AUTOMATICALLY GENERATED BY MG5 FOLLOWING UFO MODEL #### ###################################################################### ## ## ## Width set on Auto will be computed following the information ## diff --git a/epochX/cudacpp/gq_ttq.mad/Cards/param_card_default.dat b/epochX/cudacpp/gq_ttq.mad/Cards/param_card_default.dat index caf4a67ea8..bb150ef10d 100644 --- a/epochX/cudacpp/gq_ttq.mad/Cards/param_card_default.dat +++ b/epochX/cudacpp/gq_ttq.mad/Cards/param_card_default.dat @@ -1,5 +1,5 @@ ###################################################################### -## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL #### +## PARAM_CARD AUTOMATICALLY GENERATED BY MG5 FOLLOWING UFO MODEL #### ###################################################################### ## ## ## Width set on Auto will be computed following the information ## diff --git a/epochX/cudacpp/gq_ttq.mad/Cards/proc_card_mg5.dat b/epochX/cudacpp/gq_ttq.mad/Cards/proc_card_mg5.dat index deab56cf41..6213a9324b 100644 --- a/epochX/cudacpp/gq_ttq.mad/Cards/proc_card_mg5.dat +++ b/epochX/cudacpp/gq_ttq.mad/Cards/proc_card_mg5.dat @@ -8,7 +8,7 @@ #* * * * #* * #* * -#* VERSION 3.5.3_lo_vect 2023-12-23 * +#* VERSION 3.6.0_lo_vect 2024-06-17 * #* * #* WARNING: UNKNOWN DEVELOPMENT VERSION. * #* WARNING: DO NOT USE FOR PRODUCTION * diff --git a/epochX/cudacpp/gq_ttq.mad/Cards/reweight_card_default.dat b/epochX/cudacpp/gq_ttq.mad/Cards/reweight_card_default.dat index ace534ae02..5cc65fe095 100644 --- a/epochX/cudacpp/gq_ttq.mad/Cards/reweight_card_default.dat +++ b/epochX/cudacpp/gq_ttq.mad/Cards/reweight_card_default.dat @@ -19,8 +19,16 @@ change mode NLO # Define type of Reweighting. For LO sample this command # has no effect since only "LO" mode is allowed. + +#uncomment if you do not want to overwrite the reweight file of Sudakov in rw_me +#change rwgt_dir /PATH_MG5_BRANCH/NAME_FOLDER + +#uncomment if you want to use Sudakov Reweight +#change include_sudakov True + launch + # SPECIFY A PATH OR USE THE SET COMMAND LIKE THIS: # set sminputs 1 130 # modify 1/alpha_EW diff --git a/epochX/cudacpp/gq_ttq.mad/Cards/run_card.dat b/epochX/cudacpp/gq_ttq.mad/Cards/run_card.dat index b016597d23..66a805e521 100644 --- a/epochX/cudacpp/gq_ttq.mad/Cards/run_card.dat +++ b/epochX/cudacpp/gq_ttq.mad/Cards/run_card.dat @@ -162,6 +162,7 @@ systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++] ['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule + #*********************************************************************** # SIMD/GPU configuration for the CUDACPP plugin #************************************************************************ diff --git a/epochX/cudacpp/gq_ttq.mad/Cards/run_card_default.dat b/epochX/cudacpp/gq_ttq.mad/Cards/run_card_default.dat index e0dabc3b73..8c0f1e2199 100644 --- a/epochX/cudacpp/gq_ttq.mad/Cards/run_card_default.dat +++ b/epochX/cudacpp/gq_ttq.mad/Cards/run_card_default.dat @@ -162,6 +162,7 @@ systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++] ['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule + #*********************************************************************** # SIMD/GPU configuration for the CUDACPP plugin #************************************************************************ diff --git a/epochX/cudacpp/gq_ttq.mad/MGMEVersion.txt b/epochX/cudacpp/gq_ttq.mad/MGMEVersion.txt index 9d3a5c0ba0..a806d3938c 100644 --- a/epochX/cudacpp/gq_ttq.mad/MGMEVersion.txt +++ b/epochX/cudacpp/gq_ttq.mad/MGMEVersion.txt @@ -1 +1 @@ -3.5.3_lo_vect \ No newline at end of file +3.6.0_lo_vect \ No newline at end of file diff --git a/epochX/cudacpp/gq_ttq.mad/Source/DHELAS/aloha_functions.f b/epochX/cudacpp/gq_ttq.mad/Source/DHELAS/aloha_functions.f index 975725737f..47699fa614 100644 --- a/epochX/cudacpp/gq_ttq.mad/Source/DHELAS/aloha_functions.f +++ b/epochX/cudacpp/gq_ttq.mad/Source/DHELAS/aloha_functions.f @@ -351,7 +351,7 @@ subroutine oxxxxx(p,fmass,nhel,nsf , fo) fo(6) = ip * sqm(abs(im)) else - pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2)) +c pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2)) sf(1) = dble(1+nsf+(1-nsf)*nh)*rHalf sf(2) = dble(1+nsf-(1-nsf)*nh)*rHalf omega(1) = dsqrt(p(0)+pp) @@ -2054,7 +2054,7 @@ subroutine CombineAmp(nb, ihels, iwfcts, W1, Wall, Amp) enddo return end - + subroutine CombineAmpS(nb, ihels, iwfcts, W1, Wall, Amp) integer nb ! size of the vectors diff --git a/epochX/cudacpp/gq_ttq.mad/Source/MODEL/couplings.f b/epochX/cudacpp/gq_ttq.mad/Source/MODEL/couplings.f index f3b620ab58..04d6bb5333 100644 --- a/epochX/cudacpp/gq_ttq.mad/Source/MODEL/couplings.f +++ b/epochX/cudacpp/gq_ttq.mad/Source/MODEL/couplings.f @@ -10,18 +10,27 @@ SUBROUTINE COUP() PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + LOGICAL UPDATELOOP COMMON /TO_UPDATELOOP/UPDATELOOP INCLUDE 'input.inc' - INCLUDE '../vector.inc' + + INCLUDE 'coupl.inc' READLHA = .TRUE. INCLUDE 'intparam_definition.inc' CALL COUP1() + IF (UPDATELOOP) THEN + + CALL COUP2() + + ENDIF + C couplings needed to be evaluated points by points C - CALL COUP2(1) + CALL COUP3(1) RETURN END @@ -47,7 +56,11 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) INCLUDE '../maxparticles.inc' INCLUDE '../cuts.inc' + + INCLUDE '../vector.inc' + + INCLUDE '../run.inc' DOUBLE PRECISION ALPHAS @@ -65,7 +78,7 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) couplings needed to be evaluated points by points C ALL_G(VECID) = G - CALL COUP2(VECID) + CALL COUP3(VECID) RETURN END @@ -80,7 +93,9 @@ SUBROUTINE UPDATE_AS_PARAM2(MU_R2,AS2 ,VECID) INTEGER VECID INCLUDE 'model_functions.inc' INCLUDE 'input.inc' + INCLUDE '../vector.inc' + INCLUDE 'coupl.inc' DOUBLE PRECISION MODEL_SCALE COMMON /MODEL_SCALE/MODEL_SCALE diff --git a/epochX/cudacpp/gq_ttq.mad/Source/MODEL/couplings1.f b/epochX/cudacpp/gq_ttq.mad/Source/MODEL/couplings1.f index e14f3a1770..72cfa0f6e4 100644 --- a/epochX/cudacpp/gq_ttq.mad/Source/MODEL/couplings1.f +++ b/epochX/cudacpp/gq_ttq.mad/Source/MODEL/couplings1.f @@ -7,11 +7,12 @@ SUBROUTINE COUP1( ) IMPLICIT NONE INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' END diff --git a/epochX/cudacpp/gq_ttq.mad/Source/MODEL/couplings2.f b/epochX/cudacpp/gq_ttq.mad/Source/MODEL/couplings2.f index be9e9f5a39..30f3a04e3b 100644 --- a/epochX/cudacpp/gq_ttq.mad/Source/MODEL/couplings2.f +++ b/epochX/cudacpp/gq_ttq.mad/Source/MODEL/couplings2.f @@ -2,18 +2,17 @@ c written by the UFO converter ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc - SUBROUTINE COUP2( VECID) + SUBROUTINE COUP2( ) IMPLICIT NONE - INTEGER VECID + INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' - GC_10(VECID) = -G - GC_11(VECID) = MDL_COMPLEXI*G END diff --git a/epochX/cudacpp/gq_ttq.mad/Source/MODEL/couplings3.f b/epochX/cudacpp/gq_ttq.mad/Source/MODEL/couplings3.f index c77bd60b5a..2d4127fa27 100644 --- a/epochX/cudacpp/gq_ttq.mad/Source/MODEL/couplings3.f +++ b/epochX/cudacpp/gq_ttq.mad/Source/MODEL/couplings3.f @@ -7,12 +7,13 @@ SUBROUTINE COUP3( VECID) IMPLICIT NONE INTEGER VECID INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' GC_10(VECID) = -G GC_11(VECID) = MDL_COMPLEXI*G diff --git a/epochX/cudacpp/gq_ttq.mad/Source/MODEL/makefile b/epochX/cudacpp/gq_ttq.mad/Source/MODEL/makefile index 0b24445a53..5a5681d220 100644 --- a/epochX/cudacpp/gq_ttq.mad/Source/MODEL/makefile +++ b/epochX/cudacpp/gq_ttq.mad/Source/MODEL/makefile @@ -3,7 +3,7 @@ # Makefile for model library # # ---------------------------------------------------------------------------- - +# template models/template_files/makefile_madevent # Check for ../make_opts ifeq ($(wildcard ../make_opts), ../make_opts) include ../make_opts diff --git a/epochX/cudacpp/gq_ttq.mad/Source/MODEL/makeinc.inc b/epochX/cudacpp/gq_ttq.mad/Source/MODEL/makeinc.inc index 6e2743eac1..4a9e1b2cc5 100644 --- a/epochX/cudacpp/gq_ttq.mad/Source/MODEL/makeinc.inc +++ b/epochX/cudacpp/gq_ttq.mad/Source/MODEL/makeinc.inc @@ -2,4 +2,4 @@ # written by the UFO converter ############################################################################# -MODEL = couplings.o lha_read.o printout.o rw_para.o model_functions.o couplings1.o couplings2.o \ No newline at end of file +MODEL = couplings.o lha_read.o printout.o rw_para.o model_functions.o couplings1.o couplings2.o couplings3.o \ No newline at end of file diff --git a/epochX/cudacpp/gq_ttq.mad/Source/MODEL/printout.f b/epochX/cudacpp/gq_ttq.mad/Source/MODEL/printout.f index 18b8f35b08..3e195b03a2 100644 --- a/epochX/cudacpp/gq_ttq.mad/Source/MODEL/printout.f +++ b/epochX/cudacpp/gq_ttq.mad/Source/MODEL/printout.f @@ -1,3 +1,7 @@ +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +c written by the UFO converter +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc + c************************************************************************ c** ** c** MadGraph/MadEvent Interface to FeynRules ** @@ -9,7 +13,7 @@ subroutine printout implicit none - include '../vector.inc' ! defines VECSIZE_MEMMAX + include '../vector.inc' ! VECSIZE_MEMMAX (needed by coupl.inc) include 'coupl.inc' ! needs VECSIZE_MEMMAX (defined in vector.inc) include 'input.inc' diff --git a/epochX/cudacpp/gq_ttq.mad/Source/PDF/eepdf.inc b/epochX/cudacpp/gq_ttq.mad/Source/PDF/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/gq_ttq.mad/Source/PDF/eepdf.inc +++ b/epochX/cudacpp/gq_ttq.mad/Source/PDF/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/gq_ttq.mad/Source/PDF/pdfwrap_emela.f b/epochX/cudacpp/gq_ttq.mad/Source/PDF/pdfwrap_emela.f index bce10819d5..da1e4e2276 100644 --- a/epochX/cudacpp/gq_ttq.mad/Source/PDF/pdfwrap_emela.f +++ b/epochX/cudacpp/gq_ttq.mad/Source/PDF/pdfwrap_emela.f @@ -13,7 +13,7 @@ SUBROUTINE PDFWRAP DOUBLE PRECISION VALUE(20) REAL*8 ALPHASPDF EXTERNAL ALPHASPDF - ! PDFs with beamstrahlung use specific initialisation/evaluation +C PDFs with beamstrahlung use specific initialisation/evaluation LOGICAL HAS_BSTRAHL COMMON /TO_HAS_BS/ HAS_BSTRAHL diff --git a/epochX/cudacpp/gq_ttq.mad/Source/PDF/pdg2pdf.f b/epochX/cudacpp/gq_ttq.mad/Source/PDF/pdg2pdf.f index 46f321e66b..2e7343a69b 100644 --- a/epochX/cudacpp/gq_ttq.mad/Source/PDF/pdg2pdf.f +++ b/epochX/cudacpp/gq_ttq.mad/Source/PDF/pdg2pdf.f @@ -108,7 +108,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) else if (abs(ipart).eq.10) then ipart = sign(1,ipart) * 15 endif - pdg2pdf = 0d0 + pdg2pdf = 0d0 if (beamid.lt.0) then ih_local = ipart @@ -122,7 +122,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) endif do i_ee = 1, n_ee ee_components(i_ee) = compute_eepdf(x,omx_ee(iabs(beamid)),xmu,i_ee,ipart,ih_local) - enddo + enddo pdg2pdf = ee_components(1) ! temporary to test pdf load c write(*,*), x, beamid ,omx_ee(iabs(beamid)),xmu,1,ipart,ih_local,pdg2pdf return diff --git a/epochX/cudacpp/gq_ttq.mad/Source/dsample.f b/epochX/cudacpp/gq_ttq.mad/Source/dsample.f index 09d482b45a..b0bc0547ad 100644 --- a/epochX/cudacpp/gq_ttq.mad/Source/dsample.f +++ b/epochX/cudacpp/gq_ttq.mad/Source/dsample.f @@ -204,6 +204,9 @@ subroutine sample_full(ndim,ncall,itmax,itmin,dsig,ninvar,nconfigs,VECSIZE_USED) if (VECSIZE_USED.le.1) then all_fx(1) = dsig(all_p, all_wgt,0) + ivec=0 + ilock=0 + iwarp=1 else c Here "i" is the position in the full grid of the event do i=(iwarp-1)*WARP_SIZE+1, iwarp*warp_size diff --git a/epochX/cudacpp/gq_ttq.mad/Source/eepdf.inc b/epochX/cudacpp/gq_ttq.mad/Source/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/gq_ttq.mad/Source/eepdf.inc +++ b/epochX/cudacpp/gq_ttq.mad/Source/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/gq_ttq.mad/Source/genps.inc b/epochX/cudacpp/gq_ttq.mad/Source/genps.inc index af7e0efbce..ef78e7e812 100644 --- a/epochX/cudacpp/gq_ttq.mad/Source/genps.inc +++ b/epochX/cudacpp/gq_ttq.mad/Source/genps.inc @@ -29,9 +29,8 @@ c parameter (max_host=99,maxplace=199,maxpoints=100,maxans=50) c************************************************************************* c Parameters for helicity sums in matrixN.f c************************************************************************* - REAL*8 LIMHEL -c PARAMETER(LIMHEL=1e-8) ! ME threshold for helicity filtering (Fortran default) - PARAMETER(LIMHEL=0) ! ME threshold for helicity filtering (force Fortran to mimic cudacpp, see #419) +c REAL*8 LIMHEL +c PARAMETER(LIMHEL=1e-8) -> pass in the run_card.dat INTEGER MAXTRIES PARAMETER(MAXTRIES=25) C To pass the helicity configuration chosen by the DiscreteSampler to diff --git a/epochX/cudacpp/gq_ttq.mad/Source/run.inc b/epochX/cudacpp/gq_ttq.mad/Source/run.inc index 5433a23583..81c8df6bf2 100644 --- a/epochX/cudacpp/gq_ttq.mad/Source/run.inc +++ b/epochX/cudacpp/gq_ttq.mad/Source/run.inc @@ -106,4 +106,7 @@ c double precision tmin_for_channel integer sde_strat ! 1 means standard single diagram enhancement strategy, c 2 means approximation by the denominator of the propagator - common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat \ No newline at end of file + common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat +c + double precision limhel + common/to_limhel/limhel diff --git a/epochX/cudacpp/gq_ttq.mad/Source/run_card.inc b/epochX/cudacpp/gq_ttq.mad/Source/run_card.inc index 67af0f2051..1a1bc782bd 100644 --- a/epochX/cudacpp/gq_ttq.mad/Source/run_card.inc +++ b/epochX/cudacpp/gq_ttq.mad/Source/run_card.inc @@ -88,6 +88,8 @@ DSQRT_SHAT = 0.000000000000000D+00 + LIMHEL = 0.000000000000000D+00 + PTJ = 2.000000000000000D+01 PTB = 0.000000000000000D+00 diff --git a/epochX/cudacpp/gq_ttq.mad/Source/setrun.f b/epochX/cudacpp/gq_ttq.mad/Source/setrun.f index 9e9ef7fdbd..dc6caef748 100644 --- a/epochX/cudacpp/gq_ttq.mad/Source/setrun.f +++ b/epochX/cudacpp/gq_ttq.mad/Source/setrun.f @@ -162,9 +162,21 @@ subroutine setrun C Fill common block for Les Houches init info do i=1,2 if(lpp(i).eq.1.or.lpp(i).eq.2) then - idbmup(i)=2212 + if (nb_proton(i).eq.1.and.nb_neutron(i).eq.0) then + idbmup(i)=2212 + elseif (nb_proton(i).eq.0.and.nb_neutron(i).eq.1) then + idbmup(i)=2112 + else + idbmup(i) = 1000000000 + (nb_proton(i)+nb_neutron(i))*10 + $ + nb_proton(i)*10000 + endif elseif(lpp(i).eq.-1.or.lpp(i).eq.-2) then - idbmup(i)=-2212 + if (nb_proton(i).eq.1.and.nb_neutron(i).eq.0) then + idbmup(i)=-2212 + else + idbmup(i) = -1*(1000000000 + (nb_proton(i)+nb_neutron(i))*10 + $ + nb_proton(i)*10000) + endif elseif(lpp(i).eq.3) then idbmup(i)=11 elseif(lpp(i).eq.-3) then diff --git a/epochX/cudacpp/gq_ttq.mad/SubProcesses/MGVersion.txt b/epochX/cudacpp/gq_ttq.mad/SubProcesses/MGVersion.txt index 9d3a5c0ba0..a806d3938c 100644 --- a/epochX/cudacpp/gq_ttq.mad/SubProcesses/MGVersion.txt +++ b/epochX/cudacpp/gq_ttq.mad/SubProcesses/MGVersion.txt @@ -1 +1 @@ -3.5.3_lo_vect \ No newline at end of file +3.6.0_lo_vect \ No newline at end of file diff --git a/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/CPPProcess.cc b/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/CPPProcess.cc index f0179d1f0d..03174bc366 100644 --- a/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/CPPProcess.cc +++ b/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/CPPProcess.h b/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/CPPProcess.h index 5200762ff8..9ee06a68ef 100644 --- a/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/CPPProcess.h +++ b/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/auto_dsig.f b/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/auto_dsig.f index 3a34c54b34..eb78c27eb4 100644 --- a/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/auto_dsig.f +++ b/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1137,11 +1137,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=32) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1151,32 +1152,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=32) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=32) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/auto_dsig1.f b/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/auto_dsig1.f index 5f8fcf53e4..d06b3bf8c7 100644 --- a/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/auto_dsig1.f +++ b/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -104,6 +104,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -232,7 +234,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -300,7 +302,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -339,9 +341,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -358,6 +361,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -529,11 +534,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -633,9 +633,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -764,3 +766,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/driver.f b/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/driver.f index c45686a3b2..c2eadb2c31 100644 --- a/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/driver.f +++ b/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/matrix1.f b/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/matrix1.f index 1fd572a5a8..42e162b388 100644 --- a/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/matrix1.f +++ b/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -26,6 +26,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=32) INTEGER NGRAPHS @@ -49,8 +51,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -59,26 +61,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -89,7 +88,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -99,26 +97,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,5) /-1, 1,-1, 1,-1/ DATA (NHEL(I, 2),I=1,5) /-1, 1,-1, 1, 1/ DATA (NHEL(I, 3),I=1,5) /-1, 1,-1,-1,-1/ @@ -162,8 +159,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -172,11 +168,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=4 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=4 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -186,16 +182,16 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) - ! handling only one beam polarization here. Second beam can be handle via the pdf. +C handling only one beam polarization here. Second beam can +C be handle via the pdf. IF(POL(2).NE.1D0.AND.NHEL(2,I).EQ.INT(SIGN(1D0,POL(2)))) $ THEN T=T*ABS(POL(2)) @@ -210,7 +206,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -239,35 +236,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -280,7 +275,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) - ! handling only one beam polarization here. Second beam can be handle via the pdf. +C handling only one beam polarization here. Second beam can be +C handle via the pdf. IF(POL(2).NE.1D0.AND.NHEL(2,I).EQ.INT(SIGN(1D0,POL(2)))) THEN T=T*ABS(POL(2)) ELSE IF(POL(2).NE.1D0)THEN @@ -345,7 +341,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gux_ttxux/CPPProcess.cc b/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gux_ttxux/CPPProcess.cc index bacd28895f..0e0543d09a 100644 --- a/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gux_ttxux/CPPProcess.cc +++ b/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gux_ttxux/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gux_ttxux/CPPProcess.h b/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gux_ttxux/CPPProcess.h index 99ec68e177..01422c303b 100644 --- a/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gux_ttxux/CPPProcess.h +++ b/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gux_ttxux/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gux_ttxux/auto_dsig.f b/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gux_ttxux/auto_dsig.f index 995579a722..eb8a8e76e4 100644 --- a/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gux_ttxux/auto_dsig.f +++ b/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gux_ttxux/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1137,11 +1137,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=32) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1151,32 +1152,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=32) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=32) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gux_ttxux/auto_dsig1.f b/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gux_ttxux/auto_dsig1.f index 27ef220e77..d02ea2f3b3 100644 --- a/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gux_ttxux/auto_dsig1.f +++ b/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gux_ttxux/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -104,6 +104,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -232,7 +234,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -300,7 +302,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -339,9 +341,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -358,6 +361,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -529,11 +534,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -633,9 +633,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -764,3 +766,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gux_ttxux/driver.f b/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gux_ttxux/driver.f index c45686a3b2..c2eadb2c31 100644 --- a/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gux_ttxux/driver.f +++ b/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gux_ttxux/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gux_ttxux/matrix1.f b/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gux_ttxux/matrix1.f index b428147f4e..d2886d52ab 100644 --- a/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gux_ttxux/matrix1.f +++ b/epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gux_ttxux/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -26,6 +26,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=32) INTEGER NGRAPHS @@ -49,8 +51,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -59,26 +61,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -89,7 +88,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -99,26 +97,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,5) /-1,-1,-1, 1, 1/ DATA (NHEL(I, 2),I=1,5) /-1,-1,-1, 1,-1/ DATA (NHEL(I, 3),I=1,5) /-1,-1,-1,-1, 1/ @@ -162,8 +159,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -172,11 +168,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=4 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=4 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -186,16 +182,16 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) - ! handling only one beam polarization here. Second beam can be handle via the pdf. +C handling only one beam polarization here. Second beam can +C be handle via the pdf. IF(POL(2).NE.1D0.AND.NHEL(2,I).EQ.INT(SIGN(1D0,POL(2)))) $ THEN T=T*ABS(POL(2)) @@ -210,7 +206,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -239,35 +236,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -280,7 +275,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) - ! handling only one beam polarization here. Second beam can be handle via the pdf. +C handling only one beam polarization here. Second beam can be +C handle via the pdf. IF(POL(2).NE.1D0.AND.NHEL(2,I).EQ.INT(SIGN(1D0,POL(2)))) THEN T=T*ABS(POL(2)) ELSE IF(POL(2).NE.1D0)THEN @@ -345,7 +341,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/gq_ttq.mad/SubProcesses/cluster.f b/epochX/cudacpp/gq_ttq.mad/SubProcesses/cluster.f index 649e46f4e9..b8995283ed 100644 --- a/epochX/cudacpp/gq_ttq.mad/SubProcesses/cluster.f +++ b/epochX/cudacpp/gq_ttq.mad/SubProcesses/cluster.f @@ -552,6 +552,8 @@ logical function cluster(p, ivec) if (btest(mlevel,1)) $ write (*,*)'New event' + iwin = 0 + jwin = 0 cluster=.false. clustered=.false. do i=0,3 @@ -663,7 +665,8 @@ logical function cluster(p, ivec) c initialize graph storage igraphs(0)=0 nleft=nexternal -c cluster +c cluster + if (iwin.eq.0.or.jwin.eq.0) stop 21 do n=1,nexternal-2 c combine winner imocl(n)=imap(iwin,2)+imap(jwin,2) diff --git a/epochX/cudacpp/gq_ttq.mad/SubProcesses/proc_characteristics b/epochX/cudacpp/gq_ttq.mad/SubProcesses/proc_characteristics index 76a6154ffb..14c5bc5d13 100644 --- a/epochX/cudacpp/gq_ttq.mad/SubProcesses/proc_characteristics +++ b/epochX/cudacpp/gq_ttq.mad/SubProcesses/proc_characteristics @@ -17,6 +17,8 @@ splitting_types = [] perturbation_order = [] limitations = [] + ew_sudakov = False hel_recycling = False single_color = False nlo_mixed_expansion = True + gauge = unitary diff --git a/epochX/cudacpp/gq_ttq.mad/SubProcesses/refine.sh b/epochX/cudacpp/gq_ttq.mad/SubProcesses/refine.sh index afb9b99ad1..b46170ba23 100644 --- a/epochX/cudacpp/gq_ttq.mad/SubProcesses/refine.sh +++ b/epochX/cudacpp/gq_ttq.mad/SubProcesses/refine.sh @@ -57,7 +57,11 @@ j=%(directory)s for((try=1;try<=16;try+=1)); do if [ "$keeplog" = true ] ; then + if [[ -e ../madevent ]];then ../madevent 2>&1 >> $k &1 >> $k &1 >> log.txt &1 >> log.txt &1 >> $k \w*)>') - pat_end=re.compile('\w*)>') + pat_begin=re.compile(r'<(?P\w*)>') + pat_end=re.compile(r'\w*)>') tag_to_file={'slha':'param_card.dat', 'mgruncard':'run_card.dat', @@ -319,7 +319,7 @@ def check_pid(self, pid2label): def get_lha_strategy(self): """get the lha_strategy: how the weight have to be handle by the shower""" - if not self["init"]: + if "init" not in self or not self["init"]: raise Exception("No init block define") data = self["init"].split('\n')[0].split() @@ -537,7 +537,8 @@ def charge_card(self, tag): self.param_card = param_card_reader.ParamCard(param_card) return self.param_card elif tag == 'mgruncard': - self.run_card = RunCard(self[tag], unknown_warning=False) + with misc.TMP_variable(RunCard, 'allow_scan', True): + self.run_card = RunCard(self[tag], consistency=False, unknow_warning=False) return self.run_card elif tag == 'mg5proccard': proc_card = self[tag].split('\n') @@ -976,6 +977,8 @@ class ConfigFile(dict): """ a class for storing/dealing with input file. """ + allow_scan = False + def __init__(self, finput=None, **opt): """initialize a new instance. input can be an instance of MadLoopParam, a file, a path to a file, or simply Nothing""" @@ -993,6 +996,7 @@ def __init__(self, finput=None, **opt): # Initialize it with all the default value self.user_set = set() self.auto_set = set() + self.scan_set = {} #key -> type of list (int/float/bool/str/... for scan self.system_only = set() self.lower_to_case = {} self.list_parameter = {} #key -> type of list (int/float/bool/str/... @@ -1109,6 +1113,8 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): #1. check if the parameter is set to auto -> pass it to special if lower_name in self: targettype = type(dict.__getitem__(self, lower_name)) + if lower_name in self.scan_set: + targettype = self.scan_set[lower_name] if targettype != str and isinstance(value, str) and value.lower() == 'auto': self.auto_set.add(lower_name) if lower_name in self.user_set: @@ -1118,13 +1124,26 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): return elif lower_name in self.auto_set: self.auto_set.remove(lower_name) - + + + #1. check if the parameter is set to auto -> pass it to special + scan_targettype = None + if self.allow_scan and isinstance(value, str) and value.strip().startswith('scan'): + if lower_name in self.user_set: + self.user_set.remove(lower_name) + self.scan_set[lower_name] = type(self[lower_name]) + dict.__setitem__(self, lower_name, value) + #keep old value. + self.post_set(lower_name,value, change_userdefine, raiseerror) + return + elif lower_name in self.scan_set: + scan_targettype = self.scan_set[lower_name] + del self.scan_set[lower_name] + # 2. Find the type of the attribute that we want if lower_name in self.list_parameter: targettype = self.list_parameter[lower_name] - - if isinstance(value, str): # split for each comma/space value = value.strip() @@ -1248,8 +1267,11 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): if change_userdefine: self.user_set.add(lower_name) return self.post_set(lower_name, None, change_userdefine, raiseerror) - elif name in self: - targettype = type(self[name]) + elif name in self: + if scan_targettype: + targettype = targettype + else: + targettype = type(self[name]) else: logger.debug('Trying to add argument %s in %s. ' % (name, self.__class__.__name__) +\ 'This argument is not defined by default. Please consider adding it.') @@ -1262,7 +1284,7 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): if change_userdefine: self.user_set.add(lower_name) return self.post_set(lower_name, None, change_userdefine, raiseerror) - + value = self.format_variable(value, targettype, name=name) #check that the value is allowed: if lower_name in self.allowed_value and '*' not in self.allowed_value[lower_name]: @@ -1444,7 +1466,7 @@ def format_variable(value, targettype, name="unknown"): value =int(value[:-1]) * convert[value[-1]] elif '/' in value or '*' in value: try: - split = re.split('(\*|/)',value) + split = re.split(r'(\*|/)',value) v = float(split[0]) for i in range((len(split)//2)): if split[2*i+1] == '*': @@ -1482,7 +1504,7 @@ def format_variable(value, targettype, name="unknown"): value = float(value) except ValueError: try: - split = re.split('(\*|/)',value) + split = re.split(r'(\*|/)',value) v = float(split[0]) for i in range((len(split)//2)): if split[2*i+1] == '*': @@ -1491,7 +1513,10 @@ def format_variable(value, targettype, name="unknown"): v /= float(split[2*i+2]) except: v=0 - raise InvalidCmd("%s can not be mapped to a float" % value) + if "scan" in value: + raise InvalidCmd("%s is not supported here. Note that scan command can not be present simultaneously in the run_card and param_card." % value) + else: + raise InvalidCmd("%s can not be mapped to a float" % value) finally: value = v else: @@ -1737,10 +1762,12 @@ def default_setup(self): self.add_param('splitting_types',[], typelist=str) self.add_param('perturbation_order', [], typelist=str) self.add_param('limitations', [], typelist=str) + self.add_param('ew_sudakov', False) self.add_param('hel_recycling', False) self.add_param('single_color', True) self.add_param('nlo_mixed_expansion', True) - + self.add_param('gauge', 'U') + def read(self, finput): """Read the input file, this can be a path to a file, a file object, a str with the content of the file.""" @@ -3104,7 +3131,7 @@ def write(self, output_file, template=None, python_template=False, # do not write hidden parameter not hidden for this template # if python_template: - written = written.union(set(re.findall('\%\((\w*)\)s', open(template,'r').read(), re.M))) + written = written.union(set(re.findall(r'\%\((\w*)\)s', open(template,'r').read(), re.M))) to_write = to_write.union(set(self.hidden_param)) to_write = to_write.difference(written) @@ -3157,7 +3184,6 @@ def get_value_from_include(self, path, list_of_params, output_dir): if path does not exists return the current value in self for all parameter""" #WARNING DOES NOT HANDLE LIST/DICT so far - misc.sprint(output_dir, path) # handle case where file is missing if not os.path.exists(pjoin(output_dir,path)): misc.sprint("include file not existing", pjoin(output_dir,path)) @@ -3259,7 +3285,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): text = open(path,'r').read() #misc.sprint(text) f77_type = ['real*8', 'integer', 'double precision', 'logical'] - pattern = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I+re.M) for fct in pattern.findall(text): fsock = file_writers.FortranWriter(tmp,'w') @@ -3287,6 +3313,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): starttext = open(pjoin(outdir, path+'.orig')).read() fsock.remove_routine(starttext, to_mod[path][0]) for text in to_mod[path][1]: + text = self.retro_compatible_custom_fct(text) fsock.writelines(text) fsock.close() if not filecmp.cmp(pjoin(outdir, path), pjoin(outdir, path+'.tmp')): @@ -3303,7 +3330,33 @@ def edit_dummy_fct_from_file(self, filelist, outdir): files.mv(pjoin(outdir,path+'.orig'), pjoin(outdir, path)) + @staticmethod + def retro_compatible_custom_fct(lines, mode=None): + f77_type = ['real*8', 'integer', 'double precision', 'logical'] + function_pat = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + % {'type':'|'.join(f77_type)}, re.I+re.M) + include_pat = re.compile(r"\s+include\s+[\'\"]([\w\./]*)") + + assert isinstance(lines, list) + sol = [] + + if mode is None or 'vector.inc' in mode: + search = True + for i,line in enumerate(lines[:]): + if search and re.search(include_pat, line): + name = re.findall(include_pat, line)[0] + misc.sprint('DETECTED INCLUDE', name) + if 'vector.inc' in name: + search = False + if 'run.inc' in name: + sol.append(" include 'vector.inc'") + search = False + sol.append(line) + if re.search(function_pat, line): + misc.sprint("DETECTED FCT") + search = True + return sol def guess_entry_fromname(self, name, value): """ @@ -3346,7 +3399,7 @@ def update_typelist(value, name, opts): #handle metadata opts = {} forced_opts = [] - for key,val in re.findall("\<(?P[_\-\w]+)\=(?P[^>]*)\>", str(name)): + for key,val in re.findall(r"\<(?P[_\-\w]+)\=(?P[^>]*)\>", str(name)): forced_opts.append(key) if val in ['True', 'False']: opts[key] = eval(val) @@ -3681,11 +3734,22 @@ def write_autodef(self, output_dir, output_file=None): out = ["%s\n" %l for l in out] fsock.writelines(out) - @staticmethod - def get_idbmup(lpp): + def get_idbmup(self, lpp, beam=1): """return the particle colliding pdg code""" if lpp in (1,2, -1,-2): - return math.copysign(2212, lpp) + target = 2212 + if 'nb_proton1' in self: + nbp = self['nb_proton%s' % beam] + nbn = self['nb_neutron%s' % beam] + if nbp == 1 and nbn ==0: + target = 2212 + elif nbp==0 and nbn ==1: + target = 2112 + else: + target = 1000000000 + target += 10 * (nbp+nbn) + target += 10000 * nbp + return math.copysign(target, lpp) elif lpp in (3,-3): return math.copysign(11, lpp) elif lpp in (4,-4): @@ -3701,8 +3765,8 @@ def get_banner_init_information(self): the first line of the block of the lhe file.""" output = {} - output["idbmup1"] = self.get_idbmup(self['lpp1']) - output["idbmup2"] = self.get_idbmup(self['lpp2']) + output["idbmup1"] = self.get_idbmup(self['lpp1'], beam=1) + output["idbmup2"] = self.get_idbmup(self['lpp2'], beam=2) output["ebmup1"] = self["ebeam1"] output["ebmup2"] = self["ebeam2"] output["pdfgup1"] = 0 @@ -3959,7 +4023,8 @@ def check_validity(self, card): dict.__setitem__(card, 'pdlabel1', card['pdlabel']) dict.__setitem__(card, 'pdlabel2', card['pdlabel']) - if abs(card['lpp1']) == 1 == abs(card['lpp2']) and card['pdlabel1'] != card['pdlabel2']: + if isinstance(card['lpp1'],int) and isinstance(card['lpp2'],int) and \ + abs(card['lpp1']) == 1 == abs(card['lpp2']) and card['pdlabel1'] != card['pdlabel2']: raise InvalidRunCard("Assymetric beam pdf not supported for proton-proton collision") def status(self, card): @@ -4156,12 +4221,16 @@ def default_setup(self): self.add_param('frame_id', 6, system=True) self.add_param("event_norm", "average", allowed=['sum','average', 'unity'], include=False, sys_default='sum', hidden=True) + self.add_param("keep_log", "normal", include=False, hidden=True, + comment="none: all log send to /dev/null.\n minimal: keep only log for survey of the last run.\n normal: keep only log for survey of all run. \n debug: keep all log (survey and refine)", + allowed=['none', 'minimal', 'normal', 'debug']) #cut self.add_param("auto_ptj_mjj", True, hidden=True) self.add_param("bwcutoff", 15.0) self.add_param("cut_decays", False, cut='d') self.add_param('dsqrt_shat',0., cut=True) self.add_param("nhel", 0, include=False) + self.add_param("limhel", 1e-8, hidden=True, comment="threshold to determine if an helicity contributes when not MC over helicity.") #pt cut self.add_param("ptj", 20.0, cut='j') self.add_param("ptb", 0.0, cut='b') @@ -4842,7 +4911,7 @@ def create_default_for_process(self, proc_characteristic, history, proc_def): # here pick strategy 2 if only one QCD color flow # and for pure multi-jet case jet_id = [21] + list(range(1, self['maxjetflavor']+1)) - if proc_characteristic['single_color']: + if proc_characteristic['gauge'] != 'FD' and proc_characteristic['single_color']: self['sde_strategy'] = 2 #for pure lepton final state go back to sde_strategy=1 pure_lepton=True @@ -5741,9 +5810,10 @@ def check_validity(self): # check that ebeam is bigger than the proton mass. for i in [1,2]: - if self['lpp%s' % i ] not in [1,2]: + # do not for proton mass if not proton PDF (or when scan initialization) + if self['lpp%s' % i ] not in [1,2] or isinstance(self['ebeam%i' % i], str): continue - + if self['ebeam%i' % i] < 0.938: if self['ebeam%i' %i] == 0: logger.warning("At-rest proton mode set: energy beam set to 0.938 GeV") @@ -6193,3 +6263,181 @@ def log_and_update(self, banner, card, par, v): xcard = banner.charge_card(card) xcard[par[0]].param_dict[(par[1],)].value = v xcard.write(os.path.join(self.me_dir, 'Cards', '%s.dat' % card)) + + + + +class RunCardIterator(object): + """A class keeping track of the scan: flag in the param_card and + having an __iter__() function to scan over all the points of the scan. + """ + + logging = True + def __init__(self, input_path=None): + with misc.TMP_variable(RunCard, 'allow_scan', True): + self.run_card = RunCard(input_path, consistency=False) + self.run_card.allow_scan = True + + self.itertag = [] #all the current value use + self.cross = [] # keep track of all the cross-section computed + self.param_order = [] + + def __iter__(self): + """generate the next param_card (in a abstract way) related to the scan. + Technically this generates only the generator.""" + + if hasattr(self, 'iterator'): + return self.iterator + self.iterator = self.iterate() + return self.iterator + + def write(self, path): + self.__iter__.write(path) + + def next(self, autostart=False): + """call the next iteration value""" + try: + iterator = self.iterator + except: + if autostart: + iterator = self.__iter__() + else: + raise + try: + out = next(iterator) + except StopIteration: + del self.iterator + raise + return out + + def iterate(self): + """create the actual generator""" + all_iterators = {} # dictionary of key -> block of object to scan [([param, [values]), ...] + pattern = re.compile(r'''scan\s*(?P\d*)\s*:\s*(?P[^#]*)''', re.I) + + # fill all_iterators with the run_card information + for name in self.run_card.scan_set: + value = self.run_card[name] + try: + key, def_list = pattern.findall(value)[0] + except Exception as error: + misc.sprint(error) + raise Exception("Fail to handle scanning tag in run_card: Please check that the syntax is valid") + if key == '': + key = -1 * len(all_iterators) + if key not in all_iterators: + all_iterators[key] = [] + try: + all_iterators[key].append( (name, eval(def_list))) + except SyntaxError as error: + raise Exception("Fail to handle your scan definition. Please check your syntax:\n entry: %s \n Error reported: %s" %(def_list, error)) + + #prepare to keep track of parameter changing for the report + keys = list(all_iterators.keys()) # need to fix an order for the scan + #store the type of parameter + for key in keys: + for param, values in all_iterators[key]: + self.param_order.append("run_card#%s" % (param)) + + # do the loop + lengths = [list(range(len(all_iterators[key][0][1]))) for key in keys] + from functools import reduce + total = reduce((lambda x, y: x * y),[len(x) for x in lengths]) + for i,positions in enumerate(itertools.product(*lengths)): + self.itertag = [] + if self.logging: + logger.info("Create the next run_card in the scan definition (%s/%s) " %( i+1, total), '$MG:BOLD') + for i, pos in enumerate(positions): + key = keys[i] + for param, values in all_iterators[key]: + # assign the value in the card. + self.run_card[param] = values[pos] + self.itertag.append(values[pos]) + if self.logging: + logger.info("change parameter %s to %s", \ + param, values[pos]) + + + # retrun the current param_card up to next iteration + yield self.run_card + + + def store_entry(self, run_name, cross, error=None, run_card_path=None): + """store the value of the cross-section""" + + if isinstance(cross, dict): + info = dict(cross) + info.update({'bench' : self.itertag, 'run_name': run_name}) + self.cross.append(info) + else: + if error is None: + self.cross.append({'bench' : self.itertag, 'run_name': run_name, 'cross(pb)':cross}) + else: + self.cross.append({'bench' : self.itertag, 'run_name': run_name, 'cross(pb)':cross, 'error(pb)':error}) + + + def write_summary(self, path, order=None, lastline=False, nbcol=20): + """ """ + + if path: + ff = open(path, 'w') + path_events = path.rsplit("/", 1)[0] + #identCard = open(pjoin(path.rsplit("/", 2)[0], "Cards", "ident_card.dat")) + #identLines = identCard.readlines() + #identCard.close() + else: + ff = StringIO.StringIO() + if order: + keys = order + else: + keys = list(self.cross[0].keys()) + if 'bench' in keys: keys.remove('bench') + if 'run_name' in keys: keys.remove('run_name') + keys.sort() + if 'cross(pb)' in keys: + keys.remove('cross(pb)') + keys.append('cross(pb)') + if 'error(pb)' in keys: + keys.remove('error(pb)') + keys.append('error(pb)') + + formatting = "#%s%s%s\n" %('%%-%is ' % (nbcol-1), ('%%-%is ' % (nbcol))* len(self.param_order), + ('%%-%is ' % (nbcol))* len(keys)) + # header + if not lastline: + ff.write(formatting % tuple(['run_name'] + self.param_order + keys)) + formatting = "%s%s%s\n" %('%%-%is ' % (nbcol), ('%%-%ie ' % (nbcol))* len(self.param_order), + ('%%-%ie ' % (nbcol))* len(keys)) + + if not lastline: + to_print = self.cross + else: + to_print = self.cross[-1:] + for info in to_print: + name = info['run_name'] + bench = info['bench'] + data = [] + for k in keys: + if k in info: + data.append(info[k]) + else: + data.append(0.) + ff.write(formatting % tuple([name] + bench + data)) + ff_single = open(pjoin(path_events, name, "params.dat"), "w") + for i_bench in range(0, len(bench)): + ff_single.write(self.param_order[i_bench] + " = " + str(bench[i_bench]) +"\n") + ff_single.close() + + if not path: + return ff.getvalue() + + + def get_next_name(self, run_name): + """returns a smart name for the next run""" + + if '_' in run_name: + name, value = run_name.rsplit('_',1) + if value.isdigit(): + return '%s_%02i' % (name, float(value)+1) + # no valid '_' in the name + return '%s_scan_02' % run_name diff --git a/epochX/cudacpp/gq_ttq.mad/bin/internal/check_param_card.py b/epochX/cudacpp/gq_ttq.mad/bin/internal/check_param_card.py index 71089d7480..bc785b5de6 100755 --- a/epochX/cudacpp/gq_ttq.mad/bin/internal/check_param_card.py +++ b/epochX/cudacpp/gq_ttq.mad/bin/internal/check_param_card.py @@ -649,7 +649,7 @@ def write_inc_file(self, outpath, identpath, default, need_mp=False): #check if we need to write the value of scale for some block if os.path.exists(input_inc): text = open(input_inc).read() - scales = list(set(re.findall('mdl__(\w*)__scale', text, re.I))) + scales = list(set(re.findall(r'mdl__(\w*)__scale', text, re.I))) else: scales = [] @@ -1000,10 +1000,12 @@ def iterate(self): self.param_order.append("%s#%s" % (param.lhablock, '_'.join(repr(i) for i in param.lhacode))) # do the loop lengths = [list(range(len(all_iterators[key][0][1]))) for key in keys] - for positions in itertools.product(*lengths): + from functools import reduce + total = reduce((lambda x, y: x * y),[len(x) for x in lengths]) + for i,positions in enumerate(itertools.product(*lengths)): self.itertag = [] if self.logging: - logger.info("Create the next param_card in the scan definition", '$MG:BOLD') + logger.info("Create the next param_card in the scan definition (%s/%s)" % (i+1,total), '$MG:BOLD') for i, pos in enumerate(positions): key = keys[i] for param, values in all_iterators[key]: diff --git a/epochX/cudacpp/gq_ttq.mad/bin/internal/cluster.py b/epochX/cudacpp/gq_ttq.mad/bin/internal/cluster.py index 9a893f630d..1ad860e04f 100755 --- a/epochX/cudacpp/gq_ttq.mad/bin/internal/cluster.py +++ b/epochX/cudacpp/gq_ttq.mad/bin/internal/cluster.py @@ -646,7 +646,10 @@ def worker(self): if os.path.exists(exe) and not exe.startswith('/'): exe = './' + exe if isinstance(opt['stdout'],str): - opt['stdout'] = open(opt['stdout'],'w') + if opt['stdout'] == '/dev/null': + opt['stdout'] = os.open(os.devnull, os.O_RDWR) + else: + opt['stdout'] = open(opt['stdout'],'w') if opt['stderr'] == None: opt['stderr'] = subprocess.STDOUT if arg: @@ -671,11 +674,12 @@ def worker(self): self.pids.put(pid) # the function should return 0 if everything is fine # the error message otherwise - returncode = exe(*arg, **opt) - if returncode != 0: - logger.warning("fct %s does not return 0. Stopping the code in a clean way. The error was:\n%s", exe, returncode) + try: + returncode = exe(*arg, **opt) + except Exception as error: + #logger.warning("fct %s does not return 0. Stopping the code in a clean way. The error was:\n%s", exe, returncode) self.stoprequest.set() - self.remove("fct %s does not return 0:\n %s" % (exe, returncode)) + self.remove("fct %s does raise %s\n %s" % (exe, error)) except Exception as error: self.fail_msg = sys.exc_info() logger.warning(str(error)) @@ -700,7 +704,7 @@ def worker(self): def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, - log=None, required_output=[], nb_submit=0): + log=None, required_output=[], nb_submit=0, python_opts={}): """submit a job on multicore machine""" # open threads if needed @@ -720,7 +724,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, return tag else: # python function - self.queue.put((tag, prog, argument, {})) + self.queue.put((tag, prog, argument, python_opts)) self.submitted.put(1) return tag @@ -908,6 +912,10 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None else: requirement = '' + if 'cluster_walltime' in self.options and self.options['cluster_walltime']\ + and self.options['cluster_walltime'] != 'None': + requirement+='\n MaxRuntime = %s' % self.options['cluster_walltime'] + if cwd is None: cwd = os.getcwd() if stdout is None: @@ -936,7 +944,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None #Submitting job(s). #Logging submit event(s). #1 job(s) submitted to cluster 2253622. - pat = re.compile("submitted to cluster (\d*)",re.MULTILINE) + pat = re.compile(r"submitted to cluster (\d*)",re.MULTILINE) output = output.decode(errors='ignore') try: id = pat.search(output).groups()[0] @@ -1025,7 +1033,7 @@ def submit2(self, prog, argument=[], cwd=None, stdout=None, stderr=None, #Logging submit event(s). #1 job(s) submitted to cluster 2253622. output = output.decode(errors='ignore') - pat = re.compile("submitted to cluster (\d*)",re.MULTILINE) + pat = re.compile(r"submitted to cluster (\d*)",re.MULTILINE) try: id = pat.search(output).groups()[0] except: @@ -1588,7 +1596,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None output = a.communicate()[0].decode(errors='ignore') #Your job 874511 ("test.sh") has been submitted - pat = re.compile("Your job (\d*) \(",re.MULTILINE) + pat = re.compile(r"Your job (\d*) \(",re.MULTILINE) try: id = pat.search(output).groups()[0] except: @@ -1606,7 +1614,7 @@ def control_one_job(self, id): if not status: return 'F' #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 - pat = re.compile("^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") + pat = re.compile(r"^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") stat = '' for line in status.stdout.read().decode(errors='ignore').split('\n'): if not line: @@ -1636,7 +1644,7 @@ def control(self, me_dir=None): cmd = 'qstat -s %s' % statusflag status = misc.Popen([cmd], shell=True, stdout=subprocess.PIPE) #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 - pat = re.compile("^(\d+)") + pat = re.compile(r"^(\d+)") for line in status.stdout.read().decode(errors='ignore').split('\n'): line = line.strip() try: @@ -1715,6 +1723,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None stderr = stdout if log is None: log = '/dev/null' + command = ['sbatch', '-o', stdout, '-J', me_dir, @@ -1726,6 +1735,12 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None command.insert(1, '-p') command.insert(2, self.cluster_queue) + if 'cluster_walltime' in self.options and self.options['cluster_walltime']\ + and self.options['cluster_walltime'] != 'None': + command.insert(1, '-t') + command.insert(2, self.options['cluster_walltime']) + + a = misc.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -1736,7 +1751,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None id = output_arr[3].rstrip() if not id.isdigit(): - id = re.findall('Submitted batch job ([\d\.]+)', ' '.join(output_arr)) + id = re.findall(r'Submitted batch job ([\d\.]+)', ' '.join(output_arr)) if not id or len(id)>1: raise ClusterManagmentError( 'fail to submit to the cluster: \n%s' \ diff --git a/epochX/cudacpp/gq_ttq.mad/bin/internal/combine_runs.py b/epochX/cudacpp/gq_ttq.mad/bin/internal/combine_runs.py index 4de6b84ec0..b1e8c88eac 100755 --- a/epochX/cudacpp/gq_ttq.mad/bin/internal/combine_runs.py +++ b/epochX/cudacpp/gq_ttq.mad/bin/internal/combine_runs.py @@ -20,6 +20,7 @@ from __future__ import absolute_import import math import os +import shutil import re import logging from six.moves import range @@ -117,6 +118,7 @@ def sum_multichannel(self, channel): #Now read in all of the events and write them #back out with the appropriate scaled weight + to_clean = [] fsock = open(pjoin(channel, 'events.lhe'), 'w') wgt = results.axsec / results.nunwgt tot_nevents, nb_file = 0, 0 @@ -129,8 +131,14 @@ def sum_multichannel(self, channel): nw = self.copy_events(fsock, pjoin(path,'events.lhe'), wgt) tot_nevents += nw nb_file += 1 + to_clean.append(path) logger.debug("Combined %s file generating %s events for %s " , nb_file, tot_nevents, channel) - + for path in to_clean: + try: + shutil.rmtree(path) + except Exception as error: + pass + @staticmethod def get_fortran_str(nb): data = '%E' % nb @@ -162,6 +170,7 @@ def copy_events(self, fsock, input, new_wgt): fsock.write(line) old_line = line return nb_evt + def get_channels(self, proc_path): """Opens file symfact.dat to determine all channels""" sympath = os.path.join(proc_path, 'symfact.dat') diff --git a/epochX/cudacpp/gq_ttq.mad/bin/internal/common_run_interface.py b/epochX/cudacpp/gq_ttq.mad/bin/internal/common_run_interface.py index 9bd9d9cb50..194f0cdfbd 100755 --- a/epochX/cudacpp/gq_ttq.mad/bin/internal/common_run_interface.py +++ b/epochX/cudacpp/gq_ttq.mad/bin/internal/common_run_interface.py @@ -23,6 +23,7 @@ import ast import logging import math +import copy import os import re import shutil @@ -181,6 +182,23 @@ def help_add_time_of_flight(self): logger.info(' threshold option allows to change the minimal value required to') logger.info(' a non zero value for the particle (default:1e-12s)') + def help_print_results(self): + logger.info("syntax: print_results [RUN_NAME] [OPTIONS]") + logger.info("-- print the results of the previous run on the screen") + logger.info(" If not RUN_NAME is provided, the information of all run") + logger.info(" are printed one after another.") + logger.info("") + logger.info(" supported options:") + logger.info(" ------------------") + logger.info(" --format=full|short # default is full") + logger.info(" full format contains banner/... ") + logger.info(" while short is a simple multi-column format (nice for plotting)") + logger.info(" --path=") + logger.info(" allow to write the information to a file.") + logger.info(" --mode=w|a #default is w ") + logger.info(" when the information is printed to a file, you can choose ") + logger.info(" to either overwrite the file if already exists (w mode)") + logger.info(" to append the information at the end of the file (a mode)") class CheckValidForCmd(object): @@ -727,7 +745,7 @@ def __init__(self, me_dir, options, *args, **opts): if not self.proc_characteristics['ninitial']: # Get number of initial states nexternal = open(pjoin(self.me_dir,'Source','nexternal.inc')).read() - found = re.search("PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) + found = re.search(r"PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) self.ninitial = int(found.group(1)) else: self.ninitial = self.proc_characteristics['ninitial'] @@ -989,7 +1007,22 @@ def do_treatcards(self, line, amcatnlo=False): #raise Exception, "%s %s %s" % (sys.path, os.path.exists(pjoin(self.me_dir,'bin','internal', 'ufomodel')), os.listdir(pjoin(self.me_dir,'bin','internal', 'ufomodel'))) import ufomodel as ufomodel zero = ufomodel.parameters.ZERO - if self.proc_characteristics['nlo_mixed_expansion']: + no_width = [] + + if self.proc_characteristics['ew_sudakov']: + # if the sudakov approximation is used, force all particle widths to zero + # unless the complex mass scheme is used + if not self.proc_characteristics['complex_mass_scheme']: + no_width = [p for p in ufomodel.all_particles if p.width != zero] + logger.info('''Setting all particle widths to zero (needed for EW Sudakov approximation).''','$MG:BOLD') + # also, check that the model features the 'ntadpole' parameter, and set it to 1 + try: + param_card['tadpole'].get(1).value = 1. + logger.info('''Setting the value of ntadpole to 1 (needed for EW Sudakov approximation).''','$MG:BOLD') + except KeyError: + logger.warning('''The model has no 'ntadpole' parameter. The Sudakov approximation for EW corrections may give wrong results.''') + + elif self.proc_characteristics['nlo_mixed_expansion']: no_width = [p for p in ufomodel.all_particles if (str(p.pdg_code) in pids or str(-p.pdg_code) in pids) and p.width != zero] @@ -1168,17 +1201,17 @@ def detect_card_type(path): 'Begin Minpts', 'gridpack', 'ebeam1', - 'block\s+mw_run', + r'block\s+mw_run', 'BLOCK', 'DECAY', 'launch', 'madspin', - 'transfer_card\.dat', + r'transfer_card\.dat', 'set', 'main:numberofevents', # pythia8, '@MG5aMC skip_analysis', #MA5 --both-- - '@MG5aMC\s*inputs\s*=\s*\*\.(?:hepmc|lhe)', #MA5 --both-- - '@MG5aMC\s*reconstruction_name', # MA5 hadronique + r'@MG5aMC\s*inputs\s*=\s*\*\.(?:hepmc|lhe)', #MA5 --both-- + r'@MG5aMC\s*reconstruction_name', # MA5 hadronique '@MG5aMC', # MA5 hadronique 'run_rivet_later', # Rivet ] @@ -1237,7 +1270,7 @@ def detect_card_type(path): return 'madspin_card.dat' if 'decay' in text: # need to check if this a line like "decay w+" or "set decay" - if re.search("(^|;)\s*decay", fulltext, re.M): + if re.search(r"(^|;)\s*decay", fulltext, re.M): return 'madspin_card.dat' else: return 'reweight_card.dat' @@ -2074,6 +2107,12 @@ def check_multicore(self): # ensure that the run_card is present if not hasattr(self, 'run_card'): self.run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat')) + # Below reads the run_card in the LHE file rather than the Cards/run_card + import madgraph.various.lhe_parser as lhe_parser + args_path = list(args) + self.check_decay_events(args_path) + self.run_card = banner_mod.RunCard(lhe_parser.EventFile(args_path[0]).get_banner()['mgruncard']) + # we want to run this in a separate shell to avoid hard f2py crash command = [sys.executable] @@ -2085,6 +2124,12 @@ def check_multicore(self): command.append('--web') command.append('reweight') + ## TV: copy the event file as backup before starting reweighting + event_path = pjoin(self.me_dir, 'Events', self.run_name, 'events.lhe.gz') + event_path_backup = pjoin(self.me_dir, 'Events', self.run_name, 'events_orig.lhe.gz') + if os.path.exists(event_path) and not os.path.exists(event_path_backup): + shutil.copyfile(event_path, event_path_backup) + ######### START SINGLE CORE MODE ############ if self.options['nb_core']==1 or self.run_card['nevents'] < 101 or not check_multicore(self): if self.run_name: @@ -2200,7 +2245,7 @@ def check_multicore(self): cross_sections[key] = value / (nb_event+1) lhe.remove() for key in cross_sections: - if key == 'orig' or key.isdigit(): + if key == 'orig' or (key.isdigit() and not (key[0] == '2')): continue logger.info('%s : %s pb' % (key, cross_sections[key])) return @@ -2461,7 +2506,7 @@ def do_add_time_of_flight(self, line): ############################################################################ def do_print_results(self, line): - """Not in help:Print the cross-section/ number of events for a given run""" + """Print the cross-section/ number of events for a given run""" args = self.split_arg(line) options={'path':None, 'mode':'w', 'format':'full'} @@ -2942,10 +2987,15 @@ def do_rivet(self, line, postprocess=False): #2 Prepare Rivet setup environments rivet_path = self.options['rivet_path'] yoda_path = self.options['yoda_path'] + fastjet_path = subprocess.Popen([self.options['fastjet'], '--prefix'], + stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip() + set_env = set_env + "export PATH={0}:$PATH\n".format(pjoin(rivet_path, 'bin')) set_env = set_env + "export PATH={0}:$PATH\n".format(pjoin(yoda_path, 'bin')) set_env = set_env + "export LD_LIBRARY_PATH={0}:{1}:$LD_LIBRARY_PATH\n".format(pjoin(rivet_path, 'lib'), pjoin(rivet_path, 'lib64')) set_env = set_env + "export LD_LIBRARY_PATH={0}:{1}:$LD_LIBRARY_PATH\n".format(pjoin(yoda_path, 'lib'), pjoin(yoda_path, 'lib64')) + set_env = set_env + "export LD_LIBRARY_PATH={0}:$LD_LIBRARY_PATH\n".format(pjoin(self.options['hepmc_path'], 'lib')) + set_env = set_env + "export LD_LIBRARY_PATH={0}:$LD_LIBRARY_PATH\n".format(pjoin(fastjet_path, 'lib')) major, minor = sys.version_info[0:2] set_env = set_env + "export PYTHONPATH={0}:{1}:$PYTHONPATH\n".format(pjoin(rivet_path, 'lib', 'python%s.%s' %(major,minor), 'site-packages'),\ pjoin(rivet_path, 'lib64', 'python%s.%s' %(major,minor), 'site-packages')) @@ -4311,8 +4361,8 @@ def complete_compute_widths(self, text, line, begidx, endidx, formatting=True): else: completion = {} completion['options'] = self.list_completion(text, - ['--path=', '--output=', '--min_br=0.\$', '--nlo', - '--precision_channel=0.\$', '--body_decay=']) + ['--path=', '--output=', r'--min_br=0.\$', '--nlo', + r'--precision_channel=0.\$', '--body_decay=']) return self.deal_multiple_categories(completion, formatting) @@ -4821,9 +4871,9 @@ class AskforEditCard(cmd.OneLinePathCompletion): (return False to repeat the question) """ - all_card_name = ['param_card', 'run_card', 'pythia_card', 'pythia8_card', + all_card_name = ['param_card', 'run_card', 'pythia_card', 'pythia8_card', 'fo_analysis_card' 'madweight_card', 'MadLoopParams', 'shower_card', 'rivet_card'] - to_init_card = ['param', 'run', 'madweight', 'madloop', + to_init_card = ['param', 'run', 'madweight', 'madloop', 'fo_analysis', 'shower', 'pythia8','delphes','madspin', 'rivet'] special_shortcut = {} special_shortcut_help = {} @@ -4853,6 +4903,7 @@ def load_default(self): self.has_PY8 = False self.has_delphes = False self.has_rivet = False + self.has_fo_card = False self.paths = {} self.update_block = [] @@ -5058,7 +5109,8 @@ def init_run(self, cards): try: - self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning') + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning') except IOError: self.run_card = {} try: @@ -5248,6 +5300,15 @@ def init_delphes(self, cards): self.has_delphes = True return [] + def init_fo_analysis(self, cards): + self.has_fo_card = False + if not self.get_path('FO_analyse', cards): + return [] + self.has_fo_card = True + self.fo_card = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse']) + self.fo_card_def = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse_default']) + return list(self.fo_card.string_vars) + def set_CM_velocity(self, line): """compute sqrts from the velocity in the center of mass frame""" @@ -5508,6 +5569,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): allowed['delphes_card'] = '' if self.has_rivet: allowed['rivet_card'] = '' + if self.has_fo_card: + allowed['fo_card'] = '' elif len(args) == 2: if args[1] == 'run_card': @@ -5532,6 +5595,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): allowed = {'delphes_card':'default'} elif args[1] == 'rivet_card': allowed = {'rivet_card':'default'} + elif args[1] == 'fo_card': + allowed = {'fo_card':'default'} else: allowed = {'value':''} @@ -5539,6 +5604,7 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): start = 1 if args[1] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', 'MadLoop_card','pythia8_card','delphes_card','plot_card', + 'fo_card', 'madanalysis5_parton_card','madanalysis5_hadron_card', 'rivet_card']: start = 2 @@ -5576,6 +5642,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): categories.append('delphes_card') if self.has_rivet: categories.append('rivet_card') + if self.has_fo_card: + categories.append('fo_card') possibilities['category of parameter (optional)'] = \ self.list_completion(text, categories) @@ -5630,7 +5698,13 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): if 'delphes_card' in allowed: if allowed['delphes_card'] == 'default': opts = ['default', 'atlas', 'cms'] - possibilities['Delphes Card'] = self.list_completion(text, opts) + possibilities['Delphes Card'] = self.list_completion(text, opts) + + if 'fo_card' in allowed: + opts = self.fo_card.string_vars + if allowed['fo_card'] == 'default': + opts.append('default') + possibilities['FO Card'] = self.list_completion(text, opts) if 'value' in list(allowed.keys()): opts = ['default', 'scale'] @@ -5733,21 +5807,28 @@ def do_set(self, line): if args[0] in self.special_shortcut: targettypes , cmd = self.special_shortcut[args[0]] if len(args) != len(targettypes) +1: - logger.warning('shortcut %s requires %s argument' % (args[0], len(targettypes))) - if len(args) < len(targettypes) +1: - return + if len(targettypes) == 1 and args[len(targettypes)].startswith('scan'): + args = args[:len(targettypes)] + [' '.join(args[len(targettypes):])] + targettypes = [str] else: - logger.warning('additional argument will be ignored') + logger.warning('shortcut %s requires %s argument' % (args[0], len(targettypes))) + if len(args) < len(targettypes) +1: + return + else: + logger.warning('additional argument will be ignored') values ={} for i, argtype in enumerate(targettypes): try: - values = {str(i): banner_mod.ConfigFile.format_variable(args[i+1], argtype, args[0])} + values[str(i)] = banner_mod.ConfigFile.format_variable(args[i+1], argtype, args[0]) except ValueError as e: logger.warning("Wrong argument: The entry #%s should be of type %s.", i+1, argtype) return except InvalidCmd as e: - logger.warning(str(e)) - return + if isinstance(args[i+1], str) and args[i+1].startswith('scan'): + values[str(i)] = args[i+1] + else: + logger.warning(str(e)) + return #else: # logger.warning("too many argument for this command") # return @@ -5787,7 +5868,7 @@ def do_set(self, line): if os.path.exists(pythia_path): logger.info('add line QCUT = %s in pythia_card.dat' % args[1]) p_card = open(pythia_path,'r').read() - p_card, n = re.subn('''^\s*QCUT\s*=\s*[\de\+\-\.]*\s*$''', + p_card, n = re.subn(r'''^\s*QCUT\s*=\s*[\de\+\-\.]*\s*$''', ''' QCUT = %s ''' % args[1], \ p_card, flags=(re.M+re.I)) if n==0: @@ -5801,7 +5882,7 @@ def do_set(self, line): if os.path.exists(pythia_path): logger.info('add line SHOWERKT = %s in pythia_card.dat' % args[1].upper()) p_card = open(pythia_path,'r').read() - p_card, n = re.subn('''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''', + p_card, n = re.subn(r'''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''', ''' SHOWERKT = %s ''' % args[1].upper(), \ p_card, flags=(re.M+re.I)) if n==0: @@ -5856,7 +5937,7 @@ def do_set(self, line): pjoin(self.me_dir,'Cards', 'delphes_card.dat')) return - if args[0] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', + if args[0] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', 'fo_card', 'delphes_card','madanalysis5_hadron_card','madanalysis5_parton_card','rivet_card']: if args[1] == 'default': @@ -6176,6 +6257,22 @@ def do_set(self, line): self.setRivet(args[start], value, default=default) self.rivet_card.write(self.paths['rivet'], self.paths['rivet_default']) + elif self.has_fo_card and (card in ['', 'fo_card'])\ + and args[start].lower() in [k.lower() for k in self.fo_card.string_vars]: + + if args[start] in self.conflict and card == '': + text = 'ambiguous name (present in more than one card). Please specify which card to edit' + logger.warning(text) + return + if args[start+1] == 'default': + value = self.fo_card_default[args[start]] + default = True + else: + value = args[start+1] + default = False + self.fo_card[args[start]] = value + self.modified_card.add('fo_card') + #INVALID -------------------------------------------------------------- else: logger.warning('invalid set command %s ' % line) @@ -6222,12 +6319,13 @@ def setM(self, block, name, value): def setR(self, name, value): - if self.mother_interface.inputfile: - self.run_card.set(name, value, user=True, raiseerror=True) - else: - self.run_card.set(name, value, user=True) - new_value = self.run_card.get(name) - logger.info('modify parameter %s of the run_card.dat to %s' % (name, new_value),'$MG:BOLD') + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + if self.mother_interface.inputfile: + self.run_card.set(name, value, user=True, raiseerror=True) + else: + self.run_card.set(name, value, user=True) + new_value = self.run_card.get(name) + logger.info('modify parameter %s of the run_card.dat to %s' % (name, new_value),'$MG:BOLD') def setML(self, name, value, default=False): @@ -6314,6 +6412,7 @@ def check_card_consistency(self): proc_charac = self.mother_interface.proc_characteristics if proc_charac['grouped_matrix'] and \ + isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int) and \ abs(self.run_card['lpp1']) == 1 == abs(self.run_card['lpp2']) and \ (self.run_card['nb_proton1'] != self.run_card['nb_proton2'] or self.run_card['nb_neutron1'] != self.run_card['nb_neutron2'] or @@ -6403,41 +6502,42 @@ def check_card_consistency(self): # check that only quark/gluon/photon are in initial beam if lpp=+-1 pdg_in_p = list(range(-6,7))+[21,22] - if (abs(self.run_card['lpp1'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial1'])) \ + if isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int): + if(abs(self.run_card['lpp1'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial1'])) \ or (abs(self.run_card['lpp2'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial2'])): - if 'pythia_card.dat' in self.cards or 'pythia8_card.dat' in self.cards: - path_to_remove = None - if 'pythia_card.dat' in self.cards: - path_to_remove = self.paths['pythia'] - card_to_remove = 'pythia_card.dat' - elif 'pythia8_card.dat' in self.cards: - path_to_remove = self.paths['pythia8'] - card_to_remove = 'pythia8_card.dat' - if path_to_remove: - if 'partonshower' in self.run_card['bypass_check']: + if 'pythia_card.dat' in self.cards or 'pythia8_card.dat' in self.cards: + path_to_remove = None + if 'pythia_card.dat' in self.cards: + path_to_remove = self.paths['pythia'] + card_to_remove = 'pythia_card.dat' + elif 'pythia8_card.dat' in self.cards: + path_to_remove = self.paths['pythia8'] + card_to_remove = 'pythia8_card.dat' + if path_to_remove: + if 'partonshower' in self.run_card['bypass_check']: + logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") + else: + logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') + os.remove(path_to_remove) + self.cards.remove(card_to_remove) + else: + logger.info('Remember that Parton-Shower are not yet ready for such proton component definition (HW implementation in progress).', '$MG:BOLD' ) + elif (abs(self.run_card['lpp1'])==3 and abs(self.run_card['lpp2'])==3): + if 'pythia8_card.dat' in self.cards: + if self.run_card['pdlabel'] == 'isronlyll': + if 'partonshower' not in self.run_card['bypass_check']: + # force that QED shower is on? + for param in ['TimeShower:QEDshowerByQ', 'TimeShower:QEDshowerByL', 'TimeShower:QEDshowerByGamma', 'SpaceShower:QEDshowerByQ', 'SpaceShower:QEDshowerByL']: + if param not in self.PY8Card or \ + (not self.PY8Card[param] and param.lower() not in self.PY8Card.user_set): + logger.warning('Activating QED shower: setting %s to True', param) + self.PY8Card[param] = True + elif 'partonshower' in self.run_card['bypass_check']: logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") - else: + else: logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') - os.remove(path_to_remove) - self.cards.remove(card_to_remove) - else: - logger.info('Remember that Parton-Shower are not yet ready for such proton component definition (HW implementation in progress).', '$MG:BOLD' ) - elif (abs(self.run_card['lpp1'])==3 and abs(self.run_card['lpp2'])==3): - if 'pythia8_card.dat' in self.cards: - if self.run_card['pdlabel'] == 'isronlyll': - if 'partonshower' not in self.run_card['bypass_check']: - # force that QED shower is on? - for param in ['TimeShower:QEDshowerByQ', 'TimeShower:QEDshowerByL', 'TimeShower:QEDshowerByGamma', 'SpaceShower:QEDshowerByQ', 'SpaceShower:QEDshowerByL']: - if param not in self.PY8Card or \ - (not self.PY8Card[param] and param.lower() not in self.PY8Card.user_set): - logger.warning('Activating QED shower: setting %s to True', param) - self.PY8Card[param] = True - elif 'partonshower' in self.run_card['bypass_check']: - logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") - else: - logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') - os.remove(self.paths['pythia8']) - self.cards.remove('pythia8_card.dat') + os.remove(self.paths['pythia8']) + self.cards.remove('pythia8_card.dat') ######################################################################## @@ -6514,7 +6614,8 @@ def check_card_consistency(self): #check relation between lepton PDF // dressed lepton collisions // ... - if abs(self.run_card['lpp1']) != 1 or abs(self.run_card['lpp2']) != 1: + if isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int) and \ + abs(self.run_card['lpp1']) != 1 or abs(self.run_card['lpp2']) != 1: if abs(self.run_card['lpp1']) == abs(self.run_card['lpp2']) == 3: # this can be dressed lepton or photon-flux if proc_charac['pdg_initial1'] in [[11],[-11]] and proc_charac['pdg_initial2'] in [[11],[-11]]: @@ -6732,7 +6833,11 @@ def write_card_param(self): """ write the param_card """ self.param_card.write(self.paths['param']) - + + def write_card_fo_card(self): + """ write the fo_card""" + self.fo_card.write_card_from_template(self.paths['FO_analyse'], self.paths['FO_analyse_default']) + @staticmethod def update_dependent(mecmd, me_dir, param_card, path ,timer=0, run_card=None, lhapdfconfig=None): @@ -7076,7 +7181,7 @@ def do_decay(self, line): #first find the particle particle = line.split('>')[0].strip() logger.info("change madspin_card to define the decay of %s: %s" %(particle, line.strip()), '$MG:BOLD') - particle = particle.replace('+','\+').replace('-','\-') + particle = particle.replace('+',r'\+').replace('-',r'\-') decay_pattern = re.compile(r"^\s*decay\s+%s\s*>[\s\w+-~]*?$" % particle, re.I+re.M) text= open(path).read() text = decay_pattern.sub('', text) @@ -7193,7 +7298,7 @@ def help_edit(self, prefix=True): logger.info( ' --clean remove all previously existing line in the file') logger.info( ' --comment_line="" comment all lines matching the regular expression') logger.info('') - logger.info(' Note: all regular-expression will be prefixed by ^\s*') + logger.info(r' Note: all regular-expression will be prefixed by ^\s*') logger.info('') logger.info( ' example: edit reweight --after_line="change mode\b" change model heft') logger.info( ' edit madspin --after_line="banner" change model XXXX') @@ -7314,7 +7419,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''replace_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[14:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[14:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7344,7 +7449,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''comment_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[14:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[14:-1] nb_mod = 0 for posline,l in enumerate(split): if re.search(pattern, l): @@ -7366,7 +7471,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''before_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[13:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[13:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7383,7 +7488,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern = r'''after_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[12:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[12:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7527,16 +7632,19 @@ def open_file(self, answer): answer = 'plot' else: answer = self.cards[int(answer)-self.integer_bias] - + path = '' if 'madweight' in answer: answer = answer.replace('madweight', 'MadWeight') elif 'MadLoopParams' in answer: answer = self.paths['ML'] elif 'pythia8_card' in answer: answer = self.paths['pythia8'] + elif 'FO_analyse' in answer: + path = self.paths['FO_analyse'] + answer = 'fo_card' if os.path.exists(answer): path = answer - else: + elif not os.path.exists(path): if not '.dat' in answer and not '.lhco' in answer: if answer != 'trigger': path = self.paths[answer] @@ -7595,7 +7703,8 @@ def reload_card(self, path): logger.error('Please re-open the file and fix the problem.') logger.warning('using the \'set\' command without opening the file will discard all your manual change') elif path == self.paths['run']: - self.run_card = banner_mod.RunCard(path) + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + self.run_card = banner_mod.RunCard(path) elif path == self.paths['shower']: self.shower_card = shower_card_mod.ShowerCard(path) elif path == self.paths['ML']: @@ -7614,6 +7723,8 @@ def reload_card(self, path): except: import internal.madweight.Cards as mwcards self.mw_card = mwcards.Card(path) + elif path == self.paths['FO_analyse']: + self.fo_card = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse']) else: logger.debug('not keep in sync: %s', path) return path @@ -7629,6 +7740,9 @@ def scanparamcardhandling(input_path=lambda obj: pjoin(obj.me_dir, 'Cards', 'par iteratorclass=param_card_mod.ParamCardIterator, summaryorder=lambda obj: lambda:None, check_card=lambda obj: CommonRunCmd.static_check_param_card, + run_card_scan=False, + run_card_input= lambda obj: pjoin(obj.me_dir, 'Cards', 'run_card.dat'), + run_card_iteratorclass=banner_mod.RunCardIterator, ): """ This is a decorator for customizing/using scan over the param_card (or technically other) This should be use like this: @@ -7678,7 +7792,60 @@ def __enter__(self): def __exit__(self, ctype, value, traceback ): self.iterator.write(self.path) - def decorator(original_fct): + def scan_over_run_card(original_fct, obj, *args, **opts): + + if isinstance(input_path, str): + card_path = run_card_input + else: + card_path = run_card_input(obj) + + run_card_iterator = run_card_iteratorclass(card_path) + orig_card = copy.deepcopy(run_card_iterator.run_card) + if not run_card_iterator.run_card.scan_set: + return original_fct(obj, *args, **opts) + + + with restore_iterator(orig_card, card_path): + # this with statement ensure that the original card is restore + # whatever happens inside those block + + if not hasattr(obj, 'allow_notification_center'): + obj.allow_notification_center = False + with misc.TMP_variable(obj, 'allow_notification_center', False): + orig_name = get_run_name(obj) + if not orig_name and args[1]: + orig_name = args[1][0] + args = (args[0], args[1][1:]) + #orig_name = "scan_%s" % len(obj.results) + + try: + os.mkdir(pjoin(obj.me_dir, 'Events', orig_name)) + except Exception: + pass + next_name = orig_name + "_00" + + for i,card in enumerate(run_card_iterator): + card.write(card_path) + # still have to check for the auto-wdith + #if i !=0: + next_name = run_card_iterator.get_next_name(next_name) + set_run_name(obj)(next_name) + try: + original_fct(obj, *args, **opts) + except ignoreerror as error: + run_card_iterator.store_entry(next_name, {'exception': error}) + else: + run_card_iterator.store_entry(next_name, store_for_scan(obj)(), run_card_path=card_path) + + #param_card_iterator.write(card_path) #-> this is done by the with statement + name = misc.get_scan_name(orig_name, next_name) + path = result_path(obj) % name + logger.info("write scan results in %s" % path ,'$MG:BOLD') + order = summaryorder(obj)() + run_card_iterator.write_summary(path, order=order) + + + def decorator(original_fct): def new_fct(obj, *args, **opts): if isinstance(input_path, str): @@ -7702,8 +7869,13 @@ def new_fct(obj, *args, **opts): if not param_card_iterator: #first run of the function - original_fct(obj, *args, **opts) - return + if run_card_scan: + scan_over_run_card(original_fct, obj, *args, **opts) + return + else: + #first run of the function + original_fct(obj, *args, **opts) + return with restore_iterator(param_card_iterator, card_path): # this with statement ensure that the original card is restore diff --git a/epochX/cudacpp/gq_ttq.mad/bin/internal/extended_cmd.py b/epochX/cudacpp/gq_ttq.mad/bin/internal/extended_cmd.py index 2f37070580..789976beee 100755 --- a/epochX/cudacpp/gq_ttq.mad/bin/internal/extended_cmd.py +++ b/epochX/cudacpp/gq_ttq.mad/bin/internal/extended_cmd.py @@ -624,12 +624,12 @@ def complete(self, text, state): compfunc = self.completenames # correct wrong splittion with '\ ' - if line and begidx > 2 and line[begidx-2:begidx] == '\ ': + if line and begidx > 2 and line[begidx-2:begidx] == r'\ ': Ntext = line.split(os.path.sep)[-1] - self.completion_prefix = Ntext.rsplit('\ ', 1)[0] + '\ ' + self.completion_prefix = Ntext.rsplit(r'\ ', 1)[0] + r'\ ' to_rm = len(self.completion_prefix) - 1 Nbegidx = len(line.rsplit(os.path.sep, 1)[0]) + 1 - data = compfunc(Ntext.replace('\ ', ' '), line, Nbegidx, endidx) + data = compfunc(Ntext.replace(r'\ ', ' '), line, Nbegidx, endidx) self.completion_matches = [p[to_rm:] for p in data if len(p)>to_rm] # correct wrong splitting with '-'/"=" @@ -742,7 +742,7 @@ def path_completion(text, base_dir = None, only_dirs = False, completion += [prefix + f for f in ['.'+os.path.sep, '..'+os.path.sep] if \ f.startswith(text) and not prefix.startswith('.')] - completion = [a.replace(' ','\ ') for a in completion] + completion = [a.replace(' ',r'\ ') for a in completion] return completion @@ -1253,7 +1253,7 @@ def check_answer_in_input_file(self, question_instance, default, path=False, lin return possibility[0] if '=' in line and ' ' in line.strip(): leninit = len(line) - line,n = re.subn('\s*=\s*','=', line) + line,n = re.subn(r'\s*=\s*','=', line) if n and len(line) != leninit: return self.check_answer_in_input_file(question_instance, default, path=path, line=line) @@ -1311,7 +1311,7 @@ def nice_error_handling(self, error, line): if os.path.exists(self.debug_output): os.remove(self.debug_output) try: - super(Cmd,self).onecmd('history %s' % self.debug_output.replace(' ', '\ ')) + super(Cmd,self).onecmd('history %s' % self.debug_output.replace(' ', r'\ ')) except Exception as error: logger.error(error) @@ -2001,6 +2001,7 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): text = "" has_mg5_path = False # Use local configuration => Need to update the path + already_written = set() for line in open(basefile): if '=' in line: data, value = line.split('=',1) @@ -2018,9 +2019,12 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): comment = '' if key in to_keep: value = str(to_keep[key]) - else: + elif line not in already_written: + already_written.add(line) text += line continue + else: + continue if key == 'mg5_path': has_mg5_path = True try: @@ -2032,14 +2036,20 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): # check if absolute path if not os.path.isabs(value): value = os.path.realpath(os.path.join(basedir, value)) - text += '%s = %s # %s \n' % (key, value, comment) + new_line = '%s = %s # %s \n' % (key, value, comment) + if new_line not in already_written: + text += new_line + already_written.add(new_line) for key in to_write: if key in to_keep: - text += '%s = %s \n' % (key, to_keep[key]) + new_line = '%s = %s \n' % (key, to_keep[key]) + if new_line not in already_written: + text += new_line if not MADEVENT and not has_mg5_path: - text += """\n# MG5 MAIN DIRECTORY\n""" - text += "mg5_path = %s\n" % MG5DIR + if "mg5_path = %s\n" % MG5DIR not in already_written: + text += """\n# MG5 MAIN DIRECTORY\n""" + text += "mg5_path = %s\n" % MG5DIR writer = open(filepath,'w') writer.write(text) @@ -2190,7 +2200,7 @@ def onecmd(self, line, **opt): raise def reask(self, reprint_opt=True): - pat = re.compile('\[(\d*)s to answer\]') + pat = re.compile(r'\[(\d*)s to answer\]') prev_timer = signal.alarm(0) # avoid timer if any if prev_timer: @@ -2991,7 +3001,7 @@ def question_formatting(self, nb_col = 80, lpotential_switch=0, lnb_key=0, key=None): - """should return four lines: + r"""should return four lines: 1. The upper band (typically /========\ 2. The lower band (typically \========/ 3. The line without conflict | %(nb)2d. %(descrip)-20s %(name)5s = %(switch)-10s | @@ -3239,13 +3249,13 @@ def create_question(self, help_text=True): data_to_format['conflict_switch'] = self.color_for_value(key,self.inconsistent_keys[key], consistency=False) if hidden_line: - f2 = re.sub('%(\((?:name|descrip|add_info)\)-?)(\d+)s', + f2 = re.sub(r'%(\((?:name|descrip|add_info)\)-?)(\d+)s', lambda x: '%%%s%ds' % (x.group(1),int(x.group(2))+9), f2) text.append(f2 % data_to_format) elif hidden_line: if not f3: - f3 = re.sub('%(\((?:name|descrip|add_info)\)-?)(\d+)s', + f3 = re.sub(r'%(\((?:name|descrip|add_info)\)-?)(\d+)s', lambda x: '%%%s%ds' % (x.group(1),int(x.group(2))+9), f1) text.append(f3 % data_to_format) diff --git a/epochX/cudacpp/gq_ttq.mad/bin/internal/file_writers.py b/epochX/cudacpp/gq_ttq.mad/bin/internal/file_writers.py index 41bff05276..526756129f 100755 --- a/epochX/cudacpp/gq_ttq.mad/bin/internal/file_writers.py +++ b/epochX/cudacpp/gq_ttq.mad/bin/internal/file_writers.py @@ -36,10 +36,10 @@ class FileWriter(io.FileIO): supported_preprocessor_commands = ['if'] preprocessor_command_re=re.compile( - "\s*(?P%s)\s*\(\s*(?P.*)\s*\)\s*{\s*"\ + r"\s*(?P%s)\s*\(\s*(?P.*)\s*\)\s*{\s*"\ %('|'.join(supported_preprocessor_commands))) preprocessor_endif_re=re.compile(\ - "\s*}\s*(?Pelse)?\s*(\((?P.*)\))?\s*(?P{)?\s*") + r"\s*}\s*(?Pelse)?\s*(\((?P.*)\))?\s*(?P{)?\s*") class FileWriterError(IOError): """Exception raised if an error occurs in the definition @@ -191,15 +191,15 @@ class FortranWriterError(FileWriter.FileWriterError): pass # Parameters defining the output of the Fortran writer - keyword_pairs = {'^if.+then\s*$': ('^endif', 2), - '^type(?!\s*\()\s*.+\s*$': ('^endtype', 2), - '^do(?!\s+\d+)\s+': ('^enddo\s*$', 2), - '^subroutine': ('^end\s*$', 0), - '^module': ('^end\s*$', 0), - 'function': ('^end\s*$', 0)} - single_indents = {'^else\s*$':-2, - '^else\s*if.+then\s*$':-2} - number_re = re.compile('^(?P\d+)\s+(?P.*)') + keyword_pairs = {r'^if.+then\s*$': ('^endif', 2), + r'^type(?!\s*\()\s*.+\s*$': ('^endtype', 2), + r'^do(?!\s+\d+)\s+': (r'^enddo\s*$', 2), + '^subroutine': (r'^end\s*$', 0), + '^module': (r'^end\s*$', 0), + 'function': (r'^end\s*$', 0)} + single_indents = {r'^else\s*$':-2, + r'^else\s*if.+then\s*$':-2} + number_re = re.compile(r'^(?P\d+)\s+(?P.*)') line_cont_char = '$' comment_char = 'c' uniformcase = True #force everyting to be lower/upper case @@ -212,7 +212,7 @@ class FortranWriterError(FileWriter.FileWriterError): # Private variables __indent = 0 __keyword_list = [] - __comment_pattern = re.compile(r"^(\s*#|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|!)", re.IGNORECASE) + __comment_pattern = re.compile(r"^(\s*#|c\$|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|\s*!|!\$)", re.IGNORECASE) __continuation_line = re.compile(r"(?: )[$&]") def write_line(self, line): @@ -424,26 +424,20 @@ def count_number_of_quotes(self, line): i = i + 1 return len(splitline)-1 - def remove_routine(self, text, fct_names, formatting=True): - """write the incoming text but fully removing the associate routine/function - text can be a path to a file, an iterator, a string - fct_names should be a list of functions to remove + @staticmethod + def get_routine(text, fct_names, call_back=None): + """ + get the fortran function from a fortran file """ - f77_type = ['real*8', 'integer', 'double precision', 'logical'] - pattern = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I) - + + if isinstance(text, str): + text = text.split('\n') + + to_write=False removed = [] - if isinstance(text, str): - if '\n' in text: - text = text.split('\n') - else: - text = open(text) - if isinstance(fct_names, str): - fct_names = [fct_names] - - to_write=True for line in text: fct = pattern.findall(line) if fct: @@ -451,22 +445,38 @@ def remove_routine(self, text, fct_names, formatting=True): to_write = False else: to_write = True - if to_write: - if formatting: - if line.endswith('\n'): - line = line[:-1] - self.writelines(line) - else: - if not line.endswith('\n'): - line = '%s\n' % line - super(FileWriter,self).writelines(line) + if call_back: + call_back(line) else: removed.append(line) - + return removed + + def remove_routine(self, text, fct_names, formatting=True): + """write the incoming text but fully removing the associate routine/function + text can be a path to a file, an iterator, a string + fct_names should be a list of functions to remove + """ + + def call_back(line): + if formatting: + if line.endswith('\n'): + line = line[:-1] + self.writelines(line) + else: + if not line.endswith('\n'): + line = '%s\n' % line + super(FileWriter,self).writelines(line) + + return self.get_routine(text, fct_names, call_back) + +class FortranWriter90(FortranWriter): + + comment_char = ' !' + #=============================================================================== # CPPWriter #=============================================================================== @@ -497,50 +507,50 @@ class CPPWriterError(FileWriter.FileWriterError): '^private': standard_indent, '^protected': standard_indent} - spacing_patterns = [ - ('\s*\"\s*}', '\"'), - ('\s*,\s*', ', '), - ('\s*-\s*', ' - '), - ('([{(,=])\s*-\s*', '\g<1> -'), - ('(return)\s*-\s*', '\g<1> -'), - ('\s*\+\s*', ' + '), - ('([{(,=])\s*\+\s*', '\g<1> +'), - ('\(\s*', '('), - ('\s*\)', ')'), - ('\{\s*', '{'), - ('\s*\}', '}'), - ('\s*=\s*', ' = '), - ('\s*>\s*', ' > '), - ('\s*<\s*', ' < '), - ('\s*!\s*', ' !'), - ('\s*/\s*', '/'), - ('(?\s+>\s*', ' >> '), - ('<\s*double\s*>>\s*', ' > '), - ('\s*<\s+<\s*', ' << '), - ('\s*-\s+>\s*', '->'), - ('\s*=\s+=\s*', ' == '), - ('\s*!\s+=\s*', ' != '), - ('\s*>\s+=\s*', ' >= '), - ('\s*<\s+=\s*', ' <= '), - ('\s*&&\s*', ' && '), - ('\s*\|\|\s*', ' || '), - ('\s*{\s*}', ' {}'), - ('\s*;\s*', '; '), - (';\s*\}', ';}'), - (';\s*$}', ';'), - ('\s*<\s*([a-zA-Z0-9]+?)\s*>', '<\g<1>>'), - ('^#include\s*<\s*(.*?)\s*>', '#include <\g<1>>'), - ('(\d+\.{0,1}\d*|\.\d+)\s*[eE]\s*([+-]{0,1})\s*(\d+)', - '\g<1>e\g<2>\g<3>'), - ('\s+',' '), - ('^\s*#','#')] + spacing_patterns = [(r'\s*\"\s*}', '\"'), + (r'\s*,\s*', ', '), + (r'\s*-\s*', ' - '), + (r'([{(,=])\s*-\s*', r'\g<1> -'), + (r'(return)\s*-\s*', r'\g<1> -'), + (r'\s*\+\s*', ' + '), + (r'([{(,=])\s*\+\s*', r'\g<1> +'), + (r'\(\s*', '('), + (r'\s*\)', ')'), + (r'\{\s*', '{'), + (r'\s*\}', '}'), + (r'\s*=\s*', ' = '), + (r'\s*>\s*', ' > '), + (r'\s*<\s*', ' < '), + (r'\s*!\s*', ' !'), + (r'\s*/\s*', '/'), + (r'\s*\*\s*', ' * '), + (r'\s*-\s+-\s*', '-- '), + (r'\s*\+\s+\+\s*', '++ '), + (r'\s*-\s+=\s*', ' -= '), + (r'\s*\+\s+=\s*', ' += '), + (r'\s*\*\s+=\s*', ' *= '), + (r'\s*/=\s*', ' /= '), + (r'\s*>\s+>\s*', ' >> '), + (r'<\s*double\s*>>\s*', ' > '), + (r'\s*<\s+<\s*', ' << '), + (r'\s*-\s+>\s*', '->'), + (r'\s*=\s+=\s*', ' == '), + (r'\s*!\s+=\s*', ' != '), + (r'\s*>\s+=\s*', ' >= '), + (r'\s*<\s+=\s*', ' <= '), + (r'\s*&&\s*', ' && '), + (r'\s*\|\|\s*', ' || '), + (r'\s*{\s*}', ' {}'), + (r'\s*;\s*', '; '), + (r';\s*\}', ';}'), + (r';\s*$}', ';'), + (r'\s*<\s*([a-zA-Z0-9]+?)\s*>', r'<\g<1>>'), + (r'^#include\s*<\s*(.*?)\s*>', r'#include <\g<1>>'), + (r'(\d+\.{0,1}\d*|\.\d+)\s*[eE]\s*([+-]{0,1})\s*(\d+)', + r'\g<1>e\g<2>\g<3>'), + (r'\s+',' '), + (r'^\s*#','#')] + spacing_re = dict([(key[0], re.compile(key[0])) for key in \ spacing_patterns]) diff --git a/epochX/cudacpp/gq_ttq.mad/bin/internal/gen_crossxhtml.py b/epochX/cudacpp/gq_ttq.mad/bin/internal/gen_crossxhtml.py index d58ec573bc..681bf9d09b 100755 --- a/epochX/cudacpp/gq_ttq.mad/bin/internal/gen_crossxhtml.py +++ b/epochX/cudacpp/gq_ttq.mad/bin/internal/gen_crossxhtml.py @@ -648,7 +648,7 @@ def recreate(self, banner): if run_card['ickkw'] != 0: #parse the file to have back the information pythia_log = misc.BackRead(pjoin(path, '%s_pythia.log' % tag)) - pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") + pythiare = re.compile(r"\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") for line in pythia_log: info = pythiare.search(line) if not info: @@ -1623,7 +1623,7 @@ def get_html(self, runresults): elif self.debug: text = str(self.debug).replace('. ','.
') if 'http' in text: - pat = re.compile('(http[\S]*)') + pat = re.compile(r'(http[\S]*)') text = pat.sub(r' here ', text) debug = '
%s
%s
' % \ (self.debug.__class__.__name__, text) diff --git a/epochX/cudacpp/gq_ttq.mad/bin/internal/gen_ximprove.py b/epochX/cudacpp/gq_ttq.mad/bin/internal/gen_ximprove.py index c86da36a05..415ecc9de0 100755 --- a/epochX/cudacpp/gq_ttq.mad/bin/internal/gen_ximprove.py +++ b/epochX/cudacpp/gq_ttq.mad/bin/internal/gen_ximprove.py @@ -158,8 +158,11 @@ def get_helicity(self, to_submit=True, clean=True): (stdout, _) = p.communicate(''.encode()) stdout = stdout.decode('ascii',errors='ignore') if stdout: - nb_channel = max([math.floor(float(d)) for d in stdout.split()]) + lines = stdout.strip().split('\n') + nb_channel = max([math.floor(float(d)) for d in lines[-1].split()]) else: + if os.path.exists(pjoin(self.me_dir, 'error')): + os.remove(pjoin(self.me_dir, 'error')) for matrix_file in misc.glob('matrix*orig.f', Pdir): files.cp(matrix_file, matrix_file.replace('orig','optim')) P_zero_result.append(Pdir) @@ -297,12 +300,14 @@ def get_helicity(self, to_submit=True, clean=True): bad_amps_perhel = [] if __debug__: mtext = open(matrix_file).read() - nb_amp = int(re.findall('PARAMETER \(NGRAPHS=(\d+)\)', mtext)[0]) - logger.debug('nb_hel: %s zero amp: %s bad_amps_hel: %s/%s', len(good_hels),len(bad_amps),len(bad_amps_perhel), len(good_hels)*nb_amp ) + nb_amp = int(re.findall(r'PARAMETER \(NGRAPHS=(\d+)\)', mtext)[0]) + logger.debug('(%s) nb_hel: %s zero amp: %s bad_amps_hel: %s/%s', split_file[-1], len(good_hels),len(bad_amps),len(bad_amps_perhel), len(good_hels)*nb_amp ) if len(good_hels) == 1: files.cp(matrix_file, matrix_file.replace('orig','optim')) continue # avoid optimization if onlye one helicity - recycler = hel_recycle.HelicityRecycler(good_hels, bad_amps, bad_amps_perhel) + + gauge = self.cmd.proc_characteristics['gauge'] + recycler = hel_recycle.HelicityRecycler(good_hels, bad_amps, bad_amps_perhel, gauge=gauge) # In case of bugs you can play around with these: recycler.hel_filt = self.run_card['hel_filtering'] recycler.amp_splt = self.run_card['hel_splitamp'] @@ -1299,7 +1304,7 @@ def get_job_for_event(self): 'script_name': 'unknown', 'directory': C.name, # need to be change for splitted job 'P_dir': C.parent_name, - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # needed for RO gridpack 'offset': 1, # need to be change for splitted job 'nevents': nevents, 'maxiter': self.max_iter, @@ -1387,7 +1392,7 @@ def create_ajob(self, template, jobs, write_dir=None): break info = jobs[j] info['script_name'] = 'ajob%i' % script_number - info['keeplog'] = 'false' + info['keeplog'] = 'false' if self.run_card['keep_log'] != 'debug' else 'true' if "base_directory" not in info: info["base_directory"] = "./" fsock.write(template_text % info) @@ -1456,7 +1461,7 @@ def get_job_for_precision(self): 'script_name': 'unknown', 'directory': C.name, # need to be change for splitted job 'P_dir': C.parent_name, - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # used for RO gridpack 'offset': 1, # need to be change for splitted job 'nevents': nevents, 'maxiter': self.max_iter, @@ -1916,7 +1921,7 @@ def get_job_for_event(self): 'directory': C.name, # need to be change for splitted job 'P_dir': os.path.basename(C.parent_name), 'offset': 1, # need to be change for splitted job - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # use for RO gridpack 'nevents': nevents, #int(nevents*self.gen_events_security)+1, 'maxiter': self.max_iter, 'miniter': self.min_iter, diff --git a/epochX/cudacpp/gq_ttq.mad/bin/internal/hel_recycle.py b/epochX/cudacpp/gq_ttq.mad/bin/internal/hel_recycle.py index dfa45d5d20..6c86611f68 100755 --- a/epochX/cudacpp/gq_ttq.mad/bin/internal/hel_recycle.py +++ b/epochX/cudacpp/gq_ttq.mad/bin/internal/hel_recycle.py @@ -383,7 +383,7 @@ def get_number(cls, *args): class HelicityRecycler(): '''Class for recycling helicity''' - def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[]): + def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[], gauge='U'): External.good_hel = [] External.nhel_lines = '' @@ -427,6 +427,7 @@ def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[]): self.all_hel = [] self.hel_filt = True + self.gauge = gauge def set_input(self, file): if 'born_matrix' in file: @@ -612,7 +613,7 @@ def unfold_helicities(self, line, nature): def apply_amps(self, line, new_objs): if self.amp_splt: - return split_amps(line, new_objs) + return split_amps(line, new_objs, gauge=self.gauge) else: return apply_args(line, [i.args for i in new_objs]) @@ -785,7 +786,7 @@ def apply_args(old_line, all_the_args): return ''.join(new_lines) -def split_amps(line, new_amps): +def split_amps(line, new_amps, gauge): if not new_amps: return '' fct = line.split('(',1)[0].split('_0')[0] @@ -841,34 +842,31 @@ def split_amps(line, new_amps): spin = fct.split(None,1)[1][to_remove] lines.append('%sP1N_%s(%s)' % (fct, to_remove+1, ', '.join(args))) - hel, iamp = re.findall('AMP\((\d+),(\d+)\)', amp_result)[0] + hel, iamp = re.findall(r'AMP\((\d+),(\d+)\)', amp_result)[0] hel_calculated.append(hel) #lines.append(' %(result)s = TMP(3) * W(3,%(w)s) + TMP(4) * W(4,%(w)s)+' # % {'result': amp_result, 'w': windex}) #lines.append(' & TMP(5) * W(5,%(w)s)+TMP(6) * W(6,%(w)s)' # % {'result': amp_result, 'w': windex}) - if spin in "VF": - lines.append(""" call CombineAmp(%(nb)i, - & (/%(hel_list)s/), - & (/%(w_list)s/), - & TMP, W, AMP(1,%(iamp)s))""" % - {'nb': len(sub_amps), - 'hel_list': ','.join(hel_calculated), - 'w_list': ','.join(windices), - 'iamp': iamp - }) + if spin == "F" or ( spin == "V" and gauge !='FD'): + suffix = '' elif spin == "S": - lines.append(""" call CombineAmpS(%(nb)i, - &(/%(hel_list)s/), - & (/%(w_list)s/), - & TMP, W, AMP(1,%(iamp)s))""" % - {'nb': len(sub_amps), - 'hel_list': ','.join(hel_calculated), - 'w_list': ','.join(windices), - 'iamp': iamp - }) + suffix = 'S' + elif spin == "V" and gauge == "FD": + suffix = "FD" else: - raise Exception("split amp are not supported for spin2 and 3/2") + raise Exception("split amp not supported for spin2, 3/2") + + lines.append(""" call CombineAmp%(suffix)s(%(nb)i, + & (/%(hel_list)s/), + & (/%(w_list)s/), + & TMP, W, AMP(1,%(iamp)s))""" % {'suffix':suffix, + 'nb': len(sub_amps), + 'hel_list': ','.join(hel_calculated), + 'w_list': ','.join(windices), + 'iamp': iamp + }) + #lines.append('') return '\n'.join(lines) diff --git a/epochX/cudacpp/gq_ttq.mad/bin/internal/histograms.py b/epochX/cudacpp/gq_ttq.mad/bin/internal/histograms.py index 98f22c4c3a..9931127f66 100755 --- a/epochX/cudacpp/gq_ttq.mad/bin/internal/histograms.py +++ b/epochX/cudacpp/gq_ttq.mad/bin/internal/histograms.py @@ -632,34 +632,34 @@ class HwU(Histogram): # than necessary because the HwU standard allows for spaces from within # the name of a weight weight_header_re = re.compile( - '&\s*(?P(\S|(\s(?!\s*(&|$))))+)(\s(?!(&|$)))*') + r'&\s*(?P(\S|(\s(?!\s*(&|$))))+)(\s(?!(&|$)))*') # ================================ # Histo weight specification RE's # ================================ # The start of a plot - histo_start_re = re.compile('^\s*\s*(?P\d+)\s*"\s*'+ - '(?P(\S|(\s(?!\s*")))+)\s*"\s*$') + histo_start_re = re.compile(r'^\s*\s*(?P\d+)\s*"\s*'+ + r'(?P(\S|(\s(?!\s*")))+)\s*"\s*$') # A given weight specifier - a_float_re = '[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' - histo_bin_weight_re = re.compile('(?P%s|NaN)'%a_float_re,re.IGNORECASE) - a_int_re = '[\+|-]?\d+' + a_float_re = r'[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' + histo_bin_weight_re = re.compile(r'(?P%s|NaN)'%a_float_re,re.IGNORECASE) + a_int_re = r'[\+|-]?\d+' # The end of a plot histo_end_re = re.compile(r'^\s*<\\histogram>\s*$') # A scale type of weight - weight_label_scale = re.compile('^\s*mur\s*=\s*(?P%s)'%a_float_re+\ - '\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) - weight_label_PDF = re.compile('^\s*PDF\s*=\s*(?P\d+)\s*$') - weight_label_PDF_XML = re.compile('^\s*pdfset\s*=\s*(?P\d+)\s*$') - weight_label_TMS = re.compile('^\s*TMS\s*=\s*(?P%s)\s*$'%a_float_re) - weight_label_alpsfact = re.compile('^\s*alpsfact\s*=\s*(?P%s)\s*$'%a_float_re, + weight_label_scale = re.compile(r'^\s*mur\s*=\s*(?P%s)'%a_float_re+\ + r'\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) + weight_label_PDF = re.compile(r'^\s*PDF\s*=\s*(?P\d+)\s*$') + weight_label_PDF_XML = re.compile(r'^\s*pdfset\s*=\s*(?P\d+)\s*$') + weight_label_TMS = re.compile(r'^\s*TMS\s*=\s*(?P%s)\s*$'%a_float_re) + weight_label_alpsfact = re.compile(r'^\s*alpsfact\s*=\s*(?P%s)\s*$'%a_float_re, re.IGNORECASE) - weight_label_scale_adv = re.compile('^\s*dyn\s*=\s*(?P%s)'%a_int_re+\ - '\s*mur\s*=\s*(?P%s)'%a_float_re+\ - '\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) - weight_label_PDF_adv = re.compile('^\s*PDF\s*=\s*(?P\d+)\s+(?P\S+)\s*$') + weight_label_scale_adv = re.compile(r'^\s*dyn\s*=\s*(?P%s)'%a_int_re+\ + r'\s*mur\s*=\s*(?P%s)'%a_float_re+\ + r'\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) + weight_label_PDF_adv = re.compile(r'^\s*PDF\s*=\s*(?P\d+)\s+(?P\S+)\s*$') class ParseError(MadGraph5Error): @@ -926,7 +926,7 @@ def get_HwU_source(self, print_header=True): res.append(' '.join('%+16.7e'%wgt for wgt in list(bin.boundaries))) res[-1] += ' '.join('%+16.7e'%bin.wgts[key] for key in self.bins.weight_labels if key not in ['central','stat_error']) - res.append('<\histogram>') + res.append(r'<\histogram>') return res def output(self, path=None, format='HwU', print_header=True): @@ -1149,6 +1149,8 @@ def parse_one_histo_from_stream(self, stream, all_weight_header, boundaries = [0.0,0.0] for j, weight in \ enumerate(HwU.histo_bin_weight_re.finditer(line_bin)): + if (j == len(weight_header)): + continue if j == len(all_weight_header): raise HwU.ParseError("There is more bin weights"+\ " specified than expected (%i)"%len(weight_header)) @@ -1803,7 +1805,7 @@ def parse_histos_from_PY8_XML_stream(self, stream, run_id=None, # Filter empty weights coming from the split weight_label_list = [wgt.strip() for wgt in str(selected_run_node.getAttribute('header')).split(';') if - not re.match('^\s*$',wgt)] + not re.match(r'^\s*$',wgt)] ordered_weight_label_list = [w for w in weight_label_list if w not\ in ['xmin','xmax']] # Remove potential repetition of identical weight labels @@ -1827,7 +1829,7 @@ def parse_histos_from_PY8_XML_stream(self, stream, run_id=None, all_weights = [] for wgt_position, wgt_label in \ enumerate(str(selected_run_node.getAttribute('header')).split(';')): - if not re.match('^\s*$',wgt_label) is None: + if not re.match(r'^\s*$',wgt_label) is None: continue all_weights.append({'POSITION':wgt_position}) for wgt_item in wgt_label.strip().split('_'): @@ -2714,7 +2716,7 @@ def ratio_no_correlations(wgtsA, wgtsB): # First the global gnuplot header for this histogram group global_header =\ -""" +r""" ################################################################################ ### Rendering of the plot titled '%(title)s' ################################################################################ @@ -2862,9 +2864,9 @@ def ratio_no_correlations(wgtsA, wgtsB): major_title = ', '.join(major_title) if not mu[0] in ['none',None]: - major_title += ', dynamical\_scale\_choice=%s'%mu[0] + major_title += r', dynamical\_scale\_choice=%s'%mu[0] if not pdf[0] in ['none',None]: - major_title += ', PDF=%s'%pdf[0].replace('_','\_') + major_title += ', PDF=%s'%pdf[0].replace('_',r'\_') # Do not show uncertainties for individual jet samples (unless first # or specified explicitely and uniquely) @@ -2937,7 +2939,7 @@ def ratio_no_correlations(wgtsA, wgtsB): plot_lines.append( "'%s' index %d using (($1+$2)/2):%d ls %d title '%s'"\ %(HwU_name,block_position+i,mu_var+3,color_index,\ -'%s dynamical\_scale\_choice=%s' % (title,mu[j]))) +r'%s dynamical\_scale\_choice=%s' % (title,mu[j]))) # And now PDF_variation if available if not PDF_var_pos is None: for j,PDF_var in enumerate(PDF_var_pos): @@ -2947,7 +2949,7 @@ def ratio_no_correlations(wgtsA, wgtsB): plot_lines.append( "'%s' index %d using (($1+$2)/2):%d ls %d title '%s'"\ %(HwU_name,block_position+i,PDF_var+3,color_index,\ -'%s PDF=%s' % (title,pdf[j].replace('_','\_')))) +'%s PDF=%s' % (title,pdf[j].replace('_',r'\_')))) # Now add the uncertainty lines, those not using a band so that they # are not covered by those using a band after we reverse plo_lines diff --git a/epochX/cudacpp/gq_ttq.mad/bin/internal/launch_plugin.py b/epochX/cudacpp/gq_ttq.mad/bin/internal/launch_plugin.py index 7b10bedcef..9ec09eb71d 100644 --- a/epochX/cudacpp/gq_ttq.mad/bin/internal/launch_plugin.py +++ b/epochX/cudacpp/gq_ttq.mad/bin/internal/launch_plugin.py @@ -98,6 +98,7 @@ def default_setup(self): self['vector_size'] = 16 # already setup in default class (just change value) self['aloha_flag'] = '--fast-math' self['matrix_flag'] = '-O3' + self['limhel'] = 0 self.display_block.append('simd') self.display_block.append('psoptim') 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 eee9ba4522..f6e47956cd 100755 --- a/epochX/cudacpp/gq_ttq.mad/bin/internal/lhe_parser.py +++ b/epochX/cudacpp/gq_ttq.mad/bin/internal/lhe_parser.py @@ -7,6 +7,7 @@ import numbers import math import time +import copy import os import shutil import sys @@ -101,7 +102,7 @@ def __init__(self, line=None, event=None): self.rwgt = 0 return - + self.event = event if event is not None: self.event_id = len(event) #not yet in the event @@ -1066,6 +1067,8 @@ def define_init_banner(self, wgt, lha_strategy, proc_charac=None): #special case for 1>N init_information = run_card.get_banner_init_information() event = next(self) + if not len(event): #if parse-momenta was false we have to parse the first event + event = Event(str(event)) init_information["idbmup1"] = event[0].pdg init_information["ebmup1"] = event[0].mass init_information["idbmup2"] = 0 @@ -1149,6 +1152,7 @@ def initialize_unweighting(self, getwgt, trunc_error): nb_keep = max(20, int(nb_event*trunc_error*15)) new_wgt = new_wgt[-nb_keep:] if nb_event == 0: + misc.sprint(i,f) raise Exception # store the information self.initial_nb_events[i] = nb_event @@ -1203,7 +1207,6 @@ def unweight(self, outputpath, get_wgt, **opts): (stop to write event when target is reached) """ - if isinstance(get_wgt, (str,six.text_type)): unwgt_name =get_wgt def get_wgt_multi(event): @@ -1483,12 +1486,12 @@ def reorder_mother_child(self): particle.mother2 -= 1 # re-call the function for the next potential change return self.reorder_mother_child() - - - - - + + + + + def parse_reweight(self): """Parse the re-weight information in order to return a dictionary {key: value}. If no group is define group should be '' """ @@ -1522,6 +1525,37 @@ def parse_nlo_weight(self, real_type=(1,11), threshold=None): threshold=threshold) return self.nloweight + def get_fks_pair(self, real_type=(1,11), threshold=None): + """ Gives the fks pair labels""" + start, stop = self.tag.find(''), self.tag.find('') + if start != -1 != stop: + text = self.tag[start+8:stop] + all_line = text.split('\n') + text = text.lower().replace('d','e') + all_line = text.split('\n') + for line in all_line: + data = line.split() + if len(data)>16: + wgt = OneNLOWeight(line, real_type=real_type) + return wgt.to_merge_pdg,wgt.nexternal + + def get_born_momenta(self,real_type=(1,11), threshold=None): + """ Gets the underlying n+1 body kinematics""" + start, stop = self.tag.find(''), self.tag.find('') + if start != -1 != stop: + text = self.tag[start+8:stop] + text = text.lower().replace('d','e') + all_line = text.split('\n') + for line in all_line: + data = line.split() + if len(data)>16: + wgt = OneNLOWeight(line, real_type=real_type) + nexternal = wgt.nexternal + real_momenta = all_line[2:2+nexternal] + return real_momenta + + + def rewrite_nlo_weight(self, wgt=None): """get the string associate to the weight""" @@ -1558,11 +1592,11 @@ def parse_lo_weight(self): return self.loweight if not hasattr(Event, 'loweight_pattern'): - Event.loweight_pattern = re.compile('''\s*(?P\d+)\s+(?P[\d.e+-]+)\s*\s*\n\s* - \s*(?P[\s\d.+-e]+)\s*\s*\n\s* - 1|2)["']?\>\s*(?P[\s\d.e+-]*)\s*\s*\n\s* - 1|2)["']?\>\s*(?P[\s\d.e+-]*)\s*\s*\n\s* - \s*(?P[\d.e+-]*)\s* + Event.loweight_pattern = re.compile('''\\s*(?P\\d+)\\s+(?P[\\d.e+-]+)\\s*\\s*\n\\s* + \\s*(?P[\\s\\d.+-e]+)\\s*\\s*\n\\s* + 1|2)["']?\\>\\s*(?P[\\s\\d.e+-]*)\\s*\\s*\n\\s* + 1|2)["']?\\>\\s*(?P[\\s\\d.e+-]*)\\s*\\s*\n\\s* + \\s*(?P[\\d.e+-]*)\\s* ''',re.X+re.I+re.M) start, stop = self.tag.find(''), self.tag.find('') @@ -1615,7 +1649,7 @@ def parse_matching_scale(self): self.matched_scale_data = [] - pattern = re.compile("") + pattern = re.compile(r"") data = re.split(pattern,self.tag) if len(data) == 1: return [] @@ -1623,7 +1657,7 @@ def parse_matching_scale(self): tmp = {} start,content, end = data self.tag = "%s%s" % (start, end) - pattern = re.compile("pt_clust_(\d*)=\"([\de+-.]*)\"") + pattern = re.compile("pt_clust_(\\d*)=\"([\\de+-.]*)\"") for id,value in pattern.findall(content): tmp[int(id)] = float(value) for i in range(1, len(self)+1): @@ -1647,7 +1681,7 @@ def parse_syscalc_info(self): return self.syscalc_data pattern = re.compile("|") - pattern2 = re.compile("<(?P[\w]*)(?:\s*(\w*)=[\"'](.*)[\"']\s*|\s*)>(.*)") + pattern2 = re.compile("<(?P[\\w]*)(?:\\s*(\\w*)=[\"'](.*)[\"']\\s*|\\s*)>(.*)") data = re.split(pattern,self.tag) if len(data) == 1: return [] @@ -1850,6 +1884,240 @@ def get_decay(self, pdg_code=0, event_id=None): return new_event + + def set_initial_mass_to_zero(self): + """set the masses of the initial particles to zero, by reshuffling the respective momenta + Works only in the **partonic** com frame, so the event must be boosted to such frame + before calling the function + """ + + if not misc.equal(self[0].px, 0) or not misc.equal(self[1].px, 0) or \ + not misc.equal(self[0].py, 0) or not misc.equal(self[1].py, 0) or \ + not misc.equal(self[0].pz, - self[1].pz, zero_limit=False): + misc.sprint(self[0]) + misc.sprint(self[1]) + raise Exception('momenta should be in the partonic center of mass frame') + + self[0].mass = 0. + self[1].mass = 0. + tot_E=0. + for ip,part in enumerate(self): + if part.status == 1 : + tot_E += part.E + if (self[0].pz > 0. and self[1].pz < 0): + self[0].set_momentum(FourMomentum([tot_E/2., 0., 0., tot_E/2.])) + self[1].set_momentum(FourMomentum([tot_E/2., 0., 0., -tot_E/2.])) + elif (self[0].pz < 0. and self[1].pz > 0): + self[0].set_momentum(FourMomentum([tot_E/2., 0., 0., -tot_E/2.])) + self[1].set_momentum(FourMomentum([tot_E/2., 0., 0., tot_E/2.])) + else: + logger.critical('ERROR: two incoming partons not back.-to-back') + + def set_final_jet_mass_to_zero(self): + """set the final light particle masses to zero + """ + + for ip,part in enumerate(self): + if ((abs(part.pid) <= 5) or (abs(part.pid) == 11) or (abs(part.pid) == 12)) and (part.status == 1): + part.mass = 0. + E_1_new = math.sqrt(part.mass**2 + part.px**2 + part.py**2 + part.pz**2) + part.set_momentum(FourMomentum([E_1_new, part.px, part.py, part.pz])) + + + + def merge_particles_kinematics(self, i,j, moth): + """Map to an underlying n-body kinematics for two given + particles i,j to be merged and a resulting moth""" + """ note! kinematics (and id) mapping only! """ + + recoil = True + fks_type = False + + if recoil and not fks_type: + if (i == moth[0].get('number')-1): + fks_i = i + fks_j = j + elif (j == moth[0].get('number')-1): + fks_i = j + fks_j = i + to_remove = fks_j + + merge_i = self[fks_i] + merge_j = self[fks_j] + + i_4mom = FourMomentum(merge_i) + j_4mom = FourMomentum(merge_j) + if (fks_i <= 1): + sign1 = -1.0 + else: + sign1 = 1.0 + mother_4mom = i_4mom + sign1*j_4mom + + new_event = copy.deepcopy(self) + + self[fks_i].pid = moth[0]['id'] + self[fks_i].set_momentum(mother_4mom) + + if fks_i <= 1: # initial-state recoil + new_p = FourMomentum() + for ip,part in enumerate(self): + if (ip != fks_i and ip != fks_j and ip >= 2): + new_p += part + + if fks_i == 0: + self[1].set_momentum(new_p - FourMomentum(self[0])) + elif fks_i == 1: + self[0].set_momentum(new_p - FourMomentum(self[1])) + + pz_1_new = self.recoil_eq(self[0],self[1]) + pz_2_new = self[0].pz + self[1].pz - pz_1_new + E_1_new = math.sqrt(self[0].mass**2 + self[0].px**2 + self[0].py**2 + pz_1_new **2) + E_2_new = math.sqrt(self[1].mass**2 + self[1].px**2 + self[1].py**2 + pz_2_new **2) + self[0].set_momentum(FourMomentum([E_1_new,self[0].px,self[0].py,pz_1_new])) + self[1].set_momentum(FourMomentum([E_2_new,self[1].px,self[1].py,pz_2_new])) + self.pop(to_remove) + + if fks_i > 1: # final-state recoil + + # Re-scale the energy of fks_i to make it on-shell + for ip,part in enumerate(self): + if (ip == fks_i): + part.E = math.sqrt(part.mass**2 + part.px**2 + part.py**2 + part.pz**2) + new_p.E = part.E + + # Find the overall energy in the final state + new_p.E = 0.0 + for ip,part in enumerate(self): + if (ip != fks_j and ip >= 2): + new_p.E += part.E + + # Use one of the initial states to absorb the energy change in the final state + self[1].set_momentum(FourMomentum([new_p.E-self[0].E,self[1].px,self[1].py,self[1].pz])) + + # Change the initial state pz and E + pz_1_new = self.recoil_eq(self[0],self[1]) + pz_2_new = self[0].pz + self[1].pz - pz_1_new + E_1_new = math.sqrt(self[0].mass**2 + self[0].px**2 + self[0].py**2 + pz_1_new **2) + E_2_new = math.sqrt(self[1].mass**2 + self[1].px**2 + self[1].py**2 + pz_2_new **2) + self[0].set_momentum(FourMomentum([E_1_new,self[0].px,self[0].py,pz_1_new])) + self[1].set_momentum(FourMomentum([E_2_new,self[1].px,self[1].py,pz_2_new])) + self.pop(to_remove) + + elif fks_type and not recoil: + ## Do it in a more FKS-style + if (i == moth[0].get('number')-1): + fks_i = i + fks_j = j + elif (j == moth[0].get('number')-1): + fks_i = j + fks_j = i + to_remove = fks_j + new_event = copy.copy(event) + + if fks_i <= 1: # initial-state recoil + + # First boost to partonic CM frame + q = FourMomentum(self[0])+FourMomentum(self[1]) + for ip,part in enumerate(self): + vec = FourMomentum(part) + self[ip].set_momentum(vec.zboost(pboost=q)) + + k_tot = FourMomentum([self[0].E+self[1].E-self[fks_j].E,self[0].px+self[1].px-self[fks_j].px,\ + self[0].py+self[1].py-self[fks_j].py,self[0].pz+self[1].pz-self[fks_j].pz]) + + final = FourMomentum([0,0,0,0]) + for ip,part in enumerate(self): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + if (ip != fks_i and ip != fks_j and ip >= 2): + final = final + vec + + s = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz])**2 + ksi = self[fks_j].E/(math.sqrt(s)/2.0) + y = self[fks_j].pz/self[fks_j].E + + self[0].pz = self[0].pz * math.sqrt(1.0-ksi)*math.sqrt((2.0-ksi*(1.0+y))/((2.0-ksi*(1.0-y)))) + self[0].E = math.sqrt(self[0].mass**2 + self[0].pz**2) + self[1].pz = self[1].pz * math.sqrt(1.0-ksi)*math.sqrt((2.0-ksi*(1.0-y))/((2.0-ksi*(1.0+y)))) + self[1].E = math.sqrt(self[1].mass**2 + self[1].pz**2) + + final = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + k_tot_1 = k_tot.zboost(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + k_tot_2 = k_tot_1.pt_boost(pboost=FourMomentum([k_tot_1.E,k_tot_1.px,k_tot_1.py,k_tot_1.pz])) + k_tot_3 = k_tot_2.zboost_inv(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + + for ip,part in enumerate(self): + if (ip >= 2): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + vec2 = vec.zboost(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + vec3 = vec2.pt_boost(pboost=FourMomentum([k_tot_1.E,k_tot_1.px,k_tot_1.py,k_tot_1.pz])) + vec_new = vec3.zboost_inv(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + self[ip].set_momentum(FourMomentum([vec_new.E,vec_new.px,vec_new.py,vec_new.pz])) + + self.pop(to_remove) + + else: # final-state recoil + q = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + for ip,part in enumerate(self): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + self[ip].set_momentum(vec.zboost(pboost=q)) + + q = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + k = FourMomentum([self[fks_i].E+self[fks_j].E,self[fks_i].px+self[fks_j].px,\ + self[fks_i].py+self[fks_j].py,self[fks_i].pz+self[fks_j].pz]) + + k_rec = FourMomentum([0,0,0,0]) + for ip,part in enumerate(self): + if ip >= 2 and ip != fks_i and ip != fks_j: # add only final-states to the recoil and not the FKS pair + k_rec = k_rec + FourMomentum([part.E,part.px,part.py,part.pz]) + + k_mom = math.sqrt(k_rec.px**2 + k_rec.py**2 + k_rec.pz**2) + beta = (q**2 - (k_rec.E+k_mom)**2)/(q**2 + (k_rec.E+k_mom)**2) + for ip,part in enumerate(self): + if ip >= 2 and ip != fks_i and ip != fks_j: + vec = FourMomentum([self[ip].E,self[ip].px,self[ip].py,self[ip].pz]) + self[ip].set_momentum(vec.boost_beta(beta,k_rec)) + if ip == fks_i: + self[ip].set_momentum(q - k_rec.boost_beta(beta,k_rec)) + self.pop(to_remove) + else: + logger.info('Error in Sudakov Born mapping: no recoil scheme found!') + + def recoil_eq(self,part1, part2): + """ In general, solves the equation + E1 + E2 = K + p1 + p2 = c + E1^2 - p1^2 = a + E2^2 - p2^2 = b + and returns p1 + """ + thresh = 1e-6 + import random + a = part1.mass**2 + part1.px**2 + part1.py**2 + b = part2.mass**2 + part2.px**2 + part2.py**2 + c = part1.pz + part2.pz + K = part1.E + part2.E + K2 = K**2 + sol1 = (-a*c + b*c + c**3 - c*K2 - math.sqrt(K2*(a**2 + (b + c**2 - K2)**2 - 2*a*(b - c**2 + K2))))/(2*(c**2-K2)) + sol2 = (-a*c + b*c + c**3 - c*K2 + math.sqrt(K2*(a**2 + (b + c**2 - K2)**2 - 2*a*(b - c**2 + K2))))/(2*(c**2-K2)) + + if abs(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2) - (math.sqrt(a+sol2**2) + math.sqrt(b+(c-sol2)**2))) > thresh: + logger.critical('Error in recoil_eq solver 1') + logger.critical(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2)) + logger.critical(math.sqrt(a+sol2**2) + math.sqrt(b+(c-sol2)**2)) + if abs(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2) - K) > thresh: + logger.critical('Error in recoil_eq solver 2') + logger.critical(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2)) + logger.critical(K) + return sol1 + + def boost(self, filter=None): """modify the current event to boost it according to the current filter""" if filter is None: @@ -1861,7 +2129,7 @@ def boost(self, filter=None): if list(filter(p)): pboost += p else: - pboost = FourMomentum(pboost) + pboost = FourMomentum(filter) # change sign of three-component due to helas convention pboost.px *=-1 @@ -1877,7 +2145,7 @@ def check(self): """check various property of the events""" # check that relative error is under control - threshold = 1e-6 + threshold = 1e-4 #1. Check that the 4-momenta are conserved E, px, py, pz = 0,0,0,0 @@ -1920,7 +2188,50 @@ def check(self): self.check_color_structure() #3. check mass - + + def check_kinematics_only(self): + """check various property of the events - only kinematics""" + + # check that relative error is under control + threshold = 1e-3 + + #1. Check that the 4-momenta are conserved + E, px, py, pz = 0,0,0,0 + absE, abspx, abspy, abspz = 0,0,0,0 + for particle in self: + coeff = 1 + if particle.status == -1: + coeff = -1 + elif particle.status != 1: + continue + E += coeff * particle.E + absE += abs(particle.E) + px += coeff * particle.px + py += coeff * particle.py + pz += coeff * particle.pz + abspx += abs(particle.px) + abspy += abs(particle.py) + abspz += abs(particle.pz) + # check mass + fourmass = FourMomentum(particle).mass + + if particle.mass and (abs(particle.mass) - fourmass)/ abs(particle.mass) > threshold: + logger.critical(self) + raise Exception( "Do not have correct mass lhe: %s momentum: %s (error at %s" % (particle.mass, fourmass, (abs(particle.mass) - fourmass)/ abs(particle.mass))) + + if abs(E/absE) > threshold: + logger.critical(self) + raise Exception("Do not conserve Energy %s, %s" % (E/absE, E)) + if abs(px/abspx) > threshold: + logger.critical(self) + raise Exception("Do not conserve Px %s, %s" % (px/abspx, px)) + if abs(py/abspy) > threshold: + logger.critical(self) + raise Exception("Do not conserve Py %s, %s" % (py/abspy, py)) + if abs(pz/abspz) > threshold: + logger.critical(self) + raise Exception("Do not conserve Pz %s, %s" % (pz/abspz, pz)) + def assign_scale_line(self, line, convert=True): """read the line corresponding to global event line @@ -2764,7 +3075,7 @@ def zboost(self, pboost=None, E=0, pz=0): if isinstance(pboost, FourMomentum): E = pboost.E pz = pboost.pz - + #beta = pz/E gamma = E / math.sqrt(E**2-pz**2) gammabeta = pz / math.sqrt(E**2-pz**2) @@ -2778,6 +3089,74 @@ def zboost(self, pboost=None, E=0, pz=0): out.pz = 0 return out + def zboost_inv(self, pboost=None, E=0, pz=0): + """Both momenta should be in the same frame. + The boost perform correspond to the boost required to set pboost at + rest (only z boost applied). + """ + if isinstance(pboost, FourMomentum): + E = pboost.E + pz = pboost.pz + + #beta = pz/E + gamma = E / math.sqrt(E**2-pz**2) + gammabeta = pz / math.sqrt(E**2-pz**2) + + out = FourMomentum([gamma*self.E + gammabeta*self.pz, + self.px, + self.py, + gamma*self.pz + gammabeta*self.E]) + + if abs(out.pz) < 1e-6 * out.E: + out.pz = 0 + return out + + + def pt_boost(self, pboost=None, E=0, pz=0): + """Both momenta should be in the same frame. + The boost perform correspond to the boost required to set pboost at + rest (only pT boost applied). + """ + + if isinstance(pboost, FourMomentum): + E = pboost.E + px = pboost.px + py = pboost.py + mass = math.sqrt(E**2 - px**2 - py**2) + + betax = px/E + betay = py/E + beta = math.sqrt(betax**2+betay**2) + gamma = 1 / math.sqrt(1.0-beta**2) + + out = FourMomentum([gamma*self.E - gamma*betax*self.px - gamma*betay*self.py, + -gamma*betax*self.E + (1.0 + (gamma-1.0)*betax**2/(beta**2))*self.px + (gamma-1.0)*betax*betay/(beta**2)*self.py, + -gamma*betay*self.E + ((gamma-1.0)*betax*betay/(beta**2))*self.px + (1.0+(gamma-1.0)*(betay**2)/(beta**2))*self.py, + self.pz]) + + if abs(out.px) < 1e-6 * out.E: + out.px = 0 + if abs(out.py) < 1e-6 * out.E: + out.py = 0 + return out + + def boost_beta(self,beta,mom): + """ Boost along the three-momentum of mom with a boost of size beta""" + + unit = mom * (1.0/math.sqrt(mom.px**2+mom.py**2+mom.pz**2)) + beta_vec = beta*unit + bx = beta_vec.px + by = beta_vec.py + bz = beta_vec.pz + gamma = 1.0 / math.sqrt(1.0-beta**2) + + out = FourMomentum([gamma*self.E - gamma*bx*self.px - gamma*by*self.py - gamma*bz*self.pz, + -gamma*bx*self.E + (1.0 + (gamma-1.0)*bx**2/(beta**2))*self.px + (gamma-1.0)*bx*by/(beta**2)*self.py + (gamma-1.0)*bx*bz/(beta**2)*self.pz, + -gamma*by*self.E + ((gamma-1.0)*bx*by/(beta**2))*self.px + (1.0+(gamma-1.0)*(by**2)/(beta**2))*self.py + (gamma-1.0)*by*bz/(beta**2)*self.pz, + -gamma*bz*self.E + (gamma-1.0)*bx*bz/(beta**2)*self.px + (gamma-1.0)*(by*bz)/(beta**2)*self.py + (1.0+(gamma-1.0)*bz**2/(beta**2))*self.pz]) + + return out + def boost_to_restframe(self, pboost): """apply the boost transformation such that pboost is at rest in the new frame. First apply a rotation to allign the pboost to the z axis and then use @@ -2789,27 +3168,64 @@ def boost_to_restframe(self, pboost): return out - # write pboost as (E, p cosT sinF, p sinT sinF, p cosF) - # rotation such that it become (E, 0 , 0 , p ) is - # cosT sinF , -sinT , cosT sinF - # sinT cosF , cosT , sinT sinF - # -sinT , 0 , cosF - p = math.sqrt( pboost.px**2 + pboost.py**2+ pboost.pz**2) - cosF = pboost.pz / p - sinF = math.sqrt(1-cosF**2) - sinT = pboost.py/p/sinF - cosT = pboost.px/p/sinF - - out=FourMomentum([self.E, - self.px*cosT*cosF + self.py*sinT*cosF-self.pz*sinF, - -self.px*sinT+ self.py*cosT, - self.px*cosT*sinF + self.py*sinT*sinF + self.pz*cosF - ]) - out = out.zboost(E=pboost.E,pz=p) + # see here https://physics.stackexchange.com/questions/749036/general-lorentz-boost-of-four-momentum-in-cm-frame-particle-physics + vx = pboost.px/pboost.E + vy = pboost.py/pboost.E + vz = pboost.pz/pboost.E + v = pboost.norm/pboost.E + v2 = pboost.norm_sq/pboost.E**2 + gamma = 1./math.sqrt(1.-v**2) + gammo = gamma-1. + out = FourMomentum(E = gamma*(self.E - vx*self.px - vy*self.py - vz*self.pz), + px= -gamma*vx*self.E + (1+gammo*vx**2/v2)*self.px + gammo*vx*vy/v2*self.py + gammo*vx*vz/v2*self.pz, + py= -gamma*vy*self.E + gammo*vy*vx/v2*self.px + (1+gammo*vy**2/v2)*self.py + gammo*vy*vz/v2*self.pz, + pz= -gamma*vz*self.E + gammo*vz*vx/v2*self.px + gammo*vz*vy/v2*self.py + (1+gammo*vz**2/v2)*self.pz) + return out + def rotate_to_z(self,prot): + + import math + import numpy as np + + z = np.array([0.,0.,1.]) + + px = self.px + py = self.py + pz = self.pz + + refx = prot.px + refy = prot.py + refz = prot.pz + + prot_mom = np.array([px, py, pz]) + ref_mom = np.array([refx, refy, refz]) + + # Create normal vector + n = np.array([refy, -refx, 0.]) + n = n * 1./math.sqrt(self.threedot(n,n)) + t = prot_mom - self.threedot(n,prot_mom)*n + p = ref_mom - self.threedot(ref_mom,z)*z + p = p/math.sqrt(self.threedot(p,p)) + + t_pz = np.array([self.threedot(t,p), self.threedot(t,z), 0.]) + costheta = self.threedot(ref_mom,z)* 1./math.sqrt(self.threedot(ref_mom, ref_mom)) + sintheta=math.sqrt(1.-costheta**2) + + sgn = 1. + t_pz_p = np.array([0., 0., 0.]) + t_pz_p[0] = costheta*t_pz[0] + sgn*(-sintheta) * t_pz[1] + t_pz_p[1] = sgn*sintheta*t_pz[0] + costheta * t_pz[1] + + out_mom = self.threedot(n,prot_mom)*n + t_pz_p[0]*p + t_pz_p[1]*z + + out = FourMomentum([self.E,out_mom[0], out_mom[1], out_mom[2] ] ) + + return out - + def threedot(self,a,b): + + return a[0]*b[0]+a[1]*b[1]+a[2]*b[2] class OneNLOWeight(object): 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 2a118e21bf..8e30cf690c 100755 --- a/epochX/cudacpp/gq_ttq.mad/bin/internal/madevent_interface.py +++ b/epochX/cudacpp/gq_ttq.mad/bin/internal/madevent_interface.py @@ -496,7 +496,6 @@ def help_remove(self): logger.info(" the optional '-f' allows to by-pass all security question") logger.info(" The banner can be remove only if all files are removed first.") - class AskRun(cmd.ControlSwitch): """a class for the question on what to do on a madevent run""" @@ -2393,13 +2392,17 @@ def do_generate_events(self, line): # Check argument's validity mode = self.check_generate_events(args) switch_mode = self.ask_run_configuration(mode, args) - if not args: - # No run name assigned -> assigned one automaticaly - self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton') - else: - self.set_run_name(args[0], None, 'parton', True) - args.pop(0) - + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat'), consistency=False) + if not run_card.scan_set: + if not args: + # No run name assigned -> assigned one automaticaly + self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton') + else: + self.set_run_name(args[0], None, 'parton', True) + args.pop(0) + + self.run_generate_events(switch_mode, args) self.postprocessing() @@ -2560,7 +2563,7 @@ def wait_monitoring(Idle, Running, Done): self.update_status("postprocessing contur done", level="rivet") # this decorator handle the loop related to scan. - @common_run.scanparamcardhandling() + @common_run.scanparamcardhandling(run_card_scan=True) def run_generate_events(self, switch_mode, args): if self.proc_characteristics['loop_induced'] and self.options['run_mode']==0: @@ -2593,7 +2596,6 @@ def run_generate_events(self, switch_mode, args): # Regular run mode logger.info('Generating %s events with run name %s' % (self.run_card['nevents'], self.run_name)) - self.exec_cmd('survey %s %s' % (self.run_name,' '.join(args)), postcmd=False) nb_event = self.run_card['nevents'] @@ -2975,7 +2977,7 @@ def update_width_in_param_card(decay_info, initial=None, output=None): particle = 0 # Read BRs for this decay line = param_card[line_number] - while re.search('^(#|\s|\d)', line): + while re.search(r'^(#|\s|\d)', line): line = param_card.pop(line_number) if not particle or line.startswith('#'): line=param_card[line_number] @@ -3226,7 +3228,7 @@ def do_treatcards(self, line, mode=None, opt=None): for line in open(pjoin(bias_module_path,'%s.f'%os.path.basename(bias_module_path))): if start and last: break - if not start and not re.search('c\s*parameters\s*=\s*{',line, re.I): + if not start and not re.search(r'c\s*parameters\s*=\s*{',line, re.I): continue start = True if not line.startswith('C'): @@ -3235,7 +3237,7 @@ def do_treatcards(self, line, mode=None, opt=None): if '{' in line: line = line.split('{')[-1] # split for } ! # - split_result = re.split('(\}|!|\#)', line,1, re.M) + split_result = re.split(r'(\}|!|\#)', line,1, re.M) line = split_result[0] sep = split_result[1] if len(split_result)>1 else None if sep == '}': @@ -3514,8 +3516,8 @@ def pass_in_difficult_integration_mode(self, rate=1): text = open(conf_path).read() min_evt, max_evt = 2500 *(2+rate), 10000*(rate+1) - text = re.sub('''\(min_events = \d+\)''', '(min_events = %i )' % min_evt, text) - text = re.sub('''\(max_events = \d+\)''', '(max_events = %i )' % max_evt, text) + text = re.sub(r'''\(min_events = \d+\)''', '(min_events = %i )' % min_evt, text) + text = re.sub(r'''\(max_events = \d+\)''', '(max_events = %i )' % max_evt, text) fsock = open(conf_path, 'w') fsock.write(text) fsock.close() @@ -3619,7 +3621,7 @@ def do_refine(self, line): alljobs = misc.glob('ajob*', Pdir) #remove associated results.dat (ensure to not mix with all data) - Gre = re.compile("\s*j=(G[\d\.\w]+)") + Gre = re.compile(r"\s*j=(G[\d\.\w]+)") for job in alljobs: Gdirs = Gre.findall(open(job).read()) for Gdir in Gdirs: @@ -3727,58 +3729,126 @@ def do_combine_events(self, line): sum_xsec, sum_xerru, sum_axsec = 0,[],0 Gdirs = self.get_Gdir() Gdirs.sort() - for Gdir in Gdirs: - if os.path.exists(pjoin(Gdir, 'events.lhe')): - result = sum_html.OneResult('') - result.read_results(pjoin(Gdir, 'results.dat')) - sum_xsec += result.get('xsec') - sum_xerru.append(result.get('xerru')) - sum_axsec += result.get('axsec') - - if self.run_card['gridpack'] or self.run_card['nevents']==0: - os.remove(pjoin(Gdir, 'events.lhe')) - continue + partials_info = [] + try: + p = subprocess.Popen(["ulimit", "-n"], stdout=subprocess.PIPE) + out, err = p.communicate() + max_G = out.decode() + if max_G == "unlimited": + max_G =2500 + else: + max_G = int(max_G) - 40 + except Exception as error: + logger.debug(error) + max_G = 80 # max(20, len(Gdirs)/self.options['nb_core']) - AllEvent.add(pjoin(Gdir, 'events.lhe'), - result.get('xsec'), - result.get('xerru'), - result.get('axsec') - ) - - if len(AllEvent) >= 80: #perform a partial unweighting - AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % partials), - get_wgt, log_level=5, trunc_error=1e-2, event_target=self.run_card['nevents']) - AllEvent = lhe_parser.MultiEventFile() - AllEvent.banner = self.banner - AllEvent.add(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % partials), - sum_xsec, - math.sqrt(sum(x**2 for x in sum_xerru)), - sum_axsec) - partials +=1 - if not hasattr(self,'proc_characteristic'): self.proc_characteristic = self.get_characteristics() - if len(AllEvent) == 0: - nb_event = 0 - else: + mycluster = cluster.MultiCore(nb_core=self.options['nb_core']) + + def split(a, n): + """split a list "a" into n chunk of same size (or nearly same size)""" + k, m = divmod(len(a), n) + return (a[i*k+min(i, m):(i+1)*k+min(i+1, m)] for i in range(n)) + + partials_info = [] + if len(Gdirs) >= max_G: + start_unweight= time.perf_counter() + # first check in how many chunk we have to split (always use a multiple of nb_core) + nb_split = 1 + nb_G = len(Gdirs) // (2* self.options['nb_core']) + while nb_G > min(80, max_G): + nb_split += 1 + nb_G = len(Gdirs)//(nb_split*2*self.options['nb_core']) + if nb_G < 10: + nb_split -=1 + nb_G = len(Gdirs)//(nb_split*2*self.options['nb_core']) + + #enforce at least 10 directory per thread + if nb_G > 10 or nb_split>1: + # do the unweighting of each chunk on their own thread + nb_chunk = (nb_split*2*self.options['nb_core']) + else: + nb_chunk = len(Gdirs) // 10 + nb_G =10 + + # security that the number of combine events is too large + if nb_chunk >= max_G: + nb_chunk = max_G -1 + nb_G = len(Gdirs) // nb_chunk + + for i, local_G in enumerate(split(Gdirs, nb_chunk)): + line = [pjoin(self.me_dir, "Events", self.run_name, "partials%d.lhe.gz" % i)] + line.append(pjoin(self.me_dir, 'Events', self.run_name, '%s_%s_banner.txt' % (self.run_name, tag))) + line.append(str(self.results.current['cross'])) + line += local_G + partials_info.append(self.do_combine_events_partial(' '.join(line), preprocess_only=True)) + mycluster.submit(sys.executable, + [pjoin(self.me_dir, 'bin', 'internal', 'madevent_interface.py'), 'combine_events_partial'] + line, + stdout='/dev/null' + ) + + starttime = time.time() + update_status = lambda idle, run, finish: \ + self.update_status((idle, run, finish, 'unweight'), level=None, + force=False, starttime=starttime) + mycluster.wait(self.me_dir, update_status) + # do the final combination + for data in partials_info: + AllEvent.add(*data) + + start_unweight= time.perf_counter() nb_event = AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "unweighted_events.lhe.gz"), get_wgt, trunc_error=1e-2, event_target=self.run_card['nevents'], log_level=logging.DEBUG, normalization=self.run_card['event_norm'], proc_charac=self.proc_characteristic) + + #cleaning + for data in partials_info: + path = data[0] + try: + os.remove(path) + except Exception as error: + try: + os.remove(path[:-3]) # try without the .gz + except: + misc.sprint('no file ', path, 'to clean') + else: + for Gdir in Gdirs: + if os.path.exists(pjoin(Gdir, 'events.lhe')): + result = sum_html.OneResult('') + result.read_results(pjoin(Gdir, 'results.dat')) + sum_xsec += result.get('xsec') + sum_xerru.append(result.get('xerru')) + sum_axsec += result.get('axsec') + + if self.run_card['gridpack'] or self.run_card['nevents']==0: + os.remove(pjoin(Gdir, 'events.lhe')) + continue + + AllEvent.add(pjoin(Gdir, 'events.lhe'), + result.get('xsec'), + result.get('xerru'), + result.get('axsec') + ) + + if len(AllEvent) == 0: + nb_event = 0 + else: + nb_event = AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "unweighted_events.lhe.gz"), + get_wgt, trunc_error=1e-2, event_target=self.run_card['nevents'], + log_level=logging.DEBUG, normalization=self.run_card['event_norm'], + proc_charac=self.proc_characteristic) + + if nb_event < self.run_card['nevents']: + logger.warning("failed to generate enough events. Please follow one of the following suggestions to fix the issue:") + logger.warning(" - set in the run_card.dat 'sde_strategy' to %s", 1 + self.run_card['sde_strategy'] % 2) + logger.warning(" - set in the run_card.dat 'hard_survey' to 1 or 2.") + logger.warning(" - reduce the number of requested events (if set too high)") + logger.warning(" - check that you do not have -integrable- singularity in your amplitude.") + logger.warning(" - regenerate your process directory by selecting another gauge (in particular try FD gauge).") - if nb_event < self.run_card['nevents']: - logger.warning("failed to generate enough events. Please follow one of the following suggestions to fix the issue:") - logger.warning(" - set in the run_card.dat 'sde_strategy' to %s", 1 + self.run_card['sde_strategy'] % 2) - logger.warning(" - set in the run_card.dat 'hard_survey' to 1 or 2.") - logger.warning(" - reduce the number of requested events (if set too high)") - logger.warning(" - check that you do not have -integrable- singularity in your amplitude.") - if partials: - for i in range(partials): - try: - os.remove(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % i)) - except Exception: - os.remove(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe" % i)) self.results.add_detail('nb_event', nb_event) @@ -3789,7 +3859,50 @@ def do_combine_events(self, line): logger.info("combination of events done in %s s ", time.time()-start) self.to_store.append('event') + + ############################################################################ + def do_combine_events_partial(self, line, preprocess_only=False): + """ """ + + AllEvent = lhe_parser.MultiEventFile() + + sum_xsec, sum_xerru, sum_axsec = 0,[],0 + output, banner_path,cross = line.split()[:3] + Gdirs = line.split()[3:] + + cross = float(cross) + if not self.banner: + self.banner = banner_mod.Banner(banner_path) + if not hasattr(self, 'run_card'): + self.run_card = banner_mod.RunCard(self.banner['mgruncard']) + AllEvent.banner = self.banner + + for Gdir in Gdirs: + if os.path.exists(pjoin(Gdir, 'events.lhe')): + result = sum_html.OneResult('') + result.read_results(pjoin(Gdir, 'results.dat')) + sum_xsec += result.get('xsec') + sum_xerru.append(result.get('xerru')) + sum_axsec += result.get('axsec') + + if self.run_card['gridpack'] or self.run_card['nevents']==0: + os.remove(pjoin(Gdir, 'events.lhe')) + continue + if not preprocess_only: + AllEvent.add(pjoin(Gdir, 'events.lhe'), + result.get('xsec'), + result.get('xerru'), + result.get('axsec') + ) + if preprocess_only: + return output, sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), sum_axsec + nb_event = max(min(abs(1.01*self.run_card['nevents']*sum_axsec/cross),self.run_card['nevents']), 10) + get_wgt = lambda event: event.wgt + AllEvent.unweight(output, + get_wgt, log_level=5, trunc_error=1e-2, event_target=nb_event) + return output, sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), sum_axsec + ############################################################################ def correct_bias(self): """check the first event and correct the weight by the bias @@ -3902,13 +4015,19 @@ def do_store_events(self, line): #except Exception: # continue # Store log - try: - if os.path.exists(pjoin(G_path, 'log.txt')): - input = pjoin(G_path, 'log.txt') + input = pjoin(G_path, 'log.txt') + if os.path.exists(input): + if self.run_card['keep_log'] not in ["none", "minimal"]: output = pjoin(G_path, '%s_log.txt' % run) - files.mv(input, output) - except Exception: - continue + try: + files.mv(input, output) + except Exception: + continue + elif self.run_card['keep_log'] == "none": + try: + os.remove(input) + except Exception: + continue #try: # # Grid # for name in ['ftn26']: @@ -3989,7 +4108,7 @@ def do_create_gridpack(self, line): misc.call(['./bin/internal/make_gridpack'], cwd=self.me_dir) files.mv(pjoin(self.me_dir, 'gridpack.tar.gz'), pjoin(self.me_dir, '%s_gridpack.tar.gz' % self.run_name)) - os.system("sed -i.bak \"s/\s*.true.*=.*GridRun/ .false. = GridRun/g\" %s/Cards/grid_card.dat" \ + os.system("sed -i.bak \"s/\\s*.true.*=.*GridRun/ .false. = GridRun/g\" %s/Cards/grid_card.dat" \ % self.me_dir) self.update_status('gridpack created', level='gridpack') @@ -4476,7 +4595,7 @@ def do_pythia8(self, line): else: preamble = misc.get_HEPTools_location_setter( pjoin(MG5DIR,'HEPTools'),'lib') - preamble += "\n unset PYTHIA8DATA\n" + #preamble += "\n unset PYTHIA8DATA\n" open(pythia_cmd_card,'w').write("""! ! It is possible to run this card manually with: @@ -4691,7 +4810,7 @@ def do_pythia8(self, line): # Make sure to sure the number of split_events determined during the splitting. split_PY8_Card.systemSet('Main:numberOfEvents',partition_for_PY8[i]) split_PY8_Card.systemSet('HEPMCoutput:scaling',split_PY8_Card['HEPMCoutput:scaling']* - (float(partition_for_PY8[i])/float(n_events))) + (float(partition_for_PY8[i]))) # Add_missing set to False so as to be sure not to add any additional parameter w.r.t # the ones in the original PY8 param_card copied. split_PY8_Card.write(pjoin(parallelization_dir,'PY8Card_%d.dat'%i), @@ -4963,9 +5082,9 @@ def wait_monitoring(Idle, Running, Done): if cross_sections: # Filter the cross_sections specified an keep only the ones # with central parameters and a different merging scale - a_float_re = '[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' + a_float_re = r'[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' central_merging_re = re.compile( - '^\s*Weight_MERGING\s*=\s*(?P%s)\s*$'%a_float_re, + r'^\s*Weight_MERGING\s*=\s*(?P%s)\s*$'%a_float_re, re.IGNORECASE) cross_sections = dict( (float(central_merging_re.match(xsec).group('merging')),value) @@ -5016,8 +5135,8 @@ def wait_monitoring(Idle, Running, Done): def parse_PY8_log_file(self, log_file_path): """ Parse a log file to extract number of event and cross-section. """ - pythiare = re.compile("Les Houches User Process\(es\)\s*\d+\s*\|\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)\s*\|\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") - pythia_xsec_re = re.compile("Inclusive cross section\s*:\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") + pythiare = re.compile(r"Les Houches User Process\(es\)\s*\d+\s*\|\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)\s*\|\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") + pythia_xsec_re = re.compile(r"Inclusive cross section\s*:\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") sigma_m, Nacc, Ntry = None, None, None for line in misc.BackRead(log_file_path): info = pythiare.search(line) @@ -5158,7 +5277,7 @@ def do_pythia(self, line): # read the line from the bottom of the file #pythia_log = misc.BackRead(pjoin(self.me_dir,'Events', self.run_name, # '%s_pythia.log' % tag)) - pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") + pythiare = re.compile(r"\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") for line in misc.reverse_readline(pjoin(self.me_dir,'Events', self.run_name, '%s_pythia.log' % tag)): info = pythiare.search(line) @@ -5619,8 +5738,8 @@ def launch_job(self,exe, cwd=None, stdout=None, argument = [], remaining=0, input_files.append(self.get_pdf_input_filename()) #Find the correct ajob - Gre = re.compile("\s*j=(G[\d\.\w]+)") - origre = re.compile("grid_directory=(G[\d\.\w]+)") + Gre = re.compile(r"\s*j=(G[\d\.\w]+)") + origre = re.compile(r"grid_directory=(G[\d\.\w]+)") try : fsock = open(exe) except Exception: @@ -5628,7 +5747,7 @@ def launch_job(self,exe, cwd=None, stdout=None, argument = [], remaining=0, text = fsock.read() output_files = Gre.findall(text) if not output_files: - Ire = re.compile("for i in ([\d\.\s]*) ; do") + Ire = re.compile(r"for i in ([\d\.\s]*) ; do") data = Ire.findall(text) data = ' '.join(data).split() for nb in data: @@ -6035,7 +6154,7 @@ def get_last_tag(self, level): 'syscalc':[], 'rivet':['rivet']} - if name == self.run_name: + if name and name == self.run_name: if reload_card: run_card = pjoin(self.me_dir, 'Cards','run_card.dat') self.run_card = banner_mod.RunCard(run_card) @@ -6334,7 +6453,7 @@ def run_syscalc(self, mode='parton', event_path=None, output=None): elif mode == 'Pythia': stdout = open(pjoin(event_dir, self.run_name, '%s_%s_syscalc.log' % (tag,mode)),'w') if 'mgpythiacard' in self.banner: - pat = re.compile('''^\s*qcut\s*=\s*([\+\-\d.e]*)''', re.M+re.I) + pat = re.compile(r'''^\s*qcut\s*=\s*([\+\-\d.e]*)''', re.M+re.I) data = pat.search(self.banner['mgpythiacard']) if data: qcut = float(data.group(1)) @@ -6611,7 +6730,7 @@ def get_subP_ids(path): for line in open(pjoin(path, 'leshouche.inc')): if not 'IDUP' in line: continue - particles = re.search("/([\d,-]+)/", line) + particles = re.search(r"/([\d,-]+)/", line) all_ids.append([int(p) for p in particles.group(1).split(',')]) return all_ids @@ -6899,6 +7018,7 @@ def do_combine_events(self, line): partials = 0 # if too many file make some partial unweighting sum_xsec, sum_xerru, sum_axsec = 0,[],0 + partials_info = [] Gdirs = self.get_Gdir() Gdirs.sort() for Gdir in Gdirs: @@ -6917,16 +7037,21 @@ def do_combine_events(self, line): sum_axsec += result.get('axsec')*gscalefact[Gdir] if len(AllEvent) >= 80: #perform a partial unweighting + nb_event = min(abs(1.01*self.nb_event*sum_axsec/self.results.current['cross']),self.run_card['nevents']) AllEvent.unweight(pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), - get_wgt, log_level=5, trunc_error=1e-2, event_target=self.nb_event) + get_wgt, log_level=5, trunc_error=1e-2, event_target=nb_event) AllEvent = lhe_parser.MultiEventFile() AllEvent.banner = self.banner - AllEvent.add(pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), + partials_info.append((pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), - sum_axsec) + sum_axsec) ) + sum_xsec, sum_xerru, sum_axsec = 0,[],0 partials +=1 + for data in partials_info: + AllEvent.add(*data) + if not hasattr(self,'proc_characteristic'): self.proc_characteristic = self.get_characteristics() diff --git a/epochX/cudacpp/gq_ttq.mad/bin/internal/misc.py b/epochX/cudacpp/gq_ttq.mad/bin/internal/misc.py index c4c669f36b..e7fd60be0d 100755 --- a/epochX/cudacpp/gq_ttq.mad/bin/internal/misc.py +++ b/epochX/cudacpp/gq_ttq.mad/bin/internal/misc.py @@ -67,7 +67,7 @@ def parse_info_str(fsock): """ info_dict = {} - pattern = re.compile("(?P\w*)\s*=\s*(?P.*)", + pattern = re.compile(r"(?P\w*)\s*=\s*(?P.*)", re.IGNORECASE | re.VERBOSE) for entry in fsock: entry = entry.strip() @@ -84,7 +84,7 @@ def parse_info_str(fsock): def glob(name, path=''): """call to glob.glob with automatic security on path""" import glob as glob_module - path = re.sub('(?P\?|\*|\[|\])', '[\g]', path) + path = re.sub(r'(?P\?|\*|\[|\])', r'[\g]', path) return glob_module.glob(pjoin(path, name)) #=============================================================================== @@ -614,10 +614,10 @@ def mod_compilator(directory, new='gfortran', current=None, compiler_type='gfort #search file file_to_change=find_makefile_in_dir(directory) if compiler_type == 'gfortran': - comp_re = re.compile('^(\s*)FC\s*=\s*(.+)\s*$') + comp_re = re.compile(r'^(\s*)FC\s*=\s*(.+)\s*$') var = 'FC' elif compiler_type == 'cpp': - comp_re = re.compile('^(\s*)CXX\s*=\s*(.+)\s*$') + comp_re = re.compile(r'^(\s*)CXX\s*=\s*(.+)\s*$') var = 'CXX' else: MadGraph5Error, 'Unknown compiler type: %s' % compiler_type @@ -861,9 +861,9 @@ def detect_current_compiler(path, compiler_type='fortran'): # comp = re.compile("^\s*FC\s*=\s*(\w+)\s*") # The regular expression below allows for compiler definition with absolute path if compiler_type == 'fortran': - comp = re.compile("^\s*FC\s*=\s*([\w\/\\.\-]+)\s*") + comp = re.compile("^\\s*FC\\s*=\\s*([\\w\\/\\.\\-]+)\\s*") elif compiler_type == 'cpp': - comp = re.compile("^\s*CXX\s*=\s*([\w\/\\.\-]+)\s*") + comp = re.compile("^\\s*CXX\\s*=\\s*([\\w\\/\\.\\-]+)\\s*") else: MadGraph5Error, 'Unknown compiler type: %s' % compiler_type @@ -1001,7 +1001,19 @@ def call_stdout(arg, *args, **opt): def copytree(src, dst, symlinks = False, ignore = None): if not os.path.exists(dst): os.makedirs(dst) - shutil.copystat(src, dst) + try: + shutil.copystat(src, dst) + except PermissionError: + if os.path.realpath(src).startswith('/cvmfs') and os.path.realpath(dst).startswith('/afs'): + # allowing missmatch from cvmfs to afs since sounds to not create issue --at least in general-- + logger.critical(f'Ignoring that we could not copy permissions from {src} to {dst}') + else: + logger.critical(f'Permission error detected from {src} to {dst}.\n'+\ + 'If you are using WSL with windows partition, please try using python3.12\n'+\ + 'or avoid moving your data from the WSL partition to the UNIX one') + # we do not have enough experience in WSL to allow it to get trough. + raise + lst = os.listdir(src) if ignore: excl = ignore(src, lst) @@ -1895,12 +1907,12 @@ class EasterEgg(object): May4_banner = "* _____ *\n" + \ "* ,-~\" \"~-. *\n" + \ "* * ,^ ___ ^. * *\n" + \ - "* * / .^ ^. \ * *\n" + \ + "* * / .^ ^. \\ * *\n" + \ "* * Y l o ! Y * *\n" + \ "* * l_ `.___.' _,[ * *\n" + \ "* * |^~\"--------------~\"\"^| * *\n" + \ "* * ! May the 4th ! * *\n" + \ - "* * \ / * *\n" + \ + "* * \\ / * *\n" + \ "* * ^. .^ * *\n" + \ "* * \"-.._____.,-\" * *\n" @@ -1909,13 +1921,13 @@ class EasterEgg(object): "* M::::::::::M M::::::::::M *\n" + \ "* M:::::::::::M M:::::::::::M (_)___ *\n" + \ "* M:::::::M::::M M::::M:::::::M | / __| *\n" + \ - "* M::::::M M::::M M::::M M::::::M | \__ \ *\n" + \ + "* M::::::M M::::M M::::M M::::::M | \\__ \\ *\n" + \ "* M::::::M M::::M::::M M::::::M |_|___/ *\n" + \ "* M::::::M M:::::::M M::::::M *\n" + \ "* M::::::M M:::::M M::::::M / _| ___ _ __ *\n" + \ - "* M::::::M MMMMM M::::::M | |_ / _ \| '__| *\n" + \ + "* M::::::M MMMMM M::::::M | |_ / _ \\| '__| *\n" + \ "* M::::::M M::::::M | _| (_) | | *\n" + \ - "* M::::::M M::::::M |_/\/\___/|_| *\n" + \ + "* M::::::M M::::::M |_/\\/\\___/|_| *\n" + \ "* M::::::M M::::::M *\n" + \ "* MMMMMMMM MMMMMMMM *\n" + \ "* *\n" + \ @@ -2233,39 +2245,51 @@ def import_python_lhapdf(lhapdfconfig): os.environ['LD_LIBRARY_PATH'] = lhapdf_libdir else: os.environ['LD_LIBRARY_PATH'] = '%s:%s' %(lhapdf_libdir,os.environ['LD_LIBRARY_PATH']) - try: candidates=[dirname for dirname in os.listdir(lhapdf_libdir) \ if os.path.isdir(os.path.join(lhapdf_libdir,dirname))] except OSError: candidates=[] + if os.path.isdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')): + candidates += [pjoin(os.pardir,'local', 'lib', dirname) for dirname in os.listdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')) + if os.path.isdir(os.path.join(lhapdf_libdir,os.pardir, 'local', 'lib', dirname))] for candidate in candidates: - if os.path.isdir(os.path.join(lhapdf_libdir,candidate,'site-packages')): - sys.path.insert(0,os.path.join(lhapdf_libdir,candidate,'site-packages')) - try: - import lhapdf - use_lhapdf=True - break - except ImportError: - sys.path.pop(0) - continue + for subdir in ['site-packages', 'dist-packages']: + if os.path.isdir(os.path.join(lhapdf_libdir,candidate, subdir)): + sys.path.insert(0,os.path.join(lhapdf_libdir,candidate, subdir)) + try: + import lhapdf + use_lhapdf=True + break + except ImportError as error: + sys.path.pop(0) + continue + else: + continue + break if not use_lhapdf: try: candidates=[dirname for dirname in os.listdir(lhapdf_libdir+'64') \ if os.path.isdir(os.path.join(lhapdf_libdir+'64',dirname))] except OSError: candidates=[] - + if os.path.isdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib64')): + candidates += [pjoin(os.pardir,'local', 'lib64', dirname) for dirname in os.listdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')) + if os.path.isdir(os.path.join(lhapdf_libdir,os.pardir, 'local', 'lib64', dirname))] for candidate in candidates: - if os.path.isdir(os.path.join(lhapdf_libdir+'64',candidate,'site-packages')): - sys.path.insert(0,os.path.join(lhapdf_libdir+'64',candidate,'site-packages')) - try: - import lhapdf - use_lhapdf=True - break - except ImportError: - sys.path.pop(0) - continue + for subdir in ['site-packages', 'dist-packages']: + if os.path.isdir(os.path.join(lhapdf_libdir+'64',candidate, subdir)): + sys.path.insert(0,os.path.join(lhapdf_libdir+'64',candidate, subdir)) + try: + import lhapdf + use_lhapdf=True + break + except ImportError as error: + sys.path.pop(0) + continue + else: + continue + break if not use_lhapdf: try: import lhapdf diff --git a/epochX/cudacpp/gq_ttq.mad/bin/internal/shower_card.py b/epochX/cudacpp/gq_ttq.mad/bin/internal/shower_card.py index e87d534177..16ed72b1a0 100755 --- a/epochX/cudacpp/gq_ttq.mad/bin/internal/shower_card.py +++ b/epochX/cudacpp/gq_ttq.mad/bin/internal/shower_card.py @@ -288,7 +288,7 @@ def write(self, output_file, template=None, python_template=False, self.text = open(template,'r').read() - key_re = re.compile('^(\s*)([\S^#]+)(\s*)=(\s*)([^#]*?)(\s*)(\#.*|$)') + key_re = re.compile(r'^(\s*)([\S^#]+)(\s*)=(\s*)([^#]*?)(\s*)(\#.*|$)') newlines = [] for line in self.text.split('\n'): key_match = key_re.findall(line) diff --git a/epochX/cudacpp/gq_ttq.mad/bin/internal/systematics.py b/epochX/cudacpp/gq_ttq.mad/bin/internal/systematics.py index 28eaed00e2..2acebd087c 100644 --- a/epochX/cudacpp/gq_ttq.mad/bin/internal/systematics.py +++ b/epochX/cudacpp/gq_ttq.mad/bin/internal/systematics.py @@ -582,7 +582,7 @@ def print_cross_sections(self, all_cross, nb_event, stdout): else: resume.write( '#PDF %s: %g +%2.3g%% -%2.3g%%\n' % (pdfset.name, pdferr.central,pdferr.errplus*100/all_cross[0], pdferr.errminus*100/all_cross[0])) - dyn_name = {1: '\sum ET', 2:'\sum\sqrt{m^2+pt^2}', 3:'0.5 \sum\sqrt{m^2+pt^2}',4:'\sqrt{\hat s}' } + dyn_name = {1: r'\sum ET', 2:r'\sum\sqrt{m^2+pt^2}', 3:r'0.5 \sum\sqrt{m^2+pt^2}',4:r'\sqrt{\hat s}' } for key, curr in dyns.items(): if key ==-1: continue @@ -789,7 +789,7 @@ def get_id(self): return int(self.start_wgt_id) if 'initrwgt' in self.banner: - pattern = re.compile(' set lhapdf /PATH/TO/lhapdf-config -None does not seem to correspond to a valid lhapdf-config executable. -Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config). -Note that you can still compile and run aMC@NLO with the built-in PDFs - MG5_aMC> set lhapdf /PATH/TO/lhapdf-config - Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt -import /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq.mg +import /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq.mg The import format was not given, so we guess it as command set stdout_level DEBUG set output information to level: 10 @@ -61,7 +56,7 @@ set zerowidth_tchannel F define q = u c d s u~ c~ d~ s~ INFO: load particles INFO: load vertices -DEBUG: model prefixing takes 0.005497932434082031  +DEBUG: model prefixing takes 0.0057294368743896484  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  @@ -170,17 +165,16 @@ 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.079 s +8 processes with 40 diagrams generated in 0.080 s Total: 8 processes with 40 diagrams output standalone_cudacpp ../TMPOUT/CODEGEN_cudacpp_gq_ttq Load PLUGIN.CUDACPP_OUTPUT -Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.5.3_lo_vect. +Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.6.0_lo_vect. It has been validated for the last time with version: 3.5.2 Output will be done with PLUGIN: CUDACPP_OUTPUT -DEBUG: cformat =  plugin [export_cpp.py at line 3070]  DEBUG: Entering PLUGIN_ProcessExporter.__init__ (initialise the exporter) [output.py at line 165]  DEBUG: Entering PLUGIN_ProcessExporter.copy_template (initialise the directory) [output.py at line 170]  -INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq +INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq INFO: Organizing processes into subprocess groups INFO: Generating Helas calls for process: g u > t t~ u WEIGHTED<=3 @1 INFO: Processing color information for process: g u > t t~ u @1 @@ -197,40 +191,40 @@ INFO: Combined process g s~ > t t~ s~ WEIGHTED<=3 @1 with process g u~ > t t~ u~ DEBUG: type(fortran_model)= [output.py at line 214]  DEBUG: type(me)= me=0 [output.py at line 215]  DEBUG: "need to link", self.to_link_in_P =  need to link ['nvtx.h', 'timer.h', 'timermap.h', 'ompnumthreads.h', 'GpuRuntime.h', 'GpuAbstraction.h', 'MemoryAccessHelpers.h', 'MemoryAccessVectors.h', 'MemoryAccessMatrixElements.h', 'MemoryAccessMomenta.h', 'MemoryAccessRandomNumbers.h', 'MemoryAccessWeights.h', 'MemoryAccessAmplitudes.h', 'MemoryAccessWavefunctions.h', 'MemoryAccessGs.h', 'MemoryAccessCouplingsFixed.h', 'MemoryAccessNumerators.h', 'MemoryAccessDenominators.h', 'MemoryAccessChannelIds.h', 'EventStatistics.h', 'CommonRandomNumbers.h', 'CrossSectionKernels.cc', 'CrossSectionKernels.h', 'MatrixElementKernels.cc', 'MatrixElementKernels.h', 'RamboSamplingKernels.cc', 'RamboSamplingKernels.h', 'RandomNumberKernels.h', 'CommonRandomNumberKernel.cc', 'CurandRandomNumberKernel.cc', 'HiprandRandomNumberKernel.cc', 'Bridge.h', 'BridgeKernels.cc', 'BridgeKernels.h', 'fbridge.cc', 'fbridge.inc', 'fsampler.cc', 'fsampler.inc', 'MadgraphTest.h', 'runTest.cc', 'testmisc.cc', 'testxxx_cc_ref.txt', 'valgrind.h', 'cudacpp.mk', 'testxxx.cc', 'MemoryBuffers.h', 'MemoryAccessCouplings.h', 'perf.py', 'profile.sh'] [output.py at line 216]  -INFO: Creating files in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/SubProcesses/P1_Sigma_sm_gu_ttxu -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/SubProcesses/P1_Sigma_sm_gu_ttxu/./CPPProcess.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/SubProcesses/P1_Sigma_sm_gu_ttxu/./CPPProcess.cc -INFO: Created files CPPProcess.h and CPPProcess.cc in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/SubProcesses/P1_Sigma_sm_gu_ttxu/. +INFO: Creating files in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/SubProcesses/P1_Sigma_sm_gu_ttxu +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/SubProcesses/P1_Sigma_sm_gu_ttxu/./CPPProcess.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/SubProcesses/P1_Sigma_sm_gu_ttxu/./CPPProcess.cc +INFO: Created files CPPProcess.h and CPPProcess.cc in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/SubProcesses/P1_Sigma_sm_gu_ttxu/. DEBUG: Entering PLUGIN_ProcessExporter.generate_subprocess_directory (create the directory) [output.py at line 212]  DEBUG: type(subproc_group)= [output.py at line 213]  DEBUG: type(fortran_model)= [output.py at line 214]  DEBUG: type(me)= me=1 [output.py at line 215]  DEBUG: "need to link", self.to_link_in_P =  need to link ['nvtx.h', 'timer.h', 'timermap.h', 'ompnumthreads.h', 'GpuRuntime.h', 'GpuAbstraction.h', 'MemoryAccessHelpers.h', 'MemoryAccessVectors.h', 'MemoryAccessMatrixElements.h', 'MemoryAccessMomenta.h', 'MemoryAccessRandomNumbers.h', 'MemoryAccessWeights.h', 'MemoryAccessAmplitudes.h', 'MemoryAccessWavefunctions.h', 'MemoryAccessGs.h', 'MemoryAccessCouplingsFixed.h', 'MemoryAccessNumerators.h', 'MemoryAccessDenominators.h', 'MemoryAccessChannelIds.h', 'EventStatistics.h', 'CommonRandomNumbers.h', 'CrossSectionKernels.cc', 'CrossSectionKernels.h', 'MatrixElementKernels.cc', 'MatrixElementKernels.h', 'RamboSamplingKernels.cc', 'RamboSamplingKernels.h', 'RandomNumberKernels.h', 'CommonRandomNumberKernel.cc', 'CurandRandomNumberKernel.cc', 'HiprandRandomNumberKernel.cc', 'Bridge.h', 'BridgeKernels.cc', 'BridgeKernels.h', 'fbridge.cc', 'fbridge.inc', 'fsampler.cc', 'fsampler.inc', 'MadgraphTest.h', 'runTest.cc', 'testmisc.cc', 'testxxx_cc_ref.txt', 'valgrind.h', 'cudacpp.mk', 'testxxx.cc', 'MemoryBuffers.h', 'MemoryAccessCouplings.h', 'perf.py', 'profile.sh'] [output.py at line 216]  -INFO: Creating files in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/SubProcesses/P1_Sigma_sm_gux_ttxux -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/SubProcesses/P1_Sigma_sm_gux_ttxux/./CPPProcess.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/SubProcesses/P1_Sigma_sm_gux_ttxux/./CPPProcess.cc -INFO: Created files CPPProcess.h and CPPProcess.cc in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/SubProcesses/P1_Sigma_sm_gux_ttxux/. +INFO: Creating files in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/SubProcesses/P1_Sigma_sm_gux_ttxux +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/SubProcesses/P1_Sigma_sm_gux_ttxux/./CPPProcess.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/SubProcesses/P1_Sigma_sm_gux_ttxux/./CPPProcess.cc +INFO: Created files CPPProcess.h and CPPProcess.cc in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/SubProcesses/P1_Sigma_sm_gux_ttxux/. Generated helas calls for 2 subprocesses (10 diagrams) in 0.031 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.145 s +ALOHA: aloha creates 2 routines in 0.147 s FFV1 FFV1 FFV1 FFV1 VVV1 -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/src/./HelAmps_sm.h -INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/src/. +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/src/./HelAmps_sm.h +INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/src/. super_write_set_parameters_onlyfixMajorana (hardcoded=False) super_write_set_parameters_onlyfixMajorana (hardcoded=True) -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/src/./Parameters_sm.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/src/./Parameters_sm.cc +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/src/./Parameters_sm.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/src/./Parameters_sm.cc INFO: Created files Parameters_sm.h and Parameters_sm.cc in directory -INFO: /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/src/. and /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/src/. +INFO: /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/src/. and /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_gq_ttq/src/. quit -real 0m0.756s -user 0m0.592s -sys 0m0.059s +real 0m0.658s +user 0m0.600s +sys 0m0.052s Code generation completed in 1 seconds diff --git a/epochX/cudacpp/heft_gg_bb.mad/CODEGEN_mad_heft_gg_bb_log.txt b/epochX/cudacpp/heft_gg_bb.mad/CODEGEN_mad_heft_gg_bb_log.txt index b5c70a5837..0d7d52c915 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/CODEGEN_mad_heft_gg_bb_log.txt +++ b/epochX/cudacpp/heft_gg_bb.mad/CODEGEN_mad_heft_gg_bb_log.txt @@ -14,7 +14,7 @@ Running MG5 in debug mode * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect 2023-12-23 * +* VERSION 3.6.0_lo_vect 2024-06-17 * * * * WARNING: UNKNOWN DEVELOPMENT VERSION. * * WARNING: DO NOT USE FOR PRODUCTION * @@ -45,22 +45,17 @@ Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (inclu Note that you can still compile and run aMC@NLO with the built-in PDFs MG5_aMC> set lhapdf /PATH/TO/lhapdf-config -None does not seem to correspond to a valid lhapdf-config executable. -Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config). -Note that you can still compile and run aMC@NLO with the built-in PDFs - MG5_aMC> set lhapdf /PATH/TO/lhapdf-config - Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt -import /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb.mg +import /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb.mg The import format was not given, so we guess it as command set stdout_level DEBUG set output information to level: 10 set zerowidth_tchannel F set auto_convert_model T save options auto_convert_model -save configuration file to /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +save configuration file to /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt import model heft INFO: Restrict model heft with file models/heft/restrict_default.dat . DEBUG: Simplifying conditional expressions  @@ -131,20 +126,20 @@ INFO: Process has 4 diagrams Total: 1 processes with 4 diagrams output madevent_simd ../TMPOUT/CODEGEN_mad_heft_gg_bb --hel_recycling=False --vector_size=32 Load PLUGIN.CUDACPP_OUTPUT -Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.5.3_lo_vect. +Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.6.0_lo_vect. It has been validated for the last time with version: 3.5.2 Output will be done with PLUGIN: CUDACPP_OUTPUT Addition matrix-element will be done with PLUGIN: CUDACPP_OUTPUT +DEBUG: opt['output_options']['vector_size'] =  32 [export_v4.py at line 4334]  Output will be done with PLUGIN: CUDACPP_OUTPUT -DEBUG: cformat =  standalone_simd [export_cpp.py at line 3070]  DEBUG: Entering PLUGIN_ProcessExporter.__init__ (initialise the exporter) [output.py at line 165]  INFO: initialize a new directory: CODEGEN_mad_heft_gg_bb INFO: remove old information in CODEGEN_mad_heft_gg_bb DEBUG: Entering PLUGIN_ProcessExporter.copy_template (initialise the directory) [output.py at line 170]  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb  -INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/Cards  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/SubProcesses  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb  +INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/Cards  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/SubProcesses  INFO: Organizing processes into subprocess groups INFO: Generating Helas calls for process: g g > b b~ HIG<=1 HIW<=1 @1 INFO: Processing color information for process: g g > b b~ HIG<=1 HIW<=1 @1 @@ -154,68 +149,67 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4] [export_cpp.py at line 711]  -DEBUG: subproc_number =  0 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: g g > b b~ HIG<=1 HIW<=1 @1 INFO: Finding symmetric diagrams for subprocess group gg_bbx -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/SubProcesses/P1_gg_bbx [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  4 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4} [model_handling.py at line 1548]  Generated helas calls for 1 subprocesses (4 diagrams) in 0.009 s -Wrote files for 12 helas calls in 0.087 s +Wrote files for 12 helas calls in 0.078 s +DEBUG: self.vector_size =  32 [export_v4.py at line 7023]  ALOHA: aloha starts to compute helicity amplitudes ALOHA: aloha creates VVS3 routines ALOHA: aloha creates VVV1 set of routines with options: P0 ALOHA: aloha creates FFV1 routines ALOHA: aloha creates FFS2 routines -ALOHA: aloha creates 4 routines in 0.265 s +ALOHA: aloha creates 4 routines in 0.270 s ALOHA: aloha starts to compute helicity amplitudes ALOHA: aloha creates VVS3 routines ALOHA: aloha creates VVV1 set of routines with options: P0 ALOHA: aloha creates FFV1 routines ALOHA: aloha creates FFS2 routines -ALOHA: aloha creates 8 routines in 0.251 s +ALOHA: aloha creates 8 routines in 0.257 s VVS3 VVV1 FFV1 FFV1 FFV1 FFS2 -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/src/./HelAmps_heft.h -INFO: Created file HelAmps_heft.h in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/src/. +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/src/./HelAmps_heft.h +INFO: Created file HelAmps_heft.h in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/src/. super_write_set_parameters_onlyfixMajorana (hardcoded=False) super_write_set_parameters_onlyfixMajorana (hardcoded=True) -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/src/./Parameters_heft.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/src/./Parameters_heft.cc +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/src/./Parameters_heft.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/src/./Parameters_heft.cc INFO: Created files Parameters_heft.h and Parameters_heft.cc in directory -INFO: /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/src/. and /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/src/. +INFO: /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/src/. and /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/src/. The option zerowidth_tchannel is modified [True] but will not be written in the configuration files. If you want to make this value the default for future session, you can run 'save options --all' -save configuration file to /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/Cards/me5_configuration.txt +save configuration file to /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/Cards/me5_configuration.txt INFO: Use Fortran compiler gfortran INFO: Use c++ compiler g++ INFO: Generate jpeg diagrams INFO: Generate web pages -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common -patching file Source/genps.inc +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common patching file SubProcesses/makefile -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/SubProcesses/P1_gg_bbx; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/SubProcesses/P1_gg_bbx; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f +Hunk #2 succeeded at 227 (offset 13 lines). DEBUG: p.returncode =  0 [output.py at line 258]  -Output to directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb done. +Output to directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb done. Type "launch" to generate events from this process, or see -/data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/README +/data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/README Run "open index.html" to see more information about this process. quit -real 0m2.690s -user 0m1.914s -sys 0m0.257s -Code generation completed in 3 seconds +real 0m2.177s +user 0m1.895s +sys 0m0.262s +Code generation completed in 2 seconds ************************************************************ * * * W E L C O M E to * @@ -228,7 +222,7 @@ Code generation completed in 3 seconds * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect * +* VERSION 3.6.0_lo_vect * * * * The MadGraph5_aMC@NLO Development Team - Find us at * * https://server06.fynu.ucl.ac.be/projects/madgraph * @@ -236,9 +230,9 @@ Code generation completed in 3 seconds * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt @@ -258,7 +252,7 @@ launch in debug mode * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect * +* VERSION 3.6.0_lo_vect * * * * The MadGraph5_aMC@NLO Development Team - Find us at * * https://server06.fynu.ucl.ac.be/projects/madgraph * @@ -266,9 +260,9 @@ launch in debug mode * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_heft_gg_bb/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt diff --git a/epochX/cudacpp/heft_gg_bb.mad/Cards/me5_configuration.txt b/epochX/cudacpp/heft_gg_bb.mad/Cards/me5_configuration.txt index cdeedc7863..4f5079f78a 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/Cards/me5_configuration.txt +++ b/epochX/cudacpp/heft_gg_bb.mad/Cards/me5_configuration.txt @@ -116,6 +116,7 @@ # cluster_type = condor # cluster_queue = madgraph # cluster_size = 150 +# cluster_walltime = # time in minute for slurm and second for condor (not supported for other scheduller) #! Path to a node directory to avoid direct writing on the central disk #! Note that condor clusters avoid direct writing by default (therefore this @@ -234,7 +235,7 @@ # pineappl = pineappl -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo # MG5 MAIN DIRECTORY -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo diff --git a/epochX/cudacpp/heft_gg_bb.mad/Cards/param_card.dat b/epochX/cudacpp/heft_gg_bb.mad/Cards/param_card.dat index c9600c4da0..8e66ac1662 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/Cards/param_card.dat +++ b/epochX/cudacpp/heft_gg_bb.mad/Cards/param_card.dat @@ -1,5 +1,5 @@ ###################################################################### -## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL #### +## PARAM_CARD AUTOMATICALLY GENERATED BY MG5 FOLLOWING UFO MODEL #### ###################################################################### ## ## ## Width set on Auto will be computed following the information ## diff --git a/epochX/cudacpp/heft_gg_bb.mad/Cards/param_card_default.dat b/epochX/cudacpp/heft_gg_bb.mad/Cards/param_card_default.dat index c9600c4da0..8e66ac1662 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/Cards/param_card_default.dat +++ b/epochX/cudacpp/heft_gg_bb.mad/Cards/param_card_default.dat @@ -1,5 +1,5 @@ ###################################################################### -## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL #### +## PARAM_CARD AUTOMATICALLY GENERATED BY MG5 FOLLOWING UFO MODEL #### ###################################################################### ## ## ## Width set on Auto will be computed following the information ## diff --git a/epochX/cudacpp/heft_gg_bb.mad/Cards/proc_card_mg5.dat b/epochX/cudacpp/heft_gg_bb.mad/Cards/proc_card_mg5.dat index 92abae0d44..2e02c5ea0e 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/Cards/proc_card_mg5.dat +++ b/epochX/cudacpp/heft_gg_bb.mad/Cards/proc_card_mg5.dat @@ -8,7 +8,7 @@ #* * * * #* * #* * -#* VERSION 3.5.3_lo_vect 2023-12-23 * +#* VERSION 3.6.0_lo_vect 2024-06-17 * #* * #* WARNING: UNKNOWN DEVELOPMENT VERSION. * #* WARNING: DO NOT USE FOR PRODUCTION * diff --git a/epochX/cudacpp/heft_gg_bb.mad/Cards/reweight_card_default.dat b/epochX/cudacpp/heft_gg_bb.mad/Cards/reweight_card_default.dat index ace534ae02..5cc65fe095 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/Cards/reweight_card_default.dat +++ b/epochX/cudacpp/heft_gg_bb.mad/Cards/reweight_card_default.dat @@ -19,8 +19,16 @@ change mode NLO # Define type of Reweighting. For LO sample this command # has no effect since only "LO" mode is allowed. + +#uncomment if you do not want to overwrite the reweight file of Sudakov in rw_me +#change rwgt_dir /PATH_MG5_BRANCH/NAME_FOLDER + +#uncomment if you want to use Sudakov Reweight +#change include_sudakov True + launch + # SPECIFY A PATH OR USE THE SET COMMAND LIKE THIS: # set sminputs 1 130 # modify 1/alpha_EW diff --git a/epochX/cudacpp/heft_gg_bb.mad/Cards/run_card.dat b/epochX/cudacpp/heft_gg_bb.mad/Cards/run_card.dat index d1ec266fca..8af20dc4e4 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/Cards/run_card.dat +++ b/epochX/cudacpp/heft_gg_bb.mad/Cards/run_card.dat @@ -170,6 +170,7 @@ systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++] ['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule + #*********************************************************************** # SIMD/GPU configuration for the CUDACPP plugin #************************************************************************ diff --git a/epochX/cudacpp/heft_gg_bb.mad/Cards/run_card_default.dat b/epochX/cudacpp/heft_gg_bb.mad/Cards/run_card_default.dat index 5a50dbf7ed..cfef927481 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/Cards/run_card_default.dat +++ b/epochX/cudacpp/heft_gg_bb.mad/Cards/run_card_default.dat @@ -170,6 +170,7 @@ systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++] ['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule + #*********************************************************************** # SIMD/GPU configuration for the CUDACPP plugin #************************************************************************ diff --git a/epochX/cudacpp/heft_gg_bb.mad/MGMEVersion.txt b/epochX/cudacpp/heft_gg_bb.mad/MGMEVersion.txt index 9d3a5c0ba0..a806d3938c 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/MGMEVersion.txt +++ b/epochX/cudacpp/heft_gg_bb.mad/MGMEVersion.txt @@ -1 +1 @@ -3.5.3_lo_vect \ No newline at end of file +3.6.0_lo_vect \ No newline at end of file diff --git a/epochX/cudacpp/heft_gg_bb.mad/Source/DHELAS/aloha_functions.f b/epochX/cudacpp/heft_gg_bb.mad/Source/DHELAS/aloha_functions.f index 975725737f..47699fa614 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/Source/DHELAS/aloha_functions.f +++ b/epochX/cudacpp/heft_gg_bb.mad/Source/DHELAS/aloha_functions.f @@ -351,7 +351,7 @@ subroutine oxxxxx(p,fmass,nhel,nsf , fo) fo(6) = ip * sqm(abs(im)) else - pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2)) +c pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2)) sf(1) = dble(1+nsf+(1-nsf)*nh)*rHalf sf(2) = dble(1+nsf-(1-nsf)*nh)*rHalf omega(1) = dsqrt(p(0)+pp) @@ -2054,7 +2054,7 @@ subroutine CombineAmp(nb, ihels, iwfcts, W1, Wall, Amp) enddo return end - + subroutine CombineAmpS(nb, ihels, iwfcts, W1, Wall, Amp) integer nb ! size of the vectors diff --git a/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/couplings.f b/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/couplings.f index f3b620ab58..04d6bb5333 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/couplings.f +++ b/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/couplings.f @@ -10,18 +10,27 @@ SUBROUTINE COUP() PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + LOGICAL UPDATELOOP COMMON /TO_UPDATELOOP/UPDATELOOP INCLUDE 'input.inc' - INCLUDE '../vector.inc' + + INCLUDE 'coupl.inc' READLHA = .TRUE. INCLUDE 'intparam_definition.inc' CALL COUP1() + IF (UPDATELOOP) THEN + + CALL COUP2() + + ENDIF + C couplings needed to be evaluated points by points C - CALL COUP2(1) + CALL COUP3(1) RETURN END @@ -47,7 +56,11 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) INCLUDE '../maxparticles.inc' INCLUDE '../cuts.inc' + + INCLUDE '../vector.inc' + + INCLUDE '../run.inc' DOUBLE PRECISION ALPHAS @@ -65,7 +78,7 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) couplings needed to be evaluated points by points C ALL_G(VECID) = G - CALL COUP2(VECID) + CALL COUP3(VECID) RETURN END @@ -80,7 +93,9 @@ SUBROUTINE UPDATE_AS_PARAM2(MU_R2,AS2 ,VECID) INTEGER VECID INCLUDE 'model_functions.inc' INCLUDE 'input.inc' + INCLUDE '../vector.inc' + INCLUDE 'coupl.inc' DOUBLE PRECISION MODEL_SCALE COMMON /MODEL_SCALE/MODEL_SCALE diff --git a/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/couplings1.f b/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/couplings1.f index f0848107b5..dd11e8418e 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/couplings1.f +++ b/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/couplings1.f @@ -7,12 +7,13 @@ SUBROUTINE COUP1( ) IMPLICIT NONE INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' GC_74 = -((MDL_COMPLEXI*MDL_YB)/MDL_SQRT__2) END diff --git a/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/couplings2.f b/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/couplings2.f index e2f1fb6eab..30f3a04e3b 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/couplings2.f +++ b/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/couplings2.f @@ -2,19 +2,17 @@ c written by the UFO converter ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc - SUBROUTINE COUP2( VECID) + SUBROUTINE COUP2( ) IMPLICIT NONE - INTEGER VECID + INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' - GC_10(VECID) = -G - GC_11(VECID) = MDL_COMPLEXI*G - GC_13(VECID) = -(MDL_COMPLEXI*MDL_GH) END diff --git a/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/couplings3.f b/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/couplings3.f index bcfea764e7..e033f0a91c 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/couplings3.f +++ b/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/couplings3.f @@ -7,12 +7,13 @@ SUBROUTINE COUP3( VECID) IMPLICIT NONE INTEGER VECID INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' GC_10(VECID) = -G GC_11(VECID) = MDL_COMPLEXI*G diff --git a/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/makefile b/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/makefile index 0b24445a53..5a5681d220 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/makefile +++ b/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/makefile @@ -3,7 +3,7 @@ # Makefile for model library # # ---------------------------------------------------------------------------- - +# template models/template_files/makefile_madevent # Check for ../make_opts ifeq ($(wildcard ../make_opts), ../make_opts) include ../make_opts diff --git a/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/makeinc.inc b/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/makeinc.inc index 6e2743eac1..4a9e1b2cc5 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/makeinc.inc +++ b/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/makeinc.inc @@ -2,4 +2,4 @@ # written by the UFO converter ############################################################################# -MODEL = couplings.o lha_read.o printout.o rw_para.o model_functions.o couplings1.o couplings2.o \ No newline at end of file +MODEL = couplings.o lha_read.o printout.o rw_para.o model_functions.o couplings1.o couplings2.o couplings3.o \ No newline at end of file diff --git a/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/printout.f b/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/printout.f index 18b8f35b08..3e195b03a2 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/printout.f +++ b/epochX/cudacpp/heft_gg_bb.mad/Source/MODEL/printout.f @@ -1,3 +1,7 @@ +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +c written by the UFO converter +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc + c************************************************************************ c** ** c** MadGraph/MadEvent Interface to FeynRules ** @@ -9,7 +13,7 @@ subroutine printout implicit none - include '../vector.inc' ! defines VECSIZE_MEMMAX + include '../vector.inc' ! VECSIZE_MEMMAX (needed by coupl.inc) include 'coupl.inc' ! needs VECSIZE_MEMMAX (defined in vector.inc) include 'input.inc' diff --git a/epochX/cudacpp/heft_gg_bb.mad/Source/PDF/eepdf.inc b/epochX/cudacpp/heft_gg_bb.mad/Source/PDF/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/Source/PDF/eepdf.inc +++ b/epochX/cudacpp/heft_gg_bb.mad/Source/PDF/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/heft_gg_bb.mad/Source/PDF/pdfwrap_emela.f b/epochX/cudacpp/heft_gg_bb.mad/Source/PDF/pdfwrap_emela.f index bce10819d5..da1e4e2276 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/Source/PDF/pdfwrap_emela.f +++ b/epochX/cudacpp/heft_gg_bb.mad/Source/PDF/pdfwrap_emela.f @@ -13,7 +13,7 @@ SUBROUTINE PDFWRAP DOUBLE PRECISION VALUE(20) REAL*8 ALPHASPDF EXTERNAL ALPHASPDF - ! PDFs with beamstrahlung use specific initialisation/evaluation +C PDFs with beamstrahlung use specific initialisation/evaluation LOGICAL HAS_BSTRAHL COMMON /TO_HAS_BS/ HAS_BSTRAHL diff --git a/epochX/cudacpp/heft_gg_bb.mad/Source/PDF/pdg2pdf.f b/epochX/cudacpp/heft_gg_bb.mad/Source/PDF/pdg2pdf.f index 46f321e66b..2e7343a69b 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/Source/PDF/pdg2pdf.f +++ b/epochX/cudacpp/heft_gg_bb.mad/Source/PDF/pdg2pdf.f @@ -108,7 +108,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) else if (abs(ipart).eq.10) then ipart = sign(1,ipart) * 15 endif - pdg2pdf = 0d0 + pdg2pdf = 0d0 if (beamid.lt.0) then ih_local = ipart @@ -122,7 +122,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) endif do i_ee = 1, n_ee ee_components(i_ee) = compute_eepdf(x,omx_ee(iabs(beamid)),xmu,i_ee,ipart,ih_local) - enddo + enddo pdg2pdf = ee_components(1) ! temporary to test pdf load c write(*,*), x, beamid ,omx_ee(iabs(beamid)),xmu,1,ipart,ih_local,pdg2pdf return diff --git a/epochX/cudacpp/heft_gg_bb.mad/Source/dsample.f b/epochX/cudacpp/heft_gg_bb.mad/Source/dsample.f index 09d482b45a..b0bc0547ad 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/Source/dsample.f +++ b/epochX/cudacpp/heft_gg_bb.mad/Source/dsample.f @@ -204,6 +204,9 @@ subroutine sample_full(ndim,ncall,itmax,itmin,dsig,ninvar,nconfigs,VECSIZE_USED) if (VECSIZE_USED.le.1) then all_fx(1) = dsig(all_p, all_wgt,0) + ivec=0 + ilock=0 + iwarp=1 else c Here "i" is the position in the full grid of the event do i=(iwarp-1)*WARP_SIZE+1, iwarp*warp_size diff --git a/epochX/cudacpp/heft_gg_bb.mad/Source/eepdf.inc b/epochX/cudacpp/heft_gg_bb.mad/Source/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/Source/eepdf.inc +++ b/epochX/cudacpp/heft_gg_bb.mad/Source/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/heft_gg_bb.mad/Source/genps.inc b/epochX/cudacpp/heft_gg_bb.mad/Source/genps.inc index af7e0efbce..ef78e7e812 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/Source/genps.inc +++ b/epochX/cudacpp/heft_gg_bb.mad/Source/genps.inc @@ -29,9 +29,8 @@ c parameter (max_host=99,maxplace=199,maxpoints=100,maxans=50) c************************************************************************* c Parameters for helicity sums in matrixN.f c************************************************************************* - REAL*8 LIMHEL -c PARAMETER(LIMHEL=1e-8) ! ME threshold for helicity filtering (Fortran default) - PARAMETER(LIMHEL=0) ! ME threshold for helicity filtering (force Fortran to mimic cudacpp, see #419) +c REAL*8 LIMHEL +c PARAMETER(LIMHEL=1e-8) -> pass in the run_card.dat INTEGER MAXTRIES PARAMETER(MAXTRIES=25) C To pass the helicity configuration chosen by the DiscreteSampler to diff --git a/epochX/cudacpp/heft_gg_bb.mad/Source/run.inc b/epochX/cudacpp/heft_gg_bb.mad/Source/run.inc index 5433a23583..81c8df6bf2 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/Source/run.inc +++ b/epochX/cudacpp/heft_gg_bb.mad/Source/run.inc @@ -106,4 +106,7 @@ c double precision tmin_for_channel integer sde_strat ! 1 means standard single diagram enhancement strategy, c 2 means approximation by the denominator of the propagator - common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat \ No newline at end of file + common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat +c + double precision limhel + common/to_limhel/limhel diff --git a/epochX/cudacpp/heft_gg_bb.mad/Source/run_card.inc b/epochX/cudacpp/heft_gg_bb.mad/Source/run_card.inc index 67af0f2051..1a1bc782bd 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/Source/run_card.inc +++ b/epochX/cudacpp/heft_gg_bb.mad/Source/run_card.inc @@ -88,6 +88,8 @@ DSQRT_SHAT = 0.000000000000000D+00 + LIMHEL = 0.000000000000000D+00 + PTJ = 2.000000000000000D+01 PTB = 0.000000000000000D+00 diff --git a/epochX/cudacpp/heft_gg_bb.mad/Source/setrun.f b/epochX/cudacpp/heft_gg_bb.mad/Source/setrun.f index 9e9ef7fdbd..dc6caef748 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/Source/setrun.f +++ b/epochX/cudacpp/heft_gg_bb.mad/Source/setrun.f @@ -162,9 +162,21 @@ subroutine setrun C Fill common block for Les Houches init info do i=1,2 if(lpp(i).eq.1.or.lpp(i).eq.2) then - idbmup(i)=2212 + if (nb_proton(i).eq.1.and.nb_neutron(i).eq.0) then + idbmup(i)=2212 + elseif (nb_proton(i).eq.0.and.nb_neutron(i).eq.1) then + idbmup(i)=2112 + else + idbmup(i) = 1000000000 + (nb_proton(i)+nb_neutron(i))*10 + $ + nb_proton(i)*10000 + endif elseif(lpp(i).eq.-1.or.lpp(i).eq.-2) then - idbmup(i)=-2212 + if (nb_proton(i).eq.1.and.nb_neutron(i).eq.0) then + idbmup(i)=-2212 + else + idbmup(i) = -1*(1000000000 + (nb_proton(i)+nb_neutron(i))*10 + $ + nb_proton(i)*10000) + endif elseif(lpp(i).eq.3) then idbmup(i)=11 elseif(lpp(i).eq.-3) then diff --git a/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/MGVersion.txt b/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/MGVersion.txt index 9d3a5c0ba0..a806d3938c 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/MGVersion.txt +++ b/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/MGVersion.txt @@ -1 +1 @@ -3.5.3_lo_vect \ No newline at end of file +3.6.0_lo_vect \ No newline at end of file diff --git a/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/P1_gg_bbx/CPPProcess.cc b/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/P1_gg_bbx/CPPProcess.cc index fb54fdea37..1291d5924f 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/P1_gg_bbx/CPPProcess.cc +++ b/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/P1_gg_bbx/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/P1_gg_bbx/CPPProcess.h b/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/P1_gg_bbx/CPPProcess.h index fcd8cce98a..bb2909d380 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/P1_gg_bbx/CPPProcess.h +++ b/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/P1_gg_bbx/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/P1_gg_bbx/auto_dsig.f b/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/P1_gg_bbx/auto_dsig.f index 35195c387d..bdd8998a01 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/P1_gg_bbx/auto_dsig.f +++ b/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/P1_gg_bbx/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1134,11 +1134,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=16) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1148,32 +1149,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=16) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=16) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/P1_gg_bbx/auto_dsig1.f b/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/P1_gg_bbx/auto_dsig1.f index 6a68e69402..a7b5c93585 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/P1_gg_bbx/auto_dsig1.f +++ b/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/P1_gg_bbx/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -101,6 +101,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -217,7 +219,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -281,7 +283,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -320,9 +322,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -338,6 +341,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -485,11 +490,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -589,9 +589,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -704,3 +706,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/P1_gg_bbx/driver.f b/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/P1_gg_bbx/driver.f index 27a6e46742..ec5722702a 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/P1_gg_bbx/driver.f +++ b/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/P1_gg_bbx/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/P1_gg_bbx/matrix1.f b/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/P1_gg_bbx/matrix1.f index 9995f8b768..4aa29f8152 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/P1_gg_bbx/matrix1.f +++ b/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/P1_gg_bbx/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -23,6 +23,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=16) INTEGER NGRAPHS @@ -46,8 +48,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -56,26 +58,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -86,7 +85,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -96,26 +94,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,4) /-1,-1,-1, 1/ DATA (NHEL(I, 2),I=1,4) /-1,-1,-1,-1/ DATA (NHEL(I, 3),I=1,4) /-1,-1, 1, 1/ @@ -143,8 +140,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -153,11 +149,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=3 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=3 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -167,12 +163,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -184,7 +179,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -213,35 +209,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -313,7 +307,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/cluster.f b/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/cluster.f index 649e46f4e9..b8995283ed 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/cluster.f +++ b/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/cluster.f @@ -552,6 +552,8 @@ logical function cluster(p, ivec) if (btest(mlevel,1)) $ write (*,*)'New event' + iwin = 0 + jwin = 0 cluster=.false. clustered=.false. do i=0,3 @@ -663,7 +665,8 @@ logical function cluster(p, ivec) c initialize graph storage igraphs(0)=0 nleft=nexternal -c cluster +c cluster + if (iwin.eq.0.or.jwin.eq.0) stop 21 do n=1,nexternal-2 c combine winner imocl(n)=imap(iwin,2)+imap(jwin,2) diff --git a/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/proc_characteristics b/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/proc_characteristics index a607b77022..be5693ddfc 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/proc_characteristics +++ b/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/proc_characteristics @@ -17,6 +17,8 @@ splitting_types = [] perturbation_order = [] limitations = [] + ew_sudakov = False hel_recycling = False single_color = True nlo_mixed_expansion = True + gauge = unitary diff --git a/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/refine.sh b/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/refine.sh index afb9b99ad1..b46170ba23 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/refine.sh +++ b/epochX/cudacpp/heft_gg_bb.mad/SubProcesses/refine.sh @@ -57,7 +57,11 @@ j=%(directory)s for((try=1;try<=16;try+=1)); do if [ "$keeplog" = true ] ; then + if [[ -e ../madevent ]];then ../madevent 2>&1 >> $k &1 >> $k &1 >> log.txt &1 >> log.txt &1 >> $k \w*)>') - pat_end=re.compile('\w*)>') + pat_begin=re.compile(r'<(?P\w*)>') + pat_end=re.compile(r'\w*)>') tag_to_file={'slha':'param_card.dat', 'mgruncard':'run_card.dat', @@ -319,7 +319,7 @@ def check_pid(self, pid2label): def get_lha_strategy(self): """get the lha_strategy: how the weight have to be handle by the shower""" - if not self["init"]: + if "init" not in self or not self["init"]: raise Exception("No init block define") data = self["init"].split('\n')[0].split() @@ -537,7 +537,8 @@ def charge_card(self, tag): self.param_card = param_card_reader.ParamCard(param_card) return self.param_card elif tag == 'mgruncard': - self.run_card = RunCard(self[tag], unknown_warning=False) + with misc.TMP_variable(RunCard, 'allow_scan', True): + self.run_card = RunCard(self[tag], consistency=False, unknow_warning=False) return self.run_card elif tag == 'mg5proccard': proc_card = self[tag].split('\n') @@ -976,6 +977,8 @@ class ConfigFile(dict): """ a class for storing/dealing with input file. """ + allow_scan = False + def __init__(self, finput=None, **opt): """initialize a new instance. input can be an instance of MadLoopParam, a file, a path to a file, or simply Nothing""" @@ -993,6 +996,7 @@ def __init__(self, finput=None, **opt): # Initialize it with all the default value self.user_set = set() self.auto_set = set() + self.scan_set = {} #key -> type of list (int/float/bool/str/... for scan self.system_only = set() self.lower_to_case = {} self.list_parameter = {} #key -> type of list (int/float/bool/str/... @@ -1109,6 +1113,8 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): #1. check if the parameter is set to auto -> pass it to special if lower_name in self: targettype = type(dict.__getitem__(self, lower_name)) + if lower_name in self.scan_set: + targettype = self.scan_set[lower_name] if targettype != str and isinstance(value, str) and value.lower() == 'auto': self.auto_set.add(lower_name) if lower_name in self.user_set: @@ -1118,13 +1124,26 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): return elif lower_name in self.auto_set: self.auto_set.remove(lower_name) - + + + #1. check if the parameter is set to auto -> pass it to special + scan_targettype = None + if self.allow_scan and isinstance(value, str) and value.strip().startswith('scan'): + if lower_name in self.user_set: + self.user_set.remove(lower_name) + self.scan_set[lower_name] = type(self[lower_name]) + dict.__setitem__(self, lower_name, value) + #keep old value. + self.post_set(lower_name,value, change_userdefine, raiseerror) + return + elif lower_name in self.scan_set: + scan_targettype = self.scan_set[lower_name] + del self.scan_set[lower_name] + # 2. Find the type of the attribute that we want if lower_name in self.list_parameter: targettype = self.list_parameter[lower_name] - - if isinstance(value, str): # split for each comma/space value = value.strip() @@ -1248,8 +1267,11 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): if change_userdefine: self.user_set.add(lower_name) return self.post_set(lower_name, None, change_userdefine, raiseerror) - elif name in self: - targettype = type(self[name]) + elif name in self: + if scan_targettype: + targettype = targettype + else: + targettype = type(self[name]) else: logger.debug('Trying to add argument %s in %s. ' % (name, self.__class__.__name__) +\ 'This argument is not defined by default. Please consider adding it.') @@ -1262,7 +1284,7 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): if change_userdefine: self.user_set.add(lower_name) return self.post_set(lower_name, None, change_userdefine, raiseerror) - + value = self.format_variable(value, targettype, name=name) #check that the value is allowed: if lower_name in self.allowed_value and '*' not in self.allowed_value[lower_name]: @@ -1444,7 +1466,7 @@ def format_variable(value, targettype, name="unknown"): value =int(value[:-1]) * convert[value[-1]] elif '/' in value or '*' in value: try: - split = re.split('(\*|/)',value) + split = re.split(r'(\*|/)',value) v = float(split[0]) for i in range((len(split)//2)): if split[2*i+1] == '*': @@ -1482,7 +1504,7 @@ def format_variable(value, targettype, name="unknown"): value = float(value) except ValueError: try: - split = re.split('(\*|/)',value) + split = re.split(r'(\*|/)',value) v = float(split[0]) for i in range((len(split)//2)): if split[2*i+1] == '*': @@ -1491,7 +1513,10 @@ def format_variable(value, targettype, name="unknown"): v /= float(split[2*i+2]) except: v=0 - raise InvalidCmd("%s can not be mapped to a float" % value) + if "scan" in value: + raise InvalidCmd("%s is not supported here. Note that scan command can not be present simultaneously in the run_card and param_card." % value) + else: + raise InvalidCmd("%s can not be mapped to a float" % value) finally: value = v else: @@ -1737,10 +1762,12 @@ def default_setup(self): self.add_param('splitting_types',[], typelist=str) self.add_param('perturbation_order', [], typelist=str) self.add_param('limitations', [], typelist=str) + self.add_param('ew_sudakov', False) self.add_param('hel_recycling', False) self.add_param('single_color', True) self.add_param('nlo_mixed_expansion', True) - + self.add_param('gauge', 'U') + def read(self, finput): """Read the input file, this can be a path to a file, a file object, a str with the content of the file.""" @@ -3104,7 +3131,7 @@ def write(self, output_file, template=None, python_template=False, # do not write hidden parameter not hidden for this template # if python_template: - written = written.union(set(re.findall('\%\((\w*)\)s', open(template,'r').read(), re.M))) + written = written.union(set(re.findall(r'\%\((\w*)\)s', open(template,'r').read(), re.M))) to_write = to_write.union(set(self.hidden_param)) to_write = to_write.difference(written) @@ -3157,7 +3184,6 @@ def get_value_from_include(self, path, list_of_params, output_dir): if path does not exists return the current value in self for all parameter""" #WARNING DOES NOT HANDLE LIST/DICT so far - misc.sprint(output_dir, path) # handle case where file is missing if not os.path.exists(pjoin(output_dir,path)): misc.sprint("include file not existing", pjoin(output_dir,path)) @@ -3259,7 +3285,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): text = open(path,'r').read() #misc.sprint(text) f77_type = ['real*8', 'integer', 'double precision', 'logical'] - pattern = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I+re.M) for fct in pattern.findall(text): fsock = file_writers.FortranWriter(tmp,'w') @@ -3287,6 +3313,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): starttext = open(pjoin(outdir, path+'.orig')).read() fsock.remove_routine(starttext, to_mod[path][0]) for text in to_mod[path][1]: + text = self.retro_compatible_custom_fct(text) fsock.writelines(text) fsock.close() if not filecmp.cmp(pjoin(outdir, path), pjoin(outdir, path+'.tmp')): @@ -3303,7 +3330,33 @@ def edit_dummy_fct_from_file(self, filelist, outdir): files.mv(pjoin(outdir,path+'.orig'), pjoin(outdir, path)) + @staticmethod + def retro_compatible_custom_fct(lines, mode=None): + f77_type = ['real*8', 'integer', 'double precision', 'logical'] + function_pat = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + % {'type':'|'.join(f77_type)}, re.I+re.M) + include_pat = re.compile(r"\s+include\s+[\'\"]([\w\./]*)") + + assert isinstance(lines, list) + sol = [] + + if mode is None or 'vector.inc' in mode: + search = True + for i,line in enumerate(lines[:]): + if search and re.search(include_pat, line): + name = re.findall(include_pat, line)[0] + misc.sprint('DETECTED INCLUDE', name) + if 'vector.inc' in name: + search = False + if 'run.inc' in name: + sol.append(" include 'vector.inc'") + search = False + sol.append(line) + if re.search(function_pat, line): + misc.sprint("DETECTED FCT") + search = True + return sol def guess_entry_fromname(self, name, value): """ @@ -3346,7 +3399,7 @@ def update_typelist(value, name, opts): #handle metadata opts = {} forced_opts = [] - for key,val in re.findall("\<(?P[_\-\w]+)\=(?P[^>]*)\>", str(name)): + for key,val in re.findall(r"\<(?P[_\-\w]+)\=(?P[^>]*)\>", str(name)): forced_opts.append(key) if val in ['True', 'False']: opts[key] = eval(val) @@ -3681,11 +3734,22 @@ def write_autodef(self, output_dir, output_file=None): out = ["%s\n" %l for l in out] fsock.writelines(out) - @staticmethod - def get_idbmup(lpp): + def get_idbmup(self, lpp, beam=1): """return the particle colliding pdg code""" if lpp in (1,2, -1,-2): - return math.copysign(2212, lpp) + target = 2212 + if 'nb_proton1' in self: + nbp = self['nb_proton%s' % beam] + nbn = self['nb_neutron%s' % beam] + if nbp == 1 and nbn ==0: + target = 2212 + elif nbp==0 and nbn ==1: + target = 2112 + else: + target = 1000000000 + target += 10 * (nbp+nbn) + target += 10000 * nbp + return math.copysign(target, lpp) elif lpp in (3,-3): return math.copysign(11, lpp) elif lpp in (4,-4): @@ -3701,8 +3765,8 @@ def get_banner_init_information(self): the first line of the block of the lhe file.""" output = {} - output["idbmup1"] = self.get_idbmup(self['lpp1']) - output["idbmup2"] = self.get_idbmup(self['lpp2']) + output["idbmup1"] = self.get_idbmup(self['lpp1'], beam=1) + output["idbmup2"] = self.get_idbmup(self['lpp2'], beam=2) output["ebmup1"] = self["ebeam1"] output["ebmup2"] = self["ebeam2"] output["pdfgup1"] = 0 @@ -3959,7 +4023,8 @@ def check_validity(self, card): dict.__setitem__(card, 'pdlabel1', card['pdlabel']) dict.__setitem__(card, 'pdlabel2', card['pdlabel']) - if abs(card['lpp1']) == 1 == abs(card['lpp2']) and card['pdlabel1'] != card['pdlabel2']: + if isinstance(card['lpp1'],int) and isinstance(card['lpp2'],int) and \ + abs(card['lpp1']) == 1 == abs(card['lpp2']) and card['pdlabel1'] != card['pdlabel2']: raise InvalidRunCard("Assymetric beam pdf not supported for proton-proton collision") def status(self, card): @@ -4156,12 +4221,16 @@ def default_setup(self): self.add_param('frame_id', 6, system=True) self.add_param("event_norm", "average", allowed=['sum','average', 'unity'], include=False, sys_default='sum', hidden=True) + self.add_param("keep_log", "normal", include=False, hidden=True, + comment="none: all log send to /dev/null.\n minimal: keep only log for survey of the last run.\n normal: keep only log for survey of all run. \n debug: keep all log (survey and refine)", + allowed=['none', 'minimal', 'normal', 'debug']) #cut self.add_param("auto_ptj_mjj", True, hidden=True) self.add_param("bwcutoff", 15.0) self.add_param("cut_decays", False, cut='d') self.add_param('dsqrt_shat',0., cut=True) self.add_param("nhel", 0, include=False) + self.add_param("limhel", 1e-8, hidden=True, comment="threshold to determine if an helicity contributes when not MC over helicity.") #pt cut self.add_param("ptj", 20.0, cut='j') self.add_param("ptb", 0.0, cut='b') @@ -4842,7 +4911,7 @@ def create_default_for_process(self, proc_characteristic, history, proc_def): # here pick strategy 2 if only one QCD color flow # and for pure multi-jet case jet_id = [21] + list(range(1, self['maxjetflavor']+1)) - if proc_characteristic['single_color']: + if proc_characteristic['gauge'] != 'FD' and proc_characteristic['single_color']: self['sde_strategy'] = 2 #for pure lepton final state go back to sde_strategy=1 pure_lepton=True @@ -5741,9 +5810,10 @@ def check_validity(self): # check that ebeam is bigger than the proton mass. for i in [1,2]: - if self['lpp%s' % i ] not in [1,2]: + # do not for proton mass if not proton PDF (or when scan initialization) + if self['lpp%s' % i ] not in [1,2] or isinstance(self['ebeam%i' % i], str): continue - + if self['ebeam%i' % i] < 0.938: if self['ebeam%i' %i] == 0: logger.warning("At-rest proton mode set: energy beam set to 0.938 GeV") @@ -6193,3 +6263,181 @@ def log_and_update(self, banner, card, par, v): xcard = banner.charge_card(card) xcard[par[0]].param_dict[(par[1],)].value = v xcard.write(os.path.join(self.me_dir, 'Cards', '%s.dat' % card)) + + + + +class RunCardIterator(object): + """A class keeping track of the scan: flag in the param_card and + having an __iter__() function to scan over all the points of the scan. + """ + + logging = True + def __init__(self, input_path=None): + with misc.TMP_variable(RunCard, 'allow_scan', True): + self.run_card = RunCard(input_path, consistency=False) + self.run_card.allow_scan = True + + self.itertag = [] #all the current value use + self.cross = [] # keep track of all the cross-section computed + self.param_order = [] + + def __iter__(self): + """generate the next param_card (in a abstract way) related to the scan. + Technically this generates only the generator.""" + + if hasattr(self, 'iterator'): + return self.iterator + self.iterator = self.iterate() + return self.iterator + + def write(self, path): + self.__iter__.write(path) + + def next(self, autostart=False): + """call the next iteration value""" + try: + iterator = self.iterator + except: + if autostart: + iterator = self.__iter__() + else: + raise + try: + out = next(iterator) + except StopIteration: + del self.iterator + raise + return out + + def iterate(self): + """create the actual generator""" + all_iterators = {} # dictionary of key -> block of object to scan [([param, [values]), ...] + pattern = re.compile(r'''scan\s*(?P\d*)\s*:\s*(?P[^#]*)''', re.I) + + # fill all_iterators with the run_card information + for name in self.run_card.scan_set: + value = self.run_card[name] + try: + key, def_list = pattern.findall(value)[0] + except Exception as error: + misc.sprint(error) + raise Exception("Fail to handle scanning tag in run_card: Please check that the syntax is valid") + if key == '': + key = -1 * len(all_iterators) + if key not in all_iterators: + all_iterators[key] = [] + try: + all_iterators[key].append( (name, eval(def_list))) + except SyntaxError as error: + raise Exception("Fail to handle your scan definition. Please check your syntax:\n entry: %s \n Error reported: %s" %(def_list, error)) + + #prepare to keep track of parameter changing for the report + keys = list(all_iterators.keys()) # need to fix an order for the scan + #store the type of parameter + for key in keys: + for param, values in all_iterators[key]: + self.param_order.append("run_card#%s" % (param)) + + # do the loop + lengths = [list(range(len(all_iterators[key][0][1]))) for key in keys] + from functools import reduce + total = reduce((lambda x, y: x * y),[len(x) for x in lengths]) + for i,positions in enumerate(itertools.product(*lengths)): + self.itertag = [] + if self.logging: + logger.info("Create the next run_card in the scan definition (%s/%s) " %( i+1, total), '$MG:BOLD') + for i, pos in enumerate(positions): + key = keys[i] + for param, values in all_iterators[key]: + # assign the value in the card. + self.run_card[param] = values[pos] + self.itertag.append(values[pos]) + if self.logging: + logger.info("change parameter %s to %s", \ + param, values[pos]) + + + # retrun the current param_card up to next iteration + yield self.run_card + + + def store_entry(self, run_name, cross, error=None, run_card_path=None): + """store the value of the cross-section""" + + if isinstance(cross, dict): + info = dict(cross) + info.update({'bench' : self.itertag, 'run_name': run_name}) + self.cross.append(info) + else: + if error is None: + self.cross.append({'bench' : self.itertag, 'run_name': run_name, 'cross(pb)':cross}) + else: + self.cross.append({'bench' : self.itertag, 'run_name': run_name, 'cross(pb)':cross, 'error(pb)':error}) + + + def write_summary(self, path, order=None, lastline=False, nbcol=20): + """ """ + + if path: + ff = open(path, 'w') + path_events = path.rsplit("/", 1)[0] + #identCard = open(pjoin(path.rsplit("/", 2)[0], "Cards", "ident_card.dat")) + #identLines = identCard.readlines() + #identCard.close() + else: + ff = StringIO.StringIO() + if order: + keys = order + else: + keys = list(self.cross[0].keys()) + if 'bench' in keys: keys.remove('bench') + if 'run_name' in keys: keys.remove('run_name') + keys.sort() + if 'cross(pb)' in keys: + keys.remove('cross(pb)') + keys.append('cross(pb)') + if 'error(pb)' in keys: + keys.remove('error(pb)') + keys.append('error(pb)') + + formatting = "#%s%s%s\n" %('%%-%is ' % (nbcol-1), ('%%-%is ' % (nbcol))* len(self.param_order), + ('%%-%is ' % (nbcol))* len(keys)) + # header + if not lastline: + ff.write(formatting % tuple(['run_name'] + self.param_order + keys)) + formatting = "%s%s%s\n" %('%%-%is ' % (nbcol), ('%%-%ie ' % (nbcol))* len(self.param_order), + ('%%-%ie ' % (nbcol))* len(keys)) + + if not lastline: + to_print = self.cross + else: + to_print = self.cross[-1:] + for info in to_print: + name = info['run_name'] + bench = info['bench'] + data = [] + for k in keys: + if k in info: + data.append(info[k]) + else: + data.append(0.) + ff.write(formatting % tuple([name] + bench + data)) + ff_single = open(pjoin(path_events, name, "params.dat"), "w") + for i_bench in range(0, len(bench)): + ff_single.write(self.param_order[i_bench] + " = " + str(bench[i_bench]) +"\n") + ff_single.close() + + if not path: + return ff.getvalue() + + + def get_next_name(self, run_name): + """returns a smart name for the next run""" + + if '_' in run_name: + name, value = run_name.rsplit('_',1) + if value.isdigit(): + return '%s_%02i' % (name, float(value)+1) + # no valid '_' in the name + return '%s_scan_02' % run_name diff --git a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/check_param_card.py b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/check_param_card.py index 71089d7480..bc785b5de6 100755 --- a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/check_param_card.py +++ b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/check_param_card.py @@ -649,7 +649,7 @@ def write_inc_file(self, outpath, identpath, default, need_mp=False): #check if we need to write the value of scale for some block if os.path.exists(input_inc): text = open(input_inc).read() - scales = list(set(re.findall('mdl__(\w*)__scale', text, re.I))) + scales = list(set(re.findall(r'mdl__(\w*)__scale', text, re.I))) else: scales = [] @@ -1000,10 +1000,12 @@ def iterate(self): self.param_order.append("%s#%s" % (param.lhablock, '_'.join(repr(i) for i in param.lhacode))) # do the loop lengths = [list(range(len(all_iterators[key][0][1]))) for key in keys] - for positions in itertools.product(*lengths): + from functools import reduce + total = reduce((lambda x, y: x * y),[len(x) for x in lengths]) + for i,positions in enumerate(itertools.product(*lengths)): self.itertag = [] if self.logging: - logger.info("Create the next param_card in the scan definition", '$MG:BOLD') + logger.info("Create the next param_card in the scan definition (%s/%s)" % (i+1,total), '$MG:BOLD') for i, pos in enumerate(positions): key = keys[i] for param, values in all_iterators[key]: diff --git a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/cluster.py b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/cluster.py index 9a893f630d..1ad860e04f 100755 --- a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/cluster.py +++ b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/cluster.py @@ -646,7 +646,10 @@ def worker(self): if os.path.exists(exe) and not exe.startswith('/'): exe = './' + exe if isinstance(opt['stdout'],str): - opt['stdout'] = open(opt['stdout'],'w') + if opt['stdout'] == '/dev/null': + opt['stdout'] = os.open(os.devnull, os.O_RDWR) + else: + opt['stdout'] = open(opt['stdout'],'w') if opt['stderr'] == None: opt['stderr'] = subprocess.STDOUT if arg: @@ -671,11 +674,12 @@ def worker(self): self.pids.put(pid) # the function should return 0 if everything is fine # the error message otherwise - returncode = exe(*arg, **opt) - if returncode != 0: - logger.warning("fct %s does not return 0. Stopping the code in a clean way. The error was:\n%s", exe, returncode) + try: + returncode = exe(*arg, **opt) + except Exception as error: + #logger.warning("fct %s does not return 0. Stopping the code in a clean way. The error was:\n%s", exe, returncode) self.stoprequest.set() - self.remove("fct %s does not return 0:\n %s" % (exe, returncode)) + self.remove("fct %s does raise %s\n %s" % (exe, error)) except Exception as error: self.fail_msg = sys.exc_info() logger.warning(str(error)) @@ -700,7 +704,7 @@ def worker(self): def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, - log=None, required_output=[], nb_submit=0): + log=None, required_output=[], nb_submit=0, python_opts={}): """submit a job on multicore machine""" # open threads if needed @@ -720,7 +724,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, return tag else: # python function - self.queue.put((tag, prog, argument, {})) + self.queue.put((tag, prog, argument, python_opts)) self.submitted.put(1) return tag @@ -908,6 +912,10 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None else: requirement = '' + if 'cluster_walltime' in self.options and self.options['cluster_walltime']\ + and self.options['cluster_walltime'] != 'None': + requirement+='\n MaxRuntime = %s' % self.options['cluster_walltime'] + if cwd is None: cwd = os.getcwd() if stdout is None: @@ -936,7 +944,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None #Submitting job(s). #Logging submit event(s). #1 job(s) submitted to cluster 2253622. - pat = re.compile("submitted to cluster (\d*)",re.MULTILINE) + pat = re.compile(r"submitted to cluster (\d*)",re.MULTILINE) output = output.decode(errors='ignore') try: id = pat.search(output).groups()[0] @@ -1025,7 +1033,7 @@ def submit2(self, prog, argument=[], cwd=None, stdout=None, stderr=None, #Logging submit event(s). #1 job(s) submitted to cluster 2253622. output = output.decode(errors='ignore') - pat = re.compile("submitted to cluster (\d*)",re.MULTILINE) + pat = re.compile(r"submitted to cluster (\d*)",re.MULTILINE) try: id = pat.search(output).groups()[0] except: @@ -1588,7 +1596,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None output = a.communicate()[0].decode(errors='ignore') #Your job 874511 ("test.sh") has been submitted - pat = re.compile("Your job (\d*) \(",re.MULTILINE) + pat = re.compile(r"Your job (\d*) \(",re.MULTILINE) try: id = pat.search(output).groups()[0] except: @@ -1606,7 +1614,7 @@ def control_one_job(self, id): if not status: return 'F' #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 - pat = re.compile("^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") + pat = re.compile(r"^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") stat = '' for line in status.stdout.read().decode(errors='ignore').split('\n'): if not line: @@ -1636,7 +1644,7 @@ def control(self, me_dir=None): cmd = 'qstat -s %s' % statusflag status = misc.Popen([cmd], shell=True, stdout=subprocess.PIPE) #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 - pat = re.compile("^(\d+)") + pat = re.compile(r"^(\d+)") for line in status.stdout.read().decode(errors='ignore').split('\n'): line = line.strip() try: @@ -1715,6 +1723,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None stderr = stdout if log is None: log = '/dev/null' + command = ['sbatch', '-o', stdout, '-J', me_dir, @@ -1726,6 +1735,12 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None command.insert(1, '-p') command.insert(2, self.cluster_queue) + if 'cluster_walltime' in self.options and self.options['cluster_walltime']\ + and self.options['cluster_walltime'] != 'None': + command.insert(1, '-t') + command.insert(2, self.options['cluster_walltime']) + + a = misc.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -1736,7 +1751,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None id = output_arr[3].rstrip() if not id.isdigit(): - id = re.findall('Submitted batch job ([\d\.]+)', ' '.join(output_arr)) + id = re.findall(r'Submitted batch job ([\d\.]+)', ' '.join(output_arr)) if not id or len(id)>1: raise ClusterManagmentError( 'fail to submit to the cluster: \n%s' \ diff --git a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/combine_runs.py b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/combine_runs.py index 4de6b84ec0..b1e8c88eac 100755 --- a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/combine_runs.py +++ b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/combine_runs.py @@ -20,6 +20,7 @@ from __future__ import absolute_import import math import os +import shutil import re import logging from six.moves import range @@ -117,6 +118,7 @@ def sum_multichannel(self, channel): #Now read in all of the events and write them #back out with the appropriate scaled weight + to_clean = [] fsock = open(pjoin(channel, 'events.lhe'), 'w') wgt = results.axsec / results.nunwgt tot_nevents, nb_file = 0, 0 @@ -129,8 +131,14 @@ def sum_multichannel(self, channel): nw = self.copy_events(fsock, pjoin(path,'events.lhe'), wgt) tot_nevents += nw nb_file += 1 + to_clean.append(path) logger.debug("Combined %s file generating %s events for %s " , nb_file, tot_nevents, channel) - + for path in to_clean: + try: + shutil.rmtree(path) + except Exception as error: + pass + @staticmethod def get_fortran_str(nb): data = '%E' % nb @@ -162,6 +170,7 @@ def copy_events(self, fsock, input, new_wgt): fsock.write(line) old_line = line return nb_evt + def get_channels(self, proc_path): """Opens file symfact.dat to determine all channels""" sympath = os.path.join(proc_path, 'symfact.dat') diff --git a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/common_run_interface.py b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/common_run_interface.py index 9bd9d9cb50..194f0cdfbd 100755 --- a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/common_run_interface.py +++ b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/common_run_interface.py @@ -23,6 +23,7 @@ import ast import logging import math +import copy import os import re import shutil @@ -181,6 +182,23 @@ def help_add_time_of_flight(self): logger.info(' threshold option allows to change the minimal value required to') logger.info(' a non zero value for the particle (default:1e-12s)') + def help_print_results(self): + logger.info("syntax: print_results [RUN_NAME] [OPTIONS]") + logger.info("-- print the results of the previous run on the screen") + logger.info(" If not RUN_NAME is provided, the information of all run") + logger.info(" are printed one after another.") + logger.info("") + logger.info(" supported options:") + logger.info(" ------------------") + logger.info(" --format=full|short # default is full") + logger.info(" full format contains banner/... ") + logger.info(" while short is a simple multi-column format (nice for plotting)") + logger.info(" --path=") + logger.info(" allow to write the information to a file.") + logger.info(" --mode=w|a #default is w ") + logger.info(" when the information is printed to a file, you can choose ") + logger.info(" to either overwrite the file if already exists (w mode)") + logger.info(" to append the information at the end of the file (a mode)") class CheckValidForCmd(object): @@ -727,7 +745,7 @@ def __init__(self, me_dir, options, *args, **opts): if not self.proc_characteristics['ninitial']: # Get number of initial states nexternal = open(pjoin(self.me_dir,'Source','nexternal.inc')).read() - found = re.search("PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) + found = re.search(r"PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) self.ninitial = int(found.group(1)) else: self.ninitial = self.proc_characteristics['ninitial'] @@ -989,7 +1007,22 @@ def do_treatcards(self, line, amcatnlo=False): #raise Exception, "%s %s %s" % (sys.path, os.path.exists(pjoin(self.me_dir,'bin','internal', 'ufomodel')), os.listdir(pjoin(self.me_dir,'bin','internal', 'ufomodel'))) import ufomodel as ufomodel zero = ufomodel.parameters.ZERO - if self.proc_characteristics['nlo_mixed_expansion']: + no_width = [] + + if self.proc_characteristics['ew_sudakov']: + # if the sudakov approximation is used, force all particle widths to zero + # unless the complex mass scheme is used + if not self.proc_characteristics['complex_mass_scheme']: + no_width = [p for p in ufomodel.all_particles if p.width != zero] + logger.info('''Setting all particle widths to zero (needed for EW Sudakov approximation).''','$MG:BOLD') + # also, check that the model features the 'ntadpole' parameter, and set it to 1 + try: + param_card['tadpole'].get(1).value = 1. + logger.info('''Setting the value of ntadpole to 1 (needed for EW Sudakov approximation).''','$MG:BOLD') + except KeyError: + logger.warning('''The model has no 'ntadpole' parameter. The Sudakov approximation for EW corrections may give wrong results.''') + + elif self.proc_characteristics['nlo_mixed_expansion']: no_width = [p for p in ufomodel.all_particles if (str(p.pdg_code) in pids or str(-p.pdg_code) in pids) and p.width != zero] @@ -1168,17 +1201,17 @@ def detect_card_type(path): 'Begin Minpts', 'gridpack', 'ebeam1', - 'block\s+mw_run', + r'block\s+mw_run', 'BLOCK', 'DECAY', 'launch', 'madspin', - 'transfer_card\.dat', + r'transfer_card\.dat', 'set', 'main:numberofevents', # pythia8, '@MG5aMC skip_analysis', #MA5 --both-- - '@MG5aMC\s*inputs\s*=\s*\*\.(?:hepmc|lhe)', #MA5 --both-- - '@MG5aMC\s*reconstruction_name', # MA5 hadronique + r'@MG5aMC\s*inputs\s*=\s*\*\.(?:hepmc|lhe)', #MA5 --both-- + r'@MG5aMC\s*reconstruction_name', # MA5 hadronique '@MG5aMC', # MA5 hadronique 'run_rivet_later', # Rivet ] @@ -1237,7 +1270,7 @@ def detect_card_type(path): return 'madspin_card.dat' if 'decay' in text: # need to check if this a line like "decay w+" or "set decay" - if re.search("(^|;)\s*decay", fulltext, re.M): + if re.search(r"(^|;)\s*decay", fulltext, re.M): return 'madspin_card.dat' else: return 'reweight_card.dat' @@ -2074,6 +2107,12 @@ def check_multicore(self): # ensure that the run_card is present if not hasattr(self, 'run_card'): self.run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat')) + # Below reads the run_card in the LHE file rather than the Cards/run_card + import madgraph.various.lhe_parser as lhe_parser + args_path = list(args) + self.check_decay_events(args_path) + self.run_card = banner_mod.RunCard(lhe_parser.EventFile(args_path[0]).get_banner()['mgruncard']) + # we want to run this in a separate shell to avoid hard f2py crash command = [sys.executable] @@ -2085,6 +2124,12 @@ def check_multicore(self): command.append('--web') command.append('reweight') + ## TV: copy the event file as backup before starting reweighting + event_path = pjoin(self.me_dir, 'Events', self.run_name, 'events.lhe.gz') + event_path_backup = pjoin(self.me_dir, 'Events', self.run_name, 'events_orig.lhe.gz') + if os.path.exists(event_path) and not os.path.exists(event_path_backup): + shutil.copyfile(event_path, event_path_backup) + ######### START SINGLE CORE MODE ############ if self.options['nb_core']==1 or self.run_card['nevents'] < 101 or not check_multicore(self): if self.run_name: @@ -2200,7 +2245,7 @@ def check_multicore(self): cross_sections[key] = value / (nb_event+1) lhe.remove() for key in cross_sections: - if key == 'orig' or key.isdigit(): + if key == 'orig' or (key.isdigit() and not (key[0] == '2')): continue logger.info('%s : %s pb' % (key, cross_sections[key])) return @@ -2461,7 +2506,7 @@ def do_add_time_of_flight(self, line): ############################################################################ def do_print_results(self, line): - """Not in help:Print the cross-section/ number of events for a given run""" + """Print the cross-section/ number of events for a given run""" args = self.split_arg(line) options={'path':None, 'mode':'w', 'format':'full'} @@ -2942,10 +2987,15 @@ def do_rivet(self, line, postprocess=False): #2 Prepare Rivet setup environments rivet_path = self.options['rivet_path'] yoda_path = self.options['yoda_path'] + fastjet_path = subprocess.Popen([self.options['fastjet'], '--prefix'], + stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip() + set_env = set_env + "export PATH={0}:$PATH\n".format(pjoin(rivet_path, 'bin')) set_env = set_env + "export PATH={0}:$PATH\n".format(pjoin(yoda_path, 'bin')) set_env = set_env + "export LD_LIBRARY_PATH={0}:{1}:$LD_LIBRARY_PATH\n".format(pjoin(rivet_path, 'lib'), pjoin(rivet_path, 'lib64')) set_env = set_env + "export LD_LIBRARY_PATH={0}:{1}:$LD_LIBRARY_PATH\n".format(pjoin(yoda_path, 'lib'), pjoin(yoda_path, 'lib64')) + set_env = set_env + "export LD_LIBRARY_PATH={0}:$LD_LIBRARY_PATH\n".format(pjoin(self.options['hepmc_path'], 'lib')) + set_env = set_env + "export LD_LIBRARY_PATH={0}:$LD_LIBRARY_PATH\n".format(pjoin(fastjet_path, 'lib')) major, minor = sys.version_info[0:2] set_env = set_env + "export PYTHONPATH={0}:{1}:$PYTHONPATH\n".format(pjoin(rivet_path, 'lib', 'python%s.%s' %(major,minor), 'site-packages'),\ pjoin(rivet_path, 'lib64', 'python%s.%s' %(major,minor), 'site-packages')) @@ -4311,8 +4361,8 @@ def complete_compute_widths(self, text, line, begidx, endidx, formatting=True): else: completion = {} completion['options'] = self.list_completion(text, - ['--path=', '--output=', '--min_br=0.\$', '--nlo', - '--precision_channel=0.\$', '--body_decay=']) + ['--path=', '--output=', r'--min_br=0.\$', '--nlo', + r'--precision_channel=0.\$', '--body_decay=']) return self.deal_multiple_categories(completion, formatting) @@ -4821,9 +4871,9 @@ class AskforEditCard(cmd.OneLinePathCompletion): (return False to repeat the question) """ - all_card_name = ['param_card', 'run_card', 'pythia_card', 'pythia8_card', + all_card_name = ['param_card', 'run_card', 'pythia_card', 'pythia8_card', 'fo_analysis_card' 'madweight_card', 'MadLoopParams', 'shower_card', 'rivet_card'] - to_init_card = ['param', 'run', 'madweight', 'madloop', + to_init_card = ['param', 'run', 'madweight', 'madloop', 'fo_analysis', 'shower', 'pythia8','delphes','madspin', 'rivet'] special_shortcut = {} special_shortcut_help = {} @@ -4853,6 +4903,7 @@ def load_default(self): self.has_PY8 = False self.has_delphes = False self.has_rivet = False + self.has_fo_card = False self.paths = {} self.update_block = [] @@ -5058,7 +5109,8 @@ def init_run(self, cards): try: - self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning') + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning') except IOError: self.run_card = {} try: @@ -5248,6 +5300,15 @@ def init_delphes(self, cards): self.has_delphes = True return [] + def init_fo_analysis(self, cards): + self.has_fo_card = False + if not self.get_path('FO_analyse', cards): + return [] + self.has_fo_card = True + self.fo_card = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse']) + self.fo_card_def = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse_default']) + return list(self.fo_card.string_vars) + def set_CM_velocity(self, line): """compute sqrts from the velocity in the center of mass frame""" @@ -5508,6 +5569,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): allowed['delphes_card'] = '' if self.has_rivet: allowed['rivet_card'] = '' + if self.has_fo_card: + allowed['fo_card'] = '' elif len(args) == 2: if args[1] == 'run_card': @@ -5532,6 +5595,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): allowed = {'delphes_card':'default'} elif args[1] == 'rivet_card': allowed = {'rivet_card':'default'} + elif args[1] == 'fo_card': + allowed = {'fo_card':'default'} else: allowed = {'value':''} @@ -5539,6 +5604,7 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): start = 1 if args[1] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', 'MadLoop_card','pythia8_card','delphes_card','plot_card', + 'fo_card', 'madanalysis5_parton_card','madanalysis5_hadron_card', 'rivet_card']: start = 2 @@ -5576,6 +5642,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): categories.append('delphes_card') if self.has_rivet: categories.append('rivet_card') + if self.has_fo_card: + categories.append('fo_card') possibilities['category of parameter (optional)'] = \ self.list_completion(text, categories) @@ -5630,7 +5698,13 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): if 'delphes_card' in allowed: if allowed['delphes_card'] == 'default': opts = ['default', 'atlas', 'cms'] - possibilities['Delphes Card'] = self.list_completion(text, opts) + possibilities['Delphes Card'] = self.list_completion(text, opts) + + if 'fo_card' in allowed: + opts = self.fo_card.string_vars + if allowed['fo_card'] == 'default': + opts.append('default') + possibilities['FO Card'] = self.list_completion(text, opts) if 'value' in list(allowed.keys()): opts = ['default', 'scale'] @@ -5733,21 +5807,28 @@ def do_set(self, line): if args[0] in self.special_shortcut: targettypes , cmd = self.special_shortcut[args[0]] if len(args) != len(targettypes) +1: - logger.warning('shortcut %s requires %s argument' % (args[0], len(targettypes))) - if len(args) < len(targettypes) +1: - return + if len(targettypes) == 1 and args[len(targettypes)].startswith('scan'): + args = args[:len(targettypes)] + [' '.join(args[len(targettypes):])] + targettypes = [str] else: - logger.warning('additional argument will be ignored') + logger.warning('shortcut %s requires %s argument' % (args[0], len(targettypes))) + if len(args) < len(targettypes) +1: + return + else: + logger.warning('additional argument will be ignored') values ={} for i, argtype in enumerate(targettypes): try: - values = {str(i): banner_mod.ConfigFile.format_variable(args[i+1], argtype, args[0])} + values[str(i)] = banner_mod.ConfigFile.format_variable(args[i+1], argtype, args[0]) except ValueError as e: logger.warning("Wrong argument: The entry #%s should be of type %s.", i+1, argtype) return except InvalidCmd as e: - logger.warning(str(e)) - return + if isinstance(args[i+1], str) and args[i+1].startswith('scan'): + values[str(i)] = args[i+1] + else: + logger.warning(str(e)) + return #else: # logger.warning("too many argument for this command") # return @@ -5787,7 +5868,7 @@ def do_set(self, line): if os.path.exists(pythia_path): logger.info('add line QCUT = %s in pythia_card.dat' % args[1]) p_card = open(pythia_path,'r').read() - p_card, n = re.subn('''^\s*QCUT\s*=\s*[\de\+\-\.]*\s*$''', + p_card, n = re.subn(r'''^\s*QCUT\s*=\s*[\de\+\-\.]*\s*$''', ''' QCUT = %s ''' % args[1], \ p_card, flags=(re.M+re.I)) if n==0: @@ -5801,7 +5882,7 @@ def do_set(self, line): if os.path.exists(pythia_path): logger.info('add line SHOWERKT = %s in pythia_card.dat' % args[1].upper()) p_card = open(pythia_path,'r').read() - p_card, n = re.subn('''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''', + p_card, n = re.subn(r'''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''', ''' SHOWERKT = %s ''' % args[1].upper(), \ p_card, flags=(re.M+re.I)) if n==0: @@ -5856,7 +5937,7 @@ def do_set(self, line): pjoin(self.me_dir,'Cards', 'delphes_card.dat')) return - if args[0] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', + if args[0] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', 'fo_card', 'delphes_card','madanalysis5_hadron_card','madanalysis5_parton_card','rivet_card']: if args[1] == 'default': @@ -6176,6 +6257,22 @@ def do_set(self, line): self.setRivet(args[start], value, default=default) self.rivet_card.write(self.paths['rivet'], self.paths['rivet_default']) + elif self.has_fo_card and (card in ['', 'fo_card'])\ + and args[start].lower() in [k.lower() for k in self.fo_card.string_vars]: + + if args[start] in self.conflict and card == '': + text = 'ambiguous name (present in more than one card). Please specify which card to edit' + logger.warning(text) + return + if args[start+1] == 'default': + value = self.fo_card_default[args[start]] + default = True + else: + value = args[start+1] + default = False + self.fo_card[args[start]] = value + self.modified_card.add('fo_card') + #INVALID -------------------------------------------------------------- else: logger.warning('invalid set command %s ' % line) @@ -6222,12 +6319,13 @@ def setM(self, block, name, value): def setR(self, name, value): - if self.mother_interface.inputfile: - self.run_card.set(name, value, user=True, raiseerror=True) - else: - self.run_card.set(name, value, user=True) - new_value = self.run_card.get(name) - logger.info('modify parameter %s of the run_card.dat to %s' % (name, new_value),'$MG:BOLD') + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + if self.mother_interface.inputfile: + self.run_card.set(name, value, user=True, raiseerror=True) + else: + self.run_card.set(name, value, user=True) + new_value = self.run_card.get(name) + logger.info('modify parameter %s of the run_card.dat to %s' % (name, new_value),'$MG:BOLD') def setML(self, name, value, default=False): @@ -6314,6 +6412,7 @@ def check_card_consistency(self): proc_charac = self.mother_interface.proc_characteristics if proc_charac['grouped_matrix'] and \ + isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int) and \ abs(self.run_card['lpp1']) == 1 == abs(self.run_card['lpp2']) and \ (self.run_card['nb_proton1'] != self.run_card['nb_proton2'] or self.run_card['nb_neutron1'] != self.run_card['nb_neutron2'] or @@ -6403,41 +6502,42 @@ def check_card_consistency(self): # check that only quark/gluon/photon are in initial beam if lpp=+-1 pdg_in_p = list(range(-6,7))+[21,22] - if (abs(self.run_card['lpp1'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial1'])) \ + if isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int): + if(abs(self.run_card['lpp1'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial1'])) \ or (abs(self.run_card['lpp2'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial2'])): - if 'pythia_card.dat' in self.cards or 'pythia8_card.dat' in self.cards: - path_to_remove = None - if 'pythia_card.dat' in self.cards: - path_to_remove = self.paths['pythia'] - card_to_remove = 'pythia_card.dat' - elif 'pythia8_card.dat' in self.cards: - path_to_remove = self.paths['pythia8'] - card_to_remove = 'pythia8_card.dat' - if path_to_remove: - if 'partonshower' in self.run_card['bypass_check']: + if 'pythia_card.dat' in self.cards or 'pythia8_card.dat' in self.cards: + path_to_remove = None + if 'pythia_card.dat' in self.cards: + path_to_remove = self.paths['pythia'] + card_to_remove = 'pythia_card.dat' + elif 'pythia8_card.dat' in self.cards: + path_to_remove = self.paths['pythia8'] + card_to_remove = 'pythia8_card.dat' + if path_to_remove: + if 'partonshower' in self.run_card['bypass_check']: + logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") + else: + logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') + os.remove(path_to_remove) + self.cards.remove(card_to_remove) + else: + logger.info('Remember that Parton-Shower are not yet ready for such proton component definition (HW implementation in progress).', '$MG:BOLD' ) + elif (abs(self.run_card['lpp1'])==3 and abs(self.run_card['lpp2'])==3): + if 'pythia8_card.dat' in self.cards: + if self.run_card['pdlabel'] == 'isronlyll': + if 'partonshower' not in self.run_card['bypass_check']: + # force that QED shower is on? + for param in ['TimeShower:QEDshowerByQ', 'TimeShower:QEDshowerByL', 'TimeShower:QEDshowerByGamma', 'SpaceShower:QEDshowerByQ', 'SpaceShower:QEDshowerByL']: + if param not in self.PY8Card or \ + (not self.PY8Card[param] and param.lower() not in self.PY8Card.user_set): + logger.warning('Activating QED shower: setting %s to True', param) + self.PY8Card[param] = True + elif 'partonshower' in self.run_card['bypass_check']: logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") - else: + else: logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') - os.remove(path_to_remove) - self.cards.remove(card_to_remove) - else: - logger.info('Remember that Parton-Shower are not yet ready for such proton component definition (HW implementation in progress).', '$MG:BOLD' ) - elif (abs(self.run_card['lpp1'])==3 and abs(self.run_card['lpp2'])==3): - if 'pythia8_card.dat' in self.cards: - if self.run_card['pdlabel'] == 'isronlyll': - if 'partonshower' not in self.run_card['bypass_check']: - # force that QED shower is on? - for param in ['TimeShower:QEDshowerByQ', 'TimeShower:QEDshowerByL', 'TimeShower:QEDshowerByGamma', 'SpaceShower:QEDshowerByQ', 'SpaceShower:QEDshowerByL']: - if param not in self.PY8Card or \ - (not self.PY8Card[param] and param.lower() not in self.PY8Card.user_set): - logger.warning('Activating QED shower: setting %s to True', param) - self.PY8Card[param] = True - elif 'partonshower' in self.run_card['bypass_check']: - logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") - else: - logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') - os.remove(self.paths['pythia8']) - self.cards.remove('pythia8_card.dat') + os.remove(self.paths['pythia8']) + self.cards.remove('pythia8_card.dat') ######################################################################## @@ -6514,7 +6614,8 @@ def check_card_consistency(self): #check relation between lepton PDF // dressed lepton collisions // ... - if abs(self.run_card['lpp1']) != 1 or abs(self.run_card['lpp2']) != 1: + if isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int) and \ + abs(self.run_card['lpp1']) != 1 or abs(self.run_card['lpp2']) != 1: if abs(self.run_card['lpp1']) == abs(self.run_card['lpp2']) == 3: # this can be dressed lepton or photon-flux if proc_charac['pdg_initial1'] in [[11],[-11]] and proc_charac['pdg_initial2'] in [[11],[-11]]: @@ -6732,7 +6833,11 @@ def write_card_param(self): """ write the param_card """ self.param_card.write(self.paths['param']) - + + def write_card_fo_card(self): + """ write the fo_card""" + self.fo_card.write_card_from_template(self.paths['FO_analyse'], self.paths['FO_analyse_default']) + @staticmethod def update_dependent(mecmd, me_dir, param_card, path ,timer=0, run_card=None, lhapdfconfig=None): @@ -7076,7 +7181,7 @@ def do_decay(self, line): #first find the particle particle = line.split('>')[0].strip() logger.info("change madspin_card to define the decay of %s: %s" %(particle, line.strip()), '$MG:BOLD') - particle = particle.replace('+','\+').replace('-','\-') + particle = particle.replace('+',r'\+').replace('-',r'\-') decay_pattern = re.compile(r"^\s*decay\s+%s\s*>[\s\w+-~]*?$" % particle, re.I+re.M) text= open(path).read() text = decay_pattern.sub('', text) @@ -7193,7 +7298,7 @@ def help_edit(self, prefix=True): logger.info( ' --clean remove all previously existing line in the file') logger.info( ' --comment_line="" comment all lines matching the regular expression') logger.info('') - logger.info(' Note: all regular-expression will be prefixed by ^\s*') + logger.info(r' Note: all regular-expression will be prefixed by ^\s*') logger.info('') logger.info( ' example: edit reweight --after_line="change mode\b" change model heft') logger.info( ' edit madspin --after_line="banner" change model XXXX') @@ -7314,7 +7419,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''replace_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[14:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[14:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7344,7 +7449,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''comment_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[14:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[14:-1] nb_mod = 0 for posline,l in enumerate(split): if re.search(pattern, l): @@ -7366,7 +7471,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''before_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[13:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[13:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7383,7 +7488,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern = r'''after_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[12:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[12:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7527,16 +7632,19 @@ def open_file(self, answer): answer = 'plot' else: answer = self.cards[int(answer)-self.integer_bias] - + path = '' if 'madweight' in answer: answer = answer.replace('madweight', 'MadWeight') elif 'MadLoopParams' in answer: answer = self.paths['ML'] elif 'pythia8_card' in answer: answer = self.paths['pythia8'] + elif 'FO_analyse' in answer: + path = self.paths['FO_analyse'] + answer = 'fo_card' if os.path.exists(answer): path = answer - else: + elif not os.path.exists(path): if not '.dat' in answer and not '.lhco' in answer: if answer != 'trigger': path = self.paths[answer] @@ -7595,7 +7703,8 @@ def reload_card(self, path): logger.error('Please re-open the file and fix the problem.') logger.warning('using the \'set\' command without opening the file will discard all your manual change') elif path == self.paths['run']: - self.run_card = banner_mod.RunCard(path) + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + self.run_card = banner_mod.RunCard(path) elif path == self.paths['shower']: self.shower_card = shower_card_mod.ShowerCard(path) elif path == self.paths['ML']: @@ -7614,6 +7723,8 @@ def reload_card(self, path): except: import internal.madweight.Cards as mwcards self.mw_card = mwcards.Card(path) + elif path == self.paths['FO_analyse']: + self.fo_card = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse']) else: logger.debug('not keep in sync: %s', path) return path @@ -7629,6 +7740,9 @@ def scanparamcardhandling(input_path=lambda obj: pjoin(obj.me_dir, 'Cards', 'par iteratorclass=param_card_mod.ParamCardIterator, summaryorder=lambda obj: lambda:None, check_card=lambda obj: CommonRunCmd.static_check_param_card, + run_card_scan=False, + run_card_input= lambda obj: pjoin(obj.me_dir, 'Cards', 'run_card.dat'), + run_card_iteratorclass=banner_mod.RunCardIterator, ): """ This is a decorator for customizing/using scan over the param_card (or technically other) This should be use like this: @@ -7678,7 +7792,60 @@ def __enter__(self): def __exit__(self, ctype, value, traceback ): self.iterator.write(self.path) - def decorator(original_fct): + def scan_over_run_card(original_fct, obj, *args, **opts): + + if isinstance(input_path, str): + card_path = run_card_input + else: + card_path = run_card_input(obj) + + run_card_iterator = run_card_iteratorclass(card_path) + orig_card = copy.deepcopy(run_card_iterator.run_card) + if not run_card_iterator.run_card.scan_set: + return original_fct(obj, *args, **opts) + + + with restore_iterator(orig_card, card_path): + # this with statement ensure that the original card is restore + # whatever happens inside those block + + if not hasattr(obj, 'allow_notification_center'): + obj.allow_notification_center = False + with misc.TMP_variable(obj, 'allow_notification_center', False): + orig_name = get_run_name(obj) + if not orig_name and args[1]: + orig_name = args[1][0] + args = (args[0], args[1][1:]) + #orig_name = "scan_%s" % len(obj.results) + + try: + os.mkdir(pjoin(obj.me_dir, 'Events', orig_name)) + except Exception: + pass + next_name = orig_name + "_00" + + for i,card in enumerate(run_card_iterator): + card.write(card_path) + # still have to check for the auto-wdith + #if i !=0: + next_name = run_card_iterator.get_next_name(next_name) + set_run_name(obj)(next_name) + try: + original_fct(obj, *args, **opts) + except ignoreerror as error: + run_card_iterator.store_entry(next_name, {'exception': error}) + else: + run_card_iterator.store_entry(next_name, store_for_scan(obj)(), run_card_path=card_path) + + #param_card_iterator.write(card_path) #-> this is done by the with statement + name = misc.get_scan_name(orig_name, next_name) + path = result_path(obj) % name + logger.info("write scan results in %s" % path ,'$MG:BOLD') + order = summaryorder(obj)() + run_card_iterator.write_summary(path, order=order) + + + def decorator(original_fct): def new_fct(obj, *args, **opts): if isinstance(input_path, str): @@ -7702,8 +7869,13 @@ def new_fct(obj, *args, **opts): if not param_card_iterator: #first run of the function - original_fct(obj, *args, **opts) - return + if run_card_scan: + scan_over_run_card(original_fct, obj, *args, **opts) + return + else: + #first run of the function + original_fct(obj, *args, **opts) + return with restore_iterator(param_card_iterator, card_path): # this with statement ensure that the original card is restore diff --git a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/extended_cmd.py b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/extended_cmd.py index 2f37070580..789976beee 100755 --- a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/extended_cmd.py +++ b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/extended_cmd.py @@ -624,12 +624,12 @@ def complete(self, text, state): compfunc = self.completenames # correct wrong splittion with '\ ' - if line and begidx > 2 and line[begidx-2:begidx] == '\ ': + if line and begidx > 2 and line[begidx-2:begidx] == r'\ ': Ntext = line.split(os.path.sep)[-1] - self.completion_prefix = Ntext.rsplit('\ ', 1)[0] + '\ ' + self.completion_prefix = Ntext.rsplit(r'\ ', 1)[0] + r'\ ' to_rm = len(self.completion_prefix) - 1 Nbegidx = len(line.rsplit(os.path.sep, 1)[0]) + 1 - data = compfunc(Ntext.replace('\ ', ' '), line, Nbegidx, endidx) + data = compfunc(Ntext.replace(r'\ ', ' '), line, Nbegidx, endidx) self.completion_matches = [p[to_rm:] for p in data if len(p)>to_rm] # correct wrong splitting with '-'/"=" @@ -742,7 +742,7 @@ def path_completion(text, base_dir = None, only_dirs = False, completion += [prefix + f for f in ['.'+os.path.sep, '..'+os.path.sep] if \ f.startswith(text) and not prefix.startswith('.')] - completion = [a.replace(' ','\ ') for a in completion] + completion = [a.replace(' ',r'\ ') for a in completion] return completion @@ -1253,7 +1253,7 @@ def check_answer_in_input_file(self, question_instance, default, path=False, lin return possibility[0] if '=' in line and ' ' in line.strip(): leninit = len(line) - line,n = re.subn('\s*=\s*','=', line) + line,n = re.subn(r'\s*=\s*','=', line) if n and len(line) != leninit: return self.check_answer_in_input_file(question_instance, default, path=path, line=line) @@ -1311,7 +1311,7 @@ def nice_error_handling(self, error, line): if os.path.exists(self.debug_output): os.remove(self.debug_output) try: - super(Cmd,self).onecmd('history %s' % self.debug_output.replace(' ', '\ ')) + super(Cmd,self).onecmd('history %s' % self.debug_output.replace(' ', r'\ ')) except Exception as error: logger.error(error) @@ -2001,6 +2001,7 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): text = "" has_mg5_path = False # Use local configuration => Need to update the path + already_written = set() for line in open(basefile): if '=' in line: data, value = line.split('=',1) @@ -2018,9 +2019,12 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): comment = '' if key in to_keep: value = str(to_keep[key]) - else: + elif line not in already_written: + already_written.add(line) text += line continue + else: + continue if key == 'mg5_path': has_mg5_path = True try: @@ -2032,14 +2036,20 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): # check if absolute path if not os.path.isabs(value): value = os.path.realpath(os.path.join(basedir, value)) - text += '%s = %s # %s \n' % (key, value, comment) + new_line = '%s = %s # %s \n' % (key, value, comment) + if new_line not in already_written: + text += new_line + already_written.add(new_line) for key in to_write: if key in to_keep: - text += '%s = %s \n' % (key, to_keep[key]) + new_line = '%s = %s \n' % (key, to_keep[key]) + if new_line not in already_written: + text += new_line if not MADEVENT and not has_mg5_path: - text += """\n# MG5 MAIN DIRECTORY\n""" - text += "mg5_path = %s\n" % MG5DIR + if "mg5_path = %s\n" % MG5DIR not in already_written: + text += """\n# MG5 MAIN DIRECTORY\n""" + text += "mg5_path = %s\n" % MG5DIR writer = open(filepath,'w') writer.write(text) @@ -2190,7 +2200,7 @@ def onecmd(self, line, **opt): raise def reask(self, reprint_opt=True): - pat = re.compile('\[(\d*)s to answer\]') + pat = re.compile(r'\[(\d*)s to answer\]') prev_timer = signal.alarm(0) # avoid timer if any if prev_timer: @@ -2991,7 +3001,7 @@ def question_formatting(self, nb_col = 80, lpotential_switch=0, lnb_key=0, key=None): - """should return four lines: + r"""should return four lines: 1. The upper band (typically /========\ 2. The lower band (typically \========/ 3. The line without conflict | %(nb)2d. %(descrip)-20s %(name)5s = %(switch)-10s | @@ -3239,13 +3249,13 @@ def create_question(self, help_text=True): data_to_format['conflict_switch'] = self.color_for_value(key,self.inconsistent_keys[key], consistency=False) if hidden_line: - f2 = re.sub('%(\((?:name|descrip|add_info)\)-?)(\d+)s', + f2 = re.sub(r'%(\((?:name|descrip|add_info)\)-?)(\d+)s', lambda x: '%%%s%ds' % (x.group(1),int(x.group(2))+9), f2) text.append(f2 % data_to_format) elif hidden_line: if not f3: - f3 = re.sub('%(\((?:name|descrip|add_info)\)-?)(\d+)s', + f3 = re.sub(r'%(\((?:name|descrip|add_info)\)-?)(\d+)s', lambda x: '%%%s%ds' % (x.group(1),int(x.group(2))+9), f1) text.append(f3 % data_to_format) diff --git a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/file_writers.py b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/file_writers.py index 41bff05276..526756129f 100755 --- a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/file_writers.py +++ b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/file_writers.py @@ -36,10 +36,10 @@ class FileWriter(io.FileIO): supported_preprocessor_commands = ['if'] preprocessor_command_re=re.compile( - "\s*(?P%s)\s*\(\s*(?P.*)\s*\)\s*{\s*"\ + r"\s*(?P%s)\s*\(\s*(?P.*)\s*\)\s*{\s*"\ %('|'.join(supported_preprocessor_commands))) preprocessor_endif_re=re.compile(\ - "\s*}\s*(?Pelse)?\s*(\((?P.*)\))?\s*(?P{)?\s*") + r"\s*}\s*(?Pelse)?\s*(\((?P.*)\))?\s*(?P{)?\s*") class FileWriterError(IOError): """Exception raised if an error occurs in the definition @@ -191,15 +191,15 @@ class FortranWriterError(FileWriter.FileWriterError): pass # Parameters defining the output of the Fortran writer - keyword_pairs = {'^if.+then\s*$': ('^endif', 2), - '^type(?!\s*\()\s*.+\s*$': ('^endtype', 2), - '^do(?!\s+\d+)\s+': ('^enddo\s*$', 2), - '^subroutine': ('^end\s*$', 0), - '^module': ('^end\s*$', 0), - 'function': ('^end\s*$', 0)} - single_indents = {'^else\s*$':-2, - '^else\s*if.+then\s*$':-2} - number_re = re.compile('^(?P\d+)\s+(?P.*)') + keyword_pairs = {r'^if.+then\s*$': ('^endif', 2), + r'^type(?!\s*\()\s*.+\s*$': ('^endtype', 2), + r'^do(?!\s+\d+)\s+': (r'^enddo\s*$', 2), + '^subroutine': (r'^end\s*$', 0), + '^module': (r'^end\s*$', 0), + 'function': (r'^end\s*$', 0)} + single_indents = {r'^else\s*$':-2, + r'^else\s*if.+then\s*$':-2} + number_re = re.compile(r'^(?P\d+)\s+(?P.*)') line_cont_char = '$' comment_char = 'c' uniformcase = True #force everyting to be lower/upper case @@ -212,7 +212,7 @@ class FortranWriterError(FileWriter.FileWriterError): # Private variables __indent = 0 __keyword_list = [] - __comment_pattern = re.compile(r"^(\s*#|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|!)", re.IGNORECASE) + __comment_pattern = re.compile(r"^(\s*#|c\$|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|\s*!|!\$)", re.IGNORECASE) __continuation_line = re.compile(r"(?: )[$&]") def write_line(self, line): @@ -424,26 +424,20 @@ def count_number_of_quotes(self, line): i = i + 1 return len(splitline)-1 - def remove_routine(self, text, fct_names, formatting=True): - """write the incoming text but fully removing the associate routine/function - text can be a path to a file, an iterator, a string - fct_names should be a list of functions to remove + @staticmethod + def get_routine(text, fct_names, call_back=None): + """ + get the fortran function from a fortran file """ - f77_type = ['real*8', 'integer', 'double precision', 'logical'] - pattern = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I) - + + if isinstance(text, str): + text = text.split('\n') + + to_write=False removed = [] - if isinstance(text, str): - if '\n' in text: - text = text.split('\n') - else: - text = open(text) - if isinstance(fct_names, str): - fct_names = [fct_names] - - to_write=True for line in text: fct = pattern.findall(line) if fct: @@ -451,22 +445,38 @@ def remove_routine(self, text, fct_names, formatting=True): to_write = False else: to_write = True - if to_write: - if formatting: - if line.endswith('\n'): - line = line[:-1] - self.writelines(line) - else: - if not line.endswith('\n'): - line = '%s\n' % line - super(FileWriter,self).writelines(line) + if call_back: + call_back(line) else: removed.append(line) - + return removed + + def remove_routine(self, text, fct_names, formatting=True): + """write the incoming text but fully removing the associate routine/function + text can be a path to a file, an iterator, a string + fct_names should be a list of functions to remove + """ + + def call_back(line): + if formatting: + if line.endswith('\n'): + line = line[:-1] + self.writelines(line) + else: + if not line.endswith('\n'): + line = '%s\n' % line + super(FileWriter,self).writelines(line) + + return self.get_routine(text, fct_names, call_back) + +class FortranWriter90(FortranWriter): + + comment_char = ' !' + #=============================================================================== # CPPWriter #=============================================================================== @@ -497,50 +507,50 @@ class CPPWriterError(FileWriter.FileWriterError): '^private': standard_indent, '^protected': standard_indent} - spacing_patterns = [ - ('\s*\"\s*}', '\"'), - ('\s*,\s*', ', '), - ('\s*-\s*', ' - '), - ('([{(,=])\s*-\s*', '\g<1> -'), - ('(return)\s*-\s*', '\g<1> -'), - ('\s*\+\s*', ' + '), - ('([{(,=])\s*\+\s*', '\g<1> +'), - ('\(\s*', '('), - ('\s*\)', ')'), - ('\{\s*', '{'), - ('\s*\}', '}'), - ('\s*=\s*', ' = '), - ('\s*>\s*', ' > '), - ('\s*<\s*', ' < '), - ('\s*!\s*', ' !'), - ('\s*/\s*', '/'), - ('(?\s+>\s*', ' >> '), - ('<\s*double\s*>>\s*', ' > '), - ('\s*<\s+<\s*', ' << '), - ('\s*-\s+>\s*', '->'), - ('\s*=\s+=\s*', ' == '), - ('\s*!\s+=\s*', ' != '), - ('\s*>\s+=\s*', ' >= '), - ('\s*<\s+=\s*', ' <= '), - ('\s*&&\s*', ' && '), - ('\s*\|\|\s*', ' || '), - ('\s*{\s*}', ' {}'), - ('\s*;\s*', '; '), - (';\s*\}', ';}'), - (';\s*$}', ';'), - ('\s*<\s*([a-zA-Z0-9]+?)\s*>', '<\g<1>>'), - ('^#include\s*<\s*(.*?)\s*>', '#include <\g<1>>'), - ('(\d+\.{0,1}\d*|\.\d+)\s*[eE]\s*([+-]{0,1})\s*(\d+)', - '\g<1>e\g<2>\g<3>'), - ('\s+',' '), - ('^\s*#','#')] + spacing_patterns = [(r'\s*\"\s*}', '\"'), + (r'\s*,\s*', ', '), + (r'\s*-\s*', ' - '), + (r'([{(,=])\s*-\s*', r'\g<1> -'), + (r'(return)\s*-\s*', r'\g<1> -'), + (r'\s*\+\s*', ' + '), + (r'([{(,=])\s*\+\s*', r'\g<1> +'), + (r'\(\s*', '('), + (r'\s*\)', ')'), + (r'\{\s*', '{'), + (r'\s*\}', '}'), + (r'\s*=\s*', ' = '), + (r'\s*>\s*', ' > '), + (r'\s*<\s*', ' < '), + (r'\s*!\s*', ' !'), + (r'\s*/\s*', '/'), + (r'\s*\*\s*', ' * '), + (r'\s*-\s+-\s*', '-- '), + (r'\s*\+\s+\+\s*', '++ '), + (r'\s*-\s+=\s*', ' -= '), + (r'\s*\+\s+=\s*', ' += '), + (r'\s*\*\s+=\s*', ' *= '), + (r'\s*/=\s*', ' /= '), + (r'\s*>\s+>\s*', ' >> '), + (r'<\s*double\s*>>\s*', ' > '), + (r'\s*<\s+<\s*', ' << '), + (r'\s*-\s+>\s*', '->'), + (r'\s*=\s+=\s*', ' == '), + (r'\s*!\s+=\s*', ' != '), + (r'\s*>\s+=\s*', ' >= '), + (r'\s*<\s+=\s*', ' <= '), + (r'\s*&&\s*', ' && '), + (r'\s*\|\|\s*', ' || '), + (r'\s*{\s*}', ' {}'), + (r'\s*;\s*', '; '), + (r';\s*\}', ';}'), + (r';\s*$}', ';'), + (r'\s*<\s*([a-zA-Z0-9]+?)\s*>', r'<\g<1>>'), + (r'^#include\s*<\s*(.*?)\s*>', r'#include <\g<1>>'), + (r'(\d+\.{0,1}\d*|\.\d+)\s*[eE]\s*([+-]{0,1})\s*(\d+)', + r'\g<1>e\g<2>\g<3>'), + (r'\s+',' '), + (r'^\s*#','#')] + spacing_re = dict([(key[0], re.compile(key[0])) for key in \ spacing_patterns]) diff --git a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/gen_crossxhtml.py b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/gen_crossxhtml.py index d58ec573bc..681bf9d09b 100755 --- a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/gen_crossxhtml.py +++ b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/gen_crossxhtml.py @@ -648,7 +648,7 @@ def recreate(self, banner): if run_card['ickkw'] != 0: #parse the file to have back the information pythia_log = misc.BackRead(pjoin(path, '%s_pythia.log' % tag)) - pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") + pythiare = re.compile(r"\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") for line in pythia_log: info = pythiare.search(line) if not info: @@ -1623,7 +1623,7 @@ def get_html(self, runresults): elif self.debug: text = str(self.debug).replace('. ','.
') if 'http' in text: - pat = re.compile('(http[\S]*)') + pat = re.compile(r'(http[\S]*)') text = pat.sub(r' here ', text) debug = '
%s
%s
' % \ (self.debug.__class__.__name__, text) diff --git a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/gen_ximprove.py b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/gen_ximprove.py index c86da36a05..415ecc9de0 100755 --- a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/gen_ximprove.py +++ b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/gen_ximprove.py @@ -158,8 +158,11 @@ def get_helicity(self, to_submit=True, clean=True): (stdout, _) = p.communicate(''.encode()) stdout = stdout.decode('ascii',errors='ignore') if stdout: - nb_channel = max([math.floor(float(d)) for d in stdout.split()]) + lines = stdout.strip().split('\n') + nb_channel = max([math.floor(float(d)) for d in lines[-1].split()]) else: + if os.path.exists(pjoin(self.me_dir, 'error')): + os.remove(pjoin(self.me_dir, 'error')) for matrix_file in misc.glob('matrix*orig.f', Pdir): files.cp(matrix_file, matrix_file.replace('orig','optim')) P_zero_result.append(Pdir) @@ -297,12 +300,14 @@ def get_helicity(self, to_submit=True, clean=True): bad_amps_perhel = [] if __debug__: mtext = open(matrix_file).read() - nb_amp = int(re.findall('PARAMETER \(NGRAPHS=(\d+)\)', mtext)[0]) - logger.debug('nb_hel: %s zero amp: %s bad_amps_hel: %s/%s', len(good_hels),len(bad_amps),len(bad_amps_perhel), len(good_hels)*nb_amp ) + nb_amp = int(re.findall(r'PARAMETER \(NGRAPHS=(\d+)\)', mtext)[0]) + logger.debug('(%s) nb_hel: %s zero amp: %s bad_amps_hel: %s/%s', split_file[-1], len(good_hels),len(bad_amps),len(bad_amps_perhel), len(good_hels)*nb_amp ) if len(good_hels) == 1: files.cp(matrix_file, matrix_file.replace('orig','optim')) continue # avoid optimization if onlye one helicity - recycler = hel_recycle.HelicityRecycler(good_hels, bad_amps, bad_amps_perhel) + + gauge = self.cmd.proc_characteristics['gauge'] + recycler = hel_recycle.HelicityRecycler(good_hels, bad_amps, bad_amps_perhel, gauge=gauge) # In case of bugs you can play around with these: recycler.hel_filt = self.run_card['hel_filtering'] recycler.amp_splt = self.run_card['hel_splitamp'] @@ -1299,7 +1304,7 @@ def get_job_for_event(self): 'script_name': 'unknown', 'directory': C.name, # need to be change for splitted job 'P_dir': C.parent_name, - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # needed for RO gridpack 'offset': 1, # need to be change for splitted job 'nevents': nevents, 'maxiter': self.max_iter, @@ -1387,7 +1392,7 @@ def create_ajob(self, template, jobs, write_dir=None): break info = jobs[j] info['script_name'] = 'ajob%i' % script_number - info['keeplog'] = 'false' + info['keeplog'] = 'false' if self.run_card['keep_log'] != 'debug' else 'true' if "base_directory" not in info: info["base_directory"] = "./" fsock.write(template_text % info) @@ -1456,7 +1461,7 @@ def get_job_for_precision(self): 'script_name': 'unknown', 'directory': C.name, # need to be change for splitted job 'P_dir': C.parent_name, - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # used for RO gridpack 'offset': 1, # need to be change for splitted job 'nevents': nevents, 'maxiter': self.max_iter, @@ -1916,7 +1921,7 @@ def get_job_for_event(self): 'directory': C.name, # need to be change for splitted job 'P_dir': os.path.basename(C.parent_name), 'offset': 1, # need to be change for splitted job - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # use for RO gridpack 'nevents': nevents, #int(nevents*self.gen_events_security)+1, 'maxiter': self.max_iter, 'miniter': self.min_iter, diff --git a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/hel_recycle.py b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/hel_recycle.py index dfa45d5d20..6c86611f68 100755 --- a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/hel_recycle.py +++ b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/hel_recycle.py @@ -383,7 +383,7 @@ def get_number(cls, *args): class HelicityRecycler(): '''Class for recycling helicity''' - def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[]): + def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[], gauge='U'): External.good_hel = [] External.nhel_lines = '' @@ -427,6 +427,7 @@ def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[]): self.all_hel = [] self.hel_filt = True + self.gauge = gauge def set_input(self, file): if 'born_matrix' in file: @@ -612,7 +613,7 @@ def unfold_helicities(self, line, nature): def apply_amps(self, line, new_objs): if self.amp_splt: - return split_amps(line, new_objs) + return split_amps(line, new_objs, gauge=self.gauge) else: return apply_args(line, [i.args for i in new_objs]) @@ -785,7 +786,7 @@ def apply_args(old_line, all_the_args): return ''.join(new_lines) -def split_amps(line, new_amps): +def split_amps(line, new_amps, gauge): if not new_amps: return '' fct = line.split('(',1)[0].split('_0')[0] @@ -841,34 +842,31 @@ def split_amps(line, new_amps): spin = fct.split(None,1)[1][to_remove] lines.append('%sP1N_%s(%s)' % (fct, to_remove+1, ', '.join(args))) - hel, iamp = re.findall('AMP\((\d+),(\d+)\)', amp_result)[0] + hel, iamp = re.findall(r'AMP\((\d+),(\d+)\)', amp_result)[0] hel_calculated.append(hel) #lines.append(' %(result)s = TMP(3) * W(3,%(w)s) + TMP(4) * W(4,%(w)s)+' # % {'result': amp_result, 'w': windex}) #lines.append(' & TMP(5) * W(5,%(w)s)+TMP(6) * W(6,%(w)s)' # % {'result': amp_result, 'w': windex}) - if spin in "VF": - lines.append(""" call CombineAmp(%(nb)i, - & (/%(hel_list)s/), - & (/%(w_list)s/), - & TMP, W, AMP(1,%(iamp)s))""" % - {'nb': len(sub_amps), - 'hel_list': ','.join(hel_calculated), - 'w_list': ','.join(windices), - 'iamp': iamp - }) + if spin == "F" or ( spin == "V" and gauge !='FD'): + suffix = '' elif spin == "S": - lines.append(""" call CombineAmpS(%(nb)i, - &(/%(hel_list)s/), - & (/%(w_list)s/), - & TMP, W, AMP(1,%(iamp)s))""" % - {'nb': len(sub_amps), - 'hel_list': ','.join(hel_calculated), - 'w_list': ','.join(windices), - 'iamp': iamp - }) + suffix = 'S' + elif spin == "V" and gauge == "FD": + suffix = "FD" else: - raise Exception("split amp are not supported for spin2 and 3/2") + raise Exception("split amp not supported for spin2, 3/2") + + lines.append(""" call CombineAmp%(suffix)s(%(nb)i, + & (/%(hel_list)s/), + & (/%(w_list)s/), + & TMP, W, AMP(1,%(iamp)s))""" % {'suffix':suffix, + 'nb': len(sub_amps), + 'hel_list': ','.join(hel_calculated), + 'w_list': ','.join(windices), + 'iamp': iamp + }) + #lines.append('') return '\n'.join(lines) diff --git a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/histograms.py b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/histograms.py index 98f22c4c3a..9931127f66 100755 --- a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/histograms.py +++ b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/histograms.py @@ -632,34 +632,34 @@ class HwU(Histogram): # than necessary because the HwU standard allows for spaces from within # the name of a weight weight_header_re = re.compile( - '&\s*(?P(\S|(\s(?!\s*(&|$))))+)(\s(?!(&|$)))*') + r'&\s*(?P(\S|(\s(?!\s*(&|$))))+)(\s(?!(&|$)))*') # ================================ # Histo weight specification RE's # ================================ # The start of a plot - histo_start_re = re.compile('^\s*\s*(?P\d+)\s*"\s*'+ - '(?P(\S|(\s(?!\s*")))+)\s*"\s*$') + histo_start_re = re.compile(r'^\s*\s*(?P\d+)\s*"\s*'+ + r'(?P(\S|(\s(?!\s*")))+)\s*"\s*$') # A given weight specifier - a_float_re = '[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' - histo_bin_weight_re = re.compile('(?P%s|NaN)'%a_float_re,re.IGNORECASE) - a_int_re = '[\+|-]?\d+' + a_float_re = r'[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' + histo_bin_weight_re = re.compile(r'(?P%s|NaN)'%a_float_re,re.IGNORECASE) + a_int_re = r'[\+|-]?\d+' # The end of a plot histo_end_re = re.compile(r'^\s*<\\histogram>\s*$') # A scale type of weight - weight_label_scale = re.compile('^\s*mur\s*=\s*(?P%s)'%a_float_re+\ - '\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) - weight_label_PDF = re.compile('^\s*PDF\s*=\s*(?P\d+)\s*$') - weight_label_PDF_XML = re.compile('^\s*pdfset\s*=\s*(?P\d+)\s*$') - weight_label_TMS = re.compile('^\s*TMS\s*=\s*(?P%s)\s*$'%a_float_re) - weight_label_alpsfact = re.compile('^\s*alpsfact\s*=\s*(?P%s)\s*$'%a_float_re, + weight_label_scale = re.compile(r'^\s*mur\s*=\s*(?P%s)'%a_float_re+\ + r'\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) + weight_label_PDF = re.compile(r'^\s*PDF\s*=\s*(?P\d+)\s*$') + weight_label_PDF_XML = re.compile(r'^\s*pdfset\s*=\s*(?P\d+)\s*$') + weight_label_TMS = re.compile(r'^\s*TMS\s*=\s*(?P%s)\s*$'%a_float_re) + weight_label_alpsfact = re.compile(r'^\s*alpsfact\s*=\s*(?P%s)\s*$'%a_float_re, re.IGNORECASE) - weight_label_scale_adv = re.compile('^\s*dyn\s*=\s*(?P%s)'%a_int_re+\ - '\s*mur\s*=\s*(?P%s)'%a_float_re+\ - '\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) - weight_label_PDF_adv = re.compile('^\s*PDF\s*=\s*(?P\d+)\s+(?P\S+)\s*$') + weight_label_scale_adv = re.compile(r'^\s*dyn\s*=\s*(?P%s)'%a_int_re+\ + r'\s*mur\s*=\s*(?P%s)'%a_float_re+\ + r'\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) + weight_label_PDF_adv = re.compile(r'^\s*PDF\s*=\s*(?P\d+)\s+(?P\S+)\s*$') class ParseError(MadGraph5Error): @@ -926,7 +926,7 @@ def get_HwU_source(self, print_header=True): res.append(' '.join('%+16.7e'%wgt for wgt in list(bin.boundaries))) res[-1] += ' '.join('%+16.7e'%bin.wgts[key] for key in self.bins.weight_labels if key not in ['central','stat_error']) - res.append('<\histogram>') + res.append(r'<\histogram>') return res def output(self, path=None, format='HwU', print_header=True): @@ -1149,6 +1149,8 @@ def parse_one_histo_from_stream(self, stream, all_weight_header, boundaries = [0.0,0.0] for j, weight in \ enumerate(HwU.histo_bin_weight_re.finditer(line_bin)): + if (j == len(weight_header)): + continue if j == len(all_weight_header): raise HwU.ParseError("There is more bin weights"+\ " specified than expected (%i)"%len(weight_header)) @@ -1803,7 +1805,7 @@ def parse_histos_from_PY8_XML_stream(self, stream, run_id=None, # Filter empty weights coming from the split weight_label_list = [wgt.strip() for wgt in str(selected_run_node.getAttribute('header')).split(';') if - not re.match('^\s*$',wgt)] + not re.match(r'^\s*$',wgt)] ordered_weight_label_list = [w for w in weight_label_list if w not\ in ['xmin','xmax']] # Remove potential repetition of identical weight labels @@ -1827,7 +1829,7 @@ def parse_histos_from_PY8_XML_stream(self, stream, run_id=None, all_weights = [] for wgt_position, wgt_label in \ enumerate(str(selected_run_node.getAttribute('header')).split(';')): - if not re.match('^\s*$',wgt_label) is None: + if not re.match(r'^\s*$',wgt_label) is None: continue all_weights.append({'POSITION':wgt_position}) for wgt_item in wgt_label.strip().split('_'): @@ -2714,7 +2716,7 @@ def ratio_no_correlations(wgtsA, wgtsB): # First the global gnuplot header for this histogram group global_header =\ -""" +r""" ################################################################################ ### Rendering of the plot titled '%(title)s' ################################################################################ @@ -2862,9 +2864,9 @@ def ratio_no_correlations(wgtsA, wgtsB): major_title = ', '.join(major_title) if not mu[0] in ['none',None]: - major_title += ', dynamical\_scale\_choice=%s'%mu[0] + major_title += r', dynamical\_scale\_choice=%s'%mu[0] if not pdf[0] in ['none',None]: - major_title += ', PDF=%s'%pdf[0].replace('_','\_') + major_title += ', PDF=%s'%pdf[0].replace('_',r'\_') # Do not show uncertainties for individual jet samples (unless first # or specified explicitely and uniquely) @@ -2937,7 +2939,7 @@ def ratio_no_correlations(wgtsA, wgtsB): plot_lines.append( "'%s' index %d using (($1+$2)/2):%d ls %d title '%s'"\ %(HwU_name,block_position+i,mu_var+3,color_index,\ -'%s dynamical\_scale\_choice=%s' % (title,mu[j]))) +r'%s dynamical\_scale\_choice=%s' % (title,mu[j]))) # And now PDF_variation if available if not PDF_var_pos is None: for j,PDF_var in enumerate(PDF_var_pos): @@ -2947,7 +2949,7 @@ def ratio_no_correlations(wgtsA, wgtsB): plot_lines.append( "'%s' index %d using (($1+$2)/2):%d ls %d title '%s'"\ %(HwU_name,block_position+i,PDF_var+3,color_index,\ -'%s PDF=%s' % (title,pdf[j].replace('_','\_')))) +'%s PDF=%s' % (title,pdf[j].replace('_',r'\_')))) # Now add the uncertainty lines, those not using a band so that they # are not covered by those using a band after we reverse plo_lines diff --git a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/launch_plugin.py b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/launch_plugin.py index 7b10bedcef..9ec09eb71d 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/launch_plugin.py +++ b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/launch_plugin.py @@ -98,6 +98,7 @@ def default_setup(self): self['vector_size'] = 16 # already setup in default class (just change value) self['aloha_flag'] = '--fast-math' self['matrix_flag'] = '-O3' + self['limhel'] = 0 self.display_block.append('simd') self.display_block.append('psoptim') diff --git a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/lhe_parser.py b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/lhe_parser.py index eee9ba4522..f6e47956cd 100755 --- a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/lhe_parser.py +++ b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/lhe_parser.py @@ -7,6 +7,7 @@ import numbers import math import time +import copy import os import shutil import sys @@ -101,7 +102,7 @@ def __init__(self, line=None, event=None): self.rwgt = 0 return - + self.event = event if event is not None: self.event_id = len(event) #not yet in the event @@ -1066,6 +1067,8 @@ def define_init_banner(self, wgt, lha_strategy, proc_charac=None): #special case for 1>N init_information = run_card.get_banner_init_information() event = next(self) + if not len(event): #if parse-momenta was false we have to parse the first event + event = Event(str(event)) init_information["idbmup1"] = event[0].pdg init_information["ebmup1"] = event[0].mass init_information["idbmup2"] = 0 @@ -1149,6 +1152,7 @@ def initialize_unweighting(self, getwgt, trunc_error): nb_keep = max(20, int(nb_event*trunc_error*15)) new_wgt = new_wgt[-nb_keep:] if nb_event == 0: + misc.sprint(i,f) raise Exception # store the information self.initial_nb_events[i] = nb_event @@ -1203,7 +1207,6 @@ def unweight(self, outputpath, get_wgt, **opts): (stop to write event when target is reached) """ - if isinstance(get_wgt, (str,six.text_type)): unwgt_name =get_wgt def get_wgt_multi(event): @@ -1483,12 +1486,12 @@ def reorder_mother_child(self): particle.mother2 -= 1 # re-call the function for the next potential change return self.reorder_mother_child() - - - - - + + + + + def parse_reweight(self): """Parse the re-weight information in order to return a dictionary {key: value}. If no group is define group should be '' """ @@ -1522,6 +1525,37 @@ def parse_nlo_weight(self, real_type=(1,11), threshold=None): threshold=threshold) return self.nloweight + def get_fks_pair(self, real_type=(1,11), threshold=None): + """ Gives the fks pair labels""" + start, stop = self.tag.find(''), self.tag.find('') + if start != -1 != stop: + text = self.tag[start+8:stop] + all_line = text.split('\n') + text = text.lower().replace('d','e') + all_line = text.split('\n') + for line in all_line: + data = line.split() + if len(data)>16: + wgt = OneNLOWeight(line, real_type=real_type) + return wgt.to_merge_pdg,wgt.nexternal + + def get_born_momenta(self,real_type=(1,11), threshold=None): + """ Gets the underlying n+1 body kinematics""" + start, stop = self.tag.find(''), self.tag.find('') + if start != -1 != stop: + text = self.tag[start+8:stop] + text = text.lower().replace('d','e') + all_line = text.split('\n') + for line in all_line: + data = line.split() + if len(data)>16: + wgt = OneNLOWeight(line, real_type=real_type) + nexternal = wgt.nexternal + real_momenta = all_line[2:2+nexternal] + return real_momenta + + + def rewrite_nlo_weight(self, wgt=None): """get the string associate to the weight""" @@ -1558,11 +1592,11 @@ def parse_lo_weight(self): return self.loweight if not hasattr(Event, 'loweight_pattern'): - Event.loweight_pattern = re.compile('''\s*(?P\d+)\s+(?P[\d.e+-]+)\s*\s*\n\s* - \s*(?P[\s\d.+-e]+)\s*\s*\n\s* - 1|2)["']?\>\s*(?P[\s\d.e+-]*)\s*\s*\n\s* - 1|2)["']?\>\s*(?P[\s\d.e+-]*)\s*\s*\n\s* - \s*(?P[\d.e+-]*)\s* + Event.loweight_pattern = re.compile('''\\s*(?P\\d+)\\s+(?P[\\d.e+-]+)\\s*\\s*\n\\s* + \\s*(?P[\\s\\d.+-e]+)\\s*\\s*\n\\s* + 1|2)["']?\\>\\s*(?P[\\s\\d.e+-]*)\\s*\\s*\n\\s* + 1|2)["']?\\>\\s*(?P[\\s\\d.e+-]*)\\s*\\s*\n\\s* + \\s*(?P[\\d.e+-]*)\\s* ''',re.X+re.I+re.M) start, stop = self.tag.find(''), self.tag.find('') @@ -1615,7 +1649,7 @@ def parse_matching_scale(self): self.matched_scale_data = [] - pattern = re.compile("") + pattern = re.compile(r"") data = re.split(pattern,self.tag) if len(data) == 1: return [] @@ -1623,7 +1657,7 @@ def parse_matching_scale(self): tmp = {} start,content, end = data self.tag = "%s%s" % (start, end) - pattern = re.compile("pt_clust_(\d*)=\"([\de+-.]*)\"") + pattern = re.compile("pt_clust_(\\d*)=\"([\\de+-.]*)\"") for id,value in pattern.findall(content): tmp[int(id)] = float(value) for i in range(1, len(self)+1): @@ -1647,7 +1681,7 @@ def parse_syscalc_info(self): return self.syscalc_data pattern = re.compile("|") - pattern2 = re.compile("<(?P[\w]*)(?:\s*(\w*)=[\"'](.*)[\"']\s*|\s*)>(.*)") + pattern2 = re.compile("<(?P[\\w]*)(?:\\s*(\\w*)=[\"'](.*)[\"']\\s*|\\s*)>(.*)") data = re.split(pattern,self.tag) if len(data) == 1: return [] @@ -1850,6 +1884,240 @@ def get_decay(self, pdg_code=0, event_id=None): return new_event + + def set_initial_mass_to_zero(self): + """set the masses of the initial particles to zero, by reshuffling the respective momenta + Works only in the **partonic** com frame, so the event must be boosted to such frame + before calling the function + """ + + if not misc.equal(self[0].px, 0) or not misc.equal(self[1].px, 0) or \ + not misc.equal(self[0].py, 0) or not misc.equal(self[1].py, 0) or \ + not misc.equal(self[0].pz, - self[1].pz, zero_limit=False): + misc.sprint(self[0]) + misc.sprint(self[1]) + raise Exception('momenta should be in the partonic center of mass frame') + + self[0].mass = 0. + self[1].mass = 0. + tot_E=0. + for ip,part in enumerate(self): + if part.status == 1 : + tot_E += part.E + if (self[0].pz > 0. and self[1].pz < 0): + self[0].set_momentum(FourMomentum([tot_E/2., 0., 0., tot_E/2.])) + self[1].set_momentum(FourMomentum([tot_E/2., 0., 0., -tot_E/2.])) + elif (self[0].pz < 0. and self[1].pz > 0): + self[0].set_momentum(FourMomentum([tot_E/2., 0., 0., -tot_E/2.])) + self[1].set_momentum(FourMomentum([tot_E/2., 0., 0., tot_E/2.])) + else: + logger.critical('ERROR: two incoming partons not back.-to-back') + + def set_final_jet_mass_to_zero(self): + """set the final light particle masses to zero + """ + + for ip,part in enumerate(self): + if ((abs(part.pid) <= 5) or (abs(part.pid) == 11) or (abs(part.pid) == 12)) and (part.status == 1): + part.mass = 0. + E_1_new = math.sqrt(part.mass**2 + part.px**2 + part.py**2 + part.pz**2) + part.set_momentum(FourMomentum([E_1_new, part.px, part.py, part.pz])) + + + + def merge_particles_kinematics(self, i,j, moth): + """Map to an underlying n-body kinematics for two given + particles i,j to be merged and a resulting moth""" + """ note! kinematics (and id) mapping only! """ + + recoil = True + fks_type = False + + if recoil and not fks_type: + if (i == moth[0].get('number')-1): + fks_i = i + fks_j = j + elif (j == moth[0].get('number')-1): + fks_i = j + fks_j = i + to_remove = fks_j + + merge_i = self[fks_i] + merge_j = self[fks_j] + + i_4mom = FourMomentum(merge_i) + j_4mom = FourMomentum(merge_j) + if (fks_i <= 1): + sign1 = -1.0 + else: + sign1 = 1.0 + mother_4mom = i_4mom + sign1*j_4mom + + new_event = copy.deepcopy(self) + + self[fks_i].pid = moth[0]['id'] + self[fks_i].set_momentum(mother_4mom) + + if fks_i <= 1: # initial-state recoil + new_p = FourMomentum() + for ip,part in enumerate(self): + if (ip != fks_i and ip != fks_j and ip >= 2): + new_p += part + + if fks_i == 0: + self[1].set_momentum(new_p - FourMomentum(self[0])) + elif fks_i == 1: + self[0].set_momentum(new_p - FourMomentum(self[1])) + + pz_1_new = self.recoil_eq(self[0],self[1]) + pz_2_new = self[0].pz + self[1].pz - pz_1_new + E_1_new = math.sqrt(self[0].mass**2 + self[0].px**2 + self[0].py**2 + pz_1_new **2) + E_2_new = math.sqrt(self[1].mass**2 + self[1].px**2 + self[1].py**2 + pz_2_new **2) + self[0].set_momentum(FourMomentum([E_1_new,self[0].px,self[0].py,pz_1_new])) + self[1].set_momentum(FourMomentum([E_2_new,self[1].px,self[1].py,pz_2_new])) + self.pop(to_remove) + + if fks_i > 1: # final-state recoil + + # Re-scale the energy of fks_i to make it on-shell + for ip,part in enumerate(self): + if (ip == fks_i): + part.E = math.sqrt(part.mass**2 + part.px**2 + part.py**2 + part.pz**2) + new_p.E = part.E + + # Find the overall energy in the final state + new_p.E = 0.0 + for ip,part in enumerate(self): + if (ip != fks_j and ip >= 2): + new_p.E += part.E + + # Use one of the initial states to absorb the energy change in the final state + self[1].set_momentum(FourMomentum([new_p.E-self[0].E,self[1].px,self[1].py,self[1].pz])) + + # Change the initial state pz and E + pz_1_new = self.recoil_eq(self[0],self[1]) + pz_2_new = self[0].pz + self[1].pz - pz_1_new + E_1_new = math.sqrt(self[0].mass**2 + self[0].px**2 + self[0].py**2 + pz_1_new **2) + E_2_new = math.sqrt(self[1].mass**2 + self[1].px**2 + self[1].py**2 + pz_2_new **2) + self[0].set_momentum(FourMomentum([E_1_new,self[0].px,self[0].py,pz_1_new])) + self[1].set_momentum(FourMomentum([E_2_new,self[1].px,self[1].py,pz_2_new])) + self.pop(to_remove) + + elif fks_type and not recoil: + ## Do it in a more FKS-style + if (i == moth[0].get('number')-1): + fks_i = i + fks_j = j + elif (j == moth[0].get('number')-1): + fks_i = j + fks_j = i + to_remove = fks_j + new_event = copy.copy(event) + + if fks_i <= 1: # initial-state recoil + + # First boost to partonic CM frame + q = FourMomentum(self[0])+FourMomentum(self[1]) + for ip,part in enumerate(self): + vec = FourMomentum(part) + self[ip].set_momentum(vec.zboost(pboost=q)) + + k_tot = FourMomentum([self[0].E+self[1].E-self[fks_j].E,self[0].px+self[1].px-self[fks_j].px,\ + self[0].py+self[1].py-self[fks_j].py,self[0].pz+self[1].pz-self[fks_j].pz]) + + final = FourMomentum([0,0,0,0]) + for ip,part in enumerate(self): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + if (ip != fks_i and ip != fks_j and ip >= 2): + final = final + vec + + s = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz])**2 + ksi = self[fks_j].E/(math.sqrt(s)/2.0) + y = self[fks_j].pz/self[fks_j].E + + self[0].pz = self[0].pz * math.sqrt(1.0-ksi)*math.sqrt((2.0-ksi*(1.0+y))/((2.0-ksi*(1.0-y)))) + self[0].E = math.sqrt(self[0].mass**2 + self[0].pz**2) + self[1].pz = self[1].pz * math.sqrt(1.0-ksi)*math.sqrt((2.0-ksi*(1.0-y))/((2.0-ksi*(1.0+y)))) + self[1].E = math.sqrt(self[1].mass**2 + self[1].pz**2) + + final = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + k_tot_1 = k_tot.zboost(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + k_tot_2 = k_tot_1.pt_boost(pboost=FourMomentum([k_tot_1.E,k_tot_1.px,k_tot_1.py,k_tot_1.pz])) + k_tot_3 = k_tot_2.zboost_inv(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + + for ip,part in enumerate(self): + if (ip >= 2): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + vec2 = vec.zboost(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + vec3 = vec2.pt_boost(pboost=FourMomentum([k_tot_1.E,k_tot_1.px,k_tot_1.py,k_tot_1.pz])) + vec_new = vec3.zboost_inv(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + self[ip].set_momentum(FourMomentum([vec_new.E,vec_new.px,vec_new.py,vec_new.pz])) + + self.pop(to_remove) + + else: # final-state recoil + q = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + for ip,part in enumerate(self): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + self[ip].set_momentum(vec.zboost(pboost=q)) + + q = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + k = FourMomentum([self[fks_i].E+self[fks_j].E,self[fks_i].px+self[fks_j].px,\ + self[fks_i].py+self[fks_j].py,self[fks_i].pz+self[fks_j].pz]) + + k_rec = FourMomentum([0,0,0,0]) + for ip,part in enumerate(self): + if ip >= 2 and ip != fks_i and ip != fks_j: # add only final-states to the recoil and not the FKS pair + k_rec = k_rec + FourMomentum([part.E,part.px,part.py,part.pz]) + + k_mom = math.sqrt(k_rec.px**2 + k_rec.py**2 + k_rec.pz**2) + beta = (q**2 - (k_rec.E+k_mom)**2)/(q**2 + (k_rec.E+k_mom)**2) + for ip,part in enumerate(self): + if ip >= 2 and ip != fks_i and ip != fks_j: + vec = FourMomentum([self[ip].E,self[ip].px,self[ip].py,self[ip].pz]) + self[ip].set_momentum(vec.boost_beta(beta,k_rec)) + if ip == fks_i: + self[ip].set_momentum(q - k_rec.boost_beta(beta,k_rec)) + self.pop(to_remove) + else: + logger.info('Error in Sudakov Born mapping: no recoil scheme found!') + + def recoil_eq(self,part1, part2): + """ In general, solves the equation + E1 + E2 = K + p1 + p2 = c + E1^2 - p1^2 = a + E2^2 - p2^2 = b + and returns p1 + """ + thresh = 1e-6 + import random + a = part1.mass**2 + part1.px**2 + part1.py**2 + b = part2.mass**2 + part2.px**2 + part2.py**2 + c = part1.pz + part2.pz + K = part1.E + part2.E + K2 = K**2 + sol1 = (-a*c + b*c + c**3 - c*K2 - math.sqrt(K2*(a**2 + (b + c**2 - K2)**2 - 2*a*(b - c**2 + K2))))/(2*(c**2-K2)) + sol2 = (-a*c + b*c + c**3 - c*K2 + math.sqrt(K2*(a**2 + (b + c**2 - K2)**2 - 2*a*(b - c**2 + K2))))/(2*(c**2-K2)) + + if abs(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2) - (math.sqrt(a+sol2**2) + math.sqrt(b+(c-sol2)**2))) > thresh: + logger.critical('Error in recoil_eq solver 1') + logger.critical(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2)) + logger.critical(math.sqrt(a+sol2**2) + math.sqrt(b+(c-sol2)**2)) + if abs(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2) - K) > thresh: + logger.critical('Error in recoil_eq solver 2') + logger.critical(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2)) + logger.critical(K) + return sol1 + + def boost(self, filter=None): """modify the current event to boost it according to the current filter""" if filter is None: @@ -1861,7 +2129,7 @@ def boost(self, filter=None): if list(filter(p)): pboost += p else: - pboost = FourMomentum(pboost) + pboost = FourMomentum(filter) # change sign of three-component due to helas convention pboost.px *=-1 @@ -1877,7 +2145,7 @@ def check(self): """check various property of the events""" # check that relative error is under control - threshold = 1e-6 + threshold = 1e-4 #1. Check that the 4-momenta are conserved E, px, py, pz = 0,0,0,0 @@ -1920,7 +2188,50 @@ def check(self): self.check_color_structure() #3. check mass - + + def check_kinematics_only(self): + """check various property of the events - only kinematics""" + + # check that relative error is under control + threshold = 1e-3 + + #1. Check that the 4-momenta are conserved + E, px, py, pz = 0,0,0,0 + absE, abspx, abspy, abspz = 0,0,0,0 + for particle in self: + coeff = 1 + if particle.status == -1: + coeff = -1 + elif particle.status != 1: + continue + E += coeff * particle.E + absE += abs(particle.E) + px += coeff * particle.px + py += coeff * particle.py + pz += coeff * particle.pz + abspx += abs(particle.px) + abspy += abs(particle.py) + abspz += abs(particle.pz) + # check mass + fourmass = FourMomentum(particle).mass + + if particle.mass and (abs(particle.mass) - fourmass)/ abs(particle.mass) > threshold: + logger.critical(self) + raise Exception( "Do not have correct mass lhe: %s momentum: %s (error at %s" % (particle.mass, fourmass, (abs(particle.mass) - fourmass)/ abs(particle.mass))) + + if abs(E/absE) > threshold: + logger.critical(self) + raise Exception("Do not conserve Energy %s, %s" % (E/absE, E)) + if abs(px/abspx) > threshold: + logger.critical(self) + raise Exception("Do not conserve Px %s, %s" % (px/abspx, px)) + if abs(py/abspy) > threshold: + logger.critical(self) + raise Exception("Do not conserve Py %s, %s" % (py/abspy, py)) + if abs(pz/abspz) > threshold: + logger.critical(self) + raise Exception("Do not conserve Pz %s, %s" % (pz/abspz, pz)) + def assign_scale_line(self, line, convert=True): """read the line corresponding to global event line @@ -2764,7 +3075,7 @@ def zboost(self, pboost=None, E=0, pz=0): if isinstance(pboost, FourMomentum): E = pboost.E pz = pboost.pz - + #beta = pz/E gamma = E / math.sqrt(E**2-pz**2) gammabeta = pz / math.sqrt(E**2-pz**2) @@ -2778,6 +3089,74 @@ def zboost(self, pboost=None, E=0, pz=0): out.pz = 0 return out + def zboost_inv(self, pboost=None, E=0, pz=0): + """Both momenta should be in the same frame. + The boost perform correspond to the boost required to set pboost at + rest (only z boost applied). + """ + if isinstance(pboost, FourMomentum): + E = pboost.E + pz = pboost.pz + + #beta = pz/E + gamma = E / math.sqrt(E**2-pz**2) + gammabeta = pz / math.sqrt(E**2-pz**2) + + out = FourMomentum([gamma*self.E + gammabeta*self.pz, + self.px, + self.py, + gamma*self.pz + gammabeta*self.E]) + + if abs(out.pz) < 1e-6 * out.E: + out.pz = 0 + return out + + + def pt_boost(self, pboost=None, E=0, pz=0): + """Both momenta should be in the same frame. + The boost perform correspond to the boost required to set pboost at + rest (only pT boost applied). + """ + + if isinstance(pboost, FourMomentum): + E = pboost.E + px = pboost.px + py = pboost.py + mass = math.sqrt(E**2 - px**2 - py**2) + + betax = px/E + betay = py/E + beta = math.sqrt(betax**2+betay**2) + gamma = 1 / math.sqrt(1.0-beta**2) + + out = FourMomentum([gamma*self.E - gamma*betax*self.px - gamma*betay*self.py, + -gamma*betax*self.E + (1.0 + (gamma-1.0)*betax**2/(beta**2))*self.px + (gamma-1.0)*betax*betay/(beta**2)*self.py, + -gamma*betay*self.E + ((gamma-1.0)*betax*betay/(beta**2))*self.px + (1.0+(gamma-1.0)*(betay**2)/(beta**2))*self.py, + self.pz]) + + if abs(out.px) < 1e-6 * out.E: + out.px = 0 + if abs(out.py) < 1e-6 * out.E: + out.py = 0 + return out + + def boost_beta(self,beta,mom): + """ Boost along the three-momentum of mom with a boost of size beta""" + + unit = mom * (1.0/math.sqrt(mom.px**2+mom.py**2+mom.pz**2)) + beta_vec = beta*unit + bx = beta_vec.px + by = beta_vec.py + bz = beta_vec.pz + gamma = 1.0 / math.sqrt(1.0-beta**2) + + out = FourMomentum([gamma*self.E - gamma*bx*self.px - gamma*by*self.py - gamma*bz*self.pz, + -gamma*bx*self.E + (1.0 + (gamma-1.0)*bx**2/(beta**2))*self.px + (gamma-1.0)*bx*by/(beta**2)*self.py + (gamma-1.0)*bx*bz/(beta**2)*self.pz, + -gamma*by*self.E + ((gamma-1.0)*bx*by/(beta**2))*self.px + (1.0+(gamma-1.0)*(by**2)/(beta**2))*self.py + (gamma-1.0)*by*bz/(beta**2)*self.pz, + -gamma*bz*self.E + (gamma-1.0)*bx*bz/(beta**2)*self.px + (gamma-1.0)*(by*bz)/(beta**2)*self.py + (1.0+(gamma-1.0)*bz**2/(beta**2))*self.pz]) + + return out + def boost_to_restframe(self, pboost): """apply the boost transformation such that pboost is at rest in the new frame. First apply a rotation to allign the pboost to the z axis and then use @@ -2789,27 +3168,64 @@ def boost_to_restframe(self, pboost): return out - # write pboost as (E, p cosT sinF, p sinT sinF, p cosF) - # rotation such that it become (E, 0 , 0 , p ) is - # cosT sinF , -sinT , cosT sinF - # sinT cosF , cosT , sinT sinF - # -sinT , 0 , cosF - p = math.sqrt( pboost.px**2 + pboost.py**2+ pboost.pz**2) - cosF = pboost.pz / p - sinF = math.sqrt(1-cosF**2) - sinT = pboost.py/p/sinF - cosT = pboost.px/p/sinF - - out=FourMomentum([self.E, - self.px*cosT*cosF + self.py*sinT*cosF-self.pz*sinF, - -self.px*sinT+ self.py*cosT, - self.px*cosT*sinF + self.py*sinT*sinF + self.pz*cosF - ]) - out = out.zboost(E=pboost.E,pz=p) + # see here https://physics.stackexchange.com/questions/749036/general-lorentz-boost-of-four-momentum-in-cm-frame-particle-physics + vx = pboost.px/pboost.E + vy = pboost.py/pboost.E + vz = pboost.pz/pboost.E + v = pboost.norm/pboost.E + v2 = pboost.norm_sq/pboost.E**2 + gamma = 1./math.sqrt(1.-v**2) + gammo = gamma-1. + out = FourMomentum(E = gamma*(self.E - vx*self.px - vy*self.py - vz*self.pz), + px= -gamma*vx*self.E + (1+gammo*vx**2/v2)*self.px + gammo*vx*vy/v2*self.py + gammo*vx*vz/v2*self.pz, + py= -gamma*vy*self.E + gammo*vy*vx/v2*self.px + (1+gammo*vy**2/v2)*self.py + gammo*vy*vz/v2*self.pz, + pz= -gamma*vz*self.E + gammo*vz*vx/v2*self.px + gammo*vz*vy/v2*self.py + (1+gammo*vz**2/v2)*self.pz) + return out + def rotate_to_z(self,prot): + + import math + import numpy as np + + z = np.array([0.,0.,1.]) + + px = self.px + py = self.py + pz = self.pz + + refx = prot.px + refy = prot.py + refz = prot.pz + + prot_mom = np.array([px, py, pz]) + ref_mom = np.array([refx, refy, refz]) + + # Create normal vector + n = np.array([refy, -refx, 0.]) + n = n * 1./math.sqrt(self.threedot(n,n)) + t = prot_mom - self.threedot(n,prot_mom)*n + p = ref_mom - self.threedot(ref_mom,z)*z + p = p/math.sqrt(self.threedot(p,p)) + + t_pz = np.array([self.threedot(t,p), self.threedot(t,z), 0.]) + costheta = self.threedot(ref_mom,z)* 1./math.sqrt(self.threedot(ref_mom, ref_mom)) + sintheta=math.sqrt(1.-costheta**2) + + sgn = 1. + t_pz_p = np.array([0., 0., 0.]) + t_pz_p[0] = costheta*t_pz[0] + sgn*(-sintheta) * t_pz[1] + t_pz_p[1] = sgn*sintheta*t_pz[0] + costheta * t_pz[1] + + out_mom = self.threedot(n,prot_mom)*n + t_pz_p[0]*p + t_pz_p[1]*z + + out = FourMomentum([self.E,out_mom[0], out_mom[1], out_mom[2] ] ) + + return out - + def threedot(self,a,b): + + return a[0]*b[0]+a[1]*b[1]+a[2]*b[2] class OneNLOWeight(object): diff --git a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/madevent_interface.py b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/madevent_interface.py index 2a118e21bf..8e30cf690c 100755 --- a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/madevent_interface.py +++ b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/madevent_interface.py @@ -496,7 +496,6 @@ def help_remove(self): logger.info(" the optional '-f' allows to by-pass all security question") logger.info(" The banner can be remove only if all files are removed first.") - class AskRun(cmd.ControlSwitch): """a class for the question on what to do on a madevent run""" @@ -2393,13 +2392,17 @@ def do_generate_events(self, line): # Check argument's validity mode = self.check_generate_events(args) switch_mode = self.ask_run_configuration(mode, args) - if not args: - # No run name assigned -> assigned one automaticaly - self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton') - else: - self.set_run_name(args[0], None, 'parton', True) - args.pop(0) - + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat'), consistency=False) + if not run_card.scan_set: + if not args: + # No run name assigned -> assigned one automaticaly + self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton') + else: + self.set_run_name(args[0], None, 'parton', True) + args.pop(0) + + self.run_generate_events(switch_mode, args) self.postprocessing() @@ -2560,7 +2563,7 @@ def wait_monitoring(Idle, Running, Done): self.update_status("postprocessing contur done", level="rivet") # this decorator handle the loop related to scan. - @common_run.scanparamcardhandling() + @common_run.scanparamcardhandling(run_card_scan=True) def run_generate_events(self, switch_mode, args): if self.proc_characteristics['loop_induced'] and self.options['run_mode']==0: @@ -2593,7 +2596,6 @@ def run_generate_events(self, switch_mode, args): # Regular run mode logger.info('Generating %s events with run name %s' % (self.run_card['nevents'], self.run_name)) - self.exec_cmd('survey %s %s' % (self.run_name,' '.join(args)), postcmd=False) nb_event = self.run_card['nevents'] @@ -2975,7 +2977,7 @@ def update_width_in_param_card(decay_info, initial=None, output=None): particle = 0 # Read BRs for this decay line = param_card[line_number] - while re.search('^(#|\s|\d)', line): + while re.search(r'^(#|\s|\d)', line): line = param_card.pop(line_number) if not particle or line.startswith('#'): line=param_card[line_number] @@ -3226,7 +3228,7 @@ def do_treatcards(self, line, mode=None, opt=None): for line in open(pjoin(bias_module_path,'%s.f'%os.path.basename(bias_module_path))): if start and last: break - if not start and not re.search('c\s*parameters\s*=\s*{',line, re.I): + if not start and not re.search(r'c\s*parameters\s*=\s*{',line, re.I): continue start = True if not line.startswith('C'): @@ -3235,7 +3237,7 @@ def do_treatcards(self, line, mode=None, opt=None): if '{' in line: line = line.split('{')[-1] # split for } ! # - split_result = re.split('(\}|!|\#)', line,1, re.M) + split_result = re.split(r'(\}|!|\#)', line,1, re.M) line = split_result[0] sep = split_result[1] if len(split_result)>1 else None if sep == '}': @@ -3514,8 +3516,8 @@ def pass_in_difficult_integration_mode(self, rate=1): text = open(conf_path).read() min_evt, max_evt = 2500 *(2+rate), 10000*(rate+1) - text = re.sub('''\(min_events = \d+\)''', '(min_events = %i )' % min_evt, text) - text = re.sub('''\(max_events = \d+\)''', '(max_events = %i )' % max_evt, text) + text = re.sub(r'''\(min_events = \d+\)''', '(min_events = %i )' % min_evt, text) + text = re.sub(r'''\(max_events = \d+\)''', '(max_events = %i )' % max_evt, text) fsock = open(conf_path, 'w') fsock.write(text) fsock.close() @@ -3619,7 +3621,7 @@ def do_refine(self, line): alljobs = misc.glob('ajob*', Pdir) #remove associated results.dat (ensure to not mix with all data) - Gre = re.compile("\s*j=(G[\d\.\w]+)") + Gre = re.compile(r"\s*j=(G[\d\.\w]+)") for job in alljobs: Gdirs = Gre.findall(open(job).read()) for Gdir in Gdirs: @@ -3727,58 +3729,126 @@ def do_combine_events(self, line): sum_xsec, sum_xerru, sum_axsec = 0,[],0 Gdirs = self.get_Gdir() Gdirs.sort() - for Gdir in Gdirs: - if os.path.exists(pjoin(Gdir, 'events.lhe')): - result = sum_html.OneResult('') - result.read_results(pjoin(Gdir, 'results.dat')) - sum_xsec += result.get('xsec') - sum_xerru.append(result.get('xerru')) - sum_axsec += result.get('axsec') - - if self.run_card['gridpack'] or self.run_card['nevents']==0: - os.remove(pjoin(Gdir, 'events.lhe')) - continue + partials_info = [] + try: + p = subprocess.Popen(["ulimit", "-n"], stdout=subprocess.PIPE) + out, err = p.communicate() + max_G = out.decode() + if max_G == "unlimited": + max_G =2500 + else: + max_G = int(max_G) - 40 + except Exception as error: + logger.debug(error) + max_G = 80 # max(20, len(Gdirs)/self.options['nb_core']) - AllEvent.add(pjoin(Gdir, 'events.lhe'), - result.get('xsec'), - result.get('xerru'), - result.get('axsec') - ) - - if len(AllEvent) >= 80: #perform a partial unweighting - AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % partials), - get_wgt, log_level=5, trunc_error=1e-2, event_target=self.run_card['nevents']) - AllEvent = lhe_parser.MultiEventFile() - AllEvent.banner = self.banner - AllEvent.add(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % partials), - sum_xsec, - math.sqrt(sum(x**2 for x in sum_xerru)), - sum_axsec) - partials +=1 - if not hasattr(self,'proc_characteristic'): self.proc_characteristic = self.get_characteristics() - if len(AllEvent) == 0: - nb_event = 0 - else: + mycluster = cluster.MultiCore(nb_core=self.options['nb_core']) + + def split(a, n): + """split a list "a" into n chunk of same size (or nearly same size)""" + k, m = divmod(len(a), n) + return (a[i*k+min(i, m):(i+1)*k+min(i+1, m)] for i in range(n)) + + partials_info = [] + if len(Gdirs) >= max_G: + start_unweight= time.perf_counter() + # first check in how many chunk we have to split (always use a multiple of nb_core) + nb_split = 1 + nb_G = len(Gdirs) // (2* self.options['nb_core']) + while nb_G > min(80, max_G): + nb_split += 1 + nb_G = len(Gdirs)//(nb_split*2*self.options['nb_core']) + if nb_G < 10: + nb_split -=1 + nb_G = len(Gdirs)//(nb_split*2*self.options['nb_core']) + + #enforce at least 10 directory per thread + if nb_G > 10 or nb_split>1: + # do the unweighting of each chunk on their own thread + nb_chunk = (nb_split*2*self.options['nb_core']) + else: + nb_chunk = len(Gdirs) // 10 + nb_G =10 + + # security that the number of combine events is too large + if nb_chunk >= max_G: + nb_chunk = max_G -1 + nb_G = len(Gdirs) // nb_chunk + + for i, local_G in enumerate(split(Gdirs, nb_chunk)): + line = [pjoin(self.me_dir, "Events", self.run_name, "partials%d.lhe.gz" % i)] + line.append(pjoin(self.me_dir, 'Events', self.run_name, '%s_%s_banner.txt' % (self.run_name, tag))) + line.append(str(self.results.current['cross'])) + line += local_G + partials_info.append(self.do_combine_events_partial(' '.join(line), preprocess_only=True)) + mycluster.submit(sys.executable, + [pjoin(self.me_dir, 'bin', 'internal', 'madevent_interface.py'), 'combine_events_partial'] + line, + stdout='/dev/null' + ) + + starttime = time.time() + update_status = lambda idle, run, finish: \ + self.update_status((idle, run, finish, 'unweight'), level=None, + force=False, starttime=starttime) + mycluster.wait(self.me_dir, update_status) + # do the final combination + for data in partials_info: + AllEvent.add(*data) + + start_unweight= time.perf_counter() nb_event = AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "unweighted_events.lhe.gz"), get_wgt, trunc_error=1e-2, event_target=self.run_card['nevents'], log_level=logging.DEBUG, normalization=self.run_card['event_norm'], proc_charac=self.proc_characteristic) + + #cleaning + for data in partials_info: + path = data[0] + try: + os.remove(path) + except Exception as error: + try: + os.remove(path[:-3]) # try without the .gz + except: + misc.sprint('no file ', path, 'to clean') + else: + for Gdir in Gdirs: + if os.path.exists(pjoin(Gdir, 'events.lhe')): + result = sum_html.OneResult('') + result.read_results(pjoin(Gdir, 'results.dat')) + sum_xsec += result.get('xsec') + sum_xerru.append(result.get('xerru')) + sum_axsec += result.get('axsec') + + if self.run_card['gridpack'] or self.run_card['nevents']==0: + os.remove(pjoin(Gdir, 'events.lhe')) + continue + + AllEvent.add(pjoin(Gdir, 'events.lhe'), + result.get('xsec'), + result.get('xerru'), + result.get('axsec') + ) + + if len(AllEvent) == 0: + nb_event = 0 + else: + nb_event = AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "unweighted_events.lhe.gz"), + get_wgt, trunc_error=1e-2, event_target=self.run_card['nevents'], + log_level=logging.DEBUG, normalization=self.run_card['event_norm'], + proc_charac=self.proc_characteristic) + + if nb_event < self.run_card['nevents']: + logger.warning("failed to generate enough events. Please follow one of the following suggestions to fix the issue:") + logger.warning(" - set in the run_card.dat 'sde_strategy' to %s", 1 + self.run_card['sde_strategy'] % 2) + logger.warning(" - set in the run_card.dat 'hard_survey' to 1 or 2.") + logger.warning(" - reduce the number of requested events (if set too high)") + logger.warning(" - check that you do not have -integrable- singularity in your amplitude.") + logger.warning(" - regenerate your process directory by selecting another gauge (in particular try FD gauge).") - if nb_event < self.run_card['nevents']: - logger.warning("failed to generate enough events. Please follow one of the following suggestions to fix the issue:") - logger.warning(" - set in the run_card.dat 'sde_strategy' to %s", 1 + self.run_card['sde_strategy'] % 2) - logger.warning(" - set in the run_card.dat 'hard_survey' to 1 or 2.") - logger.warning(" - reduce the number of requested events (if set too high)") - logger.warning(" - check that you do not have -integrable- singularity in your amplitude.") - if partials: - for i in range(partials): - try: - os.remove(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % i)) - except Exception: - os.remove(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe" % i)) self.results.add_detail('nb_event', nb_event) @@ -3789,7 +3859,50 @@ def do_combine_events(self, line): logger.info("combination of events done in %s s ", time.time()-start) self.to_store.append('event') + + ############################################################################ + def do_combine_events_partial(self, line, preprocess_only=False): + """ """ + + AllEvent = lhe_parser.MultiEventFile() + + sum_xsec, sum_xerru, sum_axsec = 0,[],0 + output, banner_path,cross = line.split()[:3] + Gdirs = line.split()[3:] + + cross = float(cross) + if not self.banner: + self.banner = banner_mod.Banner(banner_path) + if not hasattr(self, 'run_card'): + self.run_card = banner_mod.RunCard(self.banner['mgruncard']) + AllEvent.banner = self.banner + + for Gdir in Gdirs: + if os.path.exists(pjoin(Gdir, 'events.lhe')): + result = sum_html.OneResult('') + result.read_results(pjoin(Gdir, 'results.dat')) + sum_xsec += result.get('xsec') + sum_xerru.append(result.get('xerru')) + sum_axsec += result.get('axsec') + + if self.run_card['gridpack'] or self.run_card['nevents']==0: + os.remove(pjoin(Gdir, 'events.lhe')) + continue + if not preprocess_only: + AllEvent.add(pjoin(Gdir, 'events.lhe'), + result.get('xsec'), + result.get('xerru'), + result.get('axsec') + ) + if preprocess_only: + return output, sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), sum_axsec + nb_event = max(min(abs(1.01*self.run_card['nevents']*sum_axsec/cross),self.run_card['nevents']), 10) + get_wgt = lambda event: event.wgt + AllEvent.unweight(output, + get_wgt, log_level=5, trunc_error=1e-2, event_target=nb_event) + return output, sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), sum_axsec + ############################################################################ def correct_bias(self): """check the first event and correct the weight by the bias @@ -3902,13 +4015,19 @@ def do_store_events(self, line): #except Exception: # continue # Store log - try: - if os.path.exists(pjoin(G_path, 'log.txt')): - input = pjoin(G_path, 'log.txt') + input = pjoin(G_path, 'log.txt') + if os.path.exists(input): + if self.run_card['keep_log'] not in ["none", "minimal"]: output = pjoin(G_path, '%s_log.txt' % run) - files.mv(input, output) - except Exception: - continue + try: + files.mv(input, output) + except Exception: + continue + elif self.run_card['keep_log'] == "none": + try: + os.remove(input) + except Exception: + continue #try: # # Grid # for name in ['ftn26']: @@ -3989,7 +4108,7 @@ def do_create_gridpack(self, line): misc.call(['./bin/internal/make_gridpack'], cwd=self.me_dir) files.mv(pjoin(self.me_dir, 'gridpack.tar.gz'), pjoin(self.me_dir, '%s_gridpack.tar.gz' % self.run_name)) - os.system("sed -i.bak \"s/\s*.true.*=.*GridRun/ .false. = GridRun/g\" %s/Cards/grid_card.dat" \ + os.system("sed -i.bak \"s/\\s*.true.*=.*GridRun/ .false. = GridRun/g\" %s/Cards/grid_card.dat" \ % self.me_dir) self.update_status('gridpack created', level='gridpack') @@ -4476,7 +4595,7 @@ def do_pythia8(self, line): else: preamble = misc.get_HEPTools_location_setter( pjoin(MG5DIR,'HEPTools'),'lib') - preamble += "\n unset PYTHIA8DATA\n" + #preamble += "\n unset PYTHIA8DATA\n" open(pythia_cmd_card,'w').write("""! ! It is possible to run this card manually with: @@ -4691,7 +4810,7 @@ def do_pythia8(self, line): # Make sure to sure the number of split_events determined during the splitting. split_PY8_Card.systemSet('Main:numberOfEvents',partition_for_PY8[i]) split_PY8_Card.systemSet('HEPMCoutput:scaling',split_PY8_Card['HEPMCoutput:scaling']* - (float(partition_for_PY8[i])/float(n_events))) + (float(partition_for_PY8[i]))) # Add_missing set to False so as to be sure not to add any additional parameter w.r.t # the ones in the original PY8 param_card copied. split_PY8_Card.write(pjoin(parallelization_dir,'PY8Card_%d.dat'%i), @@ -4963,9 +5082,9 @@ def wait_monitoring(Idle, Running, Done): if cross_sections: # Filter the cross_sections specified an keep only the ones # with central parameters and a different merging scale - a_float_re = '[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' + a_float_re = r'[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' central_merging_re = re.compile( - '^\s*Weight_MERGING\s*=\s*(?P%s)\s*$'%a_float_re, + r'^\s*Weight_MERGING\s*=\s*(?P%s)\s*$'%a_float_re, re.IGNORECASE) cross_sections = dict( (float(central_merging_re.match(xsec).group('merging')),value) @@ -5016,8 +5135,8 @@ def wait_monitoring(Idle, Running, Done): def parse_PY8_log_file(self, log_file_path): """ Parse a log file to extract number of event and cross-section. """ - pythiare = re.compile("Les Houches User Process\(es\)\s*\d+\s*\|\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)\s*\|\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") - pythia_xsec_re = re.compile("Inclusive cross section\s*:\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") + pythiare = re.compile(r"Les Houches User Process\(es\)\s*\d+\s*\|\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)\s*\|\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") + pythia_xsec_re = re.compile(r"Inclusive cross section\s*:\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") sigma_m, Nacc, Ntry = None, None, None for line in misc.BackRead(log_file_path): info = pythiare.search(line) @@ -5158,7 +5277,7 @@ def do_pythia(self, line): # read the line from the bottom of the file #pythia_log = misc.BackRead(pjoin(self.me_dir,'Events', self.run_name, # '%s_pythia.log' % tag)) - pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") + pythiare = re.compile(r"\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") for line in misc.reverse_readline(pjoin(self.me_dir,'Events', self.run_name, '%s_pythia.log' % tag)): info = pythiare.search(line) @@ -5619,8 +5738,8 @@ def launch_job(self,exe, cwd=None, stdout=None, argument = [], remaining=0, input_files.append(self.get_pdf_input_filename()) #Find the correct ajob - Gre = re.compile("\s*j=(G[\d\.\w]+)") - origre = re.compile("grid_directory=(G[\d\.\w]+)") + Gre = re.compile(r"\s*j=(G[\d\.\w]+)") + origre = re.compile(r"grid_directory=(G[\d\.\w]+)") try : fsock = open(exe) except Exception: @@ -5628,7 +5747,7 @@ def launch_job(self,exe, cwd=None, stdout=None, argument = [], remaining=0, text = fsock.read() output_files = Gre.findall(text) if not output_files: - Ire = re.compile("for i in ([\d\.\s]*) ; do") + Ire = re.compile(r"for i in ([\d\.\s]*) ; do") data = Ire.findall(text) data = ' '.join(data).split() for nb in data: @@ -6035,7 +6154,7 @@ def get_last_tag(self, level): 'syscalc':[], 'rivet':['rivet']} - if name == self.run_name: + if name and name == self.run_name: if reload_card: run_card = pjoin(self.me_dir, 'Cards','run_card.dat') self.run_card = banner_mod.RunCard(run_card) @@ -6334,7 +6453,7 @@ def run_syscalc(self, mode='parton', event_path=None, output=None): elif mode == 'Pythia': stdout = open(pjoin(event_dir, self.run_name, '%s_%s_syscalc.log' % (tag,mode)),'w') if 'mgpythiacard' in self.banner: - pat = re.compile('''^\s*qcut\s*=\s*([\+\-\d.e]*)''', re.M+re.I) + pat = re.compile(r'''^\s*qcut\s*=\s*([\+\-\d.e]*)''', re.M+re.I) data = pat.search(self.banner['mgpythiacard']) if data: qcut = float(data.group(1)) @@ -6611,7 +6730,7 @@ def get_subP_ids(path): for line in open(pjoin(path, 'leshouche.inc')): if not 'IDUP' in line: continue - particles = re.search("/([\d,-]+)/", line) + particles = re.search(r"/([\d,-]+)/", line) all_ids.append([int(p) for p in particles.group(1).split(',')]) return all_ids @@ -6899,6 +7018,7 @@ def do_combine_events(self, line): partials = 0 # if too many file make some partial unweighting sum_xsec, sum_xerru, sum_axsec = 0,[],0 + partials_info = [] Gdirs = self.get_Gdir() Gdirs.sort() for Gdir in Gdirs: @@ -6917,16 +7037,21 @@ def do_combine_events(self, line): sum_axsec += result.get('axsec')*gscalefact[Gdir] if len(AllEvent) >= 80: #perform a partial unweighting + nb_event = min(abs(1.01*self.nb_event*sum_axsec/self.results.current['cross']),self.run_card['nevents']) AllEvent.unweight(pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), - get_wgt, log_level=5, trunc_error=1e-2, event_target=self.nb_event) + get_wgt, log_level=5, trunc_error=1e-2, event_target=nb_event) AllEvent = lhe_parser.MultiEventFile() AllEvent.banner = self.banner - AllEvent.add(pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), + partials_info.append((pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), - sum_axsec) + sum_axsec) ) + sum_xsec, sum_xerru, sum_axsec = 0,[],0 partials +=1 + for data in partials_info: + AllEvent.add(*data) + if not hasattr(self,'proc_characteristic'): self.proc_characteristic = self.get_characteristics() diff --git a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/misc.py b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/misc.py index c4c669f36b..e7fd60be0d 100755 --- a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/misc.py +++ b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/misc.py @@ -67,7 +67,7 @@ def parse_info_str(fsock): """ info_dict = {} - pattern = re.compile("(?P\w*)\s*=\s*(?P.*)", + pattern = re.compile(r"(?P\w*)\s*=\s*(?P.*)", re.IGNORECASE | re.VERBOSE) for entry in fsock: entry = entry.strip() @@ -84,7 +84,7 @@ def parse_info_str(fsock): def glob(name, path=''): """call to glob.glob with automatic security on path""" import glob as glob_module - path = re.sub('(?P\?|\*|\[|\])', '[\g]', path) + path = re.sub(r'(?P\?|\*|\[|\])', r'[\g]', path) return glob_module.glob(pjoin(path, name)) #=============================================================================== @@ -614,10 +614,10 @@ def mod_compilator(directory, new='gfortran', current=None, compiler_type='gfort #search file file_to_change=find_makefile_in_dir(directory) if compiler_type == 'gfortran': - comp_re = re.compile('^(\s*)FC\s*=\s*(.+)\s*$') + comp_re = re.compile(r'^(\s*)FC\s*=\s*(.+)\s*$') var = 'FC' elif compiler_type == 'cpp': - comp_re = re.compile('^(\s*)CXX\s*=\s*(.+)\s*$') + comp_re = re.compile(r'^(\s*)CXX\s*=\s*(.+)\s*$') var = 'CXX' else: MadGraph5Error, 'Unknown compiler type: %s' % compiler_type @@ -861,9 +861,9 @@ def detect_current_compiler(path, compiler_type='fortran'): # comp = re.compile("^\s*FC\s*=\s*(\w+)\s*") # The regular expression below allows for compiler definition with absolute path if compiler_type == 'fortran': - comp = re.compile("^\s*FC\s*=\s*([\w\/\\.\-]+)\s*") + comp = re.compile("^\\s*FC\\s*=\\s*([\\w\\/\\.\\-]+)\\s*") elif compiler_type == 'cpp': - comp = re.compile("^\s*CXX\s*=\s*([\w\/\\.\-]+)\s*") + comp = re.compile("^\\s*CXX\\s*=\\s*([\\w\\/\\.\\-]+)\\s*") else: MadGraph5Error, 'Unknown compiler type: %s' % compiler_type @@ -1001,7 +1001,19 @@ def call_stdout(arg, *args, **opt): def copytree(src, dst, symlinks = False, ignore = None): if not os.path.exists(dst): os.makedirs(dst) - shutil.copystat(src, dst) + try: + shutil.copystat(src, dst) + except PermissionError: + if os.path.realpath(src).startswith('/cvmfs') and os.path.realpath(dst).startswith('/afs'): + # allowing missmatch from cvmfs to afs since sounds to not create issue --at least in general-- + logger.critical(f'Ignoring that we could not copy permissions from {src} to {dst}') + else: + logger.critical(f'Permission error detected from {src} to {dst}.\n'+\ + 'If you are using WSL with windows partition, please try using python3.12\n'+\ + 'or avoid moving your data from the WSL partition to the UNIX one') + # we do not have enough experience in WSL to allow it to get trough. + raise + lst = os.listdir(src) if ignore: excl = ignore(src, lst) @@ -1895,12 +1907,12 @@ class EasterEgg(object): May4_banner = "* _____ *\n" + \ "* ,-~\" \"~-. *\n" + \ "* * ,^ ___ ^. * *\n" + \ - "* * / .^ ^. \ * *\n" + \ + "* * / .^ ^. \\ * *\n" + \ "* * Y l o ! Y * *\n" + \ "* * l_ `.___.' _,[ * *\n" + \ "* * |^~\"--------------~\"\"^| * *\n" + \ "* * ! May the 4th ! * *\n" + \ - "* * \ / * *\n" + \ + "* * \\ / * *\n" + \ "* * ^. .^ * *\n" + \ "* * \"-.._____.,-\" * *\n" @@ -1909,13 +1921,13 @@ class EasterEgg(object): "* M::::::::::M M::::::::::M *\n" + \ "* M:::::::::::M M:::::::::::M (_)___ *\n" + \ "* M:::::::M::::M M::::M:::::::M | / __| *\n" + \ - "* M::::::M M::::M M::::M M::::::M | \__ \ *\n" + \ + "* M::::::M M::::M M::::M M::::::M | \\__ \\ *\n" + \ "* M::::::M M::::M::::M M::::::M |_|___/ *\n" + \ "* M::::::M M:::::::M M::::::M *\n" + \ "* M::::::M M:::::M M::::::M / _| ___ _ __ *\n" + \ - "* M::::::M MMMMM M::::::M | |_ / _ \| '__| *\n" + \ + "* M::::::M MMMMM M::::::M | |_ / _ \\| '__| *\n" + \ "* M::::::M M::::::M | _| (_) | | *\n" + \ - "* M::::::M M::::::M |_/\/\___/|_| *\n" + \ + "* M::::::M M::::::M |_/\\/\\___/|_| *\n" + \ "* M::::::M M::::::M *\n" + \ "* MMMMMMMM MMMMMMMM *\n" + \ "* *\n" + \ @@ -2233,39 +2245,51 @@ def import_python_lhapdf(lhapdfconfig): os.environ['LD_LIBRARY_PATH'] = lhapdf_libdir else: os.environ['LD_LIBRARY_PATH'] = '%s:%s' %(lhapdf_libdir,os.environ['LD_LIBRARY_PATH']) - try: candidates=[dirname for dirname in os.listdir(lhapdf_libdir) \ if os.path.isdir(os.path.join(lhapdf_libdir,dirname))] except OSError: candidates=[] + if os.path.isdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')): + candidates += [pjoin(os.pardir,'local', 'lib', dirname) for dirname in os.listdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')) + if os.path.isdir(os.path.join(lhapdf_libdir,os.pardir, 'local', 'lib', dirname))] for candidate in candidates: - if os.path.isdir(os.path.join(lhapdf_libdir,candidate,'site-packages')): - sys.path.insert(0,os.path.join(lhapdf_libdir,candidate,'site-packages')) - try: - import lhapdf - use_lhapdf=True - break - except ImportError: - sys.path.pop(0) - continue + for subdir in ['site-packages', 'dist-packages']: + if os.path.isdir(os.path.join(lhapdf_libdir,candidate, subdir)): + sys.path.insert(0,os.path.join(lhapdf_libdir,candidate, subdir)) + try: + import lhapdf + use_lhapdf=True + break + except ImportError as error: + sys.path.pop(0) + continue + else: + continue + break if not use_lhapdf: try: candidates=[dirname for dirname in os.listdir(lhapdf_libdir+'64') \ if os.path.isdir(os.path.join(lhapdf_libdir+'64',dirname))] except OSError: candidates=[] - + if os.path.isdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib64')): + candidates += [pjoin(os.pardir,'local', 'lib64', dirname) for dirname in os.listdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')) + if os.path.isdir(os.path.join(lhapdf_libdir,os.pardir, 'local', 'lib64', dirname))] for candidate in candidates: - if os.path.isdir(os.path.join(lhapdf_libdir+'64',candidate,'site-packages')): - sys.path.insert(0,os.path.join(lhapdf_libdir+'64',candidate,'site-packages')) - try: - import lhapdf - use_lhapdf=True - break - except ImportError: - sys.path.pop(0) - continue + for subdir in ['site-packages', 'dist-packages']: + if os.path.isdir(os.path.join(lhapdf_libdir+'64',candidate, subdir)): + sys.path.insert(0,os.path.join(lhapdf_libdir+'64',candidate, subdir)) + try: + import lhapdf + use_lhapdf=True + break + except ImportError as error: + sys.path.pop(0) + continue + else: + continue + break if not use_lhapdf: try: import lhapdf diff --git a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/shower_card.py b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/shower_card.py index e87d534177..16ed72b1a0 100755 --- a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/shower_card.py +++ b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/shower_card.py @@ -288,7 +288,7 @@ def write(self, output_file, template=None, python_template=False, self.text = open(template,'r').read() - key_re = re.compile('^(\s*)([\S^#]+)(\s*)=(\s*)([^#]*?)(\s*)(\#.*|$)') + key_re = re.compile(r'^(\s*)([\S^#]+)(\s*)=(\s*)([^#]*?)(\s*)(\#.*|$)') newlines = [] for line in self.text.split('\n'): key_match = key_re.findall(line) diff --git a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/systematics.py b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/systematics.py index 28eaed00e2..2acebd087c 100644 --- a/epochX/cudacpp/heft_gg_bb.mad/bin/internal/systematics.py +++ b/epochX/cudacpp/heft_gg_bb.mad/bin/internal/systematics.py @@ -582,7 +582,7 @@ def print_cross_sections(self, all_cross, nb_event, stdout): else: resume.write( '#PDF %s: %g +%2.3g%% -%2.3g%%\n' % (pdfset.name, pdferr.central,pdferr.errplus*100/all_cross[0], pdferr.errminus*100/all_cross[0])) - dyn_name = {1: '\sum ET', 2:'\sum\sqrt{m^2+pt^2}', 3:'0.5 \sum\sqrt{m^2+pt^2}',4:'\sqrt{\hat s}' } + dyn_name = {1: r'\sum ET', 2:r'\sum\sqrt{m^2+pt^2}', 3:r'0.5 \sum\sqrt{m^2+pt^2}',4:r'\sqrt{\hat s}' } for key, curr in dyns.items(): if key ==-1: continue @@ -789,7 +789,7 @@ def get_id(self): return int(self.start_wgt_id) if 'initrwgt' in self.banner: - pattern = re.compile(' set lhapdf /PATH/TO/lhapdf-config -None does not seem to correspond to a valid lhapdf-config executable. -Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config). -Note that you can still compile and run aMC@NLO with the built-in PDFs - MG5_aMC> set lhapdf /PATH/TO/lhapdf-config - Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt -import /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_heft_gg_bb.mg +import /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_heft_gg_bb.mg The import format was not given, so we guess it as command set stdout_level DEBUG set output information to level: 10 set zerowidth_tchannel F set auto_convert_model T save options auto_convert_model -save configuration file to /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +save configuration file to /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt import model heft +INFO: load particles +INFO: load vertices +WARNING: coupling GC_13=-(complex(0,1)*GH) has direct dependence in aS but has QCD order set to 0. Automatic computation of scale uncertainty can be wrong for such model.  +WARNING: coupling GC_16=(complex(0,1)*Gphi)/8. has direct dependence in aS but has QCD order set to 0. Automatic computation of scale uncertainty can be wrong for such model.  +DEBUG: model prefixing takes 0.006150245666503906  INFO: Restrict model heft with file models/heft/restrict_default.dat . DEBUG: Simplifying conditional expressions  DEBUG: remove interactions: s u w+ at order: QED=1  @@ -131,13 +131,12 @@ INFO: Process has 4 diagrams Total: 1 processes with 4 diagrams output standalone_cudacpp ../TMPOUT/CODEGEN_cudacpp_heft_gg_bb Load PLUGIN.CUDACPP_OUTPUT -Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.5.3_lo_vect. +Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.6.0_lo_vect. It has been validated for the last time with version: 3.5.2 Output will be done with PLUGIN: CUDACPP_OUTPUT -DEBUG: cformat =  plugin [export_cpp.py at line 3070]  DEBUG: Entering PLUGIN_ProcessExporter.__init__ (initialise the exporter) [output.py at line 165]  DEBUG: Entering PLUGIN_ProcessExporter.copy_template (initialise the directory) [output.py at line 170]  -INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_heft_gg_bb +INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_heft_gg_bb INFO: Organizing processes into subprocess groups INFO: Generating Helas calls for process: g g > b b~ HIG<=1 HIW<=1 @1 INFO: Processing color information for process: g g > b b~ HIG<=1 HIW<=1 @1 @@ -146,34 +145,34 @@ INFO: Processing color information for process: g g > b b~ HIG<=1 HIW<=1 @1 DEBUG: type(fortran_model)= [output.py at line 214]  DEBUG: type(me)= me=0 [output.py at line 215]  DEBUG: "need to link", self.to_link_in_P =  need to link ['nvtx.h', 'timer.h', 'timermap.h', 'ompnumthreads.h', 'GpuRuntime.h', 'GpuAbstraction.h', 'MemoryAccessHelpers.h', 'MemoryAccessVectors.h', 'MemoryAccessMatrixElements.h', 'MemoryAccessMomenta.h', 'MemoryAccessRandomNumbers.h', 'MemoryAccessWeights.h', 'MemoryAccessAmplitudes.h', 'MemoryAccessWavefunctions.h', 'MemoryAccessGs.h', 'MemoryAccessCouplingsFixed.h', 'MemoryAccessNumerators.h', 'MemoryAccessDenominators.h', 'MemoryAccessChannelIds.h', 'EventStatistics.h', 'CommonRandomNumbers.h', 'CrossSectionKernels.cc', 'CrossSectionKernels.h', 'MatrixElementKernels.cc', 'MatrixElementKernels.h', 'RamboSamplingKernels.cc', 'RamboSamplingKernels.h', 'RandomNumberKernels.h', 'CommonRandomNumberKernel.cc', 'CurandRandomNumberKernel.cc', 'HiprandRandomNumberKernel.cc', 'Bridge.h', 'BridgeKernels.cc', 'BridgeKernels.h', 'fbridge.cc', 'fbridge.inc', 'fsampler.cc', 'fsampler.inc', 'MadgraphTest.h', 'runTest.cc', 'testmisc.cc', 'testxxx_cc_ref.txt', 'valgrind.h', 'cudacpp.mk', 'testxxx.cc', 'MemoryBuffers.h', 'MemoryAccessCouplings.h', 'perf.py', 'profile.sh'] [output.py at line 216]  -INFO: Creating files in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_heft_gg_bb/SubProcesses/P1_Sigma_heft_gg_bbx -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_heft_gg_bb/SubProcesses/P1_Sigma_heft_gg_bbx/./CPPProcess.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_heft_gg_bb/SubProcesses/P1_Sigma_heft_gg_bbx/./CPPProcess.cc -INFO: Created files CPPProcess.h and CPPProcess.cc in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_heft_gg_bb/SubProcesses/P1_Sigma_heft_gg_bbx/. +INFO: Creating files in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_heft_gg_bb/SubProcesses/P1_Sigma_heft_gg_bbx +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_heft_gg_bb/SubProcesses/P1_Sigma_heft_gg_bbx/./CPPProcess.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_heft_gg_bb/SubProcesses/P1_Sigma_heft_gg_bbx/./CPPProcess.cc +INFO: Created files CPPProcess.h and CPPProcess.cc in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_heft_gg_bb/SubProcesses/P1_Sigma_heft_gg_bbx/. Generated helas calls for 1 subprocesses (4 diagrams) in 0.008 s ALOHA: aloha starts to compute helicity amplitudes ALOHA: aloha creates VVS3 routines ALOHA: aloha creates VVV1 set of routines with options: P0 ALOHA: aloha creates FFV1 routines ALOHA: aloha creates FFS2 routines -ALOHA: aloha creates 4 routines in 0.266 s +ALOHA: aloha creates 4 routines in 0.265 s VVS3 VVV1 FFV1 FFV1 FFV1 FFS2 -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_heft_gg_bb/src/./HelAmps_heft.h -INFO: Created file HelAmps_heft.h in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_heft_gg_bb/src/. +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_heft_gg_bb/src/./HelAmps_heft.h +INFO: Created file HelAmps_heft.h in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_heft_gg_bb/src/. super_write_set_parameters_onlyfixMajorana (hardcoded=False) super_write_set_parameters_onlyfixMajorana (hardcoded=True) -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_heft_gg_bb/src/./Parameters_heft.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_heft_gg_bb/src/./Parameters_heft.cc +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_heft_gg_bb/src/./Parameters_heft.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_heft_gg_bb/src/./Parameters_heft.cc INFO: Created files Parameters_heft.h and Parameters_heft.cc in directory -INFO: /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_heft_gg_bb/src/. and /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_heft_gg_bb/src/. +INFO: /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_heft_gg_bb/src/. and /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_heft_gg_bb/src/. quit -real 0m0.741s -user 0m0.588s -sys 0m0.060s -Code generation completed in 1 seconds +real 0m0.668s +user 0m0.604s +sys 0m0.052s +Code generation completed in 0 seconds diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/CODEGEN_mad_nobm_pp_ttW_log.txt b/epochX/cudacpp/nobm_pp_ttW.mad/CODEGEN_mad_nobm_pp_ttW_log.txt index b115d02584..f536ab73a6 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/CODEGEN_mad_nobm_pp_ttW_log.txt +++ b/epochX/cudacpp/nobm_pp_ttW.mad/CODEGEN_mad_nobm_pp_ttW_log.txt @@ -14,7 +14,7 @@ Running MG5 in debug mode * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect 2023-12-23 * +* VERSION 3.6.0_lo_vect 2024-06-17 * * * * WARNING: UNKNOWN DEVELOPMENT VERSION. * * WARNING: DO NOT USE FOR PRODUCTION * @@ -45,15 +45,10 @@ Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (inclu Note that you can still compile and run aMC@NLO with the built-in PDFs MG5_aMC> set lhapdf /PATH/TO/lhapdf-config -None does not seem to correspond to a valid lhapdf-config executable. -Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config). -Note that you can still compile and run aMC@NLO with the built-in PDFs - MG5_aMC> set lhapdf /PATH/TO/lhapdf-config - Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt -import /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW.mg +import /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW.mg The import format was not given, so we guess it as command set stdout_level DEBUG set output information to level: 10 @@ -61,7 +56,7 @@ set zerowidth_tchannel F import model sm-no_b_mass INFO: load particles INFO: load vertices -DEBUG: model prefixing takes 0.005822896957397461  +DEBUG: model prefixing takes 0.005758047103881836  INFO: Restrict model sm-no_b_mass with file models/sm/restrict_no_b_mass.dat . DEBUG: Simplifying conditional expressions  DEBUG: remove interactions: u s w+ at order: QED=1  @@ -185,7 +180,7 @@ INFO: Process u~ d > t t~ w- added to mirror process d u~ > t t~ w- INFO: Process c~ s > t t~ w- added to mirror process s c~ > t t~ w- INFO: Process d~ u > t t~ w+ added to mirror process u d~ > t t~ w+ INFO: Process s~ c > t t~ w+ added to mirror process c s~ > t t~ w+ -4 processes with 8 diagrams generated in 0.108 s +4 processes with 8 diagrams generated in 0.111 s Total: 4 processes with 8 diagrams add process p p > t t~ w j @1 INFO: Checking for minimal orders which gives processes. @@ -227,24 +222,24 @@ INFO: Process d~ g > t t~ w+ u~ added to mirror process g d~ > t t~ w+ u~ INFO: Process d~ u > t t~ w+ g added to mirror process u d~ > t t~ w+ g INFO: Process s~ g > t t~ w+ c~ added to mirror process g s~ > t t~ w+ c~ INFO: Process s~ c > t t~ w+ g added to mirror process c s~ > t t~ w+ g -12 processes with 144 diagrams generated in 0.649 s +12 processes with 144 diagrams generated in 0.661 s Total: 16 processes with 152 diagrams output madevent_simd ../TMPOUT/CODEGEN_mad_nobm_pp_ttW --hel_recycling=False --vector_size=32 Load PLUGIN.CUDACPP_OUTPUT -Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.5.3_lo_vect. +Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.6.0_lo_vect. It has been validated for the last time with version: 3.5.2 Output will be done with PLUGIN: CUDACPP_OUTPUT Addition matrix-element will be done with PLUGIN: CUDACPP_OUTPUT +DEBUG: opt['output_options']['vector_size'] =  32 [export_v4.py at line 4334]  Output will be done with PLUGIN: CUDACPP_OUTPUT -DEBUG: cformat =  standalone_simd [export_cpp.py at line 3070]  DEBUG: Entering PLUGIN_ProcessExporter.__init__ (initialise the exporter) [output.py at line 165]  INFO: initialize a new directory: CODEGEN_mad_nobm_pp_ttW INFO: remove old information in CODEGEN_mad_nobm_pp_ttW DEBUG: Entering PLUGIN_ProcessExporter.copy_template (initialise the directory) [output.py at line 170]  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW  -INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/Cards  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW  +INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/Cards  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses  INFO: Organizing processes into subprocess groups INFO: Generating Helas calls for process: g u > t t~ w+ d WEIGHTED<=5 @1 INFO: Processing color information for process: g u > t t~ w+ d @1 @@ -276,13 +271,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] [export_cpp.py at line 711]  -DEBUG: subproc_number =  0 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: g u > t t~ w+ d WEIGHTED<=5 @1 INFO: Finding symmetric diagrams for subprocess group gu_ttxwpd -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses/P1_gu_ttxwpd [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  12 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12} [model_handling.py at line 1548]  @@ -292,13 +282,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] [export_cpp.py at line 711]  -DEBUG: subproc_number =  1 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: g d > t t~ w- u WEIGHTED<=5 @1 INFO: Finding symmetric diagrams for subprocess group gd_ttxwmu -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses/P1_gd_ttxwmu [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  12 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12} [model_handling.py at line 1548]  @@ -308,13 +293,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] [export_cpp.py at line 711]  -DEBUG: subproc_number =  2 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: g u~ > t t~ w- d~ WEIGHTED<=5 @1 INFO: Finding symmetric diagrams for subprocess group gux_ttxwmdx -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses/P1_gux_ttxwmdx [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  12 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12} [model_handling.py at line 1548]  @@ -324,13 +304,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] [export_cpp.py at line 711]  -DEBUG: subproc_number =  3 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: g d~ > t t~ w+ u~ WEIGHTED<=5 @1 INFO: Finding symmetric diagrams for subprocess group gdx_ttxwpux -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses/P1_gdx_ttxwpux [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  12 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12} [model_handling.py at line 1548]  @@ -340,13 +315,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] [export_cpp.py at line 711]  -DEBUG: subproc_number =  4 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: u d~ > t t~ w+ g WEIGHTED<=5 @1 INFO: Finding symmetric diagrams for subprocess group udx_ttxwpg -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses/P1_udx_ttxwpg [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  12 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12} [model_handling.py at line 1548]  @@ -356,13 +326,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] [export_cpp.py at line 711]  -DEBUG: subproc_number =  5 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: d u~ > t t~ w- g WEIGHTED<=5 @1 INFO: Finding symmetric diagrams for subprocess group dux_ttxwmg -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses/P1_dux_ttxwmg [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  12 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12} [model_handling.py at line 1548]  @@ -372,13 +337,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2] [export_cpp.py at line 711]  -DEBUG: subproc_number =  6 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: u d~ > t t~ w+ WEIGHTED<=4 INFO: Finding symmetric diagrams for subprocess group udx_ttxwp -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses/P0_udx_ttxwp [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  2 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2} [model_handling.py at line 1548]  @@ -388,18 +348,14 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2] [export_cpp.py at line 711]  -DEBUG: subproc_number =  7 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: d u~ > t t~ w- WEIGHTED<=4 INFO: Finding symmetric diagrams for subprocess group dux_ttxwm -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses/P0_dux_ttxwm [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  2 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2} [model_handling.py at line 1548]  -Generated helas calls for 8 subprocesses (76 diagrams) in 0.203 s -Wrote files for 212 helas calls in 0.911 s +Generated helas calls for 8 subprocesses (76 diagrams) in 0.206 s +Wrote files for 212 helas calls in 0.836 s +DEBUG: self.vector_size =  32 [export_v4.py at line 7023]  ALOHA: aloha starts to compute helicity amplitudes ALOHA: aloha creates FFV1 routines ALOHA: aloha creates FFV2 routines @@ -409,7 +365,7 @@ ALOHA: aloha starts to compute helicity amplitudes ALOHA: aloha creates FFV1 routines ALOHA: aloha creates FFV2 routines ALOHA: aloha creates VVV1 set of routines with options: P0 -ALOHA: aloha creates 6 routines in 0.201 s +ALOHA: aloha creates 6 routines in 0.206 s FFV1 FFV1 FFV1 @@ -417,74 +373,97 @@ ALOHA: aloha creates 6 routines in 0.201 s FFV2 FFV2 VVV1 -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/src/./HelAmps_sm_no_b_mass.h -INFO: Created file HelAmps_sm_no_b_mass.h in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/src/. +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/src/./HelAmps_sm_no_b_mass.h +INFO: Created file HelAmps_sm_no_b_mass.h in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/src/. super_write_set_parameters_onlyfixMajorana (hardcoded=False) super_write_set_parameters_onlyfixMajorana (hardcoded=True) -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/src/./Parameters_sm_no_b_mass.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/src/./Parameters_sm_no_b_mass.cc +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/src/./Parameters_sm_no_b_mass.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/src/./Parameters_sm_no_b_mass.cc INFO: Created files Parameters_sm_no_b_mass.h and Parameters_sm_no_b_mass.cc in directory -INFO: /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/src/. and /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/src/. +INFO: /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/src/. and /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/src/. The option zerowidth_tchannel is modified [True] but will not be written in the configuration files. If you want to make this value the default for future session, you can run 'save options --all' -save configuration file to /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/Cards/me5_configuration.txt +save configuration file to /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/Cards/me5_configuration.txt INFO: Use Fortran compiler gfortran INFO: Use c++ compiler g++ INFO: Generate jpeg diagrams INFO: Generate web pages -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common -patching file Source/genps.inc +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common patching file SubProcesses/makefile -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses/P0_dux_ttxwm; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses/P0_dux_ttxwm; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 73 (offset 1 line). -Hunk #2 succeeded at 273 (offset 40 lines). -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses/P0_udx_ttxwp; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #1 succeeded at 72 (offset 1 line). +Hunk #2 succeeded at 268 (offset 54 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses/P0_udx_ttxwp; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 73 (offset 1 line). -Hunk #2 succeeded at 273 (offset 40 lines). -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses/P1_dux_ttxwmg; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #1 succeeded at 72 (offset 1 line). +Hunk #2 succeeded at 268 (offset 54 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses/P1_dux_ttxwmg; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 73 (offset 1 line). -Hunk #2 succeeded at 321 (offset 88 lines). -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses/P1_gd_ttxwmu; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #1 succeeded at 72 (offset 1 line). +Hunk #2 succeeded at 316 (offset 102 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses/P1_gd_ttxwmu; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 73 (offset 1 line). -Hunk #2 succeeded at 321 (offset 88 lines). -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses/P1_gdx_ttxwpux; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #1 succeeded at 72 (offset 1 line). +Hunk #2 succeeded at 316 (offset 102 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses/P1_gdx_ttxwpux; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 73 (offset 1 line). -Hunk #2 succeeded at 321 (offset 88 lines). -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses/P1_gu_ttxwpd; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #1 succeeded at 72 (offset 1 line). +Hunk #2 succeeded at 316 (offset 102 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses/P1_gu_ttxwpd; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 73 (offset 1 line). -Hunk #2 succeeded at 321 (offset 88 lines). -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses/P1_gux_ttxwmdx; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #1 succeeded at 72 (offset 1 line). +Hunk #2 succeeded at 316 (offset 102 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses/P1_gux_ttxwmdx; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 73 (offset 1 line). -Hunk #2 succeeded at 321 (offset 88 lines). -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses/P1_udx_ttxwpg; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #1 succeeded at 72 (offset 1 line). +Hunk #2 succeeded at 316 (offset 102 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/SubProcesses/P1_udx_ttxwpg; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 73 (offset 1 line). -Hunk #2 succeeded at 321 (offset 88 lines). +Hunk #1 succeeded at 72 (offset 1 line). +Hunk #2 succeeded at 316 (offset 102 lines). DEBUG: p.returncode =  0 [output.py at line 258]  -Output to directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW done. +Output to directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW done. Type "launch" to generate events from this process, or see -/data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/README +/data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/README Run "open index.html" to see more information about this process. quit -real 0m4.821s -user 0m4.254s -sys 0m0.492s +real 0m4.712s +user 0m4.184s +sys 0m0.513s Code generation completed in 5 seconds ************************************************************ * * @@ -498,7 +477,7 @@ Code generation completed in 5 seconds * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect * +* VERSION 3.6.0_lo_vect * * * * The MadGraph5_aMC@NLO Development Team - Find us at * * https://server06.fynu.ucl.ac.be/projects/madgraph * @@ -506,9 +485,9 @@ Code generation completed in 5 seconds * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt @@ -528,7 +507,7 @@ launch in debug mode * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect * +* VERSION 3.6.0_lo_vect * * * * The MadGraph5_aMC@NLO Development Team - Find us at * * https://server06.fynu.ucl.ac.be/projects/madgraph * @@ -536,9 +515,9 @@ launch in debug mode * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_nobm_pp_ttW/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/Cards/me5_configuration.txt b/epochX/cudacpp/nobm_pp_ttW.mad/Cards/me5_configuration.txt index cdeedc7863..4f5079f78a 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/Cards/me5_configuration.txt +++ b/epochX/cudacpp/nobm_pp_ttW.mad/Cards/me5_configuration.txt @@ -116,6 +116,7 @@ # cluster_type = condor # cluster_queue = madgraph # cluster_size = 150 +# cluster_walltime = # time in minute for slurm and second for condor (not supported for other scheduller) #! Path to a node directory to avoid direct writing on the central disk #! Note that condor clusters avoid direct writing by default (therefore this @@ -234,7 +235,7 @@ # pineappl = pineappl -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo # MG5 MAIN DIRECTORY -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/Cards/param_card.dat b/epochX/cudacpp/nobm_pp_ttW.mad/Cards/param_card.dat index 943e6ff7f2..e07ce1c87a 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/Cards/param_card.dat +++ b/epochX/cudacpp/nobm_pp_ttW.mad/Cards/param_card.dat @@ -1,5 +1,5 @@ ###################################################################### -## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL #### +## PARAM_CARD AUTOMATICALLY GENERATED BY MG5 FOLLOWING UFO MODEL #### ###################################################################### ## ## ## Width set on Auto will be computed following the information ## diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/Cards/param_card_default.dat b/epochX/cudacpp/nobm_pp_ttW.mad/Cards/param_card_default.dat index 943e6ff7f2..e07ce1c87a 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/Cards/param_card_default.dat +++ b/epochX/cudacpp/nobm_pp_ttW.mad/Cards/param_card_default.dat @@ -1,5 +1,5 @@ ###################################################################### -## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL #### +## PARAM_CARD AUTOMATICALLY GENERATED BY MG5 FOLLOWING UFO MODEL #### ###################################################################### ## ## ## Width set on Auto will be computed following the information ## diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/Cards/proc_card_mg5.dat b/epochX/cudacpp/nobm_pp_ttW.mad/Cards/proc_card_mg5.dat index 9dd46e75a8..49ae48919c 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/Cards/proc_card_mg5.dat +++ b/epochX/cudacpp/nobm_pp_ttW.mad/Cards/proc_card_mg5.dat @@ -8,7 +8,7 @@ #* * * * #* * #* * -#* VERSION 3.5.3_lo_vect 2023-12-23 * +#* VERSION 3.6.0_lo_vect 2024-06-17 * #* * #* WARNING: UNKNOWN DEVELOPMENT VERSION. * #* WARNING: DO NOT USE FOR PRODUCTION * diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/Cards/reweight_card_default.dat b/epochX/cudacpp/nobm_pp_ttW.mad/Cards/reweight_card_default.dat index ace534ae02..5cc65fe095 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/Cards/reweight_card_default.dat +++ b/epochX/cudacpp/nobm_pp_ttW.mad/Cards/reweight_card_default.dat @@ -19,8 +19,16 @@ change mode NLO # Define type of Reweighting. For LO sample this command # has no effect since only "LO" mode is allowed. + +#uncomment if you do not want to overwrite the reweight file of Sudakov in rw_me +#change rwgt_dir /PATH_MG5_BRANCH/NAME_FOLDER + +#uncomment if you want to use Sudakov Reweight +#change include_sudakov True + launch + # SPECIFY A PATH OR USE THE SET COMMAND LIKE THIS: # set sminputs 1 130 # modify 1/alpha_EW diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/Cards/run_card.dat b/epochX/cudacpp/nobm_pp_ttW.mad/Cards/run_card.dat index b80a436c7c..5eca3e3f2b 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/Cards/run_card.dat +++ b/epochX/cudacpp/nobm_pp_ttW.mad/Cards/run_card.dat @@ -180,6 +180,7 @@ systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++] ['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset', '--alps=0.5,1,2'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule + #*********************************************************************** # SIMD/GPU configuration for the CUDACPP plugin #************************************************************************ diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/Cards/run_card_default.dat b/epochX/cudacpp/nobm_pp_ttW.mad/Cards/run_card_default.dat index 811e9c6ab2..3b445d02a0 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/Cards/run_card_default.dat +++ b/epochX/cudacpp/nobm_pp_ttW.mad/Cards/run_card_default.dat @@ -180,6 +180,7 @@ systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++] ['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset', '--alps=0.5,1,2'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule + #*********************************************************************** # SIMD/GPU configuration for the CUDACPP plugin #************************************************************************ diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/MGMEVersion.txt b/epochX/cudacpp/nobm_pp_ttW.mad/MGMEVersion.txt index 9d3a5c0ba0..a806d3938c 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/MGMEVersion.txt +++ b/epochX/cudacpp/nobm_pp_ttW.mad/MGMEVersion.txt @@ -1 +1 @@ -3.5.3_lo_vect \ No newline at end of file +3.6.0_lo_vect \ No newline at end of file diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/Source/DHELAS/aloha_functions.f b/epochX/cudacpp/nobm_pp_ttW.mad/Source/DHELAS/aloha_functions.f index 975725737f..47699fa614 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/Source/DHELAS/aloha_functions.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/Source/DHELAS/aloha_functions.f @@ -351,7 +351,7 @@ subroutine oxxxxx(p,fmass,nhel,nsf , fo) fo(6) = ip * sqm(abs(im)) else - pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2)) +c pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2)) sf(1) = dble(1+nsf+(1-nsf)*nh)*rHalf sf(2) = dble(1+nsf-(1-nsf)*nh)*rHalf omega(1) = dsqrt(p(0)+pp) @@ -2054,7 +2054,7 @@ subroutine CombineAmp(nb, ihels, iwfcts, W1, Wall, Amp) enddo return end - + subroutine CombineAmpS(nb, ihels, iwfcts, W1, Wall, Amp) integer nb ! size of the vectors diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/Source/MODEL/couplings.f b/epochX/cudacpp/nobm_pp_ttW.mad/Source/MODEL/couplings.f index f3b620ab58..04d6bb5333 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/Source/MODEL/couplings.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/Source/MODEL/couplings.f @@ -10,18 +10,27 @@ SUBROUTINE COUP() PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + LOGICAL UPDATELOOP COMMON /TO_UPDATELOOP/UPDATELOOP INCLUDE 'input.inc' - INCLUDE '../vector.inc' + + INCLUDE 'coupl.inc' READLHA = .TRUE. INCLUDE 'intparam_definition.inc' CALL COUP1() + IF (UPDATELOOP) THEN + + CALL COUP2() + + ENDIF + C couplings needed to be evaluated points by points C - CALL COUP2(1) + CALL COUP3(1) RETURN END @@ -47,7 +56,11 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) INCLUDE '../maxparticles.inc' INCLUDE '../cuts.inc' + + INCLUDE '../vector.inc' + + INCLUDE '../run.inc' DOUBLE PRECISION ALPHAS @@ -65,7 +78,7 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) couplings needed to be evaluated points by points C ALL_G(VECID) = G - CALL COUP2(VECID) + CALL COUP3(VECID) RETURN END @@ -80,7 +93,9 @@ SUBROUTINE UPDATE_AS_PARAM2(MU_R2,AS2 ,VECID) INTEGER VECID INCLUDE 'model_functions.inc' INCLUDE 'input.inc' + INCLUDE '../vector.inc' + INCLUDE 'coupl.inc' DOUBLE PRECISION MODEL_SCALE COMMON /MODEL_SCALE/MODEL_SCALE diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/Source/MODEL/couplings1.f b/epochX/cudacpp/nobm_pp_ttW.mad/Source/MODEL/couplings1.f index 04b640a980..eecf80afa7 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/Source/MODEL/couplings1.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/Source/MODEL/couplings1.f @@ -7,12 +7,13 @@ SUBROUTINE COUP1( ) IMPLICIT NONE INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' GC_100 = (MDL_EE*MDL_COMPLEXI*MDL_CONJG__CKM1X1)/(MDL_SW $ *MDL_SQRT__2) diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/Source/MODEL/couplings2.f b/epochX/cudacpp/nobm_pp_ttW.mad/Source/MODEL/couplings2.f index be9e9f5a39..30f3a04e3b 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/Source/MODEL/couplings2.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/Source/MODEL/couplings2.f @@ -2,18 +2,17 @@ c written by the UFO converter ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc - SUBROUTINE COUP2( VECID) + SUBROUTINE COUP2( ) IMPLICIT NONE - INTEGER VECID + INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' - GC_10(VECID) = -G - GC_11(VECID) = MDL_COMPLEXI*G END diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/Source/MODEL/makefile b/epochX/cudacpp/nobm_pp_ttW.mad/Source/MODEL/makefile index 0b24445a53..5a5681d220 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/Source/MODEL/makefile +++ b/epochX/cudacpp/nobm_pp_ttW.mad/Source/MODEL/makefile @@ -3,7 +3,7 @@ # Makefile for model library # # ---------------------------------------------------------------------------- - +# template models/template_files/makefile_madevent # Check for ../make_opts ifeq ($(wildcard ../make_opts), ../make_opts) include ../make_opts diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/Source/MODEL/makeinc.inc b/epochX/cudacpp/nobm_pp_ttW.mad/Source/MODEL/makeinc.inc index 6e2743eac1..4a9e1b2cc5 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/Source/MODEL/makeinc.inc +++ b/epochX/cudacpp/nobm_pp_ttW.mad/Source/MODEL/makeinc.inc @@ -2,4 +2,4 @@ # written by the UFO converter ############################################################################# -MODEL = couplings.o lha_read.o printout.o rw_para.o model_functions.o couplings1.o couplings2.o \ No newline at end of file +MODEL = couplings.o lha_read.o printout.o rw_para.o model_functions.o couplings1.o couplings2.o couplings3.o \ No newline at end of file diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/Source/MODEL/printout.f b/epochX/cudacpp/nobm_pp_ttW.mad/Source/MODEL/printout.f index 18b8f35b08..3e195b03a2 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/Source/MODEL/printout.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/Source/MODEL/printout.f @@ -1,3 +1,7 @@ +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +c written by the UFO converter +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc + c************************************************************************ c** ** c** MadGraph/MadEvent Interface to FeynRules ** @@ -9,7 +13,7 @@ subroutine printout implicit none - include '../vector.inc' ! defines VECSIZE_MEMMAX + include '../vector.inc' ! VECSIZE_MEMMAX (needed by coupl.inc) include 'coupl.inc' ! needs VECSIZE_MEMMAX (defined in vector.inc) include 'input.inc' diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/Source/PDF/eepdf.inc b/epochX/cudacpp/nobm_pp_ttW.mad/Source/PDF/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/Source/PDF/eepdf.inc +++ b/epochX/cudacpp/nobm_pp_ttW.mad/Source/PDF/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/Source/PDF/pdfwrap_emela.f b/epochX/cudacpp/nobm_pp_ttW.mad/Source/PDF/pdfwrap_emela.f index bce10819d5..da1e4e2276 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/Source/PDF/pdfwrap_emela.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/Source/PDF/pdfwrap_emela.f @@ -13,7 +13,7 @@ SUBROUTINE PDFWRAP DOUBLE PRECISION VALUE(20) REAL*8 ALPHASPDF EXTERNAL ALPHASPDF - ! PDFs with beamstrahlung use specific initialisation/evaluation +C PDFs with beamstrahlung use specific initialisation/evaluation LOGICAL HAS_BSTRAHL COMMON /TO_HAS_BS/ HAS_BSTRAHL diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/Source/PDF/pdg2pdf.f b/epochX/cudacpp/nobm_pp_ttW.mad/Source/PDF/pdg2pdf.f index 46f321e66b..2e7343a69b 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/Source/PDF/pdg2pdf.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/Source/PDF/pdg2pdf.f @@ -108,7 +108,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) else if (abs(ipart).eq.10) then ipart = sign(1,ipart) * 15 endif - pdg2pdf = 0d0 + pdg2pdf = 0d0 if (beamid.lt.0) then ih_local = ipart @@ -122,7 +122,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) endif do i_ee = 1, n_ee ee_components(i_ee) = compute_eepdf(x,omx_ee(iabs(beamid)),xmu,i_ee,ipart,ih_local) - enddo + enddo pdg2pdf = ee_components(1) ! temporary to test pdf load c write(*,*), x, beamid ,omx_ee(iabs(beamid)),xmu,1,ipart,ih_local,pdg2pdf return diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/Source/dsample.f b/epochX/cudacpp/nobm_pp_ttW.mad/Source/dsample.f index 09d482b45a..b0bc0547ad 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/Source/dsample.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/Source/dsample.f @@ -204,6 +204,9 @@ subroutine sample_full(ndim,ncall,itmax,itmin,dsig,ninvar,nconfigs,VECSIZE_USED) if (VECSIZE_USED.le.1) then all_fx(1) = dsig(all_p, all_wgt,0) + ivec=0 + ilock=0 + iwarp=1 else c Here "i" is the position in the full grid of the event do i=(iwarp-1)*WARP_SIZE+1, iwarp*warp_size diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/Source/eepdf.inc b/epochX/cudacpp/nobm_pp_ttW.mad/Source/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/Source/eepdf.inc +++ b/epochX/cudacpp/nobm_pp_ttW.mad/Source/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/Source/genps.inc b/epochX/cudacpp/nobm_pp_ttW.mad/Source/genps.inc index af7e0efbce..ef78e7e812 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/Source/genps.inc +++ b/epochX/cudacpp/nobm_pp_ttW.mad/Source/genps.inc @@ -29,9 +29,8 @@ c parameter (max_host=99,maxplace=199,maxpoints=100,maxans=50) c************************************************************************* c Parameters for helicity sums in matrixN.f c************************************************************************* - REAL*8 LIMHEL -c PARAMETER(LIMHEL=1e-8) ! ME threshold for helicity filtering (Fortran default) - PARAMETER(LIMHEL=0) ! ME threshold for helicity filtering (force Fortran to mimic cudacpp, see #419) +c REAL*8 LIMHEL +c PARAMETER(LIMHEL=1e-8) -> pass in the run_card.dat INTEGER MAXTRIES PARAMETER(MAXTRIES=25) C To pass the helicity configuration chosen by the DiscreteSampler to diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/Source/run.inc b/epochX/cudacpp/nobm_pp_ttW.mad/Source/run.inc index 5433a23583..81c8df6bf2 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/Source/run.inc +++ b/epochX/cudacpp/nobm_pp_ttW.mad/Source/run.inc @@ -106,4 +106,7 @@ c double precision tmin_for_channel integer sde_strat ! 1 means standard single diagram enhancement strategy, c 2 means approximation by the denominator of the propagator - common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat \ No newline at end of file + common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat +c + double precision limhel + common/to_limhel/limhel diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/Source/run_card.inc b/epochX/cudacpp/nobm_pp_ttW.mad/Source/run_card.inc index 22d8b7aaa9..2588190439 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/Source/run_card.inc +++ b/epochX/cudacpp/nobm_pp_ttW.mad/Source/run_card.inc @@ -88,6 +88,8 @@ DSQRT_SHAT = 0.000000000000000D+00 + LIMHEL = 0.000000000000000D+00 + PTJ = 2.000000000000000D+01 PTB = 0.000000000000000D+00 diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/Source/setrun.f b/epochX/cudacpp/nobm_pp_ttW.mad/Source/setrun.f index 9e9ef7fdbd..dc6caef748 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/Source/setrun.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/Source/setrun.f @@ -162,9 +162,21 @@ subroutine setrun C Fill common block for Les Houches init info do i=1,2 if(lpp(i).eq.1.or.lpp(i).eq.2) then - idbmup(i)=2212 + if (nb_proton(i).eq.1.and.nb_neutron(i).eq.0) then + idbmup(i)=2212 + elseif (nb_proton(i).eq.0.and.nb_neutron(i).eq.1) then + idbmup(i)=2112 + else + idbmup(i) = 1000000000 + (nb_proton(i)+nb_neutron(i))*10 + $ + nb_proton(i)*10000 + endif elseif(lpp(i).eq.-1.or.lpp(i).eq.-2) then - idbmup(i)=-2212 + if (nb_proton(i).eq.1.and.nb_neutron(i).eq.0) then + idbmup(i)=-2212 + else + idbmup(i) = -1*(1000000000 + (nb_proton(i)+nb_neutron(i))*10 + $ + nb_proton(i)*10000) + endif elseif(lpp(i).eq.3) then idbmup(i)=11 elseif(lpp(i).eq.-3) then diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/MGVersion.txt b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/MGVersion.txt index 9d3a5c0ba0..a806d3938c 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/MGVersion.txt +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/MGVersion.txt @@ -1 +1 @@ -3.5.3_lo_vect \ No newline at end of file +3.6.0_lo_vect \ No newline at end of file diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_dux_ttxwm/CPPProcess.cc b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_dux_ttxwm/CPPProcess.cc index e38b43e7f3..14e10e47fc 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_dux_ttxwm/CPPProcess.cc +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_dux_ttxwm/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_dux_ttxwm/CPPProcess.h b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_dux_ttxwm/CPPProcess.h index 79e7b1b6fc..20e49fe614 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_dux_ttxwm/CPPProcess.h +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_dux_ttxwm/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_dux_ttxwm/auto_dsig.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_dux_ttxwm/auto_dsig.f index 33b5b1c440..5891689dfa 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_dux_ttxwm/auto_dsig.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_dux_ttxwm/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1135,11 +1135,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=48) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1149,32 +1150,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=48) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=48) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_dux_ttxwm/auto_dsig1.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_dux_ttxwm/auto_dsig1.f index a13eea8546..270de18021 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_dux_ttxwm/auto_dsig1.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_dux_ttxwm/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -102,6 +102,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -223,7 +225,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -288,7 +290,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -327,9 +329,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -345,6 +348,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -502,11 +507,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -606,9 +606,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -753,3 +755,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_dux_ttxwm/driver.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_dux_ttxwm/driver.f index 57ea01dbd8..531dfa0771 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_dux_ttxwm/driver.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_dux_ttxwm/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_dux_ttxwm/matrix1.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_dux_ttxwm/matrix1.f index a5685fa4f7..d62b9b396d 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_dux_ttxwm/matrix1.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_dux_ttxwm/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -24,6 +24,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=48) INTEGER NGRAPHS @@ -47,8 +49,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -57,26 +59,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -87,7 +86,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -97,26 +95,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,5) / 1,-1,-1, 1, 1/ DATA (NHEL(I, 2),I=1,5) / 1,-1,-1, 1, 0/ DATA (NHEL(I, 3),I=1,5) / 1,-1,-1, 1,-1/ @@ -176,8 +173,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -186,11 +182,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=2 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=2 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -200,16 +196,16 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) - ! handling only one beam polarization here. Second beam can be handle via the pdf. +C handling only one beam polarization here. Second beam can +C be handle via the pdf. IF(POL(2).NE.1D0.AND.NHEL(2,I).EQ.INT(SIGN(1D0,POL(2)))) $ THEN T=T*ABS(POL(2)) @@ -224,7 +220,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -253,35 +250,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -294,7 +289,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) - ! handling only one beam polarization here. Second beam can be handle via the pdf. +C handling only one beam polarization here. Second beam can be +C handle via the pdf. IF(POL(2).NE.1D0.AND.NHEL(2,I).EQ.INT(SIGN(1D0,POL(2)))) THEN T=T*ABS(POL(2)) ELSE IF(POL(2).NE.1D0)THEN @@ -359,7 +355,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_udx_ttxwp/CPPProcess.cc b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_udx_ttxwp/CPPProcess.cc index 0541cd1591..2dd6b7e9c8 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_udx_ttxwp/CPPProcess.cc +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_udx_ttxwp/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_udx_ttxwp/CPPProcess.h b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_udx_ttxwp/CPPProcess.h index 3296b2d643..341673e627 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_udx_ttxwp/CPPProcess.h +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_udx_ttxwp/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_udx_ttxwp/auto_dsig.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_udx_ttxwp/auto_dsig.f index 743426de24..4c2829fa46 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_udx_ttxwp/auto_dsig.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_udx_ttxwp/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1135,11 +1135,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=48) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1149,32 +1150,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=48) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=48) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_udx_ttxwp/auto_dsig1.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_udx_ttxwp/auto_dsig1.f index 86d5f78001..83f18c6ff4 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_udx_ttxwp/auto_dsig1.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_udx_ttxwp/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -102,6 +102,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -223,7 +225,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -288,7 +290,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -327,9 +329,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -345,6 +348,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -502,11 +507,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -606,9 +606,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -753,3 +755,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_udx_ttxwp/driver.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_udx_ttxwp/driver.f index 57ea01dbd8..531dfa0771 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_udx_ttxwp/driver.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_udx_ttxwp/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_udx_ttxwp/matrix1.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_udx_ttxwp/matrix1.f index d3f67221a5..cea81c4d0d 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_udx_ttxwp/matrix1.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P0_udx_ttxwp/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -24,6 +24,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=48) INTEGER NGRAPHS @@ -47,8 +49,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -57,26 +59,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -87,7 +86,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -97,26 +95,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,5) / 1,-1,-1, 1,-1/ DATA (NHEL(I, 2),I=1,5) / 1,-1,-1, 1, 0/ DATA (NHEL(I, 3),I=1,5) / 1,-1,-1, 1, 1/ @@ -176,8 +173,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -186,11 +182,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=2 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=2 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -200,16 +196,16 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) - ! handling only one beam polarization here. Second beam can be handle via the pdf. +C handling only one beam polarization here. Second beam can +C be handle via the pdf. IF(POL(2).NE.1D0.AND.NHEL(2,I).EQ.INT(SIGN(1D0,POL(2)))) $ THEN T=T*ABS(POL(2)) @@ -224,7 +220,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -253,35 +250,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -294,7 +289,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) - ! handling only one beam polarization here. Second beam can be handle via the pdf. +C handling only one beam polarization here. Second beam can be +C handle via the pdf. IF(POL(2).NE.1D0.AND.NHEL(2,I).EQ.INT(SIGN(1D0,POL(2)))) THEN T=T*ABS(POL(2)) ELSE IF(POL(2).NE.1D0)THEN @@ -359,7 +355,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_dux_ttxwmg/CPPProcess.cc b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_dux_ttxwmg/CPPProcess.cc index fc9b6764e6..2a7368ed83 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_dux_ttxwmg/CPPProcess.cc +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_dux_ttxwmg/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_dux_ttxwmg/CPPProcess.h b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_dux_ttxwmg/CPPProcess.h index 073939ee63..bfd92ecff3 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_dux_ttxwmg/CPPProcess.h +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_dux_ttxwmg/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_dux_ttxwmg/auto_dsig.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_dux_ttxwmg/auto_dsig.f index 5826d24723..396df04429 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_dux_ttxwmg/auto_dsig.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_dux_ttxwmg/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1135,11 +1135,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=96) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1149,32 +1150,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=96) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=96) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_dux_ttxwmg/auto_dsig1.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_dux_ttxwmg/auto_dsig1.f index 7902f12b15..bb5e721ed6 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_dux_ttxwmg/auto_dsig1.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_dux_ttxwmg/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -102,6 +102,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -223,7 +225,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -288,7 +290,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -327,9 +329,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -345,6 +348,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -502,11 +507,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -606,9 +606,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -801,3 +803,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_dux_ttxwmg/driver.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_dux_ttxwmg/driver.f index 9ff47ec544..d8518f17f7 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_dux_ttxwmg/driver.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_dux_ttxwmg/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_dux_ttxwmg/matrix1.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_dux_ttxwmg/matrix1.f index 15384201fd..122483e42d 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_dux_ttxwmg/matrix1.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_dux_ttxwmg/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -24,6 +24,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=96) INTEGER NGRAPHS @@ -47,8 +49,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -57,26 +59,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -87,7 +86,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -97,26 +95,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,6) / 1,-1,-1, 1, 1,-1/ DATA (NHEL(I, 2),I=1,6) / 1,-1,-1, 1, 1, 1/ DATA (NHEL(I, 3),I=1,6) / 1,-1,-1, 1, 0,-1/ @@ -224,8 +221,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -234,11 +230,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=4 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=4 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -248,16 +244,16 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) - ! handling only one beam polarization here. Second beam can be handle via the pdf. +C handling only one beam polarization here. Second beam can +C be handle via the pdf. IF(POL(2).NE.1D0.AND.NHEL(2,I).EQ.INT(SIGN(1D0,POL(2)))) $ THEN T=T*ABS(POL(2)) @@ -272,7 +268,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -301,35 +298,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -342,7 +337,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) - ! handling only one beam polarization here. Second beam can be handle via the pdf. +C handling only one beam polarization here. Second beam can be +C handle via the pdf. IF(POL(2).NE.1D0.AND.NHEL(2,I).EQ.INT(SIGN(1D0,POL(2)))) THEN T=T*ABS(POL(2)) ELSE IF(POL(2).NE.1D0)THEN @@ -407,7 +403,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gd_ttxwmu/CPPProcess.cc b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gd_ttxwmu/CPPProcess.cc index 639e6e3b52..fbcc691644 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gd_ttxwmu/CPPProcess.cc +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gd_ttxwmu/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gd_ttxwmu/CPPProcess.h b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gd_ttxwmu/CPPProcess.h index 63b5815ea8..6d0f6f6b2e 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gd_ttxwmu/CPPProcess.h +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gd_ttxwmu/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gd_ttxwmu/auto_dsig.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gd_ttxwmu/auto_dsig.f index c3d0230022..5ffdcf9830 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gd_ttxwmu/auto_dsig.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gd_ttxwmu/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1135,11 +1135,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=96) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1149,32 +1150,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=96) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=96) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gd_ttxwmu/auto_dsig1.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gd_ttxwmu/auto_dsig1.f index eea411d970..30a102ffc6 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gd_ttxwmu/auto_dsig1.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gd_ttxwmu/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -102,6 +102,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -222,7 +224,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -287,7 +289,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -326,9 +328,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -344,6 +347,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -499,11 +504,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -603,9 +603,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -798,3 +800,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gd_ttxwmu/driver.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gd_ttxwmu/driver.f index 9ff47ec544..d8518f17f7 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gd_ttxwmu/driver.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gd_ttxwmu/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gd_ttxwmu/matrix1.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gd_ttxwmu/matrix1.f index 3884a841e5..b9fc08afab 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gd_ttxwmu/matrix1.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gd_ttxwmu/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -24,6 +24,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=96) INTEGER NGRAPHS @@ -47,8 +49,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -57,26 +59,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -87,7 +86,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -97,26 +95,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,6) /-1, 1,-1, 1, 1,-1/ DATA (NHEL(I, 2),I=1,6) /-1, 1,-1, 1, 1, 1/ DATA (NHEL(I, 3),I=1,6) /-1, 1,-1, 1, 0,-1/ @@ -224,8 +221,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -234,11 +230,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=4 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=4 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -248,16 +244,16 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) - ! handling only one beam polarization here. Second beam can be handle via the pdf. +C handling only one beam polarization here. Second beam can +C be handle via the pdf. IF(POL(2).NE.1D0.AND.NHEL(2,I).EQ.INT(SIGN(1D0,POL(2)))) $ THEN T=T*ABS(POL(2)) @@ -272,7 +268,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -301,35 +298,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -342,7 +337,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) - ! handling only one beam polarization here. Second beam can be handle via the pdf. +C handling only one beam polarization here. Second beam can be +C handle via the pdf. IF(POL(2).NE.1D0.AND.NHEL(2,I).EQ.INT(SIGN(1D0,POL(2)))) THEN T=T*ABS(POL(2)) ELSE IF(POL(2).NE.1D0)THEN @@ -407,7 +403,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gdx_ttxwpux/CPPProcess.cc b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gdx_ttxwpux/CPPProcess.cc index 7722a4930f..37d6632f2d 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gdx_ttxwpux/CPPProcess.cc +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gdx_ttxwpux/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gdx_ttxwpux/CPPProcess.h b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gdx_ttxwpux/CPPProcess.h index c9ef36c99e..7ecf7fb4f2 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gdx_ttxwpux/CPPProcess.h +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gdx_ttxwpux/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gdx_ttxwpux/auto_dsig.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gdx_ttxwpux/auto_dsig.f index 6c6b6e46be..2fb389e215 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gdx_ttxwpux/auto_dsig.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gdx_ttxwpux/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1135,11 +1135,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=96) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1149,32 +1150,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=96) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=96) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gdx_ttxwpux/auto_dsig1.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gdx_ttxwpux/auto_dsig1.f index 4aaf959523..89f373b168 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gdx_ttxwpux/auto_dsig1.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gdx_ttxwpux/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -102,6 +102,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -222,7 +224,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -287,7 +289,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -326,9 +328,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -344,6 +347,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -499,11 +504,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -603,9 +603,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -798,3 +800,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gdx_ttxwpux/driver.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gdx_ttxwpux/driver.f index 9ff47ec544..d8518f17f7 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gdx_ttxwpux/driver.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gdx_ttxwpux/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gdx_ttxwpux/matrix1.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gdx_ttxwpux/matrix1.f index 9e94386d22..57c105fffc 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gdx_ttxwpux/matrix1.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gdx_ttxwpux/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -24,6 +24,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=96) INTEGER NGRAPHS @@ -47,8 +49,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -57,26 +59,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -87,7 +86,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -97,26 +95,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,6) /-1,-1,-1, 1,-1, 1/ DATA (NHEL(I, 2),I=1,6) /-1,-1,-1, 1,-1,-1/ DATA (NHEL(I, 3),I=1,6) /-1,-1,-1, 1, 0, 1/ @@ -224,8 +221,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -234,11 +230,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=4 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=4 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -248,16 +244,16 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) - ! handling only one beam polarization here. Second beam can be handle via the pdf. +C handling only one beam polarization here. Second beam can +C be handle via the pdf. IF(POL(2).NE.1D0.AND.NHEL(2,I).EQ.INT(SIGN(1D0,POL(2)))) $ THEN T=T*ABS(POL(2)) @@ -272,7 +268,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -301,35 +298,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -342,7 +337,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) - ! handling only one beam polarization here. Second beam can be handle via the pdf. +C handling only one beam polarization here. Second beam can be +C handle via the pdf. IF(POL(2).NE.1D0.AND.NHEL(2,I).EQ.INT(SIGN(1D0,POL(2)))) THEN T=T*ABS(POL(2)) ELSE IF(POL(2).NE.1D0)THEN @@ -407,7 +403,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gu_ttxwpd/CPPProcess.cc b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gu_ttxwpd/CPPProcess.cc index 9740f08230..f0626d1178 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gu_ttxwpd/CPPProcess.cc +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gu_ttxwpd/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gu_ttxwpd/CPPProcess.h b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gu_ttxwpd/CPPProcess.h index 925ea70c59..38a61439fa 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gu_ttxwpd/CPPProcess.h +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gu_ttxwpd/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gu_ttxwpd/auto_dsig.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gu_ttxwpd/auto_dsig.f index 10677eec81..529ea9ac57 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gu_ttxwpd/auto_dsig.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gu_ttxwpd/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1135,11 +1135,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=96) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1149,32 +1150,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=96) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=96) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gu_ttxwpd/auto_dsig1.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gu_ttxwpd/auto_dsig1.f index 635d50d915..c05076fb2e 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gu_ttxwpd/auto_dsig1.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gu_ttxwpd/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -102,6 +102,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -222,7 +224,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -287,7 +289,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -326,9 +328,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -344,6 +347,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -499,11 +504,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -603,9 +603,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -798,3 +800,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gu_ttxwpd/driver.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gu_ttxwpd/driver.f index 9ff47ec544..d8518f17f7 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gu_ttxwpd/driver.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gu_ttxwpd/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gu_ttxwpd/matrix1.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gu_ttxwpd/matrix1.f index f58f1a225f..f61d71c2bc 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gu_ttxwpd/matrix1.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gu_ttxwpd/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -24,6 +24,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=96) INTEGER NGRAPHS @@ -47,8 +49,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -57,26 +59,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -87,7 +86,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -97,26 +95,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,6) /-1, 1,-1, 1,-1,-1/ DATA (NHEL(I, 2),I=1,6) /-1, 1,-1, 1,-1, 1/ DATA (NHEL(I, 3),I=1,6) /-1, 1,-1, 1, 0,-1/ @@ -224,8 +221,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -234,11 +230,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=4 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=4 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -248,16 +244,16 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) - ! handling only one beam polarization here. Second beam can be handle via the pdf. +C handling only one beam polarization here. Second beam can +C be handle via the pdf. IF(POL(2).NE.1D0.AND.NHEL(2,I).EQ.INT(SIGN(1D0,POL(2)))) $ THEN T=T*ABS(POL(2)) @@ -272,7 +268,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -301,35 +298,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -342,7 +337,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) - ! handling only one beam polarization here. Second beam can be handle via the pdf. +C handling only one beam polarization here. Second beam can be +C handle via the pdf. IF(POL(2).NE.1D0.AND.NHEL(2,I).EQ.INT(SIGN(1D0,POL(2)))) THEN T=T*ABS(POL(2)) ELSE IF(POL(2).NE.1D0)THEN @@ -407,7 +403,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gux_ttxwmdx/CPPProcess.cc b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gux_ttxwmdx/CPPProcess.cc index 4790c0ae01..71184b0eda 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gux_ttxwmdx/CPPProcess.cc +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gux_ttxwmdx/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gux_ttxwmdx/CPPProcess.h b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gux_ttxwmdx/CPPProcess.h index 18d9b3a4bc..17ec79ccb1 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gux_ttxwmdx/CPPProcess.h +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gux_ttxwmdx/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gux_ttxwmdx/auto_dsig.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gux_ttxwmdx/auto_dsig.f index f4bc3efd94..d0608f110f 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gux_ttxwmdx/auto_dsig.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gux_ttxwmdx/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1135,11 +1135,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=96) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1149,32 +1150,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=96) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=96) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gux_ttxwmdx/auto_dsig1.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gux_ttxwmdx/auto_dsig1.f index 0679fc876b..34376363c9 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gux_ttxwmdx/auto_dsig1.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gux_ttxwmdx/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -102,6 +102,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -222,7 +224,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -287,7 +289,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -326,9 +328,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -344,6 +347,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -499,11 +504,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -603,9 +603,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -798,3 +800,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gux_ttxwmdx/driver.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gux_ttxwmdx/driver.f index 9ff47ec544..d8518f17f7 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gux_ttxwmdx/driver.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gux_ttxwmdx/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gux_ttxwmdx/matrix1.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gux_ttxwmdx/matrix1.f index 6ce9435143..dfac31811b 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gux_ttxwmdx/matrix1.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_gux_ttxwmdx/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -24,6 +24,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=96) INTEGER NGRAPHS @@ -47,8 +49,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -57,26 +59,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -87,7 +86,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -97,26 +95,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,6) /-1,-1,-1, 1, 1, 1/ DATA (NHEL(I, 2),I=1,6) /-1,-1,-1, 1, 1,-1/ DATA (NHEL(I, 3),I=1,6) /-1,-1,-1, 1, 0, 1/ @@ -224,8 +221,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -234,11 +230,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=4 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=4 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -248,16 +244,16 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) - ! handling only one beam polarization here. Second beam can be handle via the pdf. +C handling only one beam polarization here. Second beam can +C be handle via the pdf. IF(POL(2).NE.1D0.AND.NHEL(2,I).EQ.INT(SIGN(1D0,POL(2)))) $ THEN T=T*ABS(POL(2)) @@ -272,7 +268,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -301,35 +298,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -342,7 +337,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) - ! handling only one beam polarization here. Second beam can be handle via the pdf. +C handling only one beam polarization here. Second beam can be +C handle via the pdf. IF(POL(2).NE.1D0.AND.NHEL(2,I).EQ.INT(SIGN(1D0,POL(2)))) THEN T=T*ABS(POL(2)) ELSE IF(POL(2).NE.1D0)THEN @@ -407,7 +403,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_udx_ttxwpg/CPPProcess.cc b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_udx_ttxwpg/CPPProcess.cc index 03315c9b9c..c2a3e42ac6 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_udx_ttxwpg/CPPProcess.cc +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_udx_ttxwpg/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_udx_ttxwpg/CPPProcess.h b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_udx_ttxwpg/CPPProcess.h index f87264b065..ea33cce2b1 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_udx_ttxwpg/CPPProcess.h +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_udx_ttxwpg/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_udx_ttxwpg/auto_dsig.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_udx_ttxwpg/auto_dsig.f index 018e3a69ea..3ab40bf574 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_udx_ttxwpg/auto_dsig.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_udx_ttxwpg/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1135,11 +1135,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=96) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1149,32 +1150,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=96) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=96) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_udx_ttxwpg/auto_dsig1.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_udx_ttxwpg/auto_dsig1.f index 05cce0a465..f465e93055 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_udx_ttxwpg/auto_dsig1.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_udx_ttxwpg/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -102,6 +102,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -223,7 +225,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -288,7 +290,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -327,9 +329,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -345,6 +348,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -502,11 +507,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -606,9 +606,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -801,3 +803,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_udx_ttxwpg/driver.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_udx_ttxwpg/driver.f index 9ff47ec544..d8518f17f7 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_udx_ttxwpg/driver.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_udx_ttxwpg/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_udx_ttxwpg/matrix1.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_udx_ttxwpg/matrix1.f index f441ba2a6f..3bcf9d58c1 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_udx_ttxwpg/matrix1.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/P1_udx_ttxwpg/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -24,6 +24,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=96) INTEGER NGRAPHS @@ -47,8 +49,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -57,26 +59,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -87,7 +86,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -97,26 +95,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,6) / 1,-1,-1, 1,-1,-1/ DATA (NHEL(I, 2),I=1,6) / 1,-1,-1, 1,-1, 1/ DATA (NHEL(I, 3),I=1,6) / 1,-1,-1, 1, 0,-1/ @@ -224,8 +221,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -234,11 +230,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=4 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=4 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -248,16 +244,16 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) - ! handling only one beam polarization here. Second beam can be handle via the pdf. +C handling only one beam polarization here. Second beam can +C be handle via the pdf. IF(POL(2).NE.1D0.AND.NHEL(2,I).EQ.INT(SIGN(1D0,POL(2)))) $ THEN T=T*ABS(POL(2)) @@ -272,7 +268,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -301,35 +298,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -342,7 +337,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) - ! handling only one beam polarization here. Second beam can be handle via the pdf. +C handling only one beam polarization here. Second beam can be +C handle via the pdf. IF(POL(2).NE.1D0.AND.NHEL(2,I).EQ.INT(SIGN(1D0,POL(2)))) THEN T=T*ABS(POL(2)) ELSE IF(POL(2).NE.1D0)THEN @@ -407,7 +403,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/cluster.f b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/cluster.f index 649e46f4e9..b8995283ed 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/cluster.f +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/cluster.f @@ -552,6 +552,8 @@ logical function cluster(p, ivec) if (btest(mlevel,1)) $ write (*,*)'New event' + iwin = 0 + jwin = 0 cluster=.false. clustered=.false. do i=0,3 @@ -663,7 +665,8 @@ logical function cluster(p, ivec) c initialize graph storage igraphs(0)=0 nleft=nexternal -c cluster +c cluster + if (iwin.eq.0.or.jwin.eq.0) stop 21 do n=1,nexternal-2 c combine winner imocl(n)=imap(iwin,2)+imap(jwin,2) diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/proc_characteristics b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/proc_characteristics index a5b0c16e13..ee4c9d4276 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/proc_characteristics +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/proc_characteristics @@ -17,6 +17,8 @@ splitting_types = [] perturbation_order = [] limitations = [] + ew_sudakov = False hel_recycling = False single_color = False nlo_mixed_expansion = True + gauge = unitary diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/refine.sh b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/refine.sh index afb9b99ad1..b46170ba23 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/refine.sh +++ b/epochX/cudacpp/nobm_pp_ttW.mad/SubProcesses/refine.sh @@ -57,7 +57,11 @@ j=%(directory)s for((try=1;try<=16;try+=1)); do if [ "$keeplog" = true ] ; then + if [[ -e ../madevent ]];then ../madevent 2>&1 >> $k &1 >> $k &1 >> log.txt &1 >> log.txt &1 >> $k \w*)>') - pat_end=re.compile('\w*)>') + pat_begin=re.compile(r'<(?P\w*)>') + pat_end=re.compile(r'\w*)>') tag_to_file={'slha':'param_card.dat', 'mgruncard':'run_card.dat', @@ -319,7 +319,7 @@ def check_pid(self, pid2label): def get_lha_strategy(self): """get the lha_strategy: how the weight have to be handle by the shower""" - if not self["init"]: + if "init" not in self or not self["init"]: raise Exception("No init block define") data = self["init"].split('\n')[0].split() @@ -537,7 +537,8 @@ def charge_card(self, tag): self.param_card = param_card_reader.ParamCard(param_card) return self.param_card elif tag == 'mgruncard': - self.run_card = RunCard(self[tag], unknown_warning=False) + with misc.TMP_variable(RunCard, 'allow_scan', True): + self.run_card = RunCard(self[tag], consistency=False, unknow_warning=False) return self.run_card elif tag == 'mg5proccard': proc_card = self[tag].split('\n') @@ -976,6 +977,8 @@ class ConfigFile(dict): """ a class for storing/dealing with input file. """ + allow_scan = False + def __init__(self, finput=None, **opt): """initialize a new instance. input can be an instance of MadLoopParam, a file, a path to a file, or simply Nothing""" @@ -993,6 +996,7 @@ def __init__(self, finput=None, **opt): # Initialize it with all the default value self.user_set = set() self.auto_set = set() + self.scan_set = {} #key -> type of list (int/float/bool/str/... for scan self.system_only = set() self.lower_to_case = {} self.list_parameter = {} #key -> type of list (int/float/bool/str/... @@ -1109,6 +1113,8 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): #1. check if the parameter is set to auto -> pass it to special if lower_name in self: targettype = type(dict.__getitem__(self, lower_name)) + if lower_name in self.scan_set: + targettype = self.scan_set[lower_name] if targettype != str and isinstance(value, str) and value.lower() == 'auto': self.auto_set.add(lower_name) if lower_name in self.user_set: @@ -1118,13 +1124,26 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): return elif lower_name in self.auto_set: self.auto_set.remove(lower_name) - + + + #1. check if the parameter is set to auto -> pass it to special + scan_targettype = None + if self.allow_scan and isinstance(value, str) and value.strip().startswith('scan'): + if lower_name in self.user_set: + self.user_set.remove(lower_name) + self.scan_set[lower_name] = type(self[lower_name]) + dict.__setitem__(self, lower_name, value) + #keep old value. + self.post_set(lower_name,value, change_userdefine, raiseerror) + return + elif lower_name in self.scan_set: + scan_targettype = self.scan_set[lower_name] + del self.scan_set[lower_name] + # 2. Find the type of the attribute that we want if lower_name in self.list_parameter: targettype = self.list_parameter[lower_name] - - if isinstance(value, str): # split for each comma/space value = value.strip() @@ -1248,8 +1267,11 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): if change_userdefine: self.user_set.add(lower_name) return self.post_set(lower_name, None, change_userdefine, raiseerror) - elif name in self: - targettype = type(self[name]) + elif name in self: + if scan_targettype: + targettype = targettype + else: + targettype = type(self[name]) else: logger.debug('Trying to add argument %s in %s. ' % (name, self.__class__.__name__) +\ 'This argument is not defined by default. Please consider adding it.') @@ -1262,7 +1284,7 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): if change_userdefine: self.user_set.add(lower_name) return self.post_set(lower_name, None, change_userdefine, raiseerror) - + value = self.format_variable(value, targettype, name=name) #check that the value is allowed: if lower_name in self.allowed_value and '*' not in self.allowed_value[lower_name]: @@ -1444,7 +1466,7 @@ def format_variable(value, targettype, name="unknown"): value =int(value[:-1]) * convert[value[-1]] elif '/' in value or '*' in value: try: - split = re.split('(\*|/)',value) + split = re.split(r'(\*|/)',value) v = float(split[0]) for i in range((len(split)//2)): if split[2*i+1] == '*': @@ -1482,7 +1504,7 @@ def format_variable(value, targettype, name="unknown"): value = float(value) except ValueError: try: - split = re.split('(\*|/)',value) + split = re.split(r'(\*|/)',value) v = float(split[0]) for i in range((len(split)//2)): if split[2*i+1] == '*': @@ -1491,7 +1513,10 @@ def format_variable(value, targettype, name="unknown"): v /= float(split[2*i+2]) except: v=0 - raise InvalidCmd("%s can not be mapped to a float" % value) + if "scan" in value: + raise InvalidCmd("%s is not supported here. Note that scan command can not be present simultaneously in the run_card and param_card." % value) + else: + raise InvalidCmd("%s can not be mapped to a float" % value) finally: value = v else: @@ -1737,10 +1762,12 @@ def default_setup(self): self.add_param('splitting_types',[], typelist=str) self.add_param('perturbation_order', [], typelist=str) self.add_param('limitations', [], typelist=str) + self.add_param('ew_sudakov', False) self.add_param('hel_recycling', False) self.add_param('single_color', True) self.add_param('nlo_mixed_expansion', True) - + self.add_param('gauge', 'U') + def read(self, finput): """Read the input file, this can be a path to a file, a file object, a str with the content of the file.""" @@ -3104,7 +3131,7 @@ def write(self, output_file, template=None, python_template=False, # do not write hidden parameter not hidden for this template # if python_template: - written = written.union(set(re.findall('\%\((\w*)\)s', open(template,'r').read(), re.M))) + written = written.union(set(re.findall(r'\%\((\w*)\)s', open(template,'r').read(), re.M))) to_write = to_write.union(set(self.hidden_param)) to_write = to_write.difference(written) @@ -3157,7 +3184,6 @@ def get_value_from_include(self, path, list_of_params, output_dir): if path does not exists return the current value in self for all parameter""" #WARNING DOES NOT HANDLE LIST/DICT so far - misc.sprint(output_dir, path) # handle case where file is missing if not os.path.exists(pjoin(output_dir,path)): misc.sprint("include file not existing", pjoin(output_dir,path)) @@ -3259,7 +3285,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): text = open(path,'r').read() #misc.sprint(text) f77_type = ['real*8', 'integer', 'double precision', 'logical'] - pattern = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I+re.M) for fct in pattern.findall(text): fsock = file_writers.FortranWriter(tmp,'w') @@ -3287,6 +3313,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): starttext = open(pjoin(outdir, path+'.orig')).read() fsock.remove_routine(starttext, to_mod[path][0]) for text in to_mod[path][1]: + text = self.retro_compatible_custom_fct(text) fsock.writelines(text) fsock.close() if not filecmp.cmp(pjoin(outdir, path), pjoin(outdir, path+'.tmp')): @@ -3303,7 +3330,33 @@ def edit_dummy_fct_from_file(self, filelist, outdir): files.mv(pjoin(outdir,path+'.orig'), pjoin(outdir, path)) + @staticmethod + def retro_compatible_custom_fct(lines, mode=None): + f77_type = ['real*8', 'integer', 'double precision', 'logical'] + function_pat = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + % {'type':'|'.join(f77_type)}, re.I+re.M) + include_pat = re.compile(r"\s+include\s+[\'\"]([\w\./]*)") + + assert isinstance(lines, list) + sol = [] + + if mode is None or 'vector.inc' in mode: + search = True + for i,line in enumerate(lines[:]): + if search and re.search(include_pat, line): + name = re.findall(include_pat, line)[0] + misc.sprint('DETECTED INCLUDE', name) + if 'vector.inc' in name: + search = False + if 'run.inc' in name: + sol.append(" include 'vector.inc'") + search = False + sol.append(line) + if re.search(function_pat, line): + misc.sprint("DETECTED FCT") + search = True + return sol def guess_entry_fromname(self, name, value): """ @@ -3346,7 +3399,7 @@ def update_typelist(value, name, opts): #handle metadata opts = {} forced_opts = [] - for key,val in re.findall("\<(?P[_\-\w]+)\=(?P[^>]*)\>", str(name)): + for key,val in re.findall(r"\<(?P[_\-\w]+)\=(?P[^>]*)\>", str(name)): forced_opts.append(key) if val in ['True', 'False']: opts[key] = eval(val) @@ -3681,11 +3734,22 @@ def write_autodef(self, output_dir, output_file=None): out = ["%s\n" %l for l in out] fsock.writelines(out) - @staticmethod - def get_idbmup(lpp): + def get_idbmup(self, lpp, beam=1): """return the particle colliding pdg code""" if lpp in (1,2, -1,-2): - return math.copysign(2212, lpp) + target = 2212 + if 'nb_proton1' in self: + nbp = self['nb_proton%s' % beam] + nbn = self['nb_neutron%s' % beam] + if nbp == 1 and nbn ==0: + target = 2212 + elif nbp==0 and nbn ==1: + target = 2112 + else: + target = 1000000000 + target += 10 * (nbp+nbn) + target += 10000 * nbp + return math.copysign(target, lpp) elif lpp in (3,-3): return math.copysign(11, lpp) elif lpp in (4,-4): @@ -3701,8 +3765,8 @@ def get_banner_init_information(self): the first line of the block of the lhe file.""" output = {} - output["idbmup1"] = self.get_idbmup(self['lpp1']) - output["idbmup2"] = self.get_idbmup(self['lpp2']) + output["idbmup1"] = self.get_idbmup(self['lpp1'], beam=1) + output["idbmup2"] = self.get_idbmup(self['lpp2'], beam=2) output["ebmup1"] = self["ebeam1"] output["ebmup2"] = self["ebeam2"] output["pdfgup1"] = 0 @@ -3959,7 +4023,8 @@ def check_validity(self, card): dict.__setitem__(card, 'pdlabel1', card['pdlabel']) dict.__setitem__(card, 'pdlabel2', card['pdlabel']) - if abs(card['lpp1']) == 1 == abs(card['lpp2']) and card['pdlabel1'] != card['pdlabel2']: + if isinstance(card['lpp1'],int) and isinstance(card['lpp2'],int) and \ + abs(card['lpp1']) == 1 == abs(card['lpp2']) and card['pdlabel1'] != card['pdlabel2']: raise InvalidRunCard("Assymetric beam pdf not supported for proton-proton collision") def status(self, card): @@ -4156,12 +4221,16 @@ def default_setup(self): self.add_param('frame_id', 6, system=True) self.add_param("event_norm", "average", allowed=['sum','average', 'unity'], include=False, sys_default='sum', hidden=True) + self.add_param("keep_log", "normal", include=False, hidden=True, + comment="none: all log send to /dev/null.\n minimal: keep only log for survey of the last run.\n normal: keep only log for survey of all run. \n debug: keep all log (survey and refine)", + allowed=['none', 'minimal', 'normal', 'debug']) #cut self.add_param("auto_ptj_mjj", True, hidden=True) self.add_param("bwcutoff", 15.0) self.add_param("cut_decays", False, cut='d') self.add_param('dsqrt_shat',0., cut=True) self.add_param("nhel", 0, include=False) + self.add_param("limhel", 1e-8, hidden=True, comment="threshold to determine if an helicity contributes when not MC over helicity.") #pt cut self.add_param("ptj", 20.0, cut='j') self.add_param("ptb", 0.0, cut='b') @@ -4842,7 +4911,7 @@ def create_default_for_process(self, proc_characteristic, history, proc_def): # here pick strategy 2 if only one QCD color flow # and for pure multi-jet case jet_id = [21] + list(range(1, self['maxjetflavor']+1)) - if proc_characteristic['single_color']: + if proc_characteristic['gauge'] != 'FD' and proc_characteristic['single_color']: self['sde_strategy'] = 2 #for pure lepton final state go back to sde_strategy=1 pure_lepton=True @@ -5741,9 +5810,10 @@ def check_validity(self): # check that ebeam is bigger than the proton mass. for i in [1,2]: - if self['lpp%s' % i ] not in [1,2]: + # do not for proton mass if not proton PDF (or when scan initialization) + if self['lpp%s' % i ] not in [1,2] or isinstance(self['ebeam%i' % i], str): continue - + if self['ebeam%i' % i] < 0.938: if self['ebeam%i' %i] == 0: logger.warning("At-rest proton mode set: energy beam set to 0.938 GeV") @@ -6193,3 +6263,181 @@ def log_and_update(self, banner, card, par, v): xcard = banner.charge_card(card) xcard[par[0]].param_dict[(par[1],)].value = v xcard.write(os.path.join(self.me_dir, 'Cards', '%s.dat' % card)) + + + + +class RunCardIterator(object): + """A class keeping track of the scan: flag in the param_card and + having an __iter__() function to scan over all the points of the scan. + """ + + logging = True + def __init__(self, input_path=None): + with misc.TMP_variable(RunCard, 'allow_scan', True): + self.run_card = RunCard(input_path, consistency=False) + self.run_card.allow_scan = True + + self.itertag = [] #all the current value use + self.cross = [] # keep track of all the cross-section computed + self.param_order = [] + + def __iter__(self): + """generate the next param_card (in a abstract way) related to the scan. + Technically this generates only the generator.""" + + if hasattr(self, 'iterator'): + return self.iterator + self.iterator = self.iterate() + return self.iterator + + def write(self, path): + self.__iter__.write(path) + + def next(self, autostart=False): + """call the next iteration value""" + try: + iterator = self.iterator + except: + if autostart: + iterator = self.__iter__() + else: + raise + try: + out = next(iterator) + except StopIteration: + del self.iterator + raise + return out + + def iterate(self): + """create the actual generator""" + all_iterators = {} # dictionary of key -> block of object to scan [([param, [values]), ...] + pattern = re.compile(r'''scan\s*(?P\d*)\s*:\s*(?P[^#]*)''', re.I) + + # fill all_iterators with the run_card information + for name in self.run_card.scan_set: + value = self.run_card[name] + try: + key, def_list = pattern.findall(value)[0] + except Exception as error: + misc.sprint(error) + raise Exception("Fail to handle scanning tag in run_card: Please check that the syntax is valid") + if key == '': + key = -1 * len(all_iterators) + if key not in all_iterators: + all_iterators[key] = [] + try: + all_iterators[key].append( (name, eval(def_list))) + except SyntaxError as error: + raise Exception("Fail to handle your scan definition. Please check your syntax:\n entry: %s \n Error reported: %s" %(def_list, error)) + + #prepare to keep track of parameter changing for the report + keys = list(all_iterators.keys()) # need to fix an order for the scan + #store the type of parameter + for key in keys: + for param, values in all_iterators[key]: + self.param_order.append("run_card#%s" % (param)) + + # do the loop + lengths = [list(range(len(all_iterators[key][0][1]))) for key in keys] + from functools import reduce + total = reduce((lambda x, y: x * y),[len(x) for x in lengths]) + for i,positions in enumerate(itertools.product(*lengths)): + self.itertag = [] + if self.logging: + logger.info("Create the next run_card in the scan definition (%s/%s) " %( i+1, total), '$MG:BOLD') + for i, pos in enumerate(positions): + key = keys[i] + for param, values in all_iterators[key]: + # assign the value in the card. + self.run_card[param] = values[pos] + self.itertag.append(values[pos]) + if self.logging: + logger.info("change parameter %s to %s", \ + param, values[pos]) + + + # retrun the current param_card up to next iteration + yield self.run_card + + + def store_entry(self, run_name, cross, error=None, run_card_path=None): + """store the value of the cross-section""" + + if isinstance(cross, dict): + info = dict(cross) + info.update({'bench' : self.itertag, 'run_name': run_name}) + self.cross.append(info) + else: + if error is None: + self.cross.append({'bench' : self.itertag, 'run_name': run_name, 'cross(pb)':cross}) + else: + self.cross.append({'bench' : self.itertag, 'run_name': run_name, 'cross(pb)':cross, 'error(pb)':error}) + + + def write_summary(self, path, order=None, lastline=False, nbcol=20): + """ """ + + if path: + ff = open(path, 'w') + path_events = path.rsplit("/", 1)[0] + #identCard = open(pjoin(path.rsplit("/", 2)[0], "Cards", "ident_card.dat")) + #identLines = identCard.readlines() + #identCard.close() + else: + ff = StringIO.StringIO() + if order: + keys = order + else: + keys = list(self.cross[0].keys()) + if 'bench' in keys: keys.remove('bench') + if 'run_name' in keys: keys.remove('run_name') + keys.sort() + if 'cross(pb)' in keys: + keys.remove('cross(pb)') + keys.append('cross(pb)') + if 'error(pb)' in keys: + keys.remove('error(pb)') + keys.append('error(pb)') + + formatting = "#%s%s%s\n" %('%%-%is ' % (nbcol-1), ('%%-%is ' % (nbcol))* len(self.param_order), + ('%%-%is ' % (nbcol))* len(keys)) + # header + if not lastline: + ff.write(formatting % tuple(['run_name'] + self.param_order + keys)) + formatting = "%s%s%s\n" %('%%-%is ' % (nbcol), ('%%-%ie ' % (nbcol))* len(self.param_order), + ('%%-%ie ' % (nbcol))* len(keys)) + + if not lastline: + to_print = self.cross + else: + to_print = self.cross[-1:] + for info in to_print: + name = info['run_name'] + bench = info['bench'] + data = [] + for k in keys: + if k in info: + data.append(info[k]) + else: + data.append(0.) + ff.write(formatting % tuple([name] + bench + data)) + ff_single = open(pjoin(path_events, name, "params.dat"), "w") + for i_bench in range(0, len(bench)): + ff_single.write(self.param_order[i_bench] + " = " + str(bench[i_bench]) +"\n") + ff_single.close() + + if not path: + return ff.getvalue() + + + def get_next_name(self, run_name): + """returns a smart name for the next run""" + + if '_' in run_name: + name, value = run_name.rsplit('_',1) + if value.isdigit(): + return '%s_%02i' % (name, float(value)+1) + # no valid '_' in the name + return '%s_scan_02' % run_name diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/check_param_card.py b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/check_param_card.py index 71089d7480..bc785b5de6 100755 --- a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/check_param_card.py +++ b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/check_param_card.py @@ -649,7 +649,7 @@ def write_inc_file(self, outpath, identpath, default, need_mp=False): #check if we need to write the value of scale for some block if os.path.exists(input_inc): text = open(input_inc).read() - scales = list(set(re.findall('mdl__(\w*)__scale', text, re.I))) + scales = list(set(re.findall(r'mdl__(\w*)__scale', text, re.I))) else: scales = [] @@ -1000,10 +1000,12 @@ def iterate(self): self.param_order.append("%s#%s" % (param.lhablock, '_'.join(repr(i) for i in param.lhacode))) # do the loop lengths = [list(range(len(all_iterators[key][0][1]))) for key in keys] - for positions in itertools.product(*lengths): + from functools import reduce + total = reduce((lambda x, y: x * y),[len(x) for x in lengths]) + for i,positions in enumerate(itertools.product(*lengths)): self.itertag = [] if self.logging: - logger.info("Create the next param_card in the scan definition", '$MG:BOLD') + logger.info("Create the next param_card in the scan definition (%s/%s)" % (i+1,total), '$MG:BOLD') for i, pos in enumerate(positions): key = keys[i] for param, values in all_iterators[key]: diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/cluster.py b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/cluster.py index 9a893f630d..1ad860e04f 100755 --- a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/cluster.py +++ b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/cluster.py @@ -646,7 +646,10 @@ def worker(self): if os.path.exists(exe) and not exe.startswith('/'): exe = './' + exe if isinstance(opt['stdout'],str): - opt['stdout'] = open(opt['stdout'],'w') + if opt['stdout'] == '/dev/null': + opt['stdout'] = os.open(os.devnull, os.O_RDWR) + else: + opt['stdout'] = open(opt['stdout'],'w') if opt['stderr'] == None: opt['stderr'] = subprocess.STDOUT if arg: @@ -671,11 +674,12 @@ def worker(self): self.pids.put(pid) # the function should return 0 if everything is fine # the error message otherwise - returncode = exe(*arg, **opt) - if returncode != 0: - logger.warning("fct %s does not return 0. Stopping the code in a clean way. The error was:\n%s", exe, returncode) + try: + returncode = exe(*arg, **opt) + except Exception as error: + #logger.warning("fct %s does not return 0. Stopping the code in a clean way. The error was:\n%s", exe, returncode) self.stoprequest.set() - self.remove("fct %s does not return 0:\n %s" % (exe, returncode)) + self.remove("fct %s does raise %s\n %s" % (exe, error)) except Exception as error: self.fail_msg = sys.exc_info() logger.warning(str(error)) @@ -700,7 +704,7 @@ def worker(self): def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, - log=None, required_output=[], nb_submit=0): + log=None, required_output=[], nb_submit=0, python_opts={}): """submit a job on multicore machine""" # open threads if needed @@ -720,7 +724,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, return tag else: # python function - self.queue.put((tag, prog, argument, {})) + self.queue.put((tag, prog, argument, python_opts)) self.submitted.put(1) return tag @@ -908,6 +912,10 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None else: requirement = '' + if 'cluster_walltime' in self.options and self.options['cluster_walltime']\ + and self.options['cluster_walltime'] != 'None': + requirement+='\n MaxRuntime = %s' % self.options['cluster_walltime'] + if cwd is None: cwd = os.getcwd() if stdout is None: @@ -936,7 +944,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None #Submitting job(s). #Logging submit event(s). #1 job(s) submitted to cluster 2253622. - pat = re.compile("submitted to cluster (\d*)",re.MULTILINE) + pat = re.compile(r"submitted to cluster (\d*)",re.MULTILINE) output = output.decode(errors='ignore') try: id = pat.search(output).groups()[0] @@ -1025,7 +1033,7 @@ def submit2(self, prog, argument=[], cwd=None, stdout=None, stderr=None, #Logging submit event(s). #1 job(s) submitted to cluster 2253622. output = output.decode(errors='ignore') - pat = re.compile("submitted to cluster (\d*)",re.MULTILINE) + pat = re.compile(r"submitted to cluster (\d*)",re.MULTILINE) try: id = pat.search(output).groups()[0] except: @@ -1588,7 +1596,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None output = a.communicate()[0].decode(errors='ignore') #Your job 874511 ("test.sh") has been submitted - pat = re.compile("Your job (\d*) \(",re.MULTILINE) + pat = re.compile(r"Your job (\d*) \(",re.MULTILINE) try: id = pat.search(output).groups()[0] except: @@ -1606,7 +1614,7 @@ def control_one_job(self, id): if not status: return 'F' #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 - pat = re.compile("^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") + pat = re.compile(r"^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") stat = '' for line in status.stdout.read().decode(errors='ignore').split('\n'): if not line: @@ -1636,7 +1644,7 @@ def control(self, me_dir=None): cmd = 'qstat -s %s' % statusflag status = misc.Popen([cmd], shell=True, stdout=subprocess.PIPE) #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 - pat = re.compile("^(\d+)") + pat = re.compile(r"^(\d+)") for line in status.stdout.read().decode(errors='ignore').split('\n'): line = line.strip() try: @@ -1715,6 +1723,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None stderr = stdout if log is None: log = '/dev/null' + command = ['sbatch', '-o', stdout, '-J', me_dir, @@ -1726,6 +1735,12 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None command.insert(1, '-p') command.insert(2, self.cluster_queue) + if 'cluster_walltime' in self.options and self.options['cluster_walltime']\ + and self.options['cluster_walltime'] != 'None': + command.insert(1, '-t') + command.insert(2, self.options['cluster_walltime']) + + a = misc.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -1736,7 +1751,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None id = output_arr[3].rstrip() if not id.isdigit(): - id = re.findall('Submitted batch job ([\d\.]+)', ' '.join(output_arr)) + id = re.findall(r'Submitted batch job ([\d\.]+)', ' '.join(output_arr)) if not id or len(id)>1: raise ClusterManagmentError( 'fail to submit to the cluster: \n%s' \ diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/combine_runs.py b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/combine_runs.py index 4de6b84ec0..b1e8c88eac 100755 --- a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/combine_runs.py +++ b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/combine_runs.py @@ -20,6 +20,7 @@ from __future__ import absolute_import import math import os +import shutil import re import logging from six.moves import range @@ -117,6 +118,7 @@ def sum_multichannel(self, channel): #Now read in all of the events and write them #back out with the appropriate scaled weight + to_clean = [] fsock = open(pjoin(channel, 'events.lhe'), 'w') wgt = results.axsec / results.nunwgt tot_nevents, nb_file = 0, 0 @@ -129,8 +131,14 @@ def sum_multichannel(self, channel): nw = self.copy_events(fsock, pjoin(path,'events.lhe'), wgt) tot_nevents += nw nb_file += 1 + to_clean.append(path) logger.debug("Combined %s file generating %s events for %s " , nb_file, tot_nevents, channel) - + for path in to_clean: + try: + shutil.rmtree(path) + except Exception as error: + pass + @staticmethod def get_fortran_str(nb): data = '%E' % nb @@ -162,6 +170,7 @@ def copy_events(self, fsock, input, new_wgt): fsock.write(line) old_line = line return nb_evt + def get_channels(self, proc_path): """Opens file symfact.dat to determine all channels""" sympath = os.path.join(proc_path, 'symfact.dat') diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/common_run_interface.py b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/common_run_interface.py index 9bd9d9cb50..194f0cdfbd 100755 --- a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/common_run_interface.py +++ b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/common_run_interface.py @@ -23,6 +23,7 @@ import ast import logging import math +import copy import os import re import shutil @@ -181,6 +182,23 @@ def help_add_time_of_flight(self): logger.info(' threshold option allows to change the minimal value required to') logger.info(' a non zero value for the particle (default:1e-12s)') + def help_print_results(self): + logger.info("syntax: print_results [RUN_NAME] [OPTIONS]") + logger.info("-- print the results of the previous run on the screen") + logger.info(" If not RUN_NAME is provided, the information of all run") + logger.info(" are printed one after another.") + logger.info("") + logger.info(" supported options:") + logger.info(" ------------------") + logger.info(" --format=full|short # default is full") + logger.info(" full format contains banner/... ") + logger.info(" while short is a simple multi-column format (nice for plotting)") + logger.info(" --path=") + logger.info(" allow to write the information to a file.") + logger.info(" --mode=w|a #default is w ") + logger.info(" when the information is printed to a file, you can choose ") + logger.info(" to either overwrite the file if already exists (w mode)") + logger.info(" to append the information at the end of the file (a mode)") class CheckValidForCmd(object): @@ -727,7 +745,7 @@ def __init__(self, me_dir, options, *args, **opts): if not self.proc_characteristics['ninitial']: # Get number of initial states nexternal = open(pjoin(self.me_dir,'Source','nexternal.inc')).read() - found = re.search("PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) + found = re.search(r"PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) self.ninitial = int(found.group(1)) else: self.ninitial = self.proc_characteristics['ninitial'] @@ -989,7 +1007,22 @@ def do_treatcards(self, line, amcatnlo=False): #raise Exception, "%s %s %s" % (sys.path, os.path.exists(pjoin(self.me_dir,'bin','internal', 'ufomodel')), os.listdir(pjoin(self.me_dir,'bin','internal', 'ufomodel'))) import ufomodel as ufomodel zero = ufomodel.parameters.ZERO - if self.proc_characteristics['nlo_mixed_expansion']: + no_width = [] + + if self.proc_characteristics['ew_sudakov']: + # if the sudakov approximation is used, force all particle widths to zero + # unless the complex mass scheme is used + if not self.proc_characteristics['complex_mass_scheme']: + no_width = [p for p in ufomodel.all_particles if p.width != zero] + logger.info('''Setting all particle widths to zero (needed for EW Sudakov approximation).''','$MG:BOLD') + # also, check that the model features the 'ntadpole' parameter, and set it to 1 + try: + param_card['tadpole'].get(1).value = 1. + logger.info('''Setting the value of ntadpole to 1 (needed for EW Sudakov approximation).''','$MG:BOLD') + except KeyError: + logger.warning('''The model has no 'ntadpole' parameter. The Sudakov approximation for EW corrections may give wrong results.''') + + elif self.proc_characteristics['nlo_mixed_expansion']: no_width = [p for p in ufomodel.all_particles if (str(p.pdg_code) in pids or str(-p.pdg_code) in pids) and p.width != zero] @@ -1168,17 +1201,17 @@ def detect_card_type(path): 'Begin Minpts', 'gridpack', 'ebeam1', - 'block\s+mw_run', + r'block\s+mw_run', 'BLOCK', 'DECAY', 'launch', 'madspin', - 'transfer_card\.dat', + r'transfer_card\.dat', 'set', 'main:numberofevents', # pythia8, '@MG5aMC skip_analysis', #MA5 --both-- - '@MG5aMC\s*inputs\s*=\s*\*\.(?:hepmc|lhe)', #MA5 --both-- - '@MG5aMC\s*reconstruction_name', # MA5 hadronique + r'@MG5aMC\s*inputs\s*=\s*\*\.(?:hepmc|lhe)', #MA5 --both-- + r'@MG5aMC\s*reconstruction_name', # MA5 hadronique '@MG5aMC', # MA5 hadronique 'run_rivet_later', # Rivet ] @@ -1237,7 +1270,7 @@ def detect_card_type(path): return 'madspin_card.dat' if 'decay' in text: # need to check if this a line like "decay w+" or "set decay" - if re.search("(^|;)\s*decay", fulltext, re.M): + if re.search(r"(^|;)\s*decay", fulltext, re.M): return 'madspin_card.dat' else: return 'reweight_card.dat' @@ -2074,6 +2107,12 @@ def check_multicore(self): # ensure that the run_card is present if not hasattr(self, 'run_card'): self.run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat')) + # Below reads the run_card in the LHE file rather than the Cards/run_card + import madgraph.various.lhe_parser as lhe_parser + args_path = list(args) + self.check_decay_events(args_path) + self.run_card = banner_mod.RunCard(lhe_parser.EventFile(args_path[0]).get_banner()['mgruncard']) + # we want to run this in a separate shell to avoid hard f2py crash command = [sys.executable] @@ -2085,6 +2124,12 @@ def check_multicore(self): command.append('--web') command.append('reweight') + ## TV: copy the event file as backup before starting reweighting + event_path = pjoin(self.me_dir, 'Events', self.run_name, 'events.lhe.gz') + event_path_backup = pjoin(self.me_dir, 'Events', self.run_name, 'events_orig.lhe.gz') + if os.path.exists(event_path) and not os.path.exists(event_path_backup): + shutil.copyfile(event_path, event_path_backup) + ######### START SINGLE CORE MODE ############ if self.options['nb_core']==1 or self.run_card['nevents'] < 101 or not check_multicore(self): if self.run_name: @@ -2200,7 +2245,7 @@ def check_multicore(self): cross_sections[key] = value / (nb_event+1) lhe.remove() for key in cross_sections: - if key == 'orig' or key.isdigit(): + if key == 'orig' or (key.isdigit() and not (key[0] == '2')): continue logger.info('%s : %s pb' % (key, cross_sections[key])) return @@ -2461,7 +2506,7 @@ def do_add_time_of_flight(self, line): ############################################################################ def do_print_results(self, line): - """Not in help:Print the cross-section/ number of events for a given run""" + """Print the cross-section/ number of events for a given run""" args = self.split_arg(line) options={'path':None, 'mode':'w', 'format':'full'} @@ -2942,10 +2987,15 @@ def do_rivet(self, line, postprocess=False): #2 Prepare Rivet setup environments rivet_path = self.options['rivet_path'] yoda_path = self.options['yoda_path'] + fastjet_path = subprocess.Popen([self.options['fastjet'], '--prefix'], + stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip() + set_env = set_env + "export PATH={0}:$PATH\n".format(pjoin(rivet_path, 'bin')) set_env = set_env + "export PATH={0}:$PATH\n".format(pjoin(yoda_path, 'bin')) set_env = set_env + "export LD_LIBRARY_PATH={0}:{1}:$LD_LIBRARY_PATH\n".format(pjoin(rivet_path, 'lib'), pjoin(rivet_path, 'lib64')) set_env = set_env + "export LD_LIBRARY_PATH={0}:{1}:$LD_LIBRARY_PATH\n".format(pjoin(yoda_path, 'lib'), pjoin(yoda_path, 'lib64')) + set_env = set_env + "export LD_LIBRARY_PATH={0}:$LD_LIBRARY_PATH\n".format(pjoin(self.options['hepmc_path'], 'lib')) + set_env = set_env + "export LD_LIBRARY_PATH={0}:$LD_LIBRARY_PATH\n".format(pjoin(fastjet_path, 'lib')) major, minor = sys.version_info[0:2] set_env = set_env + "export PYTHONPATH={0}:{1}:$PYTHONPATH\n".format(pjoin(rivet_path, 'lib', 'python%s.%s' %(major,minor), 'site-packages'),\ pjoin(rivet_path, 'lib64', 'python%s.%s' %(major,minor), 'site-packages')) @@ -4311,8 +4361,8 @@ def complete_compute_widths(self, text, line, begidx, endidx, formatting=True): else: completion = {} completion['options'] = self.list_completion(text, - ['--path=', '--output=', '--min_br=0.\$', '--nlo', - '--precision_channel=0.\$', '--body_decay=']) + ['--path=', '--output=', r'--min_br=0.\$', '--nlo', + r'--precision_channel=0.\$', '--body_decay=']) return self.deal_multiple_categories(completion, formatting) @@ -4821,9 +4871,9 @@ class AskforEditCard(cmd.OneLinePathCompletion): (return False to repeat the question) """ - all_card_name = ['param_card', 'run_card', 'pythia_card', 'pythia8_card', + all_card_name = ['param_card', 'run_card', 'pythia_card', 'pythia8_card', 'fo_analysis_card' 'madweight_card', 'MadLoopParams', 'shower_card', 'rivet_card'] - to_init_card = ['param', 'run', 'madweight', 'madloop', + to_init_card = ['param', 'run', 'madweight', 'madloop', 'fo_analysis', 'shower', 'pythia8','delphes','madspin', 'rivet'] special_shortcut = {} special_shortcut_help = {} @@ -4853,6 +4903,7 @@ def load_default(self): self.has_PY8 = False self.has_delphes = False self.has_rivet = False + self.has_fo_card = False self.paths = {} self.update_block = [] @@ -5058,7 +5109,8 @@ def init_run(self, cards): try: - self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning') + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning') except IOError: self.run_card = {} try: @@ -5248,6 +5300,15 @@ def init_delphes(self, cards): self.has_delphes = True return [] + def init_fo_analysis(self, cards): + self.has_fo_card = False + if not self.get_path('FO_analyse', cards): + return [] + self.has_fo_card = True + self.fo_card = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse']) + self.fo_card_def = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse_default']) + return list(self.fo_card.string_vars) + def set_CM_velocity(self, line): """compute sqrts from the velocity in the center of mass frame""" @@ -5508,6 +5569,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): allowed['delphes_card'] = '' if self.has_rivet: allowed['rivet_card'] = '' + if self.has_fo_card: + allowed['fo_card'] = '' elif len(args) == 2: if args[1] == 'run_card': @@ -5532,6 +5595,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): allowed = {'delphes_card':'default'} elif args[1] == 'rivet_card': allowed = {'rivet_card':'default'} + elif args[1] == 'fo_card': + allowed = {'fo_card':'default'} else: allowed = {'value':''} @@ -5539,6 +5604,7 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): start = 1 if args[1] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', 'MadLoop_card','pythia8_card','delphes_card','plot_card', + 'fo_card', 'madanalysis5_parton_card','madanalysis5_hadron_card', 'rivet_card']: start = 2 @@ -5576,6 +5642,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): categories.append('delphes_card') if self.has_rivet: categories.append('rivet_card') + if self.has_fo_card: + categories.append('fo_card') possibilities['category of parameter (optional)'] = \ self.list_completion(text, categories) @@ -5630,7 +5698,13 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): if 'delphes_card' in allowed: if allowed['delphes_card'] == 'default': opts = ['default', 'atlas', 'cms'] - possibilities['Delphes Card'] = self.list_completion(text, opts) + possibilities['Delphes Card'] = self.list_completion(text, opts) + + if 'fo_card' in allowed: + opts = self.fo_card.string_vars + if allowed['fo_card'] == 'default': + opts.append('default') + possibilities['FO Card'] = self.list_completion(text, opts) if 'value' in list(allowed.keys()): opts = ['default', 'scale'] @@ -5733,21 +5807,28 @@ def do_set(self, line): if args[0] in self.special_shortcut: targettypes , cmd = self.special_shortcut[args[0]] if len(args) != len(targettypes) +1: - logger.warning('shortcut %s requires %s argument' % (args[0], len(targettypes))) - if len(args) < len(targettypes) +1: - return + if len(targettypes) == 1 and args[len(targettypes)].startswith('scan'): + args = args[:len(targettypes)] + [' '.join(args[len(targettypes):])] + targettypes = [str] else: - logger.warning('additional argument will be ignored') + logger.warning('shortcut %s requires %s argument' % (args[0], len(targettypes))) + if len(args) < len(targettypes) +1: + return + else: + logger.warning('additional argument will be ignored') values ={} for i, argtype in enumerate(targettypes): try: - values = {str(i): banner_mod.ConfigFile.format_variable(args[i+1], argtype, args[0])} + values[str(i)] = banner_mod.ConfigFile.format_variable(args[i+1], argtype, args[0]) except ValueError as e: logger.warning("Wrong argument: The entry #%s should be of type %s.", i+1, argtype) return except InvalidCmd as e: - logger.warning(str(e)) - return + if isinstance(args[i+1], str) and args[i+1].startswith('scan'): + values[str(i)] = args[i+1] + else: + logger.warning(str(e)) + return #else: # logger.warning("too many argument for this command") # return @@ -5787,7 +5868,7 @@ def do_set(self, line): if os.path.exists(pythia_path): logger.info('add line QCUT = %s in pythia_card.dat' % args[1]) p_card = open(pythia_path,'r').read() - p_card, n = re.subn('''^\s*QCUT\s*=\s*[\de\+\-\.]*\s*$''', + p_card, n = re.subn(r'''^\s*QCUT\s*=\s*[\de\+\-\.]*\s*$''', ''' QCUT = %s ''' % args[1], \ p_card, flags=(re.M+re.I)) if n==0: @@ -5801,7 +5882,7 @@ def do_set(self, line): if os.path.exists(pythia_path): logger.info('add line SHOWERKT = %s in pythia_card.dat' % args[1].upper()) p_card = open(pythia_path,'r').read() - p_card, n = re.subn('''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''', + p_card, n = re.subn(r'''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''', ''' SHOWERKT = %s ''' % args[1].upper(), \ p_card, flags=(re.M+re.I)) if n==0: @@ -5856,7 +5937,7 @@ def do_set(self, line): pjoin(self.me_dir,'Cards', 'delphes_card.dat')) return - if args[0] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', + if args[0] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', 'fo_card', 'delphes_card','madanalysis5_hadron_card','madanalysis5_parton_card','rivet_card']: if args[1] == 'default': @@ -6176,6 +6257,22 @@ def do_set(self, line): self.setRivet(args[start], value, default=default) self.rivet_card.write(self.paths['rivet'], self.paths['rivet_default']) + elif self.has_fo_card and (card in ['', 'fo_card'])\ + and args[start].lower() in [k.lower() for k in self.fo_card.string_vars]: + + if args[start] in self.conflict and card == '': + text = 'ambiguous name (present in more than one card). Please specify which card to edit' + logger.warning(text) + return + if args[start+1] == 'default': + value = self.fo_card_default[args[start]] + default = True + else: + value = args[start+1] + default = False + self.fo_card[args[start]] = value + self.modified_card.add('fo_card') + #INVALID -------------------------------------------------------------- else: logger.warning('invalid set command %s ' % line) @@ -6222,12 +6319,13 @@ def setM(self, block, name, value): def setR(self, name, value): - if self.mother_interface.inputfile: - self.run_card.set(name, value, user=True, raiseerror=True) - else: - self.run_card.set(name, value, user=True) - new_value = self.run_card.get(name) - logger.info('modify parameter %s of the run_card.dat to %s' % (name, new_value),'$MG:BOLD') + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + if self.mother_interface.inputfile: + self.run_card.set(name, value, user=True, raiseerror=True) + else: + self.run_card.set(name, value, user=True) + new_value = self.run_card.get(name) + logger.info('modify parameter %s of the run_card.dat to %s' % (name, new_value),'$MG:BOLD') def setML(self, name, value, default=False): @@ -6314,6 +6412,7 @@ def check_card_consistency(self): proc_charac = self.mother_interface.proc_characteristics if proc_charac['grouped_matrix'] and \ + isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int) and \ abs(self.run_card['lpp1']) == 1 == abs(self.run_card['lpp2']) and \ (self.run_card['nb_proton1'] != self.run_card['nb_proton2'] or self.run_card['nb_neutron1'] != self.run_card['nb_neutron2'] or @@ -6403,41 +6502,42 @@ def check_card_consistency(self): # check that only quark/gluon/photon are in initial beam if lpp=+-1 pdg_in_p = list(range(-6,7))+[21,22] - if (abs(self.run_card['lpp1'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial1'])) \ + if isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int): + if(abs(self.run_card['lpp1'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial1'])) \ or (abs(self.run_card['lpp2'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial2'])): - if 'pythia_card.dat' in self.cards or 'pythia8_card.dat' in self.cards: - path_to_remove = None - if 'pythia_card.dat' in self.cards: - path_to_remove = self.paths['pythia'] - card_to_remove = 'pythia_card.dat' - elif 'pythia8_card.dat' in self.cards: - path_to_remove = self.paths['pythia8'] - card_to_remove = 'pythia8_card.dat' - if path_to_remove: - if 'partonshower' in self.run_card['bypass_check']: + if 'pythia_card.dat' in self.cards or 'pythia8_card.dat' in self.cards: + path_to_remove = None + if 'pythia_card.dat' in self.cards: + path_to_remove = self.paths['pythia'] + card_to_remove = 'pythia_card.dat' + elif 'pythia8_card.dat' in self.cards: + path_to_remove = self.paths['pythia8'] + card_to_remove = 'pythia8_card.dat' + if path_to_remove: + if 'partonshower' in self.run_card['bypass_check']: + logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") + else: + logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') + os.remove(path_to_remove) + self.cards.remove(card_to_remove) + else: + logger.info('Remember that Parton-Shower are not yet ready for such proton component definition (HW implementation in progress).', '$MG:BOLD' ) + elif (abs(self.run_card['lpp1'])==3 and abs(self.run_card['lpp2'])==3): + if 'pythia8_card.dat' in self.cards: + if self.run_card['pdlabel'] == 'isronlyll': + if 'partonshower' not in self.run_card['bypass_check']: + # force that QED shower is on? + for param in ['TimeShower:QEDshowerByQ', 'TimeShower:QEDshowerByL', 'TimeShower:QEDshowerByGamma', 'SpaceShower:QEDshowerByQ', 'SpaceShower:QEDshowerByL']: + if param not in self.PY8Card or \ + (not self.PY8Card[param] and param.lower() not in self.PY8Card.user_set): + logger.warning('Activating QED shower: setting %s to True', param) + self.PY8Card[param] = True + elif 'partonshower' in self.run_card['bypass_check']: logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") - else: + else: logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') - os.remove(path_to_remove) - self.cards.remove(card_to_remove) - else: - logger.info('Remember that Parton-Shower are not yet ready for such proton component definition (HW implementation in progress).', '$MG:BOLD' ) - elif (abs(self.run_card['lpp1'])==3 and abs(self.run_card['lpp2'])==3): - if 'pythia8_card.dat' in self.cards: - if self.run_card['pdlabel'] == 'isronlyll': - if 'partonshower' not in self.run_card['bypass_check']: - # force that QED shower is on? - for param in ['TimeShower:QEDshowerByQ', 'TimeShower:QEDshowerByL', 'TimeShower:QEDshowerByGamma', 'SpaceShower:QEDshowerByQ', 'SpaceShower:QEDshowerByL']: - if param not in self.PY8Card or \ - (not self.PY8Card[param] and param.lower() not in self.PY8Card.user_set): - logger.warning('Activating QED shower: setting %s to True', param) - self.PY8Card[param] = True - elif 'partonshower' in self.run_card['bypass_check']: - logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") - else: - logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') - os.remove(self.paths['pythia8']) - self.cards.remove('pythia8_card.dat') + os.remove(self.paths['pythia8']) + self.cards.remove('pythia8_card.dat') ######################################################################## @@ -6514,7 +6614,8 @@ def check_card_consistency(self): #check relation between lepton PDF // dressed lepton collisions // ... - if abs(self.run_card['lpp1']) != 1 or abs(self.run_card['lpp2']) != 1: + if isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int) and \ + abs(self.run_card['lpp1']) != 1 or abs(self.run_card['lpp2']) != 1: if abs(self.run_card['lpp1']) == abs(self.run_card['lpp2']) == 3: # this can be dressed lepton or photon-flux if proc_charac['pdg_initial1'] in [[11],[-11]] and proc_charac['pdg_initial2'] in [[11],[-11]]: @@ -6732,7 +6833,11 @@ def write_card_param(self): """ write the param_card """ self.param_card.write(self.paths['param']) - + + def write_card_fo_card(self): + """ write the fo_card""" + self.fo_card.write_card_from_template(self.paths['FO_analyse'], self.paths['FO_analyse_default']) + @staticmethod def update_dependent(mecmd, me_dir, param_card, path ,timer=0, run_card=None, lhapdfconfig=None): @@ -7076,7 +7181,7 @@ def do_decay(self, line): #first find the particle particle = line.split('>')[0].strip() logger.info("change madspin_card to define the decay of %s: %s" %(particle, line.strip()), '$MG:BOLD') - particle = particle.replace('+','\+').replace('-','\-') + particle = particle.replace('+',r'\+').replace('-',r'\-') decay_pattern = re.compile(r"^\s*decay\s+%s\s*>[\s\w+-~]*?$" % particle, re.I+re.M) text= open(path).read() text = decay_pattern.sub('', text) @@ -7193,7 +7298,7 @@ def help_edit(self, prefix=True): logger.info( ' --clean remove all previously existing line in the file') logger.info( ' --comment_line="" comment all lines matching the regular expression') logger.info('') - logger.info(' Note: all regular-expression will be prefixed by ^\s*') + logger.info(r' Note: all regular-expression will be prefixed by ^\s*') logger.info('') logger.info( ' example: edit reweight --after_line="change mode\b" change model heft') logger.info( ' edit madspin --after_line="banner" change model XXXX') @@ -7314,7 +7419,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''replace_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[14:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[14:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7344,7 +7449,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''comment_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[14:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[14:-1] nb_mod = 0 for posline,l in enumerate(split): if re.search(pattern, l): @@ -7366,7 +7471,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''before_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[13:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[13:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7383,7 +7488,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern = r'''after_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[12:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[12:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7527,16 +7632,19 @@ def open_file(self, answer): answer = 'plot' else: answer = self.cards[int(answer)-self.integer_bias] - + path = '' if 'madweight' in answer: answer = answer.replace('madweight', 'MadWeight') elif 'MadLoopParams' in answer: answer = self.paths['ML'] elif 'pythia8_card' in answer: answer = self.paths['pythia8'] + elif 'FO_analyse' in answer: + path = self.paths['FO_analyse'] + answer = 'fo_card' if os.path.exists(answer): path = answer - else: + elif not os.path.exists(path): if not '.dat' in answer and not '.lhco' in answer: if answer != 'trigger': path = self.paths[answer] @@ -7595,7 +7703,8 @@ def reload_card(self, path): logger.error('Please re-open the file and fix the problem.') logger.warning('using the \'set\' command without opening the file will discard all your manual change') elif path == self.paths['run']: - self.run_card = banner_mod.RunCard(path) + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + self.run_card = banner_mod.RunCard(path) elif path == self.paths['shower']: self.shower_card = shower_card_mod.ShowerCard(path) elif path == self.paths['ML']: @@ -7614,6 +7723,8 @@ def reload_card(self, path): except: import internal.madweight.Cards as mwcards self.mw_card = mwcards.Card(path) + elif path == self.paths['FO_analyse']: + self.fo_card = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse']) else: logger.debug('not keep in sync: %s', path) return path @@ -7629,6 +7740,9 @@ def scanparamcardhandling(input_path=lambda obj: pjoin(obj.me_dir, 'Cards', 'par iteratorclass=param_card_mod.ParamCardIterator, summaryorder=lambda obj: lambda:None, check_card=lambda obj: CommonRunCmd.static_check_param_card, + run_card_scan=False, + run_card_input= lambda obj: pjoin(obj.me_dir, 'Cards', 'run_card.dat'), + run_card_iteratorclass=banner_mod.RunCardIterator, ): """ This is a decorator for customizing/using scan over the param_card (or technically other) This should be use like this: @@ -7678,7 +7792,60 @@ def __enter__(self): def __exit__(self, ctype, value, traceback ): self.iterator.write(self.path) - def decorator(original_fct): + def scan_over_run_card(original_fct, obj, *args, **opts): + + if isinstance(input_path, str): + card_path = run_card_input + else: + card_path = run_card_input(obj) + + run_card_iterator = run_card_iteratorclass(card_path) + orig_card = copy.deepcopy(run_card_iterator.run_card) + if not run_card_iterator.run_card.scan_set: + return original_fct(obj, *args, **opts) + + + with restore_iterator(orig_card, card_path): + # this with statement ensure that the original card is restore + # whatever happens inside those block + + if not hasattr(obj, 'allow_notification_center'): + obj.allow_notification_center = False + with misc.TMP_variable(obj, 'allow_notification_center', False): + orig_name = get_run_name(obj) + if not orig_name and args[1]: + orig_name = args[1][0] + args = (args[0], args[1][1:]) + #orig_name = "scan_%s" % len(obj.results) + + try: + os.mkdir(pjoin(obj.me_dir, 'Events', orig_name)) + except Exception: + pass + next_name = orig_name + "_00" + + for i,card in enumerate(run_card_iterator): + card.write(card_path) + # still have to check for the auto-wdith + #if i !=0: + next_name = run_card_iterator.get_next_name(next_name) + set_run_name(obj)(next_name) + try: + original_fct(obj, *args, **opts) + except ignoreerror as error: + run_card_iterator.store_entry(next_name, {'exception': error}) + else: + run_card_iterator.store_entry(next_name, store_for_scan(obj)(), run_card_path=card_path) + + #param_card_iterator.write(card_path) #-> this is done by the with statement + name = misc.get_scan_name(orig_name, next_name) + path = result_path(obj) % name + logger.info("write scan results in %s" % path ,'$MG:BOLD') + order = summaryorder(obj)() + run_card_iterator.write_summary(path, order=order) + + + def decorator(original_fct): def new_fct(obj, *args, **opts): if isinstance(input_path, str): @@ -7702,8 +7869,13 @@ def new_fct(obj, *args, **opts): if not param_card_iterator: #first run of the function - original_fct(obj, *args, **opts) - return + if run_card_scan: + scan_over_run_card(original_fct, obj, *args, **opts) + return + else: + #first run of the function + original_fct(obj, *args, **opts) + return with restore_iterator(param_card_iterator, card_path): # this with statement ensure that the original card is restore diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/extended_cmd.py b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/extended_cmd.py index 2f37070580..789976beee 100755 --- a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/extended_cmd.py +++ b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/extended_cmd.py @@ -624,12 +624,12 @@ def complete(self, text, state): compfunc = self.completenames # correct wrong splittion with '\ ' - if line and begidx > 2 and line[begidx-2:begidx] == '\ ': + if line and begidx > 2 and line[begidx-2:begidx] == r'\ ': Ntext = line.split(os.path.sep)[-1] - self.completion_prefix = Ntext.rsplit('\ ', 1)[0] + '\ ' + self.completion_prefix = Ntext.rsplit(r'\ ', 1)[0] + r'\ ' to_rm = len(self.completion_prefix) - 1 Nbegidx = len(line.rsplit(os.path.sep, 1)[0]) + 1 - data = compfunc(Ntext.replace('\ ', ' '), line, Nbegidx, endidx) + data = compfunc(Ntext.replace(r'\ ', ' '), line, Nbegidx, endidx) self.completion_matches = [p[to_rm:] for p in data if len(p)>to_rm] # correct wrong splitting with '-'/"=" @@ -742,7 +742,7 @@ def path_completion(text, base_dir = None, only_dirs = False, completion += [prefix + f for f in ['.'+os.path.sep, '..'+os.path.sep] if \ f.startswith(text) and not prefix.startswith('.')] - completion = [a.replace(' ','\ ') for a in completion] + completion = [a.replace(' ',r'\ ') for a in completion] return completion @@ -1253,7 +1253,7 @@ def check_answer_in_input_file(self, question_instance, default, path=False, lin return possibility[0] if '=' in line and ' ' in line.strip(): leninit = len(line) - line,n = re.subn('\s*=\s*','=', line) + line,n = re.subn(r'\s*=\s*','=', line) if n and len(line) != leninit: return self.check_answer_in_input_file(question_instance, default, path=path, line=line) @@ -1311,7 +1311,7 @@ def nice_error_handling(self, error, line): if os.path.exists(self.debug_output): os.remove(self.debug_output) try: - super(Cmd,self).onecmd('history %s' % self.debug_output.replace(' ', '\ ')) + super(Cmd,self).onecmd('history %s' % self.debug_output.replace(' ', r'\ ')) except Exception as error: logger.error(error) @@ -2001,6 +2001,7 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): text = "" has_mg5_path = False # Use local configuration => Need to update the path + already_written = set() for line in open(basefile): if '=' in line: data, value = line.split('=',1) @@ -2018,9 +2019,12 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): comment = '' if key in to_keep: value = str(to_keep[key]) - else: + elif line not in already_written: + already_written.add(line) text += line continue + else: + continue if key == 'mg5_path': has_mg5_path = True try: @@ -2032,14 +2036,20 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): # check if absolute path if not os.path.isabs(value): value = os.path.realpath(os.path.join(basedir, value)) - text += '%s = %s # %s \n' % (key, value, comment) + new_line = '%s = %s # %s \n' % (key, value, comment) + if new_line not in already_written: + text += new_line + already_written.add(new_line) for key in to_write: if key in to_keep: - text += '%s = %s \n' % (key, to_keep[key]) + new_line = '%s = %s \n' % (key, to_keep[key]) + if new_line not in already_written: + text += new_line if not MADEVENT and not has_mg5_path: - text += """\n# MG5 MAIN DIRECTORY\n""" - text += "mg5_path = %s\n" % MG5DIR + if "mg5_path = %s\n" % MG5DIR not in already_written: + text += """\n# MG5 MAIN DIRECTORY\n""" + text += "mg5_path = %s\n" % MG5DIR writer = open(filepath,'w') writer.write(text) @@ -2190,7 +2200,7 @@ def onecmd(self, line, **opt): raise def reask(self, reprint_opt=True): - pat = re.compile('\[(\d*)s to answer\]') + pat = re.compile(r'\[(\d*)s to answer\]') prev_timer = signal.alarm(0) # avoid timer if any if prev_timer: @@ -2991,7 +3001,7 @@ def question_formatting(self, nb_col = 80, lpotential_switch=0, lnb_key=0, key=None): - """should return four lines: + r"""should return four lines: 1. The upper band (typically /========\ 2. The lower band (typically \========/ 3. The line without conflict | %(nb)2d. %(descrip)-20s %(name)5s = %(switch)-10s | @@ -3239,13 +3249,13 @@ def create_question(self, help_text=True): data_to_format['conflict_switch'] = self.color_for_value(key,self.inconsistent_keys[key], consistency=False) if hidden_line: - f2 = re.sub('%(\((?:name|descrip|add_info)\)-?)(\d+)s', + f2 = re.sub(r'%(\((?:name|descrip|add_info)\)-?)(\d+)s', lambda x: '%%%s%ds' % (x.group(1),int(x.group(2))+9), f2) text.append(f2 % data_to_format) elif hidden_line: if not f3: - f3 = re.sub('%(\((?:name|descrip|add_info)\)-?)(\d+)s', + f3 = re.sub(r'%(\((?:name|descrip|add_info)\)-?)(\d+)s', lambda x: '%%%s%ds' % (x.group(1),int(x.group(2))+9), f1) text.append(f3 % data_to_format) diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/file_writers.py b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/file_writers.py index 41bff05276..526756129f 100755 --- a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/file_writers.py +++ b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/file_writers.py @@ -36,10 +36,10 @@ class FileWriter(io.FileIO): supported_preprocessor_commands = ['if'] preprocessor_command_re=re.compile( - "\s*(?P%s)\s*\(\s*(?P.*)\s*\)\s*{\s*"\ + r"\s*(?P%s)\s*\(\s*(?P.*)\s*\)\s*{\s*"\ %('|'.join(supported_preprocessor_commands))) preprocessor_endif_re=re.compile(\ - "\s*}\s*(?Pelse)?\s*(\((?P.*)\))?\s*(?P{)?\s*") + r"\s*}\s*(?Pelse)?\s*(\((?P.*)\))?\s*(?P{)?\s*") class FileWriterError(IOError): """Exception raised if an error occurs in the definition @@ -191,15 +191,15 @@ class FortranWriterError(FileWriter.FileWriterError): pass # Parameters defining the output of the Fortran writer - keyword_pairs = {'^if.+then\s*$': ('^endif', 2), - '^type(?!\s*\()\s*.+\s*$': ('^endtype', 2), - '^do(?!\s+\d+)\s+': ('^enddo\s*$', 2), - '^subroutine': ('^end\s*$', 0), - '^module': ('^end\s*$', 0), - 'function': ('^end\s*$', 0)} - single_indents = {'^else\s*$':-2, - '^else\s*if.+then\s*$':-2} - number_re = re.compile('^(?P\d+)\s+(?P.*)') + keyword_pairs = {r'^if.+then\s*$': ('^endif', 2), + r'^type(?!\s*\()\s*.+\s*$': ('^endtype', 2), + r'^do(?!\s+\d+)\s+': (r'^enddo\s*$', 2), + '^subroutine': (r'^end\s*$', 0), + '^module': (r'^end\s*$', 0), + 'function': (r'^end\s*$', 0)} + single_indents = {r'^else\s*$':-2, + r'^else\s*if.+then\s*$':-2} + number_re = re.compile(r'^(?P\d+)\s+(?P.*)') line_cont_char = '$' comment_char = 'c' uniformcase = True #force everyting to be lower/upper case @@ -212,7 +212,7 @@ class FortranWriterError(FileWriter.FileWriterError): # Private variables __indent = 0 __keyword_list = [] - __comment_pattern = re.compile(r"^(\s*#|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|!)", re.IGNORECASE) + __comment_pattern = re.compile(r"^(\s*#|c\$|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|\s*!|!\$)", re.IGNORECASE) __continuation_line = re.compile(r"(?: )[$&]") def write_line(self, line): @@ -424,26 +424,20 @@ def count_number_of_quotes(self, line): i = i + 1 return len(splitline)-1 - def remove_routine(self, text, fct_names, formatting=True): - """write the incoming text but fully removing the associate routine/function - text can be a path to a file, an iterator, a string - fct_names should be a list of functions to remove + @staticmethod + def get_routine(text, fct_names, call_back=None): + """ + get the fortran function from a fortran file """ - f77_type = ['real*8', 'integer', 'double precision', 'logical'] - pattern = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I) - + + if isinstance(text, str): + text = text.split('\n') + + to_write=False removed = [] - if isinstance(text, str): - if '\n' in text: - text = text.split('\n') - else: - text = open(text) - if isinstance(fct_names, str): - fct_names = [fct_names] - - to_write=True for line in text: fct = pattern.findall(line) if fct: @@ -451,22 +445,38 @@ def remove_routine(self, text, fct_names, formatting=True): to_write = False else: to_write = True - if to_write: - if formatting: - if line.endswith('\n'): - line = line[:-1] - self.writelines(line) - else: - if not line.endswith('\n'): - line = '%s\n' % line - super(FileWriter,self).writelines(line) + if call_back: + call_back(line) else: removed.append(line) - + return removed + + def remove_routine(self, text, fct_names, formatting=True): + """write the incoming text but fully removing the associate routine/function + text can be a path to a file, an iterator, a string + fct_names should be a list of functions to remove + """ + + def call_back(line): + if formatting: + if line.endswith('\n'): + line = line[:-1] + self.writelines(line) + else: + if not line.endswith('\n'): + line = '%s\n' % line + super(FileWriter,self).writelines(line) + + return self.get_routine(text, fct_names, call_back) + +class FortranWriter90(FortranWriter): + + comment_char = ' !' + #=============================================================================== # CPPWriter #=============================================================================== @@ -497,50 +507,50 @@ class CPPWriterError(FileWriter.FileWriterError): '^private': standard_indent, '^protected': standard_indent} - spacing_patterns = [ - ('\s*\"\s*}', '\"'), - ('\s*,\s*', ', '), - ('\s*-\s*', ' - '), - ('([{(,=])\s*-\s*', '\g<1> -'), - ('(return)\s*-\s*', '\g<1> -'), - ('\s*\+\s*', ' + '), - ('([{(,=])\s*\+\s*', '\g<1> +'), - ('\(\s*', '('), - ('\s*\)', ')'), - ('\{\s*', '{'), - ('\s*\}', '}'), - ('\s*=\s*', ' = '), - ('\s*>\s*', ' > '), - ('\s*<\s*', ' < '), - ('\s*!\s*', ' !'), - ('\s*/\s*', '/'), - ('(?\s+>\s*', ' >> '), - ('<\s*double\s*>>\s*', ' > '), - ('\s*<\s+<\s*', ' << '), - ('\s*-\s+>\s*', '->'), - ('\s*=\s+=\s*', ' == '), - ('\s*!\s+=\s*', ' != '), - ('\s*>\s+=\s*', ' >= '), - ('\s*<\s+=\s*', ' <= '), - ('\s*&&\s*', ' && '), - ('\s*\|\|\s*', ' || '), - ('\s*{\s*}', ' {}'), - ('\s*;\s*', '; '), - (';\s*\}', ';}'), - (';\s*$}', ';'), - ('\s*<\s*([a-zA-Z0-9]+?)\s*>', '<\g<1>>'), - ('^#include\s*<\s*(.*?)\s*>', '#include <\g<1>>'), - ('(\d+\.{0,1}\d*|\.\d+)\s*[eE]\s*([+-]{0,1})\s*(\d+)', - '\g<1>e\g<2>\g<3>'), - ('\s+',' '), - ('^\s*#','#')] + spacing_patterns = [(r'\s*\"\s*}', '\"'), + (r'\s*,\s*', ', '), + (r'\s*-\s*', ' - '), + (r'([{(,=])\s*-\s*', r'\g<1> -'), + (r'(return)\s*-\s*', r'\g<1> -'), + (r'\s*\+\s*', ' + '), + (r'([{(,=])\s*\+\s*', r'\g<1> +'), + (r'\(\s*', '('), + (r'\s*\)', ')'), + (r'\{\s*', '{'), + (r'\s*\}', '}'), + (r'\s*=\s*', ' = '), + (r'\s*>\s*', ' > '), + (r'\s*<\s*', ' < '), + (r'\s*!\s*', ' !'), + (r'\s*/\s*', '/'), + (r'\s*\*\s*', ' * '), + (r'\s*-\s+-\s*', '-- '), + (r'\s*\+\s+\+\s*', '++ '), + (r'\s*-\s+=\s*', ' -= '), + (r'\s*\+\s+=\s*', ' += '), + (r'\s*\*\s+=\s*', ' *= '), + (r'\s*/=\s*', ' /= '), + (r'\s*>\s+>\s*', ' >> '), + (r'<\s*double\s*>>\s*', ' > '), + (r'\s*<\s+<\s*', ' << '), + (r'\s*-\s+>\s*', '->'), + (r'\s*=\s+=\s*', ' == '), + (r'\s*!\s+=\s*', ' != '), + (r'\s*>\s+=\s*', ' >= '), + (r'\s*<\s+=\s*', ' <= '), + (r'\s*&&\s*', ' && '), + (r'\s*\|\|\s*', ' || '), + (r'\s*{\s*}', ' {}'), + (r'\s*;\s*', '; '), + (r';\s*\}', ';}'), + (r';\s*$}', ';'), + (r'\s*<\s*([a-zA-Z0-9]+?)\s*>', r'<\g<1>>'), + (r'^#include\s*<\s*(.*?)\s*>', r'#include <\g<1>>'), + (r'(\d+\.{0,1}\d*|\.\d+)\s*[eE]\s*([+-]{0,1})\s*(\d+)', + r'\g<1>e\g<2>\g<3>'), + (r'\s+',' '), + (r'^\s*#','#')] + spacing_re = dict([(key[0], re.compile(key[0])) for key in \ spacing_patterns]) diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/gen_crossxhtml.py b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/gen_crossxhtml.py index d58ec573bc..681bf9d09b 100755 --- a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/gen_crossxhtml.py +++ b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/gen_crossxhtml.py @@ -648,7 +648,7 @@ def recreate(self, banner): if run_card['ickkw'] != 0: #parse the file to have back the information pythia_log = misc.BackRead(pjoin(path, '%s_pythia.log' % tag)) - pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") + pythiare = re.compile(r"\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") for line in pythia_log: info = pythiare.search(line) if not info: @@ -1623,7 +1623,7 @@ def get_html(self, runresults): elif self.debug: text = str(self.debug).replace('. ','.
') if 'http' in text: - pat = re.compile('(http[\S]*)') + pat = re.compile(r'(http[\S]*)') text = pat.sub(r' here ', text) debug = '
%s
%s
' % \ (self.debug.__class__.__name__, text) diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/gen_ximprove.py b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/gen_ximprove.py index c86da36a05..415ecc9de0 100755 --- a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/gen_ximprove.py +++ b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/gen_ximprove.py @@ -158,8 +158,11 @@ def get_helicity(self, to_submit=True, clean=True): (stdout, _) = p.communicate(''.encode()) stdout = stdout.decode('ascii',errors='ignore') if stdout: - nb_channel = max([math.floor(float(d)) for d in stdout.split()]) + lines = stdout.strip().split('\n') + nb_channel = max([math.floor(float(d)) for d in lines[-1].split()]) else: + if os.path.exists(pjoin(self.me_dir, 'error')): + os.remove(pjoin(self.me_dir, 'error')) for matrix_file in misc.glob('matrix*orig.f', Pdir): files.cp(matrix_file, matrix_file.replace('orig','optim')) P_zero_result.append(Pdir) @@ -297,12 +300,14 @@ def get_helicity(self, to_submit=True, clean=True): bad_amps_perhel = [] if __debug__: mtext = open(matrix_file).read() - nb_amp = int(re.findall('PARAMETER \(NGRAPHS=(\d+)\)', mtext)[0]) - logger.debug('nb_hel: %s zero amp: %s bad_amps_hel: %s/%s', len(good_hels),len(bad_amps),len(bad_amps_perhel), len(good_hels)*nb_amp ) + nb_amp = int(re.findall(r'PARAMETER \(NGRAPHS=(\d+)\)', mtext)[0]) + logger.debug('(%s) nb_hel: %s zero amp: %s bad_amps_hel: %s/%s', split_file[-1], len(good_hels),len(bad_amps),len(bad_amps_perhel), len(good_hels)*nb_amp ) if len(good_hels) == 1: files.cp(matrix_file, matrix_file.replace('orig','optim')) continue # avoid optimization if onlye one helicity - recycler = hel_recycle.HelicityRecycler(good_hels, bad_amps, bad_amps_perhel) + + gauge = self.cmd.proc_characteristics['gauge'] + recycler = hel_recycle.HelicityRecycler(good_hels, bad_amps, bad_amps_perhel, gauge=gauge) # In case of bugs you can play around with these: recycler.hel_filt = self.run_card['hel_filtering'] recycler.amp_splt = self.run_card['hel_splitamp'] @@ -1299,7 +1304,7 @@ def get_job_for_event(self): 'script_name': 'unknown', 'directory': C.name, # need to be change for splitted job 'P_dir': C.parent_name, - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # needed for RO gridpack 'offset': 1, # need to be change for splitted job 'nevents': nevents, 'maxiter': self.max_iter, @@ -1387,7 +1392,7 @@ def create_ajob(self, template, jobs, write_dir=None): break info = jobs[j] info['script_name'] = 'ajob%i' % script_number - info['keeplog'] = 'false' + info['keeplog'] = 'false' if self.run_card['keep_log'] != 'debug' else 'true' if "base_directory" not in info: info["base_directory"] = "./" fsock.write(template_text % info) @@ -1456,7 +1461,7 @@ def get_job_for_precision(self): 'script_name': 'unknown', 'directory': C.name, # need to be change for splitted job 'P_dir': C.parent_name, - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # used for RO gridpack 'offset': 1, # need to be change for splitted job 'nevents': nevents, 'maxiter': self.max_iter, @@ -1916,7 +1921,7 @@ def get_job_for_event(self): 'directory': C.name, # need to be change for splitted job 'P_dir': os.path.basename(C.parent_name), 'offset': 1, # need to be change for splitted job - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # use for RO gridpack 'nevents': nevents, #int(nevents*self.gen_events_security)+1, 'maxiter': self.max_iter, 'miniter': self.min_iter, diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/hel_recycle.py b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/hel_recycle.py index dfa45d5d20..6c86611f68 100755 --- a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/hel_recycle.py +++ b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/hel_recycle.py @@ -383,7 +383,7 @@ def get_number(cls, *args): class HelicityRecycler(): '''Class for recycling helicity''' - def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[]): + def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[], gauge='U'): External.good_hel = [] External.nhel_lines = '' @@ -427,6 +427,7 @@ def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[]): self.all_hel = [] self.hel_filt = True + self.gauge = gauge def set_input(self, file): if 'born_matrix' in file: @@ -612,7 +613,7 @@ def unfold_helicities(self, line, nature): def apply_amps(self, line, new_objs): if self.amp_splt: - return split_amps(line, new_objs) + return split_amps(line, new_objs, gauge=self.gauge) else: return apply_args(line, [i.args for i in new_objs]) @@ -785,7 +786,7 @@ def apply_args(old_line, all_the_args): return ''.join(new_lines) -def split_amps(line, new_amps): +def split_amps(line, new_amps, gauge): if not new_amps: return '' fct = line.split('(',1)[0].split('_0')[0] @@ -841,34 +842,31 @@ def split_amps(line, new_amps): spin = fct.split(None,1)[1][to_remove] lines.append('%sP1N_%s(%s)' % (fct, to_remove+1, ', '.join(args))) - hel, iamp = re.findall('AMP\((\d+),(\d+)\)', amp_result)[0] + hel, iamp = re.findall(r'AMP\((\d+),(\d+)\)', amp_result)[0] hel_calculated.append(hel) #lines.append(' %(result)s = TMP(3) * W(3,%(w)s) + TMP(4) * W(4,%(w)s)+' # % {'result': amp_result, 'w': windex}) #lines.append(' & TMP(5) * W(5,%(w)s)+TMP(6) * W(6,%(w)s)' # % {'result': amp_result, 'w': windex}) - if spin in "VF": - lines.append(""" call CombineAmp(%(nb)i, - & (/%(hel_list)s/), - & (/%(w_list)s/), - & TMP, W, AMP(1,%(iamp)s))""" % - {'nb': len(sub_amps), - 'hel_list': ','.join(hel_calculated), - 'w_list': ','.join(windices), - 'iamp': iamp - }) + if spin == "F" or ( spin == "V" and gauge !='FD'): + suffix = '' elif spin == "S": - lines.append(""" call CombineAmpS(%(nb)i, - &(/%(hel_list)s/), - & (/%(w_list)s/), - & TMP, W, AMP(1,%(iamp)s))""" % - {'nb': len(sub_amps), - 'hel_list': ','.join(hel_calculated), - 'w_list': ','.join(windices), - 'iamp': iamp - }) + suffix = 'S' + elif spin == "V" and gauge == "FD": + suffix = "FD" else: - raise Exception("split amp are not supported for spin2 and 3/2") + raise Exception("split amp not supported for spin2, 3/2") + + lines.append(""" call CombineAmp%(suffix)s(%(nb)i, + & (/%(hel_list)s/), + & (/%(w_list)s/), + & TMP, W, AMP(1,%(iamp)s))""" % {'suffix':suffix, + 'nb': len(sub_amps), + 'hel_list': ','.join(hel_calculated), + 'w_list': ','.join(windices), + 'iamp': iamp + }) + #lines.append('') return '\n'.join(lines) diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/histograms.py b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/histograms.py index 98f22c4c3a..9931127f66 100755 --- a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/histograms.py +++ b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/histograms.py @@ -632,34 +632,34 @@ class HwU(Histogram): # than necessary because the HwU standard allows for spaces from within # the name of a weight weight_header_re = re.compile( - '&\s*(?P(\S|(\s(?!\s*(&|$))))+)(\s(?!(&|$)))*') + r'&\s*(?P(\S|(\s(?!\s*(&|$))))+)(\s(?!(&|$)))*') # ================================ # Histo weight specification RE's # ================================ # The start of a plot - histo_start_re = re.compile('^\s*\s*(?P\d+)\s*"\s*'+ - '(?P(\S|(\s(?!\s*")))+)\s*"\s*$') + histo_start_re = re.compile(r'^\s*\s*(?P\d+)\s*"\s*'+ + r'(?P(\S|(\s(?!\s*")))+)\s*"\s*$') # A given weight specifier - a_float_re = '[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' - histo_bin_weight_re = re.compile('(?P%s|NaN)'%a_float_re,re.IGNORECASE) - a_int_re = '[\+|-]?\d+' + a_float_re = r'[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' + histo_bin_weight_re = re.compile(r'(?P%s|NaN)'%a_float_re,re.IGNORECASE) + a_int_re = r'[\+|-]?\d+' # The end of a plot histo_end_re = re.compile(r'^\s*<\\histogram>\s*$') # A scale type of weight - weight_label_scale = re.compile('^\s*mur\s*=\s*(?P%s)'%a_float_re+\ - '\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) - weight_label_PDF = re.compile('^\s*PDF\s*=\s*(?P\d+)\s*$') - weight_label_PDF_XML = re.compile('^\s*pdfset\s*=\s*(?P\d+)\s*$') - weight_label_TMS = re.compile('^\s*TMS\s*=\s*(?P%s)\s*$'%a_float_re) - weight_label_alpsfact = re.compile('^\s*alpsfact\s*=\s*(?P%s)\s*$'%a_float_re, + weight_label_scale = re.compile(r'^\s*mur\s*=\s*(?P%s)'%a_float_re+\ + r'\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) + weight_label_PDF = re.compile(r'^\s*PDF\s*=\s*(?P\d+)\s*$') + weight_label_PDF_XML = re.compile(r'^\s*pdfset\s*=\s*(?P\d+)\s*$') + weight_label_TMS = re.compile(r'^\s*TMS\s*=\s*(?P%s)\s*$'%a_float_re) + weight_label_alpsfact = re.compile(r'^\s*alpsfact\s*=\s*(?P%s)\s*$'%a_float_re, re.IGNORECASE) - weight_label_scale_adv = re.compile('^\s*dyn\s*=\s*(?P%s)'%a_int_re+\ - '\s*mur\s*=\s*(?P%s)'%a_float_re+\ - '\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) - weight_label_PDF_adv = re.compile('^\s*PDF\s*=\s*(?P\d+)\s+(?P\S+)\s*$') + weight_label_scale_adv = re.compile(r'^\s*dyn\s*=\s*(?P%s)'%a_int_re+\ + r'\s*mur\s*=\s*(?P%s)'%a_float_re+\ + r'\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) + weight_label_PDF_adv = re.compile(r'^\s*PDF\s*=\s*(?P\d+)\s+(?P\S+)\s*$') class ParseError(MadGraph5Error): @@ -926,7 +926,7 @@ def get_HwU_source(self, print_header=True): res.append(' '.join('%+16.7e'%wgt for wgt in list(bin.boundaries))) res[-1] += ' '.join('%+16.7e'%bin.wgts[key] for key in self.bins.weight_labels if key not in ['central','stat_error']) - res.append('<\histogram>') + res.append(r'<\histogram>') return res def output(self, path=None, format='HwU', print_header=True): @@ -1149,6 +1149,8 @@ def parse_one_histo_from_stream(self, stream, all_weight_header, boundaries = [0.0,0.0] for j, weight in \ enumerate(HwU.histo_bin_weight_re.finditer(line_bin)): + if (j == len(weight_header)): + continue if j == len(all_weight_header): raise HwU.ParseError("There is more bin weights"+\ " specified than expected (%i)"%len(weight_header)) @@ -1803,7 +1805,7 @@ def parse_histos_from_PY8_XML_stream(self, stream, run_id=None, # Filter empty weights coming from the split weight_label_list = [wgt.strip() for wgt in str(selected_run_node.getAttribute('header')).split(';') if - not re.match('^\s*$',wgt)] + not re.match(r'^\s*$',wgt)] ordered_weight_label_list = [w for w in weight_label_list if w not\ in ['xmin','xmax']] # Remove potential repetition of identical weight labels @@ -1827,7 +1829,7 @@ def parse_histos_from_PY8_XML_stream(self, stream, run_id=None, all_weights = [] for wgt_position, wgt_label in \ enumerate(str(selected_run_node.getAttribute('header')).split(';')): - if not re.match('^\s*$',wgt_label) is None: + if not re.match(r'^\s*$',wgt_label) is None: continue all_weights.append({'POSITION':wgt_position}) for wgt_item in wgt_label.strip().split('_'): @@ -2714,7 +2716,7 @@ def ratio_no_correlations(wgtsA, wgtsB): # First the global gnuplot header for this histogram group global_header =\ -""" +r""" ################################################################################ ### Rendering of the plot titled '%(title)s' ################################################################################ @@ -2862,9 +2864,9 @@ def ratio_no_correlations(wgtsA, wgtsB): major_title = ', '.join(major_title) if not mu[0] in ['none',None]: - major_title += ', dynamical\_scale\_choice=%s'%mu[0] + major_title += r', dynamical\_scale\_choice=%s'%mu[0] if not pdf[0] in ['none',None]: - major_title += ', PDF=%s'%pdf[0].replace('_','\_') + major_title += ', PDF=%s'%pdf[0].replace('_',r'\_') # Do not show uncertainties for individual jet samples (unless first # or specified explicitely and uniquely) @@ -2937,7 +2939,7 @@ def ratio_no_correlations(wgtsA, wgtsB): plot_lines.append( "'%s' index %d using (($1+$2)/2):%d ls %d title '%s'"\ %(HwU_name,block_position+i,mu_var+3,color_index,\ -'%s dynamical\_scale\_choice=%s' % (title,mu[j]))) +r'%s dynamical\_scale\_choice=%s' % (title,mu[j]))) # And now PDF_variation if available if not PDF_var_pos is None: for j,PDF_var in enumerate(PDF_var_pos): @@ -2947,7 +2949,7 @@ def ratio_no_correlations(wgtsA, wgtsB): plot_lines.append( "'%s' index %d using (($1+$2)/2):%d ls %d title '%s'"\ %(HwU_name,block_position+i,PDF_var+3,color_index,\ -'%s PDF=%s' % (title,pdf[j].replace('_','\_')))) +'%s PDF=%s' % (title,pdf[j].replace('_',r'\_')))) # Now add the uncertainty lines, those not using a band so that they # are not covered by those using a band after we reverse plo_lines diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/launch_plugin.py b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/launch_plugin.py index 7b10bedcef..9ec09eb71d 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/launch_plugin.py +++ b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/launch_plugin.py @@ -98,6 +98,7 @@ def default_setup(self): self['vector_size'] = 16 # already setup in default class (just change value) self['aloha_flag'] = '--fast-math' self['matrix_flag'] = '-O3' + self['limhel'] = 0 self.display_block.append('simd') self.display_block.append('psoptim') diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/lhe_parser.py b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/lhe_parser.py index eee9ba4522..f6e47956cd 100755 --- a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/lhe_parser.py +++ b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/lhe_parser.py @@ -7,6 +7,7 @@ import numbers import math import time +import copy import os import shutil import sys @@ -101,7 +102,7 @@ def __init__(self, line=None, event=None): self.rwgt = 0 return - + self.event = event if event is not None: self.event_id = len(event) #not yet in the event @@ -1066,6 +1067,8 @@ def define_init_banner(self, wgt, lha_strategy, proc_charac=None): #special case for 1>N init_information = run_card.get_banner_init_information() event = next(self) + if not len(event): #if parse-momenta was false we have to parse the first event + event = Event(str(event)) init_information["idbmup1"] = event[0].pdg init_information["ebmup1"] = event[0].mass init_information["idbmup2"] = 0 @@ -1149,6 +1152,7 @@ def initialize_unweighting(self, getwgt, trunc_error): nb_keep = max(20, int(nb_event*trunc_error*15)) new_wgt = new_wgt[-nb_keep:] if nb_event == 0: + misc.sprint(i,f) raise Exception # store the information self.initial_nb_events[i] = nb_event @@ -1203,7 +1207,6 @@ def unweight(self, outputpath, get_wgt, **opts): (stop to write event when target is reached) """ - if isinstance(get_wgt, (str,six.text_type)): unwgt_name =get_wgt def get_wgt_multi(event): @@ -1483,12 +1486,12 @@ def reorder_mother_child(self): particle.mother2 -= 1 # re-call the function for the next potential change return self.reorder_mother_child() - - - - - + + + + + def parse_reweight(self): """Parse the re-weight information in order to return a dictionary {key: value}. If no group is define group should be '' """ @@ -1522,6 +1525,37 @@ def parse_nlo_weight(self, real_type=(1,11), threshold=None): threshold=threshold) return self.nloweight + def get_fks_pair(self, real_type=(1,11), threshold=None): + """ Gives the fks pair labels""" + start, stop = self.tag.find(''), self.tag.find('') + if start != -1 != stop: + text = self.tag[start+8:stop] + all_line = text.split('\n') + text = text.lower().replace('d','e') + all_line = text.split('\n') + for line in all_line: + data = line.split() + if len(data)>16: + wgt = OneNLOWeight(line, real_type=real_type) + return wgt.to_merge_pdg,wgt.nexternal + + def get_born_momenta(self,real_type=(1,11), threshold=None): + """ Gets the underlying n+1 body kinematics""" + start, stop = self.tag.find(''), self.tag.find('') + if start != -1 != stop: + text = self.tag[start+8:stop] + text = text.lower().replace('d','e') + all_line = text.split('\n') + for line in all_line: + data = line.split() + if len(data)>16: + wgt = OneNLOWeight(line, real_type=real_type) + nexternal = wgt.nexternal + real_momenta = all_line[2:2+nexternal] + return real_momenta + + + def rewrite_nlo_weight(self, wgt=None): """get the string associate to the weight""" @@ -1558,11 +1592,11 @@ def parse_lo_weight(self): return self.loweight if not hasattr(Event, 'loweight_pattern'): - Event.loweight_pattern = re.compile('''\s*(?P\d+)\s+(?P[\d.e+-]+)\s*\s*\n\s* - \s*(?P[\s\d.+-e]+)\s*\s*\n\s* - 1|2)["']?\>\s*(?P[\s\d.e+-]*)\s*\s*\n\s* - 1|2)["']?\>\s*(?P[\s\d.e+-]*)\s*\s*\n\s* - \s*(?P[\d.e+-]*)\s* + Event.loweight_pattern = re.compile('''\\s*(?P\\d+)\\s+(?P[\\d.e+-]+)\\s*\\s*\n\\s* + \\s*(?P[\\s\\d.+-e]+)\\s*\\s*\n\\s* + 1|2)["']?\\>\\s*(?P[\\s\\d.e+-]*)\\s*\\s*\n\\s* + 1|2)["']?\\>\\s*(?P[\\s\\d.e+-]*)\\s*\\s*\n\\s* + \\s*(?P[\\d.e+-]*)\\s* ''',re.X+re.I+re.M) start, stop = self.tag.find(''), self.tag.find('') @@ -1615,7 +1649,7 @@ def parse_matching_scale(self): self.matched_scale_data = [] - pattern = re.compile("") + pattern = re.compile(r"") data = re.split(pattern,self.tag) if len(data) == 1: return [] @@ -1623,7 +1657,7 @@ def parse_matching_scale(self): tmp = {} start,content, end = data self.tag = "%s%s" % (start, end) - pattern = re.compile("pt_clust_(\d*)=\"([\de+-.]*)\"") + pattern = re.compile("pt_clust_(\\d*)=\"([\\de+-.]*)\"") for id,value in pattern.findall(content): tmp[int(id)] = float(value) for i in range(1, len(self)+1): @@ -1647,7 +1681,7 @@ def parse_syscalc_info(self): return self.syscalc_data pattern = re.compile("|") - pattern2 = re.compile("<(?P[\w]*)(?:\s*(\w*)=[\"'](.*)[\"']\s*|\s*)>(.*)") + pattern2 = re.compile("<(?P[\\w]*)(?:\\s*(\\w*)=[\"'](.*)[\"']\\s*|\\s*)>(.*)") data = re.split(pattern,self.tag) if len(data) == 1: return [] @@ -1850,6 +1884,240 @@ def get_decay(self, pdg_code=0, event_id=None): return new_event + + def set_initial_mass_to_zero(self): + """set the masses of the initial particles to zero, by reshuffling the respective momenta + Works only in the **partonic** com frame, so the event must be boosted to such frame + before calling the function + """ + + if not misc.equal(self[0].px, 0) or not misc.equal(self[1].px, 0) or \ + not misc.equal(self[0].py, 0) or not misc.equal(self[1].py, 0) or \ + not misc.equal(self[0].pz, - self[1].pz, zero_limit=False): + misc.sprint(self[0]) + misc.sprint(self[1]) + raise Exception('momenta should be in the partonic center of mass frame') + + self[0].mass = 0. + self[1].mass = 0. + tot_E=0. + for ip,part in enumerate(self): + if part.status == 1 : + tot_E += part.E + if (self[0].pz > 0. and self[1].pz < 0): + self[0].set_momentum(FourMomentum([tot_E/2., 0., 0., tot_E/2.])) + self[1].set_momentum(FourMomentum([tot_E/2., 0., 0., -tot_E/2.])) + elif (self[0].pz < 0. and self[1].pz > 0): + self[0].set_momentum(FourMomentum([tot_E/2., 0., 0., -tot_E/2.])) + self[1].set_momentum(FourMomentum([tot_E/2., 0., 0., tot_E/2.])) + else: + logger.critical('ERROR: two incoming partons not back.-to-back') + + def set_final_jet_mass_to_zero(self): + """set the final light particle masses to zero + """ + + for ip,part in enumerate(self): + if ((abs(part.pid) <= 5) or (abs(part.pid) == 11) or (abs(part.pid) == 12)) and (part.status == 1): + part.mass = 0. + E_1_new = math.sqrt(part.mass**2 + part.px**2 + part.py**2 + part.pz**2) + part.set_momentum(FourMomentum([E_1_new, part.px, part.py, part.pz])) + + + + def merge_particles_kinematics(self, i,j, moth): + """Map to an underlying n-body kinematics for two given + particles i,j to be merged and a resulting moth""" + """ note! kinematics (and id) mapping only! """ + + recoil = True + fks_type = False + + if recoil and not fks_type: + if (i == moth[0].get('number')-1): + fks_i = i + fks_j = j + elif (j == moth[0].get('number')-1): + fks_i = j + fks_j = i + to_remove = fks_j + + merge_i = self[fks_i] + merge_j = self[fks_j] + + i_4mom = FourMomentum(merge_i) + j_4mom = FourMomentum(merge_j) + if (fks_i <= 1): + sign1 = -1.0 + else: + sign1 = 1.0 + mother_4mom = i_4mom + sign1*j_4mom + + new_event = copy.deepcopy(self) + + self[fks_i].pid = moth[0]['id'] + self[fks_i].set_momentum(mother_4mom) + + if fks_i <= 1: # initial-state recoil + new_p = FourMomentum() + for ip,part in enumerate(self): + if (ip != fks_i and ip != fks_j and ip >= 2): + new_p += part + + if fks_i == 0: + self[1].set_momentum(new_p - FourMomentum(self[0])) + elif fks_i == 1: + self[0].set_momentum(new_p - FourMomentum(self[1])) + + pz_1_new = self.recoil_eq(self[0],self[1]) + pz_2_new = self[0].pz + self[1].pz - pz_1_new + E_1_new = math.sqrt(self[0].mass**2 + self[0].px**2 + self[0].py**2 + pz_1_new **2) + E_2_new = math.sqrt(self[1].mass**2 + self[1].px**2 + self[1].py**2 + pz_2_new **2) + self[0].set_momentum(FourMomentum([E_1_new,self[0].px,self[0].py,pz_1_new])) + self[1].set_momentum(FourMomentum([E_2_new,self[1].px,self[1].py,pz_2_new])) + self.pop(to_remove) + + if fks_i > 1: # final-state recoil + + # Re-scale the energy of fks_i to make it on-shell + for ip,part in enumerate(self): + if (ip == fks_i): + part.E = math.sqrt(part.mass**2 + part.px**2 + part.py**2 + part.pz**2) + new_p.E = part.E + + # Find the overall energy in the final state + new_p.E = 0.0 + for ip,part in enumerate(self): + if (ip != fks_j and ip >= 2): + new_p.E += part.E + + # Use one of the initial states to absorb the energy change in the final state + self[1].set_momentum(FourMomentum([new_p.E-self[0].E,self[1].px,self[1].py,self[1].pz])) + + # Change the initial state pz and E + pz_1_new = self.recoil_eq(self[0],self[1]) + pz_2_new = self[0].pz + self[1].pz - pz_1_new + E_1_new = math.sqrt(self[0].mass**2 + self[0].px**2 + self[0].py**2 + pz_1_new **2) + E_2_new = math.sqrt(self[1].mass**2 + self[1].px**2 + self[1].py**2 + pz_2_new **2) + self[0].set_momentum(FourMomentum([E_1_new,self[0].px,self[0].py,pz_1_new])) + self[1].set_momentum(FourMomentum([E_2_new,self[1].px,self[1].py,pz_2_new])) + self.pop(to_remove) + + elif fks_type and not recoil: + ## Do it in a more FKS-style + if (i == moth[0].get('number')-1): + fks_i = i + fks_j = j + elif (j == moth[0].get('number')-1): + fks_i = j + fks_j = i + to_remove = fks_j + new_event = copy.copy(event) + + if fks_i <= 1: # initial-state recoil + + # First boost to partonic CM frame + q = FourMomentum(self[0])+FourMomentum(self[1]) + for ip,part in enumerate(self): + vec = FourMomentum(part) + self[ip].set_momentum(vec.zboost(pboost=q)) + + k_tot = FourMomentum([self[0].E+self[1].E-self[fks_j].E,self[0].px+self[1].px-self[fks_j].px,\ + self[0].py+self[1].py-self[fks_j].py,self[0].pz+self[1].pz-self[fks_j].pz]) + + final = FourMomentum([0,0,0,0]) + for ip,part in enumerate(self): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + if (ip != fks_i and ip != fks_j and ip >= 2): + final = final + vec + + s = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz])**2 + ksi = self[fks_j].E/(math.sqrt(s)/2.0) + y = self[fks_j].pz/self[fks_j].E + + self[0].pz = self[0].pz * math.sqrt(1.0-ksi)*math.sqrt((2.0-ksi*(1.0+y))/((2.0-ksi*(1.0-y)))) + self[0].E = math.sqrt(self[0].mass**2 + self[0].pz**2) + self[1].pz = self[1].pz * math.sqrt(1.0-ksi)*math.sqrt((2.0-ksi*(1.0-y))/((2.0-ksi*(1.0+y)))) + self[1].E = math.sqrt(self[1].mass**2 + self[1].pz**2) + + final = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + k_tot_1 = k_tot.zboost(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + k_tot_2 = k_tot_1.pt_boost(pboost=FourMomentum([k_tot_1.E,k_tot_1.px,k_tot_1.py,k_tot_1.pz])) + k_tot_3 = k_tot_2.zboost_inv(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + + for ip,part in enumerate(self): + if (ip >= 2): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + vec2 = vec.zboost(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + vec3 = vec2.pt_boost(pboost=FourMomentum([k_tot_1.E,k_tot_1.px,k_tot_1.py,k_tot_1.pz])) + vec_new = vec3.zboost_inv(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + self[ip].set_momentum(FourMomentum([vec_new.E,vec_new.px,vec_new.py,vec_new.pz])) + + self.pop(to_remove) + + else: # final-state recoil + q = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + for ip,part in enumerate(self): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + self[ip].set_momentum(vec.zboost(pboost=q)) + + q = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + k = FourMomentum([self[fks_i].E+self[fks_j].E,self[fks_i].px+self[fks_j].px,\ + self[fks_i].py+self[fks_j].py,self[fks_i].pz+self[fks_j].pz]) + + k_rec = FourMomentum([0,0,0,0]) + for ip,part in enumerate(self): + if ip >= 2 and ip != fks_i and ip != fks_j: # add only final-states to the recoil and not the FKS pair + k_rec = k_rec + FourMomentum([part.E,part.px,part.py,part.pz]) + + k_mom = math.sqrt(k_rec.px**2 + k_rec.py**2 + k_rec.pz**2) + beta = (q**2 - (k_rec.E+k_mom)**2)/(q**2 + (k_rec.E+k_mom)**2) + for ip,part in enumerate(self): + if ip >= 2 and ip != fks_i and ip != fks_j: + vec = FourMomentum([self[ip].E,self[ip].px,self[ip].py,self[ip].pz]) + self[ip].set_momentum(vec.boost_beta(beta,k_rec)) + if ip == fks_i: + self[ip].set_momentum(q - k_rec.boost_beta(beta,k_rec)) + self.pop(to_remove) + else: + logger.info('Error in Sudakov Born mapping: no recoil scheme found!') + + def recoil_eq(self,part1, part2): + """ In general, solves the equation + E1 + E2 = K + p1 + p2 = c + E1^2 - p1^2 = a + E2^2 - p2^2 = b + and returns p1 + """ + thresh = 1e-6 + import random + a = part1.mass**2 + part1.px**2 + part1.py**2 + b = part2.mass**2 + part2.px**2 + part2.py**2 + c = part1.pz + part2.pz + K = part1.E + part2.E + K2 = K**2 + sol1 = (-a*c + b*c + c**3 - c*K2 - math.sqrt(K2*(a**2 + (b + c**2 - K2)**2 - 2*a*(b - c**2 + K2))))/(2*(c**2-K2)) + sol2 = (-a*c + b*c + c**3 - c*K2 + math.sqrt(K2*(a**2 + (b + c**2 - K2)**2 - 2*a*(b - c**2 + K2))))/(2*(c**2-K2)) + + if abs(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2) - (math.sqrt(a+sol2**2) + math.sqrt(b+(c-sol2)**2))) > thresh: + logger.critical('Error in recoil_eq solver 1') + logger.critical(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2)) + logger.critical(math.sqrt(a+sol2**2) + math.sqrt(b+(c-sol2)**2)) + if abs(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2) - K) > thresh: + logger.critical('Error in recoil_eq solver 2') + logger.critical(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2)) + logger.critical(K) + return sol1 + + def boost(self, filter=None): """modify the current event to boost it according to the current filter""" if filter is None: @@ -1861,7 +2129,7 @@ def boost(self, filter=None): if list(filter(p)): pboost += p else: - pboost = FourMomentum(pboost) + pboost = FourMomentum(filter) # change sign of three-component due to helas convention pboost.px *=-1 @@ -1877,7 +2145,7 @@ def check(self): """check various property of the events""" # check that relative error is under control - threshold = 1e-6 + threshold = 1e-4 #1. Check that the 4-momenta are conserved E, px, py, pz = 0,0,0,0 @@ -1920,7 +2188,50 @@ def check(self): self.check_color_structure() #3. check mass - + + def check_kinematics_only(self): + """check various property of the events - only kinematics""" + + # check that relative error is under control + threshold = 1e-3 + + #1. Check that the 4-momenta are conserved + E, px, py, pz = 0,0,0,0 + absE, abspx, abspy, abspz = 0,0,0,0 + for particle in self: + coeff = 1 + if particle.status == -1: + coeff = -1 + elif particle.status != 1: + continue + E += coeff * particle.E + absE += abs(particle.E) + px += coeff * particle.px + py += coeff * particle.py + pz += coeff * particle.pz + abspx += abs(particle.px) + abspy += abs(particle.py) + abspz += abs(particle.pz) + # check mass + fourmass = FourMomentum(particle).mass + + if particle.mass and (abs(particle.mass) - fourmass)/ abs(particle.mass) > threshold: + logger.critical(self) + raise Exception( "Do not have correct mass lhe: %s momentum: %s (error at %s" % (particle.mass, fourmass, (abs(particle.mass) - fourmass)/ abs(particle.mass))) + + if abs(E/absE) > threshold: + logger.critical(self) + raise Exception("Do not conserve Energy %s, %s" % (E/absE, E)) + if abs(px/abspx) > threshold: + logger.critical(self) + raise Exception("Do not conserve Px %s, %s" % (px/abspx, px)) + if abs(py/abspy) > threshold: + logger.critical(self) + raise Exception("Do not conserve Py %s, %s" % (py/abspy, py)) + if abs(pz/abspz) > threshold: + logger.critical(self) + raise Exception("Do not conserve Pz %s, %s" % (pz/abspz, pz)) + def assign_scale_line(self, line, convert=True): """read the line corresponding to global event line @@ -2764,7 +3075,7 @@ def zboost(self, pboost=None, E=0, pz=0): if isinstance(pboost, FourMomentum): E = pboost.E pz = pboost.pz - + #beta = pz/E gamma = E / math.sqrt(E**2-pz**2) gammabeta = pz / math.sqrt(E**2-pz**2) @@ -2778,6 +3089,74 @@ def zboost(self, pboost=None, E=0, pz=0): out.pz = 0 return out + def zboost_inv(self, pboost=None, E=0, pz=0): + """Both momenta should be in the same frame. + The boost perform correspond to the boost required to set pboost at + rest (only z boost applied). + """ + if isinstance(pboost, FourMomentum): + E = pboost.E + pz = pboost.pz + + #beta = pz/E + gamma = E / math.sqrt(E**2-pz**2) + gammabeta = pz / math.sqrt(E**2-pz**2) + + out = FourMomentum([gamma*self.E + gammabeta*self.pz, + self.px, + self.py, + gamma*self.pz + gammabeta*self.E]) + + if abs(out.pz) < 1e-6 * out.E: + out.pz = 0 + return out + + + def pt_boost(self, pboost=None, E=0, pz=0): + """Both momenta should be in the same frame. + The boost perform correspond to the boost required to set pboost at + rest (only pT boost applied). + """ + + if isinstance(pboost, FourMomentum): + E = pboost.E + px = pboost.px + py = pboost.py + mass = math.sqrt(E**2 - px**2 - py**2) + + betax = px/E + betay = py/E + beta = math.sqrt(betax**2+betay**2) + gamma = 1 / math.sqrt(1.0-beta**2) + + out = FourMomentum([gamma*self.E - gamma*betax*self.px - gamma*betay*self.py, + -gamma*betax*self.E + (1.0 + (gamma-1.0)*betax**2/(beta**2))*self.px + (gamma-1.0)*betax*betay/(beta**2)*self.py, + -gamma*betay*self.E + ((gamma-1.0)*betax*betay/(beta**2))*self.px + (1.0+(gamma-1.0)*(betay**2)/(beta**2))*self.py, + self.pz]) + + if abs(out.px) < 1e-6 * out.E: + out.px = 0 + if abs(out.py) < 1e-6 * out.E: + out.py = 0 + return out + + def boost_beta(self,beta,mom): + """ Boost along the three-momentum of mom with a boost of size beta""" + + unit = mom * (1.0/math.sqrt(mom.px**2+mom.py**2+mom.pz**2)) + beta_vec = beta*unit + bx = beta_vec.px + by = beta_vec.py + bz = beta_vec.pz + gamma = 1.0 / math.sqrt(1.0-beta**2) + + out = FourMomentum([gamma*self.E - gamma*bx*self.px - gamma*by*self.py - gamma*bz*self.pz, + -gamma*bx*self.E + (1.0 + (gamma-1.0)*bx**2/(beta**2))*self.px + (gamma-1.0)*bx*by/(beta**2)*self.py + (gamma-1.0)*bx*bz/(beta**2)*self.pz, + -gamma*by*self.E + ((gamma-1.0)*bx*by/(beta**2))*self.px + (1.0+(gamma-1.0)*(by**2)/(beta**2))*self.py + (gamma-1.0)*by*bz/(beta**2)*self.pz, + -gamma*bz*self.E + (gamma-1.0)*bx*bz/(beta**2)*self.px + (gamma-1.0)*(by*bz)/(beta**2)*self.py + (1.0+(gamma-1.0)*bz**2/(beta**2))*self.pz]) + + return out + def boost_to_restframe(self, pboost): """apply the boost transformation such that pboost is at rest in the new frame. First apply a rotation to allign the pboost to the z axis and then use @@ -2789,27 +3168,64 @@ def boost_to_restframe(self, pboost): return out - # write pboost as (E, p cosT sinF, p sinT sinF, p cosF) - # rotation such that it become (E, 0 , 0 , p ) is - # cosT sinF , -sinT , cosT sinF - # sinT cosF , cosT , sinT sinF - # -sinT , 0 , cosF - p = math.sqrt( pboost.px**2 + pboost.py**2+ pboost.pz**2) - cosF = pboost.pz / p - sinF = math.sqrt(1-cosF**2) - sinT = pboost.py/p/sinF - cosT = pboost.px/p/sinF - - out=FourMomentum([self.E, - self.px*cosT*cosF + self.py*sinT*cosF-self.pz*sinF, - -self.px*sinT+ self.py*cosT, - self.px*cosT*sinF + self.py*sinT*sinF + self.pz*cosF - ]) - out = out.zboost(E=pboost.E,pz=p) + # see here https://physics.stackexchange.com/questions/749036/general-lorentz-boost-of-four-momentum-in-cm-frame-particle-physics + vx = pboost.px/pboost.E + vy = pboost.py/pboost.E + vz = pboost.pz/pboost.E + v = pboost.norm/pboost.E + v2 = pboost.norm_sq/pboost.E**2 + gamma = 1./math.sqrt(1.-v**2) + gammo = gamma-1. + out = FourMomentum(E = gamma*(self.E - vx*self.px - vy*self.py - vz*self.pz), + px= -gamma*vx*self.E + (1+gammo*vx**2/v2)*self.px + gammo*vx*vy/v2*self.py + gammo*vx*vz/v2*self.pz, + py= -gamma*vy*self.E + gammo*vy*vx/v2*self.px + (1+gammo*vy**2/v2)*self.py + gammo*vy*vz/v2*self.pz, + pz= -gamma*vz*self.E + gammo*vz*vx/v2*self.px + gammo*vz*vy/v2*self.py + (1+gammo*vz**2/v2)*self.pz) + return out + def rotate_to_z(self,prot): + + import math + import numpy as np + + z = np.array([0.,0.,1.]) + + px = self.px + py = self.py + pz = self.pz + + refx = prot.px + refy = prot.py + refz = prot.pz + + prot_mom = np.array([px, py, pz]) + ref_mom = np.array([refx, refy, refz]) + + # Create normal vector + n = np.array([refy, -refx, 0.]) + n = n * 1./math.sqrt(self.threedot(n,n)) + t = prot_mom - self.threedot(n,prot_mom)*n + p = ref_mom - self.threedot(ref_mom,z)*z + p = p/math.sqrt(self.threedot(p,p)) + + t_pz = np.array([self.threedot(t,p), self.threedot(t,z), 0.]) + costheta = self.threedot(ref_mom,z)* 1./math.sqrt(self.threedot(ref_mom, ref_mom)) + sintheta=math.sqrt(1.-costheta**2) + + sgn = 1. + t_pz_p = np.array([0., 0., 0.]) + t_pz_p[0] = costheta*t_pz[0] + sgn*(-sintheta) * t_pz[1] + t_pz_p[1] = sgn*sintheta*t_pz[0] + costheta * t_pz[1] + + out_mom = self.threedot(n,prot_mom)*n + t_pz_p[0]*p + t_pz_p[1]*z + + out = FourMomentum([self.E,out_mom[0], out_mom[1], out_mom[2] ] ) + + return out - + def threedot(self,a,b): + + return a[0]*b[0]+a[1]*b[1]+a[2]*b[2] class OneNLOWeight(object): diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/madevent_interface.py b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/madevent_interface.py index 2a118e21bf..8e30cf690c 100755 --- a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/madevent_interface.py +++ b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/madevent_interface.py @@ -496,7 +496,6 @@ def help_remove(self): logger.info(" the optional '-f' allows to by-pass all security question") logger.info(" The banner can be remove only if all files are removed first.") - class AskRun(cmd.ControlSwitch): """a class for the question on what to do on a madevent run""" @@ -2393,13 +2392,17 @@ def do_generate_events(self, line): # Check argument's validity mode = self.check_generate_events(args) switch_mode = self.ask_run_configuration(mode, args) - if not args: - # No run name assigned -> assigned one automaticaly - self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton') - else: - self.set_run_name(args[0], None, 'parton', True) - args.pop(0) - + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat'), consistency=False) + if not run_card.scan_set: + if not args: + # No run name assigned -> assigned one automaticaly + self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton') + else: + self.set_run_name(args[0], None, 'parton', True) + args.pop(0) + + self.run_generate_events(switch_mode, args) self.postprocessing() @@ -2560,7 +2563,7 @@ def wait_monitoring(Idle, Running, Done): self.update_status("postprocessing contur done", level="rivet") # this decorator handle the loop related to scan. - @common_run.scanparamcardhandling() + @common_run.scanparamcardhandling(run_card_scan=True) def run_generate_events(self, switch_mode, args): if self.proc_characteristics['loop_induced'] and self.options['run_mode']==0: @@ -2593,7 +2596,6 @@ def run_generate_events(self, switch_mode, args): # Regular run mode logger.info('Generating %s events with run name %s' % (self.run_card['nevents'], self.run_name)) - self.exec_cmd('survey %s %s' % (self.run_name,' '.join(args)), postcmd=False) nb_event = self.run_card['nevents'] @@ -2975,7 +2977,7 @@ def update_width_in_param_card(decay_info, initial=None, output=None): particle = 0 # Read BRs for this decay line = param_card[line_number] - while re.search('^(#|\s|\d)', line): + while re.search(r'^(#|\s|\d)', line): line = param_card.pop(line_number) if not particle or line.startswith('#'): line=param_card[line_number] @@ -3226,7 +3228,7 @@ def do_treatcards(self, line, mode=None, opt=None): for line in open(pjoin(bias_module_path,'%s.f'%os.path.basename(bias_module_path))): if start and last: break - if not start and not re.search('c\s*parameters\s*=\s*{',line, re.I): + if not start and not re.search(r'c\s*parameters\s*=\s*{',line, re.I): continue start = True if not line.startswith('C'): @@ -3235,7 +3237,7 @@ def do_treatcards(self, line, mode=None, opt=None): if '{' in line: line = line.split('{')[-1] # split for } ! # - split_result = re.split('(\}|!|\#)', line,1, re.M) + split_result = re.split(r'(\}|!|\#)', line,1, re.M) line = split_result[0] sep = split_result[1] if len(split_result)>1 else None if sep == '}': @@ -3514,8 +3516,8 @@ def pass_in_difficult_integration_mode(self, rate=1): text = open(conf_path).read() min_evt, max_evt = 2500 *(2+rate), 10000*(rate+1) - text = re.sub('''\(min_events = \d+\)''', '(min_events = %i )' % min_evt, text) - text = re.sub('''\(max_events = \d+\)''', '(max_events = %i )' % max_evt, text) + text = re.sub(r'''\(min_events = \d+\)''', '(min_events = %i )' % min_evt, text) + text = re.sub(r'''\(max_events = \d+\)''', '(max_events = %i )' % max_evt, text) fsock = open(conf_path, 'w') fsock.write(text) fsock.close() @@ -3619,7 +3621,7 @@ def do_refine(self, line): alljobs = misc.glob('ajob*', Pdir) #remove associated results.dat (ensure to not mix with all data) - Gre = re.compile("\s*j=(G[\d\.\w]+)") + Gre = re.compile(r"\s*j=(G[\d\.\w]+)") for job in alljobs: Gdirs = Gre.findall(open(job).read()) for Gdir in Gdirs: @@ -3727,58 +3729,126 @@ def do_combine_events(self, line): sum_xsec, sum_xerru, sum_axsec = 0,[],0 Gdirs = self.get_Gdir() Gdirs.sort() - for Gdir in Gdirs: - if os.path.exists(pjoin(Gdir, 'events.lhe')): - result = sum_html.OneResult('') - result.read_results(pjoin(Gdir, 'results.dat')) - sum_xsec += result.get('xsec') - sum_xerru.append(result.get('xerru')) - sum_axsec += result.get('axsec') - - if self.run_card['gridpack'] or self.run_card['nevents']==0: - os.remove(pjoin(Gdir, 'events.lhe')) - continue + partials_info = [] + try: + p = subprocess.Popen(["ulimit", "-n"], stdout=subprocess.PIPE) + out, err = p.communicate() + max_G = out.decode() + if max_G == "unlimited": + max_G =2500 + else: + max_G = int(max_G) - 40 + except Exception as error: + logger.debug(error) + max_G = 80 # max(20, len(Gdirs)/self.options['nb_core']) - AllEvent.add(pjoin(Gdir, 'events.lhe'), - result.get('xsec'), - result.get('xerru'), - result.get('axsec') - ) - - if len(AllEvent) >= 80: #perform a partial unweighting - AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % partials), - get_wgt, log_level=5, trunc_error=1e-2, event_target=self.run_card['nevents']) - AllEvent = lhe_parser.MultiEventFile() - AllEvent.banner = self.banner - AllEvent.add(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % partials), - sum_xsec, - math.sqrt(sum(x**2 for x in sum_xerru)), - sum_axsec) - partials +=1 - if not hasattr(self,'proc_characteristic'): self.proc_characteristic = self.get_characteristics() - if len(AllEvent) == 0: - nb_event = 0 - else: + mycluster = cluster.MultiCore(nb_core=self.options['nb_core']) + + def split(a, n): + """split a list "a" into n chunk of same size (or nearly same size)""" + k, m = divmod(len(a), n) + return (a[i*k+min(i, m):(i+1)*k+min(i+1, m)] for i in range(n)) + + partials_info = [] + if len(Gdirs) >= max_G: + start_unweight= time.perf_counter() + # first check in how many chunk we have to split (always use a multiple of nb_core) + nb_split = 1 + nb_G = len(Gdirs) // (2* self.options['nb_core']) + while nb_G > min(80, max_G): + nb_split += 1 + nb_G = len(Gdirs)//(nb_split*2*self.options['nb_core']) + if nb_G < 10: + nb_split -=1 + nb_G = len(Gdirs)//(nb_split*2*self.options['nb_core']) + + #enforce at least 10 directory per thread + if nb_G > 10 or nb_split>1: + # do the unweighting of each chunk on their own thread + nb_chunk = (nb_split*2*self.options['nb_core']) + else: + nb_chunk = len(Gdirs) // 10 + nb_G =10 + + # security that the number of combine events is too large + if nb_chunk >= max_G: + nb_chunk = max_G -1 + nb_G = len(Gdirs) // nb_chunk + + for i, local_G in enumerate(split(Gdirs, nb_chunk)): + line = [pjoin(self.me_dir, "Events", self.run_name, "partials%d.lhe.gz" % i)] + line.append(pjoin(self.me_dir, 'Events', self.run_name, '%s_%s_banner.txt' % (self.run_name, tag))) + line.append(str(self.results.current['cross'])) + line += local_G + partials_info.append(self.do_combine_events_partial(' '.join(line), preprocess_only=True)) + mycluster.submit(sys.executable, + [pjoin(self.me_dir, 'bin', 'internal', 'madevent_interface.py'), 'combine_events_partial'] + line, + stdout='/dev/null' + ) + + starttime = time.time() + update_status = lambda idle, run, finish: \ + self.update_status((idle, run, finish, 'unweight'), level=None, + force=False, starttime=starttime) + mycluster.wait(self.me_dir, update_status) + # do the final combination + for data in partials_info: + AllEvent.add(*data) + + start_unweight= time.perf_counter() nb_event = AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "unweighted_events.lhe.gz"), get_wgt, trunc_error=1e-2, event_target=self.run_card['nevents'], log_level=logging.DEBUG, normalization=self.run_card['event_norm'], proc_charac=self.proc_characteristic) + + #cleaning + for data in partials_info: + path = data[0] + try: + os.remove(path) + except Exception as error: + try: + os.remove(path[:-3]) # try without the .gz + except: + misc.sprint('no file ', path, 'to clean') + else: + for Gdir in Gdirs: + if os.path.exists(pjoin(Gdir, 'events.lhe')): + result = sum_html.OneResult('') + result.read_results(pjoin(Gdir, 'results.dat')) + sum_xsec += result.get('xsec') + sum_xerru.append(result.get('xerru')) + sum_axsec += result.get('axsec') + + if self.run_card['gridpack'] or self.run_card['nevents']==0: + os.remove(pjoin(Gdir, 'events.lhe')) + continue + + AllEvent.add(pjoin(Gdir, 'events.lhe'), + result.get('xsec'), + result.get('xerru'), + result.get('axsec') + ) + + if len(AllEvent) == 0: + nb_event = 0 + else: + nb_event = AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "unweighted_events.lhe.gz"), + get_wgt, trunc_error=1e-2, event_target=self.run_card['nevents'], + log_level=logging.DEBUG, normalization=self.run_card['event_norm'], + proc_charac=self.proc_characteristic) + + if nb_event < self.run_card['nevents']: + logger.warning("failed to generate enough events. Please follow one of the following suggestions to fix the issue:") + logger.warning(" - set in the run_card.dat 'sde_strategy' to %s", 1 + self.run_card['sde_strategy'] % 2) + logger.warning(" - set in the run_card.dat 'hard_survey' to 1 or 2.") + logger.warning(" - reduce the number of requested events (if set too high)") + logger.warning(" - check that you do not have -integrable- singularity in your amplitude.") + logger.warning(" - regenerate your process directory by selecting another gauge (in particular try FD gauge).") - if nb_event < self.run_card['nevents']: - logger.warning("failed to generate enough events. Please follow one of the following suggestions to fix the issue:") - logger.warning(" - set in the run_card.dat 'sde_strategy' to %s", 1 + self.run_card['sde_strategy'] % 2) - logger.warning(" - set in the run_card.dat 'hard_survey' to 1 or 2.") - logger.warning(" - reduce the number of requested events (if set too high)") - logger.warning(" - check that you do not have -integrable- singularity in your amplitude.") - if partials: - for i in range(partials): - try: - os.remove(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % i)) - except Exception: - os.remove(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe" % i)) self.results.add_detail('nb_event', nb_event) @@ -3789,7 +3859,50 @@ def do_combine_events(self, line): logger.info("combination of events done in %s s ", time.time()-start) self.to_store.append('event') + + ############################################################################ + def do_combine_events_partial(self, line, preprocess_only=False): + """ """ + + AllEvent = lhe_parser.MultiEventFile() + + sum_xsec, sum_xerru, sum_axsec = 0,[],0 + output, banner_path,cross = line.split()[:3] + Gdirs = line.split()[3:] + + cross = float(cross) + if not self.banner: + self.banner = banner_mod.Banner(banner_path) + if not hasattr(self, 'run_card'): + self.run_card = banner_mod.RunCard(self.banner['mgruncard']) + AllEvent.banner = self.banner + + for Gdir in Gdirs: + if os.path.exists(pjoin(Gdir, 'events.lhe')): + result = sum_html.OneResult('') + result.read_results(pjoin(Gdir, 'results.dat')) + sum_xsec += result.get('xsec') + sum_xerru.append(result.get('xerru')) + sum_axsec += result.get('axsec') + + if self.run_card['gridpack'] or self.run_card['nevents']==0: + os.remove(pjoin(Gdir, 'events.lhe')) + continue + if not preprocess_only: + AllEvent.add(pjoin(Gdir, 'events.lhe'), + result.get('xsec'), + result.get('xerru'), + result.get('axsec') + ) + if preprocess_only: + return output, sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), sum_axsec + nb_event = max(min(abs(1.01*self.run_card['nevents']*sum_axsec/cross),self.run_card['nevents']), 10) + get_wgt = lambda event: event.wgt + AllEvent.unweight(output, + get_wgt, log_level=5, trunc_error=1e-2, event_target=nb_event) + return output, sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), sum_axsec + ############################################################################ def correct_bias(self): """check the first event and correct the weight by the bias @@ -3902,13 +4015,19 @@ def do_store_events(self, line): #except Exception: # continue # Store log - try: - if os.path.exists(pjoin(G_path, 'log.txt')): - input = pjoin(G_path, 'log.txt') + input = pjoin(G_path, 'log.txt') + if os.path.exists(input): + if self.run_card['keep_log'] not in ["none", "minimal"]: output = pjoin(G_path, '%s_log.txt' % run) - files.mv(input, output) - except Exception: - continue + try: + files.mv(input, output) + except Exception: + continue + elif self.run_card['keep_log'] == "none": + try: + os.remove(input) + except Exception: + continue #try: # # Grid # for name in ['ftn26']: @@ -3989,7 +4108,7 @@ def do_create_gridpack(self, line): misc.call(['./bin/internal/make_gridpack'], cwd=self.me_dir) files.mv(pjoin(self.me_dir, 'gridpack.tar.gz'), pjoin(self.me_dir, '%s_gridpack.tar.gz' % self.run_name)) - os.system("sed -i.bak \"s/\s*.true.*=.*GridRun/ .false. = GridRun/g\" %s/Cards/grid_card.dat" \ + os.system("sed -i.bak \"s/\\s*.true.*=.*GridRun/ .false. = GridRun/g\" %s/Cards/grid_card.dat" \ % self.me_dir) self.update_status('gridpack created', level='gridpack') @@ -4476,7 +4595,7 @@ def do_pythia8(self, line): else: preamble = misc.get_HEPTools_location_setter( pjoin(MG5DIR,'HEPTools'),'lib') - preamble += "\n unset PYTHIA8DATA\n" + #preamble += "\n unset PYTHIA8DATA\n" open(pythia_cmd_card,'w').write("""! ! It is possible to run this card manually with: @@ -4691,7 +4810,7 @@ def do_pythia8(self, line): # Make sure to sure the number of split_events determined during the splitting. split_PY8_Card.systemSet('Main:numberOfEvents',partition_for_PY8[i]) split_PY8_Card.systemSet('HEPMCoutput:scaling',split_PY8_Card['HEPMCoutput:scaling']* - (float(partition_for_PY8[i])/float(n_events))) + (float(partition_for_PY8[i]))) # Add_missing set to False so as to be sure not to add any additional parameter w.r.t # the ones in the original PY8 param_card copied. split_PY8_Card.write(pjoin(parallelization_dir,'PY8Card_%d.dat'%i), @@ -4963,9 +5082,9 @@ def wait_monitoring(Idle, Running, Done): if cross_sections: # Filter the cross_sections specified an keep only the ones # with central parameters and a different merging scale - a_float_re = '[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' + a_float_re = r'[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' central_merging_re = re.compile( - '^\s*Weight_MERGING\s*=\s*(?P%s)\s*$'%a_float_re, + r'^\s*Weight_MERGING\s*=\s*(?P%s)\s*$'%a_float_re, re.IGNORECASE) cross_sections = dict( (float(central_merging_re.match(xsec).group('merging')),value) @@ -5016,8 +5135,8 @@ def wait_monitoring(Idle, Running, Done): def parse_PY8_log_file(self, log_file_path): """ Parse a log file to extract number of event and cross-section. """ - pythiare = re.compile("Les Houches User Process\(es\)\s*\d+\s*\|\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)\s*\|\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") - pythia_xsec_re = re.compile("Inclusive cross section\s*:\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") + pythiare = re.compile(r"Les Houches User Process\(es\)\s*\d+\s*\|\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)\s*\|\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") + pythia_xsec_re = re.compile(r"Inclusive cross section\s*:\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") sigma_m, Nacc, Ntry = None, None, None for line in misc.BackRead(log_file_path): info = pythiare.search(line) @@ -5158,7 +5277,7 @@ def do_pythia(self, line): # read the line from the bottom of the file #pythia_log = misc.BackRead(pjoin(self.me_dir,'Events', self.run_name, # '%s_pythia.log' % tag)) - pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") + pythiare = re.compile(r"\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") for line in misc.reverse_readline(pjoin(self.me_dir,'Events', self.run_name, '%s_pythia.log' % tag)): info = pythiare.search(line) @@ -5619,8 +5738,8 @@ def launch_job(self,exe, cwd=None, stdout=None, argument = [], remaining=0, input_files.append(self.get_pdf_input_filename()) #Find the correct ajob - Gre = re.compile("\s*j=(G[\d\.\w]+)") - origre = re.compile("grid_directory=(G[\d\.\w]+)") + Gre = re.compile(r"\s*j=(G[\d\.\w]+)") + origre = re.compile(r"grid_directory=(G[\d\.\w]+)") try : fsock = open(exe) except Exception: @@ -5628,7 +5747,7 @@ def launch_job(self,exe, cwd=None, stdout=None, argument = [], remaining=0, text = fsock.read() output_files = Gre.findall(text) if not output_files: - Ire = re.compile("for i in ([\d\.\s]*) ; do") + Ire = re.compile(r"for i in ([\d\.\s]*) ; do") data = Ire.findall(text) data = ' '.join(data).split() for nb in data: @@ -6035,7 +6154,7 @@ def get_last_tag(self, level): 'syscalc':[], 'rivet':['rivet']} - if name == self.run_name: + if name and name == self.run_name: if reload_card: run_card = pjoin(self.me_dir, 'Cards','run_card.dat') self.run_card = banner_mod.RunCard(run_card) @@ -6334,7 +6453,7 @@ def run_syscalc(self, mode='parton', event_path=None, output=None): elif mode == 'Pythia': stdout = open(pjoin(event_dir, self.run_name, '%s_%s_syscalc.log' % (tag,mode)),'w') if 'mgpythiacard' in self.banner: - pat = re.compile('''^\s*qcut\s*=\s*([\+\-\d.e]*)''', re.M+re.I) + pat = re.compile(r'''^\s*qcut\s*=\s*([\+\-\d.e]*)''', re.M+re.I) data = pat.search(self.banner['mgpythiacard']) if data: qcut = float(data.group(1)) @@ -6611,7 +6730,7 @@ def get_subP_ids(path): for line in open(pjoin(path, 'leshouche.inc')): if not 'IDUP' in line: continue - particles = re.search("/([\d,-]+)/", line) + particles = re.search(r"/([\d,-]+)/", line) all_ids.append([int(p) for p in particles.group(1).split(',')]) return all_ids @@ -6899,6 +7018,7 @@ def do_combine_events(self, line): partials = 0 # if too many file make some partial unweighting sum_xsec, sum_xerru, sum_axsec = 0,[],0 + partials_info = [] Gdirs = self.get_Gdir() Gdirs.sort() for Gdir in Gdirs: @@ -6917,16 +7037,21 @@ def do_combine_events(self, line): sum_axsec += result.get('axsec')*gscalefact[Gdir] if len(AllEvent) >= 80: #perform a partial unweighting + nb_event = min(abs(1.01*self.nb_event*sum_axsec/self.results.current['cross']),self.run_card['nevents']) AllEvent.unweight(pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), - get_wgt, log_level=5, trunc_error=1e-2, event_target=self.nb_event) + get_wgt, log_level=5, trunc_error=1e-2, event_target=nb_event) AllEvent = lhe_parser.MultiEventFile() AllEvent.banner = self.banner - AllEvent.add(pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), + partials_info.append((pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), - sum_axsec) + sum_axsec) ) + sum_xsec, sum_xerru, sum_axsec = 0,[],0 partials +=1 + for data in partials_info: + AllEvent.add(*data) + if not hasattr(self,'proc_characteristic'): self.proc_characteristic = self.get_characteristics() diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/misc.py b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/misc.py index c4c669f36b..e7fd60be0d 100755 --- a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/misc.py +++ b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/misc.py @@ -67,7 +67,7 @@ def parse_info_str(fsock): """ info_dict = {} - pattern = re.compile("(?P\w*)\s*=\s*(?P.*)", + pattern = re.compile(r"(?P\w*)\s*=\s*(?P.*)", re.IGNORECASE | re.VERBOSE) for entry in fsock: entry = entry.strip() @@ -84,7 +84,7 @@ def parse_info_str(fsock): def glob(name, path=''): """call to glob.glob with automatic security on path""" import glob as glob_module - path = re.sub('(?P\?|\*|\[|\])', '[\g]', path) + path = re.sub(r'(?P\?|\*|\[|\])', r'[\g]', path) return glob_module.glob(pjoin(path, name)) #=============================================================================== @@ -614,10 +614,10 @@ def mod_compilator(directory, new='gfortran', current=None, compiler_type='gfort #search file file_to_change=find_makefile_in_dir(directory) if compiler_type == 'gfortran': - comp_re = re.compile('^(\s*)FC\s*=\s*(.+)\s*$') + comp_re = re.compile(r'^(\s*)FC\s*=\s*(.+)\s*$') var = 'FC' elif compiler_type == 'cpp': - comp_re = re.compile('^(\s*)CXX\s*=\s*(.+)\s*$') + comp_re = re.compile(r'^(\s*)CXX\s*=\s*(.+)\s*$') var = 'CXX' else: MadGraph5Error, 'Unknown compiler type: %s' % compiler_type @@ -861,9 +861,9 @@ def detect_current_compiler(path, compiler_type='fortran'): # comp = re.compile("^\s*FC\s*=\s*(\w+)\s*") # The regular expression below allows for compiler definition with absolute path if compiler_type == 'fortran': - comp = re.compile("^\s*FC\s*=\s*([\w\/\\.\-]+)\s*") + comp = re.compile("^\\s*FC\\s*=\\s*([\\w\\/\\.\\-]+)\\s*") elif compiler_type == 'cpp': - comp = re.compile("^\s*CXX\s*=\s*([\w\/\\.\-]+)\s*") + comp = re.compile("^\\s*CXX\\s*=\\s*([\\w\\/\\.\\-]+)\\s*") else: MadGraph5Error, 'Unknown compiler type: %s' % compiler_type @@ -1001,7 +1001,19 @@ def call_stdout(arg, *args, **opt): def copytree(src, dst, symlinks = False, ignore = None): if not os.path.exists(dst): os.makedirs(dst) - shutil.copystat(src, dst) + try: + shutil.copystat(src, dst) + except PermissionError: + if os.path.realpath(src).startswith('/cvmfs') and os.path.realpath(dst).startswith('/afs'): + # allowing missmatch from cvmfs to afs since sounds to not create issue --at least in general-- + logger.critical(f'Ignoring that we could not copy permissions from {src} to {dst}') + else: + logger.critical(f'Permission error detected from {src} to {dst}.\n'+\ + 'If you are using WSL with windows partition, please try using python3.12\n'+\ + 'or avoid moving your data from the WSL partition to the UNIX one') + # we do not have enough experience in WSL to allow it to get trough. + raise + lst = os.listdir(src) if ignore: excl = ignore(src, lst) @@ -1895,12 +1907,12 @@ class EasterEgg(object): May4_banner = "* _____ *\n" + \ "* ,-~\" \"~-. *\n" + \ "* * ,^ ___ ^. * *\n" + \ - "* * / .^ ^. \ * *\n" + \ + "* * / .^ ^. \\ * *\n" + \ "* * Y l o ! Y * *\n" + \ "* * l_ `.___.' _,[ * *\n" + \ "* * |^~\"--------------~\"\"^| * *\n" + \ "* * ! May the 4th ! * *\n" + \ - "* * \ / * *\n" + \ + "* * \\ / * *\n" + \ "* * ^. .^ * *\n" + \ "* * \"-.._____.,-\" * *\n" @@ -1909,13 +1921,13 @@ class EasterEgg(object): "* M::::::::::M M::::::::::M *\n" + \ "* M:::::::::::M M:::::::::::M (_)___ *\n" + \ "* M:::::::M::::M M::::M:::::::M | / __| *\n" + \ - "* M::::::M M::::M M::::M M::::::M | \__ \ *\n" + \ + "* M::::::M M::::M M::::M M::::::M | \\__ \\ *\n" + \ "* M::::::M M::::M::::M M::::::M |_|___/ *\n" + \ "* M::::::M M:::::::M M::::::M *\n" + \ "* M::::::M M:::::M M::::::M / _| ___ _ __ *\n" + \ - "* M::::::M MMMMM M::::::M | |_ / _ \| '__| *\n" + \ + "* M::::::M MMMMM M::::::M | |_ / _ \\| '__| *\n" + \ "* M::::::M M::::::M | _| (_) | | *\n" + \ - "* M::::::M M::::::M |_/\/\___/|_| *\n" + \ + "* M::::::M M::::::M |_/\\/\\___/|_| *\n" + \ "* M::::::M M::::::M *\n" + \ "* MMMMMMMM MMMMMMMM *\n" + \ "* *\n" + \ @@ -2233,39 +2245,51 @@ def import_python_lhapdf(lhapdfconfig): os.environ['LD_LIBRARY_PATH'] = lhapdf_libdir else: os.environ['LD_LIBRARY_PATH'] = '%s:%s' %(lhapdf_libdir,os.environ['LD_LIBRARY_PATH']) - try: candidates=[dirname for dirname in os.listdir(lhapdf_libdir) \ if os.path.isdir(os.path.join(lhapdf_libdir,dirname))] except OSError: candidates=[] + if os.path.isdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')): + candidates += [pjoin(os.pardir,'local', 'lib', dirname) for dirname in os.listdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')) + if os.path.isdir(os.path.join(lhapdf_libdir,os.pardir, 'local', 'lib', dirname))] for candidate in candidates: - if os.path.isdir(os.path.join(lhapdf_libdir,candidate,'site-packages')): - sys.path.insert(0,os.path.join(lhapdf_libdir,candidate,'site-packages')) - try: - import lhapdf - use_lhapdf=True - break - except ImportError: - sys.path.pop(0) - continue + for subdir in ['site-packages', 'dist-packages']: + if os.path.isdir(os.path.join(lhapdf_libdir,candidate, subdir)): + sys.path.insert(0,os.path.join(lhapdf_libdir,candidate, subdir)) + try: + import lhapdf + use_lhapdf=True + break + except ImportError as error: + sys.path.pop(0) + continue + else: + continue + break if not use_lhapdf: try: candidates=[dirname for dirname in os.listdir(lhapdf_libdir+'64') \ if os.path.isdir(os.path.join(lhapdf_libdir+'64',dirname))] except OSError: candidates=[] - + if os.path.isdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib64')): + candidates += [pjoin(os.pardir,'local', 'lib64', dirname) for dirname in os.listdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')) + if os.path.isdir(os.path.join(lhapdf_libdir,os.pardir, 'local', 'lib64', dirname))] for candidate in candidates: - if os.path.isdir(os.path.join(lhapdf_libdir+'64',candidate,'site-packages')): - sys.path.insert(0,os.path.join(lhapdf_libdir+'64',candidate,'site-packages')) - try: - import lhapdf - use_lhapdf=True - break - except ImportError: - sys.path.pop(0) - continue + for subdir in ['site-packages', 'dist-packages']: + if os.path.isdir(os.path.join(lhapdf_libdir+'64',candidate, subdir)): + sys.path.insert(0,os.path.join(lhapdf_libdir+'64',candidate, subdir)) + try: + import lhapdf + use_lhapdf=True + break + except ImportError as error: + sys.path.pop(0) + continue + else: + continue + break if not use_lhapdf: try: import lhapdf diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/shower_card.py b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/shower_card.py index e87d534177..16ed72b1a0 100755 --- a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/shower_card.py +++ b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/shower_card.py @@ -288,7 +288,7 @@ def write(self, output_file, template=None, python_template=False, self.text = open(template,'r').read() - key_re = re.compile('^(\s*)([\S^#]+)(\s*)=(\s*)([^#]*?)(\s*)(\#.*|$)') + key_re = re.compile(r'^(\s*)([\S^#]+)(\s*)=(\s*)([^#]*?)(\s*)(\#.*|$)') newlines = [] for line in self.text.split('\n'): key_match = key_re.findall(line) diff --git a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/systematics.py b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/systematics.py index 28eaed00e2..2acebd087c 100644 --- a/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/systematics.py +++ b/epochX/cudacpp/nobm_pp_ttW.mad/bin/internal/systematics.py @@ -582,7 +582,7 @@ def print_cross_sections(self, all_cross, nb_event, stdout): else: resume.write( '#PDF %s: %g +%2.3g%% -%2.3g%%\n' % (pdfset.name, pdferr.central,pdferr.errplus*100/all_cross[0], pdferr.errminus*100/all_cross[0])) - dyn_name = {1: '\sum ET', 2:'\sum\sqrt{m^2+pt^2}', 3:'0.5 \sum\sqrt{m^2+pt^2}',4:'\sqrt{\hat s}' } + dyn_name = {1: r'\sum ET', 2:r'\sum\sqrt{m^2+pt^2}', 3:r'0.5 \sum\sqrt{m^2+pt^2}',4:r'\sqrt{\hat s}' } for key, curr in dyns.items(): if key ==-1: continue @@ -789,7 +789,7 @@ def get_id(self): return int(self.start_wgt_id) if 'initrwgt' in self.banner: - pattern = re.compile(' set lhapdf /PATH/TO/lhapdf-config -None does not seem to correspond to a valid lhapdf-config executable. -Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config). -Note that you can still compile and run aMC@NLO with the built-in PDFs - MG5_aMC> set lhapdf /PATH/TO/lhapdf-config - Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt -import /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j.mg +import /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j.mg The import format was not given, so we guess it as command set stdout_level DEBUG set output information to level: 10 @@ -61,7 +56,7 @@ set zerowidth_tchannel F define j = p INFO: load particles INFO: load vertices -DEBUG: model prefixing takes 0.005425453186035156  +DEBUG: model prefixing takes 0.005753755569458008  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  @@ -172,7 +167,7 @@ INFO: Process u~ u > t t~ added to mirror process u u~ > t t~ INFO: Process c~ c > t t~ added to mirror process c c~ > t t~ INFO: Process d~ d > t t~ added to mirror process d d~ > t t~ INFO: Process s~ s > t t~ added to mirror process s s~ > t t~ -5 processes with 7 diagrams generated in 0.029 s +5 processes with 7 diagrams generated in 0.030 s Total: 5 processes with 7 diagrams add process p p > t t~ j @1 INFO: Checking for minimal orders which gives processes. @@ -212,7 +207,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.139 s +13 processes with 76 diagrams generated in 0.141 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,24 +373,24 @@ 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.859 s +65 processes with 1119 diagrams generated in 1.869 s Total: 83 processes with 1202 diagrams output madevent_simd ../TMPOUT/CODEGEN_mad_pp_tt012j --hel_recycling=False --vector_size=32 Load PLUGIN.CUDACPP_OUTPUT -Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.5.3_lo_vect. +Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.6.0_lo_vect. It has been validated for the last time with version: 3.5.2 Output will be done with PLUGIN: CUDACPP_OUTPUT Addition matrix-element will be done with PLUGIN: CUDACPP_OUTPUT +DEBUG: opt['output_options']['vector_size'] =  32 [export_v4.py at line 4334]  Output will be done with PLUGIN: CUDACPP_OUTPUT -DEBUG: cformat =  standalone_simd [export_cpp.py at line 3070]  DEBUG: Entering PLUGIN_ProcessExporter.__init__ (initialise the exporter) [output.py at line 165]  INFO: initialize a new directory: CODEGEN_mad_pp_tt012j INFO: remove old information in CODEGEN_mad_pp_tt012j DEBUG: Entering PLUGIN_ProcessExporter.copy_template (initialise the directory) [output.py at line 170]  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j  -INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/Cards  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j  +INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/Cards  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses  INFO: Organizing processes into subprocess groups INFO: Generating Helas calls for process: g g > t t~ g g WEIGHTED<=4 @2 INFO: Processing color information for process: g g > t t~ g g @2 @@ -504,13 +499,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 0, 46, 47, 48, 49, 50, 51, 52, 53, 54, 0, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 0, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 0, 88, 89, 90, 91, 92, 93, 0, 94, 95, 96, 97, 98, 99, 0, 100, 101, 102, 103, 104, 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [export_cpp.py at line 711]  -DEBUG: subproc_number =  0 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: g g > t t~ g g WEIGHTED<=4 @2 INFO: Finding symmetric diagrams for subprocess group gg_ttxgg -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_gg_ttxgg [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  105 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 2, 2: 3, 3: 4, 4: 5, 5: 6, 6: 7, 7: 8, 8: 9, 9: 10, 10: 11, 11: 12, 12: 13, 13: 14, 14: 15, 15: 16, 16: 17, 17: 18, 18: 19, 19: 20, 20: 21, 21: 22, 22: 23, 23: 24, 24: 25, 25: 26, 26: 27, 27: 28, 28: 29, 29: 30, 30: 31, 31: 33, 32: 34, 33: 35, 34: 36, 35: 37, 36: 38, 37: 39, 38: 40, 39: 41, 40: 42, 41: 43, 42: 44, 43: 45, 44: 46, 45: 47, 46: 49, 47: 50, 48: 51, 49: 52, 50: 53, 51: 54, 52: 55, 53: 56, 54: 57, 55: 59, 56: 60, 57: 61, 58: 62, 59: 63, 60: 64, 61: 65, 62: 66, 63: 67, 64: 68, 65: 69, 66: 70, 67: 71, 68: 72, 69: 73, 70: 75, 71: 76, 72: 77, 73: 78, 74: 79, 75: 80, 76: 81, 77: 82, 78: 83, 79: 84, 80: 85, 81: 86, 82: 87, 83: 88, 84: 89, 85: 90, 86: 91, 87: 92, 88: 94, 89: 95, 90: 96, 91: 97, 92: 98, 93: 99, 94: 101, 95: 102, 96: 103, 97: 104, 98: 105, 99: 106, 100: 108, 101: 109, 102: 110, 103: 111, 104: 112, 105: 113} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {2: 1, 3: 2, 4: 3, 5: 4, 6: 5, 7: 6, 8: 7, 9: 8, 10: 9, 11: 10, 12: 11, 13: 12, 14: 13, 15: 14, 16: 15, 17: 16, 18: 17, 19: 18, 20: 19, 21: 20, 22: 21, 23: 22, 24: 23, 25: 24, 26: 25, 27: 26, 28: 27, 29: 28, 30: 29, 31: 30, 33: 31, 34: 32, 35: 33, 36: 34, 37: 35, 38: 36, 39: 37, 40: 38, 41: 39, 42: 40, 43: 41, 44: 42, 45: 43, 46: 44, 47: 45, 49: 46, 50: 47, 51: 48, 52: 49, 53: 50, 54: 51, 55: 52, 56: 53, 57: 54, 59: 55, 60: 56, 61: 57, 62: 58, 63: 59, 64: 60, 65: 61, 66: 62, 67: 63, 68: 64, 69: 65, 70: 66, 71: 67, 72: 68, 73: 69, 75: 70, 76: 71, 77: 72, 78: 73, 79: 74, 80: 75, 81: 76, 82: 77, 83: 78, 84: 79, 85: 80, 86: 81, 87: 82, 88: 83, 89: 84, 90: 85, 91: 86, 92: 87, 94: 88, 95: 89, 96: 90, 97: 91, 98: 92, 99: 93, 101: 94, 102: 95, 103: 96, 104: 97, 105: 98, 106: 99, 108: 100, 109: 101, 110: 102, 111: 103, 112: 104, 113: 105} [model_handling.py at line 1548]  @@ -520,13 +510,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 0, 34, 35] [export_cpp.py at line 711]  -DEBUG: subproc_number =  1 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: g g > t t~ u u~ WEIGHTED<=4 @2 INFO: Finding symmetric diagrams for subprocess group gg_ttxuux -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_gg_ttxuux [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  35 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 19: 19, 20: 20, 21: 21, 22: 22, 23: 23, 24: 24, 25: 25, 26: 26, 27: 27, 28: 28, 29: 29, 30: 30, 31: 31, 32: 32, 33: 33, 34: 35, 35: 36} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 19: 19, 20: 20, 21: 21, 22: 22, 23: 23, 24: 24, 25: 25, 26: 26, 27: 27, 28: 28, 29: 29, 30: 30, 31: 31, 32: 32, 33: 33, 35: 34, 36: 35} [model_handling.py at line 1548]  @@ -536,13 +521,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 0, 34, 35] [export_cpp.py at line 711]  -DEBUG: subproc_number =  2 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: g u > t t~ g u WEIGHTED<=4 @2 INFO: Finding symmetric diagrams for subprocess group gu_ttxgu -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_gu_ttxgu [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  35 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 19: 19, 20: 20, 21: 21, 22: 22, 23: 23, 24: 24, 25: 25, 26: 26, 27: 27, 28: 28, 29: 29, 30: 30, 31: 31, 32: 32, 33: 33, 34: 35, 35: 36} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 19: 19, 20: 20, 21: 21, 22: 22, 23: 23, 24: 24, 25: 25, 26: 26, 27: 27, 28: 28, 29: 29, 30: 30, 31: 31, 32: 32, 33: 33, 35: 34, 36: 35} [model_handling.py at line 1548]  @@ -552,13 +532,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 0, 34, 35] [export_cpp.py at line 711]  -DEBUG: subproc_number =  3 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: g u~ > t t~ g u~ WEIGHTED<=4 @2 INFO: Finding symmetric diagrams for subprocess group gux_ttxgux -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_gux_ttxgux [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  35 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 19: 19, 20: 20, 21: 21, 22: 22, 23: 23, 24: 24, 25: 25, 26: 26, 27: 27, 28: 28, 29: 29, 30: 30, 31: 31, 32: 32, 33: 33, 34: 35, 35: 36} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 19: 19, 20: 20, 21: 21, 22: 22, 23: 23, 24: 24, 25: 25, 26: 26, 27: 27, 28: 28, 29: 29, 30: 30, 31: 31, 32: 32, 33: 33, 35: 34, 36: 35} [model_handling.py at line 1548]  @@ -568,13 +543,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 0, 34, 35] [export_cpp.py at line 711]  -DEBUG: subproc_number =  4 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: u u~ > t t~ g g WEIGHTED<=4 @2 INFO: Finding symmetric diagrams for subprocess group uux_ttxgg -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_uux_ttxgg [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  35 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 19: 19, 20: 20, 21: 21, 22: 22, 23: 23, 24: 24, 25: 25, 26: 26, 27: 27, 28: 28, 29: 29, 30: 30, 31: 31, 32: 32, 33: 33, 34: 35, 35: 36} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 19: 19, 20: 20, 21: 21, 22: 22, 23: 23, 24: 24, 25: 25, 26: 26, 27: 27, 28: 28, 29: 29, 30: 30, 31: 31, 32: 32, 33: 33, 35: 34, 36: 35} [model_handling.py at line 1548]  @@ -584,13 +554,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0] [export_cpp.py at line 711]  -DEBUG: subproc_number =  5 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: g g > t t~ g WEIGHTED<=3 @1 INFO: Finding symmetric diagrams for subprocess group gg_ttxg -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P1_gg_ttxg [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  15 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15} [model_handling.py at line 1548]  @@ -600,13 +565,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] [export_cpp.py at line 711]  -DEBUG: subproc_number =  6 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: u u > t t~ u u WEIGHTED<=4 @2 INFO: Finding symmetric diagrams for subprocess group uu_ttxuu -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_uu_ttxuu [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  14 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14} [model_handling.py at line 1548]  @@ -616,13 +576,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] [export_cpp.py at line 711]  -DEBUG: subproc_number =  7 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: u u~ > t t~ u u~ WEIGHTED<=4 @2 INFO: Finding symmetric diagrams for subprocess group uux_ttxuux -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_uux_ttxuux [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  14 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14} [model_handling.py at line 1548]  @@ -632,13 +587,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] [export_cpp.py at line 711]  -DEBUG: subproc_number =  8 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: u~ u~ > t t~ u~ u~ WEIGHTED<=4 @2 INFO: Finding symmetric diagrams for subprocess group uxux_ttxuxux -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_uxux_ttxuxux [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  14 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14} [model_handling.py at line 1548]  @@ -648,13 +598,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5, 6, 7] [export_cpp.py at line 711]  -DEBUG: subproc_number =  9 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: u c > t t~ u c WEIGHTED<=4 @2 INFO: Finding symmetric diagrams for subprocess group uc_ttxuc -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_uc_ttxuc [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  7 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7} [model_handling.py at line 1548]  @@ -664,13 +609,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5, 6, 7] [export_cpp.py at line 711]  -DEBUG: subproc_number =  10 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: u u~ > t t~ c c~ WEIGHTED<=4 @2 INFO: Finding symmetric diagrams for subprocess group uux_ttxccx -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_uux_ttxccx [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  7 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7} [model_handling.py at line 1548]  @@ -680,13 +620,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5, 6, 7] [export_cpp.py at line 711]  -DEBUG: subproc_number =  11 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: u c~ > t t~ u c~ WEIGHTED<=4 @2 INFO: Finding symmetric diagrams for subprocess group ucx_ttxucx -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_ucx_ttxucx [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  7 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7} [model_handling.py at line 1548]  @@ -696,13 +631,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5, 6, 7] [export_cpp.py at line 711]  -DEBUG: subproc_number =  12 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: u~ c~ > t t~ u~ c~ WEIGHTED<=4 @2 INFO: Finding symmetric diagrams for subprocess group uxcx_ttxuxcx -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_uxcx_ttxuxcx [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  7 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7} [model_handling.py at line 1548]  @@ -712,13 +642,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5] [export_cpp.py at line 711]  -DEBUG: subproc_number =  13 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: g u > t t~ u WEIGHTED<=3 @1 INFO: Finding symmetric diagrams for subprocess group gu_ttxu -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P1_gu_ttxu [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  5 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5} [model_handling.py at line 1548]  @@ -728,13 +653,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5] [export_cpp.py at line 711]  -DEBUG: subproc_number =  14 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: g u~ > t t~ u~ WEIGHTED<=3 @1 INFO: Finding symmetric diagrams for subprocess group gux_ttxux -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P1_gux_ttxux [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  5 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5} [model_handling.py at line 1548]  @@ -744,13 +664,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5] [export_cpp.py at line 711]  -DEBUG: subproc_number =  15 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: u u~ > t t~ g WEIGHTED<=3 @1 INFO: Finding symmetric diagrams for subprocess group uux_ttxg -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P1_uux_ttxg [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  5 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5} [model_handling.py at line 1548]  @@ -760,13 +675,8 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3] [export_cpp.py at line 711]  -DEBUG: subproc_number =  16 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: g g > t t~ WEIGHTED<=2 INFO: Finding symmetric diagrams for subprocess group gg_ttx -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P0_gg_ttx [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  3 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3} [model_handling.py at line 1548]  @@ -776,32 +686,28 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1] [export_cpp.py at line 711]  -DEBUG: subproc_number =  17 [export_cpp.py at line 712]  -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 -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P0_uux_ttx [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  1 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1} [model_handling.py at line 1548]  Generated helas calls for 18 subprocesses (372 diagrams) in 1.318 s -Wrote files for 810 helas calls in 3.004 s +Wrote files for 810 helas calls in 2.818 s +DEBUG: self.vector_size =  32 [export_v4.py at line 7023]  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.342 s +ALOHA: aloha creates 5 routines in 0.346 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 10 routines in 0.322 s +ALOHA: aloha creates 10 routines in 0.326 s VVV1 VVV1 FFV1 @@ -814,121 +720,175 @@ ALOHA: aloha creates 10 routines in 0.322 s VVVV3 VVVV4 VVVV4 -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/src/./HelAmps_sm.h -INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/src/. +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/src/./HelAmps_sm.h +INFO: Created file HelAmps_sm.h in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/src/. super_write_set_parameters_onlyfixMajorana (hardcoded=False) super_write_set_parameters_onlyfixMajorana (hardcoded=True) -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/src/./Parameters_sm.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/src/./Parameters_sm.cc +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/src/./Parameters_sm.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/src/./Parameters_sm.cc INFO: Created files Parameters_sm.h and Parameters_sm.cc in directory -INFO: /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/src/. and /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/src/. +INFO: /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/src/. and /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/src/. The option zerowidth_tchannel is modified [True] but will not be written in the configuration files. If you want to make this value the default for future session, you can run 'save options --all' -save configuration file to /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/Cards/me5_configuration.txt +save configuration file to /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/Cards/me5_configuration.txt INFO: Use Fortran compiler gfortran INFO: Use c++ compiler g++ INFO: Generate jpeg diagrams INFO: Generate web pages -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common -patching file Source/genps.inc +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common patching file SubProcesses/makefile -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P0_gg_ttx; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P0_gg_ttx; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P0_uux_ttx; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #2 succeeded at 227 (offset 13 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P0_uux_ttx; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 75 (offset 3 lines). -Hunk #2 succeeded at 236 (offset 3 lines). -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P1_gg_ttxg; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #1 succeeded at 74 (offset 3 lines). +Hunk #2 succeeded at 230 (offset 16 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P1_gg_ttxg; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #2 succeeded at 249 (offset 16 lines). -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P1_gu_ttxu; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #2 succeeded at 243 (offset 29 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P1_gu_ttxu; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 75 (offset 3 lines). -Hunk #2 succeeded at 252 (offset 19 lines). -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P1_gux_ttxux; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #1 succeeded at 74 (offset 3 lines). +Hunk #2 succeeded at 246 (offset 32 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P1_gux_ttxux; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 75 (offset 3 lines). -Hunk #2 succeeded at 252 (offset 19 lines). -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P1_uux_ttxg; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #1 succeeded at 74 (offset 3 lines). +Hunk #2 succeeded at 246 (offset 32 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P1_uux_ttxg; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 75 (offset 3 lines). -Hunk #2 succeeded at 252 (offset 19 lines). -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_gg_ttxgg; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #1 succeeded at 74 (offset 3 lines). +Hunk #2 succeeded at 246 (offset 32 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_gg_ttxgg; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #2 succeeded at 281 (offset 48 lines). -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_gg_ttxuux; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #2 succeeded at 275 (offset 61 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_gg_ttxuux; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 75 (offset 3 lines). -Hunk #2 succeeded at 284 (offset 51 lines). -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_gu_ttxgu; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #1 succeeded at 74 (offset 3 lines). +Hunk #2 succeeded at 278 (offset 64 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_gu_ttxgu; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 75 (offset 3 lines). -Hunk #2 succeeded at 284 (offset 51 lines). -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_gux_ttxgux; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #1 succeeded at 74 (offset 3 lines). +Hunk #2 succeeded at 278 (offset 64 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_gux_ttxgux; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 75 (offset 3 lines). -Hunk #2 succeeded at 284 (offset 51 lines). -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_uc_ttxuc; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #1 succeeded at 74 (offset 3 lines). +Hunk #2 succeeded at 278 (offset 64 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_uc_ttxuc; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 77 (offset 5 lines). -Hunk #2 succeeded at 286 (offset 53 lines). -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_ucx_ttxucx; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #1 succeeded at 76 (offset 5 lines). +Hunk #2 succeeded at 280 (offset 66 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_ucx_ttxucx; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 83 (offset 11 lines). -Hunk #2 succeeded at 292 (offset 59 lines). -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_uu_ttxuu; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #1 succeeded at 82 (offset 11 lines). +Hunk #2 succeeded at 286 (offset 72 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_uu_ttxuu; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 75 (offset 3 lines). -Hunk #2 succeeded at 284 (offset 51 lines). -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_uux_ttxccx; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #1 succeeded at 74 (offset 3 lines). +Hunk #2 succeeded at 278 (offset 64 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_uux_ttxccx; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 83 (offset 11 lines). -Hunk #2 succeeded at 292 (offset 59 lines). -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_uux_ttxgg; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #1 succeeded at 82 (offset 11 lines). +Hunk #2 succeeded at 286 (offset 72 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_uux_ttxgg; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 75 (offset 3 lines). -Hunk #2 succeeded at 284 (offset 51 lines). -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_uux_ttxuux; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #1 succeeded at 74 (offset 3 lines). +Hunk #2 succeeded at 278 (offset 64 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_uux_ttxuux; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 75 (offset 3 lines). -Hunk #2 succeeded at 284 (offset 51 lines). -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_uxcx_ttxuxcx; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #1 succeeded at 74 (offset 3 lines). +Hunk #2 succeeded at 278 (offset 64 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_uxcx_ttxuxcx; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 77 (offset 5 lines). -Hunk #2 succeeded at 286 (offset 53 lines). -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_uxux_ttxuxux; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +Hunk #1 succeeded at 76 (offset 5 lines). +Hunk #2 succeeded at 280 (offset 66 lines). +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/SubProcesses/P2_uxux_ttxuxux; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #1 succeeded at 75 (offset 3 lines). -Hunk #2 succeeded at 284 (offset 51 lines). +Hunk #1 succeeded at 74 (offset 3 lines). +Hunk #2 succeeded at 278 (offset 64 lines). DEBUG: p.returncode =  0 [output.py at line 258]  -Output to directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j done. +Output to directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j done. Type "launch" to generate events from this process, or see -/data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/README +/data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/README Run "open index.html" to see more information about this process. quit -real 0m12.030s -user 0m9.841s -sys 0m0.932s -Code generation completed in 12 seconds +real 0m10.632s +user 0m9.727s +sys 0m0.868s +Code generation completed in 11 seconds ************************************************************ * * * W E L C O M E to * @@ -941,7 +901,7 @@ Code generation completed in 12 seconds * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect * +* VERSION 3.6.0_lo_vect * * * * The MadGraph5_aMC@NLO Development Team - Find us at * * https://server06.fynu.ucl.ac.be/projects/madgraph * @@ -949,9 +909,9 @@ Code generation completed in 12 seconds * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt @@ -971,7 +931,7 @@ launch in debug mode * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect * +* VERSION 3.6.0_lo_vect * * * * The MadGraph5_aMC@NLO Development Team - Find us at * * https://server06.fynu.ucl.ac.be/projects/madgraph * @@ -979,9 +939,9 @@ launch in debug mode * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_pp_tt012j/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt diff --git a/epochX/cudacpp/pp_tt012j.mad/Cards/me5_configuration.txt b/epochX/cudacpp/pp_tt012j.mad/Cards/me5_configuration.txt index cdeedc7863..4f5079f78a 100644 --- a/epochX/cudacpp/pp_tt012j.mad/Cards/me5_configuration.txt +++ b/epochX/cudacpp/pp_tt012j.mad/Cards/me5_configuration.txt @@ -116,6 +116,7 @@ # cluster_type = condor # cluster_queue = madgraph # cluster_size = 150 +# cluster_walltime = # time in minute for slurm and second for condor (not supported for other scheduller) #! Path to a node directory to avoid direct writing on the central disk #! Note that condor clusters avoid direct writing by default (therefore this @@ -234,7 +235,7 @@ # pineappl = pineappl -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo # MG5 MAIN DIRECTORY -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo diff --git a/epochX/cudacpp/pp_tt012j.mad/Cards/param_card.dat b/epochX/cudacpp/pp_tt012j.mad/Cards/param_card.dat index caf4a67ea8..bb150ef10d 100644 --- a/epochX/cudacpp/pp_tt012j.mad/Cards/param_card.dat +++ b/epochX/cudacpp/pp_tt012j.mad/Cards/param_card.dat @@ -1,5 +1,5 @@ ###################################################################### -## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL #### +## PARAM_CARD AUTOMATICALLY GENERATED BY MG5 FOLLOWING UFO MODEL #### ###################################################################### ## ## ## Width set on Auto will be computed following the information ## diff --git a/epochX/cudacpp/pp_tt012j.mad/Cards/param_card_default.dat b/epochX/cudacpp/pp_tt012j.mad/Cards/param_card_default.dat index caf4a67ea8..bb150ef10d 100644 --- a/epochX/cudacpp/pp_tt012j.mad/Cards/param_card_default.dat +++ b/epochX/cudacpp/pp_tt012j.mad/Cards/param_card_default.dat @@ -1,5 +1,5 @@ ###################################################################### -## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL #### +## PARAM_CARD AUTOMATICALLY GENERATED BY MG5 FOLLOWING UFO MODEL #### ###################################################################### ## ## ## Width set on Auto will be computed following the information ## diff --git a/epochX/cudacpp/pp_tt012j.mad/Cards/proc_card_mg5.dat b/epochX/cudacpp/pp_tt012j.mad/Cards/proc_card_mg5.dat index 2f22f719bc..1f2f1a070e 100644 --- a/epochX/cudacpp/pp_tt012j.mad/Cards/proc_card_mg5.dat +++ b/epochX/cudacpp/pp_tt012j.mad/Cards/proc_card_mg5.dat @@ -8,7 +8,7 @@ #* * * * #* * #* * -#* VERSION 3.5.3_lo_vect 2023-12-23 * +#* VERSION 3.6.0_lo_vect 2024-06-17 * #* * #* WARNING: UNKNOWN DEVELOPMENT VERSION. * #* WARNING: DO NOT USE FOR PRODUCTION * diff --git a/epochX/cudacpp/pp_tt012j.mad/Cards/reweight_card_default.dat b/epochX/cudacpp/pp_tt012j.mad/Cards/reweight_card_default.dat index ace534ae02..5cc65fe095 100644 --- a/epochX/cudacpp/pp_tt012j.mad/Cards/reweight_card_default.dat +++ b/epochX/cudacpp/pp_tt012j.mad/Cards/reweight_card_default.dat @@ -19,8 +19,16 @@ change mode NLO # Define type of Reweighting. For LO sample this command # has no effect since only "LO" mode is allowed. + +#uncomment if you do not want to overwrite the reweight file of Sudakov in rw_me +#change rwgt_dir /PATH_MG5_BRANCH/NAME_FOLDER + +#uncomment if you want to use Sudakov Reweight +#change include_sudakov True + launch + # SPECIFY A PATH OR USE THE SET COMMAND LIKE THIS: # set sminputs 1 130 # modify 1/alpha_EW diff --git a/epochX/cudacpp/pp_tt012j.mad/Cards/run_card.dat b/epochX/cudacpp/pp_tt012j.mad/Cards/run_card.dat index 1a36d8a6aa..5eb60f35df 100644 --- a/epochX/cudacpp/pp_tt012j.mad/Cards/run_card.dat +++ b/epochX/cudacpp/pp_tt012j.mad/Cards/run_card.dat @@ -203,6 +203,7 @@ systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++] ['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset', '--alps=0.5,1,2'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule + #*********************************************************************** # SIMD/GPU configuration for the CUDACPP plugin #************************************************************************ diff --git a/epochX/cudacpp/pp_tt012j.mad/Cards/run_card_default.dat b/epochX/cudacpp/pp_tt012j.mad/Cards/run_card_default.dat index 7294e35706..38810a6b83 100644 --- a/epochX/cudacpp/pp_tt012j.mad/Cards/run_card_default.dat +++ b/epochX/cudacpp/pp_tt012j.mad/Cards/run_card_default.dat @@ -203,6 +203,7 @@ systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++] ['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset', '--alps=0.5,1,2'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule + #*********************************************************************** # SIMD/GPU configuration for the CUDACPP plugin #************************************************************************ diff --git a/epochX/cudacpp/pp_tt012j.mad/MGMEVersion.txt b/epochX/cudacpp/pp_tt012j.mad/MGMEVersion.txt index 9d3a5c0ba0..a806d3938c 100644 --- a/epochX/cudacpp/pp_tt012j.mad/MGMEVersion.txt +++ b/epochX/cudacpp/pp_tt012j.mad/MGMEVersion.txt @@ -1 +1 @@ -3.5.3_lo_vect \ No newline at end of file +3.6.0_lo_vect \ No newline at end of file diff --git a/epochX/cudacpp/pp_tt012j.mad/Source/DHELAS/aloha_functions.f b/epochX/cudacpp/pp_tt012j.mad/Source/DHELAS/aloha_functions.f index 975725737f..47699fa614 100644 --- a/epochX/cudacpp/pp_tt012j.mad/Source/DHELAS/aloha_functions.f +++ b/epochX/cudacpp/pp_tt012j.mad/Source/DHELAS/aloha_functions.f @@ -351,7 +351,7 @@ subroutine oxxxxx(p,fmass,nhel,nsf , fo) fo(6) = ip * sqm(abs(im)) else - pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2)) +c pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2)) sf(1) = dble(1+nsf+(1-nsf)*nh)*rHalf sf(2) = dble(1+nsf-(1-nsf)*nh)*rHalf omega(1) = dsqrt(p(0)+pp) @@ -2054,7 +2054,7 @@ subroutine CombineAmp(nb, ihels, iwfcts, W1, Wall, Amp) enddo return end - + subroutine CombineAmpS(nb, ihels, iwfcts, W1, Wall, Amp) integer nb ! size of the vectors diff --git a/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/couplings.f b/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/couplings.f index f3b620ab58..04d6bb5333 100644 --- a/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/couplings.f +++ b/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/couplings.f @@ -10,18 +10,27 @@ SUBROUTINE COUP() PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + LOGICAL UPDATELOOP COMMON /TO_UPDATELOOP/UPDATELOOP INCLUDE 'input.inc' - INCLUDE '../vector.inc' + + INCLUDE 'coupl.inc' READLHA = .TRUE. INCLUDE 'intparam_definition.inc' CALL COUP1() + IF (UPDATELOOP) THEN + + CALL COUP2() + + ENDIF + C couplings needed to be evaluated points by points C - CALL COUP2(1) + CALL COUP3(1) RETURN END @@ -47,7 +56,11 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) INCLUDE '../maxparticles.inc' INCLUDE '../cuts.inc' + + INCLUDE '../vector.inc' + + INCLUDE '../run.inc' DOUBLE PRECISION ALPHAS @@ -65,7 +78,7 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) couplings needed to be evaluated points by points C ALL_G(VECID) = G - CALL COUP2(VECID) + CALL COUP3(VECID) RETURN END @@ -80,7 +93,9 @@ SUBROUTINE UPDATE_AS_PARAM2(MU_R2,AS2 ,VECID) INTEGER VECID INCLUDE 'model_functions.inc' INCLUDE 'input.inc' + INCLUDE '../vector.inc' + INCLUDE 'coupl.inc' DOUBLE PRECISION MODEL_SCALE COMMON /MODEL_SCALE/MODEL_SCALE diff --git a/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/couplings1.f b/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/couplings1.f index e14f3a1770..72cfa0f6e4 100644 --- a/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/couplings1.f +++ b/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/couplings1.f @@ -7,11 +7,12 @@ SUBROUTINE COUP1( ) IMPLICIT NONE INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' END diff --git a/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/couplings2.f b/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/couplings2.f index e638b28035..30f3a04e3b 100644 --- a/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/couplings2.f +++ b/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/couplings2.f @@ -2,19 +2,17 @@ c written by the UFO converter ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc - SUBROUTINE COUP2( VECID) + SUBROUTINE COUP2( ) IMPLICIT NONE - INTEGER VECID + INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' - GC_10(VECID) = -G - GC_11(VECID) = MDL_COMPLEXI*G - GC_12(VECID) = MDL_COMPLEXI*MDL_G__EXP__2 END diff --git a/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/couplings3.f b/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/couplings3.f index f537dd3764..ad696f2865 100644 --- a/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/couplings3.f +++ b/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/couplings3.f @@ -7,12 +7,13 @@ SUBROUTINE COUP3( VECID) IMPLICIT NONE INTEGER VECID INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' GC_10(VECID) = -G GC_11(VECID) = MDL_COMPLEXI*G diff --git a/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/makefile b/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/makefile index 0b24445a53..5a5681d220 100644 --- a/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/makefile +++ b/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/makefile @@ -3,7 +3,7 @@ # Makefile for model library # # ---------------------------------------------------------------------------- - +# template models/template_files/makefile_madevent # Check for ../make_opts ifeq ($(wildcard ../make_opts), ../make_opts) include ../make_opts diff --git a/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/makeinc.inc b/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/makeinc.inc index 6e2743eac1..4a9e1b2cc5 100644 --- a/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/makeinc.inc +++ b/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/makeinc.inc @@ -2,4 +2,4 @@ # written by the UFO converter ############################################################################# -MODEL = couplings.o lha_read.o printout.o rw_para.o model_functions.o couplings1.o couplings2.o \ No newline at end of file +MODEL = couplings.o lha_read.o printout.o rw_para.o model_functions.o couplings1.o couplings2.o couplings3.o \ No newline at end of file diff --git a/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/printout.f b/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/printout.f index 18b8f35b08..3e195b03a2 100644 --- a/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/printout.f +++ b/epochX/cudacpp/pp_tt012j.mad/Source/MODEL/printout.f @@ -1,3 +1,7 @@ +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +c written by the UFO converter +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc + c************************************************************************ c** ** c** MadGraph/MadEvent Interface to FeynRules ** @@ -9,7 +13,7 @@ subroutine printout implicit none - include '../vector.inc' ! defines VECSIZE_MEMMAX + include '../vector.inc' ! VECSIZE_MEMMAX (needed by coupl.inc) include 'coupl.inc' ! needs VECSIZE_MEMMAX (defined in vector.inc) include 'input.inc' diff --git a/epochX/cudacpp/pp_tt012j.mad/Source/PDF/eepdf.inc b/epochX/cudacpp/pp_tt012j.mad/Source/PDF/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/pp_tt012j.mad/Source/PDF/eepdf.inc +++ b/epochX/cudacpp/pp_tt012j.mad/Source/PDF/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/pp_tt012j.mad/Source/PDF/pdfwrap_emela.f b/epochX/cudacpp/pp_tt012j.mad/Source/PDF/pdfwrap_emela.f index bce10819d5..da1e4e2276 100644 --- a/epochX/cudacpp/pp_tt012j.mad/Source/PDF/pdfwrap_emela.f +++ b/epochX/cudacpp/pp_tt012j.mad/Source/PDF/pdfwrap_emela.f @@ -13,7 +13,7 @@ SUBROUTINE PDFWRAP DOUBLE PRECISION VALUE(20) REAL*8 ALPHASPDF EXTERNAL ALPHASPDF - ! PDFs with beamstrahlung use specific initialisation/evaluation +C PDFs with beamstrahlung use specific initialisation/evaluation LOGICAL HAS_BSTRAHL COMMON /TO_HAS_BS/ HAS_BSTRAHL diff --git a/epochX/cudacpp/pp_tt012j.mad/Source/PDF/pdg2pdf.f b/epochX/cudacpp/pp_tt012j.mad/Source/PDF/pdg2pdf.f index 46f321e66b..2e7343a69b 100644 --- a/epochX/cudacpp/pp_tt012j.mad/Source/PDF/pdg2pdf.f +++ b/epochX/cudacpp/pp_tt012j.mad/Source/PDF/pdg2pdf.f @@ -108,7 +108,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) else if (abs(ipart).eq.10) then ipart = sign(1,ipart) * 15 endif - pdg2pdf = 0d0 + pdg2pdf = 0d0 if (beamid.lt.0) then ih_local = ipart @@ -122,7 +122,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) endif do i_ee = 1, n_ee ee_components(i_ee) = compute_eepdf(x,omx_ee(iabs(beamid)),xmu,i_ee,ipart,ih_local) - enddo + enddo pdg2pdf = ee_components(1) ! temporary to test pdf load c write(*,*), x, beamid ,omx_ee(iabs(beamid)),xmu,1,ipart,ih_local,pdg2pdf return diff --git a/epochX/cudacpp/pp_tt012j.mad/Source/dsample.f b/epochX/cudacpp/pp_tt012j.mad/Source/dsample.f index 09d482b45a..b0bc0547ad 100644 --- a/epochX/cudacpp/pp_tt012j.mad/Source/dsample.f +++ b/epochX/cudacpp/pp_tt012j.mad/Source/dsample.f @@ -204,6 +204,9 @@ subroutine sample_full(ndim,ncall,itmax,itmin,dsig,ninvar,nconfigs,VECSIZE_USED) if (VECSIZE_USED.le.1) then all_fx(1) = dsig(all_p, all_wgt,0) + ivec=0 + ilock=0 + iwarp=1 else c Here "i" is the position in the full grid of the event do i=(iwarp-1)*WARP_SIZE+1, iwarp*warp_size diff --git a/epochX/cudacpp/pp_tt012j.mad/Source/eepdf.inc b/epochX/cudacpp/pp_tt012j.mad/Source/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/pp_tt012j.mad/Source/eepdf.inc +++ b/epochX/cudacpp/pp_tt012j.mad/Source/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/pp_tt012j.mad/Source/genps.inc b/epochX/cudacpp/pp_tt012j.mad/Source/genps.inc index af7e0efbce..ef78e7e812 100644 --- a/epochX/cudacpp/pp_tt012j.mad/Source/genps.inc +++ b/epochX/cudacpp/pp_tt012j.mad/Source/genps.inc @@ -29,9 +29,8 @@ c parameter (max_host=99,maxplace=199,maxpoints=100,maxans=50) c************************************************************************* c Parameters for helicity sums in matrixN.f c************************************************************************* - REAL*8 LIMHEL -c PARAMETER(LIMHEL=1e-8) ! ME threshold for helicity filtering (Fortran default) - PARAMETER(LIMHEL=0) ! ME threshold for helicity filtering (force Fortran to mimic cudacpp, see #419) +c REAL*8 LIMHEL +c PARAMETER(LIMHEL=1e-8) -> pass in the run_card.dat INTEGER MAXTRIES PARAMETER(MAXTRIES=25) C To pass the helicity configuration chosen by the DiscreteSampler to diff --git a/epochX/cudacpp/pp_tt012j.mad/Source/run.inc b/epochX/cudacpp/pp_tt012j.mad/Source/run.inc index 5433a23583..81c8df6bf2 100644 --- a/epochX/cudacpp/pp_tt012j.mad/Source/run.inc +++ b/epochX/cudacpp/pp_tt012j.mad/Source/run.inc @@ -106,4 +106,7 @@ c double precision tmin_for_channel integer sde_strat ! 1 means standard single diagram enhancement strategy, c 2 means approximation by the denominator of the propagator - common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat \ No newline at end of file + common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat +c + double precision limhel + common/to_limhel/limhel diff --git a/epochX/cudacpp/pp_tt012j.mad/Source/run_card.inc b/epochX/cudacpp/pp_tt012j.mad/Source/run_card.inc index 22d8b7aaa9..2588190439 100644 --- a/epochX/cudacpp/pp_tt012j.mad/Source/run_card.inc +++ b/epochX/cudacpp/pp_tt012j.mad/Source/run_card.inc @@ -88,6 +88,8 @@ DSQRT_SHAT = 0.000000000000000D+00 + LIMHEL = 0.000000000000000D+00 + PTJ = 2.000000000000000D+01 PTB = 0.000000000000000D+00 diff --git a/epochX/cudacpp/pp_tt012j.mad/Source/setrun.f b/epochX/cudacpp/pp_tt012j.mad/Source/setrun.f index 9e9ef7fdbd..dc6caef748 100644 --- a/epochX/cudacpp/pp_tt012j.mad/Source/setrun.f +++ b/epochX/cudacpp/pp_tt012j.mad/Source/setrun.f @@ -162,9 +162,21 @@ subroutine setrun C Fill common block for Les Houches init info do i=1,2 if(lpp(i).eq.1.or.lpp(i).eq.2) then - idbmup(i)=2212 + if (nb_proton(i).eq.1.and.nb_neutron(i).eq.0) then + idbmup(i)=2212 + elseif (nb_proton(i).eq.0.and.nb_neutron(i).eq.1) then + idbmup(i)=2112 + else + idbmup(i) = 1000000000 + (nb_proton(i)+nb_neutron(i))*10 + $ + nb_proton(i)*10000 + endif elseif(lpp(i).eq.-1.or.lpp(i).eq.-2) then - idbmup(i)=-2212 + if (nb_proton(i).eq.1.and.nb_neutron(i).eq.0) then + idbmup(i)=-2212 + else + idbmup(i) = -1*(1000000000 + (nb_proton(i)+nb_neutron(i))*10 + $ + nb_proton(i)*10000) + endif elseif(lpp(i).eq.3) then idbmup(i)=11 elseif(lpp(i).eq.-3) then diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/MGVersion.txt b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/MGVersion.txt index 9d3a5c0ba0..a806d3938c 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/MGVersion.txt +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/MGVersion.txt @@ -1 +1 @@ -3.5.3_lo_vect \ No newline at end of file +3.6.0_lo_vect \ No newline at end of file diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_gg_ttx/CPPProcess.cc b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_gg_ttx/CPPProcess.cc index 20160c38ee..e0cab101a6 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_gg_ttx/CPPProcess.cc +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_gg_ttx/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_gg_ttx/CPPProcess.h b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_gg_ttx/CPPProcess.h index 33c7f752b7..a0af4854a8 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_gg_ttx/CPPProcess.h +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_gg_ttx/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_gg_ttx/auto_dsig.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_gg_ttx/auto_dsig.f index f50b3b61f3..b0fe6f24c2 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_gg_ttx/auto_dsig.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_gg_ttx/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1134,11 +1134,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=16) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1148,32 +1149,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=16) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=16) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_gg_ttx/auto_dsig1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_gg_ttx/auto_dsig1.f index 39833c0293..2a748f3f03 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_gg_ttx/auto_dsig1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_gg_ttx/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -101,6 +101,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -217,7 +219,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -281,7 +283,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -320,9 +322,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -338,6 +341,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -485,11 +490,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -589,9 +589,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -704,3 +706,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_gg_ttx/driver.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_gg_ttx/driver.f index 27a6e46742..ec5722702a 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_gg_ttx/driver.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_gg_ttx/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_gg_ttx/matrix1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_gg_ttx/matrix1.f index 528cf15af0..2dfc78bb40 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_gg_ttx/matrix1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_gg_ttx/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -23,6 +23,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=16) INTEGER NGRAPHS @@ -46,8 +48,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -56,26 +58,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -86,7 +85,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -96,26 +94,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,4) /-1,-1,-1, 1/ DATA (NHEL(I, 2),I=1,4) /-1,-1,-1,-1/ DATA (NHEL(I, 3),I=1,4) /-1,-1, 1, 1/ @@ -143,8 +140,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -153,11 +149,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=2 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=2 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -167,12 +163,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -184,7 +179,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -213,35 +209,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -313,7 +307,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_uux_ttx/CPPProcess.cc b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_uux_ttx/CPPProcess.cc index 9ee164638a..9488909522 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_uux_ttx/CPPProcess.cc +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_uux_ttx/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_uux_ttx/CPPProcess.h b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_uux_ttx/CPPProcess.h index a9806ed2e5..b4f44d05d5 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_uux_ttx/CPPProcess.h +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_uux_ttx/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_uux_ttx/auto_dsig.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_uux_ttx/auto_dsig.f index e18cee3ba8..59c357609b 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_uux_ttx/auto_dsig.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_uux_ttx/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1137,11 +1137,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=16) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1151,32 +1152,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=16) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=16) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_uux_ttx/auto_dsig1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_uux_ttx/auto_dsig1.f index 66c3732b56..3896571fc6 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_uux_ttx/auto_dsig1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_uux_ttx/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -104,6 +104,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -235,7 +237,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -304,7 +306,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -343,9 +345,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -363,6 +366,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -540,11 +545,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -644,9 +644,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -759,3 +761,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_uux_ttx/driver.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_uux_ttx/driver.f index 27a6e46742..ec5722702a 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_uux_ttx/driver.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_uux_ttx/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_uux_ttx/matrix1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_uux_ttx/matrix1.f index e25448c00d..0025b83810 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_uux_ttx/matrix1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P0_uux_ttx/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -26,6 +26,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=16) INTEGER NGRAPHS @@ -49,8 +51,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -59,26 +61,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -89,7 +88,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -99,26 +97,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,4) / 1,-1,-1, 1/ DATA (NHEL(I, 2),I=1,4) / 1,-1,-1,-1/ DATA (NHEL(I, 3),I=1,4) / 1,-1, 1, 1/ @@ -146,8 +143,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -156,11 +152,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=2 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=2 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -170,12 +166,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -187,7 +182,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -216,35 +212,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -316,7 +310,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gg_ttxg/CPPProcess.cc b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gg_ttxg/CPPProcess.cc index 6a72bd0004..c117c80635 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gg_ttxg/CPPProcess.cc +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gg_ttxg/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gg_ttxg/CPPProcess.h b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gg_ttxg/CPPProcess.h index 4cf0de0da5..1336561d98 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gg_ttxg/CPPProcess.h +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gg_ttxg/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gg_ttxg/auto_dsig.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gg_ttxg/auto_dsig.f index e443f9d74a..18102513a2 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gg_ttxg/auto_dsig.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gg_ttxg/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1134,11 +1134,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=32) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1148,32 +1149,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=32) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=32) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gg_ttxg/auto_dsig1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gg_ttxg/auto_dsig1.f index c9392f3f6a..feae52d0d1 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gg_ttxg/auto_dsig1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gg_ttxg/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -101,6 +101,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -217,7 +219,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -281,7 +283,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -320,9 +322,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -338,6 +341,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -485,11 +490,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -589,9 +589,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -720,3 +722,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gg_ttxg/driver.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gg_ttxg/driver.f index c45686a3b2..c2eadb2c31 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gg_ttxg/driver.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gg_ttxg/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gg_ttxg/matrix1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gg_ttxg/matrix1.f index a8c7e012bf..80c1d61cc8 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gg_ttxg/matrix1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gg_ttxg/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -23,6 +23,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=32) INTEGER NGRAPHS @@ -46,8 +48,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -56,26 +58,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -86,7 +85,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -96,26 +94,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,5) /-1,-1,-1, 1,-1/ DATA (NHEL(I, 2),I=1,5) /-1,-1,-1, 1, 1/ DATA (NHEL(I, 3),I=1,5) /-1,-1,-1,-1,-1/ @@ -159,8 +156,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -169,11 +165,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=6 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=6 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -183,12 +179,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -200,7 +195,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -229,35 +225,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -329,7 +323,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gu_ttxu/CPPProcess.cc b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gu_ttxu/CPPProcess.cc index 0f0c8e12ab..7efa2ddf59 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gu_ttxu/CPPProcess.cc +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gu_ttxu/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gu_ttxu/CPPProcess.h b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gu_ttxu/CPPProcess.h index 5200762ff8..9ee06a68ef 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gu_ttxu/CPPProcess.h +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gu_ttxu/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gu_ttxu/auto_dsig.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gu_ttxu/auto_dsig.f index 3a34c54b34..eb78c27eb4 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gu_ttxu/auto_dsig.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gu_ttxu/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1137,11 +1137,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=32) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1151,32 +1152,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=32) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=32) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gu_ttxu/auto_dsig1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gu_ttxu/auto_dsig1.f index 5f8fcf53e4..d06b3bf8c7 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gu_ttxu/auto_dsig1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gu_ttxu/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -104,6 +104,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -232,7 +234,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -300,7 +302,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -339,9 +341,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -358,6 +361,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -529,11 +534,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -633,9 +633,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -764,3 +766,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gu_ttxu/driver.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gu_ttxu/driver.f index c45686a3b2..c2eadb2c31 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gu_ttxu/driver.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gu_ttxu/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gu_ttxu/matrix1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gu_ttxu/matrix1.f index 3af79030d2..3b108ad83f 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gu_ttxu/matrix1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gu_ttxu/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -26,6 +26,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=32) INTEGER NGRAPHS @@ -49,8 +51,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -59,26 +61,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -89,7 +88,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -99,26 +97,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,5) /-1, 1,-1, 1,-1/ DATA (NHEL(I, 2),I=1,5) /-1, 1,-1, 1, 1/ DATA (NHEL(I, 3),I=1,5) /-1, 1,-1,-1,-1/ @@ -162,8 +159,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -172,11 +168,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=4 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=4 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -186,12 +182,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -203,7 +198,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -232,35 +228,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -332,7 +326,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gux_ttxux/CPPProcess.cc b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gux_ttxux/CPPProcess.cc index 8d157bfe8c..4146aaf18c 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gux_ttxux/CPPProcess.cc +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gux_ttxux/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gux_ttxux/CPPProcess.h b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gux_ttxux/CPPProcess.h index 99ec68e177..01422c303b 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gux_ttxux/CPPProcess.h +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gux_ttxux/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gux_ttxux/auto_dsig.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gux_ttxux/auto_dsig.f index 995579a722..eb8a8e76e4 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gux_ttxux/auto_dsig.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gux_ttxux/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1137,11 +1137,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=32) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1151,32 +1152,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=32) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=32) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gux_ttxux/auto_dsig1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gux_ttxux/auto_dsig1.f index 27ef220e77..d02ea2f3b3 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gux_ttxux/auto_dsig1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gux_ttxux/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -104,6 +104,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -232,7 +234,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -300,7 +302,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -339,9 +341,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -358,6 +361,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -529,11 +534,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -633,9 +633,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -764,3 +766,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gux_ttxux/driver.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gux_ttxux/driver.f index c45686a3b2..c2eadb2c31 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gux_ttxux/driver.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gux_ttxux/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gux_ttxux/matrix1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gux_ttxux/matrix1.f index 1ab08162f9..1ebce3e45d 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gux_ttxux/matrix1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_gux_ttxux/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -26,6 +26,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=32) INTEGER NGRAPHS @@ -49,8 +51,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -59,26 +61,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -89,7 +88,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -99,26 +97,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,5) /-1,-1,-1, 1, 1/ DATA (NHEL(I, 2),I=1,5) /-1,-1,-1, 1,-1/ DATA (NHEL(I, 3),I=1,5) /-1,-1,-1,-1, 1/ @@ -162,8 +159,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -172,11 +168,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=4 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=4 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -186,12 +182,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -203,7 +198,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -232,35 +228,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -332,7 +326,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_uux_ttxg/CPPProcess.cc b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_uux_ttxg/CPPProcess.cc index e5d9023f43..225c8ca5c9 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_uux_ttxg/CPPProcess.cc +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_uux_ttxg/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_uux_ttxg/CPPProcess.h b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_uux_ttxg/CPPProcess.h index 0f582e7533..f8f6c51172 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_uux_ttxg/CPPProcess.h +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_uux_ttxg/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_uux_ttxg/auto_dsig.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_uux_ttxg/auto_dsig.f index 4481151b60..508328291b 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_uux_ttxg/auto_dsig.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_uux_ttxg/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1137,11 +1137,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=32) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1151,32 +1152,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=32) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=32) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_uux_ttxg/auto_dsig1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_uux_ttxg/auto_dsig1.f index 6dfd0af10a..1353e82a42 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_uux_ttxg/auto_dsig1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_uux_ttxg/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -104,6 +104,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -235,7 +237,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -304,7 +306,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -343,9 +345,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -363,6 +366,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -540,11 +545,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -644,9 +644,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -775,3 +777,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_uux_ttxg/driver.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_uux_ttxg/driver.f index c45686a3b2..c2eadb2c31 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_uux_ttxg/driver.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_uux_ttxg/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_uux_ttxg/matrix1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_uux_ttxg/matrix1.f index f617e77d4c..cbe5075ab3 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_uux_ttxg/matrix1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P1_uux_ttxg/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -26,6 +26,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=32) INTEGER NGRAPHS @@ -49,8 +51,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -59,26 +61,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -89,7 +88,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -99,26 +97,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,5) / 1,-1,-1, 1,-1/ DATA (NHEL(I, 2),I=1,5) / 1,-1,-1, 1, 1/ DATA (NHEL(I, 3),I=1,5) / 1,-1,-1,-1,-1/ @@ -162,8 +159,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -172,11 +168,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=4 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=4 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -186,12 +182,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -203,7 +198,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -232,35 +228,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -332,7 +326,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxgg/CPPProcess.cc b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxgg/CPPProcess.cc index 5ab6d2dc1f..0b331fd15a 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxgg/CPPProcess.cc +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxgg/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxgg/CPPProcess.h b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxgg/CPPProcess.h index aca257e0c2..b72a5017b0 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxgg/CPPProcess.h +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxgg/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxgg/auto_dsig.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxgg/auto_dsig.f index 5462c5b2f7..48483f3ccd 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxgg/auto_dsig.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxgg/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1134,11 +1134,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1148,32 +1149,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxgg/auto_dsig1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxgg/auto_dsig1.f index 18dcab4951..36aca3d359 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxgg/auto_dsig1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxgg/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -101,6 +101,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -217,7 +219,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -281,7 +283,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -320,9 +322,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -338,6 +341,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -485,11 +490,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -589,9 +589,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -752,3 +754,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxgg/driver.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxgg/driver.f index 526cc3b0ae..f7f23196eb 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxgg/driver.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxgg/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxgg/matrix1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxgg/matrix1.f index 2af276483a..11d3797b55 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxgg/matrix1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxgg/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -23,6 +23,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) INTEGER NGRAPHS @@ -46,8 +48,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -56,26 +58,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -86,7 +85,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -96,26 +94,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,6) /-1,-1,-1, 1,-1,-1/ DATA (NHEL(I, 2),I=1,6) /-1,-1,-1, 1,-1, 1/ DATA (NHEL(I, 3),I=1,6) /-1,-1,-1, 1, 1,-1/ @@ -191,8 +188,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -201,11 +197,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=24 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=24 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -215,12 +211,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -232,7 +227,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -261,35 +257,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -361,7 +355,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxuux/CPPProcess.cc b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxuux/CPPProcess.cc index fc7bcb9128..4f6d700ede 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxuux/CPPProcess.cc +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxuux/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxuux/CPPProcess.h b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxuux/CPPProcess.h index 90000b218a..8ba1d7555c 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxuux/CPPProcess.h +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxuux/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxuux/auto_dsig.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxuux/auto_dsig.f index 19425434f5..4466e3b318 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxuux/auto_dsig.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxuux/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1137,11 +1137,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1151,32 +1152,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxuux/auto_dsig1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxuux/auto_dsig1.f index f50acf4e1e..2bb68d8cc5 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxuux/auto_dsig1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxuux/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -104,6 +104,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -229,7 +231,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -296,7 +298,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -335,9 +337,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -353,6 +356,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -518,11 +523,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -622,9 +622,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -785,3 +787,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxuux/driver.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxuux/driver.f index 526cc3b0ae..f7f23196eb 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxuux/driver.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxuux/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxuux/matrix1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxuux/matrix1.f index 14442a3c07..4a8b96c863 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxuux/matrix1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gg_ttxuux/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -26,6 +26,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) INTEGER NGRAPHS @@ -49,8 +51,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -59,26 +61,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -89,7 +88,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -99,26 +97,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,6) /-1,-1,-1, 1,-1, 1/ DATA (NHEL(I, 2),I=1,6) /-1,-1,-1, 1,-1,-1/ DATA (NHEL(I, 3),I=1,6) /-1,-1,-1, 1, 1, 1/ @@ -194,8 +191,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -204,11 +200,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=12 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=12 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -218,12 +214,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -235,7 +230,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -264,35 +260,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -364,7 +358,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gu_ttxgu/CPPProcess.cc b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gu_ttxgu/CPPProcess.cc index f0abafb826..fe1473ec16 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gu_ttxgu/CPPProcess.cc +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gu_ttxgu/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gu_ttxgu/CPPProcess.h b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gu_ttxgu/CPPProcess.h index 59d48b3183..50c6185fb2 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gu_ttxgu/CPPProcess.h +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gu_ttxgu/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gu_ttxgu/auto_dsig.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gu_ttxgu/auto_dsig.f index 86518a03ce..05928f949e 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gu_ttxgu/auto_dsig.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gu_ttxgu/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1137,11 +1137,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1151,32 +1152,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gu_ttxgu/auto_dsig1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gu_ttxgu/auto_dsig1.f index 01d90ced46..562099653e 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gu_ttxgu/auto_dsig1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gu_ttxgu/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -104,6 +104,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -232,7 +234,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -300,7 +302,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -339,9 +341,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -358,6 +361,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -529,11 +534,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -633,9 +633,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -796,3 +798,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gu_ttxgu/driver.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gu_ttxgu/driver.f index 526cc3b0ae..f7f23196eb 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gu_ttxgu/driver.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gu_ttxgu/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gu_ttxgu/matrix1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gu_ttxgu/matrix1.f index cd276a4930..dfc65978b0 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gu_ttxgu/matrix1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gu_ttxgu/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -26,6 +26,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) INTEGER NGRAPHS @@ -49,8 +51,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -59,26 +61,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -89,7 +88,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -99,26 +97,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,6) /-1, 1,-1, 1,-1,-1/ DATA (NHEL(I, 2),I=1,6) /-1, 1,-1, 1,-1, 1/ DATA (NHEL(I, 3),I=1,6) /-1, 1,-1, 1, 1,-1/ @@ -194,8 +191,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -204,11 +200,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=12 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=12 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -218,12 +214,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -235,7 +230,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -264,35 +260,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -364,7 +358,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gux_ttxgux/CPPProcess.cc b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gux_ttxgux/CPPProcess.cc index 78a198f0ad..9bbe46ac79 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gux_ttxgux/CPPProcess.cc +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gux_ttxgux/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gux_ttxgux/CPPProcess.h b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gux_ttxgux/CPPProcess.h index 8b2f5cd09c..bbcbd44a5f 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gux_ttxgux/CPPProcess.h +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gux_ttxgux/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gux_ttxgux/auto_dsig.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gux_ttxgux/auto_dsig.f index 8a83e54567..a4d734ab51 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gux_ttxgux/auto_dsig.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gux_ttxgux/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1137,11 +1137,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1151,32 +1152,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gux_ttxgux/auto_dsig1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gux_ttxgux/auto_dsig1.f index 1772ea07ea..bdf370f218 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gux_ttxgux/auto_dsig1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gux_ttxgux/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -104,6 +104,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -232,7 +234,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -300,7 +302,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -339,9 +341,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -358,6 +361,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -529,11 +534,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -633,9 +633,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -796,3 +798,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gux_ttxgux/driver.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gux_ttxgux/driver.f index 526cc3b0ae..f7f23196eb 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gux_ttxgux/driver.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gux_ttxgux/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gux_ttxgux/matrix1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gux_ttxgux/matrix1.f index a6d3ffb1e8..f661174e8f 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gux_ttxgux/matrix1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_gux_ttxgux/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -26,6 +26,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) INTEGER NGRAPHS @@ -49,8 +51,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -59,26 +61,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -89,7 +88,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -99,26 +97,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,6) /-1,-1,-1, 1,-1, 1/ DATA (NHEL(I, 2),I=1,6) /-1,-1,-1, 1,-1,-1/ DATA (NHEL(I, 3),I=1,6) /-1,-1,-1, 1, 1, 1/ @@ -194,8 +191,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -204,11 +200,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=12 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=12 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -218,12 +214,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -235,7 +230,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -264,35 +260,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -364,7 +358,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uc_ttxuc/CPPProcess.cc b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uc_ttxuc/CPPProcess.cc index c4e155dcae..d7983b25cf 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uc_ttxuc/CPPProcess.cc +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uc_ttxuc/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uc_ttxuc/CPPProcess.h b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uc_ttxuc/CPPProcess.h index a2c6821084..19270b5496 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uc_ttxuc/CPPProcess.h +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uc_ttxuc/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uc_ttxuc/auto_dsig.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uc_ttxuc/auto_dsig.f index c4823d6e82..a1ec332bbc 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uc_ttxuc/auto_dsig.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uc_ttxuc/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1139,11 +1139,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1153,32 +1154,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uc_ttxuc/auto_dsig1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uc_ttxuc/auto_dsig1.f index 43a225bd7b..f5a438d016 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uc_ttxuc/auto_dsig1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uc_ttxuc/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -106,6 +106,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -241,7 +243,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -312,7 +314,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -351,9 +353,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -371,6 +374,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -556,11 +561,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -660,9 +660,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -823,3 +825,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uc_ttxuc/driver.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uc_ttxuc/driver.f index 526cc3b0ae..f7f23196eb 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uc_ttxuc/driver.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uc_ttxuc/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uc_ttxuc/matrix1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uc_ttxuc/matrix1.f index 8cd072202c..8e69b0f0ca 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uc_ttxuc/matrix1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uc_ttxuc/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -28,6 +28,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) INTEGER NGRAPHS @@ -51,8 +53,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -61,26 +63,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -91,7 +90,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -101,26 +99,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,6) / 1, 1,-1, 1,-1,-1/ DATA (NHEL(I, 2),I=1,6) / 1, 1,-1, 1,-1, 1/ DATA (NHEL(I, 3),I=1,6) / 1, 1,-1, 1, 1,-1/ @@ -196,8 +193,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -206,11 +202,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=6 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=6 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -220,12 +216,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -237,7 +232,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -266,35 +262,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -366,7 +360,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_ucx_ttxucx/CPPProcess.cc b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_ucx_ttxucx/CPPProcess.cc index e78aae3cdd..ec11bb2216 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_ucx_ttxucx/CPPProcess.cc +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_ucx_ttxucx/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_ucx_ttxucx/CPPProcess.h b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_ucx_ttxucx/CPPProcess.h index ff4da9ff1c..222259193b 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_ucx_ttxucx/CPPProcess.h +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_ucx_ttxucx/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_ucx_ttxucx/auto_dsig.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_ucx_ttxucx/auto_dsig.f index 8cf4f9e36a..a3de0328ec 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_ucx_ttxucx/auto_dsig.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_ucx_ttxucx/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1145,11 +1145,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1159,32 +1160,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_ucx_ttxucx/auto_dsig1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_ucx_ttxucx/auto_dsig1.f index 6e6d4c2db1..c51f0fb863 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_ucx_ttxucx/auto_dsig1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_ucx_ttxucx/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -112,6 +112,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -267,7 +269,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -344,7 +346,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -383,9 +385,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -403,6 +406,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -628,11 +633,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -732,9 +732,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -895,3 +897,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_ucx_ttxucx/driver.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_ucx_ttxucx/driver.f index 526cc3b0ae..f7f23196eb 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_ucx_ttxucx/driver.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_ucx_ttxucx/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_ucx_ttxucx/matrix1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_ucx_ttxucx/matrix1.f index 302d4ac309..d8ca6d18c2 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_ucx_ttxucx/matrix1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_ucx_ttxucx/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -34,6 +34,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) INTEGER NGRAPHS @@ -57,8 +59,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -67,26 +69,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -97,7 +96,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -107,26 +105,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,6) / 1,-1,-1, 1,-1, 1/ DATA (NHEL(I, 2),I=1,6) / 1,-1,-1, 1,-1,-1/ DATA (NHEL(I, 3),I=1,6) / 1,-1,-1, 1, 1, 1/ @@ -202,8 +199,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -212,11 +208,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=6 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=6 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -226,12 +222,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -243,7 +238,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -272,35 +268,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -372,7 +366,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uu_ttxuu/CPPProcess.cc b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uu_ttxuu/CPPProcess.cc index 901a41c0cf..31e63dc449 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uu_ttxuu/CPPProcess.cc +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uu_ttxuu/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uu_ttxuu/CPPProcess.h b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uu_ttxuu/CPPProcess.h index 97f0e941bb..da24a1c10d 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uu_ttxuu/CPPProcess.h +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uu_ttxuu/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uu_ttxuu/auto_dsig.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uu_ttxuu/auto_dsig.f index 186b3a7c7d..a6a0d3cd09 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uu_ttxuu/auto_dsig.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uu_ttxuu/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1137,11 +1137,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1151,32 +1152,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uu_ttxuu/auto_dsig1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uu_ttxuu/auto_dsig1.f index 3628224ed0..7d89233913 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uu_ttxuu/auto_dsig1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uu_ttxuu/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -104,6 +104,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -235,7 +237,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -304,7 +306,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -343,9 +345,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -363,6 +366,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -540,11 +545,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -644,9 +644,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -807,3 +809,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uu_ttxuu/driver.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uu_ttxuu/driver.f index 526cc3b0ae..f7f23196eb 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uu_ttxuu/driver.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uu_ttxuu/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uu_ttxuu/matrix1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uu_ttxuu/matrix1.f index 52c8aadf6c..64969ed611 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uu_ttxuu/matrix1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uu_ttxuu/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -26,6 +26,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) INTEGER NGRAPHS @@ -49,8 +51,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -59,26 +61,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -89,7 +88,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -99,26 +97,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,6) / 1, 1,-1, 1,-1,-1/ DATA (NHEL(I, 2),I=1,6) / 1, 1,-1, 1,-1, 1/ DATA (NHEL(I, 3),I=1,6) / 1, 1,-1, 1, 1,-1/ @@ -194,8 +191,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -204,11 +200,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=6 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=6 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -218,12 +214,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -235,7 +230,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -264,35 +260,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -364,7 +358,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxccx/CPPProcess.cc b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxccx/CPPProcess.cc index 496c0c8b1d..a4e3a7bb49 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxccx/CPPProcess.cc +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxccx/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxccx/CPPProcess.h b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxccx/CPPProcess.h index 9533fc12fa..a710a7cfff 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxccx/CPPProcess.h +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxccx/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxccx/auto_dsig.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxccx/auto_dsig.f index ca6d2b083c..ff97f048f3 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxccx/auto_dsig.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxccx/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1145,11 +1145,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1159,32 +1160,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxccx/auto_dsig1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxccx/auto_dsig1.f index dc917e5277..636ac38d51 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxccx/auto_dsig1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxccx/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -112,6 +112,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -267,7 +269,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -344,7 +346,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -383,9 +385,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -403,6 +406,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -628,11 +633,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -732,9 +732,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -895,3 +897,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxccx/driver.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxccx/driver.f index 526cc3b0ae..f7f23196eb 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxccx/driver.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxccx/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxccx/matrix1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxccx/matrix1.f index b20106a6da..00b7bed9bd 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxccx/matrix1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxccx/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -34,6 +34,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) INTEGER NGRAPHS @@ -57,8 +59,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -67,26 +69,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -97,7 +96,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -107,26 +105,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,6) / 1,-1,-1, 1,-1, 1/ DATA (NHEL(I, 2),I=1,6) / 1,-1,-1, 1,-1,-1/ DATA (NHEL(I, 3),I=1,6) / 1,-1,-1, 1, 1, 1/ @@ -202,8 +199,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -212,11 +208,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=6 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=6 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -226,12 +222,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -243,7 +238,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -272,35 +268,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -372,7 +366,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxgg/CPPProcess.cc b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxgg/CPPProcess.cc index 8532f570e6..6143def4bf 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxgg/CPPProcess.cc +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxgg/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxgg/CPPProcess.h b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxgg/CPPProcess.h index 2325c57c00..e23dde0cb9 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxgg/CPPProcess.h +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxgg/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxgg/auto_dsig.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxgg/auto_dsig.f index ad1f4999af..c2ac14a8d0 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxgg/auto_dsig.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxgg/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1137,11 +1137,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1151,32 +1152,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxgg/auto_dsig1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxgg/auto_dsig1.f index 1e7b114e37..dacc8482d6 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxgg/auto_dsig1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxgg/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -104,6 +104,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -235,7 +237,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -304,7 +306,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -343,9 +345,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -363,6 +366,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -540,11 +545,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -644,9 +644,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -807,3 +809,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxgg/driver.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxgg/driver.f index 526cc3b0ae..f7f23196eb 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxgg/driver.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxgg/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxgg/matrix1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxgg/matrix1.f index 7c94ecdda2..c9dcb1350f 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxgg/matrix1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxgg/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -26,6 +26,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) INTEGER NGRAPHS @@ -49,8 +51,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -59,26 +61,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -89,7 +88,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -99,26 +97,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,6) / 1,-1,-1, 1,-1,-1/ DATA (NHEL(I, 2),I=1,6) / 1,-1,-1, 1,-1, 1/ DATA (NHEL(I, 3),I=1,6) / 1,-1,-1, 1, 1,-1/ @@ -194,8 +191,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -204,11 +200,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=12 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=12 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -218,12 +214,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -235,7 +230,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -264,35 +260,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -364,7 +358,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxuux/CPPProcess.cc b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxuux/CPPProcess.cc index 7135109e40..7bae595aca 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxuux/CPPProcess.cc +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxuux/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxuux/CPPProcess.h b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxuux/CPPProcess.h index 9d8ce6ea23..44c39a5bc8 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxuux/CPPProcess.h +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxuux/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxuux/auto_dsig.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxuux/auto_dsig.f index fd8be8f8af..0c4a9864c1 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxuux/auto_dsig.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxuux/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1137,11 +1137,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1151,32 +1152,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxuux/auto_dsig1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxuux/auto_dsig1.f index 1608ea5ad1..663dc8ed89 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxuux/auto_dsig1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxuux/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -104,6 +104,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -235,7 +237,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -304,7 +306,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -343,9 +345,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -363,6 +366,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -540,11 +545,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -644,9 +644,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -807,3 +809,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxuux/driver.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxuux/driver.f index 526cc3b0ae..f7f23196eb 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxuux/driver.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxuux/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxuux/matrix1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxuux/matrix1.f index 82823c1c50..2a7b58687a 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxuux/matrix1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uux_ttxuux/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -26,6 +26,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) INTEGER NGRAPHS @@ -49,8 +51,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -59,26 +61,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -89,7 +88,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -99,26 +97,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,6) / 1,-1,-1, 1,-1, 1/ DATA (NHEL(I, 2),I=1,6) / 1,-1,-1, 1,-1,-1/ DATA (NHEL(I, 3),I=1,6) / 1,-1,-1, 1, 1, 1/ @@ -194,8 +191,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -204,11 +200,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=6 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=6 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -218,12 +214,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -235,7 +230,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -264,35 +260,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -364,7 +358,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxcx_ttxuxcx/CPPProcess.cc b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxcx_ttxuxcx/CPPProcess.cc index ff59b31ca9..7ea668d895 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxcx_ttxuxcx/CPPProcess.cc +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxcx_ttxuxcx/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxcx_ttxuxcx/CPPProcess.h b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxcx_ttxuxcx/CPPProcess.h index 61d801feb4..f8e2c83991 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxcx_ttxuxcx/CPPProcess.h +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxcx_ttxuxcx/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxcx_ttxuxcx/auto_dsig.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxcx_ttxuxcx/auto_dsig.f index 2dabdef85f..457e737d33 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxcx_ttxuxcx/auto_dsig.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxcx_ttxuxcx/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1139,11 +1139,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1153,32 +1154,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxcx_ttxuxcx/auto_dsig1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxcx_ttxuxcx/auto_dsig1.f index 96afa77779..80d690354a 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxcx_ttxuxcx/auto_dsig1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxcx_ttxuxcx/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -106,6 +106,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -241,7 +243,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -312,7 +314,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -351,9 +353,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -371,6 +374,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -556,11 +561,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -660,9 +660,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -823,3 +825,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxcx_ttxuxcx/driver.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxcx_ttxuxcx/driver.f index 526cc3b0ae..f7f23196eb 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxcx_ttxuxcx/driver.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxcx_ttxuxcx/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxcx_ttxuxcx/matrix1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxcx_ttxuxcx/matrix1.f index 8ba3eb160c..d270065dca 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxcx_ttxuxcx/matrix1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxcx_ttxuxcx/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -28,6 +28,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) INTEGER NGRAPHS @@ -51,8 +53,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -61,26 +63,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -91,7 +90,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -101,26 +99,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,6) /-1,-1,-1, 1, 1, 1/ DATA (NHEL(I, 2),I=1,6) /-1,-1,-1, 1, 1,-1/ DATA (NHEL(I, 3),I=1,6) /-1,-1,-1, 1,-1, 1/ @@ -196,8 +193,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -206,11 +202,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=6 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=6 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -220,12 +216,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -237,7 +232,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -266,35 +262,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -366,7 +360,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxux_ttxuxux/CPPProcess.cc b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxux_ttxuxux/CPPProcess.cc index b6d60ab8be..11b75db19c 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxux_ttxuxux/CPPProcess.cc +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxux_ttxuxux/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxux_ttxuxux/CPPProcess.h b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxux_ttxuxux/CPPProcess.h index b4cb750c38..8866ee1700 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxux_ttxuxux/CPPProcess.h +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxux_ttxuxux/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxux_ttxuxux/auto_dsig.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxux_ttxuxux/auto_dsig.f index dc961917f2..dc4100f8ae 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxux_ttxuxux/auto_dsig.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxux_ttxuxux/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1137,11 +1137,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1151,32 +1152,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxux_ttxuxux/auto_dsig1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxux_ttxuxux/auto_dsig1.f index f1b990cb16..c97397e1e2 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxux_ttxuxux/auto_dsig1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxux_ttxuxux/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -104,6 +104,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -235,7 +237,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -304,7 +306,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -343,9 +345,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -363,6 +366,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -540,11 +545,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -644,9 +644,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -807,3 +809,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxux_ttxuxux/driver.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxux_ttxuxux/driver.f index 526cc3b0ae..f7f23196eb 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxux_ttxuxux/driver.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxux_ttxuxux/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxux_ttxuxux/matrix1.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxux_ttxuxux/matrix1.f index 82735f7c1e..93a9de8bf3 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxux_ttxuxux/matrix1.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/P2_uxux_ttxuxux/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -26,6 +26,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) INTEGER NGRAPHS @@ -49,8 +51,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -59,26 +61,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -89,7 +88,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -99,26 +97,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,6) /-1,-1,-1, 1, 1, 1/ DATA (NHEL(I, 2),I=1,6) /-1,-1,-1, 1, 1,-1/ DATA (NHEL(I, 3),I=1,6) /-1,-1,-1, 1,-1, 1/ @@ -194,8 +191,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -204,11 +200,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=6 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=6 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -218,12 +214,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -235,7 +230,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -264,35 +260,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -364,7 +358,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/cluster.f b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/cluster.f index 649e46f4e9..b8995283ed 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/cluster.f +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/cluster.f @@ -552,6 +552,8 @@ logical function cluster(p, ivec) if (btest(mlevel,1)) $ write (*,*)'New event' + iwin = 0 + jwin = 0 cluster=.false. clustered=.false. do i=0,3 @@ -663,7 +665,8 @@ logical function cluster(p, ivec) c initialize graph storage igraphs(0)=0 nleft=nexternal -c cluster +c cluster + if (iwin.eq.0.or.jwin.eq.0) stop 21 do n=1,nexternal-2 c combine winner imocl(n)=imap(iwin,2)+imap(jwin,2) diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/proc_characteristics b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/proc_characteristics index 8bc9226ddb..2805dfbacf 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/proc_characteristics +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/proc_characteristics @@ -17,6 +17,8 @@ splitting_types = [] perturbation_order = [] limitations = [] + ew_sudakov = False hel_recycling = False single_color = False nlo_mixed_expansion = True + gauge = unitary diff --git a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/refine.sh b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/refine.sh index afb9b99ad1..b46170ba23 100644 --- a/epochX/cudacpp/pp_tt012j.mad/SubProcesses/refine.sh +++ b/epochX/cudacpp/pp_tt012j.mad/SubProcesses/refine.sh @@ -57,7 +57,11 @@ j=%(directory)s for((try=1;try<=16;try+=1)); do if [ "$keeplog" = true ] ; then + if [[ -e ../madevent ]];then ../madevent 2>&1 >> $k &1 >> $k &1 >> log.txt &1 >> log.txt &1 >> $k \w*)>') - pat_end=re.compile('\w*)>') + pat_begin=re.compile(r'<(?P\w*)>') + pat_end=re.compile(r'\w*)>') tag_to_file={'slha':'param_card.dat', 'mgruncard':'run_card.dat', @@ -319,7 +319,7 @@ def check_pid(self, pid2label): def get_lha_strategy(self): """get the lha_strategy: how the weight have to be handle by the shower""" - if not self["init"]: + if "init" not in self or not self["init"]: raise Exception("No init block define") data = self["init"].split('\n')[0].split() @@ -537,7 +537,8 @@ def charge_card(self, tag): self.param_card = param_card_reader.ParamCard(param_card) return self.param_card elif tag == 'mgruncard': - self.run_card = RunCard(self[tag], unknown_warning=False) + with misc.TMP_variable(RunCard, 'allow_scan', True): + self.run_card = RunCard(self[tag], consistency=False, unknow_warning=False) return self.run_card elif tag == 'mg5proccard': proc_card = self[tag].split('\n') @@ -976,6 +977,8 @@ class ConfigFile(dict): """ a class for storing/dealing with input file. """ + allow_scan = False + def __init__(self, finput=None, **opt): """initialize a new instance. input can be an instance of MadLoopParam, a file, a path to a file, or simply Nothing""" @@ -993,6 +996,7 @@ def __init__(self, finput=None, **opt): # Initialize it with all the default value self.user_set = set() self.auto_set = set() + self.scan_set = {} #key -> type of list (int/float/bool/str/... for scan self.system_only = set() self.lower_to_case = {} self.list_parameter = {} #key -> type of list (int/float/bool/str/... @@ -1109,6 +1113,8 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): #1. check if the parameter is set to auto -> pass it to special if lower_name in self: targettype = type(dict.__getitem__(self, lower_name)) + if lower_name in self.scan_set: + targettype = self.scan_set[lower_name] if targettype != str and isinstance(value, str) and value.lower() == 'auto': self.auto_set.add(lower_name) if lower_name in self.user_set: @@ -1118,13 +1124,26 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): return elif lower_name in self.auto_set: self.auto_set.remove(lower_name) - + + + #1. check if the parameter is set to auto -> pass it to special + scan_targettype = None + if self.allow_scan and isinstance(value, str) and value.strip().startswith('scan'): + if lower_name in self.user_set: + self.user_set.remove(lower_name) + self.scan_set[lower_name] = type(self[lower_name]) + dict.__setitem__(self, lower_name, value) + #keep old value. + self.post_set(lower_name,value, change_userdefine, raiseerror) + return + elif lower_name in self.scan_set: + scan_targettype = self.scan_set[lower_name] + del self.scan_set[lower_name] + # 2. Find the type of the attribute that we want if lower_name in self.list_parameter: targettype = self.list_parameter[lower_name] - - if isinstance(value, str): # split for each comma/space value = value.strip() @@ -1248,8 +1267,11 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): if change_userdefine: self.user_set.add(lower_name) return self.post_set(lower_name, None, change_userdefine, raiseerror) - elif name in self: - targettype = type(self[name]) + elif name in self: + if scan_targettype: + targettype = targettype + else: + targettype = type(self[name]) else: logger.debug('Trying to add argument %s in %s. ' % (name, self.__class__.__name__) +\ 'This argument is not defined by default. Please consider adding it.') @@ -1262,7 +1284,7 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): if change_userdefine: self.user_set.add(lower_name) return self.post_set(lower_name, None, change_userdefine, raiseerror) - + value = self.format_variable(value, targettype, name=name) #check that the value is allowed: if lower_name in self.allowed_value and '*' not in self.allowed_value[lower_name]: @@ -1444,7 +1466,7 @@ def format_variable(value, targettype, name="unknown"): value =int(value[:-1]) * convert[value[-1]] elif '/' in value or '*' in value: try: - split = re.split('(\*|/)',value) + split = re.split(r'(\*|/)',value) v = float(split[0]) for i in range((len(split)//2)): if split[2*i+1] == '*': @@ -1482,7 +1504,7 @@ def format_variable(value, targettype, name="unknown"): value = float(value) except ValueError: try: - split = re.split('(\*|/)',value) + split = re.split(r'(\*|/)',value) v = float(split[0]) for i in range((len(split)//2)): if split[2*i+1] == '*': @@ -1491,7 +1513,10 @@ def format_variable(value, targettype, name="unknown"): v /= float(split[2*i+2]) except: v=0 - raise InvalidCmd("%s can not be mapped to a float" % value) + if "scan" in value: + raise InvalidCmd("%s is not supported here. Note that scan command can not be present simultaneously in the run_card and param_card." % value) + else: + raise InvalidCmd("%s can not be mapped to a float" % value) finally: value = v else: @@ -1737,10 +1762,12 @@ def default_setup(self): self.add_param('splitting_types',[], typelist=str) self.add_param('perturbation_order', [], typelist=str) self.add_param('limitations', [], typelist=str) + self.add_param('ew_sudakov', False) self.add_param('hel_recycling', False) self.add_param('single_color', True) self.add_param('nlo_mixed_expansion', True) - + self.add_param('gauge', 'U') + def read(self, finput): """Read the input file, this can be a path to a file, a file object, a str with the content of the file.""" @@ -3104,7 +3131,7 @@ def write(self, output_file, template=None, python_template=False, # do not write hidden parameter not hidden for this template # if python_template: - written = written.union(set(re.findall('\%\((\w*)\)s', open(template,'r').read(), re.M))) + written = written.union(set(re.findall(r'\%\((\w*)\)s', open(template,'r').read(), re.M))) to_write = to_write.union(set(self.hidden_param)) to_write = to_write.difference(written) @@ -3157,7 +3184,6 @@ def get_value_from_include(self, path, list_of_params, output_dir): if path does not exists return the current value in self for all parameter""" #WARNING DOES NOT HANDLE LIST/DICT so far - misc.sprint(output_dir, path) # handle case where file is missing if not os.path.exists(pjoin(output_dir,path)): misc.sprint("include file not existing", pjoin(output_dir,path)) @@ -3259,7 +3285,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): text = open(path,'r').read() #misc.sprint(text) f77_type = ['real*8', 'integer', 'double precision', 'logical'] - pattern = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I+re.M) for fct in pattern.findall(text): fsock = file_writers.FortranWriter(tmp,'w') @@ -3287,6 +3313,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): starttext = open(pjoin(outdir, path+'.orig')).read() fsock.remove_routine(starttext, to_mod[path][0]) for text in to_mod[path][1]: + text = self.retro_compatible_custom_fct(text) fsock.writelines(text) fsock.close() if not filecmp.cmp(pjoin(outdir, path), pjoin(outdir, path+'.tmp')): @@ -3303,7 +3330,33 @@ def edit_dummy_fct_from_file(self, filelist, outdir): files.mv(pjoin(outdir,path+'.orig'), pjoin(outdir, path)) + @staticmethod + def retro_compatible_custom_fct(lines, mode=None): + f77_type = ['real*8', 'integer', 'double precision', 'logical'] + function_pat = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + % {'type':'|'.join(f77_type)}, re.I+re.M) + include_pat = re.compile(r"\s+include\s+[\'\"]([\w\./]*)") + + assert isinstance(lines, list) + sol = [] + + if mode is None or 'vector.inc' in mode: + search = True + for i,line in enumerate(lines[:]): + if search and re.search(include_pat, line): + name = re.findall(include_pat, line)[0] + misc.sprint('DETECTED INCLUDE', name) + if 'vector.inc' in name: + search = False + if 'run.inc' in name: + sol.append(" include 'vector.inc'") + search = False + sol.append(line) + if re.search(function_pat, line): + misc.sprint("DETECTED FCT") + search = True + return sol def guess_entry_fromname(self, name, value): """ @@ -3346,7 +3399,7 @@ def update_typelist(value, name, opts): #handle metadata opts = {} forced_opts = [] - for key,val in re.findall("\<(?P[_\-\w]+)\=(?P[^>]*)\>", str(name)): + for key,val in re.findall(r"\<(?P[_\-\w]+)\=(?P[^>]*)\>", str(name)): forced_opts.append(key) if val in ['True', 'False']: opts[key] = eval(val) @@ -3681,11 +3734,22 @@ def write_autodef(self, output_dir, output_file=None): out = ["%s\n" %l for l in out] fsock.writelines(out) - @staticmethod - def get_idbmup(lpp): + def get_idbmup(self, lpp, beam=1): """return the particle colliding pdg code""" if lpp in (1,2, -1,-2): - return math.copysign(2212, lpp) + target = 2212 + if 'nb_proton1' in self: + nbp = self['nb_proton%s' % beam] + nbn = self['nb_neutron%s' % beam] + if nbp == 1 and nbn ==0: + target = 2212 + elif nbp==0 and nbn ==1: + target = 2112 + else: + target = 1000000000 + target += 10 * (nbp+nbn) + target += 10000 * nbp + return math.copysign(target, lpp) elif lpp in (3,-3): return math.copysign(11, lpp) elif lpp in (4,-4): @@ -3701,8 +3765,8 @@ def get_banner_init_information(self): the first line of the block of the lhe file.""" output = {} - output["idbmup1"] = self.get_idbmup(self['lpp1']) - output["idbmup2"] = self.get_idbmup(self['lpp2']) + output["idbmup1"] = self.get_idbmup(self['lpp1'], beam=1) + output["idbmup2"] = self.get_idbmup(self['lpp2'], beam=2) output["ebmup1"] = self["ebeam1"] output["ebmup2"] = self["ebeam2"] output["pdfgup1"] = 0 @@ -3959,7 +4023,8 @@ def check_validity(self, card): dict.__setitem__(card, 'pdlabel1', card['pdlabel']) dict.__setitem__(card, 'pdlabel2', card['pdlabel']) - if abs(card['lpp1']) == 1 == abs(card['lpp2']) and card['pdlabel1'] != card['pdlabel2']: + if isinstance(card['lpp1'],int) and isinstance(card['lpp2'],int) and \ + abs(card['lpp1']) == 1 == abs(card['lpp2']) and card['pdlabel1'] != card['pdlabel2']: raise InvalidRunCard("Assymetric beam pdf not supported for proton-proton collision") def status(self, card): @@ -4156,12 +4221,16 @@ def default_setup(self): self.add_param('frame_id', 6, system=True) self.add_param("event_norm", "average", allowed=['sum','average', 'unity'], include=False, sys_default='sum', hidden=True) + self.add_param("keep_log", "normal", include=False, hidden=True, + comment="none: all log send to /dev/null.\n minimal: keep only log for survey of the last run.\n normal: keep only log for survey of all run. \n debug: keep all log (survey and refine)", + allowed=['none', 'minimal', 'normal', 'debug']) #cut self.add_param("auto_ptj_mjj", True, hidden=True) self.add_param("bwcutoff", 15.0) self.add_param("cut_decays", False, cut='d') self.add_param('dsqrt_shat',0., cut=True) self.add_param("nhel", 0, include=False) + self.add_param("limhel", 1e-8, hidden=True, comment="threshold to determine if an helicity contributes when not MC over helicity.") #pt cut self.add_param("ptj", 20.0, cut='j') self.add_param("ptb", 0.0, cut='b') @@ -4842,7 +4911,7 @@ def create_default_for_process(self, proc_characteristic, history, proc_def): # here pick strategy 2 if only one QCD color flow # and for pure multi-jet case jet_id = [21] + list(range(1, self['maxjetflavor']+1)) - if proc_characteristic['single_color']: + if proc_characteristic['gauge'] != 'FD' and proc_characteristic['single_color']: self['sde_strategy'] = 2 #for pure lepton final state go back to sde_strategy=1 pure_lepton=True @@ -5741,9 +5810,10 @@ def check_validity(self): # check that ebeam is bigger than the proton mass. for i in [1,2]: - if self['lpp%s' % i ] not in [1,2]: + # do not for proton mass if not proton PDF (or when scan initialization) + if self['lpp%s' % i ] not in [1,2] or isinstance(self['ebeam%i' % i], str): continue - + if self['ebeam%i' % i] < 0.938: if self['ebeam%i' %i] == 0: logger.warning("At-rest proton mode set: energy beam set to 0.938 GeV") @@ -6193,3 +6263,181 @@ def log_and_update(self, banner, card, par, v): xcard = banner.charge_card(card) xcard[par[0]].param_dict[(par[1],)].value = v xcard.write(os.path.join(self.me_dir, 'Cards', '%s.dat' % card)) + + + + +class RunCardIterator(object): + """A class keeping track of the scan: flag in the param_card and + having an __iter__() function to scan over all the points of the scan. + """ + + logging = True + def __init__(self, input_path=None): + with misc.TMP_variable(RunCard, 'allow_scan', True): + self.run_card = RunCard(input_path, consistency=False) + self.run_card.allow_scan = True + + self.itertag = [] #all the current value use + self.cross = [] # keep track of all the cross-section computed + self.param_order = [] + + def __iter__(self): + """generate the next param_card (in a abstract way) related to the scan. + Technically this generates only the generator.""" + + if hasattr(self, 'iterator'): + return self.iterator + self.iterator = self.iterate() + return self.iterator + + def write(self, path): + self.__iter__.write(path) + + def next(self, autostart=False): + """call the next iteration value""" + try: + iterator = self.iterator + except: + if autostart: + iterator = self.__iter__() + else: + raise + try: + out = next(iterator) + except StopIteration: + del self.iterator + raise + return out + + def iterate(self): + """create the actual generator""" + all_iterators = {} # dictionary of key -> block of object to scan [([param, [values]), ...] + pattern = re.compile(r'''scan\s*(?P\d*)\s*:\s*(?P[^#]*)''', re.I) + + # fill all_iterators with the run_card information + for name in self.run_card.scan_set: + value = self.run_card[name] + try: + key, def_list = pattern.findall(value)[0] + except Exception as error: + misc.sprint(error) + raise Exception("Fail to handle scanning tag in run_card: Please check that the syntax is valid") + if key == '': + key = -1 * len(all_iterators) + if key not in all_iterators: + all_iterators[key] = [] + try: + all_iterators[key].append( (name, eval(def_list))) + except SyntaxError as error: + raise Exception("Fail to handle your scan definition. Please check your syntax:\n entry: %s \n Error reported: %s" %(def_list, error)) + + #prepare to keep track of parameter changing for the report + keys = list(all_iterators.keys()) # need to fix an order for the scan + #store the type of parameter + for key in keys: + for param, values in all_iterators[key]: + self.param_order.append("run_card#%s" % (param)) + + # do the loop + lengths = [list(range(len(all_iterators[key][0][1]))) for key in keys] + from functools import reduce + total = reduce((lambda x, y: x * y),[len(x) for x in lengths]) + for i,positions in enumerate(itertools.product(*lengths)): + self.itertag = [] + if self.logging: + logger.info("Create the next run_card in the scan definition (%s/%s) " %( i+1, total), '$MG:BOLD') + for i, pos in enumerate(positions): + key = keys[i] + for param, values in all_iterators[key]: + # assign the value in the card. + self.run_card[param] = values[pos] + self.itertag.append(values[pos]) + if self.logging: + logger.info("change parameter %s to %s", \ + param, values[pos]) + + + # retrun the current param_card up to next iteration + yield self.run_card + + + def store_entry(self, run_name, cross, error=None, run_card_path=None): + """store the value of the cross-section""" + + if isinstance(cross, dict): + info = dict(cross) + info.update({'bench' : self.itertag, 'run_name': run_name}) + self.cross.append(info) + else: + if error is None: + self.cross.append({'bench' : self.itertag, 'run_name': run_name, 'cross(pb)':cross}) + else: + self.cross.append({'bench' : self.itertag, 'run_name': run_name, 'cross(pb)':cross, 'error(pb)':error}) + + + def write_summary(self, path, order=None, lastline=False, nbcol=20): + """ """ + + if path: + ff = open(path, 'w') + path_events = path.rsplit("/", 1)[0] + #identCard = open(pjoin(path.rsplit("/", 2)[0], "Cards", "ident_card.dat")) + #identLines = identCard.readlines() + #identCard.close() + else: + ff = StringIO.StringIO() + if order: + keys = order + else: + keys = list(self.cross[0].keys()) + if 'bench' in keys: keys.remove('bench') + if 'run_name' in keys: keys.remove('run_name') + keys.sort() + if 'cross(pb)' in keys: + keys.remove('cross(pb)') + keys.append('cross(pb)') + if 'error(pb)' in keys: + keys.remove('error(pb)') + keys.append('error(pb)') + + formatting = "#%s%s%s\n" %('%%-%is ' % (nbcol-1), ('%%-%is ' % (nbcol))* len(self.param_order), + ('%%-%is ' % (nbcol))* len(keys)) + # header + if not lastline: + ff.write(formatting % tuple(['run_name'] + self.param_order + keys)) + formatting = "%s%s%s\n" %('%%-%is ' % (nbcol), ('%%-%ie ' % (nbcol))* len(self.param_order), + ('%%-%ie ' % (nbcol))* len(keys)) + + if not lastline: + to_print = self.cross + else: + to_print = self.cross[-1:] + for info in to_print: + name = info['run_name'] + bench = info['bench'] + data = [] + for k in keys: + if k in info: + data.append(info[k]) + else: + data.append(0.) + ff.write(formatting % tuple([name] + bench + data)) + ff_single = open(pjoin(path_events, name, "params.dat"), "w") + for i_bench in range(0, len(bench)): + ff_single.write(self.param_order[i_bench] + " = " + str(bench[i_bench]) +"\n") + ff_single.close() + + if not path: + return ff.getvalue() + + + def get_next_name(self, run_name): + """returns a smart name for the next run""" + + if '_' in run_name: + name, value = run_name.rsplit('_',1) + if value.isdigit(): + return '%s_%02i' % (name, float(value)+1) + # no valid '_' in the name + return '%s_scan_02' % run_name diff --git a/epochX/cudacpp/pp_tt012j.mad/bin/internal/check_param_card.py b/epochX/cudacpp/pp_tt012j.mad/bin/internal/check_param_card.py index 71089d7480..bc785b5de6 100755 --- a/epochX/cudacpp/pp_tt012j.mad/bin/internal/check_param_card.py +++ b/epochX/cudacpp/pp_tt012j.mad/bin/internal/check_param_card.py @@ -649,7 +649,7 @@ def write_inc_file(self, outpath, identpath, default, need_mp=False): #check if we need to write the value of scale for some block if os.path.exists(input_inc): text = open(input_inc).read() - scales = list(set(re.findall('mdl__(\w*)__scale', text, re.I))) + scales = list(set(re.findall(r'mdl__(\w*)__scale', text, re.I))) else: scales = [] @@ -1000,10 +1000,12 @@ def iterate(self): self.param_order.append("%s#%s" % (param.lhablock, '_'.join(repr(i) for i in param.lhacode))) # do the loop lengths = [list(range(len(all_iterators[key][0][1]))) for key in keys] - for positions in itertools.product(*lengths): + from functools import reduce + total = reduce((lambda x, y: x * y),[len(x) for x in lengths]) + for i,positions in enumerate(itertools.product(*lengths)): self.itertag = [] if self.logging: - logger.info("Create the next param_card in the scan definition", '$MG:BOLD') + logger.info("Create the next param_card in the scan definition (%s/%s)" % (i+1,total), '$MG:BOLD') for i, pos in enumerate(positions): key = keys[i] for param, values in all_iterators[key]: diff --git a/epochX/cudacpp/pp_tt012j.mad/bin/internal/cluster.py b/epochX/cudacpp/pp_tt012j.mad/bin/internal/cluster.py index 9a893f630d..1ad860e04f 100755 --- a/epochX/cudacpp/pp_tt012j.mad/bin/internal/cluster.py +++ b/epochX/cudacpp/pp_tt012j.mad/bin/internal/cluster.py @@ -646,7 +646,10 @@ def worker(self): if os.path.exists(exe) and not exe.startswith('/'): exe = './' + exe if isinstance(opt['stdout'],str): - opt['stdout'] = open(opt['stdout'],'w') + if opt['stdout'] == '/dev/null': + opt['stdout'] = os.open(os.devnull, os.O_RDWR) + else: + opt['stdout'] = open(opt['stdout'],'w') if opt['stderr'] == None: opt['stderr'] = subprocess.STDOUT if arg: @@ -671,11 +674,12 @@ def worker(self): self.pids.put(pid) # the function should return 0 if everything is fine # the error message otherwise - returncode = exe(*arg, **opt) - if returncode != 0: - logger.warning("fct %s does not return 0. Stopping the code in a clean way. The error was:\n%s", exe, returncode) + try: + returncode = exe(*arg, **opt) + except Exception as error: + #logger.warning("fct %s does not return 0. Stopping the code in a clean way. The error was:\n%s", exe, returncode) self.stoprequest.set() - self.remove("fct %s does not return 0:\n %s" % (exe, returncode)) + self.remove("fct %s does raise %s\n %s" % (exe, error)) except Exception as error: self.fail_msg = sys.exc_info() logger.warning(str(error)) @@ -700,7 +704,7 @@ def worker(self): def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, - log=None, required_output=[], nb_submit=0): + log=None, required_output=[], nb_submit=0, python_opts={}): """submit a job on multicore machine""" # open threads if needed @@ -720,7 +724,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, return tag else: # python function - self.queue.put((tag, prog, argument, {})) + self.queue.put((tag, prog, argument, python_opts)) self.submitted.put(1) return tag @@ -908,6 +912,10 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None else: requirement = '' + if 'cluster_walltime' in self.options and self.options['cluster_walltime']\ + and self.options['cluster_walltime'] != 'None': + requirement+='\n MaxRuntime = %s' % self.options['cluster_walltime'] + if cwd is None: cwd = os.getcwd() if stdout is None: @@ -936,7 +944,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None #Submitting job(s). #Logging submit event(s). #1 job(s) submitted to cluster 2253622. - pat = re.compile("submitted to cluster (\d*)",re.MULTILINE) + pat = re.compile(r"submitted to cluster (\d*)",re.MULTILINE) output = output.decode(errors='ignore') try: id = pat.search(output).groups()[0] @@ -1025,7 +1033,7 @@ def submit2(self, prog, argument=[], cwd=None, stdout=None, stderr=None, #Logging submit event(s). #1 job(s) submitted to cluster 2253622. output = output.decode(errors='ignore') - pat = re.compile("submitted to cluster (\d*)",re.MULTILINE) + pat = re.compile(r"submitted to cluster (\d*)",re.MULTILINE) try: id = pat.search(output).groups()[0] except: @@ -1588,7 +1596,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None output = a.communicate()[0].decode(errors='ignore') #Your job 874511 ("test.sh") has been submitted - pat = re.compile("Your job (\d*) \(",re.MULTILINE) + pat = re.compile(r"Your job (\d*) \(",re.MULTILINE) try: id = pat.search(output).groups()[0] except: @@ -1606,7 +1614,7 @@ def control_one_job(self, id): if not status: return 'F' #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 - pat = re.compile("^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") + pat = re.compile(r"^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") stat = '' for line in status.stdout.read().decode(errors='ignore').split('\n'): if not line: @@ -1636,7 +1644,7 @@ def control(self, me_dir=None): cmd = 'qstat -s %s' % statusflag status = misc.Popen([cmd], shell=True, stdout=subprocess.PIPE) #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 - pat = re.compile("^(\d+)") + pat = re.compile(r"^(\d+)") for line in status.stdout.read().decode(errors='ignore').split('\n'): line = line.strip() try: @@ -1715,6 +1723,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None stderr = stdout if log is None: log = '/dev/null' + command = ['sbatch', '-o', stdout, '-J', me_dir, @@ -1726,6 +1735,12 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None command.insert(1, '-p') command.insert(2, self.cluster_queue) + if 'cluster_walltime' in self.options and self.options['cluster_walltime']\ + and self.options['cluster_walltime'] != 'None': + command.insert(1, '-t') + command.insert(2, self.options['cluster_walltime']) + + a = misc.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -1736,7 +1751,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None id = output_arr[3].rstrip() if not id.isdigit(): - id = re.findall('Submitted batch job ([\d\.]+)', ' '.join(output_arr)) + id = re.findall(r'Submitted batch job ([\d\.]+)', ' '.join(output_arr)) if not id or len(id)>1: raise ClusterManagmentError( 'fail to submit to the cluster: \n%s' \ diff --git a/epochX/cudacpp/pp_tt012j.mad/bin/internal/combine_runs.py b/epochX/cudacpp/pp_tt012j.mad/bin/internal/combine_runs.py index 4de6b84ec0..b1e8c88eac 100755 --- a/epochX/cudacpp/pp_tt012j.mad/bin/internal/combine_runs.py +++ b/epochX/cudacpp/pp_tt012j.mad/bin/internal/combine_runs.py @@ -20,6 +20,7 @@ from __future__ import absolute_import import math import os +import shutil import re import logging from six.moves import range @@ -117,6 +118,7 @@ def sum_multichannel(self, channel): #Now read in all of the events and write them #back out with the appropriate scaled weight + to_clean = [] fsock = open(pjoin(channel, 'events.lhe'), 'w') wgt = results.axsec / results.nunwgt tot_nevents, nb_file = 0, 0 @@ -129,8 +131,14 @@ def sum_multichannel(self, channel): nw = self.copy_events(fsock, pjoin(path,'events.lhe'), wgt) tot_nevents += nw nb_file += 1 + to_clean.append(path) logger.debug("Combined %s file generating %s events for %s " , nb_file, tot_nevents, channel) - + for path in to_clean: + try: + shutil.rmtree(path) + except Exception as error: + pass + @staticmethod def get_fortran_str(nb): data = '%E' % nb @@ -162,6 +170,7 @@ def copy_events(self, fsock, input, new_wgt): fsock.write(line) old_line = line return nb_evt + def get_channels(self, proc_path): """Opens file symfact.dat to determine all channels""" sympath = os.path.join(proc_path, 'symfact.dat') diff --git a/epochX/cudacpp/pp_tt012j.mad/bin/internal/common_run_interface.py b/epochX/cudacpp/pp_tt012j.mad/bin/internal/common_run_interface.py index 9bd9d9cb50..194f0cdfbd 100755 --- a/epochX/cudacpp/pp_tt012j.mad/bin/internal/common_run_interface.py +++ b/epochX/cudacpp/pp_tt012j.mad/bin/internal/common_run_interface.py @@ -23,6 +23,7 @@ import ast import logging import math +import copy import os import re import shutil @@ -181,6 +182,23 @@ def help_add_time_of_flight(self): logger.info(' threshold option allows to change the minimal value required to') logger.info(' a non zero value for the particle (default:1e-12s)') + def help_print_results(self): + logger.info("syntax: print_results [RUN_NAME] [OPTIONS]") + logger.info("-- print the results of the previous run on the screen") + logger.info(" If not RUN_NAME is provided, the information of all run") + logger.info(" are printed one after another.") + logger.info("") + logger.info(" supported options:") + logger.info(" ------------------") + logger.info(" --format=full|short # default is full") + logger.info(" full format contains banner/... ") + logger.info(" while short is a simple multi-column format (nice for plotting)") + logger.info(" --path=") + logger.info(" allow to write the information to a file.") + logger.info(" --mode=w|a #default is w ") + logger.info(" when the information is printed to a file, you can choose ") + logger.info(" to either overwrite the file if already exists (w mode)") + logger.info(" to append the information at the end of the file (a mode)") class CheckValidForCmd(object): @@ -727,7 +745,7 @@ def __init__(self, me_dir, options, *args, **opts): if not self.proc_characteristics['ninitial']: # Get number of initial states nexternal = open(pjoin(self.me_dir,'Source','nexternal.inc')).read() - found = re.search("PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) + found = re.search(r"PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) self.ninitial = int(found.group(1)) else: self.ninitial = self.proc_characteristics['ninitial'] @@ -989,7 +1007,22 @@ def do_treatcards(self, line, amcatnlo=False): #raise Exception, "%s %s %s" % (sys.path, os.path.exists(pjoin(self.me_dir,'bin','internal', 'ufomodel')), os.listdir(pjoin(self.me_dir,'bin','internal', 'ufomodel'))) import ufomodel as ufomodel zero = ufomodel.parameters.ZERO - if self.proc_characteristics['nlo_mixed_expansion']: + no_width = [] + + if self.proc_characteristics['ew_sudakov']: + # if the sudakov approximation is used, force all particle widths to zero + # unless the complex mass scheme is used + if not self.proc_characteristics['complex_mass_scheme']: + no_width = [p for p in ufomodel.all_particles if p.width != zero] + logger.info('''Setting all particle widths to zero (needed for EW Sudakov approximation).''','$MG:BOLD') + # also, check that the model features the 'ntadpole' parameter, and set it to 1 + try: + param_card['tadpole'].get(1).value = 1. + logger.info('''Setting the value of ntadpole to 1 (needed for EW Sudakov approximation).''','$MG:BOLD') + except KeyError: + logger.warning('''The model has no 'ntadpole' parameter. The Sudakov approximation for EW corrections may give wrong results.''') + + elif self.proc_characteristics['nlo_mixed_expansion']: no_width = [p for p in ufomodel.all_particles if (str(p.pdg_code) in pids or str(-p.pdg_code) in pids) and p.width != zero] @@ -1168,17 +1201,17 @@ def detect_card_type(path): 'Begin Minpts', 'gridpack', 'ebeam1', - 'block\s+mw_run', + r'block\s+mw_run', 'BLOCK', 'DECAY', 'launch', 'madspin', - 'transfer_card\.dat', + r'transfer_card\.dat', 'set', 'main:numberofevents', # pythia8, '@MG5aMC skip_analysis', #MA5 --both-- - '@MG5aMC\s*inputs\s*=\s*\*\.(?:hepmc|lhe)', #MA5 --both-- - '@MG5aMC\s*reconstruction_name', # MA5 hadronique + r'@MG5aMC\s*inputs\s*=\s*\*\.(?:hepmc|lhe)', #MA5 --both-- + r'@MG5aMC\s*reconstruction_name', # MA5 hadronique '@MG5aMC', # MA5 hadronique 'run_rivet_later', # Rivet ] @@ -1237,7 +1270,7 @@ def detect_card_type(path): return 'madspin_card.dat' if 'decay' in text: # need to check if this a line like "decay w+" or "set decay" - if re.search("(^|;)\s*decay", fulltext, re.M): + if re.search(r"(^|;)\s*decay", fulltext, re.M): return 'madspin_card.dat' else: return 'reweight_card.dat' @@ -2074,6 +2107,12 @@ def check_multicore(self): # ensure that the run_card is present if not hasattr(self, 'run_card'): self.run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat')) + # Below reads the run_card in the LHE file rather than the Cards/run_card + import madgraph.various.lhe_parser as lhe_parser + args_path = list(args) + self.check_decay_events(args_path) + self.run_card = banner_mod.RunCard(lhe_parser.EventFile(args_path[0]).get_banner()['mgruncard']) + # we want to run this in a separate shell to avoid hard f2py crash command = [sys.executable] @@ -2085,6 +2124,12 @@ def check_multicore(self): command.append('--web') command.append('reweight') + ## TV: copy the event file as backup before starting reweighting + event_path = pjoin(self.me_dir, 'Events', self.run_name, 'events.lhe.gz') + event_path_backup = pjoin(self.me_dir, 'Events', self.run_name, 'events_orig.lhe.gz') + if os.path.exists(event_path) and not os.path.exists(event_path_backup): + shutil.copyfile(event_path, event_path_backup) + ######### START SINGLE CORE MODE ############ if self.options['nb_core']==1 or self.run_card['nevents'] < 101 or not check_multicore(self): if self.run_name: @@ -2200,7 +2245,7 @@ def check_multicore(self): cross_sections[key] = value / (nb_event+1) lhe.remove() for key in cross_sections: - if key == 'orig' or key.isdigit(): + if key == 'orig' or (key.isdigit() and not (key[0] == '2')): continue logger.info('%s : %s pb' % (key, cross_sections[key])) return @@ -2461,7 +2506,7 @@ def do_add_time_of_flight(self, line): ############################################################################ def do_print_results(self, line): - """Not in help:Print the cross-section/ number of events for a given run""" + """Print the cross-section/ number of events for a given run""" args = self.split_arg(line) options={'path':None, 'mode':'w', 'format':'full'} @@ -2942,10 +2987,15 @@ def do_rivet(self, line, postprocess=False): #2 Prepare Rivet setup environments rivet_path = self.options['rivet_path'] yoda_path = self.options['yoda_path'] + fastjet_path = subprocess.Popen([self.options['fastjet'], '--prefix'], + stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip() + set_env = set_env + "export PATH={0}:$PATH\n".format(pjoin(rivet_path, 'bin')) set_env = set_env + "export PATH={0}:$PATH\n".format(pjoin(yoda_path, 'bin')) set_env = set_env + "export LD_LIBRARY_PATH={0}:{1}:$LD_LIBRARY_PATH\n".format(pjoin(rivet_path, 'lib'), pjoin(rivet_path, 'lib64')) set_env = set_env + "export LD_LIBRARY_PATH={0}:{1}:$LD_LIBRARY_PATH\n".format(pjoin(yoda_path, 'lib'), pjoin(yoda_path, 'lib64')) + set_env = set_env + "export LD_LIBRARY_PATH={0}:$LD_LIBRARY_PATH\n".format(pjoin(self.options['hepmc_path'], 'lib')) + set_env = set_env + "export LD_LIBRARY_PATH={0}:$LD_LIBRARY_PATH\n".format(pjoin(fastjet_path, 'lib')) major, minor = sys.version_info[0:2] set_env = set_env + "export PYTHONPATH={0}:{1}:$PYTHONPATH\n".format(pjoin(rivet_path, 'lib', 'python%s.%s' %(major,minor), 'site-packages'),\ pjoin(rivet_path, 'lib64', 'python%s.%s' %(major,minor), 'site-packages')) @@ -4311,8 +4361,8 @@ def complete_compute_widths(self, text, line, begidx, endidx, formatting=True): else: completion = {} completion['options'] = self.list_completion(text, - ['--path=', '--output=', '--min_br=0.\$', '--nlo', - '--precision_channel=0.\$', '--body_decay=']) + ['--path=', '--output=', r'--min_br=0.\$', '--nlo', + r'--precision_channel=0.\$', '--body_decay=']) return self.deal_multiple_categories(completion, formatting) @@ -4821,9 +4871,9 @@ class AskforEditCard(cmd.OneLinePathCompletion): (return False to repeat the question) """ - all_card_name = ['param_card', 'run_card', 'pythia_card', 'pythia8_card', + all_card_name = ['param_card', 'run_card', 'pythia_card', 'pythia8_card', 'fo_analysis_card' 'madweight_card', 'MadLoopParams', 'shower_card', 'rivet_card'] - to_init_card = ['param', 'run', 'madweight', 'madloop', + to_init_card = ['param', 'run', 'madweight', 'madloop', 'fo_analysis', 'shower', 'pythia8','delphes','madspin', 'rivet'] special_shortcut = {} special_shortcut_help = {} @@ -4853,6 +4903,7 @@ def load_default(self): self.has_PY8 = False self.has_delphes = False self.has_rivet = False + self.has_fo_card = False self.paths = {} self.update_block = [] @@ -5058,7 +5109,8 @@ def init_run(self, cards): try: - self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning') + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning') except IOError: self.run_card = {} try: @@ -5248,6 +5300,15 @@ def init_delphes(self, cards): self.has_delphes = True return [] + def init_fo_analysis(self, cards): + self.has_fo_card = False + if not self.get_path('FO_analyse', cards): + return [] + self.has_fo_card = True + self.fo_card = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse']) + self.fo_card_def = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse_default']) + return list(self.fo_card.string_vars) + def set_CM_velocity(self, line): """compute sqrts from the velocity in the center of mass frame""" @@ -5508,6 +5569,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): allowed['delphes_card'] = '' if self.has_rivet: allowed['rivet_card'] = '' + if self.has_fo_card: + allowed['fo_card'] = '' elif len(args) == 2: if args[1] == 'run_card': @@ -5532,6 +5595,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): allowed = {'delphes_card':'default'} elif args[1] == 'rivet_card': allowed = {'rivet_card':'default'} + elif args[1] == 'fo_card': + allowed = {'fo_card':'default'} else: allowed = {'value':''} @@ -5539,6 +5604,7 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): start = 1 if args[1] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', 'MadLoop_card','pythia8_card','delphes_card','plot_card', + 'fo_card', 'madanalysis5_parton_card','madanalysis5_hadron_card', 'rivet_card']: start = 2 @@ -5576,6 +5642,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): categories.append('delphes_card') if self.has_rivet: categories.append('rivet_card') + if self.has_fo_card: + categories.append('fo_card') possibilities['category of parameter (optional)'] = \ self.list_completion(text, categories) @@ -5630,7 +5698,13 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): if 'delphes_card' in allowed: if allowed['delphes_card'] == 'default': opts = ['default', 'atlas', 'cms'] - possibilities['Delphes Card'] = self.list_completion(text, opts) + possibilities['Delphes Card'] = self.list_completion(text, opts) + + if 'fo_card' in allowed: + opts = self.fo_card.string_vars + if allowed['fo_card'] == 'default': + opts.append('default') + possibilities['FO Card'] = self.list_completion(text, opts) if 'value' in list(allowed.keys()): opts = ['default', 'scale'] @@ -5733,21 +5807,28 @@ def do_set(self, line): if args[0] in self.special_shortcut: targettypes , cmd = self.special_shortcut[args[0]] if len(args) != len(targettypes) +1: - logger.warning('shortcut %s requires %s argument' % (args[0], len(targettypes))) - if len(args) < len(targettypes) +1: - return + if len(targettypes) == 1 and args[len(targettypes)].startswith('scan'): + args = args[:len(targettypes)] + [' '.join(args[len(targettypes):])] + targettypes = [str] else: - logger.warning('additional argument will be ignored') + logger.warning('shortcut %s requires %s argument' % (args[0], len(targettypes))) + if len(args) < len(targettypes) +1: + return + else: + logger.warning('additional argument will be ignored') values ={} for i, argtype in enumerate(targettypes): try: - values = {str(i): banner_mod.ConfigFile.format_variable(args[i+1], argtype, args[0])} + values[str(i)] = banner_mod.ConfigFile.format_variable(args[i+1], argtype, args[0]) except ValueError as e: logger.warning("Wrong argument: The entry #%s should be of type %s.", i+1, argtype) return except InvalidCmd as e: - logger.warning(str(e)) - return + if isinstance(args[i+1], str) and args[i+1].startswith('scan'): + values[str(i)] = args[i+1] + else: + logger.warning(str(e)) + return #else: # logger.warning("too many argument for this command") # return @@ -5787,7 +5868,7 @@ def do_set(self, line): if os.path.exists(pythia_path): logger.info('add line QCUT = %s in pythia_card.dat' % args[1]) p_card = open(pythia_path,'r').read() - p_card, n = re.subn('''^\s*QCUT\s*=\s*[\de\+\-\.]*\s*$''', + p_card, n = re.subn(r'''^\s*QCUT\s*=\s*[\de\+\-\.]*\s*$''', ''' QCUT = %s ''' % args[1], \ p_card, flags=(re.M+re.I)) if n==0: @@ -5801,7 +5882,7 @@ def do_set(self, line): if os.path.exists(pythia_path): logger.info('add line SHOWERKT = %s in pythia_card.dat' % args[1].upper()) p_card = open(pythia_path,'r').read() - p_card, n = re.subn('''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''', + p_card, n = re.subn(r'''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''', ''' SHOWERKT = %s ''' % args[1].upper(), \ p_card, flags=(re.M+re.I)) if n==0: @@ -5856,7 +5937,7 @@ def do_set(self, line): pjoin(self.me_dir,'Cards', 'delphes_card.dat')) return - if args[0] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', + if args[0] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', 'fo_card', 'delphes_card','madanalysis5_hadron_card','madanalysis5_parton_card','rivet_card']: if args[1] == 'default': @@ -6176,6 +6257,22 @@ def do_set(self, line): self.setRivet(args[start], value, default=default) self.rivet_card.write(self.paths['rivet'], self.paths['rivet_default']) + elif self.has_fo_card and (card in ['', 'fo_card'])\ + and args[start].lower() in [k.lower() for k in self.fo_card.string_vars]: + + if args[start] in self.conflict and card == '': + text = 'ambiguous name (present in more than one card). Please specify which card to edit' + logger.warning(text) + return + if args[start+1] == 'default': + value = self.fo_card_default[args[start]] + default = True + else: + value = args[start+1] + default = False + self.fo_card[args[start]] = value + self.modified_card.add('fo_card') + #INVALID -------------------------------------------------------------- else: logger.warning('invalid set command %s ' % line) @@ -6222,12 +6319,13 @@ def setM(self, block, name, value): def setR(self, name, value): - if self.mother_interface.inputfile: - self.run_card.set(name, value, user=True, raiseerror=True) - else: - self.run_card.set(name, value, user=True) - new_value = self.run_card.get(name) - logger.info('modify parameter %s of the run_card.dat to %s' % (name, new_value),'$MG:BOLD') + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + if self.mother_interface.inputfile: + self.run_card.set(name, value, user=True, raiseerror=True) + else: + self.run_card.set(name, value, user=True) + new_value = self.run_card.get(name) + logger.info('modify parameter %s of the run_card.dat to %s' % (name, new_value),'$MG:BOLD') def setML(self, name, value, default=False): @@ -6314,6 +6412,7 @@ def check_card_consistency(self): proc_charac = self.mother_interface.proc_characteristics if proc_charac['grouped_matrix'] and \ + isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int) and \ abs(self.run_card['lpp1']) == 1 == abs(self.run_card['lpp2']) and \ (self.run_card['nb_proton1'] != self.run_card['nb_proton2'] or self.run_card['nb_neutron1'] != self.run_card['nb_neutron2'] or @@ -6403,41 +6502,42 @@ def check_card_consistency(self): # check that only quark/gluon/photon are in initial beam if lpp=+-1 pdg_in_p = list(range(-6,7))+[21,22] - if (abs(self.run_card['lpp1'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial1'])) \ + if isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int): + if(abs(self.run_card['lpp1'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial1'])) \ or (abs(self.run_card['lpp2'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial2'])): - if 'pythia_card.dat' in self.cards or 'pythia8_card.dat' in self.cards: - path_to_remove = None - if 'pythia_card.dat' in self.cards: - path_to_remove = self.paths['pythia'] - card_to_remove = 'pythia_card.dat' - elif 'pythia8_card.dat' in self.cards: - path_to_remove = self.paths['pythia8'] - card_to_remove = 'pythia8_card.dat' - if path_to_remove: - if 'partonshower' in self.run_card['bypass_check']: + if 'pythia_card.dat' in self.cards or 'pythia8_card.dat' in self.cards: + path_to_remove = None + if 'pythia_card.dat' in self.cards: + path_to_remove = self.paths['pythia'] + card_to_remove = 'pythia_card.dat' + elif 'pythia8_card.dat' in self.cards: + path_to_remove = self.paths['pythia8'] + card_to_remove = 'pythia8_card.dat' + if path_to_remove: + if 'partonshower' in self.run_card['bypass_check']: + logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") + else: + logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') + os.remove(path_to_remove) + self.cards.remove(card_to_remove) + else: + logger.info('Remember that Parton-Shower are not yet ready for such proton component definition (HW implementation in progress).', '$MG:BOLD' ) + elif (abs(self.run_card['lpp1'])==3 and abs(self.run_card['lpp2'])==3): + if 'pythia8_card.dat' in self.cards: + if self.run_card['pdlabel'] == 'isronlyll': + if 'partonshower' not in self.run_card['bypass_check']: + # force that QED shower is on? + for param in ['TimeShower:QEDshowerByQ', 'TimeShower:QEDshowerByL', 'TimeShower:QEDshowerByGamma', 'SpaceShower:QEDshowerByQ', 'SpaceShower:QEDshowerByL']: + if param not in self.PY8Card or \ + (not self.PY8Card[param] and param.lower() not in self.PY8Card.user_set): + logger.warning('Activating QED shower: setting %s to True', param) + self.PY8Card[param] = True + elif 'partonshower' in self.run_card['bypass_check']: logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") - else: + else: logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') - os.remove(path_to_remove) - self.cards.remove(card_to_remove) - else: - logger.info('Remember that Parton-Shower are not yet ready for such proton component definition (HW implementation in progress).', '$MG:BOLD' ) - elif (abs(self.run_card['lpp1'])==3 and abs(self.run_card['lpp2'])==3): - if 'pythia8_card.dat' in self.cards: - if self.run_card['pdlabel'] == 'isronlyll': - if 'partonshower' not in self.run_card['bypass_check']: - # force that QED shower is on? - for param in ['TimeShower:QEDshowerByQ', 'TimeShower:QEDshowerByL', 'TimeShower:QEDshowerByGamma', 'SpaceShower:QEDshowerByQ', 'SpaceShower:QEDshowerByL']: - if param not in self.PY8Card or \ - (not self.PY8Card[param] and param.lower() not in self.PY8Card.user_set): - logger.warning('Activating QED shower: setting %s to True', param) - self.PY8Card[param] = True - elif 'partonshower' in self.run_card['bypass_check']: - logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") - else: - logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') - os.remove(self.paths['pythia8']) - self.cards.remove('pythia8_card.dat') + os.remove(self.paths['pythia8']) + self.cards.remove('pythia8_card.dat') ######################################################################## @@ -6514,7 +6614,8 @@ def check_card_consistency(self): #check relation between lepton PDF // dressed lepton collisions // ... - if abs(self.run_card['lpp1']) != 1 or abs(self.run_card['lpp2']) != 1: + if isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int) and \ + abs(self.run_card['lpp1']) != 1 or abs(self.run_card['lpp2']) != 1: if abs(self.run_card['lpp1']) == abs(self.run_card['lpp2']) == 3: # this can be dressed lepton or photon-flux if proc_charac['pdg_initial1'] in [[11],[-11]] and proc_charac['pdg_initial2'] in [[11],[-11]]: @@ -6732,7 +6833,11 @@ def write_card_param(self): """ write the param_card """ self.param_card.write(self.paths['param']) - + + def write_card_fo_card(self): + """ write the fo_card""" + self.fo_card.write_card_from_template(self.paths['FO_analyse'], self.paths['FO_analyse_default']) + @staticmethod def update_dependent(mecmd, me_dir, param_card, path ,timer=0, run_card=None, lhapdfconfig=None): @@ -7076,7 +7181,7 @@ def do_decay(self, line): #first find the particle particle = line.split('>')[0].strip() logger.info("change madspin_card to define the decay of %s: %s" %(particle, line.strip()), '$MG:BOLD') - particle = particle.replace('+','\+').replace('-','\-') + particle = particle.replace('+',r'\+').replace('-',r'\-') decay_pattern = re.compile(r"^\s*decay\s+%s\s*>[\s\w+-~]*?$" % particle, re.I+re.M) text= open(path).read() text = decay_pattern.sub('', text) @@ -7193,7 +7298,7 @@ def help_edit(self, prefix=True): logger.info( ' --clean remove all previously existing line in the file') logger.info( ' --comment_line="" comment all lines matching the regular expression') logger.info('') - logger.info(' Note: all regular-expression will be prefixed by ^\s*') + logger.info(r' Note: all regular-expression will be prefixed by ^\s*') logger.info('') logger.info( ' example: edit reweight --after_line="change mode\b" change model heft') logger.info( ' edit madspin --after_line="banner" change model XXXX') @@ -7314,7 +7419,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''replace_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[14:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[14:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7344,7 +7449,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''comment_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[14:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[14:-1] nb_mod = 0 for posline,l in enumerate(split): if re.search(pattern, l): @@ -7366,7 +7471,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''before_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[13:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[13:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7383,7 +7488,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern = r'''after_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[12:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[12:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7527,16 +7632,19 @@ def open_file(self, answer): answer = 'plot' else: answer = self.cards[int(answer)-self.integer_bias] - + path = '' if 'madweight' in answer: answer = answer.replace('madweight', 'MadWeight') elif 'MadLoopParams' in answer: answer = self.paths['ML'] elif 'pythia8_card' in answer: answer = self.paths['pythia8'] + elif 'FO_analyse' in answer: + path = self.paths['FO_analyse'] + answer = 'fo_card' if os.path.exists(answer): path = answer - else: + elif not os.path.exists(path): if not '.dat' in answer and not '.lhco' in answer: if answer != 'trigger': path = self.paths[answer] @@ -7595,7 +7703,8 @@ def reload_card(self, path): logger.error('Please re-open the file and fix the problem.') logger.warning('using the \'set\' command without opening the file will discard all your manual change') elif path == self.paths['run']: - self.run_card = banner_mod.RunCard(path) + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + self.run_card = banner_mod.RunCard(path) elif path == self.paths['shower']: self.shower_card = shower_card_mod.ShowerCard(path) elif path == self.paths['ML']: @@ -7614,6 +7723,8 @@ def reload_card(self, path): except: import internal.madweight.Cards as mwcards self.mw_card = mwcards.Card(path) + elif path == self.paths['FO_analyse']: + self.fo_card = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse']) else: logger.debug('not keep in sync: %s', path) return path @@ -7629,6 +7740,9 @@ def scanparamcardhandling(input_path=lambda obj: pjoin(obj.me_dir, 'Cards', 'par iteratorclass=param_card_mod.ParamCardIterator, summaryorder=lambda obj: lambda:None, check_card=lambda obj: CommonRunCmd.static_check_param_card, + run_card_scan=False, + run_card_input= lambda obj: pjoin(obj.me_dir, 'Cards', 'run_card.dat'), + run_card_iteratorclass=banner_mod.RunCardIterator, ): """ This is a decorator for customizing/using scan over the param_card (or technically other) This should be use like this: @@ -7678,7 +7792,60 @@ def __enter__(self): def __exit__(self, ctype, value, traceback ): self.iterator.write(self.path) - def decorator(original_fct): + def scan_over_run_card(original_fct, obj, *args, **opts): + + if isinstance(input_path, str): + card_path = run_card_input + else: + card_path = run_card_input(obj) + + run_card_iterator = run_card_iteratorclass(card_path) + orig_card = copy.deepcopy(run_card_iterator.run_card) + if not run_card_iterator.run_card.scan_set: + return original_fct(obj, *args, **opts) + + + with restore_iterator(orig_card, card_path): + # this with statement ensure that the original card is restore + # whatever happens inside those block + + if not hasattr(obj, 'allow_notification_center'): + obj.allow_notification_center = False + with misc.TMP_variable(obj, 'allow_notification_center', False): + orig_name = get_run_name(obj) + if not orig_name and args[1]: + orig_name = args[1][0] + args = (args[0], args[1][1:]) + #orig_name = "scan_%s" % len(obj.results) + + try: + os.mkdir(pjoin(obj.me_dir, 'Events', orig_name)) + except Exception: + pass + next_name = orig_name + "_00" + + for i,card in enumerate(run_card_iterator): + card.write(card_path) + # still have to check for the auto-wdith + #if i !=0: + next_name = run_card_iterator.get_next_name(next_name) + set_run_name(obj)(next_name) + try: + original_fct(obj, *args, **opts) + except ignoreerror as error: + run_card_iterator.store_entry(next_name, {'exception': error}) + else: + run_card_iterator.store_entry(next_name, store_for_scan(obj)(), run_card_path=card_path) + + #param_card_iterator.write(card_path) #-> this is done by the with statement + name = misc.get_scan_name(orig_name, next_name) + path = result_path(obj) % name + logger.info("write scan results in %s" % path ,'$MG:BOLD') + order = summaryorder(obj)() + run_card_iterator.write_summary(path, order=order) + + + def decorator(original_fct): def new_fct(obj, *args, **opts): if isinstance(input_path, str): @@ -7702,8 +7869,13 @@ def new_fct(obj, *args, **opts): if not param_card_iterator: #first run of the function - original_fct(obj, *args, **opts) - return + if run_card_scan: + scan_over_run_card(original_fct, obj, *args, **opts) + return + else: + #first run of the function + original_fct(obj, *args, **opts) + return with restore_iterator(param_card_iterator, card_path): # this with statement ensure that the original card is restore diff --git a/epochX/cudacpp/pp_tt012j.mad/bin/internal/extended_cmd.py b/epochX/cudacpp/pp_tt012j.mad/bin/internal/extended_cmd.py index 2f37070580..789976beee 100755 --- a/epochX/cudacpp/pp_tt012j.mad/bin/internal/extended_cmd.py +++ b/epochX/cudacpp/pp_tt012j.mad/bin/internal/extended_cmd.py @@ -624,12 +624,12 @@ def complete(self, text, state): compfunc = self.completenames # correct wrong splittion with '\ ' - if line and begidx > 2 and line[begidx-2:begidx] == '\ ': + if line and begidx > 2 and line[begidx-2:begidx] == r'\ ': Ntext = line.split(os.path.sep)[-1] - self.completion_prefix = Ntext.rsplit('\ ', 1)[0] + '\ ' + self.completion_prefix = Ntext.rsplit(r'\ ', 1)[0] + r'\ ' to_rm = len(self.completion_prefix) - 1 Nbegidx = len(line.rsplit(os.path.sep, 1)[0]) + 1 - data = compfunc(Ntext.replace('\ ', ' '), line, Nbegidx, endidx) + data = compfunc(Ntext.replace(r'\ ', ' '), line, Nbegidx, endidx) self.completion_matches = [p[to_rm:] for p in data if len(p)>to_rm] # correct wrong splitting with '-'/"=" @@ -742,7 +742,7 @@ def path_completion(text, base_dir = None, only_dirs = False, completion += [prefix + f for f in ['.'+os.path.sep, '..'+os.path.sep] if \ f.startswith(text) and not prefix.startswith('.')] - completion = [a.replace(' ','\ ') for a in completion] + completion = [a.replace(' ',r'\ ') for a in completion] return completion @@ -1253,7 +1253,7 @@ def check_answer_in_input_file(self, question_instance, default, path=False, lin return possibility[0] if '=' in line and ' ' in line.strip(): leninit = len(line) - line,n = re.subn('\s*=\s*','=', line) + line,n = re.subn(r'\s*=\s*','=', line) if n and len(line) != leninit: return self.check_answer_in_input_file(question_instance, default, path=path, line=line) @@ -1311,7 +1311,7 @@ def nice_error_handling(self, error, line): if os.path.exists(self.debug_output): os.remove(self.debug_output) try: - super(Cmd,self).onecmd('history %s' % self.debug_output.replace(' ', '\ ')) + super(Cmd,self).onecmd('history %s' % self.debug_output.replace(' ', r'\ ')) except Exception as error: logger.error(error) @@ -2001,6 +2001,7 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): text = "" has_mg5_path = False # Use local configuration => Need to update the path + already_written = set() for line in open(basefile): if '=' in line: data, value = line.split('=',1) @@ -2018,9 +2019,12 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): comment = '' if key in to_keep: value = str(to_keep[key]) - else: + elif line not in already_written: + already_written.add(line) text += line continue + else: + continue if key == 'mg5_path': has_mg5_path = True try: @@ -2032,14 +2036,20 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): # check if absolute path if not os.path.isabs(value): value = os.path.realpath(os.path.join(basedir, value)) - text += '%s = %s # %s \n' % (key, value, comment) + new_line = '%s = %s # %s \n' % (key, value, comment) + if new_line not in already_written: + text += new_line + already_written.add(new_line) for key in to_write: if key in to_keep: - text += '%s = %s \n' % (key, to_keep[key]) + new_line = '%s = %s \n' % (key, to_keep[key]) + if new_line not in already_written: + text += new_line if not MADEVENT and not has_mg5_path: - text += """\n# MG5 MAIN DIRECTORY\n""" - text += "mg5_path = %s\n" % MG5DIR + if "mg5_path = %s\n" % MG5DIR not in already_written: + text += """\n# MG5 MAIN DIRECTORY\n""" + text += "mg5_path = %s\n" % MG5DIR writer = open(filepath,'w') writer.write(text) @@ -2190,7 +2200,7 @@ def onecmd(self, line, **opt): raise def reask(self, reprint_opt=True): - pat = re.compile('\[(\d*)s to answer\]') + pat = re.compile(r'\[(\d*)s to answer\]') prev_timer = signal.alarm(0) # avoid timer if any if prev_timer: @@ -2991,7 +3001,7 @@ def question_formatting(self, nb_col = 80, lpotential_switch=0, lnb_key=0, key=None): - """should return four lines: + r"""should return four lines: 1. The upper band (typically /========\ 2. The lower band (typically \========/ 3. The line without conflict | %(nb)2d. %(descrip)-20s %(name)5s = %(switch)-10s | @@ -3239,13 +3249,13 @@ def create_question(self, help_text=True): data_to_format['conflict_switch'] = self.color_for_value(key,self.inconsistent_keys[key], consistency=False) if hidden_line: - f2 = re.sub('%(\((?:name|descrip|add_info)\)-?)(\d+)s', + f2 = re.sub(r'%(\((?:name|descrip|add_info)\)-?)(\d+)s', lambda x: '%%%s%ds' % (x.group(1),int(x.group(2))+9), f2) text.append(f2 % data_to_format) elif hidden_line: if not f3: - f3 = re.sub('%(\((?:name|descrip|add_info)\)-?)(\d+)s', + f3 = re.sub(r'%(\((?:name|descrip|add_info)\)-?)(\d+)s', lambda x: '%%%s%ds' % (x.group(1),int(x.group(2))+9), f1) text.append(f3 % data_to_format) diff --git a/epochX/cudacpp/pp_tt012j.mad/bin/internal/file_writers.py b/epochX/cudacpp/pp_tt012j.mad/bin/internal/file_writers.py index 41bff05276..526756129f 100755 --- a/epochX/cudacpp/pp_tt012j.mad/bin/internal/file_writers.py +++ b/epochX/cudacpp/pp_tt012j.mad/bin/internal/file_writers.py @@ -36,10 +36,10 @@ class FileWriter(io.FileIO): supported_preprocessor_commands = ['if'] preprocessor_command_re=re.compile( - "\s*(?P%s)\s*\(\s*(?P.*)\s*\)\s*{\s*"\ + r"\s*(?P%s)\s*\(\s*(?P.*)\s*\)\s*{\s*"\ %('|'.join(supported_preprocessor_commands))) preprocessor_endif_re=re.compile(\ - "\s*}\s*(?Pelse)?\s*(\((?P.*)\))?\s*(?P{)?\s*") + r"\s*}\s*(?Pelse)?\s*(\((?P.*)\))?\s*(?P{)?\s*") class FileWriterError(IOError): """Exception raised if an error occurs in the definition @@ -191,15 +191,15 @@ class FortranWriterError(FileWriter.FileWriterError): pass # Parameters defining the output of the Fortran writer - keyword_pairs = {'^if.+then\s*$': ('^endif', 2), - '^type(?!\s*\()\s*.+\s*$': ('^endtype', 2), - '^do(?!\s+\d+)\s+': ('^enddo\s*$', 2), - '^subroutine': ('^end\s*$', 0), - '^module': ('^end\s*$', 0), - 'function': ('^end\s*$', 0)} - single_indents = {'^else\s*$':-2, - '^else\s*if.+then\s*$':-2} - number_re = re.compile('^(?P\d+)\s+(?P.*)') + keyword_pairs = {r'^if.+then\s*$': ('^endif', 2), + r'^type(?!\s*\()\s*.+\s*$': ('^endtype', 2), + r'^do(?!\s+\d+)\s+': (r'^enddo\s*$', 2), + '^subroutine': (r'^end\s*$', 0), + '^module': (r'^end\s*$', 0), + 'function': (r'^end\s*$', 0)} + single_indents = {r'^else\s*$':-2, + r'^else\s*if.+then\s*$':-2} + number_re = re.compile(r'^(?P\d+)\s+(?P.*)') line_cont_char = '$' comment_char = 'c' uniformcase = True #force everyting to be lower/upper case @@ -212,7 +212,7 @@ class FortranWriterError(FileWriter.FileWriterError): # Private variables __indent = 0 __keyword_list = [] - __comment_pattern = re.compile(r"^(\s*#|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|!)", re.IGNORECASE) + __comment_pattern = re.compile(r"^(\s*#|c\$|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|\s*!|!\$)", re.IGNORECASE) __continuation_line = re.compile(r"(?: )[$&]") def write_line(self, line): @@ -424,26 +424,20 @@ def count_number_of_quotes(self, line): i = i + 1 return len(splitline)-1 - def remove_routine(self, text, fct_names, formatting=True): - """write the incoming text but fully removing the associate routine/function - text can be a path to a file, an iterator, a string - fct_names should be a list of functions to remove + @staticmethod + def get_routine(text, fct_names, call_back=None): + """ + get the fortran function from a fortran file """ - f77_type = ['real*8', 'integer', 'double precision', 'logical'] - pattern = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I) - + + if isinstance(text, str): + text = text.split('\n') + + to_write=False removed = [] - if isinstance(text, str): - if '\n' in text: - text = text.split('\n') - else: - text = open(text) - if isinstance(fct_names, str): - fct_names = [fct_names] - - to_write=True for line in text: fct = pattern.findall(line) if fct: @@ -451,22 +445,38 @@ def remove_routine(self, text, fct_names, formatting=True): to_write = False else: to_write = True - if to_write: - if formatting: - if line.endswith('\n'): - line = line[:-1] - self.writelines(line) - else: - if not line.endswith('\n'): - line = '%s\n' % line - super(FileWriter,self).writelines(line) + if call_back: + call_back(line) else: removed.append(line) - + return removed + + def remove_routine(self, text, fct_names, formatting=True): + """write the incoming text but fully removing the associate routine/function + text can be a path to a file, an iterator, a string + fct_names should be a list of functions to remove + """ + + def call_back(line): + if formatting: + if line.endswith('\n'): + line = line[:-1] + self.writelines(line) + else: + if not line.endswith('\n'): + line = '%s\n' % line + super(FileWriter,self).writelines(line) + + return self.get_routine(text, fct_names, call_back) + +class FortranWriter90(FortranWriter): + + comment_char = ' !' + #=============================================================================== # CPPWriter #=============================================================================== @@ -497,50 +507,50 @@ class CPPWriterError(FileWriter.FileWriterError): '^private': standard_indent, '^protected': standard_indent} - spacing_patterns = [ - ('\s*\"\s*}', '\"'), - ('\s*,\s*', ', '), - ('\s*-\s*', ' - '), - ('([{(,=])\s*-\s*', '\g<1> -'), - ('(return)\s*-\s*', '\g<1> -'), - ('\s*\+\s*', ' + '), - ('([{(,=])\s*\+\s*', '\g<1> +'), - ('\(\s*', '('), - ('\s*\)', ')'), - ('\{\s*', '{'), - ('\s*\}', '}'), - ('\s*=\s*', ' = '), - ('\s*>\s*', ' > '), - ('\s*<\s*', ' < '), - ('\s*!\s*', ' !'), - ('\s*/\s*', '/'), - ('(?\s+>\s*', ' >> '), - ('<\s*double\s*>>\s*', ' > '), - ('\s*<\s+<\s*', ' << '), - ('\s*-\s+>\s*', '->'), - ('\s*=\s+=\s*', ' == '), - ('\s*!\s+=\s*', ' != '), - ('\s*>\s+=\s*', ' >= '), - ('\s*<\s+=\s*', ' <= '), - ('\s*&&\s*', ' && '), - ('\s*\|\|\s*', ' || '), - ('\s*{\s*}', ' {}'), - ('\s*;\s*', '; '), - (';\s*\}', ';}'), - (';\s*$}', ';'), - ('\s*<\s*([a-zA-Z0-9]+?)\s*>', '<\g<1>>'), - ('^#include\s*<\s*(.*?)\s*>', '#include <\g<1>>'), - ('(\d+\.{0,1}\d*|\.\d+)\s*[eE]\s*([+-]{0,1})\s*(\d+)', - '\g<1>e\g<2>\g<3>'), - ('\s+',' '), - ('^\s*#','#')] + spacing_patterns = [(r'\s*\"\s*}', '\"'), + (r'\s*,\s*', ', '), + (r'\s*-\s*', ' - '), + (r'([{(,=])\s*-\s*', r'\g<1> -'), + (r'(return)\s*-\s*', r'\g<1> -'), + (r'\s*\+\s*', ' + '), + (r'([{(,=])\s*\+\s*', r'\g<1> +'), + (r'\(\s*', '('), + (r'\s*\)', ')'), + (r'\{\s*', '{'), + (r'\s*\}', '}'), + (r'\s*=\s*', ' = '), + (r'\s*>\s*', ' > '), + (r'\s*<\s*', ' < '), + (r'\s*!\s*', ' !'), + (r'\s*/\s*', '/'), + (r'\s*\*\s*', ' * '), + (r'\s*-\s+-\s*', '-- '), + (r'\s*\+\s+\+\s*', '++ '), + (r'\s*-\s+=\s*', ' -= '), + (r'\s*\+\s+=\s*', ' += '), + (r'\s*\*\s+=\s*', ' *= '), + (r'\s*/=\s*', ' /= '), + (r'\s*>\s+>\s*', ' >> '), + (r'<\s*double\s*>>\s*', ' > '), + (r'\s*<\s+<\s*', ' << '), + (r'\s*-\s+>\s*', '->'), + (r'\s*=\s+=\s*', ' == '), + (r'\s*!\s+=\s*', ' != '), + (r'\s*>\s+=\s*', ' >= '), + (r'\s*<\s+=\s*', ' <= '), + (r'\s*&&\s*', ' && '), + (r'\s*\|\|\s*', ' || '), + (r'\s*{\s*}', ' {}'), + (r'\s*;\s*', '; '), + (r';\s*\}', ';}'), + (r';\s*$}', ';'), + (r'\s*<\s*([a-zA-Z0-9]+?)\s*>', r'<\g<1>>'), + (r'^#include\s*<\s*(.*?)\s*>', r'#include <\g<1>>'), + (r'(\d+\.{0,1}\d*|\.\d+)\s*[eE]\s*([+-]{0,1})\s*(\d+)', + r'\g<1>e\g<2>\g<3>'), + (r'\s+',' '), + (r'^\s*#','#')] + spacing_re = dict([(key[0], re.compile(key[0])) for key in \ spacing_patterns]) diff --git a/epochX/cudacpp/pp_tt012j.mad/bin/internal/gen_crossxhtml.py b/epochX/cudacpp/pp_tt012j.mad/bin/internal/gen_crossxhtml.py index d58ec573bc..681bf9d09b 100755 --- a/epochX/cudacpp/pp_tt012j.mad/bin/internal/gen_crossxhtml.py +++ b/epochX/cudacpp/pp_tt012j.mad/bin/internal/gen_crossxhtml.py @@ -648,7 +648,7 @@ def recreate(self, banner): if run_card['ickkw'] != 0: #parse the file to have back the information pythia_log = misc.BackRead(pjoin(path, '%s_pythia.log' % tag)) - pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") + pythiare = re.compile(r"\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") for line in pythia_log: info = pythiare.search(line) if not info: @@ -1623,7 +1623,7 @@ def get_html(self, runresults): elif self.debug: text = str(self.debug).replace('. ','.
') if 'http' in text: - pat = re.compile('(http[\S]*)') + pat = re.compile(r'(http[\S]*)') text = pat.sub(r' here ', text) debug = '
%s
%s
' % \ (self.debug.__class__.__name__, text) diff --git a/epochX/cudacpp/pp_tt012j.mad/bin/internal/gen_ximprove.py b/epochX/cudacpp/pp_tt012j.mad/bin/internal/gen_ximprove.py index c86da36a05..415ecc9de0 100755 --- a/epochX/cudacpp/pp_tt012j.mad/bin/internal/gen_ximprove.py +++ b/epochX/cudacpp/pp_tt012j.mad/bin/internal/gen_ximprove.py @@ -158,8 +158,11 @@ def get_helicity(self, to_submit=True, clean=True): (stdout, _) = p.communicate(''.encode()) stdout = stdout.decode('ascii',errors='ignore') if stdout: - nb_channel = max([math.floor(float(d)) for d in stdout.split()]) + lines = stdout.strip().split('\n') + nb_channel = max([math.floor(float(d)) for d in lines[-1].split()]) else: + if os.path.exists(pjoin(self.me_dir, 'error')): + os.remove(pjoin(self.me_dir, 'error')) for matrix_file in misc.glob('matrix*orig.f', Pdir): files.cp(matrix_file, matrix_file.replace('orig','optim')) P_zero_result.append(Pdir) @@ -297,12 +300,14 @@ def get_helicity(self, to_submit=True, clean=True): bad_amps_perhel = [] if __debug__: mtext = open(matrix_file).read() - nb_amp = int(re.findall('PARAMETER \(NGRAPHS=(\d+)\)', mtext)[0]) - logger.debug('nb_hel: %s zero amp: %s bad_amps_hel: %s/%s', len(good_hels),len(bad_amps),len(bad_amps_perhel), len(good_hels)*nb_amp ) + nb_amp = int(re.findall(r'PARAMETER \(NGRAPHS=(\d+)\)', mtext)[0]) + logger.debug('(%s) nb_hel: %s zero amp: %s bad_amps_hel: %s/%s', split_file[-1], len(good_hels),len(bad_amps),len(bad_amps_perhel), len(good_hels)*nb_amp ) if len(good_hels) == 1: files.cp(matrix_file, matrix_file.replace('orig','optim')) continue # avoid optimization if onlye one helicity - recycler = hel_recycle.HelicityRecycler(good_hels, bad_amps, bad_amps_perhel) + + gauge = self.cmd.proc_characteristics['gauge'] + recycler = hel_recycle.HelicityRecycler(good_hels, bad_amps, bad_amps_perhel, gauge=gauge) # In case of bugs you can play around with these: recycler.hel_filt = self.run_card['hel_filtering'] recycler.amp_splt = self.run_card['hel_splitamp'] @@ -1299,7 +1304,7 @@ def get_job_for_event(self): 'script_name': 'unknown', 'directory': C.name, # need to be change for splitted job 'P_dir': C.parent_name, - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # needed for RO gridpack 'offset': 1, # need to be change for splitted job 'nevents': nevents, 'maxiter': self.max_iter, @@ -1387,7 +1392,7 @@ def create_ajob(self, template, jobs, write_dir=None): break info = jobs[j] info['script_name'] = 'ajob%i' % script_number - info['keeplog'] = 'false' + info['keeplog'] = 'false' if self.run_card['keep_log'] != 'debug' else 'true' if "base_directory" not in info: info["base_directory"] = "./" fsock.write(template_text % info) @@ -1456,7 +1461,7 @@ def get_job_for_precision(self): 'script_name': 'unknown', 'directory': C.name, # need to be change for splitted job 'P_dir': C.parent_name, - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # used for RO gridpack 'offset': 1, # need to be change for splitted job 'nevents': nevents, 'maxiter': self.max_iter, @@ -1916,7 +1921,7 @@ def get_job_for_event(self): 'directory': C.name, # need to be change for splitted job 'P_dir': os.path.basename(C.parent_name), 'offset': 1, # need to be change for splitted job - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # use for RO gridpack 'nevents': nevents, #int(nevents*self.gen_events_security)+1, 'maxiter': self.max_iter, 'miniter': self.min_iter, diff --git a/epochX/cudacpp/pp_tt012j.mad/bin/internal/hel_recycle.py b/epochX/cudacpp/pp_tt012j.mad/bin/internal/hel_recycle.py index dfa45d5d20..6c86611f68 100755 --- a/epochX/cudacpp/pp_tt012j.mad/bin/internal/hel_recycle.py +++ b/epochX/cudacpp/pp_tt012j.mad/bin/internal/hel_recycle.py @@ -383,7 +383,7 @@ def get_number(cls, *args): class HelicityRecycler(): '''Class for recycling helicity''' - def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[]): + def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[], gauge='U'): External.good_hel = [] External.nhel_lines = '' @@ -427,6 +427,7 @@ def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[]): self.all_hel = [] self.hel_filt = True + self.gauge = gauge def set_input(self, file): if 'born_matrix' in file: @@ -612,7 +613,7 @@ def unfold_helicities(self, line, nature): def apply_amps(self, line, new_objs): if self.amp_splt: - return split_amps(line, new_objs) + return split_amps(line, new_objs, gauge=self.gauge) else: return apply_args(line, [i.args for i in new_objs]) @@ -785,7 +786,7 @@ def apply_args(old_line, all_the_args): return ''.join(new_lines) -def split_amps(line, new_amps): +def split_amps(line, new_amps, gauge): if not new_amps: return '' fct = line.split('(',1)[0].split('_0')[0] @@ -841,34 +842,31 @@ def split_amps(line, new_amps): spin = fct.split(None,1)[1][to_remove] lines.append('%sP1N_%s(%s)' % (fct, to_remove+1, ', '.join(args))) - hel, iamp = re.findall('AMP\((\d+),(\d+)\)', amp_result)[0] + hel, iamp = re.findall(r'AMP\((\d+),(\d+)\)', amp_result)[0] hel_calculated.append(hel) #lines.append(' %(result)s = TMP(3) * W(3,%(w)s) + TMP(4) * W(4,%(w)s)+' # % {'result': amp_result, 'w': windex}) #lines.append(' & TMP(5) * W(5,%(w)s)+TMP(6) * W(6,%(w)s)' # % {'result': amp_result, 'w': windex}) - if spin in "VF": - lines.append(""" call CombineAmp(%(nb)i, - & (/%(hel_list)s/), - & (/%(w_list)s/), - & TMP, W, AMP(1,%(iamp)s))""" % - {'nb': len(sub_amps), - 'hel_list': ','.join(hel_calculated), - 'w_list': ','.join(windices), - 'iamp': iamp - }) + if spin == "F" or ( spin == "V" and gauge !='FD'): + suffix = '' elif spin == "S": - lines.append(""" call CombineAmpS(%(nb)i, - &(/%(hel_list)s/), - & (/%(w_list)s/), - & TMP, W, AMP(1,%(iamp)s))""" % - {'nb': len(sub_amps), - 'hel_list': ','.join(hel_calculated), - 'w_list': ','.join(windices), - 'iamp': iamp - }) + suffix = 'S' + elif spin == "V" and gauge == "FD": + suffix = "FD" else: - raise Exception("split amp are not supported for spin2 and 3/2") + raise Exception("split amp not supported for spin2, 3/2") + + lines.append(""" call CombineAmp%(suffix)s(%(nb)i, + & (/%(hel_list)s/), + & (/%(w_list)s/), + & TMP, W, AMP(1,%(iamp)s))""" % {'suffix':suffix, + 'nb': len(sub_amps), + 'hel_list': ','.join(hel_calculated), + 'w_list': ','.join(windices), + 'iamp': iamp + }) + #lines.append('') return '\n'.join(lines) diff --git a/epochX/cudacpp/pp_tt012j.mad/bin/internal/histograms.py b/epochX/cudacpp/pp_tt012j.mad/bin/internal/histograms.py index 98f22c4c3a..9931127f66 100755 --- a/epochX/cudacpp/pp_tt012j.mad/bin/internal/histograms.py +++ b/epochX/cudacpp/pp_tt012j.mad/bin/internal/histograms.py @@ -632,34 +632,34 @@ class HwU(Histogram): # than necessary because the HwU standard allows for spaces from within # the name of a weight weight_header_re = re.compile( - '&\s*(?P(\S|(\s(?!\s*(&|$))))+)(\s(?!(&|$)))*') + r'&\s*(?P(\S|(\s(?!\s*(&|$))))+)(\s(?!(&|$)))*') # ================================ # Histo weight specification RE's # ================================ # The start of a plot - histo_start_re = re.compile('^\s*\s*(?P\d+)\s*"\s*'+ - '(?P(\S|(\s(?!\s*")))+)\s*"\s*$') + histo_start_re = re.compile(r'^\s*\s*(?P\d+)\s*"\s*'+ + r'(?P(\S|(\s(?!\s*")))+)\s*"\s*$') # A given weight specifier - a_float_re = '[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' - histo_bin_weight_re = re.compile('(?P%s|NaN)'%a_float_re,re.IGNORECASE) - a_int_re = '[\+|-]?\d+' + a_float_re = r'[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' + histo_bin_weight_re = re.compile(r'(?P%s|NaN)'%a_float_re,re.IGNORECASE) + a_int_re = r'[\+|-]?\d+' # The end of a plot histo_end_re = re.compile(r'^\s*<\\histogram>\s*$') # A scale type of weight - weight_label_scale = re.compile('^\s*mur\s*=\s*(?P%s)'%a_float_re+\ - '\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) - weight_label_PDF = re.compile('^\s*PDF\s*=\s*(?P\d+)\s*$') - weight_label_PDF_XML = re.compile('^\s*pdfset\s*=\s*(?P\d+)\s*$') - weight_label_TMS = re.compile('^\s*TMS\s*=\s*(?P%s)\s*$'%a_float_re) - weight_label_alpsfact = re.compile('^\s*alpsfact\s*=\s*(?P%s)\s*$'%a_float_re, + weight_label_scale = re.compile(r'^\s*mur\s*=\s*(?P%s)'%a_float_re+\ + r'\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) + weight_label_PDF = re.compile(r'^\s*PDF\s*=\s*(?P\d+)\s*$') + weight_label_PDF_XML = re.compile(r'^\s*pdfset\s*=\s*(?P\d+)\s*$') + weight_label_TMS = re.compile(r'^\s*TMS\s*=\s*(?P%s)\s*$'%a_float_re) + weight_label_alpsfact = re.compile(r'^\s*alpsfact\s*=\s*(?P%s)\s*$'%a_float_re, re.IGNORECASE) - weight_label_scale_adv = re.compile('^\s*dyn\s*=\s*(?P%s)'%a_int_re+\ - '\s*mur\s*=\s*(?P%s)'%a_float_re+\ - '\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) - weight_label_PDF_adv = re.compile('^\s*PDF\s*=\s*(?P\d+)\s+(?P\S+)\s*$') + weight_label_scale_adv = re.compile(r'^\s*dyn\s*=\s*(?P%s)'%a_int_re+\ + r'\s*mur\s*=\s*(?P%s)'%a_float_re+\ + r'\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) + weight_label_PDF_adv = re.compile(r'^\s*PDF\s*=\s*(?P\d+)\s+(?P\S+)\s*$') class ParseError(MadGraph5Error): @@ -926,7 +926,7 @@ def get_HwU_source(self, print_header=True): res.append(' '.join('%+16.7e'%wgt for wgt in list(bin.boundaries))) res[-1] += ' '.join('%+16.7e'%bin.wgts[key] for key in self.bins.weight_labels if key not in ['central','stat_error']) - res.append('<\histogram>') + res.append(r'<\histogram>') return res def output(self, path=None, format='HwU', print_header=True): @@ -1149,6 +1149,8 @@ def parse_one_histo_from_stream(self, stream, all_weight_header, boundaries = [0.0,0.0] for j, weight in \ enumerate(HwU.histo_bin_weight_re.finditer(line_bin)): + if (j == len(weight_header)): + continue if j == len(all_weight_header): raise HwU.ParseError("There is more bin weights"+\ " specified than expected (%i)"%len(weight_header)) @@ -1803,7 +1805,7 @@ def parse_histos_from_PY8_XML_stream(self, stream, run_id=None, # Filter empty weights coming from the split weight_label_list = [wgt.strip() for wgt in str(selected_run_node.getAttribute('header')).split(';') if - not re.match('^\s*$',wgt)] + not re.match(r'^\s*$',wgt)] ordered_weight_label_list = [w for w in weight_label_list if w not\ in ['xmin','xmax']] # Remove potential repetition of identical weight labels @@ -1827,7 +1829,7 @@ def parse_histos_from_PY8_XML_stream(self, stream, run_id=None, all_weights = [] for wgt_position, wgt_label in \ enumerate(str(selected_run_node.getAttribute('header')).split(';')): - if not re.match('^\s*$',wgt_label) is None: + if not re.match(r'^\s*$',wgt_label) is None: continue all_weights.append({'POSITION':wgt_position}) for wgt_item in wgt_label.strip().split('_'): @@ -2714,7 +2716,7 @@ def ratio_no_correlations(wgtsA, wgtsB): # First the global gnuplot header for this histogram group global_header =\ -""" +r""" ################################################################################ ### Rendering of the plot titled '%(title)s' ################################################################################ @@ -2862,9 +2864,9 @@ def ratio_no_correlations(wgtsA, wgtsB): major_title = ', '.join(major_title) if not mu[0] in ['none',None]: - major_title += ', dynamical\_scale\_choice=%s'%mu[0] + major_title += r', dynamical\_scale\_choice=%s'%mu[0] if not pdf[0] in ['none',None]: - major_title += ', PDF=%s'%pdf[0].replace('_','\_') + major_title += ', PDF=%s'%pdf[0].replace('_',r'\_') # Do not show uncertainties for individual jet samples (unless first # or specified explicitely and uniquely) @@ -2937,7 +2939,7 @@ def ratio_no_correlations(wgtsA, wgtsB): plot_lines.append( "'%s' index %d using (($1+$2)/2):%d ls %d title '%s'"\ %(HwU_name,block_position+i,mu_var+3,color_index,\ -'%s dynamical\_scale\_choice=%s' % (title,mu[j]))) +r'%s dynamical\_scale\_choice=%s' % (title,mu[j]))) # And now PDF_variation if available if not PDF_var_pos is None: for j,PDF_var in enumerate(PDF_var_pos): @@ -2947,7 +2949,7 @@ def ratio_no_correlations(wgtsA, wgtsB): plot_lines.append( "'%s' index %d using (($1+$2)/2):%d ls %d title '%s'"\ %(HwU_name,block_position+i,PDF_var+3,color_index,\ -'%s PDF=%s' % (title,pdf[j].replace('_','\_')))) +'%s PDF=%s' % (title,pdf[j].replace('_',r'\_')))) # Now add the uncertainty lines, those not using a band so that they # are not covered by those using a band after we reverse plo_lines diff --git a/epochX/cudacpp/pp_tt012j.mad/bin/internal/launch_plugin.py b/epochX/cudacpp/pp_tt012j.mad/bin/internal/launch_plugin.py index 7b10bedcef..9ec09eb71d 100644 --- a/epochX/cudacpp/pp_tt012j.mad/bin/internal/launch_plugin.py +++ b/epochX/cudacpp/pp_tt012j.mad/bin/internal/launch_plugin.py @@ -98,6 +98,7 @@ def default_setup(self): self['vector_size'] = 16 # already setup in default class (just change value) self['aloha_flag'] = '--fast-math' self['matrix_flag'] = '-O3' + self['limhel'] = 0 self.display_block.append('simd') self.display_block.append('psoptim') 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 eee9ba4522..f6e47956cd 100755 --- a/epochX/cudacpp/pp_tt012j.mad/bin/internal/lhe_parser.py +++ b/epochX/cudacpp/pp_tt012j.mad/bin/internal/lhe_parser.py @@ -7,6 +7,7 @@ import numbers import math import time +import copy import os import shutil import sys @@ -101,7 +102,7 @@ def __init__(self, line=None, event=None): self.rwgt = 0 return - + self.event = event if event is not None: self.event_id = len(event) #not yet in the event @@ -1066,6 +1067,8 @@ def define_init_banner(self, wgt, lha_strategy, proc_charac=None): #special case for 1>N init_information = run_card.get_banner_init_information() event = next(self) + if not len(event): #if parse-momenta was false we have to parse the first event + event = Event(str(event)) init_information["idbmup1"] = event[0].pdg init_information["ebmup1"] = event[0].mass init_information["idbmup2"] = 0 @@ -1149,6 +1152,7 @@ def initialize_unweighting(self, getwgt, trunc_error): nb_keep = max(20, int(nb_event*trunc_error*15)) new_wgt = new_wgt[-nb_keep:] if nb_event == 0: + misc.sprint(i,f) raise Exception # store the information self.initial_nb_events[i] = nb_event @@ -1203,7 +1207,6 @@ def unweight(self, outputpath, get_wgt, **opts): (stop to write event when target is reached) """ - if isinstance(get_wgt, (str,six.text_type)): unwgt_name =get_wgt def get_wgt_multi(event): @@ -1483,12 +1486,12 @@ def reorder_mother_child(self): particle.mother2 -= 1 # re-call the function for the next potential change return self.reorder_mother_child() - - - - - + + + + + def parse_reweight(self): """Parse the re-weight information in order to return a dictionary {key: value}. If no group is define group should be '' """ @@ -1522,6 +1525,37 @@ def parse_nlo_weight(self, real_type=(1,11), threshold=None): threshold=threshold) return self.nloweight + def get_fks_pair(self, real_type=(1,11), threshold=None): + """ Gives the fks pair labels""" + start, stop = self.tag.find(''), self.tag.find('') + if start != -1 != stop: + text = self.tag[start+8:stop] + all_line = text.split('\n') + text = text.lower().replace('d','e') + all_line = text.split('\n') + for line in all_line: + data = line.split() + if len(data)>16: + wgt = OneNLOWeight(line, real_type=real_type) + return wgt.to_merge_pdg,wgt.nexternal + + def get_born_momenta(self,real_type=(1,11), threshold=None): + """ Gets the underlying n+1 body kinematics""" + start, stop = self.tag.find(''), self.tag.find('') + if start != -1 != stop: + text = self.tag[start+8:stop] + text = text.lower().replace('d','e') + all_line = text.split('\n') + for line in all_line: + data = line.split() + if len(data)>16: + wgt = OneNLOWeight(line, real_type=real_type) + nexternal = wgt.nexternal + real_momenta = all_line[2:2+nexternal] + return real_momenta + + + def rewrite_nlo_weight(self, wgt=None): """get the string associate to the weight""" @@ -1558,11 +1592,11 @@ def parse_lo_weight(self): return self.loweight if not hasattr(Event, 'loweight_pattern'): - Event.loweight_pattern = re.compile('''\s*(?P\d+)\s+(?P[\d.e+-]+)\s*\s*\n\s* - \s*(?P[\s\d.+-e]+)\s*\s*\n\s* - 1|2)["']?\>\s*(?P[\s\d.e+-]*)\s*\s*\n\s* - 1|2)["']?\>\s*(?P[\s\d.e+-]*)\s*\s*\n\s* - \s*(?P[\d.e+-]*)\s* + Event.loweight_pattern = re.compile('''\\s*(?P\\d+)\\s+(?P[\\d.e+-]+)\\s*\\s*\n\\s* + \\s*(?P[\\s\\d.+-e]+)\\s*\\s*\n\\s* + 1|2)["']?\\>\\s*(?P[\\s\\d.e+-]*)\\s*\\s*\n\\s* + 1|2)["']?\\>\\s*(?P[\\s\\d.e+-]*)\\s*\\s*\n\\s* + \\s*(?P[\\d.e+-]*)\\s* ''',re.X+re.I+re.M) start, stop = self.tag.find(''), self.tag.find('') @@ -1615,7 +1649,7 @@ def parse_matching_scale(self): self.matched_scale_data = [] - pattern = re.compile("") + pattern = re.compile(r"") data = re.split(pattern,self.tag) if len(data) == 1: return [] @@ -1623,7 +1657,7 @@ def parse_matching_scale(self): tmp = {} start,content, end = data self.tag = "%s%s" % (start, end) - pattern = re.compile("pt_clust_(\d*)=\"([\de+-.]*)\"") + pattern = re.compile("pt_clust_(\\d*)=\"([\\de+-.]*)\"") for id,value in pattern.findall(content): tmp[int(id)] = float(value) for i in range(1, len(self)+1): @@ -1647,7 +1681,7 @@ def parse_syscalc_info(self): return self.syscalc_data pattern = re.compile("|") - pattern2 = re.compile("<(?P[\w]*)(?:\s*(\w*)=[\"'](.*)[\"']\s*|\s*)>(.*)") + pattern2 = re.compile("<(?P[\\w]*)(?:\\s*(\\w*)=[\"'](.*)[\"']\\s*|\\s*)>(.*)") data = re.split(pattern,self.tag) if len(data) == 1: return [] @@ -1850,6 +1884,240 @@ def get_decay(self, pdg_code=0, event_id=None): return new_event + + def set_initial_mass_to_zero(self): + """set the masses of the initial particles to zero, by reshuffling the respective momenta + Works only in the **partonic** com frame, so the event must be boosted to such frame + before calling the function + """ + + if not misc.equal(self[0].px, 0) or not misc.equal(self[1].px, 0) or \ + not misc.equal(self[0].py, 0) or not misc.equal(self[1].py, 0) or \ + not misc.equal(self[0].pz, - self[1].pz, zero_limit=False): + misc.sprint(self[0]) + misc.sprint(self[1]) + raise Exception('momenta should be in the partonic center of mass frame') + + self[0].mass = 0. + self[1].mass = 0. + tot_E=0. + for ip,part in enumerate(self): + if part.status == 1 : + tot_E += part.E + if (self[0].pz > 0. and self[1].pz < 0): + self[0].set_momentum(FourMomentum([tot_E/2., 0., 0., tot_E/2.])) + self[1].set_momentum(FourMomentum([tot_E/2., 0., 0., -tot_E/2.])) + elif (self[0].pz < 0. and self[1].pz > 0): + self[0].set_momentum(FourMomentum([tot_E/2., 0., 0., -tot_E/2.])) + self[1].set_momentum(FourMomentum([tot_E/2., 0., 0., tot_E/2.])) + else: + logger.critical('ERROR: two incoming partons not back.-to-back') + + def set_final_jet_mass_to_zero(self): + """set the final light particle masses to zero + """ + + for ip,part in enumerate(self): + if ((abs(part.pid) <= 5) or (abs(part.pid) == 11) or (abs(part.pid) == 12)) and (part.status == 1): + part.mass = 0. + E_1_new = math.sqrt(part.mass**2 + part.px**2 + part.py**2 + part.pz**2) + part.set_momentum(FourMomentum([E_1_new, part.px, part.py, part.pz])) + + + + def merge_particles_kinematics(self, i,j, moth): + """Map to an underlying n-body kinematics for two given + particles i,j to be merged and a resulting moth""" + """ note! kinematics (and id) mapping only! """ + + recoil = True + fks_type = False + + if recoil and not fks_type: + if (i == moth[0].get('number')-1): + fks_i = i + fks_j = j + elif (j == moth[0].get('number')-1): + fks_i = j + fks_j = i + to_remove = fks_j + + merge_i = self[fks_i] + merge_j = self[fks_j] + + i_4mom = FourMomentum(merge_i) + j_4mom = FourMomentum(merge_j) + if (fks_i <= 1): + sign1 = -1.0 + else: + sign1 = 1.0 + mother_4mom = i_4mom + sign1*j_4mom + + new_event = copy.deepcopy(self) + + self[fks_i].pid = moth[0]['id'] + self[fks_i].set_momentum(mother_4mom) + + if fks_i <= 1: # initial-state recoil + new_p = FourMomentum() + for ip,part in enumerate(self): + if (ip != fks_i and ip != fks_j and ip >= 2): + new_p += part + + if fks_i == 0: + self[1].set_momentum(new_p - FourMomentum(self[0])) + elif fks_i == 1: + self[0].set_momentum(new_p - FourMomentum(self[1])) + + pz_1_new = self.recoil_eq(self[0],self[1]) + pz_2_new = self[0].pz + self[1].pz - pz_1_new + E_1_new = math.sqrt(self[0].mass**2 + self[0].px**2 + self[0].py**2 + pz_1_new **2) + E_2_new = math.sqrt(self[1].mass**2 + self[1].px**2 + self[1].py**2 + pz_2_new **2) + self[0].set_momentum(FourMomentum([E_1_new,self[0].px,self[0].py,pz_1_new])) + self[1].set_momentum(FourMomentum([E_2_new,self[1].px,self[1].py,pz_2_new])) + self.pop(to_remove) + + if fks_i > 1: # final-state recoil + + # Re-scale the energy of fks_i to make it on-shell + for ip,part in enumerate(self): + if (ip == fks_i): + part.E = math.sqrt(part.mass**2 + part.px**2 + part.py**2 + part.pz**2) + new_p.E = part.E + + # Find the overall energy in the final state + new_p.E = 0.0 + for ip,part in enumerate(self): + if (ip != fks_j and ip >= 2): + new_p.E += part.E + + # Use one of the initial states to absorb the energy change in the final state + self[1].set_momentum(FourMomentum([new_p.E-self[0].E,self[1].px,self[1].py,self[1].pz])) + + # Change the initial state pz and E + pz_1_new = self.recoil_eq(self[0],self[1]) + pz_2_new = self[0].pz + self[1].pz - pz_1_new + E_1_new = math.sqrt(self[0].mass**2 + self[0].px**2 + self[0].py**2 + pz_1_new **2) + E_2_new = math.sqrt(self[1].mass**2 + self[1].px**2 + self[1].py**2 + pz_2_new **2) + self[0].set_momentum(FourMomentum([E_1_new,self[0].px,self[0].py,pz_1_new])) + self[1].set_momentum(FourMomentum([E_2_new,self[1].px,self[1].py,pz_2_new])) + self.pop(to_remove) + + elif fks_type and not recoil: + ## Do it in a more FKS-style + if (i == moth[0].get('number')-1): + fks_i = i + fks_j = j + elif (j == moth[0].get('number')-1): + fks_i = j + fks_j = i + to_remove = fks_j + new_event = copy.copy(event) + + if fks_i <= 1: # initial-state recoil + + # First boost to partonic CM frame + q = FourMomentum(self[0])+FourMomentum(self[1]) + for ip,part in enumerate(self): + vec = FourMomentum(part) + self[ip].set_momentum(vec.zboost(pboost=q)) + + k_tot = FourMomentum([self[0].E+self[1].E-self[fks_j].E,self[0].px+self[1].px-self[fks_j].px,\ + self[0].py+self[1].py-self[fks_j].py,self[0].pz+self[1].pz-self[fks_j].pz]) + + final = FourMomentum([0,0,0,0]) + for ip,part in enumerate(self): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + if (ip != fks_i and ip != fks_j and ip >= 2): + final = final + vec + + s = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz])**2 + ksi = self[fks_j].E/(math.sqrt(s)/2.0) + y = self[fks_j].pz/self[fks_j].E + + self[0].pz = self[0].pz * math.sqrt(1.0-ksi)*math.sqrt((2.0-ksi*(1.0+y))/((2.0-ksi*(1.0-y)))) + self[0].E = math.sqrt(self[0].mass**2 + self[0].pz**2) + self[1].pz = self[1].pz * math.sqrt(1.0-ksi)*math.sqrt((2.0-ksi*(1.0-y))/((2.0-ksi*(1.0+y)))) + self[1].E = math.sqrt(self[1].mass**2 + self[1].pz**2) + + final = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + k_tot_1 = k_tot.zboost(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + k_tot_2 = k_tot_1.pt_boost(pboost=FourMomentum([k_tot_1.E,k_tot_1.px,k_tot_1.py,k_tot_1.pz])) + k_tot_3 = k_tot_2.zboost_inv(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + + for ip,part in enumerate(self): + if (ip >= 2): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + vec2 = vec.zboost(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + vec3 = vec2.pt_boost(pboost=FourMomentum([k_tot_1.E,k_tot_1.px,k_tot_1.py,k_tot_1.pz])) + vec_new = vec3.zboost_inv(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + self[ip].set_momentum(FourMomentum([vec_new.E,vec_new.px,vec_new.py,vec_new.pz])) + + self.pop(to_remove) + + else: # final-state recoil + q = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + for ip,part in enumerate(self): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + self[ip].set_momentum(vec.zboost(pboost=q)) + + q = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + k = FourMomentum([self[fks_i].E+self[fks_j].E,self[fks_i].px+self[fks_j].px,\ + self[fks_i].py+self[fks_j].py,self[fks_i].pz+self[fks_j].pz]) + + k_rec = FourMomentum([0,0,0,0]) + for ip,part in enumerate(self): + if ip >= 2 and ip != fks_i and ip != fks_j: # add only final-states to the recoil and not the FKS pair + k_rec = k_rec + FourMomentum([part.E,part.px,part.py,part.pz]) + + k_mom = math.sqrt(k_rec.px**2 + k_rec.py**2 + k_rec.pz**2) + beta = (q**2 - (k_rec.E+k_mom)**2)/(q**2 + (k_rec.E+k_mom)**2) + for ip,part in enumerate(self): + if ip >= 2 and ip != fks_i and ip != fks_j: + vec = FourMomentum([self[ip].E,self[ip].px,self[ip].py,self[ip].pz]) + self[ip].set_momentum(vec.boost_beta(beta,k_rec)) + if ip == fks_i: + self[ip].set_momentum(q - k_rec.boost_beta(beta,k_rec)) + self.pop(to_remove) + else: + logger.info('Error in Sudakov Born mapping: no recoil scheme found!') + + def recoil_eq(self,part1, part2): + """ In general, solves the equation + E1 + E2 = K + p1 + p2 = c + E1^2 - p1^2 = a + E2^2 - p2^2 = b + and returns p1 + """ + thresh = 1e-6 + import random + a = part1.mass**2 + part1.px**2 + part1.py**2 + b = part2.mass**2 + part2.px**2 + part2.py**2 + c = part1.pz + part2.pz + K = part1.E + part2.E + K2 = K**2 + sol1 = (-a*c + b*c + c**3 - c*K2 - math.sqrt(K2*(a**2 + (b + c**2 - K2)**2 - 2*a*(b - c**2 + K2))))/(2*(c**2-K2)) + sol2 = (-a*c + b*c + c**3 - c*K2 + math.sqrt(K2*(a**2 + (b + c**2 - K2)**2 - 2*a*(b - c**2 + K2))))/(2*(c**2-K2)) + + if abs(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2) - (math.sqrt(a+sol2**2) + math.sqrt(b+(c-sol2)**2))) > thresh: + logger.critical('Error in recoil_eq solver 1') + logger.critical(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2)) + logger.critical(math.sqrt(a+sol2**2) + math.sqrt(b+(c-sol2)**2)) + if abs(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2) - K) > thresh: + logger.critical('Error in recoil_eq solver 2') + logger.critical(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2)) + logger.critical(K) + return sol1 + + def boost(self, filter=None): """modify the current event to boost it according to the current filter""" if filter is None: @@ -1861,7 +2129,7 @@ def boost(self, filter=None): if list(filter(p)): pboost += p else: - pboost = FourMomentum(pboost) + pboost = FourMomentum(filter) # change sign of three-component due to helas convention pboost.px *=-1 @@ -1877,7 +2145,7 @@ def check(self): """check various property of the events""" # check that relative error is under control - threshold = 1e-6 + threshold = 1e-4 #1. Check that the 4-momenta are conserved E, px, py, pz = 0,0,0,0 @@ -1920,7 +2188,50 @@ def check(self): self.check_color_structure() #3. check mass - + + def check_kinematics_only(self): + """check various property of the events - only kinematics""" + + # check that relative error is under control + threshold = 1e-3 + + #1. Check that the 4-momenta are conserved + E, px, py, pz = 0,0,0,0 + absE, abspx, abspy, abspz = 0,0,0,0 + for particle in self: + coeff = 1 + if particle.status == -1: + coeff = -1 + elif particle.status != 1: + continue + E += coeff * particle.E + absE += abs(particle.E) + px += coeff * particle.px + py += coeff * particle.py + pz += coeff * particle.pz + abspx += abs(particle.px) + abspy += abs(particle.py) + abspz += abs(particle.pz) + # check mass + fourmass = FourMomentum(particle).mass + + if particle.mass and (abs(particle.mass) - fourmass)/ abs(particle.mass) > threshold: + logger.critical(self) + raise Exception( "Do not have correct mass lhe: %s momentum: %s (error at %s" % (particle.mass, fourmass, (abs(particle.mass) - fourmass)/ abs(particle.mass))) + + if abs(E/absE) > threshold: + logger.critical(self) + raise Exception("Do not conserve Energy %s, %s" % (E/absE, E)) + if abs(px/abspx) > threshold: + logger.critical(self) + raise Exception("Do not conserve Px %s, %s" % (px/abspx, px)) + if abs(py/abspy) > threshold: + logger.critical(self) + raise Exception("Do not conserve Py %s, %s" % (py/abspy, py)) + if abs(pz/abspz) > threshold: + logger.critical(self) + raise Exception("Do not conserve Pz %s, %s" % (pz/abspz, pz)) + def assign_scale_line(self, line, convert=True): """read the line corresponding to global event line @@ -2764,7 +3075,7 @@ def zboost(self, pboost=None, E=0, pz=0): if isinstance(pboost, FourMomentum): E = pboost.E pz = pboost.pz - + #beta = pz/E gamma = E / math.sqrt(E**2-pz**2) gammabeta = pz / math.sqrt(E**2-pz**2) @@ -2778,6 +3089,74 @@ def zboost(self, pboost=None, E=0, pz=0): out.pz = 0 return out + def zboost_inv(self, pboost=None, E=0, pz=0): + """Both momenta should be in the same frame. + The boost perform correspond to the boost required to set pboost at + rest (only z boost applied). + """ + if isinstance(pboost, FourMomentum): + E = pboost.E + pz = pboost.pz + + #beta = pz/E + gamma = E / math.sqrt(E**2-pz**2) + gammabeta = pz / math.sqrt(E**2-pz**2) + + out = FourMomentum([gamma*self.E + gammabeta*self.pz, + self.px, + self.py, + gamma*self.pz + gammabeta*self.E]) + + if abs(out.pz) < 1e-6 * out.E: + out.pz = 0 + return out + + + def pt_boost(self, pboost=None, E=0, pz=0): + """Both momenta should be in the same frame. + The boost perform correspond to the boost required to set pboost at + rest (only pT boost applied). + """ + + if isinstance(pboost, FourMomentum): + E = pboost.E + px = pboost.px + py = pboost.py + mass = math.sqrt(E**2 - px**2 - py**2) + + betax = px/E + betay = py/E + beta = math.sqrt(betax**2+betay**2) + gamma = 1 / math.sqrt(1.0-beta**2) + + out = FourMomentum([gamma*self.E - gamma*betax*self.px - gamma*betay*self.py, + -gamma*betax*self.E + (1.0 + (gamma-1.0)*betax**2/(beta**2))*self.px + (gamma-1.0)*betax*betay/(beta**2)*self.py, + -gamma*betay*self.E + ((gamma-1.0)*betax*betay/(beta**2))*self.px + (1.0+(gamma-1.0)*(betay**2)/(beta**2))*self.py, + self.pz]) + + if abs(out.px) < 1e-6 * out.E: + out.px = 0 + if abs(out.py) < 1e-6 * out.E: + out.py = 0 + return out + + def boost_beta(self,beta,mom): + """ Boost along the three-momentum of mom with a boost of size beta""" + + unit = mom * (1.0/math.sqrt(mom.px**2+mom.py**2+mom.pz**2)) + beta_vec = beta*unit + bx = beta_vec.px + by = beta_vec.py + bz = beta_vec.pz + gamma = 1.0 / math.sqrt(1.0-beta**2) + + out = FourMomentum([gamma*self.E - gamma*bx*self.px - gamma*by*self.py - gamma*bz*self.pz, + -gamma*bx*self.E + (1.0 + (gamma-1.0)*bx**2/(beta**2))*self.px + (gamma-1.0)*bx*by/(beta**2)*self.py + (gamma-1.0)*bx*bz/(beta**2)*self.pz, + -gamma*by*self.E + ((gamma-1.0)*bx*by/(beta**2))*self.px + (1.0+(gamma-1.0)*(by**2)/(beta**2))*self.py + (gamma-1.0)*by*bz/(beta**2)*self.pz, + -gamma*bz*self.E + (gamma-1.0)*bx*bz/(beta**2)*self.px + (gamma-1.0)*(by*bz)/(beta**2)*self.py + (1.0+(gamma-1.0)*bz**2/(beta**2))*self.pz]) + + return out + def boost_to_restframe(self, pboost): """apply the boost transformation such that pboost is at rest in the new frame. First apply a rotation to allign the pboost to the z axis and then use @@ -2789,27 +3168,64 @@ def boost_to_restframe(self, pboost): return out - # write pboost as (E, p cosT sinF, p sinT sinF, p cosF) - # rotation such that it become (E, 0 , 0 , p ) is - # cosT sinF , -sinT , cosT sinF - # sinT cosF , cosT , sinT sinF - # -sinT , 0 , cosF - p = math.sqrt( pboost.px**2 + pboost.py**2+ pboost.pz**2) - cosF = pboost.pz / p - sinF = math.sqrt(1-cosF**2) - sinT = pboost.py/p/sinF - cosT = pboost.px/p/sinF - - out=FourMomentum([self.E, - self.px*cosT*cosF + self.py*sinT*cosF-self.pz*sinF, - -self.px*sinT+ self.py*cosT, - self.px*cosT*sinF + self.py*sinT*sinF + self.pz*cosF - ]) - out = out.zboost(E=pboost.E,pz=p) + # see here https://physics.stackexchange.com/questions/749036/general-lorentz-boost-of-four-momentum-in-cm-frame-particle-physics + vx = pboost.px/pboost.E + vy = pboost.py/pboost.E + vz = pboost.pz/pboost.E + v = pboost.norm/pboost.E + v2 = pboost.norm_sq/pboost.E**2 + gamma = 1./math.sqrt(1.-v**2) + gammo = gamma-1. + out = FourMomentum(E = gamma*(self.E - vx*self.px - vy*self.py - vz*self.pz), + px= -gamma*vx*self.E + (1+gammo*vx**2/v2)*self.px + gammo*vx*vy/v2*self.py + gammo*vx*vz/v2*self.pz, + py= -gamma*vy*self.E + gammo*vy*vx/v2*self.px + (1+gammo*vy**2/v2)*self.py + gammo*vy*vz/v2*self.pz, + pz= -gamma*vz*self.E + gammo*vz*vx/v2*self.px + gammo*vz*vy/v2*self.py + (1+gammo*vz**2/v2)*self.pz) + return out + def rotate_to_z(self,prot): + + import math + import numpy as np + + z = np.array([0.,0.,1.]) + + px = self.px + py = self.py + pz = self.pz + + refx = prot.px + refy = prot.py + refz = prot.pz + + prot_mom = np.array([px, py, pz]) + ref_mom = np.array([refx, refy, refz]) + + # Create normal vector + n = np.array([refy, -refx, 0.]) + n = n * 1./math.sqrt(self.threedot(n,n)) + t = prot_mom - self.threedot(n,prot_mom)*n + p = ref_mom - self.threedot(ref_mom,z)*z + p = p/math.sqrt(self.threedot(p,p)) + + t_pz = np.array([self.threedot(t,p), self.threedot(t,z), 0.]) + costheta = self.threedot(ref_mom,z)* 1./math.sqrt(self.threedot(ref_mom, ref_mom)) + sintheta=math.sqrt(1.-costheta**2) + + sgn = 1. + t_pz_p = np.array([0., 0., 0.]) + t_pz_p[0] = costheta*t_pz[0] + sgn*(-sintheta) * t_pz[1] + t_pz_p[1] = sgn*sintheta*t_pz[0] + costheta * t_pz[1] + + out_mom = self.threedot(n,prot_mom)*n + t_pz_p[0]*p + t_pz_p[1]*z + + out = FourMomentum([self.E,out_mom[0], out_mom[1], out_mom[2] ] ) + + return out - + def threedot(self,a,b): + + return a[0]*b[0]+a[1]*b[1]+a[2]*b[2] class OneNLOWeight(object): 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 2a118e21bf..8e30cf690c 100755 --- a/epochX/cudacpp/pp_tt012j.mad/bin/internal/madevent_interface.py +++ b/epochX/cudacpp/pp_tt012j.mad/bin/internal/madevent_interface.py @@ -496,7 +496,6 @@ def help_remove(self): logger.info(" the optional '-f' allows to by-pass all security question") logger.info(" The banner can be remove only if all files are removed first.") - class AskRun(cmd.ControlSwitch): """a class for the question on what to do on a madevent run""" @@ -2393,13 +2392,17 @@ def do_generate_events(self, line): # Check argument's validity mode = self.check_generate_events(args) switch_mode = self.ask_run_configuration(mode, args) - if not args: - # No run name assigned -> assigned one automaticaly - self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton') - else: - self.set_run_name(args[0], None, 'parton', True) - args.pop(0) - + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat'), consistency=False) + if not run_card.scan_set: + if not args: + # No run name assigned -> assigned one automaticaly + self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton') + else: + self.set_run_name(args[0], None, 'parton', True) + args.pop(0) + + self.run_generate_events(switch_mode, args) self.postprocessing() @@ -2560,7 +2563,7 @@ def wait_monitoring(Idle, Running, Done): self.update_status("postprocessing contur done", level="rivet") # this decorator handle the loop related to scan. - @common_run.scanparamcardhandling() + @common_run.scanparamcardhandling(run_card_scan=True) def run_generate_events(self, switch_mode, args): if self.proc_characteristics['loop_induced'] and self.options['run_mode']==0: @@ -2593,7 +2596,6 @@ def run_generate_events(self, switch_mode, args): # Regular run mode logger.info('Generating %s events with run name %s' % (self.run_card['nevents'], self.run_name)) - self.exec_cmd('survey %s %s' % (self.run_name,' '.join(args)), postcmd=False) nb_event = self.run_card['nevents'] @@ -2975,7 +2977,7 @@ def update_width_in_param_card(decay_info, initial=None, output=None): particle = 0 # Read BRs for this decay line = param_card[line_number] - while re.search('^(#|\s|\d)', line): + while re.search(r'^(#|\s|\d)', line): line = param_card.pop(line_number) if not particle or line.startswith('#'): line=param_card[line_number] @@ -3226,7 +3228,7 @@ def do_treatcards(self, line, mode=None, opt=None): for line in open(pjoin(bias_module_path,'%s.f'%os.path.basename(bias_module_path))): if start and last: break - if not start and not re.search('c\s*parameters\s*=\s*{',line, re.I): + if not start and not re.search(r'c\s*parameters\s*=\s*{',line, re.I): continue start = True if not line.startswith('C'): @@ -3235,7 +3237,7 @@ def do_treatcards(self, line, mode=None, opt=None): if '{' in line: line = line.split('{')[-1] # split for } ! # - split_result = re.split('(\}|!|\#)', line,1, re.M) + split_result = re.split(r'(\}|!|\#)', line,1, re.M) line = split_result[0] sep = split_result[1] if len(split_result)>1 else None if sep == '}': @@ -3514,8 +3516,8 @@ def pass_in_difficult_integration_mode(self, rate=1): text = open(conf_path).read() min_evt, max_evt = 2500 *(2+rate), 10000*(rate+1) - text = re.sub('''\(min_events = \d+\)''', '(min_events = %i )' % min_evt, text) - text = re.sub('''\(max_events = \d+\)''', '(max_events = %i )' % max_evt, text) + text = re.sub(r'''\(min_events = \d+\)''', '(min_events = %i )' % min_evt, text) + text = re.sub(r'''\(max_events = \d+\)''', '(max_events = %i )' % max_evt, text) fsock = open(conf_path, 'w') fsock.write(text) fsock.close() @@ -3619,7 +3621,7 @@ def do_refine(self, line): alljobs = misc.glob('ajob*', Pdir) #remove associated results.dat (ensure to not mix with all data) - Gre = re.compile("\s*j=(G[\d\.\w]+)") + Gre = re.compile(r"\s*j=(G[\d\.\w]+)") for job in alljobs: Gdirs = Gre.findall(open(job).read()) for Gdir in Gdirs: @@ -3727,58 +3729,126 @@ def do_combine_events(self, line): sum_xsec, sum_xerru, sum_axsec = 0,[],0 Gdirs = self.get_Gdir() Gdirs.sort() - for Gdir in Gdirs: - if os.path.exists(pjoin(Gdir, 'events.lhe')): - result = sum_html.OneResult('') - result.read_results(pjoin(Gdir, 'results.dat')) - sum_xsec += result.get('xsec') - sum_xerru.append(result.get('xerru')) - sum_axsec += result.get('axsec') - - if self.run_card['gridpack'] or self.run_card['nevents']==0: - os.remove(pjoin(Gdir, 'events.lhe')) - continue + partials_info = [] + try: + p = subprocess.Popen(["ulimit", "-n"], stdout=subprocess.PIPE) + out, err = p.communicate() + max_G = out.decode() + if max_G == "unlimited": + max_G =2500 + else: + max_G = int(max_G) - 40 + except Exception as error: + logger.debug(error) + max_G = 80 # max(20, len(Gdirs)/self.options['nb_core']) - AllEvent.add(pjoin(Gdir, 'events.lhe'), - result.get('xsec'), - result.get('xerru'), - result.get('axsec') - ) - - if len(AllEvent) >= 80: #perform a partial unweighting - AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % partials), - get_wgt, log_level=5, trunc_error=1e-2, event_target=self.run_card['nevents']) - AllEvent = lhe_parser.MultiEventFile() - AllEvent.banner = self.banner - AllEvent.add(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % partials), - sum_xsec, - math.sqrt(sum(x**2 for x in sum_xerru)), - sum_axsec) - partials +=1 - if not hasattr(self,'proc_characteristic'): self.proc_characteristic = self.get_characteristics() - if len(AllEvent) == 0: - nb_event = 0 - else: + mycluster = cluster.MultiCore(nb_core=self.options['nb_core']) + + def split(a, n): + """split a list "a" into n chunk of same size (or nearly same size)""" + k, m = divmod(len(a), n) + return (a[i*k+min(i, m):(i+1)*k+min(i+1, m)] for i in range(n)) + + partials_info = [] + if len(Gdirs) >= max_G: + start_unweight= time.perf_counter() + # first check in how many chunk we have to split (always use a multiple of nb_core) + nb_split = 1 + nb_G = len(Gdirs) // (2* self.options['nb_core']) + while nb_G > min(80, max_G): + nb_split += 1 + nb_G = len(Gdirs)//(nb_split*2*self.options['nb_core']) + if nb_G < 10: + nb_split -=1 + nb_G = len(Gdirs)//(nb_split*2*self.options['nb_core']) + + #enforce at least 10 directory per thread + if nb_G > 10 or nb_split>1: + # do the unweighting of each chunk on their own thread + nb_chunk = (nb_split*2*self.options['nb_core']) + else: + nb_chunk = len(Gdirs) // 10 + nb_G =10 + + # security that the number of combine events is too large + if nb_chunk >= max_G: + nb_chunk = max_G -1 + nb_G = len(Gdirs) // nb_chunk + + for i, local_G in enumerate(split(Gdirs, nb_chunk)): + line = [pjoin(self.me_dir, "Events", self.run_name, "partials%d.lhe.gz" % i)] + line.append(pjoin(self.me_dir, 'Events', self.run_name, '%s_%s_banner.txt' % (self.run_name, tag))) + line.append(str(self.results.current['cross'])) + line += local_G + partials_info.append(self.do_combine_events_partial(' '.join(line), preprocess_only=True)) + mycluster.submit(sys.executable, + [pjoin(self.me_dir, 'bin', 'internal', 'madevent_interface.py'), 'combine_events_partial'] + line, + stdout='/dev/null' + ) + + starttime = time.time() + update_status = lambda idle, run, finish: \ + self.update_status((idle, run, finish, 'unweight'), level=None, + force=False, starttime=starttime) + mycluster.wait(self.me_dir, update_status) + # do the final combination + for data in partials_info: + AllEvent.add(*data) + + start_unweight= time.perf_counter() nb_event = AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "unweighted_events.lhe.gz"), get_wgt, trunc_error=1e-2, event_target=self.run_card['nevents'], log_level=logging.DEBUG, normalization=self.run_card['event_norm'], proc_charac=self.proc_characteristic) + + #cleaning + for data in partials_info: + path = data[0] + try: + os.remove(path) + except Exception as error: + try: + os.remove(path[:-3]) # try without the .gz + except: + misc.sprint('no file ', path, 'to clean') + else: + for Gdir in Gdirs: + if os.path.exists(pjoin(Gdir, 'events.lhe')): + result = sum_html.OneResult('') + result.read_results(pjoin(Gdir, 'results.dat')) + sum_xsec += result.get('xsec') + sum_xerru.append(result.get('xerru')) + sum_axsec += result.get('axsec') + + if self.run_card['gridpack'] or self.run_card['nevents']==0: + os.remove(pjoin(Gdir, 'events.lhe')) + continue + + AllEvent.add(pjoin(Gdir, 'events.lhe'), + result.get('xsec'), + result.get('xerru'), + result.get('axsec') + ) + + if len(AllEvent) == 0: + nb_event = 0 + else: + nb_event = AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "unweighted_events.lhe.gz"), + get_wgt, trunc_error=1e-2, event_target=self.run_card['nevents'], + log_level=logging.DEBUG, normalization=self.run_card['event_norm'], + proc_charac=self.proc_characteristic) + + if nb_event < self.run_card['nevents']: + logger.warning("failed to generate enough events. Please follow one of the following suggestions to fix the issue:") + logger.warning(" - set in the run_card.dat 'sde_strategy' to %s", 1 + self.run_card['sde_strategy'] % 2) + logger.warning(" - set in the run_card.dat 'hard_survey' to 1 or 2.") + logger.warning(" - reduce the number of requested events (if set too high)") + logger.warning(" - check that you do not have -integrable- singularity in your amplitude.") + logger.warning(" - regenerate your process directory by selecting another gauge (in particular try FD gauge).") - if nb_event < self.run_card['nevents']: - logger.warning("failed to generate enough events. Please follow one of the following suggestions to fix the issue:") - logger.warning(" - set in the run_card.dat 'sde_strategy' to %s", 1 + self.run_card['sde_strategy'] % 2) - logger.warning(" - set in the run_card.dat 'hard_survey' to 1 or 2.") - logger.warning(" - reduce the number of requested events (if set too high)") - logger.warning(" - check that you do not have -integrable- singularity in your amplitude.") - if partials: - for i in range(partials): - try: - os.remove(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % i)) - except Exception: - os.remove(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe" % i)) self.results.add_detail('nb_event', nb_event) @@ -3789,7 +3859,50 @@ def do_combine_events(self, line): logger.info("combination of events done in %s s ", time.time()-start) self.to_store.append('event') + + ############################################################################ + def do_combine_events_partial(self, line, preprocess_only=False): + """ """ + + AllEvent = lhe_parser.MultiEventFile() + + sum_xsec, sum_xerru, sum_axsec = 0,[],0 + output, banner_path,cross = line.split()[:3] + Gdirs = line.split()[3:] + + cross = float(cross) + if not self.banner: + self.banner = banner_mod.Banner(banner_path) + if not hasattr(self, 'run_card'): + self.run_card = banner_mod.RunCard(self.banner['mgruncard']) + AllEvent.banner = self.banner + + for Gdir in Gdirs: + if os.path.exists(pjoin(Gdir, 'events.lhe')): + result = sum_html.OneResult('') + result.read_results(pjoin(Gdir, 'results.dat')) + sum_xsec += result.get('xsec') + sum_xerru.append(result.get('xerru')) + sum_axsec += result.get('axsec') + + if self.run_card['gridpack'] or self.run_card['nevents']==0: + os.remove(pjoin(Gdir, 'events.lhe')) + continue + if not preprocess_only: + AllEvent.add(pjoin(Gdir, 'events.lhe'), + result.get('xsec'), + result.get('xerru'), + result.get('axsec') + ) + if preprocess_only: + return output, sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), sum_axsec + nb_event = max(min(abs(1.01*self.run_card['nevents']*sum_axsec/cross),self.run_card['nevents']), 10) + get_wgt = lambda event: event.wgt + AllEvent.unweight(output, + get_wgt, log_level=5, trunc_error=1e-2, event_target=nb_event) + return output, sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), sum_axsec + ############################################################################ def correct_bias(self): """check the first event and correct the weight by the bias @@ -3902,13 +4015,19 @@ def do_store_events(self, line): #except Exception: # continue # Store log - try: - if os.path.exists(pjoin(G_path, 'log.txt')): - input = pjoin(G_path, 'log.txt') + input = pjoin(G_path, 'log.txt') + if os.path.exists(input): + if self.run_card['keep_log'] not in ["none", "minimal"]: output = pjoin(G_path, '%s_log.txt' % run) - files.mv(input, output) - except Exception: - continue + try: + files.mv(input, output) + except Exception: + continue + elif self.run_card['keep_log'] == "none": + try: + os.remove(input) + except Exception: + continue #try: # # Grid # for name in ['ftn26']: @@ -3989,7 +4108,7 @@ def do_create_gridpack(self, line): misc.call(['./bin/internal/make_gridpack'], cwd=self.me_dir) files.mv(pjoin(self.me_dir, 'gridpack.tar.gz'), pjoin(self.me_dir, '%s_gridpack.tar.gz' % self.run_name)) - os.system("sed -i.bak \"s/\s*.true.*=.*GridRun/ .false. = GridRun/g\" %s/Cards/grid_card.dat" \ + os.system("sed -i.bak \"s/\\s*.true.*=.*GridRun/ .false. = GridRun/g\" %s/Cards/grid_card.dat" \ % self.me_dir) self.update_status('gridpack created', level='gridpack') @@ -4476,7 +4595,7 @@ def do_pythia8(self, line): else: preamble = misc.get_HEPTools_location_setter( pjoin(MG5DIR,'HEPTools'),'lib') - preamble += "\n unset PYTHIA8DATA\n" + #preamble += "\n unset PYTHIA8DATA\n" open(pythia_cmd_card,'w').write("""! ! It is possible to run this card manually with: @@ -4691,7 +4810,7 @@ def do_pythia8(self, line): # Make sure to sure the number of split_events determined during the splitting. split_PY8_Card.systemSet('Main:numberOfEvents',partition_for_PY8[i]) split_PY8_Card.systemSet('HEPMCoutput:scaling',split_PY8_Card['HEPMCoutput:scaling']* - (float(partition_for_PY8[i])/float(n_events))) + (float(partition_for_PY8[i]))) # Add_missing set to False so as to be sure not to add any additional parameter w.r.t # the ones in the original PY8 param_card copied. split_PY8_Card.write(pjoin(parallelization_dir,'PY8Card_%d.dat'%i), @@ -4963,9 +5082,9 @@ def wait_monitoring(Idle, Running, Done): if cross_sections: # Filter the cross_sections specified an keep only the ones # with central parameters and a different merging scale - a_float_re = '[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' + a_float_re = r'[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' central_merging_re = re.compile( - '^\s*Weight_MERGING\s*=\s*(?P%s)\s*$'%a_float_re, + r'^\s*Weight_MERGING\s*=\s*(?P%s)\s*$'%a_float_re, re.IGNORECASE) cross_sections = dict( (float(central_merging_re.match(xsec).group('merging')),value) @@ -5016,8 +5135,8 @@ def wait_monitoring(Idle, Running, Done): def parse_PY8_log_file(self, log_file_path): """ Parse a log file to extract number of event and cross-section. """ - pythiare = re.compile("Les Houches User Process\(es\)\s*\d+\s*\|\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)\s*\|\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") - pythia_xsec_re = re.compile("Inclusive cross section\s*:\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") + pythiare = re.compile(r"Les Houches User Process\(es\)\s*\d+\s*\|\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)\s*\|\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") + pythia_xsec_re = re.compile(r"Inclusive cross section\s*:\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") sigma_m, Nacc, Ntry = None, None, None for line in misc.BackRead(log_file_path): info = pythiare.search(line) @@ -5158,7 +5277,7 @@ def do_pythia(self, line): # read the line from the bottom of the file #pythia_log = misc.BackRead(pjoin(self.me_dir,'Events', self.run_name, # '%s_pythia.log' % tag)) - pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") + pythiare = re.compile(r"\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") for line in misc.reverse_readline(pjoin(self.me_dir,'Events', self.run_name, '%s_pythia.log' % tag)): info = pythiare.search(line) @@ -5619,8 +5738,8 @@ def launch_job(self,exe, cwd=None, stdout=None, argument = [], remaining=0, input_files.append(self.get_pdf_input_filename()) #Find the correct ajob - Gre = re.compile("\s*j=(G[\d\.\w]+)") - origre = re.compile("grid_directory=(G[\d\.\w]+)") + Gre = re.compile(r"\s*j=(G[\d\.\w]+)") + origre = re.compile(r"grid_directory=(G[\d\.\w]+)") try : fsock = open(exe) except Exception: @@ -5628,7 +5747,7 @@ def launch_job(self,exe, cwd=None, stdout=None, argument = [], remaining=0, text = fsock.read() output_files = Gre.findall(text) if not output_files: - Ire = re.compile("for i in ([\d\.\s]*) ; do") + Ire = re.compile(r"for i in ([\d\.\s]*) ; do") data = Ire.findall(text) data = ' '.join(data).split() for nb in data: @@ -6035,7 +6154,7 @@ def get_last_tag(self, level): 'syscalc':[], 'rivet':['rivet']} - if name == self.run_name: + if name and name == self.run_name: if reload_card: run_card = pjoin(self.me_dir, 'Cards','run_card.dat') self.run_card = banner_mod.RunCard(run_card) @@ -6334,7 +6453,7 @@ def run_syscalc(self, mode='parton', event_path=None, output=None): elif mode == 'Pythia': stdout = open(pjoin(event_dir, self.run_name, '%s_%s_syscalc.log' % (tag,mode)),'w') if 'mgpythiacard' in self.banner: - pat = re.compile('''^\s*qcut\s*=\s*([\+\-\d.e]*)''', re.M+re.I) + pat = re.compile(r'''^\s*qcut\s*=\s*([\+\-\d.e]*)''', re.M+re.I) data = pat.search(self.banner['mgpythiacard']) if data: qcut = float(data.group(1)) @@ -6611,7 +6730,7 @@ def get_subP_ids(path): for line in open(pjoin(path, 'leshouche.inc')): if not 'IDUP' in line: continue - particles = re.search("/([\d,-]+)/", line) + particles = re.search(r"/([\d,-]+)/", line) all_ids.append([int(p) for p in particles.group(1).split(',')]) return all_ids @@ -6899,6 +7018,7 @@ def do_combine_events(self, line): partials = 0 # if too many file make some partial unweighting sum_xsec, sum_xerru, sum_axsec = 0,[],0 + partials_info = [] Gdirs = self.get_Gdir() Gdirs.sort() for Gdir in Gdirs: @@ -6917,16 +7037,21 @@ def do_combine_events(self, line): sum_axsec += result.get('axsec')*gscalefact[Gdir] if len(AllEvent) >= 80: #perform a partial unweighting + nb_event = min(abs(1.01*self.nb_event*sum_axsec/self.results.current['cross']),self.run_card['nevents']) AllEvent.unweight(pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), - get_wgt, log_level=5, trunc_error=1e-2, event_target=self.nb_event) + get_wgt, log_level=5, trunc_error=1e-2, event_target=nb_event) AllEvent = lhe_parser.MultiEventFile() AllEvent.banner = self.banner - AllEvent.add(pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), + partials_info.append((pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), - sum_axsec) + sum_axsec) ) + sum_xsec, sum_xerru, sum_axsec = 0,[],0 partials +=1 + for data in partials_info: + AllEvent.add(*data) + if not hasattr(self,'proc_characteristic'): self.proc_characteristic = self.get_characteristics() diff --git a/epochX/cudacpp/pp_tt012j.mad/bin/internal/misc.py b/epochX/cudacpp/pp_tt012j.mad/bin/internal/misc.py index c4c669f36b..e7fd60be0d 100755 --- a/epochX/cudacpp/pp_tt012j.mad/bin/internal/misc.py +++ b/epochX/cudacpp/pp_tt012j.mad/bin/internal/misc.py @@ -67,7 +67,7 @@ def parse_info_str(fsock): """ info_dict = {} - pattern = re.compile("(?P\w*)\s*=\s*(?P.*)", + pattern = re.compile(r"(?P\w*)\s*=\s*(?P.*)", re.IGNORECASE | re.VERBOSE) for entry in fsock: entry = entry.strip() @@ -84,7 +84,7 @@ def parse_info_str(fsock): def glob(name, path=''): """call to glob.glob with automatic security on path""" import glob as glob_module - path = re.sub('(?P\?|\*|\[|\])', '[\g]', path) + path = re.sub(r'(?P\?|\*|\[|\])', r'[\g]', path) return glob_module.glob(pjoin(path, name)) #=============================================================================== @@ -614,10 +614,10 @@ def mod_compilator(directory, new='gfortran', current=None, compiler_type='gfort #search file file_to_change=find_makefile_in_dir(directory) if compiler_type == 'gfortran': - comp_re = re.compile('^(\s*)FC\s*=\s*(.+)\s*$') + comp_re = re.compile(r'^(\s*)FC\s*=\s*(.+)\s*$') var = 'FC' elif compiler_type == 'cpp': - comp_re = re.compile('^(\s*)CXX\s*=\s*(.+)\s*$') + comp_re = re.compile(r'^(\s*)CXX\s*=\s*(.+)\s*$') var = 'CXX' else: MadGraph5Error, 'Unknown compiler type: %s' % compiler_type @@ -861,9 +861,9 @@ def detect_current_compiler(path, compiler_type='fortran'): # comp = re.compile("^\s*FC\s*=\s*(\w+)\s*") # The regular expression below allows for compiler definition with absolute path if compiler_type == 'fortran': - comp = re.compile("^\s*FC\s*=\s*([\w\/\\.\-]+)\s*") + comp = re.compile("^\\s*FC\\s*=\\s*([\\w\\/\\.\\-]+)\\s*") elif compiler_type == 'cpp': - comp = re.compile("^\s*CXX\s*=\s*([\w\/\\.\-]+)\s*") + comp = re.compile("^\\s*CXX\\s*=\\s*([\\w\\/\\.\\-]+)\\s*") else: MadGraph5Error, 'Unknown compiler type: %s' % compiler_type @@ -1001,7 +1001,19 @@ def call_stdout(arg, *args, **opt): def copytree(src, dst, symlinks = False, ignore = None): if not os.path.exists(dst): os.makedirs(dst) - shutil.copystat(src, dst) + try: + shutil.copystat(src, dst) + except PermissionError: + if os.path.realpath(src).startswith('/cvmfs') and os.path.realpath(dst).startswith('/afs'): + # allowing missmatch from cvmfs to afs since sounds to not create issue --at least in general-- + logger.critical(f'Ignoring that we could not copy permissions from {src} to {dst}') + else: + logger.critical(f'Permission error detected from {src} to {dst}.\n'+\ + 'If you are using WSL with windows partition, please try using python3.12\n'+\ + 'or avoid moving your data from the WSL partition to the UNIX one') + # we do not have enough experience in WSL to allow it to get trough. + raise + lst = os.listdir(src) if ignore: excl = ignore(src, lst) @@ -1895,12 +1907,12 @@ class EasterEgg(object): May4_banner = "* _____ *\n" + \ "* ,-~\" \"~-. *\n" + \ "* * ,^ ___ ^. * *\n" + \ - "* * / .^ ^. \ * *\n" + \ + "* * / .^ ^. \\ * *\n" + \ "* * Y l o ! Y * *\n" + \ "* * l_ `.___.' _,[ * *\n" + \ "* * |^~\"--------------~\"\"^| * *\n" + \ "* * ! May the 4th ! * *\n" + \ - "* * \ / * *\n" + \ + "* * \\ / * *\n" + \ "* * ^. .^ * *\n" + \ "* * \"-.._____.,-\" * *\n" @@ -1909,13 +1921,13 @@ class EasterEgg(object): "* M::::::::::M M::::::::::M *\n" + \ "* M:::::::::::M M:::::::::::M (_)___ *\n" + \ "* M:::::::M::::M M::::M:::::::M | / __| *\n" + \ - "* M::::::M M::::M M::::M M::::::M | \__ \ *\n" + \ + "* M::::::M M::::M M::::M M::::::M | \\__ \\ *\n" + \ "* M::::::M M::::M::::M M::::::M |_|___/ *\n" + \ "* M::::::M M:::::::M M::::::M *\n" + \ "* M::::::M M:::::M M::::::M / _| ___ _ __ *\n" + \ - "* M::::::M MMMMM M::::::M | |_ / _ \| '__| *\n" + \ + "* M::::::M MMMMM M::::::M | |_ / _ \\| '__| *\n" + \ "* M::::::M M::::::M | _| (_) | | *\n" + \ - "* M::::::M M::::::M |_/\/\___/|_| *\n" + \ + "* M::::::M M::::::M |_/\\/\\___/|_| *\n" + \ "* M::::::M M::::::M *\n" + \ "* MMMMMMMM MMMMMMMM *\n" + \ "* *\n" + \ @@ -2233,39 +2245,51 @@ def import_python_lhapdf(lhapdfconfig): os.environ['LD_LIBRARY_PATH'] = lhapdf_libdir else: os.environ['LD_LIBRARY_PATH'] = '%s:%s' %(lhapdf_libdir,os.environ['LD_LIBRARY_PATH']) - try: candidates=[dirname for dirname in os.listdir(lhapdf_libdir) \ if os.path.isdir(os.path.join(lhapdf_libdir,dirname))] except OSError: candidates=[] + if os.path.isdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')): + candidates += [pjoin(os.pardir,'local', 'lib', dirname) for dirname in os.listdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')) + if os.path.isdir(os.path.join(lhapdf_libdir,os.pardir, 'local', 'lib', dirname))] for candidate in candidates: - if os.path.isdir(os.path.join(lhapdf_libdir,candidate,'site-packages')): - sys.path.insert(0,os.path.join(lhapdf_libdir,candidate,'site-packages')) - try: - import lhapdf - use_lhapdf=True - break - except ImportError: - sys.path.pop(0) - continue + for subdir in ['site-packages', 'dist-packages']: + if os.path.isdir(os.path.join(lhapdf_libdir,candidate, subdir)): + sys.path.insert(0,os.path.join(lhapdf_libdir,candidate, subdir)) + try: + import lhapdf + use_lhapdf=True + break + except ImportError as error: + sys.path.pop(0) + continue + else: + continue + break if not use_lhapdf: try: candidates=[dirname for dirname in os.listdir(lhapdf_libdir+'64') \ if os.path.isdir(os.path.join(lhapdf_libdir+'64',dirname))] except OSError: candidates=[] - + if os.path.isdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib64')): + candidates += [pjoin(os.pardir,'local', 'lib64', dirname) for dirname in os.listdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')) + if os.path.isdir(os.path.join(lhapdf_libdir,os.pardir, 'local', 'lib64', dirname))] for candidate in candidates: - if os.path.isdir(os.path.join(lhapdf_libdir+'64',candidate,'site-packages')): - sys.path.insert(0,os.path.join(lhapdf_libdir+'64',candidate,'site-packages')) - try: - import lhapdf - use_lhapdf=True - break - except ImportError: - sys.path.pop(0) - continue + for subdir in ['site-packages', 'dist-packages']: + if os.path.isdir(os.path.join(lhapdf_libdir+'64',candidate, subdir)): + sys.path.insert(0,os.path.join(lhapdf_libdir+'64',candidate, subdir)) + try: + import lhapdf + use_lhapdf=True + break + except ImportError as error: + sys.path.pop(0) + continue + else: + continue + break if not use_lhapdf: try: import lhapdf diff --git a/epochX/cudacpp/pp_tt012j.mad/bin/internal/shower_card.py b/epochX/cudacpp/pp_tt012j.mad/bin/internal/shower_card.py index e87d534177..16ed72b1a0 100755 --- a/epochX/cudacpp/pp_tt012j.mad/bin/internal/shower_card.py +++ b/epochX/cudacpp/pp_tt012j.mad/bin/internal/shower_card.py @@ -288,7 +288,7 @@ def write(self, output_file, template=None, python_template=False, self.text = open(template,'r').read() - key_re = re.compile('^(\s*)([\S^#]+)(\s*)=(\s*)([^#]*?)(\s*)(\#.*|$)') + key_re = re.compile(r'^(\s*)([\S^#]+)(\s*)=(\s*)([^#]*?)(\s*)(\#.*|$)') newlines = [] for line in self.text.split('\n'): key_match = key_re.findall(line) diff --git a/epochX/cudacpp/pp_tt012j.mad/bin/internal/systematics.py b/epochX/cudacpp/pp_tt012j.mad/bin/internal/systematics.py index 28eaed00e2..2acebd087c 100644 --- a/epochX/cudacpp/pp_tt012j.mad/bin/internal/systematics.py +++ b/epochX/cudacpp/pp_tt012j.mad/bin/internal/systematics.py @@ -582,7 +582,7 @@ def print_cross_sections(self, all_cross, nb_event, stdout): else: resume.write( '#PDF %s: %g +%2.3g%% -%2.3g%%\n' % (pdfset.name, pdferr.central,pdferr.errplus*100/all_cross[0], pdferr.errminus*100/all_cross[0])) - dyn_name = {1: '\sum ET', 2:'\sum\sqrt{m^2+pt^2}', 3:'0.5 \sum\sqrt{m^2+pt^2}',4:'\sqrt{\hat s}' } + dyn_name = {1: r'\sum ET', 2:r'\sum\sqrt{m^2+pt^2}', 3:r'0.5 \sum\sqrt{m^2+pt^2}',4:r'\sqrt{\hat s}' } for key, curr in dyns.items(): if key ==-1: continue @@ -789,7 +789,7 @@ def get_id(self): return int(self.start_wgt_id) if 'initrwgt' in self.banner: - pattern = re.compile(' set lhapdf /PATH/TO/lhapdf-config -None does not seem to correspond to a valid lhapdf-config executable. -Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config). -Note that you can still compile and run aMC@NLO with the built-in PDFs - MG5_aMC> set lhapdf /PATH/TO/lhapdf-config - Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt -import /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt.mg +import /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt.mg The import format was not given, so we guess it as command set stdout_level DEBUG set output information to level: 10 set zerowidth_tchannel F set auto_convert_model T save options auto_convert_model -save configuration file to /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +save configuration file to /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt import model SMEFTsim_topU3l_MwScheme_UFO -massless_4t INFO: load particles INFO: load vertices @@ -77,7 +72,7 @@ INFO: load vertices DEBUG: MG5 converter defines FFFF26 to Gamma(-2,-4,-3)*Gamma(-2,2,-6)*Gamma(-1,-6,-5)*Gamma(-1,4,-4)*ProjP(-5,1)*ProjP(-3,3) + Gamma(-2,-4,-3)*Gamma(-2,4,-6)*Gamma(-1,-6,-5)*Gamma(-1,2,-4)*ProjP(-5,3)*ProjP(-3,1) + Gamma(-2,-4,-3)*Gamma(-2,2,-6)*Gamma(-1,-6,-5)*Gamma(-1,4,-4)*ProjM(-5,1)*ProjM(-3,3) + Gamma(-2,-4,-3)*Gamma(-2,4,-6)*Gamma(-1,-6,-5)*Gamma(-1,2,-4)*ProjM(-5,3)*ProjM(-3,1)  DEBUG: MG5 converter defines FFFF27 to ProjP(2,1)*ProjP(4,3) + ProjM(2,1)*ProjM(4,3)  DEBUG: MG5 converter defines FFFF112 to ProjM(2,3)*ProjM(4,1) + ProjP(2,3)*ProjP(4,1)  -DEBUG: model prefixing takes 0.14006304740905762  +DEBUG: model prefixing takes 0.14330029487609863  INFO: Change particles name to pass to MG5 convention Defined multiparticle p = g u c d s u~ c~ d~ s~ Defined multiparticle j = g u c d s u~ c~ d~ s~ @@ -92,24 +87,24 @@ INFO: Please specify coupling orders to bypass this step. INFO: Trying coupling order WEIGHTED<=4: WEIGTHED IS QCD+2*QED+99*SMHLOOP+99*NP+99*NPshifts+99*NPprop+99*NPcpv+NPcbb+NPcbB+NPcbBB+NPcbd1+NPcbd8+NPcbe+NPcbG+NPcbH+NPcbj1+NPcbj8+NPcbl+NPcbu1+NPcbu8+NPcbW+NPcdB+NPcdd1+NPcdd8+NPcdG+NPcdH+NPcdW+NPceB+NPced+NPcee+NPceH+NPceu+NPceW+NPcG+NPcGtil+NPcH+NPcHB+NPcHbox+NPcHbq+NPcHBtil+NPcHd+NPcHDD+NPcHe+NPcHG+NPcHGtil+NPcHj1+NPcHj3+NPcHl1+NPcHl3+NPcHQ1+NPcHQ3+NPcHt+NPcHtb+NPcHu+NPcHud+NPcHW+NPcHWB+NPcHWBtil+NPcHWtil+NPcjd1+NPcjd8+NPcje+NPcjj11+NPcjj18+NPcjj31+NPcjj38+NPcjQbd1+NPcjQbd8+NPcjQtu1+NPcjQtu8+NPcjtQd1+NPcjtQd8+NPcju1+NPcju8+NPcjujd1+NPcjujd11+NPcjujd8+NPcjujd81+NPcjuQb1+NPcjuQb8+NPcld+NPcle+NPclebQ+NPcledj+NPcleju1+NPcleju3+NPcleQt1+NPcleQt3+NPclj1+NPclj3+NPcll+NPcll1+NPclu+NPcQb1+NPcQb8+NPcQd1+NPcQd8+NPcQe+NPcQj11+NPcQj18+NPcQj31+NPcQj38+NPcQl1+NPcQl3+NPcQQ1+NPcQQ8+NPcQt1+NPcQt8+NPcQtjd1+NPcQtjd8+NPcQtQb1+NPcQtQb8+NPcQu1+NPcQu8+NPcQujb1+NPcQujb8+NPctB+NPctb1+NPctb8+NPctd1+NPctd8+NPcte+NPctG+NPctH+NPctj1+NPctj8+NPctl+NPctt+NPctu1+NPctu8+NPctW+NPcuB+NPcud1+NPcud8+NPcuG+NPcuH+NPcutbd1+NPcutbd8+NPcuu1+NPcuu8+NPcuW+NPcW+NPcWtil+NPQjujb8 INFO: Trying process: g g > t t~ t t~ WEIGHTED<=4 @1 INFO: Process has 72 diagrams -1 processes with 72 diagrams generated in 3.739 s +1 processes with 72 diagrams generated in 3.816 s Total: 1 processes with 72 diagrams output madevent_simd ../TMPOUT/CODEGEN_mad_smeft_gg_tttt --hel_recycling=False --vector_size=32 Load PLUGIN.CUDACPP_OUTPUT -Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.5.3_lo_vect. +Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.6.0_lo_vect. It has been validated for the last time with version: 3.5.2 Output will be done with PLUGIN: CUDACPP_OUTPUT Addition matrix-element will be done with PLUGIN: CUDACPP_OUTPUT +DEBUG: opt['output_options']['vector_size'] =  32 [export_v4.py at line 4334]  Output will be done with PLUGIN: CUDACPP_OUTPUT -DEBUG: cformat =  standalone_simd [export_cpp.py at line 3070]  DEBUG: Entering PLUGIN_ProcessExporter.__init__ (initialise the exporter) [output.py at line 165]  INFO: initialize a new directory: CODEGEN_mad_smeft_gg_tttt INFO: remove old information in CODEGEN_mad_smeft_gg_tttt DEBUG: Entering PLUGIN_ProcessExporter.copy_template (initialise the directory) [output.py at line 170]  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt  -INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/Cards  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/SubProcesses  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt  +INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/Cards  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/SubProcesses  INFO: Organizing processes into subprocess groups INFO: Generating Helas calls for process: g g > t t~ t t~ WEIGHTED<=4 @1 INFO: Processing color information for process: g g > t t~ t t~ @1 @@ -119,32 +114,28 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 67, 68, 0, 69, 70] [export_cpp.py at line 711]  -DEBUG: subproc_number =  0 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: g g > t t~ t t~ WEIGHTED<=4 @1 INFO: Finding symmetric diagrams for subprocess group gg_ttxttx -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/SubProcesses/P1_gg_ttxttx [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  70 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 19: 19, 20: 20, 21: 21, 22: 22, 23: 23, 24: 24, 25: 25, 26: 26, 27: 27, 28: 28, 29: 29, 30: 30, 31: 31, 32: 32, 33: 33, 34: 34, 35: 35, 36: 36, 37: 37, 38: 38, 39: 39, 40: 40, 41: 41, 42: 42, 43: 43, 44: 44, 45: 45, 46: 46, 47: 47, 48: 48, 49: 49, 50: 50, 51: 51, 52: 52, 53: 53, 54: 54, 55: 55, 56: 56, 57: 57, 58: 58, 59: 59, 60: 60, 61: 61, 62: 62, 63: 63, 64: 64, 65: 65, 66: 66, 67: 68, 68: 69, 69: 71, 70: 72} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 19: 19, 20: 20, 21: 21, 22: 22, 23: 23, 24: 24, 25: 25, 26: 26, 27: 27, 28: 28, 29: 29, 30: 30, 31: 31, 32: 32, 33: 33, 34: 34, 35: 35, 36: 36, 37: 37, 38: 38, 39: 39, 40: 40, 41: 41, 42: 42, 43: 43, 44: 44, 45: 45, 46: 46, 47: 47, 48: 48, 49: 49, 50: 50, 51: 51, 52: 52, 53: 53, 54: 54, 55: 55, 56: 56, 57: 57, 58: 58, 59: 59, 60: 60, 61: 61, 62: 62, 63: 63, 64: 64, 65: 65, 66: 66, 68: 67, 69: 68, 71: 69, 72: 70} [model_handling.py at line 1548]  -Generated helas calls for 1 subprocesses (72 diagrams) in 0.190 s -Wrote files for 119 helas calls in 0.401 s +Generated helas calls for 1 subprocesses (72 diagrams) in 0.193 s +Wrote files for 119 helas calls in 0.396 s +DEBUG: self.vector_size =  32 [export_v4.py at line 7023]  ALOHA: aloha starts to compute helicity amplitudes ALOHA: aloha creates VVV5 routines ALOHA: aloha creates FFV1 routines ALOHA: aloha creates VVVV1 routines ALOHA: aloha creates VVVV9 routines ALOHA: aloha creates VVVV10 routines -ALOHA: aloha creates 5 routines in 0.323 s +ALOHA: aloha creates 5 routines in 0.327 s ALOHA: aloha starts to compute helicity amplitudes ALOHA: aloha creates VVV5 routines ALOHA: aloha creates FFV1 routines ALOHA: aloha creates VVVV1 routines ALOHA: aloha creates VVVV9 routines ALOHA: aloha creates VVVV10 routines -ALOHA: aloha creates 10 routines in 0.332 s +ALOHA: aloha creates 10 routines in 0.336 s VVV5 VVV5 FFV1 @@ -154,38 +145,40 @@ ALOHA: aloha creates 10 routines in 0.332 s VVVV1 VVVV9 VVVV10 -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/src/./HelAmps_SMEFTsim_topU3l_MwScheme_UFO.h -INFO: Created file HelAmps_SMEFTsim_topU3l_MwScheme_UFO.h in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/src/. +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/src/./HelAmps_SMEFTsim_topU3l_MwScheme_UFO.h +INFO: Created file HelAmps_SMEFTsim_topU3l_MwScheme_UFO.h in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/src/. super_write_set_parameters_onlyfixMajorana (hardcoded=False) super_write_set_parameters_onlyfixMajorana (hardcoded=True) -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/src/./Parameters_SMEFTsim_topU3l_MwScheme_UFO.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/src/./Parameters_SMEFTsim_topU3l_MwScheme_UFO.cc +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/src/./Parameters_SMEFTsim_topU3l_MwScheme_UFO.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/src/./Parameters_SMEFTsim_topU3l_MwScheme_UFO.cc INFO: Created files Parameters_SMEFTsim_topU3l_MwScheme_UFO.h and Parameters_SMEFTsim_topU3l_MwScheme_UFO.cc in directory -INFO: /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/src/. and /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/src/. +INFO: /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/src/. and /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/src/. The option zerowidth_tchannel is modified [True] but will not be written in the configuration files. If you want to make this value the default for future session, you can run 'save options --all' -save configuration file to /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/Cards/me5_configuration.txt +save configuration file to /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/Cards/me5_configuration.txt INFO: Use Fortran compiler gfortran INFO: Use c++ compiler g++ INFO: Generate jpeg diagrams INFO: Generate web pages -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common -patching file Source/genps.inc +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common patching file SubProcesses/makefile -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/SubProcesses/P1_gg_ttxttx; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/SubProcesses/P1_gg_ttxttx; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #2 succeeded at 281 (offset 48 lines). +Hunk #2 succeeded at 275 (offset 61 lines). DEBUG: p.returncode =  0 [output.py at line 258]  -Output to directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt done. +Output to directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt done. Type "launch" to generate events from this process, or see -/data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/README +/data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/README Run "open index.html" to see more information about this process. quit -real 0m7.325s -user 0m6.873s -sys 0m0.329s +real 0m7.349s +user 0m6.999s +sys 0m0.311s Code generation completed in 7 seconds ************************************************************ * * @@ -199,7 +192,7 @@ Code generation completed in 7 seconds * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect * +* VERSION 3.6.0_lo_vect * * * * The MadGraph5_aMC@NLO Development Team - Find us at * * https://server06.fynu.ucl.ac.be/projects/madgraph * @@ -207,9 +200,9 @@ Code generation completed in 7 seconds * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt @@ -229,7 +222,7 @@ launch in debug mode * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect * +* VERSION 3.6.0_lo_vect * * * * The MadGraph5_aMC@NLO Development Team - Find us at * * https://server06.fynu.ucl.ac.be/projects/madgraph * @@ -237,9 +230,9 @@ launch in debug mode * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_smeft_gg_tttt/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/Cards/me5_configuration.txt b/epochX/cudacpp/smeft_gg_tttt.mad/Cards/me5_configuration.txt index cdeedc7863..4f5079f78a 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/Cards/me5_configuration.txt +++ b/epochX/cudacpp/smeft_gg_tttt.mad/Cards/me5_configuration.txt @@ -116,6 +116,7 @@ # cluster_type = condor # cluster_queue = madgraph # cluster_size = 150 +# cluster_walltime = # time in minute for slurm and second for condor (not supported for other scheduller) #! Path to a node directory to avoid direct writing on the central disk #! Note that condor clusters avoid direct writing by default (therefore this @@ -234,7 +235,7 @@ # pineappl = pineappl -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo # MG5 MAIN DIRECTORY -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/Cards/param_card.dat b/epochX/cudacpp/smeft_gg_tttt.mad/Cards/param_card.dat index 4a29fbe719..effb6edf97 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/Cards/param_card.dat +++ b/epochX/cudacpp/smeft_gg_tttt.mad/Cards/param_card.dat @@ -1,5 +1,5 @@ ###################################################################### -## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL #### +## PARAM_CARD AUTOMATICALLY GENERATED BY MG5 FOLLOWING UFO MODEL #### ###################################################################### ## ## ## Width set on Auto will be computed following the information ## diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/Cards/param_card_default.dat b/epochX/cudacpp/smeft_gg_tttt.mad/Cards/param_card_default.dat index 4a29fbe719..effb6edf97 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/Cards/param_card_default.dat +++ b/epochX/cudacpp/smeft_gg_tttt.mad/Cards/param_card_default.dat @@ -1,5 +1,5 @@ ###################################################################### -## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL #### +## PARAM_CARD AUTOMATICALLY GENERATED BY MG5 FOLLOWING UFO MODEL #### ###################################################################### ## ## ## Width set on Auto will be computed following the information ## diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/Cards/proc_card_mg5.dat b/epochX/cudacpp/smeft_gg_tttt.mad/Cards/proc_card_mg5.dat index f365b1da04..cff7a006a2 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/Cards/proc_card_mg5.dat +++ b/epochX/cudacpp/smeft_gg_tttt.mad/Cards/proc_card_mg5.dat @@ -8,7 +8,7 @@ #* * * * #* * #* * -#* VERSION 3.5.3_lo_vect 2023-12-23 * +#* VERSION 3.6.0_lo_vect 2024-06-17 * #* * #* WARNING: UNKNOWN DEVELOPMENT VERSION. * #* WARNING: DO NOT USE FOR PRODUCTION * diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/Cards/reweight_card_default.dat b/epochX/cudacpp/smeft_gg_tttt.mad/Cards/reweight_card_default.dat index ace534ae02..5cc65fe095 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/Cards/reweight_card_default.dat +++ b/epochX/cudacpp/smeft_gg_tttt.mad/Cards/reweight_card_default.dat @@ -19,8 +19,16 @@ change mode NLO # Define type of Reweighting. For LO sample this command # has no effect since only "LO" mode is allowed. + +#uncomment if you do not want to overwrite the reweight file of Sudakov in rw_me +#change rwgt_dir /PATH_MG5_BRANCH/NAME_FOLDER + +#uncomment if you want to use Sudakov Reweight +#change include_sudakov True + launch + # SPECIFY A PATH OR USE THE SET COMMAND LIKE THIS: # set sminputs 1 130 # modify 1/alpha_EW diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/Cards/run_card.dat b/epochX/cudacpp/smeft_gg_tttt.mad/Cards/run_card.dat index b58554b4f2..6b82577032 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/Cards/run_card.dat +++ b/epochX/cudacpp/smeft_gg_tttt.mad/Cards/run_card.dat @@ -157,6 +157,7 @@ systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++] ['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule + #*********************************************************************** # SIMD/GPU configuration for the CUDACPP plugin #************************************************************************ diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/Cards/run_card_default.dat b/epochX/cudacpp/smeft_gg_tttt.mad/Cards/run_card_default.dat index 1cb94c8622..b8db871c35 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/Cards/run_card_default.dat +++ b/epochX/cudacpp/smeft_gg_tttt.mad/Cards/run_card_default.dat @@ -157,6 +157,7 @@ systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++] ['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule + #*********************************************************************** # SIMD/GPU configuration for the CUDACPP plugin #************************************************************************ diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/MGMEVersion.txt b/epochX/cudacpp/smeft_gg_tttt.mad/MGMEVersion.txt index 9d3a5c0ba0..a806d3938c 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/MGMEVersion.txt +++ b/epochX/cudacpp/smeft_gg_tttt.mad/MGMEVersion.txt @@ -1 +1 @@ -3.5.3_lo_vect \ No newline at end of file +3.6.0_lo_vect \ No newline at end of file diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/Source/DHELAS/aloha_functions.f b/epochX/cudacpp/smeft_gg_tttt.mad/Source/DHELAS/aloha_functions.f index 975725737f..47699fa614 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/Source/DHELAS/aloha_functions.f +++ b/epochX/cudacpp/smeft_gg_tttt.mad/Source/DHELAS/aloha_functions.f @@ -351,7 +351,7 @@ subroutine oxxxxx(p,fmass,nhel,nsf , fo) fo(6) = ip * sqm(abs(im)) else - pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2)) +c pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2)) sf(1) = dble(1+nsf+(1-nsf)*nh)*rHalf sf(2) = dble(1+nsf-(1-nsf)*nh)*rHalf omega(1) = dsqrt(p(0)+pp) @@ -2054,7 +2054,7 @@ subroutine CombineAmp(nb, ihels, iwfcts, W1, Wall, Amp) enddo return end - + subroutine CombineAmpS(nb, ihels, iwfcts, W1, Wall, Amp) integer nb ! size of the vectors diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/couplings.f b/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/couplings.f index f3b620ab58..04d6bb5333 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/couplings.f +++ b/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/couplings.f @@ -10,18 +10,27 @@ SUBROUTINE COUP() PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + LOGICAL UPDATELOOP COMMON /TO_UPDATELOOP/UPDATELOOP INCLUDE 'input.inc' - INCLUDE '../vector.inc' + + INCLUDE 'coupl.inc' READLHA = .TRUE. INCLUDE 'intparam_definition.inc' CALL COUP1() + IF (UPDATELOOP) THEN + + CALL COUP2() + + ENDIF + C couplings needed to be evaluated points by points C - CALL COUP2(1) + CALL COUP3(1) RETURN END @@ -47,7 +56,11 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) INCLUDE '../maxparticles.inc' INCLUDE '../cuts.inc' + + INCLUDE '../vector.inc' + + INCLUDE '../run.inc' DOUBLE PRECISION ALPHAS @@ -65,7 +78,7 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) couplings needed to be evaluated points by points C ALL_G(VECID) = G - CALL COUP2(VECID) + CALL COUP3(VECID) RETURN END @@ -80,7 +93,9 @@ SUBROUTINE UPDATE_AS_PARAM2(MU_R2,AS2 ,VECID) INTEGER VECID INCLUDE 'model_functions.inc' INCLUDE 'input.inc' + INCLUDE '../vector.inc' + INCLUDE 'coupl.inc' DOUBLE PRECISION MODEL_SCALE COMMON /MODEL_SCALE/MODEL_SCALE diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/couplings1.f b/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/couplings1.f index e14f3a1770..72cfa0f6e4 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/couplings1.f +++ b/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/couplings1.f @@ -7,11 +7,12 @@ SUBROUTINE COUP1( ) IMPLICIT NONE INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' END diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/couplings2.f b/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/couplings2.f index 555e337578..30f3a04e3b 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/couplings2.f +++ b/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/couplings2.f @@ -2,19 +2,17 @@ c written by the UFO converter ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc - SUBROUTINE COUP2( VECID) + SUBROUTINE COUP2( ) IMPLICIT NONE - INTEGER VECID + INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' - GC_6(VECID) = -(MDL_COMPLEXI*G) - GC_7(VECID) = G - GC_8(VECID) = MDL_COMPLEXI*MDL_G__EXP__2 END diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/couplings3.f b/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/couplings3.f index 0d0f298340..3a8a352951 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/couplings3.f +++ b/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/couplings3.f @@ -7,12 +7,13 @@ SUBROUTINE COUP3( VECID) IMPLICIT NONE INTEGER VECID INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' GC_6(VECID) = -(MDL_COMPLEXI*G) GC_7(VECID) = G diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/makefile b/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/makefile index 0b24445a53..5a5681d220 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/makefile +++ b/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/makefile @@ -3,7 +3,7 @@ # Makefile for model library # # ---------------------------------------------------------------------------- - +# template models/template_files/makefile_madevent # Check for ../make_opts ifeq ($(wildcard ../make_opts), ../make_opts) include ../make_opts diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/makeinc.inc b/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/makeinc.inc index 6e2743eac1..4a9e1b2cc5 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/makeinc.inc +++ b/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/makeinc.inc @@ -2,4 +2,4 @@ # written by the UFO converter ############################################################################# -MODEL = couplings.o lha_read.o printout.o rw_para.o model_functions.o couplings1.o couplings2.o \ No newline at end of file +MODEL = couplings.o lha_read.o printout.o rw_para.o model_functions.o couplings1.o couplings2.o couplings3.o \ No newline at end of file diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/printout.f b/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/printout.f index 18b8f35b08..3e195b03a2 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/printout.f +++ b/epochX/cudacpp/smeft_gg_tttt.mad/Source/MODEL/printout.f @@ -1,3 +1,7 @@ +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +c written by the UFO converter +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc + c************************************************************************ c** ** c** MadGraph/MadEvent Interface to FeynRules ** @@ -9,7 +13,7 @@ subroutine printout implicit none - include '../vector.inc' ! defines VECSIZE_MEMMAX + include '../vector.inc' ! VECSIZE_MEMMAX (needed by coupl.inc) include 'coupl.inc' ! needs VECSIZE_MEMMAX (defined in vector.inc) include 'input.inc' diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/Source/PDF/eepdf.inc b/epochX/cudacpp/smeft_gg_tttt.mad/Source/PDF/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/Source/PDF/eepdf.inc +++ b/epochX/cudacpp/smeft_gg_tttt.mad/Source/PDF/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/Source/PDF/pdfwrap_emela.f b/epochX/cudacpp/smeft_gg_tttt.mad/Source/PDF/pdfwrap_emela.f index bce10819d5..da1e4e2276 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/Source/PDF/pdfwrap_emela.f +++ b/epochX/cudacpp/smeft_gg_tttt.mad/Source/PDF/pdfwrap_emela.f @@ -13,7 +13,7 @@ SUBROUTINE PDFWRAP DOUBLE PRECISION VALUE(20) REAL*8 ALPHASPDF EXTERNAL ALPHASPDF - ! PDFs with beamstrahlung use specific initialisation/evaluation +C PDFs with beamstrahlung use specific initialisation/evaluation LOGICAL HAS_BSTRAHL COMMON /TO_HAS_BS/ HAS_BSTRAHL diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/Source/PDF/pdg2pdf.f b/epochX/cudacpp/smeft_gg_tttt.mad/Source/PDF/pdg2pdf.f index 46f321e66b..2e7343a69b 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/Source/PDF/pdg2pdf.f +++ b/epochX/cudacpp/smeft_gg_tttt.mad/Source/PDF/pdg2pdf.f @@ -108,7 +108,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) else if (abs(ipart).eq.10) then ipart = sign(1,ipart) * 15 endif - pdg2pdf = 0d0 + pdg2pdf = 0d0 if (beamid.lt.0) then ih_local = ipart @@ -122,7 +122,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) endif do i_ee = 1, n_ee ee_components(i_ee) = compute_eepdf(x,omx_ee(iabs(beamid)),xmu,i_ee,ipart,ih_local) - enddo + enddo pdg2pdf = ee_components(1) ! temporary to test pdf load c write(*,*), x, beamid ,omx_ee(iabs(beamid)),xmu,1,ipart,ih_local,pdg2pdf return diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/Source/dsample.f b/epochX/cudacpp/smeft_gg_tttt.mad/Source/dsample.f index 09d482b45a..b0bc0547ad 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/Source/dsample.f +++ b/epochX/cudacpp/smeft_gg_tttt.mad/Source/dsample.f @@ -204,6 +204,9 @@ subroutine sample_full(ndim,ncall,itmax,itmin,dsig,ninvar,nconfigs,VECSIZE_USED) if (VECSIZE_USED.le.1) then all_fx(1) = dsig(all_p, all_wgt,0) + ivec=0 + ilock=0 + iwarp=1 else c Here "i" is the position in the full grid of the event do i=(iwarp-1)*WARP_SIZE+1, iwarp*warp_size diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/Source/eepdf.inc b/epochX/cudacpp/smeft_gg_tttt.mad/Source/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/Source/eepdf.inc +++ b/epochX/cudacpp/smeft_gg_tttt.mad/Source/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/Source/genps.inc b/epochX/cudacpp/smeft_gg_tttt.mad/Source/genps.inc index af7e0efbce..ef78e7e812 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/Source/genps.inc +++ b/epochX/cudacpp/smeft_gg_tttt.mad/Source/genps.inc @@ -29,9 +29,8 @@ c parameter (max_host=99,maxplace=199,maxpoints=100,maxans=50) c************************************************************************* c Parameters for helicity sums in matrixN.f c************************************************************************* - REAL*8 LIMHEL -c PARAMETER(LIMHEL=1e-8) ! ME threshold for helicity filtering (Fortran default) - PARAMETER(LIMHEL=0) ! ME threshold for helicity filtering (force Fortran to mimic cudacpp, see #419) +c REAL*8 LIMHEL +c PARAMETER(LIMHEL=1e-8) -> pass in the run_card.dat INTEGER MAXTRIES PARAMETER(MAXTRIES=25) C To pass the helicity configuration chosen by the DiscreteSampler to diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/Source/run.inc b/epochX/cudacpp/smeft_gg_tttt.mad/Source/run.inc index 5433a23583..81c8df6bf2 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/Source/run.inc +++ b/epochX/cudacpp/smeft_gg_tttt.mad/Source/run.inc @@ -106,4 +106,7 @@ c double precision tmin_for_channel integer sde_strat ! 1 means standard single diagram enhancement strategy, c 2 means approximation by the denominator of the propagator - common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat \ No newline at end of file + common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat +c + double precision limhel + common/to_limhel/limhel diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/Source/run_card.inc b/epochX/cudacpp/smeft_gg_tttt.mad/Source/run_card.inc index 67af0f2051..1a1bc782bd 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/Source/run_card.inc +++ b/epochX/cudacpp/smeft_gg_tttt.mad/Source/run_card.inc @@ -88,6 +88,8 @@ DSQRT_SHAT = 0.000000000000000D+00 + LIMHEL = 0.000000000000000D+00 + PTJ = 2.000000000000000D+01 PTB = 0.000000000000000D+00 diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/Source/setrun.f b/epochX/cudacpp/smeft_gg_tttt.mad/Source/setrun.f index 9e9ef7fdbd..dc6caef748 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/Source/setrun.f +++ b/epochX/cudacpp/smeft_gg_tttt.mad/Source/setrun.f @@ -162,9 +162,21 @@ subroutine setrun C Fill common block for Les Houches init info do i=1,2 if(lpp(i).eq.1.or.lpp(i).eq.2) then - idbmup(i)=2212 + if (nb_proton(i).eq.1.and.nb_neutron(i).eq.0) then + idbmup(i)=2212 + elseif (nb_proton(i).eq.0.and.nb_neutron(i).eq.1) then + idbmup(i)=2112 + else + idbmup(i) = 1000000000 + (nb_proton(i)+nb_neutron(i))*10 + $ + nb_proton(i)*10000 + endif elseif(lpp(i).eq.-1.or.lpp(i).eq.-2) then - idbmup(i)=-2212 + if (nb_proton(i).eq.1.and.nb_neutron(i).eq.0) then + idbmup(i)=-2212 + else + idbmup(i) = -1*(1000000000 + (nb_proton(i)+nb_neutron(i))*10 + $ + nb_proton(i)*10000) + endif elseif(lpp(i).eq.3) then idbmup(i)=11 elseif(lpp(i).eq.-3) then diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/MGVersion.txt b/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/MGVersion.txt index 9d3a5c0ba0..a806d3938c 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/MGVersion.txt +++ b/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/MGVersion.txt @@ -1 +1 @@ -3.5.3_lo_vect \ No newline at end of file +3.6.0_lo_vect \ No newline at end of file diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/P1_gg_ttxttx/CPPProcess.cc b/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/P1_gg_ttxttx/CPPProcess.cc index bcac2c3f49..9f314a5390 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/P1_gg_ttxttx/CPPProcess.cc +++ b/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/P1_gg_ttxttx/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/P1_gg_ttxttx/CPPProcess.h b/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/P1_gg_ttxttx/CPPProcess.h index 0b15804ba8..d6b7f76091 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/P1_gg_ttxttx/CPPProcess.h +++ b/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/P1_gg_ttxttx/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/P1_gg_ttxttx/auto_dsig.f b/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/P1_gg_ttxttx/auto_dsig.f index ad9980333b..f327786853 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/P1_gg_ttxttx/auto_dsig.f +++ b/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/P1_gg_ttxttx/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1134,11 +1134,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1148,32 +1149,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/P1_gg_ttxttx/auto_dsig1.f b/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/P1_gg_ttxttx/auto_dsig1.f index d4fae9f441..e0844348aa 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/P1_gg_ttxttx/auto_dsig1.f +++ b/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/P1_gg_ttxttx/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -101,6 +101,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -217,7 +219,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -281,7 +283,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -320,9 +322,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -338,6 +341,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -485,11 +490,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -589,9 +589,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -752,3 +754,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/P1_gg_ttxttx/driver.f b/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/P1_gg_ttxttx/driver.f index 526cc3b0ae..f7f23196eb 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/P1_gg_ttxttx/driver.f +++ b/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/P1_gg_ttxttx/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/P1_gg_ttxttx/matrix1.f b/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/P1_gg_ttxttx/matrix1.f index c1df290c34..631bf2245d 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/P1_gg_ttxttx/matrix1.f +++ b/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/P1_gg_ttxttx/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -23,6 +23,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=64) INTEGER NGRAPHS @@ -46,8 +48,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -56,26 +58,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -86,7 +85,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -96,26 +94,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,6) /-1,-1,-1, 1,-1, 1/ DATA (NHEL(I, 2),I=1,6) /-1,-1,-1, 1,-1,-1/ DATA (NHEL(I, 3),I=1,6) /-1,-1,-1, 1, 1, 1/ @@ -191,8 +188,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -201,11 +197,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=12 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=12 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -215,12 +211,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -232,7 +227,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -261,35 +257,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -361,7 +355,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/cluster.f b/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/cluster.f index 649e46f4e9..b8995283ed 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/cluster.f +++ b/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/cluster.f @@ -552,6 +552,8 @@ logical function cluster(p, ivec) if (btest(mlevel,1)) $ write (*,*)'New event' + iwin = 0 + jwin = 0 cluster=.false. clustered=.false. do i=0,3 @@ -663,7 +665,8 @@ logical function cluster(p, ivec) c initialize graph storage igraphs(0)=0 nleft=nexternal -c cluster +c cluster + if (iwin.eq.0.or.jwin.eq.0) stop 21 do n=1,nexternal-2 c combine winner imocl(n)=imap(iwin,2)+imap(jwin,2) diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/proc_characteristics b/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/proc_characteristics index 6f1aee2300..7d14ce32dc 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/proc_characteristics +++ b/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/proc_characteristics @@ -17,6 +17,8 @@ splitting_types = [] perturbation_order = [] limitations = [] + ew_sudakov = False hel_recycling = False single_color = False nlo_mixed_expansion = True + gauge = unitary diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/refine.sh b/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/refine.sh index afb9b99ad1..b46170ba23 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/refine.sh +++ b/epochX/cudacpp/smeft_gg_tttt.mad/SubProcesses/refine.sh @@ -57,7 +57,11 @@ j=%(directory)s for((try=1;try<=16;try+=1)); do if [ "$keeplog" = true ] ; then + if [[ -e ../madevent ]];then ../madevent 2>&1 >> $k &1 >> $k &1 >> log.txt &1 >> log.txt &1 >> $k \w*)>') - pat_end=re.compile('\w*)>') + pat_begin=re.compile(r'<(?P\w*)>') + pat_end=re.compile(r'\w*)>') tag_to_file={'slha':'param_card.dat', 'mgruncard':'run_card.dat', @@ -319,7 +319,7 @@ def check_pid(self, pid2label): def get_lha_strategy(self): """get the lha_strategy: how the weight have to be handle by the shower""" - if not self["init"]: + if "init" not in self or not self["init"]: raise Exception("No init block define") data = self["init"].split('\n')[0].split() @@ -537,7 +537,8 @@ def charge_card(self, tag): self.param_card = param_card_reader.ParamCard(param_card) return self.param_card elif tag == 'mgruncard': - self.run_card = RunCard(self[tag], unknown_warning=False) + with misc.TMP_variable(RunCard, 'allow_scan', True): + self.run_card = RunCard(self[tag], consistency=False, unknow_warning=False) return self.run_card elif tag == 'mg5proccard': proc_card = self[tag].split('\n') @@ -976,6 +977,8 @@ class ConfigFile(dict): """ a class for storing/dealing with input file. """ + allow_scan = False + def __init__(self, finput=None, **opt): """initialize a new instance. input can be an instance of MadLoopParam, a file, a path to a file, or simply Nothing""" @@ -993,6 +996,7 @@ def __init__(self, finput=None, **opt): # Initialize it with all the default value self.user_set = set() self.auto_set = set() + self.scan_set = {} #key -> type of list (int/float/bool/str/... for scan self.system_only = set() self.lower_to_case = {} self.list_parameter = {} #key -> type of list (int/float/bool/str/... @@ -1109,6 +1113,8 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): #1. check if the parameter is set to auto -> pass it to special if lower_name in self: targettype = type(dict.__getitem__(self, lower_name)) + if lower_name in self.scan_set: + targettype = self.scan_set[lower_name] if targettype != str and isinstance(value, str) and value.lower() == 'auto': self.auto_set.add(lower_name) if lower_name in self.user_set: @@ -1118,13 +1124,26 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): return elif lower_name in self.auto_set: self.auto_set.remove(lower_name) - + + + #1. check if the parameter is set to auto -> pass it to special + scan_targettype = None + if self.allow_scan and isinstance(value, str) and value.strip().startswith('scan'): + if lower_name in self.user_set: + self.user_set.remove(lower_name) + self.scan_set[lower_name] = type(self[lower_name]) + dict.__setitem__(self, lower_name, value) + #keep old value. + self.post_set(lower_name,value, change_userdefine, raiseerror) + return + elif lower_name in self.scan_set: + scan_targettype = self.scan_set[lower_name] + del self.scan_set[lower_name] + # 2. Find the type of the attribute that we want if lower_name in self.list_parameter: targettype = self.list_parameter[lower_name] - - if isinstance(value, str): # split for each comma/space value = value.strip() @@ -1248,8 +1267,11 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): if change_userdefine: self.user_set.add(lower_name) return self.post_set(lower_name, None, change_userdefine, raiseerror) - elif name in self: - targettype = type(self[name]) + elif name in self: + if scan_targettype: + targettype = targettype + else: + targettype = type(self[name]) else: logger.debug('Trying to add argument %s in %s. ' % (name, self.__class__.__name__) +\ 'This argument is not defined by default. Please consider adding it.') @@ -1262,7 +1284,7 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): if change_userdefine: self.user_set.add(lower_name) return self.post_set(lower_name, None, change_userdefine, raiseerror) - + value = self.format_variable(value, targettype, name=name) #check that the value is allowed: if lower_name in self.allowed_value and '*' not in self.allowed_value[lower_name]: @@ -1444,7 +1466,7 @@ def format_variable(value, targettype, name="unknown"): value =int(value[:-1]) * convert[value[-1]] elif '/' in value or '*' in value: try: - split = re.split('(\*|/)',value) + split = re.split(r'(\*|/)',value) v = float(split[0]) for i in range((len(split)//2)): if split[2*i+1] == '*': @@ -1482,7 +1504,7 @@ def format_variable(value, targettype, name="unknown"): value = float(value) except ValueError: try: - split = re.split('(\*|/)',value) + split = re.split(r'(\*|/)',value) v = float(split[0]) for i in range((len(split)//2)): if split[2*i+1] == '*': @@ -1491,7 +1513,10 @@ def format_variable(value, targettype, name="unknown"): v /= float(split[2*i+2]) except: v=0 - raise InvalidCmd("%s can not be mapped to a float" % value) + if "scan" in value: + raise InvalidCmd("%s is not supported here. Note that scan command can not be present simultaneously in the run_card and param_card." % value) + else: + raise InvalidCmd("%s can not be mapped to a float" % value) finally: value = v else: @@ -1737,10 +1762,12 @@ def default_setup(self): self.add_param('splitting_types',[], typelist=str) self.add_param('perturbation_order', [], typelist=str) self.add_param('limitations', [], typelist=str) + self.add_param('ew_sudakov', False) self.add_param('hel_recycling', False) self.add_param('single_color', True) self.add_param('nlo_mixed_expansion', True) - + self.add_param('gauge', 'U') + def read(self, finput): """Read the input file, this can be a path to a file, a file object, a str with the content of the file.""" @@ -3104,7 +3131,7 @@ def write(self, output_file, template=None, python_template=False, # do not write hidden parameter not hidden for this template # if python_template: - written = written.union(set(re.findall('\%\((\w*)\)s', open(template,'r').read(), re.M))) + written = written.union(set(re.findall(r'\%\((\w*)\)s', open(template,'r').read(), re.M))) to_write = to_write.union(set(self.hidden_param)) to_write = to_write.difference(written) @@ -3157,7 +3184,6 @@ def get_value_from_include(self, path, list_of_params, output_dir): if path does not exists return the current value in self for all parameter""" #WARNING DOES NOT HANDLE LIST/DICT so far - misc.sprint(output_dir, path) # handle case where file is missing if not os.path.exists(pjoin(output_dir,path)): misc.sprint("include file not existing", pjoin(output_dir,path)) @@ -3259,7 +3285,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): text = open(path,'r').read() #misc.sprint(text) f77_type = ['real*8', 'integer', 'double precision', 'logical'] - pattern = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I+re.M) for fct in pattern.findall(text): fsock = file_writers.FortranWriter(tmp,'w') @@ -3287,6 +3313,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): starttext = open(pjoin(outdir, path+'.orig')).read() fsock.remove_routine(starttext, to_mod[path][0]) for text in to_mod[path][1]: + text = self.retro_compatible_custom_fct(text) fsock.writelines(text) fsock.close() if not filecmp.cmp(pjoin(outdir, path), pjoin(outdir, path+'.tmp')): @@ -3303,7 +3330,33 @@ def edit_dummy_fct_from_file(self, filelist, outdir): files.mv(pjoin(outdir,path+'.orig'), pjoin(outdir, path)) + @staticmethod + def retro_compatible_custom_fct(lines, mode=None): + f77_type = ['real*8', 'integer', 'double precision', 'logical'] + function_pat = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + % {'type':'|'.join(f77_type)}, re.I+re.M) + include_pat = re.compile(r"\s+include\s+[\'\"]([\w\./]*)") + + assert isinstance(lines, list) + sol = [] + + if mode is None or 'vector.inc' in mode: + search = True + for i,line in enumerate(lines[:]): + if search and re.search(include_pat, line): + name = re.findall(include_pat, line)[0] + misc.sprint('DETECTED INCLUDE', name) + if 'vector.inc' in name: + search = False + if 'run.inc' in name: + sol.append(" include 'vector.inc'") + search = False + sol.append(line) + if re.search(function_pat, line): + misc.sprint("DETECTED FCT") + search = True + return sol def guess_entry_fromname(self, name, value): """ @@ -3346,7 +3399,7 @@ def update_typelist(value, name, opts): #handle metadata opts = {} forced_opts = [] - for key,val in re.findall("\<(?P[_\-\w]+)\=(?P[^>]*)\>", str(name)): + for key,val in re.findall(r"\<(?P[_\-\w]+)\=(?P[^>]*)\>", str(name)): forced_opts.append(key) if val in ['True', 'False']: opts[key] = eval(val) @@ -3681,11 +3734,22 @@ def write_autodef(self, output_dir, output_file=None): out = ["%s\n" %l for l in out] fsock.writelines(out) - @staticmethod - def get_idbmup(lpp): + def get_idbmup(self, lpp, beam=1): """return the particle colliding pdg code""" if lpp in (1,2, -1,-2): - return math.copysign(2212, lpp) + target = 2212 + if 'nb_proton1' in self: + nbp = self['nb_proton%s' % beam] + nbn = self['nb_neutron%s' % beam] + if nbp == 1 and nbn ==0: + target = 2212 + elif nbp==0 and nbn ==1: + target = 2112 + else: + target = 1000000000 + target += 10 * (nbp+nbn) + target += 10000 * nbp + return math.copysign(target, lpp) elif lpp in (3,-3): return math.copysign(11, lpp) elif lpp in (4,-4): @@ -3701,8 +3765,8 @@ def get_banner_init_information(self): the first line of the block of the lhe file.""" output = {} - output["idbmup1"] = self.get_idbmup(self['lpp1']) - output["idbmup2"] = self.get_idbmup(self['lpp2']) + output["idbmup1"] = self.get_idbmup(self['lpp1'], beam=1) + output["idbmup2"] = self.get_idbmup(self['lpp2'], beam=2) output["ebmup1"] = self["ebeam1"] output["ebmup2"] = self["ebeam2"] output["pdfgup1"] = 0 @@ -3959,7 +4023,8 @@ def check_validity(self, card): dict.__setitem__(card, 'pdlabel1', card['pdlabel']) dict.__setitem__(card, 'pdlabel2', card['pdlabel']) - if abs(card['lpp1']) == 1 == abs(card['lpp2']) and card['pdlabel1'] != card['pdlabel2']: + if isinstance(card['lpp1'],int) and isinstance(card['lpp2'],int) and \ + abs(card['lpp1']) == 1 == abs(card['lpp2']) and card['pdlabel1'] != card['pdlabel2']: raise InvalidRunCard("Assymetric beam pdf not supported for proton-proton collision") def status(self, card): @@ -4156,12 +4221,16 @@ def default_setup(self): self.add_param('frame_id', 6, system=True) self.add_param("event_norm", "average", allowed=['sum','average', 'unity'], include=False, sys_default='sum', hidden=True) + self.add_param("keep_log", "normal", include=False, hidden=True, + comment="none: all log send to /dev/null.\n minimal: keep only log for survey of the last run.\n normal: keep only log for survey of all run. \n debug: keep all log (survey and refine)", + allowed=['none', 'minimal', 'normal', 'debug']) #cut self.add_param("auto_ptj_mjj", True, hidden=True) self.add_param("bwcutoff", 15.0) self.add_param("cut_decays", False, cut='d') self.add_param('dsqrt_shat',0., cut=True) self.add_param("nhel", 0, include=False) + self.add_param("limhel", 1e-8, hidden=True, comment="threshold to determine if an helicity contributes when not MC over helicity.") #pt cut self.add_param("ptj", 20.0, cut='j') self.add_param("ptb", 0.0, cut='b') @@ -4842,7 +4911,7 @@ def create_default_for_process(self, proc_characteristic, history, proc_def): # here pick strategy 2 if only one QCD color flow # and for pure multi-jet case jet_id = [21] + list(range(1, self['maxjetflavor']+1)) - if proc_characteristic['single_color']: + if proc_characteristic['gauge'] != 'FD' and proc_characteristic['single_color']: self['sde_strategy'] = 2 #for pure lepton final state go back to sde_strategy=1 pure_lepton=True @@ -5741,9 +5810,10 @@ def check_validity(self): # check that ebeam is bigger than the proton mass. for i in [1,2]: - if self['lpp%s' % i ] not in [1,2]: + # do not for proton mass if not proton PDF (or when scan initialization) + if self['lpp%s' % i ] not in [1,2] or isinstance(self['ebeam%i' % i], str): continue - + if self['ebeam%i' % i] < 0.938: if self['ebeam%i' %i] == 0: logger.warning("At-rest proton mode set: energy beam set to 0.938 GeV") @@ -6193,3 +6263,181 @@ def log_and_update(self, banner, card, par, v): xcard = banner.charge_card(card) xcard[par[0]].param_dict[(par[1],)].value = v xcard.write(os.path.join(self.me_dir, 'Cards', '%s.dat' % card)) + + + + +class RunCardIterator(object): + """A class keeping track of the scan: flag in the param_card and + having an __iter__() function to scan over all the points of the scan. + """ + + logging = True + def __init__(self, input_path=None): + with misc.TMP_variable(RunCard, 'allow_scan', True): + self.run_card = RunCard(input_path, consistency=False) + self.run_card.allow_scan = True + + self.itertag = [] #all the current value use + self.cross = [] # keep track of all the cross-section computed + self.param_order = [] + + def __iter__(self): + """generate the next param_card (in a abstract way) related to the scan. + Technically this generates only the generator.""" + + if hasattr(self, 'iterator'): + return self.iterator + self.iterator = self.iterate() + return self.iterator + + def write(self, path): + self.__iter__.write(path) + + def next(self, autostart=False): + """call the next iteration value""" + try: + iterator = self.iterator + except: + if autostart: + iterator = self.__iter__() + else: + raise + try: + out = next(iterator) + except StopIteration: + del self.iterator + raise + return out + + def iterate(self): + """create the actual generator""" + all_iterators = {} # dictionary of key -> block of object to scan [([param, [values]), ...] + pattern = re.compile(r'''scan\s*(?P\d*)\s*:\s*(?P[^#]*)''', re.I) + + # fill all_iterators with the run_card information + for name in self.run_card.scan_set: + value = self.run_card[name] + try: + key, def_list = pattern.findall(value)[0] + except Exception as error: + misc.sprint(error) + raise Exception("Fail to handle scanning tag in run_card: Please check that the syntax is valid") + if key == '': + key = -1 * len(all_iterators) + if key not in all_iterators: + all_iterators[key] = [] + try: + all_iterators[key].append( (name, eval(def_list))) + except SyntaxError as error: + raise Exception("Fail to handle your scan definition. Please check your syntax:\n entry: %s \n Error reported: %s" %(def_list, error)) + + #prepare to keep track of parameter changing for the report + keys = list(all_iterators.keys()) # need to fix an order for the scan + #store the type of parameter + for key in keys: + for param, values in all_iterators[key]: + self.param_order.append("run_card#%s" % (param)) + + # do the loop + lengths = [list(range(len(all_iterators[key][0][1]))) for key in keys] + from functools import reduce + total = reduce((lambda x, y: x * y),[len(x) for x in lengths]) + for i,positions in enumerate(itertools.product(*lengths)): + self.itertag = [] + if self.logging: + logger.info("Create the next run_card in the scan definition (%s/%s) " %( i+1, total), '$MG:BOLD') + for i, pos in enumerate(positions): + key = keys[i] + for param, values in all_iterators[key]: + # assign the value in the card. + self.run_card[param] = values[pos] + self.itertag.append(values[pos]) + if self.logging: + logger.info("change parameter %s to %s", \ + param, values[pos]) + + + # retrun the current param_card up to next iteration + yield self.run_card + + + def store_entry(self, run_name, cross, error=None, run_card_path=None): + """store the value of the cross-section""" + + if isinstance(cross, dict): + info = dict(cross) + info.update({'bench' : self.itertag, 'run_name': run_name}) + self.cross.append(info) + else: + if error is None: + self.cross.append({'bench' : self.itertag, 'run_name': run_name, 'cross(pb)':cross}) + else: + self.cross.append({'bench' : self.itertag, 'run_name': run_name, 'cross(pb)':cross, 'error(pb)':error}) + + + def write_summary(self, path, order=None, lastline=False, nbcol=20): + """ """ + + if path: + ff = open(path, 'w') + path_events = path.rsplit("/", 1)[0] + #identCard = open(pjoin(path.rsplit("/", 2)[0], "Cards", "ident_card.dat")) + #identLines = identCard.readlines() + #identCard.close() + else: + ff = StringIO.StringIO() + if order: + keys = order + else: + keys = list(self.cross[0].keys()) + if 'bench' in keys: keys.remove('bench') + if 'run_name' in keys: keys.remove('run_name') + keys.sort() + if 'cross(pb)' in keys: + keys.remove('cross(pb)') + keys.append('cross(pb)') + if 'error(pb)' in keys: + keys.remove('error(pb)') + keys.append('error(pb)') + + formatting = "#%s%s%s\n" %('%%-%is ' % (nbcol-1), ('%%-%is ' % (nbcol))* len(self.param_order), + ('%%-%is ' % (nbcol))* len(keys)) + # header + if not lastline: + ff.write(formatting % tuple(['run_name'] + self.param_order + keys)) + formatting = "%s%s%s\n" %('%%-%is ' % (nbcol), ('%%-%ie ' % (nbcol))* len(self.param_order), + ('%%-%ie ' % (nbcol))* len(keys)) + + if not lastline: + to_print = self.cross + else: + to_print = self.cross[-1:] + for info in to_print: + name = info['run_name'] + bench = info['bench'] + data = [] + for k in keys: + if k in info: + data.append(info[k]) + else: + data.append(0.) + ff.write(formatting % tuple([name] + bench + data)) + ff_single = open(pjoin(path_events, name, "params.dat"), "w") + for i_bench in range(0, len(bench)): + ff_single.write(self.param_order[i_bench] + " = " + str(bench[i_bench]) +"\n") + ff_single.close() + + if not path: + return ff.getvalue() + + + def get_next_name(self, run_name): + """returns a smart name for the next run""" + + if '_' in run_name: + name, value = run_name.rsplit('_',1) + if value.isdigit(): + return '%s_%02i' % (name, float(value)+1) + # no valid '_' in the name + return '%s_scan_02' % run_name diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/check_param_card.py b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/check_param_card.py index 71089d7480..bc785b5de6 100755 --- a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/check_param_card.py +++ b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/check_param_card.py @@ -649,7 +649,7 @@ def write_inc_file(self, outpath, identpath, default, need_mp=False): #check if we need to write the value of scale for some block if os.path.exists(input_inc): text = open(input_inc).read() - scales = list(set(re.findall('mdl__(\w*)__scale', text, re.I))) + scales = list(set(re.findall(r'mdl__(\w*)__scale', text, re.I))) else: scales = [] @@ -1000,10 +1000,12 @@ def iterate(self): self.param_order.append("%s#%s" % (param.lhablock, '_'.join(repr(i) for i in param.lhacode))) # do the loop lengths = [list(range(len(all_iterators[key][0][1]))) for key in keys] - for positions in itertools.product(*lengths): + from functools import reduce + total = reduce((lambda x, y: x * y),[len(x) for x in lengths]) + for i,positions in enumerate(itertools.product(*lengths)): self.itertag = [] if self.logging: - logger.info("Create the next param_card in the scan definition", '$MG:BOLD') + logger.info("Create the next param_card in the scan definition (%s/%s)" % (i+1,total), '$MG:BOLD') for i, pos in enumerate(positions): key = keys[i] for param, values in all_iterators[key]: diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/cluster.py b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/cluster.py index 9a893f630d..1ad860e04f 100755 --- a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/cluster.py +++ b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/cluster.py @@ -646,7 +646,10 @@ def worker(self): if os.path.exists(exe) and not exe.startswith('/'): exe = './' + exe if isinstance(opt['stdout'],str): - opt['stdout'] = open(opt['stdout'],'w') + if opt['stdout'] == '/dev/null': + opt['stdout'] = os.open(os.devnull, os.O_RDWR) + else: + opt['stdout'] = open(opt['stdout'],'w') if opt['stderr'] == None: opt['stderr'] = subprocess.STDOUT if arg: @@ -671,11 +674,12 @@ def worker(self): self.pids.put(pid) # the function should return 0 if everything is fine # the error message otherwise - returncode = exe(*arg, **opt) - if returncode != 0: - logger.warning("fct %s does not return 0. Stopping the code in a clean way. The error was:\n%s", exe, returncode) + try: + returncode = exe(*arg, **opt) + except Exception as error: + #logger.warning("fct %s does not return 0. Stopping the code in a clean way. The error was:\n%s", exe, returncode) self.stoprequest.set() - self.remove("fct %s does not return 0:\n %s" % (exe, returncode)) + self.remove("fct %s does raise %s\n %s" % (exe, error)) except Exception as error: self.fail_msg = sys.exc_info() logger.warning(str(error)) @@ -700,7 +704,7 @@ def worker(self): def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, - log=None, required_output=[], nb_submit=0): + log=None, required_output=[], nb_submit=0, python_opts={}): """submit a job on multicore machine""" # open threads if needed @@ -720,7 +724,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, return tag else: # python function - self.queue.put((tag, prog, argument, {})) + self.queue.put((tag, prog, argument, python_opts)) self.submitted.put(1) return tag @@ -908,6 +912,10 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None else: requirement = '' + if 'cluster_walltime' in self.options and self.options['cluster_walltime']\ + and self.options['cluster_walltime'] != 'None': + requirement+='\n MaxRuntime = %s' % self.options['cluster_walltime'] + if cwd is None: cwd = os.getcwd() if stdout is None: @@ -936,7 +944,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None #Submitting job(s). #Logging submit event(s). #1 job(s) submitted to cluster 2253622. - pat = re.compile("submitted to cluster (\d*)",re.MULTILINE) + pat = re.compile(r"submitted to cluster (\d*)",re.MULTILINE) output = output.decode(errors='ignore') try: id = pat.search(output).groups()[0] @@ -1025,7 +1033,7 @@ def submit2(self, prog, argument=[], cwd=None, stdout=None, stderr=None, #Logging submit event(s). #1 job(s) submitted to cluster 2253622. output = output.decode(errors='ignore') - pat = re.compile("submitted to cluster (\d*)",re.MULTILINE) + pat = re.compile(r"submitted to cluster (\d*)",re.MULTILINE) try: id = pat.search(output).groups()[0] except: @@ -1588,7 +1596,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None output = a.communicate()[0].decode(errors='ignore') #Your job 874511 ("test.sh") has been submitted - pat = re.compile("Your job (\d*) \(",re.MULTILINE) + pat = re.compile(r"Your job (\d*) \(",re.MULTILINE) try: id = pat.search(output).groups()[0] except: @@ -1606,7 +1614,7 @@ def control_one_job(self, id): if not status: return 'F' #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 - pat = re.compile("^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") + pat = re.compile(r"^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") stat = '' for line in status.stdout.read().decode(errors='ignore').split('\n'): if not line: @@ -1636,7 +1644,7 @@ def control(self, me_dir=None): cmd = 'qstat -s %s' % statusflag status = misc.Popen([cmd], shell=True, stdout=subprocess.PIPE) #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 - pat = re.compile("^(\d+)") + pat = re.compile(r"^(\d+)") for line in status.stdout.read().decode(errors='ignore').split('\n'): line = line.strip() try: @@ -1715,6 +1723,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None stderr = stdout if log is None: log = '/dev/null' + command = ['sbatch', '-o', stdout, '-J', me_dir, @@ -1726,6 +1735,12 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None command.insert(1, '-p') command.insert(2, self.cluster_queue) + if 'cluster_walltime' in self.options and self.options['cluster_walltime']\ + and self.options['cluster_walltime'] != 'None': + command.insert(1, '-t') + command.insert(2, self.options['cluster_walltime']) + + a = misc.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -1736,7 +1751,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None id = output_arr[3].rstrip() if not id.isdigit(): - id = re.findall('Submitted batch job ([\d\.]+)', ' '.join(output_arr)) + id = re.findall(r'Submitted batch job ([\d\.]+)', ' '.join(output_arr)) if not id or len(id)>1: raise ClusterManagmentError( 'fail to submit to the cluster: \n%s' \ diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/combine_runs.py b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/combine_runs.py index 4de6b84ec0..b1e8c88eac 100755 --- a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/combine_runs.py +++ b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/combine_runs.py @@ -20,6 +20,7 @@ from __future__ import absolute_import import math import os +import shutil import re import logging from six.moves import range @@ -117,6 +118,7 @@ def sum_multichannel(self, channel): #Now read in all of the events and write them #back out with the appropriate scaled weight + to_clean = [] fsock = open(pjoin(channel, 'events.lhe'), 'w') wgt = results.axsec / results.nunwgt tot_nevents, nb_file = 0, 0 @@ -129,8 +131,14 @@ def sum_multichannel(self, channel): nw = self.copy_events(fsock, pjoin(path,'events.lhe'), wgt) tot_nevents += nw nb_file += 1 + to_clean.append(path) logger.debug("Combined %s file generating %s events for %s " , nb_file, tot_nevents, channel) - + for path in to_clean: + try: + shutil.rmtree(path) + except Exception as error: + pass + @staticmethod def get_fortran_str(nb): data = '%E' % nb @@ -162,6 +170,7 @@ def copy_events(self, fsock, input, new_wgt): fsock.write(line) old_line = line return nb_evt + def get_channels(self, proc_path): """Opens file symfact.dat to determine all channels""" sympath = os.path.join(proc_path, 'symfact.dat') diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/common_run_interface.py b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/common_run_interface.py index 9bd9d9cb50..194f0cdfbd 100755 --- a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/common_run_interface.py +++ b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/common_run_interface.py @@ -23,6 +23,7 @@ import ast import logging import math +import copy import os import re import shutil @@ -181,6 +182,23 @@ def help_add_time_of_flight(self): logger.info(' threshold option allows to change the minimal value required to') logger.info(' a non zero value for the particle (default:1e-12s)') + def help_print_results(self): + logger.info("syntax: print_results [RUN_NAME] [OPTIONS]") + logger.info("-- print the results of the previous run on the screen") + logger.info(" If not RUN_NAME is provided, the information of all run") + logger.info(" are printed one after another.") + logger.info("") + logger.info(" supported options:") + logger.info(" ------------------") + logger.info(" --format=full|short # default is full") + logger.info(" full format contains banner/... ") + logger.info(" while short is a simple multi-column format (nice for plotting)") + logger.info(" --path=") + logger.info(" allow to write the information to a file.") + logger.info(" --mode=w|a #default is w ") + logger.info(" when the information is printed to a file, you can choose ") + logger.info(" to either overwrite the file if already exists (w mode)") + logger.info(" to append the information at the end of the file (a mode)") class CheckValidForCmd(object): @@ -727,7 +745,7 @@ def __init__(self, me_dir, options, *args, **opts): if not self.proc_characteristics['ninitial']: # Get number of initial states nexternal = open(pjoin(self.me_dir,'Source','nexternal.inc')).read() - found = re.search("PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) + found = re.search(r"PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) self.ninitial = int(found.group(1)) else: self.ninitial = self.proc_characteristics['ninitial'] @@ -989,7 +1007,22 @@ def do_treatcards(self, line, amcatnlo=False): #raise Exception, "%s %s %s" % (sys.path, os.path.exists(pjoin(self.me_dir,'bin','internal', 'ufomodel')), os.listdir(pjoin(self.me_dir,'bin','internal', 'ufomodel'))) import ufomodel as ufomodel zero = ufomodel.parameters.ZERO - if self.proc_characteristics['nlo_mixed_expansion']: + no_width = [] + + if self.proc_characteristics['ew_sudakov']: + # if the sudakov approximation is used, force all particle widths to zero + # unless the complex mass scheme is used + if not self.proc_characteristics['complex_mass_scheme']: + no_width = [p for p in ufomodel.all_particles if p.width != zero] + logger.info('''Setting all particle widths to zero (needed for EW Sudakov approximation).''','$MG:BOLD') + # also, check that the model features the 'ntadpole' parameter, and set it to 1 + try: + param_card['tadpole'].get(1).value = 1. + logger.info('''Setting the value of ntadpole to 1 (needed for EW Sudakov approximation).''','$MG:BOLD') + except KeyError: + logger.warning('''The model has no 'ntadpole' parameter. The Sudakov approximation for EW corrections may give wrong results.''') + + elif self.proc_characteristics['nlo_mixed_expansion']: no_width = [p for p in ufomodel.all_particles if (str(p.pdg_code) in pids or str(-p.pdg_code) in pids) and p.width != zero] @@ -1168,17 +1201,17 @@ def detect_card_type(path): 'Begin Minpts', 'gridpack', 'ebeam1', - 'block\s+mw_run', + r'block\s+mw_run', 'BLOCK', 'DECAY', 'launch', 'madspin', - 'transfer_card\.dat', + r'transfer_card\.dat', 'set', 'main:numberofevents', # pythia8, '@MG5aMC skip_analysis', #MA5 --both-- - '@MG5aMC\s*inputs\s*=\s*\*\.(?:hepmc|lhe)', #MA5 --both-- - '@MG5aMC\s*reconstruction_name', # MA5 hadronique + r'@MG5aMC\s*inputs\s*=\s*\*\.(?:hepmc|lhe)', #MA5 --both-- + r'@MG5aMC\s*reconstruction_name', # MA5 hadronique '@MG5aMC', # MA5 hadronique 'run_rivet_later', # Rivet ] @@ -1237,7 +1270,7 @@ def detect_card_type(path): return 'madspin_card.dat' if 'decay' in text: # need to check if this a line like "decay w+" or "set decay" - if re.search("(^|;)\s*decay", fulltext, re.M): + if re.search(r"(^|;)\s*decay", fulltext, re.M): return 'madspin_card.dat' else: return 'reweight_card.dat' @@ -2074,6 +2107,12 @@ def check_multicore(self): # ensure that the run_card is present if not hasattr(self, 'run_card'): self.run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat')) + # Below reads the run_card in the LHE file rather than the Cards/run_card + import madgraph.various.lhe_parser as lhe_parser + args_path = list(args) + self.check_decay_events(args_path) + self.run_card = banner_mod.RunCard(lhe_parser.EventFile(args_path[0]).get_banner()['mgruncard']) + # we want to run this in a separate shell to avoid hard f2py crash command = [sys.executable] @@ -2085,6 +2124,12 @@ def check_multicore(self): command.append('--web') command.append('reweight') + ## TV: copy the event file as backup before starting reweighting + event_path = pjoin(self.me_dir, 'Events', self.run_name, 'events.lhe.gz') + event_path_backup = pjoin(self.me_dir, 'Events', self.run_name, 'events_orig.lhe.gz') + if os.path.exists(event_path) and not os.path.exists(event_path_backup): + shutil.copyfile(event_path, event_path_backup) + ######### START SINGLE CORE MODE ############ if self.options['nb_core']==1 or self.run_card['nevents'] < 101 or not check_multicore(self): if self.run_name: @@ -2200,7 +2245,7 @@ def check_multicore(self): cross_sections[key] = value / (nb_event+1) lhe.remove() for key in cross_sections: - if key == 'orig' or key.isdigit(): + if key == 'orig' or (key.isdigit() and not (key[0] == '2')): continue logger.info('%s : %s pb' % (key, cross_sections[key])) return @@ -2461,7 +2506,7 @@ def do_add_time_of_flight(self, line): ############################################################################ def do_print_results(self, line): - """Not in help:Print the cross-section/ number of events for a given run""" + """Print the cross-section/ number of events for a given run""" args = self.split_arg(line) options={'path':None, 'mode':'w', 'format':'full'} @@ -2942,10 +2987,15 @@ def do_rivet(self, line, postprocess=False): #2 Prepare Rivet setup environments rivet_path = self.options['rivet_path'] yoda_path = self.options['yoda_path'] + fastjet_path = subprocess.Popen([self.options['fastjet'], '--prefix'], + stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip() + set_env = set_env + "export PATH={0}:$PATH\n".format(pjoin(rivet_path, 'bin')) set_env = set_env + "export PATH={0}:$PATH\n".format(pjoin(yoda_path, 'bin')) set_env = set_env + "export LD_LIBRARY_PATH={0}:{1}:$LD_LIBRARY_PATH\n".format(pjoin(rivet_path, 'lib'), pjoin(rivet_path, 'lib64')) set_env = set_env + "export LD_LIBRARY_PATH={0}:{1}:$LD_LIBRARY_PATH\n".format(pjoin(yoda_path, 'lib'), pjoin(yoda_path, 'lib64')) + set_env = set_env + "export LD_LIBRARY_PATH={0}:$LD_LIBRARY_PATH\n".format(pjoin(self.options['hepmc_path'], 'lib')) + set_env = set_env + "export LD_LIBRARY_PATH={0}:$LD_LIBRARY_PATH\n".format(pjoin(fastjet_path, 'lib')) major, minor = sys.version_info[0:2] set_env = set_env + "export PYTHONPATH={0}:{1}:$PYTHONPATH\n".format(pjoin(rivet_path, 'lib', 'python%s.%s' %(major,minor), 'site-packages'),\ pjoin(rivet_path, 'lib64', 'python%s.%s' %(major,minor), 'site-packages')) @@ -4311,8 +4361,8 @@ def complete_compute_widths(self, text, line, begidx, endidx, formatting=True): else: completion = {} completion['options'] = self.list_completion(text, - ['--path=', '--output=', '--min_br=0.\$', '--nlo', - '--precision_channel=0.\$', '--body_decay=']) + ['--path=', '--output=', r'--min_br=0.\$', '--nlo', + r'--precision_channel=0.\$', '--body_decay=']) return self.deal_multiple_categories(completion, formatting) @@ -4821,9 +4871,9 @@ class AskforEditCard(cmd.OneLinePathCompletion): (return False to repeat the question) """ - all_card_name = ['param_card', 'run_card', 'pythia_card', 'pythia8_card', + all_card_name = ['param_card', 'run_card', 'pythia_card', 'pythia8_card', 'fo_analysis_card' 'madweight_card', 'MadLoopParams', 'shower_card', 'rivet_card'] - to_init_card = ['param', 'run', 'madweight', 'madloop', + to_init_card = ['param', 'run', 'madweight', 'madloop', 'fo_analysis', 'shower', 'pythia8','delphes','madspin', 'rivet'] special_shortcut = {} special_shortcut_help = {} @@ -4853,6 +4903,7 @@ def load_default(self): self.has_PY8 = False self.has_delphes = False self.has_rivet = False + self.has_fo_card = False self.paths = {} self.update_block = [] @@ -5058,7 +5109,8 @@ def init_run(self, cards): try: - self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning') + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning') except IOError: self.run_card = {} try: @@ -5248,6 +5300,15 @@ def init_delphes(self, cards): self.has_delphes = True return [] + def init_fo_analysis(self, cards): + self.has_fo_card = False + if not self.get_path('FO_analyse', cards): + return [] + self.has_fo_card = True + self.fo_card = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse']) + self.fo_card_def = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse_default']) + return list(self.fo_card.string_vars) + def set_CM_velocity(self, line): """compute sqrts from the velocity in the center of mass frame""" @@ -5508,6 +5569,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): allowed['delphes_card'] = '' if self.has_rivet: allowed['rivet_card'] = '' + if self.has_fo_card: + allowed['fo_card'] = '' elif len(args) == 2: if args[1] == 'run_card': @@ -5532,6 +5595,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): allowed = {'delphes_card':'default'} elif args[1] == 'rivet_card': allowed = {'rivet_card':'default'} + elif args[1] == 'fo_card': + allowed = {'fo_card':'default'} else: allowed = {'value':''} @@ -5539,6 +5604,7 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): start = 1 if args[1] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', 'MadLoop_card','pythia8_card','delphes_card','plot_card', + 'fo_card', 'madanalysis5_parton_card','madanalysis5_hadron_card', 'rivet_card']: start = 2 @@ -5576,6 +5642,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): categories.append('delphes_card') if self.has_rivet: categories.append('rivet_card') + if self.has_fo_card: + categories.append('fo_card') possibilities['category of parameter (optional)'] = \ self.list_completion(text, categories) @@ -5630,7 +5698,13 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): if 'delphes_card' in allowed: if allowed['delphes_card'] == 'default': opts = ['default', 'atlas', 'cms'] - possibilities['Delphes Card'] = self.list_completion(text, opts) + possibilities['Delphes Card'] = self.list_completion(text, opts) + + if 'fo_card' in allowed: + opts = self.fo_card.string_vars + if allowed['fo_card'] == 'default': + opts.append('default') + possibilities['FO Card'] = self.list_completion(text, opts) if 'value' in list(allowed.keys()): opts = ['default', 'scale'] @@ -5733,21 +5807,28 @@ def do_set(self, line): if args[0] in self.special_shortcut: targettypes , cmd = self.special_shortcut[args[0]] if len(args) != len(targettypes) +1: - logger.warning('shortcut %s requires %s argument' % (args[0], len(targettypes))) - if len(args) < len(targettypes) +1: - return + if len(targettypes) == 1 and args[len(targettypes)].startswith('scan'): + args = args[:len(targettypes)] + [' '.join(args[len(targettypes):])] + targettypes = [str] else: - logger.warning('additional argument will be ignored') + logger.warning('shortcut %s requires %s argument' % (args[0], len(targettypes))) + if len(args) < len(targettypes) +1: + return + else: + logger.warning('additional argument will be ignored') values ={} for i, argtype in enumerate(targettypes): try: - values = {str(i): banner_mod.ConfigFile.format_variable(args[i+1], argtype, args[0])} + values[str(i)] = banner_mod.ConfigFile.format_variable(args[i+1], argtype, args[0]) except ValueError as e: logger.warning("Wrong argument: The entry #%s should be of type %s.", i+1, argtype) return except InvalidCmd as e: - logger.warning(str(e)) - return + if isinstance(args[i+1], str) and args[i+1].startswith('scan'): + values[str(i)] = args[i+1] + else: + logger.warning(str(e)) + return #else: # logger.warning("too many argument for this command") # return @@ -5787,7 +5868,7 @@ def do_set(self, line): if os.path.exists(pythia_path): logger.info('add line QCUT = %s in pythia_card.dat' % args[1]) p_card = open(pythia_path,'r').read() - p_card, n = re.subn('''^\s*QCUT\s*=\s*[\de\+\-\.]*\s*$''', + p_card, n = re.subn(r'''^\s*QCUT\s*=\s*[\de\+\-\.]*\s*$''', ''' QCUT = %s ''' % args[1], \ p_card, flags=(re.M+re.I)) if n==0: @@ -5801,7 +5882,7 @@ def do_set(self, line): if os.path.exists(pythia_path): logger.info('add line SHOWERKT = %s in pythia_card.dat' % args[1].upper()) p_card = open(pythia_path,'r').read() - p_card, n = re.subn('''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''', + p_card, n = re.subn(r'''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''', ''' SHOWERKT = %s ''' % args[1].upper(), \ p_card, flags=(re.M+re.I)) if n==0: @@ -5856,7 +5937,7 @@ def do_set(self, line): pjoin(self.me_dir,'Cards', 'delphes_card.dat')) return - if args[0] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', + if args[0] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', 'fo_card', 'delphes_card','madanalysis5_hadron_card','madanalysis5_parton_card','rivet_card']: if args[1] == 'default': @@ -6176,6 +6257,22 @@ def do_set(self, line): self.setRivet(args[start], value, default=default) self.rivet_card.write(self.paths['rivet'], self.paths['rivet_default']) + elif self.has_fo_card and (card in ['', 'fo_card'])\ + and args[start].lower() in [k.lower() for k in self.fo_card.string_vars]: + + if args[start] in self.conflict and card == '': + text = 'ambiguous name (present in more than one card). Please specify which card to edit' + logger.warning(text) + return + if args[start+1] == 'default': + value = self.fo_card_default[args[start]] + default = True + else: + value = args[start+1] + default = False + self.fo_card[args[start]] = value + self.modified_card.add('fo_card') + #INVALID -------------------------------------------------------------- else: logger.warning('invalid set command %s ' % line) @@ -6222,12 +6319,13 @@ def setM(self, block, name, value): def setR(self, name, value): - if self.mother_interface.inputfile: - self.run_card.set(name, value, user=True, raiseerror=True) - else: - self.run_card.set(name, value, user=True) - new_value = self.run_card.get(name) - logger.info('modify parameter %s of the run_card.dat to %s' % (name, new_value),'$MG:BOLD') + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + if self.mother_interface.inputfile: + self.run_card.set(name, value, user=True, raiseerror=True) + else: + self.run_card.set(name, value, user=True) + new_value = self.run_card.get(name) + logger.info('modify parameter %s of the run_card.dat to %s' % (name, new_value),'$MG:BOLD') def setML(self, name, value, default=False): @@ -6314,6 +6412,7 @@ def check_card_consistency(self): proc_charac = self.mother_interface.proc_characteristics if proc_charac['grouped_matrix'] and \ + isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int) and \ abs(self.run_card['lpp1']) == 1 == abs(self.run_card['lpp2']) and \ (self.run_card['nb_proton1'] != self.run_card['nb_proton2'] or self.run_card['nb_neutron1'] != self.run_card['nb_neutron2'] or @@ -6403,41 +6502,42 @@ def check_card_consistency(self): # check that only quark/gluon/photon are in initial beam if lpp=+-1 pdg_in_p = list(range(-6,7))+[21,22] - if (abs(self.run_card['lpp1'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial1'])) \ + if isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int): + if(abs(self.run_card['lpp1'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial1'])) \ or (abs(self.run_card['lpp2'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial2'])): - if 'pythia_card.dat' in self.cards or 'pythia8_card.dat' in self.cards: - path_to_remove = None - if 'pythia_card.dat' in self.cards: - path_to_remove = self.paths['pythia'] - card_to_remove = 'pythia_card.dat' - elif 'pythia8_card.dat' in self.cards: - path_to_remove = self.paths['pythia8'] - card_to_remove = 'pythia8_card.dat' - if path_to_remove: - if 'partonshower' in self.run_card['bypass_check']: + if 'pythia_card.dat' in self.cards or 'pythia8_card.dat' in self.cards: + path_to_remove = None + if 'pythia_card.dat' in self.cards: + path_to_remove = self.paths['pythia'] + card_to_remove = 'pythia_card.dat' + elif 'pythia8_card.dat' in self.cards: + path_to_remove = self.paths['pythia8'] + card_to_remove = 'pythia8_card.dat' + if path_to_remove: + if 'partonshower' in self.run_card['bypass_check']: + logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") + else: + logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') + os.remove(path_to_remove) + self.cards.remove(card_to_remove) + else: + logger.info('Remember that Parton-Shower are not yet ready for such proton component definition (HW implementation in progress).', '$MG:BOLD' ) + elif (abs(self.run_card['lpp1'])==3 and abs(self.run_card['lpp2'])==3): + if 'pythia8_card.dat' in self.cards: + if self.run_card['pdlabel'] == 'isronlyll': + if 'partonshower' not in self.run_card['bypass_check']: + # force that QED shower is on? + for param in ['TimeShower:QEDshowerByQ', 'TimeShower:QEDshowerByL', 'TimeShower:QEDshowerByGamma', 'SpaceShower:QEDshowerByQ', 'SpaceShower:QEDshowerByL']: + if param not in self.PY8Card or \ + (not self.PY8Card[param] and param.lower() not in self.PY8Card.user_set): + logger.warning('Activating QED shower: setting %s to True', param) + self.PY8Card[param] = True + elif 'partonshower' in self.run_card['bypass_check']: logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") - else: + else: logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') - os.remove(path_to_remove) - self.cards.remove(card_to_remove) - else: - logger.info('Remember that Parton-Shower are not yet ready for such proton component definition (HW implementation in progress).', '$MG:BOLD' ) - elif (abs(self.run_card['lpp1'])==3 and abs(self.run_card['lpp2'])==3): - if 'pythia8_card.dat' in self.cards: - if self.run_card['pdlabel'] == 'isronlyll': - if 'partonshower' not in self.run_card['bypass_check']: - # force that QED shower is on? - for param in ['TimeShower:QEDshowerByQ', 'TimeShower:QEDshowerByL', 'TimeShower:QEDshowerByGamma', 'SpaceShower:QEDshowerByQ', 'SpaceShower:QEDshowerByL']: - if param not in self.PY8Card or \ - (not self.PY8Card[param] and param.lower() not in self.PY8Card.user_set): - logger.warning('Activating QED shower: setting %s to True', param) - self.PY8Card[param] = True - elif 'partonshower' in self.run_card['bypass_check']: - logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") - else: - logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') - os.remove(self.paths['pythia8']) - self.cards.remove('pythia8_card.dat') + os.remove(self.paths['pythia8']) + self.cards.remove('pythia8_card.dat') ######################################################################## @@ -6514,7 +6614,8 @@ def check_card_consistency(self): #check relation between lepton PDF // dressed lepton collisions // ... - if abs(self.run_card['lpp1']) != 1 or abs(self.run_card['lpp2']) != 1: + if isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int) and \ + abs(self.run_card['lpp1']) != 1 or abs(self.run_card['lpp2']) != 1: if abs(self.run_card['lpp1']) == abs(self.run_card['lpp2']) == 3: # this can be dressed lepton or photon-flux if proc_charac['pdg_initial1'] in [[11],[-11]] and proc_charac['pdg_initial2'] in [[11],[-11]]: @@ -6732,7 +6833,11 @@ def write_card_param(self): """ write the param_card """ self.param_card.write(self.paths['param']) - + + def write_card_fo_card(self): + """ write the fo_card""" + self.fo_card.write_card_from_template(self.paths['FO_analyse'], self.paths['FO_analyse_default']) + @staticmethod def update_dependent(mecmd, me_dir, param_card, path ,timer=0, run_card=None, lhapdfconfig=None): @@ -7076,7 +7181,7 @@ def do_decay(self, line): #first find the particle particle = line.split('>')[0].strip() logger.info("change madspin_card to define the decay of %s: %s" %(particle, line.strip()), '$MG:BOLD') - particle = particle.replace('+','\+').replace('-','\-') + particle = particle.replace('+',r'\+').replace('-',r'\-') decay_pattern = re.compile(r"^\s*decay\s+%s\s*>[\s\w+-~]*?$" % particle, re.I+re.M) text= open(path).read() text = decay_pattern.sub('', text) @@ -7193,7 +7298,7 @@ def help_edit(self, prefix=True): logger.info( ' --clean remove all previously existing line in the file') logger.info( ' --comment_line="" comment all lines matching the regular expression') logger.info('') - logger.info(' Note: all regular-expression will be prefixed by ^\s*') + logger.info(r' Note: all regular-expression will be prefixed by ^\s*') logger.info('') logger.info( ' example: edit reweight --after_line="change mode\b" change model heft') logger.info( ' edit madspin --after_line="banner" change model XXXX') @@ -7314,7 +7419,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''replace_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[14:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[14:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7344,7 +7449,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''comment_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[14:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[14:-1] nb_mod = 0 for posline,l in enumerate(split): if re.search(pattern, l): @@ -7366,7 +7471,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''before_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[13:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[13:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7383,7 +7488,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern = r'''after_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[12:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[12:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7527,16 +7632,19 @@ def open_file(self, answer): answer = 'plot' else: answer = self.cards[int(answer)-self.integer_bias] - + path = '' if 'madweight' in answer: answer = answer.replace('madweight', 'MadWeight') elif 'MadLoopParams' in answer: answer = self.paths['ML'] elif 'pythia8_card' in answer: answer = self.paths['pythia8'] + elif 'FO_analyse' in answer: + path = self.paths['FO_analyse'] + answer = 'fo_card' if os.path.exists(answer): path = answer - else: + elif not os.path.exists(path): if not '.dat' in answer and not '.lhco' in answer: if answer != 'trigger': path = self.paths[answer] @@ -7595,7 +7703,8 @@ def reload_card(self, path): logger.error('Please re-open the file and fix the problem.') logger.warning('using the \'set\' command without opening the file will discard all your manual change') elif path == self.paths['run']: - self.run_card = banner_mod.RunCard(path) + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + self.run_card = banner_mod.RunCard(path) elif path == self.paths['shower']: self.shower_card = shower_card_mod.ShowerCard(path) elif path == self.paths['ML']: @@ -7614,6 +7723,8 @@ def reload_card(self, path): except: import internal.madweight.Cards as mwcards self.mw_card = mwcards.Card(path) + elif path == self.paths['FO_analyse']: + self.fo_card = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse']) else: logger.debug('not keep in sync: %s', path) return path @@ -7629,6 +7740,9 @@ def scanparamcardhandling(input_path=lambda obj: pjoin(obj.me_dir, 'Cards', 'par iteratorclass=param_card_mod.ParamCardIterator, summaryorder=lambda obj: lambda:None, check_card=lambda obj: CommonRunCmd.static_check_param_card, + run_card_scan=False, + run_card_input= lambda obj: pjoin(obj.me_dir, 'Cards', 'run_card.dat'), + run_card_iteratorclass=banner_mod.RunCardIterator, ): """ This is a decorator for customizing/using scan over the param_card (or technically other) This should be use like this: @@ -7678,7 +7792,60 @@ def __enter__(self): def __exit__(self, ctype, value, traceback ): self.iterator.write(self.path) - def decorator(original_fct): + def scan_over_run_card(original_fct, obj, *args, **opts): + + if isinstance(input_path, str): + card_path = run_card_input + else: + card_path = run_card_input(obj) + + run_card_iterator = run_card_iteratorclass(card_path) + orig_card = copy.deepcopy(run_card_iterator.run_card) + if not run_card_iterator.run_card.scan_set: + return original_fct(obj, *args, **opts) + + + with restore_iterator(orig_card, card_path): + # this with statement ensure that the original card is restore + # whatever happens inside those block + + if not hasattr(obj, 'allow_notification_center'): + obj.allow_notification_center = False + with misc.TMP_variable(obj, 'allow_notification_center', False): + orig_name = get_run_name(obj) + if not orig_name and args[1]: + orig_name = args[1][0] + args = (args[0], args[1][1:]) + #orig_name = "scan_%s" % len(obj.results) + + try: + os.mkdir(pjoin(obj.me_dir, 'Events', orig_name)) + except Exception: + pass + next_name = orig_name + "_00" + + for i,card in enumerate(run_card_iterator): + card.write(card_path) + # still have to check for the auto-wdith + #if i !=0: + next_name = run_card_iterator.get_next_name(next_name) + set_run_name(obj)(next_name) + try: + original_fct(obj, *args, **opts) + except ignoreerror as error: + run_card_iterator.store_entry(next_name, {'exception': error}) + else: + run_card_iterator.store_entry(next_name, store_for_scan(obj)(), run_card_path=card_path) + + #param_card_iterator.write(card_path) #-> this is done by the with statement + name = misc.get_scan_name(orig_name, next_name) + path = result_path(obj) % name + logger.info("write scan results in %s" % path ,'$MG:BOLD') + order = summaryorder(obj)() + run_card_iterator.write_summary(path, order=order) + + + def decorator(original_fct): def new_fct(obj, *args, **opts): if isinstance(input_path, str): @@ -7702,8 +7869,13 @@ def new_fct(obj, *args, **opts): if not param_card_iterator: #first run of the function - original_fct(obj, *args, **opts) - return + if run_card_scan: + scan_over_run_card(original_fct, obj, *args, **opts) + return + else: + #first run of the function + original_fct(obj, *args, **opts) + return with restore_iterator(param_card_iterator, card_path): # this with statement ensure that the original card is restore diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/extended_cmd.py b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/extended_cmd.py index 2f37070580..789976beee 100755 --- a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/extended_cmd.py +++ b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/extended_cmd.py @@ -624,12 +624,12 @@ def complete(self, text, state): compfunc = self.completenames # correct wrong splittion with '\ ' - if line and begidx > 2 and line[begidx-2:begidx] == '\ ': + if line and begidx > 2 and line[begidx-2:begidx] == r'\ ': Ntext = line.split(os.path.sep)[-1] - self.completion_prefix = Ntext.rsplit('\ ', 1)[0] + '\ ' + self.completion_prefix = Ntext.rsplit(r'\ ', 1)[0] + r'\ ' to_rm = len(self.completion_prefix) - 1 Nbegidx = len(line.rsplit(os.path.sep, 1)[0]) + 1 - data = compfunc(Ntext.replace('\ ', ' '), line, Nbegidx, endidx) + data = compfunc(Ntext.replace(r'\ ', ' '), line, Nbegidx, endidx) self.completion_matches = [p[to_rm:] for p in data if len(p)>to_rm] # correct wrong splitting with '-'/"=" @@ -742,7 +742,7 @@ def path_completion(text, base_dir = None, only_dirs = False, completion += [prefix + f for f in ['.'+os.path.sep, '..'+os.path.sep] if \ f.startswith(text) and not prefix.startswith('.')] - completion = [a.replace(' ','\ ') for a in completion] + completion = [a.replace(' ',r'\ ') for a in completion] return completion @@ -1253,7 +1253,7 @@ def check_answer_in_input_file(self, question_instance, default, path=False, lin return possibility[0] if '=' in line and ' ' in line.strip(): leninit = len(line) - line,n = re.subn('\s*=\s*','=', line) + line,n = re.subn(r'\s*=\s*','=', line) if n and len(line) != leninit: return self.check_answer_in_input_file(question_instance, default, path=path, line=line) @@ -1311,7 +1311,7 @@ def nice_error_handling(self, error, line): if os.path.exists(self.debug_output): os.remove(self.debug_output) try: - super(Cmd,self).onecmd('history %s' % self.debug_output.replace(' ', '\ ')) + super(Cmd,self).onecmd('history %s' % self.debug_output.replace(' ', r'\ ')) except Exception as error: logger.error(error) @@ -2001,6 +2001,7 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): text = "" has_mg5_path = False # Use local configuration => Need to update the path + already_written = set() for line in open(basefile): if '=' in line: data, value = line.split('=',1) @@ -2018,9 +2019,12 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): comment = '' if key in to_keep: value = str(to_keep[key]) - else: + elif line not in already_written: + already_written.add(line) text += line continue + else: + continue if key == 'mg5_path': has_mg5_path = True try: @@ -2032,14 +2036,20 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): # check if absolute path if not os.path.isabs(value): value = os.path.realpath(os.path.join(basedir, value)) - text += '%s = %s # %s \n' % (key, value, comment) + new_line = '%s = %s # %s \n' % (key, value, comment) + if new_line not in already_written: + text += new_line + already_written.add(new_line) for key in to_write: if key in to_keep: - text += '%s = %s \n' % (key, to_keep[key]) + new_line = '%s = %s \n' % (key, to_keep[key]) + if new_line not in already_written: + text += new_line if not MADEVENT and not has_mg5_path: - text += """\n# MG5 MAIN DIRECTORY\n""" - text += "mg5_path = %s\n" % MG5DIR + if "mg5_path = %s\n" % MG5DIR not in already_written: + text += """\n# MG5 MAIN DIRECTORY\n""" + text += "mg5_path = %s\n" % MG5DIR writer = open(filepath,'w') writer.write(text) @@ -2190,7 +2200,7 @@ def onecmd(self, line, **opt): raise def reask(self, reprint_opt=True): - pat = re.compile('\[(\d*)s to answer\]') + pat = re.compile(r'\[(\d*)s to answer\]') prev_timer = signal.alarm(0) # avoid timer if any if prev_timer: @@ -2991,7 +3001,7 @@ def question_formatting(self, nb_col = 80, lpotential_switch=0, lnb_key=0, key=None): - """should return four lines: + r"""should return four lines: 1. The upper band (typically /========\ 2. The lower band (typically \========/ 3. The line without conflict | %(nb)2d. %(descrip)-20s %(name)5s = %(switch)-10s | @@ -3239,13 +3249,13 @@ def create_question(self, help_text=True): data_to_format['conflict_switch'] = self.color_for_value(key,self.inconsistent_keys[key], consistency=False) if hidden_line: - f2 = re.sub('%(\((?:name|descrip|add_info)\)-?)(\d+)s', + f2 = re.sub(r'%(\((?:name|descrip|add_info)\)-?)(\d+)s', lambda x: '%%%s%ds' % (x.group(1),int(x.group(2))+9), f2) text.append(f2 % data_to_format) elif hidden_line: if not f3: - f3 = re.sub('%(\((?:name|descrip|add_info)\)-?)(\d+)s', + f3 = re.sub(r'%(\((?:name|descrip|add_info)\)-?)(\d+)s', lambda x: '%%%s%ds' % (x.group(1),int(x.group(2))+9), f1) text.append(f3 % data_to_format) diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/file_writers.py b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/file_writers.py index 41bff05276..526756129f 100755 --- a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/file_writers.py +++ b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/file_writers.py @@ -36,10 +36,10 @@ class FileWriter(io.FileIO): supported_preprocessor_commands = ['if'] preprocessor_command_re=re.compile( - "\s*(?P%s)\s*\(\s*(?P.*)\s*\)\s*{\s*"\ + r"\s*(?P%s)\s*\(\s*(?P.*)\s*\)\s*{\s*"\ %('|'.join(supported_preprocessor_commands))) preprocessor_endif_re=re.compile(\ - "\s*}\s*(?Pelse)?\s*(\((?P.*)\))?\s*(?P{)?\s*") + r"\s*}\s*(?Pelse)?\s*(\((?P.*)\))?\s*(?P{)?\s*") class FileWriterError(IOError): """Exception raised if an error occurs in the definition @@ -191,15 +191,15 @@ class FortranWriterError(FileWriter.FileWriterError): pass # Parameters defining the output of the Fortran writer - keyword_pairs = {'^if.+then\s*$': ('^endif', 2), - '^type(?!\s*\()\s*.+\s*$': ('^endtype', 2), - '^do(?!\s+\d+)\s+': ('^enddo\s*$', 2), - '^subroutine': ('^end\s*$', 0), - '^module': ('^end\s*$', 0), - 'function': ('^end\s*$', 0)} - single_indents = {'^else\s*$':-2, - '^else\s*if.+then\s*$':-2} - number_re = re.compile('^(?P\d+)\s+(?P.*)') + keyword_pairs = {r'^if.+then\s*$': ('^endif', 2), + r'^type(?!\s*\()\s*.+\s*$': ('^endtype', 2), + r'^do(?!\s+\d+)\s+': (r'^enddo\s*$', 2), + '^subroutine': (r'^end\s*$', 0), + '^module': (r'^end\s*$', 0), + 'function': (r'^end\s*$', 0)} + single_indents = {r'^else\s*$':-2, + r'^else\s*if.+then\s*$':-2} + number_re = re.compile(r'^(?P\d+)\s+(?P.*)') line_cont_char = '$' comment_char = 'c' uniformcase = True #force everyting to be lower/upper case @@ -212,7 +212,7 @@ class FortranWriterError(FileWriter.FileWriterError): # Private variables __indent = 0 __keyword_list = [] - __comment_pattern = re.compile(r"^(\s*#|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|!)", re.IGNORECASE) + __comment_pattern = re.compile(r"^(\s*#|c\$|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|\s*!|!\$)", re.IGNORECASE) __continuation_line = re.compile(r"(?: )[$&]") def write_line(self, line): @@ -424,26 +424,20 @@ def count_number_of_quotes(self, line): i = i + 1 return len(splitline)-1 - def remove_routine(self, text, fct_names, formatting=True): - """write the incoming text but fully removing the associate routine/function - text can be a path to a file, an iterator, a string - fct_names should be a list of functions to remove + @staticmethod + def get_routine(text, fct_names, call_back=None): + """ + get the fortran function from a fortran file """ - f77_type = ['real*8', 'integer', 'double precision', 'logical'] - pattern = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I) - + + if isinstance(text, str): + text = text.split('\n') + + to_write=False removed = [] - if isinstance(text, str): - if '\n' in text: - text = text.split('\n') - else: - text = open(text) - if isinstance(fct_names, str): - fct_names = [fct_names] - - to_write=True for line in text: fct = pattern.findall(line) if fct: @@ -451,22 +445,38 @@ def remove_routine(self, text, fct_names, formatting=True): to_write = False else: to_write = True - if to_write: - if formatting: - if line.endswith('\n'): - line = line[:-1] - self.writelines(line) - else: - if not line.endswith('\n'): - line = '%s\n' % line - super(FileWriter,self).writelines(line) + if call_back: + call_back(line) else: removed.append(line) - + return removed + + def remove_routine(self, text, fct_names, formatting=True): + """write the incoming text but fully removing the associate routine/function + text can be a path to a file, an iterator, a string + fct_names should be a list of functions to remove + """ + + def call_back(line): + if formatting: + if line.endswith('\n'): + line = line[:-1] + self.writelines(line) + else: + if not line.endswith('\n'): + line = '%s\n' % line + super(FileWriter,self).writelines(line) + + return self.get_routine(text, fct_names, call_back) + +class FortranWriter90(FortranWriter): + + comment_char = ' !' + #=============================================================================== # CPPWriter #=============================================================================== @@ -497,50 +507,50 @@ class CPPWriterError(FileWriter.FileWriterError): '^private': standard_indent, '^protected': standard_indent} - spacing_patterns = [ - ('\s*\"\s*}', '\"'), - ('\s*,\s*', ', '), - ('\s*-\s*', ' - '), - ('([{(,=])\s*-\s*', '\g<1> -'), - ('(return)\s*-\s*', '\g<1> -'), - ('\s*\+\s*', ' + '), - ('([{(,=])\s*\+\s*', '\g<1> +'), - ('\(\s*', '('), - ('\s*\)', ')'), - ('\{\s*', '{'), - ('\s*\}', '}'), - ('\s*=\s*', ' = '), - ('\s*>\s*', ' > '), - ('\s*<\s*', ' < '), - ('\s*!\s*', ' !'), - ('\s*/\s*', '/'), - ('(?\s+>\s*', ' >> '), - ('<\s*double\s*>>\s*', ' > '), - ('\s*<\s+<\s*', ' << '), - ('\s*-\s+>\s*', '->'), - ('\s*=\s+=\s*', ' == '), - ('\s*!\s+=\s*', ' != '), - ('\s*>\s+=\s*', ' >= '), - ('\s*<\s+=\s*', ' <= '), - ('\s*&&\s*', ' && '), - ('\s*\|\|\s*', ' || '), - ('\s*{\s*}', ' {}'), - ('\s*;\s*', '; '), - (';\s*\}', ';}'), - (';\s*$}', ';'), - ('\s*<\s*([a-zA-Z0-9]+?)\s*>', '<\g<1>>'), - ('^#include\s*<\s*(.*?)\s*>', '#include <\g<1>>'), - ('(\d+\.{0,1}\d*|\.\d+)\s*[eE]\s*([+-]{0,1})\s*(\d+)', - '\g<1>e\g<2>\g<3>'), - ('\s+',' '), - ('^\s*#','#')] + spacing_patterns = [(r'\s*\"\s*}', '\"'), + (r'\s*,\s*', ', '), + (r'\s*-\s*', ' - '), + (r'([{(,=])\s*-\s*', r'\g<1> -'), + (r'(return)\s*-\s*', r'\g<1> -'), + (r'\s*\+\s*', ' + '), + (r'([{(,=])\s*\+\s*', r'\g<1> +'), + (r'\(\s*', '('), + (r'\s*\)', ')'), + (r'\{\s*', '{'), + (r'\s*\}', '}'), + (r'\s*=\s*', ' = '), + (r'\s*>\s*', ' > '), + (r'\s*<\s*', ' < '), + (r'\s*!\s*', ' !'), + (r'\s*/\s*', '/'), + (r'\s*\*\s*', ' * '), + (r'\s*-\s+-\s*', '-- '), + (r'\s*\+\s+\+\s*', '++ '), + (r'\s*-\s+=\s*', ' -= '), + (r'\s*\+\s+=\s*', ' += '), + (r'\s*\*\s+=\s*', ' *= '), + (r'\s*/=\s*', ' /= '), + (r'\s*>\s+>\s*', ' >> '), + (r'<\s*double\s*>>\s*', ' > '), + (r'\s*<\s+<\s*', ' << '), + (r'\s*-\s+>\s*', '->'), + (r'\s*=\s+=\s*', ' == '), + (r'\s*!\s+=\s*', ' != '), + (r'\s*>\s+=\s*', ' >= '), + (r'\s*<\s+=\s*', ' <= '), + (r'\s*&&\s*', ' && '), + (r'\s*\|\|\s*', ' || '), + (r'\s*{\s*}', ' {}'), + (r'\s*;\s*', '; '), + (r';\s*\}', ';}'), + (r';\s*$}', ';'), + (r'\s*<\s*([a-zA-Z0-9]+?)\s*>', r'<\g<1>>'), + (r'^#include\s*<\s*(.*?)\s*>', r'#include <\g<1>>'), + (r'(\d+\.{0,1}\d*|\.\d+)\s*[eE]\s*([+-]{0,1})\s*(\d+)', + r'\g<1>e\g<2>\g<3>'), + (r'\s+',' '), + (r'^\s*#','#')] + spacing_re = dict([(key[0], re.compile(key[0])) for key in \ spacing_patterns]) diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/gen_crossxhtml.py b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/gen_crossxhtml.py index d58ec573bc..681bf9d09b 100755 --- a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/gen_crossxhtml.py +++ b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/gen_crossxhtml.py @@ -648,7 +648,7 @@ def recreate(self, banner): if run_card['ickkw'] != 0: #parse the file to have back the information pythia_log = misc.BackRead(pjoin(path, '%s_pythia.log' % tag)) - pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") + pythiare = re.compile(r"\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") for line in pythia_log: info = pythiare.search(line) if not info: @@ -1623,7 +1623,7 @@ def get_html(self, runresults): elif self.debug: text = str(self.debug).replace('. ','.
') if 'http' in text: - pat = re.compile('(http[\S]*)') + pat = re.compile(r'(http[\S]*)') text = pat.sub(r' here ', text) debug = '
%s
%s
' % \ (self.debug.__class__.__name__, text) diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/gen_ximprove.py b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/gen_ximprove.py index c86da36a05..415ecc9de0 100755 --- a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/gen_ximprove.py +++ b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/gen_ximprove.py @@ -158,8 +158,11 @@ def get_helicity(self, to_submit=True, clean=True): (stdout, _) = p.communicate(''.encode()) stdout = stdout.decode('ascii',errors='ignore') if stdout: - nb_channel = max([math.floor(float(d)) for d in stdout.split()]) + lines = stdout.strip().split('\n') + nb_channel = max([math.floor(float(d)) for d in lines[-1].split()]) else: + if os.path.exists(pjoin(self.me_dir, 'error')): + os.remove(pjoin(self.me_dir, 'error')) for matrix_file in misc.glob('matrix*orig.f', Pdir): files.cp(matrix_file, matrix_file.replace('orig','optim')) P_zero_result.append(Pdir) @@ -297,12 +300,14 @@ def get_helicity(self, to_submit=True, clean=True): bad_amps_perhel = [] if __debug__: mtext = open(matrix_file).read() - nb_amp = int(re.findall('PARAMETER \(NGRAPHS=(\d+)\)', mtext)[0]) - logger.debug('nb_hel: %s zero amp: %s bad_amps_hel: %s/%s', len(good_hels),len(bad_amps),len(bad_amps_perhel), len(good_hels)*nb_amp ) + nb_amp = int(re.findall(r'PARAMETER \(NGRAPHS=(\d+)\)', mtext)[0]) + logger.debug('(%s) nb_hel: %s zero amp: %s bad_amps_hel: %s/%s', split_file[-1], len(good_hels),len(bad_amps),len(bad_amps_perhel), len(good_hels)*nb_amp ) if len(good_hels) == 1: files.cp(matrix_file, matrix_file.replace('orig','optim')) continue # avoid optimization if onlye one helicity - recycler = hel_recycle.HelicityRecycler(good_hels, bad_amps, bad_amps_perhel) + + gauge = self.cmd.proc_characteristics['gauge'] + recycler = hel_recycle.HelicityRecycler(good_hels, bad_amps, bad_amps_perhel, gauge=gauge) # In case of bugs you can play around with these: recycler.hel_filt = self.run_card['hel_filtering'] recycler.amp_splt = self.run_card['hel_splitamp'] @@ -1299,7 +1304,7 @@ def get_job_for_event(self): 'script_name': 'unknown', 'directory': C.name, # need to be change for splitted job 'P_dir': C.parent_name, - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # needed for RO gridpack 'offset': 1, # need to be change for splitted job 'nevents': nevents, 'maxiter': self.max_iter, @@ -1387,7 +1392,7 @@ def create_ajob(self, template, jobs, write_dir=None): break info = jobs[j] info['script_name'] = 'ajob%i' % script_number - info['keeplog'] = 'false' + info['keeplog'] = 'false' if self.run_card['keep_log'] != 'debug' else 'true' if "base_directory" not in info: info["base_directory"] = "./" fsock.write(template_text % info) @@ -1456,7 +1461,7 @@ def get_job_for_precision(self): 'script_name': 'unknown', 'directory': C.name, # need to be change for splitted job 'P_dir': C.parent_name, - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # used for RO gridpack 'offset': 1, # need to be change for splitted job 'nevents': nevents, 'maxiter': self.max_iter, @@ -1916,7 +1921,7 @@ def get_job_for_event(self): 'directory': C.name, # need to be change for splitted job 'P_dir': os.path.basename(C.parent_name), 'offset': 1, # need to be change for splitted job - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # use for RO gridpack 'nevents': nevents, #int(nevents*self.gen_events_security)+1, 'maxiter': self.max_iter, 'miniter': self.min_iter, diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/hel_recycle.py b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/hel_recycle.py index dfa45d5d20..6c86611f68 100755 --- a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/hel_recycle.py +++ b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/hel_recycle.py @@ -383,7 +383,7 @@ def get_number(cls, *args): class HelicityRecycler(): '''Class for recycling helicity''' - def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[]): + def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[], gauge='U'): External.good_hel = [] External.nhel_lines = '' @@ -427,6 +427,7 @@ def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[]): self.all_hel = [] self.hel_filt = True + self.gauge = gauge def set_input(self, file): if 'born_matrix' in file: @@ -612,7 +613,7 @@ def unfold_helicities(self, line, nature): def apply_amps(self, line, new_objs): if self.amp_splt: - return split_amps(line, new_objs) + return split_amps(line, new_objs, gauge=self.gauge) else: return apply_args(line, [i.args for i in new_objs]) @@ -785,7 +786,7 @@ def apply_args(old_line, all_the_args): return ''.join(new_lines) -def split_amps(line, new_amps): +def split_amps(line, new_amps, gauge): if not new_amps: return '' fct = line.split('(',1)[0].split('_0')[0] @@ -841,34 +842,31 @@ def split_amps(line, new_amps): spin = fct.split(None,1)[1][to_remove] lines.append('%sP1N_%s(%s)' % (fct, to_remove+1, ', '.join(args))) - hel, iamp = re.findall('AMP\((\d+),(\d+)\)', amp_result)[0] + hel, iamp = re.findall(r'AMP\((\d+),(\d+)\)', amp_result)[0] hel_calculated.append(hel) #lines.append(' %(result)s = TMP(3) * W(3,%(w)s) + TMP(4) * W(4,%(w)s)+' # % {'result': amp_result, 'w': windex}) #lines.append(' & TMP(5) * W(5,%(w)s)+TMP(6) * W(6,%(w)s)' # % {'result': amp_result, 'w': windex}) - if spin in "VF": - lines.append(""" call CombineAmp(%(nb)i, - & (/%(hel_list)s/), - & (/%(w_list)s/), - & TMP, W, AMP(1,%(iamp)s))""" % - {'nb': len(sub_amps), - 'hel_list': ','.join(hel_calculated), - 'w_list': ','.join(windices), - 'iamp': iamp - }) + if spin == "F" or ( spin == "V" and gauge !='FD'): + suffix = '' elif spin == "S": - lines.append(""" call CombineAmpS(%(nb)i, - &(/%(hel_list)s/), - & (/%(w_list)s/), - & TMP, W, AMP(1,%(iamp)s))""" % - {'nb': len(sub_amps), - 'hel_list': ','.join(hel_calculated), - 'w_list': ','.join(windices), - 'iamp': iamp - }) + suffix = 'S' + elif spin == "V" and gauge == "FD": + suffix = "FD" else: - raise Exception("split amp are not supported for spin2 and 3/2") + raise Exception("split amp not supported for spin2, 3/2") + + lines.append(""" call CombineAmp%(suffix)s(%(nb)i, + & (/%(hel_list)s/), + & (/%(w_list)s/), + & TMP, W, AMP(1,%(iamp)s))""" % {'suffix':suffix, + 'nb': len(sub_amps), + 'hel_list': ','.join(hel_calculated), + 'w_list': ','.join(windices), + 'iamp': iamp + }) + #lines.append('') return '\n'.join(lines) diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/histograms.py b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/histograms.py index 98f22c4c3a..9931127f66 100755 --- a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/histograms.py +++ b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/histograms.py @@ -632,34 +632,34 @@ class HwU(Histogram): # than necessary because the HwU standard allows for spaces from within # the name of a weight weight_header_re = re.compile( - '&\s*(?P(\S|(\s(?!\s*(&|$))))+)(\s(?!(&|$)))*') + r'&\s*(?P(\S|(\s(?!\s*(&|$))))+)(\s(?!(&|$)))*') # ================================ # Histo weight specification RE's # ================================ # The start of a plot - histo_start_re = re.compile('^\s*\s*(?P\d+)\s*"\s*'+ - '(?P(\S|(\s(?!\s*")))+)\s*"\s*$') + histo_start_re = re.compile(r'^\s*\s*(?P\d+)\s*"\s*'+ + r'(?P(\S|(\s(?!\s*")))+)\s*"\s*$') # A given weight specifier - a_float_re = '[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' - histo_bin_weight_re = re.compile('(?P%s|NaN)'%a_float_re,re.IGNORECASE) - a_int_re = '[\+|-]?\d+' + a_float_re = r'[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' + histo_bin_weight_re = re.compile(r'(?P%s|NaN)'%a_float_re,re.IGNORECASE) + a_int_re = r'[\+|-]?\d+' # The end of a plot histo_end_re = re.compile(r'^\s*<\\histogram>\s*$') # A scale type of weight - weight_label_scale = re.compile('^\s*mur\s*=\s*(?P%s)'%a_float_re+\ - '\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) - weight_label_PDF = re.compile('^\s*PDF\s*=\s*(?P\d+)\s*$') - weight_label_PDF_XML = re.compile('^\s*pdfset\s*=\s*(?P\d+)\s*$') - weight_label_TMS = re.compile('^\s*TMS\s*=\s*(?P%s)\s*$'%a_float_re) - weight_label_alpsfact = re.compile('^\s*alpsfact\s*=\s*(?P%s)\s*$'%a_float_re, + weight_label_scale = re.compile(r'^\s*mur\s*=\s*(?P%s)'%a_float_re+\ + r'\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) + weight_label_PDF = re.compile(r'^\s*PDF\s*=\s*(?P\d+)\s*$') + weight_label_PDF_XML = re.compile(r'^\s*pdfset\s*=\s*(?P\d+)\s*$') + weight_label_TMS = re.compile(r'^\s*TMS\s*=\s*(?P%s)\s*$'%a_float_re) + weight_label_alpsfact = re.compile(r'^\s*alpsfact\s*=\s*(?P%s)\s*$'%a_float_re, re.IGNORECASE) - weight_label_scale_adv = re.compile('^\s*dyn\s*=\s*(?P%s)'%a_int_re+\ - '\s*mur\s*=\s*(?P%s)'%a_float_re+\ - '\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) - weight_label_PDF_adv = re.compile('^\s*PDF\s*=\s*(?P\d+)\s+(?P\S+)\s*$') + weight_label_scale_adv = re.compile(r'^\s*dyn\s*=\s*(?P%s)'%a_int_re+\ + r'\s*mur\s*=\s*(?P%s)'%a_float_re+\ + r'\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) + weight_label_PDF_adv = re.compile(r'^\s*PDF\s*=\s*(?P\d+)\s+(?P\S+)\s*$') class ParseError(MadGraph5Error): @@ -926,7 +926,7 @@ def get_HwU_source(self, print_header=True): res.append(' '.join('%+16.7e'%wgt for wgt in list(bin.boundaries))) res[-1] += ' '.join('%+16.7e'%bin.wgts[key] for key in self.bins.weight_labels if key not in ['central','stat_error']) - res.append('<\histogram>') + res.append(r'<\histogram>') return res def output(self, path=None, format='HwU', print_header=True): @@ -1149,6 +1149,8 @@ def parse_one_histo_from_stream(self, stream, all_weight_header, boundaries = [0.0,0.0] for j, weight in \ enumerate(HwU.histo_bin_weight_re.finditer(line_bin)): + if (j == len(weight_header)): + continue if j == len(all_weight_header): raise HwU.ParseError("There is more bin weights"+\ " specified than expected (%i)"%len(weight_header)) @@ -1803,7 +1805,7 @@ def parse_histos_from_PY8_XML_stream(self, stream, run_id=None, # Filter empty weights coming from the split weight_label_list = [wgt.strip() for wgt in str(selected_run_node.getAttribute('header')).split(';') if - not re.match('^\s*$',wgt)] + not re.match(r'^\s*$',wgt)] ordered_weight_label_list = [w for w in weight_label_list if w not\ in ['xmin','xmax']] # Remove potential repetition of identical weight labels @@ -1827,7 +1829,7 @@ def parse_histos_from_PY8_XML_stream(self, stream, run_id=None, all_weights = [] for wgt_position, wgt_label in \ enumerate(str(selected_run_node.getAttribute('header')).split(';')): - if not re.match('^\s*$',wgt_label) is None: + if not re.match(r'^\s*$',wgt_label) is None: continue all_weights.append({'POSITION':wgt_position}) for wgt_item in wgt_label.strip().split('_'): @@ -2714,7 +2716,7 @@ def ratio_no_correlations(wgtsA, wgtsB): # First the global gnuplot header for this histogram group global_header =\ -""" +r""" ################################################################################ ### Rendering of the plot titled '%(title)s' ################################################################################ @@ -2862,9 +2864,9 @@ def ratio_no_correlations(wgtsA, wgtsB): major_title = ', '.join(major_title) if not mu[0] in ['none',None]: - major_title += ', dynamical\_scale\_choice=%s'%mu[0] + major_title += r', dynamical\_scale\_choice=%s'%mu[0] if not pdf[0] in ['none',None]: - major_title += ', PDF=%s'%pdf[0].replace('_','\_') + major_title += ', PDF=%s'%pdf[0].replace('_',r'\_') # Do not show uncertainties for individual jet samples (unless first # or specified explicitely and uniquely) @@ -2937,7 +2939,7 @@ def ratio_no_correlations(wgtsA, wgtsB): plot_lines.append( "'%s' index %d using (($1+$2)/2):%d ls %d title '%s'"\ %(HwU_name,block_position+i,mu_var+3,color_index,\ -'%s dynamical\_scale\_choice=%s' % (title,mu[j]))) +r'%s dynamical\_scale\_choice=%s' % (title,mu[j]))) # And now PDF_variation if available if not PDF_var_pos is None: for j,PDF_var in enumerate(PDF_var_pos): @@ -2947,7 +2949,7 @@ def ratio_no_correlations(wgtsA, wgtsB): plot_lines.append( "'%s' index %d using (($1+$2)/2):%d ls %d title '%s'"\ %(HwU_name,block_position+i,PDF_var+3,color_index,\ -'%s PDF=%s' % (title,pdf[j].replace('_','\_')))) +'%s PDF=%s' % (title,pdf[j].replace('_',r'\_')))) # Now add the uncertainty lines, those not using a band so that they # are not covered by those using a band after we reverse plo_lines diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/launch_plugin.py b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/launch_plugin.py index 7b10bedcef..9ec09eb71d 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/launch_plugin.py +++ b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/launch_plugin.py @@ -98,6 +98,7 @@ def default_setup(self): self['vector_size'] = 16 # already setup in default class (just change value) self['aloha_flag'] = '--fast-math' self['matrix_flag'] = '-O3' + self['limhel'] = 0 self.display_block.append('simd') self.display_block.append('psoptim') diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/lhe_parser.py b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/lhe_parser.py index eee9ba4522..f6e47956cd 100755 --- a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/lhe_parser.py +++ b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/lhe_parser.py @@ -7,6 +7,7 @@ import numbers import math import time +import copy import os import shutil import sys @@ -101,7 +102,7 @@ def __init__(self, line=None, event=None): self.rwgt = 0 return - + self.event = event if event is not None: self.event_id = len(event) #not yet in the event @@ -1066,6 +1067,8 @@ def define_init_banner(self, wgt, lha_strategy, proc_charac=None): #special case for 1>N init_information = run_card.get_banner_init_information() event = next(self) + if not len(event): #if parse-momenta was false we have to parse the first event + event = Event(str(event)) init_information["idbmup1"] = event[0].pdg init_information["ebmup1"] = event[0].mass init_information["idbmup2"] = 0 @@ -1149,6 +1152,7 @@ def initialize_unweighting(self, getwgt, trunc_error): nb_keep = max(20, int(nb_event*trunc_error*15)) new_wgt = new_wgt[-nb_keep:] if nb_event == 0: + misc.sprint(i,f) raise Exception # store the information self.initial_nb_events[i] = nb_event @@ -1203,7 +1207,6 @@ def unweight(self, outputpath, get_wgt, **opts): (stop to write event when target is reached) """ - if isinstance(get_wgt, (str,six.text_type)): unwgt_name =get_wgt def get_wgt_multi(event): @@ -1483,12 +1486,12 @@ def reorder_mother_child(self): particle.mother2 -= 1 # re-call the function for the next potential change return self.reorder_mother_child() - - - - - + + + + + def parse_reweight(self): """Parse the re-weight information in order to return a dictionary {key: value}. If no group is define group should be '' """ @@ -1522,6 +1525,37 @@ def parse_nlo_weight(self, real_type=(1,11), threshold=None): threshold=threshold) return self.nloweight + def get_fks_pair(self, real_type=(1,11), threshold=None): + """ Gives the fks pair labels""" + start, stop = self.tag.find(''), self.tag.find('') + if start != -1 != stop: + text = self.tag[start+8:stop] + all_line = text.split('\n') + text = text.lower().replace('d','e') + all_line = text.split('\n') + for line in all_line: + data = line.split() + if len(data)>16: + wgt = OneNLOWeight(line, real_type=real_type) + return wgt.to_merge_pdg,wgt.nexternal + + def get_born_momenta(self,real_type=(1,11), threshold=None): + """ Gets the underlying n+1 body kinematics""" + start, stop = self.tag.find(''), self.tag.find('') + if start != -1 != stop: + text = self.tag[start+8:stop] + text = text.lower().replace('d','e') + all_line = text.split('\n') + for line in all_line: + data = line.split() + if len(data)>16: + wgt = OneNLOWeight(line, real_type=real_type) + nexternal = wgt.nexternal + real_momenta = all_line[2:2+nexternal] + return real_momenta + + + def rewrite_nlo_weight(self, wgt=None): """get the string associate to the weight""" @@ -1558,11 +1592,11 @@ def parse_lo_weight(self): return self.loweight if not hasattr(Event, 'loweight_pattern'): - Event.loweight_pattern = re.compile('''\s*(?P\d+)\s+(?P[\d.e+-]+)\s*\s*\n\s* - \s*(?P[\s\d.+-e]+)\s*\s*\n\s* - 1|2)["']?\>\s*(?P[\s\d.e+-]*)\s*\s*\n\s* - 1|2)["']?\>\s*(?P[\s\d.e+-]*)\s*\s*\n\s* - \s*(?P[\d.e+-]*)\s* + Event.loweight_pattern = re.compile('''\\s*(?P\\d+)\\s+(?P[\\d.e+-]+)\\s*\\s*\n\\s* + \\s*(?P[\\s\\d.+-e]+)\\s*\\s*\n\\s* + 1|2)["']?\\>\\s*(?P[\\s\\d.e+-]*)\\s*\\s*\n\\s* + 1|2)["']?\\>\\s*(?P[\\s\\d.e+-]*)\\s*\\s*\n\\s* + \\s*(?P[\\d.e+-]*)\\s* ''',re.X+re.I+re.M) start, stop = self.tag.find(''), self.tag.find('') @@ -1615,7 +1649,7 @@ def parse_matching_scale(self): self.matched_scale_data = [] - pattern = re.compile("") + pattern = re.compile(r"") data = re.split(pattern,self.tag) if len(data) == 1: return [] @@ -1623,7 +1657,7 @@ def parse_matching_scale(self): tmp = {} start,content, end = data self.tag = "%s%s" % (start, end) - pattern = re.compile("pt_clust_(\d*)=\"([\de+-.]*)\"") + pattern = re.compile("pt_clust_(\\d*)=\"([\\de+-.]*)\"") for id,value in pattern.findall(content): tmp[int(id)] = float(value) for i in range(1, len(self)+1): @@ -1647,7 +1681,7 @@ def parse_syscalc_info(self): return self.syscalc_data pattern = re.compile("|") - pattern2 = re.compile("<(?P[\w]*)(?:\s*(\w*)=[\"'](.*)[\"']\s*|\s*)>(.*)") + pattern2 = re.compile("<(?P[\\w]*)(?:\\s*(\\w*)=[\"'](.*)[\"']\\s*|\\s*)>(.*)") data = re.split(pattern,self.tag) if len(data) == 1: return [] @@ -1850,6 +1884,240 @@ def get_decay(self, pdg_code=0, event_id=None): return new_event + + def set_initial_mass_to_zero(self): + """set the masses of the initial particles to zero, by reshuffling the respective momenta + Works only in the **partonic** com frame, so the event must be boosted to such frame + before calling the function + """ + + if not misc.equal(self[0].px, 0) or not misc.equal(self[1].px, 0) or \ + not misc.equal(self[0].py, 0) or not misc.equal(self[1].py, 0) or \ + not misc.equal(self[0].pz, - self[1].pz, zero_limit=False): + misc.sprint(self[0]) + misc.sprint(self[1]) + raise Exception('momenta should be in the partonic center of mass frame') + + self[0].mass = 0. + self[1].mass = 0. + tot_E=0. + for ip,part in enumerate(self): + if part.status == 1 : + tot_E += part.E + if (self[0].pz > 0. and self[1].pz < 0): + self[0].set_momentum(FourMomentum([tot_E/2., 0., 0., tot_E/2.])) + self[1].set_momentum(FourMomentum([tot_E/2., 0., 0., -tot_E/2.])) + elif (self[0].pz < 0. and self[1].pz > 0): + self[0].set_momentum(FourMomentum([tot_E/2., 0., 0., -tot_E/2.])) + self[1].set_momentum(FourMomentum([tot_E/2., 0., 0., tot_E/2.])) + else: + logger.critical('ERROR: two incoming partons not back.-to-back') + + def set_final_jet_mass_to_zero(self): + """set the final light particle masses to zero + """ + + for ip,part in enumerate(self): + if ((abs(part.pid) <= 5) or (abs(part.pid) == 11) or (abs(part.pid) == 12)) and (part.status == 1): + part.mass = 0. + E_1_new = math.sqrt(part.mass**2 + part.px**2 + part.py**2 + part.pz**2) + part.set_momentum(FourMomentum([E_1_new, part.px, part.py, part.pz])) + + + + def merge_particles_kinematics(self, i,j, moth): + """Map to an underlying n-body kinematics for two given + particles i,j to be merged and a resulting moth""" + """ note! kinematics (and id) mapping only! """ + + recoil = True + fks_type = False + + if recoil and not fks_type: + if (i == moth[0].get('number')-1): + fks_i = i + fks_j = j + elif (j == moth[0].get('number')-1): + fks_i = j + fks_j = i + to_remove = fks_j + + merge_i = self[fks_i] + merge_j = self[fks_j] + + i_4mom = FourMomentum(merge_i) + j_4mom = FourMomentum(merge_j) + if (fks_i <= 1): + sign1 = -1.0 + else: + sign1 = 1.0 + mother_4mom = i_4mom + sign1*j_4mom + + new_event = copy.deepcopy(self) + + self[fks_i].pid = moth[0]['id'] + self[fks_i].set_momentum(mother_4mom) + + if fks_i <= 1: # initial-state recoil + new_p = FourMomentum() + for ip,part in enumerate(self): + if (ip != fks_i and ip != fks_j and ip >= 2): + new_p += part + + if fks_i == 0: + self[1].set_momentum(new_p - FourMomentum(self[0])) + elif fks_i == 1: + self[0].set_momentum(new_p - FourMomentum(self[1])) + + pz_1_new = self.recoil_eq(self[0],self[1]) + pz_2_new = self[0].pz + self[1].pz - pz_1_new + E_1_new = math.sqrt(self[0].mass**2 + self[0].px**2 + self[0].py**2 + pz_1_new **2) + E_2_new = math.sqrt(self[1].mass**2 + self[1].px**2 + self[1].py**2 + pz_2_new **2) + self[0].set_momentum(FourMomentum([E_1_new,self[0].px,self[0].py,pz_1_new])) + self[1].set_momentum(FourMomentum([E_2_new,self[1].px,self[1].py,pz_2_new])) + self.pop(to_remove) + + if fks_i > 1: # final-state recoil + + # Re-scale the energy of fks_i to make it on-shell + for ip,part in enumerate(self): + if (ip == fks_i): + part.E = math.sqrt(part.mass**2 + part.px**2 + part.py**2 + part.pz**2) + new_p.E = part.E + + # Find the overall energy in the final state + new_p.E = 0.0 + for ip,part in enumerate(self): + if (ip != fks_j and ip >= 2): + new_p.E += part.E + + # Use one of the initial states to absorb the energy change in the final state + self[1].set_momentum(FourMomentum([new_p.E-self[0].E,self[1].px,self[1].py,self[1].pz])) + + # Change the initial state pz and E + pz_1_new = self.recoil_eq(self[0],self[1]) + pz_2_new = self[0].pz + self[1].pz - pz_1_new + E_1_new = math.sqrt(self[0].mass**2 + self[0].px**2 + self[0].py**2 + pz_1_new **2) + E_2_new = math.sqrt(self[1].mass**2 + self[1].px**2 + self[1].py**2 + pz_2_new **2) + self[0].set_momentum(FourMomentum([E_1_new,self[0].px,self[0].py,pz_1_new])) + self[1].set_momentum(FourMomentum([E_2_new,self[1].px,self[1].py,pz_2_new])) + self.pop(to_remove) + + elif fks_type and not recoil: + ## Do it in a more FKS-style + if (i == moth[0].get('number')-1): + fks_i = i + fks_j = j + elif (j == moth[0].get('number')-1): + fks_i = j + fks_j = i + to_remove = fks_j + new_event = copy.copy(event) + + if fks_i <= 1: # initial-state recoil + + # First boost to partonic CM frame + q = FourMomentum(self[0])+FourMomentum(self[1]) + for ip,part in enumerate(self): + vec = FourMomentum(part) + self[ip].set_momentum(vec.zboost(pboost=q)) + + k_tot = FourMomentum([self[0].E+self[1].E-self[fks_j].E,self[0].px+self[1].px-self[fks_j].px,\ + self[0].py+self[1].py-self[fks_j].py,self[0].pz+self[1].pz-self[fks_j].pz]) + + final = FourMomentum([0,0,0,0]) + for ip,part in enumerate(self): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + if (ip != fks_i and ip != fks_j and ip >= 2): + final = final + vec + + s = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz])**2 + ksi = self[fks_j].E/(math.sqrt(s)/2.0) + y = self[fks_j].pz/self[fks_j].E + + self[0].pz = self[0].pz * math.sqrt(1.0-ksi)*math.sqrt((2.0-ksi*(1.0+y))/((2.0-ksi*(1.0-y)))) + self[0].E = math.sqrt(self[0].mass**2 + self[0].pz**2) + self[1].pz = self[1].pz * math.sqrt(1.0-ksi)*math.sqrt((2.0-ksi*(1.0-y))/((2.0-ksi*(1.0+y)))) + self[1].E = math.sqrt(self[1].mass**2 + self[1].pz**2) + + final = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + k_tot_1 = k_tot.zboost(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + k_tot_2 = k_tot_1.pt_boost(pboost=FourMomentum([k_tot_1.E,k_tot_1.px,k_tot_1.py,k_tot_1.pz])) + k_tot_3 = k_tot_2.zboost_inv(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + + for ip,part in enumerate(self): + if (ip >= 2): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + vec2 = vec.zboost(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + vec3 = vec2.pt_boost(pboost=FourMomentum([k_tot_1.E,k_tot_1.px,k_tot_1.py,k_tot_1.pz])) + vec_new = vec3.zboost_inv(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + self[ip].set_momentum(FourMomentum([vec_new.E,vec_new.px,vec_new.py,vec_new.pz])) + + self.pop(to_remove) + + else: # final-state recoil + q = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + for ip,part in enumerate(self): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + self[ip].set_momentum(vec.zboost(pboost=q)) + + q = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + k = FourMomentum([self[fks_i].E+self[fks_j].E,self[fks_i].px+self[fks_j].px,\ + self[fks_i].py+self[fks_j].py,self[fks_i].pz+self[fks_j].pz]) + + k_rec = FourMomentum([0,0,0,0]) + for ip,part in enumerate(self): + if ip >= 2 and ip != fks_i and ip != fks_j: # add only final-states to the recoil and not the FKS pair + k_rec = k_rec + FourMomentum([part.E,part.px,part.py,part.pz]) + + k_mom = math.sqrt(k_rec.px**2 + k_rec.py**2 + k_rec.pz**2) + beta = (q**2 - (k_rec.E+k_mom)**2)/(q**2 + (k_rec.E+k_mom)**2) + for ip,part in enumerate(self): + if ip >= 2 and ip != fks_i and ip != fks_j: + vec = FourMomentum([self[ip].E,self[ip].px,self[ip].py,self[ip].pz]) + self[ip].set_momentum(vec.boost_beta(beta,k_rec)) + if ip == fks_i: + self[ip].set_momentum(q - k_rec.boost_beta(beta,k_rec)) + self.pop(to_remove) + else: + logger.info('Error in Sudakov Born mapping: no recoil scheme found!') + + def recoil_eq(self,part1, part2): + """ In general, solves the equation + E1 + E2 = K + p1 + p2 = c + E1^2 - p1^2 = a + E2^2 - p2^2 = b + and returns p1 + """ + thresh = 1e-6 + import random + a = part1.mass**2 + part1.px**2 + part1.py**2 + b = part2.mass**2 + part2.px**2 + part2.py**2 + c = part1.pz + part2.pz + K = part1.E + part2.E + K2 = K**2 + sol1 = (-a*c + b*c + c**3 - c*K2 - math.sqrt(K2*(a**2 + (b + c**2 - K2)**2 - 2*a*(b - c**2 + K2))))/(2*(c**2-K2)) + sol2 = (-a*c + b*c + c**3 - c*K2 + math.sqrt(K2*(a**2 + (b + c**2 - K2)**2 - 2*a*(b - c**2 + K2))))/(2*(c**2-K2)) + + if abs(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2) - (math.sqrt(a+sol2**2) + math.sqrt(b+(c-sol2)**2))) > thresh: + logger.critical('Error in recoil_eq solver 1') + logger.critical(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2)) + logger.critical(math.sqrt(a+sol2**2) + math.sqrt(b+(c-sol2)**2)) + if abs(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2) - K) > thresh: + logger.critical('Error in recoil_eq solver 2') + logger.critical(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2)) + logger.critical(K) + return sol1 + + def boost(self, filter=None): """modify the current event to boost it according to the current filter""" if filter is None: @@ -1861,7 +2129,7 @@ def boost(self, filter=None): if list(filter(p)): pboost += p else: - pboost = FourMomentum(pboost) + pboost = FourMomentum(filter) # change sign of three-component due to helas convention pboost.px *=-1 @@ -1877,7 +2145,7 @@ def check(self): """check various property of the events""" # check that relative error is under control - threshold = 1e-6 + threshold = 1e-4 #1. Check that the 4-momenta are conserved E, px, py, pz = 0,0,0,0 @@ -1920,7 +2188,50 @@ def check(self): self.check_color_structure() #3. check mass - + + def check_kinematics_only(self): + """check various property of the events - only kinematics""" + + # check that relative error is under control + threshold = 1e-3 + + #1. Check that the 4-momenta are conserved + E, px, py, pz = 0,0,0,0 + absE, abspx, abspy, abspz = 0,0,0,0 + for particle in self: + coeff = 1 + if particle.status == -1: + coeff = -1 + elif particle.status != 1: + continue + E += coeff * particle.E + absE += abs(particle.E) + px += coeff * particle.px + py += coeff * particle.py + pz += coeff * particle.pz + abspx += abs(particle.px) + abspy += abs(particle.py) + abspz += abs(particle.pz) + # check mass + fourmass = FourMomentum(particle).mass + + if particle.mass and (abs(particle.mass) - fourmass)/ abs(particle.mass) > threshold: + logger.critical(self) + raise Exception( "Do not have correct mass lhe: %s momentum: %s (error at %s" % (particle.mass, fourmass, (abs(particle.mass) - fourmass)/ abs(particle.mass))) + + if abs(E/absE) > threshold: + logger.critical(self) + raise Exception("Do not conserve Energy %s, %s" % (E/absE, E)) + if abs(px/abspx) > threshold: + logger.critical(self) + raise Exception("Do not conserve Px %s, %s" % (px/abspx, px)) + if abs(py/abspy) > threshold: + logger.critical(self) + raise Exception("Do not conserve Py %s, %s" % (py/abspy, py)) + if abs(pz/abspz) > threshold: + logger.critical(self) + raise Exception("Do not conserve Pz %s, %s" % (pz/abspz, pz)) + def assign_scale_line(self, line, convert=True): """read the line corresponding to global event line @@ -2764,7 +3075,7 @@ def zboost(self, pboost=None, E=0, pz=0): if isinstance(pboost, FourMomentum): E = pboost.E pz = pboost.pz - + #beta = pz/E gamma = E / math.sqrt(E**2-pz**2) gammabeta = pz / math.sqrt(E**2-pz**2) @@ -2778,6 +3089,74 @@ def zboost(self, pboost=None, E=0, pz=0): out.pz = 0 return out + def zboost_inv(self, pboost=None, E=0, pz=0): + """Both momenta should be in the same frame. + The boost perform correspond to the boost required to set pboost at + rest (only z boost applied). + """ + if isinstance(pboost, FourMomentum): + E = pboost.E + pz = pboost.pz + + #beta = pz/E + gamma = E / math.sqrt(E**2-pz**2) + gammabeta = pz / math.sqrt(E**2-pz**2) + + out = FourMomentum([gamma*self.E + gammabeta*self.pz, + self.px, + self.py, + gamma*self.pz + gammabeta*self.E]) + + if abs(out.pz) < 1e-6 * out.E: + out.pz = 0 + return out + + + def pt_boost(self, pboost=None, E=0, pz=0): + """Both momenta should be in the same frame. + The boost perform correspond to the boost required to set pboost at + rest (only pT boost applied). + """ + + if isinstance(pboost, FourMomentum): + E = pboost.E + px = pboost.px + py = pboost.py + mass = math.sqrt(E**2 - px**2 - py**2) + + betax = px/E + betay = py/E + beta = math.sqrt(betax**2+betay**2) + gamma = 1 / math.sqrt(1.0-beta**2) + + out = FourMomentum([gamma*self.E - gamma*betax*self.px - gamma*betay*self.py, + -gamma*betax*self.E + (1.0 + (gamma-1.0)*betax**2/(beta**2))*self.px + (gamma-1.0)*betax*betay/(beta**2)*self.py, + -gamma*betay*self.E + ((gamma-1.0)*betax*betay/(beta**2))*self.px + (1.0+(gamma-1.0)*(betay**2)/(beta**2))*self.py, + self.pz]) + + if abs(out.px) < 1e-6 * out.E: + out.px = 0 + if abs(out.py) < 1e-6 * out.E: + out.py = 0 + return out + + def boost_beta(self,beta,mom): + """ Boost along the three-momentum of mom with a boost of size beta""" + + unit = mom * (1.0/math.sqrt(mom.px**2+mom.py**2+mom.pz**2)) + beta_vec = beta*unit + bx = beta_vec.px + by = beta_vec.py + bz = beta_vec.pz + gamma = 1.0 / math.sqrt(1.0-beta**2) + + out = FourMomentum([gamma*self.E - gamma*bx*self.px - gamma*by*self.py - gamma*bz*self.pz, + -gamma*bx*self.E + (1.0 + (gamma-1.0)*bx**2/(beta**2))*self.px + (gamma-1.0)*bx*by/(beta**2)*self.py + (gamma-1.0)*bx*bz/(beta**2)*self.pz, + -gamma*by*self.E + ((gamma-1.0)*bx*by/(beta**2))*self.px + (1.0+(gamma-1.0)*(by**2)/(beta**2))*self.py + (gamma-1.0)*by*bz/(beta**2)*self.pz, + -gamma*bz*self.E + (gamma-1.0)*bx*bz/(beta**2)*self.px + (gamma-1.0)*(by*bz)/(beta**2)*self.py + (1.0+(gamma-1.0)*bz**2/(beta**2))*self.pz]) + + return out + def boost_to_restframe(self, pboost): """apply the boost transformation such that pboost is at rest in the new frame. First apply a rotation to allign the pboost to the z axis and then use @@ -2789,27 +3168,64 @@ def boost_to_restframe(self, pboost): return out - # write pboost as (E, p cosT sinF, p sinT sinF, p cosF) - # rotation such that it become (E, 0 , 0 , p ) is - # cosT sinF , -sinT , cosT sinF - # sinT cosF , cosT , sinT sinF - # -sinT , 0 , cosF - p = math.sqrt( pboost.px**2 + pboost.py**2+ pboost.pz**2) - cosF = pboost.pz / p - sinF = math.sqrt(1-cosF**2) - sinT = pboost.py/p/sinF - cosT = pboost.px/p/sinF - - out=FourMomentum([self.E, - self.px*cosT*cosF + self.py*sinT*cosF-self.pz*sinF, - -self.px*sinT+ self.py*cosT, - self.px*cosT*sinF + self.py*sinT*sinF + self.pz*cosF - ]) - out = out.zboost(E=pboost.E,pz=p) + # see here https://physics.stackexchange.com/questions/749036/general-lorentz-boost-of-four-momentum-in-cm-frame-particle-physics + vx = pboost.px/pboost.E + vy = pboost.py/pboost.E + vz = pboost.pz/pboost.E + v = pboost.norm/pboost.E + v2 = pboost.norm_sq/pboost.E**2 + gamma = 1./math.sqrt(1.-v**2) + gammo = gamma-1. + out = FourMomentum(E = gamma*(self.E - vx*self.px - vy*self.py - vz*self.pz), + px= -gamma*vx*self.E + (1+gammo*vx**2/v2)*self.px + gammo*vx*vy/v2*self.py + gammo*vx*vz/v2*self.pz, + py= -gamma*vy*self.E + gammo*vy*vx/v2*self.px + (1+gammo*vy**2/v2)*self.py + gammo*vy*vz/v2*self.pz, + pz= -gamma*vz*self.E + gammo*vz*vx/v2*self.px + gammo*vz*vy/v2*self.py + (1+gammo*vz**2/v2)*self.pz) + return out + def rotate_to_z(self,prot): + + import math + import numpy as np + + z = np.array([0.,0.,1.]) + + px = self.px + py = self.py + pz = self.pz + + refx = prot.px + refy = prot.py + refz = prot.pz + + prot_mom = np.array([px, py, pz]) + ref_mom = np.array([refx, refy, refz]) + + # Create normal vector + n = np.array([refy, -refx, 0.]) + n = n * 1./math.sqrt(self.threedot(n,n)) + t = prot_mom - self.threedot(n,prot_mom)*n + p = ref_mom - self.threedot(ref_mom,z)*z + p = p/math.sqrt(self.threedot(p,p)) + + t_pz = np.array([self.threedot(t,p), self.threedot(t,z), 0.]) + costheta = self.threedot(ref_mom,z)* 1./math.sqrt(self.threedot(ref_mom, ref_mom)) + sintheta=math.sqrt(1.-costheta**2) + + sgn = 1. + t_pz_p = np.array([0., 0., 0.]) + t_pz_p[0] = costheta*t_pz[0] + sgn*(-sintheta) * t_pz[1] + t_pz_p[1] = sgn*sintheta*t_pz[0] + costheta * t_pz[1] + + out_mom = self.threedot(n,prot_mom)*n + t_pz_p[0]*p + t_pz_p[1]*z + + out = FourMomentum([self.E,out_mom[0], out_mom[1], out_mom[2] ] ) + + return out - + def threedot(self,a,b): + + return a[0]*b[0]+a[1]*b[1]+a[2]*b[2] class OneNLOWeight(object): diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/madevent_interface.py b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/madevent_interface.py index 2a118e21bf..8e30cf690c 100755 --- a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/madevent_interface.py +++ b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/madevent_interface.py @@ -496,7 +496,6 @@ def help_remove(self): logger.info(" the optional '-f' allows to by-pass all security question") logger.info(" The banner can be remove only if all files are removed first.") - class AskRun(cmd.ControlSwitch): """a class for the question on what to do on a madevent run""" @@ -2393,13 +2392,17 @@ def do_generate_events(self, line): # Check argument's validity mode = self.check_generate_events(args) switch_mode = self.ask_run_configuration(mode, args) - if not args: - # No run name assigned -> assigned one automaticaly - self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton') - else: - self.set_run_name(args[0], None, 'parton', True) - args.pop(0) - + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat'), consistency=False) + if not run_card.scan_set: + if not args: + # No run name assigned -> assigned one automaticaly + self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton') + else: + self.set_run_name(args[0], None, 'parton', True) + args.pop(0) + + self.run_generate_events(switch_mode, args) self.postprocessing() @@ -2560,7 +2563,7 @@ def wait_monitoring(Idle, Running, Done): self.update_status("postprocessing contur done", level="rivet") # this decorator handle the loop related to scan. - @common_run.scanparamcardhandling() + @common_run.scanparamcardhandling(run_card_scan=True) def run_generate_events(self, switch_mode, args): if self.proc_characteristics['loop_induced'] and self.options['run_mode']==0: @@ -2593,7 +2596,6 @@ def run_generate_events(self, switch_mode, args): # Regular run mode logger.info('Generating %s events with run name %s' % (self.run_card['nevents'], self.run_name)) - self.exec_cmd('survey %s %s' % (self.run_name,' '.join(args)), postcmd=False) nb_event = self.run_card['nevents'] @@ -2975,7 +2977,7 @@ def update_width_in_param_card(decay_info, initial=None, output=None): particle = 0 # Read BRs for this decay line = param_card[line_number] - while re.search('^(#|\s|\d)', line): + while re.search(r'^(#|\s|\d)', line): line = param_card.pop(line_number) if not particle or line.startswith('#'): line=param_card[line_number] @@ -3226,7 +3228,7 @@ def do_treatcards(self, line, mode=None, opt=None): for line in open(pjoin(bias_module_path,'%s.f'%os.path.basename(bias_module_path))): if start and last: break - if not start and not re.search('c\s*parameters\s*=\s*{',line, re.I): + if not start and not re.search(r'c\s*parameters\s*=\s*{',line, re.I): continue start = True if not line.startswith('C'): @@ -3235,7 +3237,7 @@ def do_treatcards(self, line, mode=None, opt=None): if '{' in line: line = line.split('{')[-1] # split for } ! # - split_result = re.split('(\}|!|\#)', line,1, re.M) + split_result = re.split(r'(\}|!|\#)', line,1, re.M) line = split_result[0] sep = split_result[1] if len(split_result)>1 else None if sep == '}': @@ -3514,8 +3516,8 @@ def pass_in_difficult_integration_mode(self, rate=1): text = open(conf_path).read() min_evt, max_evt = 2500 *(2+rate), 10000*(rate+1) - text = re.sub('''\(min_events = \d+\)''', '(min_events = %i )' % min_evt, text) - text = re.sub('''\(max_events = \d+\)''', '(max_events = %i )' % max_evt, text) + text = re.sub(r'''\(min_events = \d+\)''', '(min_events = %i )' % min_evt, text) + text = re.sub(r'''\(max_events = \d+\)''', '(max_events = %i )' % max_evt, text) fsock = open(conf_path, 'w') fsock.write(text) fsock.close() @@ -3619,7 +3621,7 @@ def do_refine(self, line): alljobs = misc.glob('ajob*', Pdir) #remove associated results.dat (ensure to not mix with all data) - Gre = re.compile("\s*j=(G[\d\.\w]+)") + Gre = re.compile(r"\s*j=(G[\d\.\w]+)") for job in alljobs: Gdirs = Gre.findall(open(job).read()) for Gdir in Gdirs: @@ -3727,58 +3729,126 @@ def do_combine_events(self, line): sum_xsec, sum_xerru, sum_axsec = 0,[],0 Gdirs = self.get_Gdir() Gdirs.sort() - for Gdir in Gdirs: - if os.path.exists(pjoin(Gdir, 'events.lhe')): - result = sum_html.OneResult('') - result.read_results(pjoin(Gdir, 'results.dat')) - sum_xsec += result.get('xsec') - sum_xerru.append(result.get('xerru')) - sum_axsec += result.get('axsec') - - if self.run_card['gridpack'] or self.run_card['nevents']==0: - os.remove(pjoin(Gdir, 'events.lhe')) - continue + partials_info = [] + try: + p = subprocess.Popen(["ulimit", "-n"], stdout=subprocess.PIPE) + out, err = p.communicate() + max_G = out.decode() + if max_G == "unlimited": + max_G =2500 + else: + max_G = int(max_G) - 40 + except Exception as error: + logger.debug(error) + max_G = 80 # max(20, len(Gdirs)/self.options['nb_core']) - AllEvent.add(pjoin(Gdir, 'events.lhe'), - result.get('xsec'), - result.get('xerru'), - result.get('axsec') - ) - - if len(AllEvent) >= 80: #perform a partial unweighting - AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % partials), - get_wgt, log_level=5, trunc_error=1e-2, event_target=self.run_card['nevents']) - AllEvent = lhe_parser.MultiEventFile() - AllEvent.banner = self.banner - AllEvent.add(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % partials), - sum_xsec, - math.sqrt(sum(x**2 for x in sum_xerru)), - sum_axsec) - partials +=1 - if not hasattr(self,'proc_characteristic'): self.proc_characteristic = self.get_characteristics() - if len(AllEvent) == 0: - nb_event = 0 - else: + mycluster = cluster.MultiCore(nb_core=self.options['nb_core']) + + def split(a, n): + """split a list "a" into n chunk of same size (or nearly same size)""" + k, m = divmod(len(a), n) + return (a[i*k+min(i, m):(i+1)*k+min(i+1, m)] for i in range(n)) + + partials_info = [] + if len(Gdirs) >= max_G: + start_unweight= time.perf_counter() + # first check in how many chunk we have to split (always use a multiple of nb_core) + nb_split = 1 + nb_G = len(Gdirs) // (2* self.options['nb_core']) + while nb_G > min(80, max_G): + nb_split += 1 + nb_G = len(Gdirs)//(nb_split*2*self.options['nb_core']) + if nb_G < 10: + nb_split -=1 + nb_G = len(Gdirs)//(nb_split*2*self.options['nb_core']) + + #enforce at least 10 directory per thread + if nb_G > 10 or nb_split>1: + # do the unweighting of each chunk on their own thread + nb_chunk = (nb_split*2*self.options['nb_core']) + else: + nb_chunk = len(Gdirs) // 10 + nb_G =10 + + # security that the number of combine events is too large + if nb_chunk >= max_G: + nb_chunk = max_G -1 + nb_G = len(Gdirs) // nb_chunk + + for i, local_G in enumerate(split(Gdirs, nb_chunk)): + line = [pjoin(self.me_dir, "Events", self.run_name, "partials%d.lhe.gz" % i)] + line.append(pjoin(self.me_dir, 'Events', self.run_name, '%s_%s_banner.txt' % (self.run_name, tag))) + line.append(str(self.results.current['cross'])) + line += local_G + partials_info.append(self.do_combine_events_partial(' '.join(line), preprocess_only=True)) + mycluster.submit(sys.executable, + [pjoin(self.me_dir, 'bin', 'internal', 'madevent_interface.py'), 'combine_events_partial'] + line, + stdout='/dev/null' + ) + + starttime = time.time() + update_status = lambda idle, run, finish: \ + self.update_status((idle, run, finish, 'unweight'), level=None, + force=False, starttime=starttime) + mycluster.wait(self.me_dir, update_status) + # do the final combination + for data in partials_info: + AllEvent.add(*data) + + start_unweight= time.perf_counter() nb_event = AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "unweighted_events.lhe.gz"), get_wgt, trunc_error=1e-2, event_target=self.run_card['nevents'], log_level=logging.DEBUG, normalization=self.run_card['event_norm'], proc_charac=self.proc_characteristic) + + #cleaning + for data in partials_info: + path = data[0] + try: + os.remove(path) + except Exception as error: + try: + os.remove(path[:-3]) # try without the .gz + except: + misc.sprint('no file ', path, 'to clean') + else: + for Gdir in Gdirs: + if os.path.exists(pjoin(Gdir, 'events.lhe')): + result = sum_html.OneResult('') + result.read_results(pjoin(Gdir, 'results.dat')) + sum_xsec += result.get('xsec') + sum_xerru.append(result.get('xerru')) + sum_axsec += result.get('axsec') + + if self.run_card['gridpack'] or self.run_card['nevents']==0: + os.remove(pjoin(Gdir, 'events.lhe')) + continue + + AllEvent.add(pjoin(Gdir, 'events.lhe'), + result.get('xsec'), + result.get('xerru'), + result.get('axsec') + ) + + if len(AllEvent) == 0: + nb_event = 0 + else: + nb_event = AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "unweighted_events.lhe.gz"), + get_wgt, trunc_error=1e-2, event_target=self.run_card['nevents'], + log_level=logging.DEBUG, normalization=self.run_card['event_norm'], + proc_charac=self.proc_characteristic) + + if nb_event < self.run_card['nevents']: + logger.warning("failed to generate enough events. Please follow one of the following suggestions to fix the issue:") + logger.warning(" - set in the run_card.dat 'sde_strategy' to %s", 1 + self.run_card['sde_strategy'] % 2) + logger.warning(" - set in the run_card.dat 'hard_survey' to 1 or 2.") + logger.warning(" - reduce the number of requested events (if set too high)") + logger.warning(" - check that you do not have -integrable- singularity in your amplitude.") + logger.warning(" - regenerate your process directory by selecting another gauge (in particular try FD gauge).") - if nb_event < self.run_card['nevents']: - logger.warning("failed to generate enough events. Please follow one of the following suggestions to fix the issue:") - logger.warning(" - set in the run_card.dat 'sde_strategy' to %s", 1 + self.run_card['sde_strategy'] % 2) - logger.warning(" - set in the run_card.dat 'hard_survey' to 1 or 2.") - logger.warning(" - reduce the number of requested events (if set too high)") - logger.warning(" - check that you do not have -integrable- singularity in your amplitude.") - if partials: - for i in range(partials): - try: - os.remove(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % i)) - except Exception: - os.remove(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe" % i)) self.results.add_detail('nb_event', nb_event) @@ -3789,7 +3859,50 @@ def do_combine_events(self, line): logger.info("combination of events done in %s s ", time.time()-start) self.to_store.append('event') + + ############################################################################ + def do_combine_events_partial(self, line, preprocess_only=False): + """ """ + + AllEvent = lhe_parser.MultiEventFile() + + sum_xsec, sum_xerru, sum_axsec = 0,[],0 + output, banner_path,cross = line.split()[:3] + Gdirs = line.split()[3:] + + cross = float(cross) + if not self.banner: + self.banner = banner_mod.Banner(banner_path) + if not hasattr(self, 'run_card'): + self.run_card = banner_mod.RunCard(self.banner['mgruncard']) + AllEvent.banner = self.banner + + for Gdir in Gdirs: + if os.path.exists(pjoin(Gdir, 'events.lhe')): + result = sum_html.OneResult('') + result.read_results(pjoin(Gdir, 'results.dat')) + sum_xsec += result.get('xsec') + sum_xerru.append(result.get('xerru')) + sum_axsec += result.get('axsec') + + if self.run_card['gridpack'] or self.run_card['nevents']==0: + os.remove(pjoin(Gdir, 'events.lhe')) + continue + if not preprocess_only: + AllEvent.add(pjoin(Gdir, 'events.lhe'), + result.get('xsec'), + result.get('xerru'), + result.get('axsec') + ) + if preprocess_only: + return output, sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), sum_axsec + nb_event = max(min(abs(1.01*self.run_card['nevents']*sum_axsec/cross),self.run_card['nevents']), 10) + get_wgt = lambda event: event.wgt + AllEvent.unweight(output, + get_wgt, log_level=5, trunc_error=1e-2, event_target=nb_event) + return output, sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), sum_axsec + ############################################################################ def correct_bias(self): """check the first event and correct the weight by the bias @@ -3902,13 +4015,19 @@ def do_store_events(self, line): #except Exception: # continue # Store log - try: - if os.path.exists(pjoin(G_path, 'log.txt')): - input = pjoin(G_path, 'log.txt') + input = pjoin(G_path, 'log.txt') + if os.path.exists(input): + if self.run_card['keep_log'] not in ["none", "minimal"]: output = pjoin(G_path, '%s_log.txt' % run) - files.mv(input, output) - except Exception: - continue + try: + files.mv(input, output) + except Exception: + continue + elif self.run_card['keep_log'] == "none": + try: + os.remove(input) + except Exception: + continue #try: # # Grid # for name in ['ftn26']: @@ -3989,7 +4108,7 @@ def do_create_gridpack(self, line): misc.call(['./bin/internal/make_gridpack'], cwd=self.me_dir) files.mv(pjoin(self.me_dir, 'gridpack.tar.gz'), pjoin(self.me_dir, '%s_gridpack.tar.gz' % self.run_name)) - os.system("sed -i.bak \"s/\s*.true.*=.*GridRun/ .false. = GridRun/g\" %s/Cards/grid_card.dat" \ + os.system("sed -i.bak \"s/\\s*.true.*=.*GridRun/ .false. = GridRun/g\" %s/Cards/grid_card.dat" \ % self.me_dir) self.update_status('gridpack created', level='gridpack') @@ -4476,7 +4595,7 @@ def do_pythia8(self, line): else: preamble = misc.get_HEPTools_location_setter( pjoin(MG5DIR,'HEPTools'),'lib') - preamble += "\n unset PYTHIA8DATA\n" + #preamble += "\n unset PYTHIA8DATA\n" open(pythia_cmd_card,'w').write("""! ! It is possible to run this card manually with: @@ -4691,7 +4810,7 @@ def do_pythia8(self, line): # Make sure to sure the number of split_events determined during the splitting. split_PY8_Card.systemSet('Main:numberOfEvents',partition_for_PY8[i]) split_PY8_Card.systemSet('HEPMCoutput:scaling',split_PY8_Card['HEPMCoutput:scaling']* - (float(partition_for_PY8[i])/float(n_events))) + (float(partition_for_PY8[i]))) # Add_missing set to False so as to be sure not to add any additional parameter w.r.t # the ones in the original PY8 param_card copied. split_PY8_Card.write(pjoin(parallelization_dir,'PY8Card_%d.dat'%i), @@ -4963,9 +5082,9 @@ def wait_monitoring(Idle, Running, Done): if cross_sections: # Filter the cross_sections specified an keep only the ones # with central parameters and a different merging scale - a_float_re = '[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' + a_float_re = r'[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' central_merging_re = re.compile( - '^\s*Weight_MERGING\s*=\s*(?P%s)\s*$'%a_float_re, + r'^\s*Weight_MERGING\s*=\s*(?P%s)\s*$'%a_float_re, re.IGNORECASE) cross_sections = dict( (float(central_merging_re.match(xsec).group('merging')),value) @@ -5016,8 +5135,8 @@ def wait_monitoring(Idle, Running, Done): def parse_PY8_log_file(self, log_file_path): """ Parse a log file to extract number of event and cross-section. """ - pythiare = re.compile("Les Houches User Process\(es\)\s*\d+\s*\|\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)\s*\|\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") - pythia_xsec_re = re.compile("Inclusive cross section\s*:\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") + pythiare = re.compile(r"Les Houches User Process\(es\)\s*\d+\s*\|\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)\s*\|\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") + pythia_xsec_re = re.compile(r"Inclusive cross section\s*:\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") sigma_m, Nacc, Ntry = None, None, None for line in misc.BackRead(log_file_path): info = pythiare.search(line) @@ -5158,7 +5277,7 @@ def do_pythia(self, line): # read the line from the bottom of the file #pythia_log = misc.BackRead(pjoin(self.me_dir,'Events', self.run_name, # '%s_pythia.log' % tag)) - pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") + pythiare = re.compile(r"\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") for line in misc.reverse_readline(pjoin(self.me_dir,'Events', self.run_name, '%s_pythia.log' % tag)): info = pythiare.search(line) @@ -5619,8 +5738,8 @@ def launch_job(self,exe, cwd=None, stdout=None, argument = [], remaining=0, input_files.append(self.get_pdf_input_filename()) #Find the correct ajob - Gre = re.compile("\s*j=(G[\d\.\w]+)") - origre = re.compile("grid_directory=(G[\d\.\w]+)") + Gre = re.compile(r"\s*j=(G[\d\.\w]+)") + origre = re.compile(r"grid_directory=(G[\d\.\w]+)") try : fsock = open(exe) except Exception: @@ -5628,7 +5747,7 @@ def launch_job(self,exe, cwd=None, stdout=None, argument = [], remaining=0, text = fsock.read() output_files = Gre.findall(text) if not output_files: - Ire = re.compile("for i in ([\d\.\s]*) ; do") + Ire = re.compile(r"for i in ([\d\.\s]*) ; do") data = Ire.findall(text) data = ' '.join(data).split() for nb in data: @@ -6035,7 +6154,7 @@ def get_last_tag(self, level): 'syscalc':[], 'rivet':['rivet']} - if name == self.run_name: + if name and name == self.run_name: if reload_card: run_card = pjoin(self.me_dir, 'Cards','run_card.dat') self.run_card = banner_mod.RunCard(run_card) @@ -6334,7 +6453,7 @@ def run_syscalc(self, mode='parton', event_path=None, output=None): elif mode == 'Pythia': stdout = open(pjoin(event_dir, self.run_name, '%s_%s_syscalc.log' % (tag,mode)),'w') if 'mgpythiacard' in self.banner: - pat = re.compile('''^\s*qcut\s*=\s*([\+\-\d.e]*)''', re.M+re.I) + pat = re.compile(r'''^\s*qcut\s*=\s*([\+\-\d.e]*)''', re.M+re.I) data = pat.search(self.banner['mgpythiacard']) if data: qcut = float(data.group(1)) @@ -6611,7 +6730,7 @@ def get_subP_ids(path): for line in open(pjoin(path, 'leshouche.inc')): if not 'IDUP' in line: continue - particles = re.search("/([\d,-]+)/", line) + particles = re.search(r"/([\d,-]+)/", line) all_ids.append([int(p) for p in particles.group(1).split(',')]) return all_ids @@ -6899,6 +7018,7 @@ def do_combine_events(self, line): partials = 0 # if too many file make some partial unweighting sum_xsec, sum_xerru, sum_axsec = 0,[],0 + partials_info = [] Gdirs = self.get_Gdir() Gdirs.sort() for Gdir in Gdirs: @@ -6917,16 +7037,21 @@ def do_combine_events(self, line): sum_axsec += result.get('axsec')*gscalefact[Gdir] if len(AllEvent) >= 80: #perform a partial unweighting + nb_event = min(abs(1.01*self.nb_event*sum_axsec/self.results.current['cross']),self.run_card['nevents']) AllEvent.unweight(pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), - get_wgt, log_level=5, trunc_error=1e-2, event_target=self.nb_event) + get_wgt, log_level=5, trunc_error=1e-2, event_target=nb_event) AllEvent = lhe_parser.MultiEventFile() AllEvent.banner = self.banner - AllEvent.add(pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), + partials_info.append((pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), - sum_axsec) + sum_axsec) ) + sum_xsec, sum_xerru, sum_axsec = 0,[],0 partials +=1 + for data in partials_info: + AllEvent.add(*data) + if not hasattr(self,'proc_characteristic'): self.proc_characteristic = self.get_characteristics() diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/misc.py b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/misc.py index c4c669f36b..e7fd60be0d 100755 --- a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/misc.py +++ b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/misc.py @@ -67,7 +67,7 @@ def parse_info_str(fsock): """ info_dict = {} - pattern = re.compile("(?P\w*)\s*=\s*(?P.*)", + pattern = re.compile(r"(?P\w*)\s*=\s*(?P.*)", re.IGNORECASE | re.VERBOSE) for entry in fsock: entry = entry.strip() @@ -84,7 +84,7 @@ def parse_info_str(fsock): def glob(name, path=''): """call to glob.glob with automatic security on path""" import glob as glob_module - path = re.sub('(?P\?|\*|\[|\])', '[\g]', path) + path = re.sub(r'(?P\?|\*|\[|\])', r'[\g]', path) return glob_module.glob(pjoin(path, name)) #=============================================================================== @@ -614,10 +614,10 @@ def mod_compilator(directory, new='gfortran', current=None, compiler_type='gfort #search file file_to_change=find_makefile_in_dir(directory) if compiler_type == 'gfortran': - comp_re = re.compile('^(\s*)FC\s*=\s*(.+)\s*$') + comp_re = re.compile(r'^(\s*)FC\s*=\s*(.+)\s*$') var = 'FC' elif compiler_type == 'cpp': - comp_re = re.compile('^(\s*)CXX\s*=\s*(.+)\s*$') + comp_re = re.compile(r'^(\s*)CXX\s*=\s*(.+)\s*$') var = 'CXX' else: MadGraph5Error, 'Unknown compiler type: %s' % compiler_type @@ -861,9 +861,9 @@ def detect_current_compiler(path, compiler_type='fortran'): # comp = re.compile("^\s*FC\s*=\s*(\w+)\s*") # The regular expression below allows for compiler definition with absolute path if compiler_type == 'fortran': - comp = re.compile("^\s*FC\s*=\s*([\w\/\\.\-]+)\s*") + comp = re.compile("^\\s*FC\\s*=\\s*([\\w\\/\\.\\-]+)\\s*") elif compiler_type == 'cpp': - comp = re.compile("^\s*CXX\s*=\s*([\w\/\\.\-]+)\s*") + comp = re.compile("^\\s*CXX\\s*=\\s*([\\w\\/\\.\\-]+)\\s*") else: MadGraph5Error, 'Unknown compiler type: %s' % compiler_type @@ -1001,7 +1001,19 @@ def call_stdout(arg, *args, **opt): def copytree(src, dst, symlinks = False, ignore = None): if not os.path.exists(dst): os.makedirs(dst) - shutil.copystat(src, dst) + try: + shutil.copystat(src, dst) + except PermissionError: + if os.path.realpath(src).startswith('/cvmfs') and os.path.realpath(dst).startswith('/afs'): + # allowing missmatch from cvmfs to afs since sounds to not create issue --at least in general-- + logger.critical(f'Ignoring that we could not copy permissions from {src} to {dst}') + else: + logger.critical(f'Permission error detected from {src} to {dst}.\n'+\ + 'If you are using WSL with windows partition, please try using python3.12\n'+\ + 'or avoid moving your data from the WSL partition to the UNIX one') + # we do not have enough experience in WSL to allow it to get trough. + raise + lst = os.listdir(src) if ignore: excl = ignore(src, lst) @@ -1895,12 +1907,12 @@ class EasterEgg(object): May4_banner = "* _____ *\n" + \ "* ,-~\" \"~-. *\n" + \ "* * ,^ ___ ^. * *\n" + \ - "* * / .^ ^. \ * *\n" + \ + "* * / .^ ^. \\ * *\n" + \ "* * Y l o ! Y * *\n" + \ "* * l_ `.___.' _,[ * *\n" + \ "* * |^~\"--------------~\"\"^| * *\n" + \ "* * ! May the 4th ! * *\n" + \ - "* * \ / * *\n" + \ + "* * \\ / * *\n" + \ "* * ^. .^ * *\n" + \ "* * \"-.._____.,-\" * *\n" @@ -1909,13 +1921,13 @@ class EasterEgg(object): "* M::::::::::M M::::::::::M *\n" + \ "* M:::::::::::M M:::::::::::M (_)___ *\n" + \ "* M:::::::M::::M M::::M:::::::M | / __| *\n" + \ - "* M::::::M M::::M M::::M M::::::M | \__ \ *\n" + \ + "* M::::::M M::::M M::::M M::::::M | \\__ \\ *\n" + \ "* M::::::M M::::M::::M M::::::M |_|___/ *\n" + \ "* M::::::M M:::::::M M::::::M *\n" + \ "* M::::::M M:::::M M::::::M / _| ___ _ __ *\n" + \ - "* M::::::M MMMMM M::::::M | |_ / _ \| '__| *\n" + \ + "* M::::::M MMMMM M::::::M | |_ / _ \\| '__| *\n" + \ "* M::::::M M::::::M | _| (_) | | *\n" + \ - "* M::::::M M::::::M |_/\/\___/|_| *\n" + \ + "* M::::::M M::::::M |_/\\/\\___/|_| *\n" + \ "* M::::::M M::::::M *\n" + \ "* MMMMMMMM MMMMMMMM *\n" + \ "* *\n" + \ @@ -2233,39 +2245,51 @@ def import_python_lhapdf(lhapdfconfig): os.environ['LD_LIBRARY_PATH'] = lhapdf_libdir else: os.environ['LD_LIBRARY_PATH'] = '%s:%s' %(lhapdf_libdir,os.environ['LD_LIBRARY_PATH']) - try: candidates=[dirname for dirname in os.listdir(lhapdf_libdir) \ if os.path.isdir(os.path.join(lhapdf_libdir,dirname))] except OSError: candidates=[] + if os.path.isdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')): + candidates += [pjoin(os.pardir,'local', 'lib', dirname) for dirname in os.listdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')) + if os.path.isdir(os.path.join(lhapdf_libdir,os.pardir, 'local', 'lib', dirname))] for candidate in candidates: - if os.path.isdir(os.path.join(lhapdf_libdir,candidate,'site-packages')): - sys.path.insert(0,os.path.join(lhapdf_libdir,candidate,'site-packages')) - try: - import lhapdf - use_lhapdf=True - break - except ImportError: - sys.path.pop(0) - continue + for subdir in ['site-packages', 'dist-packages']: + if os.path.isdir(os.path.join(lhapdf_libdir,candidate, subdir)): + sys.path.insert(0,os.path.join(lhapdf_libdir,candidate, subdir)) + try: + import lhapdf + use_lhapdf=True + break + except ImportError as error: + sys.path.pop(0) + continue + else: + continue + break if not use_lhapdf: try: candidates=[dirname for dirname in os.listdir(lhapdf_libdir+'64') \ if os.path.isdir(os.path.join(lhapdf_libdir+'64',dirname))] except OSError: candidates=[] - + if os.path.isdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib64')): + candidates += [pjoin(os.pardir,'local', 'lib64', dirname) for dirname in os.listdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')) + if os.path.isdir(os.path.join(lhapdf_libdir,os.pardir, 'local', 'lib64', dirname))] for candidate in candidates: - if os.path.isdir(os.path.join(lhapdf_libdir+'64',candidate,'site-packages')): - sys.path.insert(0,os.path.join(lhapdf_libdir+'64',candidate,'site-packages')) - try: - import lhapdf - use_lhapdf=True - break - except ImportError: - sys.path.pop(0) - continue + for subdir in ['site-packages', 'dist-packages']: + if os.path.isdir(os.path.join(lhapdf_libdir+'64',candidate, subdir)): + sys.path.insert(0,os.path.join(lhapdf_libdir+'64',candidate, subdir)) + try: + import lhapdf + use_lhapdf=True + break + except ImportError as error: + sys.path.pop(0) + continue + else: + continue + break if not use_lhapdf: try: import lhapdf diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/shower_card.py b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/shower_card.py index e87d534177..16ed72b1a0 100755 --- a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/shower_card.py +++ b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/shower_card.py @@ -288,7 +288,7 @@ def write(self, output_file, template=None, python_template=False, self.text = open(template,'r').read() - key_re = re.compile('^(\s*)([\S^#]+)(\s*)=(\s*)([^#]*?)(\s*)(\#.*|$)') + key_re = re.compile(r'^(\s*)([\S^#]+)(\s*)=(\s*)([^#]*?)(\s*)(\#.*|$)') newlines = [] for line in self.text.split('\n'): key_match = key_re.findall(line) diff --git a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/systematics.py b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/systematics.py index 28eaed00e2..2acebd087c 100644 --- a/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/systematics.py +++ b/epochX/cudacpp/smeft_gg_tttt.mad/bin/internal/systematics.py @@ -582,7 +582,7 @@ def print_cross_sections(self, all_cross, nb_event, stdout): else: resume.write( '#PDF %s: %g +%2.3g%% -%2.3g%%\n' % (pdfset.name, pdferr.central,pdferr.errplus*100/all_cross[0], pdferr.errminus*100/all_cross[0])) - dyn_name = {1: '\sum ET', 2:'\sum\sqrt{m^2+pt^2}', 3:'0.5 \sum\sqrt{m^2+pt^2}',4:'\sqrt{\hat s}' } + dyn_name = {1: r'\sum ET', 2:r'\sum\sqrt{m^2+pt^2}', 3:r'0.5 \sum\sqrt{m^2+pt^2}',4:r'\sqrt{\hat s}' } for key, curr in dyns.items(): if key ==-1: continue @@ -789,7 +789,7 @@ def get_id(self): return int(self.start_wgt_id) if 'initrwgt' in self.banner: - pattern = re.compile(' set lhapdf /PATH/TO/lhapdf-config -None does not seem to correspond to a valid lhapdf-config executable. -Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config). -Note that you can still compile and run aMC@NLO with the built-in PDFs - MG5_aMC> set lhapdf /PATH/TO/lhapdf-config - Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt -import /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt.mg +import /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt.mg The import format was not given, so we guess it as command set stdout_level DEBUG set output information to level: 10 set zerowidth_tchannel F set auto_convert_model T save options auto_convert_model -save configuration file to /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +save configuration file to /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt import model SMEFTsim_topU3l_MwScheme_UFO -massless_4t INFO: load particles INFO: load vertices @@ -77,7 +72,7 @@ INFO: load vertices DEBUG: MG5 converter defines FFFF26 to Gamma(-2,-4,-3)*Gamma(-2,2,-6)*Gamma(-1,-6,-5)*Gamma(-1,4,-4)*ProjP(-5,1)*ProjP(-3,3) + Gamma(-2,-4,-3)*Gamma(-2,4,-6)*Gamma(-1,-6,-5)*Gamma(-1,2,-4)*ProjP(-5,3)*ProjP(-3,1) + Gamma(-2,-4,-3)*Gamma(-2,2,-6)*Gamma(-1,-6,-5)*Gamma(-1,4,-4)*ProjM(-5,1)*ProjM(-3,3) + Gamma(-2,-4,-3)*Gamma(-2,4,-6)*Gamma(-1,-6,-5)*Gamma(-1,2,-4)*ProjM(-5,3)*ProjM(-3,1)  DEBUG: MG5 converter defines FFFF27 to ProjP(2,1)*ProjP(4,3) + ProjM(2,1)*ProjM(4,3)  DEBUG: MG5 converter defines FFFF112 to ProjM(2,3)*ProjM(4,1) + ProjP(2,3)*ProjP(4,1)  -DEBUG: model prefixing takes 0.1392049789428711  +DEBUG: model prefixing takes 0.14107561111450195  INFO: Change particles name to pass to MG5 convention Defined multiparticle p = g u c d s u~ c~ d~ s~ Defined multiparticle j = g u c d s u~ c~ d~ s~ @@ -92,17 +87,16 @@ INFO: Please specify coupling orders to bypass this step. INFO: Trying coupling order WEIGHTED<=4: WEIGTHED IS QCD+2*QED+99*SMHLOOP+99*NP+99*NPshifts+99*NPprop+99*NPcpv+NPcbb+NPcbB+NPcbBB+NPcbd1+NPcbd8+NPcbe+NPcbG+NPcbH+NPcbj1+NPcbj8+NPcbl+NPcbu1+NPcbu8+NPcbW+NPcdB+NPcdd1+NPcdd8+NPcdG+NPcdH+NPcdW+NPceB+NPced+NPcee+NPceH+NPceu+NPceW+NPcG+NPcGtil+NPcH+NPcHB+NPcHbox+NPcHbq+NPcHBtil+NPcHd+NPcHDD+NPcHe+NPcHG+NPcHGtil+NPcHj1+NPcHj3+NPcHl1+NPcHl3+NPcHQ1+NPcHQ3+NPcHt+NPcHtb+NPcHu+NPcHud+NPcHW+NPcHWB+NPcHWBtil+NPcHWtil+NPcjd1+NPcjd8+NPcje+NPcjj11+NPcjj18+NPcjj31+NPcjj38+NPcjQbd1+NPcjQbd8+NPcjQtu1+NPcjQtu8+NPcjtQd1+NPcjtQd8+NPcju1+NPcju8+NPcjujd1+NPcjujd11+NPcjujd8+NPcjujd81+NPcjuQb1+NPcjuQb8+NPcld+NPcle+NPclebQ+NPcledj+NPcleju1+NPcleju3+NPcleQt1+NPcleQt3+NPclj1+NPclj3+NPcll+NPcll1+NPclu+NPcQb1+NPcQb8+NPcQd1+NPcQd8+NPcQe+NPcQj11+NPcQj18+NPcQj31+NPcQj38+NPcQl1+NPcQl3+NPcQQ1+NPcQQ8+NPcQt1+NPcQt8+NPcQtjd1+NPcQtjd8+NPcQtQb1+NPcQtQb8+NPcQu1+NPcQu8+NPcQujb1+NPcQujb8+NPctB+NPctb1+NPctb8+NPctd1+NPctd8+NPcte+NPctG+NPctH+NPctj1+NPctj8+NPctl+NPctt+NPctu1+NPctu8+NPctW+NPcuB+NPcud1+NPcud8+NPcuG+NPcuH+NPcutbd1+NPcutbd8+NPcuu1+NPcuu8+NPcuW+NPcW+NPcWtil+NPQjujb8 INFO: Trying process: g g > t t~ t t~ WEIGHTED<=4 @1 INFO: Process has 72 diagrams -1 processes with 72 diagrams generated in 3.734 s +1 processes with 72 diagrams generated in 3.786 s Total: 1 processes with 72 diagrams output standalone_cudacpp ../TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt Load PLUGIN.CUDACPP_OUTPUT -Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.5.3_lo_vect. +Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.6.0_lo_vect. It has been validated for the last time with version: 3.5.2 Output will be done with PLUGIN: CUDACPP_OUTPUT -DEBUG: cformat =  plugin [export_cpp.py at line 3070]  DEBUG: Entering PLUGIN_ProcessExporter.__init__ (initialise the exporter) [output.py at line 165]  DEBUG: Entering PLUGIN_ProcessExporter.copy_template (initialise the directory) [output.py at line 170]  -INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt +INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt INFO: Organizing processes into subprocess groups INFO: Generating Helas calls for process: g g > t t~ t t~ WEIGHTED<=4 @1 INFO: Processing color information for process: g g > t t~ t t~ @1 @@ -111,18 +105,18 @@ INFO: Processing color information for process: g g > t t~ t t~ @1 DEBUG: type(fortran_model)= [output.py at line 214]  DEBUG: type(me)= me=0 [output.py at line 215]  DEBUG: "need to link", self.to_link_in_P =  need to link ['nvtx.h', 'timer.h', 'timermap.h', 'ompnumthreads.h', 'GpuRuntime.h', 'GpuAbstraction.h', 'MemoryAccessHelpers.h', 'MemoryAccessVectors.h', 'MemoryAccessMatrixElements.h', 'MemoryAccessMomenta.h', 'MemoryAccessRandomNumbers.h', 'MemoryAccessWeights.h', 'MemoryAccessAmplitudes.h', 'MemoryAccessWavefunctions.h', 'MemoryAccessGs.h', 'MemoryAccessCouplingsFixed.h', 'MemoryAccessNumerators.h', 'MemoryAccessDenominators.h', 'MemoryAccessChannelIds.h', 'EventStatistics.h', 'CommonRandomNumbers.h', 'CrossSectionKernels.cc', 'CrossSectionKernels.h', 'MatrixElementKernels.cc', 'MatrixElementKernels.h', 'RamboSamplingKernels.cc', 'RamboSamplingKernels.h', 'RandomNumberKernels.h', 'CommonRandomNumberKernel.cc', 'CurandRandomNumberKernel.cc', 'HiprandRandomNumberKernel.cc', 'Bridge.h', 'BridgeKernels.cc', 'BridgeKernels.h', 'fbridge.cc', 'fbridge.inc', 'fsampler.cc', 'fsampler.inc', 'MadgraphTest.h', 'runTest.cc', 'testmisc.cc', 'testxxx_cc_ref.txt', 'valgrind.h', 'cudacpp.mk', 'testxxx.cc', 'MemoryBuffers.h', 'MemoryAccessCouplings.h', 'perf.py', 'profile.sh'] [output.py at line 216]  -INFO: Creating files in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt/SubProcesses/P1_Sigma_SMEFTsim_topU3l_MwScheme_UFO_gg_ttxttx -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt/SubProcesses/P1_Sigma_SMEFTsim_topU3l_MwScheme_UFO_gg_ttxttx/./CPPProcess.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt/SubProcesses/P1_Sigma_SMEFTsim_topU3l_MwScheme_UFO_gg_ttxttx/./CPPProcess.cc -INFO: Created files CPPProcess.h and CPPProcess.cc in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt/SubProcesses/P1_Sigma_SMEFTsim_topU3l_MwScheme_UFO_gg_ttxttx/. -Generated helas calls for 1 subprocesses (72 diagrams) in 0.195 s +INFO: Creating files in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt/SubProcesses/P1_Sigma_SMEFTsim_topU3l_MwScheme_UFO_gg_ttxttx +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt/SubProcesses/P1_Sigma_SMEFTsim_topU3l_MwScheme_UFO_gg_ttxttx/./CPPProcess.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt/SubProcesses/P1_Sigma_SMEFTsim_topU3l_MwScheme_UFO_gg_ttxttx/./CPPProcess.cc +INFO: Created files CPPProcess.h and CPPProcess.cc in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt/SubProcesses/P1_Sigma_SMEFTsim_topU3l_MwScheme_UFO_gg_ttxttx/. +Generated helas calls for 1 subprocesses (72 diagrams) in 0.191 s ALOHA: aloha starts to compute helicity amplitudes ALOHA: aloha creates VVV5 routines ALOHA: aloha creates FFV1 routines ALOHA: aloha creates VVVV1 routines ALOHA: aloha creates VVVV9 routines ALOHA: aloha creates VVVV10 routines -ALOHA: aloha creates 5 routines in 0.335 s +ALOHA: aloha creates 5 routines in 0.326 s VVV5 VVV5 FFV1 @@ -132,17 +126,17 @@ ALOHA: aloha creates 5 routines in 0.335 s VVVV1 VVVV9 VVVV10 -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt/src/./HelAmps_SMEFTsim_topU3l_MwScheme_UFO.h -INFO: Created file HelAmps_SMEFTsim_topU3l_MwScheme_UFO.h in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt/src/. +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt/src/./HelAmps_SMEFTsim_topU3l_MwScheme_UFO.h +INFO: Created file HelAmps_SMEFTsim_topU3l_MwScheme_UFO.h in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt/src/. super_write_set_parameters_onlyfixMajorana (hardcoded=False) super_write_set_parameters_onlyfixMajorana (hardcoded=True) -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt/src/./Parameters_SMEFTsim_topU3l_MwScheme_UFO.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt/src/./Parameters_SMEFTsim_topU3l_MwScheme_UFO.cc +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt/src/./Parameters_SMEFTsim_topU3l_MwScheme_UFO.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt/src/./Parameters_SMEFTsim_topU3l_MwScheme_UFO.cc INFO: Created files Parameters_SMEFTsim_topU3l_MwScheme_UFO.h and Parameters_SMEFTsim_topU3l_MwScheme_UFO.cc in directory -INFO: /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt/src/. and /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt/src/. +INFO: /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt/src/. and /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_smeft_gg_tttt/src/. quit -real 0m5.213s -user 0m5.091s -sys 0m0.068s +real 0m5.220s +user 0m5.109s +sys 0m0.071s Code generation completed in 5 seconds diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/CODEGEN_mad_susy_gg_t1t1_log.txt b/epochX/cudacpp/susy_gg_t1t1.mad/CODEGEN_mad_susy_gg_t1t1_log.txt index ef041da63e..5c926cec7c 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/CODEGEN_mad_susy_gg_t1t1_log.txt +++ b/epochX/cudacpp/susy_gg_t1t1.mad/CODEGEN_mad_susy_gg_t1t1_log.txt @@ -14,7 +14,7 @@ Running MG5 in debug mode * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect 2023-12-23 * +* VERSION 3.6.0_lo_vect 2024-06-17 * * * * WARNING: UNKNOWN DEVELOPMENT VERSION. * * WARNING: DO NOT USE FOR PRODUCTION * @@ -45,15 +45,10 @@ Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (inclu Note that you can still compile and run aMC@NLO with the built-in PDFs MG5_aMC> set lhapdf /PATH/TO/lhapdf-config -None does not seem to correspond to a valid lhapdf-config executable. -Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config). -Note that you can still compile and run aMC@NLO with the built-in PDFs - MG5_aMC> set lhapdf /PATH/TO/lhapdf-config - Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt -import /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1.mg +import /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1.mg The import format was not given, so we guess it as command set stdout_level DEBUG set output information to level: 10 @@ -554,24 +549,24 @@ INFO: Please specify coupling orders to bypass this step. INFO: Trying coupling order WEIGHTED<=2: WEIGTHED IS QCD+2*QED INFO: Trying process: g g > t1 t1~ WEIGHTED<=2 @1 INFO: Process has 6 diagrams -1 processes with 6 diagrams generated in 0.132 s +1 processes with 6 diagrams generated in 0.126 s Total: 1 processes with 6 diagrams output madevent_simd ../TMPOUT/CODEGEN_mad_susy_gg_t1t1 --hel_recycling=False --vector_size=32 Load PLUGIN.CUDACPP_OUTPUT -Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.5.3_lo_vect. +Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.6.0_lo_vect. It has been validated for the last time with version: 3.5.2 Output will be done with PLUGIN: CUDACPP_OUTPUT Addition matrix-element will be done with PLUGIN: CUDACPP_OUTPUT +DEBUG: opt['output_options']['vector_size'] =  32 [export_v4.py at line 4334]  Output will be done with PLUGIN: CUDACPP_OUTPUT -DEBUG: cformat =  standalone_simd [export_cpp.py at line 3070]  DEBUG: Entering PLUGIN_ProcessExporter.__init__ (initialise the exporter) [output.py at line 165]  INFO: initialize a new directory: CODEGEN_mad_susy_gg_t1t1 INFO: remove old information in CODEGEN_mad_susy_gg_t1t1 DEBUG: Entering PLUGIN_ProcessExporter.copy_template (initialise the directory) [output.py at line 170]  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1  -INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1 -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/Cards  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/SubProcesses  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1  +INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1 +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/Cards  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/SubProcesses  INFO: Organizing processes into subprocess groups INFO: Generating Helas calls for process: g g > t1 t1~ WEIGHTED<=2 @1 INFO: Processing color information for process: g g > t1 t1~ @1 @@ -581,18 +576,14 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [0, 1, 2, 3, 4, 5] [export_cpp.py at line 711]  -DEBUG: subproc_number =  0 [export_cpp.py at line 712]  -DEBUG: Done [export_cpp.py at line 713]  INFO: Generating Feynman diagrams for Process: g g > t1 t1~ WEIGHTED<=2 @1 INFO: Finding symmetric diagrams for subprocess group gg_t1t1x -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/SubProcesses/P1_gg_t1t1x [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  5 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 2, 2: 3, 3: 4, 4: 5, 5: 6} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {2: 1, 3: 2, 4: 3, 5: 4, 6: 5} [model_handling.py at line 1548]  Generated helas calls for 1 subprocesses (6 diagrams) in 0.008 s -Wrote files for 16 helas calls in 0.094 s +Wrote files for 16 helas calls in 0.083 s +DEBUG: self.vector_size =  32 [export_v4.py at line 7023]  ALOHA: aloha starts to compute helicity amplitudes ALOHA: aloha creates VVV1 set of routines with options: P0 ALOHA: aloha creates VSS1 routines @@ -608,39 +599,41 @@ ALOHA: aloha creates 6 routines in 0.185 s VSS1 VSS1 VVSS1 -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/src/./HelAmps_MSSM_SLHA2.h -INFO: Created file HelAmps_MSSM_SLHA2.h in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/src/. +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/src/./HelAmps_MSSM_SLHA2.h +INFO: Created file HelAmps_MSSM_SLHA2.h in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/src/. super_write_set_parameters_onlyfixMajorana (hardcoded=False) super_write_set_parameters_onlyfixMajorana (hardcoded=True) -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/src/./Parameters_MSSM_SLHA2.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/src/./Parameters_MSSM_SLHA2.cc +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/src/./Parameters_MSSM_SLHA2.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/src/./Parameters_MSSM_SLHA2.cc INFO: Created files Parameters_MSSM_SLHA2.h and Parameters_MSSM_SLHA2.cc in directory -INFO: /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/src/. and /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/src/. +INFO: /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/src/. and /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/src/. The option zerowidth_tchannel is modified [True] but will not be written in the configuration files. If you want to make this value the default for future session, you can run 'save options --all' -save configuration file to /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/Cards/me5_configuration.txt +save configuration file to /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/Cards/me5_configuration.txt INFO: Use Fortran compiler gfortran INFO: Use c++ compiler g++ INFO: Generate jpeg diagrams INFO: Generate web pages -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common -patching file Source/genps.inc +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common patching file SubProcesses/makefile -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/SubProcesses/P1_gg_t1t1x; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/SubProcesses/P1_gg_t1t1x; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f -Hunk #2 succeeded at 221 (offset -12 lines). +Hunk #2 succeeded at 215 (offset 1 line). DEBUG: p.returncode =  0 [output.py at line 258]  -Output to directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1 done. +Output to directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1 done. Type "launch" to generate events from this process, or see -/data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/README +/data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/README Run "open index.html" to see more information about this process. quit -real 0m3.457s -user 0m2.741s -sys 0m0.294s -Code generation completed in 4 seconds +real 0m3.008s +user 0m2.691s +sys 0m0.313s +Code generation completed in 3 seconds ************************************************************ * * * W E L C O M E to * @@ -653,7 +646,7 @@ Code generation completed in 4 seconds * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect * +* VERSION 3.6.0_lo_vect * * * * The MadGraph5_aMC@NLO Development Team - Find us at * * https://server06.fynu.ucl.ac.be/projects/madgraph * @@ -661,9 +654,9 @@ Code generation completed in 4 seconds * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt @@ -683,7 +676,7 @@ launch in debug mode * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect * +* VERSION 3.6.0_lo_vect * * * * The MadGraph5_aMC@NLO Development Team - Find us at * * https://server06.fynu.ucl.ac.be/projects/madgraph * @@ -691,9 +684,9 @@ launch in debug mode * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_t1t1/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/Cards/me5_configuration.txt b/epochX/cudacpp/susy_gg_t1t1.mad/Cards/me5_configuration.txt index cdeedc7863..4f5079f78a 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/Cards/me5_configuration.txt +++ b/epochX/cudacpp/susy_gg_t1t1.mad/Cards/me5_configuration.txt @@ -116,6 +116,7 @@ # cluster_type = condor # cluster_queue = madgraph # cluster_size = 150 +# cluster_walltime = # time in minute for slurm and second for condor (not supported for other scheduller) #! Path to a node directory to avoid direct writing on the central disk #! Note that condor clusters avoid direct writing by default (therefore this @@ -234,7 +235,7 @@ # pineappl = pineappl -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo # MG5 MAIN DIRECTORY -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/Cards/param_card.dat b/epochX/cudacpp/susy_gg_t1t1.mad/Cards/param_card.dat index 16c221de5e..ffa472ed77 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/Cards/param_card.dat +++ b/epochX/cudacpp/susy_gg_t1t1.mad/Cards/param_card.dat @@ -1,5 +1,5 @@ ###################################################################### -## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL #### +## PARAM_CARD AUTOMATICALLY GENERATED BY MG5 FOLLOWING UFO MODEL #### ###################################################################### ## ## ## Width set on Auto will be computed following the information ## diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/Cards/param_card_default.dat b/epochX/cudacpp/susy_gg_t1t1.mad/Cards/param_card_default.dat index 16c221de5e..ffa472ed77 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/Cards/param_card_default.dat +++ b/epochX/cudacpp/susy_gg_t1t1.mad/Cards/param_card_default.dat @@ -1,5 +1,5 @@ ###################################################################### -## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL #### +## PARAM_CARD AUTOMATICALLY GENERATED BY MG5 FOLLOWING UFO MODEL #### ###################################################################### ## ## ## Width set on Auto will be computed following the information ## diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/Cards/proc_card_mg5.dat b/epochX/cudacpp/susy_gg_t1t1.mad/Cards/proc_card_mg5.dat index 43d8d77a42..c4c44ef282 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/Cards/proc_card_mg5.dat +++ b/epochX/cudacpp/susy_gg_t1t1.mad/Cards/proc_card_mg5.dat @@ -8,7 +8,7 @@ #* * * * #* * #* * -#* VERSION 3.5.3_lo_vect 2023-12-23 * +#* VERSION 3.6.0_lo_vect 2024-06-17 * #* * #* WARNING: UNKNOWN DEVELOPMENT VERSION. * #* WARNING: DO NOT USE FOR PRODUCTION * diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/Cards/reweight_card_default.dat b/epochX/cudacpp/susy_gg_t1t1.mad/Cards/reweight_card_default.dat index ace534ae02..5cc65fe095 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/Cards/reweight_card_default.dat +++ b/epochX/cudacpp/susy_gg_t1t1.mad/Cards/reweight_card_default.dat @@ -19,8 +19,16 @@ change mode NLO # Define type of Reweighting. For LO sample this command # has no effect since only "LO" mode is allowed. + +#uncomment if you do not want to overwrite the reweight file of Sudakov in rw_me +#change rwgt_dir /PATH_MG5_BRANCH/NAME_FOLDER + +#uncomment if you want to use Sudakov Reweight +#change include_sudakov True + launch + # SPECIFY A PATH OR USE THE SET COMMAND LIKE THIS: # set sminputs 1 130 # modify 1/alpha_EW diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/Cards/run_card.dat b/epochX/cudacpp/susy_gg_t1t1.mad/Cards/run_card.dat index b58554b4f2..6b82577032 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/Cards/run_card.dat +++ b/epochX/cudacpp/susy_gg_t1t1.mad/Cards/run_card.dat @@ -157,6 +157,7 @@ systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++] ['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule + #*********************************************************************** # SIMD/GPU configuration for the CUDACPP plugin #************************************************************************ diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/Cards/run_card_default.dat b/epochX/cudacpp/susy_gg_t1t1.mad/Cards/run_card_default.dat index 6c2c7854ca..99fa8681a6 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/Cards/run_card_default.dat +++ b/epochX/cudacpp/susy_gg_t1t1.mad/Cards/run_card_default.dat @@ -157,6 +157,7 @@ systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++] ['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule + #*********************************************************************** # SIMD/GPU configuration for the CUDACPP plugin #************************************************************************ diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/MGMEVersion.txt b/epochX/cudacpp/susy_gg_t1t1.mad/MGMEVersion.txt index 9d3a5c0ba0..a806d3938c 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/MGMEVersion.txt +++ b/epochX/cudacpp/susy_gg_t1t1.mad/MGMEVersion.txt @@ -1 +1 @@ -3.5.3_lo_vect \ No newline at end of file +3.6.0_lo_vect \ No newline at end of file diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/Source/DHELAS/aloha_functions.f b/epochX/cudacpp/susy_gg_t1t1.mad/Source/DHELAS/aloha_functions.f index 975725737f..47699fa614 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/Source/DHELAS/aloha_functions.f +++ b/epochX/cudacpp/susy_gg_t1t1.mad/Source/DHELAS/aloha_functions.f @@ -351,7 +351,7 @@ subroutine oxxxxx(p,fmass,nhel,nsf , fo) fo(6) = ip * sqm(abs(im)) else - pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2)) +c pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2)) sf(1) = dble(1+nsf+(1-nsf)*nh)*rHalf sf(2) = dble(1+nsf-(1-nsf)*nh)*rHalf omega(1) = dsqrt(p(0)+pp) @@ -2054,7 +2054,7 @@ subroutine CombineAmp(nb, ihels, iwfcts, W1, Wall, Amp) enddo return end - + subroutine CombineAmpS(nb, ihels, iwfcts, W1, Wall, Amp) integer nb ! size of the vectors diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/couplings.f b/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/couplings.f index f3b620ab58..04d6bb5333 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/couplings.f +++ b/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/couplings.f @@ -10,18 +10,27 @@ SUBROUTINE COUP() PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + LOGICAL UPDATELOOP COMMON /TO_UPDATELOOP/UPDATELOOP INCLUDE 'input.inc' - INCLUDE '../vector.inc' + + INCLUDE 'coupl.inc' READLHA = .TRUE. INCLUDE 'intparam_definition.inc' CALL COUP1() + IF (UPDATELOOP) THEN + + CALL COUP2() + + ENDIF + C couplings needed to be evaluated points by points C - CALL COUP2(1) + CALL COUP3(1) RETURN END @@ -47,7 +56,11 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) INCLUDE '../maxparticles.inc' INCLUDE '../cuts.inc' + + INCLUDE '../vector.inc' + + INCLUDE '../run.inc' DOUBLE PRECISION ALPHAS @@ -65,7 +78,7 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) couplings needed to be evaluated points by points C ALL_G(VECID) = G - CALL COUP2(VECID) + CALL COUP3(VECID) RETURN END @@ -80,7 +93,9 @@ SUBROUTINE UPDATE_AS_PARAM2(MU_R2,AS2 ,VECID) INTEGER VECID INCLUDE 'model_functions.inc' INCLUDE 'input.inc' + INCLUDE '../vector.inc' + INCLUDE 'coupl.inc' DOUBLE PRECISION MODEL_SCALE COMMON /MODEL_SCALE/MODEL_SCALE diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/couplings1.f b/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/couplings1.f index e14f3a1770..72cfa0f6e4 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/couplings1.f +++ b/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/couplings1.f @@ -7,11 +7,12 @@ SUBROUTINE COUP1( ) IMPLICIT NONE INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' END diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/couplings2.f b/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/couplings2.f index f9cfe802c7..30f3a04e3b 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/couplings2.f +++ b/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/couplings2.f @@ -2,23 +2,17 @@ c written by the UFO converter ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc - SUBROUTINE COUP2( VECID) + SUBROUTINE COUP2( ) IMPLICIT NONE - INTEGER VECID + INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' - GC_6(VECID) = -G - GC_55(VECID) = -(MDL_COMPLEXI*G*MDL_I51X33)-MDL_COMPLEXI*G - $ *MDL_I52X33 - GC_57(VECID) = -(MDL_COMPLEXI*G*MDL_I51X36)-MDL_COMPLEXI*G - $ *MDL_I52X36 - GC_90(VECID) = MDL_COMPLEXI*MDL_G__EXP__2*MDL_I74X33 - $ +MDL_COMPLEXI*MDL_G__EXP__2*MDL_I75X33 END diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/couplings3.f b/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/couplings3.f index 4a912d71d3..72efbcef3b 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/couplings3.f +++ b/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/couplings3.f @@ -7,12 +7,13 @@ SUBROUTINE COUP3( VECID) IMPLICIT NONE INTEGER VECID INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' GC_6(VECID) = -G GC_55(VECID) = -(MDL_COMPLEXI*G*MDL_I51X33)-MDL_COMPLEXI*G diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/makefile b/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/makefile index 0b24445a53..5a5681d220 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/makefile +++ b/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/makefile @@ -3,7 +3,7 @@ # Makefile for model library # # ---------------------------------------------------------------------------- - +# template models/template_files/makefile_madevent # Check for ../make_opts ifeq ($(wildcard ../make_opts), ../make_opts) include ../make_opts diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/makeinc.inc b/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/makeinc.inc index 6e2743eac1..4a9e1b2cc5 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/makeinc.inc +++ b/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/makeinc.inc @@ -2,4 +2,4 @@ # written by the UFO converter ############################################################################# -MODEL = couplings.o lha_read.o printout.o rw_para.o model_functions.o couplings1.o couplings2.o \ No newline at end of file +MODEL = couplings.o lha_read.o printout.o rw_para.o model_functions.o couplings1.o couplings2.o couplings3.o \ No newline at end of file diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/printout.f b/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/printout.f index 18b8f35b08..3e195b03a2 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/printout.f +++ b/epochX/cudacpp/susy_gg_t1t1.mad/Source/MODEL/printout.f @@ -1,3 +1,7 @@ +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +c written by the UFO converter +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc + c************************************************************************ c** ** c** MadGraph/MadEvent Interface to FeynRules ** @@ -9,7 +13,7 @@ subroutine printout implicit none - include '../vector.inc' ! defines VECSIZE_MEMMAX + include '../vector.inc' ! VECSIZE_MEMMAX (needed by coupl.inc) include 'coupl.inc' ! needs VECSIZE_MEMMAX (defined in vector.inc) include 'input.inc' diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/Source/PDF/eepdf.inc b/epochX/cudacpp/susy_gg_t1t1.mad/Source/PDF/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/Source/PDF/eepdf.inc +++ b/epochX/cudacpp/susy_gg_t1t1.mad/Source/PDF/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/Source/PDF/pdfwrap_emela.f b/epochX/cudacpp/susy_gg_t1t1.mad/Source/PDF/pdfwrap_emela.f index bce10819d5..da1e4e2276 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/Source/PDF/pdfwrap_emela.f +++ b/epochX/cudacpp/susy_gg_t1t1.mad/Source/PDF/pdfwrap_emela.f @@ -13,7 +13,7 @@ SUBROUTINE PDFWRAP DOUBLE PRECISION VALUE(20) REAL*8 ALPHASPDF EXTERNAL ALPHASPDF - ! PDFs with beamstrahlung use specific initialisation/evaluation +C PDFs with beamstrahlung use specific initialisation/evaluation LOGICAL HAS_BSTRAHL COMMON /TO_HAS_BS/ HAS_BSTRAHL diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/Source/PDF/pdg2pdf.f b/epochX/cudacpp/susy_gg_t1t1.mad/Source/PDF/pdg2pdf.f index 46f321e66b..2e7343a69b 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/Source/PDF/pdg2pdf.f +++ b/epochX/cudacpp/susy_gg_t1t1.mad/Source/PDF/pdg2pdf.f @@ -108,7 +108,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) else if (abs(ipart).eq.10) then ipart = sign(1,ipart) * 15 endif - pdg2pdf = 0d0 + pdg2pdf = 0d0 if (beamid.lt.0) then ih_local = ipart @@ -122,7 +122,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) endif do i_ee = 1, n_ee ee_components(i_ee) = compute_eepdf(x,omx_ee(iabs(beamid)),xmu,i_ee,ipart,ih_local) - enddo + enddo pdg2pdf = ee_components(1) ! temporary to test pdf load c write(*,*), x, beamid ,omx_ee(iabs(beamid)),xmu,1,ipart,ih_local,pdg2pdf return diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/Source/dsample.f b/epochX/cudacpp/susy_gg_t1t1.mad/Source/dsample.f index 09d482b45a..b0bc0547ad 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/Source/dsample.f +++ b/epochX/cudacpp/susy_gg_t1t1.mad/Source/dsample.f @@ -204,6 +204,9 @@ subroutine sample_full(ndim,ncall,itmax,itmin,dsig,ninvar,nconfigs,VECSIZE_USED) if (VECSIZE_USED.le.1) then all_fx(1) = dsig(all_p, all_wgt,0) + ivec=0 + ilock=0 + iwarp=1 else c Here "i" is the position in the full grid of the event do i=(iwarp-1)*WARP_SIZE+1, iwarp*warp_size diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/Source/eepdf.inc b/epochX/cudacpp/susy_gg_t1t1.mad/Source/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/Source/eepdf.inc +++ b/epochX/cudacpp/susy_gg_t1t1.mad/Source/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/Source/genps.inc b/epochX/cudacpp/susy_gg_t1t1.mad/Source/genps.inc index af7e0efbce..ef78e7e812 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/Source/genps.inc +++ b/epochX/cudacpp/susy_gg_t1t1.mad/Source/genps.inc @@ -29,9 +29,8 @@ c parameter (max_host=99,maxplace=199,maxpoints=100,maxans=50) c************************************************************************* c Parameters for helicity sums in matrixN.f c************************************************************************* - REAL*8 LIMHEL -c PARAMETER(LIMHEL=1e-8) ! ME threshold for helicity filtering (Fortran default) - PARAMETER(LIMHEL=0) ! ME threshold for helicity filtering (force Fortran to mimic cudacpp, see #419) +c REAL*8 LIMHEL +c PARAMETER(LIMHEL=1e-8) -> pass in the run_card.dat INTEGER MAXTRIES PARAMETER(MAXTRIES=25) C To pass the helicity configuration chosen by the DiscreteSampler to diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/Source/run.inc b/epochX/cudacpp/susy_gg_t1t1.mad/Source/run.inc index 5433a23583..81c8df6bf2 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/Source/run.inc +++ b/epochX/cudacpp/susy_gg_t1t1.mad/Source/run.inc @@ -106,4 +106,7 @@ c double precision tmin_for_channel integer sde_strat ! 1 means standard single diagram enhancement strategy, c 2 means approximation by the denominator of the propagator - common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat \ No newline at end of file + common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat +c + double precision limhel + common/to_limhel/limhel diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/Source/run_card.inc b/epochX/cudacpp/susy_gg_t1t1.mad/Source/run_card.inc index 67af0f2051..1a1bc782bd 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/Source/run_card.inc +++ b/epochX/cudacpp/susy_gg_t1t1.mad/Source/run_card.inc @@ -88,6 +88,8 @@ DSQRT_SHAT = 0.000000000000000D+00 + LIMHEL = 0.000000000000000D+00 + PTJ = 2.000000000000000D+01 PTB = 0.000000000000000D+00 diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/Source/setrun.f b/epochX/cudacpp/susy_gg_t1t1.mad/Source/setrun.f index 9e9ef7fdbd..dc6caef748 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/Source/setrun.f +++ b/epochX/cudacpp/susy_gg_t1t1.mad/Source/setrun.f @@ -162,9 +162,21 @@ subroutine setrun C Fill common block for Les Houches init info do i=1,2 if(lpp(i).eq.1.or.lpp(i).eq.2) then - idbmup(i)=2212 + if (nb_proton(i).eq.1.and.nb_neutron(i).eq.0) then + idbmup(i)=2212 + elseif (nb_proton(i).eq.0.and.nb_neutron(i).eq.1) then + idbmup(i)=2112 + else + idbmup(i) = 1000000000 + (nb_proton(i)+nb_neutron(i))*10 + $ + nb_proton(i)*10000 + endif elseif(lpp(i).eq.-1.or.lpp(i).eq.-2) then - idbmup(i)=-2212 + if (nb_proton(i).eq.1.and.nb_neutron(i).eq.0) then + idbmup(i)=-2212 + else + idbmup(i) = -1*(1000000000 + (nb_proton(i)+nb_neutron(i))*10 + $ + nb_proton(i)*10000) + endif elseif(lpp(i).eq.3) then idbmup(i)=11 elseif(lpp(i).eq.-3) then diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/MGVersion.txt b/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/MGVersion.txt index 9d3a5c0ba0..a806d3938c 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/MGVersion.txt +++ b/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/MGVersion.txt @@ -1 +1 @@ -3.5.3_lo_vect \ No newline at end of file +3.6.0_lo_vect \ No newline at end of file diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/P1_gg_t1t1x/CPPProcess.cc b/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/P1_gg_t1t1x/CPPProcess.cc index 328c2f46ce..776b1e73b7 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/P1_gg_t1t1x/CPPProcess.cc +++ b/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/P1_gg_t1t1x/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/P1_gg_t1t1x/CPPProcess.h b/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/P1_gg_t1t1x/CPPProcess.h index de00fb127e..26e27d36ee 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/P1_gg_t1t1x/CPPProcess.h +++ b/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/P1_gg_t1t1x/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/P1_gg_t1t1x/auto_dsig.f b/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/P1_gg_t1t1x/auto_dsig.f index 63acfbe6f9..cfe2f0e220 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/P1_gg_t1t1x/auto_dsig.f +++ b/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/P1_gg_t1t1x/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1134,11 +1134,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=4) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1148,32 +1149,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=4) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=4) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/P1_gg_t1t1x/auto_dsig1.f b/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/P1_gg_t1t1x/auto_dsig1.f index a237b1ce1e..9a8c1e29c9 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/P1_gg_t1t1x/auto_dsig1.f +++ b/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/P1_gg_t1t1x/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -101,6 +101,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -217,7 +219,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -281,7 +283,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -320,9 +322,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -338,6 +341,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -485,11 +490,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -589,9 +589,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -692,3 +694,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/P1_gg_t1t1x/driver.f b/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/P1_gg_t1t1x/driver.f index 19c169f025..3fc552a31d 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/P1_gg_t1t1x/driver.f +++ b/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/P1_gg_t1t1x/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/P1_gg_t1t1x/matrix1.f b/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/P1_gg_t1t1x/matrix1.f index 3f3f042520..67cebdbb55 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/P1_gg_t1t1x/matrix1.f +++ b/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/P1_gg_t1t1x/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -23,6 +23,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=4) INTEGER NGRAPHS @@ -46,8 +48,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -56,26 +58,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -86,7 +85,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -96,26 +94,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,4) /-1,-1, 0, 0/ DATA (NHEL(I, 2),I=1,4) /-1, 1, 0, 0/ DATA (NHEL(I, 3),I=1,4) / 1,-1, 0, 0/ @@ -131,8 +128,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -141,11 +137,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=2 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=2 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -155,12 +151,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -172,7 +167,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -201,35 +197,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -301,7 +295,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/cluster.f b/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/cluster.f index 649e46f4e9..b8995283ed 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/cluster.f +++ b/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/cluster.f @@ -552,6 +552,8 @@ logical function cluster(p, ivec) if (btest(mlevel,1)) $ write (*,*)'New event' + iwin = 0 + jwin = 0 cluster=.false. clustered=.false. do i=0,3 @@ -663,7 +665,8 @@ logical function cluster(p, ivec) c initialize graph storage igraphs(0)=0 nleft=nexternal -c cluster +c cluster + if (iwin.eq.0.or.jwin.eq.0) stop 21 do n=1,nexternal-2 c combine winner imocl(n)=imap(iwin,2)+imap(jwin,2) diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/proc_characteristics b/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/proc_characteristics index b76b38b49f..9c57d84817 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/proc_characteristics +++ b/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/proc_characteristics @@ -17,6 +17,8 @@ splitting_types = [] perturbation_order = [] limitations = [] + ew_sudakov = False hel_recycling = False single_color = True nlo_mixed_expansion = True + gauge = unitary diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/refine.sh b/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/refine.sh index afb9b99ad1..b46170ba23 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/refine.sh +++ b/epochX/cudacpp/susy_gg_t1t1.mad/SubProcesses/refine.sh @@ -57,7 +57,11 @@ j=%(directory)s for((try=1;try<=16;try+=1)); do if [ "$keeplog" = true ] ; then + if [[ -e ../madevent ]];then ../madevent 2>&1 >> $k &1 >> $k &1 >> log.txt &1 >> log.txt &1 >> $k \w*)>') - pat_end=re.compile('\w*)>') + pat_begin=re.compile(r'<(?P\w*)>') + pat_end=re.compile(r'\w*)>') tag_to_file={'slha':'param_card.dat', 'mgruncard':'run_card.dat', @@ -319,7 +319,7 @@ def check_pid(self, pid2label): def get_lha_strategy(self): """get the lha_strategy: how the weight have to be handle by the shower""" - if not self["init"]: + if "init" not in self or not self["init"]: raise Exception("No init block define") data = self["init"].split('\n')[0].split() @@ -537,7 +537,8 @@ def charge_card(self, tag): self.param_card = param_card_reader.ParamCard(param_card) return self.param_card elif tag == 'mgruncard': - self.run_card = RunCard(self[tag], unknown_warning=False) + with misc.TMP_variable(RunCard, 'allow_scan', True): + self.run_card = RunCard(self[tag], consistency=False, unknow_warning=False) return self.run_card elif tag == 'mg5proccard': proc_card = self[tag].split('\n') @@ -976,6 +977,8 @@ class ConfigFile(dict): """ a class for storing/dealing with input file. """ + allow_scan = False + def __init__(self, finput=None, **opt): """initialize a new instance. input can be an instance of MadLoopParam, a file, a path to a file, or simply Nothing""" @@ -993,6 +996,7 @@ def __init__(self, finput=None, **opt): # Initialize it with all the default value self.user_set = set() self.auto_set = set() + self.scan_set = {} #key -> type of list (int/float/bool/str/... for scan self.system_only = set() self.lower_to_case = {} self.list_parameter = {} #key -> type of list (int/float/bool/str/... @@ -1109,6 +1113,8 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): #1. check if the parameter is set to auto -> pass it to special if lower_name in self: targettype = type(dict.__getitem__(self, lower_name)) + if lower_name in self.scan_set: + targettype = self.scan_set[lower_name] if targettype != str and isinstance(value, str) and value.lower() == 'auto': self.auto_set.add(lower_name) if lower_name in self.user_set: @@ -1118,13 +1124,26 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): return elif lower_name in self.auto_set: self.auto_set.remove(lower_name) - + + + #1. check if the parameter is set to auto -> pass it to special + scan_targettype = None + if self.allow_scan and isinstance(value, str) and value.strip().startswith('scan'): + if lower_name in self.user_set: + self.user_set.remove(lower_name) + self.scan_set[lower_name] = type(self[lower_name]) + dict.__setitem__(self, lower_name, value) + #keep old value. + self.post_set(lower_name,value, change_userdefine, raiseerror) + return + elif lower_name in self.scan_set: + scan_targettype = self.scan_set[lower_name] + del self.scan_set[lower_name] + # 2. Find the type of the attribute that we want if lower_name in self.list_parameter: targettype = self.list_parameter[lower_name] - - if isinstance(value, str): # split for each comma/space value = value.strip() @@ -1248,8 +1267,11 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): if change_userdefine: self.user_set.add(lower_name) return self.post_set(lower_name, None, change_userdefine, raiseerror) - elif name in self: - targettype = type(self[name]) + elif name in self: + if scan_targettype: + targettype = targettype + else: + targettype = type(self[name]) else: logger.debug('Trying to add argument %s in %s. ' % (name, self.__class__.__name__) +\ 'This argument is not defined by default. Please consider adding it.') @@ -1262,7 +1284,7 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): if change_userdefine: self.user_set.add(lower_name) return self.post_set(lower_name, None, change_userdefine, raiseerror) - + value = self.format_variable(value, targettype, name=name) #check that the value is allowed: if lower_name in self.allowed_value and '*' not in self.allowed_value[lower_name]: @@ -1444,7 +1466,7 @@ def format_variable(value, targettype, name="unknown"): value =int(value[:-1]) * convert[value[-1]] elif '/' in value or '*' in value: try: - split = re.split('(\*|/)',value) + split = re.split(r'(\*|/)',value) v = float(split[0]) for i in range((len(split)//2)): if split[2*i+1] == '*': @@ -1482,7 +1504,7 @@ def format_variable(value, targettype, name="unknown"): value = float(value) except ValueError: try: - split = re.split('(\*|/)',value) + split = re.split(r'(\*|/)',value) v = float(split[0]) for i in range((len(split)//2)): if split[2*i+1] == '*': @@ -1491,7 +1513,10 @@ def format_variable(value, targettype, name="unknown"): v /= float(split[2*i+2]) except: v=0 - raise InvalidCmd("%s can not be mapped to a float" % value) + if "scan" in value: + raise InvalidCmd("%s is not supported here. Note that scan command can not be present simultaneously in the run_card and param_card." % value) + else: + raise InvalidCmd("%s can not be mapped to a float" % value) finally: value = v else: @@ -1737,10 +1762,12 @@ def default_setup(self): self.add_param('splitting_types',[], typelist=str) self.add_param('perturbation_order', [], typelist=str) self.add_param('limitations', [], typelist=str) + self.add_param('ew_sudakov', False) self.add_param('hel_recycling', False) self.add_param('single_color', True) self.add_param('nlo_mixed_expansion', True) - + self.add_param('gauge', 'U') + def read(self, finput): """Read the input file, this can be a path to a file, a file object, a str with the content of the file.""" @@ -3104,7 +3131,7 @@ def write(self, output_file, template=None, python_template=False, # do not write hidden parameter not hidden for this template # if python_template: - written = written.union(set(re.findall('\%\((\w*)\)s', open(template,'r').read(), re.M))) + written = written.union(set(re.findall(r'\%\((\w*)\)s', open(template,'r').read(), re.M))) to_write = to_write.union(set(self.hidden_param)) to_write = to_write.difference(written) @@ -3157,7 +3184,6 @@ def get_value_from_include(self, path, list_of_params, output_dir): if path does not exists return the current value in self for all parameter""" #WARNING DOES NOT HANDLE LIST/DICT so far - misc.sprint(output_dir, path) # handle case where file is missing if not os.path.exists(pjoin(output_dir,path)): misc.sprint("include file not existing", pjoin(output_dir,path)) @@ -3259,7 +3285,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): text = open(path,'r').read() #misc.sprint(text) f77_type = ['real*8', 'integer', 'double precision', 'logical'] - pattern = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I+re.M) for fct in pattern.findall(text): fsock = file_writers.FortranWriter(tmp,'w') @@ -3287,6 +3313,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): starttext = open(pjoin(outdir, path+'.orig')).read() fsock.remove_routine(starttext, to_mod[path][0]) for text in to_mod[path][1]: + text = self.retro_compatible_custom_fct(text) fsock.writelines(text) fsock.close() if not filecmp.cmp(pjoin(outdir, path), pjoin(outdir, path+'.tmp')): @@ -3303,7 +3330,33 @@ def edit_dummy_fct_from_file(self, filelist, outdir): files.mv(pjoin(outdir,path+'.orig'), pjoin(outdir, path)) + @staticmethod + def retro_compatible_custom_fct(lines, mode=None): + f77_type = ['real*8', 'integer', 'double precision', 'logical'] + function_pat = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + % {'type':'|'.join(f77_type)}, re.I+re.M) + include_pat = re.compile(r"\s+include\s+[\'\"]([\w\./]*)") + + assert isinstance(lines, list) + sol = [] + + if mode is None or 'vector.inc' in mode: + search = True + for i,line in enumerate(lines[:]): + if search and re.search(include_pat, line): + name = re.findall(include_pat, line)[0] + misc.sprint('DETECTED INCLUDE', name) + if 'vector.inc' in name: + search = False + if 'run.inc' in name: + sol.append(" include 'vector.inc'") + search = False + sol.append(line) + if re.search(function_pat, line): + misc.sprint("DETECTED FCT") + search = True + return sol def guess_entry_fromname(self, name, value): """ @@ -3346,7 +3399,7 @@ def update_typelist(value, name, opts): #handle metadata opts = {} forced_opts = [] - for key,val in re.findall("\<(?P[_\-\w]+)\=(?P[^>]*)\>", str(name)): + for key,val in re.findall(r"\<(?P[_\-\w]+)\=(?P[^>]*)\>", str(name)): forced_opts.append(key) if val in ['True', 'False']: opts[key] = eval(val) @@ -3681,11 +3734,22 @@ def write_autodef(self, output_dir, output_file=None): out = ["%s\n" %l for l in out] fsock.writelines(out) - @staticmethod - def get_idbmup(lpp): + def get_idbmup(self, lpp, beam=1): """return the particle colliding pdg code""" if lpp in (1,2, -1,-2): - return math.copysign(2212, lpp) + target = 2212 + if 'nb_proton1' in self: + nbp = self['nb_proton%s' % beam] + nbn = self['nb_neutron%s' % beam] + if nbp == 1 and nbn ==0: + target = 2212 + elif nbp==0 and nbn ==1: + target = 2112 + else: + target = 1000000000 + target += 10 * (nbp+nbn) + target += 10000 * nbp + return math.copysign(target, lpp) elif lpp in (3,-3): return math.copysign(11, lpp) elif lpp in (4,-4): @@ -3701,8 +3765,8 @@ def get_banner_init_information(self): the first line of the block of the lhe file.""" output = {} - output["idbmup1"] = self.get_idbmup(self['lpp1']) - output["idbmup2"] = self.get_idbmup(self['lpp2']) + output["idbmup1"] = self.get_idbmup(self['lpp1'], beam=1) + output["idbmup2"] = self.get_idbmup(self['lpp2'], beam=2) output["ebmup1"] = self["ebeam1"] output["ebmup2"] = self["ebeam2"] output["pdfgup1"] = 0 @@ -3959,7 +4023,8 @@ def check_validity(self, card): dict.__setitem__(card, 'pdlabel1', card['pdlabel']) dict.__setitem__(card, 'pdlabel2', card['pdlabel']) - if abs(card['lpp1']) == 1 == abs(card['lpp2']) and card['pdlabel1'] != card['pdlabel2']: + if isinstance(card['lpp1'],int) and isinstance(card['lpp2'],int) and \ + abs(card['lpp1']) == 1 == abs(card['lpp2']) and card['pdlabel1'] != card['pdlabel2']: raise InvalidRunCard("Assymetric beam pdf not supported for proton-proton collision") def status(self, card): @@ -4156,12 +4221,16 @@ def default_setup(self): self.add_param('frame_id', 6, system=True) self.add_param("event_norm", "average", allowed=['sum','average', 'unity'], include=False, sys_default='sum', hidden=True) + self.add_param("keep_log", "normal", include=False, hidden=True, + comment="none: all log send to /dev/null.\n minimal: keep only log for survey of the last run.\n normal: keep only log for survey of all run. \n debug: keep all log (survey and refine)", + allowed=['none', 'minimal', 'normal', 'debug']) #cut self.add_param("auto_ptj_mjj", True, hidden=True) self.add_param("bwcutoff", 15.0) self.add_param("cut_decays", False, cut='d') self.add_param('dsqrt_shat',0., cut=True) self.add_param("nhel", 0, include=False) + self.add_param("limhel", 1e-8, hidden=True, comment="threshold to determine if an helicity contributes when not MC over helicity.") #pt cut self.add_param("ptj", 20.0, cut='j') self.add_param("ptb", 0.0, cut='b') @@ -4842,7 +4911,7 @@ def create_default_for_process(self, proc_characteristic, history, proc_def): # here pick strategy 2 if only one QCD color flow # and for pure multi-jet case jet_id = [21] + list(range(1, self['maxjetflavor']+1)) - if proc_characteristic['single_color']: + if proc_characteristic['gauge'] != 'FD' and proc_characteristic['single_color']: self['sde_strategy'] = 2 #for pure lepton final state go back to sde_strategy=1 pure_lepton=True @@ -5741,9 +5810,10 @@ def check_validity(self): # check that ebeam is bigger than the proton mass. for i in [1,2]: - if self['lpp%s' % i ] not in [1,2]: + # do not for proton mass if not proton PDF (or when scan initialization) + if self['lpp%s' % i ] not in [1,2] or isinstance(self['ebeam%i' % i], str): continue - + if self['ebeam%i' % i] < 0.938: if self['ebeam%i' %i] == 0: logger.warning("At-rest proton mode set: energy beam set to 0.938 GeV") @@ -6193,3 +6263,181 @@ def log_and_update(self, banner, card, par, v): xcard = banner.charge_card(card) xcard[par[0]].param_dict[(par[1],)].value = v xcard.write(os.path.join(self.me_dir, 'Cards', '%s.dat' % card)) + + + + +class RunCardIterator(object): + """A class keeping track of the scan: flag in the param_card and + having an __iter__() function to scan over all the points of the scan. + """ + + logging = True + def __init__(self, input_path=None): + with misc.TMP_variable(RunCard, 'allow_scan', True): + self.run_card = RunCard(input_path, consistency=False) + self.run_card.allow_scan = True + + self.itertag = [] #all the current value use + self.cross = [] # keep track of all the cross-section computed + self.param_order = [] + + def __iter__(self): + """generate the next param_card (in a abstract way) related to the scan. + Technically this generates only the generator.""" + + if hasattr(self, 'iterator'): + return self.iterator + self.iterator = self.iterate() + return self.iterator + + def write(self, path): + self.__iter__.write(path) + + def next(self, autostart=False): + """call the next iteration value""" + try: + iterator = self.iterator + except: + if autostart: + iterator = self.__iter__() + else: + raise + try: + out = next(iterator) + except StopIteration: + del self.iterator + raise + return out + + def iterate(self): + """create the actual generator""" + all_iterators = {} # dictionary of key -> block of object to scan [([param, [values]), ...] + pattern = re.compile(r'''scan\s*(?P\d*)\s*:\s*(?P[^#]*)''', re.I) + + # fill all_iterators with the run_card information + for name in self.run_card.scan_set: + value = self.run_card[name] + try: + key, def_list = pattern.findall(value)[0] + except Exception as error: + misc.sprint(error) + raise Exception("Fail to handle scanning tag in run_card: Please check that the syntax is valid") + if key == '': + key = -1 * len(all_iterators) + if key not in all_iterators: + all_iterators[key] = [] + try: + all_iterators[key].append( (name, eval(def_list))) + except SyntaxError as error: + raise Exception("Fail to handle your scan definition. Please check your syntax:\n entry: %s \n Error reported: %s" %(def_list, error)) + + #prepare to keep track of parameter changing for the report + keys = list(all_iterators.keys()) # need to fix an order for the scan + #store the type of parameter + for key in keys: + for param, values in all_iterators[key]: + self.param_order.append("run_card#%s" % (param)) + + # do the loop + lengths = [list(range(len(all_iterators[key][0][1]))) for key in keys] + from functools import reduce + total = reduce((lambda x, y: x * y),[len(x) for x in lengths]) + for i,positions in enumerate(itertools.product(*lengths)): + self.itertag = [] + if self.logging: + logger.info("Create the next run_card in the scan definition (%s/%s) " %( i+1, total), '$MG:BOLD') + for i, pos in enumerate(positions): + key = keys[i] + for param, values in all_iterators[key]: + # assign the value in the card. + self.run_card[param] = values[pos] + self.itertag.append(values[pos]) + if self.logging: + logger.info("change parameter %s to %s", \ + param, values[pos]) + + + # retrun the current param_card up to next iteration + yield self.run_card + + + def store_entry(self, run_name, cross, error=None, run_card_path=None): + """store the value of the cross-section""" + + if isinstance(cross, dict): + info = dict(cross) + info.update({'bench' : self.itertag, 'run_name': run_name}) + self.cross.append(info) + else: + if error is None: + self.cross.append({'bench' : self.itertag, 'run_name': run_name, 'cross(pb)':cross}) + else: + self.cross.append({'bench' : self.itertag, 'run_name': run_name, 'cross(pb)':cross, 'error(pb)':error}) + + + def write_summary(self, path, order=None, lastline=False, nbcol=20): + """ """ + + if path: + ff = open(path, 'w') + path_events = path.rsplit("/", 1)[0] + #identCard = open(pjoin(path.rsplit("/", 2)[0], "Cards", "ident_card.dat")) + #identLines = identCard.readlines() + #identCard.close() + else: + ff = StringIO.StringIO() + if order: + keys = order + else: + keys = list(self.cross[0].keys()) + if 'bench' in keys: keys.remove('bench') + if 'run_name' in keys: keys.remove('run_name') + keys.sort() + if 'cross(pb)' in keys: + keys.remove('cross(pb)') + keys.append('cross(pb)') + if 'error(pb)' in keys: + keys.remove('error(pb)') + keys.append('error(pb)') + + formatting = "#%s%s%s\n" %('%%-%is ' % (nbcol-1), ('%%-%is ' % (nbcol))* len(self.param_order), + ('%%-%is ' % (nbcol))* len(keys)) + # header + if not lastline: + ff.write(formatting % tuple(['run_name'] + self.param_order + keys)) + formatting = "%s%s%s\n" %('%%-%is ' % (nbcol), ('%%-%ie ' % (nbcol))* len(self.param_order), + ('%%-%ie ' % (nbcol))* len(keys)) + + if not lastline: + to_print = self.cross + else: + to_print = self.cross[-1:] + for info in to_print: + name = info['run_name'] + bench = info['bench'] + data = [] + for k in keys: + if k in info: + data.append(info[k]) + else: + data.append(0.) + ff.write(formatting % tuple([name] + bench + data)) + ff_single = open(pjoin(path_events, name, "params.dat"), "w") + for i_bench in range(0, len(bench)): + ff_single.write(self.param_order[i_bench] + " = " + str(bench[i_bench]) +"\n") + ff_single.close() + + if not path: + return ff.getvalue() + + + def get_next_name(self, run_name): + """returns a smart name for the next run""" + + if '_' in run_name: + name, value = run_name.rsplit('_',1) + if value.isdigit(): + return '%s_%02i' % (name, float(value)+1) + # no valid '_' in the name + return '%s_scan_02' % run_name diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/check_param_card.py b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/check_param_card.py index 71089d7480..bc785b5de6 100755 --- a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/check_param_card.py +++ b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/check_param_card.py @@ -649,7 +649,7 @@ def write_inc_file(self, outpath, identpath, default, need_mp=False): #check if we need to write the value of scale for some block if os.path.exists(input_inc): text = open(input_inc).read() - scales = list(set(re.findall('mdl__(\w*)__scale', text, re.I))) + scales = list(set(re.findall(r'mdl__(\w*)__scale', text, re.I))) else: scales = [] @@ -1000,10 +1000,12 @@ def iterate(self): self.param_order.append("%s#%s" % (param.lhablock, '_'.join(repr(i) for i in param.lhacode))) # do the loop lengths = [list(range(len(all_iterators[key][0][1]))) for key in keys] - for positions in itertools.product(*lengths): + from functools import reduce + total = reduce((lambda x, y: x * y),[len(x) for x in lengths]) + for i,positions in enumerate(itertools.product(*lengths)): self.itertag = [] if self.logging: - logger.info("Create the next param_card in the scan definition", '$MG:BOLD') + logger.info("Create the next param_card in the scan definition (%s/%s)" % (i+1,total), '$MG:BOLD') for i, pos in enumerate(positions): key = keys[i] for param, values in all_iterators[key]: diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/cluster.py b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/cluster.py index 9a893f630d..1ad860e04f 100755 --- a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/cluster.py +++ b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/cluster.py @@ -646,7 +646,10 @@ def worker(self): if os.path.exists(exe) and not exe.startswith('/'): exe = './' + exe if isinstance(opt['stdout'],str): - opt['stdout'] = open(opt['stdout'],'w') + if opt['stdout'] == '/dev/null': + opt['stdout'] = os.open(os.devnull, os.O_RDWR) + else: + opt['stdout'] = open(opt['stdout'],'w') if opt['stderr'] == None: opt['stderr'] = subprocess.STDOUT if arg: @@ -671,11 +674,12 @@ def worker(self): self.pids.put(pid) # the function should return 0 if everything is fine # the error message otherwise - returncode = exe(*arg, **opt) - if returncode != 0: - logger.warning("fct %s does not return 0. Stopping the code in a clean way. The error was:\n%s", exe, returncode) + try: + returncode = exe(*arg, **opt) + except Exception as error: + #logger.warning("fct %s does not return 0. Stopping the code in a clean way. The error was:\n%s", exe, returncode) self.stoprequest.set() - self.remove("fct %s does not return 0:\n %s" % (exe, returncode)) + self.remove("fct %s does raise %s\n %s" % (exe, error)) except Exception as error: self.fail_msg = sys.exc_info() logger.warning(str(error)) @@ -700,7 +704,7 @@ def worker(self): def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, - log=None, required_output=[], nb_submit=0): + log=None, required_output=[], nb_submit=0, python_opts={}): """submit a job on multicore machine""" # open threads if needed @@ -720,7 +724,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, return tag else: # python function - self.queue.put((tag, prog, argument, {})) + self.queue.put((tag, prog, argument, python_opts)) self.submitted.put(1) return tag @@ -908,6 +912,10 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None else: requirement = '' + if 'cluster_walltime' in self.options and self.options['cluster_walltime']\ + and self.options['cluster_walltime'] != 'None': + requirement+='\n MaxRuntime = %s' % self.options['cluster_walltime'] + if cwd is None: cwd = os.getcwd() if stdout is None: @@ -936,7 +944,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None #Submitting job(s). #Logging submit event(s). #1 job(s) submitted to cluster 2253622. - pat = re.compile("submitted to cluster (\d*)",re.MULTILINE) + pat = re.compile(r"submitted to cluster (\d*)",re.MULTILINE) output = output.decode(errors='ignore') try: id = pat.search(output).groups()[0] @@ -1025,7 +1033,7 @@ def submit2(self, prog, argument=[], cwd=None, stdout=None, stderr=None, #Logging submit event(s). #1 job(s) submitted to cluster 2253622. output = output.decode(errors='ignore') - pat = re.compile("submitted to cluster (\d*)",re.MULTILINE) + pat = re.compile(r"submitted to cluster (\d*)",re.MULTILINE) try: id = pat.search(output).groups()[0] except: @@ -1588,7 +1596,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None output = a.communicate()[0].decode(errors='ignore') #Your job 874511 ("test.sh") has been submitted - pat = re.compile("Your job (\d*) \(",re.MULTILINE) + pat = re.compile(r"Your job (\d*) \(",re.MULTILINE) try: id = pat.search(output).groups()[0] except: @@ -1606,7 +1614,7 @@ def control_one_job(self, id): if not status: return 'F' #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 - pat = re.compile("^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") + pat = re.compile(r"^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") stat = '' for line in status.stdout.read().decode(errors='ignore').split('\n'): if not line: @@ -1636,7 +1644,7 @@ def control(self, me_dir=None): cmd = 'qstat -s %s' % statusflag status = misc.Popen([cmd], shell=True, stdout=subprocess.PIPE) #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 - pat = re.compile("^(\d+)") + pat = re.compile(r"^(\d+)") for line in status.stdout.read().decode(errors='ignore').split('\n'): line = line.strip() try: @@ -1715,6 +1723,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None stderr = stdout if log is None: log = '/dev/null' + command = ['sbatch', '-o', stdout, '-J', me_dir, @@ -1726,6 +1735,12 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None command.insert(1, '-p') command.insert(2, self.cluster_queue) + if 'cluster_walltime' in self.options and self.options['cluster_walltime']\ + and self.options['cluster_walltime'] != 'None': + command.insert(1, '-t') + command.insert(2, self.options['cluster_walltime']) + + a = misc.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -1736,7 +1751,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None id = output_arr[3].rstrip() if not id.isdigit(): - id = re.findall('Submitted batch job ([\d\.]+)', ' '.join(output_arr)) + id = re.findall(r'Submitted batch job ([\d\.]+)', ' '.join(output_arr)) if not id or len(id)>1: raise ClusterManagmentError( 'fail to submit to the cluster: \n%s' \ diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/combine_runs.py b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/combine_runs.py index 4de6b84ec0..b1e8c88eac 100755 --- a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/combine_runs.py +++ b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/combine_runs.py @@ -20,6 +20,7 @@ from __future__ import absolute_import import math import os +import shutil import re import logging from six.moves import range @@ -117,6 +118,7 @@ def sum_multichannel(self, channel): #Now read in all of the events and write them #back out with the appropriate scaled weight + to_clean = [] fsock = open(pjoin(channel, 'events.lhe'), 'w') wgt = results.axsec / results.nunwgt tot_nevents, nb_file = 0, 0 @@ -129,8 +131,14 @@ def sum_multichannel(self, channel): nw = self.copy_events(fsock, pjoin(path,'events.lhe'), wgt) tot_nevents += nw nb_file += 1 + to_clean.append(path) logger.debug("Combined %s file generating %s events for %s " , nb_file, tot_nevents, channel) - + for path in to_clean: + try: + shutil.rmtree(path) + except Exception as error: + pass + @staticmethod def get_fortran_str(nb): data = '%E' % nb @@ -162,6 +170,7 @@ def copy_events(self, fsock, input, new_wgt): fsock.write(line) old_line = line return nb_evt + def get_channels(self, proc_path): """Opens file symfact.dat to determine all channels""" sympath = os.path.join(proc_path, 'symfact.dat') diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/common_run_interface.py b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/common_run_interface.py index 9bd9d9cb50..194f0cdfbd 100755 --- a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/common_run_interface.py +++ b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/common_run_interface.py @@ -23,6 +23,7 @@ import ast import logging import math +import copy import os import re import shutil @@ -181,6 +182,23 @@ def help_add_time_of_flight(self): logger.info(' threshold option allows to change the minimal value required to') logger.info(' a non zero value for the particle (default:1e-12s)') + def help_print_results(self): + logger.info("syntax: print_results [RUN_NAME] [OPTIONS]") + logger.info("-- print the results of the previous run on the screen") + logger.info(" If not RUN_NAME is provided, the information of all run") + logger.info(" are printed one after another.") + logger.info("") + logger.info(" supported options:") + logger.info(" ------------------") + logger.info(" --format=full|short # default is full") + logger.info(" full format contains banner/... ") + logger.info(" while short is a simple multi-column format (nice for plotting)") + logger.info(" --path=") + logger.info(" allow to write the information to a file.") + logger.info(" --mode=w|a #default is w ") + logger.info(" when the information is printed to a file, you can choose ") + logger.info(" to either overwrite the file if already exists (w mode)") + logger.info(" to append the information at the end of the file (a mode)") class CheckValidForCmd(object): @@ -727,7 +745,7 @@ def __init__(self, me_dir, options, *args, **opts): if not self.proc_characteristics['ninitial']: # Get number of initial states nexternal = open(pjoin(self.me_dir,'Source','nexternal.inc')).read() - found = re.search("PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) + found = re.search(r"PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) self.ninitial = int(found.group(1)) else: self.ninitial = self.proc_characteristics['ninitial'] @@ -989,7 +1007,22 @@ def do_treatcards(self, line, amcatnlo=False): #raise Exception, "%s %s %s" % (sys.path, os.path.exists(pjoin(self.me_dir,'bin','internal', 'ufomodel')), os.listdir(pjoin(self.me_dir,'bin','internal', 'ufomodel'))) import ufomodel as ufomodel zero = ufomodel.parameters.ZERO - if self.proc_characteristics['nlo_mixed_expansion']: + no_width = [] + + if self.proc_characteristics['ew_sudakov']: + # if the sudakov approximation is used, force all particle widths to zero + # unless the complex mass scheme is used + if not self.proc_characteristics['complex_mass_scheme']: + no_width = [p for p in ufomodel.all_particles if p.width != zero] + logger.info('''Setting all particle widths to zero (needed for EW Sudakov approximation).''','$MG:BOLD') + # also, check that the model features the 'ntadpole' parameter, and set it to 1 + try: + param_card['tadpole'].get(1).value = 1. + logger.info('''Setting the value of ntadpole to 1 (needed for EW Sudakov approximation).''','$MG:BOLD') + except KeyError: + logger.warning('''The model has no 'ntadpole' parameter. The Sudakov approximation for EW corrections may give wrong results.''') + + elif self.proc_characteristics['nlo_mixed_expansion']: no_width = [p for p in ufomodel.all_particles if (str(p.pdg_code) in pids or str(-p.pdg_code) in pids) and p.width != zero] @@ -1168,17 +1201,17 @@ def detect_card_type(path): 'Begin Minpts', 'gridpack', 'ebeam1', - 'block\s+mw_run', + r'block\s+mw_run', 'BLOCK', 'DECAY', 'launch', 'madspin', - 'transfer_card\.dat', + r'transfer_card\.dat', 'set', 'main:numberofevents', # pythia8, '@MG5aMC skip_analysis', #MA5 --both-- - '@MG5aMC\s*inputs\s*=\s*\*\.(?:hepmc|lhe)', #MA5 --both-- - '@MG5aMC\s*reconstruction_name', # MA5 hadronique + r'@MG5aMC\s*inputs\s*=\s*\*\.(?:hepmc|lhe)', #MA5 --both-- + r'@MG5aMC\s*reconstruction_name', # MA5 hadronique '@MG5aMC', # MA5 hadronique 'run_rivet_later', # Rivet ] @@ -1237,7 +1270,7 @@ def detect_card_type(path): return 'madspin_card.dat' if 'decay' in text: # need to check if this a line like "decay w+" or "set decay" - if re.search("(^|;)\s*decay", fulltext, re.M): + if re.search(r"(^|;)\s*decay", fulltext, re.M): return 'madspin_card.dat' else: return 'reweight_card.dat' @@ -2074,6 +2107,12 @@ def check_multicore(self): # ensure that the run_card is present if not hasattr(self, 'run_card'): self.run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat')) + # Below reads the run_card in the LHE file rather than the Cards/run_card + import madgraph.various.lhe_parser as lhe_parser + args_path = list(args) + self.check_decay_events(args_path) + self.run_card = banner_mod.RunCard(lhe_parser.EventFile(args_path[0]).get_banner()['mgruncard']) + # we want to run this in a separate shell to avoid hard f2py crash command = [sys.executable] @@ -2085,6 +2124,12 @@ def check_multicore(self): command.append('--web') command.append('reweight') + ## TV: copy the event file as backup before starting reweighting + event_path = pjoin(self.me_dir, 'Events', self.run_name, 'events.lhe.gz') + event_path_backup = pjoin(self.me_dir, 'Events', self.run_name, 'events_orig.lhe.gz') + if os.path.exists(event_path) and not os.path.exists(event_path_backup): + shutil.copyfile(event_path, event_path_backup) + ######### START SINGLE CORE MODE ############ if self.options['nb_core']==1 or self.run_card['nevents'] < 101 or not check_multicore(self): if self.run_name: @@ -2200,7 +2245,7 @@ def check_multicore(self): cross_sections[key] = value / (nb_event+1) lhe.remove() for key in cross_sections: - if key == 'orig' or key.isdigit(): + if key == 'orig' or (key.isdigit() and not (key[0] == '2')): continue logger.info('%s : %s pb' % (key, cross_sections[key])) return @@ -2461,7 +2506,7 @@ def do_add_time_of_flight(self, line): ############################################################################ def do_print_results(self, line): - """Not in help:Print the cross-section/ number of events for a given run""" + """Print the cross-section/ number of events for a given run""" args = self.split_arg(line) options={'path':None, 'mode':'w', 'format':'full'} @@ -2942,10 +2987,15 @@ def do_rivet(self, line, postprocess=False): #2 Prepare Rivet setup environments rivet_path = self.options['rivet_path'] yoda_path = self.options['yoda_path'] + fastjet_path = subprocess.Popen([self.options['fastjet'], '--prefix'], + stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip() + set_env = set_env + "export PATH={0}:$PATH\n".format(pjoin(rivet_path, 'bin')) set_env = set_env + "export PATH={0}:$PATH\n".format(pjoin(yoda_path, 'bin')) set_env = set_env + "export LD_LIBRARY_PATH={0}:{1}:$LD_LIBRARY_PATH\n".format(pjoin(rivet_path, 'lib'), pjoin(rivet_path, 'lib64')) set_env = set_env + "export LD_LIBRARY_PATH={0}:{1}:$LD_LIBRARY_PATH\n".format(pjoin(yoda_path, 'lib'), pjoin(yoda_path, 'lib64')) + set_env = set_env + "export LD_LIBRARY_PATH={0}:$LD_LIBRARY_PATH\n".format(pjoin(self.options['hepmc_path'], 'lib')) + set_env = set_env + "export LD_LIBRARY_PATH={0}:$LD_LIBRARY_PATH\n".format(pjoin(fastjet_path, 'lib')) major, minor = sys.version_info[0:2] set_env = set_env + "export PYTHONPATH={0}:{1}:$PYTHONPATH\n".format(pjoin(rivet_path, 'lib', 'python%s.%s' %(major,minor), 'site-packages'),\ pjoin(rivet_path, 'lib64', 'python%s.%s' %(major,minor), 'site-packages')) @@ -4311,8 +4361,8 @@ def complete_compute_widths(self, text, line, begidx, endidx, formatting=True): else: completion = {} completion['options'] = self.list_completion(text, - ['--path=', '--output=', '--min_br=0.\$', '--nlo', - '--precision_channel=0.\$', '--body_decay=']) + ['--path=', '--output=', r'--min_br=0.\$', '--nlo', + r'--precision_channel=0.\$', '--body_decay=']) return self.deal_multiple_categories(completion, formatting) @@ -4821,9 +4871,9 @@ class AskforEditCard(cmd.OneLinePathCompletion): (return False to repeat the question) """ - all_card_name = ['param_card', 'run_card', 'pythia_card', 'pythia8_card', + all_card_name = ['param_card', 'run_card', 'pythia_card', 'pythia8_card', 'fo_analysis_card' 'madweight_card', 'MadLoopParams', 'shower_card', 'rivet_card'] - to_init_card = ['param', 'run', 'madweight', 'madloop', + to_init_card = ['param', 'run', 'madweight', 'madloop', 'fo_analysis', 'shower', 'pythia8','delphes','madspin', 'rivet'] special_shortcut = {} special_shortcut_help = {} @@ -4853,6 +4903,7 @@ def load_default(self): self.has_PY8 = False self.has_delphes = False self.has_rivet = False + self.has_fo_card = False self.paths = {} self.update_block = [] @@ -5058,7 +5109,8 @@ def init_run(self, cards): try: - self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning') + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning') except IOError: self.run_card = {} try: @@ -5248,6 +5300,15 @@ def init_delphes(self, cards): self.has_delphes = True return [] + def init_fo_analysis(self, cards): + self.has_fo_card = False + if not self.get_path('FO_analyse', cards): + return [] + self.has_fo_card = True + self.fo_card = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse']) + self.fo_card_def = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse_default']) + return list(self.fo_card.string_vars) + def set_CM_velocity(self, line): """compute sqrts from the velocity in the center of mass frame""" @@ -5508,6 +5569,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): allowed['delphes_card'] = '' if self.has_rivet: allowed['rivet_card'] = '' + if self.has_fo_card: + allowed['fo_card'] = '' elif len(args) == 2: if args[1] == 'run_card': @@ -5532,6 +5595,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): allowed = {'delphes_card':'default'} elif args[1] == 'rivet_card': allowed = {'rivet_card':'default'} + elif args[1] == 'fo_card': + allowed = {'fo_card':'default'} else: allowed = {'value':''} @@ -5539,6 +5604,7 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): start = 1 if args[1] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', 'MadLoop_card','pythia8_card','delphes_card','plot_card', + 'fo_card', 'madanalysis5_parton_card','madanalysis5_hadron_card', 'rivet_card']: start = 2 @@ -5576,6 +5642,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): categories.append('delphes_card') if self.has_rivet: categories.append('rivet_card') + if self.has_fo_card: + categories.append('fo_card') possibilities['category of parameter (optional)'] = \ self.list_completion(text, categories) @@ -5630,7 +5698,13 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): if 'delphes_card' in allowed: if allowed['delphes_card'] == 'default': opts = ['default', 'atlas', 'cms'] - possibilities['Delphes Card'] = self.list_completion(text, opts) + possibilities['Delphes Card'] = self.list_completion(text, opts) + + if 'fo_card' in allowed: + opts = self.fo_card.string_vars + if allowed['fo_card'] == 'default': + opts.append('default') + possibilities['FO Card'] = self.list_completion(text, opts) if 'value' in list(allowed.keys()): opts = ['default', 'scale'] @@ -5733,21 +5807,28 @@ def do_set(self, line): if args[0] in self.special_shortcut: targettypes , cmd = self.special_shortcut[args[0]] if len(args) != len(targettypes) +1: - logger.warning('shortcut %s requires %s argument' % (args[0], len(targettypes))) - if len(args) < len(targettypes) +1: - return + if len(targettypes) == 1 and args[len(targettypes)].startswith('scan'): + args = args[:len(targettypes)] + [' '.join(args[len(targettypes):])] + targettypes = [str] else: - logger.warning('additional argument will be ignored') + logger.warning('shortcut %s requires %s argument' % (args[0], len(targettypes))) + if len(args) < len(targettypes) +1: + return + else: + logger.warning('additional argument will be ignored') values ={} for i, argtype in enumerate(targettypes): try: - values = {str(i): banner_mod.ConfigFile.format_variable(args[i+1], argtype, args[0])} + values[str(i)] = banner_mod.ConfigFile.format_variable(args[i+1], argtype, args[0]) except ValueError as e: logger.warning("Wrong argument: The entry #%s should be of type %s.", i+1, argtype) return except InvalidCmd as e: - logger.warning(str(e)) - return + if isinstance(args[i+1], str) and args[i+1].startswith('scan'): + values[str(i)] = args[i+1] + else: + logger.warning(str(e)) + return #else: # logger.warning("too many argument for this command") # return @@ -5787,7 +5868,7 @@ def do_set(self, line): if os.path.exists(pythia_path): logger.info('add line QCUT = %s in pythia_card.dat' % args[1]) p_card = open(pythia_path,'r').read() - p_card, n = re.subn('''^\s*QCUT\s*=\s*[\de\+\-\.]*\s*$''', + p_card, n = re.subn(r'''^\s*QCUT\s*=\s*[\de\+\-\.]*\s*$''', ''' QCUT = %s ''' % args[1], \ p_card, flags=(re.M+re.I)) if n==0: @@ -5801,7 +5882,7 @@ def do_set(self, line): if os.path.exists(pythia_path): logger.info('add line SHOWERKT = %s in pythia_card.dat' % args[1].upper()) p_card = open(pythia_path,'r').read() - p_card, n = re.subn('''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''', + p_card, n = re.subn(r'''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''', ''' SHOWERKT = %s ''' % args[1].upper(), \ p_card, flags=(re.M+re.I)) if n==0: @@ -5856,7 +5937,7 @@ def do_set(self, line): pjoin(self.me_dir,'Cards', 'delphes_card.dat')) return - if args[0] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', + if args[0] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', 'fo_card', 'delphes_card','madanalysis5_hadron_card','madanalysis5_parton_card','rivet_card']: if args[1] == 'default': @@ -6176,6 +6257,22 @@ def do_set(self, line): self.setRivet(args[start], value, default=default) self.rivet_card.write(self.paths['rivet'], self.paths['rivet_default']) + elif self.has_fo_card and (card in ['', 'fo_card'])\ + and args[start].lower() in [k.lower() for k in self.fo_card.string_vars]: + + if args[start] in self.conflict and card == '': + text = 'ambiguous name (present in more than one card). Please specify which card to edit' + logger.warning(text) + return + if args[start+1] == 'default': + value = self.fo_card_default[args[start]] + default = True + else: + value = args[start+1] + default = False + self.fo_card[args[start]] = value + self.modified_card.add('fo_card') + #INVALID -------------------------------------------------------------- else: logger.warning('invalid set command %s ' % line) @@ -6222,12 +6319,13 @@ def setM(self, block, name, value): def setR(self, name, value): - if self.mother_interface.inputfile: - self.run_card.set(name, value, user=True, raiseerror=True) - else: - self.run_card.set(name, value, user=True) - new_value = self.run_card.get(name) - logger.info('modify parameter %s of the run_card.dat to %s' % (name, new_value),'$MG:BOLD') + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + if self.mother_interface.inputfile: + self.run_card.set(name, value, user=True, raiseerror=True) + else: + self.run_card.set(name, value, user=True) + new_value = self.run_card.get(name) + logger.info('modify parameter %s of the run_card.dat to %s' % (name, new_value),'$MG:BOLD') def setML(self, name, value, default=False): @@ -6314,6 +6412,7 @@ def check_card_consistency(self): proc_charac = self.mother_interface.proc_characteristics if proc_charac['grouped_matrix'] and \ + isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int) and \ abs(self.run_card['lpp1']) == 1 == abs(self.run_card['lpp2']) and \ (self.run_card['nb_proton1'] != self.run_card['nb_proton2'] or self.run_card['nb_neutron1'] != self.run_card['nb_neutron2'] or @@ -6403,41 +6502,42 @@ def check_card_consistency(self): # check that only quark/gluon/photon are in initial beam if lpp=+-1 pdg_in_p = list(range(-6,7))+[21,22] - if (abs(self.run_card['lpp1'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial1'])) \ + if isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int): + if(abs(self.run_card['lpp1'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial1'])) \ or (abs(self.run_card['lpp2'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial2'])): - if 'pythia_card.dat' in self.cards or 'pythia8_card.dat' in self.cards: - path_to_remove = None - if 'pythia_card.dat' in self.cards: - path_to_remove = self.paths['pythia'] - card_to_remove = 'pythia_card.dat' - elif 'pythia8_card.dat' in self.cards: - path_to_remove = self.paths['pythia8'] - card_to_remove = 'pythia8_card.dat' - if path_to_remove: - if 'partonshower' in self.run_card['bypass_check']: + if 'pythia_card.dat' in self.cards or 'pythia8_card.dat' in self.cards: + path_to_remove = None + if 'pythia_card.dat' in self.cards: + path_to_remove = self.paths['pythia'] + card_to_remove = 'pythia_card.dat' + elif 'pythia8_card.dat' in self.cards: + path_to_remove = self.paths['pythia8'] + card_to_remove = 'pythia8_card.dat' + if path_to_remove: + if 'partonshower' in self.run_card['bypass_check']: + logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") + else: + logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') + os.remove(path_to_remove) + self.cards.remove(card_to_remove) + else: + logger.info('Remember that Parton-Shower are not yet ready for such proton component definition (HW implementation in progress).', '$MG:BOLD' ) + elif (abs(self.run_card['lpp1'])==3 and abs(self.run_card['lpp2'])==3): + if 'pythia8_card.dat' in self.cards: + if self.run_card['pdlabel'] == 'isronlyll': + if 'partonshower' not in self.run_card['bypass_check']: + # force that QED shower is on? + for param in ['TimeShower:QEDshowerByQ', 'TimeShower:QEDshowerByL', 'TimeShower:QEDshowerByGamma', 'SpaceShower:QEDshowerByQ', 'SpaceShower:QEDshowerByL']: + if param not in self.PY8Card or \ + (not self.PY8Card[param] and param.lower() not in self.PY8Card.user_set): + logger.warning('Activating QED shower: setting %s to True', param) + self.PY8Card[param] = True + elif 'partonshower' in self.run_card['bypass_check']: logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") - else: + else: logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') - os.remove(path_to_remove) - self.cards.remove(card_to_remove) - else: - logger.info('Remember that Parton-Shower are not yet ready for such proton component definition (HW implementation in progress).', '$MG:BOLD' ) - elif (abs(self.run_card['lpp1'])==3 and abs(self.run_card['lpp2'])==3): - if 'pythia8_card.dat' in self.cards: - if self.run_card['pdlabel'] == 'isronlyll': - if 'partonshower' not in self.run_card['bypass_check']: - # force that QED shower is on? - for param in ['TimeShower:QEDshowerByQ', 'TimeShower:QEDshowerByL', 'TimeShower:QEDshowerByGamma', 'SpaceShower:QEDshowerByQ', 'SpaceShower:QEDshowerByL']: - if param not in self.PY8Card or \ - (not self.PY8Card[param] and param.lower() not in self.PY8Card.user_set): - logger.warning('Activating QED shower: setting %s to True', param) - self.PY8Card[param] = True - elif 'partonshower' in self.run_card['bypass_check']: - logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") - else: - logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') - os.remove(self.paths['pythia8']) - self.cards.remove('pythia8_card.dat') + os.remove(self.paths['pythia8']) + self.cards.remove('pythia8_card.dat') ######################################################################## @@ -6514,7 +6614,8 @@ def check_card_consistency(self): #check relation between lepton PDF // dressed lepton collisions // ... - if abs(self.run_card['lpp1']) != 1 or abs(self.run_card['lpp2']) != 1: + if isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int) and \ + abs(self.run_card['lpp1']) != 1 or abs(self.run_card['lpp2']) != 1: if abs(self.run_card['lpp1']) == abs(self.run_card['lpp2']) == 3: # this can be dressed lepton or photon-flux if proc_charac['pdg_initial1'] in [[11],[-11]] and proc_charac['pdg_initial2'] in [[11],[-11]]: @@ -6732,7 +6833,11 @@ def write_card_param(self): """ write the param_card """ self.param_card.write(self.paths['param']) - + + def write_card_fo_card(self): + """ write the fo_card""" + self.fo_card.write_card_from_template(self.paths['FO_analyse'], self.paths['FO_analyse_default']) + @staticmethod def update_dependent(mecmd, me_dir, param_card, path ,timer=0, run_card=None, lhapdfconfig=None): @@ -7076,7 +7181,7 @@ def do_decay(self, line): #first find the particle particle = line.split('>')[0].strip() logger.info("change madspin_card to define the decay of %s: %s" %(particle, line.strip()), '$MG:BOLD') - particle = particle.replace('+','\+').replace('-','\-') + particle = particle.replace('+',r'\+').replace('-',r'\-') decay_pattern = re.compile(r"^\s*decay\s+%s\s*>[\s\w+-~]*?$" % particle, re.I+re.M) text= open(path).read() text = decay_pattern.sub('', text) @@ -7193,7 +7298,7 @@ def help_edit(self, prefix=True): logger.info( ' --clean remove all previously existing line in the file') logger.info( ' --comment_line="" comment all lines matching the regular expression') logger.info('') - logger.info(' Note: all regular-expression will be prefixed by ^\s*') + logger.info(r' Note: all regular-expression will be prefixed by ^\s*') logger.info('') logger.info( ' example: edit reweight --after_line="change mode\b" change model heft') logger.info( ' edit madspin --after_line="banner" change model XXXX') @@ -7314,7 +7419,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''replace_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[14:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[14:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7344,7 +7449,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''comment_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[14:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[14:-1] nb_mod = 0 for posline,l in enumerate(split): if re.search(pattern, l): @@ -7366,7 +7471,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''before_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[13:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[13:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7383,7 +7488,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern = r'''after_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[12:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[12:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7527,16 +7632,19 @@ def open_file(self, answer): answer = 'plot' else: answer = self.cards[int(answer)-self.integer_bias] - + path = '' if 'madweight' in answer: answer = answer.replace('madweight', 'MadWeight') elif 'MadLoopParams' in answer: answer = self.paths['ML'] elif 'pythia8_card' in answer: answer = self.paths['pythia8'] + elif 'FO_analyse' in answer: + path = self.paths['FO_analyse'] + answer = 'fo_card' if os.path.exists(answer): path = answer - else: + elif not os.path.exists(path): if not '.dat' in answer and not '.lhco' in answer: if answer != 'trigger': path = self.paths[answer] @@ -7595,7 +7703,8 @@ def reload_card(self, path): logger.error('Please re-open the file and fix the problem.') logger.warning('using the \'set\' command without opening the file will discard all your manual change') elif path == self.paths['run']: - self.run_card = banner_mod.RunCard(path) + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + self.run_card = banner_mod.RunCard(path) elif path == self.paths['shower']: self.shower_card = shower_card_mod.ShowerCard(path) elif path == self.paths['ML']: @@ -7614,6 +7723,8 @@ def reload_card(self, path): except: import internal.madweight.Cards as mwcards self.mw_card = mwcards.Card(path) + elif path == self.paths['FO_analyse']: + self.fo_card = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse']) else: logger.debug('not keep in sync: %s', path) return path @@ -7629,6 +7740,9 @@ def scanparamcardhandling(input_path=lambda obj: pjoin(obj.me_dir, 'Cards', 'par iteratorclass=param_card_mod.ParamCardIterator, summaryorder=lambda obj: lambda:None, check_card=lambda obj: CommonRunCmd.static_check_param_card, + run_card_scan=False, + run_card_input= lambda obj: pjoin(obj.me_dir, 'Cards', 'run_card.dat'), + run_card_iteratorclass=banner_mod.RunCardIterator, ): """ This is a decorator for customizing/using scan over the param_card (or technically other) This should be use like this: @@ -7678,7 +7792,60 @@ def __enter__(self): def __exit__(self, ctype, value, traceback ): self.iterator.write(self.path) - def decorator(original_fct): + def scan_over_run_card(original_fct, obj, *args, **opts): + + if isinstance(input_path, str): + card_path = run_card_input + else: + card_path = run_card_input(obj) + + run_card_iterator = run_card_iteratorclass(card_path) + orig_card = copy.deepcopy(run_card_iterator.run_card) + if not run_card_iterator.run_card.scan_set: + return original_fct(obj, *args, **opts) + + + with restore_iterator(orig_card, card_path): + # this with statement ensure that the original card is restore + # whatever happens inside those block + + if not hasattr(obj, 'allow_notification_center'): + obj.allow_notification_center = False + with misc.TMP_variable(obj, 'allow_notification_center', False): + orig_name = get_run_name(obj) + if not orig_name and args[1]: + orig_name = args[1][0] + args = (args[0], args[1][1:]) + #orig_name = "scan_%s" % len(obj.results) + + try: + os.mkdir(pjoin(obj.me_dir, 'Events', orig_name)) + except Exception: + pass + next_name = orig_name + "_00" + + for i,card in enumerate(run_card_iterator): + card.write(card_path) + # still have to check for the auto-wdith + #if i !=0: + next_name = run_card_iterator.get_next_name(next_name) + set_run_name(obj)(next_name) + try: + original_fct(obj, *args, **opts) + except ignoreerror as error: + run_card_iterator.store_entry(next_name, {'exception': error}) + else: + run_card_iterator.store_entry(next_name, store_for_scan(obj)(), run_card_path=card_path) + + #param_card_iterator.write(card_path) #-> this is done by the with statement + name = misc.get_scan_name(orig_name, next_name) + path = result_path(obj) % name + logger.info("write scan results in %s" % path ,'$MG:BOLD') + order = summaryorder(obj)() + run_card_iterator.write_summary(path, order=order) + + + def decorator(original_fct): def new_fct(obj, *args, **opts): if isinstance(input_path, str): @@ -7702,8 +7869,13 @@ def new_fct(obj, *args, **opts): if not param_card_iterator: #first run of the function - original_fct(obj, *args, **opts) - return + if run_card_scan: + scan_over_run_card(original_fct, obj, *args, **opts) + return + else: + #first run of the function + original_fct(obj, *args, **opts) + return with restore_iterator(param_card_iterator, card_path): # this with statement ensure that the original card is restore diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/extended_cmd.py b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/extended_cmd.py index 2f37070580..789976beee 100755 --- a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/extended_cmd.py +++ b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/extended_cmd.py @@ -624,12 +624,12 @@ def complete(self, text, state): compfunc = self.completenames # correct wrong splittion with '\ ' - if line and begidx > 2 and line[begidx-2:begidx] == '\ ': + if line and begidx > 2 and line[begidx-2:begidx] == r'\ ': Ntext = line.split(os.path.sep)[-1] - self.completion_prefix = Ntext.rsplit('\ ', 1)[0] + '\ ' + self.completion_prefix = Ntext.rsplit(r'\ ', 1)[0] + r'\ ' to_rm = len(self.completion_prefix) - 1 Nbegidx = len(line.rsplit(os.path.sep, 1)[0]) + 1 - data = compfunc(Ntext.replace('\ ', ' '), line, Nbegidx, endidx) + data = compfunc(Ntext.replace(r'\ ', ' '), line, Nbegidx, endidx) self.completion_matches = [p[to_rm:] for p in data if len(p)>to_rm] # correct wrong splitting with '-'/"=" @@ -742,7 +742,7 @@ def path_completion(text, base_dir = None, only_dirs = False, completion += [prefix + f for f in ['.'+os.path.sep, '..'+os.path.sep] if \ f.startswith(text) and not prefix.startswith('.')] - completion = [a.replace(' ','\ ') for a in completion] + completion = [a.replace(' ',r'\ ') for a in completion] return completion @@ -1253,7 +1253,7 @@ def check_answer_in_input_file(self, question_instance, default, path=False, lin return possibility[0] if '=' in line and ' ' in line.strip(): leninit = len(line) - line,n = re.subn('\s*=\s*','=', line) + line,n = re.subn(r'\s*=\s*','=', line) if n and len(line) != leninit: return self.check_answer_in_input_file(question_instance, default, path=path, line=line) @@ -1311,7 +1311,7 @@ def nice_error_handling(self, error, line): if os.path.exists(self.debug_output): os.remove(self.debug_output) try: - super(Cmd,self).onecmd('history %s' % self.debug_output.replace(' ', '\ ')) + super(Cmd,self).onecmd('history %s' % self.debug_output.replace(' ', r'\ ')) except Exception as error: logger.error(error) @@ -2001,6 +2001,7 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): text = "" has_mg5_path = False # Use local configuration => Need to update the path + already_written = set() for line in open(basefile): if '=' in line: data, value = line.split('=',1) @@ -2018,9 +2019,12 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): comment = '' if key in to_keep: value = str(to_keep[key]) - else: + elif line not in already_written: + already_written.add(line) text += line continue + else: + continue if key == 'mg5_path': has_mg5_path = True try: @@ -2032,14 +2036,20 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): # check if absolute path if not os.path.isabs(value): value = os.path.realpath(os.path.join(basedir, value)) - text += '%s = %s # %s \n' % (key, value, comment) + new_line = '%s = %s # %s \n' % (key, value, comment) + if new_line not in already_written: + text += new_line + already_written.add(new_line) for key in to_write: if key in to_keep: - text += '%s = %s \n' % (key, to_keep[key]) + new_line = '%s = %s \n' % (key, to_keep[key]) + if new_line not in already_written: + text += new_line if not MADEVENT and not has_mg5_path: - text += """\n# MG5 MAIN DIRECTORY\n""" - text += "mg5_path = %s\n" % MG5DIR + if "mg5_path = %s\n" % MG5DIR not in already_written: + text += """\n# MG5 MAIN DIRECTORY\n""" + text += "mg5_path = %s\n" % MG5DIR writer = open(filepath,'w') writer.write(text) @@ -2190,7 +2200,7 @@ def onecmd(self, line, **opt): raise def reask(self, reprint_opt=True): - pat = re.compile('\[(\d*)s to answer\]') + pat = re.compile(r'\[(\d*)s to answer\]') prev_timer = signal.alarm(0) # avoid timer if any if prev_timer: @@ -2991,7 +3001,7 @@ def question_formatting(self, nb_col = 80, lpotential_switch=0, lnb_key=0, key=None): - """should return four lines: + r"""should return four lines: 1. The upper band (typically /========\ 2. The lower band (typically \========/ 3. The line without conflict | %(nb)2d. %(descrip)-20s %(name)5s = %(switch)-10s | @@ -3239,13 +3249,13 @@ def create_question(self, help_text=True): data_to_format['conflict_switch'] = self.color_for_value(key,self.inconsistent_keys[key], consistency=False) if hidden_line: - f2 = re.sub('%(\((?:name|descrip|add_info)\)-?)(\d+)s', + f2 = re.sub(r'%(\((?:name|descrip|add_info)\)-?)(\d+)s', lambda x: '%%%s%ds' % (x.group(1),int(x.group(2))+9), f2) text.append(f2 % data_to_format) elif hidden_line: if not f3: - f3 = re.sub('%(\((?:name|descrip|add_info)\)-?)(\d+)s', + f3 = re.sub(r'%(\((?:name|descrip|add_info)\)-?)(\d+)s', lambda x: '%%%s%ds' % (x.group(1),int(x.group(2))+9), f1) text.append(f3 % data_to_format) diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/file_writers.py b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/file_writers.py index 41bff05276..526756129f 100755 --- a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/file_writers.py +++ b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/file_writers.py @@ -36,10 +36,10 @@ class FileWriter(io.FileIO): supported_preprocessor_commands = ['if'] preprocessor_command_re=re.compile( - "\s*(?P%s)\s*\(\s*(?P.*)\s*\)\s*{\s*"\ + r"\s*(?P%s)\s*\(\s*(?P.*)\s*\)\s*{\s*"\ %('|'.join(supported_preprocessor_commands))) preprocessor_endif_re=re.compile(\ - "\s*}\s*(?Pelse)?\s*(\((?P.*)\))?\s*(?P{)?\s*") + r"\s*}\s*(?Pelse)?\s*(\((?P.*)\))?\s*(?P{)?\s*") class FileWriterError(IOError): """Exception raised if an error occurs in the definition @@ -191,15 +191,15 @@ class FortranWriterError(FileWriter.FileWriterError): pass # Parameters defining the output of the Fortran writer - keyword_pairs = {'^if.+then\s*$': ('^endif', 2), - '^type(?!\s*\()\s*.+\s*$': ('^endtype', 2), - '^do(?!\s+\d+)\s+': ('^enddo\s*$', 2), - '^subroutine': ('^end\s*$', 0), - '^module': ('^end\s*$', 0), - 'function': ('^end\s*$', 0)} - single_indents = {'^else\s*$':-2, - '^else\s*if.+then\s*$':-2} - number_re = re.compile('^(?P\d+)\s+(?P.*)') + keyword_pairs = {r'^if.+then\s*$': ('^endif', 2), + r'^type(?!\s*\()\s*.+\s*$': ('^endtype', 2), + r'^do(?!\s+\d+)\s+': (r'^enddo\s*$', 2), + '^subroutine': (r'^end\s*$', 0), + '^module': (r'^end\s*$', 0), + 'function': (r'^end\s*$', 0)} + single_indents = {r'^else\s*$':-2, + r'^else\s*if.+then\s*$':-2} + number_re = re.compile(r'^(?P\d+)\s+(?P.*)') line_cont_char = '$' comment_char = 'c' uniformcase = True #force everyting to be lower/upper case @@ -212,7 +212,7 @@ class FortranWriterError(FileWriter.FileWriterError): # Private variables __indent = 0 __keyword_list = [] - __comment_pattern = re.compile(r"^(\s*#|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|!)", re.IGNORECASE) + __comment_pattern = re.compile(r"^(\s*#|c\$|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|\s*!|!\$)", re.IGNORECASE) __continuation_line = re.compile(r"(?: )[$&]") def write_line(self, line): @@ -424,26 +424,20 @@ def count_number_of_quotes(self, line): i = i + 1 return len(splitline)-1 - def remove_routine(self, text, fct_names, formatting=True): - """write the incoming text but fully removing the associate routine/function - text can be a path to a file, an iterator, a string - fct_names should be a list of functions to remove + @staticmethod + def get_routine(text, fct_names, call_back=None): + """ + get the fortran function from a fortran file """ - f77_type = ['real*8', 'integer', 'double precision', 'logical'] - pattern = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I) - + + if isinstance(text, str): + text = text.split('\n') + + to_write=False removed = [] - if isinstance(text, str): - if '\n' in text: - text = text.split('\n') - else: - text = open(text) - if isinstance(fct_names, str): - fct_names = [fct_names] - - to_write=True for line in text: fct = pattern.findall(line) if fct: @@ -451,22 +445,38 @@ def remove_routine(self, text, fct_names, formatting=True): to_write = False else: to_write = True - if to_write: - if formatting: - if line.endswith('\n'): - line = line[:-1] - self.writelines(line) - else: - if not line.endswith('\n'): - line = '%s\n' % line - super(FileWriter,self).writelines(line) + if call_back: + call_back(line) else: removed.append(line) - + return removed + + def remove_routine(self, text, fct_names, formatting=True): + """write the incoming text but fully removing the associate routine/function + text can be a path to a file, an iterator, a string + fct_names should be a list of functions to remove + """ + + def call_back(line): + if formatting: + if line.endswith('\n'): + line = line[:-1] + self.writelines(line) + else: + if not line.endswith('\n'): + line = '%s\n' % line + super(FileWriter,self).writelines(line) + + return self.get_routine(text, fct_names, call_back) + +class FortranWriter90(FortranWriter): + + comment_char = ' !' + #=============================================================================== # CPPWriter #=============================================================================== @@ -497,50 +507,50 @@ class CPPWriterError(FileWriter.FileWriterError): '^private': standard_indent, '^protected': standard_indent} - spacing_patterns = [ - ('\s*\"\s*}', '\"'), - ('\s*,\s*', ', '), - ('\s*-\s*', ' - '), - ('([{(,=])\s*-\s*', '\g<1> -'), - ('(return)\s*-\s*', '\g<1> -'), - ('\s*\+\s*', ' + '), - ('([{(,=])\s*\+\s*', '\g<1> +'), - ('\(\s*', '('), - ('\s*\)', ')'), - ('\{\s*', '{'), - ('\s*\}', '}'), - ('\s*=\s*', ' = '), - ('\s*>\s*', ' > '), - ('\s*<\s*', ' < '), - ('\s*!\s*', ' !'), - ('\s*/\s*', '/'), - ('(?\s+>\s*', ' >> '), - ('<\s*double\s*>>\s*', ' > '), - ('\s*<\s+<\s*', ' << '), - ('\s*-\s+>\s*', '->'), - ('\s*=\s+=\s*', ' == '), - ('\s*!\s+=\s*', ' != '), - ('\s*>\s+=\s*', ' >= '), - ('\s*<\s+=\s*', ' <= '), - ('\s*&&\s*', ' && '), - ('\s*\|\|\s*', ' || '), - ('\s*{\s*}', ' {}'), - ('\s*;\s*', '; '), - (';\s*\}', ';}'), - (';\s*$}', ';'), - ('\s*<\s*([a-zA-Z0-9]+?)\s*>', '<\g<1>>'), - ('^#include\s*<\s*(.*?)\s*>', '#include <\g<1>>'), - ('(\d+\.{0,1}\d*|\.\d+)\s*[eE]\s*([+-]{0,1})\s*(\d+)', - '\g<1>e\g<2>\g<3>'), - ('\s+',' '), - ('^\s*#','#')] + spacing_patterns = [(r'\s*\"\s*}', '\"'), + (r'\s*,\s*', ', '), + (r'\s*-\s*', ' - '), + (r'([{(,=])\s*-\s*', r'\g<1> -'), + (r'(return)\s*-\s*', r'\g<1> -'), + (r'\s*\+\s*', ' + '), + (r'([{(,=])\s*\+\s*', r'\g<1> +'), + (r'\(\s*', '('), + (r'\s*\)', ')'), + (r'\{\s*', '{'), + (r'\s*\}', '}'), + (r'\s*=\s*', ' = '), + (r'\s*>\s*', ' > '), + (r'\s*<\s*', ' < '), + (r'\s*!\s*', ' !'), + (r'\s*/\s*', '/'), + (r'\s*\*\s*', ' * '), + (r'\s*-\s+-\s*', '-- '), + (r'\s*\+\s+\+\s*', '++ '), + (r'\s*-\s+=\s*', ' -= '), + (r'\s*\+\s+=\s*', ' += '), + (r'\s*\*\s+=\s*', ' *= '), + (r'\s*/=\s*', ' /= '), + (r'\s*>\s+>\s*', ' >> '), + (r'<\s*double\s*>>\s*', ' > '), + (r'\s*<\s+<\s*', ' << '), + (r'\s*-\s+>\s*', '->'), + (r'\s*=\s+=\s*', ' == '), + (r'\s*!\s+=\s*', ' != '), + (r'\s*>\s+=\s*', ' >= '), + (r'\s*<\s+=\s*', ' <= '), + (r'\s*&&\s*', ' && '), + (r'\s*\|\|\s*', ' || '), + (r'\s*{\s*}', ' {}'), + (r'\s*;\s*', '; '), + (r';\s*\}', ';}'), + (r';\s*$}', ';'), + (r'\s*<\s*([a-zA-Z0-9]+?)\s*>', r'<\g<1>>'), + (r'^#include\s*<\s*(.*?)\s*>', r'#include <\g<1>>'), + (r'(\d+\.{0,1}\d*|\.\d+)\s*[eE]\s*([+-]{0,1})\s*(\d+)', + r'\g<1>e\g<2>\g<3>'), + (r'\s+',' '), + (r'^\s*#','#')] + spacing_re = dict([(key[0], re.compile(key[0])) for key in \ spacing_patterns]) diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/gen_crossxhtml.py b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/gen_crossxhtml.py index d58ec573bc..681bf9d09b 100755 --- a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/gen_crossxhtml.py +++ b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/gen_crossxhtml.py @@ -648,7 +648,7 @@ def recreate(self, banner): if run_card['ickkw'] != 0: #parse the file to have back the information pythia_log = misc.BackRead(pjoin(path, '%s_pythia.log' % tag)) - pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") + pythiare = re.compile(r"\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") for line in pythia_log: info = pythiare.search(line) if not info: @@ -1623,7 +1623,7 @@ def get_html(self, runresults): elif self.debug: text = str(self.debug).replace('. ','.
') if 'http' in text: - pat = re.compile('(http[\S]*)') + pat = re.compile(r'(http[\S]*)') text = pat.sub(r' here ', text) debug = '
%s
%s
' % \ (self.debug.__class__.__name__, text) diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/gen_ximprove.py b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/gen_ximprove.py index c86da36a05..415ecc9de0 100755 --- a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/gen_ximprove.py +++ b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/gen_ximprove.py @@ -158,8 +158,11 @@ def get_helicity(self, to_submit=True, clean=True): (stdout, _) = p.communicate(''.encode()) stdout = stdout.decode('ascii',errors='ignore') if stdout: - nb_channel = max([math.floor(float(d)) for d in stdout.split()]) + lines = stdout.strip().split('\n') + nb_channel = max([math.floor(float(d)) for d in lines[-1].split()]) else: + if os.path.exists(pjoin(self.me_dir, 'error')): + os.remove(pjoin(self.me_dir, 'error')) for matrix_file in misc.glob('matrix*orig.f', Pdir): files.cp(matrix_file, matrix_file.replace('orig','optim')) P_zero_result.append(Pdir) @@ -297,12 +300,14 @@ def get_helicity(self, to_submit=True, clean=True): bad_amps_perhel = [] if __debug__: mtext = open(matrix_file).read() - nb_amp = int(re.findall('PARAMETER \(NGRAPHS=(\d+)\)', mtext)[0]) - logger.debug('nb_hel: %s zero amp: %s bad_amps_hel: %s/%s', len(good_hels),len(bad_amps),len(bad_amps_perhel), len(good_hels)*nb_amp ) + nb_amp = int(re.findall(r'PARAMETER \(NGRAPHS=(\d+)\)', mtext)[0]) + logger.debug('(%s) nb_hel: %s zero amp: %s bad_amps_hel: %s/%s', split_file[-1], len(good_hels),len(bad_amps),len(bad_amps_perhel), len(good_hels)*nb_amp ) if len(good_hels) == 1: files.cp(matrix_file, matrix_file.replace('orig','optim')) continue # avoid optimization if onlye one helicity - recycler = hel_recycle.HelicityRecycler(good_hels, bad_amps, bad_amps_perhel) + + gauge = self.cmd.proc_characteristics['gauge'] + recycler = hel_recycle.HelicityRecycler(good_hels, bad_amps, bad_amps_perhel, gauge=gauge) # In case of bugs you can play around with these: recycler.hel_filt = self.run_card['hel_filtering'] recycler.amp_splt = self.run_card['hel_splitamp'] @@ -1299,7 +1304,7 @@ def get_job_for_event(self): 'script_name': 'unknown', 'directory': C.name, # need to be change for splitted job 'P_dir': C.parent_name, - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # needed for RO gridpack 'offset': 1, # need to be change for splitted job 'nevents': nevents, 'maxiter': self.max_iter, @@ -1387,7 +1392,7 @@ def create_ajob(self, template, jobs, write_dir=None): break info = jobs[j] info['script_name'] = 'ajob%i' % script_number - info['keeplog'] = 'false' + info['keeplog'] = 'false' if self.run_card['keep_log'] != 'debug' else 'true' if "base_directory" not in info: info["base_directory"] = "./" fsock.write(template_text % info) @@ -1456,7 +1461,7 @@ def get_job_for_precision(self): 'script_name': 'unknown', 'directory': C.name, # need to be change for splitted job 'P_dir': C.parent_name, - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # used for RO gridpack 'offset': 1, # need to be change for splitted job 'nevents': nevents, 'maxiter': self.max_iter, @@ -1916,7 +1921,7 @@ def get_job_for_event(self): 'directory': C.name, # need to be change for splitted job 'P_dir': os.path.basename(C.parent_name), 'offset': 1, # need to be change for splitted job - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # use for RO gridpack 'nevents': nevents, #int(nevents*self.gen_events_security)+1, 'maxiter': self.max_iter, 'miniter': self.min_iter, diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/hel_recycle.py b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/hel_recycle.py index dfa45d5d20..6c86611f68 100755 --- a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/hel_recycle.py +++ b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/hel_recycle.py @@ -383,7 +383,7 @@ def get_number(cls, *args): class HelicityRecycler(): '''Class for recycling helicity''' - def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[]): + def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[], gauge='U'): External.good_hel = [] External.nhel_lines = '' @@ -427,6 +427,7 @@ def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[]): self.all_hel = [] self.hel_filt = True + self.gauge = gauge def set_input(self, file): if 'born_matrix' in file: @@ -612,7 +613,7 @@ def unfold_helicities(self, line, nature): def apply_amps(self, line, new_objs): if self.amp_splt: - return split_amps(line, new_objs) + return split_amps(line, new_objs, gauge=self.gauge) else: return apply_args(line, [i.args for i in new_objs]) @@ -785,7 +786,7 @@ def apply_args(old_line, all_the_args): return ''.join(new_lines) -def split_amps(line, new_amps): +def split_amps(line, new_amps, gauge): if not new_amps: return '' fct = line.split('(',1)[0].split('_0')[0] @@ -841,34 +842,31 @@ def split_amps(line, new_amps): spin = fct.split(None,1)[1][to_remove] lines.append('%sP1N_%s(%s)' % (fct, to_remove+1, ', '.join(args))) - hel, iamp = re.findall('AMP\((\d+),(\d+)\)', amp_result)[0] + hel, iamp = re.findall(r'AMP\((\d+),(\d+)\)', amp_result)[0] hel_calculated.append(hel) #lines.append(' %(result)s = TMP(3) * W(3,%(w)s) + TMP(4) * W(4,%(w)s)+' # % {'result': amp_result, 'w': windex}) #lines.append(' & TMP(5) * W(5,%(w)s)+TMP(6) * W(6,%(w)s)' # % {'result': amp_result, 'w': windex}) - if spin in "VF": - lines.append(""" call CombineAmp(%(nb)i, - & (/%(hel_list)s/), - & (/%(w_list)s/), - & TMP, W, AMP(1,%(iamp)s))""" % - {'nb': len(sub_amps), - 'hel_list': ','.join(hel_calculated), - 'w_list': ','.join(windices), - 'iamp': iamp - }) + if spin == "F" or ( spin == "V" and gauge !='FD'): + suffix = '' elif spin == "S": - lines.append(""" call CombineAmpS(%(nb)i, - &(/%(hel_list)s/), - & (/%(w_list)s/), - & TMP, W, AMP(1,%(iamp)s))""" % - {'nb': len(sub_amps), - 'hel_list': ','.join(hel_calculated), - 'w_list': ','.join(windices), - 'iamp': iamp - }) + suffix = 'S' + elif spin == "V" and gauge == "FD": + suffix = "FD" else: - raise Exception("split amp are not supported for spin2 and 3/2") + raise Exception("split amp not supported for spin2, 3/2") + + lines.append(""" call CombineAmp%(suffix)s(%(nb)i, + & (/%(hel_list)s/), + & (/%(w_list)s/), + & TMP, W, AMP(1,%(iamp)s))""" % {'suffix':suffix, + 'nb': len(sub_amps), + 'hel_list': ','.join(hel_calculated), + 'w_list': ','.join(windices), + 'iamp': iamp + }) + #lines.append('') return '\n'.join(lines) diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/histograms.py b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/histograms.py index 98f22c4c3a..9931127f66 100755 --- a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/histograms.py +++ b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/histograms.py @@ -632,34 +632,34 @@ class HwU(Histogram): # than necessary because the HwU standard allows for spaces from within # the name of a weight weight_header_re = re.compile( - '&\s*(?P(\S|(\s(?!\s*(&|$))))+)(\s(?!(&|$)))*') + r'&\s*(?P(\S|(\s(?!\s*(&|$))))+)(\s(?!(&|$)))*') # ================================ # Histo weight specification RE's # ================================ # The start of a plot - histo_start_re = re.compile('^\s*\s*(?P\d+)\s*"\s*'+ - '(?P(\S|(\s(?!\s*")))+)\s*"\s*$') + histo_start_re = re.compile(r'^\s*\s*(?P\d+)\s*"\s*'+ + r'(?P(\S|(\s(?!\s*")))+)\s*"\s*$') # A given weight specifier - a_float_re = '[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' - histo_bin_weight_re = re.compile('(?P%s|NaN)'%a_float_re,re.IGNORECASE) - a_int_re = '[\+|-]?\d+' + a_float_re = r'[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' + histo_bin_weight_re = re.compile(r'(?P%s|NaN)'%a_float_re,re.IGNORECASE) + a_int_re = r'[\+|-]?\d+' # The end of a plot histo_end_re = re.compile(r'^\s*<\\histogram>\s*$') # A scale type of weight - weight_label_scale = re.compile('^\s*mur\s*=\s*(?P%s)'%a_float_re+\ - '\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) - weight_label_PDF = re.compile('^\s*PDF\s*=\s*(?P\d+)\s*$') - weight_label_PDF_XML = re.compile('^\s*pdfset\s*=\s*(?P\d+)\s*$') - weight_label_TMS = re.compile('^\s*TMS\s*=\s*(?P%s)\s*$'%a_float_re) - weight_label_alpsfact = re.compile('^\s*alpsfact\s*=\s*(?P%s)\s*$'%a_float_re, + weight_label_scale = re.compile(r'^\s*mur\s*=\s*(?P%s)'%a_float_re+\ + r'\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) + weight_label_PDF = re.compile(r'^\s*PDF\s*=\s*(?P\d+)\s*$') + weight_label_PDF_XML = re.compile(r'^\s*pdfset\s*=\s*(?P\d+)\s*$') + weight_label_TMS = re.compile(r'^\s*TMS\s*=\s*(?P%s)\s*$'%a_float_re) + weight_label_alpsfact = re.compile(r'^\s*alpsfact\s*=\s*(?P%s)\s*$'%a_float_re, re.IGNORECASE) - weight_label_scale_adv = re.compile('^\s*dyn\s*=\s*(?P%s)'%a_int_re+\ - '\s*mur\s*=\s*(?P%s)'%a_float_re+\ - '\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) - weight_label_PDF_adv = re.compile('^\s*PDF\s*=\s*(?P\d+)\s+(?P\S+)\s*$') + weight_label_scale_adv = re.compile(r'^\s*dyn\s*=\s*(?P%s)'%a_int_re+\ + r'\s*mur\s*=\s*(?P%s)'%a_float_re+\ + r'\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) + weight_label_PDF_adv = re.compile(r'^\s*PDF\s*=\s*(?P\d+)\s+(?P\S+)\s*$') class ParseError(MadGraph5Error): @@ -926,7 +926,7 @@ def get_HwU_source(self, print_header=True): res.append(' '.join('%+16.7e'%wgt for wgt in list(bin.boundaries))) res[-1] += ' '.join('%+16.7e'%bin.wgts[key] for key in self.bins.weight_labels if key not in ['central','stat_error']) - res.append('<\histogram>') + res.append(r'<\histogram>') return res def output(self, path=None, format='HwU', print_header=True): @@ -1149,6 +1149,8 @@ def parse_one_histo_from_stream(self, stream, all_weight_header, boundaries = [0.0,0.0] for j, weight in \ enumerate(HwU.histo_bin_weight_re.finditer(line_bin)): + if (j == len(weight_header)): + continue if j == len(all_weight_header): raise HwU.ParseError("There is more bin weights"+\ " specified than expected (%i)"%len(weight_header)) @@ -1803,7 +1805,7 @@ def parse_histos_from_PY8_XML_stream(self, stream, run_id=None, # Filter empty weights coming from the split weight_label_list = [wgt.strip() for wgt in str(selected_run_node.getAttribute('header')).split(';') if - not re.match('^\s*$',wgt)] + not re.match(r'^\s*$',wgt)] ordered_weight_label_list = [w for w in weight_label_list if w not\ in ['xmin','xmax']] # Remove potential repetition of identical weight labels @@ -1827,7 +1829,7 @@ def parse_histos_from_PY8_XML_stream(self, stream, run_id=None, all_weights = [] for wgt_position, wgt_label in \ enumerate(str(selected_run_node.getAttribute('header')).split(';')): - if not re.match('^\s*$',wgt_label) is None: + if not re.match(r'^\s*$',wgt_label) is None: continue all_weights.append({'POSITION':wgt_position}) for wgt_item in wgt_label.strip().split('_'): @@ -2714,7 +2716,7 @@ def ratio_no_correlations(wgtsA, wgtsB): # First the global gnuplot header for this histogram group global_header =\ -""" +r""" ################################################################################ ### Rendering of the plot titled '%(title)s' ################################################################################ @@ -2862,9 +2864,9 @@ def ratio_no_correlations(wgtsA, wgtsB): major_title = ', '.join(major_title) if not mu[0] in ['none',None]: - major_title += ', dynamical\_scale\_choice=%s'%mu[0] + major_title += r', dynamical\_scale\_choice=%s'%mu[0] if not pdf[0] in ['none',None]: - major_title += ', PDF=%s'%pdf[0].replace('_','\_') + major_title += ', PDF=%s'%pdf[0].replace('_',r'\_') # Do not show uncertainties for individual jet samples (unless first # or specified explicitely and uniquely) @@ -2937,7 +2939,7 @@ def ratio_no_correlations(wgtsA, wgtsB): plot_lines.append( "'%s' index %d using (($1+$2)/2):%d ls %d title '%s'"\ %(HwU_name,block_position+i,mu_var+3,color_index,\ -'%s dynamical\_scale\_choice=%s' % (title,mu[j]))) +r'%s dynamical\_scale\_choice=%s' % (title,mu[j]))) # And now PDF_variation if available if not PDF_var_pos is None: for j,PDF_var in enumerate(PDF_var_pos): @@ -2947,7 +2949,7 @@ def ratio_no_correlations(wgtsA, wgtsB): plot_lines.append( "'%s' index %d using (($1+$2)/2):%d ls %d title '%s'"\ %(HwU_name,block_position+i,PDF_var+3,color_index,\ -'%s PDF=%s' % (title,pdf[j].replace('_','\_')))) +'%s PDF=%s' % (title,pdf[j].replace('_',r'\_')))) # Now add the uncertainty lines, those not using a band so that they # are not covered by those using a band after we reverse plo_lines diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/launch_plugin.py b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/launch_plugin.py index 7b10bedcef..9ec09eb71d 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/launch_plugin.py +++ b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/launch_plugin.py @@ -98,6 +98,7 @@ def default_setup(self): self['vector_size'] = 16 # already setup in default class (just change value) self['aloha_flag'] = '--fast-math' self['matrix_flag'] = '-O3' + self['limhel'] = 0 self.display_block.append('simd') self.display_block.append('psoptim') diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/lhe_parser.py b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/lhe_parser.py index eee9ba4522..f6e47956cd 100755 --- a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/lhe_parser.py +++ b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/lhe_parser.py @@ -7,6 +7,7 @@ import numbers import math import time +import copy import os import shutil import sys @@ -101,7 +102,7 @@ def __init__(self, line=None, event=None): self.rwgt = 0 return - + self.event = event if event is not None: self.event_id = len(event) #not yet in the event @@ -1066,6 +1067,8 @@ def define_init_banner(self, wgt, lha_strategy, proc_charac=None): #special case for 1>N init_information = run_card.get_banner_init_information() event = next(self) + if not len(event): #if parse-momenta was false we have to parse the first event + event = Event(str(event)) init_information["idbmup1"] = event[0].pdg init_information["ebmup1"] = event[0].mass init_information["idbmup2"] = 0 @@ -1149,6 +1152,7 @@ def initialize_unweighting(self, getwgt, trunc_error): nb_keep = max(20, int(nb_event*trunc_error*15)) new_wgt = new_wgt[-nb_keep:] if nb_event == 0: + misc.sprint(i,f) raise Exception # store the information self.initial_nb_events[i] = nb_event @@ -1203,7 +1207,6 @@ def unweight(self, outputpath, get_wgt, **opts): (stop to write event when target is reached) """ - if isinstance(get_wgt, (str,six.text_type)): unwgt_name =get_wgt def get_wgt_multi(event): @@ -1483,12 +1486,12 @@ def reorder_mother_child(self): particle.mother2 -= 1 # re-call the function for the next potential change return self.reorder_mother_child() - - - - - + + + + + def parse_reweight(self): """Parse the re-weight information in order to return a dictionary {key: value}. If no group is define group should be '' """ @@ -1522,6 +1525,37 @@ def parse_nlo_weight(self, real_type=(1,11), threshold=None): threshold=threshold) return self.nloweight + def get_fks_pair(self, real_type=(1,11), threshold=None): + """ Gives the fks pair labels""" + start, stop = self.tag.find(''), self.tag.find('') + if start != -1 != stop: + text = self.tag[start+8:stop] + all_line = text.split('\n') + text = text.lower().replace('d','e') + all_line = text.split('\n') + for line in all_line: + data = line.split() + if len(data)>16: + wgt = OneNLOWeight(line, real_type=real_type) + return wgt.to_merge_pdg,wgt.nexternal + + def get_born_momenta(self,real_type=(1,11), threshold=None): + """ Gets the underlying n+1 body kinematics""" + start, stop = self.tag.find(''), self.tag.find('') + if start != -1 != stop: + text = self.tag[start+8:stop] + text = text.lower().replace('d','e') + all_line = text.split('\n') + for line in all_line: + data = line.split() + if len(data)>16: + wgt = OneNLOWeight(line, real_type=real_type) + nexternal = wgt.nexternal + real_momenta = all_line[2:2+nexternal] + return real_momenta + + + def rewrite_nlo_weight(self, wgt=None): """get the string associate to the weight""" @@ -1558,11 +1592,11 @@ def parse_lo_weight(self): return self.loweight if not hasattr(Event, 'loweight_pattern'): - Event.loweight_pattern = re.compile('''\s*(?P\d+)\s+(?P[\d.e+-]+)\s*\s*\n\s* - \s*(?P[\s\d.+-e]+)\s*\s*\n\s* - 1|2)["']?\>\s*(?P[\s\d.e+-]*)\s*\s*\n\s* - 1|2)["']?\>\s*(?P[\s\d.e+-]*)\s*\s*\n\s* - \s*(?P[\d.e+-]*)\s* + Event.loweight_pattern = re.compile('''\\s*(?P\\d+)\\s+(?P[\\d.e+-]+)\\s*\\s*\n\\s* + \\s*(?P[\\s\\d.+-e]+)\\s*\\s*\n\\s* + 1|2)["']?\\>\\s*(?P[\\s\\d.e+-]*)\\s*\\s*\n\\s* + 1|2)["']?\\>\\s*(?P[\\s\\d.e+-]*)\\s*\\s*\n\\s* + \\s*(?P[\\d.e+-]*)\\s* ''',re.X+re.I+re.M) start, stop = self.tag.find(''), self.tag.find('') @@ -1615,7 +1649,7 @@ def parse_matching_scale(self): self.matched_scale_data = [] - pattern = re.compile("") + pattern = re.compile(r"") data = re.split(pattern,self.tag) if len(data) == 1: return [] @@ -1623,7 +1657,7 @@ def parse_matching_scale(self): tmp = {} start,content, end = data self.tag = "%s%s" % (start, end) - pattern = re.compile("pt_clust_(\d*)=\"([\de+-.]*)\"") + pattern = re.compile("pt_clust_(\\d*)=\"([\\de+-.]*)\"") for id,value in pattern.findall(content): tmp[int(id)] = float(value) for i in range(1, len(self)+1): @@ -1647,7 +1681,7 @@ def parse_syscalc_info(self): return self.syscalc_data pattern = re.compile("|") - pattern2 = re.compile("<(?P[\w]*)(?:\s*(\w*)=[\"'](.*)[\"']\s*|\s*)>(.*)") + pattern2 = re.compile("<(?P[\\w]*)(?:\\s*(\\w*)=[\"'](.*)[\"']\\s*|\\s*)>(.*)") data = re.split(pattern,self.tag) if len(data) == 1: return [] @@ -1850,6 +1884,240 @@ def get_decay(self, pdg_code=0, event_id=None): return new_event + + def set_initial_mass_to_zero(self): + """set the masses of the initial particles to zero, by reshuffling the respective momenta + Works only in the **partonic** com frame, so the event must be boosted to such frame + before calling the function + """ + + if not misc.equal(self[0].px, 0) or not misc.equal(self[1].px, 0) or \ + not misc.equal(self[0].py, 0) or not misc.equal(self[1].py, 0) or \ + not misc.equal(self[0].pz, - self[1].pz, zero_limit=False): + misc.sprint(self[0]) + misc.sprint(self[1]) + raise Exception('momenta should be in the partonic center of mass frame') + + self[0].mass = 0. + self[1].mass = 0. + tot_E=0. + for ip,part in enumerate(self): + if part.status == 1 : + tot_E += part.E + if (self[0].pz > 0. and self[1].pz < 0): + self[0].set_momentum(FourMomentum([tot_E/2., 0., 0., tot_E/2.])) + self[1].set_momentum(FourMomentum([tot_E/2., 0., 0., -tot_E/2.])) + elif (self[0].pz < 0. and self[1].pz > 0): + self[0].set_momentum(FourMomentum([tot_E/2., 0., 0., -tot_E/2.])) + self[1].set_momentum(FourMomentum([tot_E/2., 0., 0., tot_E/2.])) + else: + logger.critical('ERROR: two incoming partons not back.-to-back') + + def set_final_jet_mass_to_zero(self): + """set the final light particle masses to zero + """ + + for ip,part in enumerate(self): + if ((abs(part.pid) <= 5) or (abs(part.pid) == 11) or (abs(part.pid) == 12)) and (part.status == 1): + part.mass = 0. + E_1_new = math.sqrt(part.mass**2 + part.px**2 + part.py**2 + part.pz**2) + part.set_momentum(FourMomentum([E_1_new, part.px, part.py, part.pz])) + + + + def merge_particles_kinematics(self, i,j, moth): + """Map to an underlying n-body kinematics for two given + particles i,j to be merged and a resulting moth""" + """ note! kinematics (and id) mapping only! """ + + recoil = True + fks_type = False + + if recoil and not fks_type: + if (i == moth[0].get('number')-1): + fks_i = i + fks_j = j + elif (j == moth[0].get('number')-1): + fks_i = j + fks_j = i + to_remove = fks_j + + merge_i = self[fks_i] + merge_j = self[fks_j] + + i_4mom = FourMomentum(merge_i) + j_4mom = FourMomentum(merge_j) + if (fks_i <= 1): + sign1 = -1.0 + else: + sign1 = 1.0 + mother_4mom = i_4mom + sign1*j_4mom + + new_event = copy.deepcopy(self) + + self[fks_i].pid = moth[0]['id'] + self[fks_i].set_momentum(mother_4mom) + + if fks_i <= 1: # initial-state recoil + new_p = FourMomentum() + for ip,part in enumerate(self): + if (ip != fks_i and ip != fks_j and ip >= 2): + new_p += part + + if fks_i == 0: + self[1].set_momentum(new_p - FourMomentum(self[0])) + elif fks_i == 1: + self[0].set_momentum(new_p - FourMomentum(self[1])) + + pz_1_new = self.recoil_eq(self[0],self[1]) + pz_2_new = self[0].pz + self[1].pz - pz_1_new + E_1_new = math.sqrt(self[0].mass**2 + self[0].px**2 + self[0].py**2 + pz_1_new **2) + E_2_new = math.sqrt(self[1].mass**2 + self[1].px**2 + self[1].py**2 + pz_2_new **2) + self[0].set_momentum(FourMomentum([E_1_new,self[0].px,self[0].py,pz_1_new])) + self[1].set_momentum(FourMomentum([E_2_new,self[1].px,self[1].py,pz_2_new])) + self.pop(to_remove) + + if fks_i > 1: # final-state recoil + + # Re-scale the energy of fks_i to make it on-shell + for ip,part in enumerate(self): + if (ip == fks_i): + part.E = math.sqrt(part.mass**2 + part.px**2 + part.py**2 + part.pz**2) + new_p.E = part.E + + # Find the overall energy in the final state + new_p.E = 0.0 + for ip,part in enumerate(self): + if (ip != fks_j and ip >= 2): + new_p.E += part.E + + # Use one of the initial states to absorb the energy change in the final state + self[1].set_momentum(FourMomentum([new_p.E-self[0].E,self[1].px,self[1].py,self[1].pz])) + + # Change the initial state pz and E + pz_1_new = self.recoil_eq(self[0],self[1]) + pz_2_new = self[0].pz + self[1].pz - pz_1_new + E_1_new = math.sqrt(self[0].mass**2 + self[0].px**2 + self[0].py**2 + pz_1_new **2) + E_2_new = math.sqrt(self[1].mass**2 + self[1].px**2 + self[1].py**2 + pz_2_new **2) + self[0].set_momentum(FourMomentum([E_1_new,self[0].px,self[0].py,pz_1_new])) + self[1].set_momentum(FourMomentum([E_2_new,self[1].px,self[1].py,pz_2_new])) + self.pop(to_remove) + + elif fks_type and not recoil: + ## Do it in a more FKS-style + if (i == moth[0].get('number')-1): + fks_i = i + fks_j = j + elif (j == moth[0].get('number')-1): + fks_i = j + fks_j = i + to_remove = fks_j + new_event = copy.copy(event) + + if fks_i <= 1: # initial-state recoil + + # First boost to partonic CM frame + q = FourMomentum(self[0])+FourMomentum(self[1]) + for ip,part in enumerate(self): + vec = FourMomentum(part) + self[ip].set_momentum(vec.zboost(pboost=q)) + + k_tot = FourMomentum([self[0].E+self[1].E-self[fks_j].E,self[0].px+self[1].px-self[fks_j].px,\ + self[0].py+self[1].py-self[fks_j].py,self[0].pz+self[1].pz-self[fks_j].pz]) + + final = FourMomentum([0,0,0,0]) + for ip,part in enumerate(self): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + if (ip != fks_i and ip != fks_j and ip >= 2): + final = final + vec + + s = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz])**2 + ksi = self[fks_j].E/(math.sqrt(s)/2.0) + y = self[fks_j].pz/self[fks_j].E + + self[0].pz = self[0].pz * math.sqrt(1.0-ksi)*math.sqrt((2.0-ksi*(1.0+y))/((2.0-ksi*(1.0-y)))) + self[0].E = math.sqrt(self[0].mass**2 + self[0].pz**2) + self[1].pz = self[1].pz * math.sqrt(1.0-ksi)*math.sqrt((2.0-ksi*(1.0-y))/((2.0-ksi*(1.0+y)))) + self[1].E = math.sqrt(self[1].mass**2 + self[1].pz**2) + + final = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + k_tot_1 = k_tot.zboost(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + k_tot_2 = k_tot_1.pt_boost(pboost=FourMomentum([k_tot_1.E,k_tot_1.px,k_tot_1.py,k_tot_1.pz])) + k_tot_3 = k_tot_2.zboost_inv(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + + for ip,part in enumerate(self): + if (ip >= 2): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + vec2 = vec.zboost(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + vec3 = vec2.pt_boost(pboost=FourMomentum([k_tot_1.E,k_tot_1.px,k_tot_1.py,k_tot_1.pz])) + vec_new = vec3.zboost_inv(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + self[ip].set_momentum(FourMomentum([vec_new.E,vec_new.px,vec_new.py,vec_new.pz])) + + self.pop(to_remove) + + else: # final-state recoil + q = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + for ip,part in enumerate(self): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + self[ip].set_momentum(vec.zboost(pboost=q)) + + q = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + k = FourMomentum([self[fks_i].E+self[fks_j].E,self[fks_i].px+self[fks_j].px,\ + self[fks_i].py+self[fks_j].py,self[fks_i].pz+self[fks_j].pz]) + + k_rec = FourMomentum([0,0,0,0]) + for ip,part in enumerate(self): + if ip >= 2 and ip != fks_i and ip != fks_j: # add only final-states to the recoil and not the FKS pair + k_rec = k_rec + FourMomentum([part.E,part.px,part.py,part.pz]) + + k_mom = math.sqrt(k_rec.px**2 + k_rec.py**2 + k_rec.pz**2) + beta = (q**2 - (k_rec.E+k_mom)**2)/(q**2 + (k_rec.E+k_mom)**2) + for ip,part in enumerate(self): + if ip >= 2 and ip != fks_i and ip != fks_j: + vec = FourMomentum([self[ip].E,self[ip].px,self[ip].py,self[ip].pz]) + self[ip].set_momentum(vec.boost_beta(beta,k_rec)) + if ip == fks_i: + self[ip].set_momentum(q - k_rec.boost_beta(beta,k_rec)) + self.pop(to_remove) + else: + logger.info('Error in Sudakov Born mapping: no recoil scheme found!') + + def recoil_eq(self,part1, part2): + """ In general, solves the equation + E1 + E2 = K + p1 + p2 = c + E1^2 - p1^2 = a + E2^2 - p2^2 = b + and returns p1 + """ + thresh = 1e-6 + import random + a = part1.mass**2 + part1.px**2 + part1.py**2 + b = part2.mass**2 + part2.px**2 + part2.py**2 + c = part1.pz + part2.pz + K = part1.E + part2.E + K2 = K**2 + sol1 = (-a*c + b*c + c**3 - c*K2 - math.sqrt(K2*(a**2 + (b + c**2 - K2)**2 - 2*a*(b - c**2 + K2))))/(2*(c**2-K2)) + sol2 = (-a*c + b*c + c**3 - c*K2 + math.sqrt(K2*(a**2 + (b + c**2 - K2)**2 - 2*a*(b - c**2 + K2))))/(2*(c**2-K2)) + + if abs(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2) - (math.sqrt(a+sol2**2) + math.sqrt(b+(c-sol2)**2))) > thresh: + logger.critical('Error in recoil_eq solver 1') + logger.critical(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2)) + logger.critical(math.sqrt(a+sol2**2) + math.sqrt(b+(c-sol2)**2)) + if abs(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2) - K) > thresh: + logger.critical('Error in recoil_eq solver 2') + logger.critical(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2)) + logger.critical(K) + return sol1 + + def boost(self, filter=None): """modify the current event to boost it according to the current filter""" if filter is None: @@ -1861,7 +2129,7 @@ def boost(self, filter=None): if list(filter(p)): pboost += p else: - pboost = FourMomentum(pboost) + pboost = FourMomentum(filter) # change sign of three-component due to helas convention pboost.px *=-1 @@ -1877,7 +2145,7 @@ def check(self): """check various property of the events""" # check that relative error is under control - threshold = 1e-6 + threshold = 1e-4 #1. Check that the 4-momenta are conserved E, px, py, pz = 0,0,0,0 @@ -1920,7 +2188,50 @@ def check(self): self.check_color_structure() #3. check mass - + + def check_kinematics_only(self): + """check various property of the events - only kinematics""" + + # check that relative error is under control + threshold = 1e-3 + + #1. Check that the 4-momenta are conserved + E, px, py, pz = 0,0,0,0 + absE, abspx, abspy, abspz = 0,0,0,0 + for particle in self: + coeff = 1 + if particle.status == -1: + coeff = -1 + elif particle.status != 1: + continue + E += coeff * particle.E + absE += abs(particle.E) + px += coeff * particle.px + py += coeff * particle.py + pz += coeff * particle.pz + abspx += abs(particle.px) + abspy += abs(particle.py) + abspz += abs(particle.pz) + # check mass + fourmass = FourMomentum(particle).mass + + if particle.mass and (abs(particle.mass) - fourmass)/ abs(particle.mass) > threshold: + logger.critical(self) + raise Exception( "Do not have correct mass lhe: %s momentum: %s (error at %s" % (particle.mass, fourmass, (abs(particle.mass) - fourmass)/ abs(particle.mass))) + + if abs(E/absE) > threshold: + logger.critical(self) + raise Exception("Do not conserve Energy %s, %s" % (E/absE, E)) + if abs(px/abspx) > threshold: + logger.critical(self) + raise Exception("Do not conserve Px %s, %s" % (px/abspx, px)) + if abs(py/abspy) > threshold: + logger.critical(self) + raise Exception("Do not conserve Py %s, %s" % (py/abspy, py)) + if abs(pz/abspz) > threshold: + logger.critical(self) + raise Exception("Do not conserve Pz %s, %s" % (pz/abspz, pz)) + def assign_scale_line(self, line, convert=True): """read the line corresponding to global event line @@ -2764,7 +3075,7 @@ def zboost(self, pboost=None, E=0, pz=0): if isinstance(pboost, FourMomentum): E = pboost.E pz = pboost.pz - + #beta = pz/E gamma = E / math.sqrt(E**2-pz**2) gammabeta = pz / math.sqrt(E**2-pz**2) @@ -2778,6 +3089,74 @@ def zboost(self, pboost=None, E=0, pz=0): out.pz = 0 return out + def zboost_inv(self, pboost=None, E=0, pz=0): + """Both momenta should be in the same frame. + The boost perform correspond to the boost required to set pboost at + rest (only z boost applied). + """ + if isinstance(pboost, FourMomentum): + E = pboost.E + pz = pboost.pz + + #beta = pz/E + gamma = E / math.sqrt(E**2-pz**2) + gammabeta = pz / math.sqrt(E**2-pz**2) + + out = FourMomentum([gamma*self.E + gammabeta*self.pz, + self.px, + self.py, + gamma*self.pz + gammabeta*self.E]) + + if abs(out.pz) < 1e-6 * out.E: + out.pz = 0 + return out + + + def pt_boost(self, pboost=None, E=0, pz=0): + """Both momenta should be in the same frame. + The boost perform correspond to the boost required to set pboost at + rest (only pT boost applied). + """ + + if isinstance(pboost, FourMomentum): + E = pboost.E + px = pboost.px + py = pboost.py + mass = math.sqrt(E**2 - px**2 - py**2) + + betax = px/E + betay = py/E + beta = math.sqrt(betax**2+betay**2) + gamma = 1 / math.sqrt(1.0-beta**2) + + out = FourMomentum([gamma*self.E - gamma*betax*self.px - gamma*betay*self.py, + -gamma*betax*self.E + (1.0 + (gamma-1.0)*betax**2/(beta**2))*self.px + (gamma-1.0)*betax*betay/(beta**2)*self.py, + -gamma*betay*self.E + ((gamma-1.0)*betax*betay/(beta**2))*self.px + (1.0+(gamma-1.0)*(betay**2)/(beta**2))*self.py, + self.pz]) + + if abs(out.px) < 1e-6 * out.E: + out.px = 0 + if abs(out.py) < 1e-6 * out.E: + out.py = 0 + return out + + def boost_beta(self,beta,mom): + """ Boost along the three-momentum of mom with a boost of size beta""" + + unit = mom * (1.0/math.sqrt(mom.px**2+mom.py**2+mom.pz**2)) + beta_vec = beta*unit + bx = beta_vec.px + by = beta_vec.py + bz = beta_vec.pz + gamma = 1.0 / math.sqrt(1.0-beta**2) + + out = FourMomentum([gamma*self.E - gamma*bx*self.px - gamma*by*self.py - gamma*bz*self.pz, + -gamma*bx*self.E + (1.0 + (gamma-1.0)*bx**2/(beta**2))*self.px + (gamma-1.0)*bx*by/(beta**2)*self.py + (gamma-1.0)*bx*bz/(beta**2)*self.pz, + -gamma*by*self.E + ((gamma-1.0)*bx*by/(beta**2))*self.px + (1.0+(gamma-1.0)*(by**2)/(beta**2))*self.py + (gamma-1.0)*by*bz/(beta**2)*self.pz, + -gamma*bz*self.E + (gamma-1.0)*bx*bz/(beta**2)*self.px + (gamma-1.0)*(by*bz)/(beta**2)*self.py + (1.0+(gamma-1.0)*bz**2/(beta**2))*self.pz]) + + return out + def boost_to_restframe(self, pboost): """apply the boost transformation such that pboost is at rest in the new frame. First apply a rotation to allign the pboost to the z axis and then use @@ -2789,27 +3168,64 @@ def boost_to_restframe(self, pboost): return out - # write pboost as (E, p cosT sinF, p sinT sinF, p cosF) - # rotation such that it become (E, 0 , 0 , p ) is - # cosT sinF , -sinT , cosT sinF - # sinT cosF , cosT , sinT sinF - # -sinT , 0 , cosF - p = math.sqrt( pboost.px**2 + pboost.py**2+ pboost.pz**2) - cosF = pboost.pz / p - sinF = math.sqrt(1-cosF**2) - sinT = pboost.py/p/sinF - cosT = pboost.px/p/sinF - - out=FourMomentum([self.E, - self.px*cosT*cosF + self.py*sinT*cosF-self.pz*sinF, - -self.px*sinT+ self.py*cosT, - self.px*cosT*sinF + self.py*sinT*sinF + self.pz*cosF - ]) - out = out.zboost(E=pboost.E,pz=p) + # see here https://physics.stackexchange.com/questions/749036/general-lorentz-boost-of-four-momentum-in-cm-frame-particle-physics + vx = pboost.px/pboost.E + vy = pboost.py/pboost.E + vz = pboost.pz/pboost.E + v = pboost.norm/pboost.E + v2 = pboost.norm_sq/pboost.E**2 + gamma = 1./math.sqrt(1.-v**2) + gammo = gamma-1. + out = FourMomentum(E = gamma*(self.E - vx*self.px - vy*self.py - vz*self.pz), + px= -gamma*vx*self.E + (1+gammo*vx**2/v2)*self.px + gammo*vx*vy/v2*self.py + gammo*vx*vz/v2*self.pz, + py= -gamma*vy*self.E + gammo*vy*vx/v2*self.px + (1+gammo*vy**2/v2)*self.py + gammo*vy*vz/v2*self.pz, + pz= -gamma*vz*self.E + gammo*vz*vx/v2*self.px + gammo*vz*vy/v2*self.py + (1+gammo*vz**2/v2)*self.pz) + return out + def rotate_to_z(self,prot): + + import math + import numpy as np + + z = np.array([0.,0.,1.]) + + px = self.px + py = self.py + pz = self.pz + + refx = prot.px + refy = prot.py + refz = prot.pz + + prot_mom = np.array([px, py, pz]) + ref_mom = np.array([refx, refy, refz]) + + # Create normal vector + n = np.array([refy, -refx, 0.]) + n = n * 1./math.sqrt(self.threedot(n,n)) + t = prot_mom - self.threedot(n,prot_mom)*n + p = ref_mom - self.threedot(ref_mom,z)*z + p = p/math.sqrt(self.threedot(p,p)) + + t_pz = np.array([self.threedot(t,p), self.threedot(t,z), 0.]) + costheta = self.threedot(ref_mom,z)* 1./math.sqrt(self.threedot(ref_mom, ref_mom)) + sintheta=math.sqrt(1.-costheta**2) + + sgn = 1. + t_pz_p = np.array([0., 0., 0.]) + t_pz_p[0] = costheta*t_pz[0] + sgn*(-sintheta) * t_pz[1] + t_pz_p[1] = sgn*sintheta*t_pz[0] + costheta * t_pz[1] + + out_mom = self.threedot(n,prot_mom)*n + t_pz_p[0]*p + t_pz_p[1]*z + + out = FourMomentum([self.E,out_mom[0], out_mom[1], out_mom[2] ] ) + + return out - + def threedot(self,a,b): + + return a[0]*b[0]+a[1]*b[1]+a[2]*b[2] class OneNLOWeight(object): diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/madevent_interface.py b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/madevent_interface.py index 2a118e21bf..8e30cf690c 100755 --- a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/madevent_interface.py +++ b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/madevent_interface.py @@ -496,7 +496,6 @@ def help_remove(self): logger.info(" the optional '-f' allows to by-pass all security question") logger.info(" The banner can be remove only if all files are removed first.") - class AskRun(cmd.ControlSwitch): """a class for the question on what to do on a madevent run""" @@ -2393,13 +2392,17 @@ def do_generate_events(self, line): # Check argument's validity mode = self.check_generate_events(args) switch_mode = self.ask_run_configuration(mode, args) - if not args: - # No run name assigned -> assigned one automaticaly - self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton') - else: - self.set_run_name(args[0], None, 'parton', True) - args.pop(0) - + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat'), consistency=False) + if not run_card.scan_set: + if not args: + # No run name assigned -> assigned one automaticaly + self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton') + else: + self.set_run_name(args[0], None, 'parton', True) + args.pop(0) + + self.run_generate_events(switch_mode, args) self.postprocessing() @@ -2560,7 +2563,7 @@ def wait_monitoring(Idle, Running, Done): self.update_status("postprocessing contur done", level="rivet") # this decorator handle the loop related to scan. - @common_run.scanparamcardhandling() + @common_run.scanparamcardhandling(run_card_scan=True) def run_generate_events(self, switch_mode, args): if self.proc_characteristics['loop_induced'] and self.options['run_mode']==0: @@ -2593,7 +2596,6 @@ def run_generate_events(self, switch_mode, args): # Regular run mode logger.info('Generating %s events with run name %s' % (self.run_card['nevents'], self.run_name)) - self.exec_cmd('survey %s %s' % (self.run_name,' '.join(args)), postcmd=False) nb_event = self.run_card['nevents'] @@ -2975,7 +2977,7 @@ def update_width_in_param_card(decay_info, initial=None, output=None): particle = 0 # Read BRs for this decay line = param_card[line_number] - while re.search('^(#|\s|\d)', line): + while re.search(r'^(#|\s|\d)', line): line = param_card.pop(line_number) if not particle or line.startswith('#'): line=param_card[line_number] @@ -3226,7 +3228,7 @@ def do_treatcards(self, line, mode=None, opt=None): for line in open(pjoin(bias_module_path,'%s.f'%os.path.basename(bias_module_path))): if start and last: break - if not start and not re.search('c\s*parameters\s*=\s*{',line, re.I): + if not start and not re.search(r'c\s*parameters\s*=\s*{',line, re.I): continue start = True if not line.startswith('C'): @@ -3235,7 +3237,7 @@ def do_treatcards(self, line, mode=None, opt=None): if '{' in line: line = line.split('{')[-1] # split for } ! # - split_result = re.split('(\}|!|\#)', line,1, re.M) + split_result = re.split(r'(\}|!|\#)', line,1, re.M) line = split_result[0] sep = split_result[1] if len(split_result)>1 else None if sep == '}': @@ -3514,8 +3516,8 @@ def pass_in_difficult_integration_mode(self, rate=1): text = open(conf_path).read() min_evt, max_evt = 2500 *(2+rate), 10000*(rate+1) - text = re.sub('''\(min_events = \d+\)''', '(min_events = %i )' % min_evt, text) - text = re.sub('''\(max_events = \d+\)''', '(max_events = %i )' % max_evt, text) + text = re.sub(r'''\(min_events = \d+\)''', '(min_events = %i )' % min_evt, text) + text = re.sub(r'''\(max_events = \d+\)''', '(max_events = %i )' % max_evt, text) fsock = open(conf_path, 'w') fsock.write(text) fsock.close() @@ -3619,7 +3621,7 @@ def do_refine(self, line): alljobs = misc.glob('ajob*', Pdir) #remove associated results.dat (ensure to not mix with all data) - Gre = re.compile("\s*j=(G[\d\.\w]+)") + Gre = re.compile(r"\s*j=(G[\d\.\w]+)") for job in alljobs: Gdirs = Gre.findall(open(job).read()) for Gdir in Gdirs: @@ -3727,58 +3729,126 @@ def do_combine_events(self, line): sum_xsec, sum_xerru, sum_axsec = 0,[],0 Gdirs = self.get_Gdir() Gdirs.sort() - for Gdir in Gdirs: - if os.path.exists(pjoin(Gdir, 'events.lhe')): - result = sum_html.OneResult('') - result.read_results(pjoin(Gdir, 'results.dat')) - sum_xsec += result.get('xsec') - sum_xerru.append(result.get('xerru')) - sum_axsec += result.get('axsec') - - if self.run_card['gridpack'] or self.run_card['nevents']==0: - os.remove(pjoin(Gdir, 'events.lhe')) - continue + partials_info = [] + try: + p = subprocess.Popen(["ulimit", "-n"], stdout=subprocess.PIPE) + out, err = p.communicate() + max_G = out.decode() + if max_G == "unlimited": + max_G =2500 + else: + max_G = int(max_G) - 40 + except Exception as error: + logger.debug(error) + max_G = 80 # max(20, len(Gdirs)/self.options['nb_core']) - AllEvent.add(pjoin(Gdir, 'events.lhe'), - result.get('xsec'), - result.get('xerru'), - result.get('axsec') - ) - - if len(AllEvent) >= 80: #perform a partial unweighting - AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % partials), - get_wgt, log_level=5, trunc_error=1e-2, event_target=self.run_card['nevents']) - AllEvent = lhe_parser.MultiEventFile() - AllEvent.banner = self.banner - AllEvent.add(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % partials), - sum_xsec, - math.sqrt(sum(x**2 for x in sum_xerru)), - sum_axsec) - partials +=1 - if not hasattr(self,'proc_characteristic'): self.proc_characteristic = self.get_characteristics() - if len(AllEvent) == 0: - nb_event = 0 - else: + mycluster = cluster.MultiCore(nb_core=self.options['nb_core']) + + def split(a, n): + """split a list "a" into n chunk of same size (or nearly same size)""" + k, m = divmod(len(a), n) + return (a[i*k+min(i, m):(i+1)*k+min(i+1, m)] for i in range(n)) + + partials_info = [] + if len(Gdirs) >= max_G: + start_unweight= time.perf_counter() + # first check in how many chunk we have to split (always use a multiple of nb_core) + nb_split = 1 + nb_G = len(Gdirs) // (2* self.options['nb_core']) + while nb_G > min(80, max_G): + nb_split += 1 + nb_G = len(Gdirs)//(nb_split*2*self.options['nb_core']) + if nb_G < 10: + nb_split -=1 + nb_G = len(Gdirs)//(nb_split*2*self.options['nb_core']) + + #enforce at least 10 directory per thread + if nb_G > 10 or nb_split>1: + # do the unweighting of each chunk on their own thread + nb_chunk = (nb_split*2*self.options['nb_core']) + else: + nb_chunk = len(Gdirs) // 10 + nb_G =10 + + # security that the number of combine events is too large + if nb_chunk >= max_G: + nb_chunk = max_G -1 + nb_G = len(Gdirs) // nb_chunk + + for i, local_G in enumerate(split(Gdirs, nb_chunk)): + line = [pjoin(self.me_dir, "Events", self.run_name, "partials%d.lhe.gz" % i)] + line.append(pjoin(self.me_dir, 'Events', self.run_name, '%s_%s_banner.txt' % (self.run_name, tag))) + line.append(str(self.results.current['cross'])) + line += local_G + partials_info.append(self.do_combine_events_partial(' '.join(line), preprocess_only=True)) + mycluster.submit(sys.executable, + [pjoin(self.me_dir, 'bin', 'internal', 'madevent_interface.py'), 'combine_events_partial'] + line, + stdout='/dev/null' + ) + + starttime = time.time() + update_status = lambda idle, run, finish: \ + self.update_status((idle, run, finish, 'unweight'), level=None, + force=False, starttime=starttime) + mycluster.wait(self.me_dir, update_status) + # do the final combination + for data in partials_info: + AllEvent.add(*data) + + start_unweight= time.perf_counter() nb_event = AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "unweighted_events.lhe.gz"), get_wgt, trunc_error=1e-2, event_target=self.run_card['nevents'], log_level=logging.DEBUG, normalization=self.run_card['event_norm'], proc_charac=self.proc_characteristic) + + #cleaning + for data in partials_info: + path = data[0] + try: + os.remove(path) + except Exception as error: + try: + os.remove(path[:-3]) # try without the .gz + except: + misc.sprint('no file ', path, 'to clean') + else: + for Gdir in Gdirs: + if os.path.exists(pjoin(Gdir, 'events.lhe')): + result = sum_html.OneResult('') + result.read_results(pjoin(Gdir, 'results.dat')) + sum_xsec += result.get('xsec') + sum_xerru.append(result.get('xerru')) + sum_axsec += result.get('axsec') + + if self.run_card['gridpack'] or self.run_card['nevents']==0: + os.remove(pjoin(Gdir, 'events.lhe')) + continue + + AllEvent.add(pjoin(Gdir, 'events.lhe'), + result.get('xsec'), + result.get('xerru'), + result.get('axsec') + ) + + if len(AllEvent) == 0: + nb_event = 0 + else: + nb_event = AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "unweighted_events.lhe.gz"), + get_wgt, trunc_error=1e-2, event_target=self.run_card['nevents'], + log_level=logging.DEBUG, normalization=self.run_card['event_norm'], + proc_charac=self.proc_characteristic) + + if nb_event < self.run_card['nevents']: + logger.warning("failed to generate enough events. Please follow one of the following suggestions to fix the issue:") + logger.warning(" - set in the run_card.dat 'sde_strategy' to %s", 1 + self.run_card['sde_strategy'] % 2) + logger.warning(" - set in the run_card.dat 'hard_survey' to 1 or 2.") + logger.warning(" - reduce the number of requested events (if set too high)") + logger.warning(" - check that you do not have -integrable- singularity in your amplitude.") + logger.warning(" - regenerate your process directory by selecting another gauge (in particular try FD gauge).") - if nb_event < self.run_card['nevents']: - logger.warning("failed to generate enough events. Please follow one of the following suggestions to fix the issue:") - logger.warning(" - set in the run_card.dat 'sde_strategy' to %s", 1 + self.run_card['sde_strategy'] % 2) - logger.warning(" - set in the run_card.dat 'hard_survey' to 1 or 2.") - logger.warning(" - reduce the number of requested events (if set too high)") - logger.warning(" - check that you do not have -integrable- singularity in your amplitude.") - if partials: - for i in range(partials): - try: - os.remove(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % i)) - except Exception: - os.remove(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe" % i)) self.results.add_detail('nb_event', nb_event) @@ -3789,7 +3859,50 @@ def do_combine_events(self, line): logger.info("combination of events done in %s s ", time.time()-start) self.to_store.append('event') + + ############################################################################ + def do_combine_events_partial(self, line, preprocess_only=False): + """ """ + + AllEvent = lhe_parser.MultiEventFile() + + sum_xsec, sum_xerru, sum_axsec = 0,[],0 + output, banner_path,cross = line.split()[:3] + Gdirs = line.split()[3:] + + cross = float(cross) + if not self.banner: + self.banner = banner_mod.Banner(banner_path) + if not hasattr(self, 'run_card'): + self.run_card = banner_mod.RunCard(self.banner['mgruncard']) + AllEvent.banner = self.banner + + for Gdir in Gdirs: + if os.path.exists(pjoin(Gdir, 'events.lhe')): + result = sum_html.OneResult('') + result.read_results(pjoin(Gdir, 'results.dat')) + sum_xsec += result.get('xsec') + sum_xerru.append(result.get('xerru')) + sum_axsec += result.get('axsec') + + if self.run_card['gridpack'] or self.run_card['nevents']==0: + os.remove(pjoin(Gdir, 'events.lhe')) + continue + if not preprocess_only: + AllEvent.add(pjoin(Gdir, 'events.lhe'), + result.get('xsec'), + result.get('xerru'), + result.get('axsec') + ) + if preprocess_only: + return output, sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), sum_axsec + nb_event = max(min(abs(1.01*self.run_card['nevents']*sum_axsec/cross),self.run_card['nevents']), 10) + get_wgt = lambda event: event.wgt + AllEvent.unweight(output, + get_wgt, log_level=5, trunc_error=1e-2, event_target=nb_event) + return output, sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), sum_axsec + ############################################################################ def correct_bias(self): """check the first event and correct the weight by the bias @@ -3902,13 +4015,19 @@ def do_store_events(self, line): #except Exception: # continue # Store log - try: - if os.path.exists(pjoin(G_path, 'log.txt')): - input = pjoin(G_path, 'log.txt') + input = pjoin(G_path, 'log.txt') + if os.path.exists(input): + if self.run_card['keep_log'] not in ["none", "minimal"]: output = pjoin(G_path, '%s_log.txt' % run) - files.mv(input, output) - except Exception: - continue + try: + files.mv(input, output) + except Exception: + continue + elif self.run_card['keep_log'] == "none": + try: + os.remove(input) + except Exception: + continue #try: # # Grid # for name in ['ftn26']: @@ -3989,7 +4108,7 @@ def do_create_gridpack(self, line): misc.call(['./bin/internal/make_gridpack'], cwd=self.me_dir) files.mv(pjoin(self.me_dir, 'gridpack.tar.gz'), pjoin(self.me_dir, '%s_gridpack.tar.gz' % self.run_name)) - os.system("sed -i.bak \"s/\s*.true.*=.*GridRun/ .false. = GridRun/g\" %s/Cards/grid_card.dat" \ + os.system("sed -i.bak \"s/\\s*.true.*=.*GridRun/ .false. = GridRun/g\" %s/Cards/grid_card.dat" \ % self.me_dir) self.update_status('gridpack created', level='gridpack') @@ -4476,7 +4595,7 @@ def do_pythia8(self, line): else: preamble = misc.get_HEPTools_location_setter( pjoin(MG5DIR,'HEPTools'),'lib') - preamble += "\n unset PYTHIA8DATA\n" + #preamble += "\n unset PYTHIA8DATA\n" open(pythia_cmd_card,'w').write("""! ! It is possible to run this card manually with: @@ -4691,7 +4810,7 @@ def do_pythia8(self, line): # Make sure to sure the number of split_events determined during the splitting. split_PY8_Card.systemSet('Main:numberOfEvents',partition_for_PY8[i]) split_PY8_Card.systemSet('HEPMCoutput:scaling',split_PY8_Card['HEPMCoutput:scaling']* - (float(partition_for_PY8[i])/float(n_events))) + (float(partition_for_PY8[i]))) # Add_missing set to False so as to be sure not to add any additional parameter w.r.t # the ones in the original PY8 param_card copied. split_PY8_Card.write(pjoin(parallelization_dir,'PY8Card_%d.dat'%i), @@ -4963,9 +5082,9 @@ def wait_monitoring(Idle, Running, Done): if cross_sections: # Filter the cross_sections specified an keep only the ones # with central parameters and a different merging scale - a_float_re = '[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' + a_float_re = r'[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' central_merging_re = re.compile( - '^\s*Weight_MERGING\s*=\s*(?P%s)\s*$'%a_float_re, + r'^\s*Weight_MERGING\s*=\s*(?P%s)\s*$'%a_float_re, re.IGNORECASE) cross_sections = dict( (float(central_merging_re.match(xsec).group('merging')),value) @@ -5016,8 +5135,8 @@ def wait_monitoring(Idle, Running, Done): def parse_PY8_log_file(self, log_file_path): """ Parse a log file to extract number of event and cross-section. """ - pythiare = re.compile("Les Houches User Process\(es\)\s*\d+\s*\|\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)\s*\|\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") - pythia_xsec_re = re.compile("Inclusive cross section\s*:\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") + pythiare = re.compile(r"Les Houches User Process\(es\)\s*\d+\s*\|\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)\s*\|\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") + pythia_xsec_re = re.compile(r"Inclusive cross section\s*:\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") sigma_m, Nacc, Ntry = None, None, None for line in misc.BackRead(log_file_path): info = pythiare.search(line) @@ -5158,7 +5277,7 @@ def do_pythia(self, line): # read the line from the bottom of the file #pythia_log = misc.BackRead(pjoin(self.me_dir,'Events', self.run_name, # '%s_pythia.log' % tag)) - pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") + pythiare = re.compile(r"\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") for line in misc.reverse_readline(pjoin(self.me_dir,'Events', self.run_name, '%s_pythia.log' % tag)): info = pythiare.search(line) @@ -5619,8 +5738,8 @@ def launch_job(self,exe, cwd=None, stdout=None, argument = [], remaining=0, input_files.append(self.get_pdf_input_filename()) #Find the correct ajob - Gre = re.compile("\s*j=(G[\d\.\w]+)") - origre = re.compile("grid_directory=(G[\d\.\w]+)") + Gre = re.compile(r"\s*j=(G[\d\.\w]+)") + origre = re.compile(r"grid_directory=(G[\d\.\w]+)") try : fsock = open(exe) except Exception: @@ -5628,7 +5747,7 @@ def launch_job(self,exe, cwd=None, stdout=None, argument = [], remaining=0, text = fsock.read() output_files = Gre.findall(text) if not output_files: - Ire = re.compile("for i in ([\d\.\s]*) ; do") + Ire = re.compile(r"for i in ([\d\.\s]*) ; do") data = Ire.findall(text) data = ' '.join(data).split() for nb in data: @@ -6035,7 +6154,7 @@ def get_last_tag(self, level): 'syscalc':[], 'rivet':['rivet']} - if name == self.run_name: + if name and name == self.run_name: if reload_card: run_card = pjoin(self.me_dir, 'Cards','run_card.dat') self.run_card = banner_mod.RunCard(run_card) @@ -6334,7 +6453,7 @@ def run_syscalc(self, mode='parton', event_path=None, output=None): elif mode == 'Pythia': stdout = open(pjoin(event_dir, self.run_name, '%s_%s_syscalc.log' % (tag,mode)),'w') if 'mgpythiacard' in self.banner: - pat = re.compile('''^\s*qcut\s*=\s*([\+\-\d.e]*)''', re.M+re.I) + pat = re.compile(r'''^\s*qcut\s*=\s*([\+\-\d.e]*)''', re.M+re.I) data = pat.search(self.banner['mgpythiacard']) if data: qcut = float(data.group(1)) @@ -6611,7 +6730,7 @@ def get_subP_ids(path): for line in open(pjoin(path, 'leshouche.inc')): if not 'IDUP' in line: continue - particles = re.search("/([\d,-]+)/", line) + particles = re.search(r"/([\d,-]+)/", line) all_ids.append([int(p) for p in particles.group(1).split(',')]) return all_ids @@ -6899,6 +7018,7 @@ def do_combine_events(self, line): partials = 0 # if too many file make some partial unweighting sum_xsec, sum_xerru, sum_axsec = 0,[],0 + partials_info = [] Gdirs = self.get_Gdir() Gdirs.sort() for Gdir in Gdirs: @@ -6917,16 +7037,21 @@ def do_combine_events(self, line): sum_axsec += result.get('axsec')*gscalefact[Gdir] if len(AllEvent) >= 80: #perform a partial unweighting + nb_event = min(abs(1.01*self.nb_event*sum_axsec/self.results.current['cross']),self.run_card['nevents']) AllEvent.unweight(pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), - get_wgt, log_level=5, trunc_error=1e-2, event_target=self.nb_event) + get_wgt, log_level=5, trunc_error=1e-2, event_target=nb_event) AllEvent = lhe_parser.MultiEventFile() AllEvent.banner = self.banner - AllEvent.add(pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), + partials_info.append((pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), - sum_axsec) + sum_axsec) ) + sum_xsec, sum_xerru, sum_axsec = 0,[],0 partials +=1 + for data in partials_info: + AllEvent.add(*data) + if not hasattr(self,'proc_characteristic'): self.proc_characteristic = self.get_characteristics() diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/misc.py b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/misc.py index c4c669f36b..e7fd60be0d 100755 --- a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/misc.py +++ b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/misc.py @@ -67,7 +67,7 @@ def parse_info_str(fsock): """ info_dict = {} - pattern = re.compile("(?P\w*)\s*=\s*(?P.*)", + pattern = re.compile(r"(?P\w*)\s*=\s*(?P.*)", re.IGNORECASE | re.VERBOSE) for entry in fsock: entry = entry.strip() @@ -84,7 +84,7 @@ def parse_info_str(fsock): def glob(name, path=''): """call to glob.glob with automatic security on path""" import glob as glob_module - path = re.sub('(?P\?|\*|\[|\])', '[\g]', path) + path = re.sub(r'(?P\?|\*|\[|\])', r'[\g]', path) return glob_module.glob(pjoin(path, name)) #=============================================================================== @@ -614,10 +614,10 @@ def mod_compilator(directory, new='gfortran', current=None, compiler_type='gfort #search file file_to_change=find_makefile_in_dir(directory) if compiler_type == 'gfortran': - comp_re = re.compile('^(\s*)FC\s*=\s*(.+)\s*$') + comp_re = re.compile(r'^(\s*)FC\s*=\s*(.+)\s*$') var = 'FC' elif compiler_type == 'cpp': - comp_re = re.compile('^(\s*)CXX\s*=\s*(.+)\s*$') + comp_re = re.compile(r'^(\s*)CXX\s*=\s*(.+)\s*$') var = 'CXX' else: MadGraph5Error, 'Unknown compiler type: %s' % compiler_type @@ -861,9 +861,9 @@ def detect_current_compiler(path, compiler_type='fortran'): # comp = re.compile("^\s*FC\s*=\s*(\w+)\s*") # The regular expression below allows for compiler definition with absolute path if compiler_type == 'fortran': - comp = re.compile("^\s*FC\s*=\s*([\w\/\\.\-]+)\s*") + comp = re.compile("^\\s*FC\\s*=\\s*([\\w\\/\\.\\-]+)\\s*") elif compiler_type == 'cpp': - comp = re.compile("^\s*CXX\s*=\s*([\w\/\\.\-]+)\s*") + comp = re.compile("^\\s*CXX\\s*=\\s*([\\w\\/\\.\\-]+)\\s*") else: MadGraph5Error, 'Unknown compiler type: %s' % compiler_type @@ -1001,7 +1001,19 @@ def call_stdout(arg, *args, **opt): def copytree(src, dst, symlinks = False, ignore = None): if not os.path.exists(dst): os.makedirs(dst) - shutil.copystat(src, dst) + try: + shutil.copystat(src, dst) + except PermissionError: + if os.path.realpath(src).startswith('/cvmfs') and os.path.realpath(dst).startswith('/afs'): + # allowing missmatch from cvmfs to afs since sounds to not create issue --at least in general-- + logger.critical(f'Ignoring that we could not copy permissions from {src} to {dst}') + else: + logger.critical(f'Permission error detected from {src} to {dst}.\n'+\ + 'If you are using WSL with windows partition, please try using python3.12\n'+\ + 'or avoid moving your data from the WSL partition to the UNIX one') + # we do not have enough experience in WSL to allow it to get trough. + raise + lst = os.listdir(src) if ignore: excl = ignore(src, lst) @@ -1895,12 +1907,12 @@ class EasterEgg(object): May4_banner = "* _____ *\n" + \ "* ,-~\" \"~-. *\n" + \ "* * ,^ ___ ^. * *\n" + \ - "* * / .^ ^. \ * *\n" + \ + "* * / .^ ^. \\ * *\n" + \ "* * Y l o ! Y * *\n" + \ "* * l_ `.___.' _,[ * *\n" + \ "* * |^~\"--------------~\"\"^| * *\n" + \ "* * ! May the 4th ! * *\n" + \ - "* * \ / * *\n" + \ + "* * \\ / * *\n" + \ "* * ^. .^ * *\n" + \ "* * \"-.._____.,-\" * *\n" @@ -1909,13 +1921,13 @@ class EasterEgg(object): "* M::::::::::M M::::::::::M *\n" + \ "* M:::::::::::M M:::::::::::M (_)___ *\n" + \ "* M:::::::M::::M M::::M:::::::M | / __| *\n" + \ - "* M::::::M M::::M M::::M M::::::M | \__ \ *\n" + \ + "* M::::::M M::::M M::::M M::::::M | \\__ \\ *\n" + \ "* M::::::M M::::M::::M M::::::M |_|___/ *\n" + \ "* M::::::M M:::::::M M::::::M *\n" + \ "* M::::::M M:::::M M::::::M / _| ___ _ __ *\n" + \ - "* M::::::M MMMMM M::::::M | |_ / _ \| '__| *\n" + \ + "* M::::::M MMMMM M::::::M | |_ / _ \\| '__| *\n" + \ "* M::::::M M::::::M | _| (_) | | *\n" + \ - "* M::::::M M::::::M |_/\/\___/|_| *\n" + \ + "* M::::::M M::::::M |_/\\/\\___/|_| *\n" + \ "* M::::::M M::::::M *\n" + \ "* MMMMMMMM MMMMMMMM *\n" + \ "* *\n" + \ @@ -2233,39 +2245,51 @@ def import_python_lhapdf(lhapdfconfig): os.environ['LD_LIBRARY_PATH'] = lhapdf_libdir else: os.environ['LD_LIBRARY_PATH'] = '%s:%s' %(lhapdf_libdir,os.environ['LD_LIBRARY_PATH']) - try: candidates=[dirname for dirname in os.listdir(lhapdf_libdir) \ if os.path.isdir(os.path.join(lhapdf_libdir,dirname))] except OSError: candidates=[] + if os.path.isdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')): + candidates += [pjoin(os.pardir,'local', 'lib', dirname) for dirname in os.listdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')) + if os.path.isdir(os.path.join(lhapdf_libdir,os.pardir, 'local', 'lib', dirname))] for candidate in candidates: - if os.path.isdir(os.path.join(lhapdf_libdir,candidate,'site-packages')): - sys.path.insert(0,os.path.join(lhapdf_libdir,candidate,'site-packages')) - try: - import lhapdf - use_lhapdf=True - break - except ImportError: - sys.path.pop(0) - continue + for subdir in ['site-packages', 'dist-packages']: + if os.path.isdir(os.path.join(lhapdf_libdir,candidate, subdir)): + sys.path.insert(0,os.path.join(lhapdf_libdir,candidate, subdir)) + try: + import lhapdf + use_lhapdf=True + break + except ImportError as error: + sys.path.pop(0) + continue + else: + continue + break if not use_lhapdf: try: candidates=[dirname for dirname in os.listdir(lhapdf_libdir+'64') \ if os.path.isdir(os.path.join(lhapdf_libdir+'64',dirname))] except OSError: candidates=[] - + if os.path.isdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib64')): + candidates += [pjoin(os.pardir,'local', 'lib64', dirname) for dirname in os.listdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')) + if os.path.isdir(os.path.join(lhapdf_libdir,os.pardir, 'local', 'lib64', dirname))] for candidate in candidates: - if os.path.isdir(os.path.join(lhapdf_libdir+'64',candidate,'site-packages')): - sys.path.insert(0,os.path.join(lhapdf_libdir+'64',candidate,'site-packages')) - try: - import lhapdf - use_lhapdf=True - break - except ImportError: - sys.path.pop(0) - continue + for subdir in ['site-packages', 'dist-packages']: + if os.path.isdir(os.path.join(lhapdf_libdir+'64',candidate, subdir)): + sys.path.insert(0,os.path.join(lhapdf_libdir+'64',candidate, subdir)) + try: + import lhapdf + use_lhapdf=True + break + except ImportError as error: + sys.path.pop(0) + continue + else: + continue + break if not use_lhapdf: try: import lhapdf diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/shower_card.py b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/shower_card.py index e87d534177..16ed72b1a0 100755 --- a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/shower_card.py +++ b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/shower_card.py @@ -288,7 +288,7 @@ def write(self, output_file, template=None, python_template=False, self.text = open(template,'r').read() - key_re = re.compile('^(\s*)([\S^#]+)(\s*)=(\s*)([^#]*?)(\s*)(\#.*|$)') + key_re = re.compile(r'^(\s*)([\S^#]+)(\s*)=(\s*)([^#]*?)(\s*)(\#.*|$)') newlines = [] for line in self.text.split('\n'): key_match = key_re.findall(line) diff --git a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/systematics.py b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/systematics.py index 28eaed00e2..2acebd087c 100644 --- a/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/systematics.py +++ b/epochX/cudacpp/susy_gg_t1t1.mad/bin/internal/systematics.py @@ -582,7 +582,7 @@ def print_cross_sections(self, all_cross, nb_event, stdout): else: resume.write( '#PDF %s: %g +%2.3g%% -%2.3g%%\n' % (pdfset.name, pdferr.central,pdferr.errplus*100/all_cross[0], pdferr.errminus*100/all_cross[0])) - dyn_name = {1: '\sum ET', 2:'\sum\sqrt{m^2+pt^2}', 3:'0.5 \sum\sqrt{m^2+pt^2}',4:'\sqrt{\hat s}' } + dyn_name = {1: r'\sum ET', 2:r'\sum\sqrt{m^2+pt^2}', 3:r'0.5 \sum\sqrt{m^2+pt^2}',4:r'\sqrt{\hat s}' } for key, curr in dyns.items(): if key ==-1: continue @@ -789,7 +789,7 @@ def get_id(self): return int(self.start_wgt_id) if 'initrwgt' in self.banner: - pattern = re.compile(' set lhapdf /PATH/TO/lhapdf-config -None does not seem to correspond to a valid lhapdf-config executable. -Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config). -Note that you can still compile and run aMC@NLO with the built-in PDFs - MG5_aMC> set lhapdf /PATH/TO/lhapdf-config - Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt -import /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1.mg +import /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1.mg The import format was not given, so we guess it as command set stdout_level DEBUG set output information to level: 10 @@ -554,17 +549,16 @@ INFO: Please specify coupling orders to bypass this step. INFO: Trying coupling order WEIGHTED<=2: WEIGTHED IS QCD+2*QED INFO: Trying process: g g > t1 t1~ WEIGHTED<=2 @1 INFO: Process has 6 diagrams -1 processes with 6 diagrams generated in 0.123 s +1 processes with 6 diagrams generated in 0.133 s Total: 1 processes with 6 diagrams output standalone_cudacpp ../TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1 Load PLUGIN.CUDACPP_OUTPUT -Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.5.3_lo_vect. +Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.6.0_lo_vect. It has been validated for the last time with version: 3.5.2 Output will be done with PLUGIN: CUDACPP_OUTPUT -DEBUG: cformat =  plugin [export_cpp.py at line 3070]  DEBUG: Entering PLUGIN_ProcessExporter.__init__ (initialise the exporter) [output.py at line 165]  DEBUG: Entering PLUGIN_ProcessExporter.copy_template (initialise the directory) [output.py at line 170]  -INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1 +INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1 INFO: Organizing processes into subprocess groups INFO: Generating Helas calls for process: g g > t1 t1~ WEIGHTED<=2 @1 INFO: Processing color information for process: g g > t1 t1~ @1 @@ -573,32 +567,32 @@ INFO: Processing color information for process: g g > t1 t1~ @1 DEBUG: type(fortran_model)= [output.py at line 214]  DEBUG: type(me)= me=0 [output.py at line 215]  DEBUG: "need to link", self.to_link_in_P =  need to link ['nvtx.h', 'timer.h', 'timermap.h', 'ompnumthreads.h', 'GpuRuntime.h', 'GpuAbstraction.h', 'MemoryAccessHelpers.h', 'MemoryAccessVectors.h', 'MemoryAccessMatrixElements.h', 'MemoryAccessMomenta.h', 'MemoryAccessRandomNumbers.h', 'MemoryAccessWeights.h', 'MemoryAccessAmplitudes.h', 'MemoryAccessWavefunctions.h', 'MemoryAccessGs.h', 'MemoryAccessCouplingsFixed.h', 'MemoryAccessNumerators.h', 'MemoryAccessDenominators.h', 'MemoryAccessChannelIds.h', 'EventStatistics.h', 'CommonRandomNumbers.h', 'CrossSectionKernels.cc', 'CrossSectionKernels.h', 'MatrixElementKernels.cc', 'MatrixElementKernels.h', 'RamboSamplingKernels.cc', 'RamboSamplingKernels.h', 'RandomNumberKernels.h', 'CommonRandomNumberKernel.cc', 'CurandRandomNumberKernel.cc', 'HiprandRandomNumberKernel.cc', 'Bridge.h', 'BridgeKernels.cc', 'BridgeKernels.h', 'fbridge.cc', 'fbridge.inc', 'fsampler.cc', 'fsampler.inc', 'MadgraphTest.h', 'runTest.cc', 'testmisc.cc', 'testxxx_cc_ref.txt', 'valgrind.h', 'cudacpp.mk', 'testxxx.cc', 'MemoryBuffers.h', 'MemoryAccessCouplings.h', 'perf.py', 'profile.sh'] [output.py at line 216]  -INFO: Creating files in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1/SubProcesses/P1_Sigma_MSSM_SLHA2_gg_t1t1x -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1/SubProcesses/P1_Sigma_MSSM_SLHA2_gg_t1t1x/./CPPProcess.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1/SubProcesses/P1_Sigma_MSSM_SLHA2_gg_t1t1x/./CPPProcess.cc -INFO: Created files CPPProcess.h and CPPProcess.cc in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1/SubProcesses/P1_Sigma_MSSM_SLHA2_gg_t1t1x/. +INFO: Creating files in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1/SubProcesses/P1_Sigma_MSSM_SLHA2_gg_t1t1x +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1/SubProcesses/P1_Sigma_MSSM_SLHA2_gg_t1t1x/./CPPProcess.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1/SubProcesses/P1_Sigma_MSSM_SLHA2_gg_t1t1x/./CPPProcess.cc +INFO: Created files CPPProcess.h and CPPProcess.cc in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1/SubProcesses/P1_Sigma_MSSM_SLHA2_gg_t1t1x/. Generated helas calls for 1 subprocesses (6 diagrams) in 0.008 s ALOHA: aloha starts to compute helicity amplitudes ALOHA: aloha creates VVV1 set of routines with options: P0 ALOHA: aloha creates VSS1 routines ALOHA: aloha creates VVSS1 routines -ALOHA: aloha creates 3 routines in 0.191 s +ALOHA: aloha creates 3 routines in 0.188 s VVV1 VSS1 VSS1 VSS1 VVSS1 -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1/src/./HelAmps_MSSM_SLHA2.h -INFO: Created file HelAmps_MSSM_SLHA2.h in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1/src/. +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1/src/./HelAmps_MSSM_SLHA2.h +INFO: Created file HelAmps_MSSM_SLHA2.h in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1/src/. super_write_set_parameters_onlyfixMajorana (hardcoded=False) super_write_set_parameters_onlyfixMajorana (hardcoded=True) -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1/src/./Parameters_MSSM_SLHA2.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1/src/./Parameters_MSSM_SLHA2.cc +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1/src/./Parameters_MSSM_SLHA2.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1/src/./Parameters_MSSM_SLHA2.cc INFO: Created files Parameters_MSSM_SLHA2.h and Parameters_MSSM_SLHA2.cc in directory -INFO: /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1/src/. and /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1/src/. +INFO: /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1/src/. and /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_t1t1/src/. quit -real 0m1.379s -user 0m1.276s -sys 0m0.064s -Code generation completed in 2 seconds +real 0m1.361s +user 0m1.285s +sys 0m0.066s +Code generation completed in 1 seconds diff --git a/epochX/cudacpp/susy_gg_tt.mad/CODEGEN_mad_susy_gg_tt_log.txt b/epochX/cudacpp/susy_gg_tt.mad/CODEGEN_mad_susy_gg_tt_log.txt index 186a6e657d..1bc4eab35c 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/CODEGEN_mad_susy_gg_tt_log.txt +++ b/epochX/cudacpp/susy_gg_tt.mad/CODEGEN_mad_susy_gg_tt_log.txt @@ -14,7 +14,7 @@ Running MG5 in debug mode * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect 2023-12-23 * +* VERSION 3.6.0_lo_vect 2024-06-17 * * * * WARNING: UNKNOWN DEVELOPMENT VERSION. * * WARNING: DO NOT USE FOR PRODUCTION * @@ -45,15 +45,10 @@ Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (inclu Note that you can still compile and run aMC@NLO with the built-in PDFs MG5_aMC> set lhapdf /PATH/TO/lhapdf-config -None does not seem to correspond to a valid lhapdf-config executable. -Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config). -Note that you can still compile and run aMC@NLO with the built-in PDFs - MG5_aMC> set lhapdf /PATH/TO/lhapdf-config - Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt -import /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt.mg +import /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt.mg The import format was not given, so we guess it as command set stdout_level DEBUG set output information to level: 10 @@ -554,24 +549,24 @@ INFO: Please specify coupling orders to bypass this step. INFO: Trying coupling order WEIGHTED<=2: WEIGTHED IS QCD+2*QED INFO: Trying process: g g > t t~ WEIGHTED<=2 @1 INFO: Process has 3 diagrams -1 processes with 3 diagrams generated in 0.119 s +1 processes with 3 diagrams generated in 0.122 s Total: 1 processes with 3 diagrams output madevent_simd ../TMPOUT/CODEGEN_mad_susy_gg_tt --hel_recycling=False --vector_size=32 Load PLUGIN.CUDACPP_OUTPUT -Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.5.3_lo_vect. +Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.6.0_lo_vect. It has been validated for the last time with version: 3.5.2 Output will be done with PLUGIN: CUDACPP_OUTPUT Addition matrix-element will be done with PLUGIN: CUDACPP_OUTPUT +DEBUG: opt['output_options']['vector_size'] =  32 [export_v4.py at line 4334]  Output will be done with PLUGIN: CUDACPP_OUTPUT -DEBUG: cformat =  standalone_simd [export_cpp.py at line 3070]  DEBUG: Entering PLUGIN_ProcessExporter.__init__ (initialise the exporter) [output.py at line 165]  INFO: initialize a new directory: CODEGEN_mad_susy_gg_tt INFO: remove old information in CODEGEN_mad_susy_gg_tt DEBUG: Entering PLUGIN_ProcessExporter.copy_template (initialise the directory) [output.py at line 170]  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt  -INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/Cards  -WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/SubProcesses  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt  +INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/Cards  +WARNING: File exists /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/SubProcesses  INFO: Organizing processes into subprocess groups INFO: Generating Helas calls for process: g g > t t~ WEIGHTED<=2 @1 INFO: Processing color information for process: g g > t t~ @1 @@ -581,18 +576,14 @@ INFO: Creating files in directory . FileWriter for ././CPPProcess.h FileWriter for ././CPPProcess.cc INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./. -DEBUG: proc_id =  1 [export_cpp.py at line 710]  -DEBUG: config_map =  [1, 2, 3] [export_cpp.py at line 711]  -DEBUG: subproc_number =  0 [export_cpp.py at line 712]  -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 -DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/SubProcesses/P1_gg_ttx [export_v4.py at line 6494]  DEBUG: len(subproc_diagrams_for_config) =  3 [model_handling.py at line 1523]  DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3} [model_handling.py at line 1547]  DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3} [model_handling.py at line 1548]  Generated helas calls for 1 subprocesses (3 diagrams) in 0.006 s -Wrote files for 10 helas calls in 0.086 s +Wrote files for 10 helas calls in 0.076 s +DEBUG: self.vector_size =  32 [export_v4.py at line 7023]  ALOHA: aloha starts to compute helicity amplitudes ALOHA: aloha creates VVV1 set of routines with options: P0 ALOHA: aloha creates FFV1 routines @@ -600,42 +591,45 @@ ALOHA: aloha creates 2 routines in 0.139 s ALOHA: aloha starts to compute helicity amplitudes ALOHA: aloha creates VVV1 set of routines with options: P0 ALOHA: aloha creates FFV1 routines -ALOHA: aloha creates 4 routines in 0.134 s +ALOHA: aloha creates 4 routines in 0.137 s VVV1 FFV1 FFV1 FFV1 -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/src/./HelAmps_MSSM_SLHA2.h -INFO: Created file HelAmps_MSSM_SLHA2.h in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/src/. +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/src/./HelAmps_MSSM_SLHA2.h +INFO: Created file HelAmps_MSSM_SLHA2.h in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/src/. super_write_set_parameters_onlyfixMajorana (hardcoded=False) super_write_set_parameters_onlyfixMajorana (hardcoded=True) -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/src/./Parameters_MSSM_SLHA2.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/src/./Parameters_MSSM_SLHA2.cc +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/src/./Parameters_MSSM_SLHA2.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/src/./Parameters_MSSM_SLHA2.cc INFO: Created files Parameters_MSSM_SLHA2.h and Parameters_MSSM_SLHA2.cc in directory -INFO: /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/src/. and /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/src/. +INFO: /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/src/. and /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/src/. The option zerowidth_tchannel is modified [True] but will not be written in the configuration files. If you want to make this value the default for future session, you can run 'save options --all' -save configuration file to /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/Cards/me5_configuration.txt +save configuration file to /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/Cards/me5_configuration.txt INFO: Use Fortran compiler gfortran INFO: Use c++ compiler g++ INFO: Generate jpeg diagrams INFO: Generate web pages -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common -patching file Source/genps.inc +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common patching file SubProcesses/makefile -DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/SubProcesses/P1_gg_ttx; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 +DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/SubProcesses/P1_gg_ttx; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuBis/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 patching file driver.f +Hunk #1 succeeded at 76 (offset 2 lines). +Hunk #2 succeeded at 280 (offset 8 lines). +Hunk #3 succeeded at 489 (offset 13 lines). patching file matrix1.f +Hunk #2 succeeded at 227 (offset 13 lines). DEBUG: p.returncode =  0 [output.py at line 258]  -Output to directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt done. +Output to directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt done. Type "launch" to generate events from this process, or see -/data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/README +/data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/README Run "open index.html" to see more information about this process. quit -real 0m3.067s -user 0m2.570s -sys 0m0.289s +real 0m2.945s +user 0m2.632s +sys 0m0.271s Code generation completed in 3 seconds ************************************************************ * * @@ -649,7 +643,7 @@ Code generation completed in 3 seconds * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect * +* VERSION 3.6.0_lo_vect * * * * The MadGraph5_aMC@NLO Development Team - Find us at * * https://server06.fynu.ucl.ac.be/projects/madgraph * @@ -657,9 +651,9 @@ Code generation completed in 3 seconds * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt @@ -679,7 +673,7 @@ launch in debug mode * * * * * * * * * * * * -* VERSION 3.5.3_lo_vect * +* VERSION 3.6.0_lo_vect * * * * The MadGraph5_aMC@NLO Development Team - Find us at * * https://server06.fynu.ucl.ac.be/projects/madgraph * @@ -687,9 +681,9 @@ launch in debug mode * Type 'help' for in-line help. * * * ************************************************************ -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/Cards/me5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo/input/mg5_configuration.txt -INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/Cards/me5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo/input/mg5_configuration.txt +INFO: load configuration from /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_mad_susy_gg_tt/Cards/me5_configuration.txt Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt diff --git a/epochX/cudacpp/susy_gg_tt.mad/Cards/me5_configuration.txt b/epochX/cudacpp/susy_gg_tt.mad/Cards/me5_configuration.txt index cdeedc7863..4f5079f78a 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/Cards/me5_configuration.txt +++ b/epochX/cudacpp/susy_gg_tt.mad/Cards/me5_configuration.txt @@ -116,6 +116,7 @@ # cluster_type = condor # cluster_queue = madgraph # cluster_size = 150 +# cluster_walltime = # time in minute for slurm and second for condor (not supported for other scheduller) #! Path to a node directory to avoid direct writing on the central disk #! Note that condor clusters avoid direct writing by default (therefore this @@ -234,7 +235,7 @@ # pineappl = pineappl -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo # MG5 MAIN DIRECTORY -#mg5_path = /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/mg5amcnlo +#mg5_path = /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/mg5amcnlo diff --git a/epochX/cudacpp/susy_gg_tt.mad/Cards/param_card.dat b/epochX/cudacpp/susy_gg_tt.mad/Cards/param_card.dat index 16c221de5e..ffa472ed77 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/Cards/param_card.dat +++ b/epochX/cudacpp/susy_gg_tt.mad/Cards/param_card.dat @@ -1,5 +1,5 @@ ###################################################################### -## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL #### +## PARAM_CARD AUTOMATICALLY GENERATED BY MG5 FOLLOWING UFO MODEL #### ###################################################################### ## ## ## Width set on Auto will be computed following the information ## diff --git a/epochX/cudacpp/susy_gg_tt.mad/Cards/param_card_default.dat b/epochX/cudacpp/susy_gg_tt.mad/Cards/param_card_default.dat index 16c221de5e..ffa472ed77 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/Cards/param_card_default.dat +++ b/epochX/cudacpp/susy_gg_tt.mad/Cards/param_card_default.dat @@ -1,5 +1,5 @@ ###################################################################### -## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL #### +## PARAM_CARD AUTOMATICALLY GENERATED BY MG5 FOLLOWING UFO MODEL #### ###################################################################### ## ## ## Width set on Auto will be computed following the information ## diff --git a/epochX/cudacpp/susy_gg_tt.mad/Cards/proc_card_mg5.dat b/epochX/cudacpp/susy_gg_tt.mad/Cards/proc_card_mg5.dat index 01ea0ac955..80008b5115 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/Cards/proc_card_mg5.dat +++ b/epochX/cudacpp/susy_gg_tt.mad/Cards/proc_card_mg5.dat @@ -8,7 +8,7 @@ #* * * * #* * #* * -#* VERSION 3.5.3_lo_vect 2023-12-23 * +#* VERSION 3.6.0_lo_vect 2024-06-17 * #* * #* WARNING: UNKNOWN DEVELOPMENT VERSION. * #* WARNING: DO NOT USE FOR PRODUCTION * diff --git a/epochX/cudacpp/susy_gg_tt.mad/Cards/reweight_card_default.dat b/epochX/cudacpp/susy_gg_tt.mad/Cards/reweight_card_default.dat index ace534ae02..5cc65fe095 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/Cards/reweight_card_default.dat +++ b/epochX/cudacpp/susy_gg_tt.mad/Cards/reweight_card_default.dat @@ -19,8 +19,16 @@ change mode NLO # Define type of Reweighting. For LO sample this command # has no effect since only "LO" mode is allowed. + +#uncomment if you do not want to overwrite the reweight file of Sudakov in rw_me +#change rwgt_dir /PATH_MG5_BRANCH/NAME_FOLDER + +#uncomment if you want to use Sudakov Reweight +#change include_sudakov True + launch + # SPECIFY A PATH OR USE THE SET COMMAND LIKE THIS: # set sminputs 1 130 # modify 1/alpha_EW diff --git a/epochX/cudacpp/susy_gg_tt.mad/Cards/run_card.dat b/epochX/cudacpp/susy_gg_tt.mad/Cards/run_card.dat index b58554b4f2..6b82577032 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/Cards/run_card.dat +++ b/epochX/cudacpp/susy_gg_tt.mad/Cards/run_card.dat @@ -157,6 +157,7 @@ systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++] ['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule + #*********************************************************************** # SIMD/GPU configuration for the CUDACPP plugin #************************************************************************ diff --git a/epochX/cudacpp/susy_gg_tt.mad/Cards/run_card_default.dat b/epochX/cudacpp/susy_gg_tt.mad/Cards/run_card_default.dat index 6c2c7854ca..99fa8681a6 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/Cards/run_card_default.dat +++ b/epochX/cudacpp/susy_gg_tt.mad/Cards/run_card_default.dat @@ -157,6 +157,7 @@ systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++] ['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule + #*********************************************************************** # SIMD/GPU configuration for the CUDACPP plugin #************************************************************************ diff --git a/epochX/cudacpp/susy_gg_tt.mad/MGMEVersion.txt b/epochX/cudacpp/susy_gg_tt.mad/MGMEVersion.txt index 9d3a5c0ba0..a806d3938c 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/MGMEVersion.txt +++ b/epochX/cudacpp/susy_gg_tt.mad/MGMEVersion.txt @@ -1 +1 @@ -3.5.3_lo_vect \ No newline at end of file +3.6.0_lo_vect \ No newline at end of file diff --git a/epochX/cudacpp/susy_gg_tt.mad/Source/DHELAS/aloha_functions.f b/epochX/cudacpp/susy_gg_tt.mad/Source/DHELAS/aloha_functions.f index 975725737f..47699fa614 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/Source/DHELAS/aloha_functions.f +++ b/epochX/cudacpp/susy_gg_tt.mad/Source/DHELAS/aloha_functions.f @@ -351,7 +351,7 @@ subroutine oxxxxx(p,fmass,nhel,nsf , fo) fo(6) = ip * sqm(abs(im)) else - pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2)) +c pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2)) sf(1) = dble(1+nsf+(1-nsf)*nh)*rHalf sf(2) = dble(1+nsf-(1-nsf)*nh)*rHalf omega(1) = dsqrt(p(0)+pp) @@ -2054,7 +2054,7 @@ subroutine CombineAmp(nb, ihels, iwfcts, W1, Wall, Amp) enddo return end - + subroutine CombineAmpS(nb, ihels, iwfcts, W1, Wall, Amp) integer nb ! size of the vectors diff --git a/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/couplings.f b/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/couplings.f index f3b620ab58..04d6bb5333 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/couplings.f +++ b/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/couplings.f @@ -10,18 +10,27 @@ SUBROUTINE COUP() PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + LOGICAL UPDATELOOP COMMON /TO_UPDATELOOP/UPDATELOOP INCLUDE 'input.inc' - INCLUDE '../vector.inc' + + INCLUDE 'coupl.inc' READLHA = .TRUE. INCLUDE 'intparam_definition.inc' CALL COUP1() + IF (UPDATELOOP) THEN + + CALL COUP2() + + ENDIF + C couplings needed to be evaluated points by points C - CALL COUP2(1) + CALL COUP3(1) RETURN END @@ -47,7 +56,11 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) INCLUDE '../maxparticles.inc' INCLUDE '../cuts.inc' + + INCLUDE '../vector.inc' + + INCLUDE '../run.inc' DOUBLE PRECISION ALPHAS @@ -65,7 +78,7 @@ SUBROUTINE UPDATE_AS_PARAM(VECID) couplings needed to be evaluated points by points C ALL_G(VECID) = G - CALL COUP2(VECID) + CALL COUP3(VECID) RETURN END @@ -80,7 +93,9 @@ SUBROUTINE UPDATE_AS_PARAM2(MU_R2,AS2 ,VECID) INTEGER VECID INCLUDE 'model_functions.inc' INCLUDE 'input.inc' + INCLUDE '../vector.inc' + INCLUDE 'coupl.inc' DOUBLE PRECISION MODEL_SCALE COMMON /MODEL_SCALE/MODEL_SCALE diff --git a/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/couplings1.f b/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/couplings1.f index e14f3a1770..72cfa0f6e4 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/couplings1.f +++ b/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/couplings1.f @@ -7,11 +7,12 @@ SUBROUTINE COUP1( ) IMPLICIT NONE INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' END diff --git a/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/couplings2.f b/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/couplings2.f index c75ecfcb60..30f3a04e3b 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/couplings2.f +++ b/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/couplings2.f @@ -2,18 +2,17 @@ c written by the UFO converter ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc - SUBROUTINE COUP2( VECID) + SUBROUTINE COUP2( ) IMPLICIT NONE - INTEGER VECID + INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' - GC_6(VECID) = -G - GC_51(VECID) = -(MDL_COMPLEXI*G*MDL_I51X11) END diff --git a/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/couplings3.f b/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/couplings3.f index 07e51607fb..4ec0057843 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/couplings3.f +++ b/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/couplings3.f @@ -7,12 +7,13 @@ SUBROUTINE COUP3( VECID) IMPLICIT NONE INTEGER VECID INCLUDE 'model_functions.inc' + INCLUDE '../vector.inc' + DOUBLE PRECISION PI, ZERO PARAMETER (PI=3.141592653589793D0) PARAMETER (ZERO=0D0) INCLUDE 'input.inc' - INCLUDE '../vector.inc' INCLUDE 'coupl.inc' GC_6(VECID) = -G GC_51(VECID) = -(MDL_COMPLEXI*G*MDL_I51X11) diff --git a/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/makefile b/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/makefile index 0b24445a53..5a5681d220 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/makefile +++ b/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/makefile @@ -3,7 +3,7 @@ # Makefile for model library # # ---------------------------------------------------------------------------- - +# template models/template_files/makefile_madevent # Check for ../make_opts ifeq ($(wildcard ../make_opts), ../make_opts) include ../make_opts diff --git a/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/makeinc.inc b/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/makeinc.inc index 6e2743eac1..4a9e1b2cc5 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/makeinc.inc +++ b/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/makeinc.inc @@ -2,4 +2,4 @@ # written by the UFO converter ############################################################################# -MODEL = couplings.o lha_read.o printout.o rw_para.o model_functions.o couplings1.o couplings2.o \ No newline at end of file +MODEL = couplings.o lha_read.o printout.o rw_para.o model_functions.o couplings1.o couplings2.o couplings3.o \ No newline at end of file diff --git a/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/printout.f b/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/printout.f index 18b8f35b08..3e195b03a2 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/printout.f +++ b/epochX/cudacpp/susy_gg_tt.mad/Source/MODEL/printout.f @@ -1,3 +1,7 @@ +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +c written by the UFO converter +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc + c************************************************************************ c** ** c** MadGraph/MadEvent Interface to FeynRules ** @@ -9,7 +13,7 @@ subroutine printout implicit none - include '../vector.inc' ! defines VECSIZE_MEMMAX + include '../vector.inc' ! VECSIZE_MEMMAX (needed by coupl.inc) include 'coupl.inc' ! needs VECSIZE_MEMMAX (defined in vector.inc) include 'input.inc' diff --git a/epochX/cudacpp/susy_gg_tt.mad/Source/PDF/eepdf.inc b/epochX/cudacpp/susy_gg_tt.mad/Source/PDF/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/Source/PDF/eepdf.inc +++ b/epochX/cudacpp/susy_gg_tt.mad/Source/PDF/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/susy_gg_tt.mad/Source/PDF/pdfwrap_emela.f b/epochX/cudacpp/susy_gg_tt.mad/Source/PDF/pdfwrap_emela.f index bce10819d5..da1e4e2276 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/Source/PDF/pdfwrap_emela.f +++ b/epochX/cudacpp/susy_gg_tt.mad/Source/PDF/pdfwrap_emela.f @@ -13,7 +13,7 @@ SUBROUTINE PDFWRAP DOUBLE PRECISION VALUE(20) REAL*8 ALPHASPDF EXTERNAL ALPHASPDF - ! PDFs with beamstrahlung use specific initialisation/evaluation +C PDFs with beamstrahlung use specific initialisation/evaluation LOGICAL HAS_BSTRAHL COMMON /TO_HAS_BS/ HAS_BSTRAHL diff --git a/epochX/cudacpp/susy_gg_tt.mad/Source/PDF/pdg2pdf.f b/epochX/cudacpp/susy_gg_tt.mad/Source/PDF/pdg2pdf.f index 46f321e66b..2e7343a69b 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/Source/PDF/pdg2pdf.f +++ b/epochX/cudacpp/susy_gg_tt.mad/Source/PDF/pdg2pdf.f @@ -108,7 +108,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) else if (abs(ipart).eq.10) then ipart = sign(1,ipart) * 15 endif - pdg2pdf = 0d0 + pdg2pdf = 0d0 if (beamid.lt.0) then ih_local = ipart @@ -122,7 +122,7 @@ double precision function pdg2pdf(ih,ipdg,beamid,x,xmu) endif do i_ee = 1, n_ee ee_components(i_ee) = compute_eepdf(x,omx_ee(iabs(beamid)),xmu,i_ee,ipart,ih_local) - enddo + enddo pdg2pdf = ee_components(1) ! temporary to test pdf load c write(*,*), x, beamid ,omx_ee(iabs(beamid)),xmu,1,ipart,ih_local,pdg2pdf return diff --git a/epochX/cudacpp/susy_gg_tt.mad/Source/dsample.f b/epochX/cudacpp/susy_gg_tt.mad/Source/dsample.f index 09d482b45a..b0bc0547ad 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/Source/dsample.f +++ b/epochX/cudacpp/susy_gg_tt.mad/Source/dsample.f @@ -204,6 +204,9 @@ subroutine sample_full(ndim,ncall,itmax,itmin,dsig,ninvar,nconfigs,VECSIZE_USED) if (VECSIZE_USED.le.1) then all_fx(1) = dsig(all_p, all_wgt,0) + ivec=0 + ilock=0 + iwarp=1 else c Here "i" is the position in the full grid of the event do i=(iwarp-1)*WARP_SIZE+1, iwarp*warp_size diff --git a/epochX/cudacpp/susy_gg_tt.mad/Source/eepdf.inc b/epochX/cudacpp/susy_gg_tt.mad/Source/eepdf.inc index a0183e49ee..d50d8c62b3 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/Source/eepdf.inc +++ b/epochX/cudacpp/susy_gg_tt.mad/Source/eepdf.inc @@ -4,6 +4,9 @@ integer n_ee parameter (n_ee = 4) ! arrays to store the components before combining them + ! note this common is very quickly overwritten do not use + ! use such common outside of auto_dsig.f double precision ee_components(n_ee) common / to_ee_components / ee_components + diff --git a/epochX/cudacpp/susy_gg_tt.mad/Source/genps.inc b/epochX/cudacpp/susy_gg_tt.mad/Source/genps.inc index af7e0efbce..ef78e7e812 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/Source/genps.inc +++ b/epochX/cudacpp/susy_gg_tt.mad/Source/genps.inc @@ -29,9 +29,8 @@ c parameter (max_host=99,maxplace=199,maxpoints=100,maxans=50) c************************************************************************* c Parameters for helicity sums in matrixN.f c************************************************************************* - REAL*8 LIMHEL -c PARAMETER(LIMHEL=1e-8) ! ME threshold for helicity filtering (Fortran default) - PARAMETER(LIMHEL=0) ! ME threshold for helicity filtering (force Fortran to mimic cudacpp, see #419) +c REAL*8 LIMHEL +c PARAMETER(LIMHEL=1e-8) -> pass in the run_card.dat INTEGER MAXTRIES PARAMETER(MAXTRIES=25) C To pass the helicity configuration chosen by the DiscreteSampler to diff --git a/epochX/cudacpp/susy_gg_tt.mad/Source/run.inc b/epochX/cudacpp/susy_gg_tt.mad/Source/run.inc index 5433a23583..81c8df6bf2 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/Source/run.inc +++ b/epochX/cudacpp/susy_gg_tt.mad/Source/run.inc @@ -106,4 +106,7 @@ c double precision tmin_for_channel integer sde_strat ! 1 means standard single diagram enhancement strategy, c 2 means approximation by the denominator of the propagator - common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat \ No newline at end of file + common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat +c + double precision limhel + common/to_limhel/limhel diff --git a/epochX/cudacpp/susy_gg_tt.mad/Source/run_card.inc b/epochX/cudacpp/susy_gg_tt.mad/Source/run_card.inc index 67af0f2051..1a1bc782bd 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/Source/run_card.inc +++ b/epochX/cudacpp/susy_gg_tt.mad/Source/run_card.inc @@ -88,6 +88,8 @@ DSQRT_SHAT = 0.000000000000000D+00 + LIMHEL = 0.000000000000000D+00 + PTJ = 2.000000000000000D+01 PTB = 0.000000000000000D+00 diff --git a/epochX/cudacpp/susy_gg_tt.mad/Source/setrun.f b/epochX/cudacpp/susy_gg_tt.mad/Source/setrun.f index 9e9ef7fdbd..dc6caef748 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/Source/setrun.f +++ b/epochX/cudacpp/susy_gg_tt.mad/Source/setrun.f @@ -162,9 +162,21 @@ subroutine setrun C Fill common block for Les Houches init info do i=1,2 if(lpp(i).eq.1.or.lpp(i).eq.2) then - idbmup(i)=2212 + if (nb_proton(i).eq.1.and.nb_neutron(i).eq.0) then + idbmup(i)=2212 + elseif (nb_proton(i).eq.0.and.nb_neutron(i).eq.1) then + idbmup(i)=2112 + else + idbmup(i) = 1000000000 + (nb_proton(i)+nb_neutron(i))*10 + $ + nb_proton(i)*10000 + endif elseif(lpp(i).eq.-1.or.lpp(i).eq.-2) then - idbmup(i)=-2212 + if (nb_proton(i).eq.1.and.nb_neutron(i).eq.0) then + idbmup(i)=-2212 + else + idbmup(i) = -1*(1000000000 + (nb_proton(i)+nb_neutron(i))*10 + $ + nb_proton(i)*10000) + endif elseif(lpp(i).eq.3) then idbmup(i)=11 elseif(lpp(i).eq.-3) then diff --git a/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/MGVersion.txt b/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/MGVersion.txt index 9d3a5c0ba0..a806d3938c 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/MGVersion.txt +++ b/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/MGVersion.txt @@ -1 +1 @@ -3.5.3_lo_vect \ No newline at end of file +3.6.0_lo_vect \ No newline at end of file diff --git a/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/P1_gg_ttx/CPPProcess.cc b/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/P1_gg_ttx/CPPProcess.cc index f2dfb25eb9..874cb91a6c 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/P1_gg_ttx/CPPProcess.cc +++ b/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/P1_gg_ttx/CPPProcess.cc @@ -7,7 +7,7 @@ // Further modified by: S. Hageboeck, O. Mattelaer, S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/P1_gg_ttx/CPPProcess.h b/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/P1_gg_ttx/CPPProcess.h index ed162820fd..355b4d3e77 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/P1_gg_ttx/CPPProcess.h +++ b/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/P1_gg_ttx/CPPProcess.h @@ -7,7 +7,7 @@ // Further modified by: O. Mattelaer, S. Roiser, J. Teig, A. Valassi (2020-2024) for the MG5aMC CUDACPP plugin. //========================================================================== // This file has been automatically generated for CUDA/C++ standalone by -// MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +// MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 // By the MadGraph5_aMC@NLO Development Team // Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch //========================================================================== diff --git a/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/P1_gg_ttx/auto_dsig.f b/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/P1_gg_ttx/auto_dsig.f index ef6cba5d03..ff10374363 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/P1_gg_ttx/auto_dsig.f +++ b/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/P1_gg_ttx/auto_dsig.f @@ -376,7 +376,7 @@ SUBROUTINE DSIG_VEC(ALL_P,ALL_WGT,ALL_XBK,ALL_Q2FACT,ALL_CM_RAP DOUBLE PRECISION FUNCTION DSIG(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -1134,11 +1134,12 @@ END SUBROUTINE MAP_1_TO_3 SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=16) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL WRITE(STREAM_ID,*) GOODHEL RETURN @@ -1148,32 +1149,29 @@ SUBROUTINE WRITE_GOOD_HEL(STREAM_ID) SUBROUTINE READ_GOOD_HEL(STREAM_ID) IMPLICIT NONE INCLUDE 'genps.inc' + INCLUDE 'maxamps.inc' INTEGER STREAM_ID INTEGER NCOMB PARAMETER ( NCOMB=16) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL READ(STREAM_ID,*) GOODHEL - NTRY(1) = MAXTRIES + 1 - NTRY(2) = MAXTRIES + 1 + NTRY(:) = MAXTRIES + 1 RETURN END SUBROUTINE INIT_GOOD_HEL() IMPLICIT NONE + INCLUDE 'maxamps.inc' INTEGER NCOMB PARAMETER ( NCOMB=16) - LOGICAL GOODHEL(NCOMB, 2) - INTEGER NTRY(2) - INTEGER I + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) + INTEGER I,J - DO I=1,NCOMB - GOODHEL(I,1) = .FALSE. - GOODHEL(I,2) = .FALSE. - ENDDO - NTRY(1) = 0 - NTRY(2) = 0 + GOODHEL(:,:) = .FALSE. + NTRY(:) = 0 END INTEGER FUNCTION GET_MAXSPROC() diff --git a/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/P1_gg_ttx/auto_dsig1.f b/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/P1_gg_ttx/auto_dsig1.f index e00e2f9e40..51cde595e2 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/P1_gg_ttx/auto_dsig1.f +++ b/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/P1_gg_ttx/auto_dsig1.f @@ -1,7 +1,7 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -101,6 +101,8 @@ DOUBLE PRECISION FUNCTION DSIG1(PP,WGT,IMODE) C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 DSIG1=0D0 IF(IMODE.EQ.1)THEN @@ -217,7 +219,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, $ ICONF_VEC, IMIRROR_VEC, VECSIZE_USED) C **************************************************** C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -281,7 +283,7 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION RHEL ! random number INTEGER CHANNEL C -C STUFF FOR DRESSED EE COLLISIONS --even if not supported for now-- +C STUFF FOR DRESSED EE COLLISIONS C INCLUDE '../../Source/PDF/eepdf.inc' DOUBLE PRECISION EE_COMP_PROD @@ -320,9 +322,10 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, DOUBLE PRECISION ALL_RWGT(VECSIZE_MEMMAX) C Common blocks - CHARACTER*7 PDLABEL,EPA_LABEL - INTEGER LHAID - COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL + INCLUDE '../../Source/PDF/pdf.inc' +C CHARACTER*7 PDLABEL,EPA_LABEL +C INTEGER LHAID +C COMMON/TO_PDF/LHAID,PDLABEL,EPA_LABEL C C local @@ -338,6 +341,8 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, C ---------- C BEGIN CODE C ---------- + SELECTED_HEL(:) = 0 + SELECTED_COL(:) = 0 IF(IMODE.EQ.1)THEN NFACT = DSIG1(ALL_PP(0,1,1), ALL_WGT(1), IMODE) @@ -485,11 +490,6 @@ DOUBLE PRECISION FUNCTION DSIG1_VEC(ALL_PP, ALL_XBK, ALL_Q2FACT, ENDDO END -C -C Functionality to handling grid -C - - @@ -589,9 +589,11 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNELS, C ! This is a workaround for C https://github.com/oliviermattelaer/mg5amc_test/issues/22 C (see PR #486) - IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all) - CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1 - ENDIF +C IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is +C not called at all) +C CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the' +C //' initialization' within SMATRIX1 +C ENDIF CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL) IF( NTOTHEL .NE. NCOMB ) THEN WRITE(6,*) 'ERROR ! Cudacpp/Fortran mismatch', @@ -704,3 +706,6 @@ INTEGER FUNCTION GET_NHEL1(HEL, IPART) END + + + diff --git a/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/P1_gg_ttx/driver.f b/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/P1_gg_ttx/driver.f index 27a6e46742..ec5722702a 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/P1_gg_ttx/driver.f +++ b/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/P1_gg_ttx/driver.f @@ -43,6 +43,8 @@ Program DRIVER DOUBLE PRECISION CUMULATED_TIMING COMMON/GENERAL_STATS/CUMULATED_TIMING + logical init_mode + common /to_determine_zero_hel/init_mode c c PARAM_CARD c @@ -226,6 +228,12 @@ Program DRIVER call init_good_hel() call get_user_params(ncall,itmax,itmin,mincfig) maxcfig=mincfig + if (init_mode) then + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. + ickkw = 0 + endif minvar(1,1) = 0 !This tells it to map things invarients write(*,*) 'Attempting mappinvarients',nconfigs,nexternal if (mincfig.lt.0)then @@ -338,9 +346,11 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) common /to_accuracy/accur integer use_cut common /to_weight/use_cut + logical init_mode common /to_determine_zero_hel/init_mode - + include 'vector.inc' + include 'run.inc' integer lbw(0:nexternal) !Use of B.W. common /to_BW/ lbw @@ -388,6 +398,9 @@ subroutine get_user_params(ncall,itmax,itmin,iconfig) isum_hel = 0 multi_channel = .false. init_mode = .true. + fixed_ren_scale = .true. + fixed_fac_scale1 = .true. + fixed_fac_scale2 = .true. write(*,*) 'Determining zero helicities' else isum_hel= i diff --git a/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/P1_gg_ttx/matrix1.f b/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/P1_gg_ttx/matrix1.f index 936c7c2736..cd17ce6fcf 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/P1_gg_ttx/matrix1.f +++ b/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/P1_gg_ttx/matrix1.f @@ -1,7 +1,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, $ ICOL) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C @@ -23,6 +23,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INCLUDE 'maxconfigs.inc' INCLUDE 'nexternal.inc' INCLUDE 'maxamps.inc' + INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX + INCLUDE 'run.inc' INTEGER NCOMB PARAMETER ( NCOMB=16) INTEGER NGRAPHS @@ -46,8 +48,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C C global (due to reading writting) C - LOGICAL GOODHEL(NCOMB,2) - INTEGER NTRY(2) + LOGICAL GOODHEL(NCOMB, MAXSPROC) + INTEGER NTRY(MAXSPROC) COMMON/BLOCK_GOODHEL/NTRY,GOODHEL C @@ -56,26 +58,23 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER CONFSUB(MAXSPROC,LMAXCONFIGS) INCLUDE 'config_subproc_map.inc' INTEGER NHEL(NEXTERNAL,NCOMB) - INTEGER ISHEL(2) + INTEGER ISHEL REAL*8 T,MATRIX1 REAL*8 R,SUMHEL,TS(NCOMB) INTEGER I,IDEN INTEGER JC(NEXTERNAL),II REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB) - INTEGER NGOOD(2), IGOOD(NCOMB,2) - INTEGER JHEL(2), J, JJ - INTEGER THIS_NTRY(2) - SAVE THIS_NTRY + INTEGER NGOOD + INTEGER J, JJ INTEGER NB_FAIL SAVE NB_FAIL - DATA THIS_NTRY /0,0/ DATA NB_FAIL /0/ DOUBLE PRECISION GET_CHANNEL_CUT EXTERNAL GET_CHANNEL_CUT C - INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed + INTEGER NGOODHEL ! -1 if not yet retrieved and printed SAVE NGOODHEL - DATA NGOODHEL/-1,-1/ + DATA NGOODHEL/-1/ C C This is just to temporarily store the reference grid for C helicity of the DiscreteSampler so as to obtain its number of @@ -86,7 +85,6 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C LOGICAL INIT_MODE COMMON /TO_DETERMINE_ZERO_HEL/INIT_MODE - INCLUDE '../../Source/vector.inc' ! defines VECSIZE_MEMMAX DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW) @@ -96,26 +94,25 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, INTEGER IMIRROR, IPROC COMMON/TO_MIRROR/ IMIRROR,IPROC - DOUBLE PRECISION TMIN_FOR_CHANNEL - INTEGER SDE_STRAT ! 1 means standard single diagram enhancement strategy, +C included vi run.inc +C double precision tmin_for_channel +C integer sde_strat ! 1 means standard single diagram enhancement +C strategy, C 2 means approximation by the denominator of the propagator - COMMON/TO_CHANNEL_STRAT/TMIN_FOR_CHANNEL, SDE_STRAT +C common/TO_CHANNEL_STRAT/tmin_for_channel, sde_strat REAL*8 POL(2) COMMON/TO_POLARIZATION/ POL - DOUBLE PRECISION SMALL_WIDTH_TREATMENT - COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT - INTEGER ISUM_HEL LOGICAL MULTI_CHANNEL COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG DATA XTRY, XREJ /0,0/ - DATA NGOOD /0,0/ - DATA ISHEL/0,0/ - SAVE YFRAC, IGOOD, JHEL + DATA NGOOD /0/ + DATA ISHEL/0/ + SAVE YFRAC DATA (NHEL(I, 1),I=1,4) /-1,-1,-1, 1/ DATA (NHEL(I, 2),I=1,4) /-1,-1,-1,-1/ DATA (NHEL(I, 3),I=1,4) /-1,-1, 1, 1/ @@ -143,8 +140,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C BEGIN CODE C ---------- - NTRY(IMIRROR)=NTRY(IMIRROR)+1 - THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1 + NTRY(1)=NTRY(1)+1 DO I=1,NEXTERNAL JC(I) = +1 ENDDO @@ -153,11 +149,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, DO I=1,NDIAGS AMP2(I)=0D0 ENDDO - JAMP2(0)=2 - DO I=1,INT(JAMP2(0)) - JAMP2(I)=0D0 - ENDDO ENDIF + JAMP2(0)=2 + DO I=1,INT(JAMP2(0)) + JAMP2(I)=0D0 + ENDDO ANS = 0D0 DO I=1,NCOMB TS(I)=0D0 @@ -167,12 +163,11 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, C initialized. C If HEL_PICKED==-1, this means that calls to other matrix C where in initialization mode as well for the helicity. - IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0) + IF ((ISHEL.EQ.0.AND.ISUM_HEL.EQ.0) $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1)) $ THEN DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR) - $ .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.10) + IF (GOODHEL(I,1) .OR. NTRY(1).LE.MAXTRIES.OR.(ISUM_HEL.NE.0)) $ THEN T=MATRIX1(P ,NHEL(1,I),JC(1),I,AMP2, JAMP2, IVEC) @@ -184,7 +179,8 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, TS(I)=T ENDIF ENDDO - IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN + IF(NTRY(1).EQ.(MAXTRIES+1).AND.DS_GET_DIM_STATUS('Helicity') + $ .NE.-1) THEN CALL RESET_CUMULATIVE_VARIABLE() ! avoid biais of the initialization ENDIF IF (ISUM_HEL.NE.0) THEN @@ -213,35 +209,33 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, CALL DS_SET_GRID_MODE('Helicity','init') ENDIF ELSE - JHEL(IMIRROR) = 1 - IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.10)THEN + IF(NTRY(1).LE.MAXTRIES)THEN DO I=1,NCOMB IF(INIT_MODE) THEN IF (DABS(TS(I)).GT.ANS*LIMHEL/NCOMB) THEN PRINT *, 'Matrix Element/Good Helicity: 1 ', I, $ 'IMIRROR', IMIRROR ENDIF - ELSE IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)) - $ .GT.ANS*LIMHEL/NCOMB)) THEN - GOODHEL(I,IMIRROR)=.TRUE. - NGOOD(IMIRROR) = NGOOD(IMIRROR) +1 - IGOOD(NGOOD(IMIRROR),IMIRROR) = I - PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in' - $ //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR) + ELSE IF (.NOT.GOODHEL(I,1) .AND. (DABS(TS(I)).GT.ANS + $ *LIMHEL/NCOMB)) THEN + GOODHEL(I,1)=.TRUE. + NGOOD = NGOOD +1 + PRINT *,'Added good helicity ',I, 'for process 1',TS(I) + $ *NCOMB/ANS,' in event ',NTRY(1) ENDIF ENDDO ENDIF - IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN - ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR)) + IF(NTRY(1).EQ.MAXTRIES)THEN + ISHEL=MIN(ISUM_HEL,NGOOD) C Print the number of good helicities - IF (NGOODHEL(IMIRROR).EQ.-1) THEN - NGOODHEL(IMIRROR)=0 + IF (NGOODHEL.EQ.-1) THEN + NGOODHEL=0 DO I=1,NCOMB - IF (GOODHEL(I,IMIRROR)) THEN - NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1 + IF (GOODHEL(I,1)) THEN + NGOODHEL=NGOODHEL+1 ENDIF END DO - WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror? + WRITE (6,*) 'NGOODHEL =', NGOODHEL WRITE (6,*) 'NCOMB =', NCOMB ENDIF ENDIF @@ -313,7 +307,7 @@ SUBROUTINE SMATRIX1(P, RHEL, RCOL, CHANNEL, IVEC, ANS, IHEL, REAL*8 FUNCTION MATRIX1(P,NHEL,IC, IHEL,AMP2, JAMP2, IVEC) C -C Generated by MadGraph5_aMC@NLO v. 3.5.3_lo_vect, 2023-12-23 +C Generated by MadGraph5_aMC@NLO v. 3.6.0_lo_vect, 2024-06-17 C By the MadGraph5_aMC@NLO Development Team C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch C diff --git a/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/cluster.f b/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/cluster.f index 649e46f4e9..b8995283ed 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/cluster.f +++ b/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/cluster.f @@ -552,6 +552,8 @@ logical function cluster(p, ivec) if (btest(mlevel,1)) $ write (*,*)'New event' + iwin = 0 + jwin = 0 cluster=.false. clustered=.false. do i=0,3 @@ -663,7 +665,8 @@ logical function cluster(p, ivec) c initialize graph storage igraphs(0)=0 nleft=nexternal -c cluster +c cluster + if (iwin.eq.0.or.jwin.eq.0) stop 21 do n=1,nexternal-2 c combine winner imocl(n)=imap(iwin,2)+imap(jwin,2) diff --git a/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/proc_characteristics b/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/proc_characteristics index 9bd0635a36..0a47a3fabf 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/proc_characteristics +++ b/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/proc_characteristics @@ -17,6 +17,8 @@ splitting_types = [] perturbation_order = [] limitations = [] + ew_sudakov = False hel_recycling = False single_color = True nlo_mixed_expansion = True + gauge = unitary diff --git a/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/refine.sh b/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/refine.sh index afb9b99ad1..b46170ba23 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/refine.sh +++ b/epochX/cudacpp/susy_gg_tt.mad/SubProcesses/refine.sh @@ -57,7 +57,11 @@ j=%(directory)s for((try=1;try<=16;try+=1)); do if [ "$keeplog" = true ] ; then + if [[ -e ../madevent ]];then ../madevent 2>&1 >> $k &1 >> $k &1 >> log.txt &1 >> log.txt &1 >> $k \w*)>') - pat_end=re.compile('\w*)>') + pat_begin=re.compile(r'<(?P\w*)>') + pat_end=re.compile(r'\w*)>') tag_to_file={'slha':'param_card.dat', 'mgruncard':'run_card.dat', @@ -319,7 +319,7 @@ def check_pid(self, pid2label): def get_lha_strategy(self): """get the lha_strategy: how the weight have to be handle by the shower""" - if not self["init"]: + if "init" not in self or not self["init"]: raise Exception("No init block define") data = self["init"].split('\n')[0].split() @@ -537,7 +537,8 @@ def charge_card(self, tag): self.param_card = param_card_reader.ParamCard(param_card) return self.param_card elif tag == 'mgruncard': - self.run_card = RunCard(self[tag], unknown_warning=False) + with misc.TMP_variable(RunCard, 'allow_scan', True): + self.run_card = RunCard(self[tag], consistency=False, unknow_warning=False) return self.run_card elif tag == 'mg5proccard': proc_card = self[tag].split('\n') @@ -976,6 +977,8 @@ class ConfigFile(dict): """ a class for storing/dealing with input file. """ + allow_scan = False + def __init__(self, finput=None, **opt): """initialize a new instance. input can be an instance of MadLoopParam, a file, a path to a file, or simply Nothing""" @@ -993,6 +996,7 @@ def __init__(self, finput=None, **opt): # Initialize it with all the default value self.user_set = set() self.auto_set = set() + self.scan_set = {} #key -> type of list (int/float/bool/str/... for scan self.system_only = set() self.lower_to_case = {} self.list_parameter = {} #key -> type of list (int/float/bool/str/... @@ -1109,6 +1113,8 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): #1. check if the parameter is set to auto -> pass it to special if lower_name in self: targettype = type(dict.__getitem__(self, lower_name)) + if lower_name in self.scan_set: + targettype = self.scan_set[lower_name] if targettype != str and isinstance(value, str) and value.lower() == 'auto': self.auto_set.add(lower_name) if lower_name in self.user_set: @@ -1118,13 +1124,26 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): return elif lower_name in self.auto_set: self.auto_set.remove(lower_name) - + + + #1. check if the parameter is set to auto -> pass it to special + scan_targettype = None + if self.allow_scan and isinstance(value, str) and value.strip().startswith('scan'): + if lower_name in self.user_set: + self.user_set.remove(lower_name) + self.scan_set[lower_name] = type(self[lower_name]) + dict.__setitem__(self, lower_name, value) + #keep old value. + self.post_set(lower_name,value, change_userdefine, raiseerror) + return + elif lower_name in self.scan_set: + scan_targettype = self.scan_set[lower_name] + del self.scan_set[lower_name] + # 2. Find the type of the attribute that we want if lower_name in self.list_parameter: targettype = self.list_parameter[lower_name] - - if isinstance(value, str): # split for each comma/space value = value.strip() @@ -1248,8 +1267,11 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): if change_userdefine: self.user_set.add(lower_name) return self.post_set(lower_name, None, change_userdefine, raiseerror) - elif name in self: - targettype = type(self[name]) + elif name in self: + if scan_targettype: + targettype = targettype + else: + targettype = type(self[name]) else: logger.debug('Trying to add argument %s in %s. ' % (name, self.__class__.__name__) +\ 'This argument is not defined by default. Please consider adding it.') @@ -1262,7 +1284,7 @@ def __setitem__(self, name, value, change_userdefine=False,raiseerror=False): if change_userdefine: self.user_set.add(lower_name) return self.post_set(lower_name, None, change_userdefine, raiseerror) - + value = self.format_variable(value, targettype, name=name) #check that the value is allowed: if lower_name in self.allowed_value and '*' not in self.allowed_value[lower_name]: @@ -1444,7 +1466,7 @@ def format_variable(value, targettype, name="unknown"): value =int(value[:-1]) * convert[value[-1]] elif '/' in value or '*' in value: try: - split = re.split('(\*|/)',value) + split = re.split(r'(\*|/)',value) v = float(split[0]) for i in range((len(split)//2)): if split[2*i+1] == '*': @@ -1482,7 +1504,7 @@ def format_variable(value, targettype, name="unknown"): value = float(value) except ValueError: try: - split = re.split('(\*|/)',value) + split = re.split(r'(\*|/)',value) v = float(split[0]) for i in range((len(split)//2)): if split[2*i+1] == '*': @@ -1491,7 +1513,10 @@ def format_variable(value, targettype, name="unknown"): v /= float(split[2*i+2]) except: v=0 - raise InvalidCmd("%s can not be mapped to a float" % value) + if "scan" in value: + raise InvalidCmd("%s is not supported here. Note that scan command can not be present simultaneously in the run_card and param_card." % value) + else: + raise InvalidCmd("%s can not be mapped to a float" % value) finally: value = v else: @@ -1737,10 +1762,12 @@ def default_setup(self): self.add_param('splitting_types',[], typelist=str) self.add_param('perturbation_order', [], typelist=str) self.add_param('limitations', [], typelist=str) + self.add_param('ew_sudakov', False) self.add_param('hel_recycling', False) self.add_param('single_color', True) self.add_param('nlo_mixed_expansion', True) - + self.add_param('gauge', 'U') + def read(self, finput): """Read the input file, this can be a path to a file, a file object, a str with the content of the file.""" @@ -3104,7 +3131,7 @@ def write(self, output_file, template=None, python_template=False, # do not write hidden parameter not hidden for this template # if python_template: - written = written.union(set(re.findall('\%\((\w*)\)s', open(template,'r').read(), re.M))) + written = written.union(set(re.findall(r'\%\((\w*)\)s', open(template,'r').read(), re.M))) to_write = to_write.union(set(self.hidden_param)) to_write = to_write.difference(written) @@ -3157,7 +3184,6 @@ def get_value_from_include(self, path, list_of_params, output_dir): if path does not exists return the current value in self for all parameter""" #WARNING DOES NOT HANDLE LIST/DICT so far - misc.sprint(output_dir, path) # handle case where file is missing if not os.path.exists(pjoin(output_dir,path)): misc.sprint("include file not existing", pjoin(output_dir,path)) @@ -3259,7 +3285,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): text = open(path,'r').read() #misc.sprint(text) f77_type = ['real*8', 'integer', 'double precision', 'logical'] - pattern = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I+re.M) for fct in pattern.findall(text): fsock = file_writers.FortranWriter(tmp,'w') @@ -3287,6 +3313,7 @@ def edit_dummy_fct_from_file(self, filelist, outdir): starttext = open(pjoin(outdir, path+'.orig')).read() fsock.remove_routine(starttext, to_mod[path][0]) for text in to_mod[path][1]: + text = self.retro_compatible_custom_fct(text) fsock.writelines(text) fsock.close() if not filecmp.cmp(pjoin(outdir, path), pjoin(outdir, path+'.tmp')): @@ -3303,7 +3330,33 @@ def edit_dummy_fct_from_file(self, filelist, outdir): files.mv(pjoin(outdir,path+'.orig'), pjoin(outdir, path)) + @staticmethod + def retro_compatible_custom_fct(lines, mode=None): + f77_type = ['real*8', 'integer', 'double precision', 'logical'] + function_pat = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + % {'type':'|'.join(f77_type)}, re.I+re.M) + include_pat = re.compile(r"\s+include\s+[\'\"]([\w\./]*)") + + assert isinstance(lines, list) + sol = [] + + if mode is None or 'vector.inc' in mode: + search = True + for i,line in enumerate(lines[:]): + if search and re.search(include_pat, line): + name = re.findall(include_pat, line)[0] + misc.sprint('DETECTED INCLUDE', name) + if 'vector.inc' in name: + search = False + if 'run.inc' in name: + sol.append(" include 'vector.inc'") + search = False + sol.append(line) + if re.search(function_pat, line): + misc.sprint("DETECTED FCT") + search = True + return sol def guess_entry_fromname(self, name, value): """ @@ -3346,7 +3399,7 @@ def update_typelist(value, name, opts): #handle metadata opts = {} forced_opts = [] - for key,val in re.findall("\<(?P[_\-\w]+)\=(?P[^>]*)\>", str(name)): + for key,val in re.findall(r"\<(?P[_\-\w]+)\=(?P[^>]*)\>", str(name)): forced_opts.append(key) if val in ['True', 'False']: opts[key] = eval(val) @@ -3681,11 +3734,22 @@ def write_autodef(self, output_dir, output_file=None): out = ["%s\n" %l for l in out] fsock.writelines(out) - @staticmethod - def get_idbmup(lpp): + def get_idbmup(self, lpp, beam=1): """return the particle colliding pdg code""" if lpp in (1,2, -1,-2): - return math.copysign(2212, lpp) + target = 2212 + if 'nb_proton1' in self: + nbp = self['nb_proton%s' % beam] + nbn = self['nb_neutron%s' % beam] + if nbp == 1 and nbn ==0: + target = 2212 + elif nbp==0 and nbn ==1: + target = 2112 + else: + target = 1000000000 + target += 10 * (nbp+nbn) + target += 10000 * nbp + return math.copysign(target, lpp) elif lpp in (3,-3): return math.copysign(11, lpp) elif lpp in (4,-4): @@ -3701,8 +3765,8 @@ def get_banner_init_information(self): the first line of the block of the lhe file.""" output = {} - output["idbmup1"] = self.get_idbmup(self['lpp1']) - output["idbmup2"] = self.get_idbmup(self['lpp2']) + output["idbmup1"] = self.get_idbmup(self['lpp1'], beam=1) + output["idbmup2"] = self.get_idbmup(self['lpp2'], beam=2) output["ebmup1"] = self["ebeam1"] output["ebmup2"] = self["ebeam2"] output["pdfgup1"] = 0 @@ -3959,7 +4023,8 @@ def check_validity(self, card): dict.__setitem__(card, 'pdlabel1', card['pdlabel']) dict.__setitem__(card, 'pdlabel2', card['pdlabel']) - if abs(card['lpp1']) == 1 == abs(card['lpp2']) and card['pdlabel1'] != card['pdlabel2']: + if isinstance(card['lpp1'],int) and isinstance(card['lpp2'],int) and \ + abs(card['lpp1']) == 1 == abs(card['lpp2']) and card['pdlabel1'] != card['pdlabel2']: raise InvalidRunCard("Assymetric beam pdf not supported for proton-proton collision") def status(self, card): @@ -4156,12 +4221,16 @@ def default_setup(self): self.add_param('frame_id', 6, system=True) self.add_param("event_norm", "average", allowed=['sum','average', 'unity'], include=False, sys_default='sum', hidden=True) + self.add_param("keep_log", "normal", include=False, hidden=True, + comment="none: all log send to /dev/null.\n minimal: keep only log for survey of the last run.\n normal: keep only log for survey of all run. \n debug: keep all log (survey and refine)", + allowed=['none', 'minimal', 'normal', 'debug']) #cut self.add_param("auto_ptj_mjj", True, hidden=True) self.add_param("bwcutoff", 15.0) self.add_param("cut_decays", False, cut='d') self.add_param('dsqrt_shat',0., cut=True) self.add_param("nhel", 0, include=False) + self.add_param("limhel", 1e-8, hidden=True, comment="threshold to determine if an helicity contributes when not MC over helicity.") #pt cut self.add_param("ptj", 20.0, cut='j') self.add_param("ptb", 0.0, cut='b') @@ -4842,7 +4911,7 @@ def create_default_for_process(self, proc_characteristic, history, proc_def): # here pick strategy 2 if only one QCD color flow # and for pure multi-jet case jet_id = [21] + list(range(1, self['maxjetflavor']+1)) - if proc_characteristic['single_color']: + if proc_characteristic['gauge'] != 'FD' and proc_characteristic['single_color']: self['sde_strategy'] = 2 #for pure lepton final state go back to sde_strategy=1 pure_lepton=True @@ -5741,9 +5810,10 @@ def check_validity(self): # check that ebeam is bigger than the proton mass. for i in [1,2]: - if self['lpp%s' % i ] not in [1,2]: + # do not for proton mass if not proton PDF (or when scan initialization) + if self['lpp%s' % i ] not in [1,2] or isinstance(self['ebeam%i' % i], str): continue - + if self['ebeam%i' % i] < 0.938: if self['ebeam%i' %i] == 0: logger.warning("At-rest proton mode set: energy beam set to 0.938 GeV") @@ -6193,3 +6263,181 @@ def log_and_update(self, banner, card, par, v): xcard = banner.charge_card(card) xcard[par[0]].param_dict[(par[1],)].value = v xcard.write(os.path.join(self.me_dir, 'Cards', '%s.dat' % card)) + + + + +class RunCardIterator(object): + """A class keeping track of the scan: flag in the param_card and + having an __iter__() function to scan over all the points of the scan. + """ + + logging = True + def __init__(self, input_path=None): + with misc.TMP_variable(RunCard, 'allow_scan', True): + self.run_card = RunCard(input_path, consistency=False) + self.run_card.allow_scan = True + + self.itertag = [] #all the current value use + self.cross = [] # keep track of all the cross-section computed + self.param_order = [] + + def __iter__(self): + """generate the next param_card (in a abstract way) related to the scan. + Technically this generates only the generator.""" + + if hasattr(self, 'iterator'): + return self.iterator + self.iterator = self.iterate() + return self.iterator + + def write(self, path): + self.__iter__.write(path) + + def next(self, autostart=False): + """call the next iteration value""" + try: + iterator = self.iterator + except: + if autostart: + iterator = self.__iter__() + else: + raise + try: + out = next(iterator) + except StopIteration: + del self.iterator + raise + return out + + def iterate(self): + """create the actual generator""" + all_iterators = {} # dictionary of key -> block of object to scan [([param, [values]), ...] + pattern = re.compile(r'''scan\s*(?P\d*)\s*:\s*(?P[^#]*)''', re.I) + + # fill all_iterators with the run_card information + for name in self.run_card.scan_set: + value = self.run_card[name] + try: + key, def_list = pattern.findall(value)[0] + except Exception as error: + misc.sprint(error) + raise Exception("Fail to handle scanning tag in run_card: Please check that the syntax is valid") + if key == '': + key = -1 * len(all_iterators) + if key not in all_iterators: + all_iterators[key] = [] + try: + all_iterators[key].append( (name, eval(def_list))) + except SyntaxError as error: + raise Exception("Fail to handle your scan definition. Please check your syntax:\n entry: %s \n Error reported: %s" %(def_list, error)) + + #prepare to keep track of parameter changing for the report + keys = list(all_iterators.keys()) # need to fix an order for the scan + #store the type of parameter + for key in keys: + for param, values in all_iterators[key]: + self.param_order.append("run_card#%s" % (param)) + + # do the loop + lengths = [list(range(len(all_iterators[key][0][1]))) for key in keys] + from functools import reduce + total = reduce((lambda x, y: x * y),[len(x) for x in lengths]) + for i,positions in enumerate(itertools.product(*lengths)): + self.itertag = [] + if self.logging: + logger.info("Create the next run_card in the scan definition (%s/%s) " %( i+1, total), '$MG:BOLD') + for i, pos in enumerate(positions): + key = keys[i] + for param, values in all_iterators[key]: + # assign the value in the card. + self.run_card[param] = values[pos] + self.itertag.append(values[pos]) + if self.logging: + logger.info("change parameter %s to %s", \ + param, values[pos]) + + + # retrun the current param_card up to next iteration + yield self.run_card + + + def store_entry(self, run_name, cross, error=None, run_card_path=None): + """store the value of the cross-section""" + + if isinstance(cross, dict): + info = dict(cross) + info.update({'bench' : self.itertag, 'run_name': run_name}) + self.cross.append(info) + else: + if error is None: + self.cross.append({'bench' : self.itertag, 'run_name': run_name, 'cross(pb)':cross}) + else: + self.cross.append({'bench' : self.itertag, 'run_name': run_name, 'cross(pb)':cross, 'error(pb)':error}) + + + def write_summary(self, path, order=None, lastline=False, nbcol=20): + """ """ + + if path: + ff = open(path, 'w') + path_events = path.rsplit("/", 1)[0] + #identCard = open(pjoin(path.rsplit("/", 2)[0], "Cards", "ident_card.dat")) + #identLines = identCard.readlines() + #identCard.close() + else: + ff = StringIO.StringIO() + if order: + keys = order + else: + keys = list(self.cross[0].keys()) + if 'bench' in keys: keys.remove('bench') + if 'run_name' in keys: keys.remove('run_name') + keys.sort() + if 'cross(pb)' in keys: + keys.remove('cross(pb)') + keys.append('cross(pb)') + if 'error(pb)' in keys: + keys.remove('error(pb)') + keys.append('error(pb)') + + formatting = "#%s%s%s\n" %('%%-%is ' % (nbcol-1), ('%%-%is ' % (nbcol))* len(self.param_order), + ('%%-%is ' % (nbcol))* len(keys)) + # header + if not lastline: + ff.write(formatting % tuple(['run_name'] + self.param_order + keys)) + formatting = "%s%s%s\n" %('%%-%is ' % (nbcol), ('%%-%ie ' % (nbcol))* len(self.param_order), + ('%%-%ie ' % (nbcol))* len(keys)) + + if not lastline: + to_print = self.cross + else: + to_print = self.cross[-1:] + for info in to_print: + name = info['run_name'] + bench = info['bench'] + data = [] + for k in keys: + if k in info: + data.append(info[k]) + else: + data.append(0.) + ff.write(formatting % tuple([name] + bench + data)) + ff_single = open(pjoin(path_events, name, "params.dat"), "w") + for i_bench in range(0, len(bench)): + ff_single.write(self.param_order[i_bench] + " = " + str(bench[i_bench]) +"\n") + ff_single.close() + + if not path: + return ff.getvalue() + + + def get_next_name(self, run_name): + """returns a smart name for the next run""" + + if '_' in run_name: + name, value = run_name.rsplit('_',1) + if value.isdigit(): + return '%s_%02i' % (name, float(value)+1) + # no valid '_' in the name + return '%s_scan_02' % run_name diff --git a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/check_param_card.py b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/check_param_card.py index 71089d7480..bc785b5de6 100755 --- a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/check_param_card.py +++ b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/check_param_card.py @@ -649,7 +649,7 @@ def write_inc_file(self, outpath, identpath, default, need_mp=False): #check if we need to write the value of scale for some block if os.path.exists(input_inc): text = open(input_inc).read() - scales = list(set(re.findall('mdl__(\w*)__scale', text, re.I))) + scales = list(set(re.findall(r'mdl__(\w*)__scale', text, re.I))) else: scales = [] @@ -1000,10 +1000,12 @@ def iterate(self): self.param_order.append("%s#%s" % (param.lhablock, '_'.join(repr(i) for i in param.lhacode))) # do the loop lengths = [list(range(len(all_iterators[key][0][1]))) for key in keys] - for positions in itertools.product(*lengths): + from functools import reduce + total = reduce((lambda x, y: x * y),[len(x) for x in lengths]) + for i,positions in enumerate(itertools.product(*lengths)): self.itertag = [] if self.logging: - logger.info("Create the next param_card in the scan definition", '$MG:BOLD') + logger.info("Create the next param_card in the scan definition (%s/%s)" % (i+1,total), '$MG:BOLD') for i, pos in enumerate(positions): key = keys[i] for param, values in all_iterators[key]: diff --git a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/cluster.py b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/cluster.py index 9a893f630d..1ad860e04f 100755 --- a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/cluster.py +++ b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/cluster.py @@ -646,7 +646,10 @@ def worker(self): if os.path.exists(exe) and not exe.startswith('/'): exe = './' + exe if isinstance(opt['stdout'],str): - opt['stdout'] = open(opt['stdout'],'w') + if opt['stdout'] == '/dev/null': + opt['stdout'] = os.open(os.devnull, os.O_RDWR) + else: + opt['stdout'] = open(opt['stdout'],'w') if opt['stderr'] == None: opt['stderr'] = subprocess.STDOUT if arg: @@ -671,11 +674,12 @@ def worker(self): self.pids.put(pid) # the function should return 0 if everything is fine # the error message otherwise - returncode = exe(*arg, **opt) - if returncode != 0: - logger.warning("fct %s does not return 0. Stopping the code in a clean way. The error was:\n%s", exe, returncode) + try: + returncode = exe(*arg, **opt) + except Exception as error: + #logger.warning("fct %s does not return 0. Stopping the code in a clean way. The error was:\n%s", exe, returncode) self.stoprequest.set() - self.remove("fct %s does not return 0:\n %s" % (exe, returncode)) + self.remove("fct %s does raise %s\n %s" % (exe, error)) except Exception as error: self.fail_msg = sys.exc_info() logger.warning(str(error)) @@ -700,7 +704,7 @@ def worker(self): def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, - log=None, required_output=[], nb_submit=0): + log=None, required_output=[], nb_submit=0, python_opts={}): """submit a job on multicore machine""" # open threads if needed @@ -720,7 +724,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, return tag else: # python function - self.queue.put((tag, prog, argument, {})) + self.queue.put((tag, prog, argument, python_opts)) self.submitted.put(1) return tag @@ -908,6 +912,10 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None else: requirement = '' + if 'cluster_walltime' in self.options and self.options['cluster_walltime']\ + and self.options['cluster_walltime'] != 'None': + requirement+='\n MaxRuntime = %s' % self.options['cluster_walltime'] + if cwd is None: cwd = os.getcwd() if stdout is None: @@ -936,7 +944,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None #Submitting job(s). #Logging submit event(s). #1 job(s) submitted to cluster 2253622. - pat = re.compile("submitted to cluster (\d*)",re.MULTILINE) + pat = re.compile(r"submitted to cluster (\d*)",re.MULTILINE) output = output.decode(errors='ignore') try: id = pat.search(output).groups()[0] @@ -1025,7 +1033,7 @@ def submit2(self, prog, argument=[], cwd=None, stdout=None, stderr=None, #Logging submit event(s). #1 job(s) submitted to cluster 2253622. output = output.decode(errors='ignore') - pat = re.compile("submitted to cluster (\d*)",re.MULTILINE) + pat = re.compile(r"submitted to cluster (\d*)",re.MULTILINE) try: id = pat.search(output).groups()[0] except: @@ -1588,7 +1596,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None output = a.communicate()[0].decode(errors='ignore') #Your job 874511 ("test.sh") has been submitted - pat = re.compile("Your job (\d*) \(",re.MULTILINE) + pat = re.compile(r"Your job (\d*) \(",re.MULTILINE) try: id = pat.search(output).groups()[0] except: @@ -1606,7 +1614,7 @@ def control_one_job(self, id): if not status: return 'F' #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 - pat = re.compile("^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") + pat = re.compile(r"^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") stat = '' for line in status.stdout.read().decode(errors='ignore').split('\n'): if not line: @@ -1636,7 +1644,7 @@ def control(self, me_dir=None): cmd = 'qstat -s %s' % statusflag status = misc.Popen([cmd], shell=True, stdout=subprocess.PIPE) #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 - pat = re.compile("^(\d+)") + pat = re.compile(r"^(\d+)") for line in status.stdout.read().decode(errors='ignore').split('\n'): line = line.strip() try: @@ -1715,6 +1723,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None stderr = stdout if log is None: log = '/dev/null' + command = ['sbatch', '-o', stdout, '-J', me_dir, @@ -1726,6 +1735,12 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None command.insert(1, '-p') command.insert(2, self.cluster_queue) + if 'cluster_walltime' in self.options and self.options['cluster_walltime']\ + and self.options['cluster_walltime'] != 'None': + command.insert(1, '-t') + command.insert(2, self.options['cluster_walltime']) + + a = misc.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -1736,7 +1751,7 @@ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None id = output_arr[3].rstrip() if not id.isdigit(): - id = re.findall('Submitted batch job ([\d\.]+)', ' '.join(output_arr)) + id = re.findall(r'Submitted batch job ([\d\.]+)', ' '.join(output_arr)) if not id or len(id)>1: raise ClusterManagmentError( 'fail to submit to the cluster: \n%s' \ diff --git a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/combine_runs.py b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/combine_runs.py index 4de6b84ec0..b1e8c88eac 100755 --- a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/combine_runs.py +++ b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/combine_runs.py @@ -20,6 +20,7 @@ from __future__ import absolute_import import math import os +import shutil import re import logging from six.moves import range @@ -117,6 +118,7 @@ def sum_multichannel(self, channel): #Now read in all of the events and write them #back out with the appropriate scaled weight + to_clean = [] fsock = open(pjoin(channel, 'events.lhe'), 'w') wgt = results.axsec / results.nunwgt tot_nevents, nb_file = 0, 0 @@ -129,8 +131,14 @@ def sum_multichannel(self, channel): nw = self.copy_events(fsock, pjoin(path,'events.lhe'), wgt) tot_nevents += nw nb_file += 1 + to_clean.append(path) logger.debug("Combined %s file generating %s events for %s " , nb_file, tot_nevents, channel) - + for path in to_clean: + try: + shutil.rmtree(path) + except Exception as error: + pass + @staticmethod def get_fortran_str(nb): data = '%E' % nb @@ -162,6 +170,7 @@ def copy_events(self, fsock, input, new_wgt): fsock.write(line) old_line = line return nb_evt + def get_channels(self, proc_path): """Opens file symfact.dat to determine all channels""" sympath = os.path.join(proc_path, 'symfact.dat') diff --git a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/common_run_interface.py b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/common_run_interface.py index 9bd9d9cb50..194f0cdfbd 100755 --- a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/common_run_interface.py +++ b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/common_run_interface.py @@ -23,6 +23,7 @@ import ast import logging import math +import copy import os import re import shutil @@ -181,6 +182,23 @@ def help_add_time_of_flight(self): logger.info(' threshold option allows to change the minimal value required to') logger.info(' a non zero value for the particle (default:1e-12s)') + def help_print_results(self): + logger.info("syntax: print_results [RUN_NAME] [OPTIONS]") + logger.info("-- print the results of the previous run on the screen") + logger.info(" If not RUN_NAME is provided, the information of all run") + logger.info(" are printed one after another.") + logger.info("") + logger.info(" supported options:") + logger.info(" ------------------") + logger.info(" --format=full|short # default is full") + logger.info(" full format contains banner/... ") + logger.info(" while short is a simple multi-column format (nice for plotting)") + logger.info(" --path=") + logger.info(" allow to write the information to a file.") + logger.info(" --mode=w|a #default is w ") + logger.info(" when the information is printed to a file, you can choose ") + logger.info(" to either overwrite the file if already exists (w mode)") + logger.info(" to append the information at the end of the file (a mode)") class CheckValidForCmd(object): @@ -727,7 +745,7 @@ def __init__(self, me_dir, options, *args, **opts): if not self.proc_characteristics['ninitial']: # Get number of initial states nexternal = open(pjoin(self.me_dir,'Source','nexternal.inc')).read() - found = re.search("PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) + found = re.search(r"PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) self.ninitial = int(found.group(1)) else: self.ninitial = self.proc_characteristics['ninitial'] @@ -989,7 +1007,22 @@ def do_treatcards(self, line, amcatnlo=False): #raise Exception, "%s %s %s" % (sys.path, os.path.exists(pjoin(self.me_dir,'bin','internal', 'ufomodel')), os.listdir(pjoin(self.me_dir,'bin','internal', 'ufomodel'))) import ufomodel as ufomodel zero = ufomodel.parameters.ZERO - if self.proc_characteristics['nlo_mixed_expansion']: + no_width = [] + + if self.proc_characteristics['ew_sudakov']: + # if the sudakov approximation is used, force all particle widths to zero + # unless the complex mass scheme is used + if not self.proc_characteristics['complex_mass_scheme']: + no_width = [p for p in ufomodel.all_particles if p.width != zero] + logger.info('''Setting all particle widths to zero (needed for EW Sudakov approximation).''','$MG:BOLD') + # also, check that the model features the 'ntadpole' parameter, and set it to 1 + try: + param_card['tadpole'].get(1).value = 1. + logger.info('''Setting the value of ntadpole to 1 (needed for EW Sudakov approximation).''','$MG:BOLD') + except KeyError: + logger.warning('''The model has no 'ntadpole' parameter. The Sudakov approximation for EW corrections may give wrong results.''') + + elif self.proc_characteristics['nlo_mixed_expansion']: no_width = [p for p in ufomodel.all_particles if (str(p.pdg_code) in pids or str(-p.pdg_code) in pids) and p.width != zero] @@ -1168,17 +1201,17 @@ def detect_card_type(path): 'Begin Minpts', 'gridpack', 'ebeam1', - 'block\s+mw_run', + r'block\s+mw_run', 'BLOCK', 'DECAY', 'launch', 'madspin', - 'transfer_card\.dat', + r'transfer_card\.dat', 'set', 'main:numberofevents', # pythia8, '@MG5aMC skip_analysis', #MA5 --both-- - '@MG5aMC\s*inputs\s*=\s*\*\.(?:hepmc|lhe)', #MA5 --both-- - '@MG5aMC\s*reconstruction_name', # MA5 hadronique + r'@MG5aMC\s*inputs\s*=\s*\*\.(?:hepmc|lhe)', #MA5 --both-- + r'@MG5aMC\s*reconstruction_name', # MA5 hadronique '@MG5aMC', # MA5 hadronique 'run_rivet_later', # Rivet ] @@ -1237,7 +1270,7 @@ def detect_card_type(path): return 'madspin_card.dat' if 'decay' in text: # need to check if this a line like "decay w+" or "set decay" - if re.search("(^|;)\s*decay", fulltext, re.M): + if re.search(r"(^|;)\s*decay", fulltext, re.M): return 'madspin_card.dat' else: return 'reweight_card.dat' @@ -2074,6 +2107,12 @@ def check_multicore(self): # ensure that the run_card is present if not hasattr(self, 'run_card'): self.run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat')) + # Below reads the run_card in the LHE file rather than the Cards/run_card + import madgraph.various.lhe_parser as lhe_parser + args_path = list(args) + self.check_decay_events(args_path) + self.run_card = banner_mod.RunCard(lhe_parser.EventFile(args_path[0]).get_banner()['mgruncard']) + # we want to run this in a separate shell to avoid hard f2py crash command = [sys.executable] @@ -2085,6 +2124,12 @@ def check_multicore(self): command.append('--web') command.append('reweight') + ## TV: copy the event file as backup before starting reweighting + event_path = pjoin(self.me_dir, 'Events', self.run_name, 'events.lhe.gz') + event_path_backup = pjoin(self.me_dir, 'Events', self.run_name, 'events_orig.lhe.gz') + if os.path.exists(event_path) and not os.path.exists(event_path_backup): + shutil.copyfile(event_path, event_path_backup) + ######### START SINGLE CORE MODE ############ if self.options['nb_core']==1 or self.run_card['nevents'] < 101 or not check_multicore(self): if self.run_name: @@ -2200,7 +2245,7 @@ def check_multicore(self): cross_sections[key] = value / (nb_event+1) lhe.remove() for key in cross_sections: - if key == 'orig' or key.isdigit(): + if key == 'orig' or (key.isdigit() and not (key[0] == '2')): continue logger.info('%s : %s pb' % (key, cross_sections[key])) return @@ -2461,7 +2506,7 @@ def do_add_time_of_flight(self, line): ############################################################################ def do_print_results(self, line): - """Not in help:Print the cross-section/ number of events for a given run""" + """Print the cross-section/ number of events for a given run""" args = self.split_arg(line) options={'path':None, 'mode':'w', 'format':'full'} @@ -2942,10 +2987,15 @@ def do_rivet(self, line, postprocess=False): #2 Prepare Rivet setup environments rivet_path = self.options['rivet_path'] yoda_path = self.options['yoda_path'] + fastjet_path = subprocess.Popen([self.options['fastjet'], '--prefix'], + stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip() + set_env = set_env + "export PATH={0}:$PATH\n".format(pjoin(rivet_path, 'bin')) set_env = set_env + "export PATH={0}:$PATH\n".format(pjoin(yoda_path, 'bin')) set_env = set_env + "export LD_LIBRARY_PATH={0}:{1}:$LD_LIBRARY_PATH\n".format(pjoin(rivet_path, 'lib'), pjoin(rivet_path, 'lib64')) set_env = set_env + "export LD_LIBRARY_PATH={0}:{1}:$LD_LIBRARY_PATH\n".format(pjoin(yoda_path, 'lib'), pjoin(yoda_path, 'lib64')) + set_env = set_env + "export LD_LIBRARY_PATH={0}:$LD_LIBRARY_PATH\n".format(pjoin(self.options['hepmc_path'], 'lib')) + set_env = set_env + "export LD_LIBRARY_PATH={0}:$LD_LIBRARY_PATH\n".format(pjoin(fastjet_path, 'lib')) major, minor = sys.version_info[0:2] set_env = set_env + "export PYTHONPATH={0}:{1}:$PYTHONPATH\n".format(pjoin(rivet_path, 'lib', 'python%s.%s' %(major,minor), 'site-packages'),\ pjoin(rivet_path, 'lib64', 'python%s.%s' %(major,minor), 'site-packages')) @@ -4311,8 +4361,8 @@ def complete_compute_widths(self, text, line, begidx, endidx, formatting=True): else: completion = {} completion['options'] = self.list_completion(text, - ['--path=', '--output=', '--min_br=0.\$', '--nlo', - '--precision_channel=0.\$', '--body_decay=']) + ['--path=', '--output=', r'--min_br=0.\$', '--nlo', + r'--precision_channel=0.\$', '--body_decay=']) return self.deal_multiple_categories(completion, formatting) @@ -4821,9 +4871,9 @@ class AskforEditCard(cmd.OneLinePathCompletion): (return False to repeat the question) """ - all_card_name = ['param_card', 'run_card', 'pythia_card', 'pythia8_card', + all_card_name = ['param_card', 'run_card', 'pythia_card', 'pythia8_card', 'fo_analysis_card' 'madweight_card', 'MadLoopParams', 'shower_card', 'rivet_card'] - to_init_card = ['param', 'run', 'madweight', 'madloop', + to_init_card = ['param', 'run', 'madweight', 'madloop', 'fo_analysis', 'shower', 'pythia8','delphes','madspin', 'rivet'] special_shortcut = {} special_shortcut_help = {} @@ -4853,6 +4903,7 @@ def load_default(self): self.has_PY8 = False self.has_delphes = False self.has_rivet = False + self.has_fo_card = False self.paths = {} self.update_block = [] @@ -5058,7 +5109,8 @@ def init_run(self, cards): try: - self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning') + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning') except IOError: self.run_card = {} try: @@ -5248,6 +5300,15 @@ def init_delphes(self, cards): self.has_delphes = True return [] + def init_fo_analysis(self, cards): + self.has_fo_card = False + if not self.get_path('FO_analyse', cards): + return [] + self.has_fo_card = True + self.fo_card = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse']) + self.fo_card_def = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse_default']) + return list(self.fo_card.string_vars) + def set_CM_velocity(self, line): """compute sqrts from the velocity in the center of mass frame""" @@ -5508,6 +5569,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): allowed['delphes_card'] = '' if self.has_rivet: allowed['rivet_card'] = '' + if self.has_fo_card: + allowed['fo_card'] = '' elif len(args) == 2: if args[1] == 'run_card': @@ -5532,6 +5595,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): allowed = {'delphes_card':'default'} elif args[1] == 'rivet_card': allowed = {'rivet_card':'default'} + elif args[1] == 'fo_card': + allowed = {'fo_card':'default'} else: allowed = {'value':''} @@ -5539,6 +5604,7 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): start = 1 if args[1] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', 'MadLoop_card','pythia8_card','delphes_card','plot_card', + 'fo_card', 'madanalysis5_parton_card','madanalysis5_hadron_card', 'rivet_card']: start = 2 @@ -5576,6 +5642,8 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): categories.append('delphes_card') if self.has_rivet: categories.append('rivet_card') + if self.has_fo_card: + categories.append('fo_card') possibilities['category of parameter (optional)'] = \ self.list_completion(text, categories) @@ -5630,7 +5698,13 @@ def complete_set(self, text, line, begidx, endidx, formatting=True): if 'delphes_card' in allowed: if allowed['delphes_card'] == 'default': opts = ['default', 'atlas', 'cms'] - possibilities['Delphes Card'] = self.list_completion(text, opts) + possibilities['Delphes Card'] = self.list_completion(text, opts) + + if 'fo_card' in allowed: + opts = self.fo_card.string_vars + if allowed['fo_card'] == 'default': + opts.append('default') + possibilities['FO Card'] = self.list_completion(text, opts) if 'value' in list(allowed.keys()): opts = ['default', 'scale'] @@ -5733,21 +5807,28 @@ def do_set(self, line): if args[0] in self.special_shortcut: targettypes , cmd = self.special_shortcut[args[0]] if len(args) != len(targettypes) +1: - logger.warning('shortcut %s requires %s argument' % (args[0], len(targettypes))) - if len(args) < len(targettypes) +1: - return + if len(targettypes) == 1 and args[len(targettypes)].startswith('scan'): + args = args[:len(targettypes)] + [' '.join(args[len(targettypes):])] + targettypes = [str] else: - logger.warning('additional argument will be ignored') + logger.warning('shortcut %s requires %s argument' % (args[0], len(targettypes))) + if len(args) < len(targettypes) +1: + return + else: + logger.warning('additional argument will be ignored') values ={} for i, argtype in enumerate(targettypes): try: - values = {str(i): banner_mod.ConfigFile.format_variable(args[i+1], argtype, args[0])} + values[str(i)] = banner_mod.ConfigFile.format_variable(args[i+1], argtype, args[0]) except ValueError as e: logger.warning("Wrong argument: The entry #%s should be of type %s.", i+1, argtype) return except InvalidCmd as e: - logger.warning(str(e)) - return + if isinstance(args[i+1], str) and args[i+1].startswith('scan'): + values[str(i)] = args[i+1] + else: + logger.warning(str(e)) + return #else: # logger.warning("too many argument for this command") # return @@ -5787,7 +5868,7 @@ def do_set(self, line): if os.path.exists(pythia_path): logger.info('add line QCUT = %s in pythia_card.dat' % args[1]) p_card = open(pythia_path,'r').read() - p_card, n = re.subn('''^\s*QCUT\s*=\s*[\de\+\-\.]*\s*$''', + p_card, n = re.subn(r'''^\s*QCUT\s*=\s*[\de\+\-\.]*\s*$''', ''' QCUT = %s ''' % args[1], \ p_card, flags=(re.M+re.I)) if n==0: @@ -5801,7 +5882,7 @@ def do_set(self, line): if os.path.exists(pythia_path): logger.info('add line SHOWERKT = %s in pythia_card.dat' % args[1].upper()) p_card = open(pythia_path,'r').read() - p_card, n = re.subn('''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''', + p_card, n = re.subn(r'''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''', ''' SHOWERKT = %s ''' % args[1].upper(), \ p_card, flags=(re.M+re.I)) if n==0: @@ -5856,7 +5937,7 @@ def do_set(self, line): pjoin(self.me_dir,'Cards', 'delphes_card.dat')) return - if args[0] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', + if args[0] in ['run_card', 'param_card', 'MadWeight_card', 'shower_card', 'fo_card', 'delphes_card','madanalysis5_hadron_card','madanalysis5_parton_card','rivet_card']: if args[1] == 'default': @@ -6176,6 +6257,22 @@ def do_set(self, line): self.setRivet(args[start], value, default=default) self.rivet_card.write(self.paths['rivet'], self.paths['rivet_default']) + elif self.has_fo_card and (card in ['', 'fo_card'])\ + and args[start].lower() in [k.lower() for k in self.fo_card.string_vars]: + + if args[start] in self.conflict and card == '': + text = 'ambiguous name (present in more than one card). Please specify which card to edit' + logger.warning(text) + return + if args[start+1] == 'default': + value = self.fo_card_default[args[start]] + default = True + else: + value = args[start+1] + default = False + self.fo_card[args[start]] = value + self.modified_card.add('fo_card') + #INVALID -------------------------------------------------------------- else: logger.warning('invalid set command %s ' % line) @@ -6222,12 +6319,13 @@ def setM(self, block, name, value): def setR(self, name, value): - if self.mother_interface.inputfile: - self.run_card.set(name, value, user=True, raiseerror=True) - else: - self.run_card.set(name, value, user=True) - new_value = self.run_card.get(name) - logger.info('modify parameter %s of the run_card.dat to %s' % (name, new_value),'$MG:BOLD') + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + if self.mother_interface.inputfile: + self.run_card.set(name, value, user=True, raiseerror=True) + else: + self.run_card.set(name, value, user=True) + new_value = self.run_card.get(name) + logger.info('modify parameter %s of the run_card.dat to %s' % (name, new_value),'$MG:BOLD') def setML(self, name, value, default=False): @@ -6314,6 +6412,7 @@ def check_card_consistency(self): proc_charac = self.mother_interface.proc_characteristics if proc_charac['grouped_matrix'] and \ + isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int) and \ abs(self.run_card['lpp1']) == 1 == abs(self.run_card['lpp2']) and \ (self.run_card['nb_proton1'] != self.run_card['nb_proton2'] or self.run_card['nb_neutron1'] != self.run_card['nb_neutron2'] or @@ -6403,41 +6502,42 @@ def check_card_consistency(self): # check that only quark/gluon/photon are in initial beam if lpp=+-1 pdg_in_p = list(range(-6,7))+[21,22] - if (abs(self.run_card['lpp1'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial1'])) \ + if isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int): + if(abs(self.run_card['lpp1'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial1'])) \ or (abs(self.run_card['lpp2'])==1 and any(pdg not in pdg_in_p for pdg in proc_charac['pdg_initial2'])): - if 'pythia_card.dat' in self.cards or 'pythia8_card.dat' in self.cards: - path_to_remove = None - if 'pythia_card.dat' in self.cards: - path_to_remove = self.paths['pythia'] - card_to_remove = 'pythia_card.dat' - elif 'pythia8_card.dat' in self.cards: - path_to_remove = self.paths['pythia8'] - card_to_remove = 'pythia8_card.dat' - if path_to_remove: - if 'partonshower' in self.run_card['bypass_check']: + if 'pythia_card.dat' in self.cards or 'pythia8_card.dat' in self.cards: + path_to_remove = None + if 'pythia_card.dat' in self.cards: + path_to_remove = self.paths['pythia'] + card_to_remove = 'pythia_card.dat' + elif 'pythia8_card.dat' in self.cards: + path_to_remove = self.paths['pythia8'] + card_to_remove = 'pythia8_card.dat' + if path_to_remove: + if 'partonshower' in self.run_card['bypass_check']: + logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") + else: + logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') + os.remove(path_to_remove) + self.cards.remove(card_to_remove) + else: + logger.info('Remember that Parton-Shower are not yet ready for such proton component definition (HW implementation in progress).', '$MG:BOLD' ) + elif (abs(self.run_card['lpp1'])==3 and abs(self.run_card['lpp2'])==3): + if 'pythia8_card.dat' in self.cards: + if self.run_card['pdlabel'] == 'isronlyll': + if 'partonshower' not in self.run_card['bypass_check']: + # force that QED shower is on? + for param in ['TimeShower:QEDshowerByQ', 'TimeShower:QEDshowerByL', 'TimeShower:QEDshowerByGamma', 'SpaceShower:QEDshowerByQ', 'SpaceShower:QEDshowerByL']: + if param not in self.PY8Card or \ + (not self.PY8Card[param] and param.lower() not in self.PY8Card.user_set): + logger.warning('Activating QED shower: setting %s to True', param) + self.PY8Card[param] = True + elif 'partonshower' in self.run_card['bypass_check']: logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") - else: + else: logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') - os.remove(path_to_remove) - self.cards.remove(card_to_remove) - else: - logger.info('Remember that Parton-Shower are not yet ready for such proton component definition (HW implementation in progress).', '$MG:BOLD' ) - elif (abs(self.run_card['lpp1'])==3 and abs(self.run_card['lpp2'])==3): - if 'pythia8_card.dat' in self.cards: - if self.run_card['pdlabel'] == 'isronlyll': - if 'partonshower' not in self.run_card['bypass_check']: - # force that QED shower is on? - for param in ['TimeShower:QEDshowerByQ', 'TimeShower:QEDshowerByL', 'TimeShower:QEDshowerByGamma', 'SpaceShower:QEDshowerByQ', 'SpaceShower:QEDshowerByL']: - if param not in self.PY8Card or \ - (not self.PY8Card[param] and param.lower() not in self.PY8Card.user_set): - logger.warning('Activating QED shower: setting %s to True', param) - self.PY8Card[param] = True - elif 'partonshower' in self.run_card['bypass_check']: - logger.warning("forcing to keep parton-shower run while possibly not fully consistent... please be carefull") - else: - logger.error('Parton-Shower are not yet ready for such proton component definition. Parton-shower will be switched off.') - os.remove(self.paths['pythia8']) - self.cards.remove('pythia8_card.dat') + os.remove(self.paths['pythia8']) + self.cards.remove('pythia8_card.dat') ######################################################################## @@ -6514,7 +6614,8 @@ def check_card_consistency(self): #check relation between lepton PDF // dressed lepton collisions // ... - if abs(self.run_card['lpp1']) != 1 or abs(self.run_card['lpp2']) != 1: + if isinstance(self.run_card['lpp1'],int) and isinstance(self.run_card['lpp2'],int) and \ + abs(self.run_card['lpp1']) != 1 or abs(self.run_card['lpp2']) != 1: if abs(self.run_card['lpp1']) == abs(self.run_card['lpp2']) == 3: # this can be dressed lepton or photon-flux if proc_charac['pdg_initial1'] in [[11],[-11]] and proc_charac['pdg_initial2'] in [[11],[-11]]: @@ -6732,7 +6833,11 @@ def write_card_param(self): """ write the param_card """ self.param_card.write(self.paths['param']) - + + def write_card_fo_card(self): + """ write the fo_card""" + self.fo_card.write_card_from_template(self.paths['FO_analyse'], self.paths['FO_analyse_default']) + @staticmethod def update_dependent(mecmd, me_dir, param_card, path ,timer=0, run_card=None, lhapdfconfig=None): @@ -7076,7 +7181,7 @@ def do_decay(self, line): #first find the particle particle = line.split('>')[0].strip() logger.info("change madspin_card to define the decay of %s: %s" %(particle, line.strip()), '$MG:BOLD') - particle = particle.replace('+','\+').replace('-','\-') + particle = particle.replace('+',r'\+').replace('-',r'\-') decay_pattern = re.compile(r"^\s*decay\s+%s\s*>[\s\w+-~]*?$" % particle, re.I+re.M) text= open(path).read() text = decay_pattern.sub('', text) @@ -7193,7 +7298,7 @@ def help_edit(self, prefix=True): logger.info( ' --clean remove all previously existing line in the file') logger.info( ' --comment_line="" comment all lines matching the regular expression') logger.info('') - logger.info(' Note: all regular-expression will be prefixed by ^\s*') + logger.info(r' Note: all regular-expression will be prefixed by ^\s*') logger.info('') logger.info( ' example: edit reweight --after_line="change mode\b" change model heft') logger.info( ' edit madspin --after_line="banner" change model XXXX') @@ -7314,7 +7419,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''replace_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[14:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[14:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7344,7 +7449,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''comment_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[14:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[14:-1] nb_mod = 0 for posline,l in enumerate(split): if re.search(pattern, l): @@ -7366,7 +7471,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern=r'''before_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[13:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[13:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7383,7 +7488,7 @@ def do_add(self, line): text = open(path).read() split = text.split('\n') search_pattern = r'''after_line=(?P["'])(?:(?=(\\?))\2.)*?\1''' - pattern = '^\s*' + re.search(search_pattern, line).group()[12:-1] + pattern = r'^\s*' + re.search(search_pattern, line).group()[12:-1] for posline,l in enumerate(split): if re.search(pattern, l): break @@ -7527,16 +7632,19 @@ def open_file(self, answer): answer = 'plot' else: answer = self.cards[int(answer)-self.integer_bias] - + path = '' if 'madweight' in answer: answer = answer.replace('madweight', 'MadWeight') elif 'MadLoopParams' in answer: answer = self.paths['ML'] elif 'pythia8_card' in answer: answer = self.paths['pythia8'] + elif 'FO_analyse' in answer: + path = self.paths['FO_analyse'] + answer = 'fo_card' if os.path.exists(answer): path = answer - else: + elif not os.path.exists(path): if not '.dat' in answer and not '.lhco' in answer: if answer != 'trigger': path = self.paths[answer] @@ -7595,7 +7703,8 @@ def reload_card(self, path): logger.error('Please re-open the file and fix the problem.') logger.warning('using the \'set\' command without opening the file will discard all your manual change') elif path == self.paths['run']: - self.run_card = banner_mod.RunCard(path) + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + self.run_card = banner_mod.RunCard(path) elif path == self.paths['shower']: self.shower_card = shower_card_mod.ShowerCard(path) elif path == self.paths['ML']: @@ -7614,6 +7723,8 @@ def reload_card(self, path): except: import internal.madweight.Cards as mwcards self.mw_card = mwcards.Card(path) + elif path == self.paths['FO_analyse']: + self.fo_card = FO_analyse_card.FOAnalyseCard(self.paths['FO_analyse']) else: logger.debug('not keep in sync: %s', path) return path @@ -7629,6 +7740,9 @@ def scanparamcardhandling(input_path=lambda obj: pjoin(obj.me_dir, 'Cards', 'par iteratorclass=param_card_mod.ParamCardIterator, summaryorder=lambda obj: lambda:None, check_card=lambda obj: CommonRunCmd.static_check_param_card, + run_card_scan=False, + run_card_input= lambda obj: pjoin(obj.me_dir, 'Cards', 'run_card.dat'), + run_card_iteratorclass=banner_mod.RunCardIterator, ): """ This is a decorator for customizing/using scan over the param_card (or technically other) This should be use like this: @@ -7678,7 +7792,60 @@ def __enter__(self): def __exit__(self, ctype, value, traceback ): self.iterator.write(self.path) - def decorator(original_fct): + def scan_over_run_card(original_fct, obj, *args, **opts): + + if isinstance(input_path, str): + card_path = run_card_input + else: + card_path = run_card_input(obj) + + run_card_iterator = run_card_iteratorclass(card_path) + orig_card = copy.deepcopy(run_card_iterator.run_card) + if not run_card_iterator.run_card.scan_set: + return original_fct(obj, *args, **opts) + + + with restore_iterator(orig_card, card_path): + # this with statement ensure that the original card is restore + # whatever happens inside those block + + if not hasattr(obj, 'allow_notification_center'): + obj.allow_notification_center = False + with misc.TMP_variable(obj, 'allow_notification_center', False): + orig_name = get_run_name(obj) + if not orig_name and args[1]: + orig_name = args[1][0] + args = (args[0], args[1][1:]) + #orig_name = "scan_%s" % len(obj.results) + + try: + os.mkdir(pjoin(obj.me_dir, 'Events', orig_name)) + except Exception: + pass + next_name = orig_name + "_00" + + for i,card in enumerate(run_card_iterator): + card.write(card_path) + # still have to check for the auto-wdith + #if i !=0: + next_name = run_card_iterator.get_next_name(next_name) + set_run_name(obj)(next_name) + try: + original_fct(obj, *args, **opts) + except ignoreerror as error: + run_card_iterator.store_entry(next_name, {'exception': error}) + else: + run_card_iterator.store_entry(next_name, store_for_scan(obj)(), run_card_path=card_path) + + #param_card_iterator.write(card_path) #-> this is done by the with statement + name = misc.get_scan_name(orig_name, next_name) + path = result_path(obj) % name + logger.info("write scan results in %s" % path ,'$MG:BOLD') + order = summaryorder(obj)() + run_card_iterator.write_summary(path, order=order) + + + def decorator(original_fct): def new_fct(obj, *args, **opts): if isinstance(input_path, str): @@ -7702,8 +7869,13 @@ def new_fct(obj, *args, **opts): if not param_card_iterator: #first run of the function - original_fct(obj, *args, **opts) - return + if run_card_scan: + scan_over_run_card(original_fct, obj, *args, **opts) + return + else: + #first run of the function + original_fct(obj, *args, **opts) + return with restore_iterator(param_card_iterator, card_path): # this with statement ensure that the original card is restore diff --git a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/extended_cmd.py b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/extended_cmd.py index 2f37070580..789976beee 100755 --- a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/extended_cmd.py +++ b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/extended_cmd.py @@ -624,12 +624,12 @@ def complete(self, text, state): compfunc = self.completenames # correct wrong splittion with '\ ' - if line and begidx > 2 and line[begidx-2:begidx] == '\ ': + if line and begidx > 2 and line[begidx-2:begidx] == r'\ ': Ntext = line.split(os.path.sep)[-1] - self.completion_prefix = Ntext.rsplit('\ ', 1)[0] + '\ ' + self.completion_prefix = Ntext.rsplit(r'\ ', 1)[0] + r'\ ' to_rm = len(self.completion_prefix) - 1 Nbegidx = len(line.rsplit(os.path.sep, 1)[0]) + 1 - data = compfunc(Ntext.replace('\ ', ' '), line, Nbegidx, endidx) + data = compfunc(Ntext.replace(r'\ ', ' '), line, Nbegidx, endidx) self.completion_matches = [p[to_rm:] for p in data if len(p)>to_rm] # correct wrong splitting with '-'/"=" @@ -742,7 +742,7 @@ def path_completion(text, base_dir = None, only_dirs = False, completion += [prefix + f for f in ['.'+os.path.sep, '..'+os.path.sep] if \ f.startswith(text) and not prefix.startswith('.')] - completion = [a.replace(' ','\ ') for a in completion] + completion = [a.replace(' ',r'\ ') for a in completion] return completion @@ -1253,7 +1253,7 @@ def check_answer_in_input_file(self, question_instance, default, path=False, lin return possibility[0] if '=' in line and ' ' in line.strip(): leninit = len(line) - line,n = re.subn('\s*=\s*','=', line) + line,n = re.subn(r'\s*=\s*','=', line) if n and len(line) != leninit: return self.check_answer_in_input_file(question_instance, default, path=path, line=line) @@ -1311,7 +1311,7 @@ def nice_error_handling(self, error, line): if os.path.exists(self.debug_output): os.remove(self.debug_output) try: - super(Cmd,self).onecmd('history %s' % self.debug_output.replace(' ', '\ ')) + super(Cmd,self).onecmd('history %s' % self.debug_output.replace(' ', r'\ ')) except Exception as error: logger.error(error) @@ -2001,6 +2001,7 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): text = "" has_mg5_path = False # Use local configuration => Need to update the path + already_written = set() for line in open(basefile): if '=' in line: data, value = line.split('=',1) @@ -2018,9 +2019,12 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): comment = '' if key in to_keep: value = str(to_keep[key]) - else: + elif line not in already_written: + already_written.add(line) text += line continue + else: + continue if key == 'mg5_path': has_mg5_path = True try: @@ -2032,14 +2036,20 @@ def write_configuration(self, filepath, basefile, basedir, to_keep): # check if absolute path if not os.path.isabs(value): value = os.path.realpath(os.path.join(basedir, value)) - text += '%s = %s # %s \n' % (key, value, comment) + new_line = '%s = %s # %s \n' % (key, value, comment) + if new_line not in already_written: + text += new_line + already_written.add(new_line) for key in to_write: if key in to_keep: - text += '%s = %s \n' % (key, to_keep[key]) + new_line = '%s = %s \n' % (key, to_keep[key]) + if new_line not in already_written: + text += new_line if not MADEVENT and not has_mg5_path: - text += """\n# MG5 MAIN DIRECTORY\n""" - text += "mg5_path = %s\n" % MG5DIR + if "mg5_path = %s\n" % MG5DIR not in already_written: + text += """\n# MG5 MAIN DIRECTORY\n""" + text += "mg5_path = %s\n" % MG5DIR writer = open(filepath,'w') writer.write(text) @@ -2190,7 +2200,7 @@ def onecmd(self, line, **opt): raise def reask(self, reprint_opt=True): - pat = re.compile('\[(\d*)s to answer\]') + pat = re.compile(r'\[(\d*)s to answer\]') prev_timer = signal.alarm(0) # avoid timer if any if prev_timer: @@ -2991,7 +3001,7 @@ def question_formatting(self, nb_col = 80, lpotential_switch=0, lnb_key=0, key=None): - """should return four lines: + r"""should return four lines: 1. The upper band (typically /========\ 2. The lower band (typically \========/ 3. The line without conflict | %(nb)2d. %(descrip)-20s %(name)5s = %(switch)-10s | @@ -3239,13 +3249,13 @@ def create_question(self, help_text=True): data_to_format['conflict_switch'] = self.color_for_value(key,self.inconsistent_keys[key], consistency=False) if hidden_line: - f2 = re.sub('%(\((?:name|descrip|add_info)\)-?)(\d+)s', + f2 = re.sub(r'%(\((?:name|descrip|add_info)\)-?)(\d+)s', lambda x: '%%%s%ds' % (x.group(1),int(x.group(2))+9), f2) text.append(f2 % data_to_format) elif hidden_line: if not f3: - f3 = re.sub('%(\((?:name|descrip|add_info)\)-?)(\d+)s', + f3 = re.sub(r'%(\((?:name|descrip|add_info)\)-?)(\d+)s', lambda x: '%%%s%ds' % (x.group(1),int(x.group(2))+9), f1) text.append(f3 % data_to_format) diff --git a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/file_writers.py b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/file_writers.py index 41bff05276..526756129f 100755 --- a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/file_writers.py +++ b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/file_writers.py @@ -36,10 +36,10 @@ class FileWriter(io.FileIO): supported_preprocessor_commands = ['if'] preprocessor_command_re=re.compile( - "\s*(?P%s)\s*\(\s*(?P.*)\s*\)\s*{\s*"\ + r"\s*(?P%s)\s*\(\s*(?P.*)\s*\)\s*{\s*"\ %('|'.join(supported_preprocessor_commands))) preprocessor_endif_re=re.compile(\ - "\s*}\s*(?Pelse)?\s*(\((?P.*)\))?\s*(?P{)?\s*") + r"\s*}\s*(?Pelse)?\s*(\((?P.*)\))?\s*(?P{)?\s*") class FileWriterError(IOError): """Exception raised if an error occurs in the definition @@ -191,15 +191,15 @@ class FortranWriterError(FileWriter.FileWriterError): pass # Parameters defining the output of the Fortran writer - keyword_pairs = {'^if.+then\s*$': ('^endif', 2), - '^type(?!\s*\()\s*.+\s*$': ('^endtype', 2), - '^do(?!\s+\d+)\s+': ('^enddo\s*$', 2), - '^subroutine': ('^end\s*$', 0), - '^module': ('^end\s*$', 0), - 'function': ('^end\s*$', 0)} - single_indents = {'^else\s*$':-2, - '^else\s*if.+then\s*$':-2} - number_re = re.compile('^(?P\d+)\s+(?P.*)') + keyword_pairs = {r'^if.+then\s*$': ('^endif', 2), + r'^type(?!\s*\()\s*.+\s*$': ('^endtype', 2), + r'^do(?!\s+\d+)\s+': (r'^enddo\s*$', 2), + '^subroutine': (r'^end\s*$', 0), + '^module': (r'^end\s*$', 0), + 'function': (r'^end\s*$', 0)} + single_indents = {r'^else\s*$':-2, + r'^else\s*if.+then\s*$':-2} + number_re = re.compile(r'^(?P\d+)\s+(?P.*)') line_cont_char = '$' comment_char = 'c' uniformcase = True #force everyting to be lower/upper case @@ -212,7 +212,7 @@ class FortranWriterError(FileWriter.FileWriterError): # Private variables __indent = 0 __keyword_list = [] - __comment_pattern = re.compile(r"^(\s*#|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|!)", re.IGNORECASE) + __comment_pattern = re.compile(r"^(\s*#|c\$|c$|(c\s+([^=]|$))|cf2py|c\-\-|c\*\*|\s*!|!\$)", re.IGNORECASE) __continuation_line = re.compile(r"(?: )[$&]") def write_line(self, line): @@ -424,26 +424,20 @@ def count_number_of_quotes(self, line): i = i + 1 return len(splitline)-1 - def remove_routine(self, text, fct_names, formatting=True): - """write the incoming text but fully removing the associate routine/function - text can be a path to a file, an iterator, a string - fct_names should be a list of functions to remove + @staticmethod + def get_routine(text, fct_names, call_back=None): + """ + get the fortran function from a fortran file """ - f77_type = ['real*8', 'integer', 'double precision', 'logical'] - pattern = re.compile('^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ + pattern = re.compile(r'^\s+(?:SUBROUTINE|(?:%(type)s)\s+function)\s+([a-zA-Z]\w*)' \ % {'type':'|'.join(f77_type)}, re.I) - + + if isinstance(text, str): + text = text.split('\n') + + to_write=False removed = [] - if isinstance(text, str): - if '\n' in text: - text = text.split('\n') - else: - text = open(text) - if isinstance(fct_names, str): - fct_names = [fct_names] - - to_write=True for line in text: fct = pattern.findall(line) if fct: @@ -451,22 +445,38 @@ def remove_routine(self, text, fct_names, formatting=True): to_write = False else: to_write = True - if to_write: - if formatting: - if line.endswith('\n'): - line = line[:-1] - self.writelines(line) - else: - if not line.endswith('\n'): - line = '%s\n' % line - super(FileWriter,self).writelines(line) + if call_back: + call_back(line) else: removed.append(line) - + return removed + + def remove_routine(self, text, fct_names, formatting=True): + """write the incoming text but fully removing the associate routine/function + text can be a path to a file, an iterator, a string + fct_names should be a list of functions to remove + """ + + def call_back(line): + if formatting: + if line.endswith('\n'): + line = line[:-1] + self.writelines(line) + else: + if not line.endswith('\n'): + line = '%s\n' % line + super(FileWriter,self).writelines(line) + + return self.get_routine(text, fct_names, call_back) + +class FortranWriter90(FortranWriter): + + comment_char = ' !' + #=============================================================================== # CPPWriter #=============================================================================== @@ -497,50 +507,50 @@ class CPPWriterError(FileWriter.FileWriterError): '^private': standard_indent, '^protected': standard_indent} - spacing_patterns = [ - ('\s*\"\s*}', '\"'), - ('\s*,\s*', ', '), - ('\s*-\s*', ' - '), - ('([{(,=])\s*-\s*', '\g<1> -'), - ('(return)\s*-\s*', '\g<1> -'), - ('\s*\+\s*', ' + '), - ('([{(,=])\s*\+\s*', '\g<1> +'), - ('\(\s*', '('), - ('\s*\)', ')'), - ('\{\s*', '{'), - ('\s*\}', '}'), - ('\s*=\s*', ' = '), - ('\s*>\s*', ' > '), - ('\s*<\s*', ' < '), - ('\s*!\s*', ' !'), - ('\s*/\s*', '/'), - ('(?\s+>\s*', ' >> '), - ('<\s*double\s*>>\s*', ' > '), - ('\s*<\s+<\s*', ' << '), - ('\s*-\s+>\s*', '->'), - ('\s*=\s+=\s*', ' == '), - ('\s*!\s+=\s*', ' != '), - ('\s*>\s+=\s*', ' >= '), - ('\s*<\s+=\s*', ' <= '), - ('\s*&&\s*', ' && '), - ('\s*\|\|\s*', ' || '), - ('\s*{\s*}', ' {}'), - ('\s*;\s*', '; '), - (';\s*\}', ';}'), - (';\s*$}', ';'), - ('\s*<\s*([a-zA-Z0-9]+?)\s*>', '<\g<1>>'), - ('^#include\s*<\s*(.*?)\s*>', '#include <\g<1>>'), - ('(\d+\.{0,1}\d*|\.\d+)\s*[eE]\s*([+-]{0,1})\s*(\d+)', - '\g<1>e\g<2>\g<3>'), - ('\s+',' '), - ('^\s*#','#')] + spacing_patterns = [(r'\s*\"\s*}', '\"'), + (r'\s*,\s*', ', '), + (r'\s*-\s*', ' - '), + (r'([{(,=])\s*-\s*', r'\g<1> -'), + (r'(return)\s*-\s*', r'\g<1> -'), + (r'\s*\+\s*', ' + '), + (r'([{(,=])\s*\+\s*', r'\g<1> +'), + (r'\(\s*', '('), + (r'\s*\)', ')'), + (r'\{\s*', '{'), + (r'\s*\}', '}'), + (r'\s*=\s*', ' = '), + (r'\s*>\s*', ' > '), + (r'\s*<\s*', ' < '), + (r'\s*!\s*', ' !'), + (r'\s*/\s*', '/'), + (r'\s*\*\s*', ' * '), + (r'\s*-\s+-\s*', '-- '), + (r'\s*\+\s+\+\s*', '++ '), + (r'\s*-\s+=\s*', ' -= '), + (r'\s*\+\s+=\s*', ' += '), + (r'\s*\*\s+=\s*', ' *= '), + (r'\s*/=\s*', ' /= '), + (r'\s*>\s+>\s*', ' >> '), + (r'<\s*double\s*>>\s*', ' > '), + (r'\s*<\s+<\s*', ' << '), + (r'\s*-\s+>\s*', '->'), + (r'\s*=\s+=\s*', ' == '), + (r'\s*!\s+=\s*', ' != '), + (r'\s*>\s+=\s*', ' >= '), + (r'\s*<\s+=\s*', ' <= '), + (r'\s*&&\s*', ' && '), + (r'\s*\|\|\s*', ' || '), + (r'\s*{\s*}', ' {}'), + (r'\s*;\s*', '; '), + (r';\s*\}', ';}'), + (r';\s*$}', ';'), + (r'\s*<\s*([a-zA-Z0-9]+?)\s*>', r'<\g<1>>'), + (r'^#include\s*<\s*(.*?)\s*>', r'#include <\g<1>>'), + (r'(\d+\.{0,1}\d*|\.\d+)\s*[eE]\s*([+-]{0,1})\s*(\d+)', + r'\g<1>e\g<2>\g<3>'), + (r'\s+',' '), + (r'^\s*#','#')] + spacing_re = dict([(key[0], re.compile(key[0])) for key in \ spacing_patterns]) diff --git a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/gen_crossxhtml.py b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/gen_crossxhtml.py index d58ec573bc..681bf9d09b 100755 --- a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/gen_crossxhtml.py +++ b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/gen_crossxhtml.py @@ -648,7 +648,7 @@ def recreate(self, banner): if run_card['ickkw'] != 0: #parse the file to have back the information pythia_log = misc.BackRead(pjoin(path, '%s_pythia.log' % tag)) - pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") + pythiare = re.compile(r"\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") for line in pythia_log: info = pythiare.search(line) if not info: @@ -1623,7 +1623,7 @@ def get_html(self, runresults): elif self.debug: text = str(self.debug).replace('. ','.
') if 'http' in text: - pat = re.compile('(http[\S]*)') + pat = re.compile(r'(http[\S]*)') text = pat.sub(r' here ', text) debug = '
%s
%s
' % \ (self.debug.__class__.__name__, text) diff --git a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/gen_ximprove.py b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/gen_ximprove.py index c86da36a05..415ecc9de0 100755 --- a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/gen_ximprove.py +++ b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/gen_ximprove.py @@ -158,8 +158,11 @@ def get_helicity(self, to_submit=True, clean=True): (stdout, _) = p.communicate(''.encode()) stdout = stdout.decode('ascii',errors='ignore') if stdout: - nb_channel = max([math.floor(float(d)) for d in stdout.split()]) + lines = stdout.strip().split('\n') + nb_channel = max([math.floor(float(d)) for d in lines[-1].split()]) else: + if os.path.exists(pjoin(self.me_dir, 'error')): + os.remove(pjoin(self.me_dir, 'error')) for matrix_file in misc.glob('matrix*orig.f', Pdir): files.cp(matrix_file, matrix_file.replace('orig','optim')) P_zero_result.append(Pdir) @@ -297,12 +300,14 @@ def get_helicity(self, to_submit=True, clean=True): bad_amps_perhel = [] if __debug__: mtext = open(matrix_file).read() - nb_amp = int(re.findall('PARAMETER \(NGRAPHS=(\d+)\)', mtext)[0]) - logger.debug('nb_hel: %s zero amp: %s bad_amps_hel: %s/%s', len(good_hels),len(bad_amps),len(bad_amps_perhel), len(good_hels)*nb_amp ) + nb_amp = int(re.findall(r'PARAMETER \(NGRAPHS=(\d+)\)', mtext)[0]) + logger.debug('(%s) nb_hel: %s zero amp: %s bad_amps_hel: %s/%s', split_file[-1], len(good_hels),len(bad_amps),len(bad_amps_perhel), len(good_hels)*nb_amp ) if len(good_hels) == 1: files.cp(matrix_file, matrix_file.replace('orig','optim')) continue # avoid optimization if onlye one helicity - recycler = hel_recycle.HelicityRecycler(good_hels, bad_amps, bad_amps_perhel) + + gauge = self.cmd.proc_characteristics['gauge'] + recycler = hel_recycle.HelicityRecycler(good_hels, bad_amps, bad_amps_perhel, gauge=gauge) # In case of bugs you can play around with these: recycler.hel_filt = self.run_card['hel_filtering'] recycler.amp_splt = self.run_card['hel_splitamp'] @@ -1299,7 +1304,7 @@ def get_job_for_event(self): 'script_name': 'unknown', 'directory': C.name, # need to be change for splitted job 'P_dir': C.parent_name, - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # needed for RO gridpack 'offset': 1, # need to be change for splitted job 'nevents': nevents, 'maxiter': self.max_iter, @@ -1387,7 +1392,7 @@ def create_ajob(self, template, jobs, write_dir=None): break info = jobs[j] info['script_name'] = 'ajob%i' % script_number - info['keeplog'] = 'false' + info['keeplog'] = 'false' if self.run_card['keep_log'] != 'debug' else 'true' if "base_directory" not in info: info["base_directory"] = "./" fsock.write(template_text % info) @@ -1456,7 +1461,7 @@ def get_job_for_precision(self): 'script_name': 'unknown', 'directory': C.name, # need to be change for splitted job 'P_dir': C.parent_name, - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # used for RO gridpack 'offset': 1, # need to be change for splitted job 'nevents': nevents, 'maxiter': self.max_iter, @@ -1916,7 +1921,7 @@ def get_job_for_event(self): 'directory': C.name, # need to be change for splitted job 'P_dir': os.path.basename(C.parent_name), 'offset': 1, # need to be change for splitted job - #'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), + 'Ppath': pjoin(self.cmd.me_dir, 'SubProcesses', C.parent_name), # use for RO gridpack 'nevents': nevents, #int(nevents*self.gen_events_security)+1, 'maxiter': self.max_iter, 'miniter': self.min_iter, diff --git a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/hel_recycle.py b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/hel_recycle.py index dfa45d5d20..6c86611f68 100755 --- a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/hel_recycle.py +++ b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/hel_recycle.py @@ -383,7 +383,7 @@ def get_number(cls, *args): class HelicityRecycler(): '''Class for recycling helicity''' - def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[]): + def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[], gauge='U'): External.good_hel = [] External.nhel_lines = '' @@ -427,6 +427,7 @@ def __init__(self, good_elements, bad_amps=[], bad_amps_perhel=[]): self.all_hel = [] self.hel_filt = True + self.gauge = gauge def set_input(self, file): if 'born_matrix' in file: @@ -612,7 +613,7 @@ def unfold_helicities(self, line, nature): def apply_amps(self, line, new_objs): if self.amp_splt: - return split_amps(line, new_objs) + return split_amps(line, new_objs, gauge=self.gauge) else: return apply_args(line, [i.args for i in new_objs]) @@ -785,7 +786,7 @@ def apply_args(old_line, all_the_args): return ''.join(new_lines) -def split_amps(line, new_amps): +def split_amps(line, new_amps, gauge): if not new_amps: return '' fct = line.split('(',1)[0].split('_0')[0] @@ -841,34 +842,31 @@ def split_amps(line, new_amps): spin = fct.split(None,1)[1][to_remove] lines.append('%sP1N_%s(%s)' % (fct, to_remove+1, ', '.join(args))) - hel, iamp = re.findall('AMP\((\d+),(\d+)\)', amp_result)[0] + hel, iamp = re.findall(r'AMP\((\d+),(\d+)\)', amp_result)[0] hel_calculated.append(hel) #lines.append(' %(result)s = TMP(3) * W(3,%(w)s) + TMP(4) * W(4,%(w)s)+' # % {'result': amp_result, 'w': windex}) #lines.append(' & TMP(5) * W(5,%(w)s)+TMP(6) * W(6,%(w)s)' # % {'result': amp_result, 'w': windex}) - if spin in "VF": - lines.append(""" call CombineAmp(%(nb)i, - & (/%(hel_list)s/), - & (/%(w_list)s/), - & TMP, W, AMP(1,%(iamp)s))""" % - {'nb': len(sub_amps), - 'hel_list': ','.join(hel_calculated), - 'w_list': ','.join(windices), - 'iamp': iamp - }) + if spin == "F" or ( spin == "V" and gauge !='FD'): + suffix = '' elif spin == "S": - lines.append(""" call CombineAmpS(%(nb)i, - &(/%(hel_list)s/), - & (/%(w_list)s/), - & TMP, W, AMP(1,%(iamp)s))""" % - {'nb': len(sub_amps), - 'hel_list': ','.join(hel_calculated), - 'w_list': ','.join(windices), - 'iamp': iamp - }) + suffix = 'S' + elif spin == "V" and gauge == "FD": + suffix = "FD" else: - raise Exception("split amp are not supported for spin2 and 3/2") + raise Exception("split amp not supported for spin2, 3/2") + + lines.append(""" call CombineAmp%(suffix)s(%(nb)i, + & (/%(hel_list)s/), + & (/%(w_list)s/), + & TMP, W, AMP(1,%(iamp)s))""" % {'suffix':suffix, + 'nb': len(sub_amps), + 'hel_list': ','.join(hel_calculated), + 'w_list': ','.join(windices), + 'iamp': iamp + }) + #lines.append('') return '\n'.join(lines) diff --git a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/histograms.py b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/histograms.py index 98f22c4c3a..9931127f66 100755 --- a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/histograms.py +++ b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/histograms.py @@ -632,34 +632,34 @@ class HwU(Histogram): # than necessary because the HwU standard allows for spaces from within # the name of a weight weight_header_re = re.compile( - '&\s*(?P(\S|(\s(?!\s*(&|$))))+)(\s(?!(&|$)))*') + r'&\s*(?P(\S|(\s(?!\s*(&|$))))+)(\s(?!(&|$)))*') # ================================ # Histo weight specification RE's # ================================ # The start of a plot - histo_start_re = re.compile('^\s*\s*(?P\d+)\s*"\s*'+ - '(?P(\S|(\s(?!\s*")))+)\s*"\s*$') + histo_start_re = re.compile(r'^\s*\s*(?P\d+)\s*"\s*'+ + r'(?P(\S|(\s(?!\s*")))+)\s*"\s*$') # A given weight specifier - a_float_re = '[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' - histo_bin_weight_re = re.compile('(?P%s|NaN)'%a_float_re,re.IGNORECASE) - a_int_re = '[\+|-]?\d+' + a_float_re = r'[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' + histo_bin_weight_re = re.compile(r'(?P%s|NaN)'%a_float_re,re.IGNORECASE) + a_int_re = r'[\+|-]?\d+' # The end of a plot histo_end_re = re.compile(r'^\s*<\\histogram>\s*$') # A scale type of weight - weight_label_scale = re.compile('^\s*mur\s*=\s*(?P%s)'%a_float_re+\ - '\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) - weight_label_PDF = re.compile('^\s*PDF\s*=\s*(?P\d+)\s*$') - weight_label_PDF_XML = re.compile('^\s*pdfset\s*=\s*(?P\d+)\s*$') - weight_label_TMS = re.compile('^\s*TMS\s*=\s*(?P%s)\s*$'%a_float_re) - weight_label_alpsfact = re.compile('^\s*alpsfact\s*=\s*(?P%s)\s*$'%a_float_re, + weight_label_scale = re.compile(r'^\s*mur\s*=\s*(?P%s)'%a_float_re+\ + r'\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) + weight_label_PDF = re.compile(r'^\s*PDF\s*=\s*(?P\d+)\s*$') + weight_label_PDF_XML = re.compile(r'^\s*pdfset\s*=\s*(?P\d+)\s*$') + weight_label_TMS = re.compile(r'^\s*TMS\s*=\s*(?P%s)\s*$'%a_float_re) + weight_label_alpsfact = re.compile(r'^\s*alpsfact\s*=\s*(?P%s)\s*$'%a_float_re, re.IGNORECASE) - weight_label_scale_adv = re.compile('^\s*dyn\s*=\s*(?P%s)'%a_int_re+\ - '\s*mur\s*=\s*(?P%s)'%a_float_re+\ - '\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) - weight_label_PDF_adv = re.compile('^\s*PDF\s*=\s*(?P\d+)\s+(?P\S+)\s*$') + weight_label_scale_adv = re.compile(r'^\s*dyn\s*=\s*(?P%s)'%a_int_re+\ + r'\s*mur\s*=\s*(?P%s)'%a_float_re+\ + r'\s*muf\s*=\s*(?P%s)\s*$'%a_float_re,re.IGNORECASE) + weight_label_PDF_adv = re.compile(r'^\s*PDF\s*=\s*(?P\d+)\s+(?P\S+)\s*$') class ParseError(MadGraph5Error): @@ -926,7 +926,7 @@ def get_HwU_source(self, print_header=True): res.append(' '.join('%+16.7e'%wgt for wgt in list(bin.boundaries))) res[-1] += ' '.join('%+16.7e'%bin.wgts[key] for key in self.bins.weight_labels if key not in ['central','stat_error']) - res.append('<\histogram>') + res.append(r'<\histogram>') return res def output(self, path=None, format='HwU', print_header=True): @@ -1149,6 +1149,8 @@ def parse_one_histo_from_stream(self, stream, all_weight_header, boundaries = [0.0,0.0] for j, weight in \ enumerate(HwU.histo_bin_weight_re.finditer(line_bin)): + if (j == len(weight_header)): + continue if j == len(all_weight_header): raise HwU.ParseError("There is more bin weights"+\ " specified than expected (%i)"%len(weight_header)) @@ -1803,7 +1805,7 @@ def parse_histos_from_PY8_XML_stream(self, stream, run_id=None, # Filter empty weights coming from the split weight_label_list = [wgt.strip() for wgt in str(selected_run_node.getAttribute('header')).split(';') if - not re.match('^\s*$',wgt)] + not re.match(r'^\s*$',wgt)] ordered_weight_label_list = [w for w in weight_label_list if w not\ in ['xmin','xmax']] # Remove potential repetition of identical weight labels @@ -1827,7 +1829,7 @@ def parse_histos_from_PY8_XML_stream(self, stream, run_id=None, all_weights = [] for wgt_position, wgt_label in \ enumerate(str(selected_run_node.getAttribute('header')).split(';')): - if not re.match('^\s*$',wgt_label) is None: + if not re.match(r'^\s*$',wgt_label) is None: continue all_weights.append({'POSITION':wgt_position}) for wgt_item in wgt_label.strip().split('_'): @@ -2714,7 +2716,7 @@ def ratio_no_correlations(wgtsA, wgtsB): # First the global gnuplot header for this histogram group global_header =\ -""" +r""" ################################################################################ ### Rendering of the plot titled '%(title)s' ################################################################################ @@ -2862,9 +2864,9 @@ def ratio_no_correlations(wgtsA, wgtsB): major_title = ', '.join(major_title) if not mu[0] in ['none',None]: - major_title += ', dynamical\_scale\_choice=%s'%mu[0] + major_title += r', dynamical\_scale\_choice=%s'%mu[0] if not pdf[0] in ['none',None]: - major_title += ', PDF=%s'%pdf[0].replace('_','\_') + major_title += ', PDF=%s'%pdf[0].replace('_',r'\_') # Do not show uncertainties for individual jet samples (unless first # or specified explicitely and uniquely) @@ -2937,7 +2939,7 @@ def ratio_no_correlations(wgtsA, wgtsB): plot_lines.append( "'%s' index %d using (($1+$2)/2):%d ls %d title '%s'"\ %(HwU_name,block_position+i,mu_var+3,color_index,\ -'%s dynamical\_scale\_choice=%s' % (title,mu[j]))) +r'%s dynamical\_scale\_choice=%s' % (title,mu[j]))) # And now PDF_variation if available if not PDF_var_pos is None: for j,PDF_var in enumerate(PDF_var_pos): @@ -2947,7 +2949,7 @@ def ratio_no_correlations(wgtsA, wgtsB): plot_lines.append( "'%s' index %d using (($1+$2)/2):%d ls %d title '%s'"\ %(HwU_name,block_position+i,PDF_var+3,color_index,\ -'%s PDF=%s' % (title,pdf[j].replace('_','\_')))) +'%s PDF=%s' % (title,pdf[j].replace('_',r'\_')))) # Now add the uncertainty lines, those not using a band so that they # are not covered by those using a band after we reverse plo_lines diff --git a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/launch_plugin.py b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/launch_plugin.py index 7b10bedcef..9ec09eb71d 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/launch_plugin.py +++ b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/launch_plugin.py @@ -98,6 +98,7 @@ def default_setup(self): self['vector_size'] = 16 # already setup in default class (just change value) self['aloha_flag'] = '--fast-math' self['matrix_flag'] = '-O3' + self['limhel'] = 0 self.display_block.append('simd') self.display_block.append('psoptim') diff --git a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/lhe_parser.py b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/lhe_parser.py index eee9ba4522..f6e47956cd 100755 --- a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/lhe_parser.py +++ b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/lhe_parser.py @@ -7,6 +7,7 @@ import numbers import math import time +import copy import os import shutil import sys @@ -101,7 +102,7 @@ def __init__(self, line=None, event=None): self.rwgt = 0 return - + self.event = event if event is not None: self.event_id = len(event) #not yet in the event @@ -1066,6 +1067,8 @@ def define_init_banner(self, wgt, lha_strategy, proc_charac=None): #special case for 1>N init_information = run_card.get_banner_init_information() event = next(self) + if not len(event): #if parse-momenta was false we have to parse the first event + event = Event(str(event)) init_information["idbmup1"] = event[0].pdg init_information["ebmup1"] = event[0].mass init_information["idbmup2"] = 0 @@ -1149,6 +1152,7 @@ def initialize_unweighting(self, getwgt, trunc_error): nb_keep = max(20, int(nb_event*trunc_error*15)) new_wgt = new_wgt[-nb_keep:] if nb_event == 0: + misc.sprint(i,f) raise Exception # store the information self.initial_nb_events[i] = nb_event @@ -1203,7 +1207,6 @@ def unweight(self, outputpath, get_wgt, **opts): (stop to write event when target is reached) """ - if isinstance(get_wgt, (str,six.text_type)): unwgt_name =get_wgt def get_wgt_multi(event): @@ -1483,12 +1486,12 @@ def reorder_mother_child(self): particle.mother2 -= 1 # re-call the function for the next potential change return self.reorder_mother_child() - - - - - + + + + + def parse_reweight(self): """Parse the re-weight information in order to return a dictionary {key: value}. If no group is define group should be '' """ @@ -1522,6 +1525,37 @@ def parse_nlo_weight(self, real_type=(1,11), threshold=None): threshold=threshold) return self.nloweight + def get_fks_pair(self, real_type=(1,11), threshold=None): + """ Gives the fks pair labels""" + start, stop = self.tag.find(''), self.tag.find('') + if start != -1 != stop: + text = self.tag[start+8:stop] + all_line = text.split('\n') + text = text.lower().replace('d','e') + all_line = text.split('\n') + for line in all_line: + data = line.split() + if len(data)>16: + wgt = OneNLOWeight(line, real_type=real_type) + return wgt.to_merge_pdg,wgt.nexternal + + def get_born_momenta(self,real_type=(1,11), threshold=None): + """ Gets the underlying n+1 body kinematics""" + start, stop = self.tag.find(''), self.tag.find('') + if start != -1 != stop: + text = self.tag[start+8:stop] + text = text.lower().replace('d','e') + all_line = text.split('\n') + for line in all_line: + data = line.split() + if len(data)>16: + wgt = OneNLOWeight(line, real_type=real_type) + nexternal = wgt.nexternal + real_momenta = all_line[2:2+nexternal] + return real_momenta + + + def rewrite_nlo_weight(self, wgt=None): """get the string associate to the weight""" @@ -1558,11 +1592,11 @@ def parse_lo_weight(self): return self.loweight if not hasattr(Event, 'loweight_pattern'): - Event.loweight_pattern = re.compile('''\s*(?P\d+)\s+(?P[\d.e+-]+)\s*\s*\n\s* - \s*(?P[\s\d.+-e]+)\s*\s*\n\s* - 1|2)["']?\>\s*(?P[\s\d.e+-]*)\s*\s*\n\s* - 1|2)["']?\>\s*(?P[\s\d.e+-]*)\s*\s*\n\s* - \s*(?P[\d.e+-]*)\s* + Event.loweight_pattern = re.compile('''\\s*(?P\\d+)\\s+(?P[\\d.e+-]+)\\s*\\s*\n\\s* + \\s*(?P[\\s\\d.+-e]+)\\s*\\s*\n\\s* + 1|2)["']?\\>\\s*(?P[\\s\\d.e+-]*)\\s*\\s*\n\\s* + 1|2)["']?\\>\\s*(?P[\\s\\d.e+-]*)\\s*\\s*\n\\s* + \\s*(?P[\\d.e+-]*)\\s* ''',re.X+re.I+re.M) start, stop = self.tag.find(''), self.tag.find('') @@ -1615,7 +1649,7 @@ def parse_matching_scale(self): self.matched_scale_data = [] - pattern = re.compile("") + pattern = re.compile(r"") data = re.split(pattern,self.tag) if len(data) == 1: return [] @@ -1623,7 +1657,7 @@ def parse_matching_scale(self): tmp = {} start,content, end = data self.tag = "%s%s" % (start, end) - pattern = re.compile("pt_clust_(\d*)=\"([\de+-.]*)\"") + pattern = re.compile("pt_clust_(\\d*)=\"([\\de+-.]*)\"") for id,value in pattern.findall(content): tmp[int(id)] = float(value) for i in range(1, len(self)+1): @@ -1647,7 +1681,7 @@ def parse_syscalc_info(self): return self.syscalc_data pattern = re.compile("|") - pattern2 = re.compile("<(?P[\w]*)(?:\s*(\w*)=[\"'](.*)[\"']\s*|\s*)>(.*)") + pattern2 = re.compile("<(?P[\\w]*)(?:\\s*(\\w*)=[\"'](.*)[\"']\\s*|\\s*)>(.*)") data = re.split(pattern,self.tag) if len(data) == 1: return [] @@ -1850,6 +1884,240 @@ def get_decay(self, pdg_code=0, event_id=None): return new_event + + def set_initial_mass_to_zero(self): + """set the masses of the initial particles to zero, by reshuffling the respective momenta + Works only in the **partonic** com frame, so the event must be boosted to such frame + before calling the function + """ + + if not misc.equal(self[0].px, 0) or not misc.equal(self[1].px, 0) or \ + not misc.equal(self[0].py, 0) or not misc.equal(self[1].py, 0) or \ + not misc.equal(self[0].pz, - self[1].pz, zero_limit=False): + misc.sprint(self[0]) + misc.sprint(self[1]) + raise Exception('momenta should be in the partonic center of mass frame') + + self[0].mass = 0. + self[1].mass = 0. + tot_E=0. + for ip,part in enumerate(self): + if part.status == 1 : + tot_E += part.E + if (self[0].pz > 0. and self[1].pz < 0): + self[0].set_momentum(FourMomentum([tot_E/2., 0., 0., tot_E/2.])) + self[1].set_momentum(FourMomentum([tot_E/2., 0., 0., -tot_E/2.])) + elif (self[0].pz < 0. and self[1].pz > 0): + self[0].set_momentum(FourMomentum([tot_E/2., 0., 0., -tot_E/2.])) + self[1].set_momentum(FourMomentum([tot_E/2., 0., 0., tot_E/2.])) + else: + logger.critical('ERROR: two incoming partons not back.-to-back') + + def set_final_jet_mass_to_zero(self): + """set the final light particle masses to zero + """ + + for ip,part in enumerate(self): + if ((abs(part.pid) <= 5) or (abs(part.pid) == 11) or (abs(part.pid) == 12)) and (part.status == 1): + part.mass = 0. + E_1_new = math.sqrt(part.mass**2 + part.px**2 + part.py**2 + part.pz**2) + part.set_momentum(FourMomentum([E_1_new, part.px, part.py, part.pz])) + + + + def merge_particles_kinematics(self, i,j, moth): + """Map to an underlying n-body kinematics for two given + particles i,j to be merged and a resulting moth""" + """ note! kinematics (and id) mapping only! """ + + recoil = True + fks_type = False + + if recoil and not fks_type: + if (i == moth[0].get('number')-1): + fks_i = i + fks_j = j + elif (j == moth[0].get('number')-1): + fks_i = j + fks_j = i + to_remove = fks_j + + merge_i = self[fks_i] + merge_j = self[fks_j] + + i_4mom = FourMomentum(merge_i) + j_4mom = FourMomentum(merge_j) + if (fks_i <= 1): + sign1 = -1.0 + else: + sign1 = 1.0 + mother_4mom = i_4mom + sign1*j_4mom + + new_event = copy.deepcopy(self) + + self[fks_i].pid = moth[0]['id'] + self[fks_i].set_momentum(mother_4mom) + + if fks_i <= 1: # initial-state recoil + new_p = FourMomentum() + for ip,part in enumerate(self): + if (ip != fks_i and ip != fks_j and ip >= 2): + new_p += part + + if fks_i == 0: + self[1].set_momentum(new_p - FourMomentum(self[0])) + elif fks_i == 1: + self[0].set_momentum(new_p - FourMomentum(self[1])) + + pz_1_new = self.recoil_eq(self[0],self[1]) + pz_2_new = self[0].pz + self[1].pz - pz_1_new + E_1_new = math.sqrt(self[0].mass**2 + self[0].px**2 + self[0].py**2 + pz_1_new **2) + E_2_new = math.sqrt(self[1].mass**2 + self[1].px**2 + self[1].py**2 + pz_2_new **2) + self[0].set_momentum(FourMomentum([E_1_new,self[0].px,self[0].py,pz_1_new])) + self[1].set_momentum(FourMomentum([E_2_new,self[1].px,self[1].py,pz_2_new])) + self.pop(to_remove) + + if fks_i > 1: # final-state recoil + + # Re-scale the energy of fks_i to make it on-shell + for ip,part in enumerate(self): + if (ip == fks_i): + part.E = math.sqrt(part.mass**2 + part.px**2 + part.py**2 + part.pz**2) + new_p.E = part.E + + # Find the overall energy in the final state + new_p.E = 0.0 + for ip,part in enumerate(self): + if (ip != fks_j and ip >= 2): + new_p.E += part.E + + # Use one of the initial states to absorb the energy change in the final state + self[1].set_momentum(FourMomentum([new_p.E-self[0].E,self[1].px,self[1].py,self[1].pz])) + + # Change the initial state pz and E + pz_1_new = self.recoil_eq(self[0],self[1]) + pz_2_new = self[0].pz + self[1].pz - pz_1_new + E_1_new = math.sqrt(self[0].mass**2 + self[0].px**2 + self[0].py**2 + pz_1_new **2) + E_2_new = math.sqrt(self[1].mass**2 + self[1].px**2 + self[1].py**2 + pz_2_new **2) + self[0].set_momentum(FourMomentum([E_1_new,self[0].px,self[0].py,pz_1_new])) + self[1].set_momentum(FourMomentum([E_2_new,self[1].px,self[1].py,pz_2_new])) + self.pop(to_remove) + + elif fks_type and not recoil: + ## Do it in a more FKS-style + if (i == moth[0].get('number')-1): + fks_i = i + fks_j = j + elif (j == moth[0].get('number')-1): + fks_i = j + fks_j = i + to_remove = fks_j + new_event = copy.copy(event) + + if fks_i <= 1: # initial-state recoil + + # First boost to partonic CM frame + q = FourMomentum(self[0])+FourMomentum(self[1]) + for ip,part in enumerate(self): + vec = FourMomentum(part) + self[ip].set_momentum(vec.zboost(pboost=q)) + + k_tot = FourMomentum([self[0].E+self[1].E-self[fks_j].E,self[0].px+self[1].px-self[fks_j].px,\ + self[0].py+self[1].py-self[fks_j].py,self[0].pz+self[1].pz-self[fks_j].pz]) + + final = FourMomentum([0,0,0,0]) + for ip,part in enumerate(self): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + if (ip != fks_i and ip != fks_j and ip >= 2): + final = final + vec + + s = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz])**2 + ksi = self[fks_j].E/(math.sqrt(s)/2.0) + y = self[fks_j].pz/self[fks_j].E + + self[0].pz = self[0].pz * math.sqrt(1.0-ksi)*math.sqrt((2.0-ksi*(1.0+y))/((2.0-ksi*(1.0-y)))) + self[0].E = math.sqrt(self[0].mass**2 + self[0].pz**2) + self[1].pz = self[1].pz * math.sqrt(1.0-ksi)*math.sqrt((2.0-ksi*(1.0-y))/((2.0-ksi*(1.0+y)))) + self[1].E = math.sqrt(self[1].mass**2 + self[1].pz**2) + + final = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + k_tot_1 = k_tot.zboost(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + k_tot_2 = k_tot_1.pt_boost(pboost=FourMomentum([k_tot_1.E,k_tot_1.px,k_tot_1.py,k_tot_1.pz])) + k_tot_3 = k_tot_2.zboost_inv(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + + for ip,part in enumerate(self): + if (ip >= 2): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + vec2 = vec.zboost(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + vec3 = vec2.pt_boost(pboost=FourMomentum([k_tot_1.E,k_tot_1.px,k_tot_1.py,k_tot_1.pz])) + vec_new = vec3.zboost_inv(pboost=FourMomentum([k_tot.E,k_tot.px,k_tot.py,k_tot.pz])) + self[ip].set_momentum(FourMomentum([vec_new.E,vec_new.px,vec_new.py,vec_new.pz])) + + self.pop(to_remove) + + else: # final-state recoil + q = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + for ip,part in enumerate(self): + vec = FourMomentum([part.E,part.px,part.py,part.pz]) + self[ip].set_momentum(vec.zboost(pboost=q)) + + q = FourMomentum([self[0].E+self[1].E,self[0].px+self[1].px,\ + self[0].py+self[1].py,self[0].pz+self[1].pz]) + + k = FourMomentum([self[fks_i].E+self[fks_j].E,self[fks_i].px+self[fks_j].px,\ + self[fks_i].py+self[fks_j].py,self[fks_i].pz+self[fks_j].pz]) + + k_rec = FourMomentum([0,0,0,0]) + for ip,part in enumerate(self): + if ip >= 2 and ip != fks_i and ip != fks_j: # add only final-states to the recoil and not the FKS pair + k_rec = k_rec + FourMomentum([part.E,part.px,part.py,part.pz]) + + k_mom = math.sqrt(k_rec.px**2 + k_rec.py**2 + k_rec.pz**2) + beta = (q**2 - (k_rec.E+k_mom)**2)/(q**2 + (k_rec.E+k_mom)**2) + for ip,part in enumerate(self): + if ip >= 2 and ip != fks_i and ip != fks_j: + vec = FourMomentum([self[ip].E,self[ip].px,self[ip].py,self[ip].pz]) + self[ip].set_momentum(vec.boost_beta(beta,k_rec)) + if ip == fks_i: + self[ip].set_momentum(q - k_rec.boost_beta(beta,k_rec)) + self.pop(to_remove) + else: + logger.info('Error in Sudakov Born mapping: no recoil scheme found!') + + def recoil_eq(self,part1, part2): + """ In general, solves the equation + E1 + E2 = K + p1 + p2 = c + E1^2 - p1^2 = a + E2^2 - p2^2 = b + and returns p1 + """ + thresh = 1e-6 + import random + a = part1.mass**2 + part1.px**2 + part1.py**2 + b = part2.mass**2 + part2.px**2 + part2.py**2 + c = part1.pz + part2.pz + K = part1.E + part2.E + K2 = K**2 + sol1 = (-a*c + b*c + c**3 - c*K2 - math.sqrt(K2*(a**2 + (b + c**2 - K2)**2 - 2*a*(b - c**2 + K2))))/(2*(c**2-K2)) + sol2 = (-a*c + b*c + c**3 - c*K2 + math.sqrt(K2*(a**2 + (b + c**2 - K2)**2 - 2*a*(b - c**2 + K2))))/(2*(c**2-K2)) + + if abs(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2) - (math.sqrt(a+sol2**2) + math.sqrt(b+(c-sol2)**2))) > thresh: + logger.critical('Error in recoil_eq solver 1') + logger.critical(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2)) + logger.critical(math.sqrt(a+sol2**2) + math.sqrt(b+(c-sol2)**2)) + if abs(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2) - K) > thresh: + logger.critical('Error in recoil_eq solver 2') + logger.critical(math.sqrt(a+sol1**2) + math.sqrt(b+(c-sol1)**2)) + logger.critical(K) + return sol1 + + def boost(self, filter=None): """modify the current event to boost it according to the current filter""" if filter is None: @@ -1861,7 +2129,7 @@ def boost(self, filter=None): if list(filter(p)): pboost += p else: - pboost = FourMomentum(pboost) + pboost = FourMomentum(filter) # change sign of three-component due to helas convention pboost.px *=-1 @@ -1877,7 +2145,7 @@ def check(self): """check various property of the events""" # check that relative error is under control - threshold = 1e-6 + threshold = 1e-4 #1. Check that the 4-momenta are conserved E, px, py, pz = 0,0,0,0 @@ -1920,7 +2188,50 @@ def check(self): self.check_color_structure() #3. check mass - + + def check_kinematics_only(self): + """check various property of the events - only kinematics""" + + # check that relative error is under control + threshold = 1e-3 + + #1. Check that the 4-momenta are conserved + E, px, py, pz = 0,0,0,0 + absE, abspx, abspy, abspz = 0,0,0,0 + for particle in self: + coeff = 1 + if particle.status == -1: + coeff = -1 + elif particle.status != 1: + continue + E += coeff * particle.E + absE += abs(particle.E) + px += coeff * particle.px + py += coeff * particle.py + pz += coeff * particle.pz + abspx += abs(particle.px) + abspy += abs(particle.py) + abspz += abs(particle.pz) + # check mass + fourmass = FourMomentum(particle).mass + + if particle.mass and (abs(particle.mass) - fourmass)/ abs(particle.mass) > threshold: + logger.critical(self) + raise Exception( "Do not have correct mass lhe: %s momentum: %s (error at %s" % (particle.mass, fourmass, (abs(particle.mass) - fourmass)/ abs(particle.mass))) + + if abs(E/absE) > threshold: + logger.critical(self) + raise Exception("Do not conserve Energy %s, %s" % (E/absE, E)) + if abs(px/abspx) > threshold: + logger.critical(self) + raise Exception("Do not conserve Px %s, %s" % (px/abspx, px)) + if abs(py/abspy) > threshold: + logger.critical(self) + raise Exception("Do not conserve Py %s, %s" % (py/abspy, py)) + if abs(pz/abspz) > threshold: + logger.critical(self) + raise Exception("Do not conserve Pz %s, %s" % (pz/abspz, pz)) + def assign_scale_line(self, line, convert=True): """read the line corresponding to global event line @@ -2764,7 +3075,7 @@ def zboost(self, pboost=None, E=0, pz=0): if isinstance(pboost, FourMomentum): E = pboost.E pz = pboost.pz - + #beta = pz/E gamma = E / math.sqrt(E**2-pz**2) gammabeta = pz / math.sqrt(E**2-pz**2) @@ -2778,6 +3089,74 @@ def zboost(self, pboost=None, E=0, pz=0): out.pz = 0 return out + def zboost_inv(self, pboost=None, E=0, pz=0): + """Both momenta should be in the same frame. + The boost perform correspond to the boost required to set pboost at + rest (only z boost applied). + """ + if isinstance(pboost, FourMomentum): + E = pboost.E + pz = pboost.pz + + #beta = pz/E + gamma = E / math.sqrt(E**2-pz**2) + gammabeta = pz / math.sqrt(E**2-pz**2) + + out = FourMomentum([gamma*self.E + gammabeta*self.pz, + self.px, + self.py, + gamma*self.pz + gammabeta*self.E]) + + if abs(out.pz) < 1e-6 * out.E: + out.pz = 0 + return out + + + def pt_boost(self, pboost=None, E=0, pz=0): + """Both momenta should be in the same frame. + The boost perform correspond to the boost required to set pboost at + rest (only pT boost applied). + """ + + if isinstance(pboost, FourMomentum): + E = pboost.E + px = pboost.px + py = pboost.py + mass = math.sqrt(E**2 - px**2 - py**2) + + betax = px/E + betay = py/E + beta = math.sqrt(betax**2+betay**2) + gamma = 1 / math.sqrt(1.0-beta**2) + + out = FourMomentum([gamma*self.E - gamma*betax*self.px - gamma*betay*self.py, + -gamma*betax*self.E + (1.0 + (gamma-1.0)*betax**2/(beta**2))*self.px + (gamma-1.0)*betax*betay/(beta**2)*self.py, + -gamma*betay*self.E + ((gamma-1.0)*betax*betay/(beta**2))*self.px + (1.0+(gamma-1.0)*(betay**2)/(beta**2))*self.py, + self.pz]) + + if abs(out.px) < 1e-6 * out.E: + out.px = 0 + if abs(out.py) < 1e-6 * out.E: + out.py = 0 + return out + + def boost_beta(self,beta,mom): + """ Boost along the three-momentum of mom with a boost of size beta""" + + unit = mom * (1.0/math.sqrt(mom.px**2+mom.py**2+mom.pz**2)) + beta_vec = beta*unit + bx = beta_vec.px + by = beta_vec.py + bz = beta_vec.pz + gamma = 1.0 / math.sqrt(1.0-beta**2) + + out = FourMomentum([gamma*self.E - gamma*bx*self.px - gamma*by*self.py - gamma*bz*self.pz, + -gamma*bx*self.E + (1.0 + (gamma-1.0)*bx**2/(beta**2))*self.px + (gamma-1.0)*bx*by/(beta**2)*self.py + (gamma-1.0)*bx*bz/(beta**2)*self.pz, + -gamma*by*self.E + ((gamma-1.0)*bx*by/(beta**2))*self.px + (1.0+(gamma-1.0)*(by**2)/(beta**2))*self.py + (gamma-1.0)*by*bz/(beta**2)*self.pz, + -gamma*bz*self.E + (gamma-1.0)*bx*bz/(beta**2)*self.px + (gamma-1.0)*(by*bz)/(beta**2)*self.py + (1.0+(gamma-1.0)*bz**2/(beta**2))*self.pz]) + + return out + def boost_to_restframe(self, pboost): """apply the boost transformation such that pboost is at rest in the new frame. First apply a rotation to allign the pboost to the z axis and then use @@ -2789,27 +3168,64 @@ def boost_to_restframe(self, pboost): return out - # write pboost as (E, p cosT sinF, p sinT sinF, p cosF) - # rotation such that it become (E, 0 , 0 , p ) is - # cosT sinF , -sinT , cosT sinF - # sinT cosF , cosT , sinT sinF - # -sinT , 0 , cosF - p = math.sqrt( pboost.px**2 + pboost.py**2+ pboost.pz**2) - cosF = pboost.pz / p - sinF = math.sqrt(1-cosF**2) - sinT = pboost.py/p/sinF - cosT = pboost.px/p/sinF - - out=FourMomentum([self.E, - self.px*cosT*cosF + self.py*sinT*cosF-self.pz*sinF, - -self.px*sinT+ self.py*cosT, - self.px*cosT*sinF + self.py*sinT*sinF + self.pz*cosF - ]) - out = out.zboost(E=pboost.E,pz=p) + # see here https://physics.stackexchange.com/questions/749036/general-lorentz-boost-of-four-momentum-in-cm-frame-particle-physics + vx = pboost.px/pboost.E + vy = pboost.py/pboost.E + vz = pboost.pz/pboost.E + v = pboost.norm/pboost.E + v2 = pboost.norm_sq/pboost.E**2 + gamma = 1./math.sqrt(1.-v**2) + gammo = gamma-1. + out = FourMomentum(E = gamma*(self.E - vx*self.px - vy*self.py - vz*self.pz), + px= -gamma*vx*self.E + (1+gammo*vx**2/v2)*self.px + gammo*vx*vy/v2*self.py + gammo*vx*vz/v2*self.pz, + py= -gamma*vy*self.E + gammo*vy*vx/v2*self.px + (1+gammo*vy**2/v2)*self.py + gammo*vy*vz/v2*self.pz, + pz= -gamma*vz*self.E + gammo*vz*vx/v2*self.px + gammo*vz*vy/v2*self.py + (1+gammo*vz**2/v2)*self.pz) + return out + def rotate_to_z(self,prot): + + import math + import numpy as np + + z = np.array([0.,0.,1.]) + + px = self.px + py = self.py + pz = self.pz + + refx = prot.px + refy = prot.py + refz = prot.pz + + prot_mom = np.array([px, py, pz]) + ref_mom = np.array([refx, refy, refz]) + + # Create normal vector + n = np.array([refy, -refx, 0.]) + n = n * 1./math.sqrt(self.threedot(n,n)) + t = prot_mom - self.threedot(n,prot_mom)*n + p = ref_mom - self.threedot(ref_mom,z)*z + p = p/math.sqrt(self.threedot(p,p)) + + t_pz = np.array([self.threedot(t,p), self.threedot(t,z), 0.]) + costheta = self.threedot(ref_mom,z)* 1./math.sqrt(self.threedot(ref_mom, ref_mom)) + sintheta=math.sqrt(1.-costheta**2) + + sgn = 1. + t_pz_p = np.array([0., 0., 0.]) + t_pz_p[0] = costheta*t_pz[0] + sgn*(-sintheta) * t_pz[1] + t_pz_p[1] = sgn*sintheta*t_pz[0] + costheta * t_pz[1] + + out_mom = self.threedot(n,prot_mom)*n + t_pz_p[0]*p + t_pz_p[1]*z + + out = FourMomentum([self.E,out_mom[0], out_mom[1], out_mom[2] ] ) + + return out - + def threedot(self,a,b): + + return a[0]*b[0]+a[1]*b[1]+a[2]*b[2] class OneNLOWeight(object): diff --git a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/madevent_interface.py b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/madevent_interface.py index 2a118e21bf..8e30cf690c 100755 --- a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/madevent_interface.py +++ b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/madevent_interface.py @@ -496,7 +496,6 @@ def help_remove(self): logger.info(" the optional '-f' allows to by-pass all security question") logger.info(" The banner can be remove only if all files are removed first.") - class AskRun(cmd.ControlSwitch): """a class for the question on what to do on a madevent run""" @@ -2393,13 +2392,17 @@ def do_generate_events(self, line): # Check argument's validity mode = self.check_generate_events(args) switch_mode = self.ask_run_configuration(mode, args) - if not args: - # No run name assigned -> assigned one automaticaly - self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton') - else: - self.set_run_name(args[0], None, 'parton', True) - args.pop(0) - + with misc.TMP_variable(banner_mod.RunCard, 'allow_scan', True): + run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat'), consistency=False) + if not run_card.scan_set: + if not args: + # No run name assigned -> assigned one automaticaly + self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton') + else: + self.set_run_name(args[0], None, 'parton', True) + args.pop(0) + + self.run_generate_events(switch_mode, args) self.postprocessing() @@ -2560,7 +2563,7 @@ def wait_monitoring(Idle, Running, Done): self.update_status("postprocessing contur done", level="rivet") # this decorator handle the loop related to scan. - @common_run.scanparamcardhandling() + @common_run.scanparamcardhandling(run_card_scan=True) def run_generate_events(self, switch_mode, args): if self.proc_characteristics['loop_induced'] and self.options['run_mode']==0: @@ -2593,7 +2596,6 @@ def run_generate_events(self, switch_mode, args): # Regular run mode logger.info('Generating %s events with run name %s' % (self.run_card['nevents'], self.run_name)) - self.exec_cmd('survey %s %s' % (self.run_name,' '.join(args)), postcmd=False) nb_event = self.run_card['nevents'] @@ -2975,7 +2977,7 @@ def update_width_in_param_card(decay_info, initial=None, output=None): particle = 0 # Read BRs for this decay line = param_card[line_number] - while re.search('^(#|\s|\d)', line): + while re.search(r'^(#|\s|\d)', line): line = param_card.pop(line_number) if not particle or line.startswith('#'): line=param_card[line_number] @@ -3226,7 +3228,7 @@ def do_treatcards(self, line, mode=None, opt=None): for line in open(pjoin(bias_module_path,'%s.f'%os.path.basename(bias_module_path))): if start and last: break - if not start and not re.search('c\s*parameters\s*=\s*{',line, re.I): + if not start and not re.search(r'c\s*parameters\s*=\s*{',line, re.I): continue start = True if not line.startswith('C'): @@ -3235,7 +3237,7 @@ def do_treatcards(self, line, mode=None, opt=None): if '{' in line: line = line.split('{')[-1] # split for } ! # - split_result = re.split('(\}|!|\#)', line,1, re.M) + split_result = re.split(r'(\}|!|\#)', line,1, re.M) line = split_result[0] sep = split_result[1] if len(split_result)>1 else None if sep == '}': @@ -3514,8 +3516,8 @@ def pass_in_difficult_integration_mode(self, rate=1): text = open(conf_path).read() min_evt, max_evt = 2500 *(2+rate), 10000*(rate+1) - text = re.sub('''\(min_events = \d+\)''', '(min_events = %i )' % min_evt, text) - text = re.sub('''\(max_events = \d+\)''', '(max_events = %i )' % max_evt, text) + text = re.sub(r'''\(min_events = \d+\)''', '(min_events = %i )' % min_evt, text) + text = re.sub(r'''\(max_events = \d+\)''', '(max_events = %i )' % max_evt, text) fsock = open(conf_path, 'w') fsock.write(text) fsock.close() @@ -3619,7 +3621,7 @@ def do_refine(self, line): alljobs = misc.glob('ajob*', Pdir) #remove associated results.dat (ensure to not mix with all data) - Gre = re.compile("\s*j=(G[\d\.\w]+)") + Gre = re.compile(r"\s*j=(G[\d\.\w]+)") for job in alljobs: Gdirs = Gre.findall(open(job).read()) for Gdir in Gdirs: @@ -3727,58 +3729,126 @@ def do_combine_events(self, line): sum_xsec, sum_xerru, sum_axsec = 0,[],0 Gdirs = self.get_Gdir() Gdirs.sort() - for Gdir in Gdirs: - if os.path.exists(pjoin(Gdir, 'events.lhe')): - result = sum_html.OneResult('') - result.read_results(pjoin(Gdir, 'results.dat')) - sum_xsec += result.get('xsec') - sum_xerru.append(result.get('xerru')) - sum_axsec += result.get('axsec') - - if self.run_card['gridpack'] or self.run_card['nevents']==0: - os.remove(pjoin(Gdir, 'events.lhe')) - continue + partials_info = [] + try: + p = subprocess.Popen(["ulimit", "-n"], stdout=subprocess.PIPE) + out, err = p.communicate() + max_G = out.decode() + if max_G == "unlimited": + max_G =2500 + else: + max_G = int(max_G) - 40 + except Exception as error: + logger.debug(error) + max_G = 80 # max(20, len(Gdirs)/self.options['nb_core']) - AllEvent.add(pjoin(Gdir, 'events.lhe'), - result.get('xsec'), - result.get('xerru'), - result.get('axsec') - ) - - if len(AllEvent) >= 80: #perform a partial unweighting - AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % partials), - get_wgt, log_level=5, trunc_error=1e-2, event_target=self.run_card['nevents']) - AllEvent = lhe_parser.MultiEventFile() - AllEvent.banner = self.banner - AllEvent.add(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % partials), - sum_xsec, - math.sqrt(sum(x**2 for x in sum_xerru)), - sum_axsec) - partials +=1 - if not hasattr(self,'proc_characteristic'): self.proc_characteristic = self.get_characteristics() - if len(AllEvent) == 0: - nb_event = 0 - else: + mycluster = cluster.MultiCore(nb_core=self.options['nb_core']) + + def split(a, n): + """split a list "a" into n chunk of same size (or nearly same size)""" + k, m = divmod(len(a), n) + return (a[i*k+min(i, m):(i+1)*k+min(i+1, m)] for i in range(n)) + + partials_info = [] + if len(Gdirs) >= max_G: + start_unweight= time.perf_counter() + # first check in how many chunk we have to split (always use a multiple of nb_core) + nb_split = 1 + nb_G = len(Gdirs) // (2* self.options['nb_core']) + while nb_G > min(80, max_G): + nb_split += 1 + nb_G = len(Gdirs)//(nb_split*2*self.options['nb_core']) + if nb_G < 10: + nb_split -=1 + nb_G = len(Gdirs)//(nb_split*2*self.options['nb_core']) + + #enforce at least 10 directory per thread + if nb_G > 10 or nb_split>1: + # do the unweighting of each chunk on their own thread + nb_chunk = (nb_split*2*self.options['nb_core']) + else: + nb_chunk = len(Gdirs) // 10 + nb_G =10 + + # security that the number of combine events is too large + if nb_chunk >= max_G: + nb_chunk = max_G -1 + nb_G = len(Gdirs) // nb_chunk + + for i, local_G in enumerate(split(Gdirs, nb_chunk)): + line = [pjoin(self.me_dir, "Events", self.run_name, "partials%d.lhe.gz" % i)] + line.append(pjoin(self.me_dir, 'Events', self.run_name, '%s_%s_banner.txt' % (self.run_name, tag))) + line.append(str(self.results.current['cross'])) + line += local_G + partials_info.append(self.do_combine_events_partial(' '.join(line), preprocess_only=True)) + mycluster.submit(sys.executable, + [pjoin(self.me_dir, 'bin', 'internal', 'madevent_interface.py'), 'combine_events_partial'] + line, + stdout='/dev/null' + ) + + starttime = time.time() + update_status = lambda idle, run, finish: \ + self.update_status((idle, run, finish, 'unweight'), level=None, + force=False, starttime=starttime) + mycluster.wait(self.me_dir, update_status) + # do the final combination + for data in partials_info: + AllEvent.add(*data) + + start_unweight= time.perf_counter() nb_event = AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "unweighted_events.lhe.gz"), get_wgt, trunc_error=1e-2, event_target=self.run_card['nevents'], log_level=logging.DEBUG, normalization=self.run_card['event_norm'], proc_charac=self.proc_characteristic) + + #cleaning + for data in partials_info: + path = data[0] + try: + os.remove(path) + except Exception as error: + try: + os.remove(path[:-3]) # try without the .gz + except: + misc.sprint('no file ', path, 'to clean') + else: + for Gdir in Gdirs: + if os.path.exists(pjoin(Gdir, 'events.lhe')): + result = sum_html.OneResult('') + result.read_results(pjoin(Gdir, 'results.dat')) + sum_xsec += result.get('xsec') + sum_xerru.append(result.get('xerru')) + sum_axsec += result.get('axsec') + + if self.run_card['gridpack'] or self.run_card['nevents']==0: + os.remove(pjoin(Gdir, 'events.lhe')) + continue + + AllEvent.add(pjoin(Gdir, 'events.lhe'), + result.get('xsec'), + result.get('xerru'), + result.get('axsec') + ) + + if len(AllEvent) == 0: + nb_event = 0 + else: + nb_event = AllEvent.unweight(pjoin(self.me_dir, "Events", self.run_name, "unweighted_events.lhe.gz"), + get_wgt, trunc_error=1e-2, event_target=self.run_card['nevents'], + log_level=logging.DEBUG, normalization=self.run_card['event_norm'], + proc_charac=self.proc_characteristic) + + if nb_event < self.run_card['nevents']: + logger.warning("failed to generate enough events. Please follow one of the following suggestions to fix the issue:") + logger.warning(" - set in the run_card.dat 'sde_strategy' to %s", 1 + self.run_card['sde_strategy'] % 2) + logger.warning(" - set in the run_card.dat 'hard_survey' to 1 or 2.") + logger.warning(" - reduce the number of requested events (if set too high)") + logger.warning(" - check that you do not have -integrable- singularity in your amplitude.") + logger.warning(" - regenerate your process directory by selecting another gauge (in particular try FD gauge).") - if nb_event < self.run_card['nevents']: - logger.warning("failed to generate enough events. Please follow one of the following suggestions to fix the issue:") - logger.warning(" - set in the run_card.dat 'sde_strategy' to %s", 1 + self.run_card['sde_strategy'] % 2) - logger.warning(" - set in the run_card.dat 'hard_survey' to 1 or 2.") - logger.warning(" - reduce the number of requested events (if set too high)") - logger.warning(" - check that you do not have -integrable- singularity in your amplitude.") - if partials: - for i in range(partials): - try: - os.remove(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe.gz" % i)) - except Exception: - os.remove(pjoin(self.me_dir, "Events", self.run_name, "partials%s.lhe" % i)) self.results.add_detail('nb_event', nb_event) @@ -3789,7 +3859,50 @@ def do_combine_events(self, line): logger.info("combination of events done in %s s ", time.time()-start) self.to_store.append('event') + + ############################################################################ + def do_combine_events_partial(self, line, preprocess_only=False): + """ """ + + AllEvent = lhe_parser.MultiEventFile() + + sum_xsec, sum_xerru, sum_axsec = 0,[],0 + output, banner_path,cross = line.split()[:3] + Gdirs = line.split()[3:] + + cross = float(cross) + if not self.banner: + self.banner = banner_mod.Banner(banner_path) + if not hasattr(self, 'run_card'): + self.run_card = banner_mod.RunCard(self.banner['mgruncard']) + AllEvent.banner = self.banner + + for Gdir in Gdirs: + if os.path.exists(pjoin(Gdir, 'events.lhe')): + result = sum_html.OneResult('') + result.read_results(pjoin(Gdir, 'results.dat')) + sum_xsec += result.get('xsec') + sum_xerru.append(result.get('xerru')) + sum_axsec += result.get('axsec') + + if self.run_card['gridpack'] or self.run_card['nevents']==0: + os.remove(pjoin(Gdir, 'events.lhe')) + continue + if not preprocess_only: + AllEvent.add(pjoin(Gdir, 'events.lhe'), + result.get('xsec'), + result.get('xerru'), + result.get('axsec') + ) + if preprocess_only: + return output, sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), sum_axsec + nb_event = max(min(abs(1.01*self.run_card['nevents']*sum_axsec/cross),self.run_card['nevents']), 10) + get_wgt = lambda event: event.wgt + AllEvent.unweight(output, + get_wgt, log_level=5, trunc_error=1e-2, event_target=nb_event) + return output, sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), sum_axsec + ############################################################################ def correct_bias(self): """check the first event and correct the weight by the bias @@ -3902,13 +4015,19 @@ def do_store_events(self, line): #except Exception: # continue # Store log - try: - if os.path.exists(pjoin(G_path, 'log.txt')): - input = pjoin(G_path, 'log.txt') + input = pjoin(G_path, 'log.txt') + if os.path.exists(input): + if self.run_card['keep_log'] not in ["none", "minimal"]: output = pjoin(G_path, '%s_log.txt' % run) - files.mv(input, output) - except Exception: - continue + try: + files.mv(input, output) + except Exception: + continue + elif self.run_card['keep_log'] == "none": + try: + os.remove(input) + except Exception: + continue #try: # # Grid # for name in ['ftn26']: @@ -3989,7 +4108,7 @@ def do_create_gridpack(self, line): misc.call(['./bin/internal/make_gridpack'], cwd=self.me_dir) files.mv(pjoin(self.me_dir, 'gridpack.tar.gz'), pjoin(self.me_dir, '%s_gridpack.tar.gz' % self.run_name)) - os.system("sed -i.bak \"s/\s*.true.*=.*GridRun/ .false. = GridRun/g\" %s/Cards/grid_card.dat" \ + os.system("sed -i.bak \"s/\\s*.true.*=.*GridRun/ .false. = GridRun/g\" %s/Cards/grid_card.dat" \ % self.me_dir) self.update_status('gridpack created', level='gridpack') @@ -4476,7 +4595,7 @@ def do_pythia8(self, line): else: preamble = misc.get_HEPTools_location_setter( pjoin(MG5DIR,'HEPTools'),'lib') - preamble += "\n unset PYTHIA8DATA\n" + #preamble += "\n unset PYTHIA8DATA\n" open(pythia_cmd_card,'w').write("""! ! It is possible to run this card manually with: @@ -4691,7 +4810,7 @@ def do_pythia8(self, line): # Make sure to sure the number of split_events determined during the splitting. split_PY8_Card.systemSet('Main:numberOfEvents',partition_for_PY8[i]) split_PY8_Card.systemSet('HEPMCoutput:scaling',split_PY8_Card['HEPMCoutput:scaling']* - (float(partition_for_PY8[i])/float(n_events))) + (float(partition_for_PY8[i]))) # Add_missing set to False so as to be sure not to add any additional parameter w.r.t # the ones in the original PY8 param_card copied. split_PY8_Card.write(pjoin(parallelization_dir,'PY8Card_%d.dat'%i), @@ -4963,9 +5082,9 @@ def wait_monitoring(Idle, Running, Done): if cross_sections: # Filter the cross_sections specified an keep only the ones # with central parameters and a different merging scale - a_float_re = '[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' + a_float_re = r'[\+|-]?\d+(\.\d*)?([EeDd][\+|-]?\d+)?' central_merging_re = re.compile( - '^\s*Weight_MERGING\s*=\s*(?P%s)\s*$'%a_float_re, + r'^\s*Weight_MERGING\s*=\s*(?P%s)\s*$'%a_float_re, re.IGNORECASE) cross_sections = dict( (float(central_merging_re.match(xsec).group('merging')),value) @@ -5016,8 +5135,8 @@ def wait_monitoring(Idle, Running, Done): def parse_PY8_log_file(self, log_file_path): """ Parse a log file to extract number of event and cross-section. """ - pythiare = re.compile("Les Houches User Process\(es\)\s*\d+\s*\|\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)\s*\|\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") - pythia_xsec_re = re.compile("Inclusive cross section\s*:\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") + pythiare = re.compile(r"Les Houches User Process\(es\)\s*\d+\s*\|\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)\s*\|\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") + pythia_xsec_re = re.compile(r"Inclusive cross section\s*:\s*(?P[\d\.e\-\+]+)\s*(?P[\d\.e\-\+]+)") sigma_m, Nacc, Ntry = None, None, None for line in misc.BackRead(log_file_path): info = pythiare.search(line) @@ -5158,7 +5277,7 @@ def do_pythia(self, line): # read the line from the bottom of the file #pythia_log = misc.BackRead(pjoin(self.me_dir,'Events', self.run_name, # '%s_pythia.log' % tag)) - pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") + pythiare = re.compile(r"\s*I\s+0 All included subprocesses\s+I\s+(?P\d+)\s+(?P\d+)\s+I\s+(?P[\d\.D\-+]+)\s+I") for line in misc.reverse_readline(pjoin(self.me_dir,'Events', self.run_name, '%s_pythia.log' % tag)): info = pythiare.search(line) @@ -5619,8 +5738,8 @@ def launch_job(self,exe, cwd=None, stdout=None, argument = [], remaining=0, input_files.append(self.get_pdf_input_filename()) #Find the correct ajob - Gre = re.compile("\s*j=(G[\d\.\w]+)") - origre = re.compile("grid_directory=(G[\d\.\w]+)") + Gre = re.compile(r"\s*j=(G[\d\.\w]+)") + origre = re.compile(r"grid_directory=(G[\d\.\w]+)") try : fsock = open(exe) except Exception: @@ -5628,7 +5747,7 @@ def launch_job(self,exe, cwd=None, stdout=None, argument = [], remaining=0, text = fsock.read() output_files = Gre.findall(text) if not output_files: - Ire = re.compile("for i in ([\d\.\s]*) ; do") + Ire = re.compile(r"for i in ([\d\.\s]*) ; do") data = Ire.findall(text) data = ' '.join(data).split() for nb in data: @@ -6035,7 +6154,7 @@ def get_last_tag(self, level): 'syscalc':[], 'rivet':['rivet']} - if name == self.run_name: + if name and name == self.run_name: if reload_card: run_card = pjoin(self.me_dir, 'Cards','run_card.dat') self.run_card = banner_mod.RunCard(run_card) @@ -6334,7 +6453,7 @@ def run_syscalc(self, mode='parton', event_path=None, output=None): elif mode == 'Pythia': stdout = open(pjoin(event_dir, self.run_name, '%s_%s_syscalc.log' % (tag,mode)),'w') if 'mgpythiacard' in self.banner: - pat = re.compile('''^\s*qcut\s*=\s*([\+\-\d.e]*)''', re.M+re.I) + pat = re.compile(r'''^\s*qcut\s*=\s*([\+\-\d.e]*)''', re.M+re.I) data = pat.search(self.banner['mgpythiacard']) if data: qcut = float(data.group(1)) @@ -6611,7 +6730,7 @@ def get_subP_ids(path): for line in open(pjoin(path, 'leshouche.inc')): if not 'IDUP' in line: continue - particles = re.search("/([\d,-]+)/", line) + particles = re.search(r"/([\d,-]+)/", line) all_ids.append([int(p) for p in particles.group(1).split(',')]) return all_ids @@ -6899,6 +7018,7 @@ def do_combine_events(self, line): partials = 0 # if too many file make some partial unweighting sum_xsec, sum_xerru, sum_axsec = 0,[],0 + partials_info = [] Gdirs = self.get_Gdir() Gdirs.sort() for Gdir in Gdirs: @@ -6917,16 +7037,21 @@ def do_combine_events(self, line): sum_axsec += result.get('axsec')*gscalefact[Gdir] if len(AllEvent) >= 80: #perform a partial unweighting + nb_event = min(abs(1.01*self.nb_event*sum_axsec/self.results.current['cross']),self.run_card['nevents']) AllEvent.unweight(pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), - get_wgt, log_level=5, trunc_error=1e-2, event_target=self.nb_event) + get_wgt, log_level=5, trunc_error=1e-2, event_target=nb_event) AllEvent = lhe_parser.MultiEventFile() AllEvent.banner = self.banner - AllEvent.add(pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), + partials_info.append((pjoin(outdir, self.run_name, "partials%s.lhe.gz" % partials), sum_xsec, math.sqrt(sum(x**2 for x in sum_xerru)), - sum_axsec) + sum_axsec) ) + sum_xsec, sum_xerru, sum_axsec = 0,[],0 partials +=1 + for data in partials_info: + AllEvent.add(*data) + if not hasattr(self,'proc_characteristic'): self.proc_characteristic = self.get_characteristics() diff --git a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/misc.py b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/misc.py index c4c669f36b..e7fd60be0d 100755 --- a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/misc.py +++ b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/misc.py @@ -67,7 +67,7 @@ def parse_info_str(fsock): """ info_dict = {} - pattern = re.compile("(?P\w*)\s*=\s*(?P.*)", + pattern = re.compile(r"(?P\w*)\s*=\s*(?P.*)", re.IGNORECASE | re.VERBOSE) for entry in fsock: entry = entry.strip() @@ -84,7 +84,7 @@ def parse_info_str(fsock): def glob(name, path=''): """call to glob.glob with automatic security on path""" import glob as glob_module - path = re.sub('(?P\?|\*|\[|\])', '[\g]', path) + path = re.sub(r'(?P\?|\*|\[|\])', r'[\g]', path) return glob_module.glob(pjoin(path, name)) #=============================================================================== @@ -614,10 +614,10 @@ def mod_compilator(directory, new='gfortran', current=None, compiler_type='gfort #search file file_to_change=find_makefile_in_dir(directory) if compiler_type == 'gfortran': - comp_re = re.compile('^(\s*)FC\s*=\s*(.+)\s*$') + comp_re = re.compile(r'^(\s*)FC\s*=\s*(.+)\s*$') var = 'FC' elif compiler_type == 'cpp': - comp_re = re.compile('^(\s*)CXX\s*=\s*(.+)\s*$') + comp_re = re.compile(r'^(\s*)CXX\s*=\s*(.+)\s*$') var = 'CXX' else: MadGraph5Error, 'Unknown compiler type: %s' % compiler_type @@ -861,9 +861,9 @@ def detect_current_compiler(path, compiler_type='fortran'): # comp = re.compile("^\s*FC\s*=\s*(\w+)\s*") # The regular expression below allows for compiler definition with absolute path if compiler_type == 'fortran': - comp = re.compile("^\s*FC\s*=\s*([\w\/\\.\-]+)\s*") + comp = re.compile("^\\s*FC\\s*=\\s*([\\w\\/\\.\\-]+)\\s*") elif compiler_type == 'cpp': - comp = re.compile("^\s*CXX\s*=\s*([\w\/\\.\-]+)\s*") + comp = re.compile("^\\s*CXX\\s*=\\s*([\\w\\/\\.\\-]+)\\s*") else: MadGraph5Error, 'Unknown compiler type: %s' % compiler_type @@ -1001,7 +1001,19 @@ def call_stdout(arg, *args, **opt): def copytree(src, dst, symlinks = False, ignore = None): if not os.path.exists(dst): os.makedirs(dst) - shutil.copystat(src, dst) + try: + shutil.copystat(src, dst) + except PermissionError: + if os.path.realpath(src).startswith('/cvmfs') and os.path.realpath(dst).startswith('/afs'): + # allowing missmatch from cvmfs to afs since sounds to not create issue --at least in general-- + logger.critical(f'Ignoring that we could not copy permissions from {src} to {dst}') + else: + logger.critical(f'Permission error detected from {src} to {dst}.\n'+\ + 'If you are using WSL with windows partition, please try using python3.12\n'+\ + 'or avoid moving your data from the WSL partition to the UNIX one') + # we do not have enough experience in WSL to allow it to get trough. + raise + lst = os.listdir(src) if ignore: excl = ignore(src, lst) @@ -1895,12 +1907,12 @@ class EasterEgg(object): May4_banner = "* _____ *\n" + \ "* ,-~\" \"~-. *\n" + \ "* * ,^ ___ ^. * *\n" + \ - "* * / .^ ^. \ * *\n" + \ + "* * / .^ ^. \\ * *\n" + \ "* * Y l o ! Y * *\n" + \ "* * l_ `.___.' _,[ * *\n" + \ "* * |^~\"--------------~\"\"^| * *\n" + \ "* * ! May the 4th ! * *\n" + \ - "* * \ / * *\n" + \ + "* * \\ / * *\n" + \ "* * ^. .^ * *\n" + \ "* * \"-.._____.,-\" * *\n" @@ -1909,13 +1921,13 @@ class EasterEgg(object): "* M::::::::::M M::::::::::M *\n" + \ "* M:::::::::::M M:::::::::::M (_)___ *\n" + \ "* M:::::::M::::M M::::M:::::::M | / __| *\n" + \ - "* M::::::M M::::M M::::M M::::::M | \__ \ *\n" + \ + "* M::::::M M::::M M::::M M::::::M | \\__ \\ *\n" + \ "* M::::::M M::::M::::M M::::::M |_|___/ *\n" + \ "* M::::::M M:::::::M M::::::M *\n" + \ "* M::::::M M:::::M M::::::M / _| ___ _ __ *\n" + \ - "* M::::::M MMMMM M::::::M | |_ / _ \| '__| *\n" + \ + "* M::::::M MMMMM M::::::M | |_ / _ \\| '__| *\n" + \ "* M::::::M M::::::M | _| (_) | | *\n" + \ - "* M::::::M M::::::M |_/\/\___/|_| *\n" + \ + "* M::::::M M::::::M |_/\\/\\___/|_| *\n" + \ "* M::::::M M::::::M *\n" + \ "* MMMMMMMM MMMMMMMM *\n" + \ "* *\n" + \ @@ -2233,39 +2245,51 @@ def import_python_lhapdf(lhapdfconfig): os.environ['LD_LIBRARY_PATH'] = lhapdf_libdir else: os.environ['LD_LIBRARY_PATH'] = '%s:%s' %(lhapdf_libdir,os.environ['LD_LIBRARY_PATH']) - try: candidates=[dirname for dirname in os.listdir(lhapdf_libdir) \ if os.path.isdir(os.path.join(lhapdf_libdir,dirname))] except OSError: candidates=[] + if os.path.isdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')): + candidates += [pjoin(os.pardir,'local', 'lib', dirname) for dirname in os.listdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')) + if os.path.isdir(os.path.join(lhapdf_libdir,os.pardir, 'local', 'lib', dirname))] for candidate in candidates: - if os.path.isdir(os.path.join(lhapdf_libdir,candidate,'site-packages')): - sys.path.insert(0,os.path.join(lhapdf_libdir,candidate,'site-packages')) - try: - import lhapdf - use_lhapdf=True - break - except ImportError: - sys.path.pop(0) - continue + for subdir in ['site-packages', 'dist-packages']: + if os.path.isdir(os.path.join(lhapdf_libdir,candidate, subdir)): + sys.path.insert(0,os.path.join(lhapdf_libdir,candidate, subdir)) + try: + import lhapdf + use_lhapdf=True + break + except ImportError as error: + sys.path.pop(0) + continue + else: + continue + break if not use_lhapdf: try: candidates=[dirname for dirname in os.listdir(lhapdf_libdir+'64') \ if os.path.isdir(os.path.join(lhapdf_libdir+'64',dirname))] except OSError: candidates=[] - + if os.path.isdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib64')): + candidates += [pjoin(os.pardir,'local', 'lib64', dirname) for dirname in os.listdir(pjoin(lhapdf_libdir, os.pardir, 'local', 'lib')) + if os.path.isdir(os.path.join(lhapdf_libdir,os.pardir, 'local', 'lib64', dirname))] for candidate in candidates: - if os.path.isdir(os.path.join(lhapdf_libdir+'64',candidate,'site-packages')): - sys.path.insert(0,os.path.join(lhapdf_libdir+'64',candidate,'site-packages')) - try: - import lhapdf - use_lhapdf=True - break - except ImportError: - sys.path.pop(0) - continue + for subdir in ['site-packages', 'dist-packages']: + if os.path.isdir(os.path.join(lhapdf_libdir+'64',candidate, subdir)): + sys.path.insert(0,os.path.join(lhapdf_libdir+'64',candidate, subdir)) + try: + import lhapdf + use_lhapdf=True + break + except ImportError as error: + sys.path.pop(0) + continue + else: + continue + break if not use_lhapdf: try: import lhapdf diff --git a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/shower_card.py b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/shower_card.py index e87d534177..16ed72b1a0 100755 --- a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/shower_card.py +++ b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/shower_card.py @@ -288,7 +288,7 @@ def write(self, output_file, template=None, python_template=False, self.text = open(template,'r').read() - key_re = re.compile('^(\s*)([\S^#]+)(\s*)=(\s*)([^#]*?)(\s*)(\#.*|$)') + key_re = re.compile(r'^(\s*)([\S^#]+)(\s*)=(\s*)([^#]*?)(\s*)(\#.*|$)') newlines = [] for line in self.text.split('\n'): key_match = key_re.findall(line) diff --git a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/systematics.py b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/systematics.py index 28eaed00e2..2acebd087c 100644 --- a/epochX/cudacpp/susy_gg_tt.mad/bin/internal/systematics.py +++ b/epochX/cudacpp/susy_gg_tt.mad/bin/internal/systematics.py @@ -582,7 +582,7 @@ def print_cross_sections(self, all_cross, nb_event, stdout): else: resume.write( '#PDF %s: %g +%2.3g%% -%2.3g%%\n' % (pdfset.name, pdferr.central,pdferr.errplus*100/all_cross[0], pdferr.errminus*100/all_cross[0])) - dyn_name = {1: '\sum ET', 2:'\sum\sqrt{m^2+pt^2}', 3:'0.5 \sum\sqrt{m^2+pt^2}',4:'\sqrt{\hat s}' } + dyn_name = {1: r'\sum ET', 2:r'\sum\sqrt{m^2+pt^2}', 3:r'0.5 \sum\sqrt{m^2+pt^2}',4:r'\sqrt{\hat s}' } for key, curr in dyns.items(): if key ==-1: continue @@ -789,7 +789,7 @@ def get_id(self): return int(self.start_wgt_id) if 'initrwgt' in self.banner: - pattern = re.compile(' set lhapdf /PATH/TO/lhapdf-config -None does not seem to correspond to a valid lhapdf-config executable. -Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config). -Note that you can still compile and run aMC@NLO with the built-in PDFs - MG5_aMC> set lhapdf /PATH/TO/lhapdf-config - Using default text editor "vi". Set another one in ./input/mg5_configuration.txt Using default eps viewer "evince". Set another one in ./input/mg5_configuration.txt Using default web browser "firefox". Set another one in ./input/mg5_configuration.txt -import /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_tt.mg +import /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_tt.mg The import format was not given, so we guess it as command set stdout_level DEBUG set output information to level: 10 set zerowidth_tchannel F import model MSSM_SLHA2 +INFO: load particles +INFO: load vertices +DEBUG: model prefixing takes 0.9339261054992676  INFO: Restrict model MSSM_SLHA2 with file models/MSSM_SLHA2/restrict_default.dat . INFO: Detect SLHA2 format. keeping restricted parameter in the param_card DEBUG: Simplifying conditional expressions  @@ -554,17 +552,16 @@ INFO: Please specify coupling orders to bypass this step. INFO: Trying coupling order WEIGHTED<=2: WEIGTHED IS QCD+2*QED INFO: Trying process: g g > t t~ WEIGHTED<=2 @1 INFO: Process has 3 diagrams -1 processes with 3 diagrams generated in 0.119 s +1 processes with 3 diagrams generated in 0.112 s Total: 1 processes with 3 diagrams output standalone_cudacpp ../TMPOUT/CODEGEN_cudacpp_susy_gg_tt Load PLUGIN.CUDACPP_OUTPUT -Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.5.3_lo_vect. +Plugin PLUGIN.CUDACPP_OUTPUT has marked as NOT being validated with this version: 3.6.0_lo_vect. It has been validated for the last time with version: 3.5.2 Output will be done with PLUGIN: CUDACPP_OUTPUT -DEBUG: cformat =  plugin [export_cpp.py at line 3070]  DEBUG: Entering PLUGIN_ProcessExporter.__init__ (initialise the exporter) [output.py at line 165]  DEBUG: Entering PLUGIN_ProcessExporter.copy_template (initialise the directory) [output.py at line 170]  -INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_tt +INFO: Creating subdirectories in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_tt INFO: Organizing processes into subprocess groups INFO: Generating Helas calls for process: g g > t t~ WEIGHTED<=2 @1 INFO: Processing color information for process: g g > t t~ @1 @@ -573,30 +570,30 @@ INFO: Processing color information for process: g g > t t~ @1 DEBUG: type(fortran_model)= [output.py at line 214]  DEBUG: type(me)= me=0 [output.py at line 215]  DEBUG: "need to link", self.to_link_in_P =  need to link ['nvtx.h', 'timer.h', 'timermap.h', 'ompnumthreads.h', 'GpuRuntime.h', 'GpuAbstraction.h', 'MemoryAccessHelpers.h', 'MemoryAccessVectors.h', 'MemoryAccessMatrixElements.h', 'MemoryAccessMomenta.h', 'MemoryAccessRandomNumbers.h', 'MemoryAccessWeights.h', 'MemoryAccessAmplitudes.h', 'MemoryAccessWavefunctions.h', 'MemoryAccessGs.h', 'MemoryAccessCouplingsFixed.h', 'MemoryAccessNumerators.h', 'MemoryAccessDenominators.h', 'MemoryAccessChannelIds.h', 'EventStatistics.h', 'CommonRandomNumbers.h', 'CrossSectionKernels.cc', 'CrossSectionKernels.h', 'MatrixElementKernels.cc', 'MatrixElementKernels.h', 'RamboSamplingKernels.cc', 'RamboSamplingKernels.h', 'RandomNumberKernels.h', 'CommonRandomNumberKernel.cc', 'CurandRandomNumberKernel.cc', 'HiprandRandomNumberKernel.cc', 'Bridge.h', 'BridgeKernels.cc', 'BridgeKernels.h', 'fbridge.cc', 'fbridge.inc', 'fsampler.cc', 'fsampler.inc', 'MadgraphTest.h', 'runTest.cc', 'testmisc.cc', 'testxxx_cc_ref.txt', 'valgrind.h', 'cudacpp.mk', 'testxxx.cc', 'MemoryBuffers.h', 'MemoryAccessCouplings.h', 'perf.py', 'profile.sh'] [output.py at line 216]  -INFO: Creating files in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_tt/SubProcesses/P1_Sigma_MSSM_SLHA2_gg_ttx -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_tt/SubProcesses/P1_Sigma_MSSM_SLHA2_gg_ttx/./CPPProcess.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_tt/SubProcesses/P1_Sigma_MSSM_SLHA2_gg_ttx/./CPPProcess.cc -INFO: Created files CPPProcess.h and CPPProcess.cc in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_tt/SubProcesses/P1_Sigma_MSSM_SLHA2_gg_ttx/. +INFO: Creating files in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_tt/SubProcesses/P1_Sigma_MSSM_SLHA2_gg_ttx +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_tt/SubProcesses/P1_Sigma_MSSM_SLHA2_gg_ttx/./CPPProcess.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_tt/SubProcesses/P1_Sigma_MSSM_SLHA2_gg_ttx/./CPPProcess.cc +INFO: Created files CPPProcess.h and CPPProcess.cc in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_tt/SubProcesses/P1_Sigma_MSSM_SLHA2_gg_ttx/. Generated helas calls for 1 subprocesses (3 diagrams) in 0.006 s ALOHA: aloha starts to compute helicity amplitudes ALOHA: aloha creates VVV1 set of routines with options: P0 ALOHA: aloha creates FFV1 routines -ALOHA: aloha creates 2 routines in 0.138 s +ALOHA: aloha creates 2 routines in 0.150 s VVV1 FFV1 FFV1 FFV1 -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_tt/src/./HelAmps_MSSM_SLHA2.h -INFO: Created file HelAmps_MSSM_SLHA2.h in directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_tt/src/. +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_tt/src/./HelAmps_MSSM_SLHA2.h +INFO: Created file HelAmps_MSSM_SLHA2.h in directory /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_tt/src/. super_write_set_parameters_onlyfixMajorana (hardcoded=False) super_write_set_parameters_onlyfixMajorana (hardcoded=True) -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_tt/src/./Parameters_MSSM_SLHA2.h -FileWriter for /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_tt/src/./Parameters_MSSM_SLHA2.cc +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_tt/src/./Parameters_MSSM_SLHA2.h +FileWriter for /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_tt/src/./Parameters_MSSM_SLHA2.cc INFO: Created files Parameters_MSSM_SLHA2.h and Parameters_MSSM_SLHA2.cc in directory -INFO: /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_tt/src/. and /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_tt/src/. +INFO: /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_tt/src/. and /data/avalassi/GPU2023/madgraph4gpuBis/MG5aMC/TMPOUT/CODEGEN_cudacpp_susy_gg_tt/src/. quit -real 0m1.318s -user 0m1.225s -sys 0m0.058s -Code generation completed in 1 seconds +real 0m2.452s +user 0m2.316s +sys 0m0.082s +Code generation completed in 3 seconds