Skip to content

Instantly share code, notes, and snippets.

@OMantere
Last active July 6, 2018 15:44
Show Gist options
  • Save OMantere/8a28101c179d234c68a180c86c1b68b0 to your computer and use it in GitHub Desktop.
Save OMantere/8a28101c179d234c68a180c86c1b68b0 to your computer and use it in GitHub Desktop.

How to use the generator fragment and run Fast Simulation on the sample

The generator fragment takes in the LHE file generated by the matrix element generator(eg. MadGraph), and performs processes like hadronization on the sample.

This hadronized sample can then be processed by the CMSSW to do things like Fast Simulation.

At the end I'm giving the cmsDriver command to perform the complete Fast Simulation in the way we have done, if you already have experience with CMSSW you should be able to modify this to suit your needs.

The generator fragment

There are 3 fragments in total: (The last 2 are just progressively more stripped-down versions of the 1st one)

  1. Hadronizer_TuneCUETP8M1_13TeV_generic_LHE_pythia8_cff: This has been used for "hard" proton-proton processes(which require hadronization).

  2. Hadronizer_TuneCUETP8M1_13TeV_generic_LHE_elastic_pythia8_cff: For elastic gamma-gamma processes we modified the previous fragment by disabling the proton-proton collision with resolveHadrons = 3. We also disabled some other things such as ISR and FSR, I don't remember exactly why, I think they caused the program to crash when we had disabled the proton-proton collision.

  3. Hadronizer_TuneCUETP8M1_13TeV_generic_LHE_minimal_pythia8_cff: For the exclusive elastic GammaGamma-Dilepton sample generated with CepGen, we turned other stuff off too, that would have caused the program to crash. At this point Pythia is not much more than a dumb LHE -> ROOT converter. This is a kind of hacky thing to do and I'm not 100% sure about the physical relevance of this...

Running Fast Simulation command

To actually use the fragment in your simulation on LXPLUS, run the following commands:

LXPLUS stuff:

export VO_CMS_SW_DIR=/cvmfs/cms.cern.ch
source /cvmfs/cms.cern.ch/cmsset_default.sh

Setup CMMSW:

cmsrel CMSSW_9_2_3
cd CMSSW_9_2_3/src
cmsenv

Tell CMSSW to register your fragment

git-cms-addpkg Configuration/Generator
cp Hadronizer_TuneCUETP8M1_13TeV_generic_LHE_elastic_pythia8_cff.py Configuration/Generator/python/Hadronizer_TuneCUETP8M1_13TeV_generic_LHE_elastic_pythia8_cff.py
scram b Configuration/Generator/python

Now you can run the cmsDriver command to perform Fast Simulation (we are using CMSSW_9_2_3):

cmsDriver.py Hadronizer_TuneCUETP8M1_13TeV_generic_LHE_elastic_pythia8_cff --conditions auto:run2_mc --fast -n 1000 --eventcontent AODSIM -s GEN,SIM,RECOBEFMIX,DIGI:pdigi_valid,RECO --datatier AODSIM --beamspot Realistic25ns13TeVEarly2017Collision --era Run2_25ns filetype=LHE --filein=file:input.lhe --fileout=file:output.root

This would generate 1000 events using the input file input.lhe into the output file output.lhe.

Note that we're using the elastic fragment(Hadronizer_TuneCUETP8M1_13TeV_generic_LHE_elastic_pythia8_cff). You may change this in the command to suit your needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment