Skip to content

Commit 7156c19

Browse files
committed
[ANALYSIS] Apply code-checks-all with misc-definitions-in-headers additional check
1 parent 2203a47 commit 7156c19

File tree

6 files changed

+27
-24
lines changed

6 files changed

+27
-24
lines changed

JetMETCorrections/MCJet/bin/Utilities.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ std::vector<T> CommandLine::getVector(const std::string& name) {
146146
std::string::size_type pos;
147147
if (!tmp.empty()) {
148148
do {
149-
pos = tmp.find(",");
149+
pos = tmp.find(',');
150150
std::stringstream ss;
151151
ss << tmp.substr(0, pos);
152152
tmp.erase(0, pos + 1);
@@ -189,7 +189,7 @@ bool CommandLine::parse(int argc, char** argv) {
189189

190190
for (int i = 1; i < argc; i++) {
191191
std::string opt = argv[i];
192-
if (0 != opt.find("-")) {
192+
if (0 != opt.find('-')) {
193193
if (i == 1) {
194194
bool success = parse_file(opt);
195195
if (!success)
@@ -210,7 +210,7 @@ bool CommandLine::parse(int argc, char** argv) {
210210
i++;
211211
if (i < argc - 1) {
212212
next = argv[i + 1];
213-
while (next.find("-") != 0) {
213+
while (next.find('-') != 0) {
214214
_options[opt].first += "," + next;
215215
i++;
216216
next = (i < argc - 1) ? argv[i + 1] : "-";
@@ -254,7 +254,7 @@ void CommandLine::print() {
254254
std::string::size_type length = tmp.length();
255255
std::string::size_type pos;
256256
do {
257-
pos = tmp.find(",");
257+
pos = tmp.find(',');
258258
if (tmp.length() == length) {
259259
std::cout << std::setiosflags(std::ios::left) << std::setw(22) << it->first
260260
<< std::resetiosflags(std::ios::left) << std::setw(3) << "=" << std::setiosflags(std::ios::right)
@@ -308,8 +308,8 @@ bool CommandLine::parse_file(const std::string& file_name) {
308308
last_token = "";
309309
value = "";
310310
} else if (!last_token.empty()) {
311-
if (last_token.find("\"") == 0) {
312-
if (last_token.rfind("\"") == last_token.length() - 1) {
311+
if (last_token.find('\"') == 0) {
312+
if (last_token.rfind('\"') == last_token.length() - 1) {
313313
last_token = last_token.substr(1, last_token.length() - 2);
314314
value += (!value.empty()) ? "," + last_token : last_token;
315315
last_token = token;
@@ -324,7 +324,7 @@ bool CommandLine::parse_file(const std::string& file_name) {
324324
ss >> token;
325325
}
326326
if (!last_token.empty()) {
327-
if (last_token.find("\"") == 0 && last_token.rfind("\"") == last_token.length() - 1)
327+
if (last_token.find('\"') == 0 && last_token.rfind('\"') == last_token.length() - 1)
328328
last_token = last_token.substr(1, last_token.length() - 2);
329329
value += (!value.empty()) ? "," + last_token : last_token;
330330
}

MuonAnalysis/MomentumScaleCalibration/plugins/Histograms.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@
2828
#include "TCanvas.h"
2929

3030
#include "TLorentzVector.h"
31-
#include <vector>
32-
#include <string>
33-
#include <iostream>
31+
#include <memory>
32+
3433
#include "TMath.h"
34+
#include <iostream>
35+
#include <string>
36+
#include <vector>
3537

3638
class Histograms {
3739
public:
@@ -2288,8 +2290,8 @@ class HMassResolutionVSPart : public Histograms {
22882290
}
22892291

22902292
// single particles histograms
2291-
muMinus.reset(new HDelta("muMinus"));
2292-
muPlus.reset(new HDelta("muPlus"));
2293+
muMinus = std::make_unique<HDelta>("muMinus");
2294+
muPlus = std::make_unique<HDelta>("muPlus");
22932295
}
22942296

22952297
~HMassResolutionVSPart() override {

PhysicsTools/UtilAlgos/interface/CachingVariable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ class ExpressionVariable : public CachingVariable {
333333
//do something fancy for multiple variable from one PSet
334334
std::vector<std::string> vars = arg.iConfig.getParameter<std::vector<std::string> >("vars");
335335
for (unsigned int v = 0; v != vars.size(); ++v) {
336-
unsigned int sep = vars[v].find(":");
336+
unsigned int sep = vars[v].find(':');
337337
std::string name = vars[v].substr(0, sep);
338338
std::string expr = vars[v].substr(sep + 1);
339339

PhysicsTools/UtilAlgos/interface/StringBasedNTupler.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,12 @@ class StringLeaveHelper {
100100
//empty vector if product not found
101101
if (oH.failedToGet()) {
102102
edm::LogError("StringBranchHelper") << "cannot open: " << B.src();
103-
value_.reset(new std::vector<float>(0));
103+
value_ = std::make_unique<std::vector<float>>(0);
104104
} else {
105105
//parser for the object expression
106106
StringObjectFunction<Object> expr(B.expr());
107107
//allocate enough memory for the data holder
108-
value_.reset(new std::vector<float>(1));
108+
value_ = std::make_unique<std::vector<float>>(1);
109109
try {
110110
(*value_)[0] = (expr)(*oH);
111111
} catch (...) {
@@ -138,12 +138,12 @@ class StringBranchHelper {
138138
if (!(iEvent.isRealData() && B.className() == "reco::GenParticle")) { //don't output genparticle error in data
139139
edm::LogError("StringBranchHelper") << "cannot open: " << B.src() << " " << B.className();
140140
}
141-
value_.reset(new std::vector<float>());
141+
value_ = std::make_unique<std::vector<float>>();
142142
} else {
143143
//parser for the object expression
144144
StringObjectFunction<Object> expr(B.expr());
145145
//allocate enough memory for the data holder
146-
value_.reset(new std::vector<float>());
146+
value_ = std::make_unique<std::vector<float>>();
147147
value_->reserve(oH->size());
148148

149149
StringCutObjectSelector<Object>* selection = nullptr;
@@ -238,12 +238,12 @@ class StringBasedNTupler : public NTupler {
238238
uint sep = leavesS[l].find(separator);
239239
std::string name = leavesS[l].substr(0, sep);
240240
//removes spaces from the variable name
241-
/*uint*/ int space = name.find(" ");
241+
/*uint*/ int space = name.find(' ');
242242
while (space != -1 /*std::string::npos*/) {
243243
std::string first = name.substr(0, space);
244244
std::string second = name.substr(space + 1);
245245
name = first + second;
246-
space = name.find(" ");
246+
space = name.find(' ');
247247
}
248248
std::string expr = leavesS[l].substr(sep + 1);
249249
std::string branchAlias = branches[b] + "_" + name;

PhysicsTools/Utilities/interface/NumericalIntegration.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
* Gauss Legendre and Gauss algorithms based on ROOT implementation
88
*
99
*/
10+
#include "Math/AllIntegrationTypes.h"
1011
#include "Math/Functor.h"
1112
#include "Math/Integrator.h"
12-
#include "Math/AllIntegrationTypes.h"
13-
#include <vector>
1413
#include <cmath>
1514
#include <memory>
15+
#include <vector>
1616

1717
namespace funct {
1818

@@ -142,15 +142,15 @@ namespace funct {
142142
relTol_ = o.relTol_;
143143
size_ = o.size_;
144144
rule_ = o.rule_;
145-
integrator_.reset(new ROOT::Math::Integrator(type_, absTol_, relTol_, size_, rule_));
145+
integrator_ = std::make_unique<ROOT::Math::Integrator>(type_, absTol_, relTol_, size_, rule_);
146146
}
147147
RootIntegrator& operator=(const RootIntegrator& o) {
148148
type_ = o.type_;
149149
absTol_ = o.absTol_;
150150
relTol_ = o.relTol_;
151151
size_ = o.size_;
152152
rule_ = o.rule_;
153-
integrator_.reset(new ROOT::Math::Integrator(type_, absTol_, relTol_, size_, rule_));
153+
integrator_ = std::make_unique<ROOT::Math::Integrator>(type_, absTol_, relTol_, size_, rule_);
154154
return *this;
155155
}
156156
template <typename F>

TopQuarkAnalysis/TopKinFitter/plugins/TtFullLepKinSolutionProducer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,8 @@ void TtFullLepKinSolutionProducer::produce(edm::Event& evt, const edm::EventSetu
408408
if (weightsV.empty()) {
409409
//create dmummy vector
410410
std::vector<int> idcs;
411-
for (int i = 0; i < 6; ++i)
411+
idcs.reserve(6);
412+
for (int i = 0; i < 6; ++i)
412413
idcs.push_back(-1);
413414

414415
idcsV.push_back(idcs);

0 commit comments

Comments
 (0)