Skip to content

Commit

Permalink
HLTBTagHarvestingAnalyzer.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
silviodonato committed Feb 23, 2015
1 parent 9e05cc6 commit e2ca4d3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 36 deletions.
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

0 comments on commit e2ca4d3

Please sign in to comment.