Create C++ codes from L1 menu xml file for rate analysis

  • login to lxplus.cern.ch
  • type the following commands to create C++ header and source files as well as input file for rate analysis with cms-l1-dpg/L1Menu
cmsrel CMSSW_10_0_0
cd CMSSW_10_0_0
cmsenv

. /afs/cern.ch/user/t/tmatsush/public/utm-setup.sh # for bash
# source /afs/cern.ch/user/t/tmatsush/public/utm-setup.csh # for tcsh
wget https://github.com/cms-l1-dpg/2017-pp-menu-dev/archive/2017-10-04.tar.gz
tar xfz 2017-10-04.tar.gz
cd 2017-pp-menu-dev-2017-10-04/Apr12/
python toRateStudy.py
cd ../..
git clone --branch develop https://gitlab.cern.ch/cms-l1t-utm/scripts.git
cp 2017-pp-menu-dev-2017-10-04/Apr12/L1Menu_Collisions2017_dev_r10.xml scripts/
cd scripts
python menu2lib.py --menu L1Menu_Collisions2017_dev_r10.xml
  • After a successful code execution, you will get menulib.hh/cc and menu.txt files in the same directory

Check contents of menu
python menu2html.py --menu L1Menu_Collisions2017_dev_r10.xml
firefox menu.html
  • Run the program with the menu you created

Use of menulib
cd $CMSSW_BASE/src
git clone --branch develop https://github.com/cms-l1-dpg/L1Menu.git  L1TriggerDPG/L1Menu
cd L1TriggerDPG/L1Menu/macros
cp $CMSSW_BASE/scripts/menulib* .
cp $CMSSW_BASE/2017-pp-menu-dev-2017-10-04/Apr12/menu.txt .
make -j 8
  • Run the program with the menu you created for rate estimation

Example: Rate estimation at PU ~ 82
  • perform rate estimation at PU ~ 82 with the unpacked decision
cp  /afs/cern.ch/user/t/tmatsush/public/20171102/* .
./testMenu2016 -b 1866 -m menu.txt -l ntuple.list --UseUnpackTree --UseuGTDecision
  • perform rate estimation at PU ~ 82 with the menulib
cp  /afs/cern.ch/user/t/tmatsush/public/20171102/* .
./testMenu2016 -b 1866 -m menu.txt -l ntuple.list --UseUnpackTree

Menu customization

  • You can add algorithms in the menulib for quick turn around of seed development. The following steps show an example for adding L1_True algorithm in the menu.
  • Add the following algorithm declaration in menulib.hh
bool L1_True(L1Analysis::L1AnalysisL1UpgradeDataFormat* data, L1Analysis::L1AnalysisL1CaloTowerDataFormat* calo_tower);
  • Add the following algorithm body in menulib.cc
bool
L1_True(L1Analysis::L1AnalysisL1UpgradeDataFormat* data, L1Analysis::L1AnalysisL1CaloTowerDataFormat* calo_tower)
{
  return true;
}
  • Register the new algorithm in name2func variable of addFuncFromName() function.
bool addFuncFromName(std::map<std::string, std::function<bool()>> &L1SeedFun,
                     L1Analysis::L1AnalysisL1UpgradeDataFormat* upgrade,
                     L1Analysis::L1AnalysisL1CaloTowerDataFormat* calo_tower)
{
  static const std::pair<std::string, AlgorithmFunction> name2func[] = {
...
, std::make_pair("L1_True", &L1_True)};

  • Register the new algorithm in menu.txt
...
L1_True                                                 511         1
...

menulib provides some functions which provides experimental features ready to be used in a custom algorithm:

/** re-calculate missing-Et with the given parameters
 *
 * @param calo [in] tower information
 * @param max_eta [in] maximum abs(tower-IEta) to take into account for the sum
 * @param threshold [in] minimum tower energy to take into account for the sum
 * @return std::pair<missing-Et, azimuth>
 */
std::pair<double, double>
get_missing_et(L1Analysis::L1AnalysisL1CaloTowerDataFormat* calo,
               const int max_eta=28,
               double threshold=0.);

/** re-calculate total-Ht with the given parameters
 *
 * @param upgrade [in] uGt inputs
 * @param max_eta [in] maximum abs(tower-IEta) to take into account for the sum
 * @param threshold [in] minimum tower energy to take into account for the sum
 * @return total-Ht
 */
double
get_total_ht(L1Analysis::L1AnalysisL1UpgradeDataFormat* upgrade,
             const int max_eta=28,
             const double threshold=30.);

/** compute transverse mass
 *
 * @param upgrade [in] uGt inputs
 * @param threshold_eg [in] minimum ET requirement for the leading-EG object
 * @param threshold [in] minimum missing-ET requirement
 * @return transverse mass. If Mt cannot be computed, -1.
 */
double
get_transverse_mass(L1Analysis::L1AnalysisL1UpgradeDataFormat* upgrade,
                    const double threshold_eg=30.,
                    const double threshold_met=30.);
Example usage is:
bool
L1_ETM100er(L1Analysis::L1AnalysisL1UpgradeDataFormat* data, L1Analysis::L1AnalysisL1CaloTowerDataFormat* calo_tower)
{
  std::pair<double, double> met = get_missing_et(calo_tower, 27);
  if (met.first >= 100) return true;
  return false;
}
NB: There is no guarantee that the experimental feature get implemented and become available in L1T system.

L1Ntuple contents of l1t-integration-v87p3

Basic contents
******************************************************************************
*Tree    :L1EventTree: L1EventTree                                           *
******************************************************************************
*Branch  :Event                                                              *
*............................................................................*
*Br    0 :run       : UInt_t                                                 *  Run number
*Br    1 :event     : ULong64_t                                              *  Event number
*Br    2 :lumi      : UInt_t                                                 *  Lumisection ID
*Br    3 :bx        : UInt_t                                                 *  Bunch-crossing ID
*Br    4 :orbit     : ULong64_t                                              *
*Br    5 :time      : ULong64_t                                              *
*Br    6 :nPV       : Int_t                                                  *
*Br    7 :nPV_True  : Int_t                                                  *
*Br    8 :hlt       : vector<TString>                                        *
*Br    9 :puWeight  : Double_t                                               *
*............................................................................*
******************************************************************************
*Tree    :L1UpgradeTree: L1UpgradeTree                                       *
******************************************************************************
*Branch  :L1Upgrade                                                          *
*............................................................................*
*Br    0 :nEGs      : UShort_t                                               *  Number of egamma candidates
*Br    1 :egEt      : vector<float>                                          *  Transverse energy
*Br    2 :egEta     : vector<float>                                          *  Pseudo-rapidity
*Br    3 :egPhi     : vector<float>                                          *  Azimuth
*Br    4 :egIEt     : vector<short>                                          *  Transverse energy in HW unit
*Br    5 :egIEta    : vector<short>                                          *  Pseudo-rapidity in HW unit
*Br    6 :egIPhi    : vector<short>                                          *  Azimuth in HW unit
*Br    7 :egIso     : vector<short>                                          *  Isolation
*Br    8 :egBx      : vector<short>                                          *  Relative bunch-crossing ID w.r.t. the triggerd one
*Br    9 :egTowerIPhi : vector<short>                                        *
*Br   10 :egTowerIEta : vector<short>                                        *
*Br   11 :egRawEt   : vector<short>                                          *
*Br   12 :egIsoEt   : vector<short>                                          *
*Br   13 :egFootprintEt : vector<short>                                      *
*Br   14 :egNTT     : vector<short>                                          *
*Br   15 :egShape   : vector<short>                                          *
*Br   16 :nTaus     : UShort_t                                               *  Number of tau candidates
*Br   17 :tauEt     : vector<float>                                          *  Transverse energy
*Br   18 :tauEta    : vector<float>                                          *  Pseudo-rapidity
*Br   19 :tauPhi    : vector<float>                                          *  Azimuth
*Br   20 :tauIEt    : vector<short>                                          *  Transverse energy in HW unit
*Br   21 :tauIEta   : vector<short>                                          *  Pseudo-rapidity in HW unit
*Br   22 :tauIPhi   : vector<short>                                          *  Azimuth in HW unit
*Br   23 :tauIso    : vector<short>                                          *  Isolation flag (isolated corresponds to tauIso>0.5)
*Br   24 :tauBx     : vector<short>                                          *  Relative bunch-crossing ID w.r.t the triggered one
*Br   25 :tauTowerIPhi : vector<short>                                       *  iPhi position of seed tower from main tau cluster
*Br   26 :tauTowerIEta : vector<short>                                       *  iEta position of seed tower from main tau cluster
*Br   27 :tauRawEt  : vector<short>                                          *  Uncalibrated Et of tau candidate (i.e. no Layer-2 calibration applied)
*Br   28 :tauIsoEt  : vector<short>                                          *  Isolation Et of tau candidate
*Br   29 :tauNTT    : vector<short>                                          *  Pileup estimator
*Br   30 :tauHasEM  : vector<short>                                          *  Flag: tau has a non-zero EM deposit
*Br   31 :tauIsMerged : vector<short>                                        *  Flag: tau is a merged candidate
*Br   32 :tauHwQual : vector<short>                                          *  Not filled, kept for further developments
*Br   33 :nJets     : UShort_t                                               *  Number of jet candidates
*Br   34 :jetEt     : vector<float>                                          *  Transverse energy
*Br   35 :jetEta    : vector<float>                                          *  Pseudo-rapidity
*Br   36 :jetPhi    : vector<float>                                          *  Azimuth
*Br   37 :jetIEt    : vector<short>                                          *  Transverse energy in HW unit
*Br   38 :jetIEta   : vector<short>                                          *  Pseudo-rapidity in HW unit
*Br   39 :jetIPhi   : vector<short>                                          *  Azimuth in HW unit
*Br   40 :jetBx     : vector<short>                                          *  Relatvie bunch-crossing ID w.r.t the triggered one
*Br   41 :jetTowerIPhi : vector<short>                                       *
*Br   42 :jetTowerIEta : vector<short>                                       *
*Br   43 :jetRawEt  : vector<short>                                          *
*Br   44 :jetSeedEt : vector<short>                                          *
*Br   45 :jetPUEt   : vector<short>                                          *
*Br   46 :jetPUDonutEt0 : vector<short>                                      *
*Br   47 :jetPUDonutEt1 : vector<short>                                      *
*Br   48 :jetPUDonutEt2 : vector<short>                                      *
*Br   49 :jetPUDonutEt3 : vector<short>                                      *
*Br   50 :nMuons    : UShort_t                                               *  Number of muon candidates
*Br   51 :muonEt    : vector<float>                                          *  Transverse momentum
*Br   52 :muonEta   : vector<float>                                          *  Pseudo-rapidity at the muon system (typically at the second muon station)
*Br   53 :muonPhi   : vector<float>                                          *  Azimuth at the muon system (typically at the second muon station)
*        :muonEtaAtVtx   : vector<float>                                     *  Pseudo-rapidity projected to the vertex (for future l1t-integration tag)
*        :muonPhiAtVtx   : vector<float>                                     *  Azimuth projected to the vertex (for future l1t-integration-tag)
*Br   54 :muonIEt   : vector<short>                                          *  Transverse momentum in HW unit
*Br   55 :muonIEta  : vector<short>                                          *  Pseudo-rapidity in HW unit
*Br   56 :muonIPhi  : vector<short>                                          *  Azimuth in HW unit
*        :muonIEtaAtVtx  : vector<short>                                     *  Pseudo-rapidity in HW unit projected to the vertex (for future l1t-integration-tag)
*        :muonIPhiAtVtx  : vector<short>                                     *  Azimuth in HW unit projected to the vertex (for future l1t-integration-tag)
*        :muonIDEta  : vector<short>                                         *  Delta between Pseudo-rapidity at the muon system and the projected coordinate at the vertex in HW unit (for future l1t-integration-tag)
*        :muonIDPhi  : vector<short>                                         *  Delta between Azimuth at the muon system and the projected coordinate at the vertex in HW unit (for future l1t-integration-tag)
*Br   57 :muonChg   : vector<short>                                          *  Charge (can be 0 if the charge measurement was not valid)
*Br   58 :muonIso   : vector<unsigned short>                                 *  Isolation
*Br   59 :muonQual  : vector<unsigned short>                                 *  Quality
*Br   60 :muonTfMuonIdx : vector<unsigned short>                             *  Index of muon at the uGMT input. 3 indices per link/sector/wedge. EMTF+ are 0-17, OMTF+ are 18-35, BMTF are 36-71, OMTF- are 72-89, EMTF- are 90-107
*Br   61 :muonBx    : vector<short>                                          *  Relative bunch-crossing ID w.r.t the triggered one
*Br   62 :nSums     : UShort_t                                               *  Number of energy-sum candidates
*Br   63 :sumType   : vector<short>                                          *  Type of energy-sum [ref: https://github.com/cms-sw/cmssw/blob/CMSSW_9_0_X/DataFormats/L1Trigger/interface/EtSum.h#L20-L43]
*Br   64 :sumEt     : vector<float>                                          *  Transverse energy
*Br   65 :sumPhi    : vector<float>                                          *  Azimuth
*Br   66 :sumIEt    : vector<short>                                          *  Transverse energy in HW unit
*Br   67 :sumIPhi   : vector<short>                                          *  Azimuth in HW unit
*Br   68 :sumBx     : vector<float>                                          *  Relatvie bunch-crossing ID w.r.t the triggered one
*............................................................................*
******************************************************************************
*Tree    :L1uGTTree : L1uGTTree                                              *
******************************************************************************
*Branch  :L1uGT                                                              *
*............................................................................*
*Br    0 :m_orbitNr : Int_t                                                  *
*Br    1 :m_bxNr    : Int_t                                                  *
*Br    2 :m_bxInEvent : Int_t                                                *
*Br    3 :m_finalOR : Bool_t                                                 *  Trigger decision
*Br    4 :m_finalORPreVeto : Bool_t                                          *
*Br    5 :m_finalORVeto : Bool_t                                             *
*Br    6 :m_preScColumn : Int_t                                              *  Prescale column index
*Br    7 :m_algoDecisionInitial : vector<bool>                               *  Algorithm results before prescale, indexed by ID
*Br    8 :m_algoDecisionPreScaled : vector<bool>                             *
*Br    9 :m_algoDecisionFinal : vector<bool>                                 *  Algorithm results after prescale/mask, indexed by ID
*............................................................................*

Expert contents
******************************************************************************
*Tree    :L1CaloTowerTree: L1CaloTowerTree                                        *
******************************************************************************
*Branch  :CaloTP                                                             *
*............................................................................*
*Br    0 :nHCALTP   : Short_t                                                *
*Br    1 :hcalTPieta : vector<short>                                         *
*Br    2 :hcalTPiphi : vector<short>                                         *
*Br    3 :hcalTPCaliphi : vector<short>                                      *
*Br    4 :hcalTPet  : vector<float>                                          *
*Br    5 :hcalTPcompEt : vector<short>                                       *
*Br    6 :hcalTPfineGrain : vector<short>                                    *
*Br    7 :nECALTP   : Short_t                                                *
*Br    8 :ecalTPieta : vector<short>                                         *
*Br    9 :ecalTPiphi : vector<short>                                         *
*Br   10 :ecalTPCaliphi : vector<short>                                      *
*Br   11 :ecalTPet  : vector<float>                                          *
*Br   12 :ecalTPcompEt : vector<short>                                       *
*Br   13 :ecalTPfineGrain : vector<short>                                    *
*............................................................................*
*Branch  :L1CaloTower                                                        *
*............................................................................*
*Br   14 :nTower    : Short_t                                                *  Number of calorimeter towers
*Br   15 :ieta      : vector<short>                                          *  Pseudo-rapidity in HW unit
*Br   16 :iphi      : vector<short>                                          *  Azimuth in HW unit
*Br   17 :iet       : vector<short>                                          *  Transverse energy in HW unit
*Br   18 :iem       : vector<short>                                          *
*Br   19 :ihad      : vector<short>                                          *
*Br   20 :iratio    : vector<short>                                          *
*Br   21 :iqual     : vector<short>                                          *
*Br   22 :et        : vector<float>                                          *  Transverse energy
*Br   23 :eta       : vector<float>                                          *  Pseudo-rapidity
*Br   24 :phi       : vector<float>                                          *  Azimuth
*............................................................................*
*Branch  :L1CaloCluster                                                      *
*............................................................................*
*Br   25 :nCluster  : Short_t                                                *
*Br   26 :ieta      : vector<short>                                          *
*Br   27 :iphi      : vector<short>                                          *
*Br   28 :iet       : vector<short>                                          *
*Br   29 :iqual     : vector<short>                                          *
*Br   30 :et        : vector<float>                                          *
*Br   31 :eta       : vector<float>                                          *
*Br   32 :phi       : vector<float>                                          *
*............................................................................*
******************************************************************************
*Tree    :L1UpgradeTfMuonTree: L1UpgradeTfMuonTree                                    *
******************************************************************************
*Branch  :L1UpgradeBmtfMuon                                                  *
*............................................................................*
*Br    0 :nTfMuons  : UShort_t                                               *  Number of TF muon candidates
*Br    1 :tfMuonHwPt : vector<short>                                         *  Transverse momentum
*Br    2 :tfMuonHwEta : vector<short>                                        *  Pseudo-rapidity in HW unit
*Br    3 :tfMuonHwPhi : vector<short>                                        *  Local sector/wedge internal azimuth in HW unit
*Br    4 :tfMuonGlobalPhi : vector<short>                                    *  Azimuth in HW unit
*Br    5 :tfMuonHwSign : vector<short>                                       *  Charge
*Br    6 :tfMuonHwSignValid : vector<short>                                  *  Validity of charge measurement
*Br    7 :tfMuonHwQual : vector<short>                                       *  Quality
*Br    8 :tfMuonLink : vector<short>                                         *  Link number at the uGMT input
*Br    9 :tfMuonProcessor : vector<short>                                    *  Processor/board index
*Br   10 :tfMuonTrackFinderType : vector<short>                              *  TF type BMTF = 0, OMTF- = 1, OMTF+ = 2, EMTF- = 3, EMTF+ = 4
*Br   11 :tfMuonHwHF : vector<short>                                         *  Eta-fine bit
*Br   12 :tfMuonBx  : vector<short>                                          *  Relative bunch-crossing ID w.r.t the triggered one
*Br   13 :tfMuonWh  : vector<short>                                          *  Wheel number
*Br   14 :tfMuonTrAdd : vector<short>                                        *  Track address bits
*............................................................................*
*Branch  :L1UpgradeOmtfMuon                                                  *  see L1UpgradeBmtfMuon
*............................................................................*
*Br   15 :nTfMuons  : UShort_t                                               *
*Br   16 :tfMuonHwPt : vector<short>                                         *
*Br   17 :tfMuonHwEta : vector<short>                                        *
*Br   18 :tfMuonHwPhi : vector<short>                                        *
*Br   19 :tfMuonGlobalPhi : vector<short>                                    *
*Br   20 :tfMuonHwSign : vector<short>                                       *
*Br   21 :tfMuonHwSignValid : vector<short>                                  *
*Br   22 :tfMuonHwQual : vector<short>                                       *
*Br   23 :tfMuonLink : vector<short>                                         *
*Br   24 :tfMuonProcessor : vector<short>                                    *
*Br   25 :tfMuonTrackFinderType : vector<short>                              *
*Br   26 :tfMuonHwHF : vector<short>                                         *  not set
*Br   27 :tfMuonBx  : vector<short>                                          *
*Br   28 :tfMuonWh  : vector<short>                                          *  not valid
*Br   29 :tfMuonTrAdd : vector<short>                                        *  not valid
*............................................................................*
*Branch  :L1UpgradeEmtfMuon                                                  *  see L1UpgradeBmtfMuon
*............................................................................*
*Br   30 :nTfMuons  : UShort_t                                               *
*Br   31 :tfMuonHwPt : vector<short>                                         *
*Br   32 :tfMuonHwEta : vector<short>                                        *
*Br   33 :tfMuonHwPhi : vector<short>                                        *
*Br   34 :tfMuonGlobalPhi : vector<short>                                    *
*Br   35 :tfMuonHwSign : vector<short>                                       *
*Br   36 :tfMuonHwSignValid : vector<short>                                  *
*Br   37 :tfMuonHwQual : vector<short>                                       *
*Br   38 :tfMuonLink : vector<short>                                         *
*Br   39 :tfMuonProcessor : vector<short>                                    *
*Br   40 :tfMuonTrackFinderType : vector<short>                              *
*Br   41 :tfMuonHwHF : vector<short>                                         *  Halo bit
*Br   42 :tfMuonBx  : vector<short>                                          *
*Br   43 :tfMuonWh  : vector<short>                                          *  not valid
*Br   44 :tfMuonTrAdd : vector<short>                                        *  not valid
*............................................................................*
*Branch  :L1UpgradeBmtfInputs                                                *
*............................................................................*
*Br   45 :phSize    : Int_t                                                  * Number of phi track segments
*Br   46 :phBx      : vector<int>                                            * Raw bunch crossing
*Br   47 :phWh      : vector<int>                                            * Wheel of a segment
*Br   48 :phSe      : vector<int>                                            * Sector of a segment
*Br   49 :phSt      : vector<int>                                            * Station of a segment
*Br   50 :phAng     : vector<float>                                          * Phi position of a segment
*Br   51 :phBandAng : vector<float>                                          * Bending angle of a segment
*Br   52 :phCode    : vector<int>                                            * Quality of a segment
*Br   53 :phTs2Tag  : vector<int>                                            * Match 1st / 2nd segm. per Bx (e.g. 1st segm. at BX=0, 2nd at BX=0, it means that the second is actually at BX=-1)
*Br   54 :thSize    : Int_t                                                  * Number of theta segments
*Br   55 :thBx      : vector<int>                                            * Same as above for theta
*Br   56 :thWh      : vector<int>                                            * Same as above for theta
*Br   57 :thSe      : vector<int>                                            * Same as above for theta
*Br   58 :thSt      : vector<int>                                            * Same as above for theta
*Br   59 :thTheta   : vector<int>                                            * Theta position
*Br   60 :thCode    : vector<int>                                            * Same as above for theta
*............................................................................*

-- TakashiMatsushita1 - 2017-11-01

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r3 - 2018-01-31 - AndrewBrinkerhoff
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2024 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