Commit 011d2cc4 authored by Jochen Meyer's avatar Jochen Meyer Committed by Graeme Stewart
Browse files

addressing coverity defects (MuonByteStreamCnvTest-04-01-04)

        * tagging MuonByteStreamCnvTest-04-01-04
        * addressing coverity defects 28679-80, 28686

2014-12-08 Jochen Meyer

        * tagging MuonByteStreamCnvTest-04-01-03
        * fixing double delete introduced by addressing coverity defect 12308 (thanks John Chapman)

2014-12-07 Jochen Meyer

        * tagging MuonByteStreamCnvTest-04-01-02
        * addressing coverity defects 25064, 12308, 13018-20, 13022, 13078, 13083, 13108-9, 13146, 13151

2014-11-25 Jochen Meyer

        * tagging MuonByteStreamCnvTest-04-01-01
        * fixing invalid array access
           ( https://its.cern.ch/jira/browse/ATLASRECTS-1308 )

...
(Long ChangeLog diff - truncated)
parent 045131ff
...@@ -56,6 +56,7 @@ class MdtDigitToMdtRDO : public Algorithm { ...@@ -56,6 +56,7 @@ class MdtDigitToMdtRDO : public Algorithm {
MsgStream* m_log; MsgStream* m_log;
bool m_debug; bool m_debug;
bool m_verbose; bool m_verbose;
bool m_BMEpresent;
}; };
......
...@@ -60,6 +60,9 @@ class RpcByteStreamDecoder { ...@@ -60,6 +60,9 @@ class RpcByteStreamDecoder {
bool m_debug; bool m_debug;
bool m_verbose; bool m_verbose;
RpcByteStreamDecoder & operator=(const RpcByteStreamDecoder &right);
RpcByteStreamDecoder(const RpcByteStreamDecoder&);
}; // RPCBYTESTREAMDECODER_H }; // RPCBYTESTREAMDECODER_H
#endif #endif
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
CscDigitToCscRDO::CscDigitToCscRDO(const std::string& name, CscDigitToCscRDO::CscDigitToCscRDO(const std::string& name,
ISvcLocator* pSvcLocator) ISvcLocator* pSvcLocator)
: Algorithm(name, pSvcLocator), : Algorithm(name, pSvcLocator),
m_digTool("CscDigitToCscRDOTool", this ) m_digTool("CscDigitToCscRDOTool", this ), m_log(0), m_debug(false), m_verbose(false)
{ {
declareProperty("CscDigitToRDOTool", m_digTool); declareProperty("CscDigitToRDOTool", m_digTool);
} }
......
...@@ -32,7 +32,9 @@ using namespace std; ...@@ -32,7 +32,9 @@ using namespace std;
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
MdtDigitToMdtRDO::MdtDigitToMdtRDO(const std::string& name, ISvcLocator* pSvcLocator) : MdtDigitToMdtRDO::MdtDigitToMdtRDO(const std::string& name, ISvcLocator* pSvcLocator) :
Algorithm(name, pSvcLocator),m_EvtStore("StoreGateSvc", name),m_csmContainer(0) Algorithm(name, pSvcLocator), m_activeStore(0), m_EvtStore("StoreGateSvc", name),
m_cabling(0), m_csmContainer(0), m_mdtIdHelper(0), m_tagInfoMgr(0), m_log(0),
m_debug(false), m_verbose(false), m_BMEpresent(false)
{ {
declareProperty("Store", m_EvtStore, "help"); declareProperty("Store", m_EvtStore, "help");
...@@ -104,6 +106,10 @@ StatusCode MdtDigitToMdtRDO::initialize(){ ...@@ -104,6 +106,10 @@ StatusCode MdtDigitToMdtRDO::initialize(){
// create an empty pad container and record it // create an empty pad container and record it
m_csmContainer = new MdtCsmContainer(); m_csmContainer = new MdtCsmContainer();
m_csmContainer->addRef(); m_csmContainer->addRef();
// check if the layout includes elevator chambers
m_BMEpresent = m_mdtIdHelper->stationNameIndex("BME") != -1;
if ( m_BMEpresent ) *m_log << MSG::INFO << "Processing configuration for layouts with BME chambers." << endreq;
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
...@@ -164,7 +170,7 @@ StatusCode MdtDigitToMdtRDO::fill_MDTdata() const { ...@@ -164,7 +170,7 @@ StatusCode MdtDigitToMdtRDO::fill_MDTdata() const {
return StatusCode::FAILURE; return StatusCode::FAILURE;
} }
MdtCsmIdHash hashF; MdtCsmIdHash hashF;
// Iterate on the collections // Iterate on the collections
collection_iterator it_coll = container->begin(); collection_iterator it_coll = container->begin();
...@@ -189,8 +195,71 @@ StatusCode MdtDigitToMdtRDO::fill_MDTdata() const { ...@@ -189,8 +195,71 @@ StatusCode MdtDigitToMdtRDO::fill_MDTdata() const {
1, 1, 1, 1, 1, 1,
subsystem, mrod, link, subsystem, mrod, link,
tdc, channel); tdc, channel);
// Create the new CSM
MdtCsm* mdtCsm = new MdtCsm(moduleId, moduleHash, subsystem, mrod, link); if (!cabling) {
*m_log << MSG::ERROR
<< "MDTcabling can't return an online ID for the channel : " << endreq;
*m_log << MSG::ERROR << name << " "
<< eta << " " << phi << " "
<< "and dummy multilayer=1, layer=1, tube=1 ." << endreq;
assert(false);
}
Identifier chid1, chid2;
if ( m_BMEpresent ){
// 1st ML channel get_id
chid1 = m_mdtIdHelper->channelID(m_mdtIdHelper->stationName(moduleId),
m_mdtIdHelper->stationEta(moduleId),
m_mdtIdHelper->stationPhi(moduleId),
1, 1, 1 );
// 2nd ML channel id
if ( name == 53 ) {
chid2 = m_mdtIdHelper->channelID(m_mdtIdHelper->stationName(moduleId),
m_mdtIdHelper->stationEta(moduleId),
m_mdtIdHelper->stationPhi(moduleId),
2, 1, 1 );
}
}
unsigned int elementHash = 0, elementHash_2nd = 0;
MdtCsm* mdtCsm = 0;
MdtCsm* mdtCsm_2nd = 0;
// elevator chambers are read out by 2 CSMs
// they are split in the middle (for both multilayers)
// the first tube read out by the 2nd CSM is (offline!) tube 43
if ( !m_BMEpresent ) {
elementHash = hashF( moduleId );
mdtCsm = new MdtCsm(moduleId, moduleHash, subsystem, mrod, link);
} else {
elementHash = hashF( chid1 );
elementHash_2nd = hashF( chid2 );
mdtCsm = new MdtCsm(chid1, moduleHash, subsystem, mrod, link);
if ( name == 53 ) {
uint8_t subsystem_2ndcsm, mrod_2ndcsm, link_2ndcsm, tdc_2ndcsm, channel_2ndcsm;
cabling = m_cabling->getOnlineId(name, eta, phi, 1, 1, 43,
subsystem_2ndcsm, mrod_2ndcsm,
link_2ndcsm, tdc_2ndcsm, channel_2ndcsm);
if (!cabling) {
*m_log << MSG::ERROR
<< "MDTcabling can't return an online ID for the channel : " << endreq;
*m_log << MSG::ERROR << name << " "
<< eta << " " << phi << " "
<< " and dummy multilayer=1, layer=1, tube=1 ." << endreq;
assert(false);
}
mdtCsm_2nd = new MdtCsm(chid2, elementHash_2nd, subsystem_2ndcsm, mrod_2ndcsm, link_2ndcsm);
}
}
// Iterate on the digits of the collection // Iterate on the digits of the collection
digit_iterator it_dig = mdtCollection->begin(); digit_iterator it_dig = mdtCollection->begin();
...@@ -244,19 +313,31 @@ StatusCode MdtDigitToMdtRDO::fill_MDTdata() const { ...@@ -244,19 +313,31 @@ StatusCode MdtDigitToMdtRDO::fill_MDTdata() const {
<< " Width : " << width << endreq; << " Width : " << width << endreq;
// Add the digit to the CSM // Add the digit to the CSM
mdtCsm->push_back(amtHit); if( name != 53 ) mdtCsm->push_back(amtHit);
else {
if( link == mdtCsm->CsmId() ) mdtCsm->push_back(amtHit);
else if( link == mdtCsm_2nd->CsmId() ) mdtCsm_2nd->push_back(amtHit);
else {
delete amtHit; amtHit = NULL;
*m_log << MSG::ERROR << "There's a BME digit that doesn't match a CSM" << endreq;
}
}
} }
} }
// Add the CSM to the CsmContainer // Add the CSM to the CsmContainer
unsigned int elementHash = hashF( moduleId );
m_activeStore->setStore( &*m_EvtStore ); m_activeStore->setStore( &*m_EvtStore );
sc = m_csmContainer->addCollection(mdtCsm, elementHash); sc = m_csmContainer->addCollection(mdtCsm, elementHash);
if (sc.isFailure()) if (sc.isFailure())
*m_log << MSG::WARNING << "Unable to record MDT CSM in IDC" << endreq; *m_log << MSG::WARNING << "Unable to record MDT CSM in IDC" << endreq;
//delete mdtCsm; //delete mdtCsm;
if ( name == 53 && m_BMEpresent) {
sc = m_csmContainer->addCollection(mdtCsm_2nd, elementHash_2nd);
if (sc.isFailure())
*m_log << MSG::WARNING << "Unable to record MDT CSM in IDC 2nd" << endreq;
}
} }
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
MuonRdoToMuonDigit::MuonRdoToMuonDigit(const std::string& name, MuonRdoToMuonDigit::MuonRdoToMuonDigit(const std::string& name,
ISvcLocator* pSvcLocator) ISvcLocator* pSvcLocator)
: Algorithm(name, pSvcLocator), : Algorithm(name, pSvcLocator),
m_digTool("MuonRdoToMuonDigitTool", this ) m_digTool("MuonRdoToMuonDigitTool", this ), m_log(0), m_debug(false), m_verbose(false)
{ {
declareProperty("MuonRdoToMuonDigitTool", m_digTool); declareProperty("MuonRdoToMuonDigitTool", m_digTool);
} }
......
...@@ -22,7 +22,8 @@ const int MAXDIGIT = 4096; ...@@ -22,7 +22,8 @@ const int MAXDIGIT = 4096;
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
ReadCscDigit::ReadCscDigit(const std::string& name, ISvcLocator* pSvcLocator) ReadCscDigit::ReadCscDigit(const std::string& name, ISvcLocator* pSvcLocator)
: Algorithm(name, pSvcLocator) : Algorithm(name, pSvcLocator), m_ntuplePtr(0), m_activeStore(0),
m_cscHelper(0), m_log(0), m_debug(false), m_verbose(false)
{ {
// Declare the properties // Declare the properties
declareProperty("NtupleLocID",m_NtupleLocID); declareProperty("NtupleLocID",m_NtupleLocID);
......
...@@ -37,7 +37,8 @@ static const int maxDig = 5000; ...@@ -37,7 +37,8 @@ static const int maxDig = 5000;
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
ReadMdtDigit::ReadMdtDigit(const std::string& name, ISvcLocator* pSvcLocator) : ReadMdtDigit::ReadMdtDigit(const std::string& name, ISvcLocator* pSvcLocator) :
Algorithm(name, pSvcLocator) { Algorithm(name, pSvcLocator), m_ntuplePtr(0), m_activeStore(0),
m_mdtIdHelper(0), m_log(0), m_debug(false), m_verbose(false) {
// Declare the properties // Declare the properties
......
...@@ -35,7 +35,8 @@ static const int maxPrd = 5000; ...@@ -35,7 +35,8 @@ static const int maxPrd = 5000;
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
ReadMdtPRD::ReadMdtPRD(const std::string& name, ISvcLocator* pSvcLocator) : ReadMdtPRD::ReadMdtPRD(const std::string& name, ISvcLocator* pSvcLocator) :
Algorithm(name, pSvcLocator) { Algorithm(name, pSvcLocator), m_ntuplePtr(0), m_eventStore(0),
m_mdtIdHelper(0), m_log(0), m_debug(false), m_verbose(false) {
// Declare the properties // Declare the properties
......
...@@ -38,7 +38,8 @@ static const int maxAmt = 5000;//????? ...@@ -38,7 +38,8 @@ static const int maxAmt = 5000;//?????
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
ReadMdtRDO::ReadMdtRDO(const std::string& name, ISvcLocator* pSvcLocator) : ReadMdtRDO::ReadMdtRDO(const std::string& name, ISvcLocator* pSvcLocator) :
Algorithm(name, pSvcLocator) { Algorithm(name, pSvcLocator), m_ntuplePtr(0), m_activeStore(0), m_log(0),
m_debug(false), m_verbose(false) {
// Declare the properties // Declare the properties
......
...@@ -23,7 +23,8 @@ static const int maxDig = 2000; ...@@ -23,7 +23,8 @@ static const int maxDig = 2000;
// Algorithm constructor // Algorithm constructor
ReadRpcDigit::ReadRpcDigit(const std::string &name, ISvcLocator *pSvcLocator) ReadRpcDigit::ReadRpcDigit(const std::string &name, ISvcLocator *pSvcLocator)
: Algorithm(name, pSvcLocator) : Algorithm(name, pSvcLocator), m_eventStore(0), m_activeStore(0),
m_ntuplePtr(0), m_rpcIdHelper(0), m_log(0), m_debug(false), m_verbose(false)
{ {
declareProperty("NtupleLocID", m_NtupleLocID); declareProperty("NtupleLocID", m_NtupleLocID);
declareProperty("WriteRpcNtuple", m_rpcNtuple = false); declareProperty("WriteRpcNtuple", m_rpcNtuple = false);
......
...@@ -38,7 +38,8 @@ static const int maxFiredChannels = 4096; ...@@ -38,7 +38,8 @@ static const int maxFiredChannels = 4096;
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
ReadRpcRDO::ReadRpcRDO(const std::string& name, ISvcLocator* pSvcLocator) : ReadRpcRDO::ReadRpcRDO(const std::string& name, ISvcLocator* pSvcLocator) :
Algorithm(name, pSvcLocator) { Algorithm(name, pSvcLocator), m_ntuplePtr(0), m_activeStore(0),
m_log(0), m_debug(false), m_verbose(false) {
// Declare the properties // Declare the properties
......
...@@ -23,7 +23,9 @@ RpcByteStreamDecoder::RpcByteStreamDecoder(const RPCbytestream * p_bytestream, c ...@@ -23,7 +23,9 @@ RpcByteStreamDecoder::RpcByteStreamDecoder(const RPCbytestream * p_bytestream, c
} }
RpcByteStreamDecoder::~RpcByteStreamDecoder() RpcByteStreamDecoder::~RpcByteStreamDecoder()
{ } {
if( m_rpcpads != NULL ) { delete m_rpcpads; m_rpcpads = NULL; }
}
StatusCode RpcByteStreamDecoder::decodeByteStream() StatusCode RpcByteStreamDecoder::decodeByteStream()
{ {
......
...@@ -41,7 +41,9 @@ static double time_correction(double, double, double); ...@@ -41,7 +41,9 @@ static double time_correction(double, double, double);
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
RpcDigitToRpcRDO::RpcDigitToRpcRDO(const std::string& name, ISvcLocator* pSvcLocator) : RpcDigitToRpcRDO::RpcDigitToRpcRDO(const std::string& name, ISvcLocator* pSvcLocator) :
Algorithm(name, pSvcLocator),m_EvtStore("StoreGateSvc", name),m_padContainer(0) Algorithm(name, pSvcLocator), m_simu_code(0), m_activeStore(0),
m_EvtStore("StoreGateSvc", name), m_MuonMgr(0), m_cabling(0), m_padContainer(0),
m_rpcHelper(0), m_tagInfoMgr(0), m_log(0), m_debug(false), m_verbose(false)
{ {
declareProperty ( "FastDebug", m_fast_debug=0 ); declareProperty ( "FastDebug", m_fast_debug=0 );
...@@ -285,7 +287,6 @@ StatusCode RpcDigitToRpcRDO::execute() { ...@@ -285,7 +287,6 @@ StatusCode RpcDigitToRpcRDO::execute() {
*m_log << MSG::ERROR << "Unable to record RPC Pad in IDC" << endreq; *m_log << MSG::ERROR << "Unable to record RPC Pad in IDC" << endreq;
} }
delete pads;
delete padDecoder; delete padDecoder;
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
......
Markdown is supported
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