Sihyun Jeon

Seoul National University, joined CMS since 2015, shjeon@cernNOSPAMPLEASE.ch

Sherpa Tutorial

Setting up CMSSW environment with Sherpa v2.2.5, OpenLoops v2.0b.

source /cvmfs/cms.cern.ch/cmsset_default.sh
cmsrel CMSSW_10_3_0
cd CMSSW_10_3_0/src
cmsenv

As for the next step, checkout the SherpaInterface.

git cms-addpkg GeneratorInterface/SherpaInterface

Now get the needed run cards from the github

git clone https://github.com/sihyunjeon/SherpaTutorial.git
cd SherpaTutorial/ZtoEE_tutorial

In the directory, there are shell scripts, run cards, and rivet customisation file.

Let's create Sherpack with one of the run cards. In this tutorial session, we will only try to make LO samples with up to 1 jet in the matrix element level. Other samples would be provided from us.

mkdir python
mkdir test
cd test
cp ../data/*sh .
cp ../data/Run.dat_13TeV_ZtoEE_LO01j_OpenLoops .

run_MakeSherpaLibs.sh is the shell script containing needed options to make Sherpa libraries.

-p : name of the process (in this tutorial, it would be "13TeV_ZtoEE_LO01j_OpenLoops")

-o : this should be set to LBCR

-m mpirun -M '-n [XXX]' : Sherpa supports mpi parallelisation, [XXX] is the number of cores that would be used (in this tutorial, we will use "8" cores)

./run_MakeSherpaLibs.sh 13TeV_ZtoEE_LO01j_OpenLoops

After MakeSherpaLibs is finished, there would be tarball files created in the directory. The tarball files contain information about run card, integration results, compiled libraries, multiple parton interaction. Also total cross section would be calculated like below :

+-----------------------------------------------------+
| |
| Total XS is 1804.62 pb +- ( 57.2028 pb = 3.16 % ) |
| |
+-----------------------------------------------------+

run_PrepareSherpaLibs.sh is the shell script to make Sherpack using prepared tarball ingredients. The only option here is "-p" where name of the process should be put in.

./run_PrepareSherpaLibs.sh 13TeV_ZtoEE_LO01j_OpenLoops

Once the PrepareSherpaLibs is finished, python fragment would be created. We will use cmsDriver.py to later run this fragment with cmsRun.

cp sherpa_13TeV_ZtoEE_LO01j_OpenLoops_MASTER_cff.py ../python/

We also need to compile rivet customisation file as well in order to create yoda files which would be used for plotting. We will use Rivet-implemented code for Z->ee samples MC_ZINC_EL, MC_ZJETS_EL, ATLAS_2017_I1514251_EL.

Before compiling rivet_customisation file, rivet_customize_13TeV_ZtoEE.py's cross section is set to 1 as below :

process.rivetAnalyzer.CrossSection = cms.double(1.)


Change the cross section to the total cross section you obtained after MakeSherpaLibs (in pb) to make fair comparison agains actual data (ATLAS_2017_I1514251_EL)

cp ../data/rivet_customize_13TeV_ZtoEE.py ../python/
cd ..
scram b -j 4
cd test

Now using the cmsDriver.py, we will create python file to generate events.

The option added in the end (--customise=SherpaTutorial/ZtoEE_tutorial) allows us to create yoda files which would be used to make plots with Rivet.

cmsDriver.py SherpaTutorial/ZtoEE_tutorial/python/sherpa_13TeV_ZtoEE_LO01j_OpenLoops_MASTER_cff.py -s GEN -n 100 --no_exec --conditions auto:mc --eventcontent RAWSIM --customise=SherpaTutorial/ZtoEE_tutorial/rivet_customize_13TeV_ZtoEE.py
cmsRun sherpa_13TeV_ZtoEE_LO01j_OpenLoops_MASTER_cff_py_GEN.py

After doing cmsRun, there would be a newly created an yoda file named sherpa_output.yoda.

Rivet codes do not work under CMSSW_10_3_0 (not sure why) so we will use different release, CMSSW_10_0_0.

cmsrel CMSSW_10_0_0
cd CMSSW_10_0_0/src
cmsenv
git-cms-init
git-cms-addpkg GeneratorInterface/RivetInterface
source GeneratorInterface/RivetInterface/test/rivetSetup.sh
mkdir test
cd test

Now bring your sherpa_output.yoda to current path and copy paste existing yoda files with different number of jets/order settings from /afs/cern.ch/work/s/shjeon/public/SherpaTutorial/yodafiles/

cp /afs/cern.ch/work/s/shjeon/public/SherpaTutorial/yodafiles/*yoda .
rivet-mkhtml --mc-errs sherpa_output.yoda ZtoEE_LO012jet.yoda ZtoEE_NLO01jet.yoda ZtoEE_NLO0LO12jet.yoda

The above command line would produce rivet-plots directory containing validation results using Rivet.

Legacy Sample Recipes (2016)

source /cvmfs/cms.cern.ch/cmsset_default.sh
cmsrel CMSSW_9_4_6_patch1
cd CMSSW_9_4_6_patch1/src
cmsenv
git clone https://github.com/sihyunjeon/sample_production_2016miniaodsim
cd sample_production_2016miniaodsim/sample_production
python make_crab_jobs.py &>submit.sh
source /cvmfs/cms.cern.ch/crab3/crab.sh
source submit.sh

Rivet

Setup Rivet in CMS environment

Rivet v2.5.4 with CMSSW_10_0_0 Prerequirements : Setup gitlab ssh keys in https://gitlab.cern.ch/cms-gen/Rivet

cmsrel CMSSW_10_0_0
cd CMSSW_10_0_0/src
cmsenv
git-cms-init
git-cms-addpkg GeneratorInterface/RivetInterface
git-cms-addpkg Configuration/Generator
git clone https://:@gitlab.cern.ch:8443/${USER}/Rivet.git
source Rivet/rivetSetup.sh
scram b -j8

Check if Rivet setup is done properly with following lines.

(1) This lists all the prestored Rivet validation codes :

rivet --list-analyses

(2) This shows detailed information of CMS_2012_I1102908 :

rivet --show-analysis CMS_2012_I1102908

NOTE When trying to compare MC samples with analyses with CMS or ATLAS data, the collision energy should be the same (can't compare 8 TeV data with 13 TeV MC samples).

Running Rivet with prestored codes

Rivet input file should be in HepMC format which is large in size (10K events ~ 1 GB). So rather than using actual HepMC event files, using filesystem pipe (fifo) is recommended.

NOTE Sacrifice is not running properly due to library issues. I put DY to dielectron samples for test runs for the time being. /afs/cern.ch/work/s/shjeon/public/Rivet_temp/DYtoEE_LO_0jet.hepmc Using fifo needs to be updated.

mkdir test
cp /afs/cern.ch/work/s/shjeon/public/Rivet_temp/DYtoEE_LO_0jet.hepmc ./
rivet -a CMS_2012_I1102908 DYtoEE _LO_0jet.hepmc

Line above would create an YODA formatted file which can be used for histogramming. Line below would create histograms defined in CMS_2012_I1102908 codes.

rivet-mkhtml Rivet.yoda

Running Rivet with new codes

This would create a new code structure for Rivet.

rivet-mkanalysis SherpaTEST

Basic structure of Rivet code is below.

//@this part only needs to be performed only once in the beginning : definition of particles, histogram settings, etc.

void init(){

FinalState fs(Cuts::abseta < 5. && Cuts::pT > 0.*GeV);

declare(fs, "FinalState"); //final state particles with |eta| < 2.5 and pT > 10 declared

ZFinder zfinder(fs, Cuts::abseta < 2.5 && Cuts::pT > 10.*GeV, PID::ELECTRON, 80*GeV, 100*GeV, 0.0, ZFinder::CLUSTERNODECAY, ZFinder::TRACK); //ZFinder input information in http://rivet.hepforge.org/code/2.1.0/a00378.html#a738135cc98aa45f6935eb12a4c7fb226

declare(zfinder, "ZFinder"); //Z bosons defined with cuts on electrons, electron clusterings, and Z boson mass window 80~100 GeV

_histogram_Z_mass = bookHisto1D("Z_mass", 50, 0., 200.); //histogram booked for Z boson mass range 0~200 GeV with 50 bins

}//@

//@this part needs to be performed for every single event

void analyze(const Event& event){

const double weight = event.weight();

if(zfinder.bosons().size() = 0){

const Particle& eefromZ = zfinder.bosons()[0];

_histogram_Z_mass.fill(eefromZ.mass(), weight);

}

}

//@this part only needs to be performed only once in the end

void finalize(){

normalize(_histogram_Z_mass, 100.);//normalize histogram areas to 100.

}

After constructing the codes fully, scramb and check whether SherpaTEST is shown in the list with

rivet --list-analyses

-- SiHyunJeon - 2018-06-19</verbatim>

Edit | Attach | Watch | Print version | History: r11 < r10 < r9 < r8 < r7 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r11 - 2019-02-01 - SiHyunJeon
 
    • 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-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback