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

CaloTriggerTool: Use AthMessaging in LArTTCellMap.

Use AthMessaging in LArTTCellMap.
In passing, fix cppcheck warnings.
parent e122725b
No related branches found
No related tags found
No related merge requests found
...@@ -8,12 +8,12 @@ ...@@ -8,12 +8,12 @@
#include "Identifier/Identifier.h" #include "Identifier/Identifier.h"
#include "CaloTriggerTool/LArTTCell.h" #include "CaloTriggerTool/LArTTCell.h"
#include "CaloTriggerTool/LArTTCell_P.h" #include "CaloTriggerTool/LArTTCell_P.h"
#include "CaloIdentifier/LArID_Exception.h" #include "CaloIdentifier/LArID_Exception.h"
#include "AthenaBaseComps/AthMessaging.h"
#include <vector> #include <vector>
#include <map> #include <map>
class MsgStream ;
/** /**
@brief This is a StoreGate object holding the offline TT-cell map @brief This is a StoreGate object holding the offline TT-cell map
...@@ -25,6 +25,7 @@ class MsgStream ; ...@@ -25,6 +25,7 @@ class MsgStream ;
*/ */
class LArTTCellMap class LArTTCellMap
: public AthMessaging
{ {
public: public:
...@@ -70,8 +71,6 @@ private: ...@@ -70,8 +71,6 @@ private:
// std::map<HWIdentifier,Identifier> m_on2offIdMap; // std::map<HWIdentifier,Identifier> m_on2offIdMap;
LArTTCell_P m_persData; LArTTCell_P m_persData;
MsgStream* m_msg ;
}; };
#include "AthenaKernel/CLASS_DEF.h" #include "AthenaKernel/CLASS_DEF.h"
......
...@@ -7,25 +7,17 @@ ...@@ -7,25 +7,17 @@
#include "CaloIdentifier/LArEM_ID.h" #include "CaloIdentifier/LArEM_ID.h"
#include "CaloIdentifier/LArHEC_ID.h" #include "CaloIdentifier/LArHEC_ID.h"
#include "CaloIdentifier/LArFCAL_ID.h" #include "CaloIdentifier/LArFCAL_ID.h"
#include "GaudiKernel/ISvcLocator.h" #include "AthenaKernel/getMessageSvc.h"
#include "GaudiKernel/Bootstrap.h"
#include "GaudiKernel/MsgStream.h" #include "GaudiKernel/MsgStream.h"
#include "GaudiKernel/IMessageSvc.h" #include "GaudiKernel/ServiceHandle.h"
#include "StoreGate/StoreGateSvc.h" #include "StoreGate/StoreGateSvc.h"
#include <iostream> #include <iostream>
LArTTCellMap::LArTTCellMap( ): m_msg(nullptr) LArTTCellMap::LArTTCellMap( )
: AthMessaging (Athena::getMessageSvc(), "LArTTCellMap")
{ {
IMessageSvc *msgSvc;
StatusCode status =Gaudi::svcLocator()->service("MessageSvc",msgSvc);
if(status.isFailure()){
std::cout << "Cannot locate MessageSvc" << std::endl;
}
m_msg = new MsgStream ( msgSvc, "LArTTCellMap");
msgSvc->release() ;
} }
...@@ -40,35 +32,30 @@ void LArTTCellMap::set( const LArTTCell& m ) ...@@ -40,35 +32,30 @@ void LArTTCellMap::set( const LArTTCell& m )
convert_to_P(m); convert_to_P(m);
if (m_msg->level() <= MSG::DEBUG) { ATH_MSG_DEBUG( " LArTTCell size = "<<m.size() );
(*m_msg) <<MSG::DEBUG<<" LArTTCell size = "<<m.size() <<endmsg;
} ServiceHandle<StoreGateSvc> detStore ("DetectorStore", "LArTTCellMap");
StoreGateSvc * detStore;
StatusCode status = Gaudi::svcLocator()->service("DetectorStore",detStore);
if(status.isFailure()){
(*m_msg) << MSG::ERROR << "Cannot locate DetectorStore" << endmsg;
}
const LArEM_ID* em_id; const LArEM_ID* em_id;
const LArHEC_ID* hec_id; const LArHEC_ID* hec_id;
const LArFCAL_ID* fcal_id; const LArFCAL_ID* fcal_id;
const CaloLVL1_ID* lvl1_id; const CaloLVL1_ID* lvl1_id;
status=detStore->retrieve(em_id); StatusCode status=detStore->retrieve(em_id);
if(status.isFailure()){ if(status.isFailure()){
(*m_msg) << MSG::ERROR << "Cannot retrieve em_id" << endmsg; ATH_MSG_ERROR( "Cannot retrieve em_id" );
} }
status=detStore->retrieve(hec_id); status=detStore->retrieve(hec_id);
if(status.isFailure()){ if(status.isFailure()){
(*m_msg) << MSG::ERROR << "Cannot retrieve hec_id" << endmsg; ATH_MSG_ERROR( "Cannot retrieve hec_id" );
} }
status=detStore->retrieve(fcal_id); status=detStore->retrieve(fcal_id);
if(status.isFailure()){ if(status.isFailure()){
(*m_msg) << MSG::ERROR << "Cannot retrieve fcal_id" << endmsg; ATH_MSG_ERROR( "Cannot retrieve fcal_id" );
} }
status=detStore->retrieve(lvl1_id); status=detStore->retrieve(lvl1_id);
if(status.isFailure()){ if(status.isFailure()){
(*m_msg) << MSG::ERROR << "Cannot retrieve lvl1_id" << endmsg; ATH_MSG_ERROR( "Cannot retrieve lvl1_id" );
} }
LArTTCell::const_iterator it = m.begin(); LArTTCell::const_iterator it = m.begin();
LArTTCell::const_iterator it_e = m.end(); LArTTCell::const_iterator it_e = m.end();
...@@ -93,35 +80,29 @@ void LArTTCellMap::set( const LArTTCell& m ) ...@@ -93,35 +80,29 @@ void LArTTCellMap::set( const LArTTCell& m )
id = fcal_id->channel_id(t.pn,t.region,t.eta,t.phi); id = fcal_id->channel_id(t.pn,t.region,t.eta,t.phi);
} else { } else {
(*m_msg) <<MSG::ERROR <<" Wrong input Detector Number " << t.det << endmsg; ATH_MSG_ERROR( " Wrong input Detector Number " << t.det );
} }
Identifier sid = lvl1_id->layer_id(t.tpn,t.tsample,t.tregion,t.teta,t.tphi,t.layer); Identifier sid = lvl1_id->layer_id(t.tpn,t.tsample,t.tregion,t.teta,t.tphi,t.layer);
if (m_msg->level() <= MSG::VERBOSE) { ATH_MSG_VERBOSE( " db struct= "
(*m_msg) <<MSG::VERBOSE <<" det="<<t.det
<< " db struct= " <<" pn="<<t.pn
<<" det="<<t.det <<" region="<<t.region
<<" pn="<<t.pn <<" sample="<<t.sample
<<" region="<<t.region <<" eta="<<t.eta<<" phi="<<t.phi
<<" sample="<<t.sample <<" trig pn="<<t.tpn
<<" eta="<<t.eta<<" phi="<<t.phi <<" trig region="<<t.tregion
<<" trig pn="<<t.tpn <<" trig sample="<<t.tsample
<<" trig region="<<t.tregion <<" trig eta="<<t.teta<<" trig phi="<<t.tphi
<<" trig sample="<<t.tsample <<" layer="<<t.layer );
<<" trig eta="<<t.teta<<" trig phi="<<t.tphi ATH_MSG_VERBOSE( " lvl1 id = " << sid<<" offline id ="<<id );
<<" layer="<<t.layer
<< endmsg;
(*m_msg) <<MSG::VERBOSE<< " lvl1 id = " << sid<<" offline id ="<<id<<endmsg;
}
if(!(cellIdSet.insert(id)).second) { if(!(cellIdSet.insert(id)).second) {
(*m_msg) <<MSG::ERROR<<" Duplicate cell id " ATH_MSG_ERROR( " Duplicate cell id "
<< lvl1_id->show_to_string(id) << lvl1_id->show_to_string(id)
<< " in TT= " << " in TT= "
<< lvl1_id->show_to_string(sid) << lvl1_id->show_to_string(sid) );
<< endmsg;
} }
m_cell2ttIdMap[id] = sid; m_cell2ttIdMap[id] = sid;
...@@ -167,13 +148,11 @@ void LArTTCellMap::set( const LArTTCell& m ) ...@@ -167,13 +148,11 @@ void LArTTCellMap::set( const LArTTCell& m )
catch (LArID_Exception& except) { catch (LArID_Exception& except) {
(*m_msg) <<MSG::ERROR<<" Failed in LArTTCellMap::set " << endmsg; ATH_MSG_ERROR( " Failed in LArTTCellMap::set " );
(*m_msg) <<MSG::ERROR<< (std::string) except << endmsg ; ATH_MSG_ERROR( (std::string) except );
} }
if (m_msg->level() <= MSG::DEBUG) { ATH_MSG_DEBUG( " LArTTCellMap::set : number of cell Ids="<<m_cell2ttIdMap.size() );
(*m_msg) <<MSG::DEBUG<<" LArTTCellMap::set : number of cell Ids="<<m_cell2ttIdMap.size()<<std::endl;
}
detStore->release() ; detStore->release() ;
...@@ -190,7 +169,7 @@ Identifier LArTTCellMap::whichTTID(const Identifier& id) const ...@@ -190,7 +169,7 @@ Identifier LArTTCellMap::whichTTID(const Identifier& id) const
return (*it).second; return (*it).second;
} }
(*m_msg) <<MSG::ERROR<<" Offline TT ID not found for cell "<< id <<endmsg; ATH_MSG_ERROR( " Offline TT ID not found for cell "<< id );
return Identifier(); return Identifier();
...@@ -211,9 +190,7 @@ LArTTCellMap::createCellIDvec(const Identifier & sid) const ...@@ -211,9 +190,7 @@ LArTTCellMap::createCellIDvec(const Identifier & sid) const
return (*it).second; return (*it).second;
} }
if (m_msg->level() <= MSG::VERBOSE) { ATH_MSG_VERBOSE( " vector of offline cell ID not found, TT id = " <<sid.get_compact() );
(*m_msg) <<MSG::VERBOSE<<" vector of offline cell ID not found, TT id = " <<sid.get_compact()<< endmsg;
}
static const std::vector<Identifier> v; static const std::vector<Identifier> v;
return v ; return v ;
......
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