Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MET+MHT+b-tag Offline DQM 92X #19508

Closed
wants to merge 69 commits into from
Closed
Show file tree
Hide file tree
Changes from 68 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
b8c78ae
Offline DQM for Top HLT
defranchis May 27, 2017
552890e
adding electron isolation for ele+jets
defranchis May 30, 2017
8173416
adding variable binning + multiplicity histograms
defranchis May 30, 2017
01b00c3
Merge pull request #5 from defranchis/DQM-try-to-cherrypick
defranchis May 30, 2017
b68cbb0
adding 2D histograms and efficiencies
defranchis May 30, 2017
26414c6
renaming directories
defranchis May 31, 2017
5303a4a
updating from EDAnalyzer to DQMEDHarvester
defranchis May 31, 2017
7ae70ef
adding further 2D distributions for di-lepton channel
defranchis May 31, 2017
3003514
configuring variable binning
defranchis Jun 1, 2017
f35341a
bug fix
defranchis Jun 1, 2017
6286bc3
updating selection for ele+jets
defranchis Jun 1, 2017
5fbdb04
updating pt binnings
defranchis Jun 1, 2017
7735713
Updated Leptonic Paths
mohsinwaseem Jun 1, 2017
bb8267c
Reverted changes in HLTriggerOffline
mohsinwaseem Jun 1, 2017
dd87c03
Merge pull request #9 from mohsinwaseem/Test
defranchis Jun 1, 2017
cf5a011
merging code for fully-hadronic
marinakolosova Jun 1, 2017
5611aef
adding default CSV working point
defranchis Jun 1, 2017
1b97155
Merge pull request #10 from defranchis/merge-from-fully-hadronic
defranchis Jun 1, 2017
61e8d65
update top hlt dqm code to include PV cuts to be used by higgs montoring
sroychow Jun 2, 2017
79cfa0e
adding string selection for b-jets
defranchis Jun 2, 2017
5f380f1
removing single top and updating output directories
defranchis Jun 2, 2017
0ae26fa
optimization and bug fix
defranchis Jun 2, 2017
29ea8cc
Merge pull request #12 from defranchis/merge-from-fully-hadronic
defranchis Jun 2, 2017
40849d4
Merge branch 'TopDQMOfflineHLT' into updateTotopdqm
sroychow Jun 2, 2017
c817647
resolving conflicts with previous updates from bjet
sroychow Jun 2, 2017
c7e5018
Added Reference Monitoring
marinakolosova Jun 6, 2017
3b6908a
Merged refs/pull/18981/head from repository cms-sw
defranchis Jun 6, 2017
b8f531d
adding BTagMu and PFJet monitorning for AK4 and AK8
defranchis Jun 6, 2017
5b9627b
Merge pull request #13 from marinakolosova/newPR_fullyhadronic
defranchis Jun 7, 2017
a0f4163
Merge pull request #11 from sroychow/updateTotopdqm
defranchis Jun 7, 2017
ab288b5
switching verbosity level to 0
defranchis Jun 7, 2017
ace8d02
fixing problems
defranchis Jun 7, 2017
b0372d6
Merge pull request #14 from defranchis/merge-fix-top
defranchis Jun 7, 2017
adc8602
Merged refs/pull/18981/head from repository cms-sw
defranchis Jun 9, 2017
ac137be
adding CSV monitoring + deltaR (jet,mu)
defranchis Jun 9, 2017
fbcea84
important bug fix
defranchis Jun 9, 2017
856e68b
Merge pull request #15 from defranchis/merge-fix-top
defranchis Jun 9, 2017
9bebba3
Merged refs/pull/18981/head from repository cms-sw
defranchis Jun 9, 2017
fac52c7
additional monitor
defranchis Jun 9, 2017
576c9f0
Merge pull request #16 from defranchis/merge-fix-top
defranchis Jun 9, 2017
9ed886f
Merged refs/pull/18981/head from repository cms-sw
defranchis Jun 9, 2017
de60450
Added TripleBTag monitoring + bjetCSVHT 2D plots
marinakolosova Jun 10, 2017
d681e15
Merge pull request #19 from marinakolosova/TripleBTagDQM
defranchis Jun 12, 2017
39a92d5
Merged refs/pull/19119/head from repository cms-sw
defranchis Jun 12, 2017
0772a81
minor bug fixes
defranchis Jun 12, 2017
5e1fe7a
updated binning for monitoring of BTV paths
defranchis Jun 12, 2017
f5bf5a0
adjusting binning for TOP
defranchis Jun 12, 2017
e86650f
updating muon selection + adjusting binning for BTV
defranchis Jun 12, 2017
2139603
fixing code according to comments
defranchis Jun 14, 2017
8ad1b1c
adding monitor of reference paths
defranchis Jun 14, 2017
ae88403
removing commented lines
defranchis Jun 14, 2017
dba3291
bug fix
defranchis Jun 15, 2017
43a1a6e
adding DQM for (AK8)PFJet550
defranchis Jun 19, 2017
db86516
added HTmonitoring, HT plots inside METmonitor, added in ExoClient
sudhaahuja May 23, 2017
dbf148b
edited METmonitor with HT plots
sudhaahuja May 23, 2017
9ba4ad0
METmonitor and HTmonitor updated
sudhaahuja May 26, 2017
fca642a
updates after comment on PR
sudhaahuja May 31, 2017
e346e39
updated hltpaths in HTmonitor & other changes
sudhaahuja Jun 6, 2017
e3cbd3a
small correction in HT/MET clients
sudhaahuja Jun 12, 2017
6978e8a
Create ExoticaMonitoring_Client_cff.py
sudhaahuja Jun 12, 2017
2e65a74
B2G monitor added from PR19214 & small changes HT/MET monitor
sudhaahuja Jun 15, 2017
101caa1
Code review updates
rappoccio Jun 16, 2017
5df0e71
Commenting out JME-dependent modules until it is integrated
rappoccio Jun 16, 2017
422c2fd
A few edits and corrections
rappoccio Jun 16, 2017
0f13299
Changing EDAnalyzer to EDProducer
rappoccio Jun 16, 2017
d1004d4
Merged EXOB2G_HLTMON from repository rappoccio
Jun 27, 2017
3354e5e
Merged BTV-DQMOffline from repository defranchis
Jun 27, 2017
83c51a3
add met+btag monitoring
Jul 2, 2017
4ed4df6
rearranging folders from m. tosi request
Jul 3, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DQMOffline/Trigger/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<use name="DQMServices/Core"/>
<use name="CommonTools/Utils"/>
<use name="CommonTools/TriggerUtils"/>
<use name="DataFormats/VertexReco"/>
<use name="root"/>
<use name="roofit"/>
<use name="boost"/>
Expand Down
301 changes: 301 additions & 0 deletions DQMOffline/Trigger/plugins/HTMonitor.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,301 @@
#include "DQMOffline/Trigger/plugins/HTMonitor.h"

#include "CommonTools/TriggerUtils/interface/GenericTriggerEventFlag.h"

#include "DataFormats/Math/interface/deltaPhi.h"

// -----------------------------
// constructors and destructor
// -----------------------------

HTMonitor::HTMonitor( const edm::ParameterSet& iConfig ) :
folderName_ ( iConfig.getParameter<std::string>("FolderName") )
, metToken_ ( consumes<reco::PFMETCollection> (iConfig.getParameter<edm::InputTag>("met") ) )
, jetToken_ ( mayConsume<reco::PFJetCollection> (iConfig.getParameter<edm::InputTag>("jets") ) )
, eleToken_ ( mayConsume<reco::GsfElectronCollection>(iConfig.getParameter<edm::InputTag>("electrons") ) )
, muoToken_ ( mayConsume<reco::MuonCollection> (iConfig.getParameter<edm::InputTag>("muons") ) )
, vtxToken_ ( mayConsume<reco::VertexCollection> (iConfig.getParameter<edm::InputTag>("vertices") ) )
, ht_variable_binning_ ( iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double> >("htBinning") )
, ht_binning_ ( getHistoPSet (iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet> ("htPSet") ) )
, ls_binning_ ( getHistoLSPSet (iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet> ("lsPSet") ) )
, num_genTriggerEventFlag_(new GenericTriggerEventFlag(iConfig.getParameter<edm::ParameterSet>("numGenericTriggerEventPSet"),consumesCollector(), *this))
, den_genTriggerEventFlag_(new GenericTriggerEventFlag(iConfig.getParameter<edm::ParameterSet>("denGenericTriggerEventPSet"),consumesCollector(), *this))
, metSelection_ ( iConfig.getParameter<std::string>("metSelection") )
, jetSelection_ ( iConfig.getParameter<std::string>("jetSelection") )
, eleSelection_ ( iConfig.getParameter<std::string>("eleSelection") )
, muoSelection_ ( iConfig.getParameter<std::string>("muoSelection") )
, jetSelection_HT_ ( iConfig.getParameter<std::string>("jetSelection_HT") )
, njets_ ( iConfig.getParameter<unsigned>("njets" ) )
, nelectrons_ ( iConfig.getParameter<unsigned>("nelectrons" ) )
, nmuons_ ( iConfig.getParameter<unsigned>("nmuons" ) )
{

htME_variableBinning_.numerator = nullptr;
htME_variableBinning_.denominator = nullptr;
htVsLS_.numerator = nullptr;
htVsLS_.denominator = nullptr;
deltaphimetj1ME_.numerator = nullptr;
deltaphimetj1ME_.denominator = nullptr;
deltaphij1j2ME_.numerator = nullptr;
deltaphij1j2ME_.denominator = nullptr;

}

HTMonitor::~HTMonitor()
{
}

HTMonitor::MEHTbinning HTMonitor::getHistoPSet(edm::ParameterSet pset)
{
return HTMonitor::MEHTbinning{
pset.getParameter<int32_t>("nbins"),
pset.getParameter<double>("xmin"),
pset.getParameter<double>("xmax"),
};
}

HTMonitor::MEHTbinning HTMonitor::getHistoLSPSet(edm::ParameterSet pset)
{
return HTMonitor::MEHTbinning{
pset.getParameter<int32_t>("nbins"),
0.,
double(pset.getParameter<int32_t>("nbins"))
};
}

void HTMonitor::setHTitle(HTME& me, std::string titleX, std::string titleY)
{
me.numerator->setAxisTitle(titleX,1);
me.numerator->setAxisTitle(titleY,2);
me.denominator->setAxisTitle(titleX,1);
me.denominator->setAxisTitle(titleY,2);

}

void HTMonitor::bookME(DQMStore::IBooker &ibooker, HTME& me, const std::string& histname, const std::string& histtitle, int nbins, double min, double max)
{
me.numerator = ibooker.book1D(histname+"_numerator", histtitle+" (numerator)", nbins, min, max);
me.denominator = ibooker.book1D(histname+"_denominator", histtitle+" (denominator)", nbins, min, max);
}
void HTMonitor::bookME(DQMStore::IBooker &ibooker, HTME& me, const std::string& histname, const std::string& histtitle, const std::vector<double>& binning)
{
int nbins = binning.size()-1;
std::vector<float> fbinning(binning.begin(),binning.end());
float* arr = &fbinning[0];
me.numerator = ibooker.book1D(histname+"_numerator", histtitle+" (numerator)", nbins, arr);
me.denominator = ibooker.book1D(histname+"_denominator", histtitle+" (denominator)", nbins, arr);
}
void HTMonitor::bookME(DQMStore::IBooker &ibooker, HTME& me, const std::string& histname, const std::string& histtitle, int nbinsX, double xmin, double xmax, double ymin, double ymax)
{
me.numerator = ibooker.bookProfile(histname+"_numerator", histtitle+" (numerator)", nbinsX, xmin, xmax, ymin, ymax);
me.denominator = ibooker.bookProfile(histname+"_denominator", histtitle+" (denominator)", nbinsX, xmin, xmax, ymin, ymax);
}
void HTMonitor::bookME(DQMStore::IBooker &ibooker, HTME& me, const std::string& histname, const std::string& histtitle, int nbinsX, double xmin, double xmax, int nbinsY, double ymin, double ymax)
{
me.numerator = ibooker.book2D(histname+"_numerator", histtitle+" (numerator)", nbinsX, xmin, xmax, nbinsY, ymin, ymax);
me.denominator = ibooker.book2D(histname+"_denominator", histtitle+" (denominator)", nbinsX, xmin, xmax, nbinsY, ymin, ymax);
}
void HTMonitor::bookME(DQMStore::IBooker &ibooker, HTME& me, const std::string& histname, const std::string& histtitle, const std::vector<double>& binningX, const std::vector<double>& binningY)
{
int nbinsX = binningX.size()-1;
std::vector<float> fbinningX(binningX.begin(),binningX.end());
float* arrX = &fbinningX[0];
int nbinsY = binningY.size()-1;
std::vector<float> fbinningY(binningY.begin(),binningY.end());
float* arrY = &fbinningY[0];

me.numerator = ibooker.book2D(histname+"_numerator", histtitle+" (numerator)", nbinsX, arrX, nbinsY, arrY);
me.denominator = ibooker.book2D(histname+"_denominator", histtitle+" (denominator)", nbinsX, arrX, nbinsY, arrY);
}

void HTMonitor::bookHistograms(DQMStore::IBooker & ibooker,
edm::Run const & iRun,
edm::EventSetup const & iSetup)
{

std::string histname, histtitle;

std::string currentFolder = folderName_ ;
ibooker.setCurrentFolder(currentFolder.c_str());

histname = "ht_variable"; histtitle = "HT";
bookME(ibooker,htME_variableBinning_,histname,histtitle,ht_variable_binning_);
setHTitle(htME_variableBinning_,"HT [GeV]","events / [GeV]");

histname = "htVsLS"; histtitle = "HT vs LS";
bookME(ibooker,htVsLS_,histname,histtitle,ls_binning_.nbins, ls_binning_.xmin, ls_binning_.xmax,ht_binning_.xmin, ht_binning_.xmax);
setHTitle(htVsLS_,"LS","HT [GeV]");

histname = "deltaphi_metjet1"; histtitle = "DPHI_METJ1";
bookME(ibooker,deltaphimetj1ME_,histname,histtitle,phi_binning_.nbins, phi_binning_.xmin, phi_binning_.xmax);
setHTitle(deltaphimetj1ME_,"delta phi (met, j1)","events / 0.1 rad");

histname = "deltaphi_jet1jet2"; histtitle = "DPHI_J1J2";
bookME(ibooker,deltaphij1j2ME_,histname,histtitle,phi_binning_.nbins, phi_binning_.xmin, phi_binning_.xmax);
setHTitle(deltaphij1j2ME_,"delta phi (j1, j2)","events / 0.1 rad");

// Initialize the GenericTriggerEventFlag
if ( num_genTriggerEventFlag_ && num_genTriggerEventFlag_->on() ) num_genTriggerEventFlag_->initRun( iRun, iSetup );
if ( den_genTriggerEventFlag_ && den_genTriggerEventFlag_->on() ) den_genTriggerEventFlag_->initRun( iRun, iSetup );

}

#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
#include "Geometry/Records/interface/TrackerTopologyRcd.h"
void HTMonitor::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) {

// Filter out events if Trigger Filtering is requested
if (den_genTriggerEventFlag_->on() && ! den_genTriggerEventFlag_->accept( iEvent, iSetup) ) return;

edm::Handle<reco::PFMETCollection> metHandle;
iEvent.getByToken( metToken_, metHandle );
reco::PFMET pfmet = metHandle->front();
if ( ! metSelection_( pfmet ) ) return;

float ht = 0.0;

edm::Handle<reco::PFJetCollection> jetHandle; //add a configurable jet collection & jet pt selection
iEvent.getByToken( jetToken_, jetHandle );
std::vector<reco::PFJet> jets;
jets.clear();
if ( jetHandle->size() < njets_ ) return;
for ( auto const & j : *jetHandle ) {
if ( jetSelection_( j ) ) {
jets.push_back(j);
if ( jetSelection_HT_(j)) ht += j.pt();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uff, please drop this line !

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mtosi ok I can, but for your information, this code is present in the PR #19293

https://github.com/rappoccio/cmssw/blob/0f13299cb02c84e6319df259849563d63c1d4d77/DQMOffline/Trigger/plugins/HTMonitor.cc#L164-L167

I just did a merge-topic and then added a few configuration changes on top of #19119 and #19293.

See my commit here: 83c51a3

}
}
for ( auto const & j : *jetHandle ) {
if ( jetSelection_HT_(j)) ht += j.pt();
}
if ( jets.size() < njets_ ) return;

float deltaPhi_met_j1 = 10.0;
float deltaPhi_j1_j2 = 10.0;

if (jets.size() >= 1) deltaPhi_met_j1 = fabs( deltaPhi( pfmet.phi(), jets[0].phi() ));
if (jets.size() >= 2) deltaPhi_j1_j2 = fabs( deltaPhi( jets[0].phi(), jets[1].phi() ));

edm::Handle<reco::GsfElectronCollection> eleHandle;
iEvent.getByToken( eleToken_, eleHandle );
std::vector<reco::GsfElectron> electrons;
electrons.clear();
if ( eleHandle->size() < nelectrons_ ) return;
for ( auto const & e : *eleHandle ) {
if ( eleSelection_( e ) ) electrons.push_back(e);
}
if ( electrons.size() < nelectrons_ ) return;

edm::Handle<reco::VertexCollection> vtxHandle;
iEvent.getByToken(vtxToken_, vtxHandle);

reco::Vertex vtx;
math::XYZPoint pv(0, 0, 0);
for (vector<reco::Vertex>::const_iterator v = vtxHandle->begin(); v != vtxHandle->end(); ++v) {
bool isFake = v->isFake() ;

if (!isFake) {
pv.SetXYZ(v->x(), v->y(), v->z());
vtx = *v;
break;
}
}

edm::Handle<reco::MuonCollection> muoHandle;
iEvent.getByToken( muoToken_, muoHandle );
if ( muoHandle->size() < nmuons_ ) return;
std::vector<reco::Muon> muons;
muons.clear();
for ( auto const & m : *muoHandle ) {
if ( muoSelection_( m ) && m.isGlobalMuon() && m.isPFMuon() && m.globalTrack()->normalizedChi2() < 10. && m.globalTrack()->hitPattern().numberOfValidMuonHits() > 0 && m.numberOfMatchedStations() > 1 && fabs(m.muonBestTrack()->dxy(pv)) < 0.2 && fabs(m.muonBestTrack()->dz(pv)) < 0.5 && m.innerTrack()->hitPattern().numberOfValidPixelHits() > 0 && m.innerTrack()->hitPattern().trackerLayersWithMeasurement() > 5 ) muons.push_back(m);
}
if ( muons.size() < nmuons_ ) return;

// filling histograms (denominator)
htME_variableBinning_.denominator -> Fill(ht);
deltaphimetj1ME_.denominator -> Fill(deltaPhi_met_j1);
deltaphij1j2ME_.denominator -> Fill(deltaPhi_j1_j2);

int ls = iEvent.id().luminosityBlock();
htVsLS_.denominator -> Fill(ls, ht);

// applying selection for numerator
if (num_genTriggerEventFlag_->on() && ! num_genTriggerEventFlag_->accept( iEvent, iSetup) ) return;

// filling histograms (num_genTriggerEventFlag_)
htME_variableBinning_.numerator -> Fill(ht);
htVsLS_.numerator -> Fill(ls, ht);
deltaphimetj1ME_.numerator -> Fill(deltaPhi_met_j1);
deltaphij1j2ME_.numerator -> Fill(deltaPhi_j1_j2);

}

void HTMonitor::fillHistoPSetDescription(edm::ParameterSetDescription & pset)
{
pset.add<int> ( "nbins");
pset.add<double>( "xmin" );
pset.add<double>( "xmax" );
}

void HTMonitor::fillHistoLSPSetDescription(edm::ParameterSetDescription & pset)
{
pset.add<int> ( "nbins", 2500);
}

void HTMonitor::fillDescriptions(edm::ConfigurationDescriptions & descriptions)
{
edm::ParameterSetDescription desc;
desc.add<std::string> ( "FolderName", "HLT/HT" );

desc.add<edm::InputTag>( "met", edm::InputTag("pfMet") );
desc.add<edm::InputTag>( "jets", edm::InputTag("ak4PFJetsCHS") );
desc.add<edm::InputTag>( "electrons",edm::InputTag("gedGsfElectrons") );
desc.add<edm::InputTag>( "muons", edm::InputTag("muons") );
desc.add<edm::InputTag>( "vertices",edm::InputTag("offlinePrimaryVertices") );
desc.add<std::string>("metSelection", "pt > 0");
desc.add<std::string>("jetSelection", "pt > 0");
desc.add<std::string>("eleSelection", "pt > 0");
desc.add<std::string>("muoSelection", "pt > 0");
desc.add<std::string>("jetSelection_HT", "pt > 30 && eta < 2.5");
desc.add<unsigned>("njets", 0);
desc.add<unsigned>("nelectrons", 0);
desc.add<unsigned>("nmuons", 0);

edm::ParameterSetDescription genericTriggerEventPSet;
genericTriggerEventPSet.add<bool>("andOr");
genericTriggerEventPSet.add<edm::InputTag>("dcsInputTag", edm::InputTag("scalersRawToDigi") );
genericTriggerEventPSet.add<std::vector<int> >("dcsPartitions",{});
genericTriggerEventPSet.add<bool>("andOrDcs", false);
genericTriggerEventPSet.add<bool>("errorReplyDcs", true);
genericTriggerEventPSet.add<std::string>("dbLabel","");
genericTriggerEventPSet.add<bool>("andOrHlt", true);
genericTriggerEventPSet.add<edm::InputTag>("hltInputTag", edm::InputTag("TriggerResults::HLT") );
genericTriggerEventPSet.add<std::vector<std::string> >("hltPaths",{});
genericTriggerEventPSet.add<std::string>("hltDBKey","");
genericTriggerEventPSet.add<bool>("errorReplyHlt",false);
genericTriggerEventPSet.add<unsigned int>("verbosityLevel",1);

desc.add<edm::ParameterSetDescription>("numGenericTriggerEventPSet", genericTriggerEventPSet);
desc.add<edm::ParameterSetDescription>("denGenericTriggerEventPSet", genericTriggerEventPSet);

edm::ParameterSetDescription histoPSet;
edm::ParameterSetDescription htPSet;
fillHistoPSetDescription(htPSet);
histoPSet.add<edm::ParameterSetDescription>("htPSet", htPSet);
std::vector<double> bins = {0.,20.,40.,60.,80.,90.,100.,110.,120.,130.,140.,150.,160.,170.,180.,190.,200.,220.,240.,260.,280.,300.,350.,400.,450.,500.,550.,600.,650.,700.,750.,800.,850.,900.,950.,1000.,1050.,1100.,1200.,1300.,1400.,1500.,2000.,2500.};
histoPSet.add<std::vector<double> >("htBinning", bins);

edm::ParameterSetDescription lsPSet;
fillHistoLSPSetDescription(lsPSet);
histoPSet.add<edm::ParameterSetDescription>("lsPSet", lsPSet);

desc.add<edm::ParameterSetDescription>("histoPSet",histoPSet);

descriptions.add("htMonitoring", desc);
}

// Define this as a plug-in
#include "FWCore/Framework/interface/MakerMacros.h"
DEFINE_FWK_MODULE(HTMonitor);
Loading