Skip to content

Commit

Permalink
Merge pull request #40533 from aandvalenzuela/sim-clang14
Browse files Browse the repository at this point in the history
[SIMULATION][CLANG] Fix warnings reported by clang 14 IB
  • Loading branch information
cmsbuild committed Jan 16, 2023
2 parents a0ac635 + 38d44bf commit a920ba7
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 31 deletions.
16 changes: 11 additions & 5 deletions SimG4CMS/HcalTestBeam/plugins/HcalTB04Analysis.cc
Expand Up @@ -483,7 +483,9 @@ void HcalTB04Analysis::fillBuffer(const EndOfEvent* evt) {
int idHC, j;
CaloG4HitCollection* theHC;
std::map<int, float, std::less<int> > primaries;
#ifdef EDM_ML_DEBUG
double etot1 = 0, etot2 = 0;
#endif

// Look for the Hit Collection of HCal
G4HCofThisEvent* allHC = (*evt)()->GetHCofThisEvent();
Expand Down Expand Up @@ -521,8 +523,8 @@ void HcalTB04Analysis::fillBuffer(const EndOfEvent* evt) {
CaloHit hitl(det, layer, escl, eta, phi, jitter, id);
hhitl.push_back(hitl);
primaries[aHit->getTrackID()] += e;
etot1 += escl;
#ifdef EDM_ML_DEBUG
etot1 += escl;
edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Hcal Hit i/p " << j << " ID 0x" << std::hex << id << " 0x"
<< idx << std::dec << " time " << std::setw(6) << time << " " << std::setw(6)
<< jitter << " theta " << std::setw(8) << theta << " eta " << std::setw(8) << eta
Expand Down Expand Up @@ -558,9 +560,9 @@ void HcalTB04Analysis::fillBuffer(const EndOfEvent* evt) {
nhit++;
CaloHit hit(det, layer, ehit, eta, phi, jitter, unitID);
hcalHitCache.push_back(hit);
etot2 += ehit;
k1 += jump;
#ifdef EDM_ML_DEBUG
etot2 += ehit;
edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Hcal Hit store " << nhit << " ID 0x" << std::hex << unitID
<< std::dec << " time " << std::setw(6) << jitter << " eta " << std::setw(8) << eta
<< " phi " << std::setw(8) << phi << " e " << std::setw(8) << ehit;
Expand All @@ -576,7 +578,9 @@ void HcalTB04Analysis::fillBuffer(const EndOfEvent* evt) {
}
sort(hits.begin(), hits.end(), CaloHitIdMore());
int nhitl = 0;
#ifdef EDM_ML_DEBUG
double etotl = 0;
#endif
for (k1 = hits.begin(); k1 != hits.end(); k1++) {
int det = (**k1).det();
int layer = (**k1).layer();
Expand All @@ -593,7 +597,9 @@ void HcalTB04Analysis::fillBuffer(const EndOfEvent* evt) {
nhitl++;
CaloHit hit(det, layer, ehit, eta, phi, jitter, unitID);
hcalHitLayer.push_back(hit);
#ifdef EDM_ML_DEBUG
etotl += ehit;
#endif
k1 += jump;
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Hcal Hit store " << nhitl << " ID 0x" << std::hex << unitID
Expand All @@ -610,8 +616,8 @@ void HcalTB04Analysis::fillBuffer(const EndOfEvent* evt) {
sdName = names[1];
idHC = G4SDManager::GetSDMpointer()->GetCollectionID(sdName);
theHC = (CaloG4HitCollection*)allHC->GetHC(idHC);
etot1 = etot2 = 0;
#ifdef EDM_ML_DEBUG
etot1 = etot2 = 0;
edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Hit Collection for " << sdName << " of ID " << idHC
<< " is obtained at " << theHC << " with " << theHC->entries() << " entries";
#endif
Expand All @@ -635,8 +641,8 @@ void HcalTB04Analysis::fillBuffer(const EndOfEvent* evt) {
CaloHit hit(det, 0, e, eta, phi, time, id);
ehits.push_back(hit);
primaries[aHit->getTrackID()] += e;
etot1 += e;
#ifdef EDM_ML_DEBUG
etot1 += e;
edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Ecal Hit i/p " << j << " ID 0x" << std::hex << id
<< std::dec << " time " << std::setw(6) << time << " theta " << std::setw(8)
<< theta << " eta " << std::setw(8) << eta << " phi " << std::setw(8) << phi
Expand Down Expand Up @@ -670,9 +676,9 @@ void HcalTB04Analysis::fillBuffer(const EndOfEvent* evt) {
nhit++;
CaloHit hit(det, layer, ehit, eta, phi, jitter, unitID);
ecalHitCache.push_back(hit);
etot2 += ehit;
k1 += jump;
#ifdef EDM_ML_DEBUG
etot2 += ehit;
edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Ecal Hit store " << nhit << " ID 0x" << std::hex << unitID
<< std::dec << " time " << std::setw(6) << jitter << " eta " << std::setw(8) << eta
<< " phi " << std::setw(8) << phi << " e " << std::setw(8) << ehit;
Expand Down
Expand Up @@ -90,10 +90,8 @@ void HcalForwardLibWriter::analyze(const edm::Event& iEvent, const edm::EventSet
theTree->SetBranchAddress("primZ", &primZ); // added
int nentries = int(theTree->GetEntries());
int ngood = 0;
int nbytes = 0;
// cycle over showers ====================================================
for (int iev = 0; iev < nentries; iev++) {
nbytes += theTree->GetEntry(iev);
if (primZ < 990.)
continue; // exclude showers with interactions in front of HF (1m of air)
ngood++;
Expand Down
12 changes: 0 additions & 12 deletions SimMuon/RPCDigitizer/src/RPCSimSetUp.cc
Expand Up @@ -512,18 +512,6 @@ const std::vector<double>& RPCSimSetUp::getAsymmetricClsDistribution(uint32_t id
}
}

double control = 0;
for (int j = 0; j < distributionFewStrips; j++) {
control += sliceVsFewStripsDistribution[0][j];
}

double control1 = 0;
for (int j = 0; j < distributionFewStrips; j++) {
for (int i = 0; i < slices; i++) {
control1 += dataForAsymmCls[j * slices + i];
}
}

int i = slice;
double sum = 0;
int counter = 0;
Expand Down
Expand Up @@ -78,7 +78,7 @@ class VertexClassifierByProxy : public VertexClassifier {

// Combine OR the flag information
for (std::size_t i = 0; i < flags_.size(); ++i)
flags_[i] = flags_[i] | flags[i];
flags_[i] = flags_[i] || flags[i];
}

return *this;
Expand Down
6 changes: 3 additions & 3 deletions SimTracker/TrackHistory/src/TrackClassifier.cc
Expand Up @@ -7,9 +7,9 @@

#include "SimTracker/TrackHistory/interface/TrackClassifier.h"

#define update(a, b) \
do { \
(a) = (a) | (b); \
#define update(a, b) \
do { \
(a) = (a) || (b); \
} while (0)

TrackClassifier::TrackClassifier(edm::ParameterSet const &config, edm::ConsumesCollector &&collector)
Expand Down
6 changes: 3 additions & 3 deletions SimTracker/TrackHistory/src/VertexClassifier.cc
Expand Up @@ -10,9 +10,9 @@

#include "SimTracker/TrackHistory/interface/VertexClassifier.h"

#define update(a, b) \
do { \
(a) = (a) | (b); \
#define update(a, b) \
do { \
(a) = (a) || (b); \
} while (0)

VertexClassifier::VertexClassifier(edm::ParameterSet const &config, edm::ConsumesCollector collector)
Expand Down
Expand Up @@ -680,11 +680,6 @@ void TMultiDimFet::MakeCandidates() {
// Number of funcs selected
Int_t numberFunctions = 0;

// Absolute max number of functions
Int_t maxNumberFunctions = 1;
for (i = 0; i < fNVariables; i++)
maxNumberFunctions *= fMaxPowers[i];

while (kTRUE) {
// Get the control value for this function
Double_t s = EvalControl(iv);
Expand Down

0 comments on commit a920ba7

Please sign in to comment.