Skip to content

Commit

Permalink
clang checks
Browse files Browse the repository at this point in the history
  • Loading branch information
mrodozov committed Jul 17, 2020
1 parent 4047512 commit 1c330cc
Show file tree
Hide file tree
Showing 117 changed files with 530 additions and 354 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void HBHENoiseFilterResultProducer::produce(edm::Event& iEvent, const edm::Event
// Write out the standard flags
std::unique_ptr<bool> pOut;
for (std::map<std::string, bool>::const_iterator it = decisionMap_.begin(); it != decisionMap_.end(); ++it) {
pOut = std::unique_ptr<bool>(new bool(!it->second));
pOut = std::make_unique<bool>(!it->second);
iEvent.put(std::move(pOut), it->first);
}

Expand All @@ -158,14 +158,14 @@ void HBHENoiseFilterResultProducer::produce(edm::Event& iEvent, const edm::Event
std::map<std::string, bool>::const_iterator it = decisionMap_.find(defaultDecision_);
if (it == decisionMap_.end())
throw cms::Exception("Invalid HBHENoiseFilterResultProducer parameter \"defaultDecision\"");
pOut = std::unique_ptr<bool>(new bool(!it->second));
pOut = std::make_unique<bool>(!it->second);
iEvent.put(std::move(pOut), "HBHENoiseFilterResult");

// Check isolation requirements
const bool failIsolation = summary.numIsolatedNoiseChannels() >= minNumIsolatedNoiseChannels_ ||
summary.isolatedNoiseSumE() >= minIsolatedNoiseSumE_ ||
summary.isolatedNoiseSumEt() >= minIsolatedNoiseSumEt_;
pOut = std::unique_ptr<bool>(new bool(!failIsolation));
pOut = std::make_unique<bool>(!failIsolation);
iEvent.put(std::move(pOut), "HBHEIsoNoiseFilterResult");

return;
Expand Down
2 changes: 1 addition & 1 deletion DataFormats/Luminosity/src/LumiSummary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <ostream>
#include <iostream>
float LumiSummary::avgInsDelLumi() const {
size_t iIndex = lumiversion_.rfind("v");
size_t iIndex = lumiversion_.rfind('v');
//i.e. not "-1" and not "DIP", "-1" and "DIP" lumi are already corrected and unit conversion included in the raw data.
if (iIndex != std::string::npos) {
return avginsdellumi_ * 1000.0;
Expand Down
10 changes: 7 additions & 3 deletions DataFormats/TauReco/src/PFTau.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#include "DataFormats/TauReco/interface/PFTau.h"
#include <memory>



#include "DataFormats/Common/interface/RefToPtr.h"
#include "DataFormats/TauReco/interface/PFTau.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

//using namespace std;
Expand Down Expand Up @@ -132,12 +136,12 @@ namespace reco {
if (ptr.isNonnull()) {
const reco::PFCandidate* pf_cand = dynamic_cast<const reco::PFCandidate*>(&*ptr);
if (pf_cand != nullptr) {
return std::unique_ptr<reco::PFCandidatePtr>(new reco::PFCandidatePtr(ptr));
return std::make_unique<reco::PFCandidatePtr>(ptr);
} else
throw cms::Exception("Type Mismatch")
<< "This PFTau was not made from PFCandidates, but it is being tried to access a PFCandidate.\n";
}
return std::unique_ptr<reco::PFCandidatePtr>(new reco::PFCandidatePtr());
return std::make_unique<reco::PFCandidatePtr>();
}

std::unique_ptr<std::vector<reco::PFCandidatePtr> > convertToPFPtrs(const std::vector<reco::CandidatePtr>& cands) {
Expand Down
10 changes: 6 additions & 4 deletions EventFilter/HcalRawToDigi/plugins/HcalDigiToRawuHTR.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@

#include "PackerHelp.h"

#include <iostream>
#include <fstream>
#include <sstream>
#include <iostream>
#include <memory>

#include <sstream>
#include <string>

/* QUESTION: what about dual FED readout? */
Expand Down Expand Up @@ -249,8 +251,8 @@ void HcalDigiToRawuHTR::produce(edm::StreamID id, edm::Event& iEvent, const edm:
int fedId = FEDNumbering::MINHCALuTCAFEDID + crateId;
if (fedMap.find(fedId) == fedMap.end()) {
/* QUESTION: where should the orbit number come from? */
fedMap[fedId] = std::unique_ptr<HCalFED>(
new HCalFED(fedId, iEvent.id().event(), iEvent.orbitNumber(), iEvent.bunchCrossing()));
fedMap[fedId] = std::make_unique<HCalFED>(
fedId, iEvent.id().event(), iEvent.orbitNumber(), iEvent.bunchCrossing());
}
fedMap[fedId]->addUHTR(uhtr->second, crateId, slotId);
} // end loop over uhtr containers
Expand Down
4 changes: 2 additions & 2 deletions EventFilter/HcalRawToDigi/plugins/HcalLaserEventFilter2012.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ void HcalLaserEventFilter2012::addEventString(const string& eventString) {
unsigned int ls = 0;
unsigned int event = 0;
// Check that event list object is in correct form
size_t found = eventString.find(":"); // find first colon
size_t found = eventString.find(':'); // find first colon
if (found != std::string::npos)
run = atoi((eventString.substr(0, found)).c_str()); // convert to run
else {
edm::LogError("HcalLaserEventFilter2012")
<< " Unable to parse Event list input '" << eventString << "' for run number!";
return;
}
size_t found2 = eventString.find(":", found + 1); // find second colon
size_t found2 = eventString.find(':', found + 1); // find second colon
if (found2 != std::string::npos) {
/// Some event numbers are less than 0? \JetHT\Run2012C-v1\RAW:201278:2145:-2130281065 -- due to events being dumped out as ints, not uints!
ls = atoi((eventString.substr(found + 1, (found2 - found - 1))).c_str()); // convert to ls
Expand Down
6 changes: 5 additions & 1 deletion EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

#include "SiPixelRawToDigi.h"


#include <memory>


#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/ESTransientHandle.h"
Expand Down Expand Up @@ -73,7 +77,7 @@ SiPixelRawToDigi::SiPixelRawToDigi(const edm::ParameterSet& conf)
// Timing
bool timing = config_.getUntrackedParameter<bool>("Timing", false);
if (timing) {
theTimer.reset(new edm::CPUTimer);
theTimer = std::make_unique<edm::CPUTimer>();
hCPU = new TH1D("hCPU", "hCPU", 100, 0., 0.050);
hDigi = new TH1D("hDigi", "hDigi", 50, 0., 15000.);
}
Expand Down
4 changes: 2 additions & 2 deletions MagneticField/GeomBuilder/src/DD4hep_MagGeoBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ void MagGeoBuilder::build(const cms::DDDetector* det) {
buildMagVolumes(bVolumes_, bInterpolators);

// Build MagBLayers
for (auto ilay : layers) {
for (const auto& ilay : layers) {
mBLayers_.push_back(ilay.buildMagBLayer());
}
LogTrace("MagGeoBuilder") << "*** BARREL ********************************************" << newln
Expand All @@ -372,7 +372,7 @@ void MagGeoBuilder::build(const cms::DDDetector* det) {
buildMagVolumes(eVolumes_, eInterpolators);

// Build the MagESectors
for (auto isec : sectors) {
for (const auto& isec : sectors) {
mESectors_.push_back(isec.buildMagESector());
}
LogTrace("MagGeoBuilder") << "*** ENDCAP ********************************************" << newln
Expand Down
10 changes: 6 additions & 4 deletions RecoBTag/CTagging/src/CharmTagger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
#include "CondFormats/DataRecord/interface/GBRWrapperRcd.h"

#include <iostream>
#include <vector>
#include <memory>

#include <algorithm>
#include <map>
#include <iostream>
#include <map>
#include <vector>

CharmTagger::Tokens::Tokens(const edm::ParameterSet &configuration, edm::ESConsumesCollector &&cc) {
if (configuration.getParameter<bool>("useCondDB")) {
Expand All @@ -29,7 +31,7 @@ CharmTagger::CharmTagger(const edm::ParameterSet &configuration, Tokens tokens)
use_GBRForest_(configuration.getParameter<bool>("useGBRForest")),
use_adaBoost_(configuration.getParameter<bool>("useAdaBoost")),
defaultValueNoTracks_(configuration.getParameter<bool>("defaultValueNoTracks")),
tokens_{std::move(tokens)} {
tokens_{tokens} {
vpset vars_definition = configuration.getParameter<vpset>("variables");
for (auto &var : vars_definition) {
MVAVar mva_var;
Expand All @@ -49,7 +51,7 @@ CharmTagger::CharmTagger(const edm::ParameterSet &configuration, Tokens tokens)
}

void CharmTagger::initialize(const JetTagComputerRecord &record) {
mvaID_.reset(new TMVAEvaluator());
mvaID_ = std::make_unique<TMVAEvaluator>();

std::vector<std::string> variable_names;
variable_names.reserve(variables_.size());
Expand Down
6 changes: 3 additions & 3 deletions RecoBTag/Combined/plugins/BTagProbabilityToDiscriminator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,20 @@ class BTagProbabilityToDiscriminator : public edm::stream::EDProducer<> {
};

BTagProbabilityToDiscriminator::BTagProbabilityToDiscriminator(const edm::ParameterSet &iConfig) {
for (auto discriminator : iConfig.getParameter<vPSet>("discriminators")) {
for (const auto& discriminator : iConfig.getParameter<vPSet>("discriminators")) {
Discriminator current;
current.name = discriminator.getParameter<std::string>("name");
produces<JetTagCollection>(current.name);

for (auto intag : discriminator.getParameter<vInputTag>("numerator")) {
for (const auto& intag : discriminator.getParameter<vInputTag>("numerator")) {
if (jet_tags_.find(intag.encode()) == jet_tags_.end()) { // new
// probability
jet_tags_[intag.encode()] = consumes<JetTagCollection>(intag);
}
current.numerator.push_back(intag.encode());
}

for (auto intag : discriminator.getParameter<vInputTag>("denominator")) {
for (const auto& intag : discriminator.getParameter<vInputTag>("denominator")) {
if (jet_tags_.find(intag.encode()) == jet_tags_.end()) { // new
// probability
jet_tags_[intag.encode()] = consumes<JetTagCollection>(intag);
Expand Down
10 changes: 7 additions & 3 deletions RecoBTag/Combined/src/CandidateChargeBTagComputer.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#include "RecoBTag/Combined/interface/CandidateChargeBTagComputer.h"
#include <memory>



#include "RecoBTag/Combined/interface/CandidateChargeBTagComputer.h"

CandidateChargeBTagComputer::Tokens::Tokens(const edm::ParameterSet& parameters, edm::ESConsumesCollector&& cc) {
if (parameters.getParameter<bool>("useCondDB")) {
Expand All @@ -11,13 +15,13 @@ CandidateChargeBTagComputer::CandidateChargeBTagComputer(const edm::ParameterSet
useAdaBoost_(parameters.getParameter<bool>("useAdaBoost")),
jetChargeExp_(parameters.getParameter<double>("jetChargeExp")),
svChargeExp_(parameters.getParameter<double>("svChargeExp")),
tokens_{std::move(tokens)} {
tokens_{tokens} {
uses(0, "pfImpactParameterTagInfos");
uses(1, "pfInclusiveSecondaryVertexFinderCvsLTagInfos");
uses(2, "softPFMuonsTagInfos");
uses(3, "softPFElectronsTagInfos");

mvaID.reset(new TMVAEvaluator());
mvaID = std::make_unique<TMVAEvaluator>();
}

CandidateChargeBTagComputer::~CandidateChargeBTagComputer() {}
Expand Down
6 changes: 4 additions & 2 deletions RecoBTag/FeatureTools/plugins/DeepFlavourTagInfoProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@
#include "FWCore/Framework/interface/EventSetup.h"
#include "RecoBTag/TrackProbability/interface/HistogramProbabilityEstimator.h"
class HistogramProbabilityEstimator;
#include <typeinfo>
#include <memory>

#include "CondFormats/BTauObjects/interface/TrackProbabilityCalibration.h"
#include "CondFormats/DataRecord/interface/BTagTrackProbability2DRcd.h"
#include "CondFormats/DataRecord/interface/BTagTrackProbability3DRcd.h"
#include "FWCore/Framework/interface/EventSetupRecord.h"
#include "FWCore/Framework/interface/EventSetupRecordImplementation.h"
#include "FWCore/Framework/interface/EventSetupRecordKey.h"
#include <typeinfo>

class DeepFlavourTagInfoProducer : public edm::stream::EDProducer<> {
public:
Expand Down Expand Up @@ -463,7 +465,7 @@ void DeepFlavourTagInfoProducer::checkEventSetup(const edm::EventSetup& iSetup)
iSetup.get<BTagTrackProbability2DRcd>().get(calib2DHandle);
ESHandle<TrackProbabilityCalibration> calib3DHandle;
iSetup.get<BTagTrackProbability3DRcd>().get(calib3DHandle);
probabilityEstimator_.reset(new HistogramProbabilityEstimator(calib3DHandle.product(), calib2DHandle.product()));
probabilityEstimator_ = std::make_unique<HistogramProbabilityEstimator>(calib3DHandle.product(), calib2DHandle.product());
}

calibrationCacheId3D_ = cacheId3D;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void BTagPerformaceRootProducerFromSQLITE::analyze(const edm::Event& iEvent, con
if (!writer_.get()) {
edm::Service<TFileService> fs;
TFile* f = &(fs->file());
writer_ = std::unique_ptr<fwlite::RecordWriter>(new fwlite::RecordWriter(r.key().name(), f));
writer_ = std::make_unique<fwlite::RecordWriter>(r.key().name(), f);
}
lastValue_ = r.validityInterval().last();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -688,14 +688,14 @@ void TemplatedSecondaryVertexProducer<IPTI, VTX>::produce(edm::Event &event, con
std::unique_ptr<ConfigurableVertexReconstructor> vertexReco;
std::unique_ptr<GhostTrackVertexFinder> vertexRecoGT;
if (useGhostTrack)
vertexRecoGT.reset(
new GhostTrackVertexFinder(vtxRecoPSet.getParameter<double>("maxFitChi2"),
vertexRecoGT = std::make_unique<GhostTrackVertexFinder>(
vtxRecoPSet.getParameter<double>("maxFitChi2"),
vtxRecoPSet.getParameter<double>("mergeThreshold"),
vtxRecoPSet.getParameter<double>("primcut"),
vtxRecoPSet.getParameter<double>("seccut"),
getGhostTrackFitType(vtxRecoPSet.getParameter<std::string>("fitType"))));
getGhostTrackFitType(vtxRecoPSet.getParameter<std::string>("fitType")));
else
vertexReco.reset(new ConfigurableVertexReconstructor(vtxRecoPSet));
vertexReco = std::make_unique<ConfigurableVertexReconstructor>(vtxRecoPSet);

TransientTrackMap primariesMap;

Expand Down Expand Up @@ -742,7 +742,7 @@ void TemplatedSecondaryVertexProducer<IPTI, VTX>::produce(edm::Event &event, con
std::vector<GhostTrackState> gtStates;
std::unique_ptr<GhostTrackPrediction> gtPred;
if (useGhostTrack)
gtPred.reset(new GhostTrackPrediction(*iterJets->ghostTrack()));
gtPred = std::make_unique<GhostTrackPrediction>(*iterJets->ghostTrack());

for (unsigned int i = 0; i < indices.size(); i++) {
typedef typename TemplatedSecondaryVertexTagInfo<IPTI, VTX>::IndexedTrackData IndexedTrackData;
Expand Down Expand Up @@ -782,7 +782,7 @@ void TemplatedSecondaryVertexProducer<IPTI, VTX>::produce(edm::Event &event, con

std::unique_ptr<GhostTrack> ghostTrack;
if (useGhostTrack)
ghostTrack.reset(new GhostTrack(
ghostTrack = std::make_unique<GhostTrack>(
GhostTrackPrediction(
RecoVertex::convertPos(pv.position()),
RecoVertex::convertError(pv.error()),
Expand All @@ -791,7 +791,7 @@ void TemplatedSecondaryVertexProducer<IPTI, VTX>::produce(edm::Event &event, con
*gtPred,
gtStates,
iterJets->ghostTrack()->chi2(),
iterJets->ghostTrack()->ndof()));
iterJets->ghostTrack()->ndof());

// perform actual vertex finding

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#include "RecoBTag/SecondaryVertex/interface/CandidateBoostedDoubleSecondaryVertexComputer.h"
#include <memory>



#include "RecoBTag/SecondaryVertex/interface/CandidateBoostedDoubleSecondaryVertexComputer.h"

#include "FWCore/MessageLogger/interface/MessageLogger.h"

Expand All @@ -24,10 +28,10 @@ CandidateBoostedDoubleSecondaryVertexComputer::CandidateBoostedDoubleSecondaryVe
: edm::FileInPath()),
useGBRForest_(parameters.existsAs<bool>("useGBRForest") ? parameters.getParameter<bool>("useGBRForest") : false),
useAdaBoost_(parameters.existsAs<bool>("useAdaBoost") ? parameters.getParameter<bool>("useAdaBoost") : false),
tokens_{std::move(tokens)} {
tokens_{tokens} {
uses(0, "svTagInfos");

mvaID.reset(new TMVAEvaluator());
mvaID = std::make_unique<TMVAEvaluator>();
}

void CandidateBoostedDoubleSecondaryVertexComputer::initialize(const JetTagComputerRecord& record) {
Expand Down
8 changes: 5 additions & 3 deletions RecoBTag/SoftLepton/src/ElectronTagger.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include <limits>
#include <random>
#include <memory>

#include <random>

#include "CondFormats/DataRecord/interface/BTauGenericMVAJetTagComputerRcd.h"
#include "CondFormats/DataRecord/interface/GBRWrapperRcd.h"
Expand All @@ -25,9 +27,9 @@ ElectronTagger::ElectronTagger(const edm::ParameterSet& cfg, Tokens tokens)
: edm::FileInPath()),
m_useGBRForest(cfg.existsAs<bool>("useGBRForest") ? cfg.getParameter<bool>("useGBRForest") : false),
m_useAdaBoost(cfg.existsAs<bool>("useAdaBoost") ? cfg.getParameter<bool>("useAdaBoost") : false),
m_tokens{std::move(tokens)} {
m_tokens{tokens} {
uses("seTagInfos");
mvaID.reset(new TMVAEvaluator());
mvaID = std::make_unique<TMVAEvaluator>();
}

void ElectronTagger::initialize(const JetTagComputerRecord& record) {
Expand Down
8 changes: 5 additions & 3 deletions RecoBTag/SoftLepton/src/MuonTagger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
// * January 16, 2015

#include <limits>
#include <random>
#include <memory>

#include <random>

#include "RecoBTau/JetTagComputer/interface/JetTagComputerRecord.h"
#include "DataFormats/BTauReco/interface/SoftLeptonTagInfo.h"
Expand All @@ -26,9 +28,9 @@ MuonTagger::MuonTagger(const edm::ParameterSet& cfg, Tokens tokens)
: edm::FileInPath()),
m_useGBRForest(cfg.existsAs<bool>("useGBRForest") ? cfg.getParameter<bool>("useGBRForest") : false),
m_useAdaBoost(cfg.existsAs<bool>("useAdaBoost") ? cfg.getParameter<bool>("useAdaBoost") : false),
m_tokens{std::move(tokens)} {
m_tokens{tokens} {
uses("smTagInfos");
mvaID.reset(new TMVAEvaluator());
mvaID = std::make_unique<TMVAEvaluator>();
}

void MuonTagger::initialize(const JetTagComputerRecord& record) {
Expand Down
8 changes: 5 additions & 3 deletions RecoBTau/JetTagComputer/src/GenericMVAComputerCache.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include <string>
#include <vector>
#include <memory>

#include <memory>
#include <string>
#include <vector>

#include "CondFormats/PhysicsToolsObjects/interface/MVAComputer.h"
#include "RecoBTau/JetTagComputer/interface/GenericMVAComputer.h"
#include "RecoBTau/JetTagComputer/interface/GenericMVAComputerCache.h"
Expand Down Expand Up @@ -89,7 +91,7 @@ bool GenericMVAComputerCache::update(const MVAComputerContainer *calib) {
continue;

// instantiate new MVAComputer with uptodate calibration
iter->computer = std::unique_ptr<GenericMVAComputer>(new GenericMVAComputer(computerCalib));
iter->computer = std::make_unique<GenericMVAComputer>(computerCalib);

iter->cacheId = computerCalib->getCacheId();

Expand Down
Loading

0 comments on commit 1c330cc

Please sign in to comment.