Skip to content

Commit

Permalink
Merge pull request #3641 from battibass/muonHltDqmDQMEDAnalyzer
Browse files Browse the repository at this point in the history
DQM -- Muon HLT DQM modules migrated to DQMEDAlayzer and DQMEDHarvester interface.
  • Loading branch information
ktf committed May 3, 2014
2 parents 3c631eb + 6068426 commit 6b171e7
Show file tree
Hide file tree
Showing 10 changed files with 147 additions and 302 deletions.
7 changes: 3 additions & 4 deletions DQMOffline/Trigger/interface/HLTMuonMatchAndPlot.h
Expand Up @@ -67,7 +67,7 @@ class HLTMuonMatchAndPlot
const std::vector<std::string>&);

// Analyzer Methods
void beginRun(const edm::Run &, const edm::EventSetup &);
void beginRun(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &);
void analyze(edm::Handle<reco::MuonCollection> &, edm::Handle<reco::BeamSpot> &,
edm::Handle<reco::VertexCollection> &, edm::Handle<trigger::TriggerEvent> &,
edm::Handle<edm::TriggerResults> &);
Expand All @@ -84,8 +84,8 @@ class HLTMuonMatchAndPlot
private:

// Internal Methods
void book1D(std::string, std::string, std::string);
void book2D(std::string, std::string, std::string, std::string);
void book1D(DQMStore::IBooker &, std::string, std::string, std::string);
void book2D(DQMStore::IBooker &, std::string, std::string, std::string, std::string);
reco::MuonCollection selectedMuons(
const reco::MuonCollection &,
const reco::BeamSpot &,
Expand All @@ -111,7 +111,6 @@ class HLTMuonMatchAndPlot
unsigned int cutMinPt_;
std::string hltPath_;
std::vector<std::string> moduleLabels_;
DQMStore * dbe_;
std::map<std::string, MonitorElement *> hists_;

// Selectors
Expand Down
Expand Up @@ -57,7 +57,7 @@ class HLTMuonMatchAndPlotContainer
const std::vector<std::string>&);

// Analyzer Methods
void beginRun(const edm::Run &, const edm::EventSetup &);
void beginRun(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &);
void analyze(const edm::Event &, const edm::EventSetup &);
void endRun(const edm::Run &, const edm::EventSetup &);

Expand Down
79 changes: 27 additions & 52 deletions DQMOffline/Trigger/src/HLTMuonCertSummary.cc
Expand Up @@ -34,7 +34,7 @@

// user include files
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "DQMServices/Core/interface/DQMEDHarvester.h"

#include "FWCore/Framework/interface/Event.h"

Expand All @@ -56,24 +56,21 @@ using namespace std;
// class decleration
//

class HLTMuonCertSummary : public edm::EDAnalyzer {
class HLTMuonCertSummary : public DQMEDHarvester {

public:
explicit HLTMuonCertSummary(const edm::ParameterSet& pset);
~HLTMuonCertSummary();


virtual void beginJob() override ;
virtual void analyze(const edm::Event&, const edm::EventSetup&) override;
virtual void endJob() override ;
virtual void beginJob();
virtual void beginRun(const edm::Run&, const edm::EventSetup&) override ;
virtual void endRun(const edm::Run&, const edm::EventSetup&) override ;
virtual void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override ;



private:

DQMStore *dbe_;
edm::ParameterSet parameters_;

bool verbose_;
Expand All @@ -88,15 +85,7 @@ HLTMuonCertSummary::HLTMuonCertSummary(const edm::ParameterSet& pset)
{

using namespace edm;
dbe_ = 0;
dbe_ = edm::Service<DQMStore>().operator->();
if (!dbe_) {
LogInfo ("DQMGenericClient") << "Can't find DQMStore, no results will be saved"
<< endl;
} else {
dbe_->setVerbose(0);
}


parameters_ = pset;
verbose_ = parameters_.getUntrackedParameter<bool>("verbose", false);

Expand All @@ -105,37 +94,27 @@ HLTMuonCertSummary::HLTMuonCertSummary(const edm::ParameterSet& pset)
}



HLTMuonCertSummary::~HLTMuonCertSummary()
{

}



//
// member functions
//

// ------------ method called to for each event ------------
void
HLTMuonCertSummary::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
{
using namespace edm;

if(verbose_) LogInfo ("HLTMuonVal") << ">>> Analyze (HLTMuonCertSummary) <<<" << std::endl;

}

// ------------ method called once each job just before starting event loop ------------
void
HLTMuonCertSummary::beginJob()
{
}

// ------------ method called once each job just after ending the event loop ------------
void
HLTMuonCertSummary::endJob()
{
}



// ------------ method called just before starting a new run ------------
void
HLTMuonCertSummary::beginRun(const edm::Run& run, const edm::EventSetup& c)
Expand All @@ -147,18 +126,15 @@ HLTMuonCertSummary::beginRun(const edm::Run& run, const edm::EventSetup& c)

}



// ------------ method called right after a run ends ------------
void
HLTMuonCertSummary::endRun(const edm::Run& run, const edm::EventSetup& c)
HLTMuonCertSummary::dqmEndJob(DQMStore::IBooker & iBooker, DQMStore::IGetter & iGetter)
{

using namespace edm;
if(verbose_) LogInfo ("HLTMuonVal") << ">>> EndRun (HLTMuonCertSummary) <<<" << std::endl;

if(!dbe_) {
LogInfo ("DQMGenericClient") << "No dqmstore... skipping processing step" << endl;
return;
}

std::vector<string> histoNameVector;

Expand All @@ -167,19 +143,19 @@ HLTMuonCertSummary::endRun(const edm::Run& run, const edm::EventSetup& c)



dbe_->setCurrentFolder("HLT/EventInfo/muonQuality");
iBooker.setCurrentFolder("HLT/EventInfo/muonQuality");

MonitorElement* reportSummary = dbe_->bookFloat("HLT_MUON_REPORT_SUMMARY");
MonitorElement* reportSummary = iBooker.bookFloat("HLT_MUON_REPORT_SUMMARY");

int SummaryBitResult = 100;

MonitorElement* CertificationSummary = dbe_->bookFloat("HLT_MUON_CERTIFICATION_SUMMARY");
MonitorElement* CertificationSummary = iBooker.bookFloat("HLT_MUON_CERTIFICATION_SUMMARY");



//for now these will hold values from eta/phi tests for spikes/holes
MonitorElement* reportSummaryMap = dbe_->book2D("HLT_MUON_ReportSummaryMap","HLT_MUON: ReportSummaryMap",6,-0.5,5.5,1,-0.5,0.5);
MonitorElement* CertificationSummaryMap = dbe_->book2D("HLT_MUON_CertificationSummaryMap","HLT_MUON: CertificationSummaryMap",6,-0.5,5.5,1,-0.5,0.5);
MonitorElement* reportSummaryMap = iBooker.book2D("HLT_MUON_ReportSummaryMap","HLT_MUON: ReportSummaryMap",6,-0.5,5.5,1,-0.5,0.5);
MonitorElement* CertificationSummaryMap = iBooker.book2D("HLT_MUON_CertificationSummaryMap","HLT_MUON: CertificationSummaryMap",6,-0.5,5.5,1,-0.5,0.5);

TH2 * reportSummaryMapTH2 = reportSummaryMap->getTH2F();

Expand Down Expand Up @@ -213,7 +189,7 @@ HLTMuonCertSummary::endRun(const edm::Run& run, const edm::EventSetup& c)
histoNameVector.push_back("HLT/Muon/Distributions/HLT_Mu5/allMuons/recEffEta_L3Filtered");

// to do: what do we want in certification contents?
// dbe_->setCurrentFolder("Egamma/EventInfo/CertificationContents/");
// iBooker.setCurrentFolder("Egamma/EventInfo/CertificationContents/");


// //looping over histograms to be tested
Expand All @@ -227,7 +203,7 @@ HLTMuonCertSummary::endRun(const edm::Run& run, const edm::EventSetup& c)

MonitorElement * TestHist=0;

TestHist = dbe_->get(HistoName);
TestHist = iGetter.get(HistoName);

bool validMe = TestHist!=0;
if(verbose_) LogInfo ("HLTMuonVal") << " is valid? " << validMe << "\n";
Expand All @@ -254,8 +230,8 @@ HLTMuonCertSummary::endRun(const edm::Run& run, const edm::EventSetup& c)


//book and fill float for each test done
dbe_->setCurrentFolder("HLT/EventInfo/muonQuality/");
MonitorElement * qValueInt = dbe_->bookFloat(histNameNoPath+"_HLT_Mu5_"+qtname);
iBooker.setCurrentFolder("HLT/EventInfo/muonQuality/");
MonitorElement * qValueInt = iBooker.bookFloat(histNameNoPath+"_HLT_Mu5_"+qtname);
qValueInt->Fill(qtstatus);

// We're assuming that you want all of the bits to go into the decision
Expand Down Expand Up @@ -311,18 +287,17 @@ HLTMuonCertSummary::endRun(const edm::Run& run, const edm::EventSetup& c)

// Set the final bits

dbe_->setCurrentFolder("HLT/EventInfo/reportSummaryContents");
MonitorElement* muonHLTQualityBinaryBit = dbe_->bookFloat ("HLT_Muon");
iBooker.setCurrentFolder("HLT/EventInfo/reportSummaryContents");
MonitorElement* muonHLTQualityBinaryBit = iBooker.bookFloat ("HLT_Muon");

if (SummaryBitResult == 100){
muonHLTQualityBinaryBit->Fill(1);
} else {
muonHLTQualityBinaryBit->Fill(0);
}


}

}



DEFINE_FWK_MODULE(HLTMuonCertSummary);
81 changes: 40 additions & 41 deletions DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc
Expand Up @@ -55,10 +55,6 @@ HLTMuonMatchAndPlot::HLTMuonMatchAndPlot(const ParameterSet & pset,
fillMapFromPSet(binParams_, pset, "binParams");
fillMapFromPSet(plotCuts_, pset, "plotCuts");

// Prepare the DQMStore object.
dbe_ = edm::Service<DQMStore>().operator->();
dbe_->setVerbose(0);

// Get the trigger level.
triggerLevel_ = "L3";
TPRegexp levelRegexp("L[1-3]");
Expand All @@ -82,7 +78,8 @@ HLTMuonMatchAndPlot::HLTMuonMatchAndPlot(const ParameterSet & pset,

}

void HLTMuonMatchAndPlot::beginRun(const edm::Run& iRun,
void HLTMuonMatchAndPlot::beginRun(DQMStore::IBooker & iBooker,
const edm::Run& iRun,
const edm::EventSetup& iSetup)
{

Expand All @@ -93,45 +90,45 @@ void HLTMuonMatchAndPlot::beginRun(const edm::Run& iRun,
string pathSansSuffix = hltPath_;
if (hltPath_.rfind("_v") < hltPath_.length())
pathSansSuffix = hltPath_.substr(0, hltPath_.rfind("_v"));
dbe_->setCurrentFolder(baseDir + pathSansSuffix);
iBooker.setCurrentFolder(baseDir + pathSansSuffix);

// Form is book1D(name, binningType, title) where 'binningType' is used
// to fetch the bin settings from binParams_.
book1D("deltaR", "deltaR", ";#Deltar(reco, HLT);");
book1D("hltPt", "pt", ";p_{T} of HLT object");
book1D("hltEta", "eta", ";#eta of HLT object");
book1D("hltPhi", "phi", ";#phi of HLT object");
book1D("resolutionEta", "resolutionEta", ";#eta^{reco}-#eta^{HLT};");
book1D("resolutionPhi", "resolutionPhi", ";#phi^{reco}-#phi^{HLT};");
book1D("resolutionPt", "resolutionRel",
book1D(iBooker, "deltaR", "deltaR", ";#Deltar(reco, HLT);");
book1D(iBooker, "hltPt", "pt", ";p_{T} of HLT object");
book1D(iBooker, "hltEta", "eta", ";#eta of HLT object");
book1D(iBooker, "hltPhi", "phi", ";#phi of HLT object");
book1D(iBooker, "resolutionEta", "resolutionEta", ";#eta^{reco}-#eta^{HLT};");
book1D(iBooker, "resolutionPhi", "resolutionPhi", ";#phi^{reco}-#phi^{HLT};");
book1D(iBooker, "resolutionPt", "resolutionRel",
";(p_{T}^{reco}-p_{T}^{HLT})/|p_{T}^{reco}|;");

for (size_t i = 0; i < 2; i++) {

string suffix = EFFICIENCY_SUFFIXES[i];

book1D("efficiencyEta_" + suffix, "eta", ";#eta;");
book1D("efficiencyPhi_" + suffix, "phi", ";#phi;");
book1D("efficiencyTurnOn_" + suffix, "pt", ";p_{T};");
book1D("efficiencyD0_" + suffix, "d0", ";d0;");
book1D("efficiencyZ0_" + suffix, "z0", ";z0;");
book1D("efficiencyCharge_" + suffix, "charge", ";charge;");
book1D("efficiencyVertex_" + suffix, "NVertex", ";NVertex;");

book2D("efficiencyPhiVsEta_" + suffix, "etaCoarse", "phiCoarse",
";#eta;#phi");

book1D("fakerateEta_" + suffix, "eta", ";#eta;");
book1D("fakerateVertex_" + suffix, "NVertex", ";NVertex;");
book1D("fakeratePhi_" + suffix, "phi", ";#phi;");
book1D("fakerateTurnOn_" + suffix, "pt", ";p_{T};");

book1D("massVsEtaZ_" + suffix, "etaCoarse", ";#eta");
book1D("massVsEtaJpsi_" + suffix, "etaCoarse", ";#eta");
book1D("massVsPtZ_" + suffix, "ptCoarse", ";p_{T}");
book1D("massVsPtJpsi_" + suffix, "ptCoarse", ";p_{T}");
book1D("massVsVertexZ_" + suffix, "NVertex", ";NVertex");
book1D("massVsVertexJpsi_" + suffix, "NVertex", ";NVertex");
book1D(iBooker, "efficiencyEta_" + suffix, "eta", ";#eta;");
book1D(iBooker, "efficiencyPhi_" + suffix, "phi", ";#phi;");
book1D(iBooker, "efficiencyTurnOn_" + suffix, "pt", ";p_{T};");
book1D(iBooker, "efficiencyD0_" + suffix, "d0", ";d0;");
book1D(iBooker, "efficiencyZ0_" + suffix, "z0", ";z0;");
book1D(iBooker, "efficiencyCharge_" + suffix, "charge", ";charge;");
book1D(iBooker, "efficiencyVertex_" + suffix, "NVertex", ";NVertex;");

book2D(iBooker, "efficiencyPhiVsEta_" + suffix, "etaCoarse",
"phiCoarse", ";#eta;#phi");

book1D(iBooker, "fakerateEta_" + suffix, "eta", ";#eta;");
book1D(iBooker, "fakerateVertex_" + suffix, "NVertex", ";NVertex;");
book1D(iBooker, "fakeratePhi_" + suffix, "phi", ";#phi;");
book1D(iBooker, "fakerateTurnOn_" + suffix, "pt", ";p_{T};");

book1D(iBooker, "massVsEtaZ_" + suffix, "etaCoarse", ";#eta");
book1D(iBooker, "massVsEtaJpsi_" + suffix, "etaCoarse", ";#eta");
book1D(iBooker, "massVsPtZ_" + suffix, "ptCoarse", ";p_{T}");
book1D(iBooker, "massVsPtJpsi_" + suffix, "ptCoarse", ";p_{T}");
book1D(iBooker, "massVsVertexZ_" + suffix, "NVertex", ";NVertex");
book1D(iBooker, "massVsVertexJpsi_" + suffix, "NVertex", ";NVertex");

}

Expand Down Expand Up @@ -509,7 +506,8 @@ HLTMuonMatchAndPlot::selectedTriggerObjects(



void HLTMuonMatchAndPlot::book1D(string name, string binningType, string title)
void HLTMuonMatchAndPlot::book1D(DQMStore::IBooker & iBooker, string name,
string binningType, string title)
{

/* Properly delete the array of floats that has been allocated on
Expand All @@ -522,7 +520,7 @@ void HLTMuonMatchAndPlot::book1D(string name, string binningType, string title)
float * edges = 0;
fillEdges(nBins, edges, binParams_[binningType]);

hists_[name] = dbe_->book1D(name, title, nBins, edges);
hists_[name] = iBooker.book1D(name, title, nBins, edges);
if (hists_[name])
if (hists_[name]->getTH1F()->GetSumw2N())
hists_[name]->getTH1F()->Sumw2();
Expand All @@ -535,8 +533,9 @@ void HLTMuonMatchAndPlot::book1D(string name, string binningType, string title)


void
HLTMuonMatchAndPlot::book2D(string name, string binningTypeX,
string binningTypeY, string title)
HLTMuonMatchAndPlot::book2D(DQMStore::IBooker & iBooker, string name,
string binningTypeX, string binningTypeY,
string title)
{

/* Properly delete the arrays of floats that have been allocated on
Expand All @@ -553,8 +552,8 @@ HLTMuonMatchAndPlot::book2D(string name, string binningTypeX,
float * edgesY = 0;
fillEdges(nBinsY, edgesY, binParams_[binningTypeY]);

hists_[name] = dbe_->book2D(name.c_str(), title.c_str(),
nBinsX, edgesX, nBinsY, edgesY);
hists_[name] = iBooker.book2D(name.c_str(), title.c_str(),
nBinsX, edgesX, nBinsY, edgesY);
if (hists_[name])
if (hists_[name]->getTH2F()->GetSumw2N())
hists_[name]->getTH2F()->Sumw2();
Expand Down
5 changes: 3 additions & 2 deletions DQMOffline/Trigger/src/HLTMuonMatchAndPlotContainer.cc
Expand Up @@ -50,7 +50,8 @@ void HLTMuonMatchAndPlotContainer::addPlotter(const edm::ParameterSet &pset , st
}


void HLTMuonMatchAndPlotContainer::beginRun(const edm::Run & iRun,
void HLTMuonMatchAndPlotContainer::beginRun(DQMStore::IBooker & iBooker,
const edm::Run & iRun,
const edm::EventSetup & iSetup)
{

Expand All @@ -59,7 +60,7 @@ void HLTMuonMatchAndPlotContainer::beginRun(const edm::Run & iRun,

for (; iter != end; ++iter)
{
iter->beginRun(iRun, iSetup);
iter->beginRun(iBooker, iRun, iSetup);
}

}
Expand Down

0 comments on commit 6b171e7

Please sign in to comment.