ATLAS Offline Software
LArIdCablingTest.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "LArIdCablingTest.h"
10 
11 
13 
14 
16 
17  ATH_MSG_INFO ( "initialize()" );
18  if (m_isSC && m_cablingKey.key()=="LArOnOffIdMap") {
19  ATH_MSG_ERROR("Unexpected cabling key for SuperCellCase, found " << m_cablingKey);
20  }
21 
23 
24  return StatusCode::SUCCESS;
25 }
26 
27 
29 
31  const LArOnOffIdMapping* cabling=(*cablingHdl);
32 
33  const LArOnlineID_Base* larOnlineID = nullptr;
34  if (m_isSC) {
35  const LArOnline_SuperCellID* ll = nullptr;
36  ATH_CHECK(detStore()->retrieve(ll, "LArOnline_SuperCellID"));
37  larOnlineID = ll;
38  ATH_MSG_DEBUG("Found the LArOnlineID helper");
39 
40  } else { // m_isSC
41  const LArOnlineID* ll= nullptr;
42  ATH_CHECK(detStore()->retrieve(ll, "LArOnlineID"));
43  larOnlineID = ll;
44  ATH_MSG_DEBUG(" Found the LArOnlineID helper. ");
45  }
46 
47  const CaloCell_Base_ID* caloId;
48  if (m_isSC) {
49  const CaloCell_SuperCell_ID* cs = nullptr;
50  ATH_CHECK(detStore()->retrieve(cs, "CaloCell_SuperCell_ID"));
51  caloId = cs;
52  } else { // m_isSC
53  const CaloCell_ID* cc = nullptr;
54  ATH_CHECK(detStore()->retrieve(cc, "CaloCell_ID"));
55  caloId = cc;
56  }
57 
58  unsigned nConnected = 0;
59  std::array<unsigned,2> nEMECIW{0,0};
60  std::array<unsigned,2> nEMECOW{0,0};
61  std::array<unsigned,2> nBarrel{0,0};
62  std::array<unsigned,2> nHEC{0,0};
63  std::array<unsigned,2> nFCAL{0,0};
64 
65 
66 
67  for ( const HWIdentifier chid : larOnlineID->channel_range()) {
68  if (!cabling->isOnlineConnected(chid)) continue;
69  ++nConnected;
70  const Identifier id=cabling->cnvToIdentifier(chid);
71  if (!id.is_valid()) {
72  ATH_MSG_ERROR("Invalid offline id for online id 0x" << std::hex << chid.get_identifier32().get_compact() << std::dec << " " << larOnlineID->channel_name(chid));
73  }
74  else {
75  std::string subdet="Unkown";
76  int posneg=larOnlineID->pos_neg(chid);
77  if (caloId->is_em_barrel(id)) {subdet="Barrel"; ++nBarrel[posneg];}
78  if (caloId->is_em_endcap_inner(id)) {subdet="EMECIW"; ++nEMECIW[posneg];}
79  if (caloId->is_em_endcap_outer(id)) {subdet="EMECOW"; ++nEMECOW[posneg];}
80  if (caloId->is_hec(id)) {subdet="HEC"; ++nHEC[posneg];}
81  if (caloId->is_fcal(id)) {subdet="FCAL"; ++nFCAL[posneg];}
82 
83  ATH_MSG_DEBUG("Channel 0x" << std::hex << chid.get_identifier32().get_compact() << std::dec << " " << larOnlineID->channel_name(chid)
84  << " offline id 0x" << std::hex << id.get_identifier32().get_compact() << std::dec << " " << subdet);
85  if (larOnlineID->isEMBchannel(chid) != caloId->is_em_barrel(id)) {
86  ATH_MSG_ERROR("isEMB mismatch online Id 0x" << std::hex << chid.get_identifier32().get_compact() << std::dec << " " << larOnlineID->channel_name(chid)
87  << " offline id 0x" << std::hex << id.get_identifier32().get_compact() << std::dec << " onl "
88  << larOnlineID->isEMBchannel(chid) << " / ofl " << caloId->is_em_barrel(id));
89  }
90  if (larOnlineID->isEMECIW(chid) != caloId->is_em_endcap_inner(id)) {
91  ATH_MSG_ERROR("isEMECIW mismatch online Id 0x" << std::hex << chid.get_identifier32().get_compact() << std::dec << " " << larOnlineID->channel_name(chid)
92  << " offline id 0x" << std::hex << id.get_identifier32().get_compact() << std::dec << " onl "
93  << larOnlineID->isEMECIW(chid) << " / ofl " << caloId->is_em_endcap_inner(id));
94  }
95  if (larOnlineID->isEMECOW(chid) != caloId->is_em_endcap_outer(id)) {
96  ATH_MSG_ERROR("isEMECOW mismatch online Id 0x" << std::hex << chid.get_identifier32().get_compact() << std::dec << " " << larOnlineID->channel_name(chid)
97  << " offline id 0x" << std::hex << id.get_identifier32().get_compact() << std::dec << " onl "
98  << larOnlineID->isEMECOW(chid) << " / ofl " << caloId->is_em_endcap_outer(id));
99  }
100  if (larOnlineID->isEMECchannel(chid) != caloId->is_em_endcap(id)) {
101  ATH_MSG_ERROR("isEMEC mismatch online Id 0x" << std::hex << chid.get_identifier32().get_compact() << std::dec << " " << larOnlineID->channel_name(chid)
102  << " offline id 0x" << std::hex << id.get_identifier32().get_compact() << std::dec << " onl "
103  << larOnlineID->isEMECchannel(chid) << " / ofl " << caloId->is_em_endcap(id));
104  }
105  if (larOnlineID->isHECchannel(chid) != caloId->is_hec(id)) {
106  ATH_MSG_ERROR("isHEC mismatch online Id 0x" << std::hex << chid.get_identifier32().get_compact() << std::dec << " " << larOnlineID->channel_name(chid)
107  << " offline id 0x" << std::hex << id.get_identifier32().get_compact() << std::dec << " onl "
108  << larOnlineID->isHECchannel(chid) << " / ofl " << caloId->is_hec(id));
109  }
110  if (larOnlineID->isFCALchannel(chid) != caloId->is_fcal(id)) {
111  ATH_MSG_ERROR("isFCAL mismatch online Id 0x" << std::hex << chid.get_identifier32().get_compact() << std::dec << " " << larOnlineID->channel_name(chid)
112  << " offline id 0x" << std::hex << id.get_identifier32().get_compact() << std::dec << " onl "
113  << larOnlineID->isFCALchannel(chid) << "/ ofl" << caloId->is_fcal(id));
114  }
115 
116 
117  }//end if connected
118  } //end loop over online identifiers
119 
120  if (m_isSC) {
121  ATH_MSG_INFO("checked " << nConnected << " super-cell channels.");
122  } else {
123  ATH_MSG_INFO("checked " << nConnected << " regular channels.");
124  }
125  ATH_MSG_INFO("Number of channels A/C side:");
126  ATH_MSG_INFO("Barrel " << nBarrel[0] << "/" << nBarrel[1]);
127  if ( nBarrel[0] != nBarrel[1]) ATH_MSG_ERROR("MISMATCH!");
128  ATH_MSG_INFO("EMECOW " << nEMECIW[0] << "/" << nEMECIW[1]);
129  if (nEMECIW[0]!=nEMECIW[1]) ATH_MSG_ERROR("MISMATCH!");
130  ATH_MSG_INFO("EMECIW " << nEMECOW[0] << "/" << nEMECOW[1]);
131  if (nEMECOW[0]!=nEMECOW[1]) ATH_MSG_ERROR("MISMATCH!");
132  ATH_MSG_INFO("HEC " << nHEC[0] << "/" << nHEC[1]);
133  if (nHEC[0]!=nHEC[1]) ATH_MSG_ERROR("MISMATCH!");
134  ATH_MSG_INFO("FCAL " << nFCAL[0] << "/" << nFCAL[1]);
135  if (nFCAL[0]!=nFCAL[1]) ATH_MSG_ERROR("MISMATCH!");
136  return StatusCode::SUCCESS;
137 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
CaloCell_Base_ID::is_em_endcap_outer
bool is_em_endcap_outer(const Identifier id) const
test if the id belongs to the EM Endcap outer wheel
LArIdCablingTest::execute
virtual StatusCode execute() final
Definition: LArIdCablingTest.cxx:28
detail::ll
long long ll
Definition: PrimitiveHelpers.h:47
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CaloCell_Base_ID::is_em_endcap
bool is_em_endcap(const Identifier id) const
test if the id belongs to the EM Endcap
LArOnlineID_Base::isEMECIW
virtual bool isEMECIW(const HWIdentifier id) const =0
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
HWIdentifier
Definition: HWIdentifier.h:13
CaloCell_Base_ID::is_hec
bool is_hec(const Identifier id) const
test if the id belongs to the HEC
CaloCell_ID.h
AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
LArOnlineID_Base::isFCALchannel
bool isFCALchannel(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1653
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LArOnlineID_Base::channel_range
id_range channel_range() const
Definition: LArOnlineID_Base.cxx:1932
CaloCell_SuperCell_ID
Helper class for offline supercell identifiers.
Definition: CaloCell_SuperCell_ID.h:48
CaloCell_Base_ID::is_fcal
bool is_fcal(const Identifier id) const
test if the id belongs to the FCAL - true also for MiniFCAL
LArOnlineID_Base::isHECchannel
virtual bool isHECchannel(const HWIdentifier id) const =0
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LArOnlineID_Base::isEMECOW
virtual bool isEMECOW(const HWIdentifier id) const =0
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CaloCell_Base_ID::is_em_endcap_inner
bool is_em_endcap_inner(const Identifier id) const
test if the id belongs to the EM Endcap inner wheel
LArOnlineID_Base::pos_neg
int pos_neg(const HWIdentifier id) const
Return the side of a hardware cell identifier pos_neg = [0,1] positive-side or negative-side Barrel...
Definition: LArOnlineID_Base.cxx:1950
CaloCell_SuperCell_ID.h
Helper class for offline supercell identifiers.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloCell_ID
Helper class for offline cell identifiers.
Definition: CaloCell_ID.h:34
LArIdCablingTest::initialize
virtual StatusCode initialize() final
Definition: LArIdCablingTest.cxx:15
CaloCell_Base_ID::is_em_barrel
bool is_em_barrel(const Identifier id) const
test if the id belongs to the EM barrel
LArOnlineID_Base
Helper for the Liquid Argon Calorimeter cell identifiers.
Definition: LArOnlineID_Base.h:105
LArOnlineID_Base::isEMECchannel
virtual bool isEMECchannel(const HWIdentifier id) const =0
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
LArOnlineID
Definition: LArOnlineID.h:20
LArOnlineID_Base::isEMBchannel
bool isEMBchannel(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1648
LArOnline_SuperCellID
Definition: LArOnline_SuperCellID.h:20
LArIdCablingTest::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition: LArIdCablingTest.h:26
LArIdCablingTest::~LArIdCablingTest
~LArIdCablingTest()
LArIdCablingTest::m_isSC
Gaudi::Property< bool > m_isSC
Definition: LArIdCablingTest.h:28
LArIdCablingTest.h
LArOnline_SuperCellID.h
LArOnlineID_Base::channel_name
std::string channel_name(const HWIdentifier id) const
Return a string corresponding to a feedthrough name given an identifier.
Definition: LArOnlineID_Base.cxx:219
CaloCell_Base_ID
Helper base class for offline cell identifiers.
Definition: CaloCell_Base_ID.h:41
LArOnlineID.h
python.handimod.cc
int cc
Definition: handimod.py:523
LArOnOffIdMapping
Definition: LArOnOffIdMapping.h:20
Identifier
Definition: IdentifierFieldParser.cxx:14