Skip to content

Commit

Permalink
triggerMatch first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bmahakud committed Oct 24, 2018
1 parent c337d88 commit 22c5cd3
Show file tree
Hide file tree
Showing 9 changed files with 598 additions and 2 deletions.
67 changes: 67 additions & 0 deletions DQMOffline/Muon/interface/TriggerMatchEfficiencyPlotter.h
@@ -0,0 +1,67 @@
#ifndef TriggerMatchEfficiencyPlotter_H
#define TriggerMatchEfficiencyPlotter_H
/** \class TriggerMatch monitor
* *
* * DQM monitoring source for Trigger matching efficiency plotter feature added to miniAOD
* *
* * \author Bibhuprasad Mahakud (Purdue University, West Lafayette, USA)
* */

#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "DQMServices/Core/interface/DQMEDHarvester.h"
#include "DataFormats/Common/interface/Handle.h"
#include <FWCore/Framework/interface/ESHandle.h>
#include <FWCore/Framework/interface/Event.h>
#include <FWCore/Framework/interface/MakerMacros.h>
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include <FWCore/Framework/interface/LuminosityBlock.h>

#include "DQMServices/Core/interface/DQMStore.h"
#include "DQMServices/Core/interface/MonitorElement.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/Framework/interface/Run.h"

#include <memory>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include "TH1F.h"

class TriggerMatchEfficiencyPlotter: public DQMEDHarvester {

public:

/// Constructor
TriggerMatchEfficiencyPlotter(const edm::ParameterSet& ps);

/// Destructor
~TriggerMatchEfficiencyPlotter() override;

protected:

/// DQM Client Diagnostic
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override; //performed in the endJob


private:

DQMStore* theDbe;
edm::ParameterSet parameters;

std::string triggerhistName1_;
std::string triggerhistName2_;

// efficiency histograms
MonitorElement* h_eff_Path1_eta_tight;
MonitorElement* h_eff_Path1_pt_tight;
MonitorElement* h_eff_Path1_phi_tight;

MonitorElement* h_eff_Path2_eta_tight;
MonitorElement* h_eff_Path2_pt_tight;
MonitorElement* h_eff_Path2_phi_tight;

std::string theFolder;
};

#endif
95 changes: 95 additions & 0 deletions DQMOffline/Muon/interface/TriggerMatchMonitor.h
@@ -0,0 +1,95 @@
#ifndef TriggerMatchMonitor_H
#define TriggerMatchMonitor_H
/** \class TriggerMatch monitor
*
* DQM monitoring source for Trigger matching feature added to miniAOD
*
* \author Bibhuprasad Mahakud (Purdue University, West Lafayette, USA)
*/

#include <memory>
#include <fstream>
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "DQMServices/Core/interface/DQMStore.h"
#include "DQMServices/Core/interface/MonitorElement.h"
#include "DQMServices/Core/interface/DQMEDAnalyzer.h"

#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/MuonReco/interface/Muon.h"
#include "DataFormats/MuonReco/interface/MuonFwd.h"
#include "DataFormats/MuonReco/interface/MuonEnergy.h"
#include "DataFormats/BeamSpot/interface/BeamSpot.h"
#include "DataFormats/VertexReco/interface/Vertex.h"
#include "DataFormats/VertexReco/interface/VertexFwd.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/TrackReco/interface/TrackFwd.h"
#include "DataFormats/MuonReco/interface/MuonSelectors.h"
#include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h"
#include "FWCore/Common/interface/TriggerNames.h"
#include "DataFormats/Common/interface/TriggerResults.h"
#include "DataFormats/HLTReco/interface/TriggerEvent.h"
#include "DataFormats/PatCandidates/interface/Muon.h"
#include "DataFormats/PatCandidates/interface/TriggerObjectStandAlone.h"


class TriggerMatchMonitor : public DQMEDAnalyzer {
public:

/// Constructor
TriggerMatchMonitor(const edm::ParameterSet& pSet);

/// Destructor
~TriggerMatchMonitor() override;

void analyze(const edm::Event&, const edm::EventSetup&) override;
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;

private:

// ----------member data ---------------------------
MuonServiceProxy *theService;
DQMStore* theDbe;
edm::ParameterSet parameters;

// triggerNames to be passed from config
std::string triggerPathName1_;
std::string triggerHistName1_;
double triggerPtThresholdPath1_;
std::string triggerPathName2_;
std::string triggerHistName2_;
double triggerPtThresholdPath2_;

//Vertex requirements
edm::EDGetTokenT<edm::View<reco::Muon> > theMuonCollectionLabel_;
edm::EDGetTokenT<edm::View<pat::Muon> > thePATMuonCollectionLabel_;
edm::EDGetTokenT<reco::VertexCollection> theVertexLabel_;
edm::EDGetTokenT<reco::BeamSpot> theBeamSpotLabel_;
edm::EDGetTokenT<edm::TriggerResults > triggerResultsToken_;
edm::EDGetTokenT<std::vector<pat::TriggerObjectStandAlone>> triggerObjects_;

edm::EDGetTokenT<reco::BeamSpot > beamSpotToken_;
edm::EDGetTokenT<std::vector<reco::Vertex> > primaryVerticesToken_;

// histograms
std::vector<MonitorElement*> matchHists;
MonitorElement* h_passHLTPath1_eta_Tight;
MonitorElement* h_passHLTPath1_pt_Tight;
MonitorElement* h_passHLTPath1_phi_Tight;
MonitorElement* h_totalHLTPath1_eta_Tight;
MonitorElement* h_totalHLTPath1_pt_Tight;
MonitorElement* h_totalHLTPath1_phi_Tight;

MonitorElement* h_passHLTPath2_eta_Tight;
MonitorElement* h_passHLTPath2_pt_Tight;
MonitorElement* h_passHLTPath2_phi_Tight;
MonitorElement* h_totalHLTPath2_eta_Tight;
MonitorElement* h_totalHLTPath2_pt_Tight;
MonitorElement* h_totalHLTPath2_phi_Tight;

std::string theFolder;
};
#endif
10 changes: 10 additions & 0 deletions DQMOffline/Muon/python/TriggerMatchEfficencyPlotter_cfi.py
@@ -0,0 +1,10 @@
import FWCore.ParameterSet.Config as cms
from DQMServices.Core.DQMEDHarvester import DQMEDHarvester

triggerMatchEffPlotterTightMiniAOD = DQMEDHarvester("TriggerMatchEfficiencyPlotter",
folder = cms.string("Muons_miniAOD/TriggerMatchMonitor"),
triggerhistName1 = cms.string('IsoMu24'),
triggerhistName2 = cms.string('Mu50')
)


4 changes: 3 additions & 1 deletion DQMOffline/Muon/python/muonAnalyzer_cff.py
Expand Up @@ -9,6 +9,7 @@
from DQMOffline.Muon.segmentTrackAnalyzer_cfi import *
from DQMOffline.Muon.muonSeedsAnalyzer_cfi import *
from DQMOffline.Muon.muonPFAnalyzer_cfi import *
from DQMOffline.Muon.triggerMatchMonitor_cfi import *

muonAnalyzer = cms.Sequence(muonEnergyDepositAnalyzer*
muonSeedsAnalyzer*
Expand All @@ -34,7 +35,8 @@
diMuonHistos_miniAOD*
LooseMuonEfficiencyAnalyzer_miniAOD*
MediumMuonEfficiencyAnalyzer_miniAOD*
TightMuonEfficiencyAnalyzer_miniAOD)
TightMuonEfficiencyAnalyzer_miniAOD*
triggerMatchMonitor_miniAOD)

muonAnalyzer_noHLT = cms.Sequence(muonEnergyDepositAnalyzer*
muonSeedsAnalyzer*
Expand Down
4 changes: 3 additions & 1 deletion DQMOffline/Muon/python/muonQualityTests_cff.py
Expand Up @@ -8,6 +8,7 @@
from DQMOffline.Muon.muonTestSummary_cfi import *
from DQMOffline.Muon.muonTestSummaryCosmics_cfi import *
from DQMOffline.Muon.EfficencyPlotter_cfi import *
from DQMOffline.Muon.TriggerMatchEfficencyPlotter_cfi import *

muonSourcesQualityTests = cms.EDAnalyzer("QualityTester",
prescaleFactor = cms.untracked.int32(1),
Expand Down Expand Up @@ -57,6 +58,7 @@
muonClientsQualityTests*
muonComp2RefQualityTests*
muonComp2RefKolmoQualityTests*
muonTestSummary)
muonTestSummary*
triggerMatchEffPlotterTightMiniAOD)


25 changes: 25 additions & 0 deletions DQMOffline/Muon/python/triggerMatchMonitor_cfi.py
@@ -0,0 +1,25 @@
import FWCore.ParameterSet.Config as cms

from RecoMuon.TrackingTools.MuonServiceProxy_cff import *

from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
triggerMatchMonitor_miniAOD = DQMEDAnalyzer('TriggerMatchMonitor',
MuonServiceProxy,
offlineBeamSpot = cms.untracked.InputTag("offlineBeamSpot"),
offlinePrimaryVertices = cms.untracked.InputTag("offlinePrimaryVertices"),
MuonCollection = cms.InputTag("slimmedMuons"),
patMuonCollection = cms.InputTag("slimmedMuons"),
VertexLabel = cms.InputTag("offlineSlimmedPrimaryVertices"),
BeamSpotLabel = cms.InputTag("offlineBeamSpot"),
triggerResults = cms.untracked.InputTag("TriggerResults","","HLT"),
triggerObjects = cms.InputTag("slimmedPatTrigger"),
hltCollectionFilters = cms.vstring('*'),
triggerNameList = cms.vstring('HLT_Mu27_v*'),
triggerPathName1 = cms.string('HLT_IsoMu24_v*'),
triggerHistName1 = cms.string('IsoMu24'),
triggerPtThresholdPath1 = cms.double(20.0),
triggerPathName2 = cms.string('HLT_Mu50_v*'),
triggerHistName2 = cms.string('Mu50'),
triggerPtThresholdPath2 = cms.double(40.0),
folder = cms.string("Muons_miniAOD/TriggerMatchMonitor")
)
6 changes: 6 additions & 0 deletions DQMOffline/Muon/src/SealModule.cc
Expand Up @@ -19,6 +19,10 @@

#include "DQMOffline/Muon/interface/MuonMiniAOD.h"

#include "DQMOffline/Muon/interface/TriggerMatchMonitor.h"
#include "DQMOffline/Muon/interface/TriggerMatchEfficiencyPlotter.h"


DEFINE_FWK_MODULE(MuonTrackResidualsTest);
DEFINE_FWK_MODULE(MuonRecoTest);
DEFINE_FWK_MODULE(EfficiencyPlotter);
Expand All @@ -34,6 +38,8 @@ DEFINE_FWK_MODULE(SegmentTrackAnalyzer);
DEFINE_FWK_MODULE(MuonEnergyDepositAnalyzer);
DEFINE_FWK_MODULE(MuonSeedsAnalyzer);
DEFINE_FWK_MODULE(MuonMiniAOD);
DEFINE_FWK_MODULE(TriggerMatchMonitor);
DEFINE_FWK_MODULE(TriggerMatchEfficiencyPlotter);



Expand Down

0 comments on commit 22c5cd3

Please sign in to comment.