Commit c6881022 authored by Shaun Roe's avatar Shaun Roe Committed by Graeme Stewart
Browse files

fix coverity 14580 (InDetPrepRawDataFormation-01-08-31)

2014-12-10 Shaun Roe
	* coverity fix 14580
	* tag as InDetPrepRawDataFormation-01-08-31

2014-11-21 Shaun Roe
	* bring InDetPrepRawDataFormation-01-08-28-XX branch changes into trunk
	* tag as InDetPrepRawDataFormation-01-08-30

2014-11-21 Shaun Roe
	* fix coverity warnings 14586, 14580
	* tag as InDetPrepRawDataFormation-01-08-29

2014-11-14 Shaun Roe
	* Introduce use of unique_ptr
parent 652111bf
......@@ -92,8 +92,6 @@ private:
IdMap_t m_status;
IdentifierHash m_maxKey;
SCT_ClusterContainer* m_clusterContainer;
bool m_selectPixels;
bool m_selectSCTs;
const InDetDD::SiDetectorManager* m_manager;
unsigned int m_maxRDOs;
ServiceHandle<IInDetConditionsSvc> m_pSummarySvc;
......
......@@ -46,7 +46,9 @@ namespace InDet{
m_managerName("Pixel"),
m_clustersName("PixelClusters"),
m_page(0),
m_idHelper(0){
m_idHelper(0),
m_clusterContainer(0),
m_manager(0){
// Get parameter values from jobOptions file
declareProperty("DataObjectName",m_dataObjectName);
declareProperty("DetectorManagerName",m_managerName);
......@@ -75,7 +77,6 @@ namespace InDet{
//-----------------------------------------------------------------------------
// Initialize method:
StatusCode PixelClusterization::initialize(){
msg(MSG::INFO) << "PixelClusterization::initialize()" << endreq;
// get the InDet::MergedPixelsTool
if ( m_clusteringTool.retrieve().isFailure() ) {
msg(MSG:: FATAL) << m_clusteringTool.propertyName() << ": Failed to retrieve tool " << m_clusteringTool.type() << endreq;
......@@ -98,7 +99,7 @@ namespace InDet{
return StatusCode::FAILURE;
}
msg(MSG:: DEBUG) << "Pixel detector manager retrieved" << endreq;
ATH_MSG_DEBUG( "Pixel detector manager retrieved" );
// Get the Pixel helper
if (detStore()->retrieve(m_idHelper,"PixelID").isFailure())
......@@ -115,7 +116,7 @@ namespace InDet{
} else {
incSvc->addListener(this,"StoreCleared");
}
msg(MSG:: DEBUG) << "Initialize done !" << endreq;
ATH_MSG_DEBUG( "Initialize done !" );
return StatusCode::SUCCESS;
}
......@@ -130,7 +131,6 @@ namespace InDet{
//----------------------------------------------------------------------------
// Execute method:
StatusCode PixelClusterization::execute() {
msg(MSG:: DEBUG) << "PixelClusterization::execute()" << endreq;
m_clusterContainer->cleanup();
// register the IdentifiableContainer into StoreGate
StatusCode sc = evtStore()->record(m_clusterContainer,m_clustersName);
......@@ -138,7 +138,7 @@ namespace InDet{
msg(MSG:: FATAL) << "Container " << m_clustersName<< "could not be recorded in StoreGate !"<< endreq;
return StatusCode::FAILURE;
}else{
if (msgLvl(MSG::DEBUG)) msg() << "Container '" << m_clustersName<< "' recorded in StoreGate" << endreq;
ATH_MSG_DEBUG( "Container '" << m_clustersName<< "' recorded in StoreGate" );
}
// symlink the collection
SiClusterContainer* symSiContainer(0);
......@@ -147,17 +147,17 @@ namespace InDet{
msg(MSG:: FATAL) << "Pixel clusters could not be symlinked in StoreGate !"<< endreq;
return StatusCode::FAILURE;
} else {
if (msgLvl(MSG::DEBUG)) msg() << "Pixel clusters '" << m_clustersName << "' symlinked in StoreGate"<< endreq;
ATH_MSG_DEBUG( "Pixel clusters '" << m_clustersName << "' symlinked in StoreGate");
}
if (msgLvl(MSG::DEBUG)) msg() << "Creating the ganged ambiguities map" << endreq;
PixelGangedClusterAmbiguities* AmbiguitiesMap =new PixelGangedClusterAmbiguities();
ATH_MSG_DEBUG( "Creating the ganged ambiguities map");
std::unique_ptr<PixelGangedClusterAmbiguities> AmbiguitiesMap(new PixelGangedClusterAmbiguities());
const DataHandle<PixelRDO_Container> p_rdocontainer;
sc=evtStore()->retrieve(p_rdocontainer,m_dataObjectName);
if (sc.isFailure() ){
msg(MSG:: FATAL) << "Could not find the data object "<< m_dataObjectName << " !" << endreq;
// return StatusCode::FAILURE;
} else {
if (msgLvl(MSG::DEBUG)) msg() << "Data object " << m_dataObjectName << " found" << endreq;
ATH_MSG_DEBUG( "Data object " << m_dataObjectName << " found" );
p_rdocontainer->clID(); // anything to dereference the DataHandle
// will trigger the converter
PixelRDO_Container::const_iterator rdoCollections = p_rdocontainer->begin();
......@@ -166,29 +166,20 @@ namespace InDet{
for(; rdoCollections!=rdoCollectionsEnd; ++rdoCollections){
const COLLECTION* RDO_Collection(*rdoCollections);
if (!RDO_Collection) continue;
//all debug messages taken out by shaun, 18.12.2008.... too many messages to be useful, and it makes it too slow (maybe use a ifndef NDEBUG ?)
//if (msgLvl(MSG::DEBUG)) msg() << "RDO collection size="<< RDO_Collection->size()<< ", ID=" << RDO_Collection->identify() << endreq;
//if (msgLvl(MSG::DEBUG)) msg() << "Ambiguities map: " << AmbiguitiesMap->size() << " elements" << endreq;
if (RDO_Collection->size() != 0){
// Use one of the specific clustering AlgTools to make clusters
//if (msgLvl(MSG::DEBUG)) msg() << "Calling clusterize()"<< endreq;
PixelClusterCollection* clusterCollection = m_clusteringTool->clusterize(*RDO_Collection,*m_manager,*m_idHelper);
//if (msgLvl(MSG::DEBUG)) msg() << "Exiting from clusterize()"<< endreq;
if (clusterCollection){
if (clusterCollection->size() != 0) {
//if (msgLvl(MSG::DEBUG)) msg() << "Filling ambiguities map" << endreq;
m_gangedAmbiguitiesFinder->execute(clusterCollection,*m_manager,*AmbiguitiesMap);
//if (msgLvl(MSG::DEBUG)) msg() << "Ambiguities map: " << AmbiguitiesMap->size() << " elements" << endreq;
// -me- new IDC does no longer register in Storegate if hash is used !
sc= m_clusterContainer->addCollection( clusterCollection, clusterCollection->identifyHash() );
if (sc.isSuccess()){
//if (msgLvl(MSG::DEBUG)) msg() << "Clusters successfully added to Container !"<< endreq;
}else{
if (sc.isFailure()){
msg(MSG:: ERROR) << "Failed to add Clusters to container"<< endreq;
return StatusCode::FAILURE;
}
} else {
//if (msgLvl(MSG::DEBUG)) msg() << "Clustering algorithm found no clusters"<< endreq;
// -me- clean up memory
delete (clusterCollection);
}
......@@ -202,12 +193,14 @@ namespace InDet{
}
if (msgLvl(MSG::DEBUG)) msg() << "Ambiguities map has " << AmbiguitiesMap->size() << " elements" << endreq;
sc = (!evtStore()->contains<PixelGangedClusterAmbiguities>("PixelClusterAmbiguitiesMap")) ? evtStore()->record(AmbiguitiesMap,"PixelClusterAmbiguitiesMap",false) : StatusCode::SUCCESS;
//sc = evtStore()->record(std::move(AmbiguitiesMap),"PixelClusterAmbiguitiesMap",false);
const bool alreadyHaveMap(evtStore()->contains<PixelGangedClusterAmbiguities>("PixelClusterAmbiguitiesMap"));
sc = (not alreadyHaveMap) ? evtStore()->record(std::move(AmbiguitiesMap),"PixelClusterAmbiguitiesMap",false) : StatusCode::SUCCESS;
if (sc.isFailure()){
msg(MSG:: FATAL)<< "PixelClusterAmbiguitiesMap could not be recorded in StoreGate !"<< endreq;
return StatusCode::FAILURE;
}else{
if (msgLvl(MSG::DEBUG)) msg() << "PixelClusterAmbiguitiesMap recorded in StoreGate" << endreq;
ATH_MSG_DEBUG( "PixelClusterAmbiguitiesMap recorded in StoreGate");
}
}
return StatusCode::SUCCESS;
......@@ -215,7 +208,7 @@ namespace InDet{
//----------------------------------------------------------------------------
// Finalize method:
StatusCode PixelClusterization::finalize(){
msg(MSG::INFO) << "PixelClusterization::finalize() " << PACKAGE_VERSION << endreq;
ATH_MSG_INFO( "PixelClusterization::finalize() " << PACKAGE_VERSION );
m_clusterContainer->cleanup();
m_clusterContainer->release();
return StatusCode::SUCCESS;
......
......@@ -39,13 +39,15 @@ namespace InDet{
m_managerName("SCT"),
m_clustersName("SCT_Clusters"),
m_page(0),
m_idHelper(0),
m_idHelper(nullptr),
m_maxKey(0),
m_clusterContainer(0),
m_clusterContainer(nullptr),
m_manager(nullptr),
m_maxRDOs(384), //(77),
m_pSummarySvc("SCT_ConditionsSummarySvc", name),
m_flaggedConditionSvc("SCT_FlaggedConditionSvc",name),
m_checkBadModules(true),
m_flaggedModules(),
m_maxTotalOccupancyPercent(10)
{
// Get parameter values from jobOptions file
......@@ -64,32 +66,27 @@ namespace InDet{
// Initialize method:
StatusCode SCT_Clusterization::initialize(){
msg(MSG::INFO) << "SCT_Clusterization::initialize()!" << endreq;
ATH_MSG_INFO( "SCT_Clusterization::initialize()!");
static const StatusCode fail(StatusCode::FAILURE);
// Get the conditions summary service (continue anyway, just check the pointer
// later and declare everything to be 'good' if it is NULL)
if (m_checkBadModules){
msg(MSG::INFO) << "Clusterization has been asked to look at bad module info" << endreq;
if (m_pSummarySvc.retrieve().isFailure())
msg(MSG:: ERROR) << "Conditions summary service not found !" << endreq;
ATH_MSG_INFO( "Clusterization has been asked to look at bad module info" );
ATH_CHECK(m_pSummarySvc.retrieve());
}
// Get the flagged conditions service
if (m_flaggedConditionSvc.retrieve().isFailure())
return msg(MSG:: ERROR) << "Flagged conditions service not found !" << endreq, fail;
ATH_CHECK(m_flaggedConditionSvc.retrieve());
// Get the clustering tool
if (m_clusteringTool.retrieve().isFailure())
return (msg(MSG:: FATAL) << m_clusteringTool.propertyName() << ": Failed to retrieve tool " << m_clusteringTool.type() << endreq), fail;
ATH_CHECK (m_clusteringTool.retrieve());
// Get the SCT manager
if (detStore()->retrieve(m_manager,"SCT").isFailure())
return (msg(MSG:: FATAL) << "Cannot retrieve detector manager!" << endreq), fail;
ATH_CHECK (detStore()->retrieve(m_manager,"SCT"));
// Get the SCT ID helper
if (detStore()->retrieve(m_idHelper,"SCT_ID").isFailure())
return (msg(MSG:: FATAL) << "Cannot retrieve ID helper!" << endreq), fail;
ATH_CHECK (detStore()->retrieve(m_idHelper,"SCT_ID"));
// Instantiate a cluster container to record later
m_clusterContainer = new SCT_ClusterContainer(m_idHelper->wafer_hash_max());
......@@ -116,9 +113,6 @@ namespace InDet{
// Execute method:
StatusCode SCT_Clusterization::execute(){
#ifndef NDEBUG
ATH_MSG_DEBUG("SCT_Clusterization::execute()");
#endif
static const StatusCode fail(StatusCode::FAILURE);
// Register the IdentifiableContainer into StoreGate
m_clusterContainer->cleanup();
......@@ -211,7 +205,7 @@ namespace InDet{
msg(MSG::INFO)
<< "Number of noisy modules killed by maximum RDO limit of "
<< m_maxRDOs << " = " << m_flaggedModules.size() << endreq;
msg(MSG::INFO) << "Printing info on upto 10 modules:" << endreq;
msg(MSG::INFO) << "Printing info on up to 10 modules:" << endreq;
std::set<IdentifierHash>::const_iterator itr(m_flaggedModules.begin());
std::set<IdentifierHash>::const_iterator end(m_flaggedModules.end());
for (int num(0); (itr != end) && (num < 10) ; ++itr, ++num) {
......@@ -219,7 +213,6 @@ namespace InDet{
}
}
m_clusterContainer->cleanup();
//delete m_clusterContainer;
m_clusterContainer->release();
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