From 70d9d290ef1b57b624783ff32f2b9abffed04b18 Mon Sep 17 00:00:00 2001 From: Salavat Date: Tue, 20 Jul 2021 12:08:10 +0200 Subject: [PATCH] clang warning fix --- .../plugins/HcalForwardLibWriter.cc | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/SimG4CMS/ShowerLibraryProducer/plugins/HcalForwardLibWriter.cc b/SimG4CMS/ShowerLibraryProducer/plugins/HcalForwardLibWriter.cc index 539022904c5fb..7a596ce778b1e 100644 --- a/SimG4CMS/ShowerLibraryProducer/plugins/HcalForwardLibWriter.cc +++ b/SimG4CMS/ShowerLibraryProducer/plugins/HcalForwardLibWriter.cc @@ -48,12 +48,19 @@ void HcalForwardLibWriter::analyze(const edm::Event& iEvent, const edm::EventSet TFile* theFile = new TFile(fn.c_str(), "READ"); TTree* theTree = (TTree*)gDirectory->Get("g4SimHits/CherenkovPhotons"); int nphot = 0; - float x[nshowers] = {0.}; - float y[nshowers] = {0.}; - float z[nshowers] = {0.}; - float t[nshowers] = {0.}; - float lambda[nshowers] = {0.}; - int fiberId[nshowers] = {0}; + + const int size = 10000; + if (nshowers > size) { + edm::LogError("HcalForwardLibWriter") << "Too big Nshowers number"; + return; + } + + float x[size] = {0.}; + float y[size] = {0.}; + float z[size] = {0.}; + float t[size] = {0.}; + float lambda[size] = {0.}; + int fiberId[size] = {0}; float primZ; // added theTree->SetBranchAddress("nphot", &nphot);