Skip to content
Snippets Groups Projects
Commit f13f0012 authored by Pavol Strizenec's avatar Pavol Strizenec Committed by Walter Lampl
Browse files

Add LAr HV pathology bits

parent 4bfb7f00
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
from time import strptime,time from time import strptime,time
from calendar import timegm from calendar import timegm
if "GloablTag" not in dir(): if "GlobalTag" not in dir():
GlobalTag = 'CONDBR2-BLKPA-2017-03' GlobalTag = 'CONDBR2-BLKPA-2017-03'
if "inputsqlite" not in dir(): if "inputsqlite" not in dir():
...@@ -24,9 +24,9 @@ if "date" not in dir(): ...@@ -24,9 +24,9 @@ if "date" not in dir():
if "TimeStamp" not in dir(): if "TimeStamp" not in dir():
try: try:
ts=strptime(date+'/UTC','%Y-%m-%d:%H:%M:%S/%Z') ts=strptime(date+'/UTC','%Y-%m-%d:%H:%M:%S/%Z')
TimeStamp=int(timegm(ts))*1000000000L TimeStamp=int(timegm(ts))*1000000000
except ValueError: 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 ## basic job configuration
import AthenaCommon.AtlasUnixGeneratorJob import AthenaCommon.AtlasUnixGeneratorJob
......
/* /*
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" #include "LArHVPathologyDbAlg.h"
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "CaloIdentifier/LArHEC_ID.h" #include "CaloIdentifier/LArHEC_ID.h"
#include "CaloIdentifier/LArFCAL_ID.h" #include "CaloIdentifier/LArFCAL_ID.h"
#include "LArIdentifier/LArOnlineID.h" #include "LArIdentifier/LArOnlineID.h"
#include "LArCabling/LArCablingLegacyService.h"
#include "CaloDetDescr/CaloDetDescrManager.h" #include "CaloDetDescr/CaloDetDescrManager.h"
#include "CaloDetDescr/CaloDetectorElements.h" #include "CaloDetDescr/CaloDetectorElements.h"
...@@ -42,7 +41,6 @@ LArHVPathologyDbAlg::LArHVPathologyDbAlg(const std::string& name, ISvcLocator* p ...@@ -42,7 +41,6 @@ LArHVPathologyDbAlg::LArHVPathologyDbAlg(const std::string& name, ISvcLocator* p
, m_regSvc("IOVRegistrationSvc",name) , m_regSvc("IOVRegistrationSvc",name)
, m_pathologyTool("LArHVPathologyDbTool") , m_pathologyTool("LArHVPathologyDbTool")
, m_mode(0) , m_mode(0)
, m_cablingService("LArCablingLegacyService")
, m_larem_id(0) , m_larem_id(0)
, m_larhec_id(0) , m_larhec_id(0)
, m_larfcal_id(0) , m_larfcal_id(0)
...@@ -119,6 +117,7 @@ StatusCode LArHVPathologyDbAlg::initialize() ...@@ -119,6 +117,7 @@ StatusCode LArHVPathologyDbAlg::initialize()
} }
ATH_CHECK( m_hvCablingKey.initialize() ); ATH_CHECK( m_hvCablingKey.initialize() );
ATH_CHECK( m_cablingKey.initialize() );
return sc; return sc;
} }
...@@ -181,6 +180,12 @@ StatusCode LArHVPathologyDbAlg::createCondObjects (const EventContext & ctx) ...@@ -181,6 +180,12 @@ StatusCode LArHVPathologyDbAlg::createCondObjects (const EventContext & ctx)
else { else {
SG::ReadCondHandle<LArHVIdMapping> hvIdMapping (m_hvCablingKey, ctx); 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 // Read input file and construct LArHVPathologiesDb for given folder
std::ifstream infile; std::ifstream infile;
infile.open(m_inpFile.value().c_str()); infile.open(m_inpFile.value().c_str());
...@@ -234,7 +239,7 @@ StatusCode LArHVPathologyDbAlg::createCondObjects (const EventContext & ctx) ...@@ -234,7 +239,7 @@ StatusCode LArHVPathologyDbAlg::createCondObjects (const EventContext & ctx)
infile >> bec >> pos_neg >> FT >> slot >> channel >> hvModule >> hvLine >> pathologyType; infile >> bec >> pos_neg >> FT >> slot >> channel >> hvModule >> hvLine >> pathologyType;
msg(MSG::INFO) << " read " << bec << " " << pos_neg << " " << FT << " " << slot << " " << channel << " " << hvModule << " " << hvLine << " " << pathologyType << endmsg; 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); 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()); cellID = (unsigned int)(id.get_identifier32().get_compact());
elecList=getElectInd(**hvIdMapping, id,hvModule,hvLine); elecList=getElectInd(**hvIdMapping, id,hvModule,hvLine);
msg(MSG::INFO) << " cellId , elecList size " << cellID << " " << elecList.size() << endmsg; msg(MSG::INFO) << " cellId , elecList size " << cellID << " " << elecList.size() << endmsg;
...@@ -284,6 +289,12 @@ StatusCode LArHVPathologyDbAlg::printCondObjects (const EventContext& ctx) ...@@ -284,6 +289,12 @@ StatusCode LArHVPathologyDbAlg::printCondObjects (const EventContext& ctx)
msg(MSG::INFO) <<" in printCondObjects() " <<endmsg; msg(MSG::INFO) <<" in printCondObjects() " <<endmsg;
SG::ReadCondHandle<LArHVIdMapping> hvIdMapping (m_hvCablingKey, ctx); 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; std::ofstream *fout=0;
const AthenaAttributeList* attrlist; const AthenaAttributeList* attrlist;
...@@ -311,7 +322,7 @@ StatusCode LArHVPathologyDbAlg::printCondObjects (const EventContext& ctx) ...@@ -311,7 +322,7 @@ StatusCode LArHVPathologyDbAlg::printCondObjects (const EventContext& ctx)
if(fout) *fout<<electPath.cellID<<"\t"<<electPath.electInd<<"\t"<<electPath.pathologyType<<std::endl; if(fout) *fout<<electPath.cellID<<"\t"<<electPath.electInd<<"\t"<<electPath.pathologyType<<std::endl;
} else { } else {
msg(MSG::INFO) << "Got pathology for cell ID: " << electPath.cellID << endmsg; 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); int HVLine=getHVline(**hvIdMapping,Identifier(electPath.cellID),electPath.electInd);
if(HVLine<0) { if(HVLine<0) {
msg(MSG::ERROR) << "No HVline for cell "<<electPath.cellID<< endmsg; msg(MSG::ERROR) << "No HVline for cell "<<electPath.cellID<< endmsg;
......
/* /*
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 #ifndef LARCONDUTILS_LARHVPATHOLOGYDBALG_H
...@@ -9,10 +9,11 @@ ...@@ -9,10 +9,11 @@
#include "LArRecConditions/LArHVIdMapping.h" #include "LArRecConditions/LArHVIdMapping.h"
#include "StoreGate/ReadCondHandleKey.h" #include "StoreGate/ReadCondHandleKey.h"
#include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ToolHandle.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "LArCabling/LArOnOffIdMapping.h"
class IIOVRegistrationSvc; class IIOVRegistrationSvc;
class ILArHVPathologyDbTool; class ILArHVPathologyDbTool;
class LArCablingLegacyService ;
class LArEM_ID; class LArEM_ID;
class LArHEC_ID; class LArHEC_ID;
class LArFCAL_ID; class LArFCAL_ID;
...@@ -55,7 +56,6 @@ class LArHVPathologyDbAlg : public AthAlgorithm ...@@ -55,7 +56,6 @@ class LArHVPathologyDbAlg : public AthAlgorithm
const DataHandle<CaloIdManager> m_caloIdMgr; const DataHandle<CaloIdManager> m_caloIdMgr;
const DataHandle<CaloDetDescrManager> m_calodetdescrmgr; const DataHandle<CaloDetDescrManager> m_calodetdescrmgr;
ToolHandle<LArCablingLegacyService> m_cablingService;
const LArEM_ID* m_larem_id; const LArEM_ID* m_larem_id;
const LArHEC_ID* m_larhec_id; const LArHEC_ID* m_larhec_id;
const LArFCAL_ID* m_larfcal_id; const LArFCAL_ID* m_larfcal_id;
...@@ -63,6 +63,8 @@ class LArHVPathologyDbAlg : public AthAlgorithm ...@@ -63,6 +63,8 @@ class LArHVPathologyDbAlg : public AthAlgorithm
SG::ReadCondHandleKey<LArHVIdMapping> m_hvCablingKey SG::ReadCondHandleKey<LArHVIdMapping> m_hvCablingKey
{this, "LArHVIdMapping", "LArHVIdMap", "SG key for HV ID mapping"}; {this, "LArHVIdMapping", "LArHVIdMap", "SG key for HV ID mapping"};
SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey
{this, "OnOffMap", "LArOnOffIdMap", "SG key for mapping object"};
}; };
#endif #endif
/* /*
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 #ifndef LARTOOLS_LARHVPATHOLOGIESDB_H
#define LARTOOLS_LARHVPATHOLOGIESDB_H #define LARTOOLS_LARHVPATHOLOGIESDB_H
#include "CxxUtils/bitmask.h"
#include <vector> #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 class LArHVPathologiesDb
{ {
public: public:
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "GaudiKernel/IToolSvc.h" #include "GaudiKernel/IToolSvc.h"
#include "StoreGate/ReadCondHandle.h" #include "StoreGate/ReadCondHandle.h"
#include "LArElecCalib/ILArHVPathologyDbTool.h" #include "LArElecCalib/ILArHVPathologyDbTool.h"
#include "LArRecConditions/LArHVPathologiesDb.h"
#include "CaloDetDescr/CaloDetectorElements.h" #include "CaloDetDescr/CaloDetectorElements.h"
#include "CaloGeoHelpers/CaloPhiRange.h" #include "CaloGeoHelpers/CaloPhiRange.h"
#include "CaloIdentifier/LArEM_ID.h" #include "CaloIdentifier/LArEM_ID.h"
...@@ -419,15 +420,23 @@ StatusCode LArHVCondAlg::fillPayload(LArHVData* hvdata ...@@ -419,15 +420,23 @@ StatusCode LArHVCondAlg::fillPayload(LArHVData* hvdata
hvmod.getEtaIndex(), hvmod.getEtaIndex(),
igap, igap,
electrode.getElectrodeIndex() )); 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) { if (hasPathology) {
ATH_MSG_VERBOSE( "Has pathology for id: "<< m_larem_id->print_to_string(id)<<" "<<hasPathologyEM[index]); ATH_MSG_VERBOSE( "Has pathology for id: "<< m_larem_id->print_to_string(id)<<" "<<hasPathologyEM[index]);
msg(MSG::VERBOSE) << "Original hv: "<<hv<<" "; msg(MSG::VERBOSE) << "Original hv: "<<hv<<" ";
for (unsigned int ii=0;ii<listElec.size();ii++) { 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 (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); if(hasPathologyEM[index][listElec[ii]]&LArHVPathologyBits::MaskHV) {
curr=0.; 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; msg(MSG::VERBOSE) << "set hv: "<<hv<<endmsg;
...@@ -471,7 +480,8 @@ StatusCode LArHVCondAlg::fillPayload(LArHVData* hvdata ...@@ -471,7 +480,8 @@ StatusCode LArHVCondAlg::fillPayload(LArHVData* hvdata
igap, igap,
0 // not used in EMBPS 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); addHV(v,hv,wt);
addCurr(ihv,curr,wt); addCurr(ihv,curr,wt);
...@@ -519,14 +529,22 @@ StatusCode LArHVCondAlg::fillPayload(LArHVData* hvdata ...@@ -519,14 +529,22 @@ StatusCode LArHVCondAlg::fillPayload(LArHVData* hvdata
hvmod.getEtaIndex(), hvmod.getEtaIndex(),
hvmod.getSectorIndex(), hvmod.getSectorIndex(),
electrode.getElectrodeIndex() )); 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) { if (hasPathology) {
msg(MSG::VERBOSE) << "Has pathology for id: "<< m_larem_id->print_to_string(id)<<" "<<hasPathologyEM[index]<<endmsg; 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++) { 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 (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); if(hasPathologyEM[index][listElec[ii]]&LArHVPathologyBits::MaskHV) {
curr=0.; 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 ...@@ -568,7 +586,8 @@ StatusCode LArHVCondAlg::fillPayload(LArHVData* hvdata
igap, igap,
0 // not used in EMECPS 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); addHV(v,hv,wt);
addCurr(ihv,curr,wt); addCurr(ihv,curr,wt);
...@@ -646,14 +665,22 @@ StatusCode LArHVCondAlg::fillPayload(LArHVData* hvdata ...@@ -646,14 +665,22 @@ StatusCode LArHVCondAlg::fillPayload(LArHVData* hvdata
subgap.getSubgapIndex(), subgap.getSubgapIndex(),
0 // not used in HEC 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) { if (hasPathology) {
msg(MSG::VERBOSE) << "Has pathology for id: "<< m_larhec_id->print_to_string(id)<<" "<<hasPathologyHEC[index]<<endmsg; 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++) { for (unsigned int ii=0;ii<listElec.size();ii++) {
if (listElec[ii]==i && listElec[ii]<hasPathologyHEC[index].size() && hasPathologyHEC[index][listElec[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); if(hasPathologyHEC[index][listElec[ii]]&LArHVPathologyBits::MaskHV) {
curr=0.; 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 ...@@ -734,14 +761,22 @@ StatusCode LArHVCondAlg::fillPayload(LArHVData* hvdata
hvmod.getSectorIndex(), hvmod.getSectorIndex(),
line->getLineIndex() 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) { if (hasPathology) {
msg(MSG::VERBOSE) << "Has pathology for id: "<< m_larfcal_id->print_to_string(id)<<" "<<hasPathologyFCAL[index]<<endmsg; 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++) { for (unsigned int ii=0;ii<listElec.size();ii++) {
if (listElec[ii]==i && listElec[ii]<hasPathologyFCAL[index].size() && hasPathologyFCAL[index][listElec[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); if(hasPathologyFCAL[index][listElec[ii]]&LArHVPathologyBits::MaskHV){
curr=0.; hv=0.;
curr = 0.;
} else if(hasPathologyFCAL[index][listElec[ii]]&LArHVPathologyBits::MaskCurr){
curr = 0.;
} else {
hv=((hasPathologyFCAL[index][listElec[ii]]&0xFFF0)>>4);
curr=0.;
}
} }
} }
} }
......
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