Skip to content

Commit

Permalink
Merge pull request cms-sw#3820 from makortel/tautriggerdqmTauProducer…
Browse files Browse the repository at this point in the history
…_DQMGenericClient

DQM -- Migrate Tau HLT DQM to DQMGenericClient+DQMEDHarvester
  • Loading branch information
ktf committed May 14, 2014
2 parents 16a328b + 290fcce commit af6f2fa
Show file tree
Hide file tree
Showing 13 changed files with 255 additions and 537 deletions.
16 changes: 10 additions & 6 deletions DQMOffline/Trigger/interface/HLTTauDQMPath.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ class HLTTauDQMPath {
public:
typedef math::XYZTLorentzVectorD LV;
typedef std::vector<LV> LVColl;
typedef std::tuple<std::string, size_t> FilterIndex;

constexpr static size_t kName = 0;
constexpr static size_t kModuleIndex = 1;
constexpr static size_t kInvalidIndex = std::numeric_limits<size_t>::max();

struct Object {
const trigger::TriggerObject& object;
Expand All @@ -44,23 +49,23 @@ class HLTTauDQMPath {
const unsigned int getPathIndex() const { return pathIndex_; }

size_t filtersSize() const { return filterIndices_.size(); }
const std::string& getFilterName(size_t i) const { return std::get<0>(filterIndices_[i]); }
const std::string& getFilterName(size_t i) const { return std::get<kName>(filterIndices_[i]); }
int getFilterNTaus(size_t i) const { return filterTauN_[i]; }
int getFilterNElectrons(size_t i) const {return filterElectronN_[i]; }
int getFilterNMuons(size_t i) const {return filterMuonN_[i]; }

bool isFirstFilterL1Seed() const { return isFirstL1Seed_; }
const std::string& getLastFilterName() const { return std::get<0>(filterIndices_.back()); }
const std::string& getLastFilterName() const { return std::get<kName>(filterIndices_.back()); }

bool hasL2Taus() const { return lastL2TauFilterIndex_ != std::numeric_limits<size_t>::max(); }
bool hasL3Taus() const { return lastL3TauFilterIndex_ != std::numeric_limits<size_t>::max(); }
bool hasL2Taus() const { return lastL2TauFilterIndex_ != kInvalidIndex; }
bool hasL3Taus() const { return lastL3TauFilterIndex_ != kInvalidIndex; }
size_t getLastFilterBeforeL2TauIndex() const { return lastFilterBeforeL2TauIndex_; }
size_t getLastL2TauFilterIndex() const { return lastL2TauFilterIndex_; }
size_t getLastFilterBeforeL3TauIndex() const { return lastFilterBeforeL3TauIndex_; }
size_t getLastL3TauFilterIndex() const { return lastL3TauFilterIndex_; }

// index (to edm::TriggerResults) of a filter
size_t getFilterIndex(size_t i) const { return std::get<1>(filterIndices_[i]); }
size_t getFilterIndex(size_t i) const { return std::get<kModuleIndex>(filterIndices_[i]); }

// Get objects associated to a filter, i is the "internal" index
void getFilterObjects(const trigger::TriggerEvent& triggerEvent, size_t i, std::vector<Object>& retval) const;
Expand All @@ -70,7 +75,6 @@ class HLTTauDQMPath {

bool goodOfflineEvent(size_t i, const HLTTauDQMOfflineObjects& offlineObjects) const;

typedef std::tuple<std::string, size_t> FilterIndex;
private:
const std::string hltProcess_;
const bool doRefAnalysis_;
Expand Down
24 changes: 0 additions & 24 deletions DQMOffline/Trigger/interface/HLTTauDQMSummaryPlotter.h

This file was deleted.

38 changes: 9 additions & 29 deletions DQMOffline/Trigger/interface/HLTTauPostProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,20 @@
[email protected]
*/

#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "DQMServices/Core/interface/DQMEDHarvester.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/Utilities/interface/Digest.h"

//Plotters
#include "DQMOffline/Trigger/interface/HLTTauDQMSummaryPlotter.h"
#include <string>

#include<memory>

class HLTTauPostProcessor : public edm::EDAnalyzer {
class HLTTauPostProcessor : public DQMEDHarvester {
public:
HLTTauPostProcessor( const edm::ParameterSet& );
~HLTTauPostProcessor();

protected:
/// Fake Analyze
void analyze(const edm::Event& e, const edm::EventSetup& c) ;

/// EndRun
void endRun(const edm::Run& r, const edm::EventSetup& iSetup);

/// Endjob
void endJob();

void harvest();


void dqmEndJob(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter) override;

private:
std::vector<std::unique_ptr<HLTTauDQMSummaryPlotter>> summaryPlotters_;
const bool runAtEndJob_;
const bool runAtEndRun_;
void plotFilterEfficiencies(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter, const std::string& folder) const;

const std::string dqmBaseFolder_;
};
4 changes: 2 additions & 2 deletions DQMOffline/Trigger/python/HLTTauDQMOffline_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

hltTauOfflineMonitor_PFTaus = cms.EDAnalyzer("HLTTauDQMOfflineSource",
HLTProcessName = cms.untracked.string(hltTauDQMofflineProcess),
DQMBaseFolder = cms.untracked.string("HLT/TauOffline/PFTaus/"),
DQMBaseFolder = cms.untracked.string("HLT/TauOffline/PFTaus"),
TriggerResultsSrc = cms.untracked.InputTag("TriggerResults", "", hltTauDQMofflineProcess),
TriggerEventSrc = cms.untracked.InputTag("hltTriggerSummaryAOD", "", hltTauDQMofflineProcess),
L1Plotter = cms.untracked.PSet(
Expand Down Expand Up @@ -92,7 +92,7 @@
)

hltTauOfflineMonitor_Inclusive = hltTauOfflineMonitor_PFTaus.clone(
DQMBaseFolder = "HLT/TauOffline/Inclusive/",
DQMBaseFolder = "HLT/TauOffline/Inclusive",
Matching = cms.PSet(
doMatching = cms.untracked.bool(False),
matchFilters = cms.untracked.VPSet(),
Expand Down
66 changes: 55 additions & 11 deletions DQMOffline/Trigger/python/HLTTauPostProcessor_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,60 @@

from DQMOffline.Trigger.HLTTauDQMOffline_cfi import *

HLTTauPostAnalysis_PFTaus = cms.EDAnalyzer("HLTTauPostProcessor",
DQMBaseFolder = hltTauOfflineMonitor_PFTaus.DQMBaseFolder,
L1Plotter = hltTauOfflineMonitor_PFTaus.L1Plotter,
PathSummaryPlotter = hltTauOfflineMonitor_PFTaus.PathSummaryPlotter,
)
def makeInclusiveAnalyzer(monitorModule):
m1 = cms.EDAnalyzer("DQMGenericClient",
subDirs = cms.untracked.vstring(monitorModule.DQMBaseFolder.value()+"/"+monitorModule.PathSummaryPlotter.DQMFolder.value()),
verbose = cms.untracked.uint32(0), # Set to 2 for all messages
outputFileName = cms.untracked.string(''),
resolution = cms.vstring(),
efficiency = cms.vstring(),
efficiencyProfile = cms.untracked.vstring(
"PathEfficiency 'Accepted Events per Path;;' helpers/PathTriggerBits helpers/RefEvents"
),
)

m2 = cms.EDAnalyzer("HLTTauPostProcessor",
DQMBaseFolder = cms.untracked.string(monitorModule.DQMBaseFolder.value())
)

return (m1, m2)

def makePFTauAnalyzer(monitorModule):
(m1, m2) = makeInclusiveAnalyzer(monitorModule)
m1.subDirs.extend([monitorModule.DQMBaseFolder.value()+"/HLT_.*",
monitorModule.DQMBaseFolder.value()+"/"+monitorModule.L1Plotter.DQMFolder.value()])

def _addEfficiencies(level, quantities, nameFormat, titleObject="#tau", postfix=""):
if postfix != "":
postfix = " "+postfix
for quantity, titleLabel in quantities:
name = nameFormat % (level, quantity)
title = "%s %s %s efficiency%s" % (level, titleObject, titleLabel, postfix)
m1.efficiencyProfile.append("%s '%s' helpers/%sNum helpers/%sDenom" % (name, title, name, name))

HLTTauPostAnalysis_Inclusive = cms.EDAnalyzer("HLTTauPostProcessor",
DQMBaseFolder = hltTauOfflineMonitor_Inclusive.DQMBaseFolder,
L1Plotter = hltTauOfflineMonitor_Inclusive.L1Plotter,
PathSummaryPlotter = hltTauOfflineMonitor_Inclusive.PathSummaryPlotter,
)

HLTTauPostSeq = cms.Sequence(HLTTauPostAnalysis_PFTaus*HLTTauPostAnalysis_Inclusive)
_addEfficiencies("L1", [("Et", "E_{T}"),
("Eta", "#eta"),
("Phi", "#phi")], "%sTau%sEff")
_addEfficiencies("L1", [("HighEt", "E_{T}")], "%sTau%sEff", postfix="(high E_{T})")

_addEfficiencies("L1", [("Et", "E_{T}")], "%sJet%sEff")
_addEfficiencies("L1", [("HighEt", "E_{T}")], "%sJet%sEff", "central jet", postfix="(high E_{T})")
_addEfficiencies("L1", [("Eta", "#eta"),
("Phi", "#phi")], "%sJet%sEff", "central jet", "(E_{T} > %.1f)" % monitorModule.L1Plotter.L1JetMinEt.value())

for level in ["L2", "L3"]:
_addEfficiencies(level, [("Et", "p_{T}"),
("Eta", "#eta"),
("Phi", "#phi")], "%sTrigTau%sEff")
_addEfficiencies(level, [("HighEt", "p_{T}")], "%sTrigTau%sEff", postfix="(high p_{T})")

return (m1, m2)


(HLTTauPostAnalysis_Inclusive, HLTTauPostAnalysis_Inclusive2) = makeInclusiveAnalyzer(hltTauOfflineMonitor_Inclusive)
(HLTTauPostAnalysis_PFTaus, HLTTauPostAnalysis_PFTaus2) = makePFTauAnalyzer(hltTauOfflineMonitor_PFTaus)
HLTTauPostSeq = cms.Sequence(
HLTTauPostAnalysis_Inclusive+HLTTauPostAnalysis_Inclusive2+
HLTTauPostAnalysis_PFTaus+HLTTauPostAnalysis_PFTaus2
)
14 changes: 7 additions & 7 deletions DQMOffline/Trigger/src/HLTTauDQML1Plotter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,36 +82,36 @@ void HLTTauDQML1Plotter::bookHistograms(DQMStore::IBooker &iBooker) {
snprintf(buffer, BUFMAX, "L1 central jet E_{T} resolution (E_{T} > %.1f);[L1 jet E_{T}-Ref #tau E_{T}]/Ref #tau E_{T};entries", l1JetMinEt_);
l1jetEtRes_ = iBooker.book1D("L1JetEtResol", buffer, 60, -1, 4);

iBooker.setCurrentFolder(triggerTag()+"/EfficiencyHelpers");
iBooker.setCurrentFolder(triggerTag()+"/helpers");

l1tauEtEffNum_ = iBooker.book1D("L1TauEtEffNum","L1 #tau E_{T} Efficiency;Ref #tau E_{T};entries",binsEt_,0,maxPt_);
l1tauHighEtEffNum_ = iBooker.book1D("L1TauHighEtEffNum","L1 #tau E_{T} Efficiency (high E_{T});Ref #tau E_{T};entries",binsEt_,0,maxHighPt_);

l1tauEtEffDenom_ = iBooker.book1D("L1TauEtEffDenom","L1 #tau E_{T} Denominator;Ref #tau E_{T};entries",binsEt_,0,maxPt_);
l1tauHighEtEffDenom_ = iBooker.book1D("L1TauHighEtEffDenom","L1 #tau E_{T} Denominator (high E_{T});Ref #tau E_{T};entries",binsEt_,0,maxHighPt_);
l1tauHighEtEffDenom_ = iBooker.book1D("L1TauHighEtEffDenom","L1 #tau E_{T} Denominator (high E_{T});Ref #tau E_{T};Efficiency",binsEt_,0,maxHighPt_);

l1tauEtaEffNum_ = iBooker.book1D("L1TauEtaEffNum","L1 #tau #eta Efficiency;Ref #tau #eta;entries",binsEta_,-maxEta_,maxEta_);
l1tauEtaEffDenom_ = iBooker.book1D("L1TauEtaEffDenom","L1 #tau #eta Denominator;Ref #tau #eta;entries",binsEta_,-maxEta_,maxEta_);

l1tauPhiEffNum_ = iBooker.book1D("L1TauPhiEffNum","L1 #tau #phi Efficiency;Ref #tau #phi;entries",binsPhi_,minPhi,maxPhi);
l1tauPhiEffDenom_ = iBooker.book1D("L1TauPhiEffDenom","L1 #tau #phi Denominator;Ref #tau #phi;entries",binsPhi_,minPhi,maxPhi);
l1tauPhiEffDenom_ = iBooker.book1D("L1TauPhiEffDenom","L1 #tau #phi Denominator;Ref #tau #phi;Efficiency",binsPhi_,minPhi,maxPhi);

l1jetEtEffNum_ = iBooker.book1D("L1JetEtEffNum","L1 central jet E_{T} Efficiency;Ref #tau E_{T};entries",binsEt_,0,maxPt_);
l1jetHighEtEffNum_ = iBooker.book1D("L1JetHighEtEffNum","L1 central jet E_{T} Efficiency (high E_{T});Ref #tau E_{T};entries",binsEt_,0,maxHighPt_);

l1jetEtEffDenom_ = iBooker.book1D("L1JetEtEffDenom","L1 central jet E_{T} Denominator;Ref #tau E_{T};entries",binsEt_,0,maxPt_);
l1jetHighEtEffDenom_ = iBooker.book1D("L1JetHighEtEffDenom","L1 central jet E_{T} Denominator (high E_{T});Ref #tau E_{T};entries",binsEt_,0,maxHighPt_);
l1jetHighEtEffDenom_ = iBooker.book1D("L1JetHighEtEffDenom","L1 central jet E_{T} Denominator (high E_{T});Ref #tau E_{T};Efficiency",binsEt_,0,maxHighPt_);

snprintf(buffer, BUFMAX, "L1 central jet #eta Efficiency (E_{T} > %.1f);Ref #tau #eta;entries", l1JetMinEt_);
l1jetEtaEffNum_ = iBooker.book1D("L1JetEtaEffNum", buffer, binsEta_, -maxEta_, maxEta_);

snprintf(buffer, BUFMAX, "L1 central jet #eta Denominator (E_{T} > %.1f);Ref #tau #eta;entries", l1JetMinEt_);
snprintf(buffer, BUFMAX, "L1 central jet #eta Denominator (E_{T} > %.1f);Ref #tau #eta;Efficiency", l1JetMinEt_);
l1jetEtaEffDenom_ = iBooker.book1D("L1JetEtaEffDenom", buffer, binsEta_, -maxEta_, maxEta_);

snprintf(buffer, BUFMAX, "L1 central jet #phi Efficiency (E_{T} > %.1f);Ref #tau #eta;entries", l1JetMinEt_);
snprintf(buffer, BUFMAX, "L1 central jet #phi Efficiency (E_{T} > %.1f);Ref #tau #phi;entries", l1JetMinEt_);
l1jetPhiEffNum_ = iBooker.book1D("L1JetPhiEffNum", buffer, binsPhi_, minPhi, maxPhi);

snprintf(buffer, BUFMAX, "L1 central jet #phi Efficiency (E_{T} > %.1f);Ref #tau #eta;entries", l1JetMinEt_);
snprintf(buffer, BUFMAX, "L1 central jet #phi Efficiency (E_{T} > %.1f);Ref #tau #phi;Efficiency", l1JetMinEt_);
l1jetPhiEffDenom_ = iBooker.book1D("L1JetPhiEffDenom", buffer, binsPhi_, minPhi, maxPhi);
}
}
Expand Down
Loading

0 comments on commit af6f2fa

Please sign in to comment.