Skip to content

Commit

Permalink
Merge pull request #30801 from cms-sw/apply-new-ct-checks-for-hlt
Browse files Browse the repository at this point in the history
[Clang tidy] Apply checks for hlt
  • Loading branch information
cmsbuild authored Jul 18, 2020
2 parents c5e3cab + 94761e5 commit 740b926
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 30 deletions.
6 changes: 3 additions & 3 deletions HLTrigger/JetMET/plugins/HLTScoutingCaloProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,16 @@ void HLTScoutingCaloProducer::produce(edm::StreamID sid, edm::Event& iEvent, edm
Handle<double> rho;
std::unique_ptr<double> outRho(new double(-999));
if (iEvent.getByToken(rho_, rho)) {
outRho.reset(new double(*rho));
outRho = std::make_unique<double>(*rho);
}

//get MET
Handle<reco::CaloMETCollection> metCollection;
std::unique_ptr<double> outMetPt(new double(-999));
std::unique_ptr<double> outMetPhi(new double(-999));
if (doMet && iEvent.getByToken(metCollection_, metCollection)) {
outMetPt.reset(new double(metCollection->front().pt()));
outMetPhi.reset(new double(metCollection->front().phi()));
outMetPt = std::make_unique<double>(metCollection->front().pt());
outMetPhi = std::make_unique<double>(metCollection->front().phi());
}

//put output
Expand Down
6 changes: 3 additions & 3 deletions HLTrigger/JetMET/plugins/HLTScoutingPFProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,16 @@ void HLTScoutingPFProducer::produce(edm::StreamID sid, edm::Event &iEvent, edm::
Handle<double> rho;
std::unique_ptr<double> outRho(new double(-999));
if (iEvent.getByToken(rho_, rho)) {
outRho.reset(new double(*rho));
outRho = std::make_unique<double>(*rho);
}

//get MET
Handle<reco::PFMETCollection> metCollection;
std::unique_ptr<double> outMetPt(new double(-999));
std::unique_ptr<double> outMetPhi(new double(-999));
if (doMet && iEvent.getByToken(metCollection_, metCollection)) {
outMetPt.reset(new double(metCollection->front().pt()));
outMetPhi.reset(new double(metCollection->front().phi()));
outMetPt = std::make_unique<double>(metCollection->front().pt());
outMetPhi = std::make_unique<double>(metCollection->front().phi());
}

//get PF candidates
Expand Down
2 changes: 1 addition & 1 deletion HLTrigger/JetMET/plugins/PixelJetPuId.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ void PixelJetPuId::produce(edm::StreamID sid, edm::Event& iEvent, const edm::Eve
//init JetTagCollection
if (!generaljets.product()->empty()) {
edm::RefToBase<reco::Jet> jj = edm::RefToBase<reco::Jet>(generaljets, 0);
pOut_jetTagCollection.reset(new reco::JetTagCollection(edm::makeRefToBaseProdFrom(jj, iEvent)));
pOut_jetTagCollection = std::make_unique<reco::JetTagCollection>(edm::makeRefToBaseProdFrom(jj, iEvent));
}

//loop on trackIPTagInfos
Expand Down
32 changes: 16 additions & 16 deletions HLTrigger/Tools/bin/hltTimingSummary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,16 +787,16 @@ int main(int argc, char** argv) {
std::string skipped;
getline(filterFile, skipped);
//--- Special: remove any trailing whitespace ---//
size_t spos = skipped.find_first_not_of(" ");
size_t epos = skipped.find_last_not_of(" ");
size_t spos = skipped.find_first_not_of(' ');
size_t epos = skipped.find_last_not_of(' ');
if (spos != std::string::npos && epos != std::string::npos) {
skipped = skipped.substr(spos, epos);
squareOne.push_back(skipped);
}
}
} else { //--- Assume the file is a comma-separated list of modules ---//
size_t strStart = 0;
for (size_t itr = startHere.find(",", 0); itr != std::string::npos; itr = startHere.find(",", itr)) {
for (size_t itr = startHere.find(',', 0); itr != std::string::npos; itr = startHere.find(',', itr)) {
std::string skipped = startHere.substr(strStart, (itr - strStart));
itr++;
strStart = itr;
Expand All @@ -815,16 +815,16 @@ int main(int argc, char** argv) {
std::string skipped;
getline(excludeModFile, skipped);
//--- Special: remove any trailing whitespace ---//
size_t spos = skipped.find_first_not_of(" ");
size_t epos = skipped.find_last_not_of(" ");
size_t spos = skipped.find_first_not_of(' ');
size_t epos = skipped.find_last_not_of(' ');
if (spos != std::string::npos && epos != std::string::npos) {
skipped = skipped.substr(spos, epos + 1);
skipTimingMod.push_back(skipped);
}
}
} else { //--- Assume the file is a comma-separated list of modules ---//
size_t strStart = 0;
for (size_t itr = excludeModName.find(",", 0); itr != std::string::npos; itr = excludeModName.find(",", itr)) {
for (size_t itr = excludeModName.find(',', 0); itr != std::string::npos; itr = excludeModName.find(',', itr)) {
std::string skipped = excludeModName.substr(strStart, (itr - strStart));
itr++;
strStart = itr;
Expand All @@ -844,16 +844,16 @@ int main(int argc, char** argv) {
std::string skipped;
getline(excludePathFile, skipped);
//--- Special: remove any trailing whitespace ---//
size_t spos = skipped.find_first_not_of(" ");
size_t epos = skipped.find_last_not_of(" ");
size_t spos = skipped.find_first_not_of(' ');
size_t epos = skipped.find_last_not_of(' ');
if (spos != std::string::npos && epos != std::string::npos) {
skipped = skipped.substr(spos, epos + 1);
skipTimingPath.push_back(skipped);
}
}
} else { //--- Assume the file is a comma-separated list of paths ---//
size_t strStart = 0;
for (size_t itr = excludePathName.find(",", 0); itr != std::string::npos; itr = excludePathName.find(",", itr)) {
for (size_t itr = excludePathName.find(',', 0); itr != std::string::npos; itr = excludePathName.find(',', itr)) {
std::string skipped = excludePathName.substr(strStart, (itr - strStart));
itr++;
strStart = itr;
Expand All @@ -873,16 +873,16 @@ int main(int argc, char** argv) {
std::string modname;
getline(modPrintFile, modname);
//--- Special: remove any trailing whitespace ---//
size_t spos = modname.find_first_not_of(" ");
size_t epos = modname.find_last_not_of(" ");
size_t spos = modname.find_first_not_of(' ');
size_t epos = modname.find_last_not_of(' ');
if (spos != std::string::npos && epos != std::string::npos) {
modname = modname.substr(spos, epos + 1);
modInterested.push_back(modname);
}
}
} else { //--- Assume the file is a comma-separated list of modules ---//
size_t strStart = 0;
for (size_t itr = modPrintName.find(",", 0); itr != std::string::npos; itr = modPrintName.find(",", itr)) {
for (size_t itr = modPrintName.find(',', 0); itr != std::string::npos; itr = modPrintName.find(',', itr)) {
std::string modname = modPrintName.substr(strStart, (itr - strStart));
itr++;
strStart = itr;
Expand All @@ -899,10 +899,10 @@ int main(int argc, char** argv) {
unsigned int strStart = 0;
numberOfspecificTotalTime = 0;

for (size_t itr = strSpecificTotalTime.find("A", 0); itr != std::string::npos;
itr = strSpecificTotalTime.find("A", itr)) {
for (size_t itr = strSpecificTotalTime.find('A', 0); itr != std::string::npos;
itr = strSpecificTotalTime.find('A', itr)) {
std::string strSpecificTimePair = strSpecificTotalTime.substr(strStart, (itr - strStart));
size_t commaPos = strSpecificTimePair.find(",", 0);
size_t commaPos = strSpecificTimePair.find(',', 0);
std::pair<double, double> specificTimePair;
specificTimePair.first = atof(strSpecificTimePair.substr(0, commaPos).c_str());
specificTimePair.second =
Expand All @@ -914,7 +914,7 @@ int main(int argc, char** argv) {
}
//--- Fill the last entry ---//
std::string strSpecificTimePair = strSpecificTotalTime.substr(strStart, strSpecificTotalTime.length() - strStart);
size_t commaPos = strSpecificTimePair.find(",", 0);
size_t commaPos = strSpecificTimePair.find(',', 0);
std::pair<double, double> specificTimePair;
specificTimePair.first = atof(strSpecificTimePair.substr(0, commaPos).c_str());
specificTimePair.second =
Expand Down
4 changes: 2 additions & 2 deletions HLTrigger/btau/plugins/ConeIsolation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ void ConeIsolation::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
std::unique_ptr<reco::IsolatedTauTagInfoCollection> extCollection(new reco::IsolatedTauTagInfoCollection());
if (not jetTracksAssociation->empty()) {
RefToBaseProd<reco::Jet> prod(edm::makeRefToBaseProdFrom(jetTracksAssociation->begin()->first, iEvent));
tagCollection.reset(new reco::JetTagCollection(prod));
tagCollection = std::make_unique<reco::JetTagCollection>(prod);
} else {
tagCollection.reset(new reco::JetTagCollection());
tagCollection = std::make_unique<reco::JetTagCollection>();
}

Vertex::Error e;
Expand Down
2 changes: 1 addition & 1 deletion HLTrigger/btau/plugins/HLTDisplacedmumuFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ bool HLTDisplacedmumuFilter::hltFilter(edm::Event& iEvent,
bool triggered = false;

// loop over vertex collection
for (auto displacedVertex : displacedVertexColl) {
for (const auto& displacedVertex : displacedVertexColl) {
// check if the vertex actually consists of exactly two muon tracks, throw exception if not
if (displacedVertex.tracksSize() != 2)
throw cms::Exception("BadLogic") << "HLTDisplacedmumuFilter: ERROR: the Jpsi vertex must have exactly two muons "
Expand Down
2 changes: 1 addition & 1 deletion HLTrigger/btau/plugins/HLTDisplacedmumumuFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ bool HLTDisplacedmumumuFilter::hltFilter(edm::Event& iEvent,
bool triggered = false;

// loop over vertex collection
for (auto displacedVertex : displacedVertexColl) {
for (const auto& displacedVertex : displacedVertexColl) {
// check if the vertex actually consists of exactly two muon tracks, throw exception if not
if (displacedVertex.tracksSize() != 3)
throw cms::Exception("BadLogic") << "HLTDisplacedmumumuFilter: ERROR: the Jpsi vertex must have exactly three "
Expand Down
2 changes: 1 addition & 1 deletion HLTrigger/btau/plugins/HLTDisplacedtktkFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ bool HLTDisplacedtktkFilter::hltFilter(edm::Event& iEvent,
bool triggered = false;

// loop over vertex collection
for (auto displacedVertex : displacedVertexColl) {
for (const auto& displacedVertex : displacedVertexColl) {
// check if the vertex actually consists of exactly two track tracks, reject the event if not
if (displacedVertex.tracksSize() != 2) {
edm::LogError("HLTDisplacedtktkFilter") << "HLTDisplacedtktkFilter: ERROR: the Jpsi vertex must have exactly two "
Expand Down
6 changes: 4 additions & 2 deletions RecoTauTag/HLTProducers/src/L2TauPixelIsoTagProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// Created: 2012-03-07
//

#include <memory>

#include "RecoTauTag/HLTProducers/interface/L2TauPixelIsoTagProducer.h"

#include "FWCore/Framework/interface/Event.h"
Expand Down Expand Up @@ -50,9 +52,9 @@ void L2TauPixelIsoTagProducer::produce(edm::StreamID sid, edm::Event& ev, const
// define the product to store
unique_ptr<JetTagCollection> jetTagCollection;
if (jets.empty()) {
jetTagCollection.reset(new JetTagCollection());
jetTagCollection = std::make_unique<JetTagCollection>();
} else {
jetTagCollection.reset(new JetTagCollection(RefToBaseProd<Jet>(jets_h)));
jetTagCollection = std::make_unique<JetTagCollection>(RefToBaseProd<Jet>(jets_h));
}
// by default, initialize all the jets as isolated:
for (const auto& jet : jets)
Expand Down

0 comments on commit 740b926

Please sign in to comment.