Previous page

PFlow at L1 trigger

Overview

This page provide useful information about implementation of the FPlow with FPGAs for CMS L1 trigger using HLS

On this page:

Usefull Links

Samples

All samples to be used for the L1 trigger studies have HGC v11 geometry, produced with rel 11.1.2. For full list of samples run dasgoclient -query="dataset=/*/Phase2HLTTDRSummer20ReRECOMiniAOD-*/*"

!Sample
/DoublePhoton_FlatPt-1To100/Phase2HLTTDRSummer20ReRECOMiniAOD-PU200_111X_mcRun4_realistic_T15_v1_ext2-v3/FEVT
/DoubleElectron_FlatPt-1To100/Phase2HLTTDRSummer20ReRECOMiniAOD-NoPU_111X_mcRun4_realistic_T15_v1-v1/GEN-SIM-DIGI-RAW-MINIAOD
/DoubleElectron_FlatPt-1To100/Phase2HLTTDRSummer20ReRECOMiniAOD-PU140_111X_mcRun4_realistic_T15_v1-v2/GEN-SIM-DIGI-RAW-MINIAOD
/DoubleElectron_FlatPt-1To100/Phase2HLTTDRSummer20ReRECOMiniAOD-PU200_111X_mcRun4_realistic_T15_v1-v2/GEN-SIM-DIGI-RAW-MINIAOD
/SinglePion_PT0to200/Phase2HLTTDRSummer20ReRECOMiniAOD-NoPU_111X_mcRun4_realistic_T15_v1-v1/GEN-SIM-DIGI-RAW-MINIAOD
/SinglePion_PT0to200/Phase2HLTTDRSummer20ReRECOMiniAOD-PU140_phase2_111X_mcRun4_realistic_T15_v1-v1/GEN-SIM-DIGI-RAW-MINIAOD
/SinglePion_PT0to200/Phase2HLTTDRSummer20ReRECOMiniAOD-PU200_111X_mcRun4_realistic_T15_v1-v1/GEN-SIM-DIGI-RAW-MINIAOD
/DoublePhoton_FlatPt-1To100/Phase2HLTTDRSummer20ReRECOMiniAOD-NoPU_111X_mcRun4_realistic_T15_v1-v1/FEVT
/DoublePhoton_FlatPt-1To100/Phase2HLTTDRSummer20ReRECOMiniAOD-PU140_111X_mcRun4_realistic_T15_v1_ext1-v2/FEVT
Info

Software

L1 Trigger emulation

The following code is the emulation of the L1 trigger (SWGuideL1TPhase2Instructions) for phase 2 upgrade.

export SCRAM_ARCH=slc7_amd64_gcc700
cmsrel CMSSW_10_6_1_patch2
cd CMSSW_10_6_1_patch2/src
cmsenv
git cms-init
git remote add cms-l1t-offline git@github.com:cms-l1t-offline/cmssw.git
git fetch cms-l1t-offline phase2-l1t-integration-CMSSW_10_6_1_patch2
git cms-merge-topic -u cms-l1t-offline:l1t-phase2-v2.36.4
git cms-addpkg L1Trigger/L1TCommon
scram b -j8

  • Initial setup:

cd CMSSW_10_6_1_patch2/src
cmsenv

Before running the code, slim the output file by requesting the following. This to be able to process the events using the runRespNTupler.py of FastPUPPI code:

define era:
process = cms.Process('REPR',eras.Phase2C4_trigger)
and change the outputCommands:
            outputCommands = cms.untracked.vstring("drop *",
            # --- GEN
            "keep *_genParticles_*_*",
            "keep *_ak4GenJetsNoNu_*_*",
            # --- PF IN
            "keep *_TTTracksFromTracklet_Level1TTTracks_*",
            # HGC
            "keep *_hgcalBackEndLayer2Producer*_*_REPR",
            # muons
            "keep *_simGmtStage2Digis__*",
            # hcal (old)
            "keep *_simHcalTriggerPrimitiveDigis__*",
            # new ecal and hcal
            "keep *_L1EGammaClusterEmuProducer_*_*",
            # --- VERTEXING ---
            "keep *_VertexProducer_*_*",
            # E/gamma
            "keep *_l1EGammaEEProducer_*_*",
            "keep *_L1TkElectronsHGC_*_*",
            # --- PF OUT
            "keep l1tPFClusters_pfClustersFromHGC3DClusters_*_*",
            "keep l1tPFCandidates_l1tPFCandidates_PF_REPR",
        ),

cd ${CMSSW_BASE}/src
cmsRun L1Trigger/L1TCommon/test/reprocess_test_10_4_0.py

For quick validation of the inputs, one can access the PF and L1 objects:
Events->SetAlias("L1Egamma","l1tEGammaBXVector_l1EGammaEEProducer_L1EGammaCollectionBXVWithCuts_REPR.obj")
Events->SetAlias("L1Electron","l1tL1TkElectronParticles_L1TkElectronsHGC_EG_REPR.obj")
Events->SetAlias("L1ElectronElliptic","l1tL1TkElectronParticles_L1TkElectronsEllipticMatchHGC_EG_REPR.obj")
The objects are of form of BXVector, which is a vectors for different bunch crossing (to define timing). To plot the reconstruction algorithm variable (hwQual) execute the following lines:
Events->Scan("L1Electron.pt() : L1Electron.hwQual() : L1Electron.hwQual() : L1ElectronElliptic.pt()")
Events->Scan("L1Egamma.at(0,7).pt() : L1Egamma.at(0,7).hwQual() ","L1Egamma.size()>6")

Ntuplizer

RAW/MINIAOD files can be ntuplized using the following command:

cmsRun $CMSSW_BASE/src/L1Trigger/L1CaloTrigger/test/run_step1_new.py inputFiles=PATH_TO_FILE

With the following setup:

export SCRAM_ARCH=slc7_amd64_gcc820
cmsrel CMSSW_11_1_3
cd CMSSW_11_1_3/src
cmsenv
git cms-merge-topic -u cerminar:eg_ntuples_CMSSW11.1_v0
#add to BiuldFile.xml: <use   name="L1Trigger/Phase2L1ParticleFlow"/>
cp ~mpitt/public/Trigger/L1TCommon/plugins/MyNTuplizer.cc L1Trigger/L1CaloTrigger/plugins/
cp ~mpitt/public/Trigger/L1TCommon/test/run_step1_*.py L1Trigger/L1CaloTrigger/test
cp ~mpitt/public/Trigger/L1TCommon/python/calo_idModifier.py  L1Trigger/L1CaloTrigger/python
#if new EGID files are available copy them to L1THGCal:
git cms-addpkg L1Trigger/L1THGCal
cp ../../EGID/*xml L1Trigger/L1THGCal/data/
#compile
scram b -j
cmsenv
cd ../../

To skip EG/PF reconstruction, commit relevant lines from the scheduler. To set up different EGID modify L1Trigger/L1CaloTrigger/python/calo_idModifier.py accordingly.

In the ntuplizer two objects are obtained: PFlow and and L1Egamma.

PFElectron

The PFElectron is stored as reco::Candidate. To retrieve them from the event container use:

//token= consumes<reco::CandidateView> (iConfig.getParameter<edm::InputTag>("PFElectron"));
edm::Handle<reco::CandidateView> ecals;
iEvent.getByToken(token, ecals);
for (const reco::Candidate & it : *ecals) {
            std::cout << "L1TPFCaloProducer: adding ECal input pt " << it.pt() << ", eta " << it.eta() << ", phi " << it.phi() << std::endl;
        }

L1Electron

The L1Electron is stored as egamma towers l1t::EGammaBxCollection. Each tower have hwQual value depending on calibrations EG ID, brem recovery etc. For the EndCup we will use hwQual=4,5 requirement before and after brem recovery. Example of class used to retrieve L1 objects can be found in L1TriggerNtupleTkElectrons.

PFlow implementation

The following code used to study the implementation of the PFlow algorithm using the FastPUPPI at the first trigger level.

export SCRAM_ARCH=slc7_amd64_gcc700
cmsrel CMSSW_10_6_1_patch2
cd CMSSW_10_6_1_patch2/src
cmsenv
git cms-init
git cms-checkout-topic -u p2l1pfp:L1PF_10_6_1p2_X
git clone git@github.com:p2l1pfp/FastPUPPI.git -b 106X
scram b -j8

  • Initial setup:

cd CMSSW_10_6_1_patch2/src
cmsenv

  • Generation of input files (update the maxEvents before running)

cd ${CMSSW_BASE}/src/FastPUPPI/NtupleProducer/python/
cmsRun runInputs104X.py
The output file inputs104X.root will be generated.

  • process of the files
update in runRespNTupler.py the fileNames path to link to the new file, and run:
cd ${CMSSW_BASE}/src/FastPUPPI/NtupleProducer/python/
cmsRun runRespNTupler.py
The output file respTupleNew.root will be generated.

  • plots acceptance
cd ${CMSSW_BASE}/src/FastPUPPI/NtupleProducer/python/
python scripts/respPlots.py respTupleNew_eos.root plots_dir -w l1pf -p electron --no-eta --no-fit --no-resol --xpt "mc_pt" "Gen Electron p_{T}"

The code will plot the reconstructed values of variables defined in whats depend on the -w argument. The plots will be as a function of a pT and |η| in bins defined in sels. In short it create 2D histograms of: tree->Draw("variable_pt : mc_pt","mc_eta cuts and mc_id cut").

-- MichaelPitt - 2020-01-23

Edit | Attach | Watch | Print version | History: r23 < r22 < r21 < r20 < r19 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r23 - 2020-11-10 - 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-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