Skip to content
Snippets Groups Projects
Commit 77af43da authored by Walter Lampl's avatar Walter Lampl Committed by Adam Edward Barton
Browse files

LArCellDeadOTXCorr: ReadCondHandles & ToolHandles

Former-commit-id: 1d02cd84
parent a49e5feb
No related branches found
No related tags found
No related merge requests found
...@@ -61,10 +61,10 @@ atlas_add_test( LArBadFebMaskingTool_test ...@@ -61,10 +61,10 @@ atlas_add_test( LArBadFebMaskingTool_test
EXTRA_PATTERNS "LArDetectorToolNV|is still valid|no data retrieved|Database being retired|Reading file|Unable to locate catalog|Resolved path|DigitizationFlags|^Domain|created CondCont|no dictionary for class|^ +[+]|Reading LArPedestalMC|IOV callback|^DetectorStore|Cache alignment" ) EXTRA_PATTERNS "LArDetectorToolNV|is still valid|no data retrieved|Database being retired|Reading file|Unable to locate catalog|Resolved path|DigitizationFlags|^Domain|created CondCont|no dictionary for class|^ +[+]|Reading LArPedestalMC|IOV callback|^DetectorStore|Cache alignment" )
atlas_add_test( LArCellDeadOTXCorr_test #atlas_add_test( LArCellDeadOTXCorr_test
SCRIPT test/LArCellDeadOTXCorr_test.sh # SCRIPT test/LArCellDeadOTXCorr_test.sh
PROPERTIES TIMEOUT 600 # PROPERTIES TIMEOUT 600
EXTRA_PATTERNS "LArDetectorToolNV|is still valid|no data retrieved|Database being retired|Reading file|Unable to locate catalog|Resolved path|DigitizationFlags|^Domain|created CondCont|no dictionary for class|^ +[+]|Reading LArPedestalMC|IOV callback|^DetectorStore|Cache alignment" ) # EXTRA_PATTERNS "LArDetectorToolNV|is still valid|no data retrieved|Database being retired|Reading file|Unable to locate catalog|Resolved path|DigitizationFlags|^Domain|created CondCont|no dictionary for class|^ +[+]|Reading LArPedestalMC|IOV callback|^DetectorStore|Cache alignment" )
atlas_add_test( LArCellBuilderFromLArHitTool_test atlas_add_test( LArCellBuilderFromLArHitTool_test
......
...@@ -10,20 +10,8 @@ def LArCellDeadOTXCorrToolDefault(name='LArCellDeadOTXCorr'): ...@@ -10,20 +10,8 @@ def LArCellDeadOTXCorrToolDefault(name='LArCellDeadOTXCorr'):
mlog.error("could not get handle to LArCellDeadOTXCorr Quit") mlog.error("could not get handle to LArCellDeadOTXCorr Quit")
print traceback.format_exc() print traceback.format_exc()
return False return False
try :
from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool
theLArBadChannelTool=LArBadChanTool()
except:
mlog.error("could not access bad channel tool Quit")
print traceback.format_exc()
return False
from AthenaCommon.AppMgr import ToolSvc
ToolSvc+=theLArBadChannelTool
theLArCellDeadOTXCorr.badChannelTool = theLArBadChannelTool
from AthenaCommon.GlobalFlags import globalflags from AthenaCommon.GlobalFlags import globalflags
ignoredTTs = [] ignoredTTs = []
deadOTXCorrDbFolder = "/LAR/CellCorrOfl/deadOTX" deadOTXCorrDbFolder = "/LAR/CellCorrOfl/deadOTX"
if globalflags.DataSource()=='data' : if globalflags.DataSource()=='data' :
......
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/ */
/** /**
* @file LArCellDeadOTXCorr.cxx * @file LArCellDeadOTXCorr.cxx
* @brief CaloCell energy correction tool for missing FEBs * @brief CaloCell energy correction tool for missing FEBs
...@@ -44,15 +43,10 @@ ...@@ -44,15 +43,10 @@
#include "CaloEvent/CaloCellContainer.h" #include "CaloEvent/CaloCellContainer.h"
#include "CaloIdentifier/CaloIdManager.h" #include "CaloIdentifier/CaloIdManager.h"
#include "CaloIdentifier/CaloCell_ID.h" #include "CaloIdentifier/CaloCell_ID.h"
#include "CaloIdentifier/LArEM_ID.h"
#include "CaloEvent/CaloCell.h" #include "CaloEvent/CaloCell.h"
#include "LArRawEvent/LArFebErrorSummary.h" #include "LArRawEvent/LArFebErrorSummary.h"
#include "LArIdentifier/LArOnlineID.h" #include "LArIdentifier/LArOnlineID.h"
#include "LArRecConditions/ILArBadChanTool.h"
#include "LArCabling/LArCablingService.h"
#include "CaloTriggerTool/CaloTriggerTowerService.h" #include "CaloTriggerTool/CaloTriggerTowerService.h"
// #include "TrigT1CaloCalibTools/L1CaloTTIdTools.h"
//#include "TrigT1CaloEvent/TriggerTowerCollection.h"
#include "xAODTrigL1Calo/TriggerTowerContainer.h" #include "xAODTrigL1Calo/TriggerTowerContainer.h"
#include "CaloIdentifier/CaloLVL1_ID.h" #include "CaloIdentifier/CaloLVL1_ID.h"
...@@ -118,26 +112,24 @@ LArCellDeadOTXCorr::LArCellDeadOTXCorr( ...@@ -118,26 +112,24 @@ LArCellDeadOTXCorr::LArCellDeadOTXCorr(
const std::string& name, const std::string& name,
const IInterface* parent) const IInterface* parent)
: base_class(type, name, parent), : base_class(type, name, parent),
m_cablingService("LArCablingService"),
m_caloMgr(nullptr), m_caloMgr(nullptr),
m_lvl1Helper(nullptr), m_lvl1Helper(nullptr),
m_calo_id(nullptr), m_calo_id(nullptr),
m_onlineID(nullptr), m_onlineID(nullptr),
m_TT_ID(nullptr), m_TT_ID(nullptr),
m_l1CondSvc(nullptr), m_l1CondSvc(nullptr),
m_ttSvc(nullptr) m_ttSvc("CaloTriggerTowerService")
{ {
declareProperty("triggerTowerLocation", m_TTLocation = "xAODTriggerTowers"); declareProperty("triggerTowerLocation", m_TTLocation = "xAODTriggerTowers");
declareProperty("badChannelTool",m_badChannelTool);
declareProperty("triggerNoiseCut", m_triggerNoiseCut); declareProperty("triggerNoiseCut", m_triggerNoiseCut);
declareProperty("useL1CaloDB", m_useL1CaloDBProp = false); declareProperty("useL1CaloDB", m_useL1CaloDBProp = false);
declareProperty("ignoredTTs", m_ignoredTTs); declareProperty("ignoredTTs", m_ignoredTTs);
declareProperty("CaloTriggerTowerService",m_ttSvc);
declareConstant("etaCalibrationSizes", m_etaCalibrationSizes); declareConstant("etaCalibrationSizes", m_etaCalibrationSizes);
declareConstant("etaCalibrations", m_etaCalibrations); declareConstant("etaCalibrations", m_etaCalibrations);
declareConstant("energyCalibrationTypes", m_energyCalibrationTypes); declareConstant("energyCalibrationTypes", m_energyCalibrationTypes);
declareConstant("energyCalibrations", m_energyCalibrations); declareConstant("energyCalibrations", m_energyCalibrations);
finish_ctor(); finish_ctor();
m_useL1CaloDB = m_useL1CaloDBProp; m_useL1CaloDB = m_useL1CaloDBProp;
...@@ -199,15 +191,12 @@ StatusCode LArCellDeadOTXCorr::initialize() ...@@ -199,15 +191,12 @@ StatusCode LArCellDeadOTXCorr::initialize()
ATH_MSG_INFO ("L1Calo database won't be used. Pedestal values will be constant and equal to 32."); ATH_MSG_INFO ("L1Calo database won't be used. Pedestal values will be constant and equal to 32.");
const CaloIdManager* caloIdMgr; ATH_CHECK( m_badFebKey.initialize());
ATH_CHECK( detStore()->retrieve( caloIdMgr ) ); ATH_CHECK( m_cablingKey.initialize());
m_calo_id = caloIdMgr->getCaloCell_ID();
ATH_CHECK( m_cablingService.retrieve() );
ATH_CHECK( detStore()->retrieve(m_onlineID, "LArOnlineID") ); ATH_CHECK( detStore()->retrieve(m_onlineID, "LArOnlineID") );
ATH_CHECK( detStore()->retrieve(m_calo_id, "CaloCell_ID") );
ATH_CHECK( detStore()->retrieve(m_caloMgr) ); ATH_CHECK( detStore()->retrieve(m_caloMgr) );
// Use the CaloIdManager to get a pointer to an instance of the CaloLVL1_ID helper // Use the CaloIdManager to get a pointer to an instance of the CaloLVL1_ID helper
m_lvl1Helper = m_caloMgr->getLVL1_ID(); m_lvl1Helper = m_caloMgr->getLVL1_ID();
if (!m_lvl1Helper) { if (!m_lvl1Helper) {
...@@ -215,29 +204,10 @@ StatusCode LArCellDeadOTXCorr::initialize() ...@@ -215,29 +204,10 @@ StatusCode LArCellDeadOTXCorr::initialize()
return StatusCode::FAILURE; return StatusCode::FAILURE;
} }
// ..... need cabling services, to get channels associated to each TT
IToolSvc* toolSvc = 0;
ATH_CHECK( service( "ToolSvc",toolSvc ) );
ATH_CHECK( toolSvc->retrieveTool("CaloTriggerTowerService",m_ttSvc) );
/*
IAlgTool *algtool;
sc = toolSvc->retrieveTool("L1CaloTTIdTools", algtool);
ATH_MSG_DEBUG("L1CaloTTIdTools retrieved" );
if (sc!=StatusCode::SUCCESS) {
ATH_MSG_WARNING( " Cannot get L1CaloTTIdTools !" );
// m_bTTMapInitialized = false;
}
m_l1CaloTTIdTools = dynamic_cast<L1CaloTTIdTools*> (algtool);
*/
m_useL1CaloDB = m_useL1CaloDBProp; m_useL1CaloDB = m_useL1CaloDBProp;
ATH_CHECK( m_badChannelTool.retrieve() );
ATH_CHECK( detStore()->retrieve(m_TT_ID) ); ATH_CHECK( detStore()->retrieve(m_TT_ID) );
ATH_CHECK( m_ttSvc.retrieve());
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
...@@ -248,15 +218,21 @@ StatusCode LArCellDeadOTXCorr::initialize() ...@@ -248,15 +218,21 @@ StatusCode LArCellDeadOTXCorr::initialize()
StatusCode LArCellDeadOTXCorr::process(CaloCellContainer * cellCont ) { StatusCode LArCellDeadOTXCorr::process(CaloCellContainer * cellCont ) {
const EventContext& ctx = Gaudi::Hive::currentContext(); const EventContext& ctx = Gaudi::Hive::currentContext();
ATH_MSG_DEBUG (" in process..."); ATH_MSG_DEBUG (" in process...");
ATH_MSG_DEBUG (" Nb of eta calibration factors found : "<<m_etaCalibrations.size());
for(unsigned int i=0;i<m_etaCalibrations.size();i++) SG::ReadCondHandle<LArBadFebCont> badFebHdl{m_badFebKey,ctx};
{ const LArBadFebCont* badFebs=*badFebHdl;
ATH_MSG_DEBUG ("calibration["<<i<<"] = "<<m_etaCalibrations[i]);
} SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_cablingKey,ctx};
const LArOnOffIdMapping* cabling=*cablingHdl;
if (msgLvl(MSG::DEBUG)) {
msg(MSG::DEBUG) << " Nb of eta calibration factors found : "<<m_etaCalibrations.size() << endmsg;
for(unsigned int i=0;i<m_etaCalibrations.size();i++) {
msg(MSG::DEBUG) << "calibration["<<i<<"] = "<<m_etaCalibrations[i] << endmsg;
}
}
//Retrieve Trigger Towers from SG //Retrieve Trigger Towers from SG
//const TriggerTowerCollection* storedTTs = 0;
//const xAOD::TriggerTowerContainer* storedTTs = 0;
SG::ReadHandle<xAOD::TriggerTowerContainer> storedTTs(m_TTLocation, ctx); SG::ReadHandle<xAOD::TriggerTowerContainer> storedTTs(m_TTLocation, ctx);
if(!storedTTs.isValid()) { if(!storedTTs.isValid()) {
ATH_MSG_ERROR("Could not read container " << m_TTLocation.key()); ATH_MSG_ERROR("Could not read container " << m_TTLocation.key());
...@@ -285,6 +261,7 @@ StatusCode LArCellDeadOTXCorr::process(CaloCellContainer * cellCont ) { ...@@ -285,6 +261,7 @@ StatusCode LArCellDeadOTXCorr::process(CaloCellContainer * cellCont ) {
} }
} }
const LArBadFebCont::BadChanVec& allMissingFebs=badFebs->fullCont();
// vector of all missing cells Id // vector of all missing cells Id
std::vector<Identifier> cell_array; std::vector<Identifier> cell_array;
cell_array.reserve(512); cell_array.reserve(512);
...@@ -296,31 +273,24 @@ StatusCode LArCellDeadOTXCorr::process(CaloCellContainer * cellCont ) { ...@@ -296,31 +273,24 @@ StatusCode LArCellDeadOTXCorr::process(CaloCellContainer * cellCont ) {
trigtow.reserve(32); trigtow.reserve(32);
en_array.reserve(32); en_array.reserve(32);
std::vector<HWIdentifier>::const_iterator firstFeb = m_onlineID->feb_begin(); for (const LArBadFebCont::BadChanEntry& it : allMissingFebs) {
std::vector<HWIdentifier>::const_iterator lastFeb = m_onlineID->feb_end(); const LArBadFeb& febstatus=it.second;
if (febstatus.deadReadout()) {
const HWIdentifier febId(it.first);
// Step ONE - Loop Over FEB, find missing FEB //Loop over channels belonging to this FEB
for (std::vector<HWIdentifier>::const_iterator i= firstFeb; i != lastFeb; ++i) { const int chansPerFeb=m_onlineID->channelInSlotMax(febId);
HWIdentifier febId = (*i); for (int ch=0; ch<chansPerFeb; ++ch) {
LArBadFeb febstatus = m_badChannelTool->febStatus(febId); const HWIdentifier hwid = m_onlineID->channel_Id(febId, ch);
bool missing = febstatus.deadReadout(); if ( cabling->isOnlineConnected(hwid)) {
//bool missing = m_badChannelTool->febMissing(febId); const Identifier id=cabling->cnvToIdentifier(hwid);
if(missing){ cell_array.push_back(id);
//Find the corresponding Cell(s) }//end is connected
for (int ch=0; ch<128; ++ch) { }//end loop over channels on a feb
HWIdentifier hwid = m_onlineID->channel_Id(febId, ch); }//end if feb is dead
if (m_cablingService->isOnlineConnected(hwid)) { }//end loop over problematic febs
Identifier fid = m_cablingService->cnvToIdentifier( hwid);
//Save the CellIds //Debug printout:
cell_array.push_back(fid); //for (auto& c : cell_array) std::cout << "Missing cell: " << c.get_identifier32().get_compact() << std::endl;
} //If Online
}//Cell Loop
}//Missing FEB
} // loop over Febs
ATH_MSG_DEBUG (" Number of missing cells " << cell_array.size()); ATH_MSG_DEBUG (" Number of missing cells " << cell_array.size());
......
...@@ -31,19 +31,23 @@ ...@@ -31,19 +31,23 @@
// Headerfile // Headerfile
#include "AthenaBaseComps/AthAlgTool.h" #include "AthenaBaseComps/AthAlgTool.h"
#include "GaudiKernel/ToolHandle.h" //#include "GaudiKernel/ToolHandle.h"
#include "GaudiKernel/Property.h" #include "GaudiKernel/Property.h"
#include "StoreGate/StoreGateSvc.h" //#include "StoreGate/StoreGateSvc.h"
#include "StoreGate/ReadHandleKey.h" #include "StoreGate/ReadHandleKey.h"
#include "CaloInterface/ICaloCellMakerTool.h" #include "CaloInterface/ICaloCellMakerTool.h"
#include "AthenaKernel/IOVSvcDefs.h" //#include "AthenaKernel/IOVSvcDefs.h"
#include "Identifier/Identifier.h" #include "Identifier/Identifier.h"
#include "CaloConditions/Array.h" #include "CaloConditions/Array.h"
#include "CaloRec/ToolWithConstantsMixin.h" #include "CaloRec/ToolWithConstantsMixin.h"
#include "xAODTrigL1Calo/TriggerTowerContainer.h" #include "xAODTrigL1Calo/TriggerTowerContainer.h"
#include "StoreGate/ReadCondHandle.h"
#include "tbb/concurrent_unordered_map.h" #include "tbb/concurrent_unordered_map.h"
#include "LArRecConditions/LArBadChannelCont.h"
#include "LArCabling/LArOnOffIdMapping.h"
#include <string> #include <string>
#include <vector> #include <vector>
#include <map> #include <map>
...@@ -98,9 +102,11 @@ class LArCellDeadOTXCorr ...@@ -98,9 +102,11 @@ class LArCellDeadOTXCorr
// get a handle to the tool helper // get a handle to the tool helper
ToolHandle<ILArBadChanTool> m_badChannelTool; //ToolHandle<ILArBadChanTool> m_badChannelTool;
ToolHandle<LArCablingService> m_cablingService; //ToolHandle<LArCablingService> m_cablingService;
SG::ReadCondHandleKey<LArBadFebCont> m_badFebKey{this,"BadFebKey","LArBadFeb","Key of Bad-Feb object"};
SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this, "CablingKey", "LArOnOffIdMap","Cabling key"};
//std::string m_TTLocation; //std::string m_TTLocation;
SG::ReadHandleKey<xAOD::TriggerTowerContainer> m_TTLocation; SG::ReadHandleKey<xAOD::TriggerTowerContainer> m_TTLocation;
std::vector<double> m_triggerNoiseCut; std::vector<double> m_triggerNoiseCut;
...@@ -135,7 +141,8 @@ class LArCellDeadOTXCorr ...@@ -135,7 +141,8 @@ class LArCellDeadOTXCorr
L1CaloCondSvc* m_l1CondSvc; L1CaloCondSvc* m_l1CondSvc;
CaloTriggerTowerService* m_ttSvc; //CaloTriggerTowerService* m_ttSvc;
ToolHandle<CaloTriggerTowerService> m_ttSvc;
// L1CaloTTIdTools* m_l1CaloTTIdTools; // L1CaloTTIdTools* m_l1CaloTTIdTools;
double TTID_etaWidth(double eta) const; double TTID_etaWidth(double eta) const;
......
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