diff --git a/Calorimeter/CaloTools/python/CaloNoiseToolConfig.py b/Calorimeter/CaloTools/python/CaloNoiseToolConfig.py index 0c19a6e363784108ee6c80988ede1040edd64d39..f28eb308f0c2274d47b731092f6ba0ebfce4341a 100644 --- a/Calorimeter/CaloTools/python/CaloNoiseToolConfig.py +++ b/Calorimeter/CaloTools/python/CaloNoiseToolConfig.py @@ -92,10 +92,6 @@ def CaloNoiseToolCfg(configFlags): from LArCalibUtils.LArHVScaleConfig import LArHVScaleCfg result.merge( LArHVScaleCfg(configFlags) ) - from LArCondUtils.LArCondUtilsConf import LArHVToolDB - theLArHVToolDB = LArHVToolDB("LArHVToolDB") - result.addPublicTool( theLArHVToolDB ) - from LArCellRec.LArCellRecConf import LArCellHVCorr theLArCellHVCorr = LArCellHVCorr("LArCellHVCorr") result.addPublicTool( theLArCellHVCorr ) diff --git a/LArCalorimeter/LArCondUtils/src/LArHVToolDB.cxx b/LArCalorimeter/LArCondUtils/src/LArHVToolDB.cxx deleted file mode 100755 index dc7c04d45477b731482dd1ccd12a766e9d4448fc..0000000000000000000000000000000000000000 --- a/LArCalorimeter/LArCondUtils/src/LArHVToolDB.cxx +++ /dev/null @@ -1,671 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#include "LArHVToolDB.h" -#include "GaudiKernel/IToolSvc.h" -#include "StoreGate/StoreGateSvc.h" -#include "LArElecCalib/ILArHVPathologyDbTool.h" -#include "LArRecConditions/LArHVPathologiesDb.h" -#include "CaloDetDescr/CaloDetectorElements.h" -#include "CaloIdentifier/LArEM_ID.h" -#include "CaloIdentifier/LArHEC_ID.h" -#include "CaloIdentifier/LArFCAL_ID.h" -#include "CaloIdentifier/CaloIdManager.h" -#include "CaloDetDescr/CaloDetDescrManager.h" -#include "LArReadoutGeometry/EMBCell.h" -#include "LArHV/EMBHVElectrode.h" -#include "LArHV/EMBPresamplerHVModuleConstLink.h" -#include "LArHV/EMBPresamplerHVModule.h" -#include "LArReadoutGeometry/EMECCell.h" -#include "LArHV/EMECHVElectrode.h" -#include "LArHV/EMECPresamplerHVModuleConstLink.h" -#include "LArHV/EMECPresamplerHVModule.h" -#include "LArReadoutGeometry/HECCell.h" -#include "LArHV/HECHVSubgap.h" -#include "LArReadoutGeometry/FCALTile.h" -#include "LArHV/FCALHVLine.h" - -#include "LArHV/LArHVManager.h" - -#include "LArCabling/LArHVCablingTool.h" -#include "LArIdentifier/LArElectrodeID.h" -#include "LArIdentifier/LArHVLineID.h" - -#include "AthenaPoolUtilities/CondAttrListCollection.h" -#include "AthenaPoolUtilities/AthenaAttributeList.h" - -//#include <iostream> -#include <cmath> -#include <cstdlib> -#include "AthenaKernel/errorcheck.h" - - -const unsigned LArHVToolDB::m_nHVCoolChannels=453+4384; - -// constructor -LArHVToolDB::LArHVToolDB(const std::string& type, - const std::string& name, - const IInterface* parent) - : AthAlgTool(type,name,parent), - m_calodetdescrmgr(nullptr), - m_larem_id(nullptr), - m_larhec_id(nullptr), - m_larfcal_id(nullptr), - m_electrodeID(nullptr), - m_hvLineID(nullptr), - m_pathologyTool("LArHVPathologyDbTool"), - m_hvCablingTool("LArHVCablingTool"), - m_pathologyContainer(nullptr) - { - - declareInterface< ILArHVTool >( this ); - m_DCSFolderNames.push_back(std::string("/LAR/DCS/HV/BARREl/I16")); - m_DCSFolderNames.push_back(std::string("/LAR/DCS/HV/BARREL/I8")); - declareProperty("DCSFolder",m_DCSFolderNames,"LAr HV DCS Folders"); - declareProperty("HVPathologiesFolder",m_HVPathologiesFolderName="/LAR/HVPathologiesOfl/Pathologies","LAr HV Pathologies Folder"); -} - -// destructor -LArHVToolDB::~LArHVToolDB() -{ } - -StatusCode LArHVToolDB::LoadCalibration(IOVSVC_CALLBACK_ARGS_K( keys)) { - - CHECK(detStore()->retrieve(m_calodetdescrmgr)); - - std::set<size_t> DCSfolderIndices; - bool doPathology=false; - for (std::list<std::string>::const_iterator itr=keys.begin(); itr!=keys.end(); ++itr) { - ATH_MSG_DEBUG("Processing callback for SG key " << *itr); - if (*itr == m_HVPathologiesFolderName) { - doPathology=true; - } - else if(*itr == "/LAR/IdentifierOfl/HVLineToElectrodeMap") { //FIXME hardcoded foldername .The name is actually a jobO of LArHVCablingTool - msg(MSG::INFO) << "Received a callback on HV Cable Map. Need to (re)laod all HV DCS folders" << endmsg; - for(size_t i=0;i<m_DCSFolderNames.size();++i) { - DCSfolderIndices.insert(i); - m_voltageCache[i].clear(); //Clear voltage cache - } - } - else { - for(size_t i=0;i<m_DCSFolderNames.size();++i) { - if (*itr==m_DCSFolderNames[i]) { - DCSfolderIndices.insert(i); - m_nUpdatesPerFolder[i].m_nCallbacks++; - } - } - } - } - if (DCSfolderIndices.size()) { - ATH_MSG_DEBUG("Received a callback for " << DCSfolderIndices.size() << " HV folders."); - if (fillUpdatedHVChannelsVec(DCSfolderIndices).isFailure()) { - msg(MSG::ERROR) << "Call to fillUpdatedHVChannelsVec failed." << endmsg; - return StatusCode::FAILURE; - } - } - if (m_updatedElectrodes.size()>0) { - const LArHVManager *manager = NULL; - if (detStore()->retrieve(manager)==StatusCode::SUCCESS) { - manager->reset(); - } - } - - if (doPathology) { - msg(MSG::INFO) << " LArHVToolDB::LoadCalibration: Load HV pathology database " << endmsg; - if (m_pathologyContainer) delete m_pathologyContainer; - if (detStore()->contains<AthenaAttributeList>(m_HVPathologiesFolderName)) { - if (m_pathologiesHandle.isValid()) { - m_pathologyContainer = m_pathologyTool->attrList2HvPathology((*m_pathologiesHandle)); - msg (MSG::INFO) << " Number of HV pathologies found " << m_pathologyContainer->m_v.size() << endmsg; - for(unsigned i=0; i<m_pathologyContainer->m_v.size(); ++i) { - - LArHVPathologiesDb::LArHVElectPathologyDb electPath = m_pathologyContainer->m_v[i]; - Identifier id(electPath.cellID); - if (m_larem_id->is_lar_em(id)) { - IdentifierHash idHash = m_larem_id->channel_hash(id); - unsigned int index = (unsigned int)(idHash); - if (index<m_hasPathologyEM.size()) { - if(m_hasPathologyEM[index].size()) { - if(m_hasPathologyEM[index].size()<static_cast<size_t>(abs(electPath.electInd+1))) - m_hasPathologyEM[index].resize(electPath.electInd+1); - m_hasPathologyEM[index][electPath.electInd]=electPath.pathologyType; - } else { - std::vector<unsigned short> svec; - svec.resize(electPath.electInd+1); - svec[electPath.electInd]=electPath.pathologyType; - m_hasPathologyEM[index]=svec; - } - } - } - if (m_larhec_id->is_lar_hec(id)) { - IdentifierHash idHash = m_larhec_id->channel_hash(id); - unsigned int index = (unsigned int)(idHash); - if (index<m_hasPathologyHEC.size()) { - if(m_hasPathologyHEC[index].size()) { - if(m_hasPathologyHEC[index].size()<static_cast<size_t>(abs(electPath.electInd+1))) - m_hasPathologyHEC[index].resize(electPath.electInd+1); - m_hasPathologyHEC[index][electPath.electInd]=electPath.pathologyType; - } else { - std::vector<unsigned short> svec; - svec.resize(electPath.electInd+1); - svec[electPath.electInd]=electPath.pathologyType; - m_hasPathologyHEC[index]=svec; - } - } - } - if (m_larfcal_id->is_lar_fcal(id)) { - IdentifierHash idHash = m_larfcal_id->channel_hash(id); - unsigned int index = (unsigned int)(idHash); - if (index<m_hasPathologyFCAL.size()) { - if(m_hasPathologyFCAL[index].size()) { - if(m_hasPathologyFCAL[index].size()<static_cast<size_t>(abs(electPath.electInd+1))) - m_hasPathologyFCAL[index].resize(electPath.electInd+1); - m_hasPathologyFCAL[index][electPath.electInd]=electPath.pathologyType; - } else { - std::vector<unsigned short> svec; - svec.resize(electPath.electInd+1); - svec[electPath.electInd]=electPath.pathologyType; - m_hasPathologyFCAL[index]=svec; - } - - } - } - } - } - } - } - - return StatusCode::SUCCESS; - -} - - -StatusCode LArHVToolDB::finalize() { - for (size_t i=0;i<m_nUpdatesPerFolder.size();++i) { - msg(MSG::INFO) << "Folder: " << m_DCSFolderNames[i] - << ": # of Callbacks:" << m_nUpdatesPerFolder[i].m_nCallbacks - << ", # of actual voltage changes:" << m_nUpdatesPerFolder[i].m_nVoltageUpdates - << endmsg; - } - if (m_pathologyContainer) delete m_pathologyContainer; - return StatusCode::SUCCESS; -} - - -// intialize -StatusCode LArHVToolDB::initialize(){ - - const CaloCell_ID* cellID = nullptr; - ATH_CHECK( detStore()->retrieve (cellID, "CaloCell_ID") ); - - m_larem_id = cellID->em_idHelper(); - m_larhec_id = cellID->hec_idHelper(); - m_larfcal_id = cellID->fcal_idHelper(); - - // retrieve the LArElectrodeID helper - CHECK(detStore()->retrieve(m_electrodeID)); - - //retrieve the LArHVLineID helper - CHECK(detStore()->retrieve(m_hvLineID)); - -// register callback to Database folder - m_voltageCache.resize(m_DCSFolderNames.size()); - m_nUpdatesPerFolder.resize(m_DCSFolderNames.size()); - for (size_t i=0;i<m_DCSFolderNames.size();++i) { - const DataHandle<CondAttrListCollection> cHdl; - if ((detStore()->regFcn(&ILArHVTool::LoadCalibration,dynamic_cast<ILArHVTool*>(this),cHdl,m_DCSFolderNames[i])).isFailure()) { - msg(MSG::ERROR) << "cannot register callback to " << m_DCSFolderNames[i] << endmsg; - } - else - msg(MSG::INFO) << "Registered callback to DCS folder " << m_DCSFolderNames[i] << endmsg; - } - - m_pathologyContainer = 0; - m_hasPathologyEM.resize(m_larem_id->channel_hash_max()); - m_hasPathologyHEC.resize(m_larhec_id->channel_hash_max()); - m_hasPathologyFCAL.resize(m_larfcal_id->channel_hash_max()); - - if (detStore()->contains<AthenaAttributeList>( m_HVPathologiesFolderName)) { - StatusCode sc=detStore()->regFcn(&ILArHVTool::LoadCalibration,dynamic_cast<ILArHVTool*>(this),m_pathologiesHandle,m_HVPathologiesFolderName); - if (sc.isFailure()) - msg(MSG::ERROR) << "cannot register callback to " << m_HVPathologiesFolderName << endmsg; - else - msg(MSG::INFO) << "registered callback to " << m_HVPathologiesFolderName << endmsg; - } - else - msg(MSG::INFO) << " no information for HV pathology available " << endmsg; - - - // Get HVPathology tool - StatusCode sc = m_pathologyTool.retrieve(); - if(!sc.isSuccess()) { - msg(MSG::ERROR) << "Unable to initialize LArHVPathologyDbTool" << endmsg; - return sc; - } - else { - msg(MSG::INFO) << "Retrieved LArHVPathologyDbTool" << endmsg; - } - - - sc=m_hvCablingTool.retrieve(); - if(!sc.isSuccess()) { - msg(MSG::ERROR) << "Unable to retrieve LArHVCablingTool" << endmsg; - return sc; - } - - - sc=detStore()->regFcn(&LArHVCablingTool::iovCallback,&(*m_hvCablingTool), - &ILArHVTool::LoadCalibration,dynamic_cast<ILArHVTool*>(this)); - if (!sc.isSuccess()) { - msg(MSG::ERROR) << "Unable to register callback on LArHVCablingTool::iovCallback" << endmsg; - return sc; - } - else - msg(MSG::INFO) << "registered callback to LArHVCablingTool" << endmsg; - return StatusCode::SUCCESS; -} - - -StatusCode LArHVToolDB::getHV(const Identifier& id, - std::vector< HV_t > & v ) const -{ - std::vector< CURRENT_t> ihv; - return getPayload(id,v,ihv); -} - -StatusCode LArHVToolDB::getCurrent(const Identifier& id, - std::vector< CURRENT_t > & ihv ) const -{ - std::vector< HV_t> v; - return getPayload(id,v,ihv); -} - - -StatusCode LArHVToolDB::getPayload(const Identifier& id, std::vector< HV_t > & v, std::vector< CURRENT_t > & ihv) const -{ - - if (id==m_id) { - v = m_v; - ihv = m_i; - return StatusCode::SUCCESS; - } - - m_id = id; - - v.clear(); - ihv.clear(); - - std::vector<unsigned int> listElec; - -// check identifier in LAR - if (m_larem_id->is_lar_em(id) && m_larem_id->sampling(id) > 0) { -// LAr EMB - if (abs(m_larem_id->barrel_ec(id))==1) { - //std::cout << " in barrel " << m_larem_id->show_to_string(id) << std::endl; - unsigned int index = (unsigned int)(m_larem_id->channel_hash(id)); - bool hasPathology=false; - if (index<m_hasPathologyEM.size()) { - if (m_hasPathologyEM[index].size()) { - hasPathology=true; - listElec = getElecList(id); - } - } - const EMBDetectorElement* embElement = dynamic_cast<const EMBDetectorElement*>(m_calodetdescrmgr->get_element(id)); - if (!embElement) std::abort(); - const EMBCellConstLink cell = embElement->getEMBCell(); - unsigned int nelec = cell->getNumElectrodes(); - //std::cout << " nelec " << nelec << std::endl; - unsigned int ngap = 2*nelec; - double wt = 1./ngap; - for (unsigned int i=0;i<nelec;i++) { - const EMBHVElectrode& electrode = cell->getElectrode(i); - //std::cout << "electrode: endcap index, eta index , phi index, sector index , electrode index " << electrode->getModule()->getSideIndex() << - // " " << electrode->getModule()->getEtaIndex() << " " << electrode->getModule()->getPhiIndex() << - // " " << electrode->getModule()->getSectorIndex() << " " << electrode->getElectrodeIndex() << std::endl; - for (unsigned int igap=0;igap<2;igap++) { - double hv; - double curr; - electrode.voltage_current(igap,hv,curr); - if (hasPathology) { - msg(MSG::DEBUG) << "Has pathology for id: "<< m_larem_id->print_to_string(id)<<" "<<m_hasPathologyEM[index]<<endmsg; - msg(MSG::DEBUG) << "Original hv: "<<hv<<" "; - for (unsigned int ii=0;ii<listElec.size();ii++) { - if (listElec[ii]==(2*i+igap) && listElec[ii]<m_hasPathologyEM[index].size() && m_hasPathologyEM[index][listElec[ii]]) { - if(m_hasPathologyEM[index][listElec[ii]]&0xF) hv=0.; else hv=((m_hasPathologyEM[index][listElec[ii]]&0xFFF0)>>4); - curr=0.; - } - } - msg(MSG::DEBUG) << "set hv: "<<hv<<endmsg; - } - //std::cout << " hv value " << hv << std::endl; - //if (igap==1 && hv>1.) std::cout << " --- non zero value found for gap1 in barrel " << std::endl; - addHV(v,hv,wt); - addCurr(ihv,curr,wt); - - } - } - } -// LAr EMEC - else { - //std::cout << " in EMEC " << m_larem_id->show_to_string(id) << std::endl; - unsigned int index = (unsigned int)(m_larem_id->channel_hash(id)); - bool hasPathology=false; - if (index<m_hasPathologyEM.size()) { - if (m_hasPathologyEM[index].size()) { - hasPathology=true; - listElec = getElecList(id); - } - } - - const EMECDetectorElement* emecElement = dynamic_cast<const EMECDetectorElement*>(m_calodetdescrmgr->get_element(id)); - if (!emecElement) std::abort(); - const EMECCellConstLink cell = emecElement->getEMECCell(); - unsigned int nelec = cell->getNumElectrodes(); - //std::cout << " nelec " << nelec << std::endl; - unsigned int ngap = 2*nelec; - double wt = 1./ngap; - for (unsigned int i=0;i<nelec;i++) { - const EMECHVElectrode& electrode = cell->getElectrode(i); - // std::cout << "electrode: endcap index, eta index , phi index, sector index , electrode index " << electrode->getModule()->getSideIndex() << - // " " << electrode->getModule()->getEtaIndex() << " " << electrode->getModule()->getPhiIndex() << - // " " << electrode->getModule()->getSectorIndex() << " " << electrode->getElectrodeIndex() << std::endl; - for (unsigned int igap=0;igap<2;igap++) { - double hv; - double curr; - electrode.voltage_current(igap,hv,curr); - if (hasPathology) { - msg(MSG::DEBUG) << "Has pathology for id: "<< m_larem_id->print_to_string(id)<<" "<<m_hasPathologyEM[index]<<endmsg; - for (unsigned int ii=0;ii<listElec.size();ii++) { - if (listElec[ii]==(2*i+igap) && listElec[ii]<m_hasPathologyEM[index].size() && m_hasPathologyEM[index][listElec[ii]]) { - if(m_hasPathologyEM[index][listElec[ii]]&0xF) hv=0.; else hv=((m_hasPathologyEM[index][listElec[ii]]&0xFFF0)>>4); - curr=0.; - } - } - } - //std::cout << " hv value " << hv << std::endl; - //if (igap==1 && hv>1.) std::cout << " --- non zero value found for gap1 in endcap " << std::endl; - addHV(v,hv,wt); - addCurr(ihv,curr,wt); - } - } - - } - } -// LAr HEC - else if (m_larhec_id->is_lar_hec(id)) { - //std::cout << " in HEC " << std::endl; - unsigned int index = (unsigned int)(m_larhec_id->channel_hash(id)); - bool hasPathology=false; - if (index<m_hasPathologyHEC.size()) { - if (m_hasPathologyHEC[index].size()) { - hasPathology=true; - listElec = getElecList(id); - } - } - const HECDetectorElement* hecElement = dynamic_cast<const HECDetectorElement*>(m_calodetdescrmgr->get_element(id)); - if (!hecElement) std::abort(); - const HECCellConstLink cell = hecElement->getHECCell(); - unsigned int nsubgaps = cell->getNumSubgaps(); - double wt = 1./nsubgaps; - //std::cout << " nsubgaps " << nsubgaps << std::endl; - for (unsigned int i=0;i<nsubgaps;i++) { - const HECHVSubgap& subgap = cell->getSubgap(i); - double hv; - double curr; - subgap.voltage_current(hv,curr); - //std::cout << " hv value " << hv << std::endl; - if (hasPathology) { - msg(MSG::DEBUG) << "Has pathology for id: "<< m_larhec_id->print_to_string(id)<<" "<<m_hasPathologyHEC[index]<<endmsg; - for (unsigned int ii=0;ii<listElec.size();ii++) { - if (listElec[ii]==i && listElec[ii]<m_hasPathologyHEC[index].size() && m_hasPathologyHEC[index][listElec[ii]]) { - if(m_hasPathologyHEC[index][listElec[ii]]&0xF) hv=0.; else hv=((m_hasPathologyHEC[index][listElec[ii]]&0xFFF0)>>4); - curr=0.; - } - } - } - - addHV(v,hv,wt); - addCurr(ihv,curr,wt); - } - - } -// LAr FCAL - else if (m_larfcal_id->is_lar_fcal(id)) { - //std::cout << " in FCAL " << std::endl; - unsigned int index = (unsigned int)(m_larfcal_id->channel_hash(id)); - bool hasPathology=false; - if (index<m_hasPathologyFCAL.size()) { - if (m_hasPathologyFCAL[index].size()) { - hasPathology=true; - listElec = getElecList(id); - } - } - const FCALDetectorElement* fcalElement = dynamic_cast<const FCALDetectorElement*>(m_calodetdescrmgr->get_element(id)); - if (!fcalElement) std::abort(); - const FCALTile* tile = fcalElement->getFCALTile(); - //std::cout << " --- in FCAL cell id " << m_larfcal_id->show_to_string(id) << std::endl; - //std::cout << " Side, Module, I,J index " << tile->getModule()->getEndcapIndex() << " " << tile->getModule()->getModuleIndex() - // << " " << tile->getIndexI() << " " << tile->getIndexJ() << std::endl; - unsigned int nlines = tile->getNumHVLines(); - unsigned int nlines_found=0; - for (unsigned int i=0;i<nlines;i++) { - const FCALHVLine* line = tile->getHVLine(i); - if (line) nlines_found++; - } - //std::cout << " nlines " << nlines << " " << nlines_found << std::endl; - if (nlines_found>0) { - double wt = 1./nlines_found; - for (unsigned int i=0;i<nlines;i++) { - const FCALHVLine* line = tile->getHVLine(i); - if (!line) continue; - //std::cout << " line " << line; - double hv; - double curr; - line->voltage_current(hv,curr); - if (hasPathology) { - msg(MSG::DEBUG) << "Has pathology for id: "<< m_larfcal_id->print_to_string(id)<<" "<<m_hasPathologyFCAL[index]<<endmsg; - for (unsigned int ii=0;ii<listElec.size();ii++) { - if (listElec[ii]==i && listElec[ii]<m_hasPathologyFCAL[index].size() && m_hasPathologyFCAL[index][listElec[ii]]) { - if(m_hasPathologyFCAL[index][listElec[ii]]&0xF) hv=0.; else hv=((m_hasPathologyFCAL[index][listElec[ii]]&0xFFF0)>>4); - curr=0.; - } - } - } - //std::cout << " hv value " << hv << std::endl; - addHV(v,hv,wt); - addCurr(ihv,curr,wt); - } - } - - } -// Presamplers - else if (m_larem_id->is_lar_em(id) && m_larem_id->sampling(id)==0) { - - if (abs(m_larem_id->barrel_ec(id))==1) { - - const EMBDetectorElement* embElement = dynamic_cast<const EMBDetectorElement*>(m_calodetdescrmgr->get_element(id)); - if (!embElement) std::abort(); - const EMBCellConstLink cell = embElement->getEMBCell(); - - const EMBPresamplerHVModuleConstLink hvmodule = cell->getPresamplerHVModule (); - - double wt = 0.5; - for (unsigned int igap=0;igap<2;igap++) { - double hv; - double curr; - hvmodule->voltage_current(igap,hv,curr); - addHV(v,hv,wt); - addCurr(ihv,curr,wt); - } - - } - else { - - const EMECDetectorElement* emecElement = dynamic_cast<const EMECDetectorElement*>(m_calodetdescrmgr->get_element(id)); - if (!emecElement) std::abort(); - const EMECCellConstLink cell = emecElement->getEMECCell(); - - const EMECPresamplerHVModuleConstLink hvmodule = cell->getPresamplerHVModule (); - - double wt = 0.5; - for (unsigned int igap=0;igap<2;igap++) { - double hv; - double curr; - hvmodule->voltage_current(igap,hv,curr); - addHV(v,hv,wt); - addCurr(ihv,curr,wt); - } - - } - } - else { - msg(MSG::WARNING) << " cell neither in EM nor HEC nor FCAL !!!!! return empty HV " << endmsg; - } - - m_v = v; - m_i = ihv; - - return StatusCode::SUCCESS; -} - -void LArHVToolDB::addHV(std::vector< HV_t > & v , double hv, double wt) const -{ - bool found=false; - for (unsigned int i=0;i<v.size();i++) { - if (std::fabs(hv-v[i].hv) < 0.1) { - found=true; - v[i].weight += wt; - break; - } - } - if (!found) { - HV_t hh; - hh.hv = hv; - hh.weight = wt; - v.push_back(hh); - } // not already in the list -} - -void LArHVToolDB::addCurr(std::vector< CURRENT_t > & ihv , double current, double wt) const -{ - bool found=false; - for (unsigned int i=0;i<ihv.size();i++) { - if (std::fabs(current-ihv[i].current) < 0.1) { - found=true; - ihv[i].weight += wt; - break; - } - } - if (!found) { - CURRENT_t ii; - ii.current = current; - ii.weight = wt; - ihv.push_back(ii); - } // not already in the list -} - -std::vector<unsigned int> LArHVToolDB::getElecList(const Identifier& id) const -{ - std::vector<unsigned int> myList; - myList.clear(); - for(unsigned i=0; i<m_pathologyContainer->m_v.size(); ++i) { - LArHVPathologiesDb::LArHVElectPathologyDb electPath = m_pathologyContainer->m_v[i]; - if (electPath.cellID == (unsigned int)(id.get_identifier32().get_compact())) { - myList.push_back(electPath.electInd); - } - } - return myList; - -} - - - -StatusCode LArHVToolDB::fillUpdatedHVChannelsVec(const std::set<size_t>& folderIndices) { - m_updatedElectrodes.clear(); - - std::vector<unsigned> updatedHVLines; - //Loop over the list of DCS folders for with a callback has been fired - std::set<size_t>::const_iterator fldrIt=folderIndices.begin(); - std::set<size_t>::const_iterator fldrIt_e=folderIndices.end(); - for(;fldrIt!=fldrIt_e;++fldrIt) { - const size_t idx=*fldrIt; - //Get the internal cache and the AttributeListCollection for this folder - std::vector<std::pair<unsigned,float> >& voltageCache=m_voltageCache[idx]; - //if (!m_DCSHandles[idx].isValid()) { - // msg(MSG::ERROR) << "DataHandle for folder " << m_DCSFolderNames[idx] << " not valid!" << endmsg; - // return StatusCode::FAILURE; - //} - const CondAttrListCollection* attrlist=NULL; //m_DCSHandles[idx].cptr(); - if (detStore()->retrieve(attrlist,m_DCSFolderNames[idx]).isFailure()) { - msg(MSG::ERROR) << "Failed to retrieve CondAttrListCollection with key " << m_DCSFolderNames[idx] << "." << endmsg; - return StatusCode::FAILURE; - } - - const size_t cacheSize=voltageCache.size(); - if (!cacheSize) { - //First call, fill cache - updatedHVLines.reserve(m_nHVCoolChannels); - m_updatedElectrodes.reserve(m_electrodeID->electrodeHashMax()); - voltageCache.reserve(500); - CondAttrListCollection::const_iterator citr=attrlist->begin(); - CondAttrListCollection::const_iterator citr_e=attrlist->end(); - for(;citr!=citr_e;++citr) { - const unsigned chan=citr->first; - updatedHVLines.push_back(chan); //For the first callback, every HV channel will be marked as 'updated' - const coral::Attribute& attr=((citr)->second)["R_VMEAS"]; - float voltage=-999; - if (!attr.isNull()) voltage=attr.data<float>(); //Ignore NULL values - voltageCache.push_back(std::make_pair(chan,voltage)); - }//end loop over attributeListCollection - ATH_MSG_DEBUG("Filling cache for folder: " << m_DCSFolderNames[idx] <<". " << voltageCache.size() << " Channels."); - }//end if cachesize==0 - else { - //Cache already filled - size_t cacheIdx=0; - unsigned voltageHasChanged=0; - if (cacheIdx+attrlist->size() > cacheSize) { - msg(MSG::ERROR) << "Folder: " << m_DCSFolderNames[idx] - << ": Got more COOL channels than in previous callback (" << cacheSize << " -> " << cacheIdx+attrlist->size() << ")." - << endmsg; - return StatusCode::FAILURE; - } - CondAttrListCollection::const_iterator citr=attrlist->begin(); - CondAttrListCollection::const_iterator citr_e=attrlist->end(); - for(;citr!=citr_e;++citr,++cacheIdx) { - std::pair<unsigned,float>& currChanCache=voltageCache[cacheIdx]; - if (currChanCache.first != citr->first) { - msg(MSG::ERROR) << "Folder: " << m_DCSFolderNames[idx] - << ": COOL channel in unexpected order! Got channel #" << citr->first << " expected #" << currChanCache.first - << endmsg; - return StatusCode::FAILURE; - } - const coral::Attribute& attr=((citr)->second)["R_VMEAS"]; - if (attr.isNull()) continue; //Ignore NULL values - const float voltage=attr.data<float>(); - if (voltage!=currChanCache.second) { - updatedHVLines.push_back(currChanCache.first); - currChanCache.second=voltage; - voltageHasChanged=1; - } - }//end loop over AttibuteListCollection - m_nUpdatesPerFolder[idx].m_nVoltageUpdates+=voltageHasChanged; - ATH_MSG_DEBUG("Folder: " << m_DCSFolderNames[idx] << ": Found " << updatedHVLines.size() << " Channels with voltage changes so far."); - }//end else - }//end loop over folders - - - //Build vector of electrode IDs: - std::vector<unsigned>::const_iterator hvLineIt=updatedHVLines.begin(); - std::vector<unsigned>::const_iterator hvLineIt_e=updatedHVLines.end(); - for(;hvLineIt!=hvLineIt_e;++hvLineIt) { - const unsigned node=(*hvLineIt)/1000; - const unsigned line=(*hvLineIt)%1000; - HWIdentifier hvlineid=m_hvLineID->HVLineId(1,1,node,line); - const std::vector<HWIdentifier>& electrodeIdVec=m_hvCablingTool->getLArElectrodeIDvec(hvlineid); - m_updatedElectrodes.insert(m_updatedElectrodes.end(),electrodeIdVec.begin(),electrodeIdVec.end()); - } - - ATH_MSG_DEBUG("Number of electrodes with voltage change:" << m_updatedElectrodes.size() << " (max=" << m_electrodeID->electrodeHashMax() << ")"); - return StatusCode::SUCCESS; -} diff --git a/LArCalorimeter/LArCondUtils/src/LArHVToolDB.h b/LArCalorimeter/LArCondUtils/src/LArHVToolDB.h deleted file mode 100755 index 3317403e03a80736c2bf80df39b7e3849b5e246a..0000000000000000000000000000000000000000 --- a/LArCalorimeter/LArCondUtils/src/LArHVToolDB.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -//Dear emacs, this is -*-c++-*- -#ifndef LARCONDUTILS_LARHVTOOLDB_H -#define LARCONDUTILS_LARHVTOOLDB_H - - -/** - @class LArHVToolDB - @brief concrete Tool to provide HV information for readout cells for MC - - Environment: - Software developed for the ATLAS Detector at the CERN LHC - - @author - Guillaume Unal <unal@lal.in2p3.fr> - -*/ - - -// Includes for Gaudi -#include "GaudiKernel/ToolHandle.h" -#include "LArElecCalib/ILArHVTool.h" -#include "StoreGate/DataHandle.h" -#include "Identifier/Identifier.h" -#include "AthenaBaseComps/AthAlgTool.h" - -// forward declaration -class StoreGateSvc; -class CondAttrListCollection; -class AthenaAttributeList; -class ILArHVPathologyDbTool; -class LArHVPathologiesDb; -class LArEM_ID; -class LArHEC_ID; -class LArFCAL_ID; -class CaloIdManager; -class CaloDetDescrManager; -class Identifier; -class LArElectrodeID; -class LArHVLineID; -class LArHVCablingTool; - -class LArHVToolDB: public AthAlgTool, virtual public ILArHVTool -{ - - public: - LArHVToolDB(const std::string& type, const std::string& name, - const IInterface* parent); - - virtual ~LArHVToolDB() override; - - virtual StatusCode initialize() override; - virtual StatusCode finalize() override; - - // Given a Offline Readout ID, return values of HV and Weight - virtual StatusCode getHV(const Identifier& id, - std::vector< HV_t > & v ) const override ; - - // Given a Offline Readout ID, return values of Current and Weight - virtual StatusCode getCurrent(const Identifier& id, - std::vector< CURRENT_t > & ihv ) const override ; - - virtual StatusCode LoadCalibration(IOVSVC_CALLBACK_ARGS) override; - - - virtual const std::vector<HWIdentifier>& getUpdatedElectrodes() override; - - private: - - static const unsigned m_nHVCoolChannels; - - StatusCode getPayload(const Identifier& id,std::vector< HV_t > & v,std::vector< CURRENT_t > & ihv) const; - void addHV(std::vector< HV_t > & v, double hv, double wt) const; - void addCurr(std::vector< CURRENT_t > & ihv, double curr, double wt) const; - std::vector<unsigned int> getElecList(const Identifier& id) const; - StatusCode fillUpdatedHVChannelsVec(const std::set<size_t>& folderIndices); - - - const CaloDetDescrManager* m_calodetdescrmgr; - const LArEM_ID* m_larem_id; - const LArHEC_ID* m_larhec_id; - const LArFCAL_ID* m_larfcal_id; - const LArElectrodeID* m_electrodeID; - const LArHVLineID* m_hvLineID; - - // FIXME: mutable - // These are used for memoization. - mutable Identifier m_id; - mutable std::vector<HV_t> m_v; - mutable std::vector<CURRENT_t> m_i; - - const DataHandle<AthenaAttributeList> m_pathologiesHandle; - - ToolHandle<ILArHVPathologyDbTool> m_pathologyTool; - ToolHandle<LArHVCablingTool> m_hvCablingTool; - - - LArHVPathologiesDb* m_pathologyContainer; - - std::vector<std::vector<unsigned short> > m_hasPathologyEM; - std::vector<std::vector<unsigned short> > m_hasPathologyHEC; - std::vector<std::vector<unsigned short> > m_hasPathologyFCAL; - std::string m_HVPathologiesFolderName; - - std::vector<HWIdentifier> m_updatedElectrodes; - std::vector<std::vector<std::pair<unsigned,float> > > m_voltageCache; - - std::vector<std::string> m_DCSFolderNames; - - struct COUNTERS { - COUNTERS() : m_nCallbacks(0), m_nVoltageUpdates(0) {}; - unsigned m_nCallbacks; - unsigned m_nVoltageUpdates; - }; - std::vector<COUNTERS> m_nUpdatesPerFolder; - - -}; - -inline -const std::vector<HWIdentifier>& LArHVToolDB::getUpdatedElectrodes() { - return m_updatedElectrodes; -} - -#endif diff --git a/LArCalorimeter/LArCondUtils/src/LArHVToolMC.cxx b/LArCalorimeter/LArCondUtils/src/LArHVToolMC.cxx deleted file mode 100755 index 698db3e552508bffdb2817952f9982850cfc231b..0000000000000000000000000000000000000000 --- a/LArCalorimeter/LArCondUtils/src/LArHVToolMC.cxx +++ /dev/null @@ -1,300 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#include <stdlib.h> -#include <iostream> - -#include "LArHVToolMC.h" - -#include "GaudiKernel/IToolSvc.h" -#include "StoreGate/StoreGateSvc.h" - -#include "Identifier/Identifier.h" -#include "CaloIdentifier/CaloIdManager.h" -#include "CaloIdentifier/LArEM_ID.h" -#include "LArIdentifier/LArElectrodeID.h" - -#include "RDBAccessSvc/IRDBAccessSvc.h" -#include "RDBAccessSvc/IRDBRecord.h" -#include "RDBAccessSvc/IRDBRecordset.h" -#include "AthenaPoolUtilities/AthenaAttributeList.h" - -#include <iostream> -#include <cmath> - -// constructor -LArHVToolMC::LArHVToolMC(const std::string& type, - const std::string& name, - const IInterface* parent) - : AthAlgTool(type,name,parent), - m_readASCII(false), - m_larem_id(nullptr) -{ - declareInterface< ILArHVTool >( this ); - declareProperty("readASCII",m_readASCII); -} - -// destructor -LArHVToolMC::~LArHVToolMC() -{ } - -// intialize -StatusCode LArHVToolMC::initialize() -{ - ATH_CHECK( detStore()->retrieve( m_caloIdMgr ) ); - - m_larem_id = m_caloIdMgr->getEM_ID(); - - const LArElectrodeID* electrodeID = nullptr; - ATH_CHECK( detStore()->retrieve(electrodeID) ); - - //Dummy implementation for MC. We assume that all electrodes had been update - m_updatedElectrodes.reserve(electrodeID->electrodeHashMax()); - for (unsigned i=0;i<electrodeID->electrodeHashMax();++i) { - m_updatedElectrodes.push_back(electrodeID->ElectrodeId(IdentifierHash(i))); - } - - InitHV(); - - return StatusCode::SUCCESS; -} - - - -StatusCode LArHVToolMC::getHV(const Identifier& id, - std::vector< HV_t > & v ) const -{ - v.clear(); - -// check identifier in LAR - if (m_larem_id->is_lar_em(id)) { -// check identifier in barrel - if (abs(m_larem_id->barrel_ec(id))==1) { - int sampling=m_larem_id->sampling(id); - if (sampling>0) { - int region=m_larem_id->region(id); - int ieta=m_larem_id->eta(id); - int iphi=m_larem_id->phi(id); - int ietahv,iphi1,iphi2,ipm; -// ipm =0 for eta>0 1 for eta<0 - if (m_larem_id->barrel_ec(id)==1) ipm=0; - else ipm=1; - if (sampling==1 && region==0) { - iphi1=iphi*16; - iphi2=iphi1+16; - } - else { - iphi1=iphi*4; - iphi2=iphi1+4; - } - if (region==0) { - if (sampling==1) ietahv=ieta/64; - else if (sampling==2) ietahv=ieta/8; - else ietahv=ieta/4; - } - else ietahv=6; - const double ngaps = 2.*(iphi2-iphi1); - const double inv_ngaps = 1. / ngaps; - - for (int iphihv=iphi1;iphihv<iphi2;iphihv++) { - for (int iside=0;iside<2;iside++) { - double hv=m_hv[ipm][iphihv][ietahv][iside]; - bool found=false; - for (unsigned int i=0;i<v.size();i++) { - if (std::fabs(hv-v[i].hv) < 0.1) { - found=true; - v[i].weight += inv_ngaps; - } - } - if (!found) { - HV_t hh; - hh.hv = hv; - hh.weight = inv_ngaps; - v.push_back(hh); - } // not already in the list - } // loop over gap size - } // loop over electrodes - } // in accordion - } // in barrel - } // in LAr - -// hack to return something for other calos - if (v.size()==0) { - HV_t hh; - hh.hv = 2000.; - hh.weight = 1.; - v.push_back(hh); - } - - return StatusCode::SUCCESS; -} - -StatusCode LArHVToolMC::getCurrent(const Identifier& /* id */, - std::vector< CURRENT_t > & v ) const -{ - ATH_MSG_WARNING ( " LArHVToolMC: getCurrent not implemented " ); - CURRENT_t cu; - cu.current=0; - cu.weight=1.; - v.push_back(cu); - return StatusCode::SUCCESS; -} - -void LArHVToolMC::InitHV() -{ - bool setHandcoded=false; - double defaultHvVal = 2000.; - - if (!m_readASCII) { - IRDBAccessSvc *pAccessSvc; - StatusCode status = service("RDBAccessSvc",pAccessSvc); - if(status.isFailure()) - { - std::cout << "LArHVToolMC::InitHV() unable to get RDBAccess Service! Use default HV values\n"; - setHandcoded = true; - } - const AthenaAttributeList* keys = 0; - if (!setHandcoded) { - if (detStore()->contains<AthenaAttributeList>("/LAR/HVBARREL/MAPINLINE")) { - status = detStore()->retrieve(keys, "/LAR/HVBARREL/MAPINLINE"); - if(status.isFailure()) - { - std::cout << "LArHVToolMC::InitHV() unable to retrieve AthenaAttributeList! Use default HV values\n"; - setHandcoded = true; - } - } - else { - std::cout << "LArHVToolMC::InitHV() no HV map in DetStore. Use Dedault HV values\n"; - setHandcoded = true; - } - } - - std::string nodeName, tagName; - if (!setHandcoded) { - try - { - nodeName = (*keys)["HvBarrelNode"].data<std::string>(); - tagName = (*keys)["HvBarrelTag"].data<std::string>(); - } - catch(std::exception& e) - { - std::cout << e.what() << "\n"; - std::cout << " Use default HV values " << std::endl; - setHandcoded = true; - } - } - - if(!setHandcoded) - { - // retrieve the payload data - IRDBRecordset_ptr hvGlob = pAccessSvc->getRecordsetPtr("HVBarrelGlob",tagName,nodeName,"LARHV"); - - if(hvGlob->size()>0) - defaultHvVal = (*hvGlob)[0]->getDouble("DEFAULTVAL"); - - std::cout << " read defaultHvVal from database " << defaultHvVal << std::endl; - } - - // set default values - std::cout << " defaultHvVal " << defaultHvVal <<std::endl; - for (int ipm=0;ipm<2;ipm++) { - for (int ielec=0;ielec<1024;ielec++) { - for (int ieta=0;ieta<7;ieta++) { - for (int iside=0;iside<2;iside++) { - m_hv[ipm][ielec][ieta][iside] = defaultHvVal; - } - } - } - } - - // apply imperfections - if(!setHandcoded) - { - IRDBRecordset_ptr hvVal = pAccessSvc->getRecordsetPtr("HVBarrelVal", tagName,nodeName,"LARHV"); - - for(unsigned int indx=0; indx<hvVal->size(); indx++) - { - const IRDBRecord* record = (*hvVal)[indx]; - int nZSide = record->getInt("ZSIDE"); - int nEtaReg = record->getInt("ETAREGION"); - int nGapSide = record->getInt("GAPSIDE"); - int nFirstElec = record->getInt("FIRSTELEC"); - int nLastElec = record->getInt("LASTELEC"); - double hvVal = record->getDouble("HVVALUE"); - - std::cout << " found pathological region " << nZSide << " " << nEtaReg << " " << nGapSide - << " " << nFirstElec << " " << nLastElec << " " << hvVal << std::endl; - - if(nFirstElec<=nLastElec) - for(int iel=nFirstElec; iel<=nLastElec; iel++) - m_hv[nZSide][iel][nEtaReg][nGapSide] = hvVal; - else - std::cerr << "LArBarrelCalculator::InitHV() nLastElec<nFirstElec for:\n" - << "Z Side = " << nZSide << "\n" - << "Eta Reg = " << nEtaReg << "\n" - << "Gap Side = " << nGapSide << "\n"; - } - } - - } - -// read from ASCII - else { - - // set default values - std::cout << " defaultHvVal " << defaultHvVal <<std::endl; - for (int ipm=0;ipm<2;ipm++) { - for (int ielec=0;ielec<1024;ielec++) { - for (int ieta=0;ieta<7;ieta++) { - for (int iside=0;iside<2;iside++) { - m_hv[ipm][ielec][ieta][iside] = defaultHvVal; - } - } - } - } - - std::string filename = "hv.txt"; - - FILE * fp = fopen(filename.c_str(),"r"); - if (!fp) { - std::cerr << "LArBarrelCalculator::InitHV() ERROR Can't open file " - << filename << "\n"; - return; - } - char line[81]; - while (fgets(line,80,fp)) { - int nZSide,nEtaReg,nGapSide,nFirstElec,nLastElec; - float hvVal; - sscanf(&line[0],"%80d%80d%80d%80d%80d%80f",&nZSide,&nEtaReg,&nGapSide,&nFirstElec,&nLastElec,&hvVal); - - std::cout << " found pathological region " << nZSide << " " << nEtaReg << " " << nGapSide - << " " << nFirstElec << " " << nLastElec << " " << hvVal << std::endl; - - if(nFirstElec>=0 && nFirstElec<1024 && - nLastElec>=0 && nLastElec<1024 && - nZSide >= 0 && nZSide < 2 && - nEtaReg >= 0 && nEtaReg < 7 && - nGapSide >= 0 && nGapSide < 2 && - nFirstElec<=nLastElec) - { - for(int iel=nFirstElec; iel<=nLastElec; iel++) - m_hv[nZSide][iel][nEtaReg][nGapSide] = hvVal; - } - else - std::cerr << "LArBarrelCalculator::InitHV() bad input for:\n" - << "Z Side = " << nZSide << "\n" - << "Eta Reg = " << nEtaReg << "\n" - << "Gap Side = " << nGapSide << "\n"; - - } - fclose (fp); - - } - -} - -StatusCode LArHVToolMC::LoadCalibration(IOVSVC_CALLBACK_ARGS) -{ - return StatusCode::SUCCESS; -} diff --git a/LArCalorimeter/LArCondUtils/src/LArHVToolMC.h b/LArCalorimeter/LArCondUtils/src/LArHVToolMC.h deleted file mode 100755 index b99a38fe8c4958654c4cf57e2938c8808d2b4ad2..0000000000000000000000000000000000000000 --- a/LArCalorimeter/LArCondUtils/src/LArHVToolMC.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef LARCONDUTILS_LARHVTOOLMC_H -#define LARCONDUTILS_LARHVTOOLMC_H - -/** - @class LArHVToolMC - @brief concrete Tool to provide HV information for readout cells for MC - - Environment: - Software developed for the ATLAS Detector at the CERN LHC - - @author - Guillaume Unal <unal@lal.in2p3.fr> - -*/ - - -// Includes for Gaudi -#include "AthenaBaseComps/AthAlgTool.h" - -#include "LArElecCalib/ILArHVTool.h" -#include "StoreGate/DataHandle.h" -#include "Identifier/HWIdentifier.h" - -// forward declaration -class LArEM_ID; -class CaloIdManager; - -class LArHVToolMC: public AthAlgTool, virtual public ILArHVTool -{ - - public: - LArHVToolMC(const std::string& type, const std::string& name, - const IInterface* parent); - - virtual ~LArHVToolMC(); - - virtual StatusCode initialize() override; - virtual StatusCode finalize() override {return StatusCode::SUCCESS;} - - - // Given a Offline Readout ID, return values of HV and Weight - virtual StatusCode getHV(const Identifier& id, - std::vector< HV_t > & v ) const override ; - - // Given a Offline Readout ID, return values of Current and Weight - virtual StatusCode getCurrent(const Identifier& id, - std::vector< CURRENT_t > & v ) const override ; - - virtual StatusCode LoadCalibration(IOVSVC_CALLBACK_ARGS) override; - - virtual const std::vector<HWIdentifier>& getUpdatedElectrodes() override; - - private: - - bool m_readASCII; - - double m_hv[2][1024][7][2]; - - const LArEM_ID* m_larem_id; - const DataHandle<CaloIdManager> m_caloIdMgr; - - void InitHV(); - - std::vector<HWIdentifier> m_updatedElectrodes; -}; - - -inline -const std::vector<HWIdentifier>& LArHVToolMC::getUpdatedElectrodes() { - return m_updatedElectrodes; -} -#endif diff --git a/LArCalorimeter/LArCondUtils/src/components/LArCondUtils_entries.cxx b/LArCalorimeter/LArCondUtils/src/components/LArCondUtils_entries.cxx index c236f64dda5130eb65a3ead37c38a91d85f5c9ca..b813bebd055e5d07097edd249a85677199984f96 100644 --- a/LArCalorimeter/LArCondUtils/src/components/LArCondUtils_entries.cxx +++ b/LArCalorimeter/LArCondUtils/src/components/LArCondUtils_entries.cxx @@ -1,6 +1,4 @@ #include "../LArFecLvTempDcsTool.h" -#include "../LArHVToolMC.h" -#include "../LArHVToolDB.h" #include "../LArFEBTempTool.h" #include "../LArHVPathologyDbAlg.h" #include "../LArHV2Ntuple.h" @@ -8,8 +6,6 @@ DECLARE_COMPONENT( LArFecLvTempDcsTool ) -DECLARE_COMPONENT( LArHVToolMC ) -DECLARE_COMPONENT( LArHVToolDB ) DECLARE_COMPONENT( LArFEBTempTool ) DECLARE_COMPONENT( LArHVPathologyDbAlg ) DECLARE_COMPONENT( LArHV2Ntuple ) diff --git a/LArCalorimeter/LArElecCalib/LArElecCalib/ILArHVTool.h b/LArCalorimeter/LArElecCalib/LArElecCalib/ILArHVTool.h deleted file mode 100755 index b03d2b6bb697dd32ebbca5f8a7f701940c4b1003..0000000000000000000000000000000000000000 --- a/LArCalorimeter/LArElecCalib/LArElecCalib/ILArHVTool.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -//Dear emacs, this is -*-c++-*- - -#ifndef ILARHVTOOL_H -#define ILARHVTOOL_H - -// Includes for Gaudi -#include "GaudiKernel/IAlgTool.h" -#include "AthenaKernel/IOVSvcDefs.h" -#include <vector> - -static const InterfaceID IID_ILArHVTool("ILArHVTool", 1 ,0); - - -/** - @class ILArHVTool - @brief Interface for Tool to provide HV information for readout cells. - - Environment: - Software developed for the ATLAS Detector at the CERN LHC - - @author - Hong Ma <hma@bnl.gov> ------------------------------------------------------------------------ -*/ - -class Identifier; -class HWIdentifier; - -class ILArHVTool: virtual public IAlgTool -{ - - public: - virtual ~ILArHVTool () { } - - static const InterfaceID& interfaceID() { return IID_ILArHVTool; } - - /** @brief struct for HV and weight pair - */ - struct HV_t { - float hv; - float weight; - }; - - /** @brief struct for Current and weight pair - */ - struct CURRENT_t { - float current; - float weight; - }; - - - /** brief Given a Offline Readout ID, return values of HV and Weight - */ - virtual StatusCode getHV(const Identifier& id, - std::vector< HV_t > & v ) const =0 ; - - /** Given a Offline Readout ID, return values of Current and Weight - */ - virtual StatusCode getCurrent(const Identifier& id, - std::vector< CURRENT_t > & v ) const =0 ; - - virtual StatusCode LoadCalibration(IOVSVC_CALLBACK_ARGS) = 0; - - - /** Return the list of electrodes with HV updated during the last callback - */ - virtual const std::vector<HWIdentifier>& getUpdatedElectrodes() = 0; - -}; - -#endif