diff --git a/LArCalorimeter/LArCondUtils/share/LArHVPathologyDbRead.py b/LArCalorimeter/LArCondUtils/share/LArHVPathologyDbRead.py index 8e8d0e9472f9f4547cd719009829e09db8a419b2..9cff40d65964e24bc7f970e2f644578fa93cfc4b 100755 --- a/LArCalorimeter/LArCondUtils/share/LArHVPathologyDbRead.py +++ b/LArCalorimeter/LArCondUtils/share/LArHVPathologyDbRead.py @@ -4,7 +4,7 @@ from time import strptime,time from calendar import timegm -if "GloablTag" not in dir(): +if "GlobalTag" not in dir(): GlobalTag = 'CONDBR2-BLKPA-2017-03' if "inputsqlite" not in dir(): @@ -24,9 +24,9 @@ if "date" not in dir(): if "TimeStamp" not in dir(): try: ts=strptime(date+'/UTC','%Y-%m-%d:%H:%M:%S/%Z') - TimeStamp=int(timegm(ts))*1000000000L + TimeStamp=int(timegm(ts))*1000000000 except ValueError: - print "ERROR in time specification, use e.g. 2007-05-25:14:01:00" + print("ERROR in time specification, use e.g. 2007-05-25:14:01:00") ## basic job configuration import AthenaCommon.AtlasUnixGeneratorJob diff --git a/LArCalorimeter/LArCondUtils/src/LArHVPathologyDbAlg.cxx b/LArCalorimeter/LArCondUtils/src/LArHVPathologyDbAlg.cxx index 4c605b444f144499ad355938447b39e565f404af..0ef700f00467bf4bdf9bc873db8347667bb9f13f 100644 --- a/LArCalorimeter/LArCondUtils/src/LArHVPathologyDbAlg.cxx +++ b/LArCalorimeter/LArCondUtils/src/LArHVPathologyDbAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include "LArHVPathologyDbAlg.h" @@ -13,7 +13,6 @@ #include "CaloIdentifier/LArHEC_ID.h" #include "CaloIdentifier/LArFCAL_ID.h" #include "LArIdentifier/LArOnlineID.h" -#include "LArCabling/LArCablingLegacyService.h" #include "CaloDetDescr/CaloDetDescrManager.h" #include "CaloDetDescr/CaloDetectorElements.h" @@ -42,7 +41,6 @@ LArHVPathologyDbAlg::LArHVPathologyDbAlg(const std::string& name, ISvcLocator* p , m_regSvc("IOVRegistrationSvc",name) , m_pathologyTool("LArHVPathologyDbTool") , m_mode(0) - , m_cablingService("LArCablingLegacyService") , m_larem_id(0) , m_larhec_id(0) , m_larfcal_id(0) @@ -119,6 +117,7 @@ StatusCode LArHVPathologyDbAlg::initialize() } ATH_CHECK( m_hvCablingKey.initialize() ); + ATH_CHECK( m_cablingKey.initialize() ); return sc; } @@ -181,6 +180,12 @@ StatusCode LArHVPathologyDbAlg::createCondObjects (const EventContext & ctx) else { SG::ReadCondHandle<LArHVIdMapping> hvIdMapping (m_hvCablingKey, ctx); + SG::ReadCondHandle<LArOnOffIdMapping> cabHdl (m_cablingKey, ctx); + const LArOnOffIdMapping *cabling = *cabHdl; + if(!cabling) { + ATH_MSG_ERROR("Do not have cabling object with key " << m_cablingKey.key()); + return StatusCode::FAILURE; + } // Read input file and construct LArHVPathologiesDb for given folder std::ifstream infile; infile.open(m_inpFile.value().c_str()); @@ -234,7 +239,7 @@ StatusCode LArHVPathologyDbAlg::createCondObjects (const EventContext & ctx) infile >> bec >> pos_neg >> FT >> slot >> channel >> hvModule >> hvLine >> pathologyType; msg(MSG::INFO) << " read " << bec << " " << pos_neg << " " << FT << " " << slot << " " << channel << " " << hvModule << " " << hvLine << " " << pathologyType << endmsg; HWIdentifier hwid = m_laronline_id->channel_Id(bec,pos_neg,FT,slot,channel); - Identifier id = m_cablingService->cnvToIdentifier( hwid); + Identifier id = cabling->cnvToIdentifier( hwid); cellID = (unsigned int)(id.get_identifier32().get_compact()); elecList=getElectInd(**hvIdMapping, id,hvModule,hvLine); msg(MSG::INFO) << " cellId , elecList size " << cellID << " " << elecList.size() << endmsg; @@ -284,6 +289,12 @@ StatusCode LArHVPathologyDbAlg::printCondObjects (const EventContext& ctx) msg(MSG::INFO) <<" in printCondObjects() " <<endmsg; SG::ReadCondHandle<LArHVIdMapping> hvIdMapping (m_hvCablingKey, ctx); + SG::ReadCondHandle<LArOnOffIdMapping> cabHdl (m_cablingKey, ctx); + const LArOnOffIdMapping *cabling = *cabHdl; + if(!cabling) { + ATH_MSG_ERROR("Do not have cabling object with key " << m_cablingKey.key()); + return StatusCode::FAILURE; + } std::ofstream *fout=0; const AthenaAttributeList* attrlist; @@ -311,7 +322,7 @@ StatusCode LArHVPathologyDbAlg::printCondObjects (const EventContext& ctx) if(fout) *fout<<electPath.cellID<<"\t"<<electPath.electInd<<"\t"<<electPath.pathologyType<<std::endl; } else { msg(MSG::INFO) << "Got pathology for cell ID: " << electPath.cellID << endmsg; - HWIdentifier hwid = m_cablingService->createSignalChannelID(Identifier32(electPath.cellID)); + HWIdentifier hwid = cabling->createSignalChannelID(Identifier32(electPath.cellID)); int HVLine=getHVline(**hvIdMapping,Identifier(electPath.cellID),electPath.electInd); if(HVLine<0) { msg(MSG::ERROR) << "No HVline for cell "<<electPath.cellID<< endmsg; diff --git a/LArCalorimeter/LArCondUtils/src/LArHVPathologyDbAlg.h b/LArCalorimeter/LArCondUtils/src/LArHVPathologyDbAlg.h index 2446378512cf3d3dd34d108a3b5babe6c2f8267e..18c646edcd0c0afe367592849a62a9eaf1b96a63 100644 --- a/LArCalorimeter/LArCondUtils/src/LArHVPathologyDbAlg.h +++ b/LArCalorimeter/LArCondUtils/src/LArHVPathologyDbAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef LARCONDUTILS_LARHVPATHOLOGYDBALG_H @@ -9,10 +9,11 @@ #include "LArRecConditions/LArHVIdMapping.h" #include "StoreGate/ReadCondHandleKey.h" #include "GaudiKernel/ToolHandle.h" +#include "StoreGate/ReadCondHandleKey.h" +#include "LArCabling/LArOnOffIdMapping.h" class IIOVRegistrationSvc; class ILArHVPathologyDbTool; -class LArCablingLegacyService ; class LArEM_ID; class LArHEC_ID; class LArFCAL_ID; @@ -55,7 +56,6 @@ class LArHVPathologyDbAlg : public AthAlgorithm const DataHandle<CaloIdManager> m_caloIdMgr; const DataHandle<CaloDetDescrManager> m_calodetdescrmgr; - ToolHandle<LArCablingLegacyService> m_cablingService; const LArEM_ID* m_larem_id; const LArHEC_ID* m_larhec_id; const LArFCAL_ID* m_larfcal_id; @@ -63,6 +63,8 @@ class LArHVPathologyDbAlg : public AthAlgorithm SG::ReadCondHandleKey<LArHVIdMapping> m_hvCablingKey {this, "LArHVIdMapping", "LArHVIdMap", "SG key for HV ID mapping"}; + SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey + {this, "OnOffMap", "LArOnOffIdMap", "SG key for mapping object"}; }; #endif diff --git a/LArCalorimeter/LArRecConditions/LArRecConditions/LArHVPathologiesDb.h b/LArCalorimeter/LArRecConditions/LArRecConditions/LArHVPathologiesDb.h index 748deea71d80f4c3b50f6eb95410b0b14adbe627..0f03d47d5a1fa92880f2d37ad616af7888620357 100644 --- a/LArCalorimeter/LArRecConditions/LArRecConditions/LArHVPathologiesDb.h +++ b/LArCalorimeter/LArRecConditions/LArRecConditions/LArHVPathologiesDb.h @@ -1,12 +1,20 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef LARTOOLS_LARHVPATHOLOGIESDB_H #define LARTOOLS_LARHVPATHOLOGIESDB_H +#include "CxxUtils/bitmask.h" #include <vector> +class LArHVPathologyBits { + public: + static const unsigned short MaskHV=0x1; + static const unsigned short MaskCurr=0x2; + static const unsigned short SetHVMask=0xFFF0; +}; + class LArHVPathologiesDb { public: diff --git a/LArCalorimeter/LArRecUtils/src/LArHVCondAlg.cxx b/LArCalorimeter/LArRecUtils/src/LArHVCondAlg.cxx index c41808e350a296a4f4a248fc40a8654ce1d6477e..a1248a5d944d159c0524d2f1657bdd84da6cc96e 100755 --- a/LArCalorimeter/LArRecUtils/src/LArHVCondAlg.cxx +++ b/LArCalorimeter/LArRecUtils/src/LArHVCondAlg.cxx @@ -6,6 +6,7 @@ #include "GaudiKernel/IToolSvc.h" #include "StoreGate/ReadCondHandle.h" #include "LArElecCalib/ILArHVPathologyDbTool.h" +#include "LArRecConditions/LArHVPathologiesDb.h" #include "CaloDetDescr/CaloDetectorElements.h" #include "CaloGeoHelpers/CaloPhiRange.h" #include "CaloIdentifier/LArEM_ID.h" @@ -419,15 +420,23 @@ StatusCode LArHVCondAlg::fillPayload(LArHVData* hvdata hvmod.getEtaIndex(), igap, electrode.getElectrodeIndex() )); - curr *= uAkOhm * rValues[ridx]; + if(curr > 0.) curr *= uAkOhm * rValues[ridx]; else curr = 0.; + ATH_MSG_VERBOSE("channel. "<<std::hex<<id.get_identifier32()<<std::dec <<" hvline: "<<idx<<" curr. " << curr << " R: "<<rValues[ridx]); } if (hasPathology) { ATH_MSG_VERBOSE( "Has pathology for id: "<< m_larem_id->print_to_string(id)<<" "<<hasPathologyEM[index]); msg(MSG::VERBOSE) << "Original hv: "<<hv<<" "; for (unsigned int ii=0;ii<listElec.size();ii++) { if (listElec[ii]==(2*i+igap) && listElec[ii]<hasPathologyEM[index].size() && hasPathologyEM[index][listElec[ii]]) { - if(hasPathologyEM[index][listElec[ii]]&0xF) hv=0.; else hv=((hasPathologyEM[index][listElec[ii]]&0xFFF0)>>4); - curr=0.; + if(hasPathologyEM[index][listElec[ii]]&LArHVPathologyBits::MaskHV) { + hv=0.; + curr = 0.; + } else if(hasPathologyEM[index][listElec[ii]]&LArHVPathologyBits::MaskCurr) { + curr = 0.; + } else { + hv=((hasPathologyEM[index][listElec[ii]]&LArHVPathologyBits::SetHVMask)>>4); + curr=0.; + } } } msg(MSG::VERBOSE) << "set hv: "<<hv<<endmsg; @@ -471,7 +480,8 @@ StatusCode LArHVCondAlg::fillPayload(LArHVData* hvdata igap, 0 // not used in EMBPS )); - curr *= uAkOhm * rValues[ridx]; + if(curr > 0.) curr *= uAkOhm * rValues[ridx]; else curr = 0; + ATH_MSG_VERBOSE("channel. "<<std::hex<<id.get_identifier32()<<std::dec <<" hvline: "<<idx<<" curr. " << curr << " R: "<<rValues[ridx]); } addHV(v,hv,wt); addCurr(ihv,curr,wt); @@ -519,14 +529,22 @@ StatusCode LArHVCondAlg::fillPayload(LArHVData* hvdata hvmod.getEtaIndex(), hvmod.getSectorIndex(), electrode.getElectrodeIndex() )); - curr *= uAkOhm * rValues[ridx]; + if(curr > 0.) curr *= uAkOhm * rValues[ridx]; else curr = 0.; + ATH_MSG_VERBOSE("channel. "<<std::hex<<id.get_identifier32()<<std::dec <<" hvline: "<<idx<<" curr. " << curr << " R: "<<rValues[ridx]); } if (hasPathology) { msg(MSG::VERBOSE) << "Has pathology for id: "<< m_larem_id->print_to_string(id)<<" "<<hasPathologyEM[index]<<endmsg; for (unsigned int ii=0;ii<listElec.size();ii++) { if (listElec[ii]==(2*i+igap) && listElec[ii]<hasPathologyEM[index].size() && hasPathologyEM[index][listElec[ii]]) { - if(hasPathologyEM[index][listElec[ii]]&0xF) hv=0.; else hv=((hasPathologyEM[index][listElec[ii]]&0xFFF0)>>4); - curr=0.; + if(hasPathologyEM[index][listElec[ii]]&LArHVPathologyBits::MaskHV) { + hv=0.; + curr = 0.; + } else if(hasPathologyEM[index][listElec[ii]]&LArHVPathologyBits::MaskCurr) { + curr = 0.; + } else { + hv=((hasPathologyEM[index][listElec[ii]]&0xFFF0)>>4); + curr=0.; + } } } } @@ -568,7 +586,8 @@ StatusCode LArHVCondAlg::fillPayload(LArHVData* hvdata igap, 0 // not used in EMECPS )); - curr *= uAkOhm * rValues[ridx]; + if(curr >0.) curr *= uAkOhm * rValues[ridx]; else curr=0.; + ATH_MSG_VERBOSE("channel. "<<std::hex<<id.get_identifier32()<<std::dec <<" hvline: "<<idx<<" curr. " << curr << " R: "<<rValues[ridx]); } addHV(v,hv,wt); addCurr(ihv,curr,wt); @@ -646,14 +665,22 @@ StatusCode LArHVCondAlg::fillPayload(LArHVData* hvdata subgap.getSubgapIndex(), 0 // not used in HEC )); - curr *= uAkOhm * rValues[ridx]; + if(curr > 0.) curr *= uAkOhm * rValues[ridx]; else curr = 0.; + ATH_MSG_VERBOSE("channel. "<<std::hex<<id.get_identifier32()<<std::dec <<" hvline: "<<idx<<" cur. " << curr << " R: "<<rValues[ridx]); } if (hasPathology) { msg(MSG::VERBOSE) << "Has pathology for id: "<< m_larhec_id->print_to_string(id)<<" "<<hasPathologyHEC[index]<<endmsg; for (unsigned int ii=0;ii<listElec.size();ii++) { if (listElec[ii]==i && listElec[ii]<hasPathologyHEC[index].size() && hasPathologyHEC[index][listElec[ii]]) { - if(hasPathologyHEC[index][listElec[ii]]&0xF) hv=0.; else hv=((hasPathologyHEC[index][listElec[ii]]&0xFFF0)>>4); - curr=0.; + if(hasPathologyHEC[index][listElec[ii]]&LArHVPathologyBits::MaskHV) { + hv=0.; + curr = 0.; + } else if(hasPathologyHEC[index][listElec[ii]]&LArHVPathologyBits::MaskCurr){ + curr = 0.; + } else { + hv=((hasPathologyHEC[index][listElec[ii]]&LArHVPathologyBits::SetHVMask)>>4); + curr=0.; + } } } } @@ -734,14 +761,22 @@ StatusCode LArHVCondAlg::fillPayload(LArHVData* hvdata hvmod.getSectorIndex(), line->getLineIndex() )); - curr *= uAkOhm * rValues[ridx]; + if(curr > 0.) curr *= uAkOhm * rValues[ridx]; else curr = 0.; + ATH_MSG_VERBOSE("channel. "<<std::hex<<id.get_identifier32()<<std::dec <<" hvline: "<<idx<<" curr." << curr << " R: "<<rValues[ridx]); } if (hasPathology) { msg(MSG::VERBOSE) << "Has pathology for id: "<< m_larfcal_id->print_to_string(id)<<" "<<hasPathologyFCAL[index]<<endmsg; for (unsigned int ii=0;ii<listElec.size();ii++) { if (listElec[ii]==i && listElec[ii]<hasPathologyFCAL[index].size() && hasPathologyFCAL[index][listElec[ii]]) { - if(hasPathologyFCAL[index][listElec[ii]]&0xF) hv=0.; else hv=((hasPathologyFCAL[index][listElec[ii]]&0xFFF0)>>4); - curr=0.; + if(hasPathologyFCAL[index][listElec[ii]]&LArHVPathologyBits::MaskHV){ + hv=0.; + curr = 0.; + } else if(hasPathologyFCAL[index][listElec[ii]]&LArHVPathologyBits::MaskCurr){ + curr = 0.; + } else { + hv=((hasPathologyFCAL[index][listElec[ii]]&0xFFF0)>>4); + curr=0.; + } } } }