diff --git a/GeneratorInterface/Pythia8Interface/plugins/Pythia8HepMC3Hadronizer.cc b/GeneratorInterface/Pythia8Interface/plugins/Pythia8HepMC3Hadronizer.cc index f0c5271ed2308..a70a107e77070 100644 --- a/GeneratorInterface/Pythia8Interface/plugins/Pythia8HepMC3Hadronizer.cc +++ b/GeneratorInterface/Pythia8Interface/plugins/Pythia8HepMC3Hadronizer.cc @@ -150,8 +150,8 @@ class Pythia8HepMC3Hadronizer : public Py8HMC3InterfaceBase { std::string LHEInputFileName; std::shared_ptr lhaUP; - enum { PP, PPbar, ElectronPositron }; - int fInitialState; // pp, ppbar, or e-e+ + enum { PP, PPbar, ElectronPositron, HeavyIons }; + int fInitialState; // pp, ppbar, e-e+ or HI double fBeam1PZ; double fBeam2PZ; @@ -255,6 +255,15 @@ Pythia8HepMC3Hadronizer::Pythia8HepMC3Hadronizer(const edm::ParameterSet ¶ms } else { // probably need to throw on attempt to override ? } + } else if (params.exists("HeavyIonInitialState")) { + if (fInitialState == PP) { + fInitialState = HeavyIons; + edm::LogInfo("GeneratorInterface|Pythia8Interface") + << "Pythia8 will be initialized for HEAVY ION collisions. " + << "This is a user-request change from the DEFAULT PROTON-PROTON initial state."; + } else { + // probably need to throw on attempt to override ? + } } else if (params.exists("ElectronProtonInitialState") || params.exists("PositronProtonInitialState")) { // throw on unknown initial state ! throw edm::Exception(edm::errors::Configuration, "Pythia8Interface") @@ -408,10 +417,12 @@ bool Pythia8HepMC3Hadronizer::initializeForInternalPartons() { } else if (fInitialState == ElectronPositron) { fMasterGen->settings.mode("Beams:idA", 11); fMasterGen->settings.mode("Beams:idB", -11); + } else if (fInitialState == HeavyIons) { + // let user set up the beam particles } else { // throw on unknown initial state ! throw edm::Exception(edm::errors::Configuration, "Pythia8Interface") - << " UNKNOWN INITIAL STATE. \n The allowed initial states are: PP, PPbar, ElectronPositron \n"; + << " UNKNOWN INITIAL STATE. \n The allowed initial states are: PP, PPbar, ElectronPositron, HeavyIons \n"; } fMasterGen->settings.parm("Beams:eCM", comEnergy); } else { diff --git a/GeneratorInterface/Pythia8Interface/test/JetPlotsExample.py b/GeneratorInterface/Pythia8Interface/test/JetPlotsExample.py new file mode 100644 index 0000000000000..554ea6eb31cd6 --- /dev/null +++ b/GeneratorInterface/Pythia8Interface/test/JetPlotsExample.py @@ -0,0 +1,90 @@ +# PYTHON configuration file for class: JetPlotsExample +# Description: Example of simple EDAnalyzer for jets. +# Author: K. Kousouris +# Date: 25 - August - 2008 +# Modified: Kalanand Mishra +# Date: 11 - January - 2011 (for CMS Data Analysis School jet exercise) + + +import FWCore.ParameterSet.Config as cms + +## ____ _ __ __ ____ +## | _ \ __ _| |_ __ _ ___ _ __ | \/ |/ ___| +## | | | |/ _` | __/ _` | / _ \| '__| | |\/| | | +## | |_| | (_| | || (_| | | (_) | | | | | | |___ +## |____/ \__,_|\__\__,_| \___/|_| |_| |_|\____| + +isMC = True + + +## ____ __ _ _ _ +## / ___|___ _ __ / _(_) __ _ _ _ _ __ __ _| |__ | | ___ ___ +## | | / _ \| '_ \| |_| |/ _` | | | | '__/ _` | '_ \| |/ _ \/ __| +## | |__| (_) | | | | _| | (_| | |_| | | | (_| | |_) | | __/\__ \ +## \____\___/|_| |_|_| |_|\__, |\__,_|_| \__,_|_.__/|_|\___||___/ +## |___/ + +NJetsToKeep = 2 + +if isMC: + inputFile ='file:pythia8hmc3G4Jets.root' + + +## _ _ _ +## (_)_ __ ___| |_ _ __| | ___ ___ +## | | '_ \ / __| | | | |/ _` |/ _ \/ __| +## | | | | | (__| | |_| | (_| | __/\__ \ +## |_|_| |_|\___|_|\__,_|\__,_|\___||___/ + +process = cms.Process("Ana") +############# Format MessageLogger ################# +process.load("FWCore.MessageService.MessageLogger_cfi") +process.MessageLogger.cerr.FwkReport.reportEvery = 10 + + + +## ____ _ ____ +## | _ \ ___ ___ | / ___| ___ _ _ _ __ ___ ___ +## | |_) / _ \ / _ \| \___ \ / _ \| | | | '__/ __/ _ \ +## | __/ (_) | (_) | |___) | (_) | |_| | | | (_| __/ +## |_| \___/ \___/|_|____/ \___/ \__,_|_| \___\___| + + +############# Set the number of events ############# +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(100) +) +############# Define the source file ############### +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring(inputFile) +) +process.source.inputCommands = cms.untracked.vstring("keep *","drop *_MEtoEDMConverter_*_*") + + +## ____ _ _ +## | _ \| | ___ | |_ ___ +## | |_) | |/ _ \| __/ __| +## | __/| | (_) | |_\__ \ +## |_| |_|\___/ \__|___/ + +############# Gen Jets ########################### +if isMC: + process.analyseGen = cms.EDAnalyzer("GenJetPlotsExample", + JetAlgorithm = cms.string('ak4GenJets'), + HistoFileName = cms.string('GenJetPlotsExample.root'), + NJets = cms.int32(NJetsToKeep) + ) + +############# Path ########################### + +## ____ _ _ +## | _ \ __ _| |_| |__ +## | |_) / _` | __| '_ \ +## | __/ (_| | |_| | | | +## |_| \__,_|\__|_| |_| + + +if isMC: + process.p = cms.Path(process.analyseGen) +else: + process.p = cms.Path(process.calo*process.pf*process.jpt) diff --git a/GeneratorInterface/Pythia8Interface/test/pythia8hmc3G4Jets_cfg.py b/GeneratorInterface/Pythia8Interface/test/pythia8hmc3G4Jets_cfg.py new file mode 100644 index 0000000000000..0d4f3e317db03 --- /dev/null +++ b/GeneratorInterface/Pythia8Interface/test/pythia8hmc3G4Jets_cfg.py @@ -0,0 +1,140 @@ +# Auto generated configuration file +# using: +# Revision: 1.19 +# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v +# with command line options: TTbar_8TeV_TuneCUETP8M1_cfi --conditions auto:run1_mc -n 10 --eventcontent RAWSIM --relval 9000,100 -s GEN,SIM --datatier GEN-SIM --beamspot Realistic8TeVCollision --fileout file:pythia8G4.root --suffix -j JobReport1.xml +import FWCore.ParameterSet.Config as cms + + + +process = cms.Process('SIM') + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.Geometry.GeometrySimDB_cff') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.Generator_cff') +process.load('IOMC.EventVertexGenerators.VtxSmearedRealistic8TeVCollision_cfi') +process.load('GeneratorInterface.Core.genFilterSummary_cff') +process.load('Configuration.StandardSequences.SimIdeal_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +#process.load("RecoJets/Configuration/RecoJetsGlobal_cff") +process.load("RecoJets.Configuration.RecoGenJets_cff") + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(10), + output = cms.optional.untracked.allowed(cms.int32,cms.PSet) +) + +# Input source +process.source = cms.Source("EmptySource") + +process.options = cms.untracked.PSet( + IgnoreCompletely = cms.untracked.vstring(), + Rethrow = cms.untracked.vstring(), + accelerators = cms.untracked.vstring('*'), + allowUnscheduled = cms.obsolete.untracked.bool, + canDeleteEarly = cms.untracked.vstring(), + deleteNonConsumedUnscheduledModules = cms.untracked.bool(True), + dumpOptions = cms.untracked.bool(False), + emptyRunLumiMode = cms.obsolete.untracked.string, + eventSetup = cms.untracked.PSet( + forceNumberOfConcurrentIOVs = cms.untracked.PSet( + allowAnyLabel_=cms.required.untracked.uint32 + ), + numberOfConcurrentIOVs = cms.untracked.uint32(0) + ), + fileMode = cms.untracked.string('FULLMERGE'), + forceEventSetupCacheClearOnNewRun = cms.untracked.bool(False), + makeTriggerResults = cms.obsolete.untracked.bool, + numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(0), + numberOfConcurrentRuns = cms.untracked.uint32(1), + numberOfStreams = cms.untracked.uint32(0), + numberOfThreads = cms.untracked.uint32(1), + printDependencies = cms.untracked.bool(False), + sizeOfStackForThreadsInKB = cms.optional.untracked.uint32, + throwIfIllegalParameter = cms.untracked.bool(True), + wantSummary = cms.untracked.bool(False) +) + +# Production Info +process.configurationMetadata = cms.untracked.PSet( + annotation = cms.untracked.string('TTbar_8TeV_TuneCUETP8M1_cfi nevts:10'), + name = cms.untracked.string('Applications'), + version = cms.untracked.string('$Revision: 1.19 $') +) + +# Output definition + +process.RAWSIMoutput = cms.OutputModule("PoolOutputModule", + SelectEvents = cms.untracked.PSet( +# SelectEvents = cms.vstring('generation_step') + ), + compressionAlgorithm = cms.untracked.string('LZMA'), + compressionLevel = cms.untracked.int32(1), + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('GEN-SIM'), + filterName = cms.untracked.string('') + ), + eventAutoFlushCompressedSize = cms.untracked.int32(20971520), + fileName = cms.untracked.string('file:pythia8hmc3G4Jets.root'), + outputCommands = process.RAWSIMEventContent.outputCommands, + splitLevel = cms.untracked.int32(0) +) + +# Additional output definition + +# Other statements +process.genstepfilter.triggerConditions=cms.vstring("generation_step") +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run1_mc', '') + + +process.generator = cms.EDFilter("Pythia8HepMC3GeneratorFilter", + maxEventsToPrint = cms.untracked.int32(1), + pythiaPylistVerbosity = cms.untracked.int32(0), + filterEfficiency = cms.untracked.double(1.0), + pythiaHepMCVerbosity = cms.untracked.bool(False), + comEnergy = cms.double(7000.), + PythiaParameters = cms.PSet( + pythia8_example02 = cms.vstring('HardQCD:all = on', + 'PhaseSpace:pTHatMin = 20.'), + parameterSets = cms.vstring('pythia8_example02') + ) +) + + +process.ProductionFilterSequence = cms.Sequence(process.generator) + +# Path and EndPath definitions +process.generation_step = cms.Path(process.pgen) +process.simulation_step = cms.Path(process.psim) +process.genfiltersummary_step = cms.EndPath(process.genFilterSummary) +process.endjob_step = cms.EndPath(process.endOfProcess) +process.RAWSIMoutput_step = cms.EndPath(process.RAWSIMoutput) +process.recoJets = cms.Path(process.recoGenJets) + + +# Schedule definition +process.schedule = cms.Schedule(process.generation_step,process.genfiltersummary_step,process.simulation_step,process.recoJets,process.endjob_step,process.RAWSIMoutput_step) +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) +# filter all path with the production filter sequence +for path in process.paths: + getattr(process,path).insert(0, process.ProductionFilterSequence) + + + +# Customisation from command line + +# Add early deletion of temporary data products to reduce peak memory need +from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete +process = customiseEarlyDelete(process) +# End adding early deletion