Skip to content

Commit

Permalink
fix clang static analyzer warning using namespace in header
Browse files Browse the repository at this point in the history
  • Loading branch information
gartung committed Aug 28, 2015
1 parent 96ab5d7 commit 52e1651
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
9 changes: 3 additions & 6 deletions HLTriggerOffline/Btag/interface/HLTBTagHarvestingAnalyzer.h
Expand Up @@ -16,26 +16,23 @@
#include "TEfficiency.h"



/** \class HLTBTagHarvestingAnalyzer
*
* Code used to produce DQM validation plots for b-tag at HLT.
* This class read the plots producted by HLTBTagPerformanceAnalyzer and make plots of: b-tag efficiency vs discr, b-tag efficiency vs jet pt, b-tag efficiency vs mistag rate
*
*/

using namespace edm;
using namespace std;

class HLTBTagHarvestingAnalyzer : public DQMEDHarvester {
public:
explicit HLTBTagHarvestingAnalyzer(const edm::ParameterSet&);
~HLTBTagHarvestingAnalyzer();

virtual void dqmEndJob(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter);
TH1F calculateEfficiency1D( DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter, TH1 & num, TH1 & den, string name );
bool GetNumDenumerators(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter, string num,string den,TH1 * & ptrnum,TH1* & ptrden,int type);
void mistagrate( DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter, TH1F* num, TH1F* den, string effName );
TH1F calculateEfficiency1D( DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter, TH1 & num, TH1 & den, std::string name );
bool GetNumDenumerators(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter, std::string num, std::string den,TH1 * & ptrnum,TH1* & ptrden,int type);
void mistagrate( DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter, TH1F* num, TH1F* den, std::string effName );

private:
// ----------member data ---------------------------
Expand Down
6 changes: 2 additions & 4 deletions HLTriggerOffline/Btag/interface/HLTBTagPerformanceAnalyzer.h
Expand Up @@ -38,8 +38,6 @@
* And it plots the 2D distribution of the b-tag discriminant for all,b,c,lights,g jets vs pT
*/

using namespace reco;
using namespace edm;

class HLTBTagPerformanceAnalyzer : public DQMEDAnalyzer {
public:
Expand All @@ -61,7 +59,7 @@ class HLTBTagPerformanceAnalyzer : public DQMEDAnalyzer {
typedef std::map<edm::RefToBase<reco::Jet>, float, JetRefCompare> JetTagMap;

// variables from python configuration
edm::EDGetTokenT<TriggerResults> hlTriggerResults_;
edm::EDGetTokenT<edm::TriggerResults> hlTriggerResults_;
std::vector<std::string> hltPathNames_;
HLTConfigProvider hltConfigProvider_;
bool triggerConfChanged_;
Expand All @@ -75,7 +73,7 @@ class HLTBTagPerformanceAnalyzer : public DQMEDAnalyzer {
typedef unsigned int flavour_t;
typedef std::vector<flavour_t> flavours_t;

edm::EDGetTokenT<JetFlavourMatchingCollection> m_mcPartons; // MC truth match - jet association to partons
edm::EDGetTokenT<reco::JetFlavourMatchingCollection> m_mcPartons; // MC truth match - jet association to partons
std::vector<std::string> m_mcLabels; // MC truth match - labels
std::vector<flavours_t> m_mcFlavours; // MC truth match - flavours selection
double m_mcRadius; // MC truth match - deltaR association radius
Expand Down
Expand Up @@ -29,8 +29,6 @@
* It plots the distribution of recoVertex.z() - simVertex.z() of the primary vertex.
*/

using namespace reco;
using namespace edm;

class HLTVertexPerformanceAnalyzer : public DQMEDAnalyzer {
public:
Expand All @@ -43,7 +41,7 @@ class HLTVertexPerformanceAnalyzer : public DQMEDAnalyzer {
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;

// variables from python configuration
edm::EDGetTokenT<TriggerResults> hlTriggerResults_;
edm::EDGetTokenT<edm::TriggerResults> hlTriggerResults_;
edm::EDGetTokenT<std::vector<SimVertex> > simVertexCollection_;
std::vector<std::string> hltPathNames_;
HLTConfigProvider hltConfigProvider_;
Expand Down
15 changes: 8 additions & 7 deletions HLTriggerOffline/Btag/src/HLTBTagHarvestingAnalyzer.cc
Expand Up @@ -30,12 +30,12 @@ HLTBTagHarvestingAnalyzer::dqmEndJob(DQMStore::IBooker & ibooker, DQMStore::IGet
ibooker.setCurrentFolder(effDir);
TH1 *den =NULL;
TH1 *num =NULL;
map<TString,TH1F> effics;
map<TString,bool> efficsOK;
std::map<TString,TH1F> effics;
std::map<TString,bool> efficsOK;
for (unsigned int i = 0; i < m_mcLabels.size(); ++i)
{
bool isOK=false;
TString label= m_histoName.at(ind) + string("__"); //"JetTag__";
TString label= m_histoName.at(ind) + std::string("__"); //"JetTag__";
TString flavour= m_mcLabels[i].c_str();
label+=flavour;
isOK=GetNumDenumerators(ibooker,igetter,(TString(dqmFolder_hist)+"/"+label).Data(),(TString(dqmFolder_hist)+"/"+label).Data(),num,den,0);
Expand All @@ -45,7 +45,7 @@ HLTBTagHarvestingAnalyzer::dqmEndJob(DQMStore::IBooker & ibooker, DQMStore::IGet
effics[flavour]=calculateEfficiency1D(ibooker,igetter,*num,*den,(label+"_efficiency_vs_disc").Data());
efficsOK[flavour]=isOK;
}
label= m_histoName.at(ind)+string("___");
label= m_histoName.at(ind)+std::string("___");
label+=flavour+TString("_disc_pT");
isOK=GetNumDenumerators (ibooker,igetter,(TString(dqmFolder_hist)+"/"+label).Data(),(TString(dqmFolder_hist)+"/"+label).Data(),num,den,1);
if (isOK) {
Expand All @@ -62,8 +62,9 @@ HLTBTagHarvestingAnalyzer::dqmEndJob(DQMStore::IBooker & ibooker, DQMStore::IGet
} /// for triggers
}

bool HLTBTagHarvestingAnalyzer::GetNumDenumerators(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter, string num,string den,TH1 * & ptrnum,TH1* & ptrden,int type)
bool HLTBTagHarvestingAnalyzer::GetNumDenumerators(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter, std::string num,std::string den,TH1 * & ptrnum,TH1* & ptrden,int type)
{
using namespace edm;
/*
possible types:
type =0 for eff_vs_discriminator
Expand Down Expand Up @@ -125,7 +126,7 @@ bool HLTBTagHarvestingAnalyzer::GetNumDenumerators(DQMStore::IBooker& ibooker, D
}


void HLTBTagHarvestingAnalyzer::mistagrate(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter, TH1F* num, TH1F* den, string effName ){
void HLTBTagHarvestingAnalyzer::mistagrate(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter, TH1F* num, TH1F* den, std::string effName ){
//do the efficiency_vs_mistag_rate plot
TH1F* eff;
eff = new TH1F(effName.c_str(),effName.c_str(),100,0,1);
Expand Down Expand Up @@ -159,7 +160,7 @@ void HLTBTagHarvestingAnalyzer::mistagrate(DQMStore::IBooker& ibooker, DQMStore:
return;
}

TH1F HLTBTagHarvestingAnalyzer::calculateEfficiency1D(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter, TH1 & num , TH1 & den, string effName ){
TH1F HLTBTagHarvestingAnalyzer::calculateEfficiency1D(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter, TH1 & num , TH1 & den, std::string effName ){
//calculate the efficiency as num/den ratio
TH1F eff;
if(num.GetXaxis()->GetXbins()->GetSize()==0){
Expand Down
5 changes: 4 additions & 1 deletion HLTriggerOffline/Btag/src/HLTBTagPerformanceAnalyzer.cc
@@ -1,5 +1,8 @@
#include "HLTriggerOffline/Btag/interface/HLTBTagPerformanceAnalyzer.h"

using namespace edm;
using namespace reco;

// find the index of the object key of an association vector closest to a given jet, within a given distance
template <typename T, typename V>
int closestJet(const RefToBase<reco::Jet> jet, const edm::AssociationVector<T, V> & association, double distance) {
Expand All @@ -18,7 +21,7 @@ int closestJet(const RefToBase<reco::Jet> jet, const edm::AssociationVector<T,
// constructors and destructor
HLTBTagPerformanceAnalyzer::HLTBTagPerformanceAnalyzer(const edm::ParameterSet& iConfig)
{
hlTriggerResults_ = consumes<TriggerResults>(iConfig.getParameter<InputTag> ("TriggerResults"));
hlTriggerResults_ = consumes<edm::TriggerResults>(iConfig.getParameter<InputTag> ("TriggerResults"));
JetTagCollection_ = edm::vector_transform(iConfig.getParameter<std::vector<edm::InputTag> >( "JetTag" ), [this](edm::InputTag const & tag){return mayConsume< reco::JetTagCollection>(tag);});
m_mcPartons = consumes<JetFlavourMatchingCollection>(iConfig.getParameter<InputTag> ("mcPartons") );
hltPathNames_ = iConfig.getParameter< std::vector<std::string> > ("HLTPathNames");
Expand Down
3 changes: 3 additions & 0 deletions HLTriggerOffline/Btag/src/HLTVertexPerformanceAnalyzer.cc
@@ -1,5 +1,8 @@
#include "HLTriggerOffline/Btag/interface/HLTVertexPerformanceAnalyzer.h"

using namespace edm;
using namespace reco;

HLTVertexPerformanceAnalyzer::HLTVertexPerformanceAnalyzer(const edm::ParameterSet& iConfig)
{
hlTriggerResults_ = consumes<TriggerResults>(iConfig.getParameter<InputTag> ("TriggerResults"));
Expand Down

0 comments on commit 52e1651

Please sign in to comment.