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

cleaning static analyzer warnings #13585

Merged
merged 3 commits into from Mar 6, 2016
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions RecoJets/JetAnalyzers/interface/myJetAna.h
Expand Up @@ -59,6 +59,7 @@ class myJetAna : public edm::EDAnalyzer {
edm::InputTag hcalNoiseSummaryTag_;
std::string JetCorrectionService;

int totBNC, nBNC[4000];

// --- Passed selection cuts
TH1F *h_pt;
Expand Down
96 changes: 38 additions & 58 deletions RecoJets/JetAnalyzers/src/myFilter.cc
Expand Up @@ -5,6 +5,7 @@
#include "DataFormats/METReco/interface/CaloMET.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/METReco/interface/HcalCaloFlagLabels.h"
Expand Down Expand Up @@ -127,41 +128,41 @@ void myFilter::beginJob() {

void myFilter::endJob() {

std::cout << "=============================================================" << std::endl;
std::cout << "myFilter: accepted "
<< _acceptedEvt << " / " << _nEvent << " / " << _nTotal << " events" << std::endl;
std::cout << "Pt = " << _passPt << std::endl;
std::cout << "NJets = " << _passNJets << std::endl;
std::cout << "DiJets = " << _passDiJet << std::endl;
std::cout << "NTrks = " << _passNTrks << std::endl;
std::cout << "EMF = " << _passEMF << std::endl;
std::cout << "NTowers = " << _passNTowers << std::endl;
std::cout << "MET = " << _passMET << std::endl;
std::cout << "METSig = " << _passMETSig << std::endl;
std::cout << "HighPtTower = " << _passHighPtTower << std::endl;
std::cout << "NRBX = " << _passNRBX << std::endl;
std::cout << "NHPDNoise = " << _passNHPDNoise << std::endl;
std::cout << "NPMTHits = " << _passNPMTHits << std::endl;
std::cout << "NMultPMTHits = " << _passNMultiPMTHits << std::endl;
std::cout << "PKAM = " << _passPKAM << std::endl;
std::cout << "HFMET = " << _passHFMET << std::endl;
std::cout << "Noise Summary = " << _passNoiseSummary << std::endl;
std::cout << "Noise Summary EMF = " << _passNoiseSummaryEMF << std::endl;
std::cout << "Noise Summary E2E10 = " << _passNoiseSummaryE2E10 << std::endl;
std::cout << "Noise Summary NHITS = " << _passNoiseSummaryNHITS << std::endl;
std::cout << "Noise Summary ADC0 = " << _passNoiseSummaryADC0 << std::endl;
std::cout << "Noise Summary NoOther = " << _passNoiseSummaryNoOther << std::endl;
std::cout << "OERatio = " << _passOERatio << std::endl;
std::cout << "Time = " << _passTime << std::endl;
std::cout << "HF Time = " << _passHFTime << std::endl;
std::cout << "HBHE Time = " << _passHBHETime << std::endl;
std::cout << "HF Flagged = " << _passHFFlagged << std::endl;
std::cout << "HF High Energy= " << _passHFHighEnergy << std::endl;
std::cout << "=============================================================" << std::endl;
edm::LogInfo ("summary") << "=============================================================" ;
edm::LogVerbatim ("summary") << "myFilter: accepted "
<< _acceptedEvt << " / " << _nEvent << " / " << _nTotal << " events" ;
edm::LogVerbatim ("summary") << "Pt = " << _passPt ;
edm::LogVerbatim ("summary") << "NJets = " << _passNJets ;
edm::LogVerbatim ("summary") << "DiJets = " << _passDiJet ;
edm::LogVerbatim ("summary") << "NTrks = " << _passNTrks ;
edm::LogVerbatim ("summary") << "EMF = " << _passEMF ;
edm::LogVerbatim ("summary") << "NTowers = " << _passNTowers ;
edm::LogVerbatim ("summary") << "MET = " << _passMET ;
edm::LogVerbatim ("summary") << "METSig = " << _passMETSig ;
edm::LogVerbatim ("summary") << "HighPtTower = " << _passHighPtTower ;
edm::LogVerbatim ("summary") << "NRBX = " << _passNRBX ;
edm::LogVerbatim ("summary") << "NHPDNoise = " << _passNHPDNoise ;
edm::LogVerbatim ("summary") << "NPMTHits = " << _passNPMTHits ;
edm::LogVerbatim ("summary") << "NMultPMTHits = " << _passNMultiPMTHits ;
edm::LogVerbatim ("summary") << "PKAM = " << _passPKAM ;
edm::LogVerbatim ("summary") << "HFMET = " << _passHFMET ;
edm::LogVerbatim ("summary") << "Noise Summary = " << _passNoiseSummary ;
edm::LogVerbatim ("summary") << "Noise Summary EMF = " << _passNoiseSummaryEMF ;
edm::LogVerbatim ("summary") << "Noise Summary E2E10 = " << _passNoiseSummaryE2E10 ;
edm::LogVerbatim ("summary") << "Noise Summary NHITS = " << _passNoiseSummaryNHITS ;
edm::LogVerbatim ("summary") << "Noise Summary ADC0 = " << _passNoiseSummaryADC0 ;
edm::LogVerbatim ("summary") << "Noise Summary NoOther = " << _passNoiseSummaryNoOther ;
edm::LogVerbatim ("summary") << "OERatio = " << _passOERatio ;
edm::LogVerbatim ("summary") << "Time = " << _passTime ;
edm::LogVerbatim ("summary") << "HF Time = " << _passHFTime ;
edm::LogVerbatim ("summary") << "HBHE Time = " << _passHBHETime ;
edm::LogVerbatim ("summary") << "HF Flagged = " << _passHFFlagged ;
edm::LogVerbatim ("summary") << "HF High Energy= " << _passHFHighEnergy ;
edm::LogVerbatim ("summary") << "=============================================================" ;


for (int i=0; i<10; i++) {
std::cout << "Noise Results = " << _NoiseResult[i] << std::endl;
edm::LogVerbatim ("summary") << "Noise Results = " << _NoiseResult[i] ;
}

}
Expand Down Expand Up @@ -331,7 +332,6 @@ myFilter::filter(edm::Event& evt, edm::EventSetup const& es) {
NHFDigiTimeHits = 0;
NHFLongShortHits = 0;

try {
std::vector<edm::Handle<HFRecHitCollection> > colls;
evt.getManyByType(colls);
std::vector<edm::Handle<HFRecHitCollection> >::iterator i;
Expand Down Expand Up @@ -387,15 +387,14 @@ myFilter::filter(edm::Event& evt, edm::EventSetup const& es) {
if ( (j->flagField(0) != 0) && (j->energy() > 1.) ) {
NPMTHits++;
if (NPMTHits > 1) {
std::cout << ">>>> MultiHit: Run = " << evt.id().run()
edm::LogInfo("myFilter") << ">>>> MultiHit: Run = " << evt.id().run()
<< " Event = " << evt.id().event()
<< " iEta = " << j->id().ieta()
<< " iPhi = " << j->id().iphi()
<< " depth = " << j->id().depth()
<< " flag = " << j->flagField(0)
<< " hits = " << NPMTHits
<< " energy = " << j->energy()
<< std::endl;
<< " energy = " << j->energy();
}

}
Expand All @@ -418,9 +417,6 @@ myFilter::filter(edm::Event& evt, edm::EventSetup const& es) {
}
break;
}
} catch (...) {
cout << "No HF RecHits." << endl;
}

if (MaxRecHitEne > 1000.) filter_HFHighEnergy = true;

Expand Down Expand Up @@ -654,11 +650,7 @@ myFilter::filter(edm::Event& evt, edm::EventSetup const& es) {
/*******
// -- Tracks
edm::Handle<std::vector<reco::Track> > hTrackCollection;
try {
evt.getByLabel("generalTracks", hTrackCollection);
} catch (cms::Exception &ex) {
if (fVerbose > 1) cout << "No Track collection with label " << fTrackCollectionLabel << endl;
}

if (hTrackCollection.isValid()) {
const std::vector<reco::Track> trackColl = *(hTrackCollection.product());
Expand Down Expand Up @@ -741,7 +733,6 @@ myFilter::filter(edm::Event& evt, edm::EventSetup const& es) {
int nHPDNoise = 0;
nTime = 0;

try {
std::vector<edm::Handle<HBHERecHitCollection> > colls;
evt.getManyByType(colls);
std::vector<edm::Handle<HBHERecHitCollection> >::iterator i;
Expand Down Expand Up @@ -774,15 +765,11 @@ myFilter::filter(edm::Event& evt, edm::EventSetup const& es) {
****/
}
}
} catch (...) {
cout << "No HB/HE RecHits." << endl;
}

if (nHPDNoise > 10) filter_NHPDNoise = true;
if (nTime > 0) filter_HBHETime = true;


try {
/***
std::vector<edm::Handle<HFRecHitCollection> > colls;
evt.getManyByType(colls);
std::vector<edm::Handle<HFRecHitCollection> >::iterator i;
Expand All @@ -791,11 +778,7 @@ myFilter::filter(edm::Event& evt, edm::EventSetup const& es) {
// std::cout << *j << std::endl;
}
}
} catch (...) {
cout << "No HF RecHits." << endl;
}

try {
std::vector<edm::Handle<HORecHitCollection> > colls;
evt.getManyByType(colls);
std::vector<edm::Handle<HORecHitCollection> >::iterator i;
Expand All @@ -804,9 +787,7 @@ myFilter::filter(edm::Event& evt, edm::EventSetup const& es) {
// std::cout << *j << std::endl;
}
}
} catch (...) {
cout << "No HO RecHits." << endl;
}
****/
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this (HORecHitCollection loop) commented out?

Copy link
Author

Choose a reason for hiding this comment

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

I commented it out because the only thing it did was loop. There was a cout stamement that this loop could have engaged, but that was already commented out in the code as I found it. The code was effectively:

for(i in collection){
// cout<<"we have the collection"<<endl;
}

I went the step further to say that there is no point in looping.




Expand Down Expand Up @@ -1034,8 +1015,7 @@ myFilter::filter(edm::Event& evt, edm::EventSetup const& es) {
}

if (result) {
std::cout << "<<<< Event Passed"
<< std::endl;
edm::LogInfo ("summary")<< "<<<< Event Passed myFilter" ;
}
return result;

Expand Down