Commit ad92c60b authored by Walter Lampl's avatar Walter Lampl
Browse files

migrate egammaOQFlagsBuilder to CondReadHandle for LAr bad channels

parent 044cc25d
......@@ -4,9 +4,6 @@ import egammaToolsConf
from egammaRec.Factories import FcnWrapper, ToolFactory
from egammaRec import egammaKeys
from LArBadChannelTool import LArBadChannelToolConf
LArBadChanTool = ToolFactory( LArBadChannelToolConf.LArBadChanTool )
from CaloTools import CaloAffectedToolDefault as CATD
CaloAffectedToolDefault = ToolFactory( CATD.CaloAffectedToolDefault )
......@@ -19,5 +16,4 @@ egammaOQFlagsBuilder = ToolFactory( egammaToolsConf.egammaOQFlagsBuilder,
TCutVsE = 2.,
RcellCut = 0.8,
CellsName = egammaKeys.caloCellKey(),
LArBadChannelTool = LArBadChanTool,
affectedTool = CaloAffectedToolDefault)
......@@ -12,9 +12,7 @@
#include "StoreGate/StoreGateSvc.h"
#include "CaloConditions/CaloAffectedRegionInfoVec.h"
#include "LArCabling/LArCablingService.h"
#include "Identifier/HWIdentifier.h"
#include "LArRecConditions/ILArBadChanTool.h"
#include "CaloIdentifier/LArEM_ID.h"
#include "CaloIdentifier/CaloCell_ID.h"
#include "CLHEP/Units/SystemOfUnits.h"
......@@ -61,21 +59,10 @@ StatusCode egammaOQFlagsBuilder::initialize()
ATH_MSG_DEBUG(" Initializing egammaOQFlagsBuilder");
ATH_CHECK(m_cellsKey.initialize());
ATH_CHECK(m_bcContKey.initialize());
StatusCode sc;
// Get BadChannelTool
sc=m_badChannelTool.retrieve();
if (sc.isFailure()) {
msg(MSG::ERROR) << "Could not retrieve LArBadChannelTool " << m_badChannelTool << endmsg;
return StatusCode::FAILURE;
} else {
//if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "LArBadChannelTool" << m_badChannelTool << " retrieved" << endmsg;
}
//Get CaloAffectedTool
sc = m_affectedTool.retrieve();
//Get CaloAffectedTool
StatusCode sc = m_affectedTool.retrieve();
if (sc.isFailure()){
msg(MSG::ERROR) << "Could not retrieve CaloAffectedTool " << m_affectedTool << endmsg;
return StatusCode::FAILURE;
......@@ -84,16 +71,6 @@ StatusCode egammaOQFlagsBuilder::initialize()
}
//Get LArCablingService
sc=m_larCablingSvc.retrieve();
if (sc.isFailure()) {
msg(MSG::ERROR) << "Could not retrieve LArCablingService " << m_larCablingSvc << endmsg;
return StatusCode::FAILURE;
} else {
//if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "LArCablingService" << m_larCablingSvc << " retrieved" << endmsg;
}
sc=detStore()->retrieve(m_calocellId, "CaloCell_ID");
if(sc.isFailure()){
msg(MSG::WARNING) << "Cannot retrieve online_id" << endmsg;
......@@ -228,6 +205,10 @@ StatusCode egammaOQFlagsBuilder::execute(const EventContext& ctx, xAOD::Egamma*
if (foundCentralCell) {
//Find the list of neighbours cells, to define the 3x3 cluster core
std::vector<IdentifierHash> neighbourList = findNeighbours(cellCentrId);
//Get Bad-channel info for this event
SG::ReadCondHandle<LArBadChannelCont> larBadChanHdl{m_bcContKey,ctx};
const LArBadChannelCont* larBadChanCont=*larBadChanHdl;
//Loop over all the Lar cluster cells
xAOD::CaloCluster::const_cell_iterator cellIter = cluster->cell_begin();
......@@ -269,8 +250,7 @@ StatusCode egammaOQFlagsBuilder::execute(const EventContext& ctx, xAOD::Egamma*
//======================== Set LAr bits ============================================================//
//
HWIdentifier LArhwid = m_larCablingSvc->createSignalChannelIDFromHash(cell->caloDDE()->calo_hash());
LArBadChannel bc = m_badChannelTool->status(LArhwid);
const LArBadChannel bc = larBadChanCont-> offlineStatus(cell->ID());
//
if(isACoreCell) {
if((cell->provenance() & 0x0A00) == 0x0A00) {
......
......@@ -29,10 +29,12 @@ Most of the informations are given separately for each layer of the EM calorimet
#include "xAODEgamma/EgammaFwd.h"
#include "xAODCaloEvent/CaloClusterFwd.h"
#include "StoreGate/ReadHandleKey.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "LArRecConditions/LArBadChannelCont.h"
#include "LArCabling/LArOnOffIdMapping.h"
class IToolSvc;
class CaloCellContainer;
class ILArBadChanTool;
class HWIdentifier;
class LArEM_ID;
class CaloCell_ID;
......@@ -56,13 +58,10 @@ class egammaOQFlagsBuilder : public egammaBaseTool
StatusCode finalize();
private:
/** Handle to bad-channel tools */
ToolHandle<ILArBadChanTool> m_badChannelTool {this,
"LArBadChannelTool", "LArBadChanTool", "This is the larBadChannelTool"};
ToolHandle<LArCablingService> m_larCablingSvc {this,
"LArCablingService", "LArCablingService", "LArCablingService"};
/** Handle to bad-channel CDO */
SG::ReadCondHandleKey<LArBadChannelCont> m_bcContKey{this,
"LArBadChannelKey","LArBadChannel","Key of the LArBadChannelCont CDO"};
ToolHandle<ICaloAffectedTool> m_affectedTool {this,
"affectedTool", "CaloAffectedTool", "CaloAffectedTool"};
......
Supports Markdown
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