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

Devel dqm offline trigger top #26540

Merged
merged 15 commits into from
May 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion Configuration/Eras/python/Era_Run2_2017_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
from Configuration.Eras.Modifier_run2_GEM_2017_cff import run2_GEM_2017
from Configuration.Eras.Modifier_stage2L1Trigger_2017_cff import stage2L1Trigger_2017
from Configuration.Eras.Modifier_run2_HLTconditions_2017_cff import run2_HLTconditions_2017
from Configuration.Eras.Modifier_run2_HLTconditions_2016_cff import run2_HLTconditions_2016
from Configuration.Eras.Modifier_run2_muon_2017_cff import run2_muon_2017
from Configuration.Eras.Modifier_run2_muon_2016_cff import run2_muon_2016

Run2_2017 = cms.ModifierChain(Run2_2016.copyAndExclude([run2_muon_2016]),
Run2_2017 = cms.ModifierChain(Run2_2016.copyAndExclude([run2_muon_2016, run2_HLTconditions_2016]),
Copy link
Contributor

Choose a reason for hiding this comment

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

@skonstantinou could you please clarify the purpose of this modification? Add a piece to drop it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The run2_HLTcondition_2016 was contained in Run2_2018 and Run2_2017 and thus it was always selected, even when using the Run2_2017 or Run2_2018 era option. The problem is solved by removing the run2_HLTconditions_2016 modifier from Run2_2017 and run2_HLTconditions_2017 from Run2_2018 with this modification (similarly to what was done in #26489).

phase1Pixel, run2_ECAL_2017, run2_HF_2017, run2_HCAL_2017, run2_HE_2017, run2_HEPlan1_2017,
trackingPhase1, run2_GEM_2017, stage2L1Trigger_2017, run2_HLTconditions_2017, run2_muon_2017)

3 changes: 2 additions & 1 deletion Configuration/Eras/python/Era_Run2_2018_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
from Configuration.Eras.Modifier_run2_DT_2018_cff import run2_DT_2018
from Configuration.Eras.Modifier_run2_SiPixel_2018_cff import run2_SiPixel_2018
from Configuration.Eras.Modifier_run2_HLTconditions_2018_cff import run2_HLTconditions_2018
from Configuration.Eras.Modifier_run2_HLTconditions_2017_cff import run2_HLTconditions_2017
from Configuration.Eras.Modifier_run2_muon_2018_cff import run2_muon_2018
from Configuration.Eras.Modifier_run2_muon_2017_cff import run2_muon_2017
from Configuration.Eras.Modifier_run2_L1prefiring_cff import run2_L1prefiring

Run2_2018 = cms.ModifierChain(Run2_2017.copyAndExclude([run2_HEPlan1_2017, run2_muon_2017, run2_L1prefiring]),
Run2_2018 = cms.ModifierChain(Run2_2017.copyAndExclude([run2_HEPlan1_2017, run2_muon_2017, run2_L1prefiring, run2_HLTconditions_2017]),
Copy link
Contributor

Choose a reason for hiding this comment

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

@skonstantinou same comment here

run2_CSC_2018, run2_HCAL_2018, run2_HB_2018, run2_HE_2018,run2_DT_2018, run2_SiPixel_2018,
run2_HLTconditions_2018, run2_muon_2018)
77 changes: 42 additions & 35 deletions DQMOffline/Trigger/plugins/TopMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
#include "Geometry/Records/interface/TrackerTopologyRcd.h"
#include "DQMOffline/Trigger/plugins/TopMonitor.h"


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

TopMonitor::TopMonitor( const edm::ParameterSet& iConfig ) :
folderName_ ( iConfig.getParameter<std::string>("FolderName") )
TopMonitor::TopMonitor( 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<edm::View<reco::GsfElectron> >(iConfig.getParameter<edm::InputTag>("electrons") ) )
Expand All @@ -26,6 +25,7 @@ TopMonitor::TopMonitor( const edm::ParameterSet& iConfig ) :
, phoToken_ ( mayConsume<reco::PhotonCollection> (iConfig.getParameter<edm::InputTag>("photons") ) )
// Marina
, jetTagToken_ ( mayConsume<reco::JetTagCollection> (iConfig.getParameter<edm::InputTag>("btagalgo") ))
, jetbbTagToken_ ( mayConsume<reco::JetTagCollection> (iConfig.getParameter<edm::InputTag>("bbtagalgo") ))
//Suvankar
, vtxToken_ ( mayConsume<reco::VertexCollection> (iConfig.getParameter<edm::InputTag>("vertices") ) )
, met_binning_ ( getHistoPSet (iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet> ("metPSet") ) )
Expand Down Expand Up @@ -103,6 +103,8 @@ TopMonitor::TopMonitor( const edm::ParameterSet& iConfig ) :
metcut_str.erase(std::remove(metcut_str.begin(), metcut_str.end(), ' '), metcut_str.end());
if(metcut_str != "pt>0") applyMETcut_ = true;

btagalgoName_ = (iConfig.getParameter<edm::InputTag>("btagalgo")).label();

ObjME empty;

muPhi_= std::vector<ObjME> (nmuons_,empty);
Expand Down Expand Up @@ -146,7 +148,6 @@ TopMonitor::TopMonitor( const edm::ParameterSet& iConfig ) :
bjetPtEta_= std::vector<ObjME> (nbjets_,empty);
bjetEtaPhi_= std::vector<ObjME> (nbjets_,empty);
bjetCSVHT_= std::vector<ObjME> (nbjets_,empty);

//Suvankar
lepPVcuts_.dxy = (iConfig.getParameter<edm::ParameterSet>("leptonPVcuts")).getParameter<double>("dxy");
lepPVcuts_.dz = (iConfig.getParameter<edm::ParameterSet>("leptonPVcuts")).getParameter<double>("dz");
Expand Down Expand Up @@ -369,7 +370,7 @@ void TopMonitor::bookHistograms(DQMStore::IBooker & ibooker,
histname = "muEtaPhi_"; histtitle = "muon #eta - #phi - ";
histname.append(index); histtitle.append(index);
bookME(ibooker,muEtaPhi_.at(iMu),histname,histtitle, muEta_variable_binning_2D_, phi_variable_binning_2D_);
setMETitle(muEtaPhi_.at(iMu),"muon #phi","muon #eta");
setMETitle(muEtaPhi_.at(iMu),"muon #eta","muon #phi");

}

Expand Down Expand Up @@ -405,7 +406,7 @@ void TopMonitor::bookHistograms(DQMStore::IBooker & ibooker,
histname = "eleEtaPhi_"; histtitle = "electron #eta - #phi - ";
histname.append(index); histtitle.append(index);
bookME(ibooker,eleEtaPhi_.at(iEle),histname,histtitle, eleEta_variable_binning_2D_, phi_variable_binning_2D_);
setMETitle(eleEtaPhi_.at(iEle),"electron #phi","electron #eta");
setMETitle(eleEtaPhi_.at(iEle),"electron #eta","electron #phi");


}
Expand Down Expand Up @@ -438,7 +439,7 @@ void TopMonitor::bookHistograms(DQMStore::IBooker & ibooker,
histname = "phoEtaPhi_"; histtitle = "photon #eta - #phi - ";
histname.append(index); histtitle.append(index);
bookME(ibooker,phoEtaPhi_[iPho],histname,histtitle, phoEta_variable_binning_2D_, phi_variable_binning_2D_);
setMETitle(phoEtaPhi_[iPho],"photon p_{T} [GeV]","photon #eta");
setMETitle(phoEtaPhi_[iPho],"photon #eta","photon #phi");

}
}
Expand All @@ -458,15 +459,15 @@ void TopMonitor::bookHistograms(DQMStore::IBooker & ibooker,
histname = "jetEta_"; histtitle = "jet #eta - ";
histname.append(index); histtitle.append(index);
bookME(ibooker,jetEta_.at(iJet),histname,histtitle, eta_binning_.nbins,eta_binning_.xmin, eta_binning_.xmax);
setMETitle(jetEta_.at(iJet)," jet #eta","events");
setMETitle(jetEta_.at(iJet),"jet #eta","events");
histname.append("_variableBinning");
bookME(ibooker,jetEta_variableBinning_.at(iJet),histname,histtitle, jetEta_variable_binning_);
setMETitle(jetEta_variableBinning_.at(iJet),"jet #eta","events");

histname = "jetPhi_"; histtitle = "jet #phi - ";
histname.append(index); histtitle.append(index);
bookME(ibooker,jetPhi_.at(iJet),histname,histtitle, phi_binning_.nbins, phi_binning_.xmin, phi_binning_.xmax);
setMETitle(jetPhi_.at(iJet)," jet #phi","events");
setMETitle(jetPhi_.at(iJet),"jet #phi","events");

histname = "jetPtEta_"; histtitle = "jet p_{T} - #eta - ";
histname.append(index); histtitle.append(index);
Expand All @@ -476,7 +477,7 @@ void TopMonitor::bookHistograms(DQMStore::IBooker & ibooker,
histname = "jetEtaPhi_"; histtitle = "jet #eta - #phi - ";
histname.append(index); histtitle.append(index);
bookME(ibooker,jetEtaPhi_.at(iJet),histname,histtitle, jetEta_variable_binning_2D_, phi_variable_binning_2D_);
setMETitle(jetEtaPhi_.at(iJet),"#phi","jet #eta");
setMETitle(jetEtaPhi_.at(iJet),"jet #eta","jet #phi");



Expand All @@ -489,28 +490,28 @@ void TopMonitor::bookHistograms(DQMStore::IBooker & ibooker,
histname = "bjetPt_"; histtitle = "b-jet p_{T} - ";
histname.append(index); histtitle.append(index);
bookME(ibooker,bjetPt_.at(iBJet),histname,histtitle, pt_binning_.nbins, pt_binning_.xmin, pt_binning_.xmax);
setMETitle(bjetPt_.at(iBJet)," b-jet p_{T} [GeV]","events");
setMETitle(bjetPt_.at(iBJet),"b-jet p_{T} [GeV]","events");
histname.append("_variableBinning");
bookME(ibooker,bjetPt_variableBinning_.at(iBJet),histname,histtitle, jetPt_variable_binning_);
setMETitle(bjetPt_variableBinning_.at(iBJet),"b-jet p_{T} [GeV]","events");

histname = "bjetEta_"; histtitle = "b-jet #eta - ";
histname.append(index); histtitle.append(index);
bookME(ibooker,bjetEta_.at(iBJet),histname,histtitle, eta_binning_.nbins,eta_binning_.xmin, eta_binning_.xmax);
setMETitle(bjetEta_.at(iBJet)," b-jet #eta","events");
setMETitle(bjetEta_.at(iBJet),"b-jet #eta","events");
histname.append("_variableBinning");
bookME(ibooker,bjetEta_variableBinning_.at(iBJet),histname,histtitle, jetEta_variable_binning_);
setMETitle(bjetEta_variableBinning_.at(iBJet),"b-jet #eta","events");

histname = "bjetPhi_"; histtitle = "b-jet #phi - ";
histname.append(index); histtitle.append(index);
bookME(ibooker,bjetPhi_.at(iBJet),histname,histtitle, phi_binning_.nbins, phi_binning_.xmin, phi_binning_.xmax);
setMETitle(bjetPhi_.at(iBJet)," b-jet #phi","events");
setMETitle(bjetPhi_.at(iBJet),"b-jet #phi","events");

histname = "bjetCSV_"; histtitle = "b-jet CSV - ";
histname.append(index); histtitle.append(index);
bookME(ibooker,bjetCSV_.at(iBJet),histname,histtitle, csv_binning_.nbins, csv_binning_.xmin, csv_binning_.xmax);
setMETitle(bjetCSV_.at(iBJet)," b-jet CSV","events");
setMETitle(bjetCSV_.at(iBJet),"b-jet CSV","events");

histname = "bjetPtEta_"; histtitle = "b-jet p_{T} - #eta - ";
histname.append(index); histtitle.append(index);
Expand All @@ -520,7 +521,7 @@ void TopMonitor::bookHistograms(DQMStore::IBooker & ibooker,
histname = "bjetEtaPhi_"; histtitle = "b-jet #eta - #phi - ";
histname.append(index); histtitle.append(index);
bookME(ibooker,bjetEtaPhi_.at(iBJet),histname,histtitle, jetEta_variable_binning_2D_, phi_variable_binning_2D_);
setMETitle(bjetEtaPhi_.at(iBJet),"b-jet #phi","b-jet #eta");
setMETitle(bjetEtaPhi_.at(iBJet),"b-jet #eta","b-jet #phi");

histname = "bjetCSVHT_"; histtitle = "HT - b-jet CSV - ";
histname.append(index); histtitle.append(index);
Expand Down Expand Up @@ -720,22 +721,30 @@ void TopMonitor::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup
edm::LogWarning("TopMonitor") << "B-Jet handle not valid \n";
return;
}
edm::Handle<reco::JetTagCollection> bbjetHandle;
iEvent.getByToken( jetbbTagToken_, bbjetHandle );
if (!bbjetHandle.isValid() && nbjets_>0){
edm::LogWarning("TopMonitor") << "BB-Jet handle not valid \n";
return;
}

JetTagMap bjets;

if (nbjets_>0){
const reco::JetTagCollection& bTags = *(bjetHandle.product());
if (bTags.size() < nbjets_ ) return;
for (unsigned int i=0; i!=bTags.size(); ++i){
// Apply Selections
if (!bjetSelection_(*dynamic_cast<const reco::Jet*>(bTags[i].first.get())) ) continue;
if (bTags[i].second < workingpoint_ ) continue;

// Fill JetTag Map
bjets.insert(JetTagMap::value_type(bTags[i].first, bTags[i].second));
}
if (bjets.size() < nbjets_ ) return;
const reco::JetTagCollection& bTags = *(bjetHandle.product());
const reco::JetTagCollection& bbTags = *(bbjetHandle.product());
if (bTags.size() < nbjets_ ) return;
for (unsigned int i=0; i!=bTags.size(); ++i){
// Apply Selections
if (!bjetSelection_(*dynamic_cast<const reco::Jet*>(bTags[i].first.get())) ) continue;
double bdisc = (btagalgoName_ == "pfDeepCSVJetTags") ? (bTags[i].second + bbTags[i].second) : bTags[i].second; //probb + probbb
//std::cout<<folderName_<<" "<<btagalgoName_<<" "<<bTags[i].second<<" "<<bbTags[i].second<<" "<<bdisc<<std::endl;
if (bdisc < workingpoint_) continue;
// Fill JetTag Map
bjets.insert(JetTagMap::value_type(bTags[i].first, bdisc));
}
if (bjets.size() < nbjets_ ) return;
}


if (nbjets_ > 1){
double deltaEta = std::abs(bjets.begin()->first->eta()-(++bjets.begin())->first->eta());
Expand Down Expand Up @@ -896,9 +905,6 @@ void TopMonitor::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup
iBJet++;
}




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

Expand Down Expand Up @@ -1000,7 +1006,8 @@ void TopMonitor::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup
elePtEta_.at(iEle).numerator -> Fill(electrons.at(iEle).pt(), electrons.at(iEle).eta() );
eleEtaPhi_.at(iEle).numerator -> Fill(electrons.at(iEle).eta(), electrons.at(iEle).phi() );
}
//Menglei

//Menglei
if(enablePhotonPlot_){
for (unsigned int iPho=0; iPho<photons.size(); ++iPho){
if (iPho>=nphotons_) break;
Expand All @@ -1027,7 +1034,7 @@ void TopMonitor::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup
unsigned int j = 0;
for (auto & bjet: bjets){
if (j >=nbjets_) break;
bjetPhi_.at(j).numerator -> Fill(bjet.first->pt());
bjetPhi_.at(j).numerator -> Fill(bjet.first->phi());
bjetEta_.at(j).numerator -> Fill(bjet.first->eta());
bjetPt_.at(j).numerator -> Fill(bjet.first->pt());
bjetCSV_.at(j).numerator -> Fill(std::fmax(0.0,bjet.second));
Expand Down Expand Up @@ -1058,6 +1065,7 @@ void TopMonitor::fillDescriptions(edm::ConfigurationDescriptions & descriptions)
desc.add<edm::InputTag>( "vertices", edm::InputTag("offlinePrimaryVertices") );

desc.add<edm::InputTag>( "btagalgo", edm::InputTag("pfCombinedSecondaryVertexV2BJetTags") );
desc.add<edm::InputTag>( "bbtagalgo",edm::InputTag("pfDeepCSVJetTags:probbb") );
desc.add<std::string>("metSelection", "pt > 0");
desc.add<std::string>("jetSelection", "pt > 0");
desc.add<std::string>("eleSelection", "pt > 0");
Expand Down Expand Up @@ -1120,8 +1128,8 @@ void TopMonitor::fillDescriptions(edm::ConfigurationDescriptions & descriptions)
// Marina
edm::ParameterSetDescription csvPSet;
//george
edm::ParameterSetDescription invMassPSet;
edm::ParameterSetDescription MHTPSet;
edm::ParameterSetDescription invMassPSet;
edm::ParameterSetDescription MHTPSet;
fillHistoPSetDescription(metPSet);
fillHistoPSetDescription(phiPSet);
fillHistoPSetDescription(ptPSet);
Expand Down Expand Up @@ -1190,4 +1198,3 @@ void TopMonitor::fillDescriptions(edm::ConfigurationDescriptions & descriptions)
// Define this as a plug-in
#include "FWCore/Framework/interface/MakerMacros.h"
DEFINE_FWK_MODULE(TopMonitor);

7 changes: 3 additions & 4 deletions DQMOffline/Trigger/plugins/TopMonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class TopMonitor : public DQMEDAnalyzer, public TriggerDQMBase
edm::EDGetTokenT<reco::PhotonCollection> phoToken_;
// Marina
edm::EDGetTokenT<reco::JetTagCollection> jetTagToken_ ;
edm::EDGetTokenT<reco::JetTagCollection> jetbbTagToken_ ;
//Suvankar
edm::EDGetTokenT<reco::VertexCollection> vtxToken_;

Expand Down Expand Up @@ -204,7 +205,6 @@ class TopMonitor : public DQMEDAnalyzer, public TriggerDQMBase
std::vector<ObjME> bjetEta_;
std::vector<ObjME> bjetPt_;
std::vector<ObjME> bjetCSV_;

std::vector<ObjME> muPt_variableBinning_;
std::vector<ObjME> elePt_variableBinning_;
std::vector<ObjME> jetPt_variableBinning_;
Expand Down Expand Up @@ -247,7 +247,6 @@ class TopMonitor : public DQMEDAnalyzer, public TriggerDQMBase
StringCutObjectSelector<reco::Vertex,true> vtxSelection_;

StringCutObjectSelector<reco::Jet,true > bjetSelection_;

unsigned int njets_;
unsigned int nelectrons_;
unsigned int nmuons_;
Expand All @@ -259,12 +258,12 @@ class TopMonitor : public DQMEDAnalyzer, public TriggerDQMBase
// Marina
unsigned int nbjets_;
double workingpoint_;

std::string btagalgoName_;
//Suvankar
PVcut lepPVcuts_;
bool usePVcuts_;

bool applyMETcut_ = false;
bool applyMETcut_ = false;

//george
double invMassUppercut_;
Expand Down
1 change: 1 addition & 0 deletions DQMOffline/Trigger/python/TopMonitor_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
# Marina
hltTOPmonitoring.btagalgo = cms.InputTag("pfCombinedSecondaryVertexV2BJetTags")
hltTOPmonitoring.workingpoint = cms.double(0.8484) # Medium
hltTOPmonitoring.bbtagalgo = cms.InputTag("pfDeepCSVJetTags:probbb")

hltTOPmonitoring.HTdefinition = cms.string('pt>30 & abs(eta)<2.5')
hltTOPmonitoring.leptJetDeltaRmin = cms.double(0.4)
Expand Down