From dade006fdc4f432c10d2df1c70a823c6f29de2d0 Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 28 Aug 2023 17:59:47 +0200 Subject: [PATCH 1/6] Re-add patches to propagate lhe numbering through herwig This reverts commit 7f3bb5cffccb14bb8dff5647f837b616b16c193a. --- LHEEventNum.patch | 199 +++++++++++++++++++++++++++++++++++++ LHEEventNumFxFx.patch | 181 +++++++++++++++++++++++++++++++++ LesHouchesFileReader.patch | 17 ---- herwig7.spec | 2 + thepeg.spec | 2 +- 5 files changed, 383 insertions(+), 18 deletions(-) create mode 100644 LHEEventNum.patch create mode 100644 LHEEventNumFxFx.patch delete mode 100644 LesHouchesFileReader.patch diff --git a/LHEEventNum.patch b/LHEEventNum.patch new file mode 100644 index 00000000000..443917f428e --- /dev/null +++ b/LHEEventNum.patch @@ -0,0 +1,199 @@ +diff -u ThePEG-2.2.2/LesHouches/LesHouchesEventHandler.cc leshoucheseventnumbers/ThePEG/LesHouchesEventHandler.cc +--- ThePEG-2.2.2/LesHouches/LesHouchesEventHandler.cc 2021-01-20 21:18:33.000000001 +0100 ++++ leshoucheseventnumbers/ThePEG/LesHouchesEventHandler.cc 2022-01-12 19:04:24.000000001 +0100 +@@ -244,9 +244,18 @@ + const double fact = + theNormWeight ? + double(selector().sum()/picobarn) : 1.; +- +- currentEvent(new_ptr(Event(lastParticles(), this, generator()->runName(), ++ ++ //whether to use the LHE event number or not for the event identification ++ if(UseLHEEvent==0 || currentReader()->LHEEventNum() == -1) { ++ currentEvent(new_ptr(Event(lastParticles(), this, generator()->runName(), + generator()->currentEventNumber(), weight*fact ))); ++ } ++ else if(UseLHEEvent==1 && currentReader()->LHEEventNum() != -1) { ++ currentEvent(new_ptr(Event(lastParticles(), this, generator()->runName(), ++ currentReader()->LHEEventNum(), weight*fact ))); ++ } ++ ++ + currentEvent()->optionalWeights() = currentReader()->optionalEventWeights(); + // normalize the optional weights + for(map::iterator it = currentEvent()->optionalWeights().begin(); +@@ -512,13 +521,13 @@ + void LesHouchesEventHandler::persistentOutput(PersistentOStream & os) const { + os << stats << histStats << theReaders << theSelector + << oenum(theWeightOption) << theUnitTolerance << theCurrentReader << warnPNum +- << theNormWeight; ++ << theNormWeight << UseLHEEvent; + } + + void LesHouchesEventHandler::persistentInput(PersistentIStream & is, int) { + is >> stats >> histStats >> theReaders >> theSelector + >> ienum(theWeightOption) >> theUnitTolerance >> theCurrentReader >> warnPNum +- >> theNormWeight; ++ >> theNormWeight >> UseLHEEvent; + } + + ClassDescription +@@ -613,6 +622,22 @@ + "Normalize the weights to the max cross section in pb", + 1); + ++ ++ static Switch interfaceEventNumbering ++ ("EventNumbering", ++ "How to number the events", ++ &LesHouchesEventHandler::UseLHEEvent, 0, false, false); ++ static SwitchOption interfaceEventNumberingIncremental ++ (interfaceEventNumbering, ++ "Incremental", ++ "Standard incremental numbering (i.e. as they are generated)", ++ 0); ++ static SwitchOption interfaceEventNumberingLHE ++ (interfaceEventNumbering, ++ "LHE", ++ "Corresponding to the LHE event number", ++ 1); ++ + + interfaceLesHouchesReaders.rank(10); + interfaceWeightOption.rank(9); +diff -u build/BUILD/slc7_amd64_gcc900/external/thepeg/2.2.2-cms2/ThePEG-2.2.2/LesHouches/LesHouchesEventHandler.h leshoucheseventnumbers/ThePEG/LesHouchesEventHandler.h +--- ThePEG-2.2.2/LesHouches/LesHouchesEventHandler.h 2021-01-20 21:18:33.000000001 +0100 ++++ leshoucheseventnumbers/ThePEG/LesHouchesEventHandler.h 2022-01-12 19:04:24.000000001 +0100 +@@ -71,7 +71,7 @@ + */ + LesHouchesEventHandler() + : theWeightOption(unitweight), theUnitTolerance(1.0e-6), warnPNum(true), +- theNormWeight(0) ++ theNormWeight(0), UseLHEEvent(0) + { + selector().tolerance(unitTolerance()); + } +@@ -405,6 +405,11 @@ + */ + unsigned int theNormWeight; + ++ /** ++ * How to number the events ++ */ ++ unsigned int UseLHEEvent; ++ + public: + + /** @cond EXCEPTIONCLASSES */ +diff -u build/BUILD/slc7_amd64_gcc900/external/thepeg/2.2.2-cms2/ThePEG-2.2.2/LesHouches/LesHouchesFileReader.cc leshoucheseventnumbers/ThePEG/LesHouchesFileReader.cc +--- ThePEG-2.2.2/LesHouches/LesHouchesFileReader.cc 2021-07-21 00:36:31.000000001 +0200 ++++ leshoucheseventnumbers/ThePEG/LesHouchesFileReader.cc 2022-01-12 19:04:24.000000001 +0100 +@@ -546,6 +546,14 @@ + */ + if(readingInitWeights_sc && !cfile.find("") + 1; ++ string LHEeventnum_str = hs.substr(firstLim); ++ erase_substr(LHEeventnum_str,stopDEL); ++ LHEeventnum = std::stol(LHEeventnum_str, nullptr, 10); ++ } ++ ++ ++ ++ ++ + //determine start of aMCFast weights + if(cfile.find("> thePartonBinInstances + >> theBeams >> theIncoming >> theOutgoing >> theIntermediates + >> reweights >> preweights >> preweight >> reweightPDF >> doInitPDFs +- >> theLastXComb >> theMaxMultCKKW >> theMinMultCKKW >> lastweight >> optionalWeights >> optionalnpLO >> optionalnpNLO ++ >> theLastXComb >> theMaxMultCKKW >> theMinMultCKKW >> lastweight >> optionalWeights >> optionalnpLO >> optionalnpNLO >> LHEeventnum + >> maxFactor >> iunit(weightScale, picobarn) >> xSecWeights >> maxWeights + >> theMomentumTreatment >> useWeightWarnings >> theReOpenAllowed + >> theIncludeSpin; +diff -u build/BUILD/slc7_amd64_gcc900/external/thepeg/2.2.2-cms2/ThePEG-2.2.2/LesHouches/LesHouchesReader.h leshoucheseventnumbers/ThePEG/LesHouchesReader.h +--- ThePEG-2.2.2/LesHouches/LesHouchesReader.h 2021-01-20 21:18:33.000000001 +0100 ++++ leshoucheseventnumbers/ThePEG/LesHouchesReader.h 2022-01-12 19:04:24.000000001 +0100 +@@ -286,6 +286,11 @@ + */ + const map& optionalEventWeights() const { return optionalWeights; } + ++ /** ++ * Return the Les Houches event number associated with the current event ++ */ ++ const long& LHEEventNum() const { return LHEeventnum; } ++ + /** + * Return the optional npLO and npNLO + */ +@@ -831,6 +836,11 @@ + */ + map optionalWeights; + ++ /** ++ * The event number ++ */ ++ long LHEeventnum; ++ + + /** + * If the maximum cross section of this reader has been increased diff --git a/LHEEventNumFxFx.patch b/LHEEventNumFxFx.patch new file mode 100644 index 00000000000..0fe0f1a9288 --- /dev/null +++ b/LHEEventNumFxFx.patch @@ -0,0 +1,181 @@ +diff -u Herwig-7.2.2/MatrixElement/FxFx/FxFxEventHandler.cc ../../../../../../../leshoucheseventnumbers/FxFx/FxFxEventHandler.cc +--- Herwig-7.2.2/MatrixElement/FxFx/FxFxEventHandler.cc 2021-01-20 20:46:46.000000001 +0100 ++++ ../../../../../../../leshoucheseventnumbers/FxFx/FxFxEventHandler.cc 2022-01-12 19:04:24.000000001 +0100 +@@ -249,8 +249,15 @@ + + theLastXComb = currentReader()->getXComb(); + +- currentEvent(new_ptr(Event(lastParticles(), this, generator()->runName(), +- generator()->currentEventNumber(), weight*fact))); ++ //whether to use the LHE event number or not for the event identification ++ if(UseLHEEvent==0 || currentReader()->LHEEventNum() == -1) { ++ currentEvent(new_ptr(Event(lastParticles(), this, generator()->runName(), ++ generator()->currentEventNumber(), weight*fact ))); ++ } ++ else if(UseLHEEvent==1 && currentReader()->LHEEventNum() != -1) { ++ currentEvent(new_ptr(Event(lastParticles(), this, generator()->runName(), ++ currentReader()->LHEEventNum(), weight*fact ))); ++ } + currentEvent()->optionalWeights() = currentReader()->optionalEventWeights(); + // normalize the optional weights + for(map::iterator it = currentEvent()->optionalWeights().begin(); +@@ -543,14 +550,14 @@ + void FxFxEventHandler::persistentOutput(PersistentOStream & os) const { + os << stats << histStats << theReaders << theSelector + << oenum(theWeightOption) << theUnitTolerance << theCurrentReader << warnPNum +- << theNormWeight; ++ << theNormWeight << UseLHEEvent; + + } + + void FxFxEventHandler::persistentInput(PersistentIStream & is, int) { + is >> stats >> histStats >> theReaders >> theSelector + >> ienum(theWeightOption) >> theUnitTolerance >> theCurrentReader >> warnPNum +- >> theNormWeight; ++ >> theNormWeight >> UseLHEEvent;; + } + + ClassDescription +@@ -644,6 +651,20 @@ + "Normalize the weights to the max cross section in pb", + 1); + ++ static Switch interfaceEventNumbering ++ ("EventNumbering", ++ "How to number the events", ++ &FxFxEventHandler::UseLHEEvent, 0, false, false); ++ static SwitchOption interfaceEventNumberingIncremental ++ (interfaceEventNumbering, ++ "Incremental", ++ "Standard incremental numbering (i.e. as they are generated)", ++ 0); ++ static SwitchOption interfaceEventNumberingLHE ++ (interfaceEventNumbering, ++ "LHE", ++ "Corresponding to the LHE event number", ++ 1); + + interfaceFxFxReaders.rank(10); + interfaceWeightOption.rank(9); +diff -u Herwig-7.2.2/MatrixElement/FxFx/FxFxEventHandler.h ../../../../../../../leshoucheseventnumbers/FxFx/FxFxEventHandler.h +--- Herwig-7.2.2/MatrixElement/FxFx/FxFxEventHandler.h 2021-01-20 20:46:46.000000001 +0100 ++++ ../../../../../../../leshoucheseventnumbers/FxFx/FxFxEventHandler.h 2022-01-12 19:04:24.000000001 +0100 +@@ -72,7 +72,7 @@ + * The default constructor. + */ + FxFxEventHandler() +- : theWeightOption(unitweight), theUnitTolerance(1.0e-6), warnPNum(true), theNormWeight(0) ++ : theWeightOption(unitweight), theUnitTolerance(1.0e-6), warnPNum(true), theNormWeight(0), UseLHEEvent(0) + { + selector().tolerance(unitTolerance()); + } +@@ -377,6 +377,11 @@ + */ + unsigned int theNormWeight; + ++ /** ++ * How to number the events ++ */ ++ unsigned int UseLHEEvent; ++ + + public: + +diff -u Herwig-7.2.2/MatrixElement/FxFx/FxFxFileReader.cc ../../../../../../../leshoucheseventnumbers/FxFx/FxFxFileReader.cc +--- Herwig-7.2.2/MatrixElement/FxFx/FxFxFileReader.cc 2021-01-20 20:46:46.000000001 +0100 ++++ ../../../../../../../leshoucheseventnumbers/FxFx/FxFxFileReader.cc 2022-01-12 19:04:24.000000001 +0100 +@@ -707,6 +707,9 @@ + } + } + ++ LHEeventnum = -1; // set the LHEeventnum to -1, this will be the default if the tag is not found ++ ++ + // Now read any additional comments and named weights. + // read until the end of rwgt is found + bool readingWeights = false, readingaMCFast = false, readingMG5ClusInfo = false; +@@ -767,6 +770,20 @@ + erase_substr(mg5clusinfo,str_newline); + optionalWeights[mg5clusinfo.c_str()] = -222; //for the mg5 scale info weights we give them a weight -222 for future identification + } ++ ++ //the event num tag ++ if(cfile.find("") + 1; ++ string LHEeventnum_str = hs.substr(firstLim); ++ erase_substr(LHEeventnum_str,stopDEL); ++ LHEeventnum = std::stol(LHEeventnum_str, nullptr, 10); ++ } ++ ++ ++ ++ + + //store MG5 clustering information + if(cfile.find("> thePartonBinInstances + >> theBeams >> theIncoming >> theOutgoing >> theIntermediates + >> reweights >> preweights >> preweight >> reweightPDF >> doInitPDFs +- >> theLastXComb >> theMaxMultCKKW >> theMinMultCKKW >> lastweight >> optionalWeights >> optionalnpLO >> optionalnpNLO ++ >> theLastXComb >> theMaxMultCKKW >> theMinMultCKKW >> lastweight >> optionalWeights >> optionalnpLO >> optionalnpNLO >> LHEeventnum + >> maxFactor >> iunit(weightScale, picobarn) >> xSecWeights >> maxWeights + >> theMomentumTreatment >> useWeightWarnings >> theReOpenAllowed + >> theIncludeSpin; +diff -u Herwig-7.2.2/MatrixElement/FxFx/FxFxReader.h ../../../../../../../leshoucheseventnumbers/FxFx/FxFxReader.h +--- Herwig-7.2.2/MatrixElement/FxFx/FxFxReader.h 2021-01-20 20:46:46.000000001 +0100 ++++ ../../../../../../../leshoucheseventnumbers/FxFx/FxFxReader.h 2022-01-12 19:04:24.000000001 +0100 +@@ -290,6 +290,11 @@ + */ + const map& optionalEventWeights() const { return optionalWeights; } + ++ /** ++ * Return the Les Houches event number associated with the current event ++ */ ++ const long& LHEEventNum() const { return LHEeventnum; } ++ + /** + * Return the optional npLO and npNLO + */ +@@ -834,6 +839,11 @@ + * The optional weights associated to the last read events. + */ + map optionalWeights; ++ ++ /** ++ * The event number ++ */ ++ long LHEeventnum; + + /** + * If the maximum cross section of this reader has been increased diff --git a/LesHouchesFileReader.patch b/LesHouchesFileReader.patch deleted file mode 100644 index 734923fc9ef..00000000000 --- a/LesHouchesFileReader.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ThePEG-2.2.2/LesHouches/LesHouchesFileReader.cc 2021-03-08 13:18:39.000000001 +0100 -+++ LesHouchesFileReader_fix.cc 2021-03-08 13:18:30.000000001 +0100 -@@ -546,6 +546,14 @@ - */ - if(readingInitWeights_sc && !cfile.find(" Date: Tue, 7 Nov 2023 10:43:02 +0100 Subject: [PATCH 4/6] Update collier.spec --- collier.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/collier.spec b/collier.spec index 0cea4c4d797..327dc9c627e 100644 --- a/collier.spec +++ b/collier.spec @@ -1,6 +1,6 @@ ### RPM external collier 1.2.8 -Source: http://www.hepforge.org/archive/collier/%{n}-%realversion.tar.gz - # https://collier.hepforge.org/downloads/?f=collier-%{realversion}.tar.gz +# Source: http://www.hepforge.org/archive/collier/%{n}-%{realversion}.tar.gz +Source: https://cmsrep.cern.ch/cmssw/download/collier/%{realversion}/%{n}-%{realversion}.tar.gz BuildRequires: gmake cmake %define keep_archives true From c8f839afa6890bca56c76bc5ad7c5f0898873302 Mon Sep 17 00:00:00 2001 From: Ivan Razumov Date: Thu, 9 Nov 2023 14:31:39 +0100 Subject: [PATCH 5/6] Cleanup --- gosamcontrib.spec | 4 ++-- madgraph5amcatnlo.spec | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/gosamcontrib.spec b/gosamcontrib.spec index 212190dbc26..365f1341f86 100644 --- a/gosamcontrib.spec +++ b/gosamcontrib.spec @@ -24,8 +24,8 @@ PLATF_CONF_OPTS="--enable-shared --enable-static" make %makeprocesses all %install -make install +make install +rm %{i}/lib/*.la %post %{relocateConfig}share/gosam-contrib/gosam.conf - diff --git a/madgraph5amcatnlo.spec b/madgraph5amcatnlo.spec index 4b2a358a180..8d85586790c 100644 --- a/madgraph5amcatnlo.spec +++ b/madgraph5amcatnlo.spec @@ -51,13 +51,11 @@ sed -ideleteme 's|#!.*/bin/python|#!/usr/bin/env python|' \ %{i}/Template/LO/bin/internal/addmasses_optional.py \ %{i}/madgraph/various/progressbar.py find %{i} -name '*deleteme' -delete -rm -rf %{i}/HEPTools/collier/COLLIER-*/build -rm -f %{i}/HEPTools/collier/collier_install.log +rm -f %{i}/basiceventgeneration/*.log +rm -f %{i}/basiceventgeneration/Source/StdHEP/log.mcfio.* %post %relocateConfigAll . py.py %{relocateConfig}input/mg5_configuration.txt %{relocateConfig}basiceventgeneration/Cards/amcatnlo_configuration.txt %{relocateConfig}basiceventgeneration/Source/make_opts -%{relocateConfig}HEPTools/ninja/lib/lib*.la -%{relocateConfig}HEPTools/collier/COLLIER-*/collierConfig.cmake From cce5ff68ac2eea371ae2fb915d4567e83688dd3d Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 27 May 2024 11:53:53 +0200 Subject: [PATCH 6/6] Add collier toolfile --- scram-tools.file/tools/collier/collier.xml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 scram-tools.file/tools/collier/collier.xml diff --git a/scram-tools.file/tools/collier/collier.xml b/scram-tools.file/tools/collier/collier.xml new file mode 100644 index 00000000000..e5f0cb0d1f2 --- /dev/null +++ b/scram-tools.file/tools/collier/collier.xml @@ -0,0 +1,5 @@ + + + + +