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

Clang-tidy checks for RecoLocalMuon #20844

Merged
merged 1 commit into from Oct 10, 2017
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
36 changes: 18 additions & 18 deletions RecoLocalMuon/CSCEfficiency/src/CSCEfficiency.cc
Expand Up @@ -887,7 +887,7 @@ void CSCEfficiency::fillRechitsSegments_info(edm::Handle<CSCRecHit2DCollection>
for(int iC=0;iC<NumCh;iC++){
int numLayers = 0;
for(int iL=0;iL<6;iL++){
if(allRechits[iE][iS][iR][iC][iL].size()){
if(!allRechits[iE][iS][iR][iC][iL].empty()){
++numLayers;
}
}
Expand Down Expand Up @@ -1074,11 +1074,11 @@ bool CSCEfficiency::efficienciesPerChamber(CSCDetId & id, const CSCChamber* cscC
}

// Segments
bool firstCondition = allSegments[ec][st][rg][ch].size() ? true : false;
bool firstCondition = !allSegments[ec][st][rg][ch].empty() ? true : false;
bool secondCondition = false;
//---- ME1 is special as usual - ME1a and ME1b are actually one chamber
if(secondRing>-1){
secondCondition = allSegments[ec][st][secondRing][ch].size() ? true : false;
secondCondition = !allSegments[ec][st][secondRing][ch].empty() ? true : false;
}
if(firstCondition || secondCondition){
if(out){
Expand Down Expand Up @@ -1185,11 +1185,11 @@ bool CSCEfficiency::stripWire_Efficiencies(CSCDetId & id, FreeTrajectoryState &f
"size W = "<<allWG[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-FirstCh][iLayer].size()<<std::endl;

}
firstCondition = allStrips[ec][st][rg][ch][iLayer].size() ? true : false;
firstCondition = !allStrips[ec][st][rg][ch][iLayer].empty() ? true : false;
//allSegments[ec][st][rg][ch].size() ? true : false;
secondCondition = false;
if(secondRing>-1){
secondCondition = allStrips[ec][st][secondRing][ch][iLayer].size() ? true : false;
secondCondition = !allStrips[ec][st][secondRing][ch][iLayer].empty() ? true : false;
}
if(firstCondition || secondCondition){
ChHist[ec][st][rg][ch].EfficientStrips->Fill(iLayer+1);
Expand All @@ -1201,10 +1201,10 @@ bool CSCEfficiency::stripWire_Efficiencies(CSCDetId & id, FreeTrajectoryState &f
}
}
// Wires
firstCondition = allWG[ec][st][rg][ch][iLayer].size() ? true : false;
firstCondition = !allWG[ec][st][rg][ch][iLayer].empty() ? true : false;
secondCondition = false;
if(secondRing>-1){
secondCondition = allWG[ec][st][secondRing][ch][iLayer].size() ? true : false;
secondCondition = !allWG[ec][st][secondRing][ch][iLayer].empty() ? true : false;
}
if(firstCondition || secondCondition){
ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(iLayer+1);
Expand Down Expand Up @@ -1250,11 +1250,11 @@ bool CSCEfficiency::recSimHitEfficiency(CSCDetId & id, FreeTrajectoryState &ftsC
returnTypes(id, ec, st, rg, ch, secondRing);
bool firstCondition, secondCondition;
for(int iLayer=0; iLayer<6;iLayer++){
firstCondition = allSimhits[ec][st][rg][ch][iLayer].size() ? true : false;
firstCondition = !allSimhits[ec][st][rg][ch][iLayer].empty() ? true : false;
secondCondition = false;
int thisRing = rg;
if(secondRing>-1){
secondCondition = allSimhits[ec][st][secondRing][ch][iLayer].size() ? true : false;
secondCondition = !allSimhits[ec][st][secondRing][ch][iLayer].empty() ? true : false;
if(secondCondition){
thisRing = secondRing;
}
Expand All @@ -1266,7 +1266,7 @@ bool CSCEfficiency::recSimHitEfficiency(CSCDetId & id, FreeTrajectoryState &ftsC
if(13 ==
fabs(allSimhits[ec][st][thisRing][ch][iLayer][iSH].second)){
ChHist[ec][st][rg][ch].SimSimhits->Fill(iLayer+1);
if(allRechits[ec][st][thisRing][ch][iLayer].size()){
if(!allRechits[ec][st][thisRing][ch][iLayer].empty()){
ChHist[ec][st][rg][ch].SimRechits->Fill(iLayer+1);
}
break;
Expand Down Expand Up @@ -1302,11 +1302,11 @@ bool CSCEfficiency::recHitSegment_Efficiencies(CSCDetId & id, const CSCChamber*
// Rechits
if(printalot) std::cout<<"RecHits eff"<<std::endl;
for(int iLayer=0;iLayer<6;++iLayer){
firstCondition = allRechits[ec][st][rg][ch][iLayer].size() ? true : false;
firstCondition = !allRechits[ec][st][rg][ch][iLayer].empty() ? true : false;
secondCondition = false;
int thisRing = rg;
if(secondRing>-1){
secondCondition = allRechits[ec][st][secondRing][ch][iLayer].size() ? true : false;
secondCondition = !allRechits[ec][st][secondRing][ch][iLayer].empty() ? true : false;
if(secondCondition){
thisRing = secondRing;
}
Expand Down Expand Up @@ -1336,12 +1336,12 @@ bool CSCEfficiency::recHitSegment_Efficiencies(CSCDetId & id, const CSCChamber*
GlobalVector globalDir;
GlobalPoint globalPos;
// Segments
firstCondition = allSegments[ec][st][rg][ch].size() ? true : false;
firstCondition = !allSegments[ec][st][rg][ch].empty() ? true : false;
secondCondition = false;
int secondSize = 0;
int thisRing = rg;
if(secondRing>-1){
secondCondition = allSegments[ec][st][secondRing][ch].size() ? true : false;
secondCondition = !allSegments[ec][st][secondRing][ch].empty() ? true : false;
secondSize = allSegments[ec][st][secondRing][ch].size();
if(secondCondition){
thisRing = secondRing;
Expand All @@ -1368,10 +1368,10 @@ bool CSCEfficiency::recHitSegment_Efficiencies(CSCDetId & id, const CSCChamber*
}
ChHist[ec][st][rg][ch].AllSingleHits->Fill(iLayer+1);
}
firstCondition = allRechits[ec][st][rg][ch][iLayer].size() ? true : false;
firstCondition = !allRechits[ec][st][rg][ch][iLayer].empty() ? true : false;
secondCondition = false;
if(secondRing>-1){
secondCondition = allRechits[ec][st][secondRing][ch][iLayer].size() ? true : false;
secondCondition = !allRechits[ec][st][secondRing][ch][iLayer].empty() ? true : false;
}
float stripAngle = 99999.;
std::vector<float> posXY(2);
Expand Down Expand Up @@ -1572,7 +1572,7 @@ bool CSCEfficiency::applyTrigger(edm::Handle<edm::TriggerResults> &hltR,
}
}
else{
if(pointToTriggers.size()){
if(!pointToTriggers.empty()){
if(printalot){
std::cout<<"The following triggers will be required in the event: "<<std::endl;
for(size_t imyT =0; imyT <pointToTriggers.size();++imyT){
Expand All @@ -1585,7 +1585,7 @@ bool CSCEfficiency::applyTrigger(edm::Handle<edm::TriggerResults> &hltR,
}

if (hltR.isValid()) {
if(!pointToTriggers.size()){
if(pointToTriggers.empty()){
if(printalot){
std::cout<<" No triggers specified in the configuration or all ignored - no trigger information will be considered"<<std::endl;
}
Expand Down
8 changes: 4 additions & 4 deletions RecoLocalMuon/CSCEfficiency/src/CSCEfficiency.h
Expand Up @@ -117,14 +117,14 @@ class CSCEfficiency : public edm::EDFilter {
CSCEfficiency(const edm::ParameterSet& pset);

/// Destructor
virtual ~CSCEfficiency();
~CSCEfficiency() override;

private:
virtual void beginJob() ;
void beginJob() override ;
//---- analysis + filter
virtual bool filter(edm::Event & event, const edm::EventSetup& eventSetup);
bool filter(edm::Event & event, const edm::EventSetup& eventSetup) override;

virtual void endJob() ;
void endJob() override ;

//---- (input) parameters
//---- Root file name
Expand Down
4 changes: 2 additions & 2 deletions RecoLocalMuon/CSCRecHitD/src/CSCHitFromStripOnly.cc
Expand Up @@ -19,7 +19,7 @@
#include <vector>
//#include <iostream>

CSCHitFromStripOnly::CSCHitFromStripOnly( const edm::ParameterSet& ps ) : recoConditions_(0), calcped_(0), ganged_(0) {
CSCHitFromStripOnly::CSCHitFromStripOnly( const edm::ParameterSet& ps ) : recoConditions_(nullptr), calcped_(nullptr), ganged_(false) {

useCalib = ps.getParameter<bool>("CSCUseCalibrations");
bool useStaticPedestals = ps.getParameter<bool>("CSCUseStaticPedestals");
Expand Down Expand Up @@ -511,7 +511,7 @@ float CSCHitFromStripOnly::findHitOnStripPosition( const std::vector<CSCStripHit

float strippos = -1.;

if ( data.size() < 1 ) return strippos;
if ( data.empty() ) return strippos;

// biggestStrip is strip with largest pulse height
// Use pointer subtraction
Expand Down
2 changes: 1 addition & 1 deletion RecoLocalMuon/CSCRecHitD/src/CSCHitFromWireOnly.cc
Expand Up @@ -18,7 +18,7 @@
#include <iostream>


CSCHitFromWireOnly::CSCHitFromWireOnly( const edm::ParameterSet& ps ) : recoConditions_(0){
CSCHitFromWireOnly::CSCHitFromWireOnly( const edm::ParameterSet& ps ) : recoConditions_(nullptr){

deltaT = ps.getParameter<int>("CSCWireClusterDeltaT");
useReducedWireTime = ps.getParameter<bool>("CSCUseReducedWireTimeWindow");
Expand Down
14 changes: 7 additions & 7 deletions RecoLocalMuon/CSCRecHitD/src/CSCPedestalChoice.h
Expand Up @@ -25,7 +25,7 @@ class CSCPedestalChoice {
* and CSCDetId + channel
*/
virtual float pedestal( const std::vector<float>& sca,
const CSCRecoConditions* cond=0, const CSCDetId id=0, int ichan=0 ) = 0;
const CSCRecoConditions* cond=nullptr, const CSCDetId id=0, int ichan=0 ) = 0;
private:
float defaultPed;
};
Expand All @@ -40,9 +40,9 @@ class CSCPedestalChoice {
class CSCDynamicPedestal2 : public CSCPedestalChoice {
public:
CSCDynamicPedestal2(){}
~CSCDynamicPedestal2(){}
~CSCDynamicPedestal2() override{}
float pedestal( const std::vector<float>& sca,
const CSCRecoConditions*, const CSCDetId, int ){
const CSCRecoConditions*, const CSCDetId, int ) override{
float ped = getDefault();
if ( !sca.empty() ){
ped = ( sca[0]+sca[1] )/2.;
Expand All @@ -61,9 +61,9 @@ class CSCDynamicPedestal2 : public CSCPedestalChoice {
class CSCDynamicPedestal1 : public CSCPedestalChoice {
public:
CSCDynamicPedestal1(){}
~CSCDynamicPedestal1(){}
~CSCDynamicPedestal1() override{}
float pedestal( const std::vector<float>& sca,
const CSCRecoConditions*, const CSCDetId, int ){
const CSCRecoConditions*, const CSCDetId, int ) override{
float ped = getDefault();
if ( !sca.empty() ){
ped = sca[0];
Expand All @@ -82,9 +82,9 @@ class CSCDynamicPedestal1 : public CSCPedestalChoice {
class CSCStaticPedestal : public CSCPedestalChoice {
public:
CSCStaticPedestal(){}
~CSCStaticPedestal(){}
~CSCStaticPedestal() override{}
float pedestal( const std::vector<float>& sca,
const CSCRecoConditions* cond, const CSCDetId id, int ichan ){
const CSCRecoConditions* cond, const CSCDetId id, int ichan ) override{
float ped = cond->pedestal(id, ichan );
return ped;
}
Expand Down
2 changes: 1 addition & 1 deletion RecoLocalMuon/CSCRecHitD/src/CSCRecHitDBuilder.cc
Expand Up @@ -27,7 +27,7 @@
#include <iostream>
#include <cassert>

CSCRecHitDBuilder::CSCRecHitDBuilder( const edm::ParameterSet& ps ) : geom_(0) {
CSCRecHitDBuilder::CSCRecHitDBuilder( const edm::ParameterSet& ps ) : geom_(nullptr) {

// Receives ParameterSet percolated down from EDProducer

Expand Down
4 changes: 2 additions & 2 deletions RecoLocalMuon/CSCRecHitD/src/CSCRecHitDProducer.h
Expand Up @@ -31,9 +31,9 @@ class CSCRecHitDProducer : public edm::stream::EDProducer<> {

public:
explicit CSCRecHitDProducer( const edm::ParameterSet& ps );
~CSCRecHitDProducer();
~CSCRecHitDProducer() override;

virtual void produce( edm::Event&, const edm::EventSetup& );
void produce( edm::Event&, const edm::EventSetup& ) override;

static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);

Expand Down
4 changes: 2 additions & 2 deletions RecoLocalMuon/CSCRecHitD/src/CSCRecoBadChannelsAnalyzer.cc
Expand Up @@ -39,8 +39,8 @@
recoConditions_( new CSCRecoConditions( ps ) ) {
}

virtual ~CSCRecoBadChannelsAnalyzer() { delete recoConditions_; }
virtual void analyze(const edm::Event& e, const edm::EventSetup& c);
~CSCRecoBadChannelsAnalyzer() override { delete recoConditions_; }
void analyze(const edm::Event& e, const edm::EventSetup& c) override;

/// did we request reading bad channel info from db?
bool readBadChannels() const { return readBadChannels_; }
Expand Down
2 changes: 1 addition & 1 deletion RecoLocalMuon/CSCRecHitD/src/CSCXonStrip_MatchGatti.cc
Expand Up @@ -36,7 +36,7 @@


CSCXonStrip_MatchGatti::CSCXonStrip_MatchGatti(const edm::ParameterSet& ps) :
recoConditions_( 0 ) {
recoConditions_( nullptr ) {

useCalib = ps.getParameter<bool>("CSCUseCalibrations");
xtalksOffset = ps.getParameter<double>("CSCStripxtalksOffset");
Expand Down
2 changes: 1 addition & 1 deletion RecoLocalMuon/CSCSegment/src/CSCCondSegFit.h
Expand Up @@ -29,7 +29,7 @@ class CSCCondSegFit : public CSCSegFit {
covToAnyNumberAll_ ( ps.getParameter<bool>("ForceCovarianceAll") ),
covAnyNumber_ ( ps.getParameter<double>("Covariance") ) {}

~CSCCondSegFit() {}
~CSCCondSegFit() override {}

// The fit - override base class version with this version
// which passes in bool flags for up to two extra conditioning passes
Expand Down
8 changes: 4 additions & 4 deletions RecoLocalMuon/CSCSegment/src/CSCSegAlgoDF.cc
Expand Up @@ -33,7 +33,7 @@
*
*/
CSCSegAlgoDF::CSCSegAlgoDF(const edm::ParameterSet& ps)
: CSCSegmentAlgorithm(ps), myName("CSCSegAlgoDF"), sfit_(0) {
: CSCSegmentAlgorithm(ps), myName("CSCSegAlgoDF"), sfit_(nullptr) {

debug = ps.getUntrackedParameter<bool>("CSCSegmentDebug");
minLayersApart = ps.getParameter<int>("minLayersApart");
Expand Down Expand Up @@ -257,7 +257,7 @@ std::vector<CSCSegment> CSCSegAlgoDF::buildSegments(const ChamberHitContainer& _
sfit_->covarianceMatrix(), sfit_->chi2());
// std::cout << "[CSCSegAlgoDF::buildSegments] about to delete sfit= = " << sfit_ << std::endl;
delete sfit_;
sfit_ = 0; // avoid possibility of attempting a second delete later
sfit_ = nullptr; // avoid possibility of attempting a second delete later

segmentInChamber.push_back(temp);
if (debug) dumpSegment( temp );
Expand Down Expand Up @@ -499,7 +499,7 @@ void CSCSegAlgoDF::compareProtoSegment(const CSCRecHit2D* h, int layer) {

bool ok = addHit(h, layer);

CSCSegFit* newfit = 0;
CSCSegFit* newfit = nullptr;
if ( ok ) {
newfit = new CSCSegFit( theChamber, protoSegment );
// std::cout << "[CSCSegAlgoDF::compareProtoSegment] newfit = " << newfit << std::endl;
Expand Down Expand Up @@ -537,7 +537,7 @@ void CSCSegAlgoDF::flagHitsAsUsed(const ChamberHitContainer& rechitsInChamber) {
// Don't reject hits marked as "nearby" for now.
// So this is bypassed at all times for now !!!
// Perhaps add back to speed up algorithm some more
if (closeHits.size() > 0) return;
if (!closeHits.empty()) return;
for ( hi = closeHits.begin(); hi != closeHits.end(); ++hi ) {
for ( iu = ib; iu != rechitsInChamber.end(); ++iu ) {
if (*hi == *iu) usedHits[iu-ib] = true;
Expand Down
4 changes: 2 additions & 2 deletions RecoLocalMuon/CSCSegment/src/CSCSegAlgoDF.h
Expand Up @@ -61,7 +61,7 @@ class CSCSegAlgoDF : public CSCSegmentAlgorithm {
explicit CSCSegAlgoDF(const edm::ParameterSet& ps);

/// Destructor
virtual ~CSCSegAlgoDF();
~CSCSegAlgoDF() override;

/**
* Build track segments in this chamber (this is where the actual
Expand All @@ -72,7 +72,7 @@ class CSCSegAlgoDF : public CSCSegmentAlgorithm {
/**
* Here we must implement the algorithm
*/
std::vector<CSCSegment> run(const CSCChamber* aChamber, const ChamberHitContainer& rechits);
std::vector<CSCSegment> run(const CSCChamber* aChamber, const ChamberHitContainer& rechits) override;

private:

Expand Down
4 changes: 2 additions & 2 deletions RecoLocalMuon/CSCSegment/src/CSCSegAlgoRU.cc
Expand Up @@ -232,12 +232,12 @@ std::vector<CSCSegment> CSCSegAlgoRU::buildSegments(const CSCChamber* aChamber,
aState.proto_segment = best_proto_segment[j];
best_proto_segment[j].clear();
//SKIP empty proto-segments
if(aState.proto_segment.size() == 0) continue;
if(aState.proto_segment.empty()) continue;
updateParameters(aState);
// Create an actual CSCSegment - retrieve all info from the fit
CSCSegment temp(aState.sfit->hits(), aState.sfit->intercept(),
aState.sfit->localdir(), aState.sfit->covarianceMatrix(), aState.sfit->chi2());
aState.sfit = 0;
aState.sfit = nullptr;
segments.push_back(temp);
//if the segment has 3 hits flag them as used in a particular way
if(aState.proto_segment.size() == 3){
Expand Down
4 changes: 2 additions & 2 deletions RecoLocalMuon/CSCSegment/src/CSCSegAlgoRU.h
Expand Up @@ -65,7 +65,7 @@ class CSCSegAlgoRU : public CSCSegmentAlgorithm {
/// Constructor
explicit CSCSegAlgoRU(const edm::ParameterSet& ps);
/// Destructor
virtual ~CSCSegAlgoRU() {};
~CSCSegAlgoRU() override {};

/**
* Build track segments in this chamber (this is where the actual
Expand All @@ -78,7 +78,7 @@ class CSCSegAlgoRU : public CSCSegmentAlgorithm {
/**
* Here we must implement the algorithm
*/
std::vector<CSCSegment> run(const CSCChamber* aChamber, const ChamberHitContainer& rechits){ return buildSegments(aChamber, rechits); }
std::vector<CSCSegment> run(const CSCChamber* aChamber, const ChamberHitContainer& rechits) override{ return buildSegments(aChamber, rechits); }

private:
struct AlgoState {
Expand Down
6 changes: 3 additions & 3 deletions RecoLocalMuon/CSCSegment/src/CSCSegAlgoSK.cc
Expand Up @@ -17,7 +17,7 @@
#include <string>

CSCSegAlgoSK::CSCSegAlgoSK(const edm::ParameterSet& ps)
: CSCSegmentAlgorithm(ps), myName("CSCSegAlgoSK"), sfit_(0) {
: CSCSegmentAlgorithm(ps), myName("CSCSegAlgoSK"), sfit_(nullptr) {

debugInfo = ps.getUntrackedParameter<bool>("verboseInfo");

Expand Down Expand Up @@ -103,7 +103,7 @@ std::vector<CSCSegment> CSCSegAlgoSK::buildSegments(const ChamberHitContainer& u
std::vector<CSCSegment> segments;

// This is going to point to fits to hits, and its content will be used to create a CSCSegment
sfit_ = 0;
sfit_ = nullptr;

ChamberHitContainerCIt ib = rechits.begin();
ChamberHitContainerCIt ie = rechits.end();
Expand Down Expand Up @@ -173,7 +173,7 @@ std::vector<CSCSegment> CSCSegAlgoSK::buildSegments(const ChamberHitContainer& u
CSCSegment temp(sfit_->hits(), sfit_->intercept(),
sfit_->localdir(), sfit_->covarianceMatrix(), sfit_->chi2() );
delete sfit_;
sfit_ = 0;
sfit_ = nullptr;
LogDebug("CSC") << "Found a segment !!!\n";
if ( debugInfo ) dumpSegment( temp );
segments.push_back(temp);
Expand Down