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 should use HGC v9 geometry:

!Sample
/DYToLL_M-50_14TeV_TuneCP5_pythia8/PhaseIIMTDTDRAutumn18DR-PU200_103X_upgrade2023_realistic_v2-v2/FEVT
/SingleE_FlatPt-2to100/PhaseIIMTDTDRAutumn18DR-PU200_103X_upgrade2023_realistic_v2-v1/FEVT
/SingleE_FlatPt-2to100/PhaseIIMTDTDRAutumn18DR-NoPU_103X_upgrade2023_realistic_v2-v1/FEVT
/SinglePion_FlatPt-2to100/PhaseIIMTDTDRAutumn18DR-PU200_103X_upgrade2023_realistic_v2-v1/FEVT
/SinglePion_FlatPt-2to100/PhaseIIMTDTDRAutumn18DR-NoPU_103X_upgrade2023_realistic_v2-v1/FEVT
/SinglePion0_FlatPt-8to100/PhaseIIMTDTDRAutumn18DR-PU200_103X_upgrade2023_realistic_v2-v1/FEVT
/SinglePion0_FlatPt-8to100/PhaseIIMTDTDRAutumn18DR-NoPU_103X_upgrade2023_realistic_v2-v1/FEVT
/SinglePhoton_FlatPt-8to150/PhaseIIMTDTDRAutumn18DR-PU200_103X_upgrade2023_realistic_v2-v1/FEVT
/SinglePhoton_FlatPt-8to150/PhaseIIMTDTDRAutumn18DR-NoPU_103X_upgrade2023_realistic_v2-v1/FEVT
/TTbar_TuneCP5_14TeV_pythia8/PhaseIIMTDTDRAutumn18DR-NoPU_103X_upgrade2023_realistic_v2-v1/FEVT
/TTbar_14TeV_TuneCP5_Pythia8/PhaseIIMTDTDRAutumn18DR-PU200_103X_upgrade2023_realistic_v2-v1/FEVT
/DYToLL_M-50_14TeV_TuneCP5_pythia8/PhaseIIMTDTDRAutumn18DR-NoPU_103X_upgrade2023_realistic_v2-v2/FEVT
Info These samples should be updated in the future

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

To ntuplize the output file, we adapt the code from FastPUPPI. The modified version of the code is attached to the twiki. Update L1Trigger/L1TCommon/plugins/BuildFile.xml with

<use name="L1Trigger/Phase2L1ParticleFlow"/>
<use name="DataFormats/L1Trigger"/>
<use name="DataFormats/Phase2L1ParticleFlow"/>

and copy runMyNTyplizer.py to L1Trigger/L1TCommon/test/ and MyNTuplizer.cc to L1Trigger/L1TCommon/plugins/

To run the ntuplizer, execute:

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

In the ntuplizer two objects are obtained: PFElectron and L1Electron.

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: r19 < r18 < r17 < r16 < r15 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r19 - 2020-05-06 - 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