ATLAS Offline Software
Loading...
Searching...
No Matches
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
22 ATH_CHECK(m_cablingKey.initialize());
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
Helper class for offline supercell identifiers.
const ServiceHandle< StoreGateSvc > & detStore() const
Helper base class for offline cell identifiers.
bool is_fcal(const Identifier id) const
test if the id belongs to the FCAL - true also for MiniFCAL
bool is_em_endcap(const Identifier id) const
test if the id belongs to the EM Endcap
bool is_em_barrel(const Identifier id) const
test if the id belongs to the EM barrel
bool is_em_endcap_outer(const Identifier id) const
test if the id belongs to the EM Endcap outer wheel
bool is_em_endcap_inner(const Identifier id) const
test if the id belongs to the EM Endcap inner wheel
bool is_hec(const Identifier id) const
test if the id belongs to the HEC
Helper class for offline cell identifiers.
Definition CaloCell_ID.h:34
Helper class for offline supercell identifiers.
Gaudi::Property< bool > m_isSC
virtual StatusCode execute() final
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
virtual StatusCode initialize() final
Helper for the Liquid Argon Calorimeter cell identifiers.
virtual bool isEMECchannel(const HWIdentifier id) const =0
bool isEMBchannel(const HWIdentifier id) const
virtual bool isEMECIW(const HWIdentifier id) const =0
id_range channel_range() const
virtual bool isEMECOW(const HWIdentifier id) const =0
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...
std::string channel_name(const HWIdentifier id) const
Return a string corresponding to a feedthrough name given an identifier.
bool isFCALchannel(const HWIdentifier id) const
virtual bool isHECchannel(const HWIdentifier id) const =0