Skip to content
Snippets Groups Projects
Commit 9adb0522 authored by scott snyder's avatar scott snyder Committed by scott snyder
Browse files

ZdcRec: Fix cppcheck warnings.

 - Prohibit copying of class owning memory.
 - Prefer pre-increment (or range-for) to postincrement.
parent 769f4e91
No related branches found
No related tags found
No related merge requests found
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
/*
......@@ -18,6 +18,10 @@ class ZdcSignalSinc {
ZdcSignalSinc(int);
~ZdcSignalSinc();
ZdcSignalSinc(const ZdcSignalSinc&) = delete;
ZdcSignalSinc& operator= (const ZdcSignalSinc&) = delete;
int process(double *,double gain=1., double ped=0.,
double frac=1., bool corr=true);
int getError();
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
/*
......@@ -153,7 +153,7 @@ StatusCode ZdcRec::execute()
// SG has the ownership of m_rawCollection, and it should be copyed intead of just
// being passed around.
for (iter=tmpCollection->begin();iter!=tmpCollection->end();iter++) {
for (iter=tmpCollection->begin();iter!=tmpCollection->end();++iter) {
m_rawCollection->push_back(*iter);
}
......
......@@ -289,10 +289,10 @@ int ZdcRecChannelTool::makeRawFromDigits(
//We need to be carefull. Sometimes the vector size here is zero (PPM flaw) and
//the code crashs if we do not treat this.
i = 0;
for (vit = wfm.begin(); vit<wfm.end(); vit++) {
for (vit = wfm.begin(); vit<wfm.end(); ++vit) {
if (vit->size() == 0) vit->resize(7);
ped = *vit->begin();
for (it=vit->begin(); it<vit->end();it++) {
for (it=vit->begin(); it<vit->end();++it) {
(*it) -= ped;
//if ((i==1) || (i==3) ) (*it) = (*it) * s_GAIN_RATIO;
}
......@@ -356,7 +356,7 @@ int ZdcRecChannelTool::makeRawFromDigits(
/// Traditional code bellow (Energy by peak or sum,
/// time by ratio of samples
//////////////////////////////////////////////////
for (vit = wfm.begin(); vit<wfm.end(); vit++) {
for (vit = wfm.begin(); vit<wfm.end(); ++vit) {
v = *vit;
soma = std::accumulate(v.begin(), v.end(), 0) ;
pico = *(std::max_element(v.begin(),v.end()) );
......@@ -400,7 +400,7 @@ int ZdcRecChannelTool::makeRawFromDigits(
" m=" << m <<
" Time by CFD=" << tzc <<
" Peak at imax = " << imax <<
" v[imax-1] = " << v[imax-1] <<
" v[imax-1] = " << (imax > 0 ? v[imax-1] : 0) <<
" V[imax] = " << v[imax] <<
" Sample Ratio A1/A2=" << tsr << endmsg;
k++;
......@@ -528,10 +528,10 @@ int ZdcRecChannelTool::getTimingCFD(const Identifier& id, const std::vector<std
vf[i] = 0.;
}
for (vit = wfm.begin(); vit<wfm.end(); vit++) {
for (vit = wfm.begin(); vit<wfm.end(); ++vit) {
y = *vit;
i = 4;
for (it=y.begin();it != y.end();it++) {
for (it=y.begin();it != y.end();++it) {
v[i] = *it;
i++;
}
......@@ -679,7 +679,7 @@ int ZdcRecChannelTool::getTimingSinc(const Identifier& id, const std::vector<st
<< mType << ";"
<< mChannel << endmsg;
for (vvi_it = wfm.begin(); vvi_it<wfm.end(); vvi_it++) {
for (vvi_it = wfm.begin(); vvi_it<wfm.end(); ++vvi_it) {
//FIXME: Change to the method of ID identification
//if ((zId == 0xec000000) || (zId == 0xed000000) ||
// (zId == 0xec200000) || (zId == 0xed200000) ||
......@@ -692,7 +692,7 @@ int ZdcRecChannelTool::getTimingSinc(const Identifier& id, const std::vector<st
t = 0;
//Fill the interpolated vector
for (vf_it = m_wfm_bwl.begin(); vf_it != m_wfm_bwl.end(); vf_it++ ) {
for (vf_it = m_wfm_bwl.begin(); vf_it != m_wfm_bwl.end(); ++vf_it ) {
z = 0.;
for (i=0;i<m_nsamples;i++) {
x = (TMath::Pi() *(t*0.1 - i*25.))/25. ;
......@@ -817,7 +817,7 @@ int ZdcRecChannelTool::getTimingSinc2(const Identifier& id, const std::vector<st
//from only a subset
wfmIndex = 2;
i = 0;
for (vit = wfm.begin(); vit<wfm.end(); vit++) {
for (vit = wfm.begin(); vit<wfm.end(); ++vit) {
if ( (i < wfmIndex) && (mType == 0) )
{
y = *vit;
......
......@@ -119,17 +119,14 @@ int ZdcRecChannelToolV2::convertTT2ZM(const xAOD::TriggerTowerContainer* ttColle
hashmapType digits_map;
Identifier chan_id;
xAOD::TriggerTowerContainer::const_iterator tt_itr = ttCollection->begin();
xAOD::TriggerTowerContainer::const_iterator tt_end = ttCollection->end();
//std::cout << "Zdc TT's have " << ttCollection->size() << " towers" << std::endl;
for (;tt_itr != tt_end;tt_itr++)
for (const xAOD::TriggerTower* tt : *ttCollection)
{
//std::cout << "ZdcTT coolId = " << (*tt_itr)->coolId() << std::endl;
//std::cout << ZdcToString(*(*tt_itr)) << std::endl;
//std::cout << "ZdcTT coolId = " << tt->coolId() << std::endl;
//std::cout << ZdcToString(*tt) << std::endl;
uint32_t coolId = (*tt_itr)->coolId();
uint32_t coolId = tt->coolId();
uint32_t pin = (coolId>>8) & 0xf;
uint32_t asic = coolId & 0xf;
uint32_t slinkChannel = asic*16 + pin;
......@@ -173,10 +170,10 @@ int ZdcRecChannelToolV2::convertTT2ZM(const xAOD::TriggerTowerContainer* ttColle
(*iter).second->setType(m_zdcId->type(chan_id));
(*iter).second->setChannel(m_zdcId->channel(chan_id));
//std::cout << "Trying to set element links of " << chan_id << std::dec << std::endl;
if (gain==0&&delay==0) (*iter).second->setTTg0d0Link( ElementLink<xAOD::TriggerTowerContainer_v2> ((*tt_itr),*ttCollection ) );
if (gain==0&&delay==1) (*iter).second->setTTg0d1Link( ElementLink<xAOD::TriggerTowerContainer_v2> ((*tt_itr),*ttCollection ) );
if (gain==1&&delay==0) (*iter).second->setTTg1d0Link( ElementLink<xAOD::TriggerTowerContainer_v2> ((*tt_itr),*ttCollection ) );
if (gain==1&&delay==1) (*iter).second->setTTg1d1Link( ElementLink<xAOD::TriggerTowerContainer_v2> ((*tt_itr),*ttCollection ) );
if (gain==0&&delay==0) (*iter).second->setTTg0d0Link( ElementLink<xAOD::TriggerTowerContainer_v2> (tt,*ttCollection ) );
if (gain==0&&delay==1) (*iter).second->setTTg0d1Link( ElementLink<xAOD::TriggerTowerContainer_v2> (tt,*ttCollection ) );
if (gain==1&&delay==0) (*iter).second->setTTg1d0Link( ElementLink<xAOD::TriggerTowerContainer_v2> (tt,*ttCollection ) );
if (gain==1&&delay==1) (*iter).second->setTTg1d1Link( ElementLink<xAOD::TriggerTowerContainer_v2> (tt,*ttCollection ) );
}
}
......@@ -188,7 +185,7 @@ int ZdcRecChannelToolV2::convertTT2ZM(const xAOD::TriggerTowerContainer* ttColle
hashmapType::iterator iter = digits_map.begin();
hashmapType::iterator iter_end = digits_map.end();
for (;iter != iter_end;iter++)
for (;iter != iter_end;++iter)
{
makeWaveformFromDigits( *((*iter).second) );
}
......@@ -345,7 +342,7 @@ int ZdcRecChannelToolV2::splitWaveform(std::map<int,float>& waveform, std::vecto
adcs.clear();
std::map<int,float>::const_iterator wf_it = waveform.begin();
std::map<int,float>::const_iterator wf_end = waveform.end();
for (;wf_it != wf_end;wf_it++)
for (;wf_it != wf_end;++wf_it)
{
//std::cout << iwf++ << "t=" << (*wf_it).first << " a=" << (*wf_it).second << std::endl;
times.push_back((*wf_it).first / 10. ); // convert back to ns
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment