cms-sw / genproductions

Generator fragments for MC production
https://twiki.cern.ch/twiki/bin/view/CMS/GitRepositoryForGenProduction
79 stars 786 forks source link

[MadGraph] Issues with gridpack_generation.sh in MG_265 (extramodels section) #2264

Open covarell opened 5 years ago

covarell commented 5 years ago

Apparently the gridpack_generation.sh script in the mg265 branch does not work properly for the "extramodels" section, probably because of unrecognized or not properly parsed bash syntax.

A simple description of the problem follows (observed at cmsconnect, but also verified by @lviliani at lxplus):

The command: ./submit_cmsconnect_gridpack_generation.sh llll_qcd_cHWB_13TeV cards/llll_qcd_cHWB_13TeV 1 "2 Gb"

fails with an extramodel card which anyway follows the suggested syntax: $ more cards/llll_qcd_cHWB_13TeV/llll_qcd_cHWB_13TeV_extramodels.dat smeft4vbs.tgz

I checked that the model is not downloaded from the web server to the models/ directory of MG as it should be.

However, simplifying the bash as follows (in principle that should be equivalent) everything works:

--- a/bin/MadGraph5_aMCatNLO/gridpack_generation.sh
+++ b/bin/MadGraph5_aMCatNLO/gridpack_generation.sh
@@ -187,26 +187,10 @@ make_gridpack () {
       #load extra models if needed
       if [ -e $CARDSDIR/${name}_extramodels.dat ]; then
         echo "Loading extra models specified in $CARDSDIR/${name}_extramodels.d
at"
-        #strip comments
-        sed 's:#.*$::g' $CARDSDIR/${name}_extramodels.dat | while read model
-        do
-          #get needed BSM model
-          if [[ $model = *[!\ ]* ]]; then
-            echo "Loading extra model $model"
-            wget --no-check-certificate https://cms-project-generators.web.cern
.ch/cms-project-generators/$model   
-            cd models
-            if [[ $model == *".zip"* ]]; then
-              unzip ../$model
-            elif [[ $model == *".tgz"* ]]; then
-              tar zxvf ../$model
-            elif [[ $model == *".tar"* ]]; then
-              tar xavf ../$model
-            else 
-              echo "A BSM model is specified but it is not in a standard archiv
e (.zip or .tar)"
-            fi
-            cd ..
-          fi
-        done
+        wget --no-check-certificate https://cms-project-generators.web.cern.ch/
cms-project-generators/smeft4vbs.tgz    
+        cd models
+        tar zxvf ../smeft4vbs.tgz
+        cd ..
       fi

The problem appears to be in the syntax "sed 's:#.*$::g' $CARDSDIR/${name}_extramodels.dat | while read model" (???) because the first "echo" message is found in the log, the second isn't.

lviliani commented 5 years ago

The issue appears when the extramodel datacard does not contain EOL. It can be fixed replacing this line: sed 's:#.*$::g' $CARDSDIR/${name}_extramodels.dat | while read model with sed 's:#.*$::g' $CARDSDIR/${name}_extramodels.dat | while read -r model || [ -n "$model" ] but there is probably even a simpler bash solution...

covarell commented 5 years ago

I see as of today the same issue, can @lviliani make a PR of it please?

lviliani commented 5 years ago

Here it is #2449. Do you want the same PR also in UL2019 and mg265?

agrohsje commented 5 years ago

UL2019 is sufficient, as 265 is now the new master.