ATLAS Offline Software
LArCellNoiseMaskingTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /********************************************************************
6 
7 NAME: LArCellNoiseMaskingTool
8 PACKAGE: offline/Calorimeter/LArCellRec
9 
10 AUTHORS: G.Unal
11 CREATION: 4 feb 2009
12 
13 PURPOSE:
14 
15 ********************************************************************/
16 
18 
21 #include "Identifier/Identifier.h"
22 
24 // CONSTRUCTOR:
26 
28  const std::string& type,
29  const std::string& name,
30  const IInterface* parent)
31  :base_class (type, name, parent),
32  m_qualityCut(65536),
33  m_maskNoise(true),
34  m_maskSporadic(true)
35 {
36  declareProperty("qualityCut",m_qualityCut,"Quality cut for sporadic noise channel");
37  m_caloNums.clear();
38  m_caloNums.push_back( static_cast<int>(CaloCell_ID::LAREM) );
39  m_caloNums.push_back( static_cast<int>(CaloCell_ID::LARHEC) );
40  m_caloNums.push_back( static_cast<int>(CaloCell_ID::LARFCAL) );
41 
42 }
43 
44 
45 
46 
48 // INITIALIZE:
49 // The initialize method will create all the required algorithm objects
51 
53 
54  m_maskNoise= not m_problemsToMask.empty();
56 
58 
61 
62  if (m_maskNoise) {
63  ATH_MSG_INFO (" Cell masking for noise/dead channels activated");
64  }
65  else {
66  ATH_MSG_INFO (" Cell masking for noise/dead channels not activated ");
67  }
68 
69  if (m_maskSporadic) {
70  ATH_MSG_INFO (" Cell masking for sporadic noise activated");
71  }
72  else {
73  ATH_MSG_INFO (" Cell masking for sporadic noise not activated ");
74  }
75 
76  return StatusCode::SUCCESS;
77 }
78 
81  const EventContext& ctx) const
82 {
83  StatusCode returnSc = StatusCode::SUCCESS ;
84 
85  if (!m_maskNoise && !m_maskSporadic) return returnSc;
86 
88  const LArBadChannelCont* bcCont{*bcContHdl};
89 
90  for (std::vector<int>::const_iterator itrCalo=m_caloNums.begin();itrCalo!=m_caloNums.end();++itrCalo){
91  CaloCell_ID::SUBCALO caloNum=static_cast<CaloCell_ID::SUBCALO>(*itrCalo);
92  CaloCellContainer::iterator itrCell=theCont->beginCalo(caloNum);
93  CaloCellContainer::iterator itrCellEnd=theCont->endCalo(caloNum);
94 
95  for (; itrCell!=itrCellEnd;++itrCell){
96  CaloCell * aCell=*itrCell;
97  Identifier cellId = aCell->ID();
98 
99  bool toMask = false;
100 
101 // sporadic noise masking using quality cut. Logic could be improved using neighbour information...
102  if (m_maskSporadic) {
103  if (aCell->quality() > m_qualityCut) {
104  if (m_sporadicNoiseMask.cellShouldBeMasked(bcCont,cellId)) {
105  toMask=true;
106  ATH_MSG_DEBUG (" Mask sporadic noise cell" << cellId << " E,t,chi2 " << aCell->energy() << " " << aCell->time() << " " << aCell->quality());
107  }
108  }
109  }
110 
111 // high noise / dead channel masking
112  if (m_maskNoise) {
113  if (m_noiseMask.cellShouldBeMasked(bcCont,cellId)) {
114  toMask=true;
115  ATH_MSG_DEBUG (" Mask highNoise/dead cell" << cellId << " E,t,chi2 " << aCell->energy() << " " << aCell->time() << " " << aCell->quality());
116  }
117  }
118 
119 
120  if (toMask) {
121  aCell->setEnergy(0.);
122  aCell->setTime(0.);
123  uint16_t qua=0;
124  aCell->setQuality(qua);
125  uint16_t provenance = (aCell->provenance() | 0x0800);
126  aCell->setProvenance(provenance);
127  }
128 
129  }
130  }
131 
132 
133  return returnSc ;
134 }
CaloCell_Base_ID::LARFCAL
@ LARFCAL
Definition: CaloCell_Base_ID.h:46
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
LArCellNoiseMaskingTool::m_bcContKey
SG::ReadCondHandleKey< LArBadChannelCont > m_bcContKey
Definition: LArCellNoiseMaskingTool.h:35
CaloCell::setTime
virtual void setTime(float time)
set time
Definition: CaloCell.cxx:151
LArCellNoiseMaskingTool::LArCellNoiseMaskingTool
LArCellNoiseMaskingTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: LArCellNoiseMaskingTool.cxx:27
LArBadXCont
Conditions-Data class holding LAr Bad Channel or Bad Feb information.
Definition: LArBadChannelCont.h:28
LArBadChannelMask::buildBitMask
StatusCode buildBitMask(const std::vector< std::string > &problemsToMask, MsgStream &msg)
Definition: LArBadChannelMask.cxx:10
CaloCell_Base_ID::LARHEC
@ LARHEC
Definition: CaloCell_Base_ID.h:46
CaloCellContainer::endCalo
CaloCellContainer::iterator endCalo(CaloCell_ID::SUBCALO caloNum)
Definition: CaloCellContainer.cxx:128
CaloCell::provenance
uint16_t provenance() const
get provenance (data member)
Definition: CaloCell.h:338
CaloCell::setEnergy
virtual void setEnergy(float energy)
set energy
Definition: CaloCell.cxx:136
CaloCell::time
float time() const
get time (data member)
Definition: CaloCell.h:352
LArBadChannelMask::cellShouldBeMasked
bool cellShouldBeMasked(const LArBadChannelCont *bcCont, const HWIdentifier &hardwareId) const
Definition: LArBadChannelMask.h:42
LArCellNoiseMaskingTool::m_noiseMask
LArBadChannelMask m_noiseMask
Definition: LArCellNoiseMaskingTool.h:39
CaloCell_ID.h
CaloCell::energy
double energy() const
get energy (data member)
Definition: CaloCell.h:311
LArCellNoiseMaskingTool::m_maskNoise
bool m_maskNoise
Definition: LArCellNoiseMaskingTool.h:44
LArCellNoiseMaskingTool::m_caloNums
std::vector< int > m_caloNums
Definition: LArCellNoiseMaskingTool.h:43
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
DataModel_detail::iterator
(Non-const) Iterator class for DataVector/DataList.
Definition: DVLIterator.h:184
CaloCell::setQuality
virtual void setQuality(uint16_t quality)
set quality
Definition: CaloCell.cxx:156
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
LArCellNoiseMaskingTool::initialize
virtual StatusCode initialize() override
Definition: LArCellNoiseMaskingTool.cxx:52
CaloCell_Base_ID::SUBCALO
SUBCALO
enumeration of sub calorimeters
Definition: CaloCell_Base_ID.h:46
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LArCellNoiseMaskingTool::m_problemsToMask
Gaudi::Property< std::vector< std::string > > m_problemsToMask
Definition: LArCellNoiseMaskingTool.h:31
CaloCell::setProvenance
void setProvenance(uint16_t prov)
set Provenance
Definition: CaloCell.cxx:167
CaloCell::quality
uint16_t quality() const
get quality (data member)
Definition: CaloCell.h:332
LArCellNoiseMaskingTool::m_sporadicNoiseMask
LArBadChannelMask m_sporadicNoiseMask
Definition: LArCellNoiseMaskingTool.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
CaloCell::ID
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
Definition: CaloCell.h:279
CaloCellContainer.h
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
CaloCellContainer::beginCalo
CaloCellContainer::iterator beginCalo(CaloCell_ID::SUBCALO caloNum)
get non const iterators on cell of just one calo
Definition: CaloCellContainer.cxx:123
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
LArCellNoiseMaskingTool::process
virtual StatusCode process(CaloCellContainer *theCellContainer, const EventContext &ctx) const override
Definition: LArCellNoiseMaskingTool.cxx:80
CaloCell_Base_ID::LAREM
@ LAREM
Definition: CaloCell_Base_ID.h:46
LArCellNoiseMaskingTool::m_qualityCut
int m_qualityCut
Definition: LArCellNoiseMaskingTool.h:42
LArCellNoiseMaskingTool::m_sporadicProblemsToMask
Gaudi::Property< std::vector< std::string > > m_sporadicProblemsToMask
Definition: LArCellNoiseMaskingTool.h:33
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
LArCellNoiseMaskingTool::m_maskSporadic
bool m_maskSporadic
Definition: LArCellNoiseMaskingTool.h:45
LArCellNoiseMaskingTool.h
Identifier
Definition: IdentifierFieldParser.cxx:14