Andrew Wisecarver's Homepage

Quick Note and Quick Links

Oh, hello. It looks like you've arrived at my homepage. Grab a tea and get cozy.

Disclaimer: The info/commands on this Twiki may not be up to date/work properly, so use the information on this page at your own discretion.



Event Generation

MadGraph5 _aMC@NLO+Pythia8

genProductions repo:

If questions, consult:

Helpful pages:

Datacards & Gridpacks

Datacard templates are on the genproductions repository (see link above). is the main shell script to make gridpacks.

W+jets, NLO FxFx:

Select LHAPDF number, scale settings.

A) If using lxplus use one of the following:

  • ./ <name_of_process_card_without_proc_card.dat> <folder_containing_cards_relative_to_current_location> <queue>
  • ./ 30000 30000 <queue> <name of process card without _proc_card.dat> relative/path/to/cards/<name of process card without _proc_card.dat> <queue>

which should submit as a batch job, setting up its own CMSSW environment, downloading the appropriate tarballs, etc.

B) If using cmsConnect (need an account first), go to /local-scratch/<username>

  • git clone
  • voms-proxy-init -voms cms -valid 192:00
  • cd /local-scratch/awisecar/genproductions/bin/MadGraph5_aMCatNLO
  • nohup ./ <base name of datacards> relative/path/to/cards/<base name of datacards> 4 "10 Gb" > mysubmit_<base name of datacards>.debug 2>&1 &

On cmsConnect, generation is split up into the CODEGEN step and the INTEGRATE step, so check the two respective logfiles.

LHE and GEN CMSSW Modules

The initial step is to take a .cff file and run on it to get a full .cfg file, on which you cmsRun. The attached file has both LHE and Hadronization modules in it, although they can be done separately, in which case you run the Hadronizer on an LHE .root file.

Example cff file for LHE+GEN step:

Example cmsDriver command: Configuration/GenProduction/python/ --mc --conditions auto:mc --step LHE,GEN --datatier GEN-SIM,LHE --eventcontent RAWSIM,LHE -n 5000 --no_exec --fileout file:WJToLNu_2j_5f_NLO_FxFx_as_0108_GEN.root --python_filename WJToLNu

The "Configuration/GenProduction/python" part of the path is referring to the relative path within the genproductions repository (Configuration/GenProduction just used for historical reasons I think, I don't think this part is important), although for using cmsDriver I think you just need to be in a CMSSW area.

Make sure your JetMatching:nJetMax in the GEN part is set equal to the maximum number of outgoing partons that you generate on the LHE level (if your samples are jet-binned, and you will merge them later, then this number is the highest jet multiplicity).

Also, JetMatching:qCut represents the merging scale. There is much more than can be said on this.

Running CRAB for LHE-only Production using Madgraph5 Gridpacks

CRAB config files have a config.JobType.inputFiles option which allows you to specify input files that are loaded into a "sandbox" that is then available in whatever environment that job is actually run. The caveat, however, is that there is a file size limit, and some gridpacks (e.g. W+2jets) exceed this limit. A possible solution is to have those gridpacks put on cvmfs (e.g. /cvmfs/ so that they're able to be seen (this may involve setting the config.Site.storageSite and/or config.Site.whitelist parameters to 'T2_CH_CERN').

config.Data.splitting must be set to 'EventBased' if doing MC production (?)

Note: some fuddling with config.JobType.eventsPerLumi and config.Data.unitsPerJob parameters may have to be done so that it runs.

Note that the config.Data.outLFNDirBase parameter directs the output location (here on EOS), where getUsernameFromSiteDB() grabs your lxplus username automatically, if you include from UserUtilities import getUsernameFromSiteDB at the top of your CRAB config file.

Once you've got your CRAB cfg and CMSSW cfg files in the same directory, do

  • source /cvmfs/
  • voms-proxy-init --voms cms
  • crab submit -c

can also do:

  • crab checkwrite --site=T2_CH_CERN to check your permissions on this site
  • crab status and crab report (or just check the CMS Dashboard, link above)
  • crab kill (should only have to be done once)
  • crab submit --dryrun <> can tell you how long the jobs will run for?
  • crab resubmit --dir <projects_directory>/crab_<name_of_project> --maxjobruntime=2800: resubmit command resubmits failed jobs

Wall clock exit code 50664:

Obtaining GEN-level information from LHE-level with Pythia 8

If you've done the previous step, now you have ROOT files with LHE-only information, and you need to hadronize and apply other phenomenological corrections to this parton-level information to bring it to particle-level if you want to compare to data/have something physical.

The two scripts attached here are a hadronizer fragment cfg file that hadronizes LHE information to GEN level using Pythia 8, and a python script to loop over different LHE file indices, alpha-s values, doing an lxbatch submission for each of them. The STDOUT is useful, because the post-matching, final cross section Pythia calculates is used at analysis-level. Note: the hadronization parameters in the GEN step cfg file are inherited from the corresponding cff file that we previously ran on.


Information about weights in the LHEEventProduct:


MCgrid manual:
Sherpa Manual:


Use gcc 4.8.1:

  • export SCRAM_ARCH=slc6_amd64_gcc481
  • source /afs/ or
  • source /cvmfs/

Install swig.

Set environment to grab python 2.7 for Rivet's executables (lxplus default is 2.6):

  • PYTHONDIR=/afs/


  • PATH=/afs/$PATH


  • export LHAPDF_DATA_PATH=/cvmfs/

Rivet and MCgrid

Need MCgrid-enabled Rivet analysis that mimics the physics process and selection cuts you want to study. Can book and fill FastNLO grids using MCgrid classes within this Rivet .cc file. Sherpa runcards call Rivet analysis, Rivet analysis calls the FNLO “.str” cards which specify the parton combinations.

MCgrid::fastnloGridArch arch_fnlo(30,20,"Lagrange","Lagrange", "sqrtlog10", "loglog025")

mcgrid/scripts/ -- identify relevant partonic subprocesses from Sherpa output

  • −−beamtype=[pp/ppbar/pbarp] Process.db
mcgrid/scripts/ -- makes FastNLO steering file from APPLgrid steering file
  • −−beamtype=[pp/ppbar/pbarp] subproc.config


  • make plugin-fastnlo
  • make install
  • Sherpa -f Run.dat INIT_ONLY=1 (to initialize ME generators built in Sherpa)
  • ./makelibs (if using AMEGIC)
  • nohup Sherpa -f Run.dat -e 100k > WJets2017-FixedOrder-Warmup.out 2>&1 &
  • nohup Sherpa -f Run.dat -e 5M > WJets2017-FixedOrder-FillGrids.out 2>&1 &


  • The first run, or phasespace fill run, determines the relative statistics of each partonic channel in the process such that their statistical samples may be combined correctly, and also establishes the boundaries of the x, Q2 phase space for each of the interpolation grids. Grid phasespace parameters after warmup run stored in “phasespace” folder; delete this folder to get FNLO to make another one.
  • The second run actually populates the grids with the Monte Carlo weights.
  • It should be noted however that the phase space information provided from the first run must be used by all subsequent parallel runs to ensure the correct combination of the final grids. Therefore the phase space run may not be parallelised.

./fnlo-tk-cppread [PDF] [#scalecombs] [ascode] [norm]

Sherpa Runcard Parameters

Process block:
For a process like

Process 93 93 -> 90 91 93{2}
Order (*,2)

the wildcard indicates the number QCD couplings and the 2 indicates the number of EW couplings (i.e. W+jets)


  • Default scale setting (needed when multijet merging is used):
  • Possible scale setting (renorm. and fact. equal), here for 2 QCD partons:
    SCALES FASTJET[A:antikt,PT:10,R:0.4,M:0]{Abs2(p[2]+p[3])+PPerp2(p[4])+PPerp2(p[5])}

Sherpa's ordering of p[i]'s:

  • p[2]+p[3] - outgoing leptons
  • p[4]+p[5]+... - jets ordered in pt (when jets have been creating using a clustering algorithm)


  • If in (process) module the generator isnt specified for the specific final state parton multiplicity, it goes to the default to where it tries each of the matrix element generators in the (me) module in order.
  • The partonic contribution is not all there is to a cross section calculation for a multi-jet merged event generation, Sudakov rejection weights also contribute. Only after showering do you get rejection weights, and only after this can you compute the total cross section of a multlijet merged sample.
  • If multiple runs, then do a wighted average of all of the output cross sections by weighting the events to get an average cross section.
  • EVENTS means the number of events produced (after the phase space integration is done)
  • ERROR sets an error target; there are some Vegas steps it does first and then it does the integration to try and reach the error target. If ERROR 0.99, we are allowing for 99% error, meaning that it should stop after the Vegas optimization.
    • Integration_Error key can be specified for each partonic process in the (process) part of run card.


  • fnlo-tk-cppread NNPDF31_nnlo_as_0118
  • fnlo-tk-yodaout NNPDF31_nnlo_as_0118
  • comparison-plot or rivet-mkhtml *.yoda

To grab python packages, cd into CMSSW_7_1_30/src, do a cmsenv, and then source your FNLO setup script again

CSC Validation

SCRAM guide:

CSC Validation works as an offline DQM system, running over RAW and FEVT (Full Event) files that contain CSC-specific information, in order to make occupancy, efficiency, timing, etc. plots:

Datasets are organized in Express and Prompt. Express sets are available about an hour after run, and are used by DQM people to do quick evaluations. Prompt sets are called ‘prompt’ due to the algorithm that takes further information about the calibration of the detector components, using this to better reconstruct data. This dataset is available about 48 hours after running. The Prompt sets are organized in different physics triggers e.g. DoubleMuon, SingleMuon, ZeroBias. SingleMuon is used by the Data Certification people.

Remember to scram b to compile any changes! Main codes:

  • AutoValidation /
  • AutoValidation /
  • src/
  • Templates/makeGraphs.C
  • Templates/makePlots.C
  • Templates/makePlots_emtf.C
  • Templates/cfg_yesDigis_RAW_template & Templates/cfg_yesDigis_FEVT_template
  • Templates/secondStep_yesDigis_template

Running CSC Validation:

  • Create tmpfile using voms-proxy-init -hours 500
  • Copy to your home directory
  • Do voms-proxy-init --voms cms
  • Do source /cvmfs/
  • ./ /absolute/path/to/proxy.file
  • acrontab < autoval.acron
  • acrontab -l to list cron contents
  • acrontab -e to edit cron contents
  • acrontab -r to clear cron contents (and stop the jobs)
— or —
  • ./ <dataset> <globaltag> (the "first step" - process_dataset+run_validation)
  • ./ -ro <dataset> <globaltag> (the "second step" - process_output)
  • specify run number using "-rn" tag -- ./ -rn <run number> <dataset> <globaltag>

E.g. ./ /Cosmics/Commissioning2017-v1/RAW auto:run2_data

Data is stored here, at least for a short amount of time: /eos/cms/store/data, so if you're trying to run over an old dataset, and there don't appear to be any files, that's probably why. It will take more time for these runs to appear on DAS, however, and only then can you actually run the code.

miniCSC at b904

miniCSC codes:

Motivation: CSCs contain mixture of 40% Ar, 50% CO2, 10% CF4, but CF4 is not environmentally friendly. However, it provides nice "anti-aging" properties, leading to a long healthy life for our cathode strip chamber.

Idea: Reduce fraction of CF4 and see if/in what way the chamber dies. Monitor several quantities:

  • (Pre)trigger rates
  • Gas gain/"cluster charge"
  • Interstrip resistance
  • "Dark" current



CSC Detector On-Call

General --

  • Call list:
    • General issues -- Misha, Jian
    • XDAQ, configuration -- Karoly
    • DCS -- Evaldas
  • RC meeting every morning:
  • Any time the CSC system is interfered with, need to document in an ELOG
  • Phone: +41 75 411 1972 (161972 from CERN phone), PIN: 8724

  • Firmware & Configuration check every day through YP (both endcaps simultaneously), do after beams are dumped; take local run afterwards to check health of system
  • Taking a local run:
    • Ask Shift Leader and DCS Shifter to be given local control of DAQ and DCS
    • Create new "Local/local" configuration on RCMS, then Initialize, Configure, etc.
    • All dependencies (EMTF, TCDS, FED, local DAQ, local DQM) on EMUPage One should respond and become Configured (yellow) and then Enabled/Running (green) once the local run is started
    • Can choose to Halt or Stop the local run; if Stopped, then must Destroy

DCS --

  • If power cycling LV and peripheral crates, system has to reconfigure (yellow bar on DCS must appear and finish) before any further use of YP, RCMS, etc.
  • Only difference between STANDBY and ON states for CSCs is that HV is lowered by ~600V in all chambers in the former state (?)

DQM --

  • Chambers that are turned off: ME-2/1/3, ME-4/2/21
  • Anode Hit Occupancy per Wire Group
  • SCA Active Strips Occupancy
  • Cathode Comparator Hit Occupancy per Half Strip
  • L1A Differences

YP --

  • YP is how we load firmware onto the individual chambers' EPROMs, check firmware version, etc.
  • "Check Crate Controllers" on YP allows us to check if we're communicating with peripheral crates

RCMS Configurations --

  • /DQM/DQM
  • /DQM/DQM_Display
  • /Commissioning/startPCrate-minus
  • /Commissioning/startPCrate-plus
  • /tools/PC-TStore
  • /DAQ/DAQ_writeN_buildN should be local DAQ configuration when beams are on (?)
  • /Local/local or /Global/GLOBAL_TCDS (depending if in local or global DAQ)


Papers I Like:

Useful Commands:

  • nohup
  • grep

If having troubling importing ROOT into python:

  • Probably just need to find the correct environment
  • Homebrew might have installed it using python3 instead of python2
  • Try putting . /usr/local/bin/ in your .bash_profile
  • Can run "2to3" on a script to convert it from python2 to python3

-- AndrewLloydWisecarver - 2018-06-24

  • 1304.0322.pdf: nice paper on W boson charge asymmetry at LHC and PDF extraction

Topic attachments
I Attachment History Action Size Date Who Comment
PDFpdf 1304.0322.pdf r1 manage 681.0 K 2018-08-06 - 21:51 AndrewLloydWisecarver nice paper on W boson charge asymmetry at LHC and PDF extraction
PDFpdf 14-agingCSC101_010516.pdf r1 manage 2741.5 K 2018-06-29 - 14:45 AndrewLloydWisecarver Presentations by Katerina that describe GIF/904 longevity/performance studies
PDFpdf 1711.01408.pdf r1 manage 1009.8 K 2018-08-06 - 21:50 AndrewLloydWisecarver alpha-s motivation
PDFpdf 9-CSC_101_KB_20160531.pdf r1 manage 1778.7 K 2018-06-29 - 14:44 AndrewLloydWisecarver Karoly's test stand presentation from CSC 101, 2016
PDFpdf CSC-proto-aging.pdf r1 manage 1149.4 K 2018-08-06 - 21:52 AndrewLloydWisecarver miniCSC motivation
PDFpdf GIF180417.pdf r1 manage 10019.8 K 2018-06-29 - 14:45 AndrewLloydWisecarver Presentations by Katerina that describe GIF/904 longevity/performance studies
PDFpdf PhysRevLett.75.3226.pdf r1 manage 334.6 K 2018-08-06 - 21:50 AndrewLloydWisecarver alpha-s motivation
Texttxt r1 manage 6.4 K 2018-07-05 - 18:34 AndrewLloydWisecarver GEN-level stuff
Texttxt r1 manage 3.5 K 2018-07-05 - 18:20 AndrewLloydWisecarver LHE cfg file and corresponding CRAB cfg fiel
Texttxt r1 manage 2.7 K 2018-06-24 - 19:18 AndrewLloydWisecarver Example cff file for LHE+GEN step
Texttxt r1 manage 1.3 K 2018-07-05 - 18:20 AndrewLloydWisecarver LHE cfg file and corresponding CRAB cfg fiel
Texttxt r1 manage 1.1 K 2018-07-17 - 21:29 AndrewLloydWisecarver Extract post-matching xsec from Pythia output
Texttxt r1 manage 2.9 K 2018-07-05 - 18:34 AndrewLloydWisecarver GEN-level stuff
Edit | Attach | Watch | Print version | History: r21 < r20 < r19 < r18 < r17 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r21 - 2018-08-06 - AndrewLloydWisecarver
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Sandbox All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback