ATLAS Offline Software
Loading...
Searching...
No Matches
LArBadFebMaskingTool Class Reference

Mask LAr cells in Febs with decoding errors or listed in the bad feb database. More...

#include <LArBadFebMaskingTool.h>

Inheritance diagram for LArBadFebMaskingTool:

Public Member Functions

virtual StatusCode initialize () override
 initialize the tool
virtual StatusCode finalize () override
 finalize the tool
virtual StatusCode process (CaloCellContainer *theCellContainer, const EventContext &ctx) const override
 update theCellContainer, masking Feb with errors

Private Attributes

SG::ReadCondHandleKey< LArBadFebContm_badFebKey {this,"BadFebKey","LArBadFeb","Key of Bad-Feb object"}
 handle to get bad febs
SG::ReadCondHandleKey< LArOnOffIdMappingm_cablingKey {this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}
 handle to LAr cabling
Gaudi::Property< bool > m_maskParity {this,"maskParity",true}
 flags to select which errors to mask
Gaudi::Property< bool > m_maskSampleHeader {this,"maskSampleHeader",true}
Gaudi::Property< bool > m_maskEVTID {this,"maskEVTID",true}
Gaudi::Property< bool > m_maskScacStatus {this,"maskScacStatus",true}
Gaudi::Property< bool > m_maskScaOutOfRange {this,"maskScaOutOfRange",true}
Gaudi::Property< bool > m_maskGainMismatch {this,"maskGainMismatch",true}
Gaudi::Property< bool > m_maskTypeMismatch {this,"maskTypeMismatch",true}
Gaudi::Property< bool > m_maskNumOfSamples {this,"maskNumOfSamples",true}
Gaudi::Property< bool > m_maskEmptyDataBlock {this,"maskEmptyDataBlock",true}
Gaudi::Property< bool > m_maskDspBlockSize {this,"maskDspBlockSize",true}
Gaudi::Property< bool > m_maskCheckSum {this,"maskCheckSum",true}
Gaudi::Property< bool > m_maskMissingHeader {this,"maskMissingHeader",true}
Gaudi::Property< bool > m_maskBadGain {this,"maskBadGain",true}
Gaudi::Property< bool > m_noFebErrors {this,"noFebErrors",false,"do not read LArFebErrorSummary (MC case)"}
SG::ReadHandleKey< LArFebErrorSummarym_larFebErrorSummaryKey {this,"FebErrorSummaryKey","LArFebErrorSummary"}
SG::ReadHandleKey< xAOD::EventInfom_eventInfoKey {this,"EventInfoKey","EventInfo"}
SG::WriteDecorHandleKey< xAOD::EventInfom_eventInfoDecorKey {this,"EventInfoDecorKey",m_eventInfoKey, "larFlags"}
uint16_t m_errorToMask =0
 compute bit mask of errors to mask
const CaloCell_IDm_calo_id =nullptr
 pointers to identifier helpers
const LArOnlineIDm_onlineID =nullptr
std::atomic< int > m_evt {0}
 Number of events processed.
std::atomic< int > m_mask {0}
 Number of Feb masked.
const std::map< unsigned int, uint16_t > m_dummyFebMap {}
 Empty dummy map for MC case.

Detailed Description

Mask LAr cells in Febs with decoding errors or listed in the bad feb database.

AlgTool properties (name defined in cxx file): Handle for bad channel tool name Switches to decide which Feb errors to mask Removed setting LAr errors bit in EventInfo, moved to LArFebErrorSummaryMaker

Created April 23, 2009 G.Unal

Definition at line 38 of file LArBadFebMaskingTool.h.

Member Function Documentation

◆ finalize()

StatusCode LArBadFebMaskingTool::finalize ( )
overridevirtual

finalize the tool

Definition at line 73 of file LArBadFebMaskingTool.cxx.

74{
75 ATH_MSG_INFO (" ---- Summary from LArBadFebMaskingTool ");
76 ATH_MSG_INFO (" Number of events processed " << m_evt);
77 ATH_MSG_INFO (" Number of masked Feb total " << m_mask);
78 float ratio=0.;
79 if (m_evt>0) ratio=((float)(m_mask))/((float)(m_evt));
80 ATH_MSG_INFO (" Number of masked Feb per event " << ratio);
81
82 return StatusCode::SUCCESS;
83}
#define ATH_MSG_INFO(x)
std::atomic< int > m_evt
Number of events processed.
std::atomic< int > m_mask
Number of Feb masked.

◆ initialize()

StatusCode LArBadFebMaskingTool::initialize ( )
overridevirtual

initialize the tool

Definition at line 36 of file LArBadFebMaskingTool.cxx.

37{
38 m_evt=0;
39 m_mask=0;
40
41 m_errorToMask = 0;
55
56 ATH_MSG_INFO (" bit mask for errors to mask " << m_errorToMask);
57
58 // initialize read handle keys
60 ATH_CHECK( m_badFebKey.initialize());
61 ATH_CHECK( m_cablingKey.initialize());
62 ATH_CHECK(m_eventInfoKey.initialize());
63 ATH_CHECK(m_eventInfoDecorKey.initialize());
64
65 // retrieve identifier helpers
66 ATH_CHECK( detStore()->retrieve(m_onlineID, "LArOnlineID") );
67 ATH_CHECK( detStore()->retrieve(m_calo_id,"CaloCell_ID") );
68
69 return StatusCode::SUCCESS;
70
71}
#define ATH_CHECK
Evaluate an expression and check for errors.
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Gaudi::Property< bool > m_maskTypeMismatch
Gaudi::Property< bool > m_maskDspBlockSize
SG::ReadHandleKey< LArFebErrorSummary > m_larFebErrorSummaryKey
Gaudi::Property< bool > m_maskScacStatus
Gaudi::Property< bool > m_maskGainMismatch
Gaudi::Property< bool > m_maskParity
flags to select which errors to mask
Gaudi::Property< bool > m_maskSampleHeader
Gaudi::Property< bool > m_maskMissingHeader
SG::WriteDecorHandleKey< xAOD::EventInfo > m_eventInfoDecorKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
handle to LAr cabling
Gaudi::Property< bool > m_noFebErrors
Gaudi::Property< bool > m_maskScaOutOfRange
Gaudi::Property< bool > m_maskNumOfSamples
Gaudi::Property< bool > m_maskBadGain
uint16_t m_errorToMask
compute bit mask of errors to mask
SG::ReadCondHandleKey< LArBadFebCont > m_badFebKey
handle to get bad febs
Gaudi::Property< bool > m_maskEmptyDataBlock
const LArOnlineID * m_onlineID
Gaudi::Property< bool > m_maskCheckSum
Gaudi::Property< bool > m_maskEVTID
const CaloCell_ID * m_calo_id
pointers to identifier helpers
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ process()

StatusCode LArBadFebMaskingTool::process ( CaloCellContainer * theCellContainer,
const EventContext & ctx ) const
overridevirtual

update theCellContainer, masking Feb with errors

Definition at line 85 of file LArBadFebMaskingTool.cxx.

87{
88 m_evt++;
89
90 const std::map<unsigned int,uint16_t>* febMap = &m_dummyFebMap; //empty dummy map for MC case
91 if (!m_noFebErrors) {
92 ATH_MSG_DEBUG (" in LArBadFebMaskingTool::process ");
93 SG::ReadHandle<LArFebErrorSummary>larFebErrorSummary(m_larFebErrorSummaryKey, ctx);
94 if (!larFebErrorSummary.isValid()) {
95 ATH_MSG_WARNING ("Cannot retrieve Feb error summary with key " << m_larFebErrorSummaryKey.key() <<". Skip LArBadFebMaskingTool::process ");
96 return StatusCode::SUCCESS;
97 }
98
99 // retrieve map of Feb-errors
100 febMap = &larFebErrorSummary->get_all_febs();
101 ATH_MSG_DEBUG (" Number of Febs " << febMap->size());
102 }//end if m_noFebErrors
103
104 // catch cases of empty LAR container => severe problem in decoding => flag event as in ERROR
105 unsigned int nLar = theCont->nCellsCalo(CaloCell_ID::LAREM)+theCont->nCellsCalo(CaloCell_ID::LARHEC)+theCont->nCellsCalo(CaloCell_ID::LARFCAL);
106 if (nLar==0) {
107 ATH_MSG_DEBUG (" empty lar cell container ");
108 SG::ReadHandle<xAOD::EventInfo> eventInfo (m_eventInfoKey, ctx);
109 ATH_MSG_DEBUG (" set error bit for LAr for this event ");
110 if (!eventInfo->updateErrorState(xAOD::EventInfo::LAr,xAOD::EventInfo::Error)) {
111 ATH_MSG_WARNING (" cannot set error state for LAr ");
112 }
113 if (!eventInfo->updateEventFlagBit(xAOD::EventInfo::LAr,LArEventBitInfo::DATACORRUPTED)) {
114 ATH_MSG_WARNING (" cannot set event bit info for LAr ");
115 }
116 }
117
118
119 SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_cablingKey,ctx};
120 const LArOnOffIdMapping* cabling=*cablingHdl;
121
122 SG::ReadCondHandle<LArBadFebCont> badFebHdl{m_badFebKey,ctx};
123 const LArBadFebCont* badFebs=*badFebHdl;
124
125// loop over all Febs
126
127 for (HWIdentifier febId : m_onlineID->feb_range()) {
128 bool toMask1 = false; // mask because of bad error
129 bool inError = false; // mask because Feb listed in database as being to mask
130
131// for debug
132 unsigned int ifeb = febId.get_identifier32().get_compact();
133 ATH_MSG_DEBUG (" process Feb: " << ifeb);
134
135 std::map<unsigned int,uint16_t>::const_iterator it1 = febMap->find(ifeb);
136 if (it1 != febMap->end()) {
137 uint16_t ierror = (*it1).second;
138 if (ierror & m_errorToMask) toMask1=true;
139 ATH_MSG_DEBUG (" ierror,toMask " << ierror << " " << toMask1 << " ");
140 }
141
142
143 LArBadFeb febstatus = badFebs->status(febId);
144 inError = febstatus.inError() || febstatus.deadAll();
145
146 if (toMask1 || inError) {
147 m_mask++;
148 const int nChanPerFeb=m_onlineID->channelInSlotMax(febId);
149 for (int ch=0; ch<nChanPerFeb; ++ch) {
150 HWIdentifier hwid = m_onlineID->channel_Id(febId, ch);
151 if (cabling->isOnlineConnected(hwid)) {
152 Identifier id = cabling->cnvToIdentifier( hwid);
153 IdentifierHash theCellHashID = m_calo_id->calo_cell_hash(id);
154 int index = theCont->findIndex(theCellHashID);
155 if (index<0) {
156 ATH_MSG_DEBUG (" cell " << hwid.get_compact() << " " << id.get_compact() << " is not in the container ");
157 continue;
158 }
159 CaloCell* aCell = theCont->at(index);
160
161 if (aCell) {
162 ATH_MSG_DEBUG (" mask cell hwid= " << hwid.get_compact() << " offlineid = " << id.get_compact()
163 << " " << aCell->ID().get_compact());
164 aCell->setEnergy(0.);
165 aCell->setTime(0.);
166 uint16_t qua=0;
167 aCell->setQuality(qua);
168 const uint16_t provenance = (aCell->provenance() | LArProv::MASKED | LArProv::DEADFEB);// 0x0800 | 0x4000
169 aCell->setProvenance(provenance);
170 }
171
172 } // isConnected
173 } // loop over channels in Feb
174 } // toMask
175
176 } // loop over Febs in error
177
178 return StatusCode::SUCCESS;
179}
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
LArBadXCont< LArBadFeb > LArBadFebCont
virtual void setTime(float time)
set time
Definition CaloCell.h:484
uint16_t provenance() const
get provenance (data member)
Definition CaloCell.h:354
virtual void setEnergy(float energy)
set energy
Definition CaloCell.h:472
void setQuality(uint16_t quality)
set quality
Definition CaloCell.h:460
void setProvenance(uint16_t prov)
set Provenance
Definition CaloCell.h:490
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
Definition CaloCell.h:295
value_type get_compact() const
Get the compact id.
const std::map< unsigned int, uint16_t > m_dummyFebMap
Empty dummy map for MC case.
bool deadAll() const
FEB is completely missing, e.g. powered off.
Definition LArBadFeb.h:30
bool inError() const
FEB has readout errors, cannot be used.
Definition LArBadFeb.h:36
LArBC_t status(const HWIdentifier channel) const
Query the status of a particular channel or FEB This is the main client access method.
@ LAr
The LAr calorimeter.
@ Error
The sub-detector issued an error.
str index
Definition DeMoScan.py:362
setWord1 uint16_t

Member Data Documentation

◆ m_badFebKey

SG::ReadCondHandleKey<LArBadFebCont> LArBadFebMaskingTool::m_badFebKey {this,"BadFebKey","LArBadFeb","Key of Bad-Feb object"}
private

handle to get bad febs

Definition at line 66 of file LArBadFebMaskingTool.h.

66{this,"BadFebKey","LArBadFeb","Key of Bad-Feb object"};

◆ m_cablingKey

SG::ReadCondHandleKey<LArOnOffIdMapping> LArBadFebMaskingTool::m_cablingKey {this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}
private

handle to LAr cabling

Definition at line 69 of file LArBadFebMaskingTool.h.

69{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"};

◆ m_calo_id

const CaloCell_ID* LArBadFebMaskingTool::m_calo_id =nullptr
private

pointers to identifier helpers

Definition at line 98 of file LArBadFebMaskingTool.h.

◆ m_dummyFebMap

const std::map<unsigned int,uint16_t> LArBadFebMaskingTool::m_dummyFebMap {}
private

Empty dummy map for MC case.

Definition at line 111 of file LArBadFebMaskingTool.h.

111{};

◆ m_errorToMask

uint16_t LArBadFebMaskingTool::m_errorToMask =0
private

compute bit mask of errors to mask

Definition at line 94 of file LArBadFebMaskingTool.h.

◆ m_eventInfoDecorKey

SG::WriteDecorHandleKey<xAOD::EventInfo> LArBadFebMaskingTool::m_eventInfoDecorKey {this,"EventInfoDecorKey",m_eventInfoKey, "larFlags"}
private

Definition at line 91 of file LArBadFebMaskingTool.h.

91{this,"EventInfoDecorKey",m_eventInfoKey, "larFlags"};

◆ m_eventInfoKey

SG::ReadHandleKey<xAOD::EventInfo> LArBadFebMaskingTool::m_eventInfoKey {this,"EventInfoKey","EventInfo"}
private

Definition at line 90 of file LArBadFebMaskingTool.h.

90{this,"EventInfoKey","EventInfo"};

◆ m_evt

std::atomic<int> LArBadFebMaskingTool::m_evt {0}
mutableprivate

Number of events processed.

Definition at line 103 of file LArBadFebMaskingTool.h.

103{0};

◆ m_larFebErrorSummaryKey

SG::ReadHandleKey<LArFebErrorSummary> LArBadFebMaskingTool::m_larFebErrorSummaryKey {this,"FebErrorSummaryKey","LArFebErrorSummary"}
private

Definition at line 89 of file LArBadFebMaskingTool.h.

89{this,"FebErrorSummaryKey","LArFebErrorSummary"};

◆ m_mask

std::atomic<int> LArBadFebMaskingTool::m_mask {0}
mutableprivate

Number of Feb masked.

Definition at line 107 of file LArBadFebMaskingTool.h.

107{0};

◆ m_maskBadGain

Gaudi::Property<bool> LArBadFebMaskingTool::m_maskBadGain {this,"maskBadGain",true}
private

Definition at line 85 of file LArBadFebMaskingTool.h.

85{this,"maskBadGain",true};

◆ m_maskCheckSum

Gaudi::Property<bool> LArBadFebMaskingTool::m_maskCheckSum {this,"maskCheckSum",true}
private

Definition at line 83 of file LArBadFebMaskingTool.h.

83{this,"maskCheckSum",true};

◆ m_maskDspBlockSize

Gaudi::Property<bool> LArBadFebMaskingTool::m_maskDspBlockSize {this,"maskDspBlockSize",true}
private

Definition at line 82 of file LArBadFebMaskingTool.h.

82{this,"maskDspBlockSize",true};

◆ m_maskEmptyDataBlock

Gaudi::Property<bool> LArBadFebMaskingTool::m_maskEmptyDataBlock {this,"maskEmptyDataBlock",true}
private

Definition at line 81 of file LArBadFebMaskingTool.h.

81{this,"maskEmptyDataBlock",true};

◆ m_maskEVTID

Gaudi::Property<bool> LArBadFebMaskingTool::m_maskEVTID {this,"maskEVTID",true}
private

Definition at line 75 of file LArBadFebMaskingTool.h.

75{this,"maskEVTID",true};

◆ m_maskGainMismatch

Gaudi::Property<bool> LArBadFebMaskingTool::m_maskGainMismatch {this,"maskGainMismatch",true}
private

Definition at line 78 of file LArBadFebMaskingTool.h.

78{this,"maskGainMismatch",true};

◆ m_maskMissingHeader

Gaudi::Property<bool> LArBadFebMaskingTool::m_maskMissingHeader {this,"maskMissingHeader",true}
private

Definition at line 84 of file LArBadFebMaskingTool.h.

84{this,"maskMissingHeader",true};

◆ m_maskNumOfSamples

Gaudi::Property<bool> LArBadFebMaskingTool::m_maskNumOfSamples {this,"maskNumOfSamples",true}
private

Definition at line 80 of file LArBadFebMaskingTool.h.

80{this,"maskNumOfSamples",true};

◆ m_maskParity

Gaudi::Property<bool> LArBadFebMaskingTool::m_maskParity {this,"maskParity",true}
private

flags to select which errors to mask

Definition at line 73 of file LArBadFebMaskingTool.h.

73{this,"maskParity",true};

◆ m_maskSampleHeader

Gaudi::Property<bool> LArBadFebMaskingTool::m_maskSampleHeader {this,"maskSampleHeader",true}
private

Definition at line 74 of file LArBadFebMaskingTool.h.

74{this,"maskSampleHeader",true};

◆ m_maskScacStatus

Gaudi::Property<bool> LArBadFebMaskingTool::m_maskScacStatus {this,"maskScacStatus",true}
private

Definition at line 76 of file LArBadFebMaskingTool.h.

76{this,"maskScacStatus",true};

◆ m_maskScaOutOfRange

Gaudi::Property<bool> LArBadFebMaskingTool::m_maskScaOutOfRange {this,"maskScaOutOfRange",true}
private

Definition at line 77 of file LArBadFebMaskingTool.h.

77{this,"maskScaOutOfRange",true};

◆ m_maskTypeMismatch

Gaudi::Property<bool> LArBadFebMaskingTool::m_maskTypeMismatch {this,"maskTypeMismatch",true}
private

Definition at line 79 of file LArBadFebMaskingTool.h.

79{this,"maskTypeMismatch",true};

◆ m_noFebErrors

Gaudi::Property<bool> LArBadFebMaskingTool::m_noFebErrors {this,"noFebErrors",false,"do not read LArFebErrorSummary (MC case)"}
private

Definition at line 87 of file LArBadFebMaskingTool.h.

87{this,"noFebErrors",false,"do not read LArFebErrorSummary (MC case)"};

◆ m_onlineID

const LArOnlineID* LArBadFebMaskingTool::m_onlineID =nullptr
private

Definition at line 99 of file LArBadFebMaskingTool.h.


The documentation for this class was generated from the following files: