L1 Trigger Emulator Stage 1 Upgrade Instructions

This is a set of instructions on how to run the new Stage-1 upgrade version of the L1 Emulator to produce rates and efficiencies. For developer information, please see SWGuideL1TOfflineDev.

Environment Setup

The Stage1 emulator is now included in the official CMSSW. Listed below are instructions for running in CMSSW_7_3_0, though they should hold for any recent release:

 
$ setenv SCRAM_ARCH slc6_amd64_gcc491
$ cmsrel CMSSW_7_3_0
$ cd CMSSW_7_3_0/src
$ cmsenv
$ git cms-addpkg L1Trigger/L1TCalorimeter
$ scram build -j 4

$$$ If "git cms-addpkg" returns the error "fatal: destination path ... already exists and is not an empty directory", you can perform the following gymnastics:
$ mkdir ~/src_temp
$ mv * ~/src_temp/
$ git cms-addpkg L1Trigger/L1TCalorimeter
$ mv ~/src_temp/* .
$ rmdir ~/src_temp
$$$ If anyone knows the "right" way to do this in git, please revise these instructions 

Running the Emulator

To run the emulator on a given dataset, edit the file

L1Trigger/L1TCalorimeter/test/SimL1Emulator_Stage1.py

so that it points at an available dataset. Then, run the configuration with

$ cmsRun L1Trigger/L1TCalorimeter/test/SimL1Emulator_Stage1.py

This will produce an EDM file which by default is named "SimL1Emulator_Stage1_PP.root". You can inspect the configuration online here.

Tunable Parameters

Tunable parameters are configured in the file L1Trigger/L1TCalorimeter/python/caloStage1Params_cfi.py. Below is a table describing the physical meanings behind some of the more important parameters.

FirmwareVersion The FirmwareVersion controls which set of algorithms are run. Currently FirmwareVersion=1 corresponds to the Heavy Ion algorithms, while FW=2 corresponds to PP algorithms.
regionPUSType Pileup subtraction algorithm; "PUM0" (def. for pp), "HICaloRingSub", "None"
egLsb This is the LSB for EGamma candidates. Do not change this unless you change the calibrations to match.
egSeedThreshold minimum ET of 2x1 EG candidate
tauSeedThreshold minimum ET of 4x8Tau candidate
tauNeighbourThreshold minimum ET of 4x4 Tau candidate's neighbour
switchOffTauVeto ET threshold when tau veto is not applied anymore
tauRelativeJetIsolationCut (12x12 - 4x8) / 4x8 < Cut, where 4x8 represents the ET of the Tau candidate and 12x12 is the ET of the matching jet.
switchOffTauIso ET threshold when relative jet isolation requirement is not applied anymore for the tau to be considered isolated.
tauRelativeJetIsolationLimit Relative jet isolation has to be smaller than this limit in order to use switchOffTauIso
jetLsb This is the LSB for Jet candidates. Do not change this unless you change the calibrations to match.
jetSeedThreshold This value is the amount (in GeV) which the central region must have to be considered a jet seed.
etSumLsb This is the LSB for EtSum candidates. Do not change this unless you change the calibrations to match.
etSumEtaMin cms.vint32(minEtaForMET, minEtaForHT); minimum Eta of regions used in energy sum calculations. Note these are specified in hw coordinates. A value of 4 corresponds to the Endcap/Forward boundary.
etSumEtaMax cms.vint32(maxEtaForMET, maxEtaForHT); maximum Eta of regions used in energy sum calculations. Note these are specified in hw coordinates. A value of 17 corresponds to the Endcap/Forward boundary.
etSumEtThreshold cms.vdouble(regionETCutForMET, regionETCutForHT); minimum ET of regions used in energy sum calculations

Computing Rates

Once you have produced an output file, you can compute the relative rates very easily by drawing from the available trees. For instance, if you'd like to draw the rate as a function of threshold for the inclusive single jet trigger, you could use a macro like this:

  const int PT_MAX = 120;
  const int nPTBINS = PT_MAX/4; // Jets are on a 4 GeV scale

  TFile *infile = TFile::Open("SimL1Emulator_Stage1.root");
  TTree *events = (TTree*)infile->Get("Events");
  TH1D *pt = new TH1D("pt",";L1 Jet p_{T} (GeV);Count",nPTBINS,0,PT_MAX);
  events->Project(pt->GetName(), "l1tJetBXVector_caloStage1FinalDigis__L1TEMULATION.obj.data_.l1t::L1Candidate.pt()[0][0]");
  TH1D *rate = new TH1D("rate",";L1 Jet p_{T} (GeV);Rate (Arb.)",
                              nPTBINS,0,PT_MAX);
  double total_integral = pt->Integral(0,nPTBINS+1);
  for(int i = 0; i < nPTBINS; i++)
  {
    double j = (double)i*(double)PT_MAX/(double)nPTBINS;
    double integral = pt->Integral(i, nPTBINS+1);
    rate->Fill(j, (double)integral/total_integral);
  }
  rate->Draw();

Alternatively, you can use the output of the L1TriggerDPG, as used in the Computing Efficiencies section below.

Computing Efficiencies

If you are interested in calculating efficiencies, you are invited to try using the L1TriggerDPG ntuplizer code. Once you have followed the Emulator compilation instructions above, do the following from the $CMSSW_BASE/src directory:
$ git clone https://github.com/cms-l1-dpg/L1Ntuples.git L1TriggerDPG/L1Ntuples
$ git clone https://github.com/cms-l1-dpg/L1Menu.git L1TriggerDPG/L1Menu
$ scram build -j4
$ cd L1TriggerDPG/L1Menu/test
$ cmsRun customL1NtupleFromRaw.py reEmulation=True reEmulMuons=True reEmulCalos=True patchNtuple=True force2012Config=True customDTTF=True dttfLutsFile=sqlite:../data/dttf_config.db globalTag=POSTLS162_V2::All runOnMC=True runOnPostLS1=True useStage1Layer2=True
This will run the L1 Emulator and DPG ntuple producer in one step.

Recipe for Running the L1 Stage1 Emulator in the HLT

As of CMSSW_7_2_0_pre8, running the Stage1 Emulator is fully compatible with the HLT MC Run-2 workflow recipe given on the SWGuideGlobalHLT twiki. To run it, please setup your CMSSW development area according to the instructions given on SWGuideGlobalHLT#Preparing_a_CMSSW_developer_area and run the following:

rehash  # (hash -r if using bash shell) 
hltGetConfiguration /dev/CMSSW_7_2_0/GRun/V11 --full --offline --mc --unprescale --process TEST --globaltag GlobalTag --l1-emulator 'stage1,gt' --l1Xml L1Menu_Collisions2015_25ns_v1_L1T_Scales_20101224_Imp0_0x102f.xml > hlt_stage1.py
cmsRun hlt_stage1.py >& runTest.log &

Please replace GlobalTag in the hltGetConfiguration command with the GlobalTag appropriate for the MC sample being used. This information can be found on the SWGuideGlobalHLT twiki.

This recipe will run both the updated calorimeter and muon emulators for 2015. If you wish to run an HLT menu other than the one listed above, please be sure it only uses L1 seeds found in the L1Menu_Collisions2015_25ns_v1 menu. Otherwise the job will crash. See L1Menu_Collisions2015_25ns_v1 for the list of allowed seeds.

Listed below are instructions for running the L1 Stage1 upgrade emulator in the HLT in CMSSW_7_2_0_pre7. This recipe runs both the updated calorimeter and muon emulators for 2015.

cmsrel CMSSW_7_2_0_pre7
cd CMSSW_7_2_0_pre7/src
cmsenv
git cms-merge-topic --unsafe cms-l1t-offline:Emulator_1.5
scram b -j7
rehash  # (hash -r if using bash shell) 
hltGetConfiguration /dev/CMSSW_7_2_0/GRun/V11 --full --offline --mc --unprescale --process TEST --globaltag PRE_LS172_V16 --l1-emulator 'stage1,gt' --l1Xml L1Menu_Collisions2015_25ns_v1_L1T_Scales_20101224_Imp0_0x102f.xml > hlt_stage1.py &
cmsRun hlt_stage1.py >& runTest.log &

Note there is no need to add

from SLHCUpgradeSimulations.Configuration.postLS1Customs import *
process = customise_HLT( process )

to the end of hlt_stage1.py as directed for PostLS1 workflows on the SWGuideGlobalHLT twiki, as this is already taken care of in this recipe.

If you wish to run an HLT menu other than the one listed above, please be sure it only uses L1 seeds found in the L1Menu_Collisions2015_25ns_v1 menu. Otherwise the job will crash. See L1Menu_Collisions2015_25ns_v1 for the list of allowed seeds.

Listed below are instructions for running the L1 Stage1 upgrade emulator in the HLT for CMSSW_7_2_0_pre6. This recipe runs both the updated calorimeter and muon emulators for 2015. The default CMSSW_7_2_0_pre6 GRun menu, /dev/CMSSW_7_1_2/GRun/V15, is used as an example, but any menu compatible with this release should work as well.

cmsrel CMSSW_7_2_0_pre6
cd CMSSW_7_2_0_pre6/src
cmsenv
git cms-merge-topic --unsafe cms-l1t-offline:Stage1plusHLT_V0
scram b -j7
rehash  # (hash -r if using bash shell) 
cp L1Trigger/L1TCommon/data/dttf_config.db $PWD  ## for now, this file must reside in the directory you will ultimately run from
hltGetConfiguration /dev/CMSSW_7_1_2/GRun/V15 --full --offline --mc --unprescale --process TEST --globaltag auto:upgradePLS1 --l1-emulator 'stage1,gt' > hlt_stage1.py
cmsRun hlt_stage1.py >& runTest.log &

Note there is no need to add

from SLHCUpgradeSimulations.Configuration.postLS1Customs import *
process = customise_HLT( process )

to the end of hlt_stage1.py as directed for PostLS1 workflows on the SWGuideGlobalHLT twiki, as this is already taken care of in this recipe.

Running the Preliminary 2015 L1 Menu

To include the candidate 2015 L1 Menu, L1Menu_Collisions2015_25ns_v1, in the L1 Stage1 emulator + HLT workflow, please add the following to the recipe given above:

cd $CMSSW_BASE/src
git cms-addpkg L1TriggerConfig/L1GtConfigProducers
cp -a /afs/cern.ch/user/g/ghete/public/L1Menu/L1Menu_Collisions2015_25ns_v1/xml/Rev.1.1/L1Menu_Collisions2015_25ns_v1_L1T_Scales_20101224_Imp0_0x102f.xml L1TriggerConfig/L1GtConfigProducers/data/Luminosity/startup/
and add the option --l1Xml L1Menu_Collisions2015_25ns_v1_L1T_Scales_20101224_Imp0_0x102f.xml to the hltGetConfiguration command given above
hltGetConfiguration /dev/CMSSW_7_2_0/GRun/V11 --full --offline --mc --unprescale --process TEST --globaltag auto:upgradePLS1 --l1-emulator 'stage1,gt' --l1Xml L1Menu_Collisions2015_25ns_v1_L1T_Scales_20101224_Imp0_0x102f.xml > hlt_stage1_newL1Menu.py
Before running, please be sure the HLT menu has be updated to use only L1 seeds found in the L1Menu_Collisions2015_25ns_v1 menu. See L1Menu_Collisions2015_25ns_v1 for the list of allowed seeds.


-- RichardBarbieri - 26 May 2014

Edit | Attach | Watch | Print version | History: r30 < r29 < r28 < r27 < r26 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r30 - 2015-09-16 - AndrewBrinkerhoff
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    CMSPublic 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