Skip to content

Commit

Permalink
Fix a bunch of clang reported issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
ktf committed May 9, 2014
1 parent 42cb44d commit 20bf6b4
Show file tree
Hide file tree
Showing 26 changed files with 38 additions and 169 deletions.
5 changes: 3 additions & 2 deletions CondFormats/SiStripObjects/interface/SiStripConfObject.h
Expand Up @@ -61,7 +61,7 @@ class SiStripConfObject
template <class valueType>
valueType get( const std::string & name ) const
{
valueType returnValue;
valueType returnValue = 0;
parMap::const_iterator it = parameters.find(name);
std::stringstream ss;
if( it != parameters.end() ) {
Expand All @@ -74,7 +74,6 @@ class SiStripConfObject
return returnValue;
}


bool isParameter( const std::string & name ) const
{
return( parameters.find(name) != parameters.end() );
Expand All @@ -90,6 +89,8 @@ class SiStripConfObject
parMap parameters;
};

template <>
std::string SiStripConfObject::get<std::string>( const std::string & name ) const;
template <>
bool SiStripConfObject::put<std::vector<int> >( const std::string & name, const std::vector<int> & inputValue );
template <>
Expand Down
17 changes: 17 additions & 0 deletions CondFormats/SiStripObjects/src/SiStripConfObject.cc
@@ -1,4 +1,21 @@
#include "CondFormats/SiStripObjects/interface/SiStripConfObject.h"
#include <string>

template <>
std::string SiStripConfObject::get<std::string>( const std::string & name ) const
{
std::string returnValue;
parMap::const_iterator it = parameters.find(name);
std::stringstream ss;
if( it != parameters.end() ) {
ss << it->second;
ss >> returnValue;
}
else {
std::cout << "WARNING: parameter " << name << " not found. Returning default value" << std::endl;
}
return returnValue;
}

template <>
bool SiStripConfObject::put<std::vector<int> >( const std::string & name, const std::vector<int> & inputValue )
Expand Down
Expand Up @@ -31,7 +31,7 @@
HLTHFRecoEcalCandidateProducer::HLTHFRecoEcalCandidateProducer(edm::ParameterSet const& conf):
hfclusters_(conf.getParameter<edm::InputTag>("hfclusters")),
HFDBversion_(conf.existsAs<bool>("HFDBversion") ? conf.getParameter<int>("HFDBversion"):99),//do nothing
HFDBvector_(conf.existsAs<bool>("HFDBvector") ? conf.getParameter<std::vector<double> >("HFDBvector"):defaultDB_),
HFDBvector_(conf.existsAs<bool>("HFDBvector") ? conf.getParameter<std::vector<double> >("HFDBvector"):std::vector<double>{}),
Cut2D_(conf.getParameter<double>("intercept2DCut")),
defaultSlope2D_((Cut2D_<=0.83)?(0.475):((Cut2D_>0.83 && Cut2D_<=0.9)?(0.275):(0.2))),//fix for hlt unable to add slope variable now
hfvars_(HFDBversion_,HFDBvector_),
Expand Down
Expand Up @@ -30,7 +30,6 @@ class HLTHFRecoEcalCandidateProducer : public edm::EDProducer {
int HFDBversion_;
std::vector<double> HFDBvector_;
bool doPU_;
std::vector<double> defaultDB_;
double Cut2D_;
double defaultSlope2D_;
reco::HFValueStruct hfvars_;
Expand Down
Expand Up @@ -320,7 +320,7 @@ void InOutConversionSeedFinder::startSeed( const FreeTrajectoryState * fts, cons
std::vector<const reco::CaloCluster*> bcVec;
//std::cout << "InOutConversionSeedFinder::startSeed charge assumed for the in-out track " << track2Charge_ << "\n";

Geom::Phi<float> theConvPhi( stateAtPreviousLayer.globalPosition().phi());
// Geom::Phi<float> theConvPhi( stateAtPreviousLayer.globalPosition().phi());
//std::cout << "InOutConversionSeedFinder::startSeed stateAtPreviousLayer phi " << stateAtPreviousLayer.globalPosition().phi() << " R " << stateAtPreviousLayer.globalPosition().perp() << " Z " << stateAtPreviousLayer.globalPosition().z() << "\n";

bcVec = getSecondCaloClusters(stateAtPreviousLayer.globalPosition(),track2Charge_);
Expand Down
2 changes: 1 addition & 1 deletion RecoEgamma/EgammaPhotonAlgos/src/PhotonEnergyCorrector.cc
Expand Up @@ -59,7 +59,7 @@ PhotonEnergyCorrector::PhotonEnergyCorrector( const edm::ParameterSet& config, e
weightsfromDB_= config.getParameter<bool>("regressionWeightsFromDB");
w_file_ = config.getParameter<std::string>("energyRegressionWeightsFileLocation");
if (weightsfromDB_) w_db_ = config.getParameter<std::string>("energyRegressionWeightsDBLocation");
else w_db_ == "none" ;
else w_db_ = "none" ;
regressionCorrector_ = new EGEnergyCorrector();


Expand Down
6 changes: 0 additions & 6 deletions RecoJets/JetProducers/plugins/CompoundJetProducer.cc
Expand Up @@ -9,12 +9,6 @@ using namespace reco;
using namespace edm;
using namespace cms;

namespace {
const bool debug = false;

}


CompoundJetProducer::CompoundJetProducer(edm::ParameterSet const& conf):
VirtualJetProducer( conf )
{
Expand Down
5 changes: 0 additions & 5 deletions RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc
Expand Up @@ -11,11 +11,6 @@ using namespace reco;
using namespace edm;
using namespace cms;

namespace {
const bool debug = false;

}

namespace {
bool checkHydro(const reco::GenParticle * p){
const Candidate* m1 = p->mother();
Expand Down
1 change: 0 additions & 1 deletion RecoLocalCalo/Castor/src/CastorClusterProducer.cc
Expand Up @@ -75,7 +75,6 @@ class CastorClusterProducer : public edm::EDProducer {
// constants, enums and typedefs
//

const double MYR2D = 180/M_PI;

//
// static data member definitions
Expand Down
1 change: 0 additions & 1 deletion RecoLocalCalo/Castor/src/CastorTowerProducer.cc
Expand Up @@ -74,7 +74,6 @@ class CastorTowerProducer : public edm::stream::EDProducer<> {
// constants, enums and typedefs
//

const double MYR2D = 180/M_PI;

//
// static data member definitions
Expand Down
Expand Up @@ -37,7 +37,6 @@ template<class C> class EcalUncalibRecHitRecAnalFitAlgo : public EcalUncalibRecH
};

double pedestalFunction(double* var, double* par) {
double x = var[0];
double ped = par[0];
return ped;
};
Expand Down
128 changes: 0 additions & 128 deletions RecoLocalCalo/HcalRecAlgos/src/ZdcSimpleRecAlgo.cc
Expand Up @@ -243,131 +243,3 @@ ZDCRecHit ZdcSimpleRecAlgo::reconstruct(const ZDCDataFrame& digi, const std::vec
throw cms::Exception("ZDCSimpleRecoAlgos::exiting process");

}

static const float wpksamp0_zdc = 0.500053;
static const float scale_zdc = 0.999683;
static const int num_bins_zdc = 100;

static const float actual_ns_zdc[num_bins_zdc] = {
0.00250, // 0.000-0.010
0.08000, // 0.010-0.020
0.16000, // 0.020-0.030
0.23750, // 0.030-0.040
0.31750, // 0.040-0.050
0.39500, // 0.050-0.060
0.47500, // 0.060-0.070
0.55500, // 0.070-0.080
0.63000, // 0.080-0.090
0.70000, // 0.090-0.100
0.77000, // 0.100-0.110
0.84000, // 0.110-0.120
0.91000, // 0.120-0.130
0.98000, // 0.130-0.140
1.05000, // 0.140-0.150
1.12000, // 0.150-0.160
1.19000, // 0.160-0.170
1.26000, // 0.170-0.180
1.33000, // 0.180-0.190
1.40000, // 0.190-0.200
1.47000, // 0.200-0.210
1.54000, // 0.210-0.220
1.61000, // 0.220-0.230
1.68000, // 0.230-0.240
1.75000, // 0.240-0.250
1.82000, // 0.250-0.260
1.89000, // 0.260-0.270
1.96000, // 0.270-0.280
2.03000, // 0.280-0.290
2.10000, // 0.290-0.300
2.17000, // 0.300-0.310
2.24000, // 0.310-0.320
2.31000, // 0.320-0.330
2.38000, // 0.330-0.340
2.45000, // 0.340-0.350
2.52000, // 0.350-0.360
2.59000, // 0.360-0.370
2.68500, // 0.370-0.380
2.79250, // 0.380-0.390
2.90250, // 0.390-0.400
3.01000, // 0.400-0.410
3.11750, // 0.410-0.420
3.22500, // 0.420-0.430
3.33500, // 0.430-0.440
3.44250, // 0.440-0.450
3.55000, // 0.450-0.460
3.73250, // 0.460-0.470
4.02000, // 0.470-0.480
4.30750, // 0.480-0.490
4.59500, // 0.490-0.500
6.97500, // 0.500-0.510
10.98750, // 0.510-0.520
13.03750, // 0.520-0.530
14.39250, // 0.530-0.540
15.39500, // 0.540-0.550
16.18250, // 0.550-0.560
16.85250, // 0.560-0.570
17.42750, // 0.570-0.580
17.91500, // 0.580-0.590
18.36250, // 0.590-0.600
18.76500, // 0.600-0.610
19.11250, // 0.610-0.620
19.46000, // 0.620-0.630
19.76500, // 0.630-0.640
20.03500, // 0.640-0.650
20.30250, // 0.650-0.660
20.57250, // 0.660-0.670
20.79250, // 0.670-0.680
21.00250, // 0.680-0.690
21.21000, // 0.690-0.700
21.42000, // 0.700-0.710
21.62750, // 0.710-0.720
21.79000, // 0.720-0.730
21.95250, // 0.730-0.740
22.11500, // 0.740-0.750
22.27750, // 0.750-0.760
22.44000, // 0.760-0.770
22.60500, // 0.770-0.780
22.73250, // 0.780-0.790
22.86000, // 0.790-0.800
22.98500, // 0.800-0.810
23.11250, // 0.810-0.820
23.23750, // 0.820-0.830
23.36500, // 0.830-0.840
23.49000, // 0.840-0.850
23.61750, // 0.850-0.860
23.71500, // 0.860-0.870
23.81250, // 0.870-0.880
23.91250, // 0.880-0.890
24.01000, // 0.890-0.900
24.10750, // 0.900-0.910
24.20750, // 0.910-0.920
24.30500, // 0.920-0.930
24.40500, // 0.930-0.940
24.50250, // 0.940-0.950
24.60000, // 0.950-0.960
24.68250, // 0.960-0.970
24.76250, // 0.970-0.980
24.84000, // 0.980-0.990
24.92000 // 0.990-1.000
};

/*
float timeshift_ns_zdc(float wpksamp) {
float flx = (num_bins_zdc*(wpksamp - wpksamp0_zdc)/scale_zdc);
int index = (int)flx;
float yval;
if (index < 0) return actual_ns_zdc[0];
else if (index >= num_bins_zdc-1) return actual_ns_zdc[num_bins_zdc-1];
// else interpolate:
float y1 = actual_ns_zdc[index];
float y2 = actual_ns_zdc[index+1];
// float delta_x = 1/(float)num_bins_zdc;
// yval = y1 + (y2-y1)*(flx-(float)index)/delta_x;
yval = y1 + (y2-y1)*(flx-(float)index);
return yval;
}
*/
1 change: 0 additions & 1 deletion RecoLocalMuon/CSCEfficiency/src/CSCEfficiency.cc
Expand Up @@ -940,7 +940,6 @@ void CSCEfficiency::fillRechitsSegments_info(edm::Handle<CSCRecHit2DCollection>
for(size_t jRH = 0;
jRH<allRechits[idRH.endcap()-1][idRH.station()-1][idRH.ring()-1][idRH.chamber()-FirstCh][idRH.layer()-1].size();
++jRH){
allRechits[idRH.endcap()-1][idRH.station()-1][idRH.ring()-1][idRH.chamber()-FirstCh][idRH.layer()-1][jRH].first;
float xDiff = iRH->localPosition().x() -
allRechits[idRH.endcap()-1][idRH.station()-1][idRH.ring()-1][idRH.chamber()-FirstCh][idRH.layer()-1][jRH].first.x();
float yDiff = iRH->localPosition().y() -
Expand Down
3 changes: 0 additions & 3 deletions RecoLocalTracker/SiPixelRecHits/src/PixelCPEBase.cc
Expand Up @@ -31,9 +31,6 @@ using namespace std;
//#define NEW_CPEERROR // must be constistent with base.cc, generic cc/h and genericProducer.cc

namespace {
constexpr float degsPerRad = 57.29578;
constexpr float HALF_PI = 1.57079632679489656;
constexpr float PI = 2*HALF_PI;
#ifndef NEW_CPEERROR
//const bool useNewSimplerErrors = true;
const bool useNewSimplerErrors = false; // must be tha same as in generic
Expand Down
2 changes: 0 additions & 2 deletions RecoLocalTracker/SiPixelRecHits/src/PixelCPEGeneric.cc
Expand Up @@ -21,8 +21,6 @@ using namespace std;
//#define NEW_CPEERROR // must be constistent with base.cc, generic cc/h and genericProducer.cc

namespace {
constexpr float HALF_PI = 1.57079632679489656;
constexpr float PI = 2*HALF_PI;
constexpr float micronsToCm = 1.0e-4;
#ifndef NEW_CPEERROR
//const bool useNewSimplerErrors = true; // must be the same as in base
Expand Down
3 changes: 0 additions & 3 deletions RecoLocalTracker/SiPixelRecHits/src/PixelCPETemplateReco.cc
Expand Up @@ -30,9 +30,6 @@ using namespace SiPixelTemplateReco;
using namespace std;

namespace {
constexpr float PI = 3.141593;
constexpr float HALFPI = PI * 0.5;
constexpr float degsPerRad = 57.29578;
constexpr float micronsToCm = 1.0e-4;
constexpr int cluster_matrix_size_x = 13;
constexpr int cluster_matrix_size_y = 21;
Expand Down
Expand Up @@ -7,7 +7,8 @@ class StripCPEfromTrackAngle : public StripCPE
{

public:
StripClusterParameterEstimator::LocalValues
using StripCPE::localParameters;
StripClusterParameterEstimator::LocalValues
localParameters( const SiStripCluster&, const GeomDetUnit&, const LocalTrajectoryParameters&) const;

StripCPEfromTrackAngle( edm::ParameterSet & conf,
Expand Down
2 changes: 1 addition & 1 deletion RecoMuon/L3MuonProducer/src/L3TkMuonProducer.cc
Expand Up @@ -65,7 +65,7 @@ bool L3TkMuonProducer::sharedSeed(const L3MuonTrajectorySeed& s1,const L3MuonTra
//quit right away if first detId does not match. front exist because of ==0 ->quit test
if(i1_b->geographicalId() != i2_b->geographicalId()) return false;
//then check hit by hit if they are the same
for (i1=i1_b,i2=i2_b;i1!=i1_e,i2!=i2_e;++i1,++i2){
for (i1=i1_b,i2=i2_b;i1!=i1_e && i2!=i2_e;++i1,++i2){
if (!i1->sharesInput(&(*i2),TrackingRecHit::all)) return false;
}
return true;
Expand Down
1 change: 1 addition & 0 deletions RecoMuon/MuonSeedGenerator/src/SETFilter.cc
Expand Up @@ -28,6 +28,7 @@
// there is an existing sorter somewhere in the CMSSW code (I think) - delete that
struct sorter {
//bigger first!
sorter() {}
bool operator() (TransientTrackingRecHit::ConstRecHitPointer hit_1,
TransientTrackingRecHit::ConstRecHitPointer hit_2) const {
if(hit_1->det()->subDetector() != GeomDetEnumerators::CSC ||
Expand Down
8 changes: 4 additions & 4 deletions RecoTracker/FinalTrackSelectors/src/TrackerTrackHitFilter.cc
Expand Up @@ -227,10 +227,10 @@ void TrackerTrackHitFilter::parseStoN(const std::string &str) {
throw cms::Exception("Configuration") << "Rule for S to N cut '" << str << "' not understood.\n";
}
else{
std::string match_0=(match[0].first,match[0].second);
match_1=(match[1].first,match[1].second);
match_2=(match[2].first,match[2].second);
match_3=(match[3].first,match[3].second);
std::string match_0=match[0].second;
match_1=match[1].second;
match_2=match[2].second;
match_3=match[3].second;

}

Expand Down
Expand Up @@ -107,7 +107,7 @@ ConstrainedTreeBuilderT::buildTree(const std::vector<RefCountedKinematicParticle
std::vector<RefCountedKinematicParticle> rParticles;
int n=0;
// assert(initialParticles.size()==nTrk);
for( ; i != initialParticles.end(), iStates != finalStates.end(); ++i,++iStates)
for( ; i != initialParticles.end() && iStates != finalStates.end(); ++i,++iStates)
{
AlgebraicVector7 p = iStates->kinematicParameters().vector();
double a = - iStates->particleCharge() *
Expand Down
2 changes: 1 addition & 1 deletion RecoVertex/KinematicFit/src/ConstrainedTreeBuilder.cc
Expand Up @@ -60,7 +60,7 @@ RefCountedKinematicTree ConstrainedTreeBuilder::buildTree(const std::vector<RefC
std::vector<KinematicState>::const_iterator iStates = finalStates.begin();
std::vector<RefCountedKinematicParticle> rParticles;
int n=0;
for( ; i != initialParticles.end(), iStates != finalStates.end(); ++i,++iStates)
for( ; i != initialParticles.end() && iStates != finalStates.end(); ++i,++iStates)
{
AlgebraicVector7 p = iStates->kinematicParameters().vector();
double a = - iStates->particleCharge() *
Expand Down
2 changes: 1 addition & 1 deletion RecoVertex/KinematicFit/src/FinalTreeBuilder.cc
Expand Up @@ -105,7 +105,7 @@ RefCountedKinematicTree FinalTreeBuilder::buildTree(const CachingVertex<6>& vtx,

std::vector<RefCountedKinematicParticle>::const_iterator j;
std::vector<RefCountedVertexTrack>::const_iterator i;
for(j=input.begin(), i=refTracks.begin(); j !=input.end(), i !=refTracks.end();++j, ++i)
for(j=input.begin(), i=refTracks.begin(); j !=input.end() && i !=refTracks.end();++j, ++i)
{
RefCountedLinearizedTrackState lT = (*i)->linearizedTrack();
KinematicRefittedTrackState * rS= dynamic_cast<KinematicRefittedTrackState *>(&(*((*i)->refittedState())));
Expand Down
Expand Up @@ -14,7 +14,7 @@ Flight2DSvFilter::Flight2DSvFilter () {
}


Flight2DSvFilter::Flight2DSvFilter ( double maxDist2D=2.5 , double minDist2D=0.01 , double minSign2D=3.0 , int minTracks=2 ) {
Flight2DSvFilter::Flight2DSvFilter ( double maxDist2D, double minDist2D, double minSign2D, int minTracks) {
// init. data members
maxFlightDist2D = maxDist2D ; // cm
minFlightDist2D = minDist2D ; // cm
Expand Down
4 changes: 2 additions & 2 deletions RecoVertex/VertexTools/src/InvariantMassFromVertex.cc
Expand Up @@ -32,7 +32,7 @@ InvariantMassFromVertex::LorentzVector InvariantMassFromVertex::p4 (const Cachin
std::vector<RefCountedVertexTrack>::const_iterator i_s = refTracks.begin();
std::vector<double>::const_iterator i_m = masses.begin();

for( ;i_s !=refTracks.end(), i_m != masses.end(); ++i_s, ++i_m) {
for( ;i_s !=refTracks.end() && i_m != masses.end(); ++i_s, ++i_m) {
GlobalVector momentum = (**i_s).refittedState()->freeTrajectoryState().momentum();
totalP4 += LorentzVector(momentum.x(), momentum.y(), momentum.z(), *i_m);
}
Expand Down Expand Up @@ -107,7 +107,7 @@ double InvariantMassFromVertex::uncertainty(const LorentzVector & totalP4,
std::vector<double>::const_iterator i_m = masses.begin();

int i_int = 0;
for( ;rt_i !=refTracks.end(), i_m != masses.end(); ++rt_i, ++i_m) {
for( ;rt_i !=refTracks.end() && i_m != masses.end(); ++rt_i, ++i_m) {

double a;
AlgebraicVector5 param = (**rt_i).refittedState()->parameters(); // rho, theta, phi,tr_im, z_im
Expand Down

0 comments on commit 20bf6b4

Please sign in to comment.