diff --git a/Generators/EvgenJobTransforms/share/LHEonly.py b/Generators/EvgenJobTransforms/share/LHEonly.py index 0a30cfb14c01c0e0208bcbbe943c29568bca7cbf..5b952e287641729e3b9ac042aeb1f2faa7e933d8 100644 --- a/Generators/EvgenJobTransforms/share/LHEonly.py +++ b/Generators/EvgenJobTransforms/share/LHEonly.py @@ -1,6 +1,7 @@ # Common fragment for generation of 1 Pythia8 event, when producing LHE output only -# the number of events is set to 1 in two places: as Pythia param: Main:numberOfEvents = 1 and evgenconfig.nEventsPerJob=1 (the later one is stronger) +# the number of events is set to 1 in two places: as Pythia param: Main:numberOfEvents = 1 and postSeq.CountHepMC.RequestedOutput=1 (the later one is stronger) # It is needed to make the transform run +# we don't modify nEventsPerJob anymore, which now corresponds to the number of events in the output lhe file # No output is kept from this generation ## Base config for Pythia8 @@ -19,7 +20,7 @@ genSeq += Pythia8_i("Pythia8") genSeq.Pythia8.Commands += [ "Main:timesAllowErrors = 500", - "Main:numberOfEvents = 1", + "Main:numberOfEvents = 1",### first place for number of dummy events "6:m0 = 172.5", "23:m0 = 91.1876", "23:mWidth = 2.4952", @@ -41,7 +42,15 @@ genSeq.Pythia8.Commands += [ "SoftQCD:inelastic = on", "SpaceShower:rapidityOrder=0"] -evgenConfig.nEventsPerJob = 1 +### second place for number of dummy events +if not hasattr(postSeq, "CountHepMC"): + postSeq += CountHepMC() +postSeq.CountHepMC.RequestedOutput = 1 + +### we don't modify nEventsPerJob, it'll correspond to the number of events in the output lhe file +#evgenConfig.nEventsPerJob = 1 + +### deleting TestHepMC for lhe-only production del testSeq.TestHepMC diff --git a/Generators/EvgenJobTransforms/share/skel.GENtoTXT.py b/Generators/EvgenJobTransforms/share/skel.GENtoTXT.py index b55d22c64c8fd15ea2a59db99c5d952c8701db0d..4780ef220a7304cf29768399b8f930c7b96042ba 100644 --- a/Generators/EvgenJobTransforms/share/skel.GENtoTXT.py +++ b/Generators/EvgenJobTransforms/share/skel.GENtoTXT.py @@ -316,23 +316,11 @@ if evgenConfig.minevents > 0 : if evgenConfig.nEventsPerJob < 1: raise RuntimeError("evgenConfig.nEventsPerJob must be at least 1") -elif evgenConfig.nEventsPerJob > 100000: +elif evgenConfig.nEventsPerJob > 100000:# limitation to 100k events per output lhe file raise RuntimeError("evgenConfig.nEventsPerJob can be max. 100000") else: - allowed_nEventsPerJob_lt1000 = [1, 2, 5, 10, 20, 25, 50, 100, 200, 500, 1000] - msg = "evgenConfig.nEventsPerJob = %d: " % evgenConfig.nEventsPerJob - - if evgenConfig.nEventsPerJob >= 1000 and evgenConfig.nEventsPerJob <=10000 and (evgenConfig.nEventsPerJob % 1000 != 0 or 10000 % evgenConfig.nEventsPerJob != 0) : - msg += "nEventsPerJob in range [1K, 10K] must be a multiple of 1K and a divisor of 10K" - raise RuntimeError(msg) - elif evgenConfig.nEventsPerJob > 10000 and evgenConfig.nEventsPerJob % 10000 != 0: - msg += "nEventsPerJob >10K must be a multiple of 10K" - raise RuntimeError(msg) - elif evgenConfig.nEventsPerJob < 1000 and evgenConfig.nEventsPerJob not in allowed_nEventsPerJob_lt1000: - msg += "nEventsPerJob in range <= 1000 must be one of %s" % allowed_nEventsPerJob_lt1000 - raise RuntimeError(msg) - postSeq.CountHepMC.RequestedOutput = evgenConfig.nEventsPerJob if runArgs.maxEvents == -1 else runArgs.maxEvents - evgenLog.info('Requested output events '+str(postSeq.CountHepMC.RequestedOutput)) + evgenLog.info("evgenConfig.nEventsPerJob = {}, but only {} (dummy) event(s) will be generated by Pythia8 for lhe-only production".format(evgenConfig.nEventsPerJob, postSeq.CountHepMC.RequestedOutput)) +### NB: postSeq.CountHepMC.RequestedOutput is set to 1 in LHEonly.py ## Check that the keywords list is not empty: