ATLAS Offline Software
Loading...
Searching...
No Matches
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
7NAME: LArCellNoiseMaskingTool
8PACKAGE: offline/Calorimeter/LArCellRec
9
10AUTHORS: G.Unal
11CREATION: 4 feb 2009
12
13PURPOSE:
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
79StatusCode
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
LArBadXCont< LArBadChannel > LArBadChannelCont
Container class for CaloCell.
CaloCellContainer::iterator beginCalo(CaloCell_ID::SUBCALO caloNum)
get non const iterators on cell of just one calo
CaloCellContainer::iterator endCalo(CaloCell_ID::SUBCALO caloNum)
CaloCell_Base_ID::SUBCALO SUBCALO
Definition CaloCell_ID.h:50
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
float time() const
get time (data member)
Definition CaloCell.h:368
virtual void setTime(float time)
set time
Definition CaloCell.h:484
double energy() const
get energy (data member)
Definition CaloCell.h:327
uint16_t provenance() const
get provenance (data member)
Definition CaloCell.h:354
uint16_t quality() const
get quality (data member)
Definition CaloCell.h:348
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
DataModel_detail::iterator< DataVector > iterator
Definition DataVector.h:842
LArCellNoiseMaskingTool(const std::string &type, const std::string &name, const IInterface *parent)
Gaudi::Property< std::vector< std::string > > m_problemsToMask
SG::ReadCondHandleKey< LArBadChannelCont > m_bcContKey
virtual StatusCode initialize() override
LArBadChannelMask m_sporadicNoiseMask
virtual StatusCode process(CaloCellContainer *theCellContainer, const EventContext &ctx) const override
Gaudi::Property< std::vector< std::string > > m_sporadicProblemsToMask
MsgStream & msg
Definition testRead.cxx:32