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

Removing exceptions in BTag HLT validation (#7881) - ported in 75X #7899

Merged
merged 1 commit into from Feb 24, 2015
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
26 changes: 9 additions & 17 deletions HLTriggerOffline/Btag/src/HLTBTagPerformanceAnalyzer.cc
Expand Up @@ -95,25 +95,20 @@ void HLTBTagPerformanceAnalyzer::analyze(const edm::Event& iEvent, const edm::Ev
//get triggerResults
Handle<TriggerResults> TriggerResulsHandler;
Handle<reco::JetFlavourMatchingCollection> h_mcPartons;
Exception excp(errors::LogicError);
if ( hlTriggerResults_Label == "" || hlTriggerResults_Label == "NULL" )
{
excp << "TriggerResults ==> Empty";
excp.raise();
edm::LogInfo("NoTriggerResults") << "TriggerResults ==> Empty";
return;
}
try {
iEvent.getByToken(hlTriggerResults_, TriggerResulsHandler);
if (TriggerResulsHandler.isValid()) trigRes=true;
} catch (...) { }
if ( !trigRes ) { excp << "TriggerResults ==> not readable"; excp.raise(); }
iEvent.getByToken(hlTriggerResults_, TriggerResulsHandler);
if (TriggerResulsHandler.isValid()) trigRes=true;
if ( !trigRes ) { edm::LogInfo("NoTriggerResults") << "TriggerResults ==> not readable"; return;}
const TriggerResults & triggerResults = *(TriggerResulsHandler.product());

//get partons
if (m_mcMatching && m_mcPartons_Label!= "" && m_mcPartons_Label != "NULL" ) {
iEvent.getByToken(m_mcPartons, h_mcPartons);
try {
if (h_mcPartons.isValid()) MCOK=true;
} catch(...) { }
if (h_mcPartons.isValid()) MCOK=true;
}

//fill the 1D and 2D DQM plot
Expand All @@ -127,10 +122,8 @@ void HLTBTagPerformanceAnalyzer::analyze(const edm::Event& iEvent, const edm::Ev
//get JetTagCollection
if (JetTagCollection_Label[ind] != "" && JetTagCollection_Label[ind] != "NULL" )
{
try {
iEvent.getByToken(JetTagCollection_[ind], JetTagHandler);
if (JetTagHandler.isValid()) BtagOK=true;
} catch (...) { }
iEvent.getByToken(JetTagCollection_[ind], JetTagHandler);
if (JetTagHandler.isValid()) BtagOK=true;
}

//fill JetTag map
Expand All @@ -139,8 +132,7 @@ void HLTBTagPerformanceAnalyzer::analyze(const edm::Event& iEvent, const edm::Ev
JetTag.insert(JetTagMap::value_type(iter->first, iter->second));
}
else {
excp << "Collection " << JetTagCollection_Label[ind] << " ==> not found";
excp.raise();
edm::LogInfo("NoCollection") << "Collection " << JetTagCollection_Label[ind] << " ==> not found"; return;
}

for (auto & BtagJT: JetTag) {
Expand Down
29 changes: 10 additions & 19 deletions HLTriggerOffline/Btag/src/HLTVertexPerformanceAnalyzer.cc
Expand Up @@ -63,29 +63,22 @@ void HLTVertexPerformanceAnalyzer::analyze(const edm::Event& iEvent, const edm::

//get triggerResults
Handle<TriggerResults> TriggerResulsHandler;
Exception excp(errors::LogicError);
if ( hlTriggerResults_Label == "" || hlTriggerResults_Label == "NULL" ) {
excp << "TriggerResults ==> Empty";
excp.raise();
edm::LogInfo("NoTriggerResults") << "TriggerResults ==> Empty";
return;
}
try {
iEvent.getByToken(hlTriggerResults_, TriggerResulsHandler);
if (TriggerResulsHandler.isValid()) trigRes=true;
} catch (...) { }
if ( !trigRes ) { excp << "TriggerResults ==> not readable"; excp.raise(); }
iEvent.getByToken(hlTriggerResults_, TriggerResulsHandler);
if (TriggerResulsHandler.isValid()) trigRes=true;
if ( !trigRes ) { edm::LogInfo("NoTriggerResults") << "TriggerResults ==> not readable"; return;}
const TriggerResults & triggerResults = *(TriggerResulsHandler.product());

//get simVertex
float simPV=0;

Handle<std::vector<SimVertex> > simVertexCollection;

try {
iEvent.getByToken(simVertexCollection_, simVertexCollection);
const SimVertex simPVh = *(simVertexCollection->begin());
simPV=simPVh.position().z();
}
catch (...) {}
iEvent.getByToken(simVertexCollection_, simVertexCollection);
const SimVertex simPVh = *(simVertexCollection->begin());
simPV=simPVh.position().z();

//fill the DQM plot
Handle<VertexCollection> VertexHandler;
Expand All @@ -98,10 +91,8 @@ void HLTVertexPerformanceAnalyzer::analyze(const edm::Event& iEvent, const edm::
//get the recoVertex
if (VertexCollection_Label.at(coll) != "" && VertexCollection_Label.at(coll) != "NULL" )
{
try {
iEvent.getByToken(VertexCollection_.at(coll), VertexHandler);
if (VertexHandler.isValid()) VertexOK=true;
} catch (...) { }
iEvent.getByToken(VertexCollection_.at(coll), VertexHandler);
if (VertexHandler.isValid()) VertexOK=true;
}

//calculate the variable (RecoVertex - SimVertex)
Expand Down