Commit 4fe6f0a7 authored by scott snyder's avatar scott snyder Committed by scott snyder
Browse files

TrigT1CaloCalibTools: Fix cppcheck warnings.

 - Don't use postincrement for iterator classes.  Prefer range-for.
 - Don't pass large objects by value.
 
parent 09a746db
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
//*************************************************************
......@@ -57,7 +57,7 @@ public:
const std::string& pathInRootFile);
inline ~L1CaloPprEtCorrelationPlotManager() {};
inline void SetCaloCellContainer(std::string name) {m_caloCellContainerName = name;}
inline void SetCaloCellContainer(const std::string& name) {m_caloCellContainerName = name;}
// retrieve calo cell container for offline monitoring
// for online monitoring set map of cell energies for every tower
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
// ********************************************************
......@@ -110,7 +110,7 @@ public:
StatusCode Fill(const unsigned int ns_step, const unsigned int adc);
StatusCode Fill(const unsigned int timeSlice, const unsigned int rodHeaderStep, const int adc);
StatusCode Fill(const unsigned int rodHeaderStep, const std::vector<int> adc);
StatusCode Fill(const unsigned int rodHeaderStep, const std::vector<int>& adc);
StatusCode Finalize(void);
......@@ -248,8 +248,8 @@ private:
bool IsSignalSaturated(TH1* histo, const unsigned int saturationPoint) const;
void CheckRisingSlope(TH1* histo, unsigned int peakBin, float peakValue);
std::string GetPlotName(const std::string base, const L1CaloCoolChannelId& coolId) const;
std::string GetPlotTitle(const std::string base, const L1CaloCoolChannelId& coolId) const;
std::string GetPlotName(const std::string& base, const L1CaloCoolChannelId& coolId) const;
std::string GetPlotTitle(const std::string& base, const L1CaloCoolChannelId& coolId) const;
std::string CoolIdToString(const L1CaloCoolChannelId& coolId) const;
};
......
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
// ********************************************************
......@@ -88,7 +88,7 @@ public:
void SetMinimumSignalHeight(const unsigned int min){m_minSignalHeight=min;};
unsigned int GetMinimumSignalHeight(void) const {return m_minSignalHeight;};
void SetTimingRegime(const std::string regime){m_timingRegime = regime;};
void SetTimingRegime(const std::string& regime){m_timingRegime = regime;};
std::string GetTimingRegime(void) const {return m_timingRegime;};
void SetHistogramTool(ToolHandle<LVL1::TrigT1CaloLWHistogramTool>& histTool){m_histTool = &histTool;};
......@@ -110,7 +110,7 @@ public:
StatusCode Fill(const L1CaloCoolChannelId& coolId,const unsigned int ns_step,const unsigned int adc);
StatusCode Fill(const L1CaloCoolChannelId& coolId,const unsigned int timeSlice,const unsigned int rodHeaderStep,const int adc);
StatusCode Fill(const L1CaloCoolChannelId& coolId,const unsigned int rodHeaderStep,const std::vector<int> adc);
StatusCode Fill(const L1CaloCoolChannelId& coolId,const unsigned int rodHeaderStep,const std::vector<int>& adc);
StatusCode Finalize ATLAS_NOT_REENTRANT(void);
......@@ -137,7 +137,7 @@ public:
void SetRunNumber(const unsigned int runNumber){m_runNumber=runNumber;std::stringstream ss;ss.width(8);ss.fill('0');ss<<m_runNumber;ss>>m_runNumberStr;};
unsigned int GetRunNumber(void){return m_runNumber;};
void SetOutputDirectoryName(std::string name){m_outputFileDirName = name;};
void SetOutputDirectoryName(const std::string& name){m_outputFileDirName = name;};
std::string GetOutputDirectoryName(void){return m_outputFileDirName;};
void SetTileRun(bool value = true){m_isTileRun = value;};
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
//*************************************************************
......@@ -117,6 +117,9 @@ protected:
const std::string& monitoringDimension);
virtual ~L1CaloPprPlotManager();
L1CaloPprPlotManager (const L1CaloPprPlotManager&) = delete;
L1CaloPprPlotManager& operator= (const L1CaloPprPlotManager&) = delete;
// Getting the value that is supposed to be monitored,
// e.g. fine time, pedestal, ...
// makes this class an abstract base class to be further defined
......
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#include "TrigT1CaloCalibTools/L1CaloPprEtCorrelationPlotManager.h"
......@@ -101,8 +101,6 @@ StatusCode L1CaloPprEtCorrelationPlotManager::getCaloCells()
double L1CaloPprEtCorrelationPlotManager::getMonitoringValue(const xAOD::TriggerTower* trigTower, CalLayerEnum /*theLayer*/)
{
std::vector<float> CaloEnergyLayers;
std::vector<float> CaloETLayers;
float caloEnergy = 0.;
float ttCpEnergy = trigTower->cpET()*0.5;
float absEta = fabs(trigTower->eta() );
......@@ -110,18 +108,16 @@ double L1CaloPprEtCorrelationPlotManager::getMonitoringValue(const xAOD::Trigger
if (ttCpEnergy <= m_EtMin) return -1000.;
if (absEta < 3.2){
if ( trigTower->isAvailable< std::vector<float> > ("CaloCellEnergyByLayer") ) {
CaloEnergyLayers = trigTower->auxdataConst< std::vector<float> > ("CaloCellEnergyByLayer");
for (std::vector<float>::iterator it = CaloEnergyLayers.begin(); it != CaloEnergyLayers.end(); it++) {
caloEnergy += *it;
for (float e : trigTower->auxdataConst< std::vector<float> > ("CaloCellEnergyByLayer")) {
caloEnergy += e;
}
caloEnergy = caloEnergy / cosh( trigTower->eta() );
}
}//for central region only
else {
if( trigTower->isAvailable< std::vector<float> > ("CaloCellETByLayer") ){
CaloETLayers = trigTower->auxdataConst< std::vector<float> > ("CaloCellETByLayer");
for (std::vector<float>::iterator it = CaloETLayers.begin(); it != CaloETLayers.end(); it++){
caloEnergy += *it;
for (float et : trigTower->auxdataConst< std::vector<float> > ("CaloCellETByLayer")) {
caloEnergy += et;
}
}
}//forward region
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
// ********************************************************
......@@ -118,7 +118,7 @@ StatusCode L1CaloPprPhos4Shape::Fill(const unsigned int timeSlice,const unsigned
/// values, which should only contain as many entries as there are
/// ADC time slices since I use the vector to determine the number
/// of time slices
StatusCode L1CaloPprPhos4Shape::Fill(const unsigned int rodHeaderStep,const std::vector<int> adc){
StatusCode L1CaloPprPhos4Shape::Fill(const unsigned int rodHeaderStep,const std::vector<int>& adc){
const unsigned int phos4step = rodHeaderStep % NANOSEC_PER_LHC_CLOCK_TICK;
for(unsigned int timeSlice = 0;timeSlice < adc.size();++timeSlice){
......@@ -503,12 +503,12 @@ void L1CaloPprPhos4Shape::CheckRisingSlope(TH1* histo,unsigned int peakBin,float
}
std::string L1CaloPprPhos4Shape::GetPlotName(const std::string base, const L1CaloCoolChannelId& coolId) const{
std::string L1CaloPprPhos4Shape::GetPlotName(const std::string& base, const L1CaloCoolChannelId& coolId) const{
std::string tempStr = base + "_" + CoolIdToString(coolId);
return tempStr;
}
std::string L1CaloPprPhos4Shape::GetPlotTitle(const std::string base, const L1CaloCoolChannelId& coolId) const{
std::string L1CaloPprPhos4Shape::GetPlotTitle(const std::string& base, const L1CaloCoolChannelId& coolId) const{
std::string tempStr = base + " " + CoolIdToString(coolId);
return tempStr;
}
......
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#include "TrigT1CaloCalibTools/L1CaloPprPhos4ShapeCollection.h"
......@@ -222,7 +222,7 @@ StatusCode L1CaloPprPhos4ShapeCollection::Fill(const L1CaloCoolChannelId& coolId
}
StatusCode L1CaloPprPhos4ShapeCollection::Fill(const L1CaloCoolChannelId& coolId, const unsigned int rodHeaderStep, const std::vector<int> adc) {
StatusCode L1CaloPprPhos4ShapeCollection::Fill(const L1CaloCoolChannelId& coolId, const unsigned int rodHeaderStep, const std::vector<int>& adc) {
ShapesMap_itr itr = GetMapIterator(coolId);
if (itr == m_signalShapes->end()) {
*m_log << MSG::WARNING << "[Fill] no iterator returned for 0x" << CoolIdToString(coolId) << endmsg;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment