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

Add ak8 dqm and fix empty histograms #14706

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
16 changes: 5 additions & 11 deletions DQMOffline/Trigger/python/JetMETHLTOfflineAnalyzer_cff.py
@@ -1,18 +1,12 @@
import FWCore.ParameterSet.Config as cms

from JetMETCorrections.Configuration.JetCorrectionProducers_cff import * # FIXME: only for downstream imports
from JetMETCorrections.Configuration.CorrectedJetProducers_cff import *

from JetMETCorrections.Configuration.JetCorrectorsAllAlgos_cff import *
from DQMOffline.Trigger.JetMETHLTOfflineSource_cfi import *

jetMETHLTOfflineAnalyzer = cms.Sequence(
ak4CaloL1FastL2L3CorrectorChain
#* ak4CaloJetsL1FastL2L3
* ak4PFL1FastL2L3CorrectorChain
#* ak4PFJetsL1FastL2L3
* ak4CaloL1FastL2L3ResidualCorrectorChain
#* ak4CaloJetsL1FastL2L3Residual
ak4CaloL1FastL2L3ResidualCorrectorChain
* ak4PFL1FastL2L3ResidualCorrectorChain
#* ak4PFJetsL1FastL2L3Residual
* jetMETHLTOfflineSource
* jetMETHLTOfflineSourceAK4
# * ak8PFCHSL1FastjetL2L3ResidualCorrectorChain #not working in all matrix tests, yet
* jetMETHLTOfflineSourceAK8
)
4 changes: 3 additions & 1 deletion DQMOffline/Trigger/python/JetMETHLTOfflineClient_cfi.py
@@ -1,11 +1,13 @@
import FWCore.ParameterSet.Config as cms

jetMETHLTOfflineClient = cms.EDAnalyzer("JetMETHLTOfflineClient",
jetMETHLTOfflineClientAK4 = cms.EDAnalyzer("JetMETHLTOfflineClient",

processname = cms.string("HLT"),
DQMDirName=cms.string("HLT/JetMET"),
hltTag = cms.string("HLT")

)

jetMETHLTOfflineClientAK8 = jetMETHLTOfflineClientAK4.clone( DQMDirName = cms.string('HLT/JetMET/AK8'))

jetMETHLTOfflineClient = cms.Sequence( jetMETHLTOfflineClientAK4 * jetMETHLTOfflineClientAK8 )
61 changes: 56 additions & 5 deletions DQMOffline/Trigger/python/JetMETHLTOfflineSource_cfi.py
@@ -1,6 +1,6 @@
import FWCore.ParameterSet.Config as cms

jetMETHLTOfflineSource = cms.EDAnalyzer(
jetMETHLTOfflineSourceAK4 = cms.EDAnalyzer(
"JetMETHLTOfflineSource",
dirname = cms.untracked.string("HLT/JetMET"),
#
Expand All @@ -20,12 +20,10 @@
CaloMETCollectionLabel = cms.InputTag("caloMet"),
PFMETCollectionLabel = cms.InputTag("pfMet"),
#Use on-the-fly correction
#CaloJetCollectionLabel = cms.InputTag("ak4CaloJetsL1FastL2L3"),
#PFJetCollectionLabel = cms.InputTag("ak4PFJetsL1FastL2L3"),
CaloJetCollectionLabel = cms.InputTag("ak4CaloJets"),
PFJetCollectionLabel = cms.InputTag("ak4PFJets"),
CaloJetCorLabel = cms.InputTag("ak4CaloL1FastL2L3Corrector"),
PFJetCorLabel = cms.InputTag("ak4PFL1FastL2L3Corrector"),
CaloJetCorLabel = cms.InputTag("ak4CaloL1FastL2L3ResidualCorrector"), #dummy residual corrections now also provided for MC GTs
PFJetCorLabel = cms.InputTag("ak4PFL1FastL2L3ResidualCorrector"), #dummy residual corrections now also provided for MC GTs
#
fEMF = cms.untracked.double(0.01),
feta = cms.untracked.double(2.6),
Expand Down Expand Up @@ -99,3 +97,56 @@
eeRecHitsColl = cms.InputTag("ecalRecHit", "EcalRecHitsEE")
)
)


jetMETHLTOfflineSourceAK8 = jetMETHLTOfflineSourceAK4.clone(
dirname = cms.untracked.string('HLT/JetMET/AK8'),
# CaloJetCollectionLabel = cms.InputTag("ak4CaloJets"), #ak8 not available in RECO anymore, so keep ak4...
# PFJetCollectionLabel = cms.InputTag("ak8PFJetsCHS"), # does not work in all matrix tests, yet
# PFJetCorLabel = cms.InputTag("ak8PFCHSL1FastjetL2L3ResidualCorrector"), # does not work in all matrix tests, yet
PFJetCollectionLabel = cms.InputTag("ak4PFJets"),
PFJetCorLabel = cms.InputTag("ak4PFL1FastL2L3ResidualCorrector"), #dummy residual corrections now also provided for MC GTs


pathFilter = cms.untracked.vstring('HLT_AK8PFJet',
),
pathPairs = cms.VPSet(cms.PSet(
denompathname = cms.string('HLT_AK8PFJet40_v'),
pathname = cms.string('HLT_AK8PFJet60_v')
),
cms.PSet(
denompathname = cms.string('HLT_AK8PFJet60_v'),
pathname = cms.string('HLT_AK8PFJet80_v')
),
cms.PSet(
denompathname = cms.string('HLT_AK8PFJet80_v'),
pathname = cms.string('HLT_AK8PFJet140_v')
),
cms.PSet(
denompathname = cms.string('HLT_AK8PFJet140_v'),
pathname = cms.string('HLT_AK8PFJet200_v')
),
cms.PSet(
denompathname = cms.string('HLT_AK8PFJet200_v'),
pathname = cms.string('HLT_AK8PFJet260_v')
),
cms.PSet(
denompathname = cms.string('HLT_AK8PFJet260_v'),
pathname = cms.string('HLT_AK8PFJet320_v')
),
cms.PSet(
denompathname = cms.string('HLT_AK8PFJet320_v'),
pathname = cms.string('HLT_AK8PFJet400_v')
),
cms.PSet(
denompathname = cms.string('HLT_AK8PFJet400_v'),
pathname = cms.string('HLT_AK8PFJet450_v')
),
cms.PSet(
denompathname = cms.string('HLT_AK8PFJet450_v'),
pathname = cms.string('HLT_AK8PFJet500_v')
)),

)

jetMETHLTOfflineSource = cms.Sequence( jetMETHLTOfflineSourceAK4 * jetMETHLTOfflineSourceAK8 )
83 changes: 77 additions & 6 deletions DQMOffline/Trigger/src/JetMETHLTOfflineSource.cc
Expand Up @@ -112,16 +112,24 @@ JetMETHLTOfflineSource::~JetMETHLTOfflineSource()
void
JetMETHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
{
if (verbose_) {
cout << endl;
cout << "============================================================" << endl;
cout << " New event" << endl << endl;
}

//---------- triggerResults ----------
iEvent.getByToken(triggerResultsToken, triggerResults_);
if(!triggerResults_.isValid()) {
iEvent.getByToken(triggerResultsFUToken,triggerResults_);
if(!triggerResults_.isValid()) {
if (verbose_) cout << " triggerResults not valid" << endl;
edm::LogInfo("JetMETHLTOfflineSource") << "TriggerResults not found, "
"skipping event";
return;
}
}
if (verbose_) cout << " done triggerResults" << endl;

//---------- triggerResults ----------
triggerNames_ = iEvent.triggerNames(*triggerResults_);
Expand All @@ -136,24 +144,41 @@ JetMETHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup&
return;
}
}
if (verbose_) cout << " done triggerSummary" << endl;

if (verbose_) {
cout << endl;
cout << "============================================================" << endl;
cout << " Reading in offline objects" << endl << endl;
}

//------------ Offline Objects -------
iEvent.getByToken(caloJetsToken,calojetColl_);
if(!calojetColl_.isValid()) return;
calojet = *calojetColl_;
//std::stable_sort( calojet.begin(), calojet.end(), PtSorter() );

if (verbose_) cout << " done calo" << endl;

iEvent.getByToken(pfJetsToken,pfjetColl_);
if(!pfjetColl_.isValid()) return;
pfjet = *pfjetColl_;
//std::stable_sort( pfjet.begin(), pfjet.end(), PtSorter() );

if (verbose_) cout << " done pf" << endl;

iEvent.getByToken(caloMetToken, calometColl_);
if(!calometColl_.isValid()) return;

iEvent.getByToken(pfMetToken, pfmetColl_);
if(!pfmetColl_.isValid()) return;

if (verbose_) {
cout << endl;
cout << "============================================================" << endl;
cout << " Read in offline objects" << endl << endl;
}

//---------- Event counting (DEBUG) ----------
if(verbose_ && iEvent.id().event()%10000==0)
cout<<"Run = "<<iEvent.id().run()<<", LS = "<<iEvent.luminosityBlock()<<", Event = "<<iEvent.id().event()<<endl;
Expand Down Expand Up @@ -286,6 +311,8 @@ JetMETHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup&
void
JetMETHLTOfflineSource::fillMEforMonTriggerSummary(const Event & iEvent, const edm::EventSetup& iSetup)
{
if (verbose_)
cout << ">> Inside fillMEforMonTriggerSummary " << endl;
bool muTrig = false;

for(size_t i=0;i<MuonTrigPaths_.size();++i){
Expand Down Expand Up @@ -373,8 +400,12 @@ JetMETHLTOfflineSource::fillMEforMonTriggerSummary(const Event & iEvent, const e
void
JetMETHLTOfflineSource::fillMEforTriggerNTfired()
{
if (verbose_)
cout << ">> Inside fillMEforTriggerNTfired" << endl;
if(!triggerResults_.isValid()) return;

if (verbose_)
cout << " ... and triggerResults is valid" << endl;

//
for(PathInfoCollection::iterator v = hltPathsAll_.begin(); v!= hltPathsAll_.end(); ++v ){
unsigned index = triggerNames_.triggerIndex(v->getPath());
Expand Down Expand Up @@ -433,12 +464,23 @@ JetMETHLTOfflineSource::fillMEforTriggerNTfired()
void
JetMETHLTOfflineSource::fillMEforMonAllTrigger(const Event & iEvent, const edm::EventSetup& iSetup)
{
if (verbose_)
cout << ">> Inside fillMEforMonAllTrigger " << endl;
if(!triggerResults_.isValid()) return;
if (verbose_)
cout << " ... and triggerResults is valid" << endl;

const trigger::TriggerObjectCollection & toc(triggerObj_->getObjects());
PathInfoCollection::iterator v = hltPathsAll_.begin();
for(; v!= hltPathsAll_.end(); ++v ){
if(isHLTPathAccepted(v->getPath())==false) continue;
for(PathInfoCollection::iterator v = hltPathsAll_.begin(); v!= hltPathsAll_.end(); ++v ){
if (verbose_)
cout << " + Checking path " << v->getPath();
if(isHLTPathAccepted(v->getPath())==false) {
if (verbose_)
cout << " - failed" << endl;
continue;
}
if (verbose_)
cout << " - PASSED! " << endl;

//New jet collection (after apply JEC)
std::vector<double>jetPtVec;
Expand All @@ -456,17 +498,34 @@ JetMETHLTOfflineSource::fillMEforMonAllTrigger(const Event & iEvent, const edm::
//bool fillL1HLT = false;

//L1 and HLT indices
edm::InputTag l1Tag(v->getl1Path(),"",processname_);
if (verbose_) {
cout << " - L1Path = " << v->getl1Path() << endl;
cout << " - Label = " << v->getLabel() << endl;
}

//edm::InputTag l1Tag(v->getl1Path(),"",processname_);
edm::InputTag l1Tag(v->getLabel(),"",processname_);
const int l1Index = triggerObj_->filterIndex(l1Tag);
if (verbose_)
cout << " - l1Index = " << l1Index << " - l1Tag = [" << l1Tag << "]" << endl;


edm::InputTag hltTag(v->getLabel(),"",processname_);
const int hltIndex = triggerObj_->filterIndex(hltTag);
if (verbose_)
cout << " - hltIndex = " << hltIndex << " - hltTag = [" << hltTag << "]" << endl;


//bool l1TrigBool = false;
bool hltTrigBool = false;
bool diJetFire = false;
int jetsize = 0;

if ( l1Index >= triggerObj_->sizeFilters() ) {
edm::LogInfo("JetMETHLTOfflineSource") << "no index "<< l1Index << " of that name "<<l1Tag;
if (verbose_)
cout << "[JetMETHLTOfflineSource::fillMEforMonAllTrigger] - No index l1Index="
<< l1Index << " of that name \"" << l1Tag << "\"" << endl;
}
else {
//l1TrigBool = true;
Expand Down Expand Up @@ -503,6 +562,9 @@ JetMETHLTOfflineSource::fillMEforMonAllTrigger(const Event & iEvent, const edm::
//-----------------------------------------------
if ( hltIndex >= triggerObj_->sizeFilters() ) {
edm::LogInfo("JetMETHLTOfflineSource") << "no index hlt"<< hltIndex << " of that name ";
if (verbose_)
cout << "[JetMETHLTOfflineSource::fillMEforMonAllTrigger] - No index hltIndex="
<< hltIndex << " of that name " << endl;
}
else {
const trigger::Keys & khlt = triggerObj_->filterKeys(hltIndex);
Expand Down Expand Up @@ -531,6 +593,8 @@ JetMETHLTOfflineSource::fillMEforMonAllTrigger(const Event & iEvent, const edm::
double hltTrigPhi = -100.;
//fillL1HLT = true;
//MET Triggers
if (verbose_)
cout << "+ MET Triggers plots" << endl;
if(v->getObjectType() == trigger::TriggerMET || (v->getObjectType() == trigger::TriggerTET)){
v->getMEhisto_Pt_HLT()->Fill(toc[*kj].pt());
v->getMEhisto_Phi_HLT()->Fill(toc[*kj].phi());
Expand All @@ -540,7 +604,11 @@ JetMETHLTOfflineSource::fillMEforMonAllTrigger(const Event & iEvent, const edm::
v->getMEhisto_PhiResolution_L1HLT()->Fill(toc[*ki].phi()-toc[*kj].phi());
}
//Jet Triggers
if (verbose_)
cout << "+ Jet Trigger plots" << endl;
if(v->getObjectType() == trigger::TriggerJet){
if (verbose_)
cout << " - Going for those..." << endl;
hltTrigEta = toc[*kj].eta();
hltTrigPhi = toc[*kj].phi();
if((deltaR(hltTrigEta, hltTrigPhi, l1TrigEta, l1TrigPhi)) < 0.4){
Expand Down Expand Up @@ -715,7 +783,10 @@ JetMETHLTOfflineSource::fillMEforMonAllTrigger(const Event & iEvent, const edm::
v->getMEhisto_DeltaPhi_HLTObj()->Fill(HLTDelPhi);
}

}
}
if (verbose_)
cout << "<< Exiting fillMEforMonAllTrigger " << endl;

}

//------------------------------------------------------------------------//
Expand Down