Previous page

Low μ analysis with PPS

Overview

This page contain analysis instructions of low μ run data collected in 2017.

On this page:

Usefull Links

  • W/Z in low pileup runs (5 and 13 TeV): link
  • top in low pileup run (5 TeV only) link

Data and MC samples

Sample Xsec [pb]
/DYJetsToLL_M-50_TuneCP5_13TeV-amcatnloFXFX-pythia8/RunIIFall17MiniAODv2-fixECALGT_LowPU_94X_mc2017_realistic_v10For2017H_v2_ext1-v1/MINIAODSIM XXX
/ZJToMuMuJ_M-50_scales0p5to4_TuneCP5_13TeV_powheg2-minlo-pythia/RunIIFall17MiniAODv2-fixECALGT_LowPU_94X_mc2017_realistic_v10For2017H_v2_ext1-v1/MINIAODSIM 1966.0648
/ZJToEEJ_M-50_scalesUpTo8_NNPDF31_plus_CMSPDF_TuneCP5_13TeV_powheg2-minlo-pythia/RunIIFall17MiniAODv2-fixECALGT_LowPU_94X_mc2017_realistic_v10For2017H_v2_ext1-v1/MINIAODSIM XXX
/WpToMuNu_TuneCP5_13TeV-powheg-pythia8/RunIIFall17MiniAODv2-fixECALGT_LowPU_94X_mc2017_realistic_v10For2017H_v2-v1/MINIAODSIM XXX
/WpToENu_TuneCP5_13TeV-powheg-pythia8/RunIIFall17MiniAODv2-fixECALGT_LowPU_94X_mc2017_realistic_v10For2017H_v2-v1/MINIAODSIM XXX
/WmToMuNu_TuneCP5_13TeV-powheg-pythia8/RunIIFall17MiniAODv2-fixECALGT_LowPU_94X_mc2017_realistic_v10For2017H_v2-v1/MINIAODSIM XXX
/WmToENu_TuneCP5_13TeV-powheg-pythia8/RunIIFall17MiniAODv2-fixECALGT_LowPU_94X_mc2017_realistic_v10For2017H_v2-v1/MINIAODSIM XXX
/WZTo3LNu_TuneCP5_13TeV-powheg-pythia8/RunIIFall17MiniAODv2-fixECALGT_LowPU_94X_mc2017_realistic_v10For2017H_v2_ext1-v1/MINIAODSIM XXX
/WWTo2L2Nu_TuneCP5_13TeV-powheg-pythia8/RunIIFall17MiniAODv2-fixECALGT_LowPU_94X_mc2017_realistic_v10For2017H_v2_ext1-v1/MINIAODSIM XXX
/WJetsToLNu_2J_TuneCP5_13TeV-amcatnloFXFX-pythia8/RunIIFall17MiniAODv2-fixECALGT_LowPU_94X_mc2017_realistic_v10For2017H_v2-v1/MINIAODSIM XXX
/WJetsToLNu_0J_TuneCP5_13TeV-amcatnloFXFX-pythia8/RunIIFall17MiniAODv2-fixECALGT_LowPU_94X_mc2017_realistic_v10For2017H_v2_ext1-v1/MINIAODSIM XXX
/TTToSemiLeptonic_TuneCP5_13TeV-powheg-pythia8/RunIIFall17MiniAODv2-fixECALGT_LowPU_94X_mc2017_realistic_v10For2017H_v2_ext1-v1/MINIAODSIM 299.57212
/TTToHadronic_TuneCP5_13TeV-powheg-pythia8/RunIIFall17MiniAODv2-fixECALGT_LowPU_94X_mc2017_realistic_v10For2017H_v2_ext1-v1/MINIAODSIM XXX
/TTTo2L2Nu_TuneCP5_13TeV-powheg-pythia8/RunIIFall17MiniAODv2-fixECALGT_LowPU_94X_mc2017_realistic_v10For2017H_v2_ext1-v1/MINIAODSIM XXX
/QCD_Pt_3200toInf_TuneCP5_13TeV_pythia8/RunIILowPUAutumn18MiniAOD-pilot_102X_upgrade2018_realistic_v15-v1/MINIAODSIM XXX
/QCD_Pt-80to120_TuneCUETP8M1_13TeV-pythia8/RunIIFall15MiniAODv2-LowPU_LowPU_76X_mcRun2_asymptotic_v12-v2/MINIAODSIM XXX
/QCD_Pt-50to80_TuneCUETP8M1_13TeV-pythia8/RunIIFall15MiniAODv2-LowPU_LowPU_76X_mcRun2_asymptotic_v12-v1/MINIAODSIM XXX
/QCD_Pt-30to50_TuneCUETP8M1_13TeV-pythia8/RunIIFall15MiniAODv2-LowPU_LowPU_76X_mcRun2_asymptotic_v12-v1/MINIAODSIM XXX
/QCD_Pt-20to30_TuneCUETP8M1_13TeV-pythia8/RunIIFall15MiniAODv2-LowPU_lowPU_76X_mcRun2_asymptotic_v12-v1/MINIAODSIM XXX
/QCD_Pt-120to200_TuneCUETP8M1_13TeV-pythia8/RunIIFall15MiniAODv2-LowPU_LowPU_76X_mcRun2_asymptotic_v12-v1/MINIAODSIM XXX
/PrmtD0_pT-1p2_y-2p4_pp_13TeV_Pythia8/RunIILowPUAutumn18MiniAOD-102X_upgrade2018_realistic_v15-v1/MINIAODSIM XXX
/NonPrD0_pT-1p2_y-2p4_pp_13TeV_pythia8/RunIILowPUAutumn18MiniAOD-102X_upgrade2018_realistic_v15-v1/MINIAODSIM XXX
/MinBias_TuneCP5_13TeV_pythia8/RunIILowPUAutumn18MiniAOD-102X_upgrade2018_realistic_v15-v1/MINIAODSIM XXX
/JpsiToMuMu_OniaMuonFilter_TuneCUEP8M1_13TeV-pythia8/RunIISpring15DR74-Asympt50nsLowPU_MCRUN2_74_V8-v1/MINIAODSIM XXX
/InclusivectoMu_cMuonFilter_TuneCUEP8M1_13TeV-pythia8/RunIISpring15DR74-Asympt50nsLowPU_MCRUN2_74_V8-v1/MINIAODSIM XXX
/InclusivectoMu_cMuonFilter_TuneCUEP8M1_13TeV-pythia8-evtgen/RunIISpring15DR74-Asympt50nsLowPU_MCRUN2_74_V8-v1/MINIAODSIM XXX
/InclusivebtoMu_bMuonFilter_TuneCUEP8M1_13TeV-pythia8/RunIISpring15DR74-Asympt50nsLowPU_MCRUN2_74_V8-v1/MINIAODSIM XXX
/InclusivebtoMu_bMuonFilter_TuneCUEP8M1_13TeV-pythia8-evtgen/RunIISpring15DR74-Asympt50nsLowPU_MCRUN2_74_V8-v1/MINIAODSIM XXX

Info The cross section is obtained from the file by Runs->Scan("GenRunInfoProduct_generator__SIM.obj.crossSection()")

Stream Lumi
/DoubleMuon/Run2017H-17Nov2017-v1/MINIAOD XXX
/HighEGJet/Run2017H-17Nov2017-v1/MINIAOD XXX
/SingleMuon/Run2017H-17Nov2017-v2/MINIAOD XXX

Analysis

Ntuple production

Production is performed using TopLJets2015 analysis package which use PPS reconstruction data.

Instruction of running the PPS reconstruction standalone can be viewed in section PPS reconstruction/simulation.

Before submitting jobs, ProtonReconstrution and TopLJets2015 packages must be installed properly with CMSSW.

scram project CMSSW CMSSW_10_6_0
cd CMSSW_10_6_0/src
cmsenv

git cms-init
git remote add ctpps git@github.com:CTPPS/cmssw.git
git fetch ctpps
git checkout -b test ctpps/proton_reco_step4

git cms-addpkg\
  CalibPPS/ESProducers\
  CondFormats/CTPPSReadoutObjects\
  CondFormats/DataRecord\
  CondFormats/RunInfo\
  Configuration/Eras\
  DQM/CTPPS\
  DataFormats/CTPPSReco\
  DataFormats/ProtonReco\
  Geometry/VeryForwardGeometryBuilder\
  IOMC/EventVertexGenerators\
  IOMC/ParticleGuns\
  RecoCTPPS/Configuration\
  RecoCTPPS/PixelLocal\
  RecoCTPPS/ProtonReconstruction\
  RecoCTPPS/TotemRPLocal\
  SimCTPPS/Generators\
  Validation/CTPPS

scram b -r -j8

# --------------------------

#EGM id
git cms-merge-topic cms-egamma:EgammaPostRecoTools
scram b -j8

#B-fragmentation analyzer
mkdir TopQuarkAnalysis 
cd TopQuarkAnalysis
git clone -b 94x https://gitlab.cern.ch/psilva/BFragmentationAnalyzer.git
scram b -j8
cd -

#CTPPSAnalysisTools package (contains LHC conditions for different runs)
git clone https://github.com/forthommel/CTPPSAnalysisTools.git
scram b 

#TopLJets package
cd $CMSSW_BASE/src
git clone https://github.com/pfs/TopLJets2015.git -b 106_protonreco
cd TopLJets2015
scram b -j8
cd -
# --------------------------

cd ../..

mkdir -p cms-data/CalibPPS/ESProducers
cd cms-data/CalibPPS/ESProducers/CalibPPS/ESProducers/

git clone git@github.com:CTPPS/CalibPPS-ESProducers.git -b proton_reco_step2 data
cp -r data $CMSSW_BASE/src/
#cd ../../
#export CMSSW_SEARCH_PATH="$CMSSW_SEARCH_PATH:$(pwd -P)"
#export CMSSW_DATA_PATH="/afs" # this assumes that your work directory is on AFS

Setup

In a new shell execute the following commands:

cd CMSSW_10_6_0/src
cmsenv
#cd ../../cms-data/
#export CMSSW_SEARCH_PATH="$CMSSW_SEARCH_PATH:$(pwd -P)"
#export CMSSW_DATA_PATH="/afs"
#cd ../

The analysis will be performed with miniAODs, where the proton reconstruction will be obtained from the RAW data. In order to run simultaneously on both MINIAOD and RAW few modifications to the TopLJets2015 package should be done. Before that it good to test if the ProtonRecontsruction algorithm is working. To Test the algorithm on a RAW data file execute the following script:

cmsRun 2017H_W_mass_cfg.py

The scripts are attached to the twiki, rename them from XXX.py.txt to XXX.py and modify the filename to the one found in DAS, (for example for dataset=/SingleMuon/Run2017H-v1/RAW).

Local tests

NanoAOD production

To test the ntuplizer we shall run a local tests using the TopLJets2015 package, execute:

cmsRun $CMSSW_BASE/src/TopLJets2015/TopAnalysis/test/runMiniAnalyzer_cfg.py runOnData=True  era=era2017 redoProtonRecoFromRAW=True applyFilt=False globalTag=106X_dataRun2_v24 maxEvents=200

With a new list era2017 in customizeInputFiles.py file. Get The primary miniAOD and the corresponding RAW file from the DAS by selection an input file, and clicking on the parent link. Modify the runMiniAnalyzer_cfg.py to include the recent PPS reconstruction with the protonRecoLowMu_cfg.py attached to the twiki.

In addition to include low-μ triggers modify the miniAnalyzer_cfi.py to include low threshold triggers.

    elif '2017' in era:
        if runOnData:
            process.source.fileNames = cms.untracked.vstring('file:/eos/user/m/mpitt/LowMu/Samples/FA9FA831-8B34-E811-BA1D-008CFAC93CFC.root')
            if runWithAOD:
                print 'Adding secondary filenames'
                process.source.secondaryFileNames = cms.untracked.vstring([
                    'file:/eos/user/m/mpitt/LowMu/Samples/10B7D572-E9D1-E711-89D3-02163E019BCA.root',
                    'file:/eos/user/m/mpitt/LowMu/Samples/1E877022-EED1-E711-84A8-02163E01A473.root',
                    'file:/eos/user/m/mpitt/LowMu/Samples/24D6AED6-ECD1-E711-B698-02163E01A3DF.root',
                    'file:/eos/user/m/mpitt/LowMu/Samples/261E9645-EDD1-E711-A59B-02163E01A5C6.root',
                    'file:/eos/user/m/mpitt/LowMu/Samples/3062E753-E0D1-E711-ACC3-02163E011A80.root',
                    'file:/eos/user/m/mpitt/LowMu/Samples/383AE474-ECD1-E711-8869-02163E014206.root',
                    'file:/eos/user/m/mpitt/LowMu/Samples/3E805EF3-E8D1-E711-8FC4-02163E011B83.root',
                    'file:/eos/user/m/mpitt/LowMu/Samples/6097563B-EDD1-E711-9A3D-02163E011D03.root',
                    'file:/eos/user/m/mpitt/LowMu/Samples/400CA754-EDD1-E711-8947-02163E0134BF.root',
                    'file:/eos/user/m/mpitt/LowMu/Samples/7AE2E3E3-E8D1-E711-B6F9-02163E014159.root',
                    'file:/eos/user/m/mpitt/LowMu/Samples/C223F6C8-EAD1-E711-BA08-02163E014142.root',
                    'file:/eos/user/m/mpitt/LowMu/Samples/C41308C7-EDD1-E711-A257-02163E01A255.root',
                    'file:/eos/user/m/mpitt/LowMu/Samples/FE685172-E7D1-E711-827B-02163E0127CE.root',
                    'file:/eos/user/m/mpitt/LowMu/Samples/E871EBD4-EDD1-E711-874F-02163E0142C7.root',
                    'file:/eos/user/m/mpitt/LowMu/Samples/001B0186-E8D1-E711-BAB4-02163E019E63.root',
                    'file:/eos/user/m/mpitt/LowMu/Samples/020E8546-EBD1-E711-97E6-02163E014328.root',
                    'file:/eos/user/m/mpitt/LowMu/Samples/08A0ECBE-EBD1-E711-AD94-02163E011D0F.root',
                    'file:/eos/user/m/mpitt/LowMu/Samples/7222AC6A-E4D1-E711-A16B-02163E01A2C6.root'
                ])
        else:
            process.source.fileNames = cms.untracked.vstring('/store/mc/RunIIAutumn18MiniAOD/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/MINIAODSIM/102X_upgrade2018_realistic_v15_ext2-v1/50001/FD88E288-BFD2-F444-AD4C-844482719AA2.root')

if options.runOnData and options.redoProtonRecoFromRAW:
      from TopLJets2015.TopAnalysis.protonRecoLowMu_cfg import ctppsCustom
      ctppsCustom(process)

      process.ppsReco=cms.Path(process.ctppsRawToDigi*process.recoCTPPS)
      toSchedule.append(process.ppsReco)

    2017:[
    ...
    'HLT_HIL3Mu5_v1',
    'HLT_HIL3Mu5_Track1_v1',
    'HLT_HIL3Mu5_Track1_Jpsi_v1',
    'HLT_HIMu7p5_L2Mu2_Jpsi_v1',
    'HLT_HIMu7p5_Track2_Jpsi_v1',
    'HLT_HIMu7p5_L2Mu2_Upsilon_v1',
    'HLT_HIMu7p5_Track2_Upsilon_v1',
    'HLT_HIDimuon0_Jpsi_v1',
    'HLT_HIDimuon0_Jpsi_NoVertexing_v1',
    'HLT_HIDimuon0_Upsilon_NoVertexing_v1',
    ...
    ],
Warning, important Make sure that the number of triggers does not exceeds 64, remove some triggers from the list!

Example used in the analysis (LINK TO THE FILE) is attached to this twiki.

The code will load the trigger list from miniAnalyzer_cfi.py and execute the MiniAnalyzer.cc script (similar to EventLoop in ATLAS). For each event MiniAnalyzer::analyze() function will be called, and the object selection executed.

The output files will be MiniEvents.root,

To make some local tests with the output file you can execute the following code lines in ROOT (after root -l MiniEvents.root)

  • List relevant triggers:
TH1F * tr = (TH1F*)analysis->Get("triggerList");
for(int i=0;i<tr->GetXaxis()->GetNbins();i++){float n=tr->GetBinContent(i+1); if(n) cout << tr->GetXaxis()->GetBinLabel(i+1) << " "<< n << endl;}

ntuple production

The next step is is analyzing the the nanoAOD file, this is done executing the following code:

python $CMSSW_BASE/src/TopLJets2015/TopAnalysis/scripts/runLocalAnalysis.py -i MiniEvents.root --tag Data13TeV_2017H_SingleMuon_v2 -o ntuple.root --njobs 1 -q local --era era2017 -m RunLowMu2020 --skimtree True

The LowMu2020 method is attached (LINK TO THE FILE), and it should be copied to TopLJets2015 package.

PPS reconstruction (data)

Full instructions can be found in TaggedProtonsRecommendations. For low μ runs the proton reconstruction should be run on AOD/RAW (and not miniAOD). In the following processing of AOD is explained.

The ProtonReconstruction tested CMSSW_10_6_0 with some additional modifications:

After installation of CMSSW the following script should be executed:

import FWCore.ParameterSet.Config as cms
from Configuration.StandardSequences.Eras import eras

process = cms.Process("CTPPSTestProtonReconstruction", eras.Run2_2017)

# minimum of logs
process.MessageLogger = cms.Service("MessageLogger",
  statistics = cms.untracked.vstring(),
  destinations = cms.untracked.vstring("cout"),
  cout = cms.untracked.PSet(
    threshold = cms.untracked.string("WARNING")
  )
)

# raw data source
process.source = cms.Source("PoolSource",
  fileNames = cms.untracked.vstring("file:/afs/cern.ch/work/m/mpitt/LowMu/Samples/AOD.root")
)

process.maxEvents = cms.untracked.PSet(
  input = cms.untracked.int32(500)
)

# load default alignment settings
process.load("CalibPPS.ESProducers.ctppsAlignment_cff")

# raw-to-digi conversion
#process.load("EventFilter.CTPPSRawToDigi.ctppsRawToDigi_cff")

# local RP reconstruction chain with standard settings
process.load("RecoCTPPS.Configuration.recoCTPPS_cff")

# define conditions
from conditions import SetConditions
SetConditions(process)

#Add output file:
process.ProtonSIMoutput= cms.OutputModule(
    "PoolOutputModule",
    outputCommands = cms.untracked.vstring('keep *'),
    fileName = cms.untracked.string("miniAOD_withProtons.root"),
    dataset = cms.untracked.PSet(
      dataTier = cms.untracked.string('MINIAODSIM')
    ),
    SelectEvents = cms.untracked.PSet()
)
process.ProtonSIMoutput_step = cms.EndPath(process.ProtonSIMoutput)

# processing sequence
process.path = cms.Path(
  process.totemRPUVPatternFinder
  * process.totemRPLocalTrackFitter
  * process.ctppsDiamondRecHits
  * process.ctppsDiamondLocalTracks
  * process.ctppsPixelLocalTracks
  * process.ctppsLocalTrackLiteProducer
  * process.ctppsProtons
)

process.schedule=cms.Schedule( process.path, process.ProtonSIMoutput_step)


The conditions.py file is attached to the twiki as well.

Example:

# prepare work area
cmsrel CMSSW_10_6_0
cd CMSSW_10_6_0/src
cmsenv
# run a test
voms-proxy-init --voms cms # your credentials are requested here
cmsRun stepPPS_cfg.py # file attached to the TWiki page

Submit to grid

After the local tests are successful, one can process all the data on the grid. Correct submitToGrid.py:

config_file.write('config.JobType.inputFiles = [\'{0}\',\'{1}\',\'muoncorr_db.txt\',\'jecUncSources.txt\',\'qg_db.db\',\'ctpps_db.db\']\n'.format(jecDB,jerDB))
...
githash=commands.getstatusoutput('git log --pretty=format:\'%h\' -n 1')[1]
by
config_file.write('config.JobType.inputFiles = [\'{0}\',\'{1}\',\'muoncorr_db.txt\',\'jecUncSources.txt\',\'qg_db.db\']\n'.format(jecDB,jerDB))
...
githash=commands.getstatusoutput('cd ${CMSSW_BASE}/src/TopLJets2015 && git log --pretty=format:\'%h\' -n 1')[1]

Now the jobs can be submitted by executing the following lines:

python ${CMSSW_BASE}/src/TopLJets2015/TopAnalysis/scripts/submitToGrid.py -j ${CMSSW_BASE}/src/TopLJets2015/TopAnalysis/data/era2017/samples.json \
--lumi /afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions17/13TeV/Final/Cert_306896-307082_13TeV_PromptReco_Collisions17_JSON_LowPU.txt \
-c ${CMSSW_BASE}/src/TopLJets2015/TopAnalysis/test/runMiniAnalyzer_cfg.py --only 2017H --addParents --rawParents --lfn /store/group/cmst3/user/mpitt/LowMu/nanoAOD
source /cvmfs/cms.cern.ch/crab3/crab.sh
export SCRAM_ARCH=slc7_amd64_gcc700
crab submit -c grid/Data13TeV_2017H_SingleMuon_v2_cfg.py
#to track the progress:
crab status -d grid/Data13TeV_2017H_SingleMuon_v2_cfg

Submit to condor

Execute the following code:

python $CMSSW_BASE/src/TopLJets2015/TopAnalysis/scripts/submitLocalNtuplizer.py --dryRun  --addParent --proxy \
--lumiMask /afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions17/13TeV/Final/Cert_306896-307082_13TeV_PromptReco_Collisions17_JSON_LowPU.txt \
--jobTag Data13TeV_2017H_SingleMuon_v2 --dataset /SingleMuon/Run2017H-17Nov2017-v2/MINIAOD --output /store/group/cmst3/user/mpitt/LowMu \
--extraOpts runOnData=True,era=era2017,applyFilt=False,globalTag=106X_dataRun2_v24

The output that will appear in $CMSSW_BASE/FarmLocalNtuple/. Now run the jobs:

condor_submit $CMSSW_BASE/FarmLocalNtuple/condor_Data13TeV_2017H_SingleMuon_v2.sub

Help If something is not working, consult with these slides or LxbatchHTCondor

Plots

execute this and that

-- MichaelPitt - 2019-12-07

Topic attachments
I Attachment History Action Size Date Who Comment
Texttxt 2017H_W_mass_cfg.py.txt r1 manage 0.8 K 2019-12-09 - 23:14 MichaelPitt Test for PPS reconstruction code (From Jan K.)
Texttxt base.py.txt r1 manage 2.0 K 2019-12-09 - 23:14 MichaelPitt Test for PPS reconstruction code (From Jan K.)
Texttxt conditions.py.txt r1 manage 5.1 K 2019-12-09 - 23:14 MichaelPitt Test for PPS reconstruction code (From Jan K.)
Texttxt protonRecoLowMu_cfg.py.txt r1 manage 6.9 K 2019-12-10 - 22:51 MichaelPitt  
Edit | Attach | Watch | Print version | History: r26 < r25 < r24 < r23 < r22 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r26 - 2020-01-22 - MichaelPitt
 
    • 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-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback