Top Trigger Tutorial

Europe/Zurich
40/S2-A01 - Salle Anderson (CERN)

40/S2-A01 - Salle Anderson

CERN

100
Show room on map
Description
The pre-requisite of the tutorial is rather light (mostly for new comers): Read the following page: https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookCMSSWFramework And simply to manipulate a bit: https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookWriteFrameworkModule Organisation: The tutorial would be one day long (from 9h to ~19h) so we expect people to be at Cern for that day. We will provide Vidyo connection but as we want to allow people to have real discussion, we prefer people to be in the room. We have booked 40-S2-A01 all day long. People should come with laptop as it will be a tutorial. We will have ~5 presentations: 1) What is HLT? 2) How do we determine efficiencies? 3) How do we develop a new HLT path? 4) What is DQM? How do we build a DQM code to check a path? 5) Preparation for 13 TeV: What do we need to do in the coming weeks? Some of the presentations will be very tutorial like. Some others will simply introduce idea and concept but will not necessary allow to have immediate results (computing efficiencies on data will request to run on a large amount of data, not doable within one day). The presentation will be oriented towards Top physics but this tutorial is for sure open to anyone. In order to ensure to have enough people to help, it would be great that if you plan to be in the room to fill the doodle (http://www.doodle.com/th922qhw7imc2qhc#table).
    • 09:30 10:20
      Quick Introduction to HLT 50m
      Speaker: Stephanie Beauceron (Universite Claude Bernard-Lyon 1 (FR))
      Slides
    • 10:20 11:00
      Measurement of offline efficiency ("theory") 40m
      Speaker: Kelly Beernaert (Ghent University (BE))
      Slides
    • 11:00 11:10
      Coffee 10m
    • 11:10 11:50
      Matching HLT object to Reco object (Tutorial) 40m
      Speaker: Hugues Louis Brun (Universidad de Oviedo (ES))
      Slides
      // ----------member data ---------------------------
      HLTConfigProvider hltConfig;
      std::map< std::string, TH2D* > histos2D_;
      std::map< std::string, TH1D* > histos1D_;
      ------------------
      TriggerMatching::TriggerMatching(const edm::ParameterSet& iConfig):histos2D_(),histos1D_()
      {
      //now do what ever initialization is needed
      }
      ------------------
      edm::Service< TFileService > fileService;
      histos2D_[ "ptTrigCand" ] = fileService->make< TH2D >( "ptTrigCand", "Object vs. candidate p_{T} (GeV)", 60, 0., 300., 60, 0., 300. );
      histos2D_[ "ptTrigCand" ]->SetXTitle( "candidate p_{T} (GeV)" );
      histos2D_[ "ptTrigCand" ]->SetYTitle( "object p_{T} (GeV)" );
      histos2D_[ "etaTrigCand" ] = fileService->make< TH2D >( "etaTrigCand", "Object vs. candidate #eta", 50, -2.5, 2.5, 50, -2.5, 2.5 );
      histos2D_[ "etaTrigCand" ]->SetXTitle( "candidate #eta" );
      histos2D_[ "etaTrigCand" ]->SetYTitle( "object #eta" );
      histos2D_[ "phiTrigCand" ] = fileService->make< TH2D >( "phiTrigCand", "Object vs. candidate #phi", 60, -TMath::Pi(), TMath::Pi(), 60, -TMath::Pi(),
      TMath::Pi() );
      histos2D_[ "phiTrigCand" ]->SetXTitle( "candidate #phi" );
      histos2D_[ "phiTrigCand" ]->SetYTitle( "object #phi" );
      histos1D_[ "diffPtRelat" ] = fileService->make< TH1D >("diffPtRelat","relat diff online vs offline",100,-0.2,0.2);
      histos1D_[ "diffPtRelat" ]->SetXTitle( " (p_{T} HLT - p_{T} reco)/p_{T} reco " );
      histos1D_[ "ptRecoMuon" ] = fileService->make< TH1D >("ptRecoMuon","Pt reco muon",20,10,50);
      histos1D_[ "ptRecoMuon" ]->SetXTitle( "candidate p_{T} (GeV)" );
      histos1D_[ "ptRecoMuonMatched" ] = fileService->make< TH1D >("ptRecoMuonMatched","Pt reco muon",20,10,50);
      histos1D_[ "ptRecoMuonMatched" ]->SetXTitle( "candidate p_{T} (GeV)" );
      histos1D_[ "ptRecoMuonEfficiency" ] = fileService->make< TH1D >("ptRecoMuonEfficiency","Pt reco muon",20,10,50);
      histos1D_[ "ptRecoMuonEfficiency" ]->SetXTitle( "candidate p_{T} (GeV)" );
      ----------------
      histos1D_[ "ptRecoMuonEfficiency" ]->Sumw2();
      histos1D_[ "ptRecoMuonEfficiency" ]->Divide(histos1D_[ "ptRecoMuonMatched" ], histos1D_[ "ptRecoMuon" ], 1,1);
      --------------
      //open the trigger summary
      edm::InputTag triggerSummaryLabel_ = edm::InputTag("hltTriggerSummaryAOD", "", "HLT");
      edm::Handle<trigger::TriggerEvent> triggerSummary;
      iEvent.getByLabel(triggerSummaryLabel_, triggerSummary);
      //trigger object we want to match
      edm::InputTag filterTag = edm::InputTag("hltL1Mu12EG7L3MuFiltered17", "", "HLT");
      //find the index corresponding to the event
      size_t filterIndex = (*triggerSummary).filterIndex(filterTag);
      trigger::TriggerObjectCollection allTriggerObjects = triggerSummary->getObjects();
      trigger::TriggerObjectCollection selectedObjects;
      if (filterIndex < (*triggerSummary).sizeFilters()) { //check if the trigger object is present
      const trigger::Keys &keys = (*triggerSummary).filterKeys(filterIndex);
      for (size_t j = 0; j < keys.size(); j++) {
      trigger::TriggerObject foundObject = (allTriggerObjects)[keys[j]];
      selectedObjects.push_back(foundObject);
       }

      ---------------
      //Page 14
      edm::Handle< reco::MuonCollection > muons;
      iEvent.getByLabel( "muons", muons );
      for( size_t iMuon = 0; iMuon < muons->size(); ++iMuon ) {
      histos1D_[ "ptRecoMuon" ]->Fill(muons->at( iMuon ).pt());
      for (size_t t = 0 ; t < selectedObjects.size() ; t++){!
      float deltaR = sqrt(pow(selectedObjects[t].eta()-muons->at( iMuon ).eta(),2)+
      pow(acos(cos(selectedObjects[t].phi()-muons->at( iMuon ).phi())),2)) ;
      if (deltaR<0.1) {//matching successfull
      histos2D_[ "ptTrigCand" ]->Fill( muons->at( iMuon ).pt(), selectedObjects[t].pt() );
      histos2D_[ "etaTrigCand" ]->Fill( muons->at( iMuon ).eta(), selectedObjects[t].eta() );
      histos2D_[ "phiTrigCand" ]->Fill( muons->at( iMuon ).phi(), selectedObjects[t].phi() );
      histos1D_[ "ptRecoMuonMatched" ]->Fill(muons->at( iMuon ).pt());
      if (muons->at( iMuon ).pt()>0) histos1D_[ "diffPtRelat" ]->Fill((selectedObjects[t].pt()-muons-
      >at( iMuon ).pt())/muons->at( iMuon ).pt());
      }
      }
      }
      -----------
      //slide 15
      <use name="FWCore/Framework"/>
      <use name="FWCore/PluginManager"/>
      <use name="FWCore/ParameterSet"/>
      <use name="HLTrigger/HLTcore"/>
      <use name="DataFormats/Common"/>
      <use name="PhysicsTools/CandUtils"/>
      <use name="PhysicsTools/UtilAlgos"/>
      <flags EDM_PLUGIN="1"/>
      -----------
      //slide 16
      import FWCore.ParameterSet.Config as cms
      process = cms.Process("TUTO")
      process.load( "FWCore.MessageService.MessageLogger_cfi" )
      process.MessageLogger.cerr.FwkReport.reportEvery = 10
      process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(-1))
      process.source = cms.Source(
      "PoolSource",
      fileNames = cms.untracked.vstring(
      '/store/relval/CMSSW_5_3_6-START53_V14/RelValTTbarLepton/GEN-SIMRECO/
      v2/00000/7C6ACC06-F729-E211-81DD-003048678FB2.root',
      '/store/relval/CMSSW_5_3_6-START53_V14/RelValTTbarLepton/GEN-SIMRECO/
      v2/00000/72CA37E3-F929-E211-906E-003048D15D22.root'
      )
      )
      process.TFileService = cms.Service( "TFileService",
      fileName = cms.string( 'analyzeRECO.root' )
      )
      process.triggerMatchingAnalyzer = cms.EDAnalyzer('TriggerMatching')
      process.p= cms.Path(process.triggerMatchingAnalyzer)
      --------------
      //Pat part --> slide 20:
      #trigger matching parameters
      process.muonTriggerMatchHLTMuons = cms.EDProducer(
      # matching in DeltaR, sorting by best DeltaR
      "PATTriggerMatcherDRLessByR"
      # matcher input collections
      , src = cms.InputTag( 'cleanPatMuons' )
      , matched = cms.InputTag( 'patTrigger' )
      # selections of trigger objects
      , matchedCuts = cms.string( 'type( "TriggerMuon" ) &&
      filter( "hltL1Mu12EG7L3MuFiltered17" )' )
      # selection of matches
      , maxDPtRel = cms.double( 10 ) # no effect here
      , maxDeltaR = cms.double( 0.1 )
      , maxDeltaEta = cms.double( 10 ) # no effect here
      # definition of matcher output
      , resolveAmbiguities = cms.bool( True )
      , resolveByMatchQuality = cms.bool( True )
      )
      #run the trigger matching
      from PhysicsTools.PatAlgos.tools.trigTools import *
      switchOnTrigger( process )
      switchOnTriggerMatching( process, triggerMatchers = [ 'muonTriggerMatchHLTMuons'] )
      ------------
      //slide 21
      process.source.fileNames = cms.untracked.vstring(
      '/store/relval/CMSSW_5_3_6-START53_V14/RelValTTbarLepton/
      GEN-SIM-RECO/v2/00000/7C6ACC06-F729-E211-81DD-003048678FB2.root',
      '/store/relval/CMSSW_5_3_6-START53_V14/RelValTTbarLepton/
      GEN-SIM-RECO/v2/00000/72CA37E3-F929-E211-906E-003048D15D22.root'
      )
      # ##
      process.maxEvents.input = 100

      -----------
      //slide 22
      #include "DataFormats/PatCandidates/interface/Muon.h"
      #include "DataFormats/PatCandidates/interface/TriggerEvent.h"
      using namespace pat;
      #include "PhysicsTools/PatUtils/interface/TriggerHelper.h"
      --------------
      //slide 23
      //open the trigger summary
      edm::InputTag triggerSummaryLabel_ = edm::InputTag("hltTriggerSummaryAOD", "", "HLT");
      edm::Handle<trigger::TriggerEvent> triggerSummary;
      iEvent.getByLabel(triggerSummaryLabel_, triggerSummary);
      //trigger object we want to match
      edm::InputTag filterTag = edm::InputTag("hltL1Mu12EG7L3MuFiltered17", "", "HLT");
      //find the index corresponding to the event
      size_t filterIndex = (*triggerSummary).filterIndex(filterTag);
      trigger::TriggerObjectCollection allTriggerObjects = triggerSummary->getObjects();
      trigger::TriggerObjectCollection selectedObjects;
      if (filterIndex < (*triggerSummary).sizeFilters()) { //check if the trigger object is present
      const trigger::Keys &keys = (*triggerSummary).filterKeys(filterIndex);
      for (size_t j = 0; j < keys.size(); j++) {
      trigger::TriggerObject foundObject = (allTriggerObjects)[keys[j]];
      selectedObjects.push_back(foundObject);
      }
      }

      edm::InputTag triggerEventName = edm::InputTag("patTriggerEvent");
      edm::Handle<TriggerEvent> triggerEvent;
      iEvent.getByLabel( triggerEventName, triggerEvent );
      const pat::helper::TriggerMatchHelper matchHelper;

      -----------
      //slide 24
      edm::Handle< reco::MuonCollection > muons;
      iEvent.getByLabel( "muons", muons );
      for( size_t iMuon = 0; iMuon < muons->size(); ++iMuon ) {
      histos1D_[ "ptRecoMuon" ]->Fill(muons->at( iMuon ).pt());!
      for (size_t t = 0 ; t < selectedObjects.size() ; t++){!
      float deltaR = sqrt(pow(selectedObjects[t].eta()-muons->at( iMuon ).eta(),2)+
      pow(acos(cos(selectedObjects[t].phi()-muons->at( iMuon ).phi())),2)) ;
      if (deltaR<0.1) {//matching successfull
      histos2D_[ "ptTrigCand" ]->Fill( muons->at( iMuon ).pt(), selectedObjects[t].pt() );
      histos2D_[ "etaTrigCand" ]->Fill( muons->at( iMuon ).eta(), selectedObjects[t].eta() );
      histos2D_[ "phiTrigCand" ]->Fill( muons->at( iMuon ).phi(), selectedObjects[t].phi() );
      histos1D_[ "ptRecoMuonMatched" ]->Fill(muons->at( iMuon ).pt());
      if (muons->at( iMuon ).pt()>0) histos1D_[ "diffPtRelat" ]->Fill((selectedObjects[t].pt()-muons-
      >at( iMuon ).pt())/muons->at( iMuon ).pt());
      }
      }
      }


      edm::Handle<MuonCollection > muons;
      iEvent.getByLabel( "cleanPatMuons", muons );
      for( size_t iMuon = 0; iMuon < muons->size(); ++iMuon ) {
      histos1D_[ "ptRecoMuon" ]->Fill(muons->at( iMuon ).pt());
      const TriggerObjectRef selectedObjects( matchHelper.triggerMatchObject( muons, iMuon,
      "muonTriggerMatchHLTMuons", iEvent, *triggerEvent ) );
      if ( selectedObjects.isAvailable() && selectedObjects.isNonnull() ) {
      histos2D_[ "ptTrigCand" ]->Fill( muons->at( iMuon ).pt(), selectedObjects->pt() );
      histos2D_[ "etaTrigCand" ]->Fill( muons->at( iMuon ).eta(), selectedObjects->eta() );
      histos2D_[ "phiTrigCand" ]->Fill( muons->at( iMuon ).phi(), selectedObjects->phi() );
      histos1D_[ "ptRecoMuonMatched" ]->Fill(muons->at( iMuon ).pt());
      if (muons->at( iMuon ).pt()>0) histos1D_[ "diffPtRelat" ]->Fill((selectedObjects->pt()-muons-
      >at( iMuon ).pt())/muons->at( iMuon ).pt());
      }
      }
      ------------
      //slide 25
      <use name="FWCore/Framework"/>
      <use name="FWCore/PluginManager"/>
      <use name="FWCore/ParameterSet"/>
      <use name="HLTrigger/HLTcore"/>
      <use name="DataFormats/Common"/>
      <use name="PhysicsTools/CandUtils"/>
      <use name="PhysicsTools/UtilAlgos"/>
      <use name="PhysicsTools/PatExamples"/>
      <use name="PhysicsTools/PatAlgos"/>
      <use name="PhysicsTools/PatUtils"/>
      <flags EDM_PLUGIN="1"/>

      ------------
      //slide 26
      import FWCore.ParameterSet.Config as cms
      process = cms.Process("TUTO")
      process.load( "FWCore.MessageService.MessageLogger_cfi" )
      process.MessageLogger.cerr.FwkReport.reportEvery = 10
      process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(-1))
      process.source = cms.Source(
      "PoolSource",
      fileNames = cms.untracked.vstring(
      '/store/user/hbrun/triggerMatching/patTuple.root'
      )
      )
      process.TFileService = cms.Service( "TFileService",
      fileName = cms.string( 'analyzePAT.root' )
      )
      process.triggerMatchingAnalyzer = cms.EDAnalyzer('TriggerMatching')
      process.p= cms.Path(process.triggerMatchingAnalyzer)
      -------------
      //slide 28
      process.electronsTriggerMatchHLT = cms.EDProducer(
      # matching in DeltaR, sorting by best DeltaR
      "PATTriggerMatcherDRLessByR"
      # matcher input collections
      , src = cms.InputTag( 'cleanPatElectrons' )
      , matched = cms.InputTag( 'patTrigger' )
      # selections of trigger objects
      , matchedCuts = cms.string( 'type( "TriggerElectron" ) &&
      filter( "hltMu17Ele8CaloIdTCaloIsoVLTrkIdVLTrkIsoVLTrackIsoFilter" )' )
      # selection of matches
      , maxDPtRel = cms.double( 10 ) # no effect here
      , maxDeltaR = cms.double( 0.1 )
      , maxDeltaEta = cms.double( 10 ) # no effect here
      # definition of matcher output
      , resolveAmbiguities = cms.bool( True )
      , resolveByMatchQuality = cms.bool( True )
      )
      from PhysicsTools.PatAlgos.tools.trigTools import *
      switchOnTrigger( process )
      switchOnTriggerMatching( process, triggerMatchers = [ 'muonTriggerMatchHLTMuons', 'electronsTriggerMatchHLT'] )
      ---------------
      //slide 29
      #include "DataFormats/PatCandidates/interface/Electron.h"
      edm::Handle<ElectronCollection > electrons;
      iEvent.getByLabel( "cleanPatElectrons", electrons );
      for( size_t iElectron = 0; iElectron < electrons->size(); ++iElectron ) {
      const TriggerObjectRef selectedObjects( matchHelper.triggerMatchObject( electrons, iElectron,
      "electronsTriggerMatchHLT", iEvent, *triggerEvent ) );
      if ( selectedObjects.isAvailable() && selectedObjects.isNonnull() ) {
      if (electrons->at( iElectron ).pt()>0) histos1D_[ "diffPtRelatElectrons" ]->Fill((selectedObjects->pt()-
      electrons->at( iElectron ).pt())/electrons->at( iElectron ).pt());
      }
      }
      histos1D_[ "diffPtRelatElectrons" ] = fileService->make< TH1D >("diffPtRelatElectrons","relat diff online vs
      offline",100,-0.2,0.2);
      histos1D_[ "diffPtRelatElectrons" ]->SetXTitle( " (p_{T} HLT - p_{T} reco)/p_{T} reco " );

      -------
    • 11:50 12:00
      UTB/UTC 10m
      Speakers: Mia Tosi (Universita' degli Studi di Padova e INFN (IT)), mia tosi (Universita' degli Studi di Padova & INFN)
      Slides
    • 12:00 12:50
      Coding in ConfDB 50m
      Speaker: Javier Fernandez Menendez (Universidad de Oviedo (ES))
      Slides
    • 12:50 14:00
      Lunch 1h 10m
    • 14:00 15:00
      Measuring Rate/Timing and Optimisation of HLT paths 1h
      Speakers: Zeynep Demiragli (Brown University), Zeynep Demiragli (Brown University (US))
      Slides
      text
    • 15:00 15:10
      Coffee 10m
    • 15:10 16:10
      DQM at HLT 1h
      Speaker: Dr Federico De Guio (CERN)
      Slides
    • 16:10 16:40
      Summary of TSG workshop 30m
      Speaker: Simone Gennai (Universita & INFN, Milano-Bicocca (IT))
      Slides