ATLAS Offline Software
LArNoisyROTool.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // LArNoisyROTool.h
8 // Header file for class LArNoisyROTool
9 // Author: S.Binet<binet@cern.ch>
11 #ifndef LARCELLREC_LARNOISYROTOOL_H
12 #define LARCELLREC_LARNOISYROTOOL_H 1
13 
14 
15 
16 // FrameWork includes
20 
26 
27 // STL includes
28 #include <string>
29 #include <set>
30 #include <array>
31 #include <unordered_map>
32 #include <memory>
33 
34 class LArOnlineID;
35 class CaloCell_ID;
36 class LArOnOffIdMapping;
37 class LArNoisyROSummary;
38 class CaloCellContainer;
39 class LArElectrodeID;
40 class LArHVNMap;
41 
43  virtual public ILArNoisyROTool,
44  public AthAlgTool
45 {
46 
48  // Public methods:
50  public:
51  LArNoisyROTool() = delete;
53  LArNoisyROTool( const std::string& type,
54  const std::string& name,
55  const IInterface* parent );
56 
58  virtual ~LArNoisyROTool() = default;
59 
60  static const InterfaceID& interfaceID();
61 
62  // Athena algtool's Hooks
63  virtual StatusCode initialize();
64 
65  virtual
66  std::unique_ptr<LArNoisyROSummary>
67  process(const EventContext&, const CaloCellContainer*, const std::set<unsigned int>*,
68  const std::vector<HWIdentifier>*, const LArHVNMap*, const CaloDetDescrManager*,
69  const LArHVIdMapping*) const;
70 
71  private:
72 
73  // Containers
74 
75  //enum LARFLAGREASON { BADFEBS=0, MEDIUMSATURATEDQ=1, TIGHTSATURATEDQ=2, BADFEBS_W=3} ;
76 
77  private: // classes
78 
79  // this class accumulates the number of bad channel in a FEB, per preamp in a FEB
80  class FEBEvtStat{
81  public:
82  FEBEvtStat() = default;
83 
84  void addBadChannel(unsigned int channel){
85  m_chanCounter++;
86  unsigned int preamp = channel/4;
87  m_PAcounters[preamp]++;
88  }
89 
90  void resetCounters(){
91  m_chanCounter = 0;
92  for ( size_t i = 0; i < 32; i++ ) m_PAcounters[i] = 0;
93  }
94 
95  unsigned int badChannels() const { return m_chanCounter; }
96  const unsigned int* PAcounters() const { return &m_PAcounters[0]; }
97  private:
98  unsigned int m_chanCounter{};
99  unsigned int m_PAcounters[32]{};
100  };
101 
102  size_t partitionNumber(const HWIdentifier) const;
103  typedef std::unordered_map<unsigned int, FEBEvtStat> FEBEvtStatMap;
105  typedef std::unordered_map<unsigned int, FEBEvtStat>::const_iterator FEBEvtStatMapCstIt;
106  std::unordered_map<unsigned int,unsigned int> m_mapPSFEB;
107  typedef std::unordered_map<HWIdentifier, unsigned int> HVlinesStatMap;
108 
109  private:
110  ToolHandle<ILArHVMapTool> m_hvMapTool;
114  SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey {this, "CablingKey", "LArOnOffIdMap", "key to read OnOff mapping"};
115 
116  //** Qfactor value above which a channel is considered bad */
117  unsigned int m_CellQualityCut{};
118 
119  //** ignore masked cells ? */
121 
122  //** ignore front inner wheel cells ? */
124 
125  //** number of bad channels to declare a preamp noisy */
126  unsigned int m_BadChanPerPA = 0U;
127 
128  //** number of bad channels to declare a FEB noisy */
129  unsigned int m_BadChanPerFEB{};
130 
131  //** min number of bad FEB to put LAr warning in event info */
132  unsigned int m_MinBadFEB{};
133 
134 
135  //** Qfactor value above which (>=) a channel is considered with a saturated Qfactor*/
137 
138  //** Count saturated Qfactor cells above this energy cut (absolute value)*/
140 
141  //** min number of saturated Qfactor cells to declare an event bad */
142  unsigned int m_SaturatedCellTightCut{};
143 
144  //** Count events with too many saturated Qfactor cells */
145  unsigned int m_SaturatedCellTightCutEvents = 0U;
146 
147  //** do HVline flagging
148  bool m_doHVline{};
149 
150  //** fraction of bad cells in one HV line
152 
153  //** min. number of bad HV lines
154  unsigned int m_MinBadHV{};
155  unsigned int m_MNBLooseCut{};
156  unsigned int m_MNBTightCut{};
157  std::vector<unsigned int> m_MNBTight_PsVetoCut;
158  std::array<uint8_t,4> m_partitionMask{};
159 
160 };
161 
162 
163 
164 
165 inline size_t LArNoisyROTool::partitionNumber(const HWIdentifier hwid) const {
166  int pn=m_onlineID->pos_neg(hwid);
167  if (m_onlineID->isEMECchannel(hwid)) {
168  if (pn)
169  return 0; //positive EMECA side
170  else
171  return 3; //negative EMECC side
172  }
173  if (m_onlineID->isEMBchannel(hwid)) {
174  if (pn)
175  return 1; //positive EMBA side
176  else
177  return 2; //negative EMBC side
178  }
179  return 4;//Anything else
180 }
181 
182 #endif //> !LARCELLREC_LARNOISYROTOOL_H
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
LArNoisyROTool::HVlinesStatMap
std::unordered_map< HWIdentifier, unsigned int > HVlinesStatMap
Definition: LArNoisyROTool.h:107
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
LArHVNMap
Definition: LArHVNMap.h:14
LArNoisyROTool::m_SaturatedCellQualityCut
unsigned int m_SaturatedCellQualityCut
Definition: LArNoisyROTool.h:136
ILArNoisyROTool.h
LArElectrodeID
Helper for the Liquid Argon Calorimeter cell at the electrode level.
Definition: LArElectrodeID.h:101
LArNoisyROTool::m_BadChanFracPerHVline
float m_BadChanFracPerHVline
Definition: LArNoisyROTool.h:151
LArNoisyROTool::partitionNumber
size_t partitionNumber(const HWIdentifier) const
Definition: LArNoisyROTool.h:165
LArNoisyROTool::FEBEvtStat::addBadChannel
void addBadChannel(unsigned int channel)
Definition: LArNoisyROTool.h:84
LArNoisyROTool::m_BadChanPerFEB
unsigned int m_BadChanPerFEB
Definition: LArNoisyROTool.h:129
LArNoisyROTool::m_mapPSFEB
std::unordered_map< unsigned int, unsigned int > m_mapPSFEB
Definition: LArNoisyROTool.h:106
LArNoisyROTool::m_ignore_front_innerwheel_cells
bool m_ignore_front_innerwheel_cells
Definition: LArNoisyROTool.h:123
HWIdentifier
Definition: HWIdentifier.h:13
LArNoisyROTool::m_elecID
const LArElectrodeID * m_elecID
Definition: LArNoisyROTool.h:113
LArNoisyROTool::FEBEvtStatMapIt
std::unordered_map< unsigned int, FEBEvtStat >::iterator FEBEvtStatMapIt
Definition: LArNoisyROTool.h:104
LArNoisyROTool::LArNoisyROTool
LArNoisyROTool()=delete
LArNoisyROTool::m_MinBadFEB
unsigned int m_MinBadFEB
Definition: LArNoisyROTool.h:132
LArNoisyROTool::m_hvMapTool
ToolHandle< ILArHVMapTool > m_hvMapTool
Definition: LArNoisyROTool.h:110
LArNoisyROTool::m_ignore_masked_cells
bool m_ignore_masked_cells
Definition: LArNoisyROTool.h:120
python.ZdcRecConfig.pn
pn
Definition: ZdcRecConfig.py:524
LArNoisyROTool::m_SaturatedCellTightCutEvents
unsigned int m_SaturatedCellTightCutEvents
Definition: LArNoisyROTool.h:145
LArNoisyROTool::m_partitionMask
std::array< uint8_t, 4 > m_partitionMask
Definition: LArNoisyROTool.h:158
LArOnlineID::isEMECchannel
bool isEMECchannel(const HWIdentifier id) const override final
Definition: LArOnlineID.cxx:763
LArNoisyROTool::m_CellQualityCut
unsigned int m_CellQualityCut
Definition: LArNoisyROTool.h:117
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LArHVIdMapping.h
AthAlgTool.h
LArNoisyROTool::initialize
virtual StatusCode initialize()
Definition: LArNoisyROTool.cxx:51
test_pyathena.parent
parent
Definition: test_pyathena.py:15
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
LArNoisyROTool::FEBEvtStat::resetCounters
void resetCounters()
Definition: LArNoisyROTool.h:90
LArNoisyROTool::FEBEvtStat::badChannels
unsigned int badChannels() const
Definition: LArNoisyROTool.h:95
CaloCell_ID
Helper class for offline cell identifiers.
Definition: CaloCell_ID.h:34
LArNoisyROTool::FEBEvtStatMapCstIt
std::unordered_map< unsigned int, FEBEvtStat >::const_iterator FEBEvtStatMapCstIt
Definition: LArNoisyROTool.h:105
ILArHVMapTool.h
LArNoisyROTool
Definition: LArNoisyROTool.h:45
LArNoisyROTool::m_MNBTightCut
unsigned int m_MNBTightCut
Definition: LArNoisyROTool.h:156
ReadCondHandleKey.h
LArNoisyROTool::m_SaturatedCellTightCut
unsigned int m_SaturatedCellTightCut
Definition: LArNoisyROTool.h:142
LArNoisyROTool::FEBEvtStat
Definition: LArNoisyROTool.h:80
LArNoisyROTool::m_MinBadHV
unsigned int m_MinBadHV
Definition: LArNoisyROTool.h:154
HWIdentifier.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
LArNoisyROTool::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition: LArNoisyROTool.h:114
LArOnlineID
Definition: LArOnlineID.h:20
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
LArOnlineID_Base::isEMBchannel
bool isEMBchannel(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1648
LArNoisyROTool::FEBEvtStat::PAcounters
const unsigned int * PAcounters() const
Definition: LArNoisyROTool.h:96
SG::ReadCondHandleKey< LArOnOffIdMapping >
LArNoisyROTool::m_MNBLooseCut
unsigned int m_MNBLooseCut
Definition: LArNoisyROTool.h:155
ILArNoisyROTool
Definition: ILArNoisyROTool.h:33
LArHVIdMapping
Definition: LArHVIdMapping.h:21
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition: CaloDetDescrManager.h:473
LArNoisyROTool::m_doHVline
bool m_doHVline
Definition: LArNoisyROTool.h:148
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
LArNoisyROTool::FEBEvtStat::m_PAcounters
unsigned int m_PAcounters[32]
Definition: LArNoisyROTool.h:99
LArNoisyROTool::m_SaturatedCellEnergyTightCut
float m_SaturatedCellEnergyTightCut
Definition: LArNoisyROTool.h:139
LArNoisyROTool::m_BadChanPerPA
unsigned int m_BadChanPerPA
Definition: LArNoisyROTool.h:126
LArNoisyROTool::FEBEvtStatMap
std::unordered_map< unsigned int, FEBEvtStat > FEBEvtStatMap
Definition: LArNoisyROTool.h:103
LArNoisyROTool::process
virtual std::unique_ptr< LArNoisyROSummary > process(const EventContext &, const CaloCellContainer *, const std::set< unsigned int > *, const std::vector< HWIdentifier > *, const LArHVNMap *, const CaloDetDescrManager *, const LArHVIdMapping *) const
Definition: LArNoisyROTool.cxx:89
LArNoisyROTool::FEBEvtStat::m_chanCounter
unsigned int m_chanCounter
Definition: LArNoisyROTool.h:98
LArNoisyROTool::interfaceID
static const InterfaceID & interfaceID()
IOVSvcDefs.h
defines and typedefs for IOVSvc
LArNoisyROTool::~LArNoisyROTool
virtual ~LArNoisyROTool()=default
Destructor:
AthAlgTool
Definition: AthAlgTool.h:26
LArNoisyROTool::m_calo_id
const CaloCell_ID * m_calo_id
Definition: LArNoisyROTool.h:111
LArNoisyROTool::m_onlineID
const LArOnlineID * m_onlineID
Definition: LArNoisyROTool.h:112
LArOnlineID.h
LArNoisyROSummary
Summary information for noisy LAr preamp / FEBs.
Definition: LArNoisyROSummary.h:28
LArNoisyROTool::FEBEvtStat::FEBEvtStat
FEBEvtStat()=default
LArOnOffIdMapping
Definition: LArOnOffIdMapping.h:20
LArNoisyROTool::m_MNBTight_PsVetoCut
std::vector< unsigned int > m_MNBTight_PsVetoCut
Definition: LArNoisyROTool.h:157