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

TBRec: Fix cppcheck warnings.

Fix cppcheck warnings + some general cleanup.
parent b3a8609a
6 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!42064TBRec: Fix cppcheck warnings.
Showing
with 126 additions and 194 deletions
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TBREC_CBNTAA_BEAMINSTRUMENTATION_H
......@@ -10,19 +10,18 @@
#include <string>
#include <vector>
class StoreGateSvc;
class CBNTAA_BeamInstrumentation : public CBNT_TBRecBase
{
public:
CBNTAA_BeamInstrumentation(const std::string & name, ISvcLocator * pSvcLocator);
~CBNTAA_BeamInstrumentation();
virtual ~CBNTAA_BeamInstrumentation();
//standart algorithm methods
virtual StatusCode CBNT_initialize();
virtual StatusCode CBNT_execute();
virtual StatusCode CBNT_finalize();
virtual StatusCode CBNT_initialize() override;
virtual StatusCode CBNT_execute() override;
virtual StatusCode CBNT_finalize() override;
private:
......@@ -56,7 +55,7 @@ class CBNTAA_BeamInstrumentation : public CBNT_TBRecBase
//but omitts characters that are problematic for root like -+:*/
std::string add_name(const char* base, const std::string extension);
StatusCode CBNT_clear();
virtual StatusCode CBNT_clear() override;
};
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#include "CBNTAA_TBADCRaw.h"
......@@ -49,10 +49,7 @@ StatusCode CBNTAA_TBADCRaw::CBNT_execute()
m_adc->resize(nADC);
unsigned NtupleVectorIndex = 0;
TBADCRawCont::const_iterator it_adc = adcCont->begin();
TBADCRawCont::const_iterator last_adc = adcCont->end();
for(;it_adc!=last_adc;it_adc++,NtupleVectorIndex++) {
const TBADCRaw * adc = (*it_adc);
for (const TBADCRaw* adc : *adcCont) {
(*m_adc)[NtupleVectorIndex] = adc->getADC();
}
}
......@@ -74,7 +71,7 @@ StatusCode CBNTAA_TBADCRaw::CBNT_finalize()
return StatusCode::SUCCESS;
}
std::string CBNTAA_TBADCRaw::add_name(const char* base, const std::string extension) {
std::string CBNTAA_TBADCRaw::add_name(const char* base, const std::string& extension) {
std::string retval(base);
for (unsigned i=0;i<extension.size();i++) {
const char& ch=extension[i];
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TBREC_CBNTAA_TBADCRAW_H
......@@ -12,7 +12,6 @@
#include <string>
#include <vector>
class StoreGateSvc;
/** @class CBNTAA_TBADCRaw CBNTAA_TBADCRaw.h "TBRec/CBNTAA_TBADCRaw.h"
ntpl-dumper for TBEvent/TBADCRaw.h.
......@@ -24,12 +23,12 @@ class CBNTAA_TBADCRaw : public CBNT_TBRecBase
public:
CBNTAA_TBADCRaw(const std::string & name, ISvcLocator * pSvcLocator);
~CBNTAA_TBADCRaw();
virtual ~CBNTAA_TBADCRaw();
//standart algorithm methods
virtual StatusCode CBNT_initialize();
virtual StatusCode CBNT_execute();
virtual StatusCode CBNT_finalize();
virtual StatusCode CBNT_initialize() override;
virtual StatusCode CBNT_execute() override;
virtual StatusCode CBNT_finalize() override;
private:
......@@ -40,9 +39,9 @@ class CBNTAA_TBADCRaw : public CBNT_TBRecBase
//Private function to build names for ntuple entries. Concatinates strings
//but omits characters that are problematic for root like -+:*/
std::string add_name(const char* base, const std::string extension);
std::string add_name(const char* base, const std::string& extension);
StatusCode CBNT_clear();
virtual StatusCode CBNT_clear() override;
};
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TBREC_CBNTAA_TBINFO_H
......@@ -13,10 +13,10 @@ class TBCondRunParTool;
class CBNTAA_TBInfo : public CBNT_TBRecBase {
public:
CBNTAA_TBInfo(const std::string &name, ISvcLocator *pSvcLocator);
~CBNTAA_TBInfo();
virtual StatusCode CBNT_initialize();
virtual StatusCode CBNT_execute();
virtual StatusCode CBNT_finalize();
virtual ~CBNTAA_TBInfo();
virtual StatusCode CBNT_initialize() override;
virtual StatusCode CBNT_execute() override;
virtual StatusCode CBNT_finalize() override;
private:
float GetEnergy(float CurrB3, float CurrB4);
......@@ -80,7 +80,7 @@ private:
float m_sycLoss;
float m_errSycLoss;
StatusCode CBNT_clear();
virtual StatusCode CBNT_clear() override;
};
#endif // CBNT_EVENTINFO_H
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TBREC_CBNTAA_TBSCINT_H
......@@ -12,18 +12,17 @@
#include <string>
#include <vector>
class StoreGateSvc;
class CBNTAA_TBScint : public CBNT_TBRecBase
{
public:
CBNTAA_TBScint(const std::string & name, ISvcLocator * pSvcLocator);
~CBNTAA_TBScint() {};
virtual ~CBNTAA_TBScint() {};
virtual StatusCode CBNT_initialize();
virtual StatusCode CBNT_execute();
virtual StatusCode CBNT_finalize();
virtual StatusCode CBNT_initialize() override;
virtual StatusCode CBNT_execute() override;
virtual StatusCode CBNT_finalize() override;
private:
......@@ -33,7 +32,7 @@ class CBNTAA_TBScint : public CBNT_TBRecBase
std::vector<int> *m_scint_trackid;
std::vector<int> *m_scint_pdg;
StatusCode CBNT_clear();
virtual StatusCode CBNT_clear() override;
};
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#include "CBNTAA_TBTDCRaw.h"
......@@ -55,10 +55,7 @@ StatusCode CBNTAA_TBTDCRaw::CBNT_execute()
m_underThreshold->resize(nTDC);
unsigned NtupleVectorIndex = 0;
TBTDCRawCont::const_iterator it_tdc = tdcCont->begin();
TBTDCRawCont::const_iterator last_tdc = tdcCont->end();
for(;it_tdc!=last_tdc;it_tdc++,NtupleVectorIndex++) {
const TBTDCRaw * tdc = (*it_tdc);
for (const TBTDCRaw* tdc : *tdcCont) {
(*m_tdc)[NtupleVectorIndex] = tdc->getTDC();
(*m_underThreshold)[NtupleVectorIndex] = tdc->isUnderThreshold();
}
......@@ -83,7 +80,7 @@ StatusCode CBNTAA_TBTDCRaw::CBNT_finalize()
return StatusCode::SUCCESS;
}
std::string CBNTAA_TBTDCRaw::add_name(const char* base, const std::string extension) {
std::string CBNTAA_TBTDCRaw::add_name(const char* base, const std::string& extension) {
std::string retval(base);
for (unsigned i=0;i<extension.size();i++) {
const char& ch=extension[i];
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TBREC_CBNTAA_TBTDCRAW_H
......@@ -12,7 +12,6 @@
#include <string>
#include <vector>
class StoreGateSvc;
/** @class CBNTAA_TBTDCRaw CBNTAA_TBTDCRaw.h "TBRec/CBNTAA_TBTDCRaw.h"
ntpl-dumper for TBEvent/TBTDCRaw.h.
......@@ -24,12 +23,12 @@ class CBNTAA_TBTDCRaw : public CBNT_TBRecBase
public:
CBNTAA_TBTDCRaw(const std::string & name, ISvcLocator * pSvcLocator);
~CBNTAA_TBTDCRaw();
virtual ~CBNTAA_TBTDCRaw();
//standart algorithm methods
virtual StatusCode CBNT_initialize();
virtual StatusCode CBNT_execute();
virtual StatusCode CBNT_finalize();
virtual StatusCode CBNT_initialize() override;
virtual StatusCode CBNT_execute() override;
virtual StatusCode CBNT_finalize() override;
private:
......@@ -41,9 +40,9 @@ class CBNTAA_TBTDCRaw : public CBNT_TBRecBase
//Private function to build names for ntuple entries. Concatinates strings
//but omits characters that are problematic for root like -+:*/
std::string add_name(const char* base, const std::string extension);
std::string add_name(const char* base, const std::string& extension);
StatusCode CBNT_clear();
virtual StatusCode CBNT_clear() override;
};
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#include "CBNTAA_TBTPValidation.h"
......@@ -342,10 +342,7 @@ StatusCode CBNTAA_TBTPValidation::CBNT_execute()
m_overflow_TBADCRawCont->resize(nADC);
unsigned NtupleVectorIndex = 0;
TBADCRawCont::const_iterator it_adc = adcCont->begin();
TBADCRawCont::const_iterator last_adc = adcCont->end();
for(;it_adc!=last_adc;it_adc++,NtupleVectorIndex++) {
const TBADCRaw * adc = (*it_adc);
for (const TBADCRaw* adc : *adcCont) {
(*m_adc)[NtupleVectorIndex] = adc-> getADC();
(*m_tbDetectorName_TBADCRawCont)[NtupleVectorIndex] = adc-> getDetectorName();
(*m_overflow_TBADCRawCont)[NtupleVectorIndex] = adc-> isOverflow();
......@@ -369,10 +366,7 @@ StatusCode CBNTAA_TBTPValidation::CBNT_execute()
m_overflow_TBTDCRawCont->resize(nTDC);
unsigned NtupleVectorIndex = 0;
TBTDCRawCont::const_iterator it_tdc = tdcCont->begin();
TBTDCRawCont::const_iterator last_tdc = tdcCont->end();
for(;it_tdc!=last_tdc;it_tdc++,NtupleVectorIndex++) {
const TBTDCRaw * tdc = (*it_tdc);
for (const TBTDCRaw* tdc : *tdcCont) {
(*m_tdc_raw)[NtupleVectorIndex] = tdc-> getTDC();
(*m_underThreshold_raw)[NtupleVectorIndex] = tdc-> isUnderThreshold();
(*m_tbDetectorName_TBTDCRawCont)[NtupleVectorIndex] = tdc-> getDetectorName();
......@@ -458,10 +452,7 @@ StatusCode CBNTAA_TBTPValidation::CBNT_execute()
m_overflow_TBBPCCont ->resize(nBPCCont);
unsigned NtupleVectorIndex = 0;
TBBPCCont::const_iterator it_TBBPCCont = BPCCont->begin();
TBBPCCont::const_iterator last_BBPCCont = BPCCont->end();
for(;it_TBBPCCont!=last_BBPCCont;it_TBBPCCont++,NtupleVectorIndex++) {
const TBBPC * bpc = (*it_TBBPCCont);
for (const TBBPC* bpc : *BPCCont) {
(*m_xPos)[NtupleVectorIndex] = bpc-> getXPos();
(*m_yPos)[NtupleVectorIndex] = bpc-> getYPos();
(*m_xErr)[NtupleVectorIndex] = bpc-> getXErr();
......@@ -498,10 +489,7 @@ StatusCode CBNTAA_TBTPValidation::CBNT_execute()
m_samples->reserve( ( (*(LArDigitContainer->begin()))->nsamples() ) * nLArDigits);
unsigned NtupleVectorIndex = 0;
TBLArDigitContainer::const_iterator it_LArDigitContainer = LArDigitContainer->begin();
TBLArDigitContainer::const_iterator last_LArDigitContainer = LArDigitContainer->end();
for(;it_LArDigitContainer!=last_LArDigitContainer;it_LArDigitContainer++,NtupleVectorIndex++) {
const LArDigit * larDigit = (*it_LArDigitContainer);
for (const LArDigit* larDigit : *LArDigitContainer) {
(*m_channelID)[NtupleVectorIndex] = larDigit->hardwareID().get_identifier32().get_compact() ;
(*m_gain)[NtupleVectorIndex] = (unsigned char)larDigit->gain();
......@@ -834,7 +822,7 @@ StatusCode CBNTAA_TBTPValidation::CBNT_finalize()
return StatusCode::SUCCESS;
}
std::string CBNTAA_TBTPValidation::add_name(const char* base, const std::string extension) {
std::string CBNTAA_TBTPValidation::add_name(const char* base, const std::string& extension) {
std::string retval(base);
for (unsigned i=0;i<extension.size();i++) {
const char& ch=extension[i];
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TBREC_CBNTAA_TBTPVALIDATION_H
......@@ -12,7 +12,6 @@
#include <string>
#include <vector>
class StoreGateSvc;
/** @class CBNTAA_TBTPValidation CBNTAA_TBTPValidation.h "TBRec/CBNTAA_TBTPValidation.h"
ntpl-dumper for all persistified TB classes.
......@@ -126,7 +125,7 @@ class CBNTAA_TBTPValidation : public CBNT_TBRecBase
//Private function to build names for ntuple entries. Concatinates strings
//but omitts characters that are problematic for root like -+:*/
std::string add_name(const char* base, const std::string extension);
std::string add_name(const char* base, const std::string& extension);
StatusCode CBNT_clear();
};
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#include "CBNTAA_TBTrack.h"
......@@ -101,7 +101,7 @@ StatusCode CBNTAA_TBTrack::CBNT_finalize() {
return StatusCode::SUCCESS;
}
std::string CBNTAA_TBTrack::add_name(const char* base, const std::string extension) {
std::string CBNTAA_TBTrack::add_name(const char* base, const std::string& extension) {
std::string retval(base);
for (unsigned i=0;i<extension.size();i++) {
const char& ch=extension[i];
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TBREC_CBNTAA_TBTRACK_H
......@@ -11,18 +11,17 @@
#include <fstream>
#include <string>
class StoreGateSvc;
class CBNTAA_TBTrack : public CBNT_TBRecBase
{
public:
CBNTAA_TBTrack(const std::string & name, ISvcLocator * pSvcLocator);
~CBNTAA_TBTrack() {};
virtual ~CBNTAA_TBTrack() {};
virtual StatusCode CBNT_initialize();
virtual StatusCode CBNT_execute();
virtual StatusCode CBNT_finalize();
virtual StatusCode CBNT_initialize() override;
virtual StatusCode CBNT_execute() override;
virtual StatusCode CBNT_finalize() override;
private:
// by A. Mineanko
......@@ -44,7 +43,7 @@ class CBNTAA_TBTrack : public CBNT_TBRecBase
// taken from CBNTAA_BeamInstrumentation
//Private function to build names for ntuple entries. Concatinates strings
//but omitts characters that are problematic for root like -+:*/
std::string add_name(const char* base, const std::string extension);
std::string add_name(const char* base, const std::string& extension);
};
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TBREC_CBNT_BEAM_H
......@@ -9,21 +9,19 @@
#include <fstream>
#include <string>
class StoreGateSvc;
class CBNT_BeamInstrumentation : public CBNT_TBRecBase
{
public:
CBNT_BeamInstrumentation(const std::string & name, ISvcLocator * pSvcLocator);
~CBNT_BeamInstrumentation();
virtual ~CBNT_BeamInstrumentation();
//standart algorithm methods
virtual StatusCode CBNT_initialize();
virtual StatusCode CBNT_execute();
virtual StatusCode CBNT_finalize();
virtual StatusCode CBNT_initialize() override;
virtual StatusCode CBNT_execute() override;
virtual StatusCode CBNT_finalize() override;
virtual StatusCode CBNT_clear();
virtual StatusCode CBNT_clear() override;
private:
bool m_neverReturnFailure; // controls when StatusCode::FAILURE can be issued in execute()
......
......@@ -30,8 +30,6 @@
#include <string>
#include <vector>
class StoreGateSvc;
class CBNT_CaloH6 : public CBNT_TBRecBase
{
public:
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
//Dear emacs, this is -*-c++-*-
......@@ -22,19 +22,19 @@ class CBNT_TBRecBase : public AthAlgorithm {
public:
CBNT_TBRecBase(const std::string & name, ISvcLocator * pSvcLocator);
~CBNT_TBRecBase();
virtual ~CBNT_TBRecBase();
//Standard algo methods
StatusCode initialize();
StatusCode execute();
StatusCode finalize();
StatusCode pre_execute();
virtual StatusCode initialize() override;
virtual StatusCode execute() override;
virtual StatusCode finalize() override;
virtual StatusCode pre_execute();
//These needs to be implemented by the deriving class
virtual StatusCode CBNT_initialize(){return StatusCode::SUCCESS;}
virtual StatusCode CBNT_execute(){return StatusCode::SUCCESS;}
virtual StatusCode CBNT_finalize(){return StatusCode::SUCCESS;}
virtual StatusCode CBNT_clear(){return StatusCode::SUCCESS;}
virtual StatusCode CBNT_initialize() {return StatusCode::SUCCESS;}
virtual StatusCode CBNT_execute() {return StatusCode::SUCCESS;}
virtual StatusCode CBNT_finalize() {return StatusCode::SUCCESS;}
virtual StatusCode CBNT_clear() {return StatusCode::SUCCESS;}
private:
bool m_initialized;
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#include "CBNT_Timing.h"
......@@ -26,7 +26,6 @@ using Athena::Units::ns;
CBNT_Timing::CBNT_Timing(const std::string & name, ISvcLocator * pSvcLocator)
:CBNT_TBRecBase(name, pSvcLocator)
, m_onlineHelper(0)
, m_emId(0)
, m_energy_cut(2.*GeV)
, m_first_event(true)
, m_caloCellName("AllCalo")
......@@ -64,10 +63,6 @@ StatusCode CBNT_Timing::CBNT_initialize() {
ATH_MSG_DEBUG ( "CBNT_Timing in initialize()" );
const CaloCell_ID* idHelper = nullptr;
ATH_CHECK( detStore()->retrieve (idHelper, "CaloCell_ID") );
m_emId=idHelper->em_idHelper();
ATH_CHECK( m_cablingKey.initialize() );
ATH_CHECK( detStore()->retrieve(m_onlineHelper, "LArOnlineID") );
......@@ -95,20 +90,18 @@ StatusCode CBNT_Timing::CBNT_initialize() {
// get calorimeter samplings ids for the requested samplings
msg() << MSG::INFO << "Included calorimeter samplings: ";
for (std::vector<std::string>::const_iterator sampling = m_sampling_names.begin(); sampling != m_sampling_names.end(); sampling++) {
// CaloSampling::CaloSample idSamp = CaloSamplingHelper::getSamplingId(*sampling);
CaloSampling::CaloSample idSamp = m_samplingFromNameLookup[*sampling];
for (const std::string& sampling : m_sampling_names) {
CaloSampling::CaloSample idSamp = m_samplingFromNameLookup[sampling];
if (idSamp != CaloSampling::Unknown) {
m_samplingIndices.push_back(idSamp);
msg() << MSG::INFO << "\042" << *sampling
msg() << MSG::INFO << "\042" << sampling
<< "\042 ";
}
}
msg() << MSG::INFO << endmsg;
// get an idCalo keyed map of vectors of idSample for the requested samplings
for (std::vector<CaloSampling::CaloSample>::iterator sample = m_samplingIndices.begin(); sample != m_samplingIndices.end(); sample++) {
CaloSampling::CaloSample idSample = *sample;
for (CaloSampling::CaloSample idSample : m_samplingIndices) {
// find the idCalo
CaloCell_ID::SUBCALO idCalo = m_caloLookup[idSample];
// build the vector of idSample
......@@ -117,20 +110,17 @@ StatusCode CBNT_Timing::CBNT_initialize() {
m_calosAndSamplings[idCalo] = samplingV;
}
// printout
std::map< CaloCell_ID::SUBCALO, std::vector<CaloSampling::CaloSample> >::iterator it = m_calosAndSamplings.begin();
for (; it != m_calosAndSamplings.end(); it++) {
CaloCell_ID::SUBCALO idCalo = it->first;
for (const auto& p : m_calosAndSamplings) {
CaloCell_ID::SUBCALO idCalo = p.first;
msg() << MSG::INFO
<< "Included calorimeter : \042"
<< m_caloToNameLookup[idCalo]
<< "\042 samplings:";
std::vector<CaloSampling::CaloSample> samplingV = it->second;
std::vector<CaloSampling::CaloSample>::iterator sample = samplingV.begin();
std::vector<CaloSampling::CaloSample>::iterator lastSample = samplingV.end();
for (; sample != lastSample; sample++) {
const std::vector<CaloSampling::CaloSample>& samplingV = p.second;
for (CaloSampling::CaloSample sample : samplingV) {
msg() << MSG::INFO
<< " \042"
<< m_samplingToNameLookup[*sample]
<< m_samplingToNameLookup[sample]
<< "\042";
}
msg() << MSG::INFO << endmsg;
......@@ -174,14 +164,13 @@ StatusCode CBNT_Timing::CBNT_execute()
// find all febID's related to the requested samplings
// loop over desired calorimeter modules first, more efficient this way
std::map< CaloCell_ID::SUBCALO, std::vector<CaloSampling::CaloSample> >::iterator it = m_calosAndSamplings.begin();
for (; it != m_calosAndSamplings.end(); it++) {
CaloCell_ID::SUBCALO idCalo = it->first;
std::vector<CaloSampling::CaloSample> samplingV = it->second;
for (const auto& p : m_calosAndSamplings) {
CaloCell_ID::SUBCALO idCalo = p.first;
std::vector<CaloSampling::CaloSample> samplingV = p.second;
// loop over the corresponding CaloCell's
for (CaloCellContainer::const_iterator cell = cellContainer->beginConstCalo(idCalo);
cell != cellContainer->endConstCalo(idCalo); cell++) {
cell != cellContainer->endConstCalo(idCalo); ++cell) {
// get the corresponding sample
CaloSampling::CaloSample idSample;
......@@ -209,9 +198,9 @@ StatusCode CBNT_Timing::CBNT_execute()
}
// print out
msg() << MSG::INFO << "FEB IDs: ";
for (std::vector<HWIdentifier>::iterator it_febID = m_febIDs.begin(); it_febID != m_febIDs.end(); it_febID++) {
for (HWIdentifier febID : m_febIDs) {
std::ostringstream os;
os << std::hex << *it_febID;
os << std::hex << febID;
msg() << MSG::INFO << " \042" << os.str() << "\042";
}
msg() << MSG::INFO << endmsg;
......@@ -232,20 +221,19 @@ StatusCode CBNT_Timing::CBNT_execute()
// fill energy weighted time stores
// loop over desired calorimeter modules first, more efficient this way
std::map< CaloCell_ID::SUBCALO, std::vector<CaloSampling::CaloSample> >::iterator it = m_calosAndSamplings.begin();
m_energy = 0;
for (; it != m_calosAndSamplings.end(); it++) {
CaloCell_ID::SUBCALO idCalo = it->first;
for (const auto& p : m_calosAndSamplings) {
CaloCell_ID::SUBCALO idCalo = p.first;
ATH_MSG_DEBUG
( "Looping over CaloCells of calorimeter : \042"
<< m_caloToNameLookup[idCalo]
<< "\042" );
std::vector<CaloSampling::CaloSample> samplingV = it->second;
std::vector<CaloSampling::CaloSample> samplingV = p.second;
// loop over the corresponding CaloCell's
for (CaloCellContainer::const_iterator cell = cellContainer->beginConstCalo(idCalo);
cell != cellContainer->endConstCalo(idCalo); cell++) {
cell != cellContainer->endConstCalo(idCalo); ++cell) {
// get the corresponding sample
//CaloSampling::CaloSample idSample = CaloSampling::getSampling(**cell);
......@@ -324,8 +312,7 @@ StatusCode CBNT_Timing::CBNT_execute()
}
// fill energy weighted cubic peaking time for each requested sampling
for (std::vector<CaloSampling::CaloSample>::iterator sample = m_samplingIndices.begin(); sample != m_samplingIndices.end(); sample++) {
CaloSampling::CaloSample idSample = *sample;
for (CaloSampling::CaloSample idSample : m_samplingIndices) {
// go on only if there is data stored for this sample:
//if (sumEPerSampling.find(idSample) != sumEPerSampling.end()) {
double peakTime = (sumEPerSampling[idSample] > 0.) ? sumETimePerSampling[idSample]/sumEPerSampling[idSample] : NOTIME;
......@@ -335,8 +322,7 @@ StatusCode CBNT_Timing::CBNT_execute()
}
// fill energy weighted cubic peaking time for each requested FEB
for (std::vector<HWIdentifier>::iterator it_febID = m_febIDs.begin(); it_febID != m_febIDs.end(); it_febID++) {
HWIdentifier febID = *it_febID;
for (HWIdentifier febID : m_febIDs) {
// go on only if there is data stored for this febID
//if (sumEPerFeb.find(febID) != sumEPerFeb.end()) {
double peakTime = (sumEPerFeb[febID] > 0.) ? sumETimePerFeb[febID]/sumEPerFeb[febID] : NOTIME;
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TBREC_CBNT_TIMING_H
......@@ -13,26 +13,24 @@
#include "CaloIdentifier/LArEM_ID.h"
#include "LArCabling/LArOnOffIdMapping.h"
class StoreGateSvc;
class LArOnlineID;
#include <fstream>
#include <string>
class StoreGateSvc;
class CBNT_Timing : public CBNT_TBRecBase
{
public:
CBNT_Timing(const std::string & name, ISvcLocator * pSvcLocator);
~CBNT_Timing();
virtual ~CBNT_Timing();
//standart algorithm methods
virtual StatusCode CBNT_initialize();
virtual StatusCode CBNT_execute();
virtual StatusCode CBNT_finalize();
virtual StatusCode CBNT_clear();
//standard algorithm methods
virtual StatusCode CBNT_initialize() override;
virtual StatusCode CBNT_execute() override;
virtual StatusCode CBNT_finalize() override;
virtual StatusCode CBNT_clear() override;
private:
static const int NOTIME = -999;
......@@ -40,7 +38,6 @@ class CBNT_Timing : public CBNT_TBRecBase
SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"};
const LArOnlineID* m_onlineHelper;
const LArEM_ID* m_emId;
double m_energy_cut;
bool m_first_event;
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#include "CBNT_UpstreamMat.h"
......@@ -14,8 +14,7 @@ using CLHEP::Hep3Vector;
CBNT_UpstreamMat::CBNT_UpstreamMat(const std::string & name, ISvcLocator * pSvcLocator) :
CBNT_TBRecBase(name, pSvcLocator),
m_storeGate(0)
CBNT_TBRecBase(name, pSvcLocator)
{
declareProperty("CollectionName",m_key);
m_notFound=false;
......@@ -33,15 +32,8 @@ CBNT_UpstreamMat::~CBNT_UpstreamMat()
StatusCode CBNT_UpstreamMat::CBNT_initialize() {
StatusCode sc;
MsgStream log(msgSvc(), name());
sc = service( "StoreGateSvc", m_storeGate);
if( sc.isFailure() ){
log << MSG::FATAL << "Unable to locate the StoreGateSvc Service" <<endmsg;
return sc;
}
addBranch("UPSTREAMMAT/up_nElec", m_nElec,"/l");
addBranch("UPSTREAMMAT/up_nPhot", m_nPhot,"/l");
......@@ -51,17 +43,16 @@ StatusCode CBNT_UpstreamMat::CBNT_initialize() {
addBranch("UPSTREAMMAT/up_PhotEne", m_PhotEne);
addBranch("UPSTREAMMAT/up_PhotAng", m_PhotAng);
return sc;
return StatusCode::SUCCESS;
}
StatusCode CBNT_UpstreamMat::CBNT_execute() {
StatusCode sc;
MsgStream log(msgSvc(), name());
//Set to zero:
m_nElec=0;
m_nPhot=0;
if (!m_storeGate->contains<TrackRecordCollection>(m_key)) {
if (!evtStore()->contains<TrackRecordCollection>(m_key)) {
if (!m_notFound) {
log << MSG::WARNING << "TrackRecordCollection with key " << m_key << " not found" << endmsg;
m_notFound=true;
......@@ -69,16 +60,9 @@ StatusCode CBNT_UpstreamMat::CBNT_execute() {
return StatusCode::SUCCESS;
}
const TrackRecordCollection *trackRecordCollection(0);
sc = m_storeGate->retrieve(trackRecordCollection, m_key);
if ( sc.isFailure() ) {
log << MSG::ERROR << "Error retrieving TrackRecordCollection with key " << m_key << " not found" << endmsg;
return sc;
}
ATH_CHECK( evtStore()->retrieve(trackRecordCollection, m_key) );
TrackRecordCollection::const_iterator it=trackRecordCollection->begin();
TrackRecordCollection::const_iterator it_e=trackRecordCollection->end();
for (;it!=it_e;it++) {
TrackRecord trackRecord=*it;
for (const TrackRecord& trackRecord : *trackRecordCollection) {
const int pdgCode=trackRecord.GetPDGCode();
Hep3Vector p=trackRecord.GetMomentum();
double pr=sqrt(p.y()*p.y()+p.z()*p.z());
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TBREC_CBNT_UPSTREAMMAT_H
......@@ -8,19 +8,17 @@
#include "CBNT_TBRecBase.h"
#include <string>
class StoreGateSvc;
class CBNT_UpstreamMat : public CBNT_TBRecBase {
public:
CBNT_UpstreamMat(const std::string &name, ISvcLocator *pSvcLocator);
virtual ~CBNT_UpstreamMat();
virtual StatusCode CBNT_initialize();
virtual StatusCode CBNT_execute();
virtual StatusCode CBNT_finalize();
virtual StatusCode CBNT_clear();
virtual StatusCode CBNT_initialize() override;
virtual StatusCode CBNT_execute() override;
virtual StatusCode CBNT_finalize() override;
virtual StatusCode CBNT_clear() override;
private:
StoreGateSvc * m_storeGate;
std::string m_key;
bool m_notFound;
//Ntuple variables:
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
......@@ -84,7 +84,7 @@ TBAlgoSequencer::initialize()
acceptedAlgos++;
}
numberOfAlgorithms++;
subAlgos++;
++subAlgos;
}
////////////////////////
......@@ -163,7 +163,7 @@ TBAlgoSequencer::execute()
}
// iterator and counter increments
algoIndex++;
algoCounter++;
++algoCounter;
}
// this is the trick - catch it before the framework terminates the job!
return StatusCode::SUCCESS;
......@@ -216,24 +216,19 @@ TBAlgoSequencer::finalize()
ATH_MSG_INFO
( "-------------------------------------------------------- " );
std::map<std::string,unsigned int>::iterator
firstReject = m_rejectPattern.begin();
std::map<std::string,unsigned int>::iterator
firstAccept = m_acceptPattern.begin();
for ( ; firstReject != m_rejectPattern.end() ; firstReject++ )
for (const std::pair<const std::string, unsigned int>& p : m_rejectPattern)
{
double percentReject = m_eventCounter > 0
? ((double)(*firstReject).second)/((double)m_eventCounter)*100.
? ((double)p.second)/((double)m_eventCounter)*100.
: 100;
msg() << MSG::INFO
<< "Algorithm ";
msg().width(20);
msg() << MSG::INFO
<< (*firstReject).first
<< p.first
<< " rejected "
<< std::setw(6)
<< (*firstReject).second
<< p.second
<< " events (";
msg() << MSG::INFO
<< std::setprecision(5)
......@@ -247,19 +242,19 @@ TBAlgoSequencer::finalize()
( "Accept patterns: " );
ATH_MSG_INFO
( "-------------------------------------------------------- " );
for ( ; firstAccept != m_acceptPattern.end() ; firstAccept++ )
for (const std::pair<const std::string, unsigned int>& p : m_acceptPattern)
{
double percentAccept = m_eventCounter > 0
? ((double)(*firstAccept).second)/((double)m_eventCounter)*100.
? ((double)p.second)/((double)m_eventCounter)*100.
: 100;
msg() << MSG::INFO
<< "Algorithm ";
msg().width(20);
msg() << MSG::INFO
<< (*firstAccept).first
<< p.first
<< " accepted "
<< std::setw(6)
<< (*firstAccept).second
<< p.second
<< " events (";
msg().setf(std::ios::fixed);
msg() << MSG::INFO
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TBREC_TBALGOSEQUENCER
......@@ -28,11 +28,11 @@ class TBAlgoSequencer : public AthLegacySequence
public:
TBAlgoSequencer(const std::string& name, ISvcLocator* pSvcLocator);
~TBAlgoSequencer();
virtual ~TBAlgoSequencer();
StatusCode initialize();
StatusCode execute();
StatusCode finalize();
virtual StatusCode initialize() override;
virtual StatusCode execute() override;
virtual StatusCode finalize() override;
private:
......
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